cocotb 1.8.1__cp312-cp312-win32.whl → 1.9.0rc2__cp312-cp312-win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cocotb might be problematic. Click here for more details.

Files changed (79) hide show
  1. cocotb/_version.py +1 -1
  2. cocotb/binary.py +48 -14
  3. cocotb/config.py +10 -16
  4. cocotb/decorators.py +7 -1
  5. cocotb/handle.py +1 -1
  6. cocotb/libs/cocotb.dll +0 -0
  7. cocotb/libs/cocotb.exp +0 -0
  8. cocotb/libs/cocotb.lib +0 -0
  9. cocotb/libs/cocotbfli_modelsim.dll +0 -0
  10. cocotb/libs/cocotbfli_modelsim.exp +0 -0
  11. cocotb/libs/cocotbfli_modelsim.lib +0 -0
  12. cocotb/libs/cocotbutils.dll +0 -0
  13. cocotb/libs/cocotbutils.exp +0 -0
  14. cocotb/libs/cocotbutils.lib +0 -0
  15. cocotb/libs/cocotbvhpi_aldec.dll +0 -0
  16. cocotb/libs/cocotbvhpi_aldec.exp +0 -0
  17. cocotb/libs/cocotbvhpi_aldec.lib +0 -0
  18. cocotb/libs/cocotbvhpi_modelsim.dll +0 -0
  19. cocotb/libs/cocotbvhpi_modelsim.exp +0 -0
  20. cocotb/libs/cocotbvhpi_modelsim.lib +0 -0
  21. cocotb/libs/cocotbvpi_aldec.dll +0 -0
  22. cocotb/libs/cocotbvpi_aldec.exp +0 -0
  23. cocotb/libs/cocotbvpi_aldec.lib +0 -0
  24. cocotb/libs/cocotbvpi_ghdl.dll +0 -0
  25. cocotb/libs/cocotbvpi_ghdl.exp +0 -0
  26. cocotb/libs/cocotbvpi_ghdl.lib +0 -0
  27. cocotb/libs/cocotbvpi_icarus.exp +0 -0
  28. cocotb/libs/cocotbvpi_icarus.lib +0 -0
  29. cocotb/libs/cocotbvpi_icarus.vpl +0 -0
  30. cocotb/libs/cocotbvpi_modelsim.dll +0 -0
  31. cocotb/libs/cocotbvpi_modelsim.exp +0 -0
  32. cocotb/libs/cocotbvpi_modelsim.lib +0 -0
  33. cocotb/libs/embed.dll +0 -0
  34. cocotb/libs/embed.exp +0 -0
  35. cocotb/libs/embed.lib +0 -0
  36. cocotb/libs/gpi.dll +0 -0
  37. cocotb/libs/gpi.exp +0 -0
  38. cocotb/libs/gpi.lib +0 -0
  39. cocotb/libs/gpilog.dll +0 -0
  40. cocotb/libs/gpilog.exp +0 -0
  41. cocotb/libs/gpilog.lib +0 -0
  42. cocotb/libs/pygpilog.dll +0 -0
  43. cocotb/libs/pygpilog.exp +0 -0
  44. cocotb/libs/pygpilog.lib +0 -0
  45. cocotb/runner.py +487 -120
  46. cocotb/scheduler.py +4 -8
  47. cocotb/share/def/aldec.exp +0 -0
  48. cocotb/share/def/aldec.lib +0 -0
  49. cocotb/share/def/ghdl.exp +0 -0
  50. cocotb/share/def/ghdl.lib +0 -0
  51. cocotb/share/def/icarus.exp +0 -0
  52. cocotb/share/def/icarus.lib +0 -0
  53. cocotb/share/def/modelsim.exp +0 -0
  54. cocotb/share/def/modelsim.lib +0 -0
  55. cocotb/share/lib/verilator/verilator.cpp +50 -8
  56. cocotb/share/makefiles/Makefile.inc +4 -10
  57. cocotb/share/makefiles/Makefile.sim +5 -5
  58. cocotb/share/makefiles/simulators/Makefile.activehdl +3 -3
  59. cocotb/share/makefiles/simulators/Makefile.cvc +1 -1
  60. cocotb/share/makefiles/simulators/Makefile.ghdl +29 -1
  61. cocotb/share/makefiles/simulators/Makefile.icarus +4 -4
  62. cocotb/share/makefiles/simulators/Makefile.ius +1 -1
  63. cocotb/share/makefiles/simulators/Makefile.nvc +64 -0
  64. cocotb/share/makefiles/simulators/Makefile.questa +1 -1
  65. cocotb/share/makefiles/simulators/Makefile.riviera +28 -12
  66. cocotb/share/makefiles/simulators/Makefile.vcs +2 -2
  67. cocotb/share/makefiles/simulators/Makefile.verilator +11 -5
  68. cocotb/share/makefiles/simulators/Makefile.xcelium +6 -1
  69. cocotb/simulator.cp312-win32.exp +0 -0
  70. cocotb/simulator.cp312-win32.lib +0 -0
  71. cocotb/simulator.cp312-win32.pyd +0 -0
  72. cocotb/triggers.py +102 -29
  73. {cocotb-1.8.1.dist-info → cocotb-1.9.0rc2.dist-info}/METADATA +3 -3
  74. cocotb-1.9.0rc2.dist-info/RECORD +121 -0
  75. {cocotb-1.8.1.dist-info → cocotb-1.9.0rc2.dist-info}/WHEEL +1 -1
  76. cocotb-1.8.1.dist-info/RECORD +0 -120
  77. {cocotb-1.8.1.dist-info → cocotb-1.9.0rc2.dist-info}/LICENSE +0 -0
  78. {cocotb-1.8.1.dist-info → cocotb-1.9.0rc2.dist-info}/entry_points.txt +0 -0
  79. {cocotb-1.8.1.dist-info → cocotb-1.9.0rc2.dist-info}/top_level.txt +0 -0
cocotb/scheduler.py CHANGED
@@ -33,6 +33,7 @@ FIXME: We have a problem here. If a coroutine schedules a read-only but we
33
33
  also have pending writes we have to schedule the ReadWrite callback before
34
34
  the ReadOnly (and this is invalid, at least in Modelsim).
35
35
  """
36
+
36
37
  import inspect
37
38
  import logging
38
39
  import os
@@ -584,11 +585,6 @@ class Scheduler:
584
585
  except BaseException as e:
585
586
  coro.log.error("Exception raised by this forked coroutine")
586
587
  e = remove_traceback_frames(e, ["_unschedule", "get"])
587
- warnings.warn(
588
- '"Unwatched" tasks that throw exceptions will not cause the test to fail. '
589
- "See issue #2664 for more details.",
590
- FutureWarning,
591
- )
592
588
  self._abort_test(e)
593
589
 
594
590
  def _schedule_write(self, handle, write_func, *args):
@@ -639,7 +635,7 @@ class Scheduler:
639
635
  self._resume_coro_upon(
640
636
  coro,
641
637
  NullTrigger(
642
- name="Trigger.prime() Error", outcome=outcomes.Error(e)
638
+ name="Trigger.prime() Error", _outcome=outcomes.Error(e)
643
639
  ),
644
640
  )
645
641
 
@@ -841,7 +837,7 @@ class Scheduler:
841
837
  self._test = test_coro
842
838
  self._resume_coro_upon(
843
839
  test_coro,
844
- NullTrigger(name=f"Start {test_coro!s}", outcome=outcomes.Value(None)),
840
+ NullTrigger(name=f"Start {test_coro!s}", _outcome=outcomes.Value(None)),
845
841
  )
846
842
 
847
843
  # This collection of functions parses a trigger out of the object
@@ -971,7 +967,7 @@ class Scheduler:
971
967
  except TypeError as exc:
972
968
  # restart this coroutine with an exception object telling it that
973
969
  # it wasn't allowed to yield that
974
- result = NullTrigger(outcome=outcomes.Error(exc))
970
+ result = NullTrigger(_outcome=outcomes.Error(exc))
975
971
 
976
972
  self._resume_coro_upon(coroutine, result)
977
973
 
Binary file
Binary file
cocotb/share/def/ghdl.exp CHANGED
Binary file
cocotb/share/def/ghdl.lib CHANGED
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -2,7 +2,11 @@
2
2
  // Licensed under the Revised BSD License, see LICENSE for details.
3
3
  // SPDX-License-Identifier: BSD-3-Clause
4
4
 
5
- #include <memory>
5
+ #include <libgen.h> // basename
6
+ #include <stdio.h> // stderr, fprintf
7
+
8
+ #include <memory> // std::unique_ptr
9
+ #include <string> // std::string
6
10
 
7
11
  #include "Vtop.h"
8
12
  #include "verilated.h"
@@ -47,6 +51,39 @@ static inline bool settle_value_callbacks() {
47
51
  }
48
52
 
49
53
  int main(int argc, char** argv) {
54
+ bool traceOn = false;
55
+ #if VM_TRACE_FST
56
+ const char* traceFile = "dump.fst";
57
+ #else
58
+ const char* traceFile = "dump.vcd";
59
+ #endif
60
+
61
+ for (int i = 1; i < argc; i++) {
62
+ std::string arg = std::string(argv[i]);
63
+ if (arg == "--trace") {
64
+ traceOn = true;
65
+ } else if (arg == "--trace-file") {
66
+ if (++i < argc) {
67
+ traceFile = argv[i];
68
+ } else {
69
+ fprintf(stderr, "Error: --trace-file requires a parameter\n");
70
+ return -1;
71
+ }
72
+ } else if (arg == "--help") {
73
+ fprintf(stderr,
74
+ "usage: %s [--trace] [--trace-file TRACEFILE]\n"
75
+ "\n"
76
+ "Cocotb + Verilator sim\n"
77
+ "\n"
78
+ "options:\n"
79
+ " --trace Enables tracing (VCD or FST)\n"
80
+ " --trace-file Specifies the trace file name (%s by "
81
+ "default)\n",
82
+ basename(argv[0]), traceFile);
83
+ return 0;
84
+ }
85
+ }
86
+
50
87
  Verilated::commandArgs(argc, argv);
51
88
  #ifdef VERILATOR_SIM_DEBUG
52
89
  Verilated::debug(99);
@@ -62,16 +99,17 @@ int main(int argc, char** argv) {
62
99
  VerilatedVpi::callCbs(cbStartOfSimulation);
63
100
 
64
101
  #if VM_TRACE
65
- Verilated::traceEverOn(true);
66
102
  #if VM_TRACE_FST
67
103
  std::unique_ptr<VerilatedFstC> tfp(new VerilatedFstC);
68
- top->trace(tfp.get(), 99);
69
- tfp->open("dump.fst");
70
104
  #else
71
105
  std::unique_ptr<VerilatedVcdC> tfp(new VerilatedVcdC);
72
- top->trace(tfp.get(), 99);
73
- tfp->open("dump.vcd");
74
106
  #endif
107
+
108
+ if (traceOn) {
109
+ Verilated::traceEverOn(true);
110
+ top->trace(tfp.get(), 99);
111
+ tfp->open(traceFile);
112
+ }
75
113
  #endif
76
114
 
77
115
  while (!Verilated::gotFinish()) {
@@ -107,7 +145,9 @@ int main(int argc, char** argv) {
107
145
  VerilatedVpi::callCbs(cbReadOnlySynch);
108
146
 
109
147
  #if VM_TRACE
110
- tfp->dump(main_time);
148
+ if (traceOn) {
149
+ tfp->dump(main_time);
150
+ }
111
151
  #endif
112
152
  // cocotb controls the clock inputs using cbAfterDelay so
113
153
  // skip ahead to the next registered callback
@@ -140,7 +180,9 @@ int main(int argc, char** argv) {
140
180
  top->final();
141
181
 
142
182
  #if VM_TRACE
143
- tfp->close();
183
+ if (traceOn) {
184
+ tfp->close();
185
+ }
144
186
  #endif
145
187
 
146
188
  // VM_COVERAGE is a define which is set if Verilator is
@@ -37,13 +37,13 @@ COCOTB_MAKEFILE_INC_INCLUDED = 1
37
37
  .PHONY: sim
38
38
  sim:
39
39
  $(RM) $(COCOTB_RESULTS_FILE)
40
- $(MAKE) -f $(firstword $(MAKEFILE_LIST)) $(COCOTB_RESULTS_FILE)
40
+ "$(MAKE)" -f $(firstword $(MAKEFILE_LIST)) $(COCOTB_RESULTS_FILE)
41
41
 
42
42
  # Make sure to use bash for the pipefail option used in many simulator Makefiles
43
43
  SHELL := bash
44
44
 
45
- # Directory containing the cocotb Python module (realpath for Windows compatibility)
46
- COCOTB_PY_DIR := $(realpath $(shell cocotb-config --prefix))
45
+ # Directory containing the cocotb Python module
46
+ COCOTB_PY_DIR := $(shell cocotb-config --prefix)
47
47
 
48
48
  # Directory containing all support files required to build cocotb-based
49
49
  # simulations: Makefile fragments, and the simulator libraries.
@@ -62,13 +62,7 @@ export OS
62
62
  IS_VENV=$(shell $(shell cocotb-config --python-bin) -c 'import sys; print(sys.prefix != sys.base_prefix)')
63
63
 
64
64
  # this ensures we use the same python as the one cocotb was installed into
65
- ifeq ($(IS_VENV),True)
66
- # In a virtual environment, the Python binary may be a symlink, so it should not use realpath
67
- PYTHON_BIN ?= $(shell cocotb-config --python-bin)
68
- else
69
- # realpath to convert windows paths to unix paths, like cygpath -u
70
- PYTHON_BIN ?= $(realpath $(shell cocotb-config --python-bin))
71
- endif
65
+ PYTHON_BIN ?= $(shell cocotb-config --python-bin)
72
66
 
73
67
  include $(COCOTB_SHARE_DIR)/makefiles/Makefile.deprecations
74
68
 
@@ -57,10 +57,10 @@ SIM Selects which simulator Makefile to use
57
57
  WAVES Enable wave traces dump for Riviera-PRO and Questa
58
58
  VERILOG_SOURCES A list of the Verilog source files to include
59
59
  VHDL_SOURCES A list of the VHDL source files to include
60
- VHDL_SOURCES_<lib> VHDL source files to include in *lib* (GHDL/ModelSim/Questa/Xcelium/Incisive only)
61
- VHDL_LIB_ORDER Compilation order of VHDL libraries (needed for ModelSim/Questa/Xcelium/Incisive)
60
+ VHDL_SOURCES_<lib> VHDL source files to include in *lib* (GHDL/NVC/ModelSim/Questa/Xcelium/Incisive/Riviera-PRO only)
61
+ VHDL_LIB_ORDER Compilation order of VHDL libraries (needed for NVC/ModelSim/Questa/Xcelium/Incisive/Riviera-PRO)
62
62
  SIM_CMD_PREFIX Prefix for simulation command invocations
63
- COMPILE_ARGS Arguments to pass to compile stage of simulation
63
+ COMPILE_ARGS Arguments to pass to compile (analysis) stage of simulation
64
64
  SIM_ARGS Arguments to pass to execution of compiled simulation
65
65
  EXTRA_ARGS Arguments for compile and execute phases
66
66
  PLUSARGS Plusargs to pass to the simulator
@@ -98,8 +98,8 @@ SIM ?= icarus
98
98
  # Maintain backwards compatibility by supporting upper and lower case SIM variable
99
99
  SIM_LOWERCASE := $(shell echo $(SIM) | tr A-Z a-z)
100
100
 
101
- # Directory containing the cocotb Makfiles (realpath for Windows compatibility)
102
- COCOTB_MAKEFILES_DIR := $(realpath $(shell cocotb-config --makefiles))
101
+ # Directory containing the cocotb Makfiles
102
+ COCOTB_MAKEFILES_DIR := $(shell cocotb-config --makefiles)
103
103
 
104
104
  include $(COCOTB_MAKEFILES_DIR)/Makefile.deprecations
105
105
 
@@ -9,7 +9,7 @@ include $(shell cocotb-config --makefiles)/Makefile.inc
9
9
  CMD_BIN := vsimsa
10
10
 
11
11
  ifdef ACTIVEHDL_BIN_DIR
12
- CMD := $(shell :; command -v $(realpath $(ACTIVEHDL_BIN_DIR))/$(CMD_BIN) 2>/dev/null)
12
+ CMD := $(shell :; command -v $(ACTIVEHDL_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
13
13
  else
14
14
  # auto-detect bin dir from system path
15
15
  CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
@@ -54,7 +54,7 @@ endif
54
54
  ifneq ($(VERILOG_SOURCES),)
55
55
  @echo "alog $(ALOG_ARGS) $(call to_tcl_path,$(VERILOG_SOURCES))" >> $@
56
56
  endif
57
- @echo "asim $(ASIM_ARGS) $(PLUSARGS) +access +w -interceptcoutput -O2 -dbg $(GPI_ARGS) $(TOPLEVEL) $(EXTRA_TOPS)" >> $@
57
+ @echo "asim $(ASIM_ARGS) $(PLUSARGS) +access +w_nets -interceptcoutput $(GPI_ARGS) $(TOPLEVEL) $(EXTRA_TOPS)" >> $@
58
58
  @echo "run -all" >> $@
59
59
  @echo "endsim" >> $@
60
60
 
@@ -62,7 +62,7 @@ $(COCOTB_RESULTS_FILE): $(SIM_BUILD)/runsim.do $(CUSTOM_COMPILE_DEPS) $(CUSTOM_S
62
62
  $(RM) $(COCOTB_RESULTS_FILE)
63
63
 
64
64
  set -o pipefail; GPI_EXTRA=$(GPI_EXTRA) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
65
- MODULE=$(MODULE) TESTCASE=$(TESTCASE) TOPLEVEL=$(TOPLEVEL) $(SIM_CMD_PREFIX) $(CMD) $(RUN_ARGS) -do $(SIM_BUILD)/runsim.do | tee $(SIM_BUILD)/sim.log
65
+ MODULE=$(MODULE) TESTCASE=$(TESTCASE) TOPLEVEL=$(TOPLEVEL) $(SIM_CMD_PREFIX) $(CMD) $(RUN_ARGS) -do $(SIM_BUILD)/runsim.do $(SIM_CMD_SUFFIX)
66
66
 
67
67
  $(call check_for_results_file)
68
68
 
@@ -72,7 +72,7 @@ else
72
72
  $(COCOTB_RESULTS_FILE): $(SIM_BUILD)/sim.vvp $(CUSTOM_SIM_DEPS)
73
73
  MODULE=$(MODULE) \
74
74
  TESTCASE=$(TESTCASE) TOPLEVEL=$(TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
75
- $(SIM_CMD_PREFIX) $(SIM_BUILD)/sim.vvp $(SIM_ARGS) $(EXTRA_ARGS) $(PLUSARGS)
75
+ $(SIM_CMD_PREFIX) $(SIM_BUILD)/sim.vvp $(SIM_ARGS) $(EXTRA_ARGS) $(PLUSARGS) $(SIM_CMD_SUFFIX)
76
76
  endif
77
77
 
78
78
  # Execution phase
@@ -63,6 +63,34 @@ ifeq ($(OS),Msys)
63
63
  export PATH := $(GHDL_BIN_DIR)/../lib:$(PATH)
64
64
  endif
65
65
 
66
+ GHDL_RUN_ARGS ?=
67
+
68
+ ifeq ($(shell $(CMD) --version | grep -q mcode; echo $$?),0)
69
+ ifneq ($(COCOTB_HDL_TIMEPRECISION),)
70
+ # Convert the time precision to a format string supported by GHDL, if
71
+ # possible.
72
+ # GHDL only supports setting the time precision if the mcode backend is
73
+ # used, using the --time-resolution argument causes GHDL to error out
74
+ # otherwise.
75
+ # https://ghdl.github.io/ghdl/using/InvokingGHDL.html#cmdoption-ghdl-time-resolution
76
+ ifeq ($(COCOTB_HDL_TIMEPRECISION),1fs)
77
+ GHDL_TIME_RESOLUTION=fs
78
+ else ifeq ($(COCOTB_HDL_TIMEPRECISION),1ps)
79
+ GHDL_TIME_RESOLUTION=ps
80
+ else ifeq ($(COCOTB_HDL_TIMEPRECISION),1us)
81
+ GHDL_TIME_RESOLUTION=us
82
+ else ifeq ($(COCOTB_HDL_TIMEPRECISION),1ms)
83
+ GHDL_TIME_RESOLUTION=ms
84
+ else ifeq ($(COCOTB_HDL_TIMEPRECISION),1s)
85
+ GHDL_TIME_RESOLUTION=sec
86
+ else
87
+ $(error GHDL only supports the following values for COCOTB_HDL_TIMEPRECISION: 1fs, 1ps, 1us, 1ms, 1s)
88
+ endif
89
+
90
+ GHDL_RUN_ARGS += --time-resolution=$(GHDL_TIME_RESOLUTION)
91
+ endif
92
+ endif
93
+
66
94
  .PHONY: analyse
67
95
 
68
96
  # Compilation phase
@@ -76,7 +104,7 @@ $(COCOTB_RESULTS_FILE): analyse $(CUSTOM_SIM_DEPS)
76
104
  $(RM) $(COCOTB_RESULTS_FILE)
77
105
 
78
106
  MODULE=$(MODULE) TESTCASE=$(TESTCASE) TOPLEVEL=$(TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
79
- $(SIM_CMD_PREFIX) $(CMD) -r $(GHDL_ARGS) --workdir=$(SIM_BUILD) -P$(SIM_BUILD) --work=$(RTL_LIBRARY) $(TOPLEVEL) --vpi=$(shell cocotb-config --lib-name-path vpi ghdl) $(SIM_ARGS) $(PLUSARGS)
107
+ $(SIM_CMD_PREFIX) $(CMD) -r $(GHDL_ARGS) $(GHDL_RUN_ARGS) --workdir=$(SIM_BUILD) -P$(SIM_BUILD) --work=$(RTL_LIBRARY) $(TOPLEVEL) $(ARCH) --vpi=$(shell cocotb-config --lib-name-path vpi ghdl) $(SIM_ARGS) $(PLUSARGS) $(SIM_CMD_SUFFIX)
80
108
 
81
109
  $(call check_for_results_file)
82
110
 
@@ -62,7 +62,7 @@ else
62
62
  TOPMODULE_ARG :=
63
63
  endif
64
64
 
65
- COMPILE_ARGS += -f $(SIM_BUILD)/cmds.f -g2012 # Default to latest SystemVerilog standard
65
+ COMPILE_ARGS += -f $(SIM_BUILD)/cmds.f
66
66
 
67
67
  ifdef VERILOG_INCLUDE_DIRS
68
68
  COMPILE_ARGS += $(addprefix -I, $(VERILOG_INCLUDE_DIRS))
@@ -78,7 +78,7 @@ endif
78
78
 
79
79
  $(SIM_BUILD)/sim.vvp: $(VERILOG_SOURCES) $(CUSTOM_COMPILE_DEPS) | $(SIM_BUILD)
80
80
  @echo "+timescale+$(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION)" > $(SIM_BUILD)/cmds.f
81
- $(CMD) -o $(SIM_BUILD)/sim.vvp -D COCOTB_SIM=1 $(TOPMODULE_ARG) $(COMPILE_ARGS) $(EXTRA_ARGS) $(VERILOG_SOURCES)
81
+ $(CMD) -o $(SIM_BUILD)/sim.vvp -D COCOTB_SIM=1 $(TOPMODULE_ARG) -g2012 $(COMPILE_ARGS) $(EXTRA_ARGS) $(VERILOG_SOURCES)
82
82
 
83
83
  $(SIM_BUILD)/cocotb_iverilog_dump.v: | $(SIM_BUILD)
84
84
  @echo 'module cocotb_iverilog_dump();' > $@
@@ -94,7 +94,7 @@ $(COCOTB_RESULTS_FILE): $(SIM_BUILD)/sim.vvp $(CUSTOM_SIM_DEPS)
94
94
  $(RM) $(COCOTB_RESULTS_FILE)
95
95
 
96
96
  MODULE=$(MODULE) TESTCASE=$(TESTCASE) TOPLEVEL=$(TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
97
- $(SIM_CMD_PREFIX) $(ICARUS_BIN_DIR)/vvp -M $(shell cocotb-config --lib-dir) -m $(shell cocotb-config --lib-name vpi icarus) $(SIM_ARGS) $(EXTRA_ARGS) $(SIM_BUILD)/sim.vvp $(PLUSARGS)
97
+ $(SIM_CMD_PREFIX) $(ICARUS_BIN_DIR)/vvp -M $(shell cocotb-config --lib-dir) -m $(shell cocotb-config --lib-name vpi icarus) $(SIM_ARGS) $(EXTRA_ARGS) $(SIM_BUILD)/sim.vvp $(PLUSARGS) $(SIM_CMD_SUFFIX)
98
98
 
99
99
  $(call check_for_results_file)
100
100
 
@@ -102,7 +102,7 @@ debug: $(SIM_BUILD)/sim.vvp $(CUSTOM_SIM_DEPS)
102
102
  $(RM) -r $(COCOTB_RESULTS_FILE)
103
103
 
104
104
  MODULE=$(MODULE) TESTCASE=$(TESTCASE) TOPLEVEL=$(TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
105
- $(SIM_CMD_PREFIX) gdb --args $(ICARUS_BIN_DIR)/vvp $(shell cocotb-config --lib-dir) -m $(shell cocotb-config --lib-name vpi icarus) $(SIM_BUILD)/sim.vvp $(SIM_ARGS) $(EXTRA_ARGS) $(PLUSARGS)
105
+ $(SIM_CMD_PREFIX) gdb --args $(ICARUS_BIN_DIR)/vvp $(shell cocotb-config --lib-dir) -m $(shell cocotb-config --lib-name vpi icarus) $(SIM_BUILD)/sim.vvp $(SIM_ARGS) $(EXTRA_ARGS) $(PLUSARGS) $(SIM_CMD_SUFFIX)
106
106
 
107
107
  $(call check_for_results_file)
108
108
 
@@ -114,7 +114,7 @@ $(COCOTB_RESULTS_FILE): $(HDL_SOURCES) $(CUSTOM_COMPILE_DEPS) $(CUSTOM_SIM_DEPS)
114
114
  set -o pipefail; \
115
115
  MODULE=$(MODULE) TESTCASE=$(TESTCASE) TOPLEVEL=$(TOPLEVEL) GPI_EXTRA=$(GPI_EXTRA) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
116
116
  $(SIM_CMD_PREFIX) $(CMD) -timescale $(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION) \
117
- $(EXTRA_ARGS) $(GPI_ARGS) +access+rwc $(LIBS) $(MAKE_LIB) $(HDL_SOURCES) $(PLUSARGS) 2>&1 | tee $(SIM_BUILD)/sim.log
117
+ $(EXTRA_ARGS) $(GPI_ARGS) +access+rwc $(LIBS) $(MAKE_LIB) $(HDL_SOURCES) $(PLUSARGS) $(SIM_CMD_SUFFIX)
118
118
 
119
119
  $(call check_for_results_file)
120
120
 
@@ -0,0 +1,64 @@
1
+ # Copyright cocotb contributors
2
+ # Licensed under the Revised BSD License, see LICENSE for details.
3
+ # SPDX-License-Identifier: BSD-3-Clause
4
+
5
+ include $(shell cocotb-config --makefiles)/Makefile.inc
6
+
7
+ ifneq ($(VERILOG_SOURCES),)
8
+
9
+ $(COCOTB_RESULTS_FILE):
10
+ @echo "Skipping simulation as Verilog is not supported on simulator=$(SIM)"
11
+ clean::
12
+
13
+ else
14
+
15
+ CMD_BIN := nvc
16
+
17
+ ifdef NVC_BIN_DIR
18
+ CMD := $(shell :; command -v $(NVC_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
19
+ else
20
+ # auto-detect bin dir from system path
21
+ CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
22
+ endif
23
+
24
+ ifeq (, $(CMD))
25
+ $(error "Unable to locate command >$(CMD_BIN)<")
26
+ else
27
+ NVC_BIN_DIR := $(shell dirname $(CMD))
28
+ export NVC_BIN_DIR
29
+ endif
30
+
31
+ RTL_LIBRARY ?= work
32
+
33
+ .PHONY: analyse
34
+
35
+ # Split SIM_ARGS into those options that need to be passed to -e and
36
+ # those that need to be passed to -r
37
+ NVC_E_FILTER := -g% --cover --cover=%
38
+
39
+ NVC_E_ARGS := $(filter $(NVC_E_FILTER),$(SIM_ARGS))
40
+ NVC_R_ARGS := $(filter-out $(NVC_E_FILTER),$(SIM_ARGS))
41
+
42
+ # Compilation phase
43
+ analyse: $(VHDL_SOURCES) $(SIM_BUILD) $(CUSTOM_COMPILE_DEPS)
44
+ # Make sure all libs in SOURCES_VHDL_* are mentioned in VHDL_LIB_ORDER and vice versa
45
+ $(foreach LIB, $(VHDL_LIB_ORDER), $(check_vhdl_sources))
46
+ $(foreach SOURCES_VAR, $(filter VHDL_SOURCES_%, $(.VARIABLES)), $(check_lib_order))
47
+
48
+ $(foreach LIB_VAR,$(VHDL_LIB_ORDER), \
49
+ $(CMD) $(EXTRA_ARGS) --work=$(LIB_VAR):$(SIM_BUILD)/$(LIB_VAR) -L $(SIM_BUILD) -a $(VHDL_SOURCES_$(LIB_VAR)) $(COMPILE_ARGS) && ) \
50
+ $(CMD) $(EXTRA_ARGS) --work=$(RTL_LIBRARY):$(SIM_BUILD)/$(RTL_LIBRARY) -L $(SIM_BUILD) -a $(VHDL_SOURCES) $(COMPILE_ARGS)
51
+
52
+ $(COCOTB_RESULTS_FILE): analyse $(CUSTOM_SIM_DEPS)
53
+ $(RM) $(COCOTB_RESULTS_FILE)
54
+
55
+ TESTCASE=$(TESTCASE) MODULE=$(MODULE) TOPLEVEL=$(TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
56
+ $(SIM_CMD_PREFIX) $(CMD) $(EXTRA_ARGS) --work=$(RTL_LIBRARY):$(SIM_BUILD)/$(RTL_LIBRARY) -L $(SIM_BUILD) \
57
+ -e $(TOPLEVEL) --no-save $(NVC_E_ARGS) \
58
+ -r --load $(shell cocotb-config --lib-name-path vhpi nvc) $(TRACE) $(NVC_R_ARGS) $(PLUSARGS) $(SIM_CMD_SUFFIX)
59
+
60
+ $(call check_for_results_file)
61
+
62
+ clean::
63
+ $(RM) -r $(SIM_BUILD)
64
+ endif
@@ -160,7 +160,7 @@ $(COCOTB_RESULTS_FILE): $(SIM_BUILD)/runsim.do
160
160
 
161
161
  set -o pipefail; MODULE=$(MODULE) TESTCASE=$(TESTCASE) TOPLEVEL=$(TOPLEVEL) \
162
162
  GPI_EXTRA=$(GPI_EXTRA) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
163
- $(SIM_CMD_PREFIX) $(CMD) $(RUN_ARGS) -do $(SIM_BUILD)/runsim.do $(PLUSARGS) 2>&1 | tee $(SIM_BUILD)/sim.log
163
+ $(SIM_CMD_PREFIX) $(CMD) $(RUN_ARGS) -do $(SIM_BUILD)/runsim.do $(PLUSARGS) $(SIM_CMD_SUFFIX)
164
164
 
165
165
  $(call check_for_results_file)
166
166
 
@@ -69,9 +69,11 @@ ASIM_ARGS += $(SIM_ARGS)
69
69
  # Plusargs need to be passed to ASIM command not vsimsa
70
70
  ASIM_ARGS += $(PLUSARGS)
71
71
 
72
- RTL_LIBRARY ?= $(SIM_BUILD)/work
73
- ALOG_ARGS += +define+COCOTB_SIM -dbg -pli libgpi
74
- ACOM_ARGS += -dbg
72
+ RTL_LIBRARY ?= work
73
+ ALOG_ARGS += +define+COCOTB_SIM
74
+
75
+ # Pass the VPI library to the Verilog compilation to get extended checking.
76
+ ALOG_ARGS += -pli $(shell cocotb-config --lib-name-path vpi riviera)
75
77
 
76
78
  # Aldec-specific coverage types:
77
79
  # - (s)tatement
@@ -84,8 +86,10 @@ ACOM_ARGS += -dbg
84
86
  # Documentation: Riviera Pro 2017.02 Documentation - Page 359
85
87
  COVERAGE_TYPES ?= sb
86
88
  ifeq ($(COVERAGE),1)
87
- ASIM_ARGS += -acdb -acdb_cov $(COVERAGE_TYPES)
88
- ALOG_ARGS += -coverage $(COVERAGE_TYPES)
89
+ ALOG_ARGS += -dbg -coverage $(COVERAGE_TYPES)
90
+ ACOM_ARGS += -dbg -coverage $(COVERAGE_TYPES)
91
+
92
+ ASIM_ARGS += -dbg -acdb -acdb_cov $(COVERAGE_TYPES)
89
93
  endif
90
94
 
91
95
  GPI_EXTRA:=
@@ -105,30 +109,41 @@ else
105
109
  $(error A valid value (verilog or vhdl) was not provided for TOPLEVEL_LANG=$(TOPLEVEL_LANG))
106
110
  endif
107
111
 
112
+ define make_lib
113
+ echo "if [file exists $(SIM_BUILD)/$(LIB)] {adel -lib $(SIM_BUILD)/$(LIB) -all}" >> $@;
114
+ echo "alib $(SIM_BUILD)/$(LIB)" >> $@;
115
+ echo "amap $(LIB) $(SIM_BUILD)/$(LIB)" >> $@;
116
+ echo "acom -work $(LIB) $(VCOM_ARGS) $(call to_tcl_path,$(VHDL_SOURCES_$(LIB)))" >> $@;
117
+ endef
118
+
108
119
  # Create a TCL script based on the list of $(VERILOG_SOURCES)
109
120
  $(SIM_BUILD)/runsim.tcl : $(VERILOG_SOURCES) $(VHDL_SOURCES) | $(SIM_BUILD)
110
121
  @echo "onerror {" > $@
111
122
  @echo " puts [read [open sim.log r]]" >> $@
112
123
  @echo " quit -code 1" >> $@
113
124
  @echo "}" >> $@
125
+ @echo "amap -c" >> $@
126
+ $(foreach LIB, $(VHDL_LIB_ORDER), $(make_lib))
114
127
  @echo "@if [string length [array get env LICENSE_QUEUE]] {" >> $@
115
128
  @echo " set LICENSE_QUEUE $$::env(LICENSE_QUEUE)" >> $@
116
129
  @echo "}" >> $@
117
- @echo "alib $(RTL_LIBRARY)" >> $@
118
- @echo "set worklib $(RTL_LIBRARY)" >> $@
130
+ @echo "if [file exists $(SIM_BUILD)/$(RTL_LIBRARY)] {adel -lib $(SIM_BUILD)/$(RTL_LIBRARY) -all}" >> $@;
131
+ @echo "alib $(SIM_BUILD)/$(RTL_LIBRARY)" >> $@
132
+ @echo "amap $(RTL_LIBRARY) $(SIM_BUILD)/$(RTL_LIBRARY)" >> $@;
133
+ @echo "set worklib $(RTL_LIBRARY)" >> $@;
119
134
  ifneq ($(VHDL_SOURCES),)
120
- @echo "acom $(ACOM_ARGS) $(call to_tcl_path,$(VHDL_SOURCES))" >> $@
135
+ @echo "acom -work $(RTL_LIBRARY) $(ACOM_ARGS) $(call to_tcl_path,$(VHDL_SOURCES))" >> $@
121
136
  endif
122
137
  ifneq ($(VERILOG_SOURCES),)
123
- @echo "alog $(ALOG_ARGS) $(call to_tcl_path,$(VERILOG_SOURCES))" >> $@
138
+ @echo "alog -work $(RTL_LIBRARY) $(ALOG_ARGS) $(call to_tcl_path,$(VERILOG_SOURCES))" >> $@
124
139
  endif
125
140
  ifdef SCRIPT_FILE
126
141
  @echo "do $(SCRIPT_FILE)" >> $@
127
142
  endif
128
143
  ifneq ($(CFG_TOPLEVEL),)
129
- @echo "asim $(ASIM_ARGS) +access +w -interceptcoutput -O2 -dbg $(GPI_ARGS) $(CFG_TOPLEVEL) $(EXTRA_TOPS)" >> $@
144
+ @echo "asim $(ASIM_ARGS) +access +w_nets -interceptcoutput $(GPI_ARGS) $(CFG_TOPLEVEL) $(EXTRA_TOPS)" >> $@
130
145
  else
131
- @echo "asim $(ASIM_ARGS) +access +w -interceptcoutput -O2 -dbg $(GPI_ARGS) $(TOPLEVEL) $(EXTRA_TOPS)" >> $@
146
+ @echo "asim $(ASIM_ARGS) +access +w_nets -interceptcoutput $(GPI_ARGS) $(TOPLEVEL) $(EXTRA_TOPS)" >> $@
132
147
  endif
133
148
  ifeq ($(WAVES),1)
134
149
  @echo "log -recursive *" >> $@
@@ -142,6 +157,7 @@ ifeq ($(COVERAGE),1)
142
157
  @echo "acdb report -cov $(COVERAGE_TYPES) -db $(RTL_LIBRARY).acdb -html -o coverage/acdb_report.html" >> $@
143
158
  @echo "acdb report -cov $(COVERAGE_TYPES) -db $(RTL_LIBRARY).acdb -txt -o coverage/acdb_report.txt" >> $@
144
159
  endif
160
+ @echo "exit" >> $@
145
161
  endif
146
162
 
147
163
  # Note it's the redirection of the output rather than the 'do' command
@@ -150,7 +166,7 @@ $(COCOTB_RESULTS_FILE): $(SIM_BUILD)/runsim.tcl $(CUSTOM_COMPILE_DEPS) $(CUSTOM_
150
166
  $(RM) $(COCOTB_RESULTS_FILE)
151
167
 
152
168
  set -o pipefail; GPI_EXTRA=$(GPI_EXTRA) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
153
- MODULE=$(MODULE) TESTCASE=$(TESTCASE) TOPLEVEL=$(TOPLEVEL) $(SIM_CMD_PREFIX) $(CMD) $(RUN_ARGS) -do $(SIM_BUILD)/runsim.tcl | tee $(SIM_BUILD)/sim.log
169
+ MODULE=$(MODULE) TESTCASE=$(TESTCASE) TOPLEVEL=$(TOPLEVEL) $(SIM_CMD_PREFIX) $(CMD) $(RUN_ARGS) -do $(SIM_BUILD)/runsim.tcl $(SIM_CMD_SUFFIX)
154
170
 
155
171
  $(call check_for_results_file)
156
172
 
@@ -77,7 +77,7 @@ $(SIM_BUILD)/pli.tab : | $(SIM_BUILD)
77
77
  $(SIM_BUILD)/simv: $(VERILOG_SOURCES) $(SIM_BUILD)/pli.tab $(CUSTOM_COMPILE_DEPS) | $(SIM_BUILD)
78
78
  cd $(SIM_BUILD) && \
79
79
  TOPLEVEL=$(TOPLEVEL) \
80
- $(CMD) -top $(TOPLEVEL) $(PLUSARGS) +acc+1 +vpi -P pli.tab +define+COCOTB_SIM=1 -sverilog \
80
+ $(CMD) -top $(TOPLEVEL) $(PLUSARGS) -debug_access+r+w-memcbk -debug_region+cell +vpi -P pli.tab +define+COCOTB_SIM=1 -sverilog \
81
81
  -timescale=$(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION) \
82
82
  $(EXTRA_ARGS) -debug -load $(shell cocotb-config --lib-name-path vpi vcs) $(COMPILE_ARGS) $(VERILOG_SOURCES)
83
83
 
@@ -86,7 +86,7 @@ $(COCOTB_RESULTS_FILE): $(SIM_BUILD)/simv $(CUSTOM_SIM_DEPS)
86
86
  $(RM) $(COCOTB_RESULTS_FILE)
87
87
 
88
88
  MODULE=$(MODULE) TESTCASE=$(TESTCASE) TOPLEVEL=$(TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
89
- $(SIM_CMD_PREFIX) $(SIM_BUILD)/simv +define+COCOTB_SIM=1 $(SIM_ARGS) $(EXTRA_ARGS) $(PLUSARGS)
89
+ $(SIM_CMD_PREFIX) $(SIM_BUILD)/simv +define+COCOTB_SIM=1 $(SIM_ARGS) $(EXTRA_ARGS) $(PLUSARGS) $(SIM_CMD_SUFFIX)
90
90
 
91
91
  $(call check_for_results_file)
92
92
 
@@ -15,11 +15,17 @@ clean::
15
15
 
16
16
  else
17
17
 
18
- CMD := verilator
18
+ CMD_BIN := verilator
19
19
 
20
- ifeq ($(shell which $(CMD) 2>/dev/null),)
21
- # Verilator is not in PATH, lets start searching for it
22
- $(error Cannot find verilator.)
20
+ ifdef VERILATOR_BIN_DIR
21
+ CMD := $(shell :; command -v $(VERILATOR_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
22
+ else
23
+ # auto-detect bin dir from system path
24
+ CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
25
+ endif
26
+
27
+ ifeq (, $(CMD))
28
+ $(error Unable to locate command >$(CMD_BIN)<)
23
29
  endif
24
30
 
25
31
  VLT_MIN := 4.106
@@ -64,7 +70,7 @@ $(COCOTB_RESULTS_FILE): $(SIM_BUILD)/Vtop $(CUSTOM_SIM_DEPS)
64
70
  $(RM) $(COCOTB_RESULTS_FILE)
65
71
 
66
72
  MODULE=$(MODULE) TESTCASE=$(TESTCASE) TOPLEVEL=$(TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
67
- $(SIM_CMD_PREFIX) $< $(PLUSARGS)
73
+ $(SIM_CMD_PREFIX) $< $(PLUSARGS) $(SIM_CMD_SUFFIX)
68
74
 
69
75
  $(call check_for_results_file)
70
76
 
@@ -97,8 +97,12 @@ ifeq ($(TOPLEVEL_LANG),verilog)
97
97
  else ifeq ($(TOPLEVEL_LANG),vhdl)
98
98
  GPI_EXTRA = $(shell cocotb-config --lib-name-path vhpi xcelium):cocotbvhpi_entry_point
99
99
  EXTRA_ARGS += -top $(TOPLEVEL)
100
+ # Xcelium 23.09.004 fixes cocotb issue #1076 as long as the following define
101
+ # is set.
102
+ EXTRA_ARGS += -NEW_VHPI_PROPAGATE_DELAY
100
103
  RTL_LIBRARY ?= $(TOPLEVEL)
101
104
  MAKE_LIB = -makelib $(RTL_LIBRARY)
105
+ END_LIB = -endlib
102
106
  HDL_SOURCES = $(VHDL_SOURCES)
103
107
  ifneq ($(VERILOG_SOURCES),)
104
108
  HDL_SOURCES += $(VERILOG_SOURCES)
@@ -120,7 +124,8 @@ $(COCOTB_RESULTS_FILE): $(HDL_SOURCES) $(CUSTOM_COMPILE_DEPS) $(CUSTOM_SIM_DEPS)
120
124
  set -o pipefail; \
121
125
  MODULE=$(MODULE) TESTCASE=$(TESTCASE) TOPLEVEL=$(TOPLEVEL) GPI_EXTRA=$(GPI_EXTRA) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
122
126
  $(SIM_CMD_PREFIX) $(CMD) -timescale $(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION) \
123
- $(EXTRA_ARGS) $(GPI_ARGS) $(INCDIRS) -access +rwc -createdebugdb $(LIBS) $(MAKE_LIB) $(HDL_SOURCES) $(PLUSARGS) 2>&1 | tee $(SIM_BUILD)/sim.log
127
+ -vhdl_time_precision "$(COCOTB_HDL_TIMEPRECISION)" \
128
+ $(EXTRA_ARGS) $(GPI_ARGS) $(INCDIRS) -access +rwc -createdebugdb $(LIBS) $(MAKE_LIB) $(HDL_SOURCES) $(END_LIB) $(PLUSARGS) $(SIM_CMD_SUFFIX)
124
129
 
125
130
  $(call check_for_results_file)
126
131
 
Binary file
Binary file
Binary file