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
cocotb/result.py
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# Copyright (c) 2013 Potential Ventures Ltd
|
|
2
|
+
# Copyright (c) 2013 SolarFlare Communications Inc
|
|
3
|
+
# All rights reserved.
|
|
4
|
+
#
|
|
5
|
+
# Redistribution and use in source and binary forms, with or without
|
|
6
|
+
# modification, are permitted provided that the following conditions are met:
|
|
7
|
+
# * Redistributions of source code must retain the above copyright
|
|
8
|
+
# notice, this list of conditions and the following disclaimer.
|
|
9
|
+
# * Redistributions in binary form must reproduce the above copyright
|
|
10
|
+
# notice, this list of conditions and the following disclaimer in the
|
|
11
|
+
# documentation and/or other materials provided with the distribution.
|
|
12
|
+
# * Neither the name of Potential Ventures Ltd,
|
|
13
|
+
# SolarFlare Communications Inc nor the
|
|
14
|
+
# names of its contributors may be used to endorse or promote products
|
|
15
|
+
# derived from this software without specific prior written permission.
|
|
16
|
+
#
|
|
17
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
18
|
+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
19
|
+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
20
|
+
# DISCLAIMED. IN NO EVENT SHALL POTENTIAL VENTURES LTD BE LIABLE FOR ANY
|
|
21
|
+
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
22
|
+
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
23
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
24
|
+
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
25
|
+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
26
|
+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
|
+
|
|
28
|
+
import sys
|
|
29
|
+
|
|
30
|
+
# TODO: Could use cStringIO?
|
|
31
|
+
import traceback
|
|
32
|
+
import warnings
|
|
33
|
+
from io import StringIO
|
|
34
|
+
|
|
35
|
+
"""Exceptions and functions for simulation result handling."""
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def raise_error(obj, msg):
|
|
39
|
+
"""Create a :exc:`TestError` exception and raise it after printing a traceback.
|
|
40
|
+
|
|
41
|
+
.. deprecated:: 1.3
|
|
42
|
+
Raise a standard Python exception instead of calling this function.
|
|
43
|
+
A stacktrace will be printed by cocotb automatically if the exception is unhandled.
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
obj: Object with a log method.
|
|
47
|
+
msg (str): The log message.
|
|
48
|
+
"""
|
|
49
|
+
warnings.warn(
|
|
50
|
+
"``raise_error`` is deprecated - raise a standard Exception instead",
|
|
51
|
+
DeprecationWarning,
|
|
52
|
+
stacklevel=2,
|
|
53
|
+
)
|
|
54
|
+
_raise_error(obj, msg)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _raise_error(obj, msg):
|
|
58
|
+
exc_info = sys.exc_info()
|
|
59
|
+
buff = StringIO()
|
|
60
|
+
traceback.print_exception(*exc_info, file=buff)
|
|
61
|
+
obj.log.error(f"{msg}\n{buff.getvalue()}")
|
|
62
|
+
exception = TestError(msg)
|
|
63
|
+
exception.stderr.write(buff.getvalue())
|
|
64
|
+
raise exception
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def create_error(obj, msg):
|
|
68
|
+
"""Like :func:`raise_error`, but return the exception rather than raise it,
|
|
69
|
+
simply to avoid too many levels of nested `try/except` blocks.
|
|
70
|
+
|
|
71
|
+
.. deprecated:: 1.3
|
|
72
|
+
Raise a standard Python exception instead of calling this function.
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
obj: Object with a log method.
|
|
76
|
+
msg (str): The log message.
|
|
77
|
+
"""
|
|
78
|
+
warnings.warn(
|
|
79
|
+
"``create_error`` is deprecated - raise a standard Exception instead",
|
|
80
|
+
DeprecationWarning,
|
|
81
|
+
stacklevel=2,
|
|
82
|
+
)
|
|
83
|
+
try:
|
|
84
|
+
# use the private version to avoid multiple warnings
|
|
85
|
+
_raise_error(obj, msg)
|
|
86
|
+
except TestError as error:
|
|
87
|
+
return error
|
|
88
|
+
return TestError("Creating error traceback failed")
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class ReturnValue(Exception):
|
|
92
|
+
"""
|
|
93
|
+
Helper exception needed for Python versions prior to 3.3.
|
|
94
|
+
|
|
95
|
+
.. deprecated:: 1.4
|
|
96
|
+
Use a :keyword:`return` statement instead; this works in all supported versions of Python.
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
def __init__(self, retval):
|
|
100
|
+
warnings.warn(
|
|
101
|
+
"``ReturnValue`` is deprecated, use a normal return statement instead.",
|
|
102
|
+
DeprecationWarning,
|
|
103
|
+
stacklevel=2,
|
|
104
|
+
)
|
|
105
|
+
self.retval = retval
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
class TestComplete(Exception):
|
|
109
|
+
"""
|
|
110
|
+
Exception showing that the test was completed. Sub-exceptions detail the exit status.
|
|
111
|
+
|
|
112
|
+
.. deprecated:: 1.6.0
|
|
113
|
+
The ``stdout`` and ``stderr`` attributes.
|
|
114
|
+
"""
|
|
115
|
+
|
|
116
|
+
def __init__(self, *args, **kwargs):
|
|
117
|
+
super().__init__(*args, **kwargs)
|
|
118
|
+
self.__stdout = StringIO()
|
|
119
|
+
self.__stderr = StringIO()
|
|
120
|
+
|
|
121
|
+
@staticmethod
|
|
122
|
+
def __deprecated(which: str) -> None:
|
|
123
|
+
warnings.warn(
|
|
124
|
+
f"Attribute {which} is deprecated and will be removed in the next major release",
|
|
125
|
+
DeprecationWarning,
|
|
126
|
+
stacklevel=3,
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
@property
|
|
130
|
+
def stdout(self) -> StringIO:
|
|
131
|
+
self.__deprecated("stdout")
|
|
132
|
+
return self.__stdout
|
|
133
|
+
|
|
134
|
+
@stdout.setter
|
|
135
|
+
def stdout(self, new_value: StringIO) -> None:
|
|
136
|
+
self.__deprecated("stdout")
|
|
137
|
+
self.__stdout = new_value
|
|
138
|
+
|
|
139
|
+
@property
|
|
140
|
+
def stderr(self) -> StringIO:
|
|
141
|
+
self.__deprecated("stderr")
|
|
142
|
+
return self.__stderr
|
|
143
|
+
|
|
144
|
+
@stderr.setter
|
|
145
|
+
def stderr(self, new_value: StringIO) -> None:
|
|
146
|
+
self.__deprecated("stderr")
|
|
147
|
+
self.__stderr = new_value
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
class ExternalException(Exception):
|
|
151
|
+
"""Exception thrown by :class:`cocotb.external` functions."""
|
|
152
|
+
|
|
153
|
+
def __init__(self, exception):
|
|
154
|
+
self.exception = exception
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
class TestError(TestComplete):
|
|
158
|
+
"""
|
|
159
|
+
Exception showing that the test was completed with severity Error.
|
|
160
|
+
|
|
161
|
+
.. deprecated:: 1.5
|
|
162
|
+
Raise a standard Python exception instead.
|
|
163
|
+
A stacktrace will be printed by cocotb automatically if the exception is unhandled.
|
|
164
|
+
"""
|
|
165
|
+
|
|
166
|
+
def __init__(self, *args, **kwargs):
|
|
167
|
+
warnings.warn(
|
|
168
|
+
"TestError is deprecated - raise a standard Exception instead",
|
|
169
|
+
DeprecationWarning,
|
|
170
|
+
stacklevel=2,
|
|
171
|
+
)
|
|
172
|
+
super().__init__(*args, **kwargs)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
class TestFailure(TestComplete, AssertionError):
|
|
176
|
+
"""
|
|
177
|
+
Exception showing that the test was completed with severity Failure.
|
|
178
|
+
|
|
179
|
+
.. deprecated:: 1.6.0
|
|
180
|
+
Use a standard ``assert`` statement instead of raising this exception.
|
|
181
|
+
Use ``expect_fail`` rather than ``expect_error`` with this exception in the
|
|
182
|
+
:class:`cocotb.test` decorator.
|
|
183
|
+
"""
|
|
184
|
+
|
|
185
|
+
def __init__(self, *args, **kwargs):
|
|
186
|
+
warnings.warn(
|
|
187
|
+
"TestFailure is deprecated, use an ``assert`` statement instead",
|
|
188
|
+
DeprecationWarning,
|
|
189
|
+
stacklevel=2,
|
|
190
|
+
)
|
|
191
|
+
super().__init__(*args, **kwargs)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
class TestSuccess(TestComplete):
|
|
195
|
+
"""Exception showing that the test was completed successfully."""
|
|
196
|
+
|
|
197
|
+
pass
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
class SimFailure(TestComplete):
|
|
201
|
+
"""Exception showing that the simulator exited unsuccessfully."""
|
|
202
|
+
|
|
203
|
+
pass
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
class SimTimeoutError(TimeoutError):
|
|
207
|
+
"""Exception for when a timeout, in terms of simulation time, occurs."""
|
|
208
|
+
|
|
209
|
+
pass
|