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