cocotb 1.9.2__cp312-cp312-win_amd64.whl → 2.0.0b1__cp312-cp312-win_amd64.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 -332
- 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 -712
- 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.cp312-win_amd64.exp +0 -0
- cocotb/simulator.cp312-win_amd64.lib +0 -0
- cocotb/simulator.cp312-win_amd64.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 +60 -0
- cocotb-2.0.0b1.dist-info/RECORD +143 -0
- {cocotb-1.9.2.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.2.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 +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 → 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.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-1.9.2.dist-info → cocotb-2.0.0b1.dist-info/licenses}/LICENSE +0 -0
- {cocotb → cocotb_tools}/_vendor/distutils_version.py +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
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
|
+
from functools import lru_cache
|
|
5
|
+
from typing import Iterator, Sequence, Union, overload
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
from cocotb._utils import cached_method
|
|
7
8
|
|
|
8
9
|
|
|
9
|
-
class Range(
|
|
10
|
+
class Range(Sequence[int]):
|
|
10
11
|
r"""
|
|
11
12
|
Variant of :class:`range` with inclusive right bound.
|
|
12
13
|
|
|
@@ -19,19 +20,19 @@ class Range(typing.Sequence[int]):
|
|
|
19
20
|
left and right bounds.
|
|
20
21
|
Not specifying directionality will cause the directionality to be inferred.
|
|
21
22
|
|
|
22
|
-
.. code-block::
|
|
23
|
+
.. code-block:: pycon3
|
|
23
24
|
|
|
24
25
|
>>> r = Range(-2, 3)
|
|
25
26
|
>>> r.left, r.right, len(r)
|
|
26
27
|
(-2, 3, 6)
|
|
27
28
|
|
|
28
|
-
>>> s = Range(8,
|
|
29
|
+
>>> s = Range(8, "downto", 1)
|
|
29
30
|
>>> s.left, s.right, len(s)
|
|
30
31
|
(8, 1, 8)
|
|
31
32
|
|
|
32
33
|
:meth:`from_range` and :meth:`to_range` can be used to convert from and to :class:`range`.
|
|
33
34
|
|
|
34
|
-
.. code-block::
|
|
35
|
+
.. code-block:: pycon3
|
|
35
36
|
|
|
36
37
|
>>> r = Range(-2, 3)
|
|
37
38
|
>>> r.to_range()
|
|
@@ -41,9 +42,9 @@ class Range(typing.Sequence[int]):
|
|
|
41
42
|
"null" ranges occur when a left bound cannot reach a right bound with the given direction.
|
|
42
43
|
They have a length of 0, but the :attr:`left`, :attr:`right`, and :attr:`direction` values remain as given.
|
|
43
44
|
|
|
44
|
-
.. code-block::
|
|
45
|
+
.. code-block:: pycon3
|
|
45
46
|
|
|
46
|
-
>>> r = Range(1,
|
|
47
|
+
>>> r = Range(1, "to", 0) # no way to count from 1 'to' 0
|
|
47
48
|
>>> r.left, r.direction, r.right
|
|
48
49
|
(1, 'to', 0)
|
|
49
50
|
>>> len(r)
|
|
@@ -65,25 +66,20 @@ class Range(typing.Sequence[int]):
|
|
|
65
66
|
right: rightmost bound of range (inclusive)
|
|
66
67
|
"""
|
|
67
68
|
|
|
68
|
-
|
|
69
|
+
@overload
|
|
70
|
+
def __init__(self, left: int, direction: int) -> None: ...
|
|
69
71
|
|
|
70
|
-
@
|
|
71
|
-
def __init__(self, left: int, direction: int) -> None:
|
|
72
|
-
pass # pragma: no cover
|
|
72
|
+
@overload
|
|
73
|
+
def __init__(self, left: int, direction: str, right: int) -> None: ...
|
|
73
74
|
|
|
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
|
|
75
|
+
@overload
|
|
76
|
+
def __init__(self, left: int, *, right: int) -> None: ...
|
|
81
77
|
|
|
82
78
|
def __init__(
|
|
83
79
|
self,
|
|
84
80
|
left: int,
|
|
85
|
-
direction:
|
|
86
|
-
right:
|
|
81
|
+
direction: Union[int, str, None] = None,
|
|
82
|
+
right: Union[int, None] = None,
|
|
87
83
|
) -> None:
|
|
88
84
|
start = left
|
|
89
85
|
stop: int
|
|
@@ -91,12 +87,12 @@ class Range(typing.Sequence[int]):
|
|
|
91
87
|
if isinstance(direction, int) and right is None:
|
|
92
88
|
step = _guess_step(left, direction)
|
|
93
89
|
stop = direction + step
|
|
94
|
-
elif direction is None and isinstance(right, int):
|
|
95
|
-
step = _guess_step(left, right)
|
|
96
|
-
stop = right + step
|
|
97
90
|
elif isinstance(direction, str) and isinstance(right, int):
|
|
98
91
|
step = _direction_to_step(direction)
|
|
99
92
|
stop = right + step
|
|
93
|
+
elif direction is None and isinstance(right, int):
|
|
94
|
+
step = _guess_step(left, right)
|
|
95
|
+
stop = right + step
|
|
100
96
|
else:
|
|
101
97
|
raise TypeError("invalid arguments")
|
|
102
98
|
self._range = range(start, stop, step)
|
|
@@ -111,51 +107,49 @@ class Range(typing.Sequence[int]):
|
|
|
111
107
|
)
|
|
112
108
|
|
|
113
109
|
def to_range(self) -> range:
|
|
114
|
-
"""Convert
|
|
110
|
+
"""Convert Range to :class:`range`."""
|
|
115
111
|
return self._range
|
|
116
112
|
|
|
117
113
|
@property
|
|
118
114
|
def left(self) -> int:
|
|
119
|
-
"""Leftmost value in a
|
|
115
|
+
"""Leftmost value in a Range."""
|
|
120
116
|
return self._range.start
|
|
121
117
|
|
|
122
118
|
@property
|
|
123
119
|
def direction(self) -> str:
|
|
124
|
-
"""``'to'`` if
|
|
120
|
+
"""``'to'`` if Range is ascending, ``'downto'`` otherwise."""
|
|
125
121
|
return _step_to_direction(self._range.step)
|
|
126
122
|
|
|
127
123
|
@property
|
|
128
124
|
def right(self) -> int:
|
|
129
|
-
"""Rightmost value in a
|
|
125
|
+
"""Rightmost value in a Range."""
|
|
130
126
|
return self._range.stop - self._range.step
|
|
131
127
|
|
|
132
128
|
def __len__(self) -> int:
|
|
133
129
|
return len(self._range)
|
|
134
130
|
|
|
135
|
-
@
|
|
136
|
-
def __getitem__(self, item: int) -> int:
|
|
137
|
-
pass # pragma: no cover
|
|
131
|
+
@overload
|
|
132
|
+
def __getitem__(self, item: int) -> int: ...
|
|
138
133
|
|
|
139
|
-
@
|
|
140
|
-
def __getitem__(self, item: slice) -> "Range":
|
|
141
|
-
pass # pragma: no cover
|
|
134
|
+
@overload
|
|
135
|
+
def __getitem__(self, item: slice) -> "Range": ...
|
|
142
136
|
|
|
143
|
-
def __getitem__(self, item:
|
|
137
|
+
def __getitem__(self, item: Union[int, slice]) -> Union[int, "Range"]:
|
|
144
138
|
if isinstance(item, int):
|
|
145
139
|
return self._range[item]
|
|
146
140
|
elif isinstance(item, slice):
|
|
147
141
|
return type(self).from_range(self._range[item])
|
|
148
142
|
raise TypeError(
|
|
149
|
-
"indices must be integers or slices, not {
|
|
143
|
+
f"indices must be integers or slices, not {type(item).__name__}"
|
|
150
144
|
)
|
|
151
145
|
|
|
152
146
|
def __contains__(self, item: object) -> bool:
|
|
153
147
|
return item in self._range
|
|
154
148
|
|
|
155
|
-
def __iter__(self) ->
|
|
149
|
+
def __iter__(self) -> Iterator[int]:
|
|
156
150
|
return iter(self._range)
|
|
157
151
|
|
|
158
|
-
def __reversed__(self) ->
|
|
152
|
+
def __reversed__(self) -> Iterator[int]:
|
|
159
153
|
return reversed(self._range)
|
|
160
154
|
|
|
161
155
|
def __eq__(self, other: object) -> bool:
|
|
@@ -166,13 +160,10 @@ class Range(typing.Sequence[int]):
|
|
|
166
160
|
def __hash__(self) -> int:
|
|
167
161
|
return hash(self._range)
|
|
168
162
|
|
|
169
|
-
def count(self, item: int) -> int:
|
|
170
|
-
return self._range.count(item)
|
|
171
|
-
|
|
172
163
|
def __repr__(self) -> str:
|
|
173
|
-
return "{}({!r}, {!r}, {!r})"
|
|
174
|
-
|
|
175
|
-
|
|
164
|
+
return f"{type(self).__qualname__}({self.left!r}, {self.direction!r}, {self.right!r})"
|
|
165
|
+
|
|
166
|
+
index = cached_method(Sequence.index)
|
|
176
167
|
|
|
177
168
|
|
|
178
169
|
def _guess_step(left: int, right: int) -> int:
|
|
@@ -181,6 +172,7 @@ def _guess_step(left: int, right: int) -> int:
|
|
|
181
172
|
return -1
|
|
182
173
|
|
|
183
174
|
|
|
175
|
+
@lru_cache(maxsize=None)
|
|
184
176
|
def _direction_to_step(direction: str) -> int:
|
|
185
177
|
direction = direction.lower()
|
|
186
178
|
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()
|