origen_sim 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ #ifndef SERVER_H
2
+ #define SERVER_H
3
+
4
+ #include "common.h"
5
+
6
+ PLI_INT32 bridge_wait_for_msg(p_cb_data);
7
+ PLI_INT32 bridge_init(void);
8
+
9
+ #endif
@@ -0,0 +1,98 @@
1
+ ///
2
+ /// This is responsible for abstracting the socket connection to the master
3
+ /// Origen process
4
+ ///
5
+ #include "client.h"
6
+ #include <errno.h>
7
+ #include <sys/types.h>
8
+ #include <sys/socket.h>
9
+ #include <sys/un.h>
10
+ #include <unistd.h>
11
+ #include <time.h>
12
+
13
+ static int sock;
14
+ static uint64_t msg_count = 0;
15
+ static uint64_t last_msg_count = 0;
16
+
17
+ /// Connects to the Origen app's socket
18
+ int client_connect(char * socketId) {
19
+ int len;
20
+ struct sockaddr_un remote;
21
+
22
+ if (socketId == NULL) {
23
+ printf("ERROR: No socket ID given to the simulator\n");
24
+ return 1;
25
+ }
26
+
27
+ if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
28
+ perror("ERROR: The simulator failed to create a socket!");
29
+ return 1;
30
+ }
31
+
32
+ remote.sun_family = AF_UNIX;
33
+ strcpy(remote.sun_path, socketId);
34
+ len = offsetof(struct sockaddr_un, sun_path) + strlen(remote.sun_path) + 1;
35
+
36
+ if (connect(sock, (struct sockaddr *)&remote, len) == -1) {
37
+ perror("ERROR: The simulator failed to connect to Origen's socket!");
38
+ return 1;
39
+ }
40
+
41
+ return 0;
42
+ }
43
+
44
+
45
+ /// Returns true if the server has sent at least one message since the last time
46
+ /// this was called, it will always return true the very first time it is called.
47
+ /// The caller is responsible for setting the calling interval and therefore
48
+ /// deciding how long without a message we should allow before considering that
49
+ /// the server has died and that we are now an orphaned process.
50
+ bool is_server_alive() {
51
+ if (last_msg_count) {
52
+ bool res = msg_count > last_msg_count;
53
+ last_msg_count = msg_count;
54
+ return res;
55
+ } else {
56
+ last_msg_count = msg_count;
57
+ return true;
58
+ }
59
+ }
60
+
61
+
62
+ /// Send a message to the master Origen process.
63
+ /// NOTE: THE CALLER IS RESPONSIBLE FOR ADDING A \n TERMINATOR TO
64
+ /// THE MESSAGE
65
+ /// to the data as this function will do it for you.
66
+ int client_put(char* data) {
67
+ if(send(sock, data , strlen(data), 0) < 0) {
68
+ return 1;
69
+ }
70
+ return 0;
71
+ }
72
+
73
+
74
+ /// Get the next message from the master Origen application process.
75
+ /// Blocks until a complete message is received and will be returned in the
76
+ /// supplied data array
77
+ int client_get(int max_size, char* data) {
78
+ int len;
79
+
80
+ while (1) {
81
+ // Have a look at what is available
82
+ len = recv(sock, data, max_size, MSG_PEEK);
83
+ if (len < 0) {
84
+ return 1;
85
+ }
86
+
87
+ // See if we have a complete msg yet (by looking for a terminator)
88
+ for (int i = 0; i < len; i++) {
89
+ if (data[i] == '\n') {
90
+ // If so then pull that message out and return it
91
+ recv(sock, data, i + 1, 0);
92
+ data[i] = '\0';
93
+ msg_count++;
94
+ return 0;
95
+ }
96
+ }
97
+ }
98
+ }
@@ -0,0 +1,11 @@
1
+ #ifndef CLIENT_H
2
+ #define CLIENT_H
3
+
4
+ #include "common.h"
5
+
6
+ int client_connect(char *);
7
+ int client_get(int, char*);
8
+ int client_put(char*);
9
+ bool is_server_alive(void);
10
+
11
+ #endif
@@ -0,0 +1,22 @@
1
+ #ifndef COMMON_H
2
+ #define COMMON_H
3
+
4
+ #include <stddef.h>
5
+ #include <stdio.h>
6
+ #include <stdlib.h>
7
+ #include "vpi_user.h"
8
+ #include <stdbool.h>
9
+ #include <stdint.h>
10
+ #define UNUSED(x) (void)(x)
11
+
12
+ #define ENABLE_DEBUG
13
+
14
+ #ifdef ENABLE_DEBUG
15
+ /* #define DEBUG(fmt, args...) fprintf(stderr, "DEBUG: %s:%d:%s(): " fmt, \
16
+ __FILE__, __LINE__, __func__, ##args) */
17
+ #define DEBUG(fmt, args...) fprintf(stderr, "[DEBUG] " fmt, ##args)
18
+ #else
19
+ #define DEBUG(fmt, args...) /* Don't do anything in release builds */
20
+ #endif
21
+
22
+ #endif
@@ -0,0 +1,121 @@
1
+ ///
2
+ /// This is the top-level file for compilation, it basically deals with bootstrapping
3
+ /// this extension into the simulation
4
+ ///
5
+ #include "origen.h"
6
+ #include "bridge.h"
7
+ #include "client.h"
8
+ #include <string.h>
9
+
10
+ static void register_callback(PLI_INT32 aReason, PLI_INT32 (*aHandler)(p_cb_data));
11
+ static void init(void);
12
+
13
+ static void init() {
14
+ register_callback(cbStartOfSimulation, origen_startup);
15
+
16
+ register_callback(cbEndOfSimulation, origen_shutdown);
17
+ }
18
+
19
+
20
+ /// Returns the value of the given argument, or NULL if not supplied.
21
+ /// This example:
22
+ ///
23
+ /// get_arg("socket"); # => "/tmp/sim.sock"
24
+ ///
25
+ /// Will work for the arguement passed in either of these formats:
26
+ ///
27
+ /// -socket /tmp/sim.sock
28
+ /// +socket+/tmp/sim.sock
29
+ char * get_arg(char *arg) {
30
+ s_vpi_vlog_info info;
31
+ vpi_get_vlog_info(&info);
32
+ char * pch;
33
+ char * return_value;
34
+
35
+ char * minus_arg = (char *) malloc(strlen(arg) + 16);
36
+ strcpy(minus_arg, "-");
37
+ strcat(minus_arg, arg);
38
+ char * plus_arg = (char *) malloc(strlen(arg) + 16);
39
+ strcpy(plus_arg, "+");
40
+ strcat(plus_arg, arg);
41
+
42
+ for (PLI_INT32 i = 0; i < info.argc; i++) {
43
+ if (strcmp(info.argv[i], minus_arg) == 0) {
44
+ return_value = info.argv[i + 1];
45
+ goto DONE;
46
+ }
47
+ pch = strstr(info.argv[i], plus_arg);
48
+ if (pch) {
49
+ return_value = info.argv[i] + strlen(plus_arg) + 1;
50
+ goto DONE;
51
+ }
52
+ }
53
+ return_value = NULL;
54
+
55
+ DONE:
56
+ free(minus_arg);
57
+ free(plus_arg);
58
+ return return_value;
59
+ }
60
+
61
+
62
+ /// Called at the beginning of the simulation, this connects to the Origen application and then
63
+ /// enters the main process loop
64
+ PLI_INT32 origen_startup(p_cb_data data) {
65
+ UNUSED(data);
66
+ //vpi_printf("Simulation started!\n");
67
+
68
+ int err = client_connect(get_arg("socket"));
69
+
70
+ if (err) {
71
+ vpi_printf("ERROR: Couldn't connect to Origen app!\n");
72
+ return err;
73
+ }
74
+
75
+ // Start the server to listen for commands from an Origen application and apply them via VPI,
76
+ // this will run until it receives a complete message from the Origen app
77
+ return bridge_init();
78
+ }
79
+
80
+
81
+ PLI_INT32 origen_shutdown(p_cb_data data) {
82
+ UNUSED(data);
83
+ //vpi_printf("Simulation ended!\n");
84
+
85
+ return 0;
86
+ }
87
+
88
+
89
+ ///
90
+ /// Registers a very basic VPI callback with reason and handler.
91
+ ///
92
+ static void register_callback(PLI_INT32 aReason, PLI_INT32 (*aHandler)(p_cb_data))
93
+ {
94
+ s_cb_data call;
95
+
96
+ call.reason = aReason;
97
+ call.cb_rtn = aHandler;
98
+ call.obj = 0;
99
+ call.time = 0;
100
+ call.value = 0;
101
+ call.user_data = 0;
102
+
103
+ vpi_free_object(vpi_register_cb(&call));
104
+ }
105
+
106
+
107
+ ///
108
+ /// Bootstrap vector, make the simulator execute init() on startup
109
+ ///
110
+ void (*vlog_startup_routines[])(void) = { init, 0 };
111
+
112
+ #if defined(CVER) || defined(VCS) || defined(NCSIM)
113
+ void vlog_startup_routines_bootstrap()
114
+ {
115
+ unsigned int i;
116
+ for (i = 0; vlog_startup_routines[i]; i++)
117
+ {
118
+ vlog_startup_routines[i]();
119
+ }
120
+ }
121
+ #endif
@@ -0,0 +1,9 @@
1
+ #ifndef ORIGEN_H
2
+ #define ORIGEN_H
3
+
4
+ #include "common.h"
5
+
6
+ PLI_INT32 origen_startup(p_cb_data);
7
+ PLI_INT32 origen_shutdown(p_cb_data);
8
+
9
+ #endif
@@ -0,0 +1,924 @@
1
+ /*******************************************************************************
2
+ * vpi_user.h
3
+ *
4
+ * IEEE 1364-2005 Verilog HDL Programming Language Interface (PLI)
5
+ *
6
+ * This file contains the constant definitions, structure definitions, and
7
+ * routine declarations used by the Verilog PLI procedural interface VPI
8
+ * access routines.
9
+ *
10
+ ******************************************************************************/
11
+
12
+ /*******************************************************************************
13
+ * NOTE: the constant values 1 through 299 are reserved for use in this
14
+ * vpi_user.h file.
15
+ ******************************************************************************/
16
+
17
+ #ifndef VPI_USER_H
18
+ #define VPI_USER_H
19
+
20
+ #include <stdarg.h>
21
+
22
+ #ifdef __cplusplus
23
+ extern "C" {
24
+ #endif
25
+
26
+ /*----------------------------------------------------------------------------*/
27
+ /*----------------------------- Portability Help -----------------------------*/
28
+ /*----------------------------------------------------------------------------*/
29
+
30
+ /* Sized variables */
31
+
32
+ #ifndef PLI_TYPES
33
+ #define PLI_TYPES
34
+ typedef int PLI_INT32;
35
+ typedef unsigned int PLI_UINT32;
36
+ typedef short PLI_INT16;
37
+ typedef unsigned short PLI_UINT16;
38
+ typedef char PLI_BYTE8;
39
+ typedef unsigned char PLI_UBYTE8;
40
+ #endif
41
+
42
+ /* Use to export a symbol */
43
+
44
+ #if WIN32
45
+ #ifndef PLI_DLLISPEC
46
+ #define PLI_DLLISPEC __declspec(dllimport)
47
+ #define VPI_USER_DEFINED_DLLISPEC 1
48
+ #endif
49
+ #else
50
+ #ifndef PLI_DLLISPEC
51
+ #define PLI_DLLISPEC
52
+ #endif
53
+ #endif
54
+
55
+ /* Use to import a symbol */
56
+
57
+ #if WIN32
58
+ #ifndef PLI_DLLESPEC
59
+ #define PLI_DLLESPEC __declspec(dllexport)
60
+ #define VPI_USER_DEFINED_DLLESPEC 1
61
+ #endif
62
+ #else
63
+ #ifndef PLI_DLLESPEC
64
+ #define PLI_DLLESPEC
65
+ #endif
66
+ #endif
67
+
68
+ /* Use to mark a function as external */
69
+
70
+ #ifndef PLI_EXTERN
71
+ #define PLI_EXTERN
72
+ #endif
73
+
74
+ /* Use to mark a variable as external */
75
+
76
+ #ifndef PLI_VEXTERN
77
+ #define PLI_VEXTERN extern
78
+ #endif
79
+
80
+ #ifndef PLI_PROTOTYPES
81
+ #define PLI_PROTOTYPES
82
+ #define PROTO_PARAMS(params) params
83
+
84
+ /* object is defined imported by the application */
85
+
86
+ #define XXTERN PLI_EXTERN PLI_DLLISPEC
87
+
88
+ /* object is exported by the application */
89
+
90
+ #define EETERN PLI_EXTERN PLI_DLLESPEC
91
+ #endif
92
+
93
+ /********************************** TYPEDEFS **********************************/
94
+
95
+ typedef PLI_UINT32 *vpiHandle;
96
+
97
+ /******************************** OBJECT TYPES ********************************/
98
+
99
+ #define vpiAlways 1 /* always construct */
100
+ #define vpiAssignStmt 2 /* quasi-continuous assignment */
101
+ #define vpiAssignment 3 /* procedural assignment */
102
+ #define vpiBegin 4 /* block statement */
103
+ #define vpiCase 5 /* case statement */
104
+ #define vpiCaseItem 6 /* case statement item */
105
+ #define vpiConstant 7 /* numerical constant or literal string */
106
+ #define vpiContAssign 8 /* continuous assignment */
107
+ #define vpiDeassign 9 /* deassignment statement */
108
+ #define vpiDefParam 10 /* defparam */
109
+ #define vpiDelayControl 11 /* delay statement (e.g. #10) */
110
+ #define vpiDisable 12 /* named block disable statement */
111
+ #define vpiEventControl 13 /* wait on event, e.g. @e */
112
+ #define vpiEventStmt 14 /* event trigger, e.g. ->e */
113
+ #define vpiFor 15 /* for statement */
114
+ #define vpiForce 16 /* force statement */
115
+ #define vpiForever 17 /* forever statement */
116
+ #define vpiFork 18 /* fork-join block */
117
+ #define vpiFuncCall 19 /* HDL function call */
118
+ #define vpiFunction 20 /* HDL function */
119
+ #define vpiGate 21 /* primitive gate */
120
+ #define vpiIf 22 /* if statement */
121
+ #define vpiIfElse 23 /* if-else statement */
122
+ #define vpiInitial 24 /* initial construct */
123
+ #define vpiIntegerVar 25 /* integer variable */
124
+ #define vpiInterModPath 26 /* intermodule wire delay */
125
+ #define vpiIterator 27 /* iterator */
126
+ #define vpiIODecl 28 /* input/output declaration */
127
+ #define vpiMemory 29 /* behavioral memory */
128
+ #define vpiMemoryWord 30 /* single word of memory */
129
+ #define vpiModPath 31 /* module path for path delays */
130
+ #define vpiModule 32 /* module instance */
131
+ #define vpiNamedBegin 33 /* named block statement */
132
+ #define vpiNamedEvent 34 /* event variable */
133
+ #define vpiNamedFork 35 /* named fork-join block */
134
+ #define vpiNet 36 /* scalar or vector net */
135
+ #define vpiNetBit 37 /* bit of vector net */
136
+ #define vpiNullStmt 38 /* a semicolon. Ie. #10 ; */
137
+ #define vpiOperation 39 /* behavioral operation */
138
+ #define vpiParamAssign 40 /* module parameter assignment */
139
+ #define vpiParameter 41 /* module parameter */
140
+ #define vpiPartSelect 42 /* part-select */
141
+ #define vpiPathTerm 43 /* terminal of module path */
142
+ #define vpiPort 44 /* module port */
143
+ #define vpiPortBit 45 /* bit of vector module port */
144
+ #define vpiPrimTerm 46 /* primitive terminal */
145
+ #define vpiRealVar 47 /* real variable */
146
+ #define vpiReg 48 /* scalar or vector reg */
147
+ #define vpiRegBit 49 /* bit of vector reg */
148
+ #define vpiRelease 50 /* release statement */
149
+ #define vpiRepeat 51 /* repeat statement */
150
+ #define vpiRepeatControl 52 /* repeat control in an assign stmt */
151
+ #define vpiSchedEvent 53 /* vpi_put_value() event */
152
+ #define vpiSpecParam 54 /* specparam */
153
+ #define vpiSwitch 55 /* transistor switch */
154
+ #define vpiSysFuncCall 56 /* system function call */
155
+ #define vpiSysTaskCall 57 /* system task call */
156
+ #define vpiTableEntry 58 /* UDP state table entry */
157
+ #define vpiTask 59 /* HDL task */
158
+ #define vpiTaskCall 60 /* HDL task call */
159
+ #define vpiTchk 61 /* timing check */
160
+ #define vpiTchkTerm 62 /* terminal of timing check */
161
+ #define vpiTimeVar 63 /* time variable */
162
+ #define vpiTimeQueue 64 /* simulation event queue */
163
+ #define vpiUdp 65 /* user-defined primitive */
164
+ #define vpiUdpDefn 66 /* UDP definition */
165
+ #define vpiUserSystf 67 /* user defined system task or function */
166
+ #define vpiVarSelect 68 /* variable array selection */
167
+ #define vpiWait 69 /* wait statement */
168
+ #define vpiWhile 70 /* while statement */
169
+
170
+ /********************** object types added with 1364-2001 *********************/
171
+
172
+ #define vpiAttribute 105 /* attribute of an object */
173
+ #define vpiBitSelect 106 /* Bit-select of parameter, var select */
174
+ #define vpiCallback 107 /* callback object */
175
+ #define vpiDelayTerm 108 /* Delay term which is a load or driver */
176
+ #define vpiDelayDevice 109 /* Delay object within a net */
177
+ #define vpiFrame 110 /* reentrant task/func frame */
178
+ #define vpiGateArray 111 /* gate instance array */
179
+ #define vpiModuleArray 112 /* module instance array */
180
+ #define vpiPrimitiveArray 113 /* vpiprimitiveArray type */
181
+ #define vpiNetArray 114 /* multidimensional net */
182
+ #define vpiRange 115 /* range declaration */
183
+ #define vpiRegArray 116 /* multidimensional reg */
184
+ #define vpiSwitchArray 117 /* switch instance array */
185
+ #define vpiUdpArray 118 /* UDP instance array */
186
+ #define vpiContAssignBit 128 /* Bit of a vector continuous assignment */
187
+ #define vpiNamedEventArray 129 /* multidimensional named event */
188
+
189
+ /********************** object types added with 1364-2005 *********************/
190
+
191
+ #define vpiIndexedPartSelect 130 /* Indexed part-select object */
192
+ #define vpiGenScopeArray 133 /* array of generated scopes */
193
+ #define vpiGenScope 134 /* A generated scope */
194
+ #define vpiGenVar 135 /* Object used to instantiate gen scopes */
195
+
196
+ /*********************************** METHODS **********************************/
197
+ /**************** methods used to traverse 1 to 1 relationships ***************/
198
+
199
+ #define vpiCondition 71 /* condition expression */
200
+ #define vpiDelay 72 /* net or gate delay */
201
+ #define vpiElseStmt 73 /* else statement */
202
+ #define vpiForIncStmt 74 /* increment statement in for loop */
203
+ #define vpiForInitStmt 75 /* initialization statement in for loop */
204
+ #define vpiHighConn 76 /* higher connection to port */
205
+ #define vpiLhs 77 /* left-hand side of assignment */
206
+ #define vpiIndex 78 /* index of var select, bit-select, etc. */
207
+ #define vpiLeftRange 79 /* left range of vector or part-select */
208
+ #define vpiLowConn 80 /* lower connection to port */
209
+ #define vpiParent 81 /* parent object */
210
+ #define vpiRhs 82 /* right-hand side of assignment */
211
+ #define vpiRightRange 83 /* right range of vector or part-select */
212
+ #define vpiScope 84 /* containing scope object */
213
+ #define vpiSysTfCall 85 /* task function call */
214
+ #define vpiTchkDataTerm 86 /* timing check data term */
215
+ #define vpiTchkNotifier 87 /* timing check notifier */
216
+ #define vpiTchkRefTerm 88 /* timing check reference term */
217
+
218
+ /************* methods used to traverse 1 to many relationships ***************/
219
+
220
+ #define vpiArgument 89 /* argument to (system) task/function */
221
+ #define vpiBit 90 /* bit of vector net or port */
222
+ #define vpiDriver 91 /* driver for a net */
223
+ #define vpiInternalScope 92 /* internal scope in module */
224
+ #define vpiLoad 93 /* load on net or reg */
225
+ #define vpiModDataPathIn 94 /* data terminal of a module path */
226
+ #define vpiModPathIn 95 /* Input terminal of a module path */
227
+ #define vpiModPathOut 96 /* output terminal of a module path */
228
+ #define vpiOperand 97 /* operand of expression */
229
+ #define vpiPortInst 98 /* connected port instance */
230
+ #define vpiProcess 99 /* process in module */
231
+ #define vpiVariables 100 /* variables in module */
232
+ #define vpiUse 101 /* usage */
233
+
234
+ /******** methods which can traverse 1 to 1, or 1 to many relationships *******/
235
+
236
+ #define vpiExpr 102 /* connected expression */
237
+ #define vpiPrimitive 103 /* primitive (gate, switch, UDP) */
238
+ #define vpiStmt 104 /* statement in process or task */
239
+
240
+ /************************ methods added with 1364-2001 ************************/
241
+
242
+ #define vpiActiveTimeFormat 119 /* active $timeformat() system task */
243
+ #define vpiInTerm 120 /* To get to a delay device's drivers. */
244
+ #define vpiInstanceArray 121 /* vpiInstance arrays */
245
+ #define vpiLocalDriver 122 /* local drivers (within a module */
246
+ #define vpiLocalLoad 123 /* local loads (within a module */
247
+ #define vpiOutTerm 124 /* To get to a delay device's loads. */
248
+ #define vpiPorts 125 /* Module port */
249
+ #define vpiSimNet 126 /* simulated net after collapsing */
250
+ #define vpiTaskFunc 127 /* HDL task or function */
251
+
252
+ /************************ methods added with 1364-2005 ************************/
253
+
254
+ #define vpiBaseExpr 131 /* Indexed part-select's base expression */
255
+ #define vpiWidthExpr 132 /* Indexed part-select's width expression */
256
+
257
+ /********************************* PROPERTIES *********************************/
258
+ /************************** generic object properties *************************/
259
+
260
+ #define vpiUndefined -1 /* undefined property */
261
+ #define vpiType 1 /* type of object */
262
+ #define vpiName 2 /* local name of object */
263
+ #define vpiFullName 3 /* full hierarchical name */
264
+ #define vpiSize 4 /* size of gate, net, port, etc. */
265
+ #define vpiFile 5 /* File name in which the object is used*/
266
+ #define vpiLineNo 6 /* line number where the object is used */
267
+
268
+ /***************************** module properties ******************************/
269
+
270
+ #define vpiTopModule 7 /* top-level module (boolean) */
271
+ #define vpiCellInstance 8 /* cell (boolean) */
272
+ #define vpiDefName 9 /* module definition name */
273
+ #define vpiProtected 10 /* source protected module (boolean) */
274
+ #define vpiTimeUnit 11 /* module time unit */
275
+ #define vpiTimePrecision 12 /* module time precision */
276
+ #define vpiDefNetType 13 /* default net type */
277
+ #define vpiUnconnDrive 14 /* unconnected port drive strength */
278
+ #define vpiHighZ 1 /* No default drive given */
279
+ #define vpiPull1 2 /* default pull1 drive */
280
+ #define vpiPull0 3 /* default pull0 drive */
281
+ #define vpiDefFile 15 /* File name where the module is defined*/
282
+ #define vpiDefLineNo 16 /* line number for module definition */
283
+ #define vpiDefDelayMode 47 /* Default delay mode for a module */
284
+ #define vpiDelayModeNone 1 /* no delay mode specified */
285
+ #define vpiDelayModePath 2 /* path delay mode */
286
+ #define vpiDelayModeDistrib 3 /* distributed delay mode */
287
+ #define vpiDelayModeUnit 4 /* unit delay mode */
288
+ #define vpiDelayModeZero 5 /* zero delay mode */
289
+ #define vpiDelayModeMTM 6 /* min:typ:max delay mode */
290
+ #define vpiDefDecayTime 48 /* Default decay time for a module */
291
+
292
+ /*************************** port and net properties **************************/
293
+
294
+ #define vpiScalar 17 /* scalar (boolean) */
295
+ #define vpiVector 18 /* vector (boolean) */
296
+ #define vpiExplicitName 19 /* port is explicitly named */
297
+ #define vpiDirection 20 /* direction of port: */
298
+ #define vpiInput 1 /* input */
299
+ #define vpiOutput 2 /* output */
300
+ #define vpiInout 3 /* inout */
301
+ #define vpiMixedIO 4 /* mixed input-output */
302
+ #define vpiNoDirection 5 /* no direction */
303
+ #define vpiConnByName 21 /* connected by name (boolean) */
304
+
305
+ #define vpiNetType 22 /* net subtypes: */
306
+ #define vpiWire 1 /* wire net */
307
+ #define vpiWand 2 /* wire-and net */
308
+ #define vpiWor 3 /* wire-or net */
309
+ #define vpiTri 4 /* three-state net */
310
+ #define vpiTri0 5 /* pull-down net */
311
+ #define vpiTri1 6 /* pull-up net */
312
+ #define vpiTriReg 7 /* tri state reg net */
313
+ #define vpiTriAnd 8 /* three-state wire-and net */
314
+ #define vpiTriOr 9 /* three-state wire-or net */
315
+ #define vpiSupply1 10 /* supply 1 net */
316
+ #define vpiSupply0 11 /* supply zero net */
317
+ #define vpiNone 12 /* no default net type (1364-2001) */
318
+ #define vpiUwire 13 /* unresolved wire net (1364-2005) */
319
+
320
+ #define vpiExplicitScalared 23 /* explicitly scalared (boolean) */
321
+ #define vpiExplicitVectored 24 /* explicitly vectored (boolean) */
322
+ #define vpiExpanded 25 /* expanded vector net (boolean) */
323
+ #define vpiImplicitDecl 26 /* implicitly declared net (boolean) */
324
+ #define vpiChargeStrength 27 /* charge decay strength of net */
325
+
326
+ /* Defined as part of strengths section.
327
+ #define vpiLargeCharge 0x10
328
+ #define vpiMediumCharge 0x04
329
+ #define vpiSmallCharge 0x02
330
+ */
331
+
332
+ #define vpiArray 28 /* variable array (boolean) */
333
+ #define vpiPortIndex 29 /* Port index */
334
+
335
+ /************************ gate and terminal properties ************************/
336
+
337
+ #define vpiTermIndex 30 /* Index of a primitive terminal */
338
+ #define vpiStrength0 31 /* 0-strength of net or gate */
339
+ #define vpiStrength1 32 /* 1-strength of net or gate */
340
+ #define vpiPrimType 33 /* prmitive subtypes: */
341
+ #define vpiAndPrim 1 /* and gate */
342
+ #define vpiNandPrim 2 /* nand gate */
343
+ #define vpiNorPrim 3 /* nor gate */
344
+ #define vpiOrPrim 4 /* or gate */
345
+ #define vpiXorPrim 5 /* xor gate */
346
+ #define vpiXnorPrim 6 /* xnor gate */
347
+ #define vpiBufPrim 7 /* buffer */
348
+ #define vpiNotPrim 8 /* not gate */
349
+ #define vpiBufif0Prim 9 /* zero-enabled buffer */
350
+ #define vpiBufif1Prim 10 /* one-enabled buffer */
351
+ #define vpiNotif0Prim 11 /* zero-enabled not gate */
352
+ #define vpiNotif1Prim 12 /* one-enabled not gate */
353
+ #define vpiNmosPrim 13 /* nmos switch */
354
+ #define vpiPmosPrim 14 /* pmos switch */
355
+ #define vpiCmosPrim 15 /* cmos switch */
356
+ #define vpiRnmosPrim 16 /* resistive nmos switch */
357
+ #define vpiRpmosPrim 17 /* resistive pmos switch */
358
+ #define vpiRcmosPrim 18 /* resistive cmos switch */
359
+ #define vpiRtranPrim 19 /* resistive bidirectional */
360
+ #define vpiRtranif0Prim 20 /* zero-enable resistive bidirectional */
361
+ #define vpiRtranif1Prim 21 /* one-enable resistive bidirectional */
362
+ #define vpiTranPrim 22 /* bidirectional */
363
+ #define vpiTranif0Prim 23 /* zero-enabled bidirectional */
364
+ #define vpiTranif1Prim 24 /* one-enabled bidirectional */
365
+ #define vpiPullupPrim 25 /* pullup */
366
+ #define vpiPulldownPrim 26 /* pulldown */
367
+ #define vpiSeqPrim 27 /* sequential UDP */
368
+ #define vpiCombPrim 28 /* combinational UDP */
369
+
370
+ /**************** path, path terminal, timing check properties ****************/
371
+
372
+ #define vpiPolarity 34 /* polarity of module path... */
373
+ #define vpiDataPolarity 35 /* ...or data path: */
374
+ #define vpiPositive 1 /* positive */
375
+ #define vpiNegative 2 /* negative */
376
+ #define vpiUnknown 3 /* unknown (unspecified) */
377
+
378
+ #define vpiEdge 36 /* edge type of module path: */
379
+ #define vpiNoEdge 0x00 /* no edge */
380
+ #define vpiEdge01 0x01 /* 0 -> 1 */
381
+ #define vpiEdge10 0x02 /* 1 -> 0 */
382
+ #define vpiEdge0x 0x04 /* 0 -> x */
383
+ #define vpiEdgex1 0x08 /* x -> 1 */
384
+ #define vpiEdge1x 0x10 /* 1 -> x */
385
+ #define vpiEdgex0 0x20 /* x -> 0 */
386
+ #define vpiPosedge (vpiEdgex1 | vpiEdge01 | vpiEdge0x)
387
+ #define vpiNegedge (vpiEdgex0 | vpiEdge10 | vpiEdge1x)
388
+ #define vpiAnyEdge (vpiPosedge | vpiNegedge)
389
+
390
+ #define vpiPathType 37 /* path delay connection subtypes: */
391
+ #define vpiPathFull 1 /* ( a *> b ) */
392
+ #define vpiPathParallel 2 /* ( a => b ) */
393
+
394
+ #define vpiTchkType 38 /* timing check subtypes: */
395
+ #define vpiSetup 1 /* $setup */
396
+ #define vpiHold 2 /* $hold */
397
+ #define vpiPeriod 3 /* $period */
398
+ #define vpiWidth 4 /* $width */
399
+ #define vpiSkew 5 /* $skew */
400
+ #define vpiRecovery 6 /* $recovery */
401
+ #define vpiNoChange 7 /* $nochange */
402
+ #define vpiSetupHold 8 /* $setuphold */
403
+ #define vpiFullskew 9 /* $fullskew -- added for 1364-2001 */
404
+ #define vpiRecrem 10 /* $recrem -- added for 1364-2001 */
405
+ #define vpiRemoval 11 /* $removal -- added for 1364-2001 */
406
+ #define vpiTimeskew 12 /* $timeskew -- added for 1364-2001 */
407
+
408
+ /**************************** expression properties ***************************/
409
+
410
+ #define vpiOpType 39 /* operation subtypes: */
411
+ #define vpiMinusOp 1 /* unary minus */
412
+ #define vpiPlusOp 2 /* unary plus */
413
+ #define vpiNotOp 3 /* unary not */
414
+ #define vpiBitNegOp 4 /* bitwise negation */
415
+ #define vpiUnaryAndOp 5 /* bitwise reduction and */
416
+ #define vpiUnaryNandOp 6 /* bitwise reduction nand */
417
+ #define vpiUnaryOrOp 7 /* bitwise reduction or */
418
+ #define vpiUnaryNorOp 8 /* bitwise reduction nor */
419
+ #define vpiUnaryXorOp 9 /* bitwise reduction xor */
420
+ #define vpiUnaryXNorOp 10 /* bitwise reduction xnor */
421
+ #define vpiSubOp 11 /* binary subtraction */
422
+ #define vpiDivOp 12 /* binary division */
423
+ #define vpiModOp 13 /* binary modulus */
424
+ #define vpiEqOp 14 /* binary equality */
425
+ #define vpiNeqOp 15 /* binary inequality */
426
+ #define vpiCaseEqOp 16 /* case (x and z) equality */
427
+ #define vpiCaseNeqOp 17 /* case inequality */
428
+ #define vpiGtOp 18 /* binary greater than */
429
+ #define vpiGeOp 19 /* binary greater than or equal */
430
+ #define vpiLtOp 20 /* binary less than */
431
+ #define vpiLeOp 21 /* binary less than or equal */
432
+ #define vpiLShiftOp 22 /* binary left shift */
433
+ #define vpiRShiftOp 23 /* binary right shift */
434
+ #define vpiAddOp 24 /* binary addition */
435
+ #define vpiMultOp 25 /* binary multiplication */
436
+ #define vpiLogAndOp 26 /* binary logical and */
437
+ #define vpiLogOrOp 27 /* binary logical or */
438
+ #define vpiBitAndOp 28 /* binary bitwise and */
439
+ #define vpiBitOrOp 29 /* binary bitwise or */
440
+ #define vpiBitXorOp 30 /* binary bitwise xor */
441
+ #define vpiBitXNorOp 31 /* binary bitwise xnor */
442
+ #define vpiBitXnorOp vpiBitXNorOp /* added with 1364-2001 */
443
+ #define vpiConditionOp 32 /* ternary conditional */
444
+ #define vpiConcatOp 33 /* n-ary concatenation */
445
+ #define vpiMultiConcatOp 34 /* repeated concatenation */
446
+ #define vpiEventOrOp 35 /* event or */
447
+ #define vpiNullOp 36 /* null operation */
448
+ #define vpiListOp 37 /* list of expressions */
449
+ #define vpiMinTypMaxOp 38 /* min:typ:max: delay expression */
450
+ #define vpiPosedgeOp 39 /* posedge */
451
+ #define vpiNegedgeOp 40 /* negedge */
452
+ #define vpiArithLShiftOp 41 /* arithmetic left shift (1364-2001) */
453
+ #define vpiArithRShiftOp 42 /* arithmetic right shift (1364-2001) */
454
+ #define vpiPowerOp 43 /* arithmetic power op (1364-2001) */
455
+
456
+ #define vpiConstType 40 /* constant subtypes: */
457
+ #define vpiDecConst 1 /* decimal integer */
458
+ #define vpiRealConst 2 /* real */
459
+ #define vpiBinaryConst 3 /* binary integer */
460
+ #define vpiOctConst 4 /* octal integer */
461
+ #define vpiHexConst 5 /* hexadecimal integer */
462
+ #define vpiStringConst 6 /* string literal */
463
+ #define vpiIntConst 7 /* HDL integer constant (1364-2001) */
464
+
465
+ #define vpiBlocking 41 /* blocking assignment (boolean) */
466
+ #define vpiCaseType 42 /* case statement subtypes: */
467
+ #define vpiCaseExact 1 /* exact match */
468
+ #define vpiCaseX 2 /* ignore X's */
469
+ #define vpiCaseZ 3 /* ignore Z's */
470
+ #define vpiNetDeclAssign 43 /* assign part of decl (boolean) */
471
+
472
+ /************************** task/function properties **************************/
473
+
474
+ #define vpiFuncType 44 /* HDL function & system function type */
475
+ #define vpiIntFunc 1 /* returns integer */
476
+ #define vpiRealFunc 2 /* returns real */
477
+ #define vpiTimeFunc 3 /* returns time */
478
+ #define vpiSizedFunc 4 /* returns an arbitrary size */
479
+ #define vpiSizedSignedFunc 5 /* returns sized signed value */
480
+
481
+ /** alias 1364-1995 system function subtypes to 1364-2001 function subtypes ***/
482
+
483
+ #define vpiSysFuncType vpiFuncType
484
+ #define vpiSysFuncInt vpiIntFunc
485
+ #define vpiSysFuncReal vpiRealFunc
486
+ #define vpiSysFuncTime vpiTimeFunc
487
+ #define vpiSysFuncSized vpiSizedFunc
488
+
489
+ #define vpiUserDefn 45 /*user defined system task/func(boolean)*/
490
+ #define vpiScheduled 46 /* object still scheduled (boolean) */
491
+
492
+ /*********************** properties added with 1364-2001 **********************/
493
+
494
+ #define vpiActive 49 /* reentrant task/func frame is active */
495
+ #define vpiAutomatic 50 /* task/func obj is automatic */
496
+ #define vpiCell 51 /* configuration cell */
497
+ #define vpiConfig 52 /* configuration config file */
498
+ #define vpiConstantSelect 53 /* (boolean) bit-select or part-select
499
+ indices are constant expressions */
500
+ #define vpiDecompile 54 /* decompile the object */
501
+ #define vpiDefAttribute 55 /* Attribute defined for the obj */
502
+ #define vpiDelayType 56 /* delay subtype */
503
+ #define vpiModPathDelay 1 /* module path delay */
504
+ #define vpiInterModPathDelay 2 /* intermodule path delay */
505
+ #define vpiMIPDelay 3 /* module input port delay */
506
+ #define vpiIteratorType 57 /* object type of an iterator */
507
+ #define vpiLibrary 58 /* configuration library */
508
+ #define vpiMultiArray 59 /* Object is a multidimensional array */
509
+ #define vpiOffset 60 /* offset from LSB */
510
+ #define vpiResolvedNetType 61 /* net subtype after resolution, returns
511
+ same subtypes as vpiNetType */
512
+ #define vpiSaveRestartID 62 /* unique ID for save/restart data */
513
+ #define vpiSaveRestartLocation 63 /* name of save/restart data file */
514
+ #define vpiValid 64 /* reentrant task/func frame is valid */
515
+ #define vpiSigned 65 /* TRUE for vpiIODecl and any object in
516
+ the expression class if the object
517
+ has the signed attribute */
518
+ #define vpiLocalParam 70 /* TRUE when a param is declared as a
519
+ localparam */
520
+ #define vpiModPathHasIfNone 71 /* Mod path has an ifnone statement */
521
+
522
+ /*********************** properties added with 1364-2005 **********************/
523
+
524
+ #define vpiIndexedPartSelectType 72 /* Indexed part-select type */
525
+ #define vpiPosIndexed 1 /* +: */
526
+ #define vpiNegIndexed 2 /* -: */
527
+ #define vpiIsMemory 73 /* TRUE for a one-dimensional reg array */
528
+
529
+ /*************** vpi_control() constants (added with 1364-2001) ***************/
530
+
531
+ #define vpiStop 66 /* execute simulator's $stop */
532
+ #define vpiFinish 67 /* execute simulator's $finish */
533
+ #define vpiReset 68 /* execute simulator's $reset */
534
+ #define vpiSetInteractiveScope 69 /* set simulator's interactive scope */
535
+
536
+ /**************************** I/O related defines *****************************/
537
+
538
+ #define VPI_MCD_STDOUT 0x00000001
539
+
540
+ /*************************** STRUCTURE DEFINITIONS ****************************/
541
+
542
+ /******************************* time structure *******************************/
543
+
544
+ typedef struct t_vpi_time
545
+ {
546
+ PLI_INT32 type; /* [vpiScaledRealTime, vpiSimTime,
547
+ vpiSuppressTime] */
548
+ PLI_UINT32 high, low; /* for vpiSimTime */
549
+ double real; /* for vpiScaledRealTime */
550
+ } s_vpi_time, *p_vpi_time;
551
+
552
+ /* time types */
553
+
554
+ #define vpiScaledRealTime 1
555
+ #define vpiSimTime 2
556
+ #define vpiSuppressTime 3
557
+
558
+ /****************************** delay structures ******************************/
559
+
560
+ typedef struct t_vpi_delay
561
+ {
562
+ struct t_vpi_time *da; /* pointer to user allocated array of
563
+ delay values */
564
+ PLI_INT32 no_of_delays; /* number of delays */
565
+ PLI_INT32 time_type; /* [vpiScaledRealTime, vpiSimTime,
566
+ vpiSuppressTime] */
567
+ PLI_INT32 mtm_flag; /* true for mtm values */
568
+ PLI_INT32 append_flag; /* true for append */
569
+ PLI_INT32 pulsere_flag; /* true for pulsere values */
570
+ } s_vpi_delay, *p_vpi_delay;
571
+
572
+ /***************************** value structures *******************************/
573
+
574
+ /* vector value */
575
+
576
+ #ifndef VPI_VECVAL /* added in 1364-2005 */
577
+ #define VPI_VECVAL
578
+
579
+ typedef struct t_vpi_vecval
580
+ {
581
+ /* following fields are repeated enough times to contain vector */
582
+ PLI_INT32 aval, bval; /* bit encoding: ab: 00=0, 10=1, 11=X, 01=Z */
583
+ } s_vpi_vecval, *p_vpi_vecval;
584
+
585
+ #endif
586
+
587
+ /* strength (scalar) value */
588
+
589
+ typedef struct t_vpi_strengthval
590
+ {
591
+ PLI_INT32 logic; /* vpi[0,1,X,Z] */
592
+ PLI_INT32 s0, s1; /* refer to strength coding below */
593
+ } s_vpi_strengthval, *p_vpi_strengthval;
594
+
595
+ /* strength values */
596
+
597
+ #define vpiSupplyDrive 0x80
598
+ #define vpiStrongDrive 0x40
599
+ #define vpiPullDrive 0x20
600
+ #define vpiWeakDrive 0x08
601
+ #define vpiLargeCharge 0x10
602
+ #define vpiMediumCharge 0x04
603
+ #define vpiSmallCharge 0x02
604
+ #define vpiHiZ 0x01
605
+
606
+ /* generic value */
607
+
608
+ typedef struct t_vpi_value
609
+ {
610
+ PLI_INT32 format; /* vpi[[Bin,Oct,Dec,Hex]Str,Scalar,Int,Real,String,
611
+ Vector,Strength,Suppress,Time,ObjType]Val */
612
+ union
613
+ {
614
+ PLI_BYTE8 *str; /* string value */
615
+ PLI_INT32 scalar; /* vpi[0,1,X,Z] */
616
+ PLI_INT32 integer; /* integer value */
617
+ double real; /* real value */
618
+ struct t_vpi_time *time; /* time value */
619
+ struct t_vpi_vecval *vector; /* vector value */
620
+ struct t_vpi_strengthval *strength; /* strength value */
621
+ PLI_BYTE8 *misc; /* ...other */
622
+ } value;
623
+ } s_vpi_value, *p_vpi_value;
624
+
625
+ /* value formats */
626
+
627
+ #define vpiBinStrVal 1
628
+ #define vpiOctStrVal 2
629
+ #define vpiDecStrVal 3
630
+ #define vpiHexStrVal 4
631
+ #define vpiScalarVal 5
632
+ #define vpiIntVal 6
633
+ #define vpiRealVal 7
634
+ #define vpiStringVal 8
635
+ #define vpiVectorVal 9
636
+ #define vpiStrengthVal 10
637
+ #define vpiTimeVal 11
638
+ #define vpiObjTypeVal 12
639
+ #define vpiSuppressVal 13
640
+
641
+ /* delay modes */
642
+
643
+ #define vpiNoDelay 1
644
+ #define vpiInertialDelay 2
645
+ #define vpiTransportDelay 3
646
+ #define vpiPureTransportDelay 4
647
+
648
+ /* force and release flags */
649
+
650
+ #define vpiForceFlag 5
651
+ #define vpiReleaseFlag 6
652
+
653
+ /* scheduled event cancel flag */
654
+
655
+ #define vpiCancelEvent 7
656
+
657
+ /* bit mask for the flags argument to vpi_put_value() */
658
+
659
+ #define vpiReturnEvent 0x1000
660
+
661
+ /* scalar values */
662
+
663
+ #define vpi0 0
664
+ #define vpi1 1
665
+ #define vpiZ 2
666
+ #define vpiX 3
667
+ #define vpiH 4
668
+ #define vpiL 5
669
+ #define vpiDontCare 6
670
+ /*
671
+ #define vpiNoChange 7 Defined under vpiTchkType, but
672
+ can be used here.
673
+ */
674
+
675
+ /*********************** system task/function structure ***********************/
676
+
677
+ typedef struct t_vpi_systf_data
678
+ {
679
+ PLI_INT32 type; /* vpiSysTask, vpiSysFunc */
680
+ PLI_INT32 sysfunctype; /* vpiSysTask, vpi[Int,Real,Time,Sized,
681
+ SizedSigned]Func */
682
+ PLI_BYTE8 *tfname; /* first character must be '$' */
683
+ PLI_INT32 (*calltf)(PLI_BYTE8 *);
684
+ PLI_INT32 (*compiletf)(PLI_BYTE8 *);
685
+ PLI_INT32 (*sizetf)(PLI_BYTE8 *); /* for sized function callbacks only */
686
+ PLI_BYTE8 *user_data;
687
+ } s_vpi_systf_data, *p_vpi_systf_data;
688
+
689
+ #define vpiSysTask 1
690
+ #define vpiSysFunc 2
691
+
692
+ /* the subtypes are defined under the vpiFuncType property */
693
+
694
+ /****************** Verilog execution information structure *******************/
695
+
696
+ typedef struct t_vpi_vlog_info
697
+ {
698
+ PLI_INT32 argc;
699
+ PLI_BYTE8 **argv;
700
+ PLI_BYTE8 *product;
701
+ PLI_BYTE8 *version;
702
+ } s_vpi_vlog_info, *p_vpi_vlog_info;
703
+
704
+ /*********************** PLI error information structure **********************/
705
+
706
+ typedef struct t_vpi_error_info
707
+ {
708
+ PLI_INT32 state; /* vpi[Compile,PLI,Run] */
709
+ PLI_INT32 level; /* vpi[Notice,Warning,Error,System,Internal] */
710
+ PLI_BYTE8 *message;
711
+ PLI_BYTE8 *product;
712
+ PLI_BYTE8 *code;
713
+ PLI_BYTE8 *file;
714
+ PLI_INT32 line;
715
+ } s_vpi_error_info, *p_vpi_error_info;
716
+
717
+ /* state when error occurred */
718
+
719
+ #define vpiCompile 1
720
+ #define vpiPLI 2
721
+ #define vpiRun 3
722
+
723
+ /* error severity levels */
724
+
725
+ #define vpiNotice 1
726
+ #define vpiWarning 2
727
+ #define vpiError 3
728
+ #define vpiSystem 4
729
+ #define vpiInternal 5
730
+
731
+ /**************************** callback structures *****************************/
732
+
733
+ /* normal callback structure */
734
+
735
+ typedef struct t_cb_data
736
+ {
737
+ PLI_INT32 reason; /* callback reason */
738
+ PLI_INT32 (*cb_rtn)(struct t_cb_data *); /* call routine */
739
+ vpiHandle obj; /* trigger object */
740
+ p_vpi_time time; /* callback time */
741
+ p_vpi_value value; /* trigger object value */
742
+ PLI_INT32 index; /* index of the memory word or
743
+ var select that changed */
744
+ PLI_BYTE8 *user_data;
745
+ } s_cb_data, *p_cb_data;
746
+
747
+ /****************************** CALLBACK REASONS ******************************/
748
+ /***************************** Simulation related *****************************/
749
+
750
+ #define cbValueChange 1
751
+ #define cbStmt 2
752
+ #define cbForce 3
753
+ #define cbRelease 4
754
+
755
+ /******************************** Time related ********************************/
756
+
757
+ #define cbAtStartOfSimTime 5
758
+ #define cbReadWriteSynch 6
759
+ #define cbReadOnlySynch 7
760
+ #define cbNextSimTime 8
761
+ #define cbAfterDelay 9
762
+
763
+ /******************************* Action related *******************************/
764
+
765
+ #define cbEndOfCompile 10
766
+ #define cbStartOfSimulation 11
767
+ #define cbEndOfSimulation 12
768
+ #define cbError 13
769
+ #define cbTchkViolation 14
770
+ #define cbStartOfSave 15
771
+ #define cbEndOfSave 16
772
+ #define cbStartOfRestart 17
773
+ #define cbEndOfRestart 18
774
+ #define cbStartOfReset 19
775
+ #define cbEndOfReset 20
776
+ #define cbEnterInteractive 21
777
+ #define cbExitInteractive 22
778
+ #define cbInteractiveScopeChange 23
779
+ #define cbUnresolvedSystf 24
780
+
781
+ /**************************** Added with 1364-2001 ****************************/
782
+
783
+ #define cbAssign 25
784
+ #define cbDeassign 26
785
+ #define cbDisable 27
786
+ #define cbPLIError 28
787
+ #define cbSignal 29
788
+
789
+ /**************************** FUNCTION DECLARATIONS ***************************/
790
+
791
+ /* callback related */
792
+
793
+ XXTERN vpiHandle vpi_register_cb PROTO_PARAMS((p_cb_data cb_data_p));
794
+ XXTERN PLI_INT32 vpi_remove_cb PROTO_PARAMS((vpiHandle cb_obj));
795
+ XXTERN void vpi_get_cb_info PROTO_PARAMS((vpiHandle object,
796
+ p_cb_data cb_data_p));
797
+ XXTERN vpiHandle vpi_register_systf PROTO_PARAMS((p_vpi_systf_data
798
+ systf_data_p));
799
+ XXTERN void vpi_get_systf_info PROTO_PARAMS((vpiHandle object,
800
+ p_vpi_systf_data
801
+ systf_data_p));
802
+
803
+ /* for obtaining handles */
804
+
805
+ XXTERN vpiHandle vpi_handle_by_name PROTO_PARAMS((PLI_BYTE8 *name,
806
+ vpiHandle scope));
807
+ XXTERN vpiHandle vpi_handle_by_index PROTO_PARAMS((vpiHandle object,
808
+ PLI_INT32 indx));
809
+
810
+ /* for traversing relationships */
811
+
812
+ XXTERN vpiHandle vpi_handle PROTO_PARAMS((PLI_INT32 type,
813
+ vpiHandle refHandle));
814
+ XXTERN vpiHandle vpi_handle_multi PROTO_PARAMS((PLI_INT32 type,
815
+ vpiHandle refHandle1,
816
+ vpiHandle refHandle2,
817
+ ... ));
818
+ XXTERN vpiHandle vpi_iterate PROTO_PARAMS((PLI_INT32 type,
819
+ vpiHandle refHandle));
820
+ XXTERN vpiHandle vpi_scan PROTO_PARAMS((vpiHandle iterator));
821
+
822
+ /* for processing properties */
823
+
824
+ XXTERN PLI_INT32 vpi_get PROTO_PARAMS((PLI_INT32 property,
825
+ vpiHandle object));
826
+ XXTERN PLI_BYTE8 *vpi_get_str PROTO_PARAMS((PLI_INT32 property,
827
+ vpiHandle object));
828
+
829
+ /* delay processing */
830
+
831
+ XXTERN void vpi_get_delays PROTO_PARAMS((vpiHandle object,
832
+ p_vpi_delay delay_p));
833
+ XXTERN void vpi_put_delays PROTO_PARAMS((vpiHandle object,
834
+ p_vpi_delay delay_p));
835
+
836
+ /* value processing */
837
+
838
+ XXTERN void vpi_get_value PROTO_PARAMS((vpiHandle expr,
839
+ p_vpi_value value_p));
840
+ XXTERN vpiHandle vpi_put_value PROTO_PARAMS((vpiHandle object,
841
+ p_vpi_value value_p,
842
+ p_vpi_time time_p,
843
+ PLI_INT32 flags));
844
+
845
+ /* time processing */
846
+
847
+ XXTERN void vpi_get_time PROTO_PARAMS((vpiHandle object,
848
+ p_vpi_time time_p));
849
+
850
+ /* I/O routines */
851
+
852
+ XXTERN PLI_UINT32 vpi_mcd_open PROTO_PARAMS((PLI_BYTE8 *fileName));
853
+ XXTERN PLI_UINT32 vpi_mcd_close PROTO_PARAMS((PLI_UINT32 mcd));
854
+ XXTERN PLI_BYTE8 *vpi_mcd_name PROTO_PARAMS((PLI_UINT32 cd));
855
+ XXTERN PLI_INT32 vpi_mcd_printf PROTO_PARAMS((PLI_UINT32 mcd,
856
+ PLI_BYTE8 *format,
857
+ ...));
858
+ XXTERN PLI_INT32 vpi_printf PROTO_PARAMS((PLI_BYTE8 *format,
859
+ ...));
860
+
861
+ /* utility routines */
862
+
863
+ XXTERN PLI_INT32 vpi_compare_objects PROTO_PARAMS((vpiHandle object1,
864
+ vpiHandle object2));
865
+ XXTERN PLI_INT32 vpi_chk_error PROTO_PARAMS((p_vpi_error_info
866
+ error_info_p));
867
+ XXTERN PLI_INT32 vpi_free_object PROTO_PARAMS((vpiHandle object));
868
+ XXTERN PLI_INT32 vpi_get_vlog_info PROTO_PARAMS((p_vpi_vlog_info
869
+ vlog_info_p));
870
+
871
+ /* routines added with 1364-2001 */
872
+
873
+ XXTERN PLI_INT32 vpi_get_data PROTO_PARAMS((PLI_INT32 id,
874
+ PLI_BYTE8 *dataLoc,
875
+ PLI_INT32 numOfBytes));
876
+ XXTERN PLI_INT32 vpi_put_data PROTO_PARAMS((PLI_INT32 id,
877
+ PLI_BYTE8 *dataLoc,
878
+ PLI_INT32 numOfBytes));
879
+ XXTERN void *vpi_get_userdata PROTO_PARAMS((vpiHandle obj));
880
+ XXTERN PLI_INT32 vpi_put_userdata PROTO_PARAMS((vpiHandle obj,
881
+ void *userdata));
882
+ XXTERN PLI_INT32 vpi_vprintf PROTO_PARAMS((PLI_BYTE8 *format,
883
+ va_list ap));
884
+ XXTERN PLI_INT32 vpi_mcd_vprintf PROTO_PARAMS((PLI_UINT32 mcd,
885
+ PLI_BYTE8 *format,
886
+ va_list ap));
887
+ XXTERN PLI_INT32 vpi_flush PROTO_PARAMS((void));
888
+ XXTERN PLI_INT32 vpi_mcd_flush PROTO_PARAMS((PLI_UINT32 mcd));
889
+ XXTERN PLI_INT32 vpi_control PROTO_PARAMS((PLI_INT32 operation,
890
+ ...));
891
+ XXTERN vpiHandle vpi_handle_by_multi_index PROTO_PARAMS((vpiHandle obj,
892
+ PLI_INT32 num_index,
893
+ PLI_INT32 *index_array));
894
+
895
+ /****************************** GLOBAL VARIABLES ******************************/
896
+
897
+ PLI_VEXTERN PLI_DLLESPEC void (*vlog_startup_routines[])(void);
898
+
899
+ /* array of function pointers, last pointer should be null */
900
+
901
+ #undef PLI_EXTERN
902
+ #undef PLI_VEXTERN
903
+
904
+ #ifdef VPI_USER_DEFINED_DLLISPEC
905
+ #undef VPI_USER_DEFINED_DLLISPEC
906
+ #undef PLI_DLLISPEC
907
+ #endif
908
+ #ifdef VPI_USER_DEFINED_DLLESPEC
909
+ #undef VPI_USER_DEFINED_DLLESPEC
910
+ #undef PLI_DLLESPEC
911
+ #endif
912
+
913
+ #ifdef PLI_PROTOTYPES
914
+ #undef PLI_PROTOTYPES
915
+ #undef PROTO_PARAMS
916
+ #undef XXTERN
917
+ #undef EETERN
918
+ #endif
919
+
920
+ #ifdef __cplusplus
921
+ }
922
+ #endif
923
+
924
+ #endif /* VPI_USER_H */