cocotb 1.9.2__cp311-cp311-win32.whl → 2.0.0b1__cp311-cp311-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.

Files changed (155) hide show
  1. cocotb/{ANSI.py → _ANSI.py} +5 -25
  2. cocotb/__init__.py +76 -332
  3. cocotb/_base_triggers.py +513 -0
  4. cocotb/_bridge.py +187 -0
  5. cocotb/_decorators.py +515 -0
  6. cocotb/_deprecation.py +3 -3
  7. cocotb/_exceptions.py +7 -0
  8. cocotb/_extended_awaitables.py +419 -0
  9. cocotb/_gpi_triggers.py +382 -0
  10. cocotb/_init.py +295 -0
  11. cocotb/_outcomes.py +54 -0
  12. cocotb/_profiling.py +46 -0
  13. cocotb/_py_compat.py +100 -29
  14. cocotb/_scheduler.py +454 -0
  15. cocotb/_test.py +245 -0
  16. cocotb/_test_factory.py +309 -0
  17. cocotb/_test_functions.py +42 -0
  18. cocotb/_typing.py +7 -0
  19. cocotb/_utils.py +296 -0
  20. cocotb/_version.py +3 -7
  21. cocotb/_xunit_reporter.py +66 -0
  22. cocotb/clock.py +271 -108
  23. cocotb/handle.py +1342 -795
  24. cocotb/libs/cocotb.dll +0 -0
  25. cocotb/libs/cocotb.exp +0 -0
  26. cocotb/libs/cocotb.lib +0 -0
  27. cocotb/libs/cocotbfli_modelsim.dll +0 -0
  28. cocotb/libs/cocotbfli_modelsim.exp +0 -0
  29. cocotb/libs/cocotbfli_modelsim.lib +0 -0
  30. cocotb/libs/cocotbutils.dll +0 -0
  31. cocotb/libs/cocotbutils.exp +0 -0
  32. cocotb/libs/cocotbutils.lib +0 -0
  33. cocotb/libs/cocotbvhpi_aldec.dll +0 -0
  34. cocotb/libs/cocotbvhpi_aldec.exp +0 -0
  35. cocotb/libs/cocotbvhpi_aldec.lib +0 -0
  36. cocotb/libs/cocotbvhpi_modelsim.dll +0 -0
  37. cocotb/libs/cocotbvhpi_modelsim.exp +0 -0
  38. cocotb/libs/cocotbvhpi_modelsim.lib +0 -0
  39. cocotb/libs/cocotbvpi_aldec.dll +0 -0
  40. cocotb/libs/cocotbvpi_aldec.exp +0 -0
  41. cocotb/libs/cocotbvpi_aldec.lib +0 -0
  42. cocotb/libs/cocotbvpi_ghdl.dll +0 -0
  43. cocotb/libs/cocotbvpi_ghdl.exp +0 -0
  44. cocotb/libs/cocotbvpi_ghdl.lib +0 -0
  45. cocotb/libs/cocotbvpi_icarus.exp +0 -0
  46. cocotb/libs/cocotbvpi_icarus.lib +0 -0
  47. cocotb/libs/cocotbvpi_icarus.vpl +0 -0
  48. cocotb/libs/cocotbvpi_modelsim.dll +0 -0
  49. cocotb/libs/cocotbvpi_modelsim.exp +0 -0
  50. cocotb/libs/cocotbvpi_modelsim.lib +0 -0
  51. cocotb/libs/embed.dll +0 -0
  52. cocotb/libs/embed.exp +0 -0
  53. cocotb/libs/embed.lib +0 -0
  54. cocotb/libs/gpi.dll +0 -0
  55. cocotb/libs/gpi.exp +0 -0
  56. cocotb/libs/gpi.lib +0 -0
  57. cocotb/libs/gpilog.dll +0 -0
  58. cocotb/libs/gpilog.exp +0 -0
  59. cocotb/libs/gpilog.lib +0 -0
  60. cocotb/libs/pygpilog.dll +0 -0
  61. cocotb/libs/pygpilog.exp +0 -0
  62. cocotb/libs/pygpilog.lib +0 -0
  63. cocotb/{log.py → logging.py} +105 -110
  64. cocotb/queue.py +103 -57
  65. cocotb/regression.py +667 -712
  66. cocotb/result.py +17 -188
  67. cocotb/share/def/aldec.exp +0 -0
  68. cocotb/share/def/aldec.lib +0 -0
  69. cocotb/share/def/ghdl.exp +0 -0
  70. cocotb/share/def/ghdl.lib +0 -0
  71. cocotb/share/def/icarus.exp +0 -0
  72. cocotb/share/def/icarus.lib +0 -0
  73. cocotb/share/def/modelsim.def +1 -0
  74. cocotb/share/def/modelsim.exp +0 -0
  75. cocotb/share/def/modelsim.lib +0 -0
  76. cocotb/share/include/cocotb_utils.h +6 -29
  77. cocotb/share/include/embed.h +5 -28
  78. cocotb/share/include/gpi.h +137 -92
  79. cocotb/share/include/gpi_logging.h +221 -142
  80. cocotb/share/include/py_gpi_logging.h +7 -4
  81. cocotb/share/include/vpi_user_ext.h +4 -26
  82. cocotb/share/lib/verilator/verilator.cpp +59 -54
  83. cocotb/simulator.cp311-win32.exp +0 -0
  84. cocotb/simulator.cp311-win32.lib +0 -0
  85. cocotb/simulator.cp311-win32.pyd +0 -0
  86. cocotb/simulator.pyi +107 -0
  87. cocotb/task.py +434 -212
  88. cocotb/triggers.py +55 -1092
  89. cocotb/types/__init__.py +25 -47
  90. cocotb/types/_abstract_array.py +151 -0
  91. cocotb/types/_array.py +264 -0
  92. cocotb/types/_logic.py +296 -0
  93. cocotb/types/_logic_array.py +834 -0
  94. cocotb/types/{range.py → _range.py} +36 -44
  95. cocotb/types/_resolve.py +76 -0
  96. cocotb/utils.py +119 -587
  97. cocotb-2.0.0b1.dist-info/METADATA +60 -0
  98. cocotb-2.0.0b1.dist-info/RECORD +143 -0
  99. {cocotb-1.9.2.dist-info → cocotb-2.0.0b1.dist-info}/WHEEL +1 -1
  100. cocotb-2.0.0b1.dist-info/entry_points.txt +2 -0
  101. {cocotb-1.9.2.dist-info → cocotb-2.0.0b1.dist-info}/top_level.txt +1 -0
  102. cocotb_tools/__init__.py +0 -0
  103. cocotb_tools/_coverage.py +33 -0
  104. cocotb_tools/_vendor/__init__.py +3 -0
  105. cocotb_tools/check_results.py +65 -0
  106. cocotb_tools/combine_results.py +152 -0
  107. cocotb_tools/config.py +241 -0
  108. {cocotb → cocotb_tools}/ipython_support.py +29 -22
  109. cocotb_tools/makefiles/Makefile.deprecations +27 -0
  110. {cocotb/share → cocotb_tools}/makefiles/Makefile.inc +82 -54
  111. {cocotb/share → cocotb_tools}/makefiles/Makefile.sim +8 -33
  112. {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.activehdl +9 -16
  113. cocotb_tools/makefiles/simulators/Makefile.cvc +61 -0
  114. cocotb_tools/makefiles/simulators/Makefile.dsim +39 -0
  115. {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.ghdl +13 -42
  116. cocotb_tools/makefiles/simulators/Makefile.icarus +80 -0
  117. cocotb_tools/makefiles/simulators/Makefile.ius +93 -0
  118. cocotb_tools/makefiles/simulators/Makefile.modelsim +9 -0
  119. cocotb_tools/makefiles/simulators/Makefile.nvc +60 -0
  120. cocotb_tools/makefiles/simulators/Makefile.questa +29 -0
  121. cocotb/share/makefiles/simulators/Makefile.questa → cocotb_tools/makefiles/simulators/Makefile.questa-compat +26 -54
  122. cocotb_tools/makefiles/simulators/Makefile.questa-qisqrun +149 -0
  123. {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.riviera +17 -56
  124. cocotb_tools/makefiles/simulators/Makefile.vcs +65 -0
  125. {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.verilator +15 -22
  126. {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.xcelium +20 -52
  127. cocotb_tools/py.typed +0 -0
  128. {cocotb → cocotb_tools}/runner.py +794 -361
  129. cocotb/_sim_versions.py → cocotb_tools/sim_versions.py +16 -21
  130. pygpi/entry.py +34 -17
  131. pygpi/py.typed +0 -0
  132. cocotb/binary.py +0 -858
  133. cocotb/config.py +0 -289
  134. cocotb/decorators.py +0 -332
  135. cocotb/memdebug.py +0 -35
  136. cocotb/outcomes.py +0 -56
  137. cocotb/scheduler.py +0 -1099
  138. cocotb/share/makefiles/Makefile.deprecations +0 -12
  139. cocotb/share/makefiles/simulators/Makefile.cvc +0 -94
  140. cocotb/share/makefiles/simulators/Makefile.icarus +0 -111
  141. cocotb/share/makefiles/simulators/Makefile.ius +0 -125
  142. cocotb/share/makefiles/simulators/Makefile.modelsim +0 -32
  143. cocotb/share/makefiles/simulators/Makefile.nvc +0 -64
  144. cocotb/share/makefiles/simulators/Makefile.vcs +0 -98
  145. cocotb/types/array.py +0 -309
  146. cocotb/types/logic.py +0 -292
  147. cocotb/types/logic_array.py +0 -298
  148. cocotb/wavedrom.py +0 -199
  149. cocotb/xunit_reporter.py +0 -80
  150. cocotb-1.9.2.dist-info/METADATA +0 -168
  151. cocotb-1.9.2.dist-info/RECORD +0 -121
  152. cocotb-1.9.2.dist-info/entry_points.txt +0 -2
  153. /cocotb/{_vendor/__init__.py → py.typed} +0 -0
  154. {cocotb-1.9.2.dist-info → cocotb-2.0.0b1.dist-info/licenses}/LICENSE +0 -0
  155. {cocotb → cocotb_tools}/_vendor/distutils_version.py +0 -0
cocotb/_outcomes.py ADDED
@@ -0,0 +1,54 @@
1
+ """
2
+ Inspired by https://github.com/python-trio/outcome
3
+
4
+ An outcome is similar to the built-in :any:`concurrent.futures.Future`
5
+ or :any:`asyncio.Future`, but without being tied to a particular task model.
6
+ """
7
+
8
+ import abc
9
+ from typing import Callable, Generic, TypeVar
10
+
11
+ from cocotb._py_compat import ParamSpec
12
+ from cocotb._utils import remove_traceback_frames
13
+
14
+ T = TypeVar("T")
15
+ P = ParamSpec("P")
16
+
17
+
18
+ def capture(
19
+ fn: "Callable[P, T]", *args: "P.args", **kwargs: "P.kwargs"
20
+ ) -> "Outcome[T]":
21
+ """Obtain an `Outcome` representing the result of a function call."""
22
+ try:
23
+ return Value(fn(*args, **kwargs))
24
+ except BaseException as e:
25
+ e = remove_traceback_frames(e, ["capture"])
26
+ return Error(e)
27
+
28
+
29
+ class Outcome(Generic[T]):
30
+ @abc.abstractmethod
31
+ def get(self) -> T:
32
+ """Get the value of this outcome, or throw its exception."""
33
+
34
+
35
+ class Value(Outcome[T]):
36
+ def __init__(self, value: T):
37
+ self.value = value
38
+
39
+ def get(self) -> T:
40
+ return self.value
41
+
42
+ def __repr__(self) -> str:
43
+ return f"Value({self.value!r})"
44
+
45
+
46
+ class Error(Outcome[T]):
47
+ def __init__(self, error: BaseException) -> None:
48
+ self.error = error
49
+
50
+ def get(self) -> T:
51
+ raise self.error
52
+
53
+ def __repr__(self) -> str:
54
+ return f"Error({self.error!r})"
cocotb/_profiling.py ADDED
@@ -0,0 +1,46 @@
1
+ # Copyright cocotb contributors
2
+ # Licensed under the Revised BSD License, see LICENSE for details.
3
+ # SPDX-License-Identifier: BSD-3-Clause
4
+
5
+
6
+ # Debug mode controlled by environment variables
7
+ import cProfile
8
+ import os
9
+ import pstats
10
+
11
+ from cocotb._py_compat import AbstractContextManager, nullcontext
12
+
13
+ profiling_context: AbstractContextManager[None, None]
14
+
15
+
16
+ if "COCOTB_ENABLE_PROFILING" in os.environ:
17
+ _profile: cProfile.Profile
18
+
19
+ def initialize() -> None:
20
+ global _profile
21
+ _profile = cProfile.Profile()
22
+
23
+ def finalize() -> None:
24
+ ps = pstats.Stats(_profile).sort_stats("cumulative")
25
+ ps.dump_stats("cocotb.pstat")
26
+
27
+ class _profiling_context(AbstractContextManager[None, None]):
28
+ """Context manager that profiles its contents"""
29
+
30
+ def __enter__(self) -> None:
31
+ _profile.enable()
32
+
33
+ def __exit__(self, *excinfo: object) -> None:
34
+ _profile.disable()
35
+
36
+ profiling_context = _profiling_context()
37
+
38
+ else:
39
+
40
+ def initialize() -> None:
41
+ pass
42
+
43
+ def finalize() -> None:
44
+ pass
45
+
46
+ profiling_context = nullcontext()
cocotb/_py_compat.py CHANGED
@@ -1,38 +1,44 @@
1
- # Copyright (c) cocotb contributors
2
- # All rights reserved.
3
- #
4
- # Redistribution and use in source and binary forms, with or without
5
- # modification, are permitted provided that the following conditions are met:
6
- # * Redistributions of source code must retain the above copyright
7
- # notice, this list of conditions and the following disclaimer.
8
- # * Redistributions in binary form must reproduce the above copyright
9
- # notice, this list of conditions and the following disclaimer in the
10
- # documentation and/or other materials provided with the distribution.
11
- # * Neither the name of the copyright holder nor the
12
- # names of its contributors may be used to endorse or promote products
13
- # derived from this software without specific prior written permission.
14
- #
15
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16
- # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
- # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
- # DISCLAIMED. IN NO EVENT SHALL POTENTIAL VENTURES LTD BE LIABLE FOR ANY
19
- # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
- # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
- # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
- # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
- # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
- # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1
+ # Copyright cocotb contributors
2
+ # Licensed under the Revised BSD License, see LICENSE for details.
3
+ # SPDX-License-Identifier: BSD-3-Clause
25
4
  """
26
5
  Backports and compatibility shims for newer python features.
27
6
 
28
7
  These are for internal use - users should use a third party library like `six`
29
8
  if they want to use these shims in their own code
30
9
  """
10
+
31
11
  import sys
12
+ from abc import ABC
13
+ from contextlib import AbstractContextManager
14
+ from typing import TypeVar, Union, overload
15
+
16
+ __all__ = (
17
+ "AbstractContextManager",
18
+ "Final",
19
+ "Literal",
20
+ "ParamSpec",
21
+ "Protocol",
22
+ "Self",
23
+ "TypeAlias",
24
+ "cached_property",
25
+ "insertion_ordered_dict",
26
+ "nullcontext",
27
+ )
28
+
29
+ T = TypeVar("T")
30
+
31
+ if sys.version_info < (3, 9):
32
+ from typing import Generic
33
+
34
+ T_co = TypeVar("T_co", covariant=True)
35
+ ExitT_co = TypeVar("ExitT_co", covariant=True)
36
+
37
+ class AbstractContextManager(AbstractContextManager, Generic[T_co, ExitT_co]): ...
32
38
 
33
39
 
34
40
  # backport of Python 3.7's contextlib.nullcontext
35
- class nullcontext:
41
+ class nullcontext(AbstractContextManager[T, None]):
36
42
  """Context manager that does no additional processing.
37
43
  Used as a stand-in for a normal context manager, when a particular
38
44
  block of code is only sometimes used with a normal context manager:
@@ -42,22 +48,87 @@ class nullcontext:
42
48
  # Perform operation, using optional_cm if condition is True
43
49
  """
44
50
 
45
- def __init__(self, enter_result=None):
51
+ enter_result: T
52
+
53
+ @overload
54
+ def __init__(self: "nullcontext[None]", enter_result: None = None) -> None: ...
55
+
56
+ @overload
57
+ def __init__(self: "nullcontext[T]", enter_result: T) -> None: ...
58
+
59
+ def __init__(
60
+ self: "nullcontext[Union[T, None]]", enter_result: Union[T, None] = None
61
+ ) -> None:
46
62
  self.enter_result = enter_result
47
63
 
48
- def __enter__(self):
64
+ def __enter__(self) -> T:
49
65
  return self.enter_result
50
66
 
51
- def __exit__(self, *excinfo):
67
+ def __exit__(self, *excinfo: object) -> None:
52
68
  pass
53
69
 
54
70
 
55
71
  # On python 3.7 onwards, `dict` is guaranteed to preserve insertion order.
56
72
  # Since `OrderedDict` is a little slower that `dict`, we prefer the latter
57
73
  # when possible.
58
- if sys.version_info[:2] >= (3, 7):
74
+ if sys.version_info[:2] >= (3, 7): # noqa: UP036 | bug in ruff
59
75
  insertion_ordered_dict = dict
60
76
  else:
61
77
  import collections
62
78
 
63
79
  insertion_ordered_dict = collections.OrderedDict
80
+
81
+
82
+ # simple, but less than optimal backport of Python 3.8's cached_property
83
+ if sys.version_info >= (3, 8):
84
+ from functools import cached_property
85
+ else:
86
+ from functools import update_wrapper
87
+
88
+ class cached_property:
89
+ def __init__(self, method):
90
+ self._method = method
91
+ update_wrapper(self, method)
92
+
93
+ def __get__(self, instance, owner=None):
94
+ if instance is None:
95
+ return self
96
+ res = self._method(instance)
97
+ instance.__dict__[self._method.__name__] = res
98
+ return res
99
+
100
+
101
+ class FakeGetItemType:
102
+ def __class_getitem__(self, a: object) -> str:
103
+ return ""
104
+
105
+
106
+ if sys.version_info >= (3, 8):
107
+ from typing import Final, Literal, Protocol
108
+ else:
109
+ Final = FakeGetItemType
110
+ Literal = FakeGetItemType
111
+ Protocol = ABC
112
+
113
+
114
+ if sys.version_info >= (3, 10):
115
+ from typing import ParamSpec, TypeAlias
116
+ else:
117
+ TypeAlias = ""
118
+
119
+ class FakeParamSpecType:
120
+ def __init__(self, name: str) -> None: ...
121
+
122
+ def kwargs(self) -> str:
123
+ return ""
124
+
125
+ def args(self) -> str:
126
+ return ""
127
+
128
+ ParamSpec = FakeParamSpecType
129
+
130
+
131
+ if sys.version_info >= (3, 11):
132
+ from typing import Self
133
+ else:
134
+ Self = ""