cocotb 1.9.2__cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.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.

Files changed (89) hide show
  1. cocotb/ANSI.py +92 -0
  2. cocotb/__init__.py +371 -0
  3. cocotb/_deprecation.py +36 -0
  4. cocotb/_py_compat.py +63 -0
  5. cocotb/_sim_versions.py +145 -0
  6. cocotb/_vendor/__init__.py +0 -0
  7. cocotb/_vendor/distutils_version.py +346 -0
  8. cocotb/_version.py +8 -0
  9. cocotb/binary.py +858 -0
  10. cocotb/clock.py +174 -0
  11. cocotb/config.py +289 -0
  12. cocotb/decorators.py +332 -0
  13. cocotb/handle.py +1175 -0
  14. cocotb/ipython_support.py +92 -0
  15. cocotb/libs/libcocotb.so +0 -0
  16. cocotb/libs/libcocotbfli_modelsim.so +0 -0
  17. cocotb/libs/libcocotbutils.so +0 -0
  18. cocotb/libs/libcocotbvhpi_aldec.so +0 -0
  19. cocotb/libs/libcocotbvhpi_ius.so +0 -0
  20. cocotb/libs/libcocotbvhpi_modelsim.so +0 -0
  21. cocotb/libs/libcocotbvhpi_nvc.so +0 -0
  22. cocotb/libs/libcocotbvpi_aldec.so +0 -0
  23. cocotb/libs/libcocotbvpi_ghdl.so +0 -0
  24. cocotb/libs/libcocotbvpi_icarus.vpl +0 -0
  25. cocotb/libs/libcocotbvpi_ius.so +0 -0
  26. cocotb/libs/libcocotbvpi_modelsim.so +0 -0
  27. cocotb/libs/libcocotbvpi_vcs.so +0 -0
  28. cocotb/libs/libcocotbvpi_verilator.so +0 -0
  29. cocotb/libs/libembed.so +0 -0
  30. cocotb/libs/libgpi.so +0 -0
  31. cocotb/libs/libgpilog.so +0 -0
  32. cocotb/libs/libpygpilog.so +0 -0
  33. cocotb/log.py +303 -0
  34. cocotb/memdebug.py +35 -0
  35. cocotb/outcomes.py +56 -0
  36. cocotb/queue.py +179 -0
  37. cocotb/regression.py +933 -0
  38. cocotb/result.py +209 -0
  39. cocotb/runner.py +1400 -0
  40. cocotb/scheduler.py +1099 -0
  41. cocotb/share/def/.gitignore +2 -0
  42. cocotb/share/def/README.md +4 -0
  43. cocotb/share/def/aldec.def +61 -0
  44. cocotb/share/def/ghdl.def +43 -0
  45. cocotb/share/def/icarus.def +43 -0
  46. cocotb/share/def/modelsim.def +137 -0
  47. cocotb/share/include/cocotb_utils.h +93 -0
  48. cocotb/share/include/embed.h +56 -0
  49. cocotb/share/include/exports.h +20 -0
  50. cocotb/share/include/gpi.h +265 -0
  51. cocotb/share/include/gpi_logging.h +212 -0
  52. cocotb/share/include/py_gpi_logging.h +30 -0
  53. cocotb/share/include/vhpi_user_ext.h +26 -0
  54. cocotb/share/include/vpi_user_ext.h +55 -0
  55. cocotb/share/lib/verilator/verilator.cpp +196 -0
  56. cocotb/share/makefiles/Makefile.deprecations +12 -0
  57. cocotb/share/makefiles/Makefile.inc +176 -0
  58. cocotb/share/makefiles/Makefile.sim +113 -0
  59. cocotb/share/makefiles/simulators/Makefile.activehdl +79 -0
  60. cocotb/share/makefiles/simulators/Makefile.cvc +94 -0
  61. cocotb/share/makefiles/simulators/Makefile.ghdl +113 -0
  62. cocotb/share/makefiles/simulators/Makefile.icarus +111 -0
  63. cocotb/share/makefiles/simulators/Makefile.ius +125 -0
  64. cocotb/share/makefiles/simulators/Makefile.modelsim +32 -0
  65. cocotb/share/makefiles/simulators/Makefile.nvc +64 -0
  66. cocotb/share/makefiles/simulators/Makefile.questa +171 -0
  67. cocotb/share/makefiles/simulators/Makefile.riviera +183 -0
  68. cocotb/share/makefiles/simulators/Makefile.vcs +98 -0
  69. cocotb/share/makefiles/simulators/Makefile.verilator +86 -0
  70. cocotb/share/makefiles/simulators/Makefile.xcelium +136 -0
  71. cocotb/simulator.cpython-313-i386-linux-gnu.so +0 -0
  72. cocotb/task.py +325 -0
  73. cocotb/triggers.py +1104 -0
  74. cocotb/types/__init__.py +50 -0
  75. cocotb/types/array.py +309 -0
  76. cocotb/types/logic.py +292 -0
  77. cocotb/types/logic_array.py +298 -0
  78. cocotb/types/range.py +198 -0
  79. cocotb/utils.py +698 -0
  80. cocotb/wavedrom.py +199 -0
  81. cocotb/xunit_reporter.py +80 -0
  82. cocotb-1.9.2.dist-info/LICENSE +28 -0
  83. cocotb-1.9.2.dist-info/METADATA +168 -0
  84. cocotb-1.9.2.dist-info/RECORD +89 -0
  85. cocotb-1.9.2.dist-info/WHEEL +8 -0
  86. cocotb-1.9.2.dist-info/entry_points.txt +2 -0
  87. cocotb-1.9.2.dist-info/top_level.txt +21 -0
  88. pygpi/__init__.py +0 -0
  89. pygpi/entry.py +26 -0
cocotb/queue.py ADDED
@@ -0,0 +1,179 @@
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 typing import Generic, TypeVar
8
+
9
+ import cocotb
10
+ from cocotb.triggers import Event, _pointer_str
11
+
12
+
13
+ class QueueFull(asyncio.queues.QueueFull):
14
+ """Raised when the Queue.put_nowait() method is called on a full Queue."""
15
+
16
+
17
+ class QueueEmpty(asyncio.queues.QueueEmpty):
18
+ """Raised when the Queue.get_nowait() method is called on a empty Queue."""
19
+
20
+
21
+ T = TypeVar("T")
22
+
23
+
24
+ class Queue(Generic[T]):
25
+ """A queue, useful for coordinating producer and consumer coroutines.
26
+
27
+ If *maxsize* is less than or equal to 0, the queue size is infinite. If it
28
+ is an integer greater than 0, then :meth:`put` will block when the queue
29
+ reaches *maxsize*, until an item is removed by :meth:`get`.
30
+ """
31
+
32
+ def __init__(self, maxsize: int = 0):
33
+
34
+ self._maxsize = maxsize
35
+
36
+ self._finished = Event()
37
+ self._finished.set()
38
+
39
+ self._getters = collections.deque()
40
+ self._putters = collections.deque()
41
+
42
+ self._init(maxsize)
43
+
44
+ def _init(self, maxsize):
45
+ self._queue = collections.deque()
46
+
47
+ def _put(self, item):
48
+ self._queue.append(item)
49
+
50
+ def _get(self):
51
+ return self._queue.popleft()
52
+
53
+ def _wakeup_next(self, waiters):
54
+ while waiters:
55
+ event, task = waiters.popleft()
56
+ if not task.done():
57
+ event.set()
58
+ break
59
+
60
+ def __repr__(self):
61
+ return "<{} {} at {}>".format(
62
+ type(self).__name__, self._format(), _pointer_str(self)
63
+ )
64
+
65
+ def __str__(self):
66
+ return "<{} {}>".format(type(self).__name__, self._format())
67
+
68
+ def __class_getitem__(cls, type):
69
+ return cls
70
+
71
+ def _format(self):
72
+ result = "maxsize={}".format(repr(self._maxsize))
73
+ if getattr(self, "_queue", None):
74
+ result += " _queue={}".format(repr(list(self._queue)))
75
+ if self._getters:
76
+ result += " _getters[{}]".format(len(self._getters))
77
+ if self._putters:
78
+ result += " _putters[{}]".format(len(self._putters))
79
+ return result
80
+
81
+ def qsize(self) -> int:
82
+ """Number of items in the queue."""
83
+ return len(self._queue)
84
+
85
+ @property
86
+ def maxsize(self) -> int:
87
+ """Number of items allowed in the queue."""
88
+ return self._maxsize
89
+
90
+ def empty(self) -> bool:
91
+ """Return ``True`` if the queue is empty, ``False`` otherwise."""
92
+ return not self._queue
93
+
94
+ def full(self) -> bool:
95
+ """Return ``True`` if there are :meth:`maxsize` items in the queue.
96
+
97
+ .. note::
98
+ If the Queue was initialized with ``maxsize=0`` (the default), then
99
+ :meth:`full` is never ``True``.
100
+ """
101
+ if self._maxsize <= 0:
102
+ return False
103
+ else:
104
+ return self.qsize() >= self._maxsize
105
+
106
+ async def put(self, item: T) -> None:
107
+ """Put an *item* into the queue.
108
+
109
+ If the queue is full, wait until a free
110
+ slot is available before adding the item.
111
+ """
112
+ while self.full():
113
+ event = Event("{} put".format(type(self).__name__))
114
+ self._putters.append((event, cocotb.scheduler._current_task))
115
+ await event.wait()
116
+ self.put_nowait(item)
117
+
118
+ def put_nowait(self, item: T) -> None:
119
+ """Put an *item* into the queue without blocking.
120
+
121
+ If no free slot is immediately available, raise :exc:`asyncio.QueueFull`.
122
+ """
123
+ if self.full():
124
+ raise QueueFull()
125
+ self._put(item)
126
+ self._finished.clear()
127
+ self._wakeup_next(self._getters)
128
+
129
+ async def get(self) -> T:
130
+ """Remove and return an item from the queue.
131
+
132
+ If the queue is empty, wait until an item is available.
133
+ """
134
+ while self.empty():
135
+ event = Event("{} get".format(type(self).__name__))
136
+ self._getters.append((event, cocotb.scheduler._current_task))
137
+ await event.wait()
138
+ return self.get_nowait()
139
+
140
+ def get_nowait(self) -> T:
141
+ """Remove and return an item from the queue.
142
+
143
+ Return an item if one is immediately available, else raise
144
+ :exc:`asyncio.QueueEmpty`.
145
+ """
146
+ if self.empty():
147
+ raise QueueEmpty()
148
+ item = self._get()
149
+ self._wakeup_next(self._putters)
150
+ return item
151
+
152
+
153
+ class PriorityQueue(Queue):
154
+ r"""A subclass of :class:`Queue`; retrieves entries in priority order (smallest item first).
155
+
156
+ Entries are typically tuples of the form ``(priority number, data)``.
157
+ """
158
+
159
+ def _init(self, maxsize):
160
+ self._queue = []
161
+
162
+ def _put(self, item):
163
+ heapq.heappush(self._queue, item)
164
+
165
+ def _get(self):
166
+ return heapq.heappop(self._queue)
167
+
168
+
169
+ class LifoQueue(Queue):
170
+ """A subclass of :class:`Queue`; retrieves most recently added entries first."""
171
+
172
+ def _init(self, maxsize):
173
+ self._queue = collections.deque()
174
+
175
+ def _put(self, item):
176
+ self._queue.append(item)
177
+
178
+ def _get(self):
179
+ return self._queue.pop()