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
@@ -1,55 +1,34 @@
1
- /******************************************************************************
2
- * Copyright (c) 2013, 2018 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
- ******************************************************************************/
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
29
6
 
30
7
  #ifndef COCOTB_GPI_H_
31
8
  #define COCOTB_GPI_H_
32
9
 
33
- /*
34
- Generic Language Interface
10
+ /** @file gpi.h
35
11
 
36
- This header file defines a Generic Language Interface into any simulator.
37
- Implementations need to implement the underlying functions in gpi_priv.h
12
+ Generic Procedural Interface
13
+ ============================
38
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`.
39
19
  The functions are essentially a limited subset of VPI/VHPI/FLI.
40
20
 
41
- Implementation specific notes
42
- =============================
21
+ Implementation-specific notes
22
+ -----------------------------
43
23
 
44
24
  By amazing coincidence, VPI and VHPI are strikingly similar which is obviously
45
- reflected by this header file. Unfortunately, this means that proprietry,
25
+ reflected by this header file. Unfortunately, this means that proprietary,
46
26
  non-standard, less featured language interfaces (for example Mentor FLI) may
47
27
  have to resort to some hackery.
48
28
 
49
29
  Because of the lack of ability to register a callback on event change using the
50
30
  FLI, we have to create a process with the signal on the sensitivity list to
51
31
  imitate a callback.
52
-
53
32
  */
54
33
 
55
34
  #include <exports.h>
@@ -62,9 +41,6 @@ imitate a callback.
62
41
  #include <gpi_logging.h>
63
42
  #include <stdbool.h>
64
43
  #include <stdint.h>
65
- #include <stdio.h>
66
- #include <stdlib.h>
67
- #include <string.h>
68
44
 
69
45
  /*
70
46
  * Declare the handle types.
@@ -101,162 +77,380 @@ typedef struct GpiIterator *gpi_iterator_hdl;
101
77
  extern "C" {
102
78
  #endif
103
79
 
104
- // Functions for controlling/querying the simulation state
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;
105
107
 
106
- /**
107
- * Returns 1 if there is a registered GPI implementation, 0 otherwise.
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.
108
145
  *
109
146
  * Useful for checking if a simulator is running.
147
+ *
148
+ * @return `1` if there is a registered GPI implementation, `0` otherwise.
110
149
  */
111
150
  GPI_EXPORT bool gpi_has_registered_impl(void);
112
151
 
113
- // Stop the simulator
152
+ /** Stop the simulation after control returns to the GPI. */
114
153
  GPI_EXPORT void gpi_sim_end(void);
115
154
 
116
- // Returns simulation time as two uints. Units are default sim units
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
+ */
117
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
+ */
118
171
  GPI_EXPORT void gpi_get_sim_precision(int32_t *precision);
119
172
 
120
- /**
121
- * Returns a string with the running simulator product information
173
+ /** Get the running simulator product information.
122
174
  *
123
- * @return simulator product string
175
+ * @return The simulator product string.
124
176
  */
125
177
  GPI_EXPORT const char *gpi_get_simulator_product(void);
126
178
 
127
- /**
128
- * Returns a string with the running simulator version
179
+ /** Get the running simulator version string.
129
180
  *
130
- * @return simulator version string
181
+ * @return The simulator version string.
131
182
  */
132
183
  GPI_EXPORT const char *gpi_get_simulator_version(void);
133
184
 
134
- // Functions for extracting a gpi_sim_hdl to an object
135
- // Returns a handle to the root simulation object,
136
- // Should be freed with gpi_free_handle
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
+ */
137
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
+ */
138
208
  GPI_EXPORT gpi_sim_hdl gpi_get_handle_by_name(gpi_sim_hdl parent,
139
- const char *name);
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
+ */
140
218
  GPI_EXPORT gpi_sim_hdl gpi_get_handle_by_index(gpi_sim_hdl parent,
141
219
  int32_t index);
142
- GPI_EXPORT void gpi_free_handle(gpi_sim_hdl gpi_hdl);
143
220
 
144
- // Types that can be passed to the iterator.
145
- //
146
- // Note these are strikingly similar to the VPI types...
147
- typedef enum gpi_objtype_e {
148
- GPI_UNKNOWN = 0,
149
- GPI_MEMORY = 1,
150
- GPI_MODULE = 2,
151
- GPI_NET = 3,
152
- // GPI_PARAMETER = 4, // Deprecated
153
- GPI_REGISTER = 5,
154
- GPI_ARRAY = 6,
155
- GPI_ENUM = 7,
156
- GPI_STRUCTURE = 8,
157
- GPI_REAL = 9,
158
- GPI_INTEGER = 10,
159
- GPI_STRING = 11,
160
- GPI_GENARRAY = 12,
161
- } gpi_objtype_t;
221
+ /** @} */ // End of group ObjQuery
162
222
 
163
- // When iterating, we can chose to either get child objects, drivers or loads
164
- typedef enum gpi_iterator_sel_e {
165
- GPI_OBJECTS = 1,
166
- GPI_DRIVERS = 2,
167
- GPI_LOADS = 3,
168
- } gpi_iterator_sel_t;
223
+ /** @defgroup ObjProps General Object Properties
224
+ * These functions are for getting and setting properties of a simulation
225
+ * object.
226
+ * @{
227
+ */
169
228
 
170
- typedef enum gpi_set_action_e {
171
- GPI_DEPOSIT = 0,
172
- GPI_FORCE = 1,
173
- GPI_RELEASE = 2,
174
- } gpi_set_action_t;
175
-
176
- // Functions for iterating over entries of a handle
177
- // Returns an iterator handle which can then be used in gpi_next calls
178
- //
179
- // Unlike `vpi_iterate` the iterator handle may only be NULL if the `type` is
180
- // not supported, If no objects of the requested type are found, an empty
181
- // iterator is returned.
182
- GPI_EXPORT gpi_iterator_hdl gpi_iterate(gpi_sim_hdl base,
183
- gpi_iterator_sel_t type);
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);
184
231
 
185
- // Returns NULL when there are no more objects
186
- GPI_EXPORT gpi_sim_hdl gpi_next(gpi_iterator_hdl iterator);
232
+ /** @return Definition name of the simulation object. */
233
+ GPI_EXPORT const char *gpi_get_definition_name(gpi_sim_hdl gpi_hdl);
187
234
 
188
- // Returns the number of objects in the collection of the handle
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. */
189
239
  GPI_EXPORT int gpi_get_num_elems(gpi_sim_hdl gpi_sim_hdl);
190
240
 
191
- // Returns the left side of the range constraint
241
+ /** @return The left side of the range constraint. */
192
242
  GPI_EXPORT int gpi_get_range_left(gpi_sim_hdl gpi_sim_hdl);
193
243
 
194
- // Returns the right side of the range constraint
244
+ /** @return The right side of the range constraint. */
195
245
  GPI_EXPORT int gpi_get_range_right(gpi_sim_hdl gpi_sim_hdl);
196
246
 
197
- // Functions for querying the properties of a handle
198
- // Caller responsible for freeing the returned string.
199
- // This is all slightly verbose but it saves having to enumerate various value
200
- // types We only care about a limited subset of values.
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
+ */
201
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
+ */
202
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
+ */
203
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
+ */
204
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
+ */
205
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
+ */
206
307
  GPI_EXPORT const char *gpi_get_signal_type_str(gpi_sim_hdl gpi_hdl);
207
308
 
208
- // Returns one of the types defined above e.g. gpiMemory etc.
209
- GPI_EXPORT gpi_objtype_t gpi_get_object_type(gpi_sim_hdl gpi_hdl);
309
+ // Setting properties
210
310
 
211
- // Get information about the definition of a handle
212
- GPI_EXPORT const char *gpi_get_definition_name(gpi_sim_hdl gpi_hdl);
213
- GPI_EXPORT const char *gpi_get_definition_file(gpi_sim_hdl gpi_hdl);
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);
214
318
 
215
- // Determine whether an object value is constant (parameters / generics etc)
216
- GPI_EXPORT int gpi_is_constant(gpi_sim_hdl gpi_hdl);
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);
217
326
 
218
- // Determine whether an object is indexable
219
- GPI_EXPORT int gpi_is_indexable(gpi_sim_hdl gpi_hdl);
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);
220
344
 
221
- // Functions for setting the properties of a handle
222
- GPI_EXPORT void gpi_set_signal_value_real(gpi_sim_hdl gpi_hdl, double value,
223
- gpi_set_action_t action);
224
- GPI_EXPORT void gpi_set_signal_value_int(gpi_sim_hdl gpi_hdl, int32_t value,
225
- gpi_set_action_t action);
226
- GPI_EXPORT void gpi_set_signal_value_binstr(
227
- gpi_sim_hdl gpi_hdl, const char *str,
228
- gpi_set_action_t action); // String of binary char(s) [1, 0, x, z]
229
- GPI_EXPORT void gpi_set_signal_value_str(
230
- gpi_sim_hdl gpi_hdl, const char *str,
231
- gpi_set_action_t action); // String of ASCII char(s)
232
-
233
- typedef enum gpi_edge {
234
- GPI_RISING = 1,
235
- GPI_FALLING = 2,
236
- } gpi_edge_e;
237
-
238
- // The callback registering functions
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
+ */
239
386
  GPI_EXPORT gpi_cb_hdl gpi_register_timed_callback(int (*gpi_function)(void *),
240
387
  void *gpi_cb_data,
241
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
+ */
242
398
  GPI_EXPORT gpi_cb_hdl gpi_register_value_change_callback(
243
399
  int (*gpi_function)(void *), void *gpi_cb_data, gpi_sim_hdl gpi_hdl,
244
- int edge);
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
+ */
245
409
  GPI_EXPORT gpi_cb_hdl
246
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
+ */
247
419
  GPI_EXPORT gpi_cb_hdl
248
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
+ */
249
429
  GPI_EXPORT gpi_cb_hdl
250
430
  gpi_register_readwrite_callback(int (*gpi_function)(void *), void *gpi_cb_data);
251
431
 
252
- // Calling convention is that 0 = success and negative numbers a failure
253
- // For implementers of GPI the provided macro GPI_RET(x) is provided
254
- GPI_EXPORT void gpi_deregister_callback(gpi_cb_hdl gpi_hdl);
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);
255
452
 
256
- // Because the internal structures may be different for different
257
- // implementations of GPI we provide a convenience function to extract the
258
- // callback data
259
- GPI_EXPORT void *gpi_get_callback_data(gpi_cb_hdl gpi_hdl);
453
+ /** @} */ // End of group SimCallbacks
260
454
 
261
455
  #ifdef __cplusplus
262
456
  }