cocotb 2.0.1__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.
Files changed (152) hide show
  1. cocotb/_ANSI.py +65 -0
  2. cocotb/__init__.py +127 -0
  3. cocotb/_base_triggers.py +515 -0
  4. cocotb/_bridge.py +186 -0
  5. cocotb/_decorators.py +515 -0
  6. cocotb/_deprecation.py +36 -0
  7. cocotb/_exceptions.py +7 -0
  8. cocotb/_extended_awaitables.py +419 -0
  9. cocotb/_gpi_triggers.py +385 -0
  10. cocotb/_init.py +301 -0
  11. cocotb/_outcomes.py +54 -0
  12. cocotb/_profiling.py +46 -0
  13. cocotb/_py_compat.py +150 -0
  14. cocotb/_scheduler.py +448 -0
  15. cocotb/_test.py +248 -0
  16. cocotb/_test_factory.py +312 -0
  17. cocotb/_test_functions.py +42 -0
  18. cocotb/_typing.py +7 -0
  19. cocotb/_utils.py +274 -0
  20. cocotb/_version.py +4 -0
  21. cocotb/_xunit_reporter.py +103 -0
  22. cocotb/clock.py +419 -0
  23. cocotb/debug.py +24 -0
  24. cocotb/handle.py +1752 -0
  25. cocotb/libs/cocotb.dll +0 -0
  26. cocotb/libs/cocotb.exp +0 -0
  27. cocotb/libs/cocotb.lib +0 -0
  28. cocotb/libs/cocotbfli_modelsim.dll +0 -0
  29. cocotb/libs/cocotbfli_modelsim.exp +0 -0
  30. cocotb/libs/cocotbfli_modelsim.lib +0 -0
  31. cocotb/libs/cocotbutils.dll +0 -0
  32. cocotb/libs/cocotbutils.exp +0 -0
  33. cocotb/libs/cocotbutils.lib +0 -0
  34. cocotb/libs/cocotbvhpi_aldec.dll +0 -0
  35. cocotb/libs/cocotbvhpi_aldec.exp +0 -0
  36. cocotb/libs/cocotbvhpi_aldec.lib +0 -0
  37. cocotb/libs/cocotbvhpi_modelsim.dll +0 -0
  38. cocotb/libs/cocotbvhpi_modelsim.exp +0 -0
  39. cocotb/libs/cocotbvhpi_modelsim.lib +0 -0
  40. cocotb/libs/cocotbvhpi_nvc.dll +0 -0
  41. cocotb/libs/cocotbvhpi_nvc.exp +0 -0
  42. cocotb/libs/cocotbvhpi_nvc.lib +0 -0
  43. cocotb/libs/cocotbvpi_aldec.dll +0 -0
  44. cocotb/libs/cocotbvpi_aldec.exp +0 -0
  45. cocotb/libs/cocotbvpi_aldec.lib +0 -0
  46. cocotb/libs/cocotbvpi_ghdl.dll +0 -0
  47. cocotb/libs/cocotbvpi_ghdl.exp +0 -0
  48. cocotb/libs/cocotbvpi_ghdl.lib +0 -0
  49. cocotb/libs/cocotbvpi_icarus.exp +0 -0
  50. cocotb/libs/cocotbvpi_icarus.lib +0 -0
  51. cocotb/libs/cocotbvpi_icarus.vpl +0 -0
  52. cocotb/libs/cocotbvpi_modelsim.dll +0 -0
  53. cocotb/libs/cocotbvpi_modelsim.exp +0 -0
  54. cocotb/libs/cocotbvpi_modelsim.lib +0 -0
  55. cocotb/libs/embed.dll +0 -0
  56. cocotb/libs/embed.exp +0 -0
  57. cocotb/libs/embed.lib +0 -0
  58. cocotb/libs/gpi.dll +0 -0
  59. cocotb/libs/gpi.exp +0 -0
  60. cocotb/libs/gpi.lib +0 -0
  61. cocotb/libs/gpilog.dll +0 -0
  62. cocotb/libs/gpilog.exp +0 -0
  63. cocotb/libs/gpilog.lib +0 -0
  64. cocotb/libs/pygpilog.dll +0 -0
  65. cocotb/libs/pygpilog.exp +0 -0
  66. cocotb/libs/pygpilog.lib +0 -0
  67. cocotb/logging.py +417 -0
  68. cocotb/py.typed +0 -0
  69. cocotb/queue.py +235 -0
  70. cocotb/regression.py +900 -0
  71. cocotb/result.py +38 -0
  72. cocotb/share/def/.gitignore +2 -0
  73. cocotb/share/def/README.md +4 -0
  74. cocotb/share/def/aldec.def +61 -0
  75. cocotb/share/def/aldec.exp +0 -0
  76. cocotb/share/def/aldec.lib +0 -0
  77. cocotb/share/def/ghdl.def +43 -0
  78. cocotb/share/def/ghdl.exp +0 -0
  79. cocotb/share/def/ghdl.lib +0 -0
  80. cocotb/share/def/icarus.def +43 -0
  81. cocotb/share/def/icarus.exp +0 -0
  82. cocotb/share/def/icarus.lib +0 -0
  83. cocotb/share/def/modelsim.def +138 -0
  84. cocotb/share/def/modelsim.exp +0 -0
  85. cocotb/share/def/modelsim.lib +0 -0
  86. cocotb/share/def/nvcvhpi.def +18 -0
  87. cocotb/share/def/nvcvhpi.exp +0 -0
  88. cocotb/share/def/nvcvhpi.lib +0 -0
  89. cocotb/share/include/cocotb_utils.h +70 -0
  90. cocotb/share/include/embed.h +33 -0
  91. cocotb/share/include/exports.h +20 -0
  92. cocotb/share/include/gpi.h +459 -0
  93. cocotb/share/include/gpi_logging.h +291 -0
  94. cocotb/share/include/py_gpi_logging.h +33 -0
  95. cocotb/share/include/vhpi_user_ext.h +26 -0
  96. cocotb/share/include/vpi_user_ext.h +33 -0
  97. cocotb/share/lib/verilator/verilator.cpp +209 -0
  98. cocotb/simtime.py +238 -0
  99. cocotb/simulator.cp38-win32.exp +0 -0
  100. cocotb/simulator.cp38-win32.lib +0 -0
  101. cocotb/simulator.cp38-win32.pyd +0 -0
  102. cocotb/simulator.cp38-win32.pyd.2.config +8 -0
  103. cocotb/simulator.pyi +107 -0
  104. cocotb/task.py +590 -0
  105. cocotb/triggers.py +67 -0
  106. cocotb/types/__init__.py +31 -0
  107. cocotb/types/_abstract_array.py +151 -0
  108. cocotb/types/_array.py +297 -0
  109. cocotb/types/_indexing.py +17 -0
  110. cocotb/types/_logic.py +333 -0
  111. cocotb/types/_logic_array.py +884 -0
  112. cocotb/types/_range.py +197 -0
  113. cocotb/types/_resolve.py +76 -0
  114. cocotb/utils.py +110 -0
  115. cocotb-2.0.1.dist-info/LICENSE +29 -0
  116. cocotb-2.0.1.dist-info/METADATA +44 -0
  117. cocotb-2.0.1.dist-info/RECORD +152 -0
  118. cocotb-2.0.1.dist-info/WHEEL +5 -0
  119. cocotb-2.0.1.dist-info/entry_points.txt +2 -0
  120. cocotb-2.0.1.dist-info/top_level.txt +18 -0
  121. cocotb_tools/__init__.py +0 -0
  122. cocotb_tools/_coverage.py +33 -0
  123. cocotb_tools/_vendor/__init__.py +3 -0
  124. cocotb_tools/_vendor/distutils_version.py +346 -0
  125. cocotb_tools/check_results.py +65 -0
  126. cocotb_tools/combine_results.py +152 -0
  127. cocotb_tools/config.py +242 -0
  128. cocotb_tools/ipython_support.py +99 -0
  129. cocotb_tools/makefiles/Makefile.deprecations +27 -0
  130. cocotb_tools/makefiles/Makefile.inc +198 -0
  131. cocotb_tools/makefiles/Makefile.sim +96 -0
  132. cocotb_tools/makefiles/simulators/Makefile.activehdl +72 -0
  133. cocotb_tools/makefiles/simulators/Makefile.cvc +61 -0
  134. cocotb_tools/makefiles/simulators/Makefile.dsim +39 -0
  135. cocotb_tools/makefiles/simulators/Makefile.ghdl +84 -0
  136. cocotb_tools/makefiles/simulators/Makefile.icarus +80 -0
  137. cocotb_tools/makefiles/simulators/Makefile.ius +93 -0
  138. cocotb_tools/makefiles/simulators/Makefile.modelsim +9 -0
  139. cocotb_tools/makefiles/simulators/Makefile.nvc +60 -0
  140. cocotb_tools/makefiles/simulators/Makefile.questa +29 -0
  141. cocotb_tools/makefiles/simulators/Makefile.questa-compat +143 -0
  142. cocotb_tools/makefiles/simulators/Makefile.questa-qisqrun +149 -0
  143. cocotb_tools/makefiles/simulators/Makefile.riviera +144 -0
  144. cocotb_tools/makefiles/simulators/Makefile.vcs +65 -0
  145. cocotb_tools/makefiles/simulators/Makefile.verilator +79 -0
  146. cocotb_tools/makefiles/simulators/Makefile.xcelium +104 -0
  147. cocotb_tools/py.typed +0 -0
  148. cocotb_tools/runner.py +2001 -0
  149. cocotb_tools/sim_versions.py +140 -0
  150. pygpi/__init__.py +0 -0
  151. pygpi/entry.py +42 -0
  152. pygpi/py.typed +0 -0
cocotb/queue.py ADDED
@@ -0,0 +1,235 @@
1
+ # Copyright cocotb contributors
2
+ # Licensed under the Revised BSD License, see LICENSE for details.
3
+ # SPDX-License-Identifier: BSD-3-Clause
4
+ import asyncio.queues
5
+ import collections
6
+ import heapq
7
+ from abc import abstractmethod
8
+ from typing import TYPE_CHECKING, Deque, Generic, List, Tuple, TypeVar
9
+
10
+ import cocotb
11
+ from cocotb._utils import pointer_str
12
+ from cocotb.task import Task
13
+ from cocotb.triggers import Event
14
+
15
+ if TYPE_CHECKING:
16
+ from typing import Protocol, Self
17
+
18
+ class SupportsRichComparison(Protocol):
19
+ def __eq__(self, other: object) -> bool: ...
20
+ def __lt__(self, other: Self) -> bool: ...
21
+ def __le__(self, other: Self) -> bool: ...
22
+ def __gt__(self, other: Self) -> bool: ...
23
+ def __ge__(self, other: Self) -> bool: ...
24
+
25
+
26
+ __all__ = (
27
+ "AbstractQueue",
28
+ "LifoQueue",
29
+ "PriorityQueue",
30
+ "Queue",
31
+ "QueueEmpty",
32
+ "QueueFull",
33
+ )
34
+
35
+
36
+ class QueueFull(asyncio.queues.QueueFull):
37
+ """Raised when the :meth:`Queue.put_nowait()` method is called on a full :class:`Queue`."""
38
+
39
+
40
+ class QueueEmpty(asyncio.queues.QueueEmpty):
41
+ """Raised when the :meth:`Queue.get_nowait()` method is called on an empty :class:`Queue`."""
42
+
43
+
44
+ T = TypeVar("T")
45
+
46
+
47
+ class AbstractQueue(Generic[T]):
48
+ """A queue, useful for coordinating producer and consumer coroutines.
49
+
50
+ If *maxsize* is less than or equal to 0, the queue size is infinite. If it
51
+ is an integer greater than 0, then :meth:`put` will block when the queue
52
+ reaches *maxsize*, until an item is removed by :meth:`get`.
53
+ """
54
+
55
+ def __init__(self, maxsize: int = 0) -> None:
56
+ self._maxsize: int = maxsize
57
+ self._getters: Deque[Tuple[Event, Task[object]]] = collections.deque()
58
+ self._putters: Deque[Tuple[Event, Task[object]]] = collections.deque()
59
+
60
+ @abstractmethod
61
+ def _get(self) -> T:
62
+ """Remove and return the next element from the queue."""
63
+
64
+ @abstractmethod
65
+ def _put(self, item: T) -> None:
66
+ """Place a new element on the queue."""
67
+
68
+ @abstractmethod
69
+ def _size(self) -> int:
70
+ """Return the number of elements in the queue."""
71
+
72
+ @abstractmethod
73
+ def _repr(self) -> str:
74
+ """Return a string representation of the state of the queue."""
75
+
76
+ def _wakeup_next(self, waiters: Deque[Tuple[Event, Task[object]]]) -> None:
77
+ while waiters:
78
+ event, task = waiters.popleft()
79
+ if not task.done():
80
+ event.set()
81
+ break
82
+
83
+ def __repr__(self) -> str:
84
+ return f"<{type(self).__name__} {self._format()} at {pointer_str(self)}>"
85
+
86
+ def __str__(self) -> str:
87
+ return f"<{type(self).__name__} {self._format()}>"
88
+
89
+ def _format(self) -> str:
90
+ result = f"maxsize={self._maxsize!r}"
91
+ if getattr(self, "_queue", None):
92
+ result += f" _queue={self._repr()}"
93
+ if self._getters:
94
+ result += f" _getters[{len(self._getters)}]"
95
+ if self._putters:
96
+ result += f" _putters[{len(self._putters)}]"
97
+ return result
98
+
99
+ def qsize(self) -> int:
100
+ """Number of items in the queue."""
101
+ return self._size()
102
+
103
+ @property
104
+ def maxsize(self) -> int:
105
+ """Number of items allowed in the queue."""
106
+ return self._maxsize
107
+
108
+ def empty(self) -> bool:
109
+ """Return ``True`` if the queue is empty, ``False`` otherwise."""
110
+ return self._size() == 0
111
+
112
+ def full(self) -> bool:
113
+ """Return ``True`` if there are :meth:`maxsize` items in the queue.
114
+
115
+ .. note::
116
+ If the Queue was initialized with ``maxsize=0`` (the default), then
117
+ :meth:`full` is never ``True``.
118
+ """
119
+ if self._maxsize <= 0:
120
+ return False
121
+ else:
122
+ return self.qsize() >= self._maxsize
123
+
124
+ async def put(self, item: T) -> None:
125
+ """Put an *item* into the queue.
126
+
127
+ If the queue is full, wait until a free
128
+ slot is available before adding the item.
129
+ """
130
+ while self.full():
131
+ event = Event()
132
+ self._putters.append((event, cocotb.task.current_task()))
133
+ await event.wait()
134
+ self.put_nowait(item)
135
+
136
+ def put_nowait(self, item: T) -> None:
137
+ """Put an *item* into the queue without blocking.
138
+
139
+ If no free slot is immediately available, raise :exc:`~cocotb.queue.QueueFull`.
140
+ """
141
+ if self.full():
142
+ raise QueueFull()
143
+ self._put(item)
144
+ self._wakeup_next(self._getters)
145
+
146
+ async def get(self) -> T:
147
+ """Remove and return an item from the queue.
148
+
149
+ If the queue is empty, wait until an item is available.
150
+ """
151
+ while self.empty():
152
+ event = Event()
153
+ self._getters.append((event, cocotb.task.current_task()))
154
+ await event.wait()
155
+ return self.get_nowait()
156
+
157
+ def get_nowait(self) -> T:
158
+ """Remove and return an item from the queue.
159
+
160
+ Return an item if one is immediately available, else raise
161
+ :exc:`~cocotb.queue.QueueEmpty`.
162
+ """
163
+ if self.empty():
164
+ raise QueueEmpty()
165
+ item = self._get()
166
+ self._wakeup_next(self._putters)
167
+ return item
168
+
169
+
170
+ class Queue(AbstractQueue[T]):
171
+ """A subclass of :class:`AbstractQueue`; retrieves oldest entries first (FIFO)."""
172
+
173
+ def __init__(self, maxsize: int = 0) -> None:
174
+ super().__init__(maxsize)
175
+ self._queue: Deque[T] = collections.deque()
176
+
177
+ def _put(self, item: T) -> None:
178
+ self._queue.append(item)
179
+
180
+ def _get(self) -> T:
181
+ return self._queue.popleft()
182
+
183
+ def _size(self) -> int:
184
+ return len(self._queue)
185
+
186
+ def _repr(self) -> str:
187
+ return repr(self._queue)
188
+
189
+
190
+ SupportsRichComparisonT = TypeVar(
191
+ "SupportsRichComparisonT", bound="SupportsRichComparison"
192
+ )
193
+
194
+
195
+ class PriorityQueue(AbstractQueue[SupportsRichComparisonT]):
196
+ r"""A subclass of :class:`AbstractQueue`; retrieves entries in priority order (smallest item first).
197
+
198
+ Entries are typically tuples of the form ``(priority number, data)``.
199
+ """
200
+
201
+ def __init__(self, maxsize: int = 0) -> None:
202
+ super().__init__(maxsize)
203
+ self._queue: List[SupportsRichComparisonT] = []
204
+
205
+ def _put(self, item: SupportsRichComparisonT) -> None:
206
+ heapq.heappush(self._queue, item)
207
+
208
+ def _get(self) -> SupportsRichComparisonT:
209
+ return heapq.heappop(self._queue)
210
+
211
+ def _size(self) -> int:
212
+ return len(self._queue)
213
+
214
+ def _repr(self) -> str:
215
+ return repr(self._queue)
216
+
217
+
218
+ class LifoQueue(AbstractQueue[T]):
219
+ """A subclass of :class:`AbstractQueue`; retrieves most recently added entries first (LIFO)."""
220
+
221
+ def __init__(self, maxsize: int = 0) -> None:
222
+ super().__init__(maxsize)
223
+ self._queue: Deque[T] = collections.deque()
224
+
225
+ def _put(self, item: T) -> None:
226
+ self._queue.append(item)
227
+
228
+ def _get(self) -> T:
229
+ return self._queue.pop()
230
+
231
+ def _size(self) -> int:
232
+ return len(self._queue)
233
+
234
+ def _repr(self) -> str:
235
+ return repr(self._queue)