cocotb 2.0.0rc2__cp310-cp310-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-310-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,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 -kdb
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
@@ -0,0 +1,79 @@
1
+ # Copyright cocotb contributors
2
+ # Licensed under the Revised BSD License, see LICENSE for details.
3
+ # SPDX-License-Identifier: BSD-3-Clause
4
+
5
+ TOPLEVEL_LANG ?= verilog
6
+
7
+ ifneq ($(or $(filter-out $(TOPLEVEL_LANG),verilog),$(VHDL_SOURCES)),)
8
+
9
+ results.xml:
10
+ @echo "Skipping simulation as only Verilog is supported on simulator=$(SIM)"
11
+ debug: results.xml
12
+
13
+ else
14
+
15
+ CMD_BIN := verilator
16
+
17
+ ifdef VERILATOR_BIN_DIR
18
+ CMD := $(shell :; command -v $(VERILATOR_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
+ VERILATOR_BIN_DIR := $(shell dirname $(CMD))
23
+ endif
24
+
25
+ VLT_MIN := 5.036
26
+ VLT_VERSION := $(shell $(CMD) --version | cut -d " " -f 2)
27
+ MIN_VERSION := $(shell printf "%s\n%s\n" "$(VLT_MIN)" "$(VLT_VERSION)" | sort -g | head -1)
28
+ ifneq ($(MIN_VERSION),$(VLT_MIN))
29
+ $(error cocotb requires Verilator $(VLT_MIN) or later, but using $(VLT_VERSION))
30
+ endif
31
+
32
+ ifdef COCOTB_TOPLEVEL
33
+ TOPMODULE_ARG := --top-module $(COCOTB_TOPLEVEL)
34
+ else
35
+ TOPMODULE_ARG :=
36
+ endif
37
+
38
+ ifeq ($(VERILATOR_SIM_DEBUG), 1)
39
+ COMPILE_ARGS += --debug -CFLAGS "-DVL_DEBUG -DVERILATOR_SIM_DEBUG -g -Og"
40
+ DEBUG = +verilator+debug
41
+ BUILD_ARGS += OPT_FAST=-Og OPT_SLOW=-Og OPT_GLOBAL=-Og
42
+ endif
43
+
44
+ ifeq ($(VERILATOR_TRACE),1)
45
+ COMPILE_ARGS += --trace --trace-structs
46
+ SIM_ARGS += --trace
47
+ endif
48
+
49
+ COMPILE_ARGS += --timescale $(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION)
50
+
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"
53
+
54
+ ifdef VERILOG_INCLUDE_DIRS
55
+ COMPILE_ARGS += $(addprefix +incdir+, $(VERILOG_INCLUDE_DIRS))
56
+ endif
57
+
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)
62
+
63
+ # Compilation phase
64
+ $(SIM_BUILD)/Vtop: $(SIM_BUILD)/Vtop.mk
65
+ $(MAKE) -C $(SIM_BUILD) $(BUILD_ARGS) -f Vtop.mk
66
+
67
+ $(COCOTB_RESULTS_FILE): $(SIM_BUILD)/Vtop $(CUSTOM_SIM_DEPS)
68
+ $(RM) $(COCOTB_RESULTS_FILE)
69
+
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)
72
+
73
+ $(call check_results)
74
+
75
+ debug:
76
+ $(MAKE) VERILATOR_SIM_DEBUG=1 SIM_CMD_PREFIX="gdb --args" $(COCOTB_RESULTS_FILE)
77
+
78
+
79
+ endif
@@ -0,0 +1,104 @@
1
+ # Copyright cocotb contributors
2
+ # Copyright (c) 2013, 2018 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 Xcelium
8
+
9
+ CMD_BIN := xrun
10
+
11
+ ifdef XCELIUM_BIN_DIR
12
+ CMD := $(shell :; command -v $(XCELIUM_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
+ XCELIUM_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 += -xmlibdirpath $(SIM_BUILD)
32
+ ifeq ($(DEBUG),1)
33
+ EXTRA_ARGS += -pliverbose
34
+ EXTRA_ARGS += -messages
35
+ EXTRA_ARGS += -plidebug # Enhance the profile output with PLI info
36
+ EXTRA_ARGS += -plierr_verbose # Expand handle info in PLI/VPI/VHPI messages
37
+ EXTRA_ARGS += -vpicompat 1800v2005 # <1364v1995|1364v2001|1364v2005|1800v2005> Specify the IEEE VPI
38
+ else
39
+ EXTRA_ARGS += -plinowarn
40
+ endif
41
+
42
+ ifeq ($(GUI),1)
43
+ EXTRA_ARGS += -gui
44
+ else
45
+ EXTRA_ARGS +=
46
+ endif
47
+
48
+ # Xcelium errors out if multiple timescales are specified on the command line.
49
+ ifneq (,$(filter -timescale%,$(EXTRA_ARGS)))
50
+ $(error Please use COCOTB_HDL_TIMEUNIT and COCOTB_HDL_TIMEPRECISION to specify timescale.)
51
+ endif
52
+
53
+ # Loading the VHPI library causes an error, so we always load the VPI library and supply
54
+ # GPI_EXTRA=$(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi xcelium) if needed.
55
+
56
+ # Xcelium will use default vlog_startup_routines symbol only if VPI library name is libvpi.so
57
+ GPI_ARGS = -loadvpi $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi xcelium):vlog_startup_routines_bootstrap
58
+ ifeq ($(TOPLEVEL_LANG),verilog)
59
+ HDL_SOURCES = $(VERILOG_SOURCES)
60
+ ROOT_LEVEL = $(COCOTB_TOPLEVEL)
61
+ EXTRA_ARGS += -top $(COCOTB_TOPLEVEL)
62
+ ifneq ($(VHDL_SOURCES),)
63
+ HDL_SOURCES += $(VHDL_SOURCES)
64
+ GPI_EXTRA = $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi xcelium):cocotbvhpi_entry_point
65
+ endif
66
+ else ifeq ($(TOPLEVEL_LANG),vhdl)
67
+ GPI_EXTRA = $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi xcelium):cocotbvhpi_entry_point
68
+ EXTRA_ARGS += -top $(COCOTB_TOPLEVEL)
69
+ # Xcelium 23.09.004 fixes cocotb issue #1076 as long as the following define
70
+ # is set.
71
+ EXTRA_ARGS += -NEW_VHPI_PROPAGATE_DELAY
72
+ ifdef RTL_LIBRARY
73
+ $(warning Using RTL_LIBRARY is deprecated, please use TOPLEVEL_LIBRARY instead.)
74
+ TOPLEVEL_LIBRARY ?= $(RTL_LIBRARY)
75
+ else
76
+ TOPLEVEL_LIBRARY ?= work
77
+ endif
78
+ MAKE_LIB = -makelib $(TOPLEVEL_LIBRARY)
79
+ END_LIB = -endlib
80
+ HDL_SOURCES = $(VHDL_SOURCES)
81
+ ifneq ($(VERILOG_SOURCES),)
82
+ HDL_SOURCES += $(VERILOG_SOURCES)
83
+ endif
84
+ else
85
+ $(error A valid value (verilog or vhdl) was not provided for TOPLEVEL_LANG=$(TOPLEVEL_LANG))
86
+ endif
87
+
88
+ # Builds a list of arguments to support VHDL libraries specified in VHDL_SOURCES_*:
89
+ LIBS := $(foreach LIB, $(VHDL_LIB_ORDER),-makelib $(LIB) $(VHDL_SOURCES_$(LIB)) -endlib)
90
+
91
+ $(COCOTB_RESULTS_FILE): $(HDL_SOURCES) $(CUSTOM_COMPILE_DEPS) $(CUSTOM_SIM_DEPS) | $(SIM_BUILD)
92
+ $(RM) $(COCOTB_RESULTS_FILE)
93
+
94
+ # Make sure all libs in SOURCES_VHDL_* are mentioned in VHDL_LIB_ORDER and vice versa
95
+ $(foreach LIB, $(VHDL_LIB_ORDER), $(check_vhdl_sources))
96
+ $(foreach SOURCES_VAR, $(filter VHDL_SOURCES_%, $(.VARIABLES)), $(check_lib_order))
97
+
98
+ set -o pipefail; \
99
+ 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) \
100
+ $(SIM_CMD_PREFIX) $(CMD) -timescale $(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION) \
101
+ -vhdl_time_precision "$(COCOTB_HDL_TIMEPRECISION)" \
102
+ $(EXTRA_ARGS) $(GPI_ARGS) $(INCDIRS) -access +rwc -createdebugdb $(LIBS) $(MAKE_LIB) $(HDL_SOURCES) $(END_LIB) $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) $(SIM_CMD_SUFFIX)
103
+
104
+ $(call check_results)
cocotb_tools/py.typed ADDED
File without changes