cocotb 1.9.2__cp313-cp313-win32.whl → 2.0.0rc2__cp313-cp313-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 +65 -0
- cocotb/__init__.py +81 -327
- cocotb/_base_triggers.py +515 -0
- cocotb/_bridge.py +186 -0
- cocotb/_decorators.py +515 -0
- cocotb/_deprecation.py +3 -3
- cocotb/_exceptions.py +7 -0
- cocotb/_extended_awaitables.py +419 -0
- cocotb/_gpi_triggers.py +385 -0
- cocotb/_init.py +301 -0
- cocotb/_outcomes.py +54 -0
- cocotb/_profiling.py +46 -0
- cocotb/_py_compat.py +114 -29
- cocotb/_scheduler.py +448 -0
- cocotb/_test.py +248 -0
- cocotb/_test_factory.py +312 -0
- cocotb/_test_functions.py +42 -0
- cocotb/_typing.py +7 -0
- cocotb/_utils.py +274 -0
- cocotb/_version.py +3 -7
- cocotb/_xunit_reporter.py +66 -0
- cocotb/clock.py +353 -108
- cocotb/debug.py +24 -0
- cocotb/handle.py +1370 -793
- cocotb/libs/cocotb.dll +0 -0
- cocotb/libs/cocotb.exp +0 -0
- cocotb/libs/cocotb.lib +0 -0
- cocotb/libs/cocotbfli_modelsim.dll +0 -0
- cocotb/libs/cocotbfli_modelsim.exp +0 -0
- cocotb/libs/cocotbfli_modelsim.lib +0 -0
- cocotb/libs/cocotbutils.dll +0 -0
- cocotb/libs/cocotbutils.exp +0 -0
- cocotb/libs/cocotbutils.lib +0 -0
- cocotb/libs/cocotbvhpi_aldec.dll +0 -0
- cocotb/libs/cocotbvhpi_aldec.exp +0 -0
- cocotb/libs/cocotbvhpi_aldec.lib +0 -0
- cocotb/libs/cocotbvhpi_modelsim.dll +0 -0
- cocotb/libs/cocotbvhpi_modelsim.exp +0 -0
- cocotb/libs/cocotbvhpi_modelsim.lib +0 -0
- cocotb/libs/cocotbvpi_aldec.dll +0 -0
- cocotb/libs/cocotbvpi_aldec.exp +0 -0
- cocotb/libs/cocotbvpi_aldec.lib +0 -0
- cocotb/libs/cocotbvpi_ghdl.dll +0 -0
- cocotb/libs/cocotbvpi_ghdl.exp +0 -0
- cocotb/libs/cocotbvpi_ghdl.lib +0 -0
- cocotb/libs/cocotbvpi_icarus.exp +0 -0
- cocotb/libs/cocotbvpi_icarus.lib +0 -0
- cocotb/libs/cocotbvpi_icarus.vpl +0 -0
- cocotb/libs/cocotbvpi_modelsim.dll +0 -0
- cocotb/libs/cocotbvpi_modelsim.exp +0 -0
- cocotb/libs/cocotbvpi_modelsim.lib +0 -0
- cocotb/libs/embed.dll +0 -0
- cocotb/libs/embed.exp +0 -0
- cocotb/libs/embed.lib +0 -0
- cocotb/libs/gpi.dll +0 -0
- cocotb/libs/gpi.exp +0 -0
- cocotb/libs/gpi.lib +0 -0
- cocotb/libs/gpilog.dll +0 -0
- cocotb/libs/gpilog.exp +0 -0
- cocotb/libs/gpilog.lib +0 -0
- cocotb/libs/pygpilog.dll +0 -0
- cocotb/libs/pygpilog.exp +0 -0
- cocotb/libs/pygpilog.lib +0 -0
- cocotb/logging.py +424 -0
- cocotb/queue.py +103 -57
- cocotb/regression.py +680 -717
- cocotb/result.py +17 -188
- cocotb/share/def/aldec.exp +0 -0
- cocotb/share/def/aldec.lib +0 -0
- cocotb/share/def/ghdl.exp +0 -0
- cocotb/share/def/ghdl.lib +0 -0
- cocotb/share/def/icarus.exp +0 -0
- cocotb/share/def/icarus.lib +0 -0
- cocotb/share/def/modelsim.def +1 -0
- cocotb/share/def/modelsim.exp +0 -0
- cocotb/share/def/modelsim.lib +0 -0
- cocotb/share/include/cocotb_utils.h +9 -32
- cocotb/share/include/embed.h +7 -30
- cocotb/share/include/gpi.h +331 -137
- cocotb/share/include/gpi_logging.h +221 -142
- cocotb/share/include/py_gpi_logging.h +8 -5
- cocotb/share/include/vpi_user_ext.h +4 -26
- cocotb/share/lib/verilator/verilator.cpp +80 -67
- cocotb/simtime.py +230 -0
- cocotb/simulator.cp313-win32.exp +0 -0
- cocotb/simulator.cp313-win32.lib +0 -0
- cocotb/simulator.cp313-win32.pyd +0 -0
- cocotb/simulator.pyi +107 -0
- cocotb/task.py +478 -213
- cocotb/triggers.py +55 -1092
- cocotb/types/__init__.py +28 -47
- cocotb/types/_abstract_array.py +151 -0
- cocotb/types/_array.py +295 -0
- cocotb/types/_indexing.py +17 -0
- cocotb/types/_logic.py +333 -0
- cocotb/types/_logic_array.py +868 -0
- cocotb/types/{range.py → _range.py} +47 -48
- cocotb/types/_resolve.py +76 -0
- cocotb/utils.py +58 -646
- cocotb-2.0.0rc2.dist-info/METADATA +60 -0
- cocotb-2.0.0rc2.dist-info/RECORD +146 -0
- {cocotb-1.9.2.dist-info → cocotb-2.0.0rc2.dist-info}/WHEEL +1 -1
- cocotb-2.0.0rc2.dist-info/entry_points.txt +2 -0
- {cocotb-1.9.2.dist-info → cocotb-2.0.0rc2.dist-info/licenses}/LICENSE +1 -0
- {cocotb-1.9.2.dist-info → cocotb-2.0.0rc2.dist-info}/top_level.txt +1 -0
- cocotb_tools/__init__.py +0 -0
- cocotb_tools/_coverage.py +33 -0
- cocotb_tools/_vendor/__init__.py +3 -0
- cocotb_tools/check_results.py +65 -0
- cocotb_tools/combine_results.py +152 -0
- cocotb_tools/config.py +241 -0
- {cocotb → cocotb_tools}/ipython_support.py +29 -22
- cocotb_tools/makefiles/Makefile.deprecations +27 -0
- {cocotb/share → cocotb_tools}/makefiles/Makefile.inc +77 -55
- {cocotb/share → cocotb_tools}/makefiles/Makefile.sim +16 -33
- {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.activehdl +9 -16
- cocotb_tools/makefiles/simulators/Makefile.cvc +61 -0
- cocotb_tools/makefiles/simulators/Makefile.dsim +39 -0
- {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.ghdl +13 -42
- cocotb_tools/makefiles/simulators/Makefile.icarus +80 -0
- cocotb_tools/makefiles/simulators/Makefile.ius +93 -0
- cocotb_tools/makefiles/simulators/Makefile.modelsim +9 -0
- cocotb_tools/makefiles/simulators/Makefile.nvc +60 -0
- cocotb_tools/makefiles/simulators/Makefile.questa +29 -0
- cocotb/share/makefiles/simulators/Makefile.questa → cocotb_tools/makefiles/simulators/Makefile.questa-compat +26 -54
- cocotb_tools/makefiles/simulators/Makefile.questa-qisqrun +149 -0
- {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.riviera +17 -56
- cocotb_tools/makefiles/simulators/Makefile.vcs +65 -0
- {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.verilator +15 -22
- {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.xcelium +20 -52
- cocotb_tools/py.typed +0 -0
- cocotb_tools/runner.py +1868 -0
- cocotb/_sim_versions.py → cocotb_tools/sim_versions.py +16 -21
- pygpi/entry.py +34 -18
- pygpi/py.typed +0 -0
- cocotb/ANSI.py +0 -92
- cocotb/binary.py +0 -858
- cocotb/config.py +0 -289
- cocotb/decorators.py +0 -332
- cocotb/log.py +0 -303
- cocotb/memdebug.py +0 -35
- cocotb/outcomes.py +0 -56
- cocotb/runner.py +0 -1400
- cocotb/scheduler.py +0 -1099
- cocotb/share/makefiles/Makefile.deprecations +0 -12
- cocotb/share/makefiles/simulators/Makefile.cvc +0 -94
- cocotb/share/makefiles/simulators/Makefile.icarus +0 -111
- cocotb/share/makefiles/simulators/Makefile.ius +0 -125
- cocotb/share/makefiles/simulators/Makefile.modelsim +0 -32
- cocotb/share/makefiles/simulators/Makefile.nvc +0 -64
- cocotb/share/makefiles/simulators/Makefile.vcs +0 -98
- cocotb/types/array.py +0 -309
- cocotb/types/logic.py +0 -292
- cocotb/types/logic_array.py +0 -298
- cocotb/wavedrom.py +0 -199
- cocotb/xunit_reporter.py +0 -80
- cocotb-1.9.2.dist-info/METADATA +0 -168
- cocotb-1.9.2.dist-info/RECORD +0 -121
- cocotb-1.9.2.dist-info/entry_points.txt +0 -2
- /cocotb/{_vendor/__init__.py → py.typed} +0 -0
- {cocotb → cocotb_tools}/_vendor/distutils_version.py +0 -0
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
# Copyright cocotb contributors
|
|
2
2
|
# Licensed under the Revised BSD License, see LICENSE for details.
|
|
3
3
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
-
import
|
|
4
|
+
import copy
|
|
5
|
+
from functools import lru_cache
|
|
6
|
+
from typing import Any, Dict, Iterator, Sequence, Union, overload
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
from cocotb._utils import cached_method
|
|
7
9
|
|
|
8
10
|
|
|
9
|
-
class Range(
|
|
11
|
+
class Range(Sequence[int]):
|
|
10
12
|
r"""
|
|
11
13
|
Variant of :class:`range` with inclusive right bound.
|
|
12
14
|
|
|
@@ -19,19 +21,19 @@ class Range(typing.Sequence[int]):
|
|
|
19
21
|
left and right bounds.
|
|
20
22
|
Not specifying directionality will cause the directionality to be inferred.
|
|
21
23
|
|
|
22
|
-
.. code-block::
|
|
24
|
+
.. code-block:: pycon3
|
|
23
25
|
|
|
24
26
|
>>> r = Range(-2, 3)
|
|
25
27
|
>>> r.left, r.right, len(r)
|
|
26
28
|
(-2, 3, 6)
|
|
27
29
|
|
|
28
|
-
>>> s = Range(8,
|
|
30
|
+
>>> s = Range(8, "downto", 1)
|
|
29
31
|
>>> s.left, s.right, len(s)
|
|
30
32
|
(8, 1, 8)
|
|
31
33
|
|
|
32
34
|
:meth:`from_range` and :meth:`to_range` can be used to convert from and to :class:`range`.
|
|
33
35
|
|
|
34
|
-
.. code-block::
|
|
36
|
+
.. code-block:: pycon3
|
|
35
37
|
|
|
36
38
|
>>> r = Range(-2, 3)
|
|
37
39
|
>>> r.to_range()
|
|
@@ -39,11 +41,11 @@ class Range(typing.Sequence[int]):
|
|
|
39
41
|
|
|
40
42
|
:class:`Range` supports "null" ranges as seen in VHDL.
|
|
41
43
|
"null" ranges occur when a left bound cannot reach a right bound with the given direction.
|
|
42
|
-
They have a length of 0
|
|
44
|
+
They have a length of ``0``, but the :attr:`left`, :attr:`right`, and :attr:`direction` values remain as given.
|
|
43
45
|
|
|
44
|
-
.. code-block::
|
|
46
|
+
.. code-block:: pycon3
|
|
45
47
|
|
|
46
|
-
>>> r = Range(1,
|
|
48
|
+
>>> r = Range(1, "to", 0) # no way to count from 1 'to' 0
|
|
47
49
|
>>> r.left, r.direction, r.right
|
|
48
50
|
(1, 'to', 0)
|
|
49
51
|
>>> len(r)
|
|
@@ -60,30 +62,25 @@ class Range(typing.Sequence[int]):
|
|
|
60
62
|
The typical use case of this type is in conjunction with :class:`~cocotb.types.Array`.
|
|
61
63
|
|
|
62
64
|
Args:
|
|
63
|
-
left:
|
|
64
|
-
direction: ``'to'`` if values are ascending, ``'downto'`` if descending
|
|
65
|
-
right:
|
|
65
|
+
left: Leftmost bound of range.
|
|
66
|
+
direction: ``'to'`` if values are ascending, ``'downto'`` if descending.
|
|
67
|
+
right: Rightmost bound of range (inclusive).
|
|
66
68
|
"""
|
|
67
69
|
|
|
68
|
-
|
|
70
|
+
@overload
|
|
71
|
+
def __init__(self, left: int, direction: int) -> None: ...
|
|
69
72
|
|
|
70
|
-
@
|
|
71
|
-
def __init__(self, left: int, direction: int) -> None:
|
|
72
|
-
pass # pragma: no cover
|
|
73
|
+
@overload
|
|
74
|
+
def __init__(self, left: int, direction: str, right: int) -> None: ...
|
|
73
75
|
|
|
74
|
-
@
|
|
75
|
-
def __init__(self, left: int,
|
|
76
|
-
pass # pragma: no cover
|
|
77
|
-
|
|
78
|
-
@typing.overload
|
|
79
|
-
def __init__(self, left: int, *, right: int) -> None:
|
|
80
|
-
pass # pragma: no cover
|
|
76
|
+
@overload
|
|
77
|
+
def __init__(self, left: int, *, right: int) -> None: ...
|
|
81
78
|
|
|
82
79
|
def __init__(
|
|
83
80
|
self,
|
|
84
81
|
left: int,
|
|
85
|
-
direction:
|
|
86
|
-
right:
|
|
82
|
+
direction: Union[int, str, None] = None,
|
|
83
|
+
right: Union[int, None] = None,
|
|
87
84
|
) -> None:
|
|
88
85
|
start = left
|
|
89
86
|
stop: int
|
|
@@ -91,12 +88,12 @@ class Range(typing.Sequence[int]):
|
|
|
91
88
|
if isinstance(direction, int) and right is None:
|
|
92
89
|
step = _guess_step(left, direction)
|
|
93
90
|
stop = direction + step
|
|
94
|
-
elif direction is None and isinstance(right, int):
|
|
95
|
-
step = _guess_step(left, right)
|
|
96
|
-
stop = right + step
|
|
97
91
|
elif isinstance(direction, str) and isinstance(right, int):
|
|
98
92
|
step = _direction_to_step(direction)
|
|
99
93
|
stop = right + step
|
|
94
|
+
elif direction is None and isinstance(right, int):
|
|
95
|
+
step = _guess_step(left, right)
|
|
96
|
+
stop = right + step
|
|
100
97
|
else:
|
|
101
98
|
raise TypeError("invalid arguments")
|
|
102
99
|
self._range = range(start, stop, step)
|
|
@@ -111,51 +108,49 @@ class Range(typing.Sequence[int]):
|
|
|
111
108
|
)
|
|
112
109
|
|
|
113
110
|
def to_range(self) -> range:
|
|
114
|
-
"""Convert
|
|
111
|
+
"""Convert Range to :class:`range`."""
|
|
115
112
|
return self._range
|
|
116
113
|
|
|
117
114
|
@property
|
|
118
115
|
def left(self) -> int:
|
|
119
|
-
"""Leftmost value in a
|
|
116
|
+
"""Leftmost value in a Range."""
|
|
120
117
|
return self._range.start
|
|
121
118
|
|
|
122
119
|
@property
|
|
123
120
|
def direction(self) -> str:
|
|
124
|
-
"""``'to'`` if
|
|
121
|
+
"""``'to'`` if Range is ascending, ``'downto'`` otherwise."""
|
|
125
122
|
return _step_to_direction(self._range.step)
|
|
126
123
|
|
|
127
124
|
@property
|
|
128
125
|
def right(self) -> int:
|
|
129
|
-
"""Rightmost value in a
|
|
126
|
+
"""Rightmost value in a Range."""
|
|
130
127
|
return self._range.stop - self._range.step
|
|
131
128
|
|
|
132
129
|
def __len__(self) -> int:
|
|
133
130
|
return len(self._range)
|
|
134
131
|
|
|
135
|
-
@
|
|
136
|
-
def __getitem__(self, item: int) -> int:
|
|
137
|
-
pass # pragma: no cover
|
|
132
|
+
@overload
|
|
133
|
+
def __getitem__(self, item: int) -> int: ...
|
|
138
134
|
|
|
139
|
-
@
|
|
140
|
-
def __getitem__(self, item: slice) -> "Range":
|
|
141
|
-
pass # pragma: no cover
|
|
135
|
+
@overload
|
|
136
|
+
def __getitem__(self, item: slice) -> "Range": ...
|
|
142
137
|
|
|
143
|
-
def __getitem__(self, item:
|
|
138
|
+
def __getitem__(self, item: Union[int, slice]) -> Union[int, "Range"]:
|
|
144
139
|
if isinstance(item, int):
|
|
145
140
|
return self._range[item]
|
|
146
141
|
elif isinstance(item, slice):
|
|
147
142
|
return type(self).from_range(self._range[item])
|
|
148
143
|
raise TypeError(
|
|
149
|
-
"indices must be integers or slices, not {
|
|
144
|
+
f"indices must be integers or slices, not {type(item).__name__}"
|
|
150
145
|
)
|
|
151
146
|
|
|
152
147
|
def __contains__(self, item: object) -> bool:
|
|
153
148
|
return item in self._range
|
|
154
149
|
|
|
155
|
-
def __iter__(self) ->
|
|
150
|
+
def __iter__(self) -> Iterator[int]:
|
|
156
151
|
return iter(self._range)
|
|
157
152
|
|
|
158
|
-
def __reversed__(self) ->
|
|
153
|
+
def __reversed__(self) -> Iterator[int]:
|
|
159
154
|
return reversed(self._range)
|
|
160
155
|
|
|
161
156
|
def __eq__(self, other: object) -> bool:
|
|
@@ -166,13 +161,16 @@ class Range(typing.Sequence[int]):
|
|
|
166
161
|
def __hash__(self) -> int:
|
|
167
162
|
return hash(self._range)
|
|
168
163
|
|
|
169
|
-
def count(self, item: int) -> int:
|
|
170
|
-
return self._range.count(item)
|
|
171
|
-
|
|
172
164
|
def __repr__(self) -> str:
|
|
173
|
-
return "{}({!r}, {!r}, {!r})"
|
|
174
|
-
|
|
175
|
-
|
|
165
|
+
return f"{type(self).__qualname__}({self.left!r}, {self.direction!r}, {self.right!r})"
|
|
166
|
+
|
|
167
|
+
index = cached_method(Sequence.index)
|
|
168
|
+
|
|
169
|
+
def __copy__(self) -> "Range":
|
|
170
|
+
return Range.from_range(self._range)
|
|
171
|
+
|
|
172
|
+
def __deepcopy__(self, memo: Dict[int, Any]) -> "Range":
|
|
173
|
+
return Range.from_range(copy.deepcopy(self._range, memo=memo))
|
|
176
174
|
|
|
177
175
|
|
|
178
176
|
def _guess_step(left: int, right: int) -> int:
|
|
@@ -181,6 +179,7 @@ def _guess_step(left: int, right: int) -> int:
|
|
|
181
179
|
return -1
|
|
182
180
|
|
|
183
181
|
|
|
182
|
+
@lru_cache(maxsize=None)
|
|
184
183
|
def _direction_to_step(direction: str) -> int:
|
|
185
184
|
direction = direction.lower()
|
|
186
185
|
if direction == "to":
|
cocotb/types/_resolve.py
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Copyright cocotb contributors
|
|
2
|
+
# Licensed under the Revised BSD License, see LICENSE for details.
|
|
3
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
+
import os
|
|
5
|
+
from functools import lru_cache
|
|
6
|
+
from random import getrandbits
|
|
7
|
+
from typing import Callable, Dict, Union
|
|
8
|
+
|
|
9
|
+
from cocotb._py_compat import Final, Literal, TypeAlias
|
|
10
|
+
|
|
11
|
+
ResolverLiteral: TypeAlias = Literal["weak", "zeros", "ones", "random"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
_ord_0 = ord("0")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class _random_resolve_table(Dict[int, int]):
|
|
18
|
+
def __init__(self) -> None:
|
|
19
|
+
self[ord("0")] = ord("0")
|
|
20
|
+
self[ord("1")] = ord("1")
|
|
21
|
+
self[ord("L")] = ord("0")
|
|
22
|
+
self[ord("H")] = ord("1")
|
|
23
|
+
|
|
24
|
+
def __missing__(self, _: str) -> int:
|
|
25
|
+
return getrandbits(1) + _ord_0
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
_resolve_tables: Dict[str, Dict[int, int]] = {
|
|
29
|
+
"error": {},
|
|
30
|
+
"weak": str.maketrans("LHW", "01X"),
|
|
31
|
+
"zeros": str.maketrans("LHUXZW-", "0100000"),
|
|
32
|
+
"ones": str.maketrans("LHUXZW-", "0111111"),
|
|
33
|
+
"random": _random_resolve_table(),
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
_VALID_RESOLVERS = ("error", "weak", "zeros", "ones", "random")
|
|
37
|
+
_VALID_RESOLVERS_ERR_MSG = (
|
|
38
|
+
"Valid values are 'error', 'weak', 'zeros', 'ones', or 'random'"
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@lru_cache(maxsize=None)
|
|
43
|
+
def get_str_resolver(resolver: ResolverLiteral) -> Callable[[str], str]:
|
|
44
|
+
if resolver not in _VALID_RESOLVERS:
|
|
45
|
+
raise ValueError(f"Invalid resolver: {resolver!r}. {_VALID_RESOLVERS_ERR_MSG}")
|
|
46
|
+
|
|
47
|
+
resolve_table = _resolve_tables[resolver]
|
|
48
|
+
|
|
49
|
+
def resolve_func(value: str) -> str:
|
|
50
|
+
return value.translate(resolve_table)
|
|
51
|
+
|
|
52
|
+
return resolve_func
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _init() -> Union[Callable[[str], str], None]:
|
|
56
|
+
_envvar = os.getenv("COCOTB_RESOLVE_X", None)
|
|
57
|
+
|
|
58
|
+
# no resolver
|
|
59
|
+
if _envvar is None:
|
|
60
|
+
return None
|
|
61
|
+
|
|
62
|
+
# backwards compatibility
|
|
63
|
+
resolver = _envvar.strip().lower()
|
|
64
|
+
if resolver == "value_error":
|
|
65
|
+
resolver = "error"
|
|
66
|
+
|
|
67
|
+
# get resolver
|
|
68
|
+
try:
|
|
69
|
+
return get_str_resolver(resolver)
|
|
70
|
+
except ValueError:
|
|
71
|
+
raise ValueError(
|
|
72
|
+
f"Invalid COCOTB_RESOLVE_X value: {_envvar!r}. {_VALID_RESOLVERS_ERR_MSG}"
|
|
73
|
+
) from None
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
RESOLVE_X: Final = _init()
|