cocotb 1.9.2__cp36-cp36m-win_amd64.whl → 2.0.0b1__cp36-cp36m-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.cp36-win_amd64.exp +0 -0
- cocotb/simulator.cp36-win_amd64.lib +0 -0
- cocotb/simulator.cp36-win_amd64.pyd +0 -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 +48 -0
- cocotb-2.0.0b1.dist-info/RECORD +139 -0
- cocotb-2.0.0b1.dist-info/entry_points.txt +3 -0
- {cocotb-1.9.2.dist-info → cocotb-2.0.0b1.dist-info}/top_level.txt +1 -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 → cocotb_tools}/runner.py +794 -361
- cocotb/_sim_versions.py → cocotb_tools/sim_versions.py +16 -21
- pygpi/entry.py +34 -17
- 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 -170
- cocotb-1.9.2.dist-info/RECORD +0 -121
- cocotb-1.9.2.dist-info/entry_points.txt +0 -3
- {cocotb-1.9.2.dist-info → cocotb-2.0.0b1.dist-info}/LICENSE +0 -0
- {cocotb-1.9.2.dist-info → cocotb-2.0.0b1.dist-info}/WHEEL +0 -0
- {cocotb/_vendor → cocotb_tools}/__init__.py +0 -0
- {cocotb → cocotb_tools}/_vendor/distutils_version.py +0 -0
cocotb/queue.py
CHANGED
|
@@ -4,24 +4,42 @@
|
|
|
4
4
|
import asyncio.queues
|
|
5
5
|
import collections
|
|
6
6
|
import heapq
|
|
7
|
-
from
|
|
7
|
+
from abc import abstractmethod
|
|
8
|
+
from typing import (
|
|
9
|
+
Deque,
|
|
10
|
+
Generic,
|
|
11
|
+
List,
|
|
12
|
+
Tuple,
|
|
13
|
+
TypeVar,
|
|
14
|
+
)
|
|
8
15
|
|
|
9
16
|
import cocotb
|
|
10
|
-
from cocotb.
|
|
17
|
+
from cocotb._utils import pointer_str
|
|
18
|
+
from cocotb.task import Task
|
|
19
|
+
from cocotb.triggers import Event
|
|
20
|
+
|
|
21
|
+
__all__ = (
|
|
22
|
+
"AbstractQueue",
|
|
23
|
+
"LifoQueue",
|
|
24
|
+
"PriorityQueue",
|
|
25
|
+
"Queue",
|
|
26
|
+
"QueueEmpty",
|
|
27
|
+
"QueueFull",
|
|
28
|
+
)
|
|
11
29
|
|
|
12
30
|
|
|
13
31
|
class QueueFull(asyncio.queues.QueueFull):
|
|
14
|
-
"""Raised when the Queue.put_nowait() method is called on a full Queue
|
|
32
|
+
"""Raised when the :meth:`Queue.put_nowait()` method is called on a full :class:`Queue`."""
|
|
15
33
|
|
|
16
34
|
|
|
17
35
|
class QueueEmpty(asyncio.queues.QueueEmpty):
|
|
18
|
-
"""Raised when the Queue.get_nowait() method is called on
|
|
36
|
+
"""Raised when the :meth:`Queue.get_nowait()` method is called on an empty :class:`Queue`."""
|
|
19
37
|
|
|
20
38
|
|
|
21
39
|
T = TypeVar("T")
|
|
22
40
|
|
|
23
41
|
|
|
24
|
-
class
|
|
42
|
+
class AbstractQueue(Generic[T]):
|
|
25
43
|
"""A queue, useful for coordinating producer and consumer coroutines.
|
|
26
44
|
|
|
27
45
|
If *maxsize* is less than or equal to 0, the queue size is infinite. If it
|
|
@@ -29,58 +47,53 @@ class Queue(Generic[T]):
|
|
|
29
47
|
reaches *maxsize*, until an item is removed by :meth:`get`.
|
|
30
48
|
"""
|
|
31
49
|
|
|
32
|
-
def __init__(self, maxsize: int = 0):
|
|
33
|
-
|
|
34
|
-
self.
|
|
35
|
-
|
|
36
|
-
self._finished = Event()
|
|
37
|
-
self._finished.set()
|
|
50
|
+
def __init__(self, maxsize: int = 0) -> None:
|
|
51
|
+
self._maxsize: int = maxsize
|
|
52
|
+
self._getters: Deque[Tuple[Event, Task[object]]] = collections.deque()
|
|
53
|
+
self._putters: Deque[Tuple[Event, Task[object]]] = collections.deque()
|
|
38
54
|
|
|
39
|
-
|
|
40
|
-
|
|
55
|
+
@abstractmethod
|
|
56
|
+
def _get(self) -> T:
|
|
57
|
+
"""Remove and return the next element from the queue."""
|
|
41
58
|
|
|
42
|
-
|
|
59
|
+
@abstractmethod
|
|
60
|
+
def _put(self, item: T) -> None:
|
|
61
|
+
"""Place a new element on the queue."""
|
|
43
62
|
|
|
44
|
-
|
|
45
|
-
|
|
63
|
+
@abstractmethod
|
|
64
|
+
def _size(self) -> int:
|
|
65
|
+
"""Return the number of elements in the queue."""
|
|
46
66
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def _get(self):
|
|
51
|
-
return self._queue.popleft()
|
|
67
|
+
@abstractmethod
|
|
68
|
+
def _repr(self) -> str:
|
|
69
|
+
"""Return a string representation of the state of the queue."""
|
|
52
70
|
|
|
53
|
-
def _wakeup_next(self, waiters):
|
|
71
|
+
def _wakeup_next(self, waiters: Deque[Tuple[Event, Task[object]]]) -> None:
|
|
54
72
|
while waiters:
|
|
55
73
|
event, task = waiters.popleft()
|
|
56
74
|
if not task.done():
|
|
57
75
|
event.set()
|
|
58
76
|
break
|
|
59
77
|
|
|
60
|
-
def __repr__(self):
|
|
61
|
-
return "<{} {} at {}>"
|
|
62
|
-
type(self).__name__, self._format(), _pointer_str(self)
|
|
63
|
-
)
|
|
78
|
+
def __repr__(self) -> str:
|
|
79
|
+
return f"<{type(self).__name__} {self._format()} at {pointer_str(self)}>"
|
|
64
80
|
|
|
65
|
-
def __str__(self):
|
|
66
|
-
return "<{
|
|
81
|
+
def __str__(self) -> str:
|
|
82
|
+
return f"<{type(self).__name__} {self._format()}>"
|
|
67
83
|
|
|
68
|
-
def
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
def _format(self):
|
|
72
|
-
result = "maxsize={}".format(repr(self._maxsize))
|
|
84
|
+
def _format(self) -> str:
|
|
85
|
+
result = f"maxsize={self._maxsize!r}"
|
|
73
86
|
if getattr(self, "_queue", None):
|
|
74
|
-
result += " _queue={
|
|
87
|
+
result += f" _queue={self._repr()}"
|
|
75
88
|
if self._getters:
|
|
76
|
-
result += " _getters[{
|
|
89
|
+
result += f" _getters[{len(self._getters)}]"
|
|
77
90
|
if self._putters:
|
|
78
|
-
result += " _putters[{
|
|
91
|
+
result += f" _putters[{len(self._putters)}]"
|
|
79
92
|
return result
|
|
80
93
|
|
|
81
94
|
def qsize(self) -> int:
|
|
82
95
|
"""Number of items in the queue."""
|
|
83
|
-
return
|
|
96
|
+
return self._size()
|
|
84
97
|
|
|
85
98
|
@property
|
|
86
99
|
def maxsize(self) -> int:
|
|
@@ -89,7 +102,7 @@ class Queue(Generic[T]):
|
|
|
89
102
|
|
|
90
103
|
def empty(self) -> bool:
|
|
91
104
|
"""Return ``True`` if the queue is empty, ``False`` otherwise."""
|
|
92
|
-
return
|
|
105
|
+
return self._size() == 0
|
|
93
106
|
|
|
94
107
|
def full(self) -> bool:
|
|
95
108
|
"""Return ``True`` if there are :meth:`maxsize` items in the queue.
|
|
@@ -110,20 +123,19 @@ class Queue(Generic[T]):
|
|
|
110
123
|
slot is available before adding the item.
|
|
111
124
|
"""
|
|
112
125
|
while self.full():
|
|
113
|
-
event = Event(
|
|
114
|
-
self._putters.append((event, cocotb.
|
|
126
|
+
event = Event()
|
|
127
|
+
self._putters.append((event, cocotb.task.current_task()))
|
|
115
128
|
await event.wait()
|
|
116
129
|
self.put_nowait(item)
|
|
117
130
|
|
|
118
131
|
def put_nowait(self, item: T) -> None:
|
|
119
132
|
"""Put an *item* into the queue without blocking.
|
|
120
133
|
|
|
121
|
-
If no free slot is immediately available, raise :exc
|
|
134
|
+
If no free slot is immediately available, raise :exc:`~cocotb.queue.QueueFull`.
|
|
122
135
|
"""
|
|
123
136
|
if self.full():
|
|
124
137
|
raise QueueFull()
|
|
125
138
|
self._put(item)
|
|
126
|
-
self._finished.clear()
|
|
127
139
|
self._wakeup_next(self._getters)
|
|
128
140
|
|
|
129
141
|
async def get(self) -> T:
|
|
@@ -132,8 +144,8 @@ class Queue(Generic[T]):
|
|
|
132
144
|
If the queue is empty, wait until an item is available.
|
|
133
145
|
"""
|
|
134
146
|
while self.empty():
|
|
135
|
-
event = Event(
|
|
136
|
-
self._getters.append((event, cocotb.
|
|
147
|
+
event = Event()
|
|
148
|
+
self._getters.append((event, cocotb.task.current_task()))
|
|
137
149
|
await event.wait()
|
|
138
150
|
return self.get_nowait()
|
|
139
151
|
|
|
@@ -141,7 +153,7 @@ class Queue(Generic[T]):
|
|
|
141
153
|
"""Remove and return an item from the queue.
|
|
142
154
|
|
|
143
155
|
Return an item if one is immediately available, else raise
|
|
144
|
-
:exc
|
|
156
|
+
:exc:`~cocotb.queue.QueueEmpty`.
|
|
145
157
|
"""
|
|
146
158
|
if self.empty():
|
|
147
159
|
raise QueueEmpty()
|
|
@@ -150,30 +162,64 @@ class Queue(Generic[T]):
|
|
|
150
162
|
return item
|
|
151
163
|
|
|
152
164
|
|
|
153
|
-
class
|
|
154
|
-
|
|
165
|
+
class Queue(AbstractQueue[T]):
|
|
166
|
+
"""A subclass of :class:`AbstractQueue`; retrieves oldest entries first (FIFO)."""
|
|
167
|
+
|
|
168
|
+
def __init__(self, maxsize: int = 0) -> None:
|
|
169
|
+
super().__init__(maxsize)
|
|
170
|
+
self._queue: Deque[T] = collections.deque()
|
|
171
|
+
|
|
172
|
+
def _put(self, item: T) -> None:
|
|
173
|
+
self._queue.append(item)
|
|
174
|
+
|
|
175
|
+
def _get(self) -> T:
|
|
176
|
+
return self._queue.popleft()
|
|
177
|
+
|
|
178
|
+
def _size(self) -> int:
|
|
179
|
+
return len(self._queue)
|
|
180
|
+
|
|
181
|
+
def _repr(self) -> str:
|
|
182
|
+
return repr(self._queue)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
class PriorityQueue(AbstractQueue[T]):
|
|
186
|
+
r"""A subclass of :class:`AbstractQueue`; retrieves entries in priority order (smallest item first).
|
|
155
187
|
|
|
156
188
|
Entries are typically tuples of the form ``(priority number, data)``.
|
|
157
189
|
"""
|
|
158
190
|
|
|
159
|
-
def
|
|
160
|
-
|
|
191
|
+
def __init__(self, maxsize: int = 0) -> None:
|
|
192
|
+
super().__init__(maxsize)
|
|
193
|
+
self._queue: List[T] = []
|
|
161
194
|
|
|
162
|
-
def _put(self, item):
|
|
195
|
+
def _put(self, item: T) -> None:
|
|
163
196
|
heapq.heappush(self._queue, item)
|
|
164
197
|
|
|
165
|
-
def _get(self):
|
|
198
|
+
def _get(self) -> T:
|
|
166
199
|
return heapq.heappop(self._queue)
|
|
167
200
|
|
|
201
|
+
def _size(self) -> int:
|
|
202
|
+
return len(self._queue)
|
|
203
|
+
|
|
204
|
+
def _repr(self) -> str:
|
|
205
|
+
return repr(self._queue)
|
|
206
|
+
|
|
168
207
|
|
|
169
|
-
class LifoQueue(
|
|
170
|
-
"""A subclass of :class:`
|
|
208
|
+
class LifoQueue(AbstractQueue[T]):
|
|
209
|
+
"""A subclass of :class:`AbstractQueue`; retrieves most recently added entries first (LIFO)."""
|
|
171
210
|
|
|
172
|
-
def
|
|
173
|
-
|
|
211
|
+
def __init__(self, maxsize: int = 0) -> None:
|
|
212
|
+
super().__init__(maxsize)
|
|
213
|
+
self._queue: Deque[T] = collections.deque()
|
|
174
214
|
|
|
175
|
-
def _put(self, item):
|
|
215
|
+
def _put(self, item: T) -> None:
|
|
176
216
|
self._queue.append(item)
|
|
177
217
|
|
|
178
|
-
def _get(self):
|
|
218
|
+
def _get(self) -> T:
|
|
179
219
|
return self._queue.pop()
|
|
220
|
+
|
|
221
|
+
def _size(self) -> int:
|
|
222
|
+
return len(self._queue)
|
|
223
|
+
|
|
224
|
+
def _repr(self) -> str:
|
|
225
|
+
return repr(self._queue)
|