cocotb 1.9.1__cp310-cp310-win32.whl → 2.0.0b1__cp310-cp310-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 (157) hide show
  1. cocotb/{ANSI.py → _ANSI.py} +5 -25
  2. cocotb/__init__.py +76 -315
  3. cocotb/_base_triggers.py +513 -0
  4. cocotb/_bridge.py +187 -0
  5. cocotb/_decorators.py +515 -0
  6. cocotb/_deprecation.py +3 -3
  7. cocotb/_exceptions.py +7 -0
  8. cocotb/_extended_awaitables.py +419 -0
  9. cocotb/_gpi_triggers.py +382 -0
  10. cocotb/_init.py +295 -0
  11. cocotb/_outcomes.py +54 -0
  12. cocotb/_profiling.py +46 -0
  13. cocotb/_py_compat.py +100 -29
  14. cocotb/_scheduler.py +454 -0
  15. cocotb/_test.py +245 -0
  16. cocotb/_test_factory.py +309 -0
  17. cocotb/_test_functions.py +42 -0
  18. cocotb/_typing.py +7 -0
  19. cocotb/_utils.py +296 -0
  20. cocotb/_version.py +3 -7
  21. cocotb/_xunit_reporter.py +66 -0
  22. cocotb/clock.py +271 -108
  23. cocotb/handle.py +1342 -795
  24. cocotb/libs/cocotb.dll +0 -0
  25. cocotb/libs/cocotb.exp +0 -0
  26. cocotb/libs/cocotb.lib +0 -0
  27. cocotb/libs/cocotbfli_modelsim.dll +0 -0
  28. cocotb/libs/cocotbfli_modelsim.exp +0 -0
  29. cocotb/libs/cocotbfli_modelsim.lib +0 -0
  30. cocotb/libs/cocotbutils.dll +0 -0
  31. cocotb/libs/cocotbutils.exp +0 -0
  32. cocotb/libs/cocotbutils.lib +0 -0
  33. cocotb/libs/cocotbvhpi_aldec.dll +0 -0
  34. cocotb/libs/cocotbvhpi_aldec.exp +0 -0
  35. cocotb/libs/cocotbvhpi_aldec.lib +0 -0
  36. cocotb/libs/cocotbvhpi_modelsim.dll +0 -0
  37. cocotb/libs/cocotbvhpi_modelsim.exp +0 -0
  38. cocotb/libs/cocotbvhpi_modelsim.lib +0 -0
  39. cocotb/libs/cocotbvpi_aldec.dll +0 -0
  40. cocotb/libs/cocotbvpi_aldec.exp +0 -0
  41. cocotb/libs/cocotbvpi_aldec.lib +0 -0
  42. cocotb/libs/cocotbvpi_ghdl.dll +0 -0
  43. cocotb/libs/cocotbvpi_ghdl.exp +0 -0
  44. cocotb/libs/cocotbvpi_ghdl.lib +0 -0
  45. cocotb/libs/cocotbvpi_icarus.exp +0 -0
  46. cocotb/libs/cocotbvpi_icarus.lib +0 -0
  47. cocotb/libs/cocotbvpi_icarus.vpl +0 -0
  48. cocotb/libs/cocotbvpi_modelsim.dll +0 -0
  49. cocotb/libs/cocotbvpi_modelsim.exp +0 -0
  50. cocotb/libs/cocotbvpi_modelsim.lib +0 -0
  51. cocotb/libs/embed.dll +0 -0
  52. cocotb/libs/embed.exp +0 -0
  53. cocotb/libs/embed.lib +0 -0
  54. cocotb/libs/gpi.dll +0 -0
  55. cocotb/libs/gpi.exp +0 -0
  56. cocotb/libs/gpi.lib +0 -0
  57. cocotb/libs/gpilog.dll +0 -0
  58. cocotb/libs/gpilog.exp +0 -0
  59. cocotb/libs/gpilog.lib +0 -0
  60. cocotb/libs/pygpilog.dll +0 -0
  61. cocotb/libs/pygpilog.exp +0 -0
  62. cocotb/libs/pygpilog.lib +0 -0
  63. cocotb/{log.py → logging.py} +105 -110
  64. cocotb/queue.py +103 -57
  65. cocotb/regression.py +667 -716
  66. cocotb/result.py +17 -188
  67. cocotb/share/def/aldec.exp +0 -0
  68. cocotb/share/def/aldec.lib +0 -0
  69. cocotb/share/def/ghdl.exp +0 -0
  70. cocotb/share/def/ghdl.lib +0 -0
  71. cocotb/share/def/icarus.exp +0 -0
  72. cocotb/share/def/icarus.lib +0 -0
  73. cocotb/share/def/modelsim.def +1 -0
  74. cocotb/share/def/modelsim.exp +0 -0
  75. cocotb/share/def/modelsim.lib +0 -0
  76. cocotb/share/include/cocotb_utils.h +6 -29
  77. cocotb/share/include/embed.h +5 -28
  78. cocotb/share/include/gpi.h +137 -92
  79. cocotb/share/include/gpi_logging.h +221 -142
  80. cocotb/share/include/py_gpi_logging.h +7 -4
  81. cocotb/share/include/vpi_user_ext.h +4 -26
  82. cocotb/share/lib/verilator/verilator.cpp +59 -54
  83. cocotb/simulator.cp310-win32.exp +0 -0
  84. cocotb/simulator.cp310-win32.lib +0 -0
  85. cocotb/simulator.cp310-win32.pyd +0 -0
  86. cocotb/simulator.pyi +107 -0
  87. cocotb/task.py +434 -212
  88. cocotb/triggers.py +55 -1092
  89. cocotb/types/__init__.py +25 -47
  90. cocotb/types/_abstract_array.py +151 -0
  91. cocotb/types/_array.py +264 -0
  92. cocotb/types/_logic.py +296 -0
  93. cocotb/types/_logic_array.py +834 -0
  94. cocotb/types/{range.py → _range.py} +36 -44
  95. cocotb/types/_resolve.py +76 -0
  96. cocotb/utils.py +119 -587
  97. cocotb-2.0.0b1.dist-info/METADATA +60 -0
  98. cocotb-2.0.0b1.dist-info/RECORD +143 -0
  99. {cocotb-1.9.1.dist-info → cocotb-2.0.0b1.dist-info}/WHEEL +1 -1
  100. cocotb-2.0.0b1.dist-info/entry_points.txt +2 -0
  101. {cocotb-1.9.1.dist-info → cocotb-2.0.0b1.dist-info}/top_level.txt +1 -0
  102. cocotb_tools/__init__.py +0 -0
  103. cocotb_tools/_coverage.py +33 -0
  104. cocotb_tools/_vendor/__init__.py +3 -0
  105. cocotb_tools/check_results.py +65 -0
  106. cocotb_tools/combine_results.py +152 -0
  107. cocotb_tools/config.py +241 -0
  108. {cocotb → cocotb_tools}/ipython_support.py +29 -22
  109. cocotb_tools/makefiles/Makefile.deprecations +27 -0
  110. {cocotb/share → cocotb_tools}/makefiles/Makefile.inc +82 -54
  111. {cocotb/share → cocotb_tools}/makefiles/Makefile.sim +8 -33
  112. {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.activehdl +18 -18
  113. cocotb_tools/makefiles/simulators/Makefile.cvc +61 -0
  114. cocotb_tools/makefiles/simulators/Makefile.dsim +39 -0
  115. {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.ghdl +13 -42
  116. cocotb_tools/makefiles/simulators/Makefile.icarus +80 -0
  117. cocotb_tools/makefiles/simulators/Makefile.ius +93 -0
  118. cocotb_tools/makefiles/simulators/Makefile.modelsim +9 -0
  119. cocotb_tools/makefiles/simulators/Makefile.nvc +60 -0
  120. cocotb_tools/makefiles/simulators/Makefile.questa +29 -0
  121. cocotb_tools/makefiles/simulators/Makefile.questa-compat +143 -0
  122. cocotb_tools/makefiles/simulators/Makefile.questa-qisqrun +149 -0
  123. cocotb_tools/makefiles/simulators/Makefile.riviera +144 -0
  124. cocotb_tools/makefiles/simulators/Makefile.vcs +65 -0
  125. {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.verilator +15 -22
  126. {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.xcelium +20 -52
  127. cocotb_tools/py.typed +0 -0
  128. {cocotb → cocotb_tools}/runner.py +794 -361
  129. cocotb/_sim_versions.py → cocotb_tools/sim_versions.py +16 -21
  130. pygpi/entry.py +34 -17
  131. pygpi/py.typed +0 -0
  132. cocotb/binary.py +0 -858
  133. cocotb/config.py +0 -289
  134. cocotb/decorators.py +0 -332
  135. cocotb/memdebug.py +0 -35
  136. cocotb/outcomes.py +0 -56
  137. cocotb/scheduler.py +0 -1099
  138. cocotb/share/makefiles/Makefile.deprecations +0 -12
  139. cocotb/share/makefiles/simulators/Makefile.cvc +0 -94
  140. cocotb/share/makefiles/simulators/Makefile.icarus +0 -111
  141. cocotb/share/makefiles/simulators/Makefile.ius +0 -125
  142. cocotb/share/makefiles/simulators/Makefile.modelsim +0 -32
  143. cocotb/share/makefiles/simulators/Makefile.nvc +0 -64
  144. cocotb/share/makefiles/simulators/Makefile.questa +0 -168
  145. cocotb/share/makefiles/simulators/Makefile.riviera +0 -177
  146. cocotb/share/makefiles/simulators/Makefile.vcs +0 -98
  147. cocotb/types/array.py +0 -309
  148. cocotb/types/logic.py +0 -292
  149. cocotb/types/logic_array.py +0 -298
  150. cocotb/wavedrom.py +0 -199
  151. cocotb/xunit_reporter.py +0 -80
  152. cocotb-1.9.1.dist-info/METADATA +0 -166
  153. cocotb-1.9.1.dist-info/RECORD +0 -121
  154. cocotb-1.9.1.dist-info/entry_points.txt +0 -2
  155. /cocotb/{_vendor/__init__.py → py.typed} +0 -0
  156. {cocotb-1.9.1.dist-info → cocotb-2.0.0b1.dist-info/licenses}/LICENSE +0 -0
  157. {cocotb → cocotb_tools}/_vendor/distutils_version.py +0 -0
@@ -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)
@@ -0,0 +1,149 @@
1
+ # Copyright cocotb contributors
2
+ # Licensed under the Revised BSD License, see LICENSE for details.
3
+ # SPDX-License-Identifier: BSD-3-Clause
4
+
5
+ # Questa QIS/Qrun flow using the Questa Information System (QIS) for design
6
+ # access and qrun to build and run the simulation.
7
+
8
+ QRUN_BIN := qrun
9
+ VIS_BIN := vis
10
+
11
+ ifdef MODELSIM_BIN_DIR
12
+ QRUN_CMD := $(shell :; command -v $(MODELSIM_BIN_DIR)/$(QRUN_BIN) 2>/dev/null)
13
+ VIS_CMD := $(shell :; command -v $(MODELSIM_BIN_DIR)/$(VIS_BIN) 2>/dev/null)
14
+ else
15
+ # auto-detect bin dir from system path
16
+ QRUN_CMD := $(shell :; command -v $(QRUN_BIN) 2>/dev/null)
17
+ VIS_CMD := $(shell :; command -v $(VIS_BIN) 2>/dev/null)
18
+ endif
19
+
20
+ ifeq (,$(QRUN_CMD))
21
+ $(error Unable to locate command >$(QRUN_BIN)<)
22
+ endif
23
+ ifeq (,$(VIS_CMD))
24
+ $(error Unable to locate command >$(VIS_BIN)<)
25
+ endif
26
+
27
+ DESIGNFILE ?= design.bin
28
+ WAVEFILE ?= qwave.db
29
+ TOPLEVEL_LIBRARY ?= work
30
+ COCOTB_TOPLEVEL := "$(TOPLEVEL_LIBRARY).$(COCOTB_TOPLEVEL)"
31
+
32
+
33
+ ifndef VLOG_ARGS
34
+ VLOG_ARGS = -timescale $(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION) -mfcu
35
+ endif
36
+
37
+ ifdef VERILOG_INCLUDE_DIRS
38
+ VLOG_ARGS += $(addprefix +incdir+, $(VERILOG_INCLUDE_DIRS))
39
+ endif
40
+
41
+ # below allows for maintaining legacy syntax as well as enables using cross-simulator vars COMPILE_ARGS/SIM_ARGS
42
+ VLOG_ARGS += $(COMPILE_ARGS)
43
+ VCOM_ARGS +=
44
+ VOPT_ARGS += -access=rw+/.
45
+ VSIM_ARGS += $(SIM_ARGS)
46
+
47
+ ifdef GUI
48
+ # Run in GUI mode.
49
+
50
+ # Two modes are supported:
51
+ # - GUI=livesim: Open the Visualizer GUI before running the simulation.
52
+ # GUI=1 is a backwards-compatible alias for livesim.
53
+ # - GUI=postsim: Open the Visualizer GUI after the simulation has finished.
54
+
55
+ ifeq ($(filter livesim postsim 1,$(GUI)),)
56
+ $(error A valid value (livesim, postsim, or 1) was not provided for GUI=$(GUI))
57
+ endif
58
+
59
+ # Map GUI=1 to GUI=livesim.
60
+ ifeq ($(GUI),1)
61
+ GUI := livesim
62
+ endif
63
+
64
+ VOPT_ARGS += -designfile $(DESIGNFILE)
65
+ VSIM_ARGS += -onfinish stop -qwavedb=+signal+memory=all+class+assertion+uvm_schematic+msg+wavefile=$(WAVEFILE)
66
+
67
+ ifeq ($(GUI),livesim)
68
+ QRUN_CMD += -gui -visualizer
69
+ VOPT_ARGS += -debug,livesim
70
+ endif
71
+
72
+ # For GUI=postsim Visualizer is called in the $(COCOTB_RESULTS_FILE) target.
73
+ else
74
+ # Run in batch mode (no GUI).
75
+ QRUN_CMD += -c
76
+ VSIM_ARGS += -onfinish exit
77
+ endif # ifdef GUI
78
+
79
+ FLI_LIB := $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path fli questa)
80
+ VHPI_LIB := $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi questa)
81
+ GPI_EXTRA :=
82
+
83
+ VHDL_GPI_INTERFACE ?= fli
84
+
85
+ ifeq ($(filter vhpi fli,$(VHDL_GPI_INTERFACE)),)
86
+ $(error A valid value (fli or vhpi) was not provided for VHDL_GPI_INTERFACE=$(VHDL_GPI_INTERFACE))
87
+ endif
88
+
89
+ ifeq ($(TOPLEVEL_LANG),vhdl)
90
+ VSIM_ARGS += -t $(COCOTB_HDL_TIMEPRECISION)
91
+ ifeq ($(VHDL_GPI_INTERFACE),fli)
92
+ CUSTOM_COMPILE_DEPS += $(FLI_LIB)
93
+ VSIM_ARGS += -foreign "cocotb_init $(FLI_LIB)"
94
+ else
95
+ VSIM_ARGS += -foreign "vhpi_startup_routines_bootstrap $(call to_tcl_path,$(VHPI_LIB))"
96
+ endif
97
+ ifneq ($(VERILOG_SOURCES),)
98
+ GPI_EXTRA := $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi questa):cocotbvpi_entry_point
99
+ endif
100
+
101
+ else ifeq ($(TOPLEVEL_LANG),verilog)
102
+ VSIM_ARGS += -pli $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi questa)
103
+ ifneq ($(VHDL_SOURCES),)
104
+ GPI_EXTRA := $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path $(VHDL_GPI_INTERFACE) questa):cocotb$(VHDL_GPI_INTERFACE)_entry_point
105
+ endif
106
+
107
+ else
108
+ $(error A valid value (verilog or vhdl) was not provided for TOPLEVEL_LANG=$(TOPLEVEL_LANG))
109
+ endif
110
+
111
+ ifdef SCRIPT_FILE
112
+ VSIM_ARGS += -do $(SCRIPT_FILE)
113
+ endif
114
+
115
+ ifeq ($(PYTHON_ARCH),64bit)
116
+ QRUN_CMD += -64
117
+ endif
118
+
119
+ define make_lib
120
+ -makelib $(LIB) $(VHDL_SOURCES_$(LIB)) -end
121
+ endef
122
+
123
+ $(COCOTB_RESULTS_FILE):
124
+ # Make sure all libs in SOURCES_VHDL_* are mentioned in VHDL_LIB_ORDER and vice versa
125
+ $(foreach LIB, $(VHDL_LIB_ORDER), $(check_vhdl_sources))
126
+ $(foreach SOURCES_VAR, $(filter VHDL_SOURCES_%, $(.VARIABLES)), $(check_lib_order))
127
+
128
+ $(RM) $(COCOTB_RESULTS_FILE)
129
+ mkdir -p $(SIM_BUILD)
130
+
131
+ set -o pipefail; \
132
+ COCOTB_TEST_MODULES=$(COCOTB_TEST_MODULES) \
133
+ COCOTB_TESTCASE=$(COCOTB_TESTCASE) \
134
+ COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) \
135
+ COCOTB_TOPLEVEL=$(COCOTB_TOPLEVEL) \
136
+ GPI_EXTRA=$(GPI_EXTRA) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
137
+ VHDL_GPI_INTERFACE=$(VHDL_GPI_INTERFACE) \
138
+ COCOTB__QUESTA_MODE=qisqrun \
139
+ $(SIM_CMD_PREFIX) $(QRUN_CMD) $(RUN_ARGS) -outdir $(SIM_BUILD) \
140
+ $(foreach LIB, $(VHDL_LIB_ORDER), $(make_lib)) \
141
+ -makelib $(TOPLEVEL_LIBRARY) $(VERILOG_SOURCES) $(VHDL_SOURCES) $(VLOG_ARGS) $(VCOM_ARGS) -end \
142
+ $(VOPT_ARGS) $(VSIM_ARGS) $(EXTRA_ARGS) $(COCOTB_PLUSARGS) -sv \
143
+ -top $(COCOTB_TOPLEVEL) 2>&1 | tee $(SIM_BUILD)/sim.log
144
+
145
+ ifeq ($(GUI),postsim)
146
+ $(VIS_CMD) -designfile $(DESIGNFILE) -wavefile $(WAVEFILE)
147
+ endif
148
+
149
+ $(call check_results)
@@ -0,0 +1,144 @@
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 Aldec Riviera-PRO simulator
8
+
9
+ ifeq ($(GUI),1)
10
+ CMD_BIN := riviera
11
+ else
12
+ CMD_BIN := vsimsa
13
+ endif
14
+
15
+ ifdef ALDEC_BIN_DIR
16
+ CMD := $(shell :; command -v $(ALDEC_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
17
+ else
18
+ # auto-detect bin dir from system path
19
+ CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
20
+ ALDEC_BIN_DIR := $(shell dirname $(CMD))
21
+ endif
22
+
23
+ ifeq ($(GUI),1)
24
+ CMD += -nosplash
25
+ endif
26
+
27
+ ALOG_ARGS += -timescale $(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION)
28
+
29
+ ifdef VERILOG_INCLUDE_DIRS
30
+ ALOG_ARGS += $(addprefix +incdir+, $(VERILOG_INCLUDE_DIRS))
31
+ endif
32
+
33
+ # below allows for maintaining legacy syntax as well as enables using cross-simulator vars COMPILE_ARGS/SIM_ARGS
34
+ ALOG_ARGS += $(COMPILE_ARGS)
35
+ ACOM_ARGS += $(COMPILE_ARGS)
36
+ ASIM_ARGS += $(SIM_ARGS)
37
+
38
+ # Plusargs need to be passed to ASIM command not vsimsa
39
+ ASIM_ARGS += $(call deprecate,PLUSARGS,COCOTB_PLUSARGS)
40
+
41
+ ifdef RTL_LIBRARY
42
+ $(warning Using RTL_LIBRARY is deprecated, please use TOPLEVEL_LIBRARY instead.)
43
+ TOPLEVEL_LIBRARY ?= $(RTL_LIBRARY)
44
+ else
45
+ TOPLEVEL_LIBRARY ?= work
46
+ endif
47
+
48
+ # Pass the VPI library to the Verilog compilation to get extended checking.
49
+ ALOG_ARGS += -pli $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi riviera)
50
+
51
+ # Aldec-specific coverage types:
52
+ # - (s)tatement
53
+ # - (b)ranch
54
+ # - (e)xpression
55
+ # - (c)ondition
56
+ # - (a)ssertion
57
+ # - (p)ath
58
+ # - finite state (m)achine
59
+ # Documentation: Riviera Pro 2017.02 Documentation - Page 359
60
+ COVERAGE_TYPES ?= sb
61
+ ifeq ($(COCOTB_USER_COVERAGE),1)
62
+ ALOG_ARGS += -dbg -coverage $(COVERAGE_TYPES)
63
+ ACOM_ARGS += -dbg -coverage $(COVERAGE_TYPES)
64
+
65
+ ASIM_ARGS += -dbg -acdb -acdb_cov $(COVERAGE_TYPES)
66
+ endif
67
+
68
+ GPI_EXTRA:=
69
+ ifeq ($(TOPLEVEL_LANG),verilog)
70
+ GPI_ARGS = -pli $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi riviera)
71
+ ifneq ($(VHDL_SOURCES),)
72
+ GPI_EXTRA = $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi riviera):cocotbvhpi_entry_point
73
+ endif
74
+
75
+ else ifeq ($(TOPLEVEL_LANG),vhdl)
76
+ GPI_ARGS = -loadvhpi $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi riviera):vhpi_startup_routines_bootstrap
77
+ ifneq ($(VERILOG_SOURCES),)
78
+ GPI_EXTRA = $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi riviera):cocotbvpi_entry_point
79
+ endif
80
+
81
+ else
82
+ $(error A valid value (verilog or vhdl) was not provided for TOPLEVEL_LANG=$(TOPLEVEL_LANG))
83
+ endif
84
+
85
+ define make_lib
86
+ echo "if [file exists $(SIM_BUILD)/$(LIB)] {adel -lib $(SIM_BUILD)/$(LIB) -all}" >> $@;
87
+ echo "alib $(SIM_BUILD)/$(LIB)" >> $@;
88
+ echo "amap $(LIB) $(SIM_BUILD)/$(LIB)" >> $@;
89
+ echo "acom -work $(LIB) $(ACOM_ARGS) $(call to_tcl_path,$(VHDL_SOURCES_$(LIB)))" >> $@;
90
+ endef
91
+
92
+ # Create a TCL script based on the list of $(VERILOG_SOURCES)
93
+ $(SIM_BUILD)/runsim.tcl : $(VERILOG_SOURCES) $(VHDL_SOURCES) | $(SIM_BUILD)
94
+ @echo "onerror {" > $@
95
+ @echo " puts [read [open sim.log r]]" >> $@
96
+ @echo " quit -code 1" >> $@
97
+ @echo "}" >> $@
98
+ @echo "amap -c" >> $@
99
+ $(foreach LIB, $(VHDL_LIB_ORDER), $(make_lib))
100
+ @echo "@if [string length [array get env LICENSE_QUEUE]] {" >> $@
101
+ @echo " set LICENSE_QUEUE $$::env(LICENSE_QUEUE)" >> $@
102
+ @echo "}" >> $@
103
+ @echo "if [file exists $(SIM_BUILD)/$(TOPLEVEL_LIBRARY)] {adel -lib $(SIM_BUILD)/$(TOPLEVEL_LIBRARYRTL_LIBRARY) -all}" >> $@;
104
+ @echo "alib $(SIM_BUILD)/$(TOPLEVEL_LIBRARY)" >> $@
105
+ @echo "amap $(TOPLEVEL_LIBRARY) $(SIM_BUILD)/$(TOPLEVEL_LIBRARY)" >> $@;
106
+ @echo "set worklib $(TOPLEVEL_LIBRARY)" >> $@;
107
+ ifneq ($(VHDL_SOURCES),)
108
+ @echo "acom -work $(TOPLEVEL_LIBRARY) $(ACOM_ARGS) $(call to_tcl_path,$(VHDL_SOURCES))" >> $@
109
+ endif
110
+ ifneq ($(VERILOG_SOURCES),)
111
+ @echo "alog -work $(TOPLEVEL_LIBRARY) $(ALOG_ARGS) $(call to_tcl_path,$(VERILOG_SOURCES))" >> $@
112
+ endif
113
+ ifdef SCRIPT_FILE
114
+ @echo "do $(SCRIPT_FILE)" >> $@
115
+ endif
116
+ ifneq ($(CFG_TOPLEVEL),)
117
+ @echo "asim $(ASIM_ARGS) +access +w_nets -interceptcoutput $(GPI_ARGS) $(CFG_TOPLEVEL) $(EXTRA_TOPS)" >> $@
118
+ else
119
+ @echo "asim $(ASIM_ARGS) +access +w_nets -interceptcoutput $(GPI_ARGS) $(COCOTB_TOPLEVEL) $(EXTRA_TOPS)" >> $@
120
+ endif
121
+ ifeq ($(WAVES),1)
122
+ @echo "log -recursive *" >> $@
123
+ endif
124
+ ifeq ($(GUI),1)
125
+ @echo "wave -rec *" >> $@
126
+ else
127
+ @echo "run -all" >> $@
128
+ @echo "endsim" >> $@
129
+ ifeq ($(COCOTB_USER_COVERAGE),1)
130
+ @echo "acdb report -cov $(COVERAGE_TYPES) -db $(TOPLEVEL_LIBRARY).acdb -html -o coverage/acdb_report.html" >> $@
131
+ @echo "acdb report -cov $(COVERAGE_TYPES) -db $(TOPLEVEL_LIBRARY).acdb -txt -o coverage/acdb_report.txt" >> $@
132
+ endif
133
+ @echo "exit" >> $@
134
+ endif
135
+
136
+ # Note it's the redirection of the output rather than the 'do' command
137
+ # that turns on batch mode (i.e. exit on completion/error)
138
+ $(COCOTB_RESULTS_FILE): $(SIM_BUILD)/runsim.tcl $(CUSTOM_COMPILE_DEPS) $(CUSTOM_SIM_DEPS)
139
+ $(RM) $(COCOTB_RESULTS_FILE)
140
+
141
+ set -o pipefail; GPI_EXTRA=$(GPI_EXTRA) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
142
+ 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.tcl $(SIM_CMD_SUFFIX)
143
+
144
+ $(call check_results)
@@ -0,0 +1,65 @@
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
+ ifneq ($(VHDL_SOURCES),)
8
+
9
+ $(COCOTB_RESULTS_FILE):
10
+ @echo "Skipping simulation as VHDL is not supported on simulator=$(SIM)"
11
+
12
+ else
13
+
14
+ CMD_BIN := vcs
15
+
16
+ ifdef VCS_BIN_DIR
17
+ CMD := $(shell :; command -v $(VCS_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
+ VCS_BIN_DIR := $(shell dirname $(CMD))
22
+ endif
23
+
24
+ ifdef VERILOG_INCLUDE_DIRS
25
+ COMPILE_ARGS += $(addprefix +incdir+, $(VERILOG_INCLUDE_DIRS))
26
+ endif
27
+
28
+ ifeq ($(PYTHON_ARCH),64bit)
29
+ COMPILE_ARGS += -full64
30
+ endif
31
+
32
+ ifeq ($(GUI),1)
33
+ EXTRA_ARGS += -gui
34
+ endif
35
+
36
+ # Avoid linker "undefined reference to" error
37
+ COMPILE_ARGS += -LDFLAGS -Wl,--no-as-needed
38
+
39
+ # Enables globally access for read, write, and callback capabilities.
40
+ COMPILE_ARGS += +acc+3
41
+
42
+ # Enables globally debug capabilities.
43
+ COMPILE_ARGS += -debug_access+all
44
+
45
+ # TODO:
46
+ # investigate +vpi+1 option which reduces memory requirements
47
+
48
+ # Compilation phase
49
+ $(SIM_BUILD)/simv: $(VERILOG_SOURCES) $(CUSTOM_COMPILE_DEPS) | $(SIM_BUILD)
50
+ cd $(SIM_BUILD) && \
51
+ COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) \
52
+ $(CMD) -top $(COCOTB_TOPLEVEL) $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) -sverilog \
53
+ -timescale=$(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION) \
54
+ $(EXTRA_ARGS) -load $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi vcs) $(COMPILE_ARGS) $(VERILOG_SOURCES)
55
+
56
+ # Execution phase
57
+ $(COCOTB_RESULTS_FILE): $(SIM_BUILD)/simv $(CUSTOM_SIM_DEPS)
58
+ $(RM) $(COCOTB_RESULTS_FILE)
59
+
60
+ 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) \
61
+ $(SIM_CMD_PREFIX) $(SIM_BUILD)/simv $(SIM_ARGS) $(EXTRA_ARGS) $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) $(SIM_CMD_SUFFIX)
62
+
63
+ $(call check_results)
64
+
65
+ endif
@@ -4,14 +4,11 @@
4
4
 
5
5
  TOPLEVEL_LANG ?= verilog
6
6
 
7
- include $(shell cocotb-config --makefiles)/Makefile.inc
8
-
9
7
  ifneq ($(or $(filter-out $(TOPLEVEL_LANG),verilog),$(VHDL_SOURCES)),)
10
8
 
11
9
  results.xml:
12
10
  @echo "Skipping simulation as only Verilog is supported on simulator=$(SIM)"
13
11
  debug: results.xml
14
- clean::
15
12
 
16
13
  else
17
14
 
@@ -22,28 +19,25 @@ ifdef VERILATOR_BIN_DIR
22
19
  else
23
20
  # auto-detect bin dir from system path
24
21
  CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
22
+ VERILATOR_BIN_DIR := $(shell dirname $(CMD))
25
23
  endif
26
24
 
27
- ifeq (, $(CMD))
28
- $(error Unable to locate command >$(CMD_BIN)<)
29
- endif
30
-
31
- VLT_MIN := 4.106
25
+ VLT_MIN := 5.036
32
26
  VLT_VERSION := $(shell $(CMD) --version | cut -d " " -f 2)
33
27
  MIN_VERSION := $(shell printf "%s\n%s\n" "$(VLT_MIN)" "$(VLT_VERSION)" | sort -g | head -1)
34
28
  ifneq ($(MIN_VERSION),$(VLT_MIN))
35
29
  $(error cocotb requires Verilator $(VLT_MIN) or later, but using $(VLT_VERSION))
36
30
  endif
37
31
 
38
- ifdef TOPLEVEL
39
- TOPMODULE_ARG := --top-module $(TOPLEVEL)
32
+ ifdef COCOTB_TOPLEVEL
33
+ TOPMODULE_ARG := --top-module $(COCOTB_TOPLEVEL)
40
34
  else
41
35
  TOPMODULE_ARG :=
42
36
  endif
43
37
 
44
38
  ifeq ($(VERILATOR_SIM_DEBUG), 1)
45
- COMPILE_ARGS += --debug -CFLAGS "-DVL_DEBUG -DVERILATOR_SIM_DEBUG -g"
46
- PLUSARGS += +verilator+debug
39
+ COMPILE_ARGS += --debug -CFLAGS "-DVL_DEBUG -DVERILATOR_SIM_DEBUG -g -Og"
40
+ DEBUG = +verilator+debug
47
41
  BUILD_ARGS += OPT_FAST=-Og OPT_SLOW=-Og OPT_GLOBAL=-Og
48
42
  endif
49
43
 
@@ -54,14 +48,17 @@ endif
54
48
 
55
49
  COMPILE_ARGS += --timescale $(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION)
56
50
 
57
- COMPILE_ARGS += --vpi --public-flat-rw --prefix Vtop -o Vtop -LDFLAGS "-Wl,-rpath,$(shell cocotb-config --lib-dir) -L$(shell cocotb-config --lib-dir) -lcocotbvpi_verilator"
51
+ _COCOTB_LIB_DIR = $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-dir)
52
+ COMPILE_ARGS += --vpi --public-flat-rw --prefix Vtop -o Vtop -LDFLAGS "-Wl,-rpath,$(_COCOTB_LIB_DIR) -L$(_COCOTB_LIB_DIR) -lcocotbvpi_verilator"
58
53
 
59
54
  ifdef VERILOG_INCLUDE_DIRS
60
55
  COMPILE_ARGS += $(addprefix +incdir+, $(VERILOG_INCLUDE_DIRS))
61
56
  endif
62
57
 
63
- $(SIM_BUILD)/Vtop.mk: $(VERILOG_SOURCES) $(CUSTOM_COMPILE_DEPS) $(COCOTB_SHARE_DIR)/lib/verilator/verilator.cpp | $(SIM_BUILD)
64
- $(CMD) -cc --exe -Mdir $(SIM_BUILD) -DCOCOTB_SIM=1 $(TOPMODULE_ARG) $(COMPILE_ARGS) $(EXTRA_ARGS) $(VERILOG_SOURCES) $(COCOTB_SHARE_DIR)/lib/verilator/verilator.cpp
58
+ VERILATOR_CPP := $(shell $(PYTHON_BIN) -m cocotb_tools.config --share)/lib/verilator/verilator.cpp
59
+
60
+ $(SIM_BUILD)/Vtop.mk: $(VERILOG_SOURCES) $(CUSTOM_COMPILE_DEPS) $(VERILATOR_CPP) | $(SIM_BUILD)
61
+ $(CMD) -cc --exe -Mdir $(SIM_BUILD) $(TOPMODULE_ARG) $(COMPILE_ARGS) $(EXTRA_ARGS) $(VERILOG_SOURCES) $(VERILATOR_CPP)
65
62
 
66
63
  # Compilation phase
67
64
  $(SIM_BUILD)/Vtop: $(SIM_BUILD)/Vtop.mk
@@ -70,17 +67,13 @@ $(SIM_BUILD)/Vtop: $(SIM_BUILD)/Vtop.mk
70
67
  $(COCOTB_RESULTS_FILE): $(SIM_BUILD)/Vtop $(CUSTOM_SIM_DEPS)
71
68
  $(RM) $(COCOTB_RESULTS_FILE)
72
69
 
73
- MODULE=$(MODULE) TESTCASE=$(TESTCASE) TOPLEVEL=$(TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
74
- $(SIM_CMD_PREFIX) $< $(SIM_ARGS) $(EXTRA_ARGS) $(PLUSARGS) $(SIM_CMD_SUFFIX)
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) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
71
+ $(SIM_CMD_PREFIX) $< $(SIM_ARGS) $(EXTRA_ARGS) $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) $(DEBUG) $(SIM_CMD_SUFFIX)
75
72
 
76
- $(call check_for_results_file)
73
+ $(call check_results)
77
74
 
78
75
  debug:
79
76
  $(MAKE) VERILATOR_SIM_DEBUG=1 SIM_CMD_PREFIX="gdb --args" $(COCOTB_RESULTS_FILE)
80
77
 
81
- clean::
82
- $(RM) -r $(SIM_BUILD)
83
- $(RM) dump.vcd
84
- $(RM) dump.fst
85
78
 
86
79
  endif