cocotb 2.0.0rc2__cp39-cp39-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-39-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
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
// Copyright cocotb contributors
|
|
2
|
+
// Copyright (c) 2013, 2018 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_GPI_H_
|
|
8
|
+
#define COCOTB_GPI_H_
|
|
9
|
+
|
|
10
|
+
/** @file gpi.h
|
|
11
|
+
|
|
12
|
+
Generic Procedural Interface
|
|
13
|
+
============================
|
|
14
|
+
|
|
15
|
+
This header file defines the GPI to interface with any simulator that supports
|
|
16
|
+
VPI, VHPI, or FLI.
|
|
17
|
+
|
|
18
|
+
Implementations need to implement the underlying functions in `gpi_priv.h`.
|
|
19
|
+
The functions are essentially a limited subset of VPI/VHPI/FLI.
|
|
20
|
+
|
|
21
|
+
Implementation-specific notes
|
|
22
|
+
-----------------------------
|
|
23
|
+
|
|
24
|
+
By amazing coincidence, VPI and VHPI are strikingly similar which is obviously
|
|
25
|
+
reflected by this header file. Unfortunately, this means that proprietary,
|
|
26
|
+
non-standard, less featured language interfaces (for example Mentor FLI) may
|
|
27
|
+
have to resort to some hackery.
|
|
28
|
+
|
|
29
|
+
Because of the lack of ability to register a callback on event change using the
|
|
30
|
+
FLI, we have to create a process with the signal on the sensitivity list to
|
|
31
|
+
imitate a callback.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
#include <exports.h>
|
|
35
|
+
#ifdef GPI_EXPORTS
|
|
36
|
+
#define GPI_EXPORT COCOTB_EXPORT
|
|
37
|
+
#else
|
|
38
|
+
#define GPI_EXPORT COCOTB_IMPORT
|
|
39
|
+
#endif
|
|
40
|
+
|
|
41
|
+
#include <gpi_logging.h>
|
|
42
|
+
#include <stdbool.h>
|
|
43
|
+
#include <stdint.h>
|
|
44
|
+
|
|
45
|
+
/*
|
|
46
|
+
* Declare the handle types.
|
|
47
|
+
*
|
|
48
|
+
* We want these handles to be opaque pointers, since their layout is not
|
|
49
|
+
* exposed to C. We do this by using incomplete types. The assumption being
|
|
50
|
+
* made here is that `sizeof(some_cpp_class*) == sizeof(some_c_struct*)`, which
|
|
51
|
+
* is true on all reasonable platforms.
|
|
52
|
+
*/
|
|
53
|
+
#ifdef __cplusplus
|
|
54
|
+
/* In C++, we use forward-declarations of the types in gpi_priv.h as our
|
|
55
|
+
* incomplete types, as this avoids the need for any casting in GpiCommon.cpp.
|
|
56
|
+
*/
|
|
57
|
+
class GpiObjHdl;
|
|
58
|
+
class GpiCbHdl;
|
|
59
|
+
class GpiIterator;
|
|
60
|
+
typedef GpiObjHdl *gpi_sim_hdl;
|
|
61
|
+
typedef GpiCbHdl *gpi_cb_hdl;
|
|
62
|
+
typedef GpiIterator *gpi_iterator_hdl;
|
|
63
|
+
#else
|
|
64
|
+
/* In C, we declare some incomplete struct types that we never complete.
|
|
65
|
+
* The names of these are irrelevant, but for simplicity they match the C++
|
|
66
|
+
* names.
|
|
67
|
+
*/
|
|
68
|
+
struct GpiObjHdl;
|
|
69
|
+
struct GpiCbHdl;
|
|
70
|
+
struct GpiIterator;
|
|
71
|
+
typedef struct GpiObjHdl *gpi_sim_hdl;
|
|
72
|
+
typedef struct GpiCbHdl *gpi_cb_hdl;
|
|
73
|
+
typedef struct GpiIterator *gpi_iterator_hdl;
|
|
74
|
+
#endif
|
|
75
|
+
|
|
76
|
+
#ifdef __cplusplus
|
|
77
|
+
extern "C" {
|
|
78
|
+
#endif
|
|
79
|
+
|
|
80
|
+
/** Object discovery method when searching by name. */
|
|
81
|
+
typedef enum gpi_discovery_e {
|
|
82
|
+
GPI_AUTO = 0,
|
|
83
|
+
GPI_NATIVE = 1,
|
|
84
|
+
} gpi_discovery;
|
|
85
|
+
|
|
86
|
+
/** GPI simulation object types. */
|
|
87
|
+
// Note these are strikingly similar to the VPI types...
|
|
88
|
+
typedef enum gpi_objtype_e {
|
|
89
|
+
GPI_UNKNOWN = 0,
|
|
90
|
+
GPI_MEMORY = 1,
|
|
91
|
+
GPI_MODULE = 2,
|
|
92
|
+
// GPI_NET = 3, // Deprecated
|
|
93
|
+
// GPI_PARAMETER = 4, // Deprecated
|
|
94
|
+
// GPI_REGISTER = 5, // Deprecated
|
|
95
|
+
GPI_ARRAY = 6,
|
|
96
|
+
GPI_ENUM = 7,
|
|
97
|
+
GPI_STRUCTURE = 8,
|
|
98
|
+
GPI_REAL = 9,
|
|
99
|
+
GPI_INTEGER = 10,
|
|
100
|
+
GPI_STRING = 11,
|
|
101
|
+
GPI_GENARRAY = 12,
|
|
102
|
+
GPI_PACKAGE = 13,
|
|
103
|
+
GPI_PACKED_STRUCTURE = 14,
|
|
104
|
+
GPI_LOGIC = 15,
|
|
105
|
+
GPI_LOGIC_ARRAY = 16,
|
|
106
|
+
} gpi_objtype;
|
|
107
|
+
|
|
108
|
+
/** Types of child objects to search for when iterating. */
|
|
109
|
+
typedef enum gpi_iterator_sel_e {
|
|
110
|
+
GPI_OBJECTS = 1,
|
|
111
|
+
GPI_DRIVERS = 2,
|
|
112
|
+
GPI_LOADS = 3,
|
|
113
|
+
GPI_PACKAGE_SCOPES = 4,
|
|
114
|
+
} gpi_iterator_sel;
|
|
115
|
+
|
|
116
|
+
/** Action to use when setting object value. */
|
|
117
|
+
typedef enum gpi_set_action_e {
|
|
118
|
+
GPI_DEPOSIT = 0,
|
|
119
|
+
GPI_FORCE = 1,
|
|
120
|
+
GPI_RELEASE = 2,
|
|
121
|
+
GPI_NO_DELAY = 3,
|
|
122
|
+
} gpi_set_action;
|
|
123
|
+
|
|
124
|
+
/** Direction of range constraint of an object. */
|
|
125
|
+
typedef enum gpi_range_dir_e {
|
|
126
|
+
GPI_RANGE_DOWN = -1,
|
|
127
|
+
GPI_RANGE_NO_DIR = 0,
|
|
128
|
+
GPI_RANGE_UP = 1,
|
|
129
|
+
} gpi_range_dir;
|
|
130
|
+
|
|
131
|
+
/** Type of value change to match when registering for callback. */
|
|
132
|
+
typedef enum gpi_edge_e {
|
|
133
|
+
GPI_RISING,
|
|
134
|
+
GPI_FALLING,
|
|
135
|
+
GPI_VALUE_CHANGE,
|
|
136
|
+
} gpi_edge;
|
|
137
|
+
|
|
138
|
+
/** @defgroup SimIntf Simulator Control and Interrogation
|
|
139
|
+
* These functions are for controlling and querying
|
|
140
|
+
* simulator state and information.
|
|
141
|
+
* @{
|
|
142
|
+
*/
|
|
143
|
+
|
|
144
|
+
/** Check if there is a registered GPI implementation.
|
|
145
|
+
*
|
|
146
|
+
* Useful for checking if a simulator is running.
|
|
147
|
+
*
|
|
148
|
+
* @return `1` if there is a registered GPI implementation, `0` otherwise.
|
|
149
|
+
*/
|
|
150
|
+
GPI_EXPORT bool gpi_has_registered_impl(void);
|
|
151
|
+
|
|
152
|
+
/** Stop the simulation after control returns to the GPI. */
|
|
153
|
+
GPI_EXPORT void gpi_sim_end(void);
|
|
154
|
+
|
|
155
|
+
/** Get the simulation time as two 32-bit uints.
|
|
156
|
+
*
|
|
157
|
+
* The value is in default simulation time units,
|
|
158
|
+
* which can be retrieved with @ref gpi_get_sim_precision.
|
|
159
|
+
*
|
|
160
|
+
* @param high Location to return high bits of current simulation time.
|
|
161
|
+
* @param low Location to return low bits of current simulation time.
|
|
162
|
+
*/
|
|
163
|
+
GPI_EXPORT void gpi_get_sim_time(uint32_t *high, uint32_t *low);
|
|
164
|
+
|
|
165
|
+
/** Get the simulation time precision.
|
|
166
|
+
*
|
|
167
|
+
* @param precision Location to return time precision.
|
|
168
|
+
* The value is scientific notation in terms of seconds.
|
|
169
|
+
* So a value of `-9` is nanosecond precision.
|
|
170
|
+
*/
|
|
171
|
+
GPI_EXPORT void gpi_get_sim_precision(int32_t *precision);
|
|
172
|
+
|
|
173
|
+
/** Get the running simulator product information.
|
|
174
|
+
*
|
|
175
|
+
* @return The simulator product string.
|
|
176
|
+
*/
|
|
177
|
+
GPI_EXPORT const char *gpi_get_simulator_product(void);
|
|
178
|
+
|
|
179
|
+
/** Get the running simulator version string.
|
|
180
|
+
*
|
|
181
|
+
* @return The simulator version string.
|
|
182
|
+
*/
|
|
183
|
+
GPI_EXPORT const char *gpi_get_simulator_version(void);
|
|
184
|
+
|
|
185
|
+
/** @} */ // End of group SimIntf
|
|
186
|
+
|
|
187
|
+
/** @defgroup ObjQuery Simulation Object Query
|
|
188
|
+
* These functions are for getting handles to simulation objects.
|
|
189
|
+
* @{
|
|
190
|
+
*/
|
|
191
|
+
|
|
192
|
+
/** Get a handle to the root simulation object.
|
|
193
|
+
*
|
|
194
|
+
* @param name Name of the root object, or `NULL`.
|
|
195
|
+
* @return Handle to simulation object or `NULL` if not found.
|
|
196
|
+
*/
|
|
197
|
+
GPI_EXPORT gpi_sim_hdl gpi_get_root_handle(const char *name);
|
|
198
|
+
|
|
199
|
+
/** Get a handle to a child simulation object by its name.
|
|
200
|
+
*
|
|
201
|
+
* @param parent Parent object handle.
|
|
202
|
+
* @param name Name of the child object.
|
|
203
|
+
* This should not be a path,
|
|
204
|
+
* but only the name of a direct child object.
|
|
205
|
+
* @param discovery_method Object discovery method.
|
|
206
|
+
* @return Handle to simulation object or `NULL` if not found.
|
|
207
|
+
*/
|
|
208
|
+
GPI_EXPORT gpi_sim_hdl gpi_get_handle_by_name(gpi_sim_hdl parent,
|
|
209
|
+
const char *name,
|
|
210
|
+
gpi_discovery discovery_method);
|
|
211
|
+
|
|
212
|
+
/** Get a handle to a child simulation object by its index.
|
|
213
|
+
*
|
|
214
|
+
* @param parent Parent indexable object handle.
|
|
215
|
+
* @param index Index of the child object.
|
|
216
|
+
* @return Handle to simulation object or `NULL` if not found.
|
|
217
|
+
*/
|
|
218
|
+
GPI_EXPORT gpi_sim_hdl gpi_get_handle_by_index(gpi_sim_hdl parent,
|
|
219
|
+
int32_t index);
|
|
220
|
+
|
|
221
|
+
/** @} */ // End of group ObjQuery
|
|
222
|
+
|
|
223
|
+
/** @defgroup ObjProps General Object Properties
|
|
224
|
+
* These functions are for getting and setting properties of a simulation
|
|
225
|
+
* object.
|
|
226
|
+
* @{
|
|
227
|
+
*/
|
|
228
|
+
|
|
229
|
+
/** @return The @ref gpi_objtype "type" of the simulation object. */
|
|
230
|
+
GPI_EXPORT gpi_objtype gpi_get_object_type(gpi_sim_hdl gpi_hdl);
|
|
231
|
+
|
|
232
|
+
/** @return Definition name of the simulation object. */
|
|
233
|
+
GPI_EXPORT const char *gpi_get_definition_name(gpi_sim_hdl gpi_hdl);
|
|
234
|
+
|
|
235
|
+
/** @return Definition file of the simulation object. */
|
|
236
|
+
GPI_EXPORT const char *gpi_get_definition_file(gpi_sim_hdl gpi_hdl);
|
|
237
|
+
|
|
238
|
+
/** @return The number of objects in the collection of the handle. */
|
|
239
|
+
GPI_EXPORT int gpi_get_num_elems(gpi_sim_hdl gpi_sim_hdl);
|
|
240
|
+
|
|
241
|
+
/** @return The left side of the range constraint. */
|
|
242
|
+
GPI_EXPORT int gpi_get_range_left(gpi_sim_hdl gpi_sim_hdl);
|
|
243
|
+
|
|
244
|
+
/** @return The right side of the range constraint. */
|
|
245
|
+
GPI_EXPORT int gpi_get_range_right(gpi_sim_hdl gpi_sim_hdl);
|
|
246
|
+
|
|
247
|
+
/** @return The direction of the range constraint:
|
|
248
|
+
* `+1` for ascending, `-1` for descending, `0` for undefined.
|
|
249
|
+
*/
|
|
250
|
+
GPI_EXPORT gpi_range_dir gpi_get_range_dir(gpi_sim_hdl gpi_sim_hdl);
|
|
251
|
+
|
|
252
|
+
/** Determine whether an object value is constant (parameters / generics etc).
|
|
253
|
+
*
|
|
254
|
+
* @return `1` if the object value is constant, `0` otherwise.
|
|
255
|
+
*/
|
|
256
|
+
GPI_EXPORT int gpi_is_constant(gpi_sim_hdl gpi_hdl);
|
|
257
|
+
|
|
258
|
+
/** Determine whether an object is indexable.
|
|
259
|
+
*
|
|
260
|
+
* @return `1` if the object value is indexable, `0` otherwise.
|
|
261
|
+
*/
|
|
262
|
+
GPI_EXPORT int gpi_is_indexable(gpi_sim_hdl gpi_hdl);
|
|
263
|
+
|
|
264
|
+
/** @} */ // End of group ObjProps
|
|
265
|
+
|
|
266
|
+
/** @defgroup SigProps Signal Object Properties
|
|
267
|
+
* These functions are for getting and setting properties of a signal object.
|
|
268
|
+
* @{
|
|
269
|
+
*/
|
|
270
|
+
|
|
271
|
+
// Getting properties
|
|
272
|
+
|
|
273
|
+
/** Get signal object value as a binary string.
|
|
274
|
+
* @param gpi_hdl Signal object handle.
|
|
275
|
+
* @return Object value.
|
|
276
|
+
*/
|
|
277
|
+
GPI_EXPORT const char *gpi_get_signal_value_binstr(gpi_sim_hdl gpi_hdl);
|
|
278
|
+
|
|
279
|
+
/** Get signal object value as a byte array.
|
|
280
|
+
* @param gpi_hdl Signal object handle.
|
|
281
|
+
* @return Object value. Null-terminated byte array.
|
|
282
|
+
*/
|
|
283
|
+
GPI_EXPORT const char *gpi_get_signal_value_str(gpi_sim_hdl gpi_hdl);
|
|
284
|
+
|
|
285
|
+
/** Get signal object value as a real.
|
|
286
|
+
* @param gpi_hdl Signal object handle.
|
|
287
|
+
* @return Object value.
|
|
288
|
+
*/
|
|
289
|
+
GPI_EXPORT double gpi_get_signal_value_real(gpi_sim_hdl gpi_hdl);
|
|
290
|
+
|
|
291
|
+
/** Get signal object value as a long.
|
|
292
|
+
* @param gpi_hdl Signal object handle.
|
|
293
|
+
* @return Object value.
|
|
294
|
+
*/
|
|
295
|
+
GPI_EXPORT long gpi_get_signal_value_long(gpi_sim_hdl gpi_hdl);
|
|
296
|
+
|
|
297
|
+
/** Get signal object name.
|
|
298
|
+
* @param gpi_hdl Signal object handle.
|
|
299
|
+
* @return Object name.
|
|
300
|
+
*/
|
|
301
|
+
GPI_EXPORT const char *gpi_get_signal_name_str(gpi_sim_hdl gpi_hdl);
|
|
302
|
+
|
|
303
|
+
/** Get signal object type as a string.
|
|
304
|
+
* @param gpi_hdl Signal object handle.
|
|
305
|
+
* @return Object type as a string.
|
|
306
|
+
*/
|
|
307
|
+
GPI_EXPORT const char *gpi_get_signal_type_str(gpi_sim_hdl gpi_hdl);
|
|
308
|
+
|
|
309
|
+
// Setting properties
|
|
310
|
+
|
|
311
|
+
/** Set signal object value with a real.
|
|
312
|
+
* @param gpi_hdl Signal object handle.
|
|
313
|
+
* @param value Object value.
|
|
314
|
+
* @param action Action to use.
|
|
315
|
+
*/
|
|
316
|
+
GPI_EXPORT void gpi_set_signal_value_real(gpi_sim_hdl gpi_hdl, double value,
|
|
317
|
+
gpi_set_action action);
|
|
318
|
+
|
|
319
|
+
/** Set signal object value with an int.
|
|
320
|
+
* @param gpi_hdl Signal object handle.
|
|
321
|
+
* @param value Object value.
|
|
322
|
+
* @param action Action to use.
|
|
323
|
+
*/
|
|
324
|
+
GPI_EXPORT void gpi_set_signal_value_int(gpi_sim_hdl gpi_hdl, int32_t value,
|
|
325
|
+
gpi_set_action action);
|
|
326
|
+
|
|
327
|
+
/** Set signal object value with a binary string.
|
|
328
|
+
* @param gpi_hdl Signal object handle.
|
|
329
|
+
* @param str Object value. Null-terminated string of binary characters
|
|
330
|
+
* in [`1`, `0`, `x`, `z`].
|
|
331
|
+
* @param action Action to use.
|
|
332
|
+
*/
|
|
333
|
+
GPI_EXPORT void gpi_set_signal_value_binstr(gpi_sim_hdl gpi_hdl,
|
|
334
|
+
const char *str,
|
|
335
|
+
gpi_set_action action);
|
|
336
|
+
|
|
337
|
+
/** Set signal object value with a byte array.
|
|
338
|
+
* @param gpi_hdl Signal object handle.
|
|
339
|
+
* @param str Object value. Null-terminated byte array.
|
|
340
|
+
* @param action Action to use.
|
|
341
|
+
*/
|
|
342
|
+
GPI_EXPORT void gpi_set_signal_value_str(gpi_sim_hdl gpi_hdl, const char *str,
|
|
343
|
+
gpi_set_action action);
|
|
344
|
+
|
|
345
|
+
/** @} */ // End of group SigProps
|
|
346
|
+
|
|
347
|
+
/** @defgroup HandleIteration Simulation Object Iteration
|
|
348
|
+
* These functions are for iterating over simulation object handles
|
|
349
|
+
* to discover child objects.
|
|
350
|
+
* @{
|
|
351
|
+
*/
|
|
352
|
+
|
|
353
|
+
/** Start iteration on a simulation object.
|
|
354
|
+
*
|
|
355
|
+
* Unlike `vpi_iterate()` the iterator handle may only be `NULL` if the `type`
|
|
356
|
+
* is not supported. If no objects of the requested type are found, an empty
|
|
357
|
+
* iterator is returned.
|
|
358
|
+
* @param base Simulation object to iterate over.
|
|
359
|
+
* @param type Iteration type.
|
|
360
|
+
* @return An iterator handle which can then be used with @ref gpi_next.
|
|
361
|
+
*/
|
|
362
|
+
GPI_EXPORT gpi_iterator_hdl gpi_iterate(gpi_sim_hdl base,
|
|
363
|
+
gpi_iterator_sel type);
|
|
364
|
+
|
|
365
|
+
/** Get next object in iteration.
|
|
366
|
+
*
|
|
367
|
+
* @param iterator Iterator handle.
|
|
368
|
+
* @return Object handle, or `NULL` when there are no more objects.
|
|
369
|
+
*/
|
|
370
|
+
GPI_EXPORT gpi_sim_hdl gpi_next(gpi_iterator_hdl iterator);
|
|
371
|
+
|
|
372
|
+
/** @} */ // End of group HandleIteration
|
|
373
|
+
|
|
374
|
+
/** @defgroup SimCallbacks Simulation Callbacks
|
|
375
|
+
* These functions are for registering and controlling callbacks.
|
|
376
|
+
* @{
|
|
377
|
+
*/
|
|
378
|
+
|
|
379
|
+
/** Register a timed callback.
|
|
380
|
+
*
|
|
381
|
+
* @param gpi_function Callback function pointer.
|
|
382
|
+
* @param gpi_cb_data Pointer to user data to be passed to callback function.
|
|
383
|
+
* @param time Time delay in simulation time units.
|
|
384
|
+
* @return Handle to callback object.
|
|
385
|
+
*/
|
|
386
|
+
GPI_EXPORT gpi_cb_hdl gpi_register_timed_callback(int (*gpi_function)(void *),
|
|
387
|
+
void *gpi_cb_data,
|
|
388
|
+
uint64_t time);
|
|
389
|
+
|
|
390
|
+
/** Register a value change callback.
|
|
391
|
+
*
|
|
392
|
+
* @param gpi_function Callback function pointer.
|
|
393
|
+
* @param gpi_cb_data Pointer to user data to be passed to callback function.
|
|
394
|
+
* @param gpi_hdl Simulation object to monitor for value change.
|
|
395
|
+
* @param edge Type of value change to monitor for.
|
|
396
|
+
* @return Handle to callback object.
|
|
397
|
+
*/
|
|
398
|
+
GPI_EXPORT gpi_cb_hdl gpi_register_value_change_callback(
|
|
399
|
+
int (*gpi_function)(void *), void *gpi_cb_data, gpi_sim_hdl gpi_hdl,
|
|
400
|
+
gpi_edge edge);
|
|
401
|
+
|
|
402
|
+
/** Register a readonly simulation phase callback.
|
|
403
|
+
*
|
|
404
|
+
* Callback will be called when simulation next enters the readonly phase.
|
|
405
|
+
* @param gpi_function Callback function pointer.
|
|
406
|
+
* @param gpi_cb_data Pointer to user data to be passed to callback function.
|
|
407
|
+
* @return Handle to callback object.
|
|
408
|
+
*/
|
|
409
|
+
GPI_EXPORT gpi_cb_hdl
|
|
410
|
+
gpi_register_readonly_callback(int (*gpi_function)(void *), void *gpi_cb_data);
|
|
411
|
+
|
|
412
|
+
/** Register a next timestep simulation phase callback.
|
|
413
|
+
*
|
|
414
|
+
* Callback will be called when simulation next enters the next timestep.
|
|
415
|
+
* @param gpi_function Callback function pointer.
|
|
416
|
+
* @param gpi_cb_data Pointer to user data to be passed to callback function.
|
|
417
|
+
* @return Handle to callback object.
|
|
418
|
+
*/
|
|
419
|
+
GPI_EXPORT gpi_cb_hdl
|
|
420
|
+
gpi_register_nexttime_callback(int (*gpi_function)(void *), void *gpi_cb_data);
|
|
421
|
+
|
|
422
|
+
/** Register a readwrite simulation phase callback.
|
|
423
|
+
*
|
|
424
|
+
* Callback will be called when simulation next enters the readwrite phase.
|
|
425
|
+
* @param gpi_function Callback function pointer.
|
|
426
|
+
* @param gpi_cb_data Pointer to user data to be passed to callback function.
|
|
427
|
+
* @return Handle to callback object.
|
|
428
|
+
*/
|
|
429
|
+
GPI_EXPORT gpi_cb_hdl
|
|
430
|
+
gpi_register_readwrite_callback(int (*gpi_function)(void *), void *gpi_cb_data);
|
|
431
|
+
|
|
432
|
+
/** Remove callback.
|
|
433
|
+
*
|
|
434
|
+
* The callback will not fire after this function is called.
|
|
435
|
+
* The argument is no longer valid if this function succeeds.
|
|
436
|
+
*
|
|
437
|
+
* @param cb_hdl The handle to the callback to remove.
|
|
438
|
+
* @returns `0` on successful removal, `1` otherwise.
|
|
439
|
+
*/
|
|
440
|
+
GPI_EXPORT int gpi_remove_cb(gpi_cb_hdl cb_hdl);
|
|
441
|
+
|
|
442
|
+
/** Retrieve user callback information from callback handle.
|
|
443
|
+
*
|
|
444
|
+
* This function cannot fail.
|
|
445
|
+
*
|
|
446
|
+
* @param cb_hdl The handle to the callback.
|
|
447
|
+
* @param cb_func Where the user callback function should be placed.
|
|
448
|
+
* @param cb_data Where the user callback function data should be placed.
|
|
449
|
+
*/
|
|
450
|
+
GPI_EXPORT void gpi_get_cb_info(gpi_cb_hdl cb_hdl, int (**cb_func)(void *),
|
|
451
|
+
void **cb_data);
|
|
452
|
+
|
|
453
|
+
/** @} */ // End of group SimCallbacks
|
|
454
|
+
|
|
455
|
+
#ifdef __cplusplus
|
|
456
|
+
}
|
|
457
|
+
#endif
|
|
458
|
+
|
|
459
|
+
#endif /* COCOTB_GPI_H_ */
|