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