cocotb 2.0.0rc2__cp313-cp313-macosx_11_0_arm64.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 (115) hide show
  1. cocotb/_ANSI.py +65 -0
  2. cocotb/__init__.py +125 -0
  3. cocotb/_base_triggers.py +515 -0
  4. cocotb/_bridge.py +186 -0
  5. cocotb/_decorators.py +515 -0
  6. cocotb/_deprecation.py +36 -0
  7. cocotb/_exceptions.py +7 -0
  8. cocotb/_extended_awaitables.py +419 -0
  9. cocotb/_gpi_triggers.py +385 -0
  10. cocotb/_init.py +301 -0
  11. cocotb/_outcomes.py +54 -0
  12. cocotb/_profiling.py +46 -0
  13. cocotb/_py_compat.py +148 -0
  14. cocotb/_scheduler.py +448 -0
  15. cocotb/_test.py +248 -0
  16. cocotb/_test_factory.py +312 -0
  17. cocotb/_test_functions.py +42 -0
  18. cocotb/_typing.py +7 -0
  19. cocotb/_utils.py +274 -0
  20. cocotb/_version.py +4 -0
  21. cocotb/_xunit_reporter.py +66 -0
  22. cocotb/clock.py +419 -0
  23. cocotb/debug.py +24 -0
  24. cocotb/handle.py +1752 -0
  25. cocotb/libs/libcocotb.so +0 -0
  26. cocotb/libs/libcocotbfli_modelsim.so +0 -0
  27. cocotb/libs/libcocotbutils.so +0 -0
  28. cocotb/libs/libcocotbvhpi_aldec.so +0 -0
  29. cocotb/libs/libcocotbvhpi_ius.so +0 -0
  30. cocotb/libs/libcocotbvhpi_modelsim.so +0 -0
  31. cocotb/libs/libcocotbvhpi_nvc.so +0 -0
  32. cocotb/libs/libcocotbvpi_aldec.so +0 -0
  33. cocotb/libs/libcocotbvpi_dsim.so +0 -0
  34. cocotb/libs/libcocotbvpi_ghdl.so +0 -0
  35. cocotb/libs/libcocotbvpi_icarus.vpl +0 -0
  36. cocotb/libs/libcocotbvpi_ius.so +0 -0
  37. cocotb/libs/libcocotbvpi_modelsim.so +0 -0
  38. cocotb/libs/libcocotbvpi_vcs.so +0 -0
  39. cocotb/libs/libcocotbvpi_verilator.so +0 -0
  40. cocotb/libs/libembed.so +0 -0
  41. cocotb/libs/libgpi.so +0 -0
  42. cocotb/libs/libgpilog.so +0 -0
  43. cocotb/libs/libpygpilog.so +0 -0
  44. cocotb/logging.py +424 -0
  45. cocotb/py.typed +0 -0
  46. cocotb/queue.py +225 -0
  47. cocotb/regression.py +896 -0
  48. cocotb/result.py +38 -0
  49. cocotb/share/def/.gitignore +2 -0
  50. cocotb/share/def/README.md +4 -0
  51. cocotb/share/def/aldec.def +61 -0
  52. cocotb/share/def/ghdl.def +43 -0
  53. cocotb/share/def/icarus.def +43 -0
  54. cocotb/share/def/modelsim.def +138 -0
  55. cocotb/share/include/cocotb_utils.h +70 -0
  56. cocotb/share/include/embed.h +33 -0
  57. cocotb/share/include/exports.h +20 -0
  58. cocotb/share/include/gpi.h +459 -0
  59. cocotb/share/include/gpi_logging.h +291 -0
  60. cocotb/share/include/py_gpi_logging.h +33 -0
  61. cocotb/share/include/vhpi_user_ext.h +26 -0
  62. cocotb/share/include/vpi_user_ext.h +33 -0
  63. cocotb/share/lib/verilator/verilator.cpp +209 -0
  64. cocotb/simtime.py +230 -0
  65. cocotb/simulator.cpython-313-darwin.so +0 -0
  66. cocotb/simulator.pyi +107 -0
  67. cocotb/task.py +590 -0
  68. cocotb/triggers.py +67 -0
  69. cocotb/types/__init__.py +31 -0
  70. cocotb/types/_abstract_array.py +151 -0
  71. cocotb/types/_array.py +295 -0
  72. cocotb/types/_indexing.py +17 -0
  73. cocotb/types/_logic.py +333 -0
  74. cocotb/types/_logic_array.py +868 -0
  75. cocotb/types/_range.py +197 -0
  76. cocotb/types/_resolve.py +76 -0
  77. cocotb/utils.py +110 -0
  78. cocotb-2.0.0rc2.dist-info/METADATA +60 -0
  79. cocotb-2.0.0rc2.dist-info/RECORD +115 -0
  80. cocotb-2.0.0rc2.dist-info/WHEEL +5 -0
  81. cocotb-2.0.0rc2.dist-info/entry_points.txt +2 -0
  82. cocotb-2.0.0rc2.dist-info/licenses/LICENSE +29 -0
  83. cocotb-2.0.0rc2.dist-info/top_level.txt +23 -0
  84. cocotb_tools/__init__.py +0 -0
  85. cocotb_tools/_coverage.py +33 -0
  86. cocotb_tools/_vendor/__init__.py +3 -0
  87. cocotb_tools/_vendor/distutils_version.py +346 -0
  88. cocotb_tools/check_results.py +65 -0
  89. cocotb_tools/combine_results.py +152 -0
  90. cocotb_tools/config.py +241 -0
  91. cocotb_tools/ipython_support.py +99 -0
  92. cocotb_tools/makefiles/Makefile.deprecations +27 -0
  93. cocotb_tools/makefiles/Makefile.inc +198 -0
  94. cocotb_tools/makefiles/Makefile.sim +96 -0
  95. cocotb_tools/makefiles/simulators/Makefile.activehdl +72 -0
  96. cocotb_tools/makefiles/simulators/Makefile.cvc +61 -0
  97. cocotb_tools/makefiles/simulators/Makefile.dsim +39 -0
  98. cocotb_tools/makefiles/simulators/Makefile.ghdl +84 -0
  99. cocotb_tools/makefiles/simulators/Makefile.icarus +80 -0
  100. cocotb_tools/makefiles/simulators/Makefile.ius +93 -0
  101. cocotb_tools/makefiles/simulators/Makefile.modelsim +9 -0
  102. cocotb_tools/makefiles/simulators/Makefile.nvc +60 -0
  103. cocotb_tools/makefiles/simulators/Makefile.questa +29 -0
  104. cocotb_tools/makefiles/simulators/Makefile.questa-compat +143 -0
  105. cocotb_tools/makefiles/simulators/Makefile.questa-qisqrun +149 -0
  106. cocotb_tools/makefiles/simulators/Makefile.riviera +144 -0
  107. cocotb_tools/makefiles/simulators/Makefile.vcs +65 -0
  108. cocotb_tools/makefiles/simulators/Makefile.verilator +79 -0
  109. cocotb_tools/makefiles/simulators/Makefile.xcelium +104 -0
  110. cocotb_tools/py.typed +0 -0
  111. cocotb_tools/runner.py +1868 -0
  112. cocotb_tools/sim_versions.py +140 -0
  113. pygpi/__init__.py +0 -0
  114. pygpi/entry.py +42 -0
  115. pygpi/py.typed +0 -0
@@ -0,0 +1,72 @@
1
+ # Copyright cocotb contributors
2
+ # Licensed under the Revised BSD License, see LICENSE for details.
3
+ # SPDX-License-Identifier: BSD-3-Clause
4
+
5
+ # Common Makefile for the Aldec Active-HDL simulator
6
+
7
+ CMD_BIN := vsimsa
8
+
9
+ ifdef ACTIVEHDL_BIN_DIR
10
+ CMD := $(shell :; command -v $(ACTIVEHDL_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
11
+ else
12
+ # auto-detect bin dir from system path
13
+ CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
14
+ ACTIVEHDL_BIN_DIR := $(shell dirname $(CMD))
15
+ endif
16
+
17
+ ALOG_ARGS += -timescale $(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION)
18
+
19
+ # below allows for maintaining legacy syntax as well as enables using cross-simulator vars COMPILE_ARGS/SIM_ARGS
20
+ ALOG_ARGS += $(COMPILE_ARGS)
21
+ ACOM_ARGS += $(COMPILE_ARGS)
22
+ ASIM_ARGS += $(SIM_ARGS)
23
+
24
+ ifdef RTL_LIBRARY
25
+ $(warning Using RTL_LIBRARY is deprecated, please use TOPLEVEL_LIBRARY instead.)
26
+ TOPLEVEL_LIBRARY ?= $(RTL_LIBRARY)
27
+ else
28
+ TOPLEVEL_LIBRARY ?= work
29
+ endif
30
+
31
+ ALOG_ARGS += -dbg
32
+ ACOM_ARGS += -dbg
33
+
34
+ GPI_EXTRA:=
35
+ ifeq ($(TOPLEVEL_LANG),verilog)
36
+ # backslashes needed because we embed in `echo` below
37
+ GPI_ARGS = -pli \"$(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi activehdl)\"
38
+ ifneq ($(VHDL_SOURCES),)
39
+ GPI_EXTRA = $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi activehdl):cocotbvhpi_entry_point
40
+ endif
41
+
42
+ else ifeq ($(TOPLEVEL_LANG),vhdl)
43
+ # backslashes needed because we embed in `echo` below
44
+ GPI_ARGS = -loadvhpi \"$(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi activehdl):vhpi_startup_routines_bootstrap\"
45
+ ifneq ($(VERILOG_SOURCES),)
46
+ GPI_EXTRA = $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi activehdl):cocotbvpi_entry_point
47
+ endif
48
+ else
49
+ $(error A valid value (verilog or vhdl) was not provided for TOPLEVEL_LANG=$(TOPLEVEL_LANG))
50
+ endif
51
+
52
+ # Create a DO script (Tcl-like but not fully compatible) based on the list of $(VERILOG_SOURCES)
53
+ $(SIM_BUILD)/runsim.do : $(VERILOG_SOURCES) $(VHDL_SOURCES) | $(SIM_BUILD)
54
+ @echo "alib $(TOPLEVEL_LIBRARY)" > $@
55
+ @echo "set worklib $(TOPLEVEL_LIBRARY)" >> $@
56
+ ifneq ($(VHDL_SOURCES),)
57
+ @echo "acom $(ACOM_ARGS) $(call to_tcl_path,$(VHDL_SOURCES))" >> $@
58
+ endif
59
+ ifneq ($(VERILOG_SOURCES),)
60
+ @echo "alog $(ALOG_ARGS) $(call to_tcl_path,$(VERILOG_SOURCES))" >> $@
61
+ endif
62
+ @echo "asim $(ASIM_ARGS) $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) +access +w_nets -interceptcoutput $(GPI_ARGS) $(COCOTB_TOPLEVEL) $(EXTRA_TOPS)" >> $@
63
+ @echo "run -all" >> $@
64
+ @echo "endsim" >> $@
65
+
66
+ $(COCOTB_RESULTS_FILE): $(SIM_BUILD)/runsim.do $(CUSTOM_COMPILE_DEPS) $(CUSTOM_SIM_DEPS)
67
+ $(RM) $(COCOTB_RESULTS_FILE)
68
+
69
+ set -o pipefail; GPI_EXTRA=$(GPI_EXTRA) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
70
+ COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) $(SIM_CMD_PREFIX) $(CMD) $(RUN_ARGS) -do $(SIM_BUILD)/runsim.do $(SIM_CMD_SUFFIX)
71
+
72
+ $(call check_results)
@@ -0,0 +1,61 @@
1
+ # Copyright cocotb contributors
2
+ # Copyright (c) 2014 Potential Ventures Ltd
3
+ # Licensed under the Revised BSD License, see LICENSE for details.
4
+ # SPDX-License-Identifier: BSD-3-Clause
5
+
6
+ ifneq ($(VHDL_SOURCES),)
7
+
8
+ $(COCOTB_RESULTS_FILE):
9
+ @echo "Skipping simulation as VHDL is not supported on simulator=$(SIM)"
10
+ debug: $(COCOTB_RESULTS_FILE)
11
+
12
+ else
13
+
14
+ CMD_BIN := cvc64
15
+
16
+ ifdef CVC_BIN_DIR
17
+ CMD := $(shell :; command -v $(CVC_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
18
+ else
19
+ # auto-detect bin dir from system path
20
+ CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
21
+ CVC_BIN_DIR := $(shell dirname $(CMD))
22
+ endif
23
+
24
+ #only interpreted mode works for the moment
25
+ CVC_ITERP ?= 1
26
+
27
+ ifeq ($(CVC_ITERP),1)
28
+ CVC_ARGS += +interp
29
+ endif
30
+
31
+ # Compilation phase
32
+ $(SIM_BUILD)/sim.vvp: $(VERILOG_SOURCES) $(CUSTOM_COMPILE_DEPS) | $(SIM_BUILD)
33
+ COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) \
34
+ COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
35
+ $(CMD) $(CVC_ARGS) +acc+2 -o $(SIM_BUILD)/sim.vvp +loadvpi=$(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi cvc):vlog_startup_routines_bootstrap $(COMPILE_ARGS) $(EXTRA_ARGS) $(VERILOG_SOURCES)
36
+
37
+ # Execution phase
38
+ ifeq ($(CVC_ITERP),1)
39
+ $(COCOTB_RESULTS_FILE): $(SIM_BUILD)/sim.vvp
40
+ else
41
+ $(COCOTB_RESULTS_FILE): $(SIM_BUILD)/sim.vvp $(CUSTOM_SIM_DEPS)
42
+ COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) \
43
+ COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
44
+ $(SIM_CMD_PREFIX) $(SIM_BUILD)/sim.vvp $(SIM_ARGS) $(EXTRA_ARGS) $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) $(SIM_CMD_SUFFIX)
45
+ endif
46
+
47
+ # Execution phase
48
+ ifeq ($(CVC_ITERP),1)
49
+ debug: $(CUSTOM_SIM_DEPS)
50
+ COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) \
51
+ COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
52
+ $(SIM_CMD_PREFIX) gdb --args $(CMD) $(CVC_ARGS) +acc+2 -o $(SIM_BUILD)/sim.vvp +loadvpi=$(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi cvc):vlog_startup_routines_bootstrap $(COMPILE_ARGS) $(EXTRA_ARGS) $(VERILOG_SOURCES)
53
+ else
54
+ debug: $(SIM_BUILD)/sim.vvp $(CUSTOM_SIM_DEPS)
55
+ COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) \
56
+ COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
57
+ gdb --args $(SIM_BUILD)/sim.vvp $(SIM_ARGS) $(EXTRA_ARGS) $(call deprecate,PLUSARGS,COCOTB_PLUSARGS)
58
+ endif
59
+
60
+
61
+ endif
@@ -0,0 +1,39 @@
1
+ # Copyright cocotb contributors
2
+ # Licensed under the Revised BSD License, see LICENSE for details.
3
+ # SPDX-License-Identifier: BSD-3-Clause
4
+
5
+ CMD_BIN := dsim
6
+
7
+ ifdef DSIM_BIN_DIR
8
+ CMD := $(shell :; command -v $(DSIM_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
9
+ else
10
+ # auto-detect bin dir from system path
11
+ CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
12
+ endif
13
+
14
+ ifeq (, $(CMD))
15
+ $(error Unable to locate command >$(CMD_BIN)<)
16
+ endif
17
+
18
+ ifeq ($(WAVES), 1)
19
+ WAVE_ARG := -waves file.vcd
20
+ else
21
+ WAVE_ARG :=
22
+ endif
23
+
24
+ TOPMODULE_ARG = -top $(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL)
25
+
26
+ DSIM_ARGS = -work $(SIM_BUILD) -pli_lib $(shell cocotb-config --lib-name-path vpi dsim) +acc+rwcbfsWF
27
+ COMP_ARGS = $(DSIM_ARGS) -genimage image -timescale $(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION)
28
+ RUN_ARGS = $(DSIM_ARGS) -image image $(WAVE_ARG)
29
+
30
+ $(SIM_BUILD)/image.so: $(VERILOG_SOURCES) $(CUSTOM_COMPILE_DEPS)
31
+ $(SIM_CMD_PREFIX) $(CMD) $(COMP_ARGS) $(TOPMODULE_ARG) $(EXTRA_ARGS) $(VERILOG_SOURCES)
32
+
33
+ $(COCOTB_RESULTS_FILE): $(SIM_BUILD)/image.so $(CUSTOM_SIM_DEPS)
34
+ $(RM) $(COCOTB_RESULTS_FILE)
35
+ COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) \
36
+ GPI_EXTRA=$(GPI_EXTRA) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
37
+ $(SIM_CMD_PREFIX) $(CMD) $(RUN_ARGS) $(TOPMODULE_ARG) $(EXTRA_ARGS) $(VERILOG_SOURCES)
38
+
39
+ $(call check_results)
@@ -0,0 +1,84 @@
1
+ # Copyright cocotb contributors
2
+ # Copyright (c) 2014 Potential Ventures Ltd
3
+ # Licensed under the Revised BSD License, see LICENSE for details.
4
+ # SPDX-License-Identifier: BSD-3-Clause
5
+
6
+ TOPLEVEL_LANG ?= vhdl
7
+
8
+ ifneq ($(or $(filter-out $(TOPLEVEL_LANG),vhdl),$(VERILOG_SOURCES)),)
9
+
10
+ $(COCOTB_RESULTS_FILE):
11
+ @echo "Skipping simulation as only VHDL is supported on simulator=$(SIM)"
12
+
13
+ else
14
+
15
+ CMD_BIN := ghdl
16
+
17
+ ifdef GHDL_BIN_DIR
18
+ CMD := $(shell :; command -v $(GHDL_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
+ GHDL_BIN_DIR := $(shell dirname $(CMD))
23
+ endif
24
+
25
+ ifdef RTL_LIBRARY
26
+ $(warning Using RTL_LIBRARY is deprecated, please use TOPLEVEL_LIBRARY instead.)
27
+ TOPLEVEL_LIBRARY ?= $(RTL_LIBRARY)
28
+ else
29
+ TOPLEVEL_LIBRARY ?= work
30
+ endif
31
+ GHDL_ARGS ?=
32
+ GHDL_ARGS += $(EXTRA_ARGS)
33
+
34
+ # On Windows add GHDL lib folder to PATH to find libraries
35
+ ifeq ($(OS),Msys)
36
+ export PATH := $(GHDL_BIN_DIR)/../lib:$(PATH)
37
+ endif
38
+
39
+ GHDL_RUN_ARGS ?=
40
+
41
+ ifeq ($(shell $(CMD) --version | grep -q mcode; echo $$?),0)
42
+ ifneq ($(COCOTB_HDL_TIMEPRECISION),)
43
+ # Convert the time precision to a format string supported by GHDL, if
44
+ # possible.
45
+ # GHDL only supports setting the time precision if the mcode backend is
46
+ # used, using the --time-resolution argument causes GHDL to error out
47
+ # otherwise.
48
+ # https://ghdl.github.io/ghdl/using/InvokingGHDL.html#cmdoption-ghdl-time-resolution
49
+ ifeq ($(COCOTB_HDL_TIMEPRECISION),1fs)
50
+ GHDL_TIME_RESOLUTION=fs
51
+ else ifeq ($(COCOTB_HDL_TIMEPRECISION),1ps)
52
+ GHDL_TIME_RESOLUTION=ps
53
+ else ifeq ($(COCOTB_HDL_TIMEPRECISION),1us)
54
+ GHDL_TIME_RESOLUTION=us
55
+ else ifeq ($(COCOTB_HDL_TIMEPRECISION),1ms)
56
+ GHDL_TIME_RESOLUTION=ms
57
+ else ifeq ($(COCOTB_HDL_TIMEPRECISION),1s)
58
+ GHDL_TIME_RESOLUTION=sec
59
+ else
60
+ $(error GHDL only supports the following values for COCOTB_HDL_TIMEPRECISION: 1fs, 1ps, 1us, 1ms, 1s)
61
+ endif
62
+
63
+ GHDL_RUN_ARGS += --time-resolution=$(GHDL_TIME_RESOLUTION)
64
+ endif
65
+ endif
66
+
67
+ .PHONY: analyse
68
+
69
+ # Compilation phase
70
+ analyse: $(VHDL_SOURCES) $(CUSTOM_COMPILE_DEPS) | $(SIM_BUILD)
71
+ $(foreach SOURCES_VAR, $(filter VHDL_SOURCES_%, $(.VARIABLES)), \
72
+ $(CMD) -i $(GHDL_ARGS) $(COMPILE_ARGS) --workdir=$(SIM_BUILD) --work=$(SOURCES_VAR:VHDL_SOURCES_%=%) $($(SOURCES_VAR)) && ) \
73
+ $(CMD) -i $(GHDL_ARGS) $(COMPILE_ARGS) --workdir=$(SIM_BUILD) --work=$(TOPLEVEL_LIBRARY) $(VHDL_SOURCES) && \
74
+ $(CMD) -m $(GHDL_ARGS) $(COMPILE_ARGS) --workdir=$(SIM_BUILD) -P$(SIM_BUILD) --work=$(TOPLEVEL_LIBRARY) $(COCOTB_TOPLEVEL) $(ARCH)
75
+
76
+ $(COCOTB_RESULTS_FILE): analyse $(CUSTOM_SIM_DEPS)
77
+ $(RM) $(COCOTB_RESULTS_FILE)
78
+
79
+ COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
80
+ $(SIM_CMD_PREFIX) $(CMD) -r $(GHDL_ARGS) $(GHDL_RUN_ARGS) --workdir=$(SIM_BUILD) -P$(SIM_BUILD) --work=$(TOPLEVEL_LIBRARY) $(COCOTB_TOPLEVEL) $(ARCH) --vpi=$(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi ghdl) $(SIM_ARGS) $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) $(SIM_CMD_SUFFIX)
81
+
82
+ $(call check_results)
83
+
84
+ endif
@@ -0,0 +1,80 @@
1
+ # Copyright cocotb contributors
2
+ # Copyright (c) 2013 Potential Ventures Ltd
3
+ # Copyright (c) 2013 SolarFlare Communications Inc
4
+ # Licensed under the Revised BSD License, see LICENSE for details.
5
+ # SPDX-License-Identifier: BSD-3-Clause
6
+
7
+ TOPLEVEL_LANG ?= verilog
8
+
9
+ ifneq ($(or $(filter-out $(TOPLEVEL_LANG),verilog),$(VHDL_SOURCES)),)
10
+
11
+ $(COCOTB_RESULTS_FILE):
12
+ @echo "Skipping simulation as only Verilog is supported on simulator=$(SIM)"
13
+ debug: $(COCOTB_RESULTS_FILE)
14
+
15
+ else
16
+
17
+ CMD_BIN := iverilog
18
+
19
+ ifdef ICARUS_BIN_DIR
20
+ CMD := $(shell :; command -v $(ICARUS_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
21
+ else
22
+ # auto-detect bin dir from system path
23
+ CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
24
+ ICARUS_BIN_DIR := $(shell dirname $(CMD))
25
+ endif
26
+
27
+ ifdef COCOTB_TOPLEVEL
28
+ TOPMODULE_ARG := -s $(COCOTB_TOPLEVEL)
29
+ else
30
+ TOPMODULE_ARG :=
31
+ endif
32
+
33
+ COMPILE_ARGS += -f $(SIM_BUILD)/cmds.f
34
+
35
+ ifdef VERILOG_INCLUDE_DIRS
36
+ COMPILE_ARGS += $(addprefix -I, $(VERILOG_INCLUDE_DIRS))
37
+ endif
38
+
39
+ # Compilation phase
40
+
41
+ ifeq ($(WAVES), 1)
42
+ VERILOG_SOURCES += $(SIM_BUILD)/cocotb_iverilog_dump.v
43
+ COMPILE_ARGS += -s cocotb_iverilog_dump
44
+ FST = -fst
45
+ else
46
+ # Disable waveform output
47
+ FST = -none
48
+ endif
49
+
50
+ $(SIM_BUILD)/sim.vvp: $(VERILOG_SOURCES) $(CUSTOM_COMPILE_DEPS) | $(SIM_BUILD)
51
+ @echo "+timescale+$(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION)" > $(SIM_BUILD)/cmds.f
52
+ $(CMD) -o $(SIM_BUILD)/sim.vvp $(TOPMODULE_ARG) -g2012 $(COMPILE_ARGS) $(EXTRA_ARGS) $(VERILOG_SOURCES)
53
+
54
+ $(SIM_BUILD)/cocotb_iverilog_dump.v: | $(SIM_BUILD)
55
+ @echo 'module cocotb_iverilog_dump();' > $@
56
+ @echo 'initial begin' >> $@
57
+ @echo ' $$dumpfile("$(SIM_BUILD)/$(COCOTB_TOPLEVEL).fst");' >> $@
58
+ @echo ' $$dumpvars(0, $(COCOTB_TOPLEVEL));' >> $@
59
+ @echo 'end' >> $@
60
+ @echo 'endmodule' >> $@
61
+
62
+ # Execution phase
63
+
64
+ $(COCOTB_RESULTS_FILE): $(SIM_BUILD)/sim.vvp $(CUSTOM_SIM_DEPS)
65
+ $(RM) $(COCOTB_RESULTS_FILE)
66
+
67
+ COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
68
+ $(SIM_CMD_PREFIX) $(ICARUS_BIN_DIR)/vvp -M $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-dir) -m $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name vpi icarus) $(SIM_ARGS) $(EXTRA_ARGS) $(SIM_BUILD)/sim.vvp $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) $(FST) $(SIM_CMD_SUFFIX)
69
+
70
+ $(call check_results)
71
+
72
+ debug: $(SIM_BUILD)/sim.vvp $(CUSTOM_SIM_DEPS)
73
+ $(RM) -r $(COCOTB_RESULTS_FILE)
74
+
75
+ COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
76
+ $(SIM_CMD_PREFIX) gdb --args $(ICARUS_BIN_DIR)/vvp -M $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-dir) -m $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name vpi icarus) $(SIM_BUILD)/sim.vvp $(SIM_ARGS) $(EXTRA_ARGS) $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) $(FST) $(SIM_CMD_SUFFIX)
77
+
78
+ $(call check_results)
79
+
80
+ endif
@@ -0,0 +1,93 @@
1
+ # Copyright cocotb contributors
2
+ # Copyright (c) 2013 Potential Ventures Ltd
3
+ # Copyright (c) 2013 SolarFlare Communications Inc
4
+ # Licensed under the Revised BSD License, see LICENSE for details.
5
+ # SPDX-License-Identifier: BSD-3-Clause
6
+
7
+ # Common Makefile for Cadence Incisive
8
+
9
+ CMD_BIN := irun
10
+
11
+ ifdef IUS_BIN_DIR
12
+ CMD := $(shell :; command -v $(IUS_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
13
+ else
14
+ # auto-detect bin dir from system path
15
+ CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
16
+ IUS_BIN_DIR := $(shell dirname $(CMD))
17
+ endif
18
+
19
+ ifdef VERILOG_INCLUDE_DIRS
20
+ COMPILE_ARGS += $(addprefix +incdir+, $(VERILOG_INCLUDE_DIRS))
21
+ endif
22
+
23
+ EXTRA_ARGS += $(COMPILE_ARGS)
24
+ EXTRA_ARGS += $(SIM_ARGS)
25
+ EXTRA_ARGS += -licqueue
26
+
27
+ ifeq ($(PYTHON_ARCH),64bit)
28
+ EXTRA_ARGS += -64
29
+ endif
30
+
31
+ EXTRA_ARGS += -nclibdirpath $(SIM_BUILD)
32
+ EXTRA_ARGS += -plinowarn
33
+
34
+ ifeq ($(GUI),1)
35
+ EXTRA_ARGS += -gui
36
+ else
37
+ EXTRA_ARGS +=
38
+ endif
39
+
40
+ # IUS errors out if multiple timescales are specified on the command line.
41
+ ifneq (,$(findstring timescale,$(EXTRA_ARGS)))
42
+ $(error Please use COCOTB_HDL_TIMEUNIT and COCOTB_HDL_TIMEPRECISION to specify timescale.)
43
+ endif
44
+
45
+ # Loading the VHPI library causes an error, so we always load the VPI library and supply
46
+ # GPI_EXTRA=$(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi ius) if needed.
47
+
48
+ # Xcelium will use default vlog_startup_routines symbol only if vpi library name is libvpi.so
49
+ GPI_ARGS = -loadvpi $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi ius):vlog_startup_routines_bootstrap
50
+
51
+ ifeq ($(TOPLEVEL_LANG),verilog)
52
+ EXTRA_ARGS += -v93
53
+ HDL_SOURCES = $(VERILOG_SOURCES)
54
+ ROOT_LEVEL = $(COCOTB_TOPLEVEL)
55
+ ifneq ($(VHDL_SOURCES),)
56
+ HDL_SOURCES += $(VHDL_SOURCES)
57
+ GPI_EXTRA = $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi ius):cocotbvhpi_entry_point
58
+ endif
59
+ else ifeq ($(TOPLEVEL_LANG),vhdl)
60
+ GPI_EXTRA = $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi ius):cocotbvhpi_entry_point
61
+ EXTRA_ARGS += -v93
62
+ EXTRA_ARGS += -top $(COCOTB_TOPLEVEL)
63
+ ifdef RTL_LIBRARY
64
+ $(warning Using RTL_LIBRARY is deprecated, please use TOPLEVEL_LIBRARY instead.)
65
+ TOPLEVEL_LIBRARY ?= $(RTL_LIBRARY)
66
+ else
67
+ TOPLEVEL_LIBRARY ?= work
68
+ endif
69
+ MAKE_LIB = -makelib $(TOPLEVEL_LIBRARY)
70
+ HDL_SOURCES = $(VHDL_SOURCES)
71
+ ifneq ($(VERILOG_SOURCES),)
72
+ HDL_SOURCES += $(VERILOG_SOURCES)
73
+ endif
74
+ else
75
+ $(error A valid value (verilog or vhdl) was not provided for TOPLEVEL_LANG=$(TOPLEVEL_LANG))
76
+ endif
77
+
78
+ # Builds a list of arguments to support VHDL libraries specified in VHDL_SOURCES_*:
79
+ LIBS := $(foreach LIB, $(VHDL_LIB_ORDER),-makelib $(LIB) $(VHDL_SOURCES_$(LIB)) -endlib)
80
+
81
+ $(COCOTB_RESULTS_FILE): $(HDL_SOURCES) $(CUSTOM_COMPILE_DEPS) $(CUSTOM_SIM_DEPS) | $(SIM_BUILD)
82
+ $(RM) $(COCOTB_RESULTS_FILE)
83
+
84
+ # Make sure all libs in SOURCES_VHDL_* are mentioned in VHDL_LIB_ORDER and vice versa
85
+ $(foreach LIB, $(VHDL_LIB_ORDER), $(check_vhdl_sources))
86
+ $(foreach SOURCES_VAR, $(filter VHDL_SOURCES_%, $(.VARIABLES)), $(check_lib_order))
87
+
88
+ set -o pipefail; \
89
+ COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) GPI_EXTRA=$(GPI_EXTRA) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
90
+ $(SIM_CMD_PREFIX) $(CMD) -timescale $(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION) \
91
+ $(EXTRA_ARGS) $(GPI_ARGS) +access+rwc $(LIBS) $(MAKE_LIB) $(HDL_SOURCES) $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) $(SIM_CMD_SUFFIX)
92
+
93
+ $(call check_results)
@@ -0,0 +1,9 @@
1
+ # Copyright cocotb contributors
2
+ # Copyright (c) 2013 Potential Ventures Ltd
3
+ # Copyright (c) 2013 SolarFlare Communications Inc
4
+ # Licensed under the Revised BSD License, see LICENSE for details.
5
+ # SPDX-License-Identifier: BSD-3-Clause
6
+
7
+
8
+ # Identical to Questa with the compat flow.
9
+ include $(COCOTB_MAKEFILES_DIR)/simulators/Makefile.questa-compat
@@ -0,0 +1,60 @@
1
+ # Copyright cocotb contributors
2
+ # Licensed under the Revised BSD License, see LICENSE for details.
3
+ # SPDX-License-Identifier: BSD-3-Clause
4
+
5
+ ifneq ($(VERILOG_SOURCES),)
6
+
7
+ $(COCOTB_RESULTS_FILE):
8
+ @echo "Skipping simulation as Verilog is not supported on simulator=$(SIM)"
9
+
10
+ else
11
+
12
+ CMD_BIN := nvc
13
+
14
+ ifdef NVC_BIN_DIR
15
+ CMD := $(shell :; command -v $(NVC_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
16
+ else
17
+ # auto-detect bin dir from system path
18
+ CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
19
+ NVC_BIN_DIR := $(shell dirname $(CMD))
20
+ endif
21
+
22
+ PRESERVE_CASE := $(shell $(CMD) --version | $(PYTHON_BIN) -c "from cocotb_tools.sim_versions import NvcVersion; import sys; print('--preserve-case' if NvcVersion.from_commandline(sys.stdin.read()) > NvcVersion('1.16') else '')")
23
+
24
+ ifdef RTL_LIBRARY
25
+ $(warning Using RTL_LIBRARY is deprecated, please use TOPLEVEL_LIBRARY instead.)
26
+ TOPLEVEL_LIBRARY ?= $(RTL_LIBRARY)
27
+ else
28
+ TOPLEVEL_LIBRARY ?= work
29
+ endif
30
+
31
+ .PHONY: analyse
32
+
33
+ # Split SIM_ARGS into those options that need to be passed to -e and
34
+ # those that need to be passed to -r
35
+ NVC_E_FILTER := -g% --cover --cover=%
36
+
37
+ NVC_E_ARGS := $(filter $(NVC_E_FILTER),$(SIM_ARGS))
38
+ NVC_R_ARGS := $(filter-out $(NVC_E_FILTER),$(SIM_ARGS))
39
+
40
+ # Compilation phase
41
+ analyse: $(VHDL_SOURCES) $(SIM_BUILD) $(CUSTOM_COMPILE_DEPS)
42
+ # Make sure all libs in SOURCES_VHDL_* are mentioned in VHDL_LIB_ORDER and vice versa
43
+ $(foreach LIB, $(VHDL_LIB_ORDER), $(check_vhdl_sources))
44
+ $(foreach SOURCES_VAR, $(filter VHDL_SOURCES_%, $(.VARIABLES)), $(check_lib_order))
45
+
46
+ $(foreach LIB_VAR,$(VHDL_LIB_ORDER), \
47
+ $(CMD) $(EXTRA_ARGS) --work=$(LIB_VAR):$(SIM_BUILD)/$(LIB_VAR) -L $(SIM_BUILD) -a $(VHDL_SOURCES_$(LIB_VAR)) $(PRESERVE_CASE) $(COMPILE_ARGS) && ) \
48
+ $(CMD) $(EXTRA_ARGS) --work=$(TOPLEVEL_LIBRARY):$(SIM_BUILD)/$(TOPLEVEL_LIBRARY) -L $(SIM_BUILD) -a $(VHDL_SOURCES) $(PRESERVE_CASE) $(COMPILE_ARGS)
49
+
50
+ $(COCOTB_RESULTS_FILE): analyse $(CUSTOM_SIM_DEPS)
51
+ $(RM) $(COCOTB_RESULTS_FILE)
52
+
53
+ COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
54
+ $(SIM_CMD_PREFIX) $(CMD) $(EXTRA_ARGS) --work=$(TOPLEVEL_LIBRARY):$(SIM_BUILD)/$(TOPLEVEL_LIBRARY) -L $(SIM_BUILD) \
55
+ -e $(COCOTB_TOPLEVEL) --no-save $(NVC_E_ARGS) \
56
+ -r --load $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi nvc) $(TRACE) $(NVC_R_ARGS) $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) $(SIM_CMD_SUFFIX)
57
+
58
+ $(call check_results)
59
+
60
+ endif
@@ -0,0 +1,29 @@
1
+ # Copyright cocotb contributors
2
+ # Licensed under the Revised BSD License, see LICENSE for details.
3
+ # SPDX-License-Identifier: BSD-3-Clause
4
+
5
+ # Detect the version of Questa in use to choose the best flow.
6
+
7
+ CMD_BIN := vsim
8
+
9
+ ifdef MODELSIM_BIN_DIR
10
+ CMD := $(shell :; command -v $(MODELSIM_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
11
+ else
12
+ # auto-detect bin dir from system path
13
+ CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
14
+ endif
15
+
16
+ # Determine the version of Questa being used.
17
+ QUESTA_VERSION := $(shell $(CMD) -version | $(PYTHON_BIN) -c 'import re,sys; print(re.sub(r".+vsim (\d+)\.(\d).+", "\\1 \\2", sys.stdin.read()))')
18
+ QUESTA_VERSION_MAJOR := $(firstword $(QUESTA_VERSION))
19
+ QUESTA_VERSION_MINOR := $(lastword $(QUESTA_VERSION))
20
+
21
+ # Use the QIS/Qrun flow for Questa >= 2025.2 (the first version which fully
22
+ # passes the cocotb regression suite). Use the compat flow otherwise.
23
+ ifeq ($(shell test $(QUESTA_VERSION_MAJOR)$(QUESTA_VERSION_MINOR) -lt 20252; echo $$?),0)
24
+ $(info Using the Questa compat flow for Questa version $(QUESTA_VERSION_MAJOR).$(QUESTA_VERSION_MINOR) < 2025.2. Run make with SIM=questa-qisqrun to force the newer QIS/Qrun flow.)
25
+ include $(COCOTB_MAKEFILES_DIR)/simulators/Makefile.questa-compat
26
+ else
27
+ $(info Using the Questa QIS/Qrun flow for Questa $(QUESTA_VERSION_MAJOR).$(QUESTA_VERSION_MINOR) >= 2025.2. Run make with SIM=questa-compat for the compat flow.)
28
+ include $(COCOTB_MAKEFILES_DIR)/simulators/Makefile.questa-qisqrun
29
+ endif
@@ -0,0 +1,143 @@
1
+ # Copyright (c) 2013, 2018 Potential Ventures Ltd
2
+ # Copyright (c) 2013 SolarFlare Communications Inc
3
+ # Licensed under the Revised BSD License, see LICENSE for details.
4
+ # SPDX-License-Identifier: BSD-3-Clause
5
+
6
+ # Questa compatibility flow using the vlog and vsim commands with the +acc
7
+ # switch for design access.
8
+
9
+ CMD_BIN := vsim
10
+
11
+ ifdef MODELSIM_BIN_DIR
12
+ CMD := $(shell :; command -v $(MODELSIM_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
13
+ else
14
+ # auto-detect bin dir from system path
15
+ CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
16
+ MODELSIM_BIN_DIR := $(shell dirname $(CMD))
17
+ endif
18
+
19
+ ifdef RTL_LIBRARY
20
+ $(warning Using RTL_LIBRARY is deprecated, please use TOPLEVEL_LIBRARY instead.)
21
+ TOPLEVEL_LIBRARY ?= $(RTL_LIBRARY)
22
+ else
23
+ TOPLEVEL_LIBRARY ?= work
24
+ endif
25
+ COCOTB_TOPLEVEL := "$(TOPLEVEL_LIBRARY).$(COCOTB_TOPLEVEL)"
26
+
27
+ ifndef VLOG_ARGS
28
+ VLOG_ARGS = -timescale $(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION) -mfcu
29
+ endif
30
+
31
+ COMPILE_ARGS += +acc
32
+
33
+ ifdef VERILOG_INCLUDE_DIRS
34
+ VLOG_ARGS += $(addprefix +incdir+, $(VERILOG_INCLUDE_DIRS))
35
+ endif
36
+
37
+ # below allows for maintaining legacy syntax as well as enables using cross-simulator vars COMPILE_ARGS/SIM_ARGS
38
+ VLOG_ARGS += $(COMPILE_ARGS)
39
+ VCOM_ARGS += $(COMPILE_ARGS)
40
+ VSIM_ARGS += $(SIM_ARGS)
41
+
42
+ ifeq ($(GUI),1)
43
+ CMD += -gui
44
+ VSIM_ARGS += -onfinish stop
45
+ else
46
+ CMD += -c
47
+ VSIM_ARGS += -onfinish exit
48
+ endif
49
+
50
+ FLI_LIB := $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path fli questa)
51
+ VHPI_LIB := $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi questa)
52
+
53
+ GPI_EXTRA :=
54
+
55
+ VHDL_GPI_INTERFACE ?= fli
56
+
57
+ ifeq ($(filter vhpi fli,$(VHDL_GPI_INTERFACE)),)
58
+ $(error A valid value (fli or vhpi) was not provided for VHDL_GPI_INTERFACE=$(VHDL_GPI_INTERFACE))
59
+ endif
60
+
61
+ ifeq ($(TOPLEVEL_LANG),vhdl)
62
+ VSIM_ARGS += -t $(COCOTB_HDL_TIMEPRECISION)
63
+ ifeq ($(VHDL_GPI_INTERFACE),fli)
64
+ CUSTOM_COMPILE_DEPS += $(FLI_LIB)
65
+ VSIM_ARGS += -foreign \"cocotb_init $(FLI_LIB)\"
66
+ else
67
+ VSIM_ARGS += -voptargs="-access=rw+/." -foreign \"vhpi_startup_routines_bootstrap $(call to_tcl_path,$(VHPI_LIB))\"
68
+ endif
69
+ ifneq ($(VERILOG_SOURCES),)
70
+ GPI_EXTRA := $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi questa):cocotbvpi_entry_point
71
+ endif
72
+
73
+ else ifeq ($(TOPLEVEL_LANG),verilog)
74
+ VSIM_ARGS += -pli $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi questa)
75
+ ifneq ($(VHDL_SOURCES),)
76
+ GPI_EXTRA := $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path $(VHDL_GPI_INTERFACE) questa):cocotb$(VHDL_GPI_INTERFACE)_entry_point
77
+ endif
78
+
79
+ else
80
+ $(error A valid value (verilog or vhdl) was not provided for TOPLEVEL_LANG=$(TOPLEVEL_LANG))
81
+ endif
82
+
83
+ define make_lib
84
+ echo "if [file exists $(SIM_BUILD)/$(LIB)] {vdel -lib $(SIM_BUILD)/$(LIB) -all}" >> $@;
85
+ echo "vlib $(SIM_BUILD)/$(LIB)" >> $@;
86
+ echo "vmap $(LIB) $(SIM_BUILD)/$(LIB)" >> $@;
87
+ echo "vcom -work $(LIB) $(VCOM_ARGS) $(call to_tcl_path,$(VHDL_SOURCES_$(LIB)))" >> $@;
88
+ endef
89
+
90
+ $(SIM_BUILD)/runsim.do : $(VHDL_SOURCES) $(VERILOG_SOURCES) $(CUSTOM_COMPILE_DEPS) $(CUSTOM_SIM_DEPS) | $(SIM_BUILD)
91
+ # Make sure all libs in SOURCES_VHDL_* are mentioned in VHDL_LIB_ORDER and vice versa
92
+ $(foreach LIB, $(VHDL_LIB_ORDER), $(check_vhdl_sources))
93
+ $(foreach SOURCES_VAR, $(filter VHDL_SOURCES_%, $(.VARIABLES)), $(check_lib_order))
94
+
95
+ @echo "# Autogenerated file" > $@
96
+ @echo "onerror {" >> $@
97
+ @echo " quit -f -code 1" >> $@
98
+ @echo "}" >> $@
99
+ @echo "vmap -c" >> $@
100
+ $(foreach LIB, $(VHDL_LIB_ORDER), $(make_lib))
101
+ @echo "if [file exists $(SIM_BUILD)/$(TOPLEVEL_LIBRARY)] {vdel -lib $(SIM_BUILD)/$(TOPLEVEL_LIBRARY) -all}" >> $@
102
+ @echo "vlib $(SIM_BUILD)/$(TOPLEVEL_LIBRARY)" >> $@
103
+ @echo "vmap $(TOPLEVEL_LIBRARY) $(SIM_BUILD)/$(TOPLEVEL_LIBRARY)" >> $@
104
+ ifneq ($(VHDL_SOURCES),)
105
+ @echo "vcom -work $(TOPLEVEL_LIBRARY) $(VCOM_ARGS) $(call to_tcl_path,$(VHDL_SOURCES))" >> $@
106
+ endif
107
+ ifneq ($(VERILOG_SOURCES),)
108
+ @echo "vlog -work $(TOPLEVEL_LIBRARY) -sv $(VLOG_ARGS) $(EXTRA_ARGS) $(call to_tcl_path,$(VERILOG_SOURCES))" >> $@
109
+ endif
110
+ ifdef SCRIPT_FILE
111
+ @echo "do $(SCRIPT_FILE)" >> $@
112
+ endif
113
+ @echo "vsim $(VSIM_ARGS) $(EXTRA_ARGS) $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) $(COCOTB_TOPLEVEL)" >> $@
114
+ ifeq ($(WAVES),1)
115
+ @echo "log -recursive /*" >> $@
116
+ endif
117
+ ifeq ($(GUI),1)
118
+ @echo "add log -r *" >> $@
119
+ else
120
+ @echo "onbreak resume" >> $@
121
+ @echo "run -all" >> $@
122
+ @echo "quit" >> $@
123
+ endif
124
+
125
+ ifeq ($(PYTHON_ARCH),64bit)
126
+ CMD += -64
127
+ endif
128
+
129
+ $(COCOTB_RESULTS_FILE): $(SIM_BUILD)/runsim.do
130
+ $(RM) $(COCOTB_RESULTS_FILE)
131
+
132
+ set -o pipefail; \
133
+ COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) \
134
+ COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) \
135
+ COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) \
136
+ COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) \
137
+ GPI_EXTRA=$(GPI_EXTRA) \
138
+ TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
139
+ VHDL_GPI_INTERFACE=$(VHDL_GPI_INTERFACE) \
140
+ COCOTB__QUESTA_MODE=compat \
141
+ $(SIM_CMD_PREFIX) $(CMD) $(RUN_ARGS) -do $(SIM_BUILD)/runsim.do $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) $(SIM_CMD_SUFFIX)
142
+
143
+ $(call check_results)