cocotb 1.9.2__cp312-cp312-win_amd64.whl → 2.0.0rc2__cp312-cp312-win_amd64.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.cp312-win_amd64.exp +0 -0
- cocotb/simulator.cp312-win_amd64.lib +0 -0
- cocotb/simulator.cp312-win_amd64.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
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
# Common Makefile for the Aldec Active-HDL simulator
|
|
6
6
|
|
|
7
|
-
include $(shell cocotb-config --makefiles)/Makefile.inc
|
|
8
|
-
|
|
9
7
|
CMD_BIN := vsimsa
|
|
10
8
|
|
|
11
9
|
ifdef ACTIVEHDL_BIN_DIR
|
|
@@ -13,6 +11,7 @@ ifdef ACTIVEHDL_BIN_DIR
|
|
|
13
11
|
else
|
|
14
12
|
# auto-detect bin dir from system path
|
|
15
13
|
CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
|
|
14
|
+
ACTIVEHDL_BIN_DIR := $(shell dirname $(CMD))
|
|
16
15
|
endif
|
|
17
16
|
|
|
18
17
|
ALOG_ARGS += -timescale $(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION)
|
|
@@ -22,8 +21,6 @@ ALOG_ARGS += $(COMPILE_ARGS)
|
|
|
22
21
|
ACOM_ARGS += $(COMPILE_ARGS)
|
|
23
22
|
ASIM_ARGS += $(SIM_ARGS)
|
|
24
23
|
|
|
25
|
-
ALOG_ARGS += +define+COCOTB_SIM -dbg
|
|
26
|
-
|
|
27
24
|
ifdef RTL_LIBRARY
|
|
28
25
|
$(warning Using RTL_LIBRARY is deprecated, please use TOPLEVEL_LIBRARY instead.)
|
|
29
26
|
TOPLEVEL_LIBRARY ?= $(RTL_LIBRARY)
|
|
@@ -31,21 +28,22 @@ else
|
|
|
31
28
|
TOPLEVEL_LIBRARY ?= work
|
|
32
29
|
endif
|
|
33
30
|
|
|
31
|
+
ALOG_ARGS += -dbg
|
|
34
32
|
ACOM_ARGS += -dbg
|
|
35
33
|
|
|
36
34
|
GPI_EXTRA:=
|
|
37
35
|
ifeq ($(TOPLEVEL_LANG),verilog)
|
|
38
36
|
# backslashes needed because we embed in `echo` below
|
|
39
|
-
GPI_ARGS = -pli \"$(shell
|
|
37
|
+
GPI_ARGS = -pli \"$(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi activehdl)\"
|
|
40
38
|
ifneq ($(VHDL_SOURCES),)
|
|
41
|
-
GPI_EXTRA = $(shell
|
|
39
|
+
GPI_EXTRA = $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi activehdl):cocotbvhpi_entry_point
|
|
42
40
|
endif
|
|
43
41
|
|
|
44
42
|
else ifeq ($(TOPLEVEL_LANG),vhdl)
|
|
45
43
|
# backslashes needed because we embed in `echo` below
|
|
46
|
-
GPI_ARGS = -loadvhpi \"$(shell
|
|
44
|
+
GPI_ARGS = -loadvhpi \"$(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi activehdl):vhpi_startup_routines_bootstrap\"
|
|
47
45
|
ifneq ($(VERILOG_SOURCES),)
|
|
48
|
-
GPI_EXTRA = $(shell
|
|
46
|
+
GPI_EXTRA = $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi activehdl):cocotbvpi_entry_point
|
|
49
47
|
endif
|
|
50
48
|
else
|
|
51
49
|
$(error A valid value (verilog or vhdl) was not provided for TOPLEVEL_LANG=$(TOPLEVEL_LANG))
|
|
@@ -61,7 +59,7 @@ endif
|
|
|
61
59
|
ifneq ($(VERILOG_SOURCES),)
|
|
62
60
|
@echo "alog $(ALOG_ARGS) $(call to_tcl_path,$(VERILOG_SOURCES))" >> $@
|
|
63
61
|
endif
|
|
64
|
-
@echo "asim $(ASIM_ARGS) $(PLUSARGS) +access +w_nets -interceptcoutput $(GPI_ARGS) $(
|
|
62
|
+
@echo "asim $(ASIM_ARGS) $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) +access +w_nets -interceptcoutput $(GPI_ARGS) $(COCOTB_TOPLEVEL) $(EXTRA_TOPS)" >> $@
|
|
65
63
|
@echo "run -all" >> $@
|
|
66
64
|
@echo "endsim" >> $@
|
|
67
65
|
|
|
@@ -69,11 +67,6 @@ $(COCOTB_RESULTS_FILE): $(SIM_BUILD)/runsim.do $(CUSTOM_COMPILE_DEPS) $(CUSTOM_S
|
|
|
69
67
|
$(RM) $(COCOTB_RESULTS_FILE)
|
|
70
68
|
|
|
71
69
|
set -o pipefail; GPI_EXTRA=$(GPI_EXTRA) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
$(call check_for_results_file)
|
|
70
|
+
COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) $(SIM_CMD_PREFIX) $(CMD) $(RUN_ARGS) -do $(SIM_BUILD)/runsim.do $(SIM_CMD_SUFFIX)
|
|
75
71
|
|
|
76
|
-
|
|
77
|
-
$(RM) -r $(SIM_BUILD)
|
|
78
|
-
$(RM) -r work
|
|
79
|
-
$(RM) -r wave.asdb
|
|
72
|
+
$(call check_results)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Copyright cocotb contributors
|
|
2
|
+
# Copyright (c) 2014 Potential Ventures Ltd
|
|
3
|
+
# Licensed under the Revised BSD License, see LICENSE for details.
|
|
4
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
|
|
6
|
+
ifneq ($(VHDL_SOURCES),)
|
|
7
|
+
|
|
8
|
+
$(COCOTB_RESULTS_FILE):
|
|
9
|
+
@echo "Skipping simulation as VHDL is not supported on simulator=$(SIM)"
|
|
10
|
+
debug: $(COCOTB_RESULTS_FILE)
|
|
11
|
+
|
|
12
|
+
else
|
|
13
|
+
|
|
14
|
+
CMD_BIN := cvc64
|
|
15
|
+
|
|
16
|
+
ifdef CVC_BIN_DIR
|
|
17
|
+
CMD := $(shell :; command -v $(CVC_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
|
|
18
|
+
else
|
|
19
|
+
# auto-detect bin dir from system path
|
|
20
|
+
CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
|
|
21
|
+
CVC_BIN_DIR := $(shell dirname $(CMD))
|
|
22
|
+
endif
|
|
23
|
+
|
|
24
|
+
#only interpreted mode works for the moment
|
|
25
|
+
CVC_ITERP ?= 1
|
|
26
|
+
|
|
27
|
+
ifeq ($(CVC_ITERP),1)
|
|
28
|
+
CVC_ARGS += +interp
|
|
29
|
+
endif
|
|
30
|
+
|
|
31
|
+
# Compilation phase
|
|
32
|
+
$(SIM_BUILD)/sim.vvp: $(VERILOG_SOURCES) $(CUSTOM_COMPILE_DEPS) | $(SIM_BUILD)
|
|
33
|
+
COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) \
|
|
34
|
+
COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
|
|
35
|
+
$(CMD) $(CVC_ARGS) +acc+2 -o $(SIM_BUILD)/sim.vvp +loadvpi=$(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi cvc):vlog_startup_routines_bootstrap $(COMPILE_ARGS) $(EXTRA_ARGS) $(VERILOG_SOURCES)
|
|
36
|
+
|
|
37
|
+
# Execution phase
|
|
38
|
+
ifeq ($(CVC_ITERP),1)
|
|
39
|
+
$(COCOTB_RESULTS_FILE): $(SIM_BUILD)/sim.vvp
|
|
40
|
+
else
|
|
41
|
+
$(COCOTB_RESULTS_FILE): $(SIM_BUILD)/sim.vvp $(CUSTOM_SIM_DEPS)
|
|
42
|
+
COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) \
|
|
43
|
+
COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
|
|
44
|
+
$(SIM_CMD_PREFIX) $(SIM_BUILD)/sim.vvp $(SIM_ARGS) $(EXTRA_ARGS) $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) $(SIM_CMD_SUFFIX)
|
|
45
|
+
endif
|
|
46
|
+
|
|
47
|
+
# Execution phase
|
|
48
|
+
ifeq ($(CVC_ITERP),1)
|
|
49
|
+
debug: $(CUSTOM_SIM_DEPS)
|
|
50
|
+
COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) \
|
|
51
|
+
COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
|
|
52
|
+
$(SIM_CMD_PREFIX) gdb --args $(CMD) $(CVC_ARGS) +acc+2 -o $(SIM_BUILD)/sim.vvp +loadvpi=$(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi cvc):vlog_startup_routines_bootstrap $(COMPILE_ARGS) $(EXTRA_ARGS) $(VERILOG_SOURCES)
|
|
53
|
+
else
|
|
54
|
+
debug: $(SIM_BUILD)/sim.vvp $(CUSTOM_SIM_DEPS)
|
|
55
|
+
COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) \
|
|
56
|
+
COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
|
|
57
|
+
gdb --args $(SIM_BUILD)/sim.vvp $(SIM_ARGS) $(EXTRA_ARGS) $(call deprecate,PLUSARGS,COCOTB_PLUSARGS)
|
|
58
|
+
endif
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
endif
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Copyright cocotb contributors
|
|
2
|
+
# Licensed under the Revised BSD License, see LICENSE for details.
|
|
3
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
+
|
|
5
|
+
CMD_BIN := dsim
|
|
6
|
+
|
|
7
|
+
ifdef DSIM_BIN_DIR
|
|
8
|
+
CMD := $(shell :; command -v $(DSIM_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
|
|
9
|
+
else
|
|
10
|
+
# auto-detect bin dir from system path
|
|
11
|
+
CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
|
|
12
|
+
endif
|
|
13
|
+
|
|
14
|
+
ifeq (, $(CMD))
|
|
15
|
+
$(error Unable to locate command >$(CMD_BIN)<)
|
|
16
|
+
endif
|
|
17
|
+
|
|
18
|
+
ifeq ($(WAVES), 1)
|
|
19
|
+
WAVE_ARG := -waves file.vcd
|
|
20
|
+
else
|
|
21
|
+
WAVE_ARG :=
|
|
22
|
+
endif
|
|
23
|
+
|
|
24
|
+
TOPMODULE_ARG = -top $(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL)
|
|
25
|
+
|
|
26
|
+
DSIM_ARGS = -work $(SIM_BUILD) -pli_lib $(shell cocotb-config --lib-name-path vpi dsim) +acc+rwcbfsWF
|
|
27
|
+
COMP_ARGS = $(DSIM_ARGS) -genimage image -timescale $(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION)
|
|
28
|
+
RUN_ARGS = $(DSIM_ARGS) -image image $(WAVE_ARG)
|
|
29
|
+
|
|
30
|
+
$(SIM_BUILD)/image.so: $(VERILOG_SOURCES) $(CUSTOM_COMPILE_DEPS)
|
|
31
|
+
$(SIM_CMD_PREFIX) $(CMD) $(COMP_ARGS) $(TOPMODULE_ARG) $(EXTRA_ARGS) $(VERILOG_SOURCES)
|
|
32
|
+
|
|
33
|
+
$(COCOTB_RESULTS_FILE): $(SIM_BUILD)/image.so $(CUSTOM_SIM_DEPS)
|
|
34
|
+
$(RM) $(COCOTB_RESULTS_FILE)
|
|
35
|
+
COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) \
|
|
36
|
+
GPI_EXTRA=$(GPI_EXTRA) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
|
|
37
|
+
$(SIM_CMD_PREFIX) $(CMD) $(RUN_ARGS) $(TOPMODULE_ARG) $(EXTRA_ARGS) $(VERILOG_SOURCES)
|
|
38
|
+
|
|
39
|
+
$(call check_results)
|
|
@@ -1,40 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
# Copyright cocotb contributors
|
|
2
2
|
# Copyright (c) 2014 Potential Ventures Ltd
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# Redistribution and use in source and binary forms, with or without
|
|
6
|
-
# modification, are permitted provided that the following conditions are met:
|
|
7
|
-
# * Redistributions of source code must retain the above copyright
|
|
8
|
-
# notice, this list of conditions and the following disclaimer.
|
|
9
|
-
# * Redistributions in binary form must reproduce the above copyright
|
|
10
|
-
# notice, this list of conditions and the following disclaimer in the
|
|
11
|
-
# documentation and/or other materials provided with the distribution.
|
|
12
|
-
# * Neither the name of Potential Ventures Ltd,
|
|
13
|
-
# SolarFlare Communications Inc nor the
|
|
14
|
-
# names of its contributors may be used to endorse or promote products
|
|
15
|
-
# derived from this software without specific prior written permission.
|
|
16
|
-
#
|
|
17
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
18
|
-
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
19
|
-
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
20
|
-
# DISCLAIMED. IN NO EVENT SHALL POTENTIAL VENTURES LTD BE LIABLE FOR ANY
|
|
21
|
-
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
22
|
-
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
23
|
-
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
24
|
-
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
25
|
-
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
26
|
-
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
-
###############################################################################
|
|
3
|
+
# Licensed under the Revised BSD License, see LICENSE for details.
|
|
4
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
28
5
|
|
|
29
6
|
TOPLEVEL_LANG ?= vhdl
|
|
30
7
|
|
|
31
|
-
include $(shell cocotb-config --makefiles)/Makefile.inc
|
|
32
|
-
|
|
33
8
|
ifneq ($(or $(filter-out $(TOPLEVEL_LANG),vhdl),$(VERILOG_SOURCES)),)
|
|
34
9
|
|
|
35
10
|
$(COCOTB_RESULTS_FILE):
|
|
36
11
|
@echo "Skipping simulation as only VHDL is supported on simulator=$(SIM)"
|
|
37
|
-
clean::
|
|
38
12
|
|
|
39
13
|
else
|
|
40
14
|
|
|
@@ -45,16 +19,15 @@ ifdef GHDL_BIN_DIR
|
|
|
45
19
|
else
|
|
46
20
|
# auto-detect bin dir from system path
|
|
47
21
|
CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
|
|
22
|
+
GHDL_BIN_DIR := $(shell dirname $(CMD))
|
|
48
23
|
endif
|
|
49
24
|
|
|
50
|
-
|
|
51
|
-
$(
|
|
25
|
+
ifdef RTL_LIBRARY
|
|
26
|
+
$(warning Using RTL_LIBRARY is deprecated, please use TOPLEVEL_LIBRARY instead.)
|
|
27
|
+
TOPLEVEL_LIBRARY ?= $(RTL_LIBRARY)
|
|
52
28
|
else
|
|
53
|
-
|
|
54
|
-
export GHDL_BIN_DIR
|
|
29
|
+
TOPLEVEL_LIBRARY ?= work
|
|
55
30
|
endif
|
|
56
|
-
|
|
57
|
-
RTL_LIBRARY ?= work
|
|
58
31
|
GHDL_ARGS ?=
|
|
59
32
|
GHDL_ARGS += $(EXTRA_ARGS)
|
|
60
33
|
|
|
@@ -97,17 +70,15 @@ endif
|
|
|
97
70
|
analyse: $(VHDL_SOURCES) $(CUSTOM_COMPILE_DEPS) | $(SIM_BUILD)
|
|
98
71
|
$(foreach SOURCES_VAR, $(filter VHDL_SOURCES_%, $(.VARIABLES)), \
|
|
99
72
|
$(CMD) -i $(GHDL_ARGS) $(COMPILE_ARGS) --workdir=$(SIM_BUILD) --work=$(SOURCES_VAR:VHDL_SOURCES_%=%) $($(SOURCES_VAR)) && ) \
|
|
100
|
-
$(CMD) -i $(GHDL_ARGS) $(COMPILE_ARGS) --workdir=$(SIM_BUILD) --work=$(
|
|
101
|
-
$(CMD) -m $(GHDL_ARGS) $(COMPILE_ARGS) --workdir=$(SIM_BUILD) -P$(SIM_BUILD) --work=$(
|
|
73
|
+
$(CMD) -i $(GHDL_ARGS) $(COMPILE_ARGS) --workdir=$(SIM_BUILD) --work=$(TOPLEVEL_LIBRARY) $(VHDL_SOURCES) && \
|
|
74
|
+
$(CMD) -m $(GHDL_ARGS) $(COMPILE_ARGS) --workdir=$(SIM_BUILD) -P$(SIM_BUILD) --work=$(TOPLEVEL_LIBRARY) $(COCOTB_TOPLEVEL) $(ARCH)
|
|
102
75
|
|
|
103
76
|
$(COCOTB_RESULTS_FILE): analyse $(CUSTOM_SIM_DEPS)
|
|
104
77
|
$(RM) $(COCOTB_RESULTS_FILE)
|
|
105
78
|
|
|
106
|
-
|
|
107
|
-
$(SIM_CMD_PREFIX) $(CMD) -r $(GHDL_ARGS) $(GHDL_RUN_ARGS) --workdir=$(SIM_BUILD) -P$(SIM_BUILD) --work=$(
|
|
79
|
+
COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
|
|
80
|
+
$(SIM_CMD_PREFIX) $(CMD) -r $(GHDL_ARGS) $(GHDL_RUN_ARGS) --workdir=$(SIM_BUILD) -P$(SIM_BUILD) --work=$(TOPLEVEL_LIBRARY) $(COCOTB_TOPLEVEL) $(ARCH) --vpi=$(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi ghdl) $(SIM_ARGS) $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) $(SIM_CMD_SUFFIX)
|
|
108
81
|
|
|
109
|
-
$(call
|
|
82
|
+
$(call check_results)
|
|
110
83
|
|
|
111
|
-
clean::
|
|
112
|
-
$(RM) -r $(SIM_BUILD)
|
|
113
84
|
endif
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Copyright cocotb contributors
|
|
2
|
+
# Copyright (c) 2013 Potential Ventures Ltd
|
|
3
|
+
# Copyright (c) 2013 SolarFlare Communications Inc
|
|
4
|
+
# Licensed under the Revised BSD License, see LICENSE for details.
|
|
5
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
+
|
|
7
|
+
TOPLEVEL_LANG ?= verilog
|
|
8
|
+
|
|
9
|
+
ifneq ($(or $(filter-out $(TOPLEVEL_LANG),verilog),$(VHDL_SOURCES)),)
|
|
10
|
+
|
|
11
|
+
$(COCOTB_RESULTS_FILE):
|
|
12
|
+
@echo "Skipping simulation as only Verilog is supported on simulator=$(SIM)"
|
|
13
|
+
debug: $(COCOTB_RESULTS_FILE)
|
|
14
|
+
|
|
15
|
+
else
|
|
16
|
+
|
|
17
|
+
CMD_BIN := iverilog
|
|
18
|
+
|
|
19
|
+
ifdef ICARUS_BIN_DIR
|
|
20
|
+
CMD := $(shell :; command -v $(ICARUS_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
|
|
21
|
+
else
|
|
22
|
+
# auto-detect bin dir from system path
|
|
23
|
+
CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
|
|
24
|
+
ICARUS_BIN_DIR := $(shell dirname $(CMD))
|
|
25
|
+
endif
|
|
26
|
+
|
|
27
|
+
ifdef COCOTB_TOPLEVEL
|
|
28
|
+
TOPMODULE_ARG := -s $(COCOTB_TOPLEVEL)
|
|
29
|
+
else
|
|
30
|
+
TOPMODULE_ARG :=
|
|
31
|
+
endif
|
|
32
|
+
|
|
33
|
+
COMPILE_ARGS += -f $(SIM_BUILD)/cmds.f
|
|
34
|
+
|
|
35
|
+
ifdef VERILOG_INCLUDE_DIRS
|
|
36
|
+
COMPILE_ARGS += $(addprefix -I, $(VERILOG_INCLUDE_DIRS))
|
|
37
|
+
endif
|
|
38
|
+
|
|
39
|
+
# Compilation phase
|
|
40
|
+
|
|
41
|
+
ifeq ($(WAVES), 1)
|
|
42
|
+
VERILOG_SOURCES += $(SIM_BUILD)/cocotb_iverilog_dump.v
|
|
43
|
+
COMPILE_ARGS += -s cocotb_iverilog_dump
|
|
44
|
+
FST = -fst
|
|
45
|
+
else
|
|
46
|
+
# Disable waveform output
|
|
47
|
+
FST = -none
|
|
48
|
+
endif
|
|
49
|
+
|
|
50
|
+
$(SIM_BUILD)/sim.vvp: $(VERILOG_SOURCES) $(CUSTOM_COMPILE_DEPS) | $(SIM_BUILD)
|
|
51
|
+
@echo "+timescale+$(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION)" > $(SIM_BUILD)/cmds.f
|
|
52
|
+
$(CMD) -o $(SIM_BUILD)/sim.vvp $(TOPMODULE_ARG) -g2012 $(COMPILE_ARGS) $(EXTRA_ARGS) $(VERILOG_SOURCES)
|
|
53
|
+
|
|
54
|
+
$(SIM_BUILD)/cocotb_iverilog_dump.v: | $(SIM_BUILD)
|
|
55
|
+
@echo 'module cocotb_iverilog_dump();' > $@
|
|
56
|
+
@echo 'initial begin' >> $@
|
|
57
|
+
@echo ' $$dumpfile("$(SIM_BUILD)/$(COCOTB_TOPLEVEL).fst");' >> $@
|
|
58
|
+
@echo ' $$dumpvars(0, $(COCOTB_TOPLEVEL));' >> $@
|
|
59
|
+
@echo 'end' >> $@
|
|
60
|
+
@echo 'endmodule' >> $@
|
|
61
|
+
|
|
62
|
+
# Execution phase
|
|
63
|
+
|
|
64
|
+
$(COCOTB_RESULTS_FILE): $(SIM_BUILD)/sim.vvp $(CUSTOM_SIM_DEPS)
|
|
65
|
+
$(RM) $(COCOTB_RESULTS_FILE)
|
|
66
|
+
|
|
67
|
+
COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
|
|
68
|
+
$(SIM_CMD_PREFIX) $(ICARUS_BIN_DIR)/vvp -M $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-dir) -m $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name vpi icarus) $(SIM_ARGS) $(EXTRA_ARGS) $(SIM_BUILD)/sim.vvp $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) $(FST) $(SIM_CMD_SUFFIX)
|
|
69
|
+
|
|
70
|
+
$(call check_results)
|
|
71
|
+
|
|
72
|
+
debug: $(SIM_BUILD)/sim.vvp $(CUSTOM_SIM_DEPS)
|
|
73
|
+
$(RM) -r $(COCOTB_RESULTS_FILE)
|
|
74
|
+
|
|
75
|
+
COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
|
|
76
|
+
$(SIM_CMD_PREFIX) gdb --args $(ICARUS_BIN_DIR)/vvp -M $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-dir) -m $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name vpi icarus) $(SIM_BUILD)/sim.vvp $(SIM_ARGS) $(EXTRA_ARGS) $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) $(FST) $(SIM_CMD_SUFFIX)
|
|
77
|
+
|
|
78
|
+
$(call check_results)
|
|
79
|
+
|
|
80
|
+
endif
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Copyright cocotb contributors
|
|
2
|
+
# Copyright (c) 2013 Potential Ventures Ltd
|
|
3
|
+
# Copyright (c) 2013 SolarFlare Communications Inc
|
|
4
|
+
# Licensed under the Revised BSD License, see LICENSE for details.
|
|
5
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
+
|
|
7
|
+
# Common Makefile for Cadence Incisive
|
|
8
|
+
|
|
9
|
+
CMD_BIN := irun
|
|
10
|
+
|
|
11
|
+
ifdef IUS_BIN_DIR
|
|
12
|
+
CMD := $(shell :; command -v $(IUS_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
|
|
13
|
+
else
|
|
14
|
+
# auto-detect bin dir from system path
|
|
15
|
+
CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
|
|
16
|
+
IUS_BIN_DIR := $(shell dirname $(CMD))
|
|
17
|
+
endif
|
|
18
|
+
|
|
19
|
+
ifdef VERILOG_INCLUDE_DIRS
|
|
20
|
+
COMPILE_ARGS += $(addprefix +incdir+, $(VERILOG_INCLUDE_DIRS))
|
|
21
|
+
endif
|
|
22
|
+
|
|
23
|
+
EXTRA_ARGS += $(COMPILE_ARGS)
|
|
24
|
+
EXTRA_ARGS += $(SIM_ARGS)
|
|
25
|
+
EXTRA_ARGS += -licqueue
|
|
26
|
+
|
|
27
|
+
ifeq ($(PYTHON_ARCH),64bit)
|
|
28
|
+
EXTRA_ARGS += -64
|
|
29
|
+
endif
|
|
30
|
+
|
|
31
|
+
EXTRA_ARGS += -nclibdirpath $(SIM_BUILD)
|
|
32
|
+
EXTRA_ARGS += -plinowarn
|
|
33
|
+
|
|
34
|
+
ifeq ($(GUI),1)
|
|
35
|
+
EXTRA_ARGS += -gui
|
|
36
|
+
else
|
|
37
|
+
EXTRA_ARGS +=
|
|
38
|
+
endif
|
|
39
|
+
|
|
40
|
+
# IUS errors out if multiple timescales are specified on the command line.
|
|
41
|
+
ifneq (,$(findstring timescale,$(EXTRA_ARGS)))
|
|
42
|
+
$(error Please use COCOTB_HDL_TIMEUNIT and COCOTB_HDL_TIMEPRECISION to specify timescale.)
|
|
43
|
+
endif
|
|
44
|
+
|
|
45
|
+
# Loading the VHPI library causes an error, so we always load the VPI library and supply
|
|
46
|
+
# GPI_EXTRA=$(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi ius) if needed.
|
|
47
|
+
|
|
48
|
+
# Xcelium will use default vlog_startup_routines symbol only if vpi library name is libvpi.so
|
|
49
|
+
GPI_ARGS = -loadvpi $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vpi ius):vlog_startup_routines_bootstrap
|
|
50
|
+
|
|
51
|
+
ifeq ($(TOPLEVEL_LANG),verilog)
|
|
52
|
+
EXTRA_ARGS += -v93
|
|
53
|
+
HDL_SOURCES = $(VERILOG_SOURCES)
|
|
54
|
+
ROOT_LEVEL = $(COCOTB_TOPLEVEL)
|
|
55
|
+
ifneq ($(VHDL_SOURCES),)
|
|
56
|
+
HDL_SOURCES += $(VHDL_SOURCES)
|
|
57
|
+
GPI_EXTRA = $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi ius):cocotbvhpi_entry_point
|
|
58
|
+
endif
|
|
59
|
+
else ifeq ($(TOPLEVEL_LANG),vhdl)
|
|
60
|
+
GPI_EXTRA = $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi ius):cocotbvhpi_entry_point
|
|
61
|
+
EXTRA_ARGS += -v93
|
|
62
|
+
EXTRA_ARGS += -top $(COCOTB_TOPLEVEL)
|
|
63
|
+
ifdef RTL_LIBRARY
|
|
64
|
+
$(warning Using RTL_LIBRARY is deprecated, please use TOPLEVEL_LIBRARY instead.)
|
|
65
|
+
TOPLEVEL_LIBRARY ?= $(RTL_LIBRARY)
|
|
66
|
+
else
|
|
67
|
+
TOPLEVEL_LIBRARY ?= work
|
|
68
|
+
endif
|
|
69
|
+
MAKE_LIB = -makelib $(TOPLEVEL_LIBRARY)
|
|
70
|
+
HDL_SOURCES = $(VHDL_SOURCES)
|
|
71
|
+
ifneq ($(VERILOG_SOURCES),)
|
|
72
|
+
HDL_SOURCES += $(VERILOG_SOURCES)
|
|
73
|
+
endif
|
|
74
|
+
else
|
|
75
|
+
$(error A valid value (verilog or vhdl) was not provided for TOPLEVEL_LANG=$(TOPLEVEL_LANG))
|
|
76
|
+
endif
|
|
77
|
+
|
|
78
|
+
# Builds a list of arguments to support VHDL libraries specified in VHDL_SOURCES_*:
|
|
79
|
+
LIBS := $(foreach LIB, $(VHDL_LIB_ORDER),-makelib $(LIB) $(VHDL_SOURCES_$(LIB)) -endlib)
|
|
80
|
+
|
|
81
|
+
$(COCOTB_RESULTS_FILE): $(HDL_SOURCES) $(CUSTOM_COMPILE_DEPS) $(CUSTOM_SIM_DEPS) | $(SIM_BUILD)
|
|
82
|
+
$(RM) $(COCOTB_RESULTS_FILE)
|
|
83
|
+
|
|
84
|
+
# Make sure all libs in SOURCES_VHDL_* are mentioned in VHDL_LIB_ORDER and vice versa
|
|
85
|
+
$(foreach LIB, $(VHDL_LIB_ORDER), $(check_vhdl_sources))
|
|
86
|
+
$(foreach SOURCES_VAR, $(filter VHDL_SOURCES_%, $(.VARIABLES)), $(check_lib_order))
|
|
87
|
+
|
|
88
|
+
set -o pipefail; \
|
|
89
|
+
COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) GPI_EXTRA=$(GPI_EXTRA) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
|
|
90
|
+
$(SIM_CMD_PREFIX) $(CMD) -timescale $(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION) \
|
|
91
|
+
$(EXTRA_ARGS) $(GPI_ARGS) +access+rwc $(LIBS) $(MAKE_LIB) $(HDL_SOURCES) $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) $(SIM_CMD_SUFFIX)
|
|
92
|
+
|
|
93
|
+
$(call check_results)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Copyright cocotb contributors
|
|
2
|
+
# Copyright (c) 2013 Potential Ventures Ltd
|
|
3
|
+
# Copyright (c) 2013 SolarFlare Communications Inc
|
|
4
|
+
# Licensed under the Revised BSD License, see LICENSE for details.
|
|
5
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# Identical to Questa with the compat flow.
|
|
9
|
+
include $(COCOTB_MAKEFILES_DIR)/simulators/Makefile.questa-compat
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Copyright cocotb contributors
|
|
2
|
+
# Licensed under the Revised BSD License, see LICENSE for details.
|
|
3
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
+
|
|
5
|
+
ifneq ($(VERILOG_SOURCES),)
|
|
6
|
+
|
|
7
|
+
$(COCOTB_RESULTS_FILE):
|
|
8
|
+
@echo "Skipping simulation as Verilog is not supported on simulator=$(SIM)"
|
|
9
|
+
|
|
10
|
+
else
|
|
11
|
+
|
|
12
|
+
CMD_BIN := nvc
|
|
13
|
+
|
|
14
|
+
ifdef NVC_BIN_DIR
|
|
15
|
+
CMD := $(shell :; command -v $(NVC_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
|
|
16
|
+
else
|
|
17
|
+
# auto-detect bin dir from system path
|
|
18
|
+
CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
|
|
19
|
+
NVC_BIN_DIR := $(shell dirname $(CMD))
|
|
20
|
+
endif
|
|
21
|
+
|
|
22
|
+
PRESERVE_CASE := $(shell $(CMD) --version | $(PYTHON_BIN) -c "from cocotb_tools.sim_versions import NvcVersion; import sys; print('--preserve-case' if NvcVersion.from_commandline(sys.stdin.read()) > NvcVersion('1.16') else '')")
|
|
23
|
+
|
|
24
|
+
ifdef RTL_LIBRARY
|
|
25
|
+
$(warning Using RTL_LIBRARY is deprecated, please use TOPLEVEL_LIBRARY instead.)
|
|
26
|
+
TOPLEVEL_LIBRARY ?= $(RTL_LIBRARY)
|
|
27
|
+
else
|
|
28
|
+
TOPLEVEL_LIBRARY ?= work
|
|
29
|
+
endif
|
|
30
|
+
|
|
31
|
+
.PHONY: analyse
|
|
32
|
+
|
|
33
|
+
# Split SIM_ARGS into those options that need to be passed to -e and
|
|
34
|
+
# those that need to be passed to -r
|
|
35
|
+
NVC_E_FILTER := -g% --cover --cover=%
|
|
36
|
+
|
|
37
|
+
NVC_E_ARGS := $(filter $(NVC_E_FILTER),$(SIM_ARGS))
|
|
38
|
+
NVC_R_ARGS := $(filter-out $(NVC_E_FILTER),$(SIM_ARGS))
|
|
39
|
+
|
|
40
|
+
# Compilation phase
|
|
41
|
+
analyse: $(VHDL_SOURCES) $(SIM_BUILD) $(CUSTOM_COMPILE_DEPS)
|
|
42
|
+
# Make sure all libs in SOURCES_VHDL_* are mentioned in VHDL_LIB_ORDER and vice versa
|
|
43
|
+
$(foreach LIB, $(VHDL_LIB_ORDER), $(check_vhdl_sources))
|
|
44
|
+
$(foreach SOURCES_VAR, $(filter VHDL_SOURCES_%, $(.VARIABLES)), $(check_lib_order))
|
|
45
|
+
|
|
46
|
+
$(foreach LIB_VAR,$(VHDL_LIB_ORDER), \
|
|
47
|
+
$(CMD) $(EXTRA_ARGS) --work=$(LIB_VAR):$(SIM_BUILD)/$(LIB_VAR) -L $(SIM_BUILD) -a $(VHDL_SOURCES_$(LIB_VAR)) $(PRESERVE_CASE) $(COMPILE_ARGS) && ) \
|
|
48
|
+
$(CMD) $(EXTRA_ARGS) --work=$(TOPLEVEL_LIBRARY):$(SIM_BUILD)/$(TOPLEVEL_LIBRARY) -L $(SIM_BUILD) -a $(VHDL_SOURCES) $(PRESERVE_CASE) $(COMPILE_ARGS)
|
|
49
|
+
|
|
50
|
+
$(COCOTB_RESULTS_FILE): analyse $(CUSTOM_SIM_DEPS)
|
|
51
|
+
$(RM) $(COCOTB_RESULTS_FILE)
|
|
52
|
+
|
|
53
|
+
COCOTB_TESTCASE=$(call deprecate,TESTCASE,COCOTB_TESTCASE) COCOTB_TEST_FILTER=$(COCOTB_TEST_FILTER) COCOTB_TEST_MODULES=$(call deprecate,MODULE,COCOTB_TEST_MODULES) COCOTB_TOPLEVEL=$(call deprecate,TOPLEVEL,COCOTB_TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
|
|
54
|
+
$(SIM_CMD_PREFIX) $(CMD) $(EXTRA_ARGS) --work=$(TOPLEVEL_LIBRARY):$(SIM_BUILD)/$(TOPLEVEL_LIBRARY) -L $(SIM_BUILD) \
|
|
55
|
+
-e $(COCOTB_TOPLEVEL) --no-save $(NVC_E_ARGS) \
|
|
56
|
+
-r --load $(shell $(PYTHON_BIN) -m cocotb_tools.config --lib-name-path vhpi nvc) $(TRACE) $(NVC_R_ARGS) $(call deprecate,PLUSARGS,COCOTB_PLUSARGS) $(SIM_CMD_SUFFIX)
|
|
57
|
+
|
|
58
|
+
$(call check_results)
|
|
59
|
+
|
|
60
|
+
endif
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Copyright cocotb contributors
|
|
2
|
+
# Licensed under the Revised BSD License, see LICENSE for details.
|
|
3
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
+
|
|
5
|
+
# Detect the version of Questa in use to choose the best flow.
|
|
6
|
+
|
|
7
|
+
CMD_BIN := vsim
|
|
8
|
+
|
|
9
|
+
ifdef MODELSIM_BIN_DIR
|
|
10
|
+
CMD := $(shell :; command -v $(MODELSIM_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
|
|
11
|
+
else
|
|
12
|
+
# auto-detect bin dir from system path
|
|
13
|
+
CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
|
|
14
|
+
endif
|
|
15
|
+
|
|
16
|
+
# Determine the version of Questa being used.
|
|
17
|
+
QUESTA_VERSION := $(shell $(CMD) -version | $(PYTHON_BIN) -c 'import re,sys; print(re.sub(r".+vsim (\d+)\.(\d).+", "\\1 \\2", sys.stdin.read()))')
|
|
18
|
+
QUESTA_VERSION_MAJOR := $(firstword $(QUESTA_VERSION))
|
|
19
|
+
QUESTA_VERSION_MINOR := $(lastword $(QUESTA_VERSION))
|
|
20
|
+
|
|
21
|
+
# Use the QIS/Qrun flow for Questa >= 2025.2 (the first version which fully
|
|
22
|
+
# passes the cocotb regression suite). Use the compat flow otherwise.
|
|
23
|
+
ifeq ($(shell test $(QUESTA_VERSION_MAJOR)$(QUESTA_VERSION_MINOR) -lt 20252; echo $$?),0)
|
|
24
|
+
$(info Using the Questa compat flow for Questa version $(QUESTA_VERSION_MAJOR).$(QUESTA_VERSION_MINOR) < 2025.2. Run make with SIM=questa-qisqrun to force the newer QIS/Qrun flow.)
|
|
25
|
+
include $(COCOTB_MAKEFILES_DIR)/simulators/Makefile.questa-compat
|
|
26
|
+
else
|
|
27
|
+
$(info Using the Questa QIS/Qrun flow for Questa $(QUESTA_VERSION_MAJOR).$(QUESTA_VERSION_MINOR) >= 2025.2. Run make with SIM=questa-compat for the compat flow.)
|
|
28
|
+
include $(COCOTB_MAKEFILES_DIR)/simulators/Makefile.questa-qisqrun
|
|
29
|
+
endif
|