cocotb 1.9.1__cp38-cp38-win32.whl → 2.0.0b1__cp38-cp38-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/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 +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.cp38-win32.exp +0 -0
- cocotb/simulator.cp38-win32.lib +0 -0
- cocotb/simulator.cp38-win32.pyd +0 -0
- cocotb/simulator.pyi +107 -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 +46 -0
- cocotb-2.0.0b1.dist-info/RECORD +143 -0
- {cocotb-1.9.1.dist-info → cocotb-2.0.0b1.dist-info}/WHEEL +1 -1
- cocotb-2.0.0b1.dist-info/entry_points.txt +2 -0
- {cocotb-1.9.1.dist-info → cocotb-2.0.0b1.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 +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_tools/py.typed +0 -0
- {cocotb → cocotb_tools}/runner.py +794 -361
- cocotb/_sim_versions.py → cocotb_tools/sim_versions.py +16 -21
- pygpi/entry.py +34 -17
- pygpi/py.typed +0 -0
- 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 -166
- cocotb-1.9.1.dist-info/RECORD +0 -121
- cocotb-1.9.1.dist-info/entry_points.txt +0 -2
- /cocotb/{_vendor/__init__.py → py.typed} +0 -0
- {cocotb-1.9.1.dist-info → cocotb-2.0.0b1.dist-info}/LICENSE +0 -0
- {cocotb → cocotb_tools}/_vendor/distutils_version.py +0 -0
|
@@ -1,177 +0,0 @@
|
|
|
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
|
-
RTL_LIBRARY ?= work
|
|
73
|
-
ALOG_ARGS += +define+COCOTB_SIM
|
|
74
|
-
|
|
75
|
-
# Pass the VPI library to the Verilog compilation to get extended checking.
|
|
76
|
-
ALOG_ARGS += -pli $(shell cocotb-config --lib-name-path vpi riviera)
|
|
77
|
-
|
|
78
|
-
# Aldec-specific coverage types:
|
|
79
|
-
# - (s)tatement
|
|
80
|
-
# - (b)ranch
|
|
81
|
-
# - (e)xpression
|
|
82
|
-
# - (c)ondition
|
|
83
|
-
# - (a)ssertion
|
|
84
|
-
# - (p)ath
|
|
85
|
-
# - finite state (m)achine
|
|
86
|
-
# Documentation: Riviera Pro 2017.02 Documentation - Page 359
|
|
87
|
-
COVERAGE_TYPES ?= sb
|
|
88
|
-
ifeq ($(COVERAGE),1)
|
|
89
|
-
ALOG_ARGS += -dbg -coverage $(COVERAGE_TYPES)
|
|
90
|
-
ACOM_ARGS += -dbg -coverage $(COVERAGE_TYPES)
|
|
91
|
-
|
|
92
|
-
ASIM_ARGS += -dbg -acdb -acdb_cov $(COVERAGE_TYPES)
|
|
93
|
-
endif
|
|
94
|
-
|
|
95
|
-
GPI_EXTRA:=
|
|
96
|
-
ifeq ($(TOPLEVEL_LANG),verilog)
|
|
97
|
-
GPI_ARGS = -pli $(shell cocotb-config --lib-name-path vpi riviera)
|
|
98
|
-
ifneq ($(VHDL_SOURCES),)
|
|
99
|
-
GPI_EXTRA = $(shell cocotb-config --lib-name-path vhpi riviera):cocotbvhpi_entry_point
|
|
100
|
-
endif
|
|
101
|
-
|
|
102
|
-
else ifeq ($(TOPLEVEL_LANG),vhdl)
|
|
103
|
-
GPI_ARGS = -loadvhpi $(shell cocotb-config --lib-name-path vhpi riviera):vhpi_startup_routines_bootstrap
|
|
104
|
-
ifneq ($(VERILOG_SOURCES),)
|
|
105
|
-
GPI_EXTRA = $(shell cocotb-config --lib-name-path vpi riviera):cocotbvpi_entry_point
|
|
106
|
-
endif
|
|
107
|
-
|
|
108
|
-
else
|
|
109
|
-
$(error A valid value (verilog or vhdl) was not provided for TOPLEVEL_LANG=$(TOPLEVEL_LANG))
|
|
110
|
-
endif
|
|
111
|
-
|
|
112
|
-
define make_lib
|
|
113
|
-
echo "if [file exists $(SIM_BUILD)/$(LIB)] {adel -lib $(SIM_BUILD)/$(LIB) -all}" >> $@;
|
|
114
|
-
echo "alib $(SIM_BUILD)/$(LIB)" >> $@;
|
|
115
|
-
echo "amap $(LIB) $(SIM_BUILD)/$(LIB)" >> $@;
|
|
116
|
-
echo "acom -work $(LIB) $(VCOM_ARGS) $(call to_tcl_path,$(VHDL_SOURCES_$(LIB)))" >> $@;
|
|
117
|
-
endef
|
|
118
|
-
|
|
119
|
-
# Create a TCL script based on the list of $(VERILOG_SOURCES)
|
|
120
|
-
$(SIM_BUILD)/runsim.tcl : $(VERILOG_SOURCES) $(VHDL_SOURCES) | $(SIM_BUILD)
|
|
121
|
-
@echo "onerror {" > $@
|
|
122
|
-
@echo " puts [read [open sim.log r]]" >> $@
|
|
123
|
-
@echo " quit -code 1" >> $@
|
|
124
|
-
@echo "}" >> $@
|
|
125
|
-
@echo "amap -c" >> $@
|
|
126
|
-
$(foreach LIB, $(VHDL_LIB_ORDER), $(make_lib))
|
|
127
|
-
@echo "@if [string length [array get env LICENSE_QUEUE]] {" >> $@
|
|
128
|
-
@echo " set LICENSE_QUEUE $$::env(LICENSE_QUEUE)" >> $@
|
|
129
|
-
@echo "}" >> $@
|
|
130
|
-
@echo "if [file exists $(SIM_BUILD)/$(RTL_LIBRARY)] {adel -lib $(SIM_BUILD)/$(RTL_LIBRARY) -all}" >> $@;
|
|
131
|
-
@echo "alib $(SIM_BUILD)/$(RTL_LIBRARY)" >> $@
|
|
132
|
-
@echo "amap $(RTL_LIBRARY) $(SIM_BUILD)/$(RTL_LIBRARY)" >> $@;
|
|
133
|
-
@echo "set worklib $(RTL_LIBRARY)" >> $@;
|
|
134
|
-
ifneq ($(VHDL_SOURCES),)
|
|
135
|
-
@echo "acom -work $(RTL_LIBRARY) $(ACOM_ARGS) $(call to_tcl_path,$(VHDL_SOURCES))" >> $@
|
|
136
|
-
endif
|
|
137
|
-
ifneq ($(VERILOG_SOURCES),)
|
|
138
|
-
@echo "alog -work $(RTL_LIBRARY) $(ALOG_ARGS) $(call to_tcl_path,$(VERILOG_SOURCES))" >> $@
|
|
139
|
-
endif
|
|
140
|
-
ifdef SCRIPT_FILE
|
|
141
|
-
@echo "do $(SCRIPT_FILE)" >> $@
|
|
142
|
-
endif
|
|
143
|
-
ifneq ($(CFG_TOPLEVEL),)
|
|
144
|
-
@echo "asim $(ASIM_ARGS) +access +w_nets -interceptcoutput $(GPI_ARGS) $(CFG_TOPLEVEL) $(EXTRA_TOPS)" >> $@
|
|
145
|
-
else
|
|
146
|
-
@echo "asim $(ASIM_ARGS) +access +w_nets -interceptcoutput $(GPI_ARGS) $(TOPLEVEL) $(EXTRA_TOPS)" >> $@
|
|
147
|
-
endif
|
|
148
|
-
ifeq ($(WAVES),1)
|
|
149
|
-
@echo "log -recursive *" >> $@
|
|
150
|
-
endif
|
|
151
|
-
ifeq ($(GUI),1)
|
|
152
|
-
@echo "wave -rec *" >> $@
|
|
153
|
-
else
|
|
154
|
-
@echo "run -all" >> $@
|
|
155
|
-
@echo "endsim" >> $@
|
|
156
|
-
ifeq ($(COVERAGE),1)
|
|
157
|
-
@echo "acdb report -cov $(COVERAGE_TYPES) -db $(RTL_LIBRARY).acdb -html -o coverage/acdb_report.html" >> $@
|
|
158
|
-
@echo "acdb report -cov $(COVERAGE_TYPES) -db $(RTL_LIBRARY).acdb -txt -o coverage/acdb_report.txt" >> $@
|
|
159
|
-
endif
|
|
160
|
-
@echo "exit" >> $@
|
|
161
|
-
endif
|
|
162
|
-
|
|
163
|
-
# Note it's the redirection of the output rather than the 'do' command
|
|
164
|
-
# that turns on batch mode (i.e. exit on completion/error)
|
|
165
|
-
$(COCOTB_RESULTS_FILE): $(SIM_BUILD)/runsim.tcl $(CUSTOM_COMPILE_DEPS) $(CUSTOM_SIM_DEPS)
|
|
166
|
-
$(RM) $(COCOTB_RESULTS_FILE)
|
|
167
|
-
|
|
168
|
-
set -o pipefail; GPI_EXTRA=$(GPI_EXTRA) TOPLEVEL_LANG=$(TOPLEVEL_LANG) \
|
|
169
|
-
MODULE=$(MODULE) TESTCASE=$(TESTCASE) TOPLEVEL=$(TOPLEVEL) $(SIM_CMD_PREFIX) $(CMD) $(RUN_ARGS) -do $(SIM_BUILD)/runsim.tcl $(SIM_CMD_SUFFIX)
|
|
170
|
-
|
|
171
|
-
$(call check_for_results_file)
|
|
172
|
-
|
|
173
|
-
clean::
|
|
174
|
-
$(RM) -r $(SIM_BUILD)
|
|
175
|
-
$(RM) -r compile
|
|
176
|
-
$(RM) -r library.cfg
|
|
177
|
-
$(RM) -r dataset.asdb
|
|
@@ -1,98 +0,0 @@
|
|
|
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
|
cocotb/types/array.py
DELETED
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
# Copyright cocotb contributors
|
|
2
|
-
# Licensed under the Revised BSD License, see LICENSE for details.
|
|
3
|
-
# SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
-
import typing
|
|
5
|
-
from itertools import chain
|
|
6
|
-
|
|
7
|
-
from cocotb.types.range import Range
|
|
8
|
-
|
|
9
|
-
T = typing.TypeVar("T")
|
|
10
|
-
S = typing.TypeVar("S")
|
|
11
|
-
Self = typing.TypeVar("Self", bound="Array[typing.Any]")
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class Array(typing.Reversible[T], typing.Collection[T]):
|
|
15
|
-
r"""
|
|
16
|
-
Fixed-size, arbitrarily-indexed, homogeneous collection type.
|
|
17
|
-
|
|
18
|
-
Arrays are similar to, but different from Python :class:`list`\ s.
|
|
19
|
-
An array can store values of any type or values of multiple types at a time, just like a :class:`list`.
|
|
20
|
-
Unlike :class:`list`\ s, an array's size cannot change.
|
|
21
|
-
|
|
22
|
-
The indexes of an array can start or end at any integer value, they are not limited to 0-based indexing.
|
|
23
|
-
Indexing schemes can be either ascending or descending in value.
|
|
24
|
-
An array's indexes are described using a :class:`~cocotb.types.Range` object.
|
|
25
|
-
Initial values are treated as iterables, which are copied into an internal buffer.
|
|
26
|
-
|
|
27
|
-
.. code-block:: python3
|
|
28
|
-
|
|
29
|
-
>>> Array("1234") # the 0-based range `(0, len(value)-1)` is inferred
|
|
30
|
-
Array(['1', '2', '3', '4'], Range(0, 'to', 3))
|
|
31
|
-
|
|
32
|
-
>>> Array([1, True, None, "example"], Range(-2, 1)) # initial value and range lengths must be equal
|
|
33
|
-
Array([1, True, None, 'example'], Range(-2, 'to', 1))
|
|
34
|
-
|
|
35
|
-
Arrays also support "null" ranges; "null" arrays have zero length and cannot be indexed.
|
|
36
|
-
|
|
37
|
-
.. code-block:: python3
|
|
38
|
-
|
|
39
|
-
>>> Array([], range=Range(1, "to", 0))
|
|
40
|
-
Array([], Range(1, 'to', 0))
|
|
41
|
-
|
|
42
|
-
Indexing and slicing is very similar to :class:`list`\ s, but it uses the indexing scheme specified.
|
|
43
|
-
Slicing, just like the :class:`~cocotb.types.Range` object uses an inclusive right bound,
|
|
44
|
-
which is commonly seen in HDLs.
|
|
45
|
-
Like :class:`list`\ s, if a start or stop index is not specified, it is inferred as the start or end of the array.
|
|
46
|
-
Slicing an array returns a new :class:`~cocotb.types.Array` object, whose bounds are the slice indexes.
|
|
47
|
-
|
|
48
|
-
.. code-block:: python3
|
|
49
|
-
|
|
50
|
-
>>> a = Array("1234abcd")
|
|
51
|
-
>>> a[7]
|
|
52
|
-
'd'
|
|
53
|
-
>>> a[2:5]
|
|
54
|
-
Array(['3', '4', 'a', 'b'], Range(2, 'to', 5))
|
|
55
|
-
>>> a[2:5] = reversed(a[2:5])
|
|
56
|
-
>>> "".join(a)
|
|
57
|
-
'12ba43cd'
|
|
58
|
-
|
|
59
|
-
>>> b = Array("1234", Range(0, -3))
|
|
60
|
-
>>> b[-2]
|
|
61
|
-
'3'
|
|
62
|
-
>>> b[-1:]
|
|
63
|
-
Array(['2', '3', '4'], Range(-1, 'downto', -3))
|
|
64
|
-
>>> b[:] = reversed(b)
|
|
65
|
-
>>> b
|
|
66
|
-
Array(['4', '3', '2', '1'], Range(0, 'downto', -3))
|
|
67
|
-
|
|
68
|
-
.. warning::
|
|
69
|
-
Arrays behave differently in certain situations than Python's builtin sequence types (:class:`list`, :class:`tuple`, etc.).
|
|
70
|
-
|
|
71
|
-
- Arrays are not necessarily 0-based and slices use inclusive right bounds,
|
|
72
|
-
so many functions that work on Python sequences by index (like :mod:`bisect`) may not work on arrays.
|
|
73
|
-
- Slice indexes must be specified in the same direction as the array and do not support specifying a "step".
|
|
74
|
-
- When setting a slice, the new value must be an iterable of the same size as the slice.
|
|
75
|
-
- Negative indexes are *not* treated as an offset from the end of the array, but are treated literally.
|
|
76
|
-
|
|
77
|
-
Arrays are equal to other arrays of the same length with the same values (structural equality).
|
|
78
|
-
Bounds do not matter for equality.
|
|
79
|
-
|
|
80
|
-
.. code-block:: python3
|
|
81
|
-
|
|
82
|
-
>>> a = Array([1, 1, 2, 3, 5], Range(4, "downto", 0))
|
|
83
|
-
>>> b = Array([1, 1, 2, 3, 5], Range(-2, "to", 2))
|
|
84
|
-
>>> a == b
|
|
85
|
-
True
|
|
86
|
-
|
|
87
|
-
You can change the bounds of an array by setting the :attr:`range` to a new value.
|
|
88
|
-
The new bounds must be the same length of the array.
|
|
89
|
-
|
|
90
|
-
.. code-block:: python3
|
|
91
|
-
|
|
92
|
-
>>> a = Array("1234")
|
|
93
|
-
>>> a.range
|
|
94
|
-
Range(0, 'to', 3)
|
|
95
|
-
>>> a.range = Range(3, 'downto', 0)
|
|
96
|
-
>>> a.range
|
|
97
|
-
Range(3, 'downto', 0)
|
|
98
|
-
|
|
99
|
-
Arrays support the methods and semantics defined by :class:`collections.abc.Sequence`.
|
|
100
|
-
|
|
101
|
-
.. code-block:: python
|
|
102
|
-
|
|
103
|
-
>>> a = Array("stuff", Range(2, "downto", -2))
|
|
104
|
-
>>> len(a)
|
|
105
|
-
5
|
|
106
|
-
>>> "t" in a
|
|
107
|
-
True
|
|
108
|
-
>>> a.index("u")
|
|
109
|
-
0
|
|
110
|
-
>>> for c in a:
|
|
111
|
-
... print(c)
|
|
112
|
-
s
|
|
113
|
-
t
|
|
114
|
-
u
|
|
115
|
-
f
|
|
116
|
-
f
|
|
117
|
-
|
|
118
|
-
Args:
|
|
119
|
-
value: Initial value for the array.
|
|
120
|
-
range: Indexing scheme of the array.
|
|
121
|
-
|
|
122
|
-
Raises:
|
|
123
|
-
ValueError: When argument values cannot be used to construct an array.
|
|
124
|
-
TypeError: When invalid argument types are used.
|
|
125
|
-
"""
|
|
126
|
-
|
|
127
|
-
__slots__ = (
|
|
128
|
-
"_value",
|
|
129
|
-
"_range",
|
|
130
|
-
)
|
|
131
|
-
|
|
132
|
-
def __init__(self, value: typing.Iterable[T], range: typing.Optional[Range] = None):
|
|
133
|
-
self._value = list(value)
|
|
134
|
-
if range is None:
|
|
135
|
-
self._range = Range(0, "to", len(self._value) - 1)
|
|
136
|
-
else:
|
|
137
|
-
self._range = range
|
|
138
|
-
if len(self._value) != len(self._range):
|
|
139
|
-
raise ValueError(
|
|
140
|
-
"init value of length {!r} does not fit in {!r}".format(
|
|
141
|
-
len(self._value), self._range
|
|
142
|
-
)
|
|
143
|
-
)
|
|
144
|
-
|
|
145
|
-
@property
|
|
146
|
-
def left(self) -> int:
|
|
147
|
-
"""Leftmost index of the array."""
|
|
148
|
-
return self.range.left
|
|
149
|
-
|
|
150
|
-
@property
|
|
151
|
-
def direction(self) -> str:
|
|
152
|
-
"""``"to"`` if indexes are ascending, ``"downto"`` otherwise."""
|
|
153
|
-
return self.range.direction
|
|
154
|
-
|
|
155
|
-
@property
|
|
156
|
-
def right(self) -> int:
|
|
157
|
-
"""Rightmost index of the array."""
|
|
158
|
-
return self.range.right
|
|
159
|
-
|
|
160
|
-
@property
|
|
161
|
-
def range(self) -> Range:
|
|
162
|
-
""":class:`Range` of the indexes of the array."""
|
|
163
|
-
return self._range
|
|
164
|
-
|
|
165
|
-
@range.setter
|
|
166
|
-
def range(self, new_range: Range) -> None:
|
|
167
|
-
"""Sets a new indexing scheme on the array, must be the same size"""
|
|
168
|
-
if not isinstance(new_range, Range):
|
|
169
|
-
raise TypeError("range argument must be of type 'Range'")
|
|
170
|
-
if len(new_range) != len(self):
|
|
171
|
-
raise ValueError(
|
|
172
|
-
f"{new_range!r} not the same length as old range ({self._range!r})."
|
|
173
|
-
)
|
|
174
|
-
self._range = new_range
|
|
175
|
-
|
|
176
|
-
def __len__(self) -> int:
|
|
177
|
-
return len(self.range)
|
|
178
|
-
|
|
179
|
-
def __iter__(self) -> typing.Iterator[T]:
|
|
180
|
-
return iter(self._value)
|
|
181
|
-
|
|
182
|
-
def __reversed__(self) -> typing.Iterator[T]:
|
|
183
|
-
return reversed(self._value)
|
|
184
|
-
|
|
185
|
-
def __contains__(self, item: object) -> bool:
|
|
186
|
-
return item in self._value
|
|
187
|
-
|
|
188
|
-
def __eq__(self, other: object) -> bool:
|
|
189
|
-
if isinstance(other, type(self)):
|
|
190
|
-
return self._value == other._value
|
|
191
|
-
return NotImplemented
|
|
192
|
-
|
|
193
|
-
@typing.overload
|
|
194
|
-
def __getitem__(self, item: int) -> T:
|
|
195
|
-
...
|
|
196
|
-
|
|
197
|
-
@typing.overload
|
|
198
|
-
def __getitem__(self, item: slice) -> "Array[T]":
|
|
199
|
-
...
|
|
200
|
-
|
|
201
|
-
def __getitem__(
|
|
202
|
-
self, item: typing.Union[int, slice]
|
|
203
|
-
) -> typing.Union[T, "Array[T]"]:
|
|
204
|
-
if isinstance(item, int):
|
|
205
|
-
idx = self._translate_index(item)
|
|
206
|
-
return self._value[idx]
|
|
207
|
-
elif isinstance(item, slice):
|
|
208
|
-
start = item.start if item.start is not None else self.left
|
|
209
|
-
stop = item.stop if item.stop is not None else self.right
|
|
210
|
-
if item.step is not None:
|
|
211
|
-
raise IndexError("do not specify step")
|
|
212
|
-
start_i = self._translate_index(start)
|
|
213
|
-
stop_i = self._translate_index(stop)
|
|
214
|
-
if start_i > stop_i:
|
|
215
|
-
raise IndexError(
|
|
216
|
-
"slice [{}:{}] direction does not match array direction [{}:{}]".format(
|
|
217
|
-
start, stop, self.left, self.right
|
|
218
|
-
)
|
|
219
|
-
)
|
|
220
|
-
value = self._value[start_i : stop_i + 1]
|
|
221
|
-
range = Range(start, self.direction, stop)
|
|
222
|
-
return type(self)(value=value, range=range)
|
|
223
|
-
raise TypeError(
|
|
224
|
-
"indexes must be ints or slices, not {}".format(type(item).__name__)
|
|
225
|
-
)
|
|
226
|
-
|
|
227
|
-
@typing.overload
|
|
228
|
-
def __setitem__(self, item: int, value: T) -> None:
|
|
229
|
-
...
|
|
230
|
-
|
|
231
|
-
@typing.overload
|
|
232
|
-
def __setitem__(self, item: slice, value: typing.Iterable[T]) -> None:
|
|
233
|
-
...
|
|
234
|
-
|
|
235
|
-
def __setitem__(
|
|
236
|
-
self, item: typing.Union[int, slice], value: typing.Union[T, typing.Iterable[T]]
|
|
237
|
-
) -> None:
|
|
238
|
-
if isinstance(item, int):
|
|
239
|
-
idx = self._translate_index(item)
|
|
240
|
-
self._value[idx] = typing.cast(T, value)
|
|
241
|
-
elif isinstance(item, slice):
|
|
242
|
-
start = item.start if item.start is not None else self.left
|
|
243
|
-
stop = item.stop if item.stop is not None else self.right
|
|
244
|
-
if item.step is not None:
|
|
245
|
-
raise IndexError("do not specify step")
|
|
246
|
-
start_i = self._translate_index(start)
|
|
247
|
-
stop_i = self._translate_index(stop)
|
|
248
|
-
if start_i > stop_i:
|
|
249
|
-
raise IndexError(
|
|
250
|
-
"slice [{}:{}] direction does not match array direction [{}:{}]".format(
|
|
251
|
-
start, stop, self.left, self.right
|
|
252
|
-
)
|
|
253
|
-
)
|
|
254
|
-
value = list(typing.cast(typing.Iterable[T], value))
|
|
255
|
-
if len(value) != (stop_i - start_i + 1):
|
|
256
|
-
raise ValueError(
|
|
257
|
-
"value of length {!r} will not fit in slice [{}:{}]".format(
|
|
258
|
-
len(value), start, stop
|
|
259
|
-
)
|
|
260
|
-
)
|
|
261
|
-
self._value[start_i : stop_i + 1] = value
|
|
262
|
-
else:
|
|
263
|
-
raise TypeError(
|
|
264
|
-
"indexes must be ints or slices, not {}".format(type(item).__name__)
|
|
265
|
-
)
|
|
266
|
-
|
|
267
|
-
def __repr__(self) -> str:
|
|
268
|
-
return "{}({!r}, {!r})".format(type(self).__name__, self._value, self._range)
|
|
269
|
-
|
|
270
|
-
def __concat__(self: Self, other: Self) -> Self:
|
|
271
|
-
if isinstance(other, type(self)):
|
|
272
|
-
return type(self)(chain(self, other))
|
|
273
|
-
return NotImplemented
|
|
274
|
-
|
|
275
|
-
def __rconcat__(self: Self, other: Self) -> Self:
|
|
276
|
-
if isinstance(other, type(self)):
|
|
277
|
-
return type(self)(chain(other, self))
|
|
278
|
-
return NotImplemented
|
|
279
|
-
|
|
280
|
-
def index(
|
|
281
|
-
self,
|
|
282
|
-
value: T,
|
|
283
|
-
start: typing.Optional[int] = None,
|
|
284
|
-
stop: typing.Optional[int] = None,
|
|
285
|
-
) -> int:
|
|
286
|
-
"""
|
|
287
|
-
Return index of first occurrence of *value*.
|
|
288
|
-
|
|
289
|
-
Raises :exc:`IndexError` if the value is not found.
|
|
290
|
-
Search only within *start* and *stop* if given.
|
|
291
|
-
"""
|
|
292
|
-
if start is None:
|
|
293
|
-
start = self.left
|
|
294
|
-
if stop is None:
|
|
295
|
-
stop = self.right
|
|
296
|
-
for i in Range(start, self.direction, stop):
|
|
297
|
-
if self[i] == value:
|
|
298
|
-
return i
|
|
299
|
-
raise IndexError(f"{value!r} not in array")
|
|
300
|
-
|
|
301
|
-
def count(self, value: T) -> int:
|
|
302
|
-
"""Return number of occurrences of *value*."""
|
|
303
|
-
return self._value.count(value)
|
|
304
|
-
|
|
305
|
-
def _translate_index(self, item: int) -> int:
|
|
306
|
-
try:
|
|
307
|
-
return self._range.index(item)
|
|
308
|
-
except ValueError:
|
|
309
|
-
raise IndexError(f"index {item} out of range") from None
|