cocotb 1.9.2__cp37-cp37m-win_amd64.whl → 2.0.0rc2__cp37-cp37m-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.

Files changed (157) hide show
  1. cocotb/_ANSI.py +65 -0
  2. cocotb/__init__.py +81 -327
  3. cocotb/_base_triggers.py +515 -0
  4. cocotb/_bridge.py +186 -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 +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 +114 -29
  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 +3 -7
  21. cocotb/_xunit_reporter.py +66 -0
  22. cocotb/clock.py +353 -108
  23. cocotb/debug.py +24 -0
  24. cocotb/handle.py +1370 -793
  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/cocotbvpi_aldec.dll +0 -0
  41. cocotb/libs/cocotbvpi_aldec.exp +0 -0
  42. cocotb/libs/cocotbvpi_aldec.lib +0 -0
  43. cocotb/libs/cocotbvpi_ghdl.dll +0 -0
  44. cocotb/libs/cocotbvpi_ghdl.exp +0 -0
  45. cocotb/libs/cocotbvpi_ghdl.lib +0 -0
  46. cocotb/libs/cocotbvpi_icarus.exp +0 -0
  47. cocotb/libs/cocotbvpi_icarus.lib +0 -0
  48. cocotb/libs/cocotbvpi_icarus.vpl +0 -0
  49. cocotb/libs/cocotbvpi_modelsim.dll +0 -0
  50. cocotb/libs/cocotbvpi_modelsim.exp +0 -0
  51. cocotb/libs/cocotbvpi_modelsim.lib +0 -0
  52. cocotb/libs/embed.dll +0 -0
  53. cocotb/libs/embed.exp +0 -0
  54. cocotb/libs/embed.lib +0 -0
  55. cocotb/libs/gpi.dll +0 -0
  56. cocotb/libs/gpi.exp +0 -0
  57. cocotb/libs/gpi.lib +0 -0
  58. cocotb/libs/gpilog.dll +0 -0
  59. cocotb/libs/gpilog.exp +0 -0
  60. cocotb/libs/gpilog.lib +0 -0
  61. cocotb/libs/pygpilog.dll +0 -0
  62. cocotb/libs/pygpilog.exp +0 -0
  63. cocotb/libs/pygpilog.lib +0 -0
  64. cocotb/logging.py +424 -0
  65. cocotb/queue.py +103 -57
  66. cocotb/regression.py +680 -717
  67. cocotb/result.py +17 -188
  68. cocotb/share/def/aldec.exp +0 -0
  69. cocotb/share/def/aldec.lib +0 -0
  70. cocotb/share/def/ghdl.exp +0 -0
  71. cocotb/share/def/ghdl.lib +0 -0
  72. cocotb/share/def/icarus.exp +0 -0
  73. cocotb/share/def/icarus.lib +0 -0
  74. cocotb/share/def/modelsim.def +1 -0
  75. cocotb/share/def/modelsim.exp +0 -0
  76. cocotb/share/def/modelsim.lib +0 -0
  77. cocotb/share/include/cocotb_utils.h +9 -32
  78. cocotb/share/include/embed.h +7 -30
  79. cocotb/share/include/gpi.h +331 -137
  80. cocotb/share/include/gpi_logging.h +221 -142
  81. cocotb/share/include/py_gpi_logging.h +8 -5
  82. cocotb/share/include/vpi_user_ext.h +4 -26
  83. cocotb/share/lib/verilator/verilator.cpp +80 -67
  84. cocotb/simtime.py +230 -0
  85. cocotb/simulator.cp37-win_amd64.exp +0 -0
  86. cocotb/simulator.cp37-win_amd64.lib +0 -0
  87. cocotb/simulator.cp37-win_amd64.pyd +0 -0
  88. cocotb/task.py +478 -213
  89. cocotb/triggers.py +55 -1092
  90. cocotb/types/__init__.py +28 -47
  91. cocotb/types/_abstract_array.py +151 -0
  92. cocotb/types/_array.py +295 -0
  93. cocotb/types/_indexing.py +17 -0
  94. cocotb/types/_logic.py +333 -0
  95. cocotb/types/_logic_array.py +868 -0
  96. cocotb/types/{range.py → _range.py} +47 -48
  97. cocotb/types/_resolve.py +76 -0
  98. cocotb/utils.py +58 -646
  99. {cocotb-1.9.2.dist-info → cocotb-2.0.0rc2.dist-info}/LICENSE +1 -0
  100. cocotb-2.0.0rc2.dist-info/METADATA +46 -0
  101. cocotb-2.0.0rc2.dist-info/RECORD +142 -0
  102. cocotb-2.0.0rc2.dist-info/entry_points.txt +2 -0
  103. {cocotb-1.9.2.dist-info → cocotb-2.0.0rc2.dist-info}/top_level.txt +1 -0
  104. cocotb_tools/_coverage.py +33 -0
  105. cocotb_tools/_vendor/__init__.py +3 -0
  106. cocotb_tools/check_results.py +65 -0
  107. cocotb_tools/combine_results.py +152 -0
  108. cocotb_tools/config.py +241 -0
  109. {cocotb → cocotb_tools}/ipython_support.py +29 -22
  110. cocotb_tools/makefiles/Makefile.deprecations +27 -0
  111. {cocotb/share → cocotb_tools}/makefiles/Makefile.inc +77 -55
  112. {cocotb/share → cocotb_tools}/makefiles/Makefile.sim +16 -33
  113. {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.activehdl +9 -16
  114. cocotb_tools/makefiles/simulators/Makefile.cvc +61 -0
  115. cocotb_tools/makefiles/simulators/Makefile.dsim +39 -0
  116. {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.ghdl +13 -42
  117. cocotb_tools/makefiles/simulators/Makefile.icarus +80 -0
  118. cocotb_tools/makefiles/simulators/Makefile.ius +93 -0
  119. cocotb_tools/makefiles/simulators/Makefile.modelsim +9 -0
  120. cocotb_tools/makefiles/simulators/Makefile.nvc +60 -0
  121. cocotb_tools/makefiles/simulators/Makefile.questa +29 -0
  122. cocotb/share/makefiles/simulators/Makefile.questa → cocotb_tools/makefiles/simulators/Makefile.questa-compat +26 -54
  123. cocotb_tools/makefiles/simulators/Makefile.questa-qisqrun +149 -0
  124. {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.riviera +17 -56
  125. cocotb_tools/makefiles/simulators/Makefile.vcs +65 -0
  126. {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.verilator +15 -22
  127. {cocotb/share → cocotb_tools}/makefiles/simulators/Makefile.xcelium +20 -52
  128. cocotb_tools/runner.py +1868 -0
  129. cocotb/_sim_versions.py → cocotb_tools/sim_versions.py +16 -21
  130. pygpi/entry.py +34 -18
  131. cocotb/ANSI.py +0 -92
  132. cocotb/binary.py +0 -858
  133. cocotb/config.py +0 -289
  134. cocotb/decorators.py +0 -332
  135. cocotb/log.py +0 -303
  136. cocotb/memdebug.py +0 -35
  137. cocotb/outcomes.py +0 -56
  138. cocotb/runner.py +0 -1400
  139. cocotb/scheduler.py +0 -1099
  140. cocotb/share/makefiles/Makefile.deprecations +0 -12
  141. cocotb/share/makefiles/simulators/Makefile.cvc +0 -94
  142. cocotb/share/makefiles/simulators/Makefile.icarus +0 -111
  143. cocotb/share/makefiles/simulators/Makefile.ius +0 -125
  144. cocotb/share/makefiles/simulators/Makefile.modelsim +0 -32
  145. cocotb/share/makefiles/simulators/Makefile.nvc +0 -64
  146. cocotb/share/makefiles/simulators/Makefile.vcs +0 -98
  147. cocotb/types/array.py +0 -309
  148. cocotb/types/logic.py +0 -292
  149. cocotb/types/logic_array.py +0 -298
  150. cocotb/wavedrom.py +0 -199
  151. cocotb/xunit_reporter.py +0 -80
  152. cocotb-1.9.2.dist-info/METADATA +0 -168
  153. cocotb-1.9.2.dist-info/RECORD +0 -121
  154. cocotb-1.9.2.dist-info/entry_points.txt +0 -2
  155. {cocotb-1.9.2.dist-info → cocotb-2.0.0rc2.dist-info}/WHEEL +0 -0
  156. {cocotb/_vendor → cocotb_tools}/__init__.py +0 -0
  157. {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,45 @@
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
+ "StrEnum",
24
+ "TypeAlias",
25
+ "cached_property",
26
+ "insertion_ordered_dict",
27
+ "nullcontext",
28
+ )
29
+
30
+ T = TypeVar("T")
31
+
32
+ if sys.version_info < (3, 9):
33
+ from typing import Generic
34
+
35
+ T_co = TypeVar("T_co", covariant=True)
36
+ ExitT_co = TypeVar("ExitT_co", covariant=True)
37
+
38
+ class AbstractContextManager(AbstractContextManager, Generic[T_co, ExitT_co]): ...
32
39
 
33
40
 
34
41
  # backport of Python 3.7's contextlib.nullcontext
35
- class nullcontext:
42
+ class nullcontext(AbstractContextManager[T, None]):
36
43
  """Context manager that does no additional processing.
37
44
  Used as a stand-in for a normal context manager, when a particular
38
45
  block of code is only sometimes used with a normal context manager:
@@ -42,22 +49,100 @@ class nullcontext:
42
49
  # Perform operation, using optional_cm if condition is True
43
50
  """
44
51
 
45
- def __init__(self, enter_result=None):
52
+ enter_result: T
53
+
54
+ @overload
55
+ def __init__(self: "nullcontext[None]", enter_result: None = None) -> None: ...
56
+
57
+ @overload
58
+ def __init__(self: "nullcontext[T]", enter_result: T) -> None: ...
59
+
60
+ def __init__(
61
+ self: "nullcontext[Union[T, None]]", enter_result: Union[T, None] = None
62
+ ) -> None:
46
63
  self.enter_result = enter_result
47
64
 
48
- def __enter__(self):
65
+ def __enter__(self) -> T:
49
66
  return self.enter_result
50
67
 
51
- def __exit__(self, *excinfo):
68
+ def __exit__(self, *excinfo: object) -> None:
52
69
  pass
53
70
 
54
71
 
55
72
  # On python 3.7 onwards, `dict` is guaranteed to preserve insertion order.
56
73
  # Since `OrderedDict` is a little slower that `dict`, we prefer the latter
57
74
  # when possible.
58
- if sys.version_info[:2] >= (3, 7):
75
+ if sys.version_info[:2] >= (3, 7): # noqa: UP036 | bug in ruff
59
76
  insertion_ordered_dict = dict
60
77
  else:
61
78
  import collections
62
79
 
63
80
  insertion_ordered_dict = collections.OrderedDict
81
+
82
+
83
+ # simple, but less than optimal backport of Python 3.8's cached_property
84
+ if sys.version_info >= (3, 8):
85
+ from functools import cached_property
86
+ else:
87
+ from functools import update_wrapper
88
+
89
+ class cached_property:
90
+ def __init__(self, method):
91
+ self._method = method
92
+ update_wrapper(self, method)
93
+
94
+ def __get__(self, instance, owner=None):
95
+ if instance is None:
96
+ return self
97
+ res = self._method(instance)
98
+ instance.__dict__[self._method.__name__] = res
99
+ return res
100
+
101
+
102
+ if sys.version_info >= (3, 8):
103
+ from typing import Final, Literal, Protocol
104
+ else:
105
+ from typing import Any
106
+
107
+ class FakeGetItemType:
108
+ def __class_getitem__(self, a: object) -> Any:
109
+ return Any
110
+
111
+ Final = FakeGetItemType
112
+ Literal = FakeGetItemType
113
+ Protocol = ABC
114
+
115
+
116
+ if sys.version_info >= (3, 10):
117
+ from typing import ParamSpec, TypeAlias
118
+ else:
119
+ from typing import Any
120
+
121
+ TypeAlias = Any
122
+
123
+ class FakeParamSpecType:
124
+ def __init__(self, name: str) -> None: ...
125
+
126
+ def kwargs(self) -> Any:
127
+ return Any
128
+
129
+ def args(self) -> Any:
130
+ return Any
131
+
132
+ ParamSpec = FakeParamSpecType
133
+
134
+
135
+ if sys.version_info >= (3, 11):
136
+ from typing import Self
137
+ else:
138
+ Self = ""
139
+
140
+
141
+ if sys.version_info >= (3, 11):
142
+ from enum import StrEnum
143
+ else:
144
+ from enum import Enum
145
+
146
+ class StrEnum(str, Enum):
147
+ def __str__(self) -> str:
148
+ return self.value