cocotb 1.9.2__cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.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 +92 -0
- cocotb/__init__.py +371 -0
- cocotb/_deprecation.py +36 -0
- cocotb/_py_compat.py +63 -0
- cocotb/_sim_versions.py +145 -0
- cocotb/_vendor/__init__.py +0 -0
- cocotb/_vendor/distutils_version.py +346 -0
- cocotb/_version.py +8 -0
- cocotb/binary.py +858 -0
- cocotb/clock.py +174 -0
- cocotb/config.py +289 -0
- cocotb/decorators.py +332 -0
- cocotb/handle.py +1175 -0
- cocotb/ipython_support.py +92 -0
- cocotb/libs/libcocotb.so +0 -0
- cocotb/libs/libcocotbfli_modelsim.so +0 -0
- cocotb/libs/libcocotbutils.so +0 -0
- cocotb/libs/libcocotbvhpi_aldec.so +0 -0
- cocotb/libs/libcocotbvhpi_ius.so +0 -0
- cocotb/libs/libcocotbvhpi_modelsim.so +0 -0
- cocotb/libs/libcocotbvhpi_nvc.so +0 -0
- cocotb/libs/libcocotbvpi_aldec.so +0 -0
- cocotb/libs/libcocotbvpi_ghdl.so +0 -0
- cocotb/libs/libcocotbvpi_icarus.vpl +0 -0
- cocotb/libs/libcocotbvpi_ius.so +0 -0
- cocotb/libs/libcocotbvpi_modelsim.so +0 -0
- cocotb/libs/libcocotbvpi_vcs.so +0 -0
- cocotb/libs/libcocotbvpi_verilator.so +0 -0
- cocotb/libs/libembed.so +0 -0
- cocotb/libs/libgpi.so +0 -0
- cocotb/libs/libgpilog.so +0 -0
- cocotb/libs/libpygpilog.so +0 -0
- cocotb/log.py +303 -0
- cocotb/memdebug.py +35 -0
- cocotb/outcomes.py +56 -0
- cocotb/queue.py +179 -0
- cocotb/regression.py +933 -0
- cocotb/result.py +209 -0
- cocotb/runner.py +1400 -0
- cocotb/scheduler.py +1099 -0
- cocotb/share/def/.gitignore +2 -0
- cocotb/share/def/README.md +4 -0
- cocotb/share/def/aldec.def +61 -0
- cocotb/share/def/ghdl.def +43 -0
- cocotb/share/def/icarus.def +43 -0
- cocotb/share/def/modelsim.def +137 -0
- cocotb/share/include/cocotb_utils.h +93 -0
- cocotb/share/include/embed.h +56 -0
- cocotb/share/include/exports.h +20 -0
- cocotb/share/include/gpi.h +265 -0
- cocotb/share/include/gpi_logging.h +212 -0
- cocotb/share/include/py_gpi_logging.h +30 -0
- cocotb/share/include/vhpi_user_ext.h +26 -0
- cocotb/share/include/vpi_user_ext.h +55 -0
- cocotb/share/lib/verilator/verilator.cpp +196 -0
- cocotb/share/makefiles/Makefile.deprecations +12 -0
- cocotb/share/makefiles/Makefile.inc +176 -0
- cocotb/share/makefiles/Makefile.sim +113 -0
- cocotb/share/makefiles/simulators/Makefile.activehdl +79 -0
- cocotb/share/makefiles/simulators/Makefile.cvc +94 -0
- cocotb/share/makefiles/simulators/Makefile.ghdl +113 -0
- cocotb/share/makefiles/simulators/Makefile.icarus +111 -0
- cocotb/share/makefiles/simulators/Makefile.ius +125 -0
- cocotb/share/makefiles/simulators/Makefile.modelsim +32 -0
- cocotb/share/makefiles/simulators/Makefile.nvc +64 -0
- cocotb/share/makefiles/simulators/Makefile.questa +171 -0
- cocotb/share/makefiles/simulators/Makefile.riviera +183 -0
- cocotb/share/makefiles/simulators/Makefile.vcs +98 -0
- cocotb/share/makefiles/simulators/Makefile.verilator +86 -0
- cocotb/share/makefiles/simulators/Makefile.xcelium +136 -0
- cocotb/simulator.cpython-313-x86_64-linux-gnu.so +0 -0
- cocotb/task.py +325 -0
- cocotb/triggers.py +1104 -0
- cocotb/types/__init__.py +50 -0
- cocotb/types/array.py +309 -0
- cocotb/types/logic.py +292 -0
- cocotb/types/logic_array.py +298 -0
- cocotb/types/range.py +198 -0
- cocotb/utils.py +698 -0
- cocotb/wavedrom.py +199 -0
- cocotb/xunit_reporter.py +80 -0
- cocotb-1.9.2.dist-info/LICENSE +28 -0
- cocotb-1.9.2.dist-info/METADATA +168 -0
- cocotb-1.9.2.dist-info/RECORD +89 -0
- cocotb-1.9.2.dist-info/WHEEL +6 -0
- cocotb-1.9.2.dist-info/entry_points.txt +2 -0
- cocotb-1.9.2.dist-info/top_level.txt +21 -0
- pygpi/__init__.py +0 -0
- pygpi/entry.py +26 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
# Copyright (c) 2013 Potential Ventures Ltd
|
|
3
|
+
# Copyright (c) 2013 SolarFlare Communications Inc
|
|
4
|
+
# All rights reserved.
|
|
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
|
+
###############################################################################
|
|
29
|
+
|
|
30
|
+
# Common Makefile for Aldec Riviera-PRO simulator
|
|
31
|
+
|
|
32
|
+
include $(shell cocotb-config --makefiles)/Makefile.inc
|
|
33
|
+
|
|
34
|
+
ifeq ($(GUI),1)
|
|
35
|
+
CMD_BIN := riviera
|
|
36
|
+
else
|
|
37
|
+
CMD_BIN := vsimsa
|
|
38
|
+
endif
|
|
39
|
+
|
|
40
|
+
ifdef ALDEC_BIN_DIR
|
|
41
|
+
CMD := $(shell :; command -v $(ALDEC_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
|
|
42
|
+
else
|
|
43
|
+
# auto-detect bin dir from system path
|
|
44
|
+
CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
|
|
45
|
+
endif
|
|
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
|
|
52
|
+
endif
|
|
53
|
+
|
|
54
|
+
ifeq ($(GUI),1)
|
|
55
|
+
CMD += -nosplash
|
|
56
|
+
endif
|
|
57
|
+
|
|
58
|
+
ALOG_ARGS += -timescale $(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION)
|
|
59
|
+
|
|
60
|
+
ifdef VERILOG_INCLUDE_DIRS
|
|
61
|
+
ALOG_ARGS += $(addprefix +incdir+, $(VERILOG_INCLUDE_DIRS))
|
|
62
|
+
endif
|
|
63
|
+
|
|
64
|
+
# below allows for maintaining legacy syntax as well as enables using cross-simulator vars COMPILE_ARGS/SIM_ARGS
|
|
65
|
+
ALOG_ARGS += $(COMPILE_ARGS)
|
|
66
|
+
ACOM_ARGS += $(COMPILE_ARGS)
|
|
67
|
+
ASIM_ARGS += $(SIM_ARGS)
|
|
68
|
+
|
|
69
|
+
# Plusargs need to be passed to ASIM command not vsimsa
|
|
70
|
+
ASIM_ARGS += $(PLUSARGS)
|
|
71
|
+
|
|
72
|
+
ALOG_ARGS += +define+COCOTB_SIM
|
|
73
|
+
|
|
74
|
+
ifdef RTL_LIBRARY
|
|
75
|
+
$(warning Using RTL_LIBRARY is deprecated, please use TOPLEVEL_LIBRARY instead.)
|
|
76
|
+
TOPLEVEL_LIBRARY ?= $(RTL_LIBRARY)
|
|
77
|
+
else
|
|
78
|
+
TOPLEVEL_LIBRARY ?= work
|
|
79
|
+
endif
|
|
80
|
+
|
|
81
|
+
# Pass the VPI library to the Verilog compilation to get extended checking.
|
|
82
|
+
ALOG_ARGS += -pli $(shell cocotb-config --lib-name-path vpi riviera)
|
|
83
|
+
|
|
84
|
+
# Aldec-specific coverage types:
|
|
85
|
+
# - (s)tatement
|
|
86
|
+
# - (b)ranch
|
|
87
|
+
# - (e)xpression
|
|
88
|
+
# - (c)ondition
|
|
89
|
+
# - (a)ssertion
|
|
90
|
+
# - (p)ath
|
|
91
|
+
# - finite state (m)achine
|
|
92
|
+
# Documentation: Riviera Pro 2017.02 Documentation - Page 359
|
|
93
|
+
COVERAGE_TYPES ?= sb
|
|
94
|
+
ifeq ($(COVERAGE),1)
|
|
95
|
+
ALOG_ARGS += -dbg -coverage $(COVERAGE_TYPES)
|
|
96
|
+
ACOM_ARGS += -dbg -coverage $(COVERAGE_TYPES)
|
|
97
|
+
|
|
98
|
+
ASIM_ARGS += -dbg -acdb -acdb_cov $(COVERAGE_TYPES)
|
|
99
|
+
endif
|
|
100
|
+
|
|
101
|
+
GPI_EXTRA:=
|
|
102
|
+
ifeq ($(TOPLEVEL_LANG),verilog)
|
|
103
|
+
GPI_ARGS = -pli $(shell cocotb-config --lib-name-path vpi riviera)
|
|
104
|
+
ifneq ($(VHDL_SOURCES),)
|
|
105
|
+
GPI_EXTRA = $(shell cocotb-config --lib-name-path vhpi riviera):cocotbvhpi_entry_point
|
|
106
|
+
endif
|
|
107
|
+
|
|
108
|
+
else ifeq ($(TOPLEVEL_LANG),vhdl)
|
|
109
|
+
GPI_ARGS = -loadvhpi $(shell cocotb-config --lib-name-path vhpi riviera):vhpi_startup_routines_bootstrap
|
|
110
|
+
ifneq ($(VERILOG_SOURCES),)
|
|
111
|
+
GPI_EXTRA = $(shell cocotb-config --lib-name-path vpi riviera):cocotbvpi_entry_point
|
|
112
|
+
endif
|
|
113
|
+
|
|
114
|
+
else
|
|
115
|
+
$(error A valid value (verilog or vhdl) was not provided for TOPLEVEL_LANG=$(TOPLEVEL_LANG))
|
|
116
|
+
endif
|
|
117
|
+
|
|
118
|
+
define make_lib
|
|
119
|
+
echo "if [file exists $(SIM_BUILD)/$(LIB)] {adel -lib $(SIM_BUILD)/$(LIB) -all}" >> $@;
|
|
120
|
+
echo "alib $(SIM_BUILD)/$(LIB)" >> $@;
|
|
121
|
+
echo "amap $(LIB) $(SIM_BUILD)/$(LIB)" >> $@;
|
|
122
|
+
echo "acom -work $(LIB) $(VCOM_ARGS) $(call to_tcl_path,$(VHDL_SOURCES_$(LIB)))" >> $@;
|
|
123
|
+
endef
|
|
124
|
+
|
|
125
|
+
# Create a TCL script based on the list of $(VERILOG_SOURCES)
|
|
126
|
+
$(SIM_BUILD)/runsim.tcl : $(VERILOG_SOURCES) $(VHDL_SOURCES) | $(SIM_BUILD)
|
|
127
|
+
@echo "onerror {" > $@
|
|
128
|
+
@echo " puts [read [open sim.log r]]" >> $@
|
|
129
|
+
@echo " quit -code 1" >> $@
|
|
130
|
+
@echo "}" >> $@
|
|
131
|
+
@echo "amap -c" >> $@
|
|
132
|
+
$(foreach LIB, $(VHDL_LIB_ORDER), $(make_lib))
|
|
133
|
+
@echo "@if [string length [array get env LICENSE_QUEUE]] {" >> $@
|
|
134
|
+
@echo " set LICENSE_QUEUE $$::env(LICENSE_QUEUE)" >> $@
|
|
135
|
+
@echo "}" >> $@
|
|
136
|
+
@echo "if [file exists $(SIM_BUILD)/$(TOPLEVEL_LIBRARY)] {adel -lib $(SIM_BUILD)/$(TOPLEVEL_LIBRARY) -all}" >> $@;
|
|
137
|
+
@echo "alib $(SIM_BUILD)/$(TOPLEVEL_LIBRARY)" >> $@
|
|
138
|
+
@echo "amap $(TOPLEVEL_LIBRARY) $(SIM_BUILD)/$(TOPLEVEL_LIBRARY)" >> $@;
|
|
139
|
+
@echo "set worklib $(TOPLEVEL_LIBRARY)" >> $@;
|
|
140
|
+
ifneq ($(VHDL_SOURCES),)
|
|
141
|
+
@echo "acom -work $(TOPLEVEL_LIBRARY) $(ACOM_ARGS) $(call to_tcl_path,$(VHDL_SOURCES))" >> $@
|
|
142
|
+
endif
|
|
143
|
+
ifneq ($(VERILOG_SOURCES),)
|
|
144
|
+
@echo "alog -work $(TOPLEVEL_LIBRARY) $(ALOG_ARGS) $(call to_tcl_path,$(VERILOG_SOURCES))" >> $@
|
|
145
|
+
endif
|
|
146
|
+
ifdef SCRIPT_FILE
|
|
147
|
+
@echo "do $(SCRIPT_FILE)" >> $@
|
|
148
|
+
endif
|
|
149
|
+
ifneq ($(CFG_TOPLEVEL),)
|
|
150
|
+
@echo "asim $(ASIM_ARGS) +access +w_nets -interceptcoutput $(GPI_ARGS) $(CFG_TOPLEVEL) $(EXTRA_TOPS)" >> $@
|
|
151
|
+
else
|
|
152
|
+
@echo "asim $(ASIM_ARGS) +access +w_nets -interceptcoutput $(GPI_ARGS) $(TOPLEVEL) $(EXTRA_TOPS)" >> $@
|
|
153
|
+
endif
|
|
154
|
+
ifeq ($(WAVES),1)
|
|
155
|
+
@echo "log -recursive *" >> $@
|
|
156
|
+
endif
|
|
157
|
+
ifeq ($(GUI),1)
|
|
158
|
+
@echo "wave -rec *" >> $@
|
|
159
|
+
else
|
|
160
|
+
@echo "run -all" >> $@
|
|
161
|
+
@echo "endsim" >> $@
|
|
162
|
+
ifeq ($(COVERAGE),1)
|
|
163
|
+
@echo "acdb report -cov $(COVERAGE_TYPES) -db $(TOPLEVEL_LIBRARY).acdb -html -o coverage/acdb_report.html" >> $@
|
|
164
|
+
@echo "acdb report -cov $(COVERAGE_TYPES) -db $(TOPLEVEL_LIBRARY).acdb -txt -o coverage/acdb_report.txt" >> $@
|
|
165
|
+
endif
|
|
166
|
+
@echo "exit" >> $@
|
|
167
|
+
endif
|
|
168
|
+
|
|
169
|
+
# Note it's the redirection of the output rather than the 'do' command
|
|
170
|
+
# that turns on batch mode (i.e. exit on completion/error)
|
|
171
|
+
$(COCOTB_RESULTS_FILE): $(SIM_BUILD)/runsim.tcl $(CUSTOM_COMPILE_DEPS) $(CUSTOM_SIM_DEPS)
|
|
172
|
+
$(RM) $(COCOTB_RESULTS_FILE)
|
|
173
|
+
|
|
174
|
+
set -o pipefail; GPI_EXTRA=$(GPI_EXTRA) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
|
|
175
|
+
MODULE=$(MODULE) TESTCASE=$(TESTCASE) TOPLEVEL=$(TOPLEVEL) $(SIM_CMD_PREFIX) $(CMD) $(RUN_ARGS) -do $(SIM_BUILD)/runsim.tcl $(SIM_CMD_SUFFIX)
|
|
176
|
+
|
|
177
|
+
$(call check_for_results_file)
|
|
178
|
+
|
|
179
|
+
clean::
|
|
180
|
+
$(RM) -r $(SIM_BUILD)
|
|
181
|
+
$(RM) -r compile
|
|
182
|
+
$(RM) -r library.cfg
|
|
183
|
+
$(RM) -r dataset.asdb
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
# Copyright (c) 2013 Potential Ventures Ltd
|
|
3
|
+
# Copyright (c) 2013 SolarFlare Communications Inc
|
|
4
|
+
# All rights reserved.
|
|
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
|
+
###############################################################################
|
|
29
|
+
|
|
30
|
+
include $(shell cocotb-config --makefiles)/Makefile.inc
|
|
31
|
+
|
|
32
|
+
ifneq ($(VHDL_SOURCES),)
|
|
33
|
+
|
|
34
|
+
$(COCOTB_RESULTS_FILE):
|
|
35
|
+
@echo "Skipping simulation as VHDL is not supported on simulator=$(SIM)"
|
|
36
|
+
clean::
|
|
37
|
+
|
|
38
|
+
else
|
|
39
|
+
|
|
40
|
+
CMD_BIN := vcs
|
|
41
|
+
|
|
42
|
+
ifdef VCS_BIN_DIR
|
|
43
|
+
CMD := $(shell :; command -v $(VCS_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
|
|
44
|
+
else
|
|
45
|
+
# auto-detect bin dir from system path
|
|
46
|
+
CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
|
|
47
|
+
endif
|
|
48
|
+
|
|
49
|
+
ifeq (, $(CMD))
|
|
50
|
+
$(error Unable to locate command >$(CMD_BIN)<)
|
|
51
|
+
else
|
|
52
|
+
VCS_BIN_DIR := $(shell dirname $(CMD))
|
|
53
|
+
export VCS_BIN_DIR
|
|
54
|
+
endif
|
|
55
|
+
|
|
56
|
+
ifdef VERILOG_INCLUDE_DIRS
|
|
57
|
+
COMPILE_ARGS += $(addprefix +incdir+, $(VERILOG_INCLUDE_DIRS))
|
|
58
|
+
endif
|
|
59
|
+
|
|
60
|
+
ifeq ($(PYTHON_ARCH),64bit)
|
|
61
|
+
EXTRA_ARGS += -full64
|
|
62
|
+
endif
|
|
63
|
+
|
|
64
|
+
ifeq ($(GUI),1)
|
|
65
|
+
EXTRA_ARGS += -gui
|
|
66
|
+
endif
|
|
67
|
+
|
|
68
|
+
# TODO:
|
|
69
|
+
# investigate +vpi+1 option which reduces memory requirements
|
|
70
|
+
|
|
71
|
+
# Can't do this using an argument, we have to create a PLI table file
|
|
72
|
+
# enabling write access to the design
|
|
73
|
+
$(SIM_BUILD)/pli.tab : | $(SIM_BUILD)
|
|
74
|
+
echo "acc+=rw,wn:*" > $@
|
|
75
|
+
|
|
76
|
+
# Compilation phase
|
|
77
|
+
$(SIM_BUILD)/simv: $(VERILOG_SOURCES) $(SIM_BUILD)/pli.tab $(CUSTOM_COMPILE_DEPS) | $(SIM_BUILD)
|
|
78
|
+
cd $(SIM_BUILD) && \
|
|
79
|
+
TOPLEVEL=$(TOPLEVEL) \
|
|
80
|
+
$(CMD) -top $(TOPLEVEL) $(PLUSARGS) -debug_access+r+w-memcbk -debug_region+cell +vpi -P pli.tab +define+COCOTB_SIM=1 -sverilog \
|
|
81
|
+
-timescale=$(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION) \
|
|
82
|
+
$(EXTRA_ARGS) -debug -load $(shell cocotb-config --lib-name-path vpi vcs) $(COMPILE_ARGS) $(VERILOG_SOURCES)
|
|
83
|
+
|
|
84
|
+
# Execution phase
|
|
85
|
+
$(COCOTB_RESULTS_FILE): $(SIM_BUILD)/simv $(CUSTOM_SIM_DEPS)
|
|
86
|
+
$(RM) $(COCOTB_RESULTS_FILE)
|
|
87
|
+
|
|
88
|
+
MODULE=$(MODULE) TESTCASE=$(TESTCASE) TOPLEVEL=$(TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
|
|
89
|
+
$(SIM_CMD_PREFIX) $(SIM_BUILD)/simv +define+COCOTB_SIM=1 $(SIM_ARGS) $(EXTRA_ARGS) $(PLUSARGS) $(SIM_CMD_SUFFIX)
|
|
90
|
+
|
|
91
|
+
$(call check_for_results_file)
|
|
92
|
+
|
|
93
|
+
clean::
|
|
94
|
+
$(RM) -r $(SIM_BUILD)
|
|
95
|
+
$(RM) -r simv.daidir
|
|
96
|
+
$(RM) -r cm.log
|
|
97
|
+
$(RM) -r ucli.key
|
|
98
|
+
endif
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Copyright cocotb contributors
|
|
2
|
+
# Licensed under the Revised BSD License, see LICENSE for details.
|
|
3
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
+
|
|
5
|
+
TOPLEVEL_LANG ?= verilog
|
|
6
|
+
|
|
7
|
+
include $(shell cocotb-config --makefiles)/Makefile.inc
|
|
8
|
+
|
|
9
|
+
ifneq ($(or $(filter-out $(TOPLEVEL_LANG),verilog),$(VHDL_SOURCES)),)
|
|
10
|
+
|
|
11
|
+
results.xml:
|
|
12
|
+
@echo "Skipping simulation as only Verilog is supported on simulator=$(SIM)"
|
|
13
|
+
debug: results.xml
|
|
14
|
+
clean::
|
|
15
|
+
|
|
16
|
+
else
|
|
17
|
+
|
|
18
|
+
CMD_BIN := verilator
|
|
19
|
+
|
|
20
|
+
ifdef VERILATOR_BIN_DIR
|
|
21
|
+
CMD := $(shell :; command -v $(VERILATOR_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
|
|
22
|
+
else
|
|
23
|
+
# auto-detect bin dir from system path
|
|
24
|
+
CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
|
|
25
|
+
endif
|
|
26
|
+
|
|
27
|
+
ifeq (, $(CMD))
|
|
28
|
+
$(error Unable to locate command >$(CMD_BIN)<)
|
|
29
|
+
endif
|
|
30
|
+
|
|
31
|
+
VLT_MIN := 4.106
|
|
32
|
+
VLT_VERSION := $(shell $(CMD) --version | cut -d " " -f 2)
|
|
33
|
+
MIN_VERSION := $(shell printf "%s\n%s\n" "$(VLT_MIN)" "$(VLT_VERSION)" | sort -g | head -1)
|
|
34
|
+
ifneq ($(MIN_VERSION),$(VLT_MIN))
|
|
35
|
+
$(error cocotb requires Verilator $(VLT_MIN) or later, but using $(VLT_VERSION))
|
|
36
|
+
endif
|
|
37
|
+
|
|
38
|
+
ifdef TOPLEVEL
|
|
39
|
+
TOPMODULE_ARG := --top-module $(TOPLEVEL)
|
|
40
|
+
else
|
|
41
|
+
TOPMODULE_ARG :=
|
|
42
|
+
endif
|
|
43
|
+
|
|
44
|
+
ifeq ($(VERILATOR_SIM_DEBUG), 1)
|
|
45
|
+
COMPILE_ARGS += --debug -CFLAGS "-DVL_DEBUG -DVERILATOR_SIM_DEBUG -g"
|
|
46
|
+
PLUSARGS += +verilator+debug
|
|
47
|
+
BUILD_ARGS += OPT_FAST=-Og OPT_SLOW=-Og OPT_GLOBAL=-Og
|
|
48
|
+
endif
|
|
49
|
+
|
|
50
|
+
ifeq ($(VERILATOR_TRACE),1)
|
|
51
|
+
COMPILE_ARGS += --trace --trace-structs
|
|
52
|
+
SIM_ARGS += --trace
|
|
53
|
+
endif
|
|
54
|
+
|
|
55
|
+
COMPILE_ARGS += --timescale $(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION)
|
|
56
|
+
|
|
57
|
+
COMPILE_ARGS += --vpi --public-flat-rw --prefix Vtop -o Vtop -LDFLAGS "-Wl,-rpath,$(shell cocotb-config --lib-dir) -L$(shell cocotb-config --lib-dir) -lcocotbvpi_verilator"
|
|
58
|
+
|
|
59
|
+
ifdef VERILOG_INCLUDE_DIRS
|
|
60
|
+
COMPILE_ARGS += $(addprefix +incdir+, $(VERILOG_INCLUDE_DIRS))
|
|
61
|
+
endif
|
|
62
|
+
|
|
63
|
+
$(SIM_BUILD)/Vtop.mk: $(VERILOG_SOURCES) $(CUSTOM_COMPILE_DEPS) $(COCOTB_SHARE_DIR)/lib/verilator/verilator.cpp | $(SIM_BUILD)
|
|
64
|
+
$(CMD) -cc --exe -Mdir $(SIM_BUILD) -DCOCOTB_SIM=1 $(TOPMODULE_ARG) $(COMPILE_ARGS) $(EXTRA_ARGS) $(VERILOG_SOURCES) $(COCOTB_SHARE_DIR)/lib/verilator/verilator.cpp
|
|
65
|
+
|
|
66
|
+
# Compilation phase
|
|
67
|
+
$(SIM_BUILD)/Vtop: $(SIM_BUILD)/Vtop.mk
|
|
68
|
+
$(MAKE) -C $(SIM_BUILD) $(BUILD_ARGS) -f Vtop.mk
|
|
69
|
+
|
|
70
|
+
$(COCOTB_RESULTS_FILE): $(SIM_BUILD)/Vtop $(CUSTOM_SIM_DEPS)
|
|
71
|
+
$(RM) $(COCOTB_RESULTS_FILE)
|
|
72
|
+
|
|
73
|
+
MODULE=$(MODULE) TESTCASE=$(TESTCASE) TOPLEVEL=$(TOPLEVEL) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
|
|
74
|
+
$(SIM_CMD_PREFIX) $< $(SIM_ARGS) $(EXTRA_ARGS) $(PLUSARGS) $(SIM_CMD_SUFFIX)
|
|
75
|
+
|
|
76
|
+
$(call check_for_results_file)
|
|
77
|
+
|
|
78
|
+
debug:
|
|
79
|
+
$(MAKE) VERILATOR_SIM_DEBUG=1 SIM_CMD_PREFIX="gdb --args" $(COCOTB_RESULTS_FILE)
|
|
80
|
+
|
|
81
|
+
clean::
|
|
82
|
+
$(RM) -r $(SIM_BUILD)
|
|
83
|
+
$(RM) dump.vcd
|
|
84
|
+
$(RM) dump.fst
|
|
85
|
+
|
|
86
|
+
endif
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
# Copyright (c) 2013, 2018 Potential Ventures Ltd
|
|
3
|
+
# Copyright (c) 2013 SolarFlare Communications Inc
|
|
4
|
+
# All rights reserved.
|
|
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
|
+
###############################################################################
|
|
29
|
+
|
|
30
|
+
include $(shell cocotb-config --makefiles)/Makefile.inc
|
|
31
|
+
|
|
32
|
+
# Common Makefile for Cadence Xcelium
|
|
33
|
+
|
|
34
|
+
CMD_BIN := xrun
|
|
35
|
+
|
|
36
|
+
ifdef XCELIUM_BIN_DIR
|
|
37
|
+
CMD := $(shell :; command -v $(XCELIUM_BIN_DIR)/$(CMD_BIN) 2>/dev/null)
|
|
38
|
+
else
|
|
39
|
+
# auto-detect bin dir from system path
|
|
40
|
+
CMD := $(shell :; command -v $(CMD_BIN) 2>/dev/null)
|
|
41
|
+
endif
|
|
42
|
+
|
|
43
|
+
ifeq (, $(CMD))
|
|
44
|
+
$(error Unable to locate command >$(CMD_BIN)<)
|
|
45
|
+
else
|
|
46
|
+
XCELIUM_BIN_DIR := $(shell dirname $(CMD))
|
|
47
|
+
export XCELIUM_BIN_DIR
|
|
48
|
+
endif
|
|
49
|
+
|
|
50
|
+
ifdef VERILOG_INCLUDE_DIRS
|
|
51
|
+
COMPILE_ARGS += $(addprefix +incdir+, $(VERILOG_INCLUDE_DIRS))
|
|
52
|
+
endif
|
|
53
|
+
|
|
54
|
+
EXTRA_ARGS += $(COMPILE_ARGS)
|
|
55
|
+
EXTRA_ARGS += $(SIM_ARGS)
|
|
56
|
+
EXTRA_ARGS += -licqueue
|
|
57
|
+
|
|
58
|
+
ifeq ($(PYTHON_ARCH),64bit)
|
|
59
|
+
EXTRA_ARGS += -64
|
|
60
|
+
endif
|
|
61
|
+
|
|
62
|
+
EXTRA_ARGS += -xmlibdirpath $(SIM_BUILD)
|
|
63
|
+
ifeq ($(DEBUG),1)
|
|
64
|
+
EXTRA_ARGS += -pliverbose
|
|
65
|
+
EXTRA_ARGS += -messages
|
|
66
|
+
EXTRA_ARGS += -plidebug # Enhance the profile output with PLI info
|
|
67
|
+
EXTRA_ARGS += -plierr_verbose # Expand handle info in PLI/VPI/VHPI messages
|
|
68
|
+
EXTRA_ARGS += -vpicompat 1800v2005 # <1364v1995|1364v2001|1364v2005|1800v2005> Specify the IEEE VPI
|
|
69
|
+
else
|
|
70
|
+
EXTRA_ARGS += -plinowarn
|
|
71
|
+
endif
|
|
72
|
+
|
|
73
|
+
ifeq ($(GUI),1)
|
|
74
|
+
EXTRA_ARGS += -gui
|
|
75
|
+
else
|
|
76
|
+
EXTRA_ARGS +=
|
|
77
|
+
endif
|
|
78
|
+
|
|
79
|
+
# Xcelium errors out if multiple timescales are specified on the command line.
|
|
80
|
+
ifneq (,$(filter -timescale%,$(EXTRA_ARGS)))
|
|
81
|
+
$(error Please use COCOTB_HDL_TIMEUNIT and COCOTB_HDL_TIMEPRECISION to specify timescale.)
|
|
82
|
+
endif
|
|
83
|
+
|
|
84
|
+
# Loading the VHPI library causes an error, so we always load the VPI library and supply
|
|
85
|
+
# GPI_EXTRA=$(shell cocotb-config --lib-name-path vhpi xcelium) if needed.
|
|
86
|
+
|
|
87
|
+
# Xcelium will use default vlog_startup_routines symbol only if VPI library name is libvpi.so
|
|
88
|
+
GPI_ARGS = -loadvpi $(shell cocotb-config --lib-name-path vpi xcelium):vlog_startup_routines_bootstrap
|
|
89
|
+
ifeq ($(TOPLEVEL_LANG),verilog)
|
|
90
|
+
HDL_SOURCES = $(VERILOG_SOURCES)
|
|
91
|
+
ROOT_LEVEL = $(TOPLEVEL)
|
|
92
|
+
EXTRA_ARGS += -top $(TOPLEVEL)
|
|
93
|
+
ifneq ($(VHDL_SOURCES),)
|
|
94
|
+
HDL_SOURCES += $(VHDL_SOURCES)
|
|
95
|
+
GPI_EXTRA = $(shell cocotb-config --lib-name-path vhpi xcelium):cocotbvhpi_entry_point
|
|
96
|
+
endif
|
|
97
|
+
else ifeq ($(TOPLEVEL_LANG),vhdl)
|
|
98
|
+
GPI_EXTRA = $(shell cocotb-config --lib-name-path vhpi xcelium):cocotbvhpi_entry_point
|
|
99
|
+
EXTRA_ARGS += -top $(TOPLEVEL)
|
|
100
|
+
# Xcelium 23.09.004 fixes cocotb issue #1076 as long as the following define
|
|
101
|
+
# is set.
|
|
102
|
+
EXTRA_ARGS += -NEW_VHPI_PROPAGATE_DELAY
|
|
103
|
+
RTL_LIBRARY ?= $(TOPLEVEL)
|
|
104
|
+
MAKE_LIB = -makelib $(RTL_LIBRARY)
|
|
105
|
+
END_LIB = -endlib
|
|
106
|
+
HDL_SOURCES = $(VHDL_SOURCES)
|
|
107
|
+
ifneq ($(VERILOG_SOURCES),)
|
|
108
|
+
HDL_SOURCES += $(VERILOG_SOURCES)
|
|
109
|
+
endif
|
|
110
|
+
else
|
|
111
|
+
$(error A valid value (verilog or vhdl) was not provided for TOPLEVEL_LANG=$(TOPLEVEL_LANG))
|
|
112
|
+
endif
|
|
113
|
+
|
|
114
|
+
# Builds a list of arguments to support VHDL libraries specified in VHDL_SOURCES_*:
|
|
115
|
+
LIBS := $(foreach LIB, $(VHDL_LIB_ORDER),-makelib $(LIB) $(VHDL_SOURCES_$(LIB)) -endlib)
|
|
116
|
+
|
|
117
|
+
$(COCOTB_RESULTS_FILE): $(HDL_SOURCES) $(CUSTOM_COMPILE_DEPS) $(CUSTOM_SIM_DEPS) | $(SIM_BUILD)
|
|
118
|
+
$(RM) $(COCOTB_RESULTS_FILE)
|
|
119
|
+
|
|
120
|
+
# Make sure all libs in SOURCES_VHDL_* are mentioned in VHDL_LIB_ORDER and vice versa
|
|
121
|
+
$(foreach LIB, $(VHDL_LIB_ORDER), $(check_vhdl_sources))
|
|
122
|
+
$(foreach SOURCES_VAR, $(filter VHDL_SOURCES_%, $(.VARIABLES)), $(check_lib_order))
|
|
123
|
+
|
|
124
|
+
set -o pipefail; \
|
|
125
|
+
MODULE=$(MODULE) TESTCASE=$(TESTCASE) TOPLEVEL=$(TOPLEVEL) GPI_EXTRA=$(GPI_EXTRA) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
|
|
126
|
+
$(SIM_CMD_PREFIX) $(CMD) -timescale $(COCOTB_HDL_TIMEUNIT)/$(COCOTB_HDL_TIMEPRECISION) \
|
|
127
|
+
-vhdl_time_precision "$(COCOTB_HDL_TIMEPRECISION)" \
|
|
128
|
+
$(EXTRA_ARGS) $(GPI_ARGS) $(INCDIRS) -access +rwc -createdebugdb $(LIBS) $(MAKE_LIB) $(HDL_SOURCES) $(END_LIB) $(PLUSARGS) $(SIM_CMD_SUFFIX)
|
|
129
|
+
|
|
130
|
+
$(call check_for_results_file)
|
|
131
|
+
|
|
132
|
+
clean::
|
|
133
|
+
$(RM) -r $(SIM_BUILD)
|
|
134
|
+
$(RM) -r xrun.*
|
|
135
|
+
$(RM) -r xmsim.*
|
|
136
|
+
$(RM) -r gdb_cmd_xmsim
|
|
Binary file
|