cocotb 2.0.0rc2__cp311-cp311-macosx_11_0_arm64.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 +125 -0
- cocotb/_base_triggers.py +515 -0
- cocotb/_bridge.py +186 -0
- cocotb/_decorators.py +515 -0
- cocotb/_deprecation.py +36 -0
- 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 +148 -0
- 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 +4 -0
- cocotb/_xunit_reporter.py +66 -0
- cocotb/clock.py +419 -0
- cocotb/debug.py +24 -0
- cocotb/handle.py +1752 -0
- cocotb/libs/libcocotb.so +0 -0
- cocotb/libs/libcocotbfli_modelsim.so +0 -0
- cocotb/libs/libcocotbutils.so +0 -0
- cocotb/libs/libcocotbvhpi_aldec.so +0 -0
- cocotb/libs/libcocotbvhpi_ius.so +0 -0
- cocotb/libs/libcocotbvhpi_modelsim.so +0 -0
- cocotb/libs/libcocotbvhpi_nvc.so +0 -0
- cocotb/libs/libcocotbvpi_aldec.so +0 -0
- cocotb/libs/libcocotbvpi_dsim.so +0 -0
- cocotb/libs/libcocotbvpi_ghdl.so +0 -0
- cocotb/libs/libcocotbvpi_icarus.vpl +0 -0
- cocotb/libs/libcocotbvpi_ius.so +0 -0
- cocotb/libs/libcocotbvpi_modelsim.so +0 -0
- cocotb/libs/libcocotbvpi_vcs.so +0 -0
- cocotb/libs/libcocotbvpi_verilator.so +0 -0
- cocotb/libs/libembed.so +0 -0
- cocotb/libs/libgpi.so +0 -0
- cocotb/libs/libgpilog.so +0 -0
- cocotb/libs/libpygpilog.so +0 -0
- cocotb/logging.py +424 -0
- cocotb/py.typed +0 -0
- cocotb/queue.py +225 -0
- cocotb/regression.py +896 -0
- cocotb/result.py +38 -0
- cocotb/share/def/.gitignore +2 -0
- cocotb/share/def/README.md +4 -0
- cocotb/share/def/aldec.def +61 -0
- cocotb/share/def/ghdl.def +43 -0
- cocotb/share/def/icarus.def +43 -0
- cocotb/share/def/modelsim.def +138 -0
- cocotb/share/include/cocotb_utils.h +70 -0
- cocotb/share/include/embed.h +33 -0
- cocotb/share/include/exports.h +20 -0
- cocotb/share/include/gpi.h +459 -0
- cocotb/share/include/gpi_logging.h +291 -0
- cocotb/share/include/py_gpi_logging.h +33 -0
- cocotb/share/include/vhpi_user_ext.h +26 -0
- cocotb/share/include/vpi_user_ext.h +33 -0
- cocotb/share/lib/verilator/verilator.cpp +209 -0
- cocotb/simtime.py +230 -0
- cocotb/simulator.cpython-311-darwin.so +0 -0
- cocotb/simulator.pyi +107 -0
- cocotb/task.py +590 -0
- cocotb/triggers.py +67 -0
- cocotb/types/__init__.py +31 -0
- 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 +197 -0
- cocotb/types/_resolve.py +76 -0
- cocotb/utils.py +110 -0
- cocotb-2.0.0rc2.dist-info/METADATA +60 -0
- cocotb-2.0.0rc2.dist-info/RECORD +115 -0
- cocotb-2.0.0rc2.dist-info/WHEEL +5 -0
- cocotb-2.0.0rc2.dist-info/entry_points.txt +2 -0
- cocotb-2.0.0rc2.dist-info/licenses/LICENSE +29 -0
- cocotb-2.0.0rc2.dist-info/top_level.txt +23 -0
- cocotb_tools/__init__.py +0 -0
- cocotb_tools/_coverage.py +33 -0
- cocotb_tools/_vendor/__init__.py +3 -0
- cocotb_tools/_vendor/distutils_version.py +346 -0
- cocotb_tools/check_results.py +65 -0
- cocotb_tools/combine_results.py +152 -0
- cocotb_tools/config.py +241 -0
- cocotb_tools/ipython_support.py +99 -0
- cocotb_tools/makefiles/Makefile.deprecations +27 -0
- cocotb_tools/makefiles/Makefile.inc +198 -0
- cocotb_tools/makefiles/Makefile.sim +96 -0
- cocotb_tools/makefiles/simulators/Makefile.activehdl +72 -0
- cocotb_tools/makefiles/simulators/Makefile.cvc +61 -0
- cocotb_tools/makefiles/simulators/Makefile.dsim +39 -0
- cocotb_tools/makefiles/simulators/Makefile.ghdl +84 -0
- 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_tools/makefiles/simulators/Makefile.questa-compat +143 -0
- cocotb_tools/makefiles/simulators/Makefile.questa-qisqrun +149 -0
- cocotb_tools/makefiles/simulators/Makefile.riviera +144 -0
- cocotb_tools/makefiles/simulators/Makefile.vcs +65 -0
- cocotb_tools/makefiles/simulators/Makefile.verilator +79 -0
- cocotb_tools/makefiles/simulators/Makefile.xcelium +104 -0
- cocotb_tools/py.typed +0 -0
- cocotb_tools/runner.py +1868 -0
- cocotb_tools/sim_versions.py +140 -0
- pygpi/__init__.py +0 -0
- pygpi/entry.py +42 -0
- pygpi/py.typed +0 -0
cocotb/result.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Copyright cocotb contributors
|
|
2
|
+
# Licensed under the Revised BSD License, see LICENSE for details.
|
|
3
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
+
import warnings
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def __getattr__(name: str) -> object:
|
|
8
|
+
if name == "TestSuccess":
|
|
9
|
+
warnings.warn(
|
|
10
|
+
"`raise TestSuccess` is deprecated. Use `cocotb.pass_test()` instead.",
|
|
11
|
+
DeprecationWarning,
|
|
12
|
+
stacklevel=2,
|
|
13
|
+
)
|
|
14
|
+
from cocotb._test_functions import TestSuccess # noqa: PLC0415
|
|
15
|
+
|
|
16
|
+
return TestSuccess
|
|
17
|
+
|
|
18
|
+
elif name == "SimFailure":
|
|
19
|
+
warnings.warn(
|
|
20
|
+
"SimFailure was moved to `cocotb.regression`.",
|
|
21
|
+
DeprecationWarning,
|
|
22
|
+
stacklevel=2,
|
|
23
|
+
)
|
|
24
|
+
from cocotb.regression import SimFailure # noqa: PLC0415
|
|
25
|
+
|
|
26
|
+
return SimFailure
|
|
27
|
+
|
|
28
|
+
elif name == "SimTimeoutError":
|
|
29
|
+
warnings.warn(
|
|
30
|
+
"SimTimeoutError was moved from `cocotb.result` to `cocotb.triggers`.",
|
|
31
|
+
DeprecationWarning,
|
|
32
|
+
stacklevel=2,
|
|
33
|
+
)
|
|
34
|
+
from cocotb.triggers import SimTimeoutError # noqa: PLC0415
|
|
35
|
+
|
|
36
|
+
return SimTimeoutError
|
|
37
|
+
|
|
38
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
This directory contains module-definition files (`.def`).
|
|
2
|
+
On Windows these are used to generate import libraries (`.a`, but not regular static libraries), which means we can compile our libraries without having the simulator binaries available.
|
|
3
|
+
They are not needed on other platforms.
|
|
4
|
+
More details on `.def` files can be found at http://www.mingw.org/wiki/msvc_and_mingw_dlls
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
LIBRARY "aldecpli.dll"
|
|
2
|
+
EXPORTS
|
|
3
|
+
vpi_chk_error
|
|
4
|
+
vpi_compare_objects
|
|
5
|
+
vpi_control
|
|
6
|
+
vpi_flush
|
|
7
|
+
vpi_fopen
|
|
8
|
+
vpi_free_object
|
|
9
|
+
vpi_get
|
|
10
|
+
vpi_get_delays
|
|
11
|
+
vpi_get_file
|
|
12
|
+
vpi_get_str
|
|
13
|
+
vpi_get_systf_info
|
|
14
|
+
vpi_get_time
|
|
15
|
+
vpi_get_userdata
|
|
16
|
+
vpi_get_value
|
|
17
|
+
vpi_get_vlog_info
|
|
18
|
+
vpi_handle
|
|
19
|
+
vpi_handle_by_index
|
|
20
|
+
vpi_handle_by_name
|
|
21
|
+
vpi_iterate
|
|
22
|
+
vpi_mcd_close
|
|
23
|
+
vpi_mcd_flush
|
|
24
|
+
vpi_mcd_name
|
|
25
|
+
vpi_mcd_open
|
|
26
|
+
vpi_mcd_printf
|
|
27
|
+
vpi_mcd_vprintf
|
|
28
|
+
vpi_printf
|
|
29
|
+
vpi_put_delays
|
|
30
|
+
vpi_put_userdata
|
|
31
|
+
vpi_put_value
|
|
32
|
+
vpi_register_cb
|
|
33
|
+
vpi_register_systf
|
|
34
|
+
vpi_remove_cb
|
|
35
|
+
vpi_scan
|
|
36
|
+
vpi_sim_control
|
|
37
|
+
vpi_sim_vcontrol
|
|
38
|
+
vpi_vprintf
|
|
39
|
+
vpip_count_drivers
|
|
40
|
+
vpip_format_strength
|
|
41
|
+
vpip_make_systf_system_defined
|
|
42
|
+
vpip_mcd_rawwrite
|
|
43
|
+
vpip_set_return_value
|
|
44
|
+
vhpi_check_error
|
|
45
|
+
vhpi_control
|
|
46
|
+
vhpi_disable_cb
|
|
47
|
+
vhpi_enable_cb
|
|
48
|
+
vhpi_get
|
|
49
|
+
vhpi_get_phys
|
|
50
|
+
vhpi_get_str
|
|
51
|
+
vhpi_get_time
|
|
52
|
+
vhpi_get_value
|
|
53
|
+
vhpi_handle
|
|
54
|
+
vhpi_handle_by_index
|
|
55
|
+
vhpi_handle_by_name
|
|
56
|
+
vhpi_iterator
|
|
57
|
+
vhpi_put_value
|
|
58
|
+
vhpi_register_cb
|
|
59
|
+
vhpi_release_handle
|
|
60
|
+
vhpi_remove_cb
|
|
61
|
+
vhpi_scan
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
LIBRARY "libghdlvpi.dll"
|
|
2
|
+
EXPORTS
|
|
3
|
+
vpi_compare_objects
|
|
4
|
+
vpi_control
|
|
5
|
+
vpi_flush
|
|
6
|
+
vpi_fopen
|
|
7
|
+
vpi_free_object
|
|
8
|
+
vpi_get
|
|
9
|
+
vpi_get_delays
|
|
10
|
+
vpi_get_file
|
|
11
|
+
vpi_get_str
|
|
12
|
+
vpi_get_systf_info
|
|
13
|
+
vpi_get_time
|
|
14
|
+
vpi_get_userdata
|
|
15
|
+
vpi_get_value
|
|
16
|
+
vpi_get_vlog_info
|
|
17
|
+
vpi_handle
|
|
18
|
+
vpi_handle_by_index
|
|
19
|
+
vpi_handle_by_name
|
|
20
|
+
vpi_iterate
|
|
21
|
+
vpi_mcd_close
|
|
22
|
+
vpi_mcd_flush
|
|
23
|
+
vpi_mcd_name
|
|
24
|
+
vpi_mcd_printf
|
|
25
|
+
vpi_mcd_vprintf
|
|
26
|
+
vpi_printf
|
|
27
|
+
vpi_put_delays
|
|
28
|
+
vpi_put_userdata
|
|
29
|
+
vpi_put_value
|
|
30
|
+
vpi_register_cb
|
|
31
|
+
vpi_register_systf
|
|
32
|
+
vpi_remove_cb
|
|
33
|
+
vpi_scan
|
|
34
|
+
vpi_sim_control
|
|
35
|
+
vpi_sim_vcontrol
|
|
36
|
+
vpi_mcd_open
|
|
37
|
+
vpi_vprintf
|
|
38
|
+
vpip_count_drivers
|
|
39
|
+
vpip_format_strength
|
|
40
|
+
vpip_make_systf_system_defined
|
|
41
|
+
vpip_mcd_rawwrite
|
|
42
|
+
vpip_set_return_value
|
|
43
|
+
vpi_chk_error
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
LIBRARY "vvp.exe"
|
|
2
|
+
EXPORTS
|
|
3
|
+
vpi_compare_objects
|
|
4
|
+
vpi_control
|
|
5
|
+
vpi_flush
|
|
6
|
+
vpi_fopen
|
|
7
|
+
vpi_free_object
|
|
8
|
+
vpi_get
|
|
9
|
+
vpi_get_delays
|
|
10
|
+
vpi_get_file
|
|
11
|
+
vpi_get_str
|
|
12
|
+
vpi_get_systf_info
|
|
13
|
+
vpi_get_time
|
|
14
|
+
vpi_get_userdata
|
|
15
|
+
vpi_get_value
|
|
16
|
+
vpi_get_vlog_info
|
|
17
|
+
vpi_handle
|
|
18
|
+
vpi_handle_by_index
|
|
19
|
+
vpi_handle_by_name
|
|
20
|
+
vpi_iterate
|
|
21
|
+
vpi_mcd_close
|
|
22
|
+
vpi_mcd_flush
|
|
23
|
+
vpi_mcd_name
|
|
24
|
+
vpi_mcd_printf
|
|
25
|
+
vpi_mcd_vprintf
|
|
26
|
+
vpi_printf
|
|
27
|
+
vpi_put_delays
|
|
28
|
+
vpi_put_userdata
|
|
29
|
+
vpi_put_value
|
|
30
|
+
vpi_register_cb
|
|
31
|
+
vpi_register_systf
|
|
32
|
+
vpi_remove_cb
|
|
33
|
+
vpi_scan
|
|
34
|
+
vpi_sim_control
|
|
35
|
+
vpi_sim_vcontrol
|
|
36
|
+
vpi_mcd_open
|
|
37
|
+
vpi_vprintf
|
|
38
|
+
vpip_count_drivers
|
|
39
|
+
vpip_format_strength
|
|
40
|
+
vpip_make_systf_system_defined
|
|
41
|
+
vpip_mcd_rawwrite
|
|
42
|
+
vpip_set_return_value
|
|
43
|
+
vpi_chk_error
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
LIBRARY "mtipli.dll"
|
|
2
|
+
EXPORTS
|
|
3
|
+
vpi_chk_error
|
|
4
|
+
vpi_compare_objects
|
|
5
|
+
vpi_control
|
|
6
|
+
vpi_flush
|
|
7
|
+
vpi_fopen
|
|
8
|
+
vpi_free_object
|
|
9
|
+
vpi_get
|
|
10
|
+
vpi_get_delays
|
|
11
|
+
vpi_get_file
|
|
12
|
+
vpi_get_str
|
|
13
|
+
vpi_get_systf_info
|
|
14
|
+
vpi_get_time
|
|
15
|
+
vpi_get_userdata
|
|
16
|
+
vpi_get_value
|
|
17
|
+
vpi_get_vlog_info
|
|
18
|
+
vpi_handle
|
|
19
|
+
vpi_handle_by_index
|
|
20
|
+
vpi_handle_by_name
|
|
21
|
+
vpi_iterate
|
|
22
|
+
vpi_mcd_close
|
|
23
|
+
vpi_mcd_flush
|
|
24
|
+
vpi_mcd_name
|
|
25
|
+
vpi_mcd_open
|
|
26
|
+
vpi_mcd_printf
|
|
27
|
+
vpi_mcd_vprintf
|
|
28
|
+
vpi_printf
|
|
29
|
+
vpi_put_delays
|
|
30
|
+
vpi_put_userdata
|
|
31
|
+
vpi_put_value
|
|
32
|
+
vpi_register_cb
|
|
33
|
+
vpi_register_systf
|
|
34
|
+
vpi_remove_cb
|
|
35
|
+
vpi_scan
|
|
36
|
+
vpi_sim_control
|
|
37
|
+
vpi_sim_vcontrol
|
|
38
|
+
vpi_vprintf
|
|
39
|
+
vpip_count_drivers
|
|
40
|
+
vpip_format_strength
|
|
41
|
+
vpip_make_systf_system_defined
|
|
42
|
+
vpip_mcd_rawwrite
|
|
43
|
+
vpip_set_return_value
|
|
44
|
+
acc_fetch_fullname
|
|
45
|
+
acc_fetch_fulltype
|
|
46
|
+
acc_fetch_name
|
|
47
|
+
acc_fetch_type
|
|
48
|
+
acc_fetch_type_str
|
|
49
|
+
mti_AddLoadDoneCB
|
|
50
|
+
mti_AddQuitCB
|
|
51
|
+
mti_Break
|
|
52
|
+
mti_CreateProcess
|
|
53
|
+
mti_CreateProcessWithPriority
|
|
54
|
+
mti_Delta
|
|
55
|
+
mti_Desensitize
|
|
56
|
+
mti_FindRegion
|
|
57
|
+
mti_FindSignal
|
|
58
|
+
mti_FindVar
|
|
59
|
+
mti_FirstLowerRegion
|
|
60
|
+
mti_FirstLowerRegion
|
|
61
|
+
mti_FirstSignal
|
|
62
|
+
mti_FirstVarByRegion
|
|
63
|
+
mti_ForceSignal
|
|
64
|
+
mti_GetArrayElementType
|
|
65
|
+
mti_GetArraySignalValue
|
|
66
|
+
mti_GetArrayVarValue
|
|
67
|
+
mti_GetEnumValues
|
|
68
|
+
mti_GetNumRecordElements
|
|
69
|
+
mti_GetPrimaryName
|
|
70
|
+
mti_GetProductVersion
|
|
71
|
+
mti_GetRegionFullName
|
|
72
|
+
mti_GetRegionName
|
|
73
|
+
mti_GetRegionSourceName
|
|
74
|
+
mti_GetResolutionLimit
|
|
75
|
+
mti_GetSignalName
|
|
76
|
+
mti_GetSignalNameIndirect
|
|
77
|
+
mti_GetSignalSubelements
|
|
78
|
+
mti_GetSignalType
|
|
79
|
+
mti_GetSignalValue
|
|
80
|
+
mti_GetSignalValueIndirect
|
|
81
|
+
mti_GetTopRegion
|
|
82
|
+
mti_GetTypeKind
|
|
83
|
+
mti_GetVarKind
|
|
84
|
+
mti_GetVarName
|
|
85
|
+
mti_GetVarSubelements
|
|
86
|
+
mti_GetVarType
|
|
87
|
+
mti_GetVarValue
|
|
88
|
+
mti_GetVarValueIndirect
|
|
89
|
+
mti_NextRegion
|
|
90
|
+
mti_NextSignal
|
|
91
|
+
mti_NextVar
|
|
92
|
+
mti_Now
|
|
93
|
+
mti_NowUpper
|
|
94
|
+
mti_Quit
|
|
95
|
+
mti_ReleaseSignal
|
|
96
|
+
mti_RemoveLoadDoneCB
|
|
97
|
+
mti_RemoveQuitCB
|
|
98
|
+
mti_ScheduleWakeup
|
|
99
|
+
mti_ScheduleWakeup64
|
|
100
|
+
mti_Sensitize
|
|
101
|
+
mti_SetSignalValue
|
|
102
|
+
mti_SetVarValue
|
|
103
|
+
mti_TickDir
|
|
104
|
+
mti_TickLeft
|
|
105
|
+
mti_TickLength
|
|
106
|
+
mti_TickRight
|
|
107
|
+
mti_VsimFree
|
|
108
|
+
mti_Interp
|
|
109
|
+
mti_Cmd
|
|
110
|
+
Tcl_GetStringResult
|
|
111
|
+
Tcl_ResetResult
|
|
112
|
+
Tcl_GetObjResult
|
|
113
|
+
Tcl_ResetResult
|
|
114
|
+
Tcl_ListObjGetElements
|
|
115
|
+
Tcl_GetStringResult
|
|
116
|
+
TclFreeObj
|
|
117
|
+
Tcl_ResetResult
|
|
118
|
+
Tcl_ResetResult
|
|
119
|
+
Tcl_GetString
|
|
120
|
+
TclFreeObj
|
|
121
|
+
vhpi_check_error
|
|
122
|
+
vhpi_control
|
|
123
|
+
vhpi_disable_cb
|
|
124
|
+
vhpi_enable_cb
|
|
125
|
+
vhpi_get
|
|
126
|
+
vhpi_get_phys
|
|
127
|
+
vhpi_get_str
|
|
128
|
+
vhpi_get_time
|
|
129
|
+
vhpi_get_value
|
|
130
|
+
vhpi_handle
|
|
131
|
+
vhpi_handle_by_index
|
|
132
|
+
vhpi_handle_by_name
|
|
133
|
+
vhpi_iterator
|
|
134
|
+
vhpi_put_value
|
|
135
|
+
vhpi_register_cb
|
|
136
|
+
vhpi_release_handle
|
|
137
|
+
vhpi_remove_cb
|
|
138
|
+
vhpi_scan
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Copyright cocotb contributors
|
|
2
|
+
// Copyright (c) 2013 Potential Ventures Ltd
|
|
3
|
+
// Copyright (c) 2013 SolarFlare Communications Inc
|
|
4
|
+
// Licensed under the Revised BSD License, see LICENSE for details.
|
|
5
|
+
// SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
+
|
|
7
|
+
#ifndef COCOTB_UTILS_H_
|
|
8
|
+
#define COCOTB_UTILS_H_
|
|
9
|
+
|
|
10
|
+
#include <exports.h>
|
|
11
|
+
#ifdef COCOTBUTILS_EXPORTS
|
|
12
|
+
#define COCOTBUTILS_EXPORT COCOTB_EXPORT
|
|
13
|
+
#else
|
|
14
|
+
#define COCOTBUTILS_EXPORT COCOTB_IMPORT
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
#include <gpi_logging.h>
|
|
18
|
+
|
|
19
|
+
#define xstr(a) str(a)
|
|
20
|
+
#define str(a) #a
|
|
21
|
+
|
|
22
|
+
extern "C" COCOTBUTILS_EXPORT void *utils_dyn_open(const char *lib_name);
|
|
23
|
+
extern "C" COCOTBUTILS_EXPORT void *utils_dyn_sym(void *handle,
|
|
24
|
+
const char *sym_name);
|
|
25
|
+
extern "C" COCOTBUTILS_EXPORT int is_python_context;
|
|
26
|
+
|
|
27
|
+
// to_python and to_simulator are implemented as macros instead of functions so
|
|
28
|
+
// that the logs reference the user's lineno and filename
|
|
29
|
+
|
|
30
|
+
#define to_python() \
|
|
31
|
+
do { \
|
|
32
|
+
if (is_python_context) { \
|
|
33
|
+
LOG_ERROR("FATAL: We are calling up again"); \
|
|
34
|
+
exit(1); \
|
|
35
|
+
} \
|
|
36
|
+
++is_python_context; \
|
|
37
|
+
LOG_TRACE("Returning to Python"); \
|
|
38
|
+
} while (0)
|
|
39
|
+
|
|
40
|
+
#define to_simulator() \
|
|
41
|
+
do { \
|
|
42
|
+
if (!is_python_context) { \
|
|
43
|
+
LOG_ERROR("FATAL: We have returned twice from Python"); \
|
|
44
|
+
exit(1); \
|
|
45
|
+
} \
|
|
46
|
+
--is_python_context; \
|
|
47
|
+
LOG_TRACE("Returning to simulator"); \
|
|
48
|
+
} while (0)
|
|
49
|
+
|
|
50
|
+
template <typename F>
|
|
51
|
+
class Deferable {
|
|
52
|
+
public:
|
|
53
|
+
constexpr Deferable(F f) : f_(f) {};
|
|
54
|
+
~Deferable() { f_(); }
|
|
55
|
+
|
|
56
|
+
private:
|
|
57
|
+
F f_;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
template <typename F>
|
|
61
|
+
constexpr Deferable<F> make_deferable(F f) {
|
|
62
|
+
return Deferable<F>(f);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
#define DEFER1(a, b) a##b
|
|
66
|
+
#define DEFER0(a, b) DEFER1(a, b)
|
|
67
|
+
#define DEFER(statement) \
|
|
68
|
+
auto DEFER0(_defer, __COUNTER__) = make_deferable([&]() { statement; });
|
|
69
|
+
|
|
70
|
+
#endif /* COCOTB_UTILS_H_ */
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright cocotb contributors
|
|
2
|
+
// Copyright (c) 2013 Potential Ventures Ltd
|
|
3
|
+
// Copyright (c) 2013 SolarFlare Communications Inc
|
|
4
|
+
// Licensed under the Revised BSD License, see LICENSE for details.
|
|
5
|
+
// SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
+
|
|
7
|
+
#ifndef COCOTB_EMBED_H_
|
|
8
|
+
#define COCOTB_EMBED_H_
|
|
9
|
+
|
|
10
|
+
#include <exports.h>
|
|
11
|
+
#ifdef COCOTB_EMBED_EXPORTS
|
|
12
|
+
#define COCOTB_EMBED_EXPORT COCOTB_EXPORT
|
|
13
|
+
#else
|
|
14
|
+
#define COCOTB_EMBED_EXPORT COCOTB_IMPORT
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
#include <gpi.h>
|
|
18
|
+
|
|
19
|
+
#ifdef __cplusplus
|
|
20
|
+
extern "C" {
|
|
21
|
+
#endif
|
|
22
|
+
|
|
23
|
+
extern COCOTB_EMBED_EXPORT void embed_init_python(void);
|
|
24
|
+
extern COCOTB_EMBED_EXPORT void embed_sim_cleanup(void);
|
|
25
|
+
extern COCOTB_EMBED_EXPORT int embed_sim_init(int argc,
|
|
26
|
+
char const *const *argv);
|
|
27
|
+
extern COCOTB_EMBED_EXPORT void embed_sim_event(const char *msg);
|
|
28
|
+
|
|
29
|
+
#ifdef __cplusplus
|
|
30
|
+
}
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
#endif /* COCOTB_EMBED_H_ */
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright cocotb contributors
|
|
2
|
+
// Licensed under the Revised BSD License, see LICENSE for details.
|
|
3
|
+
// SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
+
|
|
5
|
+
#ifndef COCOTB_EXPORTS_H_
|
|
6
|
+
#define COCOTB_EXPORTS_H_
|
|
7
|
+
|
|
8
|
+
// Make cocotb work correctly when the default visibility is changed to hidden
|
|
9
|
+
// Changing the default visibility to hidden has the advantage of significantly
|
|
10
|
+
// reducing the code size and load times, as well as letting the optimizer
|
|
11
|
+
// produce better code.
|
|
12
|
+
#if _WIN32
|
|
13
|
+
#define COCOTB_EXPORT __declspec(dllexport)
|
|
14
|
+
#define COCOTB_IMPORT __declspec(dllimport)
|
|
15
|
+
#else
|
|
16
|
+
#define COCOTB_EXPORT __attribute__((visibility("default")))
|
|
17
|
+
#define COCOTB_IMPORT
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
#endif
|