cocotb 1.9.2__cp313-cp313-win32.whl → 2.0.0rc2__cp313-cp313-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.
- cocotb/_ANSI.py +65 -0
- cocotb/__init__.py +81 -327
- cocotb/_base_triggers.py +515 -0
- cocotb/_bridge.py +186 -0
- cocotb/_decorators.py +515 -0
- cocotb/_deprecation.py +3 -3
- cocotb/_exceptions.py +7 -0
- cocotb/_extended_awaitables.py +419 -0
- cocotb/_gpi_triggers.py +385 -0
- cocotb/_init.py +301 -0
- cocotb/_outcomes.py +54 -0
- cocotb/_profiling.py +46 -0
- cocotb/_py_compat.py +114 -29
- cocotb/_scheduler.py +448 -0
- cocotb/_test.py +248 -0
- cocotb/_test_factory.py +312 -0
- cocotb/_test_functions.py +42 -0
- cocotb/_typing.py +7 -0
- cocotb/_utils.py +274 -0
- cocotb/_version.py +3 -7
- cocotb/_xunit_reporter.py +66 -0
- cocotb/clock.py +353 -108
- cocotb/debug.py +24 -0
- cocotb/handle.py +1370 -793
- cocotb/libs/cocotb.dll +0 -0
- cocotb/libs/cocotb.exp +0 -0
- cocotb/libs/cocotb.lib +0 -0
- cocotb/libs/cocotbfli_modelsim.dll +0 -0
- cocotb/libs/cocotbfli_modelsim.exp +0 -0
- cocotb/libs/cocotbfli_modelsim.lib +0 -0
- cocotb/libs/cocotbutils.dll +0 -0
- cocotb/libs/cocotbutils.exp +0 -0
- cocotb/libs/cocotbutils.lib +0 -0
- cocotb/libs/cocotbvhpi_aldec.dll +0 -0
- cocotb/libs/cocotbvhpi_aldec.exp +0 -0
- cocotb/libs/cocotbvhpi_aldec.lib +0 -0
- cocotb/libs/cocotbvhpi_modelsim.dll +0 -0
- cocotb/libs/cocotbvhpi_modelsim.exp +0 -0
- cocotb/libs/cocotbvhpi_modelsim.lib +0 -0
- cocotb/libs/cocotbvpi_aldec.dll +0 -0
- cocotb/libs/cocotbvpi_aldec.exp +0 -0
- cocotb/libs/cocotbvpi_aldec.lib +0 -0
- cocotb/libs/cocotbvpi_ghdl.dll +0 -0
- cocotb/libs/cocotbvpi_ghdl.exp +0 -0
- cocotb/libs/cocotbvpi_ghdl.lib +0 -0
- cocotb/libs/cocotbvpi_icarus.exp +0 -0
- cocotb/libs/cocotbvpi_icarus.lib +0 -0
- cocotb/libs/cocotbvpi_icarus.vpl +0 -0
- cocotb/libs/cocotbvpi_modelsim.dll +0 -0
- cocotb/libs/cocotbvpi_modelsim.exp +0 -0
- cocotb/libs/cocotbvpi_modelsim.lib +0 -0
- cocotb/libs/embed.dll +0 -0
- cocotb/libs/embed.exp +0 -0
- cocotb/libs/embed.lib +0 -0
- cocotb/libs/gpi.dll +0 -0
- cocotb/libs/gpi.exp +0 -0
- cocotb/libs/gpi.lib +0 -0
- cocotb/libs/gpilog.dll +0 -0
- cocotb/libs/gpilog.exp +0 -0
- cocotb/libs/gpilog.lib +0 -0
- cocotb/libs/pygpilog.dll +0 -0
- cocotb/libs/pygpilog.exp +0 -0
- cocotb/libs/pygpilog.lib +0 -0
- cocotb/logging.py +424 -0
- cocotb/queue.py +103 -57
- cocotb/regression.py +680 -717
- cocotb/result.py +17 -188
- cocotb/share/def/aldec.exp +0 -0
- cocotb/share/def/aldec.lib +0 -0
- cocotb/share/def/ghdl.exp +0 -0
- cocotb/share/def/ghdl.lib +0 -0
- cocotb/share/def/icarus.exp +0 -0
- cocotb/share/def/icarus.lib +0 -0
- cocotb/share/def/modelsim.def +1 -0
- cocotb/share/def/modelsim.exp +0 -0
- cocotb/share/def/modelsim.lib +0 -0
- cocotb/share/include/cocotb_utils.h +9 -32
- cocotb/share/include/embed.h +7 -30
- cocotb/share/include/gpi.h +331 -137
- cocotb/share/include/gpi_logging.h +221 -142
- cocotb/share/include/py_gpi_logging.h +8 -5
- cocotb/share/include/vpi_user_ext.h +4 -26
- cocotb/share/lib/verilator/verilator.cpp +80 -67
- cocotb/simtime.py +230 -0
- cocotb/simulator.cp313-win32.exp +0 -0
- cocotb/simulator.cp313-win32.lib +0 -0
- cocotb/simulator.cp313-win32.pyd +0 -0
- cocotb/simulator.pyi +107 -0
- cocotb/task.py +478 -213
- cocotb/triggers.py +55 -1092
- cocotb/types/__init__.py +28 -47
- cocotb/types/_abstract_array.py +151 -0
- cocotb/types/_array.py +295 -0
- cocotb/types/_indexing.py +17 -0
- cocotb/types/_logic.py +333 -0
- cocotb/types/_logic_array.py +868 -0
- cocotb/types/{range.py → _range.py} +47 -48
- cocotb/types/_resolve.py +76 -0
- cocotb/utils.py +58 -646
- cocotb-2.0.0rc2.dist-info/METADATA +60 -0
- cocotb-2.0.0rc2.dist-info/RECORD +146 -0
- {cocotb-1.9.2.dist-info → cocotb-2.0.0rc2.dist-info}/WHEEL +1 -1
- cocotb-2.0.0rc2.dist-info/entry_points.txt +2 -0
- {cocotb-1.9.2.dist-info → cocotb-2.0.0rc2.dist-info/licenses}/LICENSE +1 -0
- {cocotb-1.9.2.dist-info → cocotb-2.0.0rc2.dist-info}/top_level.txt +1 -0
- cocotb_tools/__init__.py +0 -0
- cocotb_tools/_coverage.py +33 -0
- cocotb_tools/_vendor/__init__.py +3 -0
- cocotb_tools/check_results.py +65 -0
- cocotb_tools/combine_results.py +152 -0
- cocotb_tools/config.py +241 -0
- {cocotb → cocotb_tools}/ipython_support.py +29 -22
- cocotb_tools/makefiles/Makefile.deprecations +27 -0
- {cocotb/share → cocotb_tools}/makefiles/Makefile.inc +77 -55
- {cocotb/share → cocotb_tools}/makefiles/Makefile.sim +16 -33
- {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.activehdl +9 -16
- cocotb_tools/makefiles/simulators/Makefile.cvc +61 -0
- cocotb_tools/makefiles/simulators/Makefile.dsim +39 -0
- {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.ghdl +13 -42
- cocotb_tools/makefiles/simulators/Makefile.icarus +80 -0
- cocotb_tools/makefiles/simulators/Makefile.ius +93 -0
- cocotb_tools/makefiles/simulators/Makefile.modelsim +9 -0
- cocotb_tools/makefiles/simulators/Makefile.nvc +60 -0
- cocotb_tools/makefiles/simulators/Makefile.questa +29 -0
- cocotb/share/makefiles/simulators/Makefile.questa → cocotb_tools/makefiles/simulators/Makefile.questa-compat +26 -54
- cocotb_tools/makefiles/simulators/Makefile.questa-qisqrun +149 -0
- {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.riviera +17 -56
- cocotb_tools/makefiles/simulators/Makefile.vcs +65 -0
- {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.verilator +15 -22
- {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.xcelium +20 -52
- cocotb_tools/py.typed +0 -0
- cocotb_tools/runner.py +1868 -0
- cocotb/_sim_versions.py → cocotb_tools/sim_versions.py +16 -21
- pygpi/entry.py +34 -18
- pygpi/py.typed +0 -0
- cocotb/ANSI.py +0 -92
- cocotb/binary.py +0 -858
- cocotb/config.py +0 -289
- cocotb/decorators.py +0 -332
- cocotb/log.py +0 -303
- cocotb/memdebug.py +0 -35
- cocotb/outcomes.py +0 -56
- cocotb/runner.py +0 -1400
- cocotb/scheduler.py +0 -1099
- cocotb/share/makefiles/Makefile.deprecations +0 -12
- cocotb/share/makefiles/simulators/Makefile.cvc +0 -94
- cocotb/share/makefiles/simulators/Makefile.icarus +0 -111
- cocotb/share/makefiles/simulators/Makefile.ius +0 -125
- cocotb/share/makefiles/simulators/Makefile.modelsim +0 -32
- cocotb/share/makefiles/simulators/Makefile.nvc +0 -64
- cocotb/share/makefiles/simulators/Makefile.vcs +0 -98
- cocotb/types/array.py +0 -309
- cocotb/types/logic.py +0 -292
- cocotb/types/logic_array.py +0 -298
- cocotb/wavedrom.py +0 -199
- cocotb/xunit_reporter.py +0 -80
- cocotb-1.9.2.dist-info/METADATA +0 -168
- cocotb-1.9.2.dist-info/RECORD +0 -121
- cocotb-1.9.2.dist-info/entry_points.txt +0 -2
- /cocotb/{_vendor/__init__.py → py.typed} +0 -0
- {cocotb → cocotb_tools}/_vendor/distutils_version.py +0 -0
|
@@ -1,33 +1,10 @@
|
|
|
1
|
-
###############################################################################
|
|
2
1
|
# Copyright (c) 2013, 2018 Potential Ventures Ltd
|
|
3
2
|
# Copyright (c) 2013 SolarFlare Communications Inc
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
# notice, this list of conditions and the following disclaimer.
|
|
10
|
-
# * Redistributions in binary form must reproduce the above copyright
|
|
11
|
-
# notice, this list of conditions and the following disclaimer in the
|
|
12
|
-
# documentation and/or other materials provided with the distribution.
|
|
13
|
-
# * Neither the name of Potential Ventures Ltd,
|
|
14
|
-
# SolarFlare Communications Inc nor the
|
|
15
|
-
# names of its contributors may be used to endorse or promote products
|
|
16
|
-
# derived from this software without specific prior written permission.
|
|
17
|
-
#
|
|
18
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
19
|
-
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
20
|
-
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
21
|
-
# DISCLAIMED. IN NO EVENT SHALL POTENTIAL VENTURES LTD BE LIABLE FOR ANY
|
|
22
|
-
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
23
|
-
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
24
|
-
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
25
|
-
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26
|
-
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
27
|
-
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
-
###############################################################################
|
|
29
|
-
|
|
30
|
-
include $(shell cocotb-config --makefiles)/Makefile.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.
|
|
31
8
|
|
|
32
9
|
CMD_BIN := vsim
|
|
33
10
|
|
|
@@ -36,10 +13,7 @@ ifdef MODELSIM_BIN_DIR
|
|
|
36
13
|
else
|
|
37
14
|
# auto-detect bin dir from system path
|
|
38
15
|
CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
ifeq (, $(CMD))
|
|
42
|
-
$(error Unable to locate command >$(CMD_BIN)<)
|
|
16
|
+
MODELSIM_BIN_DIR := $(shell dirname $(CMD))
|
|
43
17
|
endif
|
|
44
18
|
|
|
45
19
|
ifdef RTL_LIBRARY
|
|
@@ -48,7 +22,7 @@ ifdef RTL_LIBRARY
|
|
|
48
22
|
else
|
|
49
23
|
TOPLEVEL_LIBRARY ?= work
|
|
50
24
|
endif
|
|
51
|
-
|
|
25
|
+
COCOTB_TOPLEVEL := "$(TOPLEVEL_LIBRARY).$(COCOTB_TOPLEVEL)"
|
|
52
26
|
|
|
53
27
|
ifndef VLOG_ARGS
|
|
54
28
|
VLOG_ARGS = -timescale $(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION) -mfcu
|
|
@@ -73,14 +47,8 @@ else
|
|
|
73
47
|
VSIM_ARGS += -onfinish exit
|
|
74
48
|
endif
|
|
75
49
|
|
|
76
|
-
FLI_LIB := $(shell
|
|
77
|
-
|
|
78
|
-
$(FLI_LIB):
|
|
79
|
-
@echo -e "ERROR: cocotb was not installed with an FLI library, as the mti.h header could not be located.\n\
|
|
80
|
-
If you installed an FLI-capable simulator after cocotb, you will need to reinstall cocotb.\n\
|
|
81
|
-
Please check the cocotb documentation on ModelSim support." >&2 && exit 1
|
|
82
|
-
|
|
83
|
-
VHPI_LIB := $(shell cocotb-config --lib-name-path vhpi questa)
|
|
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)
|
|
84
52
|
|
|
85
53
|
GPI_EXTRA :=
|
|
86
54
|
|
|
@@ -99,13 +67,13 @@ else
|
|
|
99
67
|
VSIM_ARGS += -voptargs="-access=rw+/." -foreign \"vhpi_startup_routines_bootstrap $(call to_tcl_path,$(VHPI_LIB))\"
|
|
100
68
|
endif
|
|
101
69
|
ifneq ($(VERILOG_SOURCES),)
|
|
102
|
-
GPI_EXTRA := $(shell
|
|
70
|
+
GPI_EXTRA := $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi questa):cocotbvpi_entry_point
|
|
103
71
|
endif
|
|
104
72
|
|
|
105
73
|
else ifeq ($(TOPLEVEL_LANG),verilog)
|
|
106
|
-
VSIM_ARGS += -pli $(shell
|
|
74
|
+
VSIM_ARGS += -pli $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi questa)
|
|
107
75
|
ifneq ($(VHDL_SOURCES),)
|
|
108
|
-
GPI_EXTRA := $(shell
|
|
76
|
+
GPI_EXTRA := $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path $(VHDL_GPI_INTERFACE) questa):cocotb$(VHDL_GPI_INTERFACE)_entry_point
|
|
109
77
|
endif
|
|
110
78
|
|
|
111
79
|
else
|
|
@@ -137,12 +105,12 @@ ifneq ($(VHDL_SOURCES),)
|
|
|
137
105
|
@echo "vcom -work $(TOPLEVEL_LIBRARY) $(VCOM_ARGS) $(call to_tcl_path,$(VHDL_SOURCES))" >> $@
|
|
138
106
|
endif
|
|
139
107
|
ifneq ($(VERILOG_SOURCES),)
|
|
140
|
-
@echo "vlog -work $(TOPLEVEL_LIBRARY)
|
|
108
|
+
@echo "vlog -work $(TOPLEVEL_LIBRARY) -sv $(VLOG_ARGS) $(EXTRA_ARGS) $(call to_tcl_path,$(VERILOG_SOURCES))" >> $@
|
|
141
109
|
endif
|
|
142
110
|
ifdef SCRIPT_FILE
|
|
143
111
|
@echo "do $(SCRIPT_FILE)" >> $@
|
|
144
112
|
endif
|
|
145
|
-
@echo "vsim $(VSIM_ARGS) $(EXTRA_ARGS) $(PLUSARGS) $(
|
|
113
|
+
@echo "vsim $(VSIM_ARGS) $(EXTRA_ARGS) $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) $(COCOTB_TOPLEVEL)" >> $@
|
|
146
114
|
ifeq ($(WAVES),1)
|
|
147
115
|
@echo "log -recursive /*" >> $@
|
|
148
116
|
endif
|
|
@@ -161,11 +129,15 @@ endif
|
|
|
161
129
|
$(COCOTB_RESULTS_FILE): $(SIM_BUILD)/runsim.do
|
|
162
130
|
$(RM) $(COCOTB_RESULTS_FILE)
|
|
163
131
|
|
|
164
|
-
set -o pipefail;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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)
|
|
@@ -1,36 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
# Copyright cocotb contributors
|
|
2
2
|
# Copyright (c) 2013 Potential Ventures Ltd
|
|
3
3
|
# Copyright (c) 2013 SolarFlare Communications Inc
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# Redistribution and use in source and binary forms, with or without
|
|
7
|
-
# modification, are permitted provided that the following conditions are met:
|
|
8
|
-
# * Redistributions of source code must retain the above copyright
|
|
9
|
-
# notice, this list of conditions and the following disclaimer.
|
|
10
|
-
# * Redistributions in binary form must reproduce the above copyright
|
|
11
|
-
# notice, this list of conditions and the following disclaimer in the
|
|
12
|
-
# documentation and/or other materials provided with the distribution.
|
|
13
|
-
# * Neither the name of Potential Ventures Ltd,
|
|
14
|
-
# SolarFlare Communications Inc nor the
|
|
15
|
-
# names of its contributors may be used to endorse or promote products
|
|
16
|
-
# derived from this software without specific prior written permission.
|
|
17
|
-
#
|
|
18
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
19
|
-
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
20
|
-
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
21
|
-
# DISCLAIMED. IN NO EVENT SHALL POTENTIAL VENTURES LTD BE LIABLE FOR ANY
|
|
22
|
-
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
23
|
-
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
24
|
-
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
25
|
-
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26
|
-
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
27
|
-
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
-
###############################################################################
|
|
4
|
+
# Licensed under the Revised BSD License, see LICENSE for details.
|
|
5
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
29
6
|
|
|
30
7
|
# Common Makefile for Aldec Riviera-PRO simulator
|
|
31
8
|
|
|
32
|
-
include $(shell cocotb-config --makefiles)/Makefile.inc
|
|
33
|
-
|
|
34
9
|
ifeq ($(GUI),1)
|
|
35
10
|
CMD_BIN := riviera
|
|
36
11
|
else
|
|
@@ -42,13 +17,7 @@ ifdef ALDEC_BIN_DIR
|
|
|
42
17
|
else
|
|
43
18
|
# auto-detect bin dir from system path
|
|
44
19
|
CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
ifeq (, $(CMD))
|
|
48
|
-
$(error Unable to locate command >$(CMD_BIN)<)
|
|
49
|
-
else
|
|
50
|
-
ALDEC_BIN_DIR := $(shell dirname $(CMD))
|
|
51
|
-
export ALDEC_BIN_DIR
|
|
20
|
+
ALDEC_BIN_DIR := $(shell dirname $(CMD))
|
|
52
21
|
endif
|
|
53
22
|
|
|
54
23
|
ifeq ($(GUI),1)
|
|
@@ -67,9 +36,7 @@ ACOM_ARGS += $(COMPILE_ARGS)
|
|
|
67
36
|
ASIM_ARGS += $(SIM_ARGS)
|
|
68
37
|
|
|
69
38
|
# Plusargs need to be passed to ASIM command not vsimsa
|
|
70
|
-
ASIM_ARGS += $(PLUSARGS)
|
|
71
|
-
|
|
72
|
-
ALOG_ARGS += +define+COCOTB_SIM
|
|
39
|
+
ASIM_ARGS += $(call deprecate,PLUSARGS,COCOTB_PLUSARGS)
|
|
73
40
|
|
|
74
41
|
ifdef RTL_LIBRARY
|
|
75
42
|
$(warning Using RTL_LIBRARY is deprecated, please use TOPLEVEL_LIBRARY instead.)
|
|
@@ -79,7 +46,7 @@ else
|
|
|
79
46
|
endif
|
|
80
47
|
|
|
81
48
|
# Pass the VPI library to the Verilog compilation to get extended checking.
|
|
82
|
-
ALOG_ARGS += -pli $(shell
|
|
49
|
+
ALOG_ARGS += -pli $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi riviera)
|
|
83
50
|
|
|
84
51
|
# Aldec-specific coverage types:
|
|
85
52
|
# - (s)tatement
|
|
@@ -91,7 +58,7 @@ ALOG_ARGS += -pli $(shell cocotb-config --lib-name-path vpi riviera)
|
|
|
91
58
|
# - finite state (m)achine
|
|
92
59
|
# Documentation: Riviera Pro 2017.02 Documentation - Page 359
|
|
93
60
|
COVERAGE_TYPES ?= sb
|
|
94
|
-
ifeq ($(
|
|
61
|
+
ifeq ($(COCOTB_USER_COVERAGE),1)
|
|
95
62
|
ALOG_ARGS += -dbg -coverage $(COVERAGE_TYPES)
|
|
96
63
|
ACOM_ARGS += -dbg -coverage $(COVERAGE_TYPES)
|
|
97
64
|
|
|
@@ -100,15 +67,15 @@ endif
|
|
|
100
67
|
|
|
101
68
|
GPI_EXTRA:=
|
|
102
69
|
ifeq ($(TOPLEVEL_LANG),verilog)
|
|
103
|
-
GPI_ARGS = -pli $(shell
|
|
70
|
+
GPI_ARGS = -pli $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi riviera)
|
|
104
71
|
ifneq ($(VHDL_SOURCES),)
|
|
105
|
-
GPI_EXTRA = $(shell
|
|
72
|
+
GPI_EXTRA = $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi riviera):cocotbvhpi_entry_point
|
|
106
73
|
endif
|
|
107
74
|
|
|
108
75
|
else ifeq ($(TOPLEVEL_LANG),vhdl)
|
|
109
|
-
GPI_ARGS = -loadvhpi $(shell
|
|
76
|
+
GPI_ARGS = -loadvhpi $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi riviera):vhpi_startup_routines_bootstrap
|
|
110
77
|
ifneq ($(VERILOG_SOURCES),)
|
|
111
|
-
GPI_EXTRA = $(shell
|
|
78
|
+
GPI_EXTRA = $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi riviera):cocotbvpi_entry_point
|
|
112
79
|
endif
|
|
113
80
|
|
|
114
81
|
else
|
|
@@ -119,7 +86,7 @@ define make_lib
|
|
|
119
86
|
echo "if [file exists $(SIM_BUILD)/$(LIB)] {adel -lib $(SIM_BUILD)/$(LIB) -all}" >> $@;
|
|
120
87
|
echo "alib $(SIM_BUILD)/$(LIB)" >> $@;
|
|
121
88
|
echo "amap $(LIB) $(SIM_BUILD)/$(LIB)" >> $@;
|
|
122
|
-
echo "acom -work $(LIB) $(
|
|
89
|
+
echo "acom -work $(LIB) $(ACOM_ARGS) $(call to_tcl_path,$(VHDL_SOURCES_$(LIB)))" >> $@;
|
|
123
90
|
endef
|
|
124
91
|
|
|
125
92
|
# Create a TCL script based on the list of $(VERILOG_SOURCES)
|
|
@@ -133,7 +100,7 @@ $(SIM_BUILD)/runsim.tcl : $(VERILOG_SOURCES) $(VHDL_SOURCES) | $(SIM_BUILD)
|
|
|
133
100
|
@echo "@if [string length [array get env LICENSE_QUEUE]] {" >> $@
|
|
134
101
|
@echo " set LICENSE_QUEUE $$::env(LICENSE_QUEUE)" >> $@
|
|
135
102
|
@echo "}" >> $@
|
|
136
|
-
@echo "if [file exists $(SIM_BUILD)/$(TOPLEVEL_LIBRARY)] {adel -lib $(SIM_BUILD)/$(
|
|
103
|
+
@echo "if [file exists $(SIM_BUILD)/$(TOPLEVEL_LIBRARY)] {adel -lib $(SIM_BUILD)/$(TOPLEVEL_LIBRARYRTL_LIBRARY) -all}" >> $@;
|
|
137
104
|
@echo "alib $(SIM_BUILD)/$(TOPLEVEL_LIBRARY)" >> $@
|
|
138
105
|
@echo "amap $(TOPLEVEL_LIBRARY) $(SIM_BUILD)/$(TOPLEVEL_LIBRARY)" >> $@;
|
|
139
106
|
@echo "set worklib $(TOPLEVEL_LIBRARY)" >> $@;
|
|
@@ -149,7 +116,7 @@ endif
|
|
|
149
116
|
ifneq ($(CFG_TOPLEVEL),)
|
|
150
117
|
@echo "asim $(ASIM_ARGS) +access +w_nets -interceptcoutput $(GPI_ARGS) $(CFG_TOPLEVEL) $(EXTRA_TOPS)" >> $@
|
|
151
118
|
else
|
|
152
|
-
@echo "asim $(ASIM_ARGS) +access +w_nets -interceptcoutput $(GPI_ARGS) $(
|
|
119
|
+
@echo "asim $(ASIM_ARGS) +access +w_nets -interceptcoutput $(GPI_ARGS) $(COCOTB_TOPLEVEL) $(EXTRA_TOPS)" >> $@
|
|
153
120
|
endif
|
|
154
121
|
ifeq ($(WAVES),1)
|
|
155
122
|
@echo "log -recursive *" >> $@
|
|
@@ -159,7 +126,7 @@ ifeq ($(GUI),1)
|
|
|
159
126
|
else
|
|
160
127
|
@echo "run -all" >> $@
|
|
161
128
|
@echo "endsim" >> $@
|
|
162
|
-
ifeq ($(
|
|
129
|
+
ifeq ($(COCOTB_USER_COVERAGE),1)
|
|
163
130
|
@echo "acdb report -cov $(COVERAGE_TYPES) -db $(TOPLEVEL_LIBRARY).acdb -html -o coverage/acdb_report.html" >> $@
|
|
164
131
|
@echo "acdb report -cov $(COVERAGE_TYPES) -db $(TOPLEVEL_LIBRARY).acdb -txt -o coverage/acdb_report.txt" >> $@
|
|
165
132
|
endif
|
|
@@ -172,12 +139,6 @@ $(COCOTB_RESULTS_FILE): $(SIM_BUILD)/runsim.tcl $(CUSTOM_COMPILE_DEPS) $(CUSTOM_
|
|
|
172
139
|
$(RM) $(COCOTB_RESULTS_FILE)
|
|
173
140
|
|
|
174
141
|
set -o pipefail; GPI_EXTRA=$(GPI_EXTRA) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
$(call check_for_results_file)
|
|
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)
|
|
178
143
|
|
|
179
|
-
|
|
180
|
-
$(RM) -r $(SIM_BUILD)
|
|
181
|
-
$(RM) -r compile
|
|
182
|
-
$(RM) -r library.cfg
|
|
183
|
-
$(RM) -r dataset.asdb
|
|
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
|
|
@@ -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
|
-
|
|
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
|
|
39
|
-
TOPMODULE_ARG := --top-module $(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
64
|
-
|
|
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
|
-
|
|
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
|
|
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
|