cocotb 1.9.2__cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.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 +92 -0
- cocotb/__init__.py +371 -0
- cocotb/_deprecation.py +36 -0
- cocotb/_py_compat.py +63 -0
- cocotb/_sim_versions.py +145 -0
- cocotb/_vendor/__init__.py +0 -0
- cocotb/_vendor/distutils_version.py +346 -0
- cocotb/_version.py +8 -0
- cocotb/binary.py +858 -0
- cocotb/clock.py +174 -0
- cocotb/config.py +289 -0
- cocotb/decorators.py +332 -0
- cocotb/handle.py +1175 -0
- cocotb/ipython_support.py +92 -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_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/log.py +303 -0
- cocotb/memdebug.py +35 -0
- cocotb/outcomes.py +56 -0
- cocotb/queue.py +179 -0
- cocotb/regression.py +933 -0
- cocotb/result.py +209 -0
- cocotb/runner.py +1400 -0
- cocotb/scheduler.py +1099 -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 +137 -0
- cocotb/share/include/cocotb_utils.h +93 -0
- cocotb/share/include/embed.h +56 -0
- cocotb/share/include/exports.h +20 -0
- cocotb/share/include/gpi.h +265 -0
- cocotb/share/include/gpi_logging.h +212 -0
- cocotb/share/include/py_gpi_logging.h +30 -0
- cocotb/share/include/vhpi_user_ext.h +26 -0
- cocotb/share/include/vpi_user_ext.h +55 -0
- cocotb/share/lib/verilator/verilator.cpp +196 -0
- cocotb/share/makefiles/Makefile.deprecations +12 -0
- cocotb/share/makefiles/Makefile.inc +176 -0
- cocotb/share/makefiles/Makefile.sim +113 -0
- cocotb/share/makefiles/simulators/Makefile.activehdl +79 -0
- cocotb/share/makefiles/simulators/Makefile.cvc +94 -0
- cocotb/share/makefiles/simulators/Makefile.ghdl +113 -0
- cocotb/share/makefiles/simulators/Makefile.icarus +111 -0
- cocotb/share/makefiles/simulators/Makefile.ius +125 -0
- cocotb/share/makefiles/simulators/Makefile.modelsim +32 -0
- cocotb/share/makefiles/simulators/Makefile.nvc +64 -0
- cocotb/share/makefiles/simulators/Makefile.questa +171 -0
- cocotb/share/makefiles/simulators/Makefile.riviera +183 -0
- cocotb/share/makefiles/simulators/Makefile.vcs +98 -0
- cocotb/share/makefiles/simulators/Makefile.verilator +86 -0
- cocotb/share/makefiles/simulators/Makefile.xcelium +136 -0
- cocotb/simulator.cpython-313-x86_64-linux-gnu.so +0 -0
- cocotb/task.py +325 -0
- cocotb/triggers.py +1104 -0
- cocotb/types/__init__.py +50 -0
- cocotb/types/array.py +309 -0
- cocotb/types/logic.py +292 -0
- cocotb/types/logic_array.py +298 -0
- cocotb/types/range.py +198 -0
- cocotb/utils.py +698 -0
- cocotb/wavedrom.py +199 -0
- cocotb/xunit_reporter.py +80 -0
- cocotb-1.9.2.dist-info/LICENSE +28 -0
- cocotb-1.9.2.dist-info/METADATA +168 -0
- cocotb-1.9.2.dist-info/RECORD +89 -0
- cocotb-1.9.2.dist-info/WHEEL +6 -0
- cocotb-1.9.2.dist-info/entry_points.txt +2 -0
- cocotb-1.9.2.dist-info/top_level.txt +21 -0
- pygpi/__init__.py +0 -0
- pygpi/entry.py +26 -0
|
@@ -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,137 @@
|
|
|
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_TickLeft
|
|
104
|
+
mti_TickLength
|
|
105
|
+
mti_TickRight
|
|
106
|
+
mti_VsimFree
|
|
107
|
+
mti_Interp
|
|
108
|
+
mti_Cmd
|
|
109
|
+
Tcl_GetStringResult
|
|
110
|
+
Tcl_ResetResult
|
|
111
|
+
Tcl_GetObjResult
|
|
112
|
+
Tcl_ResetResult
|
|
113
|
+
Tcl_ListObjGetElements
|
|
114
|
+
Tcl_GetStringResult
|
|
115
|
+
TclFreeObj
|
|
116
|
+
Tcl_ResetResult
|
|
117
|
+
Tcl_ResetResult
|
|
118
|
+
Tcl_GetString
|
|
119
|
+
TclFreeObj
|
|
120
|
+
vhpi_check_error
|
|
121
|
+
vhpi_control
|
|
122
|
+
vhpi_disable_cb
|
|
123
|
+
vhpi_enable_cb
|
|
124
|
+
vhpi_get
|
|
125
|
+
vhpi_get_phys
|
|
126
|
+
vhpi_get_str
|
|
127
|
+
vhpi_get_time
|
|
128
|
+
vhpi_get_value
|
|
129
|
+
vhpi_handle
|
|
130
|
+
vhpi_handle_by_index
|
|
131
|
+
vhpi_handle_by_name
|
|
132
|
+
vhpi_iterator
|
|
133
|
+
vhpi_put_value
|
|
134
|
+
vhpi_register_cb
|
|
135
|
+
vhpi_release_handle
|
|
136
|
+
vhpi_remove_cb
|
|
137
|
+
vhpi_scan
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
* Copyright (c) 2013 Potential Ventures Ltd
|
|
3
|
+
* Copyright (c) 2013 SolarFlare Communications Inc
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* Redistribution and use in source and binary forms, with or without
|
|
7
|
+
* modification, are permitted provided that the following conditions are met:
|
|
8
|
+
* * Redistributions of source code must retain the above copyright
|
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
|
10
|
+
* * Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
|
13
|
+
* * Neither the name of Potential Ventures Ltd,
|
|
14
|
+
* SolarFlare Communications Inc nor the
|
|
15
|
+
* names of its contributors may be used to endorse or promote products
|
|
16
|
+
* derived from this software without specific prior written permission.
|
|
17
|
+
*
|
|
18
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
19
|
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
20
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
21
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL POTENTIAL VENTURES LTD BE LIABLE FOR ANY
|
|
22
|
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
23
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
24
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
25
|
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
27
|
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
+
******************************************************************************/
|
|
29
|
+
|
|
30
|
+
#ifndef COCOTB_UTILS_H_
|
|
31
|
+
#define COCOTB_UTILS_H_
|
|
32
|
+
|
|
33
|
+
#include <exports.h>
|
|
34
|
+
#ifdef COCOTBUTILS_EXPORTS
|
|
35
|
+
#define COCOTBUTILS_EXPORT COCOTB_EXPORT
|
|
36
|
+
#else
|
|
37
|
+
#define COCOTBUTILS_EXPORT COCOTB_IMPORT
|
|
38
|
+
#endif
|
|
39
|
+
|
|
40
|
+
#include <gpi_logging.h>
|
|
41
|
+
|
|
42
|
+
#define xstr(a) str(a)
|
|
43
|
+
#define str(a) #a
|
|
44
|
+
|
|
45
|
+
extern "C" COCOTBUTILS_EXPORT void* utils_dyn_open(const char* lib_name);
|
|
46
|
+
extern "C" COCOTBUTILS_EXPORT void* utils_dyn_sym(void* handle,
|
|
47
|
+
const char* sym_name);
|
|
48
|
+
extern "C" COCOTBUTILS_EXPORT int is_python_context;
|
|
49
|
+
|
|
50
|
+
// to_python and to_simulator are implemented as macros instead of functions so
|
|
51
|
+
// that the logs reference the user's lineno and filename
|
|
52
|
+
|
|
53
|
+
#define to_python() \
|
|
54
|
+
do { \
|
|
55
|
+
if (is_python_context) { \
|
|
56
|
+
LOG_ERROR("FATAL: We are calling up again"); \
|
|
57
|
+
exit(1); \
|
|
58
|
+
} \
|
|
59
|
+
++is_python_context; \
|
|
60
|
+
LOG_TRACE("Returning to Python"); \
|
|
61
|
+
} while (0)
|
|
62
|
+
|
|
63
|
+
#define to_simulator() \
|
|
64
|
+
do { \
|
|
65
|
+
if (!is_python_context) { \
|
|
66
|
+
LOG_ERROR("FATAL: We have returned twice from Python"); \
|
|
67
|
+
exit(1); \
|
|
68
|
+
} \
|
|
69
|
+
--is_python_context; \
|
|
70
|
+
LOG_TRACE("Returning to simulator"); \
|
|
71
|
+
} while (0)
|
|
72
|
+
|
|
73
|
+
template <typename F>
|
|
74
|
+
class Deferable {
|
|
75
|
+
public:
|
|
76
|
+
constexpr Deferable(F f) : f_(f){};
|
|
77
|
+
~Deferable() { f_(); }
|
|
78
|
+
|
|
79
|
+
private:
|
|
80
|
+
F f_;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
template <typename F>
|
|
84
|
+
constexpr Deferable<F> make_deferable(F f) {
|
|
85
|
+
return Deferable<F>(f);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
#define DEFER1(a, b) a##b
|
|
89
|
+
#define DEFER0(a, b) DEFER1(a, b)
|
|
90
|
+
#define DEFER(statement) \
|
|
91
|
+
auto DEFER0(_defer, __COUNTER__) = make_deferable([&]() { statement; });
|
|
92
|
+
|
|
93
|
+
#endif /* COCOTB_UTILS_H_ */
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
* Copyright (c) 2013 Potential Ventures Ltd
|
|
3
|
+
* Copyright (c) 2013 SolarFlare Communications Inc
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* Redistribution and use in source and binary forms, with or without
|
|
7
|
+
* modification, are permitted provided that the following conditions are met:
|
|
8
|
+
* * Redistributions of source code must retain the above copyright
|
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
|
10
|
+
* * Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
|
13
|
+
* * Neither the name of Potential Ventures Ltd,
|
|
14
|
+
* SolarFlare Communications Inc nor the
|
|
15
|
+
* names of its contributors may be used to endorse or promote products
|
|
16
|
+
* derived from this software without specific prior written permission.
|
|
17
|
+
*
|
|
18
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
19
|
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
20
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
21
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL POTENTIAL VENTURES LTD BE LIABLE FOR ANY
|
|
22
|
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
23
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
24
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
25
|
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
27
|
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
+
******************************************************************************/
|
|
29
|
+
|
|
30
|
+
#ifndef COCOTB_EMBED_H_
|
|
31
|
+
#define COCOTB_EMBED_H_
|
|
32
|
+
|
|
33
|
+
#include <exports.h>
|
|
34
|
+
#ifdef COCOTB_EMBED_EXPORTS
|
|
35
|
+
#define COCOTB_EMBED_EXPORT COCOTB_EXPORT
|
|
36
|
+
#else
|
|
37
|
+
#define COCOTB_EMBED_EXPORT COCOTB_IMPORT
|
|
38
|
+
#endif
|
|
39
|
+
|
|
40
|
+
#include <gpi.h>
|
|
41
|
+
|
|
42
|
+
#ifdef __cplusplus
|
|
43
|
+
extern "C" {
|
|
44
|
+
#endif
|
|
45
|
+
|
|
46
|
+
extern COCOTB_EMBED_EXPORT void embed_init_python(void);
|
|
47
|
+
extern COCOTB_EMBED_EXPORT void embed_sim_cleanup(void);
|
|
48
|
+
extern COCOTB_EMBED_EXPORT int embed_sim_init(int argc,
|
|
49
|
+
char const* const* argv);
|
|
50
|
+
extern COCOTB_EMBED_EXPORT void embed_sim_event(const char* msg);
|
|
51
|
+
|
|
52
|
+
#ifdef __cplusplus
|
|
53
|
+
}
|
|
54
|
+
#endif
|
|
55
|
+
|
|
56
|
+
#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
|