cocotb 1.9.2__cp36-cp36m-win32.whl → 2.0.0rc2__cp36-cp36m-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.
- cocotb/_ANSI.py +65 -0
- cocotb/__init__.py +81 -327
- cocotb/_base_triggers.py +515 -0
- cocotb/_bridge.py +186 -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 +385 -0
- cocotb/_init.py +301 -0
- cocotb/_outcomes.py +54 -0
- cocotb/_profiling.py +46 -0
- cocotb/_py_compat.py +114 -29
- cocotb/_scheduler.py +448 -0
- cocotb/_test.py +248 -0
- cocotb/_test_factory.py +312 -0
- cocotb/_test_functions.py +42 -0
- cocotb/_typing.py +7 -0
- cocotb/_utils.py +274 -0
- cocotb/_version.py +3 -7
- cocotb/_xunit_reporter.py +66 -0
- cocotb/clock.py +353 -108
- cocotb/debug.py +24 -0
- cocotb/handle.py +1370 -793
- 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/logging.py +424 -0
- cocotb/queue.py +103 -57
- cocotb/regression.py +680 -717
- cocotb/result.py +17 -188
- cocotb/share/def/modelsim.def +1 -0
- cocotb/share/include/cocotb_utils.h +9 -32
- cocotb/share/include/embed.h +7 -30
- cocotb/share/include/gpi.h +331 -137
- cocotb/share/include/gpi_logging.h +221 -142
- cocotb/share/include/py_gpi_logging.h +8 -5
- cocotb/share/include/vpi_user_ext.h +4 -26
- cocotb/share/lib/verilator/verilator.cpp +80 -67
- cocotb/simtime.py +230 -0
- cocotb/simulator.cp36-win32.exp +0 -0
- cocotb/simulator.cp36-win32.lib +0 -0
- cocotb/simulator.cp36-win32.pyd +0 -0
- cocotb/task.py +478 -213
- cocotb/triggers.py +55 -1092
- cocotb/types/__init__.py +28 -47
- cocotb/types/_abstract_array.py +151 -0
- cocotb/types/_array.py +295 -0
- cocotb/types/_indexing.py +17 -0
- cocotb/types/_logic.py +333 -0
- cocotb/types/_logic_array.py +868 -0
- cocotb/types/{range.py → _range.py} +47 -48
- cocotb/types/_resolve.py +76 -0
- cocotb/utils.py +58 -646
- {cocotb-1.9.2.dist-info → cocotb-2.0.0rc2.dist-info}/LICENSE +1 -0
- cocotb-2.0.0rc2.dist-info/METADATA +48 -0
- cocotb-2.0.0rc2.dist-info/RECORD +134 -0
- cocotb-2.0.0rc2.dist-info/entry_points.txt +3 -0
- {cocotb-1.9.2.dist-info → cocotb-2.0.0rc2.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 +77 -55
- {cocotb/share → cocotb_tools}/makefiles/Makefile.sim +16 -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_tools/runner.py +1868 -0
- cocotb/_sim_versions.py → cocotb_tools/sim_versions.py +16 -21
- pygpi/entry.py +34 -18
- cocotb/ANSI.py +0 -92
- cocotb/binary.py +0 -858
- cocotb/config.py +0 -289
- cocotb/decorators.py +0 -332
- cocotb/log.py +0 -303
- cocotb/memdebug.py +0 -35
- cocotb/outcomes.py +0 -56
- cocotb/runner.py +0 -1400
- 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 -113
- cocotb-1.9.2.dist-info/entry_points.txt +0 -3
- {cocotb-1.9.2.dist-info → cocotb-2.0.0rc2.dist-info}/WHEEL +0 -0
- {cocotb/_vendor → cocotb_tools}/__init__.py +0 -0
- {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
|
|
2
|
-
#
|
|
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
|
-
|
|
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
|