1 /* Copyright (c) 1991-2007 Pragmatic C Software Corp. */
2 
3 /*
4    This program is free software; you can redistribute it and/or modify it
5    under the terms of the GNU General Public License as published by the
6    Free Software Foundation; either version 2 of the License, or (at your
7    option) any later version.
8 
9    This program is distributed in the hope that it will be useful, but
10    WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    General Public License for more details.
13 
14    You should have received a copy of the GNU General Public License along
15    with this program; if not, write to the Free Software Foundation, Inc.,
16    59 Temple Place, Suite 330, Boston, MA, 02111-1307.
17 
18    We are selling our new Verilog compiler that compiles to X86 Linux
19    assembly language.  It is at least two times faster for accurate gate
20    level designs and much faster for procedural designs.  The new
21    commercial compiled Verilog product is called CVC.  For more information
22    on CVC visit our website at www.pragmatic-c.com/cvc.htm or contact
23    Andrew at avanvick@pragmatic-c.com
24 
25  */
26 
27 
28 #define VERS "GPLCVER_2"
29 
30 #define VERS2 ".12a"
31 
32 #define OFDT "05/16/07"
33 #define OUTLINLEN 71          /* length of output file line */
34 #define DFLTIOWORDS 8         /* preallocated size for I/O and work values */
35 #define MUSTFREEWORDS 64      /* for stk values wider free when done */
36 /* ? for debugging */
37 /* #define DFLTIOWORDS 1 */   /* preallocated size for I/O and work values */
38 /* #define MUSTFREEWORDS 1 */ /* for stk values wider free when done */
39 
40 #define MAXNUMBITS 1000000    /* allowing 1 million for now */
41 #define MAXNUMPORTS 1000000   /* index must fit in 20 bits so 1 million max */
42 #define MAXXNEST 256          /* initial exp. eval. stack depth - grows */
43 #define MAXFCNEST 256         /* initial fcall eval stack depth - grows */
44 #define XNESTFIXINC 0x4096    /* increase xpr stack by this */
45 #define IDCHARS 4090          /* max. ID length (need 7 for unique) */
46 #define IDLEN 4097            /* size of string to hold ID */
47 #define RECLEN 4097           /* length for normal temp string (plus \0) */
48 #define MSGTRUNCLEN 1265      /* for msg len. to trunc to (... end) - id fit */
49 #define TRTRUNCLEN 66         /* for tracing truncate length (short) */
50 #define MAXFILS 500           /* start number of in and lib. files (grows) */
51 #define MAXFILNEST 1024       /* max. num. of `include macro nestings */
52 #define MAXLEVELS 800         /* max. num. nested param/task/block decls */
53 #define MAXGLBCOMPS 800       /* max. components in global name */
54 #define MAXLBEXTS 512         /* max. no. of -y library extensions */
55 #define MAXINCDIRS 2048       /* max. no. of +incidr search paths files */
56 #define MAXNOOPTMODS 2048     /* max. no of +optimize_off module names */
57 #define MAXUPRTS 11           /* max. no. of udp ports */
58 #define UALTREPIPNUM 7        /* lowest port number to use slower udp rep */
59 #define TWHINITSIZE 4000      /* size of fixed timing wheel */
60 #define MAXVERIUSERTFS 4095   /* maximum number of pli veriusertfs tfs */
61 #define SYSTFDATSIZE 256      /* starting size of vpi_ systf table (grows) */
62 #define BASE_VERIUSERTFS 1000 /* base for pli (veriuser) system tf_s */
63 #define MAXITDPTH 800         /* dpth of itstk */
64 #define MAXCIRDPTH 4096       /* maximum depth of a circuit */
65 #define IAHISTSIZ 256         /* start history list line and command size */
66 #define INFLOOP_MAX 1000      /* stages with time move for loop checking */
67 #define DFLT_SNAP_EVS 5       /* default number futuren events to print */
68 #define GDVAL 0x400           /* good value */
69 #define BDVAL 1000            /* bad value */
70 #define TOPVPIVAL 1023        /* biggest vpi define const value (MUST EXTND) */
71 #define PVH_MAGIC 0x625       /* 11 bit vpi handle magic number */
72 
73 #define MAXPRPSTNEST 800      /* maximum statement nesting */
74 #define MAXBTDPTH 40          /* maximum depth of timing q (3**40)/2 or so */
75 #define BTREEMAXWID 8         /* max. b tree node width (usually .5 full) */
76 
77 #define BIG_ALLOC_SIZE 0x3ff8 /* size of block to allocate at once */
78 #define VPI_OBJALLOCNUM 2048  /* number of vpi object to allocate at once */
79 #define RDBUFSIZ 0x4000       /* source list buffer size */
80 #define DVBUFSIZ 0x10000      /* 256k buffer for dumpvars output */
81 #define MAX_ERRORS 32         /* error limit in one run */
82 #define MAXEMSGNUM 4000       /* highest possible any type error num */
83 
84 #define MY_FOPEN_MAX 1024     /* guess at OS process max open stdio.h wrong */
85 
86 typedef unsigned long word32;
87 typedef long sword32;
88 typedef int int32;
89 typedef unsigned long long word64;
90 typedef long long sword64;
91 typedef unsigned char byte;
92 typedef unsigned short hword;
93 typedef short hsword;
94 typedef int32 i_tev_ndx;
95 /* needed to allow signals to use normal decls */
96 typedef int32 sighandler();
97 
98 #ifndef __sparc
99 /* BEWARE - assuming all non sparc systems define BYTE_ORDER and endian.h */
100 /* to PORT change for your system */
101 # ifdef __APPLE__
102 #  include <sys/types.h>
103 # else
104 #  ifdef __CYGWIN32__
105 #   include <sys/param.h>
106 #  else
107 #   ifdef __FreeBSD__
108 #    include <sys/endian.h>
109 #   else
110 #    include <endian.h>
111 #   endif
112 #  endif
113 # endif
114 
115 typedef union {
116  word64 w64v;
117 #if (BYTE_ORDER == BIG_ENDIAN)
118  struct { word32 high; word32 low; } w_u;
119 #else
120  struct { word32 low; word32 high; } w_u;
121 #endif
122 } w64_u;
123 #else
124 
125 typedef union {
126  word64 w64v;
127 #if defined(_BIG_ENDIAN)
128  struct { word32 high; word32 low; } w_u;
129 #else
130  struct { word32 low; word32 high; } w_u;
131 #endif
132 } w64_u;
133 #endif
134 
135 #define TRUE 1
136 #define FALSE 0
137 #define WBITS 32
138 #define LWBITS 64
139 #define WRDBYTES 4
140 #define MAXWSWRDS ((MAXEMSGNUM + WBITS)/WBITS)
141 #define TIMEBITS 64
142 #define WORDMASK_ULL 0xffffffffULL
143 #define ALL1W 0xffffffff
144 #define ALL1HW 0xffff
145 #define SHORTBASE (1 << (WBITS/2))
146 
147 /* these values are IEEE */
148 #define REALBITS 32           /* 64 bit double - but no no b part */
149 #define LG2_DIV_LG10 0.3010299956639812
150 #define EPSILON 2.2204460492503131E-16  /* float.h dbl == diff. amount */
151 #define _DEXPLEN 11           /* double exp. len (not incl. sign) */
152 
153 /* number base constants */
154 #define BHEX 0
155 #define BBIN 1
156 #define BOCT 2
157 #define BDEC 3
158 #define BDBLE 4               /* special base for printing */
159 #define BNONE 5               /* indicator for no base override */
160 /* debugger only bases */
161 #define BCHAR 6               /* force treatment as char */
162 #define BSTR 7                /* froce treatment as string */
163 
164 /* net representation forms */
165 #define NX_CT 0
166 #define NX_ARR 1
167 #define NX_DWIR 2
168 #define NX_WIR 3
169 #define NX_SCALWIR 4          /* for scalar empty range field */
170 
171 /* net storage representation forms */
172 #define SR_VEC 0
173 #define SR_SVEC 1
174 #define SR_SCAL 2
175 #define SR_SSCAL 3
176 #define SR_ARRAY 4
177 #define SR_PVEC 5             /* now only used for gates */
178 #define SR_PXPR 6             /* for parameter src. normal rhs expr */
179 #define SR_PISXPR 7           /* for # and defparams, per inst. array of x */
180 #define SR_PNUM 8             /* after fix up simple parameter const. */
181 #define SR_PISNUM 9           /* after fix up IS parameter const. */
182 
183 
184 /* strength types */
185 #define LOW_STREN 1
186 #define HIGH_STREN 2
187 #define CAP_STREN 3
188 
189 /* strength values - must fit in 3 bits */
190 /* notice semantics requires this exact strength assignment for 0 to 7 */
191 #define ST_HIGHZ 0
192 #define ST_SMALL 1
193 #define ST_MEDIUM 2
194 #define ST_WEAK 3
195 #define ST_LARGE 4
196 #define ST_PULL 5
197 #define ST_STRONG 6
198 #define ST_SUPPLY 7
199 
200 /* capacitor sizes */
201 #define CAP_NONE 0
202 #define CAP_SMALL 1
203 #define CAP_MED 2
204 #define CAP_LARGE 3
205 
206 /* 6 bit stren only constants */
207 #define NO_STREN 8            /* never a strength - indicator only */
208 #define ST_STRVAL 0x36        /* (strong0,strong1) 110110 */
209 
210 /* strength and value constants */
211 #define ST_STRONGX ((ST_STRVAL << 2) | 3)
212 #define ST_HIZ 0x02           /* <hiZ:hiZ>=z - 00000010 */
213 #define ST_PULL0 0xb4         /* <Pu:Pu>=0 - 10110100 */
214 #define ST_PULL1 0xb5         /* <Pu:Pu>=1 - 10110101 */
215 #define ST_SUPPLY0 0xfc       /* <Su:Su>=0 - 11111100 */
216 #define ST_SUPPLY1 0xfd       /* <Su:Su>=1 - 11111101 */
217 
218 /* udp types */
219 #define U_COMB 0
220 #define U_LEVEL 1
221 #define U_EDGE 2
222 #define NO_VAL 0x7f           /* misc. empty for byte no edge, no val etc. */
223 
224 /* udp edge values (? and b legal in edges) */
225 #define UV_0 0
226 #define UV_1 1
227 #define UV_X 3
228 #define UV_Q 4
229 #define UV_B 5
230 
231 /* net pin connection types */
232 #define NP_GATE 0
233 #define NP_CONTA 1            /* connects to lhs or rhs of cont. assign */
234 #define NP_PB_ICONN 2         /* per bit form of iconn type - now ld/drv */
235 #define NP_ICONN 3            /* for load down assign, driver to up iconn */
236 #define NP_PB_MDPRT 4         /* per bit mdprt form both drv/ld now */
237 #define NP_MDPRT 5            /* for drvr down port assgn, load up to iconn */
238 /* notice last of in src npps must be mdprt */
239 #define NP_MIPD_NCHG 6        /* for MIPD/interconnect, conn net(s) nchg */
240 #define NP_TCHG 7             /* specify time chg record subtyp determines */
241 #define NP_TRANIF 8           /* third tranif port enable is normal rhs */
242 #define NP_PULL 9             /* constant strength pullup or pulldown drv. */
243 /* PLI only not seen by vpi_ routines */
244 #define NP_TFRWARG 10         /* driver is tf_ task/func is_rw driver */
245 #define NP_VPIPUTV 11         /* driver is vpi_ put value wire driver */
246 /* removed from net drvs after tran channels built - drivers only */
247 #define NP_TRAN 12            /* driver/load for special tran/tranif gate */
248 #define NP_BIDICONN 13
249 #define NP_BIDMDPRT 14
250 
251 /* port direction change net driver states - pre added np list states */
252 #define DRVR_NONE 0           /* net not driven */
253 #define DRVR_NON_PORT 1       /* inout port or gate/conta */
254 #define DRVR_ICONN 2          /* one up iconn inst conn output driver */
255 #define DRVR_MDPRT 3          /* one down mod port input driver */
256 
257 /* parmnplst net pin types - disjoint32 from sim time npps */
258 #define PNP_GATEDEL 0
259 #define PNP_CONTADEL 1
260 #define PNP_NETDEL 2
261 #define PNP_PROCDCTRL 3
262 #define PNP_PATHDEL 4
263 #define PNP_TCHKP1 5
264 #define PNP_TCHKP2 6
265 
266 /* change record subtypes */
267 #define NPCHG_NONE 0
268 #define NPCHG_TCSTART 1
269 #define NPCHG_TCCHK 2
270 #define NPCHG_PTHSRC 3
271 
272 /* kinds of net pin global processing - npgru interpretation */
273 #define XNP_LOC 0
274 #define XNP_DOWNXMR 1
275 #define XNP_RTXMR 2
276 #define XNP_UPXMR 3
277 
278 /* kinds of net pin processing */
279 #define NP_PROC_INMOD 0
280 #define NP_PROC_GREF 1
281 #define NP_PROC_FILT 2
282 
283 /* left hand expression types */
284 #define LHS_DECL 1
285 #define LHS_PROC 2
286 
287 /* tokens types - must < 255 */
288 #define TOK_NONE 0
289 #define ID 1
290 #define BADOBJ 2
291 #define NUMBER 3
292 #define ISNUMBER 4            /* array of constants - cur_itp selects */
293 #define REALNUM 5
294 #define ISREALNUM 6
295 #define LITSTR 7              /* token returned for literal str by scanner */
296 #define OPEMPTY 8             /* unc. expr place holder in expr. list */
297 #define UNCONNPULL 9          /* unc. inst. input port `unconndrive val. */
298 #define RMADDR 10             /* special readmem address token */
299 
300 /* punctuation */
301 #define SEMI 12
302 #define COMMA 13
303 #define COLON 14
304 #define SHARP 15
305 #define LPAR 16
306 #define RPAR 17
307 #define LSB 18                /* [ (also bit select operator) */
308 #define RSB 19
309 #define LCB 20                /* { */
310 #define RCB 21
311 #define DOT 22
312 #define AT 23
313 
314 /* special unary */
315 #define CAUSE 24              /* -> not an expression operator */
316 #define EQ 25                 /* = (assignment but not an expr. lang.) */
317 
318 /* unary only operators - real 0.0 is F for logical */
319 #define BITNOT 26             /* ~ */
320 #define NOT 27                /* ! (logical) */
321 /* real unary only (0.0 if F else T) */
322 #define REALNOT 28
323 
324 /* both unary and binary */
325 #define REDXNOR 29            /* must ^~ - ~^ is 2 unaries */
326 #define PLUS 30               /* + */
327 #define MINUS 31              /* - */
328 #define BITREDAND 32          /* bin & (bit) - un red. and */
329 #define BITREDOR 33           /* bin | (bit) - un red. or */
330 #define BITREDXOR 34          /* bin ^ (bit) - un red. xor */
331 /* both real - notice type must be in operator */
332 /* notice this should have at 5? number */
333 #define REALMINUS 35
334 
335 /* binary operators */
336 #define TIMES 36              /* * */
337 #define DIV 37                /* / */
338 #define MOD 38                /* % */
339 #define RELGE 39              /* >= */
340 #define RELGT 40              /* > */
341 #define RELLE 41              /* <= (also non block cont. assign token) */
342 #define RELLT 42              /* < */
343 #define RELCEQ 43             /* === */
344 #define RELEQ 44              /* == */
345 #define RELCNEQ 45            /* !== */
346 #define RELNEQ 46             /* != */
347 #define BOOLAND 47            /* && */
348 #define BOOLOR 48             /* || */
349 #define SHIFTL 49             /* << */
350 #define ASHIFTL 50            /* <<< - differenet operator but same as << */
351 #define SHIFTR 51             /* >> */
352 #define ASHIFTR 52            /* >>> */
353 #define FPTHCON 53            /* *> (full path conn spfy. op.) */
354 #define PPTHCON 54            /* => (parallel path conn spfy. op.) */
355 #define TCHKEVAND 55          /* &&& (timing check conditional event op.) */
356 /* real binary */
357 #define REALPLUS 56
358 #define REALTIMES 57
359 #define REALDIV 58
360 #define REALRELGT 59
361 #define REALRELGE 60
362 #define REALRELLT 61
363 #define REALRELLE 62
364 #define REALRELEQ 63
365 #define REALRELNEQ 64
366 #define REALBOOLAND 65
367 #define REALBOOLOR 66
368 /* notice logical non bit-wise and non-reduction 0.0 is F */
369 
370 /* special ops */
371 /* special expression operators that do not correspond to read tokens */
372 #define QUEST 67              /* binary ? part of ?: */
373 #define QCOL 68               /* : part of ?: */
374 #define PARTSEL 69            /* part select [ */
375 #define CATCOM 70             /* concatenate comma (really list indicator) */
376 #define CATREP 71             /* concatenate repeat form */
377 #define FCALL 72              /* function call */
378 #define FCCOM 73              /* func/task call , (really list indicator) */
379 #define OPEVOR 74             /* event control or */
380 #define OPEVCOMMAOR 75        /* alternative to event ctrl or - sims same */
381 #define OPPOSEDGE 76          /* posedge in delay ctrl expr. */
382 #define OPNEGEDGE 77          /* negedge in delay ctrl expr. */
383 /* real specials */
384 #define REALREALQUEST 78      /* binary ?  part of ?: - all reals */
385 #define REALREGQUEST 79       /* bin ? part of ?: - real cond : part reg */
386 #define REGREALQCOL 80        /* binary : part of ?: - normal cond : real */
387 
388 /* global expression componnents */
389 #define GLBREF 81             /* this is sort of ID and sort of expr. */
390 #define GLBPTH 82             /* this is global path as XMRID expr (list) */
391 #define XMRID 83              /* ID node that is part of xmr (no sy) */
392 #define XMRCOM 84
393 
394 /* special indicators */
395 #define UNDEF 85              /* toktyp for no pushed back token */
396 #define TEOF 86
397 
398 /* notice unused token no. gap here for addition operators ? */
399 
400 /* these can all appear outside modules - some can appear inside */
401 /* back quote is ascii 96 (0x60) just before lower case (after upper case) */
402 #define CDIR_ACCEL 100
403 #define CDIR_AEXPVECNETS 101
404 #define CDIR_CELLDEF 102
405 #define CDIR_DEFINE 103
406 #define CDIR_DFLNTYP 104
407 #define CDIR_ECELLDEF 105
408 #define CDIR_ELSE 106
409 #define CDIR_ENDIF 107
410 #define CDIR_ENDPROTECT 108
411 #define CDIR_ENDPROTECTED 109
412 #define CDIR_XPNDVNETS 110
413 #define CDIR_IFDEF 111
414 #define CDIR_IFNDEF 112
415 #define CDIR_INCLUDE 113
416 #define CDIR_NOACCEL 114
417 #define CDIR_NOXPNDVNETS 115
418 #define CDIR_NOREMGATENAMES 116
419 #define CDIR_NOREMNETNAMES 117
420 #define CDIR_NOUNCONNDRIVE 118
421 #define CDIR_PROTECT 119
422 #define CDIR_PROTECTED 120
423 #define CDIR_REMGATESNAMES 121
424 #define CDIR_REMNETNAMES 122
425 #define CDIR_RESETALL 123
426 #define CDIR_TIMESCALE 124
427 #define CDIR_UNCONNDRIVE 125
428 #define CDIR_UNDEF 126
429 #define CDIR_DFLTDECAYTIME 127
430 #define CDIR_DFLTTRIREGSTREN 128
431 #define CDIR_DELMODEDIST 129
432 #define CDIR_DELMODEPATH 130
433 #define CDIR_DELMODEUNIT 131
434 #define CDIR_LANG 132
435 #define CDIR_DELMODEZERO 134
436 
437 #define CDIR_TOKEN_START CDIR_ACCEL
438 #define CDIR_TOKEN_END CDIR_DELMODEZERO
439 
440 /* notice 19 unused token no. gap here ? */
441 #define ALWAYS 140
442 #define ASSIGN 141
443 #define Begin 142
444 #define CASE 143
445 #define CASEX 144
446 #define CASEZ 145
447 #define DEASSIGN 146
448 #define DEFAULT 147
449 #define DEFPARAM 148
450 #define DISABLE 149
451 #define EDGE 150
452 #define ELSE 151
453 #define END 152
454 #define ENDCASE 153
455 #define ENDFUNCTION 154
456 #define ENDGENERATE 155
457 #define ENDMODULE 156
458 #define ENDPRIMITIVE 157
459 #define ENDSPECIFY 158
460 #define ENDTABLE 159
461 #define ENDTASK 160
462 #define EVENT 161
463 #define FOR 162
464 #define FORCE 163
465 #define FOREVER 164
466 #define FORK 165
467 #define FUNCTION 166
468 #define GENERATE 167
469 #define HIGHZ0 168
470 #define HIGHZ1 169
471 #define IF 170
472 #define IFNONE 171
473 #define INITial 172
474 #define INOUT 173
475 #define INPUT 174
476 #define INTEGER 175
477 #define JOIN 176
478 #define LARGE 177
479 #define LOCALPARAM 178
480 #define MACROMODULE 179
481 #define MEDIUM 180
482 #define MODULE 181
483 #define NEGEDGE 182
484 #define OUTPUT 183
485 #define PARAMETER 184
486 #define POSEDGE 185
487 #define PRIMITIVE 186
488 #define PULL0 187
489 #define PULL1 188
490 #define REAL 189
491 #define REALTIME 190
492 #define REG 191
493 #define RELEASE 192
494 #define REPEAT 193
495 #define SCALARED 194
496 #define SIGNED 195
497 #define SPECIFY 196
498 #define SPECPARAM 197
499 #define SMALL 198
500 #define Strength 199
501 #define STRONG0 200
502 #define STRONG1 201
503 #define SUPPLY0 202
504 #define SUPPLY1 203
505 #define TABLE 204
506 #define TASK 205
507 #define TIME 206
508 #define TRI 207
509 #define TRI0 208
510 #define TRI1 209
511 #define TRIAND 210
512 #define TRIOR 211
513 #define TRIREG 212
514 #define VECTORED 213
515 #define WAIT 214
516 #define WAND 215
517 #define WEAK0 216
518 #define WEAK1 217
519 #define WHILE 218
520 #define WIRE 219
521 #define WOR 220
522 
523 /* gate nums (not tokens) for sim - now separate gatid range */
524 /* now for debugging do not use low numbers */
525 #define G_ASSIGN 10
526 #define G_BITREDAND 11
527 #define G_BUF 12
528 #define G_BUFIF0 13
529 #define G_BUFIF1 14
530 #define G_CMOS 15
531 #define G_NAND 16
532 #define G_NMOS 17
533 #define G_NOR 18
534 #define G_NOT 19
535 #define G_NOTIF0 20
536 #define G_NOTIF1 21
537 #define G_BITREDOR 22
538 #define G_PMOS 23
539 #define G_PULLDOWN 24
540 #define G_PULLUP 25
541 #define G_RCMOS 26
542 #define G_RNMOS 27
543 #define G_RPMOS 28
544 #define G_RTRAN 29
545 #define G_RTRANIF0 30
546 #define G_RTRANIF1 31
547 #define G_TRAN 32
548 #define G_TRANIF0 33
549 #define G_TRANIF1 34
550 #define G_BITREDXOR 35
551 #define G_REDXNOR 36
552 
553 #define LAST_GSYM G_REDXNOR
554 
555 /* gate classes */
556 #define GC_LOGIC 0
557 #define GC_BUFIF 1
558 #define GC_MOS 2
559 #define GC_CMOS 3
560 #define GC_TRAN 4
561 #define GC_TRANIF 5
562 #define GC_UDP 6
563 #define GC_PULL 7
564 
565 /* region separation constants */
566 #define FIRSTKEY CDIR_ACCEL
567 #define BKEYS FIRSTKEY
568 /* this is last real op. part select's etc. come after */
569 #define LASTOP TEOF
570 
571 /* unconnected pull directive OPEMPTY values */
572 #define NO_UNCPULL 0
573 #define UNCPULL0 1
574 #define UNCPULL1 2
575 
576 /* net types (ntyp field) - meaningful when iotyp is NON_IO */
577 #define N_WIRE 0
578 #define N_TRI 1
579 #define N_TRI0 2
580 #define N_TRI1 3
581 #define N_TRIAND 4
582 #define N_TRIOR 5
583 #define N_TRIREG 6
584 #define N_WA 7
585 #define N_WO 8
586 #define N_SUPPLY0 9
587 #define N_SUPPLY1 10
588 #define N_REG 11
589 #define N_INT 12
590 #define N_TIME 13
591 #define N_REAL 14
592 #define N_EVENT 15            /* needs to be event so -d decls in order */
593 
594 /* beware - number ranges used so all reg types must come after all wires */
595 #define NONWIRE_ST N_REG
596 
597 /* the i/o net and port types - separate from net type */
598 #define IO_IN 0
599 #define IO_OUT 1
600 #define IO_BID 2
601 #define IO_UNKN 3
602 #define NON_IO 4
603 
604 /* sync to location classes */
605 #define SYNC_FLEVEL 0
606 #define SYNC_MODLEVEL 1
607 #define SYNC_STMT 2
608 #define SYNC_SPECITEM 3
609 #define SYNC_UDPLEVEL 4
610 #define SYNC_TARG 5
611 
612 /* scalared/vectored splitting states */
613 #define SPLT_DFLT 0
614 #define SPLT_SCAL 1
615 #define SPLT_VECT 2
616 
617 /* min/typ/max delay selection values */
618 #define DEL_MIN 1
619 #define DEL_TYP 2
620 #define DEL_MAX 3
621 
622 /* symbol types - determines net list element */
623 /* front end only symbols */
624 #define SYM_UNKN 0
625 #define SYM_M 1               /* module type name (not in pli) */
626 #define SYM_STSK 2            /* built in system task name */
627 #define SYM_SF 3              /* built in system function name */
628 #define SYM_DEF 4             /* preprocessor `define sym, separate table */
629 
630 /* in module (real pli) objects */
631 #define SYM_I 5               /* inst. name in module */
632 #define SYM_TSK 6             /* task name */
633 #define SYM_F 7               /* function name */
634 #define SYM_LB 8              /* labeled block */
635 #define SYM_PRIM 9            /* built in primitive */
636 #define SYM_UDP 10            /* udp definition name */
637 #define SYM_N 11              /* wire, regs, events and I/O ports (nets) */
638 #define SYM_CA 12             /* symbol for conta */
639 #define SYM_TCHK 13           /* symbol for time check */
640 #define SYM_PTH 14            /* symbol for delay path */
641 
642 /* pli only object (handle) types - no front end symbol */
643 #define SYM_IMPATH 19         /* inter module (inst.) path not in ovi ? */
644 #define SYM_MPATH 20          /* any intra module path */
645 #define SYM_PRIMPATH 21       /* path between primitives - not in ovi ? */
646 #define SYM_WIREPATH 22       /* another kind of non ovi path ? */
647 #define SYM_TERM 23           /* primitive terminal dummy */
648 #define SYM_MPTERM 24         /* terminal of mod path - only acc handle */
649 #define SYM_PORT 25           /* module port dummy */
650 #define SYM_BIT 26            /* bit of expanded net dummy */
651 #define SYM_PBIT 27           /* bit of expanded port dummy */
652 
653 /* tree balance constants */
654 #define BLEFT 0
655 #define BEVEN 1
656 #define BRIGHT 2
657 
658 /* btree (timing queue) constants */
659 #define BTNORM 0
660 #define BTFRNGE 1
661 
662 /* statement types */
663 #define S_NULL 0              /* ; by itself */
664 #define S_PROCA 1
665 #define S_NBPROCA 2
666 #define S_RHSDEPROCA 3
667 #define S_IF 4
668 #define S_CASE 5
669 #define S_FOR 6
670 #define S_FOREVER 7
671 #define S_REPEAT 8
672 #define S_WHILE 9             /* execept forever only sim time loop */
673 #define S_WAIT 10
674 #define S_DELCTRL 11
675 #define S_NAMBLK 12
676 #define S_UNBLK 13
677 #define S_UNFJ 14             /* this is for unnamed block fork-join only */
678 #define S_TSKCALL 15
679 #define S_QCONTA 16
680 #define S_QCONTDEA 17
681 #define S_CAUSE 18            /* CAUSE (->) <event> */
682 #define S_DSABLE 19           /* disable <task or block> */
683 #define S_STNONE 20           /* thing inside empty block */
684 /* special invisible simulation control statements */
685 #define S_REPSETUP 21         /* set up repeat count - st_u empty */
686 #define S_REPDCSETUP 22       /* event repeat form dctrl setup */
687 #define S_GOTO 23             /* goto statement for loops */
688 #define S_FORASSGN 24         /* special added (before) for assign */
689 #define S_BRKPT 25            /* for setting break point at statement */
690 
691 
692 /* system function types */
693 #define SYSF_UNKNOWN 0
694 #define SYSF_BUILTIN 1
695 #define SYSF_TF 2
696 #define SYSF_VPI 3
697 
698 /* break point types */
699 #define BP_UNKN 0
700 #define BP_INST 1
701 #define BP_TYPE 2
702 
703 /* interactive entry reasons */
704 #define IAER_UNKN 0
705 #define IAER_BRKPT 1
706 #define IAER_STEP 2
707 #define IAER_STOP 3
708 #define IAER_CTRLC 4
709 
710 /* event control types */
711 #define DC_NONE 0
712 #define DC_EVENT 1
713 #define DC_DELAY 2
714 #define DC_RHSEVENT 3
715 #define DC_RHSDELAY 4
716 #define DC_WAITEVENT 5
717 
718 /* statement dump new line control constants */
719 #define NONL 1
720 #define NL 2
721 
722 /* Verilog operator types */
723 #define NOTANOP 0
724 #define UNOP 1
725 #define BINOP 2
726 #define BOTHOP 3
727 #define SPECOP 4
728 #define RUNOP 5
729 #define RBINOP 6
730 #define RBOTHOP 7
731 
732 /* indicator if operand legal for reals */
733 #define REALOP TRUE
734 #define NOTREALOP FALSE
735 #define PTHOP TRUE
736 #define NOTPTHOP FALSE
737 
738 /* operater width result pattern */
739 #define WIDNONE 0             /* no width result */
740 #define WIDONE 1              /* result width 1 (for logicals) */
741 #define WIDENONE 2            /* result one, but widen opands to wides */
742 #define WIDLEFT 3             /* left operand width of binary */
743 #define WIDMAX 4              /* max. of 2 operands */
744 #define WIDSUM 5              /* sum of operand width for concats */
745 #define WIDSELF 6             /* width self determining (like [] or un ~/-) */
746 
747 /* specify section constants */
748 #define PTH_PAR 0             /* => */
749 #define PTH_FULL 1            /* *> */
750 #define PTH_NONE 2
751 
752 #define POLAR_NONE 0
753 #define POLAR_PLUS 1
754 #define POLAR_MINUS 2
755 
756 #define TCHK_SETUP 0
757 #define TCHK_HOLD 1
758 #define TCHK_WIDTH 2
759 #define TCHK_PERIOD 3
760 #define TCHK_SKEW 4
761 #define TCHK_RECOVERY 5
762 #define TCHK_NOCHANGE 6
763 #define TCHK_SETUPHOLD 7
764 #define TCHK_FULLSKEW 8
765 #define TCHK_RECREM 9
766 #define TCHK_REMOVAL 10
767 #define TCHK_TIMESKEW 11
768 
769 /* for [edge ...] form allows list so multiple bits possible */
770 /* values must match acc_ pli values */
771 #define NOEDGE 0
772 #define EDGE01 0x1
773 #define EDGE10 0x2
774 #define EDGE0X 0x4
775 #define EDGEX1 0x8
776 #define EDGE1X 0x10
777 #define EDGEX0 0x20
778 /* these are or of relevants */
779 #define E_POSEDGE 0xd
780 #define E_NEGEDGE 0x32
781 
782 /* delay union form for all delays after simulation preparation */
783 /* notice for non IS form no byte and halfword packed forms */
784 #define DT_NONE 0
785 #define DT_1V 1
786 #define DT_IS1V  2            /* all is forms have 1,2 and 8 byte forms */
787 #define DT_IS1V1 3
788 #define DT_IS1V2 4
789 #define DT_4V 5               /* 4v forms only for primtives not paths */
790 #define DT_IS4V 6
791 #define DT_IS4V1 7
792 #define DT_IS4V2 8
793 #define DT_16V 9              /* except for 1v all spec. delays need 15v */
794 #define DT_IS16V 10
795 #define DT_IS16V1 11
796 #define DT_IS16V2 12
797 #define DT_1X 13
798 #define DT_4X 14
799 #define DT_PTHDST 15
800 #define DT_CMPLST 16
801 
802 /* for checking 0 and path delays, kinds of bad delays */
803 #define DGOOD 1
804 #define DBAD_NONE 2
805 #define DBAD_EXPR 3
806 #define DBAD_0 4
807 #define DBAD_MAYBE0 5
808 
809 /* timing event types - what tested by not starting at 0 ? */
810 #define TE_THRD 2
811 #define TE_G 3
812 #define TE_CA 4
813 #define TE_WIRE 5
814 #define TE_BIDPATH 6
815 #define TE_MIPD_NCHG 7
816 #define TE_NBPA 8
817 #define TE_TFSETDEL 9
818 #define TE_SYNC 10
819 #define TE_TFPUTPDEL 11
820 #define TE_VPIPUTVDEL 12
821 #define TE_VPIDRVDEL 13
822 #define TE_VPICBDEL 14
823 #define TE_UNKN 15
824 
825 #define DFLT_LOGFNAM "verilog.log"
826 #define DFLTDVFNAM "verilog.dump"
827 #define DFLTKEYFNAM "verilog.key"
828 
829 /* dumpvars action state */
830 #define DVST_NOTSETUP 0
831 #define DVST_DUMPING 1
832 #define DVST_NOTDUMPING 2
833 #define DVST_OVERLIMIT 3
834 
835 /* baseline dump types for dumpvars */
836 #define DMPV_CHGONLY 0
837 #define DMPV_DMPALL 1
838 #define DMPV_DUMPX 2
839 
840 /* delay control event filter processing types */
841 #define DCE_RNG_INST 0
842 #define DCE_INST 1
843 #define DCE_RNG_MONIT 2
844 #define DCE_MONIT 3
845 #define DCE_NONE 4
846 #define DCE_QCAF 5
847 #define DCE_RNG_QCAF 6
848 #define DCE_CBF 7
849 #define DCE_RNG_CBF 8
850 #define DCE_CBR 9
851 #define DCE_RNG_CBR 10
852 /* BEWARE these always require prevval - must be higher number than above */
853 #define DCE_PVC 11
854 #define DCE_RNG_PVC 12
855 #define DCE_CBVC 13
856 #define DCE_RNG_CBVC 14
857 
858 #define ST_ND_PREVVAL DCE_PVC
859 
860 /* slotend action masks - multiple can be on at time */
861 #define SE_TCHK_VIOLATION 1
862 #define SE_MONIT_CHG 0x2      /* definite chg including first time */
863 #define SE_MONIT_TRIGGER 0x4  /* monit chg where val saved (chk at end) */
864 /* FIXME - why is this never referenced */
865 #define SE_FMONIT_TRIGGER 0x8
866 #define SE_STROBE 0x10
867 #define SE_DUMPVARS 0x20      /* ON => some dumpvars action required */
868 #define SE_DUMPALL 0x40       /* need slot end dump all */
869 #define SE_DUMPON  0x800      /* need to turn dumping on at slot end */
870 #define SE_DUMPOFF 0x100      /* need to turn dumping off at slot end */
871 #define SE_TFROSYNC 0x200     /* have list of rosync events to process */
872 #define SE_VPIROSYNC 0x400    /* have list of vpi rw sync to process */
873 
874 /* selectors for type of tran channel routine to use (low 3 bits) */
875 #define TRPROC_UNKN 0
876 #define TRPROC_BID 1
877 #define TRPROC_STBID 2
878 #define TRPROC_STWTYPBID 3
879 #define TRPROC_TRAN 4
880 
881 /* type of gate acceleration - for selecting routine */
882 #define ACC_NONE 0
883 #define ACC_STD 1
884 #define ACC_BUFNOT 2
885 #define ACC_STIBUFNOT 3
886 #define ACC_4IGATE 4
887 #define ACC_ST4IGATE 5
888 
889 /* internal vpi_ call back type classes */
890 #define CB_NONE 0
891 #define CB_VALCHG 1
892 #define CB_DELAY 2
893 #define CB_ACTION 3
894 
895 /* simulation (run) progress states */
896 #define SS_COMP 1
897 #define SS_LOAD 2
898 #define SS_RESET 3
899 #define SS_SIM 4
900 
901 /* Cver supported error severity levels */
902 #define INFORM 0
903 #define WARN 1
904 #define ERROR 2
905 #define FATAL 3
906 
907 /* per inst. masks for net nchg action byte array */
908 #define NCHG_DMPVARNOW 0x1    /* dumpvaring of this var inst on/off */
909 #define NCHG_DMPVNOTCHGED 0x2 /* var inst. not chged during current time */
910 #define NCHG_DMPVARED 0x4     /* var inst. dumpvared (setup) */
911 #define NCHG_ALL_CHGED 0x08   /* all var inst. bits chged (also if no lds) */
912 
913 /* AIV 09/05/03 consts for new fileio OS file descriptor streams support */
914 #define FIO_MSB 0x80000000
915 #define FIO_FD 0x7fffffff
916 #define FIO_STREAM_ST 3       /* first usable ver fio fd open file number */
917 #define SE_VPIROSYNC 0x400    /* have list of vpi rw sync to process */
918 
919 /* AIV 12/02/03 constants for cfg get token */
920 /* FIXME ??? - needed here because cfg get tok in v ms but used in cver? */
921 #define CFG_UNKNOWN 0
922 #define CFG_ID 1
923 #define CFG_COMMA 2
924 #define CFG_SEMI 3
925 #define CFG_EOF 4
926 #define CFG_LIBRARY 5
927 #define CFG_CFG 6
928 #define CFG_INCLUDE 7
929 #define CFG_DESIGN 8
930 #define CFG_LIBLIST 9
931 #define CFG_INSTANCE 10
932 #define CFG_CELL 11
933 #define CFG_USE 12
934 #define CFG_ENDCFG 13
935 #define CFG_DEFAULT 14
936 
937 /* SJM 07/31/01 - need system type def. include files for 64 bit types */
938 #include <time.h>
939 
940 /* various forward references */
941 struct sy_t;
942 struct st_t;
943 struct mod_pin_t;
944 struct thread_t;
945 struct tchk_t;
946 struct tchg_t;
947 struct fmonlst_t;
948 
949 /* data structure for keywords and command line/file options */
950 struct namlst_t {
951  int32 namid;
952  char *lnam;
953 };
954 
955 /* SJM 06/03/01 - to prepare for 64 bits union to avoid int32 to ptr cast */
956 /* SJM 10/12/04 - can't use p because need index into contab not addr */
957 union intptr_u {
958  int32 i;
959  int32 xvi;
960 };
961 
962 /* SJM 08/22/01 - must be at top for new expr node union */
963 union pck_u {
964  word32 *wp;
965  hword *hwp;
966  byte *bp;
967  double *dp;
968 };
969 
970 /* data struct for help message line tables - hnum is namlst_t namid */
971 struct hlplst_t {
972  /* LOOKATME - why is this unused */
973  int32 hnamid;
974  char **hmsgtab;
975 };
976 
977 struct sdfnamlst_t {
978  char *fnam;
979  char *scopnam;
980  char *optfnam;
981  int32 opt_slcnt;
982  struct sdfnamlst_t *sdfnamnxt;
983 };
984 
985 struct optlst_t {
986  unsigned optfnam_ind : 16;
987  unsigned is_bmark : 1;       /* special -f markers for vpi_ */
988  unsigned is_emark : 1;
989  unsigned is_argv : 1;
990  unsigned argv_done : 1;
991  int32 optlin_cnt;
992  int32 optnum;
993  int32 optlev;
994  char *opt;
995  char **dargv;
996  struct optlst_t *optlnxt;
997 };
998 
999 /* data structure for input file/`define/`include stack */
1000 /* could be union but not too many ? */
1001 struct vinstk_t {
1002  int32 vilin_cnt;
1003  word32 vifnam_ind;
1004  FILE *vi_s;
1005  char *vichp_beg;             /* beginning of macro string */
1006  int32 vichplen;              /* if not -1, len + 1 must be freed */
1007  char *vichp;                 /* macro string current char */
1008 };
1009 
1010 /* P1364 2001 cfg include structs */
1011 /* list of map files - uses map.lib in CWD if none from options */
1012 struct mapfiles_t {
1013  char *mapfnam;
1014  struct mapfiles_t *mapfnxt;
1015 };
1016 
1017 /* order list of config element names */
1018 struct cfgnamlst_t {
1019  char *nam;
1020  struct cfgnamlst_t *cnlnxt;
1021 };
1022 
1023 /* describes component of path during wild card expansion */
1024 struct xpndfile_t {
1025  char *fpat;                  /* the original pattern per dir, split by '/' */
1026  int32 nmatch;                /* the number of matched files */
1027  int32 level;                 /* current directory level */
1028  unsigned wildcard: 2;        /* T=> if it contains a wild char, *, ? or ... */
1029  unsigned incall : 1;         /* include the entire dir, ends in '/' */
1030  struct xpndfile_t *xpfnxt;   /* next part of original pattern */
1031 };
1032 
1033 /* record for library element (after expand, all wild cards removed) */
1034 struct libel_t {
1035  unsigned lbelsrc_rd : 1;     /* T => expanded lib file name src all read */
1036  unsigned expanded : 1;       /* T => file has been expanded  */
1037  char *lbefnam;
1038  struct libcellndx_t **lbcelndx; /* byte offset of cell names for seeking */
1039  struct symtab_t *lbel_sytab; /* symbol table of cells in file */
1040  struct libel_t *lbenxt;
1041 };
1042 
1043 /* cfg library record - sort of corresponds to -v/y data record */
1044 struct cfglib_t {
1045  unsigned lbsrc_rd : 1;       /* T => lib src files already read */
1046  unsigned sym_added : 1;      /* T => sym table has been read */
1047  char *lbname;                /* library name */
1048  struct libel_t *lbels;       /* list of library file path spec elements */
1049  struct cfglib_t *lbnxt;      /* pointer to the next library */
1050  char *cfglb_fnam;            /* location of library in src needed */
1051  int32 cfglb_lno;
1052  struct cfg_t *cfgnxt;
1053 };
1054 
1055 /* config body rule record */
1056 struct cfgrule_t {
1057  unsigned rultyp : 8;         /* type - cfg symbol number */
1058  unsigned use_rule_cfg : 1;   /* T => use clause config form */
1059  unsigned matched : 1;        /* T => rule was bound at least once */
1060  unsigned is_use : 1;         /* T => 'use' else 'liblist' */
1061  char *objnam;                /* inst clause: [XMR inst path] */
1062  char *libnam;                /* cell clause: <lib name>.[cell name] */
1063  char *rul_use_libnam;        /* use <lib name.>[cell name][:config] */
1064  char *rul_use_celnam;
1065  char **inam_comptab;         /* table of inst clause XMR components */
1066  int32 inam_comp_lasti;       /* number of components in XMR inst path */
1067 
1068  struct cfgnamlst_t *rul_libs;/* liblist clause - just list of libraries */
1069  int32 rul_lno;
1070  struct cfgrule_t *rulnxt;
1071 };
1072 
1073 /* record for list of config design cell identifiers */
1074 struct cfgdes_t {
1075  char *deslbnam;          /* name of config design library */
1076  struct cfglib_t *deslbp; /* ptr to config design library */
1077  char *topmodnam;         /* name of top level cell (type) */
1078  struct cfgdes_t *desnxt;
1079 };
1080 
1081 /* record for each cfg block */
1082 struct cfg_t {
1083  char *cfgnam;                /* name of the cfg */
1084  struct cfgdes_t *cfgdeslist; /* list of config design [lib].[cell]s */
1085 
1086  /* SJM 12/11/03 - notice preserving exact order of rules critical */
1087  struct cfgrule_t *cfgrules;  /* ordered list of config rules */
1088  struct cfgrule_t *cfgdflt;   /* default lib list if rules find no matches */
1089  char *cfg_fnam;
1090  int32 cfg_lno;
1091  struct cfg_t *cfgnxt;
1092 };
1093 
1094 /* for debugger include file and last included place */
1095 struct incloc_t {
1096  int32 inc_fnind;             /* in_fils index of included file */
1097  int32 incfrom_fnind;         /* in_fils index file included from */
1098  int32 incfrom_lcnt;          /* lin cnt where included */
1099  struct incloc_t *inclocnxt;
1100 };
1101 
1102 /* doubly linked list for undefined modules */
1103 struct undef_t {
1104  struct sy_t *msyp;
1105  int32 dfi;
1106  char *modnam;
1107  struct undef_t *undefprev;
1108  struct undef_t *undefnxt;
1109 };
1110 
1111 /* struct for files in ylib - to avoid opening if not needed */
1112 struct mydir_t {
1113  unsigned ydirfnam_ind : 16;
1114  unsigned ylbxi : 16;         /* ndx in lbexts (-1 if none), -2 no match */
1115  char *dirfnam;
1116 };
1117 
1118 /* -y and -v file list */
1119 struct vylib_t {
1120  unsigned vyfnam_ind : 16;    /* for rescanning file ind or num dir files */
1121  unsigned vytyp : 8;          /* 'v' for -v andd 'y' for -y */
1122  union {
1123   char *vyfnam;               /* file name */
1124   char *vydirpth;             /* for -y directory, directory path */
1125  } vyu;
1126  struct mydir_t *yfiles;      /* for -y header of file list */
1127  struct vylib_t *vynxt;
1128 };
1129 
1130 /* struct for multi-channel descriptors - need to save file name */
1131 struct mcchan_t {
1132  FILE *mc_s;
1133  char *mc_fnam;
1134 };
1135 
1136 /* ver fd number record for new 2001 P1364 file io package */
1137 struct fiofd_t {
1138  unsigned fd_error : 1;      /* error indicator */
1139  char *fd_name;              /* name of stdio file */
1140  FILE *fd_s;                 /* corresponding OS FILE * descriptor */
1141 };
1142 
1143 /* debugger source file cache line start location rec */
1144 struct filpos_t {
1145  int32 nlines;
1146  int32 *lpostab;
1147 };
1148 
1149 /* formal macro argument list */
1150 struct macarg_t {
1151  char *macargnam;
1152  struct macarg_t *macargnxt;
1153 };
1154 
1155 /* macro expansion templace list */
1156 struct macexp_t {
1157  char *leading_str;
1158  int32 leadlen;
1159  int32 ins_argno;
1160  struct macexp_t *macexpnxt;
1161 };
1162 
1163 /* arg macro record */
1164 struct amac_t {
1165  int32 num_formal_args;
1166  struct macexp_t *amxp;
1167 };
1168 
1169 /* operator info struct for predefined table (index by op. symbol number) */
1170 /* Verilog ops always associate left */
1171 struct opinfo_t {
1172  unsigned opclass : 8;
1173  unsigned realop : 8;
1174  unsigned pthexpop: 8;        /* T => op legal in SDPD condional expr. */
1175  unsigned reswid : 8;
1176  char *opnam;
1177 };
1178 
1179 /* value in q for $q_ system tasks */
1180 struct q_val_t {
1181  int32 job_id;
1182  int32 inform_id;
1183  word64 enter_tim;
1184 };
1185 
1186 /* q header record - linked list of all queues */
1187 struct q_hdr_t {
1188  unsigned q_fifo : 1;       /* T => fifo, F => lifo */
1189  int32 q_id;                /* user passed ID */
1190  int32 q_hdr;               /* index of current head */
1191  int32 q_tail;              /* index of current tail */
1192  int32 q_maxlen;            /* maximum length of queue */
1193  int32 q_size;              /* need to store size for q_exam */
1194  struct q_val_t *qarr;      /* table contain queue */
1195  word64 q_minwait;          /* shortest wait (min) of all els. ever in Q */
1196  int32 q_maxsize;           /* for entire run, max size of q */
1197  struct q_hdr_t *qhdrnxt;
1198 };
1199 
1200 /* history suspended statement control record */
1201 struct hctrl_t {
1202  struct st_t *hc_stp;     /* initial style statement list */
1203  struct itree_t *hc_itp;  /* itree loc. runs in if reenabled */
1204  struct thread_t *hc_thp; /* associated thread */
1205  int32 hc_lini;           /* line loc. in history of statement */
1206  int32 hc_ifi;
1207  struct hctrl_t *hc_nxt;  /* list next for non history traversing */
1208  struct hctrl_t *hc_prev; /* and previous */
1209  struct iahist_t *hc_iahp;/* ptr to history element if history on */
1210  struct dceauxlst_t *hc_dcelst; /* aux. list of per inst iact dces to free */
1211  struct gref_t *hc_grtab; /* table of any grefs used in this statement */
1212  int32 hc_numglbs;        /* size of table */
1213 };
1214 
1215 /* interactive history command record */
1216 struct iahist_t {
1217  char *iah_lp;            /* history line (may have embedded new lines) */
1218  struct hctrl_t *iah_hcp; /* parsed suspended stmt control record */
1219  struct itree_t *iah_itp; /* for non immed. save original itree loc. */
1220 };
1221 
1222 /* parallel to expr table during expr collect id name info struct */
1223 struct expridtab_t {
1224  char *idnam;
1225  int32 idfldwid;
1226  int32 idfnam_ind;
1227  int32 idlin_cnt;
1228 };
1229 
1230 /* structs for expressions */
1231 union l_u {
1232  struct expr_t *x;
1233  int32 xi; /* for compile/save changed to indices */
1234  struct sy_t *sy;
1235  int32 si; /* for compile/save changed to indices */
1236 };
1237 
1238 union r_u {
1239  struct expr_t *x;
1240  int32 xvi;                   /* wrd index into constant tab */
1241  union pck_u iop_ptr;         /* for special malloc iopt node ptr to area */
1242  struct gref_t *grp;          /* during compile/exec - ptr to gref */
1243  int32 gri;                   /* for compile/save index */
1244  char *qnchp;                 /* for local qual. name, pointer to name */
1245 };
1246 
1247 /* expression size or tf rec union */
1248 union sz_u {
1249  int32 xclen;
1250  struct tfrec_t *xfrec;
1251  void *vpi_sysf_datap;        /* for vpi_ sysf get/put data routine */
1252 };
1253 
1254 /* expression tree storage - eventually will fit in 12 bytes */
1255 struct expr_t {
1256  /* operator token type - leaf node if var or number */
1257  unsigned optyp : 8;          /* token type of node */
1258  unsigned has_sign : 1;       /* T => result must be signed */
1259  unsigned rel_ndssign : 1;    /* T => 1 bit result relational needs sign */
1260  unsigned is_string : 1;      /* T => constant in src as string (quoted) */
1261  unsigned unsiznum : 1;       /* T => constant is unsized */
1262  unsigned ibase : 3;          /* for sized no., base char. */
1263  unsigned sizdflt : 1;        /* T => '[base] form but no width */
1264  unsigned is_real : 1;        /* T => expr. value is real number */
1265  unsigned cnvt_to_real : 1;   /* T => non real operand of real expr */
1266  unsigned unsgn_widen : 1;    /* T => for cases unsigned widen if needed */
1267  unsigned consubxpr : 1;      /* T => node will evaluate to number */
1268  unsigned consub_is : 1;      /* T => node will eval to IS number */
1269  unsigned folded : 1;         /* T => const. folded (also empty cat rep rem) */
1270  unsigned getpatlhs : 1;      /* T => expressions is lhs of get pattern */
1271  unsigned ind_noth0 : 1;      /* T => constant index has been normalized */
1272  unsigned x_multfi : 1;       /* T => expr has multi fan-in or stren wire */
1273  unsigned tf_isrw : 1;        /* T => for user tf arg. - assignable (rw) */
1274  unsigned x_islhs : 1;        /* T => expr. is lhs */
1275  unsigned locqualnam : 1;     /* T => if printing name is local qualified */
1276  unsigned lhsx_ndel : 1;      /* T => wire in lhs expr. has net delay */
1277  unsigned x_stren : 1;        /* T => expr. is strength wire/bs/ps */
1278  unsigned unc_pull : 2;       /* unc. pull directive value for OPEMPTY */
1279  union sz_u szu;              /* size of func tf rec. union */
1280  union l_u lu;                /* left sub expr. or symbol union */
1281  union r_u ru;                /* right sub expr. or ptr. to value union */
1282 };
1283 
1284 struct xstk_t {
1285  int32 xslen;                 /* number of bits required to store */
1286  int32 xsawlen;               /* word32 length of a/b half of alloced size */
1287  word32 *ap;                  /* a part of value but must be contigous */
1288  word32 *bp;                  /* b part of value */
1289 };
1290 
1291 struct exprlst_t {
1292  struct expr_t *xp;
1293  struct exprlst_t *xpnxt;
1294 };
1295 
1296 /* for new ver 2001 var (not wire) decl initialize assign list */
1297 struct varinitlst_t {
1298  struct sy_t *init_syp;
1299  struct expr_t *init_xp;
1300  struct varinitlst_t *varinitnxt;
1301 };
1302 
1303 /* struct for storing # delays but not instance pound params */
1304 struct paramlst_t {
1305  struct expr_t *plxndp;
1306  struct paramlst_t *pmlnxt;
1307 };
1308 
1309 /* struct for storing defparams - list is design wide */
1310 struct dfparam_t {
1311  unsigned dfp_local : 1;      /* T => defparam is local or in top mod */
1312  unsigned dfp_rooted : 1;     /* T => rooted lhs gref */
1313  unsigned dfp_mustsplit : 1;  /* T = mst split rng cat lhs dest. param */
1314  unsigned dfp_done : 1;       /* during splitting, done with this one */
1315  unsigned dfp_has_idents : 1; /* T => identical to other rooted defparam */
1316  unsigned dfp_checked : 1;    /* T => after fix-up check done */
1317  unsigned dfpfnam_ind : 16;
1318  int32 dfplin_cnt;
1319  int32 last_dfpi;             /* last element of path */
1320 
1321  struct expr_t *dfpxlhs;
1322  struct expr_t *dfpxrhs;
1323  struct mod_t *in_mdp;        /* module appeared in for non rooted */
1324  struct dfparam_t *dfpnxt;
1325  int32 *dfpiis;               /* array of in its indices for path of defp */
1326  char *gdfpnam;               /* lhs name from gref */
1327  struct sy_t *targsyp;        /* target symbol from gref */
1328  struct dfparam_t *idntmastdfp;/* ptr to master if >1 with identical path */
1329  struct dfparam_t *idntnxt;   /* list from master of identicals path */
1330  struct dfparam_t *rooted_dfps;/* work for converting downward to rooted */
1331  struct itree_t *indfp_itp;   /* for rooted, itree place rhs evaled in */
1332  struct task_t *dfptskp;      /* if non NULL, task target declared in */
1333 };
1334 
1335 /* per type delay storage - 1 array acess during scheduling */
1336 union del_u {
1337  word64 *d1v;                 /* 1 constant (non 0) delay value */
1338  word64 *dis1v;               /* 1 constant (IS form maybe some 0) delay */
1339  byte *dis1v1;                /* 1 constant IS fits in one byte */
1340  hword *dis1v2;               /* 1 constant IS fits in two byte */
1341  word64 *d4v;                 /* 4 value constant delay table */
1342  word64 *dis4v;               /* 4 constant (IS form maybe some 0) delay */
1343  byte *dis4v1;                /* 4 constant IS fits in one byte */
1344  hword *dis4v2;               /* 4 constant IS fits in two byte */
1345  word64 *d16v;                /* 16 constant IS form */
1346  word64 *dis16v;              /* 16 constant (IS form) delay */
1347  byte *dis16v1;               /* 16 constant IS fits in one byte */
1348  hword *dis16v2;              /* 16 constant IS fits in two bytes */
1349  struct expr_t *d1x;          /* 1 delay expr. */
1350  struct expr_t **d4x;         /* array of 4 expression ptrs */
1351  struct pthdst_t **pb_pthdst; /* per bit path dest. ptr to same dst. src */
1352  struct paramlst_t *pdels;    /* original compile time # delay form */
1353 };
1354 
1355 /* input instance structure before known whether gate or cell */
1356 struct cell_pin_t {
1357  struct expr_t *cpxnd;        /* connecting expression root node */
1358  word32 cpfnam_ind;           /* file symbol defined in */
1359  int32 cplin_cnt;             /* def. line no. */
1360  char *pnam;                  /* probably no symbol table when read */
1361  struct cell_pin_t *cpnxt;
1362 };
1363 
1364 struct namparam_t {
1365  struct expr_t *pxndp;        /* parameter value as expr. */
1366  word32 prmfnam_ind;          /* file pound parameter appears in */
1367  int32 prmlin_cnt;            /* line pound parameter defined on */
1368  char *pnam;                  /* name as string - no sym table when read */
1369  struct namparam_t *nprmnxt;
1370 };
1371 
1372 /* record to store attributes - table of each from attribute inst */
1373 struct attr_t {
1374  unsigned attr_tok : 8;       /* token attribute on */
1375  unsigned attr_seen : 1;      /* turn on when see attr of attr tok type */
1376                               /* off when added to object */
1377  unsigned attr_fnind : 16;    /* file attribute instance defined at */
1378  char *attrnam;               /* name but before parsed entire attr inst str */
1379  struct expr_t *attr_xp;      /* expr - nil if no value expr */
1380  int32 attrlin_cnt;           /* and line no. */
1381  struct attr_t *attrnxt;
1382 };
1383 
1384 /* source location struct for saving cell port line numbers */
1385 struct srcloc_t {
1386  word32 sl_fnam_ind;
1387  int32 sl_lin_cnt;
1388 };
1389 
1390 /* compile time cell or gate contents */
1391 struct cell_t {
1392  unsigned c_hasst : 1;        /* T => strength appears in source */
1393  unsigned c_stval : 6;        /* (3 bit 0 st. and 3 bit 1 st. */
1394  unsigned cp_explicit : 1;    /* T => all explicit connection list */
1395  unsigned c_named : 1;        /* T => instance is named */
1396  unsigned c_iscell : 1;       /* T => this is a timing lib. cell */
1397  struct sy_t *csym;
1398  struct sy_t *cmsym;          /* module type symbol */
1399  struct cell_t *cnxt;
1400  struct expr_t *cx1, *cx2;    /* for arrays of gates/insts, the range */
1401  struct namparam_t *c_nparms;
1402  struct attr_t *cattrs;       /* attrs for cell - moved later */
1403  struct cell_pin_t *cpins;
1404 };
1405 
1406 /* list for blocks of allocated cells for fast block freeing */
1407 struct cpblk_t {
1408  struct cell_t *cpblks;
1409  struct cpblk_t *cpblknxt;
1410 };
1411 
1412 /* list for blocks of allocated cell pins for fast block freeing */
1413 struct cppblk_t {
1414  struct cell_pin_t *cppblks;
1415  struct cppblk_t *cppblknxt;
1416 };
1417 
1418 /* list of tree node blocks */
1419 struct tnblk_t {
1420  struct tnode_t *tnblks;
1421  struct tnblk_t *tnblknxt;
1422 };
1423 
1424 struct cpnblk_t {
1425  char *cpnblks;
1426  char *cpn_start_sp, *cpn_end_sp;
1427  struct cpnblk_t *cpnblknxt;
1428 };
1429 
1430 union gia_u {
1431  struct inst_t *gia_ip;
1432  struct gate_t *gia_gp;
1433 };
1434 
1435 /* index record for mod gate or inst arrays - pted to by insts/gates */
1436 /* only need one of these per array of gate/insts */
1437 struct giarr_t {
1438  unsigned gia_xpnd : 1;       /* T => inst/gate arr xpnd to per bit */
1439  unsigned gia_rng_has_pnd : 1;/* T => range has passed pound param */
1440  struct expr_t *giax1, *giax2;/* src constant rng exprs from cell */
1441  int32 gia1, gia2;            /* evaluated range - expr may chg */
1442  int32 gia_bi;                /* base mgates or minsts index */
1443  struct expr_t **giapins;     /* tab of original g/i pin expressions */
1444  struct sy_t *gia_base_syp;   /* original source base symbol name */
1445 };
1446 
1447 /* run time module instance contents */
1448 struct inst_t {
1449  unsigned ip_explicit : 1;
1450  unsigned pprm_explicit : 1;  /* has explicit form pound params */
1451  unsigned i_iscell : 1;       /* instance is a cell */
1452  unsigned i_pndsplit : 1;     /* T => must pound param split */
1453  struct sy_t *isym;
1454  struct sy_t *imsym;          /* module type symbol */
1455  struct expr_t **ipxprtab;    /* inst. pound param expr. table, nil for none */
1456  struct attr_t *iattrs;       /* attribute table for inst. */
1457  struct expr_t **ipins;       /* ptr to array of port expr ptrs */
1458  struct expr_t ***pb_ipins_tab; /* if non nil, ptr to pb sep pin expr tab */
1459 };
1460 
1461 /* as if flattened instance structure - should use inum arrays instead ? */
1462 /* think this can be smaller but per mod. inst. array better ? */
1463 struct itree_t {
1464  int32 itinum;
1465  struct itree_t *up_it;       /* containing itree inst. */
1466  struct itree_t *in_its;      /* array of low itree elements */
1467  struct inst_t *itip;         /* corresponding inst_t info */
1468 };
1469 
1470 /* gate contents after fixup separation */
1471 struct gate_t {
1472  unsigned gpnum : 14;         /* number of gate ports (limit 16k) */
1473  unsigned g_class : 3;        /* gate class for processing case */
1474  unsigned g_hasst : 1;        /* T => stren in src or tran(if) cycle break */
1475  unsigned g_stval : 6;        /* (3 bit each 0 and 1 st.) <ST:ST> if none */
1476  unsigned g_delrep : 5;
1477  unsigned g_unam : 1;         /* primitive has no instance name */
1478  unsigned g_gone : 1;         /* gate removed, no state */
1479  unsigned g_pdst : 1;         /* T => gate drives del/pth */
1480  union del_u g_du;            /* per type delay union */
1481  struct sy_t *gsym;
1482  struct sy_t *gmsym;          /* gate type symbol */
1483  union pck_u gstate;          /* per inst. storage of state vector */
1484  i_tev_ndx *schd_tevs;        /* per inst. array of scheduled events ndxes */
1485  struct attr_t *gattrs;       /* optional gate attribute */
1486  struct expr_t **gpins;       /* ptr to table of input port expr ptrs */
1487 
1488  /* routine to eval gate on input change */
1489  void (*gchg_func)(register struct gate_t *, register word32);
1490 };
1491 
1492 union pbca_u {
1493  struct conta_t *pbcaps;      /* for rhs cat per bit conta tab for sim */
1494  struct conta_t *mast_cap;    /* for per bit element, ptr to master */
1495  struct conta_t *canxt;       /* once mod's 1 bit conta rem, use table */
1496 };
1497 
1498 /* notice 1 bit ca's are simulated as gates */
1499 struct conta_t {
1500  struct sy_t *casym;
1501  unsigned ca_hasst : 1;
1502  unsigned ca_stval : 6;       /* (3 bit 0 st. and 3 bit 1 st. */
1503  unsigned ca_delrep : 5;
1504  unsigned ca_4vdel : 1;       /* T => delay 4v so need to eval new_gateval */
1505  unsigned ca_gone : 1;        /* continuous assign could be removed */
1506  unsigned ca_pb_sim : 1;      /* T => in src rhs concat simulates as PB */
1507  unsigned ca_pb_el : 1;       /* T => this is a per bit el pb fld is master */
1508  union del_u ca_du;           /* per type delay table (only in master) */
1509  struct expr_t *lhsx;
1510  struct expr_t *rhsx;
1511  i_tev_ndx *caschd_tevs;      /* per inst. scheduled event ndx array */
1512  union pck_u ca_drv_wp;       /* ptr to rhs drive a/b values if needed */
1513  union pck_u schd_drv_wp;     /* pck per inst. scheduled value */
1514  union pbca_u pbcau;          /* up or down tab rhs cat decomposed PB val */
1515  struct conta_t *canxt;       /* for non rhs cat decomposed PB, nxt field */
1516 };
1517 
1518 /* net storage */
1519 /* compilation specific net auxiliary fields */
1520 struct ncomp_t {
1521  /* compile time only flags */
1522  unsigned n_iotypknown : 1;
1523  unsigned n_wirtypknown : 1;
1524  unsigned n_rngknown : 1;     /* needed to separte range in i/o/wire decls */
1525  unsigned n_impldecl : 1;     /* declared implicitly */
1526  unsigned n_in_giarr_rng : 1; /* in array of g/i range expression */
1527  unsigned n_spltstate : 2;    /* scalared/vectored splitting of wire */
1528  unsigned n_onrhs : 1;        /* appears on some rhs (also declarative) */
1529  unsigned n_onlhs : 1;        /* appears on some lhs */
1530  unsigned n_2ndonlhs : 1;     /* T => more than 1 on lhs (for in to inout) */
1531  unsigned num_prtconns : 2;   /* count to 2 of no. of ports wire conns to */
1532  unsigned n_widthdet : 1;     /* T => parm is width determing - no IS form */
1533  unsigned n_indir_widthdet : 1; /* T => parm passed down to width det */
1534  unsigned p_setby_defpnd : 1; /* T => can't recalc since set by def/pnd */
1535  unsigned p_specparam : 1;    /* T => specify parameter */
1536  unsigned p_rhs_has_param : 1;/* T => param def rhs contains param */
1537  unsigned p_locparam : 1;     /* T => local parameter (never # or def) */
1538  unsigned prngdecl : 1;       /* T => range declared in source */
1539  unsigned ptypdecl : 1;       /* T => type declared in source */
1540  unsigned psigndecl : 1;      /* T => signed keyword declared in source */
1541  unsigned parm_srep : 4;      /* for parameter n_dels_u original expr rep */
1542  unsigned pbase : 3;          /* base of original rhs */
1543  unsigned pstring : 1;        /* T => if string appeared on original rhs */
1544  unsigned frc_assgn_in_src : 1; /* T => force or assign appears in src */
1545  unsigned monit_in_src : 1;   /* T => has mon/fmon in source for var */
1546  unsigned dmpv_in_src : 1;    /* if not all dummpvar => has mon/fmon in src */
1547  unsigned n_iscompleted : 1;  /* type def completed in earlier source */
1548 
1549  struct expr_t *nx1, *nx2;
1550  struct expr_t *ax1, *ax2;
1551  union del_u n_dels_u;
1552  byte *n_pb_drvtyp;           /* per bit drvr state tab for port dir chg */
1553  byte n_drvtyp;               /* for scalar simple stat tab for dir chg */
1554 };
1555 
1556 /* list for blocks of allocated ncomp for fast block freeing */
1557 struct ncablk_t {
1558  struct ncomp_t *ancmps;
1559  struct ncablk_t *ncablknxt;
1560 };
1561 
1562 /* array - LOOKATME - one dimensional only so far */
1563 struct rngarr_t {
1564  int32 ni1, ni2;
1565  int32 ai1, ai2;
1566 };
1567 
1568 /* normal wire with delay or path destination wire */
1569 struct rngdwir_t {
1570  int32 ni1, ni2;
1571  unsigned n_delrep : 5;
1572  union del_u n_du;            /* every bit has same delay for nets */
1573  i_tev_ndx *wschd_pbtevs;     /* any schd. event ndxes - indexed nwid*inst */
1574 };
1575 
1576 struct rngwir_t {
1577  int32 ni1, ni2;
1578 };
1579 
1580 /* various extra storage information for various stages for nets */
1581 union nx_u {
1582  struct ncomp_t *ct;          /* compile time value */
1583  struct rngarr_t *rngarr;
1584  struct rngdwir_t *rngdwir;
1585  struct rngwir_t *rngwir;
1586 };
1587 
1588 union np_u {
1589  struct gref_t *npgrp;        /* xmr glb that needs normal downward proc. */
1590  struct itree_t *filtitp;     /* for root or uprel xmr filt to 1 inst */
1591  struct h_t *vpihp;           /* for vpi_ added, the assoc. handle */
1592 };
1593 
1594 /* auxiliary list struct of lists of per inst dce lsts for qcaf lhs concats */
1595 struct dceauxlstlst_t {
1596  /* SJM 06/23/02 - for wire dce list for 1 lhs bit but ndx is per inst/bit */
1597  struct dceauxlst_t **dcelsttab; /* peri(/bit) tab of ptrs to dce lsts */
1598  struct dceauxlstlst_t *dcelstlstnxt;
1599 };
1600 
1601 /* auxiliary list struct for removing dce's of various types */
1602 struct dceauxlst_t {
1603  struct dcevnt_t *ldcep;
1604  struct dceauxlst_t *dclnxt;
1605 };
1606 
1607 struct dvchgnets_t {
1608  struct net_t *dvchg_np;
1609  struct itree_t *dvchg_itp;
1610  struct dvchgnets_t *dvchgnxt;
1611 };
1612 
1613 union dce_u {
1614  struct gref_t *dcegrp;       /* xmr glb that needs normal downward proc. */
1615  int32 pnum;                  /* for pvc dce tf routine port number */
1616  struct task_t *tskp;         /* for dmpv dce, task variable in */
1617  struct cbrec_t *dce_cbp;     /* cbrec for vpi_ val chg callback */
1618 };
1619 
1620 /* SJM 06/12/02 - need 2nd union to separate different types of data */
1621 union dce2_u {
1622  struct fmonlst_t *dce_fmon;  /* nil if monit else fmon record for monitors */
1623  struct expr_t *dce_pvc_fcallx; /* pvc misctf fcall expr */
1624  struct st_t *dce_pvc_stp;    /* pvc misctf statment */
1625  struct qcval_t *dce_qcvalp;  /* for qcaf dce, stmts qcval record */
1626 };
1627 
1628 /* for edge where value expr., need general information for filtering */
1629 /* all decomposed dce's from expr, pt. to one of these */
1630 struct dce_expr_t {
1631  struct expr_t *edgxp;
1632  byte *bp;
1633  struct dcevnt_t *mast_dcep;  /* one master (first) for alloc and init */
1634 };
1635 
1636 /* fixed (except $monitor chges) list off wire of things to trigger */
1637 struct dcevnt_t {
1638  unsigned dce_typ : 8;        /* itree location and action match type */
1639  unsigned dce_xmrtyp : 2;     /* indicates if xmr and type */
1640  unsigned dce_1inst : 1;      /* one instance form must match match itp */
1641  unsigned dce_edge : 1;       /* T => need edge filtering  */
1642  unsigned dce_edgval : 8;     /* edge signature for filter (only pos/neg) */
1643  unsigned dce_nomonstren : 1; /* T => ignore stren for monit of stren */
1644  unsigned dce_tfunc : 1;      /* T => for pvc dce func. not task */
1645  unsigned dce_off : 1;        /* for byte code PLI/monitor need dce on/off */
1646  unsigned is_fmon : 1;        /* monitor is fmon */
1647  union pck_u prevval;         /* storage for wire or range for non dmpv */
1648  int32 dci1;                  /* for range dci2 union for IS param */
1649  union intptr_u dci2;         /* for IS param union rng ptr (dci1 = -2) */
1650  struct net_t *dce_np;        /* net this dce is triggerd by */
1651  struct delctrl_t *st_dctrl;  /* statement's delay control record */
1652  union dce_u dceu;            /* for xmr - propagation gref info */
1653  union dce2_u dceu2;          /* nil if monit else fmon record */
1654  struct itree_t *dce_matchitp;/* for 1 inst. must match this itree target */
1655  struct itree_t *dce_refitp;  /* for 1 inst. this is reference itree loc */
1656  struct itree_t *iact_itp;    /* for per inst. iact need inst. to match */
1657  struct dce_expr_t *dce_expr; /* for edge where need expr old val and expr */
1658  struct dcevnt_t *dcenxt;     /* next on wire dcelst */
1659 };
1660 
1661 /* built in table for every built in primitive (gate) */
1662 struct primtab_t {
1663  unsigned gateid : 8;
1664  unsigned gclass : 8;         /* class of gate */
1665  struct sy_t *gnsym;
1666  char *gatnam;
1667 };
1668 
1669 /* table for system task info */
1670 struct systsk_t {
1671  word32 stsknum;              /* systask ind or 1000+index veriusertfs[] */
1672  char *stsknam;               /* name of system task or pli task */
1673 };
1674 
1675 /* list for +loadvpi or +loadpli1 dynamic lib and bootstrap function pairs */
1676 union dynlb_u {
1677  void (*vpi_rout)(void);
1678  void *(*tf_rout)(void);
1679 };
1680 
1681 /* need list of boot strap routines because option allows more than one */
1682 struct dynboot_t {
1683  char *bootrout_nam;
1684  union dynlb_u dynu;
1685  struct t_tfcell *ret_veriusertf;
1686  struct dynboot_t *dynbootnxt;
1687 };
1688 
1689 struct loadpli_t {
1690  unsigned pli1_option : 1;    /* T => +loadpli1= option */
1691  char *libnam;
1692  struct dynboot_t *dynblst;   /* list of boot routines (can be empty) */
1693  /* for pli1, if non nil ptr to veriusertf tab */
1694  struct loadpli_t *load_plinxt;
1695 };
1696 
1697 struct tfinst_t {
1698  struct expr_t *callx;
1699  struct st_t *tfstp;
1700  struct itree_t *tfitp;
1701  struct task_t *tftskp;
1702 };
1703 
1704 /* table for system function info */
1705 struct sysfunc_t {
1706  word32 syfnum;               /* sysfunc ind. or 1000+ind veriusertfs[] */
1707  unsigned retntyp : 8;
1708  unsigned retsigned : 1;      /* need for signed wire */
1709  unsigned tftyp : 8;          /* type */
1710  int32 retwid;                /* for veriuser and vpi systf sizetf call sets */
1711  char *syfnam;                /* name of system function */
1712 };
1713 
1714 union vsystf_u {
1715  struct expr_t *sysfcallx;    /* if systf fcall, vpi_ systf call expr. */
1716  struct st_t *syststp;        /* stmt vpi_ systf call or task enable in */
1717 };
1718 
1719 /* list element for each location vpi_ systf appears in source */
1720 /* cross linked through sz_u from calling expr node */
1721 struct vpisystf_t {
1722  unsigned is_sysfunc : 1;     /* t +> vpi_ systf func */
1723  unsigned vstffnam_ind : 16;
1724  int32 vstflin_cnt;
1725  struct mod_t *curmdp;        /* ptr. to current mod source line of call in */
1726  struct task_t *curtskp;      /* ptr. to current task source line of call in */
1727  union vsystf_u vsystfu;      /* ptr to callx or sys task stmt */
1728  struct vpisystf_t *vpistfnxt;
1729 };
1730 
1731 union mpp_afunc_u {
1732  /* routine for input cross port assign */
1733  void (*mpp_downassgnfunc)(register struct expr_t *,
1734   register struct expr_t *, struct itree_t *);
1735  /* routine for output cross port assign */
1736  void (*mpp_upassgnfunc)(register struct expr_t *,
1737   register struct expr_t *, struct itree_t *);
1738 };
1739 
1740 /* work record for decomposed into per bit declarative assign */
1741 struct pbexpr_t {
1742  unsigned ndx_outofrng : 1;
1743  unsigned rhs_const : 1;
1744  unsigned no_rhs_expr : 1;     /* lhs widers bits need 0/z assign */
1745  struct expr_t *xp;
1746  int32 bi;                     /* for bsel/psel offset in var object */
1747  word32 aval;                  /* aways 1 bit constant value (for rhs only) */
1748  word32 bval;
1749 };
1750 
1751 /* module port element */
1752 struct mod_pin_t {
1753  unsigned mptyp : 3;          /* I/O type - maybe changed with warning */
1754  unsigned mp_explicit : 1;    /* T => source explicit port reference */
1755  unsigned mp_jmpered : 1;     /* T => port has net also in other port */
1756  unsigned inout_unc : 1;      /* T => this inout unc. somewhere */
1757  unsigned assgnfunc_set : 1;  /* T => know the port assign func */
1758  unsigned has_mipd : 1;       /* T => input port has mipd delay */
1759  unsigned has_scalar_mpps : 1;/* T => simulated per bit */
1760  unsigned mpfnam_ind : 16;    /* file symbol defined in */
1761  int32 mplin_cnt;             /* def. line no. */
1762  int32 mpwide;                /* width of port */
1763 
1764  char *mpsnam;                /* name not symbol of port (can be NULL) */
1765  struct expr_t *mpref;        /* expression form port list (const.) */
1766  struct attr_t *mpattrs;      /* all I/O decls attrs for conn nets */
1767 
1768  /* union of proc ptrs  for input/output cross port assign */
1769  union mpp_afunc_u mpaf;
1770  struct mod_pin_t *pbmpps;    /* for rhs hconn input port, per bit mpp */
1771  struct mod_pin_t *mpnxt;     /* elaborate time next link */
1772 };
1773 
1774 /* table build per line for wild card processing */
1775 struct wcard_t {
1776  int32 wcinum;                /* in port (also state) numb for wild card */
1777  char wcchar;                 /* wild card ? or b */
1778 };
1779 
1780 /* udp table storage */
1781 struct utline_t {
1782  /* these must be char pairs even for combinatorial */
1783  unsigned ulhas_wcard : 1;
1784  unsigned ullen : 8;          /* length of original tline in bytes */
1785  unsigned utabsel : 8;        /* first edge char table select (maybe wc) */
1786  unsigned uledinum : 8;       /* input position number of one allowed edge */
1787  unsigned utlfnam_ind : 16;   /* file no. of udp line */
1788  int32 utlin_cnt;             /* line no. of udp tble line */
1789  char *tline;                 /* table line - for edge 2nd char in line */
1790  struct utline_t *utlnxt;
1791 };
1792 
1793 /* special struct for udp tables */
1794 struct udptab_t {
1795  word32 *ludptab;
1796  /* alloced according to required size (max 27 pointers to tabs of words */
1797  word32 **eudptabs;
1798 };
1799 
1800 struct udp_t {
1801  unsigned utyp : 4;
1802  unsigned numins : 8;         /* number of inputs */
1803  unsigned numstates : 8;      /* for combinatorial same else one more */
1804  unsigned ival : 8;           /* initial value (0,1,3 - none) */
1805  unsigned u_used : 1;         /* T => need table, instanciated in some mod */
1806  unsigned u_wide : 1;         /* T => uses alt. wide representation */
1807  int32 uidnum;                /* tmp. id number for counting */
1808  struct sy_t *usym;
1809  struct symtab_t *usymtab;    /* symbol table just for terminals */
1810  struct mod_pin_t *upins;     /* defined ports for order */
1811  struct utline_t *utlines;
1812  struct udp_t *udpnxt;
1813  struct udptab_t *utab;
1814 };
1815 
1816 /* task port (like procedural variable - all info in reg(wire)) */
1817 struct task_pin_t {
1818  unsigned trtyp : 8;          /* i/o type (same as sym np iotyp) */
1819  struct sy_t *tpsy;           /* port name sym. points to wire/reg */
1820  struct task_pin_t *tpnxt;
1821 };
1822 
1823 /* procedureal assignment statement */
1824 struct proca_t {
1825  struct expr_t *lhsx;         /* need to make sure this is an lvalue */
1826  struct expr_t *rhsx;
1827 };
1828 
1829 /* quasi continous assigns */
1830 struct qconta_t {
1831  unsigned qcatyp : 8;
1832  unsigned regform : 8;
1833  struct expr_t *qclhsx;
1834  struct expr_t *qcrhsx;
1835  struct dceauxlstlst_t *rhs_qcdlstlst;
1836 };
1837 
1838 /* quasi cont. deassigns - no continuous deassign */
1839 struct qcontdea_t {
1840  unsigned qcdatyp : 8;
1841  unsigned regform : 8;
1842  struct expr_t *qcdalhs;
1843 };
1844 
1845 struct if_t {
1846  struct expr_t *condx;
1847  struct st_t *thenst;
1848  struct st_t *elsest;
1849 };
1850 
1851 struct csitem_t {
1852  struct exprlst_t *csixlst;
1853  struct st_t *csist;          /* for unnamed block can be list */
1854  struct csitem_t *csinxt;
1855 };
1856 
1857 struct case_t {
1858  unsigned castyp : 8;
1859  unsigned maxselwid : 24;
1860  struct expr_t *csx;
1861  struct csitem_t *csitems;    /* first item always default: place holder */
1862 };
1863 
1864 struct wait_t {
1865  struct expr_t *lpx;
1866  struct st_t *lpst;
1867  struct delctrl_t *wait_dctp;
1868 };
1869 
1870 /* for forever and while */
1871 struct while_t {
1872  struct expr_t *lpx;
1873  struct st_t *lpst;
1874 };
1875 
1876 struct repeat_t {
1877  struct expr_t *repx;
1878  word32 *reptemp;             /* per inst. word32 current value tmp */
1879  struct st_t *repst;
1880 };
1881 
1882 struct for_t {
1883  struct st_t *forassgn;
1884  struct expr_t *fortermx;
1885  struct st_t *forinc;
1886  struct st_t *forbody;
1887 };
1888 
1889 /* for Ver 2001 - implicit delay control var list in action stmt */
1890 struct evctlst_t {
1891  struct net_t *evnp;
1892  int32 evi1, evi2;
1893 };
1894 
1895 /* normal separate delay control - but in case of rhs control contains st. */
1896 /* event expression allow events edges of events and oring of ev. exprs */
1897 struct delctrl_t {
1898  unsigned dctyp : 8;          /* event or delay */
1899  unsigned dc_iact : 1;        /* iact delay control */
1900  /* SJM 06/10/02 - distinguish non blocking from blocking event ctrls */
1901  unsigned dc_nblking : 1;     /* T => delay control is non blocking form */
1902  unsigned implicit_evxlst : 1;/* special all rhs's @(*) ev var-ndx list */
1903  unsigned dc_delrep : 5;      /* normal gca delay type */
1904  union del_u dc_du;           /* normal delay union (also used for ev ctrl) */
1905  struct expr_t *repcntx;      /* for rhs ev ctrl repeat form, rep cnt expr */
1906  i_tev_ndx *dceschd_tevs;     /* per inst. scheduled event ndxes */
1907  /* SJM 04/02/01 - need word32 down repeat counter with end when becomes 0 */
1908  word32 *dce_repcnts;         /* per inst. current ev rep down count val */
1909  struct st_t *actionst;
1910 };
1911 
1912 /* header list for each initial always block */
1913 struct ialst_t {
1914  unsigned iatyp : 8;
1915  struct st_t *iastp;
1916 
1917  int32 ia_first_lini;         /* line no. of initial/always */
1918  int32 ia_first_ifi;          /* and file index */
1919  int32 ia_last_lini;          /* line no. of end (mabye in next file) */
1920  int32 ia_last_ifi;           /* end file in case spans multiple files */
1921  struct ialst_t *ialnxt;
1922 };
1923 
1924 union tf_u {
1925  struct expr_t *callx;        /* for tf_ func ptr back to call expr else nil */
1926  struct st_t *tfstp;          /* for tf_ task ptr back to call stmt else nil */
1927 };
1928 
1929 union tfx_u {
1930  struct expr_t *axp;          /* for arg the expr. */
1931  word32 *awp;                 /* for 0th return value just the value */
1932 };
1933 
1934 /* per parameter tfrec record */
1935 struct tfarg_t {
1936  union tfx_u arg;
1937  struct net_t *anp;           /* for is rw, the wire */
1938  byte *old_pvc_flgs;          /* old and sav pvc flags */
1939  byte *sav_pvc_flgs;
1940  struct dltevlst_t **dputp_tedlst;/* per inst ptr to list of delputps */
1941  char **sav_xinfos;           /* per inst evalp saved expr info rec */
1942  union pck_u tfdrv_wp;        /* for rw, pointer to param driver value */
1943 };
1944 
1945 /* extra task call side data for pli tasks/funcs (each call loc. differs) */
1946 struct tfrec_t {
1947  unsigned tf_func : 1;        /* is record for tf_ func */
1948  unsigned fretreal : 1;       /* func. returns real */
1949  unsigned tffnam_ind : 16;
1950  int32 tflin_cnt;
1951  int32 tfanump1;              /* no. of args plus 1 (included 0th func ret) */
1952  int32 fretsiz;               /* for function return size (sizetf ret. val) */
1953  union tf_u tfu;              /* ptr back to tf_ task or function */
1954  struct mod_t *tf_inmdp;      /* module in (for inst. number) */
1955  struct task_t *tf_intskp;    /* task call in (nil in in init/always */
1956  struct tfarg_t *tfargs;      /* per parameter param record table */
1957  char **savwrkarea;           /* per inst saved work areas */
1958  i_tev_ndx *sync_tevp;        /* per inst ndx to sync event */
1959  i_tev_ndx *rosync_tevp;      /* per inst ndx to ro sync event in list */
1960  byte *asynchon;              /* per inst. async on flag */
1961  struct tevlst_t **setd_telst; /* per inst ptr to list of set dels */
1962  struct dceauxlst_t **pvcdcep;/* per inst dce list but all parameters */
1963  struct tfrec_t *tfrnxt;      /* linked list */
1964 };
1965 
1966 /* vpi handle union of internal d.s. elements */
1967 union h_u {
1968  struct gate_t *hgp;
1969  struct net_t *hnp;
1970  struct task_t *htskp;        /* also named block and function */
1971  struct mod_t *hmdp;          /* for mods in modsyms table */
1972  struct ialst_t *hialstp;     /* process - init or always */
1973  struct mod_pin_t *hmpp;      /* udp port or net-pin list mod. I/O port */
1974  struct conta_t *hcap;        /* pointer to conta */
1975  struct spcpth_t *hpthp;      /* point back to path for special id symbol */
1976  struct dfparam_t *hdfp;      /* for defparam source reconstruction handles */
1977  struct tchk_t *htcp;         /* and back to time check */
1978  struct expr_t *hxp;          /* representation as ptr to expr. */
1979  struct st_t *hstp;           /* statement handle */
1980  struct csitem_t *hcsip;      /* case item */
1981  int32 hpi;                   /* for port bit handle the port index */
1982  /* this is only contents field that is freed */
1983  struct pviter_t *hiterp;     /* iterator indirect element with alloc list */
1984  struct cbrec_t *hcbp;        /* callback handle guts record */
1985  i_tev_ndx htevpi;            /* event ndx for sched. vpi put value only */
1986  struct net_pin_t *hnpp;      /* for driver the drvr net pin record */
1987  struct udp_t *hudpp;         /* udp handle object record */
1988  struct utline_t *hutlp;      /* udp line for table entry handle */
1989  struct schdev_t *hevrec;     /* pending vpi_ driver all net sched. evs tab */
1990  void *hanyp;                 /* any ptr so do not need to cast to it */
1991  struct hrec_t *hfreenxt;     /* ptr to next hrec on free list */
1992 };
1993 
1994 /* non-blocking event list */
1995 struct nb_event_t {
1996  i_tev_ndx nb_tevpi;
1997  struct nb_event_t *nbnxt;
1998 };
1999 
2000 /* handle object event table record for scheduled vector events */
2001 struct schdev_t {
2002  struct net_t *evnp;
2003  i_tev_ndx *evndxtab;
2004 };
2005 
2006 /* actual handle */
2007 struct h_t {
2008  struct hrec_t *hrec;         /* hadnle content record */
2009  struct itree_t *hin_itp;     /* itree inst object in (if relevant) */
2010 };
2011 
2012 /* handle contents */
2013 struct hrec_t {
2014  unsigned htyp : 16;          /* vpi object type of handle */
2015  unsigned htyp2 : 16;         /* extra type */
2016  unsigned h_magic : 11;       /* magic number for internal checking */
2017  unsigned in_iter : 1;        /* part of iterr, free when iterator freed */
2018  unsigned free_xpr : 1;       /* free expr. when free handle */
2019  unsigned evnt_done : 1;      /* for vpi schd event, event happened */
2020  unsigned bith_ndx : 1;       /* bit handle index form (also any tab form) */
2021  union h_u hu;                /* ptr to object (could be void *) */
2022  int32 hi;                    /* for bit of object handle the index */
2023  struct task_t *hin_tskp;     /* task (scope) handle in (or ialst) */
2024 };
2025 
2026 struct pviter_t {
2027  struct h_t *scanhtab;        /* table of handles built by vpi iterator */
2028  struct hrec_t *ihrectab;     /* table of handle content records */
2029  int32 nxthi;                 /* next handle to return */
2030  int32 numhs;                 /* total number of handles for iterator */
2031 };
2032 
2033 struct onamvpi_t {
2034  char *vpiobjnam;
2035  word32 vpiotyp;              /* redundant value same as obj constant ind */
2036 };
2037 
2038 struct pnamvpi_t {
2039  char *vpipropnam;
2040  int32 vpiproptyp;            /* redundant value same as prop constant ind */
2041 };
2042 
2043 struct opnamvpi_t {
2044  char *vpiopnam;
2045  int32 vpioptyp;              /* redundant value same as op constant ind */
2046  char *vpiopchar;             /* operator character (such as +) */
2047 };
2048 
2049 union systf_u {
2050  struct systsk_t *stbp;
2051  struct sysfunc_t *sfbp;
2052 };
2053 
2054 struct systftab_t {
2055  unsigned systf_chk : 1;      /* T => already seen in source and checked */
2056  void *vpi_sytfdat;
2057  union systf_u sfu;
2058 };
2059 
2060 /* guts of callback handle - separate handle for each instance */
2061 /* info from passed user cb_data record copied into here */
2062 struct cbrec_t {
2063  unsigned cb_reason : 12;     /* reason field from passed cb_data rec. */
2064  unsigned cb_rettimtyp : 6;   /* time record field type to return */
2065  unsigned cb_retvalfmt : 7;   /* value record field format to return */
2066  unsigned cb_class : 3;       /* internal scheduling class */
2067  unsigned cb_ndxobj : 1;      /* T => value chg handle is indexed */
2068  unsigned cb_user_off : 1;    /* T => user turned off with sim control */
2069  unsigned cb_gateout : 1;     /* T => gate outut val chg type cb */
2070  struct h_t *cb_hp;           /* object */
2071  int32 (*cb_rtn)();           /* cb_data call back routine */
2072  char *cb_user_data;          /* user data field from passed cb_data rec. */
2073  struct dceauxlst_t *cbdcep;  /* list of dces for cb removal */
2074  i_tev_ndx cbtevpi;           /* ndx (ptr) back to event */
2075  struct h_t *cb_cbhp;         /* associated handle of call back */
2076  struct cbrec_t *cbnxt;       /* next in chain of all callbacks */
2077  struct cbrec_t *cbprev;      /* previous in chain of all callbacks */
2078 };
2079 
2080 /* list for release and force cb all forms - many cbs possible */
2081 struct rfcblst_t {
2082  struct cbrec_t *rfcbp;
2083  struct rfcblst_t *rfcbnxt;
2084 };
2085 
2086 /* SJM 06/20/02 - for monit now bld dces where can during prep, need dce ptr */
2087 struct monaux_t {
2088  unsigned dces_blt : 1;       /* T => dces already built for this monit */
2089  byte *argisvtab;             /* tab of v format flags for monitor */
2090  struct dceauxlst_t **mon_dcehdr; /* lst of per inst dces bld during prep */
2091 };
2092 
2093 /* SJM 06/20/02 - change sys task aux field to union instead of casts */
2094 /* sys task call union for PLI systf calls and monitor/fmonitor aux info */
2095 union tkcaux_u {
2096  struct tfrec_t *trec;        /* ptr to aux pli tf_ data */
2097  struct monaux_t *mauxp;      /* ptr to mon aux v format flag and dce ptr */
2098  void *vpi_syst_datap;
2099 };
2100 
2101 struct tskcall_t {
2102  struct expr_t *tsksyx;       /* task symbol or global table entry */
2103  struct expr_t *targs;        /* FCCOM expr of args */
2104  union tkcaux_u tkcaux;       /* ptr to aux pli tf_ data or monit rec */
2105 };
2106 
2107 struct dsable_t {
2108  struct expr_t *dsablx;       /* expr. (ID/GLB) of disable task/func/blk */
2109  struct st_t *func_nxtstp;    /* for functions disable is goto */
2110 };
2111 
2112 struct fj_t {
2113  struct st_t **fjstps;        /* ptr to tab (nil ended) fork-join stmts */
2114  int32 *fjlabs;               /* ptr to tab of fj start lab nums */
2115 };
2116 
2117 /* slot end stmt list for strobes with itree where execed strobe appeared */
2118 struct strblst_t {
2119  struct st_t *strbstp;
2120  struct itree_t *strb_itp;
2121  struct strblst_t *strbnxt;
2122 };
2123 
2124 /* slot end triggered fmonitor list */
2125 struct fmselst_t {
2126  struct fmonlst_t *fmon;
2127  struct fmselst_t *fmsenxt;
2128 };
2129 
2130 /* acctivated fmonitor list with itree location */
2131 struct fmonlst_t {
2132  word32 fmon_forcewrite;
2133  struct st_t *fmon_stp;
2134  struct itree_t *fmon_itp;
2135  struct fmselst_t *fmse_trig; /* set when monitor triggered 1st time */
2136  struct dceauxlst_t *fmon_dcehdr;
2137  struct fmonlst_t *fmonnxt;
2138 };
2139 
2140 /* union either 4 byte ptr or 12 byte union in statment */
2141 /* save space since previously needed 4 byte ptr plus record */
2142 union st_u {
2143  struct proca_t spra;
2144  struct if_t sif;
2145  struct case_t scs;
2146  struct while_t swh;
2147  struct wait_t swait;
2148  struct repeat_t srpt;
2149  struct for_t *sfor;
2150  struct delctrl_t *sdc;
2151  struct task_t *snbtsk;       /* named (like task) block */
2152  struct st_t *sbsts;          /* unnamed block statement list */
2153  struct fj_t fj;              /* fj 2 tabs (1 stps and 1 fj c code labs */
2154  struct tskcall_t stkc;
2155  struct qconta_t *sqca;       /* assign and force */
2156  struct qcontdea_t sqcdea;    /* deassign and release */
2157  struct expr_t *scausx;       /* cause expr. node symbor or global id. */
2158  struct dsable_t sdsable;     /* disable struct (also place for goto dest) */
2159  struct st_t *sgoto;          /* destination of added goto */
2160 };
2161 
2162 /* statement structure */
2163 struct st_t {
2164  unsigned stmttyp : 5;
2165  unsigned rl_stmttyp : 5;     /* for break set at statment, real type */
2166  unsigned st_unbhead : 1;     /* if unnamed block removed, indicated here */
2167  unsigned strb_seen_now : 1;  /* T => for checking strobe on list for now */
2168  unsigned lpend_goto : 1;     /* T => this is loopend goto */
2169  unsigned dctrl_goto : 1;     /* T => this is next after dctrl chain goto */
2170  unsigned lstend_goto : 1;    /* T => list end continue goto */
2171  unsigned st_schd_ent : 1;    /* T => can be first stmt entered from schd */
2172  unsigned lpend_goto_dest : 1; /* dest. of loop end back goto for compiler */
2173  unsigned stfnam_ind : 16;
2174  int32 stlin_cnt;
2175  union st_u st;
2176  struct st_t *stnxt;
2177 };
2178 
2179 /* contents of break point table */
2180 struct brkpt_t {
2181  unsigned bp_type : 4;        /* type of breakpoint */
2182  unsigned bp_can_halt : 1;    /* T => really break, F start and reset */
2183  unsigned bp_enable : 1;      /* T => break not disabled */
2184  unsigned bp_prttyp : 2;      /* type of printing when hit */
2185  unsigned bp_dup : 1;         /* T => multiple break points at statement */
2186  unsigned bp_rm_when_hit : 1; /* T => remove when hit */
2187  int32 bp_num;                /* identifying number */
2188  int32 bp_ignore_cnt;
2189  int32 bp_hit_cnt;            /* number of times hit */
2190  struct st_t *bp_stp;         /* statement this break point breaks at */
2191  struct itree_t *bp_itp;      /* itree loc. - any (first?) for all of type */
2192  struct task_t *bp_tskp;      /* task break point in else NULL if not */
2193  struct expr_t *bp_condx;     /* :cond cmd filter expr. */
2194  /* expressions and watch point values go here */
2195  struct brkpt_t *bpnxt;
2196 };
2197 
2198 struct dispx_t {
2199  unsigned dsp_enable : 1;
2200  unsigned dsp_frc_unsign : 1;
2201  int32 dsp_num;
2202  int32 dsp_prtfmt;
2203  int32 dsp_prtwidth;
2204  struct expr_t *dsp_xp;
2205  struct itree_t *dsp_itp;
2206  struct task_t *dsp_tskp;
2207  struct dispx_t *dsp_nxt;
2208 };
2209 
2210 /* horizontal doubly linked list of task threads */
2211 struct tskthrd_t {
2212  struct tskthrd_t *tthd_l, *tthd_r;
2213  struct thread_t *tthrd;
2214 };
2215 
2216 /* task definition - type of task name symbol determines task type */
2217 struct task_t {
2218  unsigned tsktyp : 8;         /* symbol number giving task type */
2219  unsigned t_used : 1;         /* T => task/func. invoked some where */
2220  unsigned thas_outs : 1;      /* T => task has outs that must be stored */
2221  unsigned thas_tskcall : 1;   /* T => task contains other task call */
2222  unsigned fhas_fcall : 1;     /* T => func contains non sys fcall */
2223  unsigned tf_lofp_decl : 1;   /* T => t/f hdr list of port decl form */
2224  struct sy_t *tsksyp;         /* name symbol in module level table */
2225  int32 tsk_last_lini;         /* line no. of end (mabye in next file) */
2226  int32 tsk_last_ifi;          /* end file in case spans multiple files */
2227  struct symtab_t *tsksymtab;  /* symbol table for objects in task */
2228  struct st_t *st_namblkin;    /* stmt named block in in */
2229  struct task_pin_t *tskpins;  /* task ports - procedural not wires */
2230  struct net_t *tsk_prms;      /* parameters defined in task */
2231  struct net_t *tsk_locprms;   /* local parameters defined in task */
2232  int32 tprmnum;               /* number of task parameters */
2233  int32 tlocprmnum;            /* number of task local parameters */
2234  struct net_t *tsk_regs;      /* list then array of nets in task */
2235  int32 trnum;                 /* number of task regs */
2236  struct st_t *tskst;          /* one task statement (usually a block) */
2237  struct task_t *tsknxt;       /* next defined task in current module */
2238  struct tskthrd_t **tthrds;   /* per inst. list of active threads for task */
2239 };
2240 
2241 /* symbol table tree nodes */
2242 struct tnode_t {
2243  unsigned bal : 8;
2244  unsigned via_dir : 8;
2245  struct sy_t *ndp;
2246  struct tnode_t *lp, *rp;
2247 };
2248 
2249 /* symbol table element (type) pointer union */
2250 union el_u {
2251  struct cell_t *ecp;
2252  struct inst_t *eip;
2253  struct gate_t *egp;
2254  struct net_t *enp;
2255  struct st_t *estp;
2256  struct delctrl_t *edctp;     /* delay ctrl for re prep pnps */
2257  struct task_t *etskp;        /* also named block and function */
2258  struct systsk_t *esytbp;     /* pointer to system task table entry */
2259  struct sysfunc_t *esyftbp;   /* pointer to system func. table entry */
2260  struct mod_t *emdp;          /* for mods in modsyms table */
2261  struct primtab_t *eprimp;    /* for prims (gates) in modsyms table */
2262  struct udp_t *eudpp;         /* for udps in modsysm table */
2263  struct mod_pin_t *empp;      /* udp port or net-pin list mod. I/O port */
2264  char *edfchp;                /* value of `define macros in defsyms table */
2265  struct amac_t *eamacp;       /* value for macro with arguments */
2266  struct conta_t *ecap;        /* pointer to conta */
2267  struct spcpth_t *epthp;      /* point back to path for special id symbol */
2268  struct tchk_t *etcp;         /* and back to time check */
2269  int32 eii;                   /* index of inst. in mod inst list or ni */
2270  struct tchg_t *etchgp;       /* time change record */
2271  struct chktchg_t *echktchgp; /* check time change record */
2272  struct undef_t *eundefp;     /* for undefined temp. link to list el. */
2273  struct tfrec_t *etfrp;       /* ptr to tf_ func/task record */
2274  void *eanyp;                 /* castable void * for special cases */
2275  struct mipd_t *emipdbits;    /* ptr to per bit mipd record for MIPD npp */
2276 };
2277 
2278 
2279 /* net pin aux struct for special cases */
2280 struct npaux_t {
2281  int32 nbi1;                  /* range of connection (-1 for all) */
2282  /* convention if nbi1 is -2, nbi2 is word32 * union ptr to 2 ISNUM tables */
2283  union intptr_u nbi2;         /* for IS param union rng ptr (dci1 = -2) */
2284  int32 lcbi1, lcbi2;          /* if fi is lhs concat, the rhs val subrange */
2285  union np_u npu;
2286  /* for src down itree loc tab for root, must match targ. itree */
2287  /* SJM 05/14/03 - since only for rooted XMR npp, this is addr not peri tab */
2288  struct itree_t *npdownitp;
2289 };
2290 
2291 struct net_pin_t {
2292  unsigned npntyp : 4;         /* type of net pin connection */
2293  unsigned npproctyp : 2;      /* type of npp processing needed */
2294  unsigned chgsubtyp : 3;      /* for change the change subtype */
2295  unsigned np_xmrtyp : 2;      /* xmr type */
2296  unsigned pullval : 1;        /* for pull driver 0 or 1 */
2297  unsigned obnum : 20;         /* port index number */
2298  int32 pbi;                   /* for per bit bit index */
2299 
2300  union el_u elnpp;            /* net pin connecting objects */
2301  struct npaux_t *npaux;       /* aux. for net pins needing special fields */
2302  struct net_pin_t *npnxt;
2303 };
2304 
2305 /* parm nplist for delay update on param change delay anotation */
2306 struct parmnet_pin_t {
2307  unsigned pnptyp : 8;         /* delay expr (or list) type param ref. in */
2308  unsigned pnp_free : 1;       /* T => master ptr to delay need to free */
2309  union el_u elpnp;            /* in mod element with delay */
2310  struct paramlst_t *pnplp;    /* param list (all dels) - copy or orig */
2311  struct parmnet_pin_t *pnpnxt;
2312 };
2313 
2314 /* PLI list of mod port or iconn npp's not yet processed for XL style iters */
2315 struct xldlnpp_t {
2316  struct net_pin_t *xlnpp;
2317  struct itree_t *xlitp;
2318  struct xldlnpp_t *xlnxt;
2319 };
2320 
2321 /* record accessed through sorted index of net/bits with xl style drv/lds */
2322 struct xldlvtx_t {
2323  struct net_t *dlnp;
2324  int32 dlbi;
2325  struct itree_t *dlitp;
2326 };
2327 
2328 /* edge list - since both vertices point to this */
2329 struct edge_t {
2330  struct vtx_t *ev2;           /* other side edge, this side is cur vtx */
2331  struct itree_t *edgoside_itp; /* edge other side itree loc (nil if same) */
2332  /* npnxt has value for traux list for vpi - tran chan must not touch */
2333  struct net_pin_t *enpp;      /* npp of connecting edge (npp) */
2334  struct edge_t *enxt;
2335 };
2336 
2337 /* vertex of tran graph - only traversed thru edges - need npp itp chg */
2338 struct vtx_t {
2339  unsigned new_vtxval : 8;     /* for tran chan, new value */
2340  unsigned old_vtxval : 8;     /* value at start of tran relax */
2341  unsigned vtx_chged : 1;      /* T => vertex changes - when done store */
2342  unsigned vtx_in_vicinity : 1;/* T => vertex already in vincinity */
2343  unsigned vtx_forced : 1;     /* T => vertex is forced */
2344  unsigned vtx_supply : 1;     /* T => vertex hard drivers/decl supply */
2345  unsigned vtx_mark : 1;       /* mark bit used for cutting cycles */
2346  unsigned vtx_mark2 : 1;      /* mark bit used for turning off marks */
2347  struct net_t *vnp;           /* net in channel */
2348  int32 vi1;                   /* bit index for vector wire */
2349  struct edge_t *vedges;       /* ptr to adjacency list for this node */
2350 };
2351 
2352 /* per bit vtx and chan. id table for this static inst. loc. */
2353 struct vbinfo_t {
2354  int32 chan_id;               /* ID for channel */
2355  struct vtx_t *vivxp;         /* vertex */
2356 };
2357 
2358 /* net tran aux record on - exists if net on some bid or tran channel */
2359 struct traux_t {
2360  union pck_u trnva;           /* per inst hard driver values for all of net */
2361  struct vbinfo_t **vbitchans; /* (chan_id, vtx) per bit or bit-inst */
2362  /* notice this uses npp npnxt field because unused by edges */
2363  struct net_pin_t *tran_npps; /* ptr to linked tran chan npps */
2364 };
2365 
2366 /* list element for tran channel relaxation */
2367 struct vtxlst_t {
2368  struct vtx_t *vtxp;
2369  struct itree_t *vtx_itp;
2370  struct vtxlst_t *vtxnxt;
2371 };
2372 
2373 /* list of net/bits in switch channel for init and change processing */
2374 struct bidvtxlst_t {
2375  struct net_t *vnp;           /* net in channel */
2376  int32 vi1;                   /* bit index for vector wire */
2377  struct itree_t *bidvtx_itp;
2378  struct bidvtxlst_t *bidvtxnxt;
2379 };
2380 
2381 /* per channel info - some needed for future rtran(if) cutting */
2382 struct chanrec_t {
2383  unsigned chtyp : 3;          /* channel processing type */
2384  unsigned chan_diffwtyps : 1; /* T => different wire types in channel */
2385  unsigned chan_no_vtxs : 1;   /* T => for pure bid after cnvt to list */
2386  struct vtx_t *chvxp;         /* for now one random vertex */
2387  struct itree_t *chvitp;      /* and its itree loc. */
2388  struct bidvtxlst_t *bid_vtxlp;  /* for bid only, list with itree loc */
2389  word32 numvtxs;              /* number of vertices (net-bits) in channel */
2390 };
2391 
2392 /* master dumpvar header record for module argument */
2393 struct mdvmast_t {
2394  struct itree_t *mdv_itprt;   /* itree root of subtree or var itree loc */
2395  struct task_t *mdv_tskp;     /* task variable or scope in */
2396  struct net_t *mdv_np;        /* for var. form, pointer to wire */
2397  struct mdvmast_t *mdvnxt;
2398  int32 mdv_levels;            /* level down from $dumpvars call */
2399 };
2400 
2401 struct qcval_t {
2402  unsigned qc_active : 1;      /* T => this net(/bit) force or assign active */
2403  unsigned qc_overridden : 1;  /* T => reg assgn active but force overrides */
2404  struct st_t *qcstp;
2405  int32 qcrhsbi;               /* if concat, rhs low bit index else -1 */
2406  int32 qclhsbi;               /* for wire, select lhs low bit index */
2407  struct itree_t *lhsitp;
2408  struct dceauxlst_t *qcdcep;  /* rhs dce tab of lists */
2409 };
2410 
2411 /* qcval union during prep and exec but other uses earlier and for params */
2412 union nqc_u {
2413  word32 *wp;                  /* for params work saved param val ptr */
2414  int32 npi;                   /* for params fixup sorting/matching val */
2415  struct net_t *nnxt;          /* during src rd and fixup, nets not yet tab */
2416  struct qcval_t *qcval;       /* per inst. (maybe per bit) qc aux records */
2417 };
2418 
2419 /* table of driver and scheduled values for each added vpi_ net driver */
2420 /* know if any at least two, last has both fields nil */
2421 struct vpi_drv_t {
2422  union pck_u vpi_hasdrv;      /* per inst. net wide driver added table */
2423  union pck_u vpi_drvwp;       /* per inst. net wide driver values */
2424  struct dltevlst_t **putv_drv_tedlst;/* per inst per bit pending ev. lists */
2425  struct dltevlst_t **softforce_putv_tedlst; /* per inst/bit pend ev lists */
2426 };
2427 
2428 struct net_t {
2429  unsigned ntyp : 4;
2430  unsigned iotyp : 3;          /* I/O direction */
2431  unsigned n_isaparam : 1;     /* T => net is a parameter */
2432  unsigned srep : 4;           /* storage representation of value - nva fld */
2433  unsigned nrngrep : 3;        /* representation for net ranges - nx_u fld */
2434  unsigned n_isavec : 1;       /* this is a vector */
2435  unsigned vec_scalared : 1;   /* wire is scalared (bit by bit, T if scalar) */
2436  unsigned n_isarr : 1;
2437  unsigned n_signed : 1;
2438  unsigned n_stren : 1;        /* T => needs strength model */
2439  unsigned n_capsiz : 2;       /* special capacitor size constant */
2440  unsigned n_mark : 1;         /* misc. marking flag for var. uses */
2441  unsigned n_multfi : 1;       /* at least one bit fi > 1 */
2442  unsigned n_isapthsrc : 1;    /* T => port net a pth src (or tc ref ev.) */
2443  unsigned n_isapthdst : 1;    /* T => port net is a path dest */
2444  unsigned n_hasdvars : 1;     /* T => at least one inst. dumpvared */
2445  unsigned n_onprocrhs : 1;    /* appears on some procedural rhs */
2446  unsigned n_gone : 1;         /* T => net deleted by gate eater */
2447  /* 03/21/01 - these are fields from removed separate optim table */
2448  unsigned nchg_nd_chgstore : 1;/* need chg store for var */
2449  unsigned nchg_has_dces : 1;  /* T => var currently has delay ctrls */
2450  unsigned nchg_has_lds : 1;   /* var has lds (structural from src */
2451  unsigned frc_assgn_allocated : 1; /* T => force/assign in src or PLI added */
2452  unsigned dmpv_in_src : 1;    /* T => dumpvars for net in src */
2453  unsigned monit_in_src : 1;   /* monit for var somewhere in src */
2454  unsigned n_onrhs : 1;        /* appears on some rhs (also declarative) */
2455  unsigned n_onlhs : 1;        /* appears on some lhs */
2456  unsigned n_drvtyp : 3;       /* for scalar, pre elab p type chg drvr state */
2457  int32 nwid;                  /* net width */
2458  union pck_u nva;             /* storage for net */
2459  struct sy_t *nsym;
2460  union nx_u nu;               /* ptr to auxiliary range and delay values */
2461  struct dcevnt_t *dcelst;     /* fixed list of dce/monit events */
2462  struct net_pin_t *ndrvs;     /* list of net drivers */
2463  struct net_pin_t *nlds;      /* list of loads driven by net */
2464  struct traux_t *ntraux;      /* aux tran channel record */
2465  byte *nchgaction;            /* per inst. (or 0 only) assign action bits */
2466  /* SJM 07/24/00 - need both add driver and soft force for wires */
2467  struct dltevlst_t **regwir_putv_tedlst; /*  per inst (all bits) ev list */
2468  struct vpi_drv_t **vpi_ndrvs;/* ptr to table of ptrs to drivers */
2469  union nqc_u nu2;             /* union - comp. nnxt, and qcval */
2470  struct attr_t *nattrs;       /* table of net's attributes */
2471 };
2472 
2473 /* symbol table contents and avl tree link info */
2474 struct sy_t {
2475  unsigned sytyp : 8;
2476  unsigned sydecl : 1;         /* symbol has been declared */
2477  unsigned syundefmod : 1;     /* undefined mod or udp */
2478  unsigned cfg_needed : 1;     /* T => symbol is used in config */
2479  unsigned sy_impldecl : 1;    /* for wire, declared implicitly */
2480  unsigned sy_argsmac : 1;     /* macro symbol with arguments */
2481  unsigned sy_giabase : 1;     /* T => symbol is g/i array base */
2482  unsigned syfnam_ind : 16;    /* file symbol defined in */
2483  int32 sylin_cnt;             /* def. line no. */
2484  char *synam;
2485  union el_u el;
2486  struct sy_t *spltsy;
2487 };
2488 
2489 /* separate work array storage of global component names */
2490 struct glbncmp_t {
2491  int32 gncsiz;                /* size of largest alloc component (reused) */
2492  char *gncmp;
2493 };
2494 
2495 union targ_u {
2496  struct itree_t *targitp;     /* only for rooted - one target itree place */
2497  struct itree_t **uprel_itps; /* parallel to mod itps dest itree table */
2498 };
2499 
2500 /* global ref. info - master global rec. also used during simulation */
2501 struct gref_t {
2502  unsigned upwards_rel : 1;    /* T => upwards relative form path */
2503  unsigned is_upreltsk : 1;    /* T => upward rel and special just task name */
2504  unsigned is_rooted : 1;      /* T => path starts at top module root */
2505  unsigned path_has_isel : 1;  /* T => down or root path has inst arr select */
2506  unsigned pathisel_done : 1;  /* T => for upward rel., grcmps fixed */
2507  unsigned gr_inst_ok : 1;     /* T => xmr can be inst. maybe just 1 comp. */
2508  unsigned gr_defparam : 1;    /* T => allow parameter as net tail */
2509  unsigned gr_gone : 1;        /* T => for defparam processing - now gone */
2510  unsigned gr_err : 1;         /* T => global is incorrect */
2511  unsigned grfnam_ind : 16;    /* file location of ref. */
2512  int32 grflin_cnt;            /* line location of ref. */
2513  int32 last_gri;              /* last - 1 (1 before target) symbol in path */
2514 
2515  char *gnam;                  /* name */
2516  struct expr_t *gxndp;        /* back link to expr. node containing xmr */
2517  struct expr_t *glbref;       /* original gref expr for inst. array eval. */
2518  struct symtab_t *grsytp;     /* symtab where ref. appears */
2519  struct mod_t *targmdp;       /* module target declared in */
2520  struct task_t *targtskp;     /* if non NULL, task target declared in */
2521  struct mod_t *gin_mdp;       /* place where gref used, for netchg prop. */
2522  struct sy_t **grcmps;        /* table of path symbols (prep fixes ia sels) */
2523  struct expr_t **grxcmps;     /* table of arr of inst path symbol sel exprs */
2524  union targ_u targu;          /* up rel. itp list or rooted 1 target itp */
2525  struct sy_t *targsyp;        /* actual end path symbol in target module */
2526  struct gref_t *spltgrp;      /* ptr from split off grp back to original */
2527  /* SJM 08/18/99 - now using gref tables no next */
2528 };
2529 
2530 /* symbol table - separate for each module */
2531 /* needs union here ? */
2532 struct symtab_t {
2533  unsigned freezes : 1;
2534  unsigned numsyms : 31;
2535  struct tnode_t *n_head;
2536  struct sy_t **stsyms;        /* non null means frozed form */
2537  struct symtab_t *sytpar;     /* parent is enclosing scope */
2538  struct symtab_t *sytsib;     /* sibling is disjoint32 same level scope */
2539  struct symtab_t *sytofs;     /* offspring is list hdr of enclosed scopes */
2540  struct sy_t *sypofsyt;       /* symbol this table is symbol table of */
2541 };
2542 
2543 /* list for saving timing check chk event changes for end of time slot */
2544 struct tc_pendlst_t {
2545  struct chktchg_t *tc_chkchgp;
2546  struct itree_t *tc_itp;
2547  struct tc_pendlst_t *tc_plnxt;
2548 };
2549 
2550 union tchg_u {
2551  struct tchk_t *chgtcp;
2552  struct spcpth_t *chgpthp;
2553 };
2554 
2555 /* time of last chg net pin record - np from context, bit from npp rec. */
2556 struct tchg_t {
2557  union tchg_u chgu;           /* union pointer to associated master */
2558  byte *oldval;                /* per inst. old value of source bit */
2559  word64 *lastchg;             /* per inst. last chg time for this 1 bit */
2560 };
2561 
2562 /* time check change record - access tchk record thru start change */
2563 struct chktchg_t {
2564  struct tchg_t *startchgp;    /* corresponding start wire time change */
2565  byte *chkoldval;
2566  word64 *chklastchg;          /* per inst. last chg time for check event */
2567 };
2568 
2569 /* simulation per bit path delay element */
2570 struct pthdst_t {
2571  struct tchg_t *pstchgp;      /* path src time change and indir. to path */
2572  struct pthdst_t *pdnxt;      /* destination bit can have >1 sources */
2573 };
2574 
2575 /* one path elment */
2576 struct pathel_t {
2577  int32 pthi1, pthi2;          /* specparam then index number value */
2578  struct net_t *penp;          /* path input/out wire - NULL if removed */
2579 };
2580 
2581 /* work data struct for checking multiple same sdpds */
2582 struct xpnd_pthel_t {
2583  unsigned in_equiv_set : 1;
2584  struct spcpth_t *pthp;
2585  int32 peii, peoi;
2586  struct xpnd_pthel_t *xpthnxt;
2587 };
2588 
2589 struct spcpth_t {
2590  unsigned pthtyp : 2;         /* type of path (full or *>) */
2591  unsigned pth_gone : 1;       /* must ignore because of serious error */
2592  unsigned pth_as_xprs : 1;    /* T => fixup not done path els still exprs */
2593  unsigned pth_delrep : 5;     /* delay representation for path */
2594  unsigned pthpolar : 2;       /* simple path polarity (no sim meaning) */
2595  unsigned pthedge : 8;        /* if edge, edge sensitive path */
2596  unsigned dsrc_polar : 2;     /* if edge sensitive polarity */
2597  unsigned pth_ifnone : 1;     /* T => condition is ifnone and other sdpds */
2598  unsigned pth_0del_rem : 1;   /* T => removed from 0 delay */
2599  struct sy_t *pthsym;         /* built symbol for identifying path */
2600  int32 last_pein;
2601  int32 last_peout;
2602  struct pathel_t *peins;      /* array of path input elements */
2603  struct pathel_t *peouts;     /* array of path output elements */
2604  union del_u pth_du;          /* delay value */
2605  struct expr_t *datasrcx;     /* non sim polarity expr, can be FCCOM list */
2606  struct expr_t *pthcondx;     /* for if (cond) sdpd, the cond expr. */
2607  struct spcpth_t *spcpthnxt;
2608 };
2609 
2610 /* timing check system task master record */
2611 struct tchk_t {
2612  unsigned tchktyp : 8;        /* timing check type */
2613  unsigned tc_delrep : 5;      /* limit delay type (will be same for both) */
2614  unsigned tc_delrep2 : 5;     /* type of 2nd limit if present */
2615  unsigned tc_gone : 1;        /* must ignore because of error */
2616  unsigned tc_supofsuphld : 1; /* setup (added) part of setup hold */
2617  unsigned tc_recofrecrem : 1; /* recovery (added) part of recrem */
2618  unsigned tc_haslim2 : 1;     /* lim2 value present */
2619  unsigned startedge : 8;      /* edge byte (pli 1 bit per rf coding) */
2620  unsigned chkedge : 8;        /* edge byte (pli 1 bit per rf coding) */
2621  struct sy_t *tcsym;          /* symbol with constructed name for del set */
2622  struct expr_t *startxp;      /* event (reference) expr */
2623  struct expr_t *startcondx;   /* &&& ref. event or edge path delay sel. */
2624  struct expr_t *chkxp;        /* event (data - check) expr */
2625  struct expr_t *chkcondx;     /* &&& data event or edge path delay sel. */
2626  union del_u tclim_du;        /* 1st limit as delay */
2627  union del_u tclim2_du;       /* 2nd optional limit as delay */
2628  struct net_t *ntfy_np;       /* notify wire (known during fix up) */
2629  struct tchk_t *tchknxt;      /* next in current specify block */
2630 };
2631 
2632 /* concatenation of all module specify items */
2633 struct spfy_t {
2634  struct symtab_t *spfsyms;    /* specify symbol table for specparams */
2635  struct spcpth_t *spcpths;    /* delay paths */
2636  struct tchk_t *tchks;        /* timing checks */
2637  struct net_t *msprms;        /* module's specify parameters */
2638  int32 sprmnum;               /* number of specify parameters in table */
2639 };
2640 
2641 /* SJM 07/10/01 - d.s. for new delay net load propagation algorithm */
2642 /* for inter module paths, each src-dest pair has one of these */
2643 struct impth_t {
2644  unsigned impth_delrep : 8;   /* delrep */
2645  union del_u impth_du;        /* for inter mod non IS del for src/dst pair */
2646  struct net_t *snp;           /* source net */
2647  int32 sbi;                   /* and bit */
2648  struct itree_t *sitp;        /* and itree loc */
2649  word64 lastchg;              /* last chg time for this 1 pth bit of inst */
2650  struct impth_t *impthnxt;    /* for || paths dst has >1 src with diff del */
2651 };
2652 
2653 /* mipd npp elnpp field points to per bit array mipd records */
2654 struct mipd_t {
2655  unsigned no_mipd : 1;        /* T => no mipd delay for this bit */
2656  unsigned pth_mipd : 1;       /* T => do not treat as src-dest inter mod pth */
2657  unsigned pb_mipd_delrep : 5; /* bit's delay type */
2658  union del_u pb_mipd_du;      /* bit's delay - max if src-dst impth */
2659  byte *oldvals;               /* per inst array of old values */
2660  i_tev_ndx *mipdschd_tevs;    /* per inst sched. event ndxes (-1 if none) */
2661  struct impth_t **impthtab;   /* per inst inter mod src-dst pth ptr list */
2662 };
2663 
2664 struct srtmp_t {
2665  int32 mppos;
2666  struct mod_pin_t *smp;
2667 };
2668 
2669 /* top level n.l. entry points - this is a real user defined module */
2670 struct mod_t {
2671  unsigned minstnum : 2;       /* static inst no. 0, 1, 2 (more than once) */
2672  unsigned mhassts : 1;        /* T => module has strength wire(s) */
2673  unsigned msplit : 1;         /* T => module created from defparam splitting */
2674  unsigned mpndsplit : 1;      /* T => split off from # params */
2675  unsigned mhassplit : 1;      /* T => modules split off from this one */
2676  unsigned mgone : 1;          /* T => split from defparam but same params */
2677  unsigned msplitpth : 1;      /* T => module comp. of split off chain */
2678  unsigned mwiddetdone : 1;    /* T => mod width determing param marking done */
2679  unsigned mhas_widthdet : 1;  /* T => module has width determin param */
2680  unsigned mhas_indir_widdet : 1; /* T => module has indr width det param */
2681  unsigned mgiarngdone : 1;    /* T => mod in array of g/i rng marking done */
2682  unsigned mpndprm_ingirng : 1;/* T => module has pound param in gi range */
2683  unsigned mpnd_girng_done : 1;/* T => gi rng pound param eval finished */
2684  unsigned mhasisform : 1;     /* T => at least oe IS form constant in mod */
2685  unsigned mtime_units : 4;    /* no. of significant units of time rounded */
2686  unsigned mtime_prec : 4;     /* prec. - exp. 0 (1 sec.) - 15 (1 fs) */
2687  unsigned mno_unitcnv : 1;    /* F => need for delay unit conv. */
2688  unsigned m_iscell : 1;       /* T => module is asic style cell */
2689  unsigned m_hascells : 1;     /* T => module contains asic style cells */
2690  unsigned mod_hasdvars : 1;   /* T => for at least 1 inst. all vars dumped */
2691  unsigned mod_dvars_in_src : 1;/* T => all vars dumpved in src */
2692  unsigned mod_dumiact : 1;    /* T => dummy iact. info mod. */
2693  unsigned mod_rhs_param : 1;  /* T => mod has param def with rhs param */
2694  unsigned mod_hasbidtran : 1; /* T => has inout mod. port - tran chan */
2695  unsigned mod_hastran : 1;    /* T => has tran gate - tran chan */
2696  unsigned mod_gatetran : 1;   /* T => module has tran gate in it */
2697  unsigned mod_has_mipds : 1;  /* T => mod has SDF or vpi_ only set mipds */
2698  unsigned mod_parms_gd : 1;   /* T => all dependent and pound params right */
2699  unsigned mod_1bcas : 1;      /* T => contains 1 bit ca - special for vpi */
2700  unsigned mod_lofp_decl : 1;  /* T => port decl uses list of ports form */
2701  unsigned mod_dfltntyp : 4;   /* T => for vpi, from directive net dflt type */
2702  unsigned mod_uncdrv : 8;     /* for vpi, mod val of unc drive directive */
2703  unsigned m_inconfig : 1;     /* T => module is from a config file */
2704  unsigned cfg_scanned : 1;    /* T => module has been scanned by config */
2705  unsigned mhas_frcassgn : 1;  /* T => mod contains force/assign(s) */
2706 
2707  int32 flatinum;              /* num. of flattened instances of module */
2708  int32 mpnum;                 /* number of module ports */
2709  int32 minum;                 /* number of instances in module */
2710  int32 mgnum;                 /* number of gates in module */
2711  int32 mcanum;                /* number of non 1 bit cas in module */
2712  int32 mnnum;                 /* number of nets in module */
2713  int32 mtotvarnum;            /* total number of variables mod+task */
2714  int32 mprmnum;               /* number of pound params defined */
2715  int32 mlocprmnum;            /* number of local params defined */
2716  int32 mlpcnt;                /* mod. inst. loop count (static level) */
2717  struct sy_t *msym;           /* symbol from separate module name space */
2718  int32 mod_last_lini;         /* line no. of end (mabye in next file) */
2719  int32 mod_last_ifi;          /* and file in case spans multiple */
2720  struct symtab_t *msymtab;    /* symbol table for objects in module */
2721  struct cfglib_t *mod_cfglbp; /* config lib this mod's cells bound using */
2722  struct mod_pin_t *mpins;     /* defined ports first list then arr. */
2723  struct gate_t *mgates;       /* array of gates, udps and assigns */
2724  struct giarr_t **mgarr;      /* parallel ptr array to mgates for gate arr. */
2725  struct conta_t *mcas;        /* module cont. assigns */
2726  struct inst_t *minsts;       /* array of module instance records */
2727  struct giarr_t **miarr;      /* parallel ptr array to minst for inst arr. */
2728  struct net_t *mlocprms;      /* local param definitions - list then tab */
2729  struct net_t *mprms;         /* local param definitions - list then tab */
2730  struct net_t *mnets;         /* list then array of nets in module */
2731  /* SJM 12/19/04 - only fixed ones from conn npin - vpi added malloced */
2732  struct net_pin_t *mnpins;    /* table of all npins in module */
2733  struct itree_t **moditps;    /* itnum to itree struct mapping table */
2734  struct mod_t *mnxt;          /* next defined module */
2735 
2736  /* new Verilog 2000 fields */
2737  struct attr_t *mattrs;       /* mod attrs - used only if inst has no attr */
2738  struct varinitlst_t *mvarinits; /* list of var (not net) init decls */
2739  i_tev_ndx **mgateout_cbs;    /* per gate ptr to per inst list of vc cbs */
2740 
2741  /* LOOKATME - these are compile only and can maybe be freed after fixup */
2742  int32 mversno;               /* version number for split modules */
2743  int32 lastinum;              /* while assigning inums - last used */
2744  struct mod_t *mlevnxt;       /* link to next same level module */
2745  struct mod_t *mspltmst;      /* pointer to defparam master if split off */
2746  struct mod_t *mpndspltmst;   /* pointer to pound master if split off */
2747  struct cell_t *mcells;       /* unordered list of module objects */
2748  struct srtmp_t *smpins;      /* sorted table of module pins */
2749  struct srcloc_t **iploctab;  /* || to insts ptr tab to tab of port locs */
2750 
2751  struct dfparam_t *mdfps;     /* modules defparams */
2752  struct task_t *mtasks;       /* tasks declared in module */
2753  struct ialst_t *ialst;       /* initial/always list */
2754  struct spfy_t *mspfy;        /* module's specify elements */
2755  char *mndvcodtab;            /* table of dmpvar codes for all nets */
2756 
2757  /* per module record tables - for optimized code and save/restart */
2758  struct expr_t *mexprtab;     /* per mod table of expr. records */
2759  int32 mexprnum;              /* size of mod's expr tab */
2760 
2761  struct st_t *msttab;         /* per mod table of mod stmts */
2762  int32 mstnum;                /* size of mod's stmt tab */
2763 
2764  struct gref_t *mgrtab;       /* list of xmr's appearing in this mod. */
2765  int32 mgrnum;                /* number of grefs in module */
2766 };
2767 
2768 /*
2769  * run time only structures
2770  */
2771 /* doubly linked list of events for cancelling some */
2772 struct dltevlst_t {
2773  i_tev_ndx tevpi;
2774  struct dltevlst_t *telp, *terp;
2775 };
2776 
2777 /* singly linked list of events for cancel (short search from front) */
2778 struct tevlst_t {
2779  i_tev_ndx tevpi;
2780  struct tevlst_t *telnxt;
2781 };
2782 
2783 /* threads - because associated with an event, inst. specific */
2784 struct thread_t {
2785  unsigned tsk_stouts : 1;     /* T => when task returns has outs to store */
2786  unsigned th_dsable : 1;      /* thread done because disabled */
2787  unsigned th_rhsform : 1;     /* T => rhs form so value in thread record */
2788  unsigned th_fj : 1;          /* T => thread is fj - assoc. task is upward */
2789  unsigned th_postamble : 1;   /* T => pending task needs end store/trace */
2790  unsigned th_ialw : 1;        /* T => thread in initial/always list */
2791  unsigned thofscnt : 24;      /* num of still active fork-join offspring */
2792  word32 thenbl_sfnam_ind;     /* file index of place thread enabled from */
2793  int32 thenbl_slin_cnt;       /* and line number */
2794 
2795  struct st_t *thnxtstp;       /* next st. in thread to execute (resume pc) */
2796  /* tree of 2 way linked sibling subthread lists */
2797  struct thread_t *thpar;      /* thread that invoked this one */
2798  struct thread_t *thright;    /* double linked same level right ptr */
2799  struct thread_t *thleft;     /* double linked same level right ptr */
2800  struct thread_t *thofs;      /* list of threads, enabled by this one */
2801  struct tskthrd_t *tthlst;    /* ptr to this task assoc. thrd list el. */
2802  i_tev_ndx thdtevi;           /* if thread has scheduled event, ndx of it */
2803  struct task_t *assoc_tsk;    /* if created from task, connection to it */
2804 
2805  struct delctrl_t *th_dctp;   /* if armed but not trig. ev ctrl, ptr to it */
2806  word32 *th_rhswp;            /* for rhs delay/event controls, rhs value */
2807  int32 th_rhswlen;            /* word32 length of rhs value for disable */
2808  struct itree_t *th_itp;      /* itree loc. thread runs in */
2809  struct hctrl_t *th_hctrl;    /* for iact, pointer to control rec. */
2810 };
2811 
2812 union ten_u {
2813  struct net_t *np;
2814  struct mod_pin_t *mpp;
2815 };
2816 
2817 /* net bit or MIPD event storage - must be alloced and freed as used */
2818 struct tenp_t {
2819  int32 nbi;
2820  union ten_u tenu;
2821 };
2822 
2823 /* storage for scheduled but not matured non blocking assign event */
2824 struct tenbpa_t {
2825  word32 *nbawp;
2826  struct st_t *nbastp;
2827  struct expr_t *nblhsxp;      /* if var ndx expr (maybe cat) const ndx copy */
2828  struct delctrl_t *nbdctp;
2829 };
2830 
2831 /* tf strdelputp event storage - one schedule change (tev has instance) */
2832 struct tedputp_t {
2833  struct tfrec_t *tedtfrp;
2834  int32 tedpnum;
2835  word32 *tedwp;               /* point to both half - know exact lhs word32 len */
2836 };
2837 
2838 /* vpi put value event storage (for both reg net driver assign */
2839 struct teputv_t {
2840  int32 nbi;
2841  int32 di;                    /* for mult. drivers the ndx no. in table */
2842  struct net_t *np;
2843  word32 *putv_wp;
2844  struct h_t *evnt_hp;         /* ptr back to event for cancelling */
2845 };
2846 
2847 union te_u {
2848  struct thread_t *tethrd;
2849  struct gate_t *tegp;
2850  struct conta_t *tecap;
2851  struct tenp_t *tenp;
2852  struct tenbpa_t *tenbpa;
2853  struct tfrec_t *tetfrec;
2854  struct tedputp_t *tedputp;
2855  struct teputv_t *teputvp;
2856  struct h_t *tehp;
2857 };
2858 
2859 struct tev_t {
2860  unsigned tetyp : 5;
2861  unsigned te_cancel : 1;      /* this event canceled */
2862  unsigned nb_evctrl : 1;      /* for non blocking event is event control */
2863  unsigned te_trdecay : 1;     /* event is trireg decay */
2864  unsigned gev_acc : 1;        /* accelerated gate value assign */
2865  unsigned vpi_reschd : 1;     /* T => vpi_ time cb moves to other slot part */
2866  unsigned vpi_onfront : 1;    /* T => cb sim time start, add on fut. front */
2867  unsigned vpi_regwir_putv : 1;/* T => putv to reg/wire soft force */
2868  unsigned outv : 8;           /* for gate output value */
2869  word64 etime;                /* absolute time not delay */
2870  struct itree_t *teitp;       /* instance tree inst event executes in */
2871  union te_u tu;
2872  i_tev_ndx tenxti;
2873 };
2874 
2875 struct telhdr_t {
2876  i_tev_ndx te_hdri, te_endi;
2877  int32 num_events;
2878 };
2879 
2880 /* list element for pending net changes to process after event done */
2881 struct nchglst_t {
2882  int32 delayed_mipd;          /* T - 2nd after schedule from ev process */
2883  int32 bi1, bi2;
2884  struct net_t *chgnp;
2885  struct itree_t *nchg_itp;
2886  struct nchglst_t *nchglnxt;
2887 };
2888 
2889 /* b tree (timing queue) structs */
2890 union bofs_u {
2891  struct bt_t *btofs;
2892  struct telhdr_t *telp;
2893 };
2894 
2895 struct bt_t {
2896  unsigned bttyp : 8;
2897  unsigned btnfill : 8;        /* no. of filled nodes in btree node */
2898  word64 btltim;               /* time of highest left subtree */
2899  union bofs_u ofsu;
2900  struct bt_t *btnxt;
2901 };
2902 
2903 struct fbel_t {
2904  struct fbel_t *fbnxt;
2905 };
2906 
2907 /* table of separate c funcs - usually only one unless too large */
2908 /* SJM ### ??? why is this not referenced? */
2909 struct cproc_t {
2910  int32 cpnum;                 /* number c proc name suffix */
2911  void (*funcptr)();           /* ptr to dlsym found c routine */
2912  void *restabptr;             /* ptr to extrn in c resume label table */
2913  int32 last_u32var;           /* highest num u32 var to decl in c proc */
2914  struct cproctab_t *cptabnxt;
2915 };
2916 
2917 struct contab_info_t {
2918  int32 cwid;
2919  int32 xvi;
2920  struct contab_info_t *cnxt;
2921 };
2922 
2923 /* various simulation counting variables */
2924 extern char *__vers;          /* actual product info */
2925 extern char *__vers2;
2926 extern char *__ofdt;
2927 extern char *__platform;
2928 extern char *__start_sp, *__end_sp;/* pointer for "big" memory allocator */
2929 extern char *__pvdate;        /* date in unix form */
2930 extern char *__pv_timestamp;  /* timestamp for design */
2931 extern time_t __start_time;   /* start wall clock times in secs. */
2932 extern time_t __start_mstime; /* start millisecond part */
2933 extern time_t __end_comp_time;/* end of compilation time */
2934 extern time_t __end_comp_mstime;
2935 extern time_t __end_prep_time;/* end of preparation time */
2936 extern time_t __end_prep_mstime;
2937 extern time_t __end_time;     /* start and end wall clock times */
2938 extern time_t __end_mstime;   /* start and end wall clock times */
2939 
2940 /* various file variables and global data base flags (i/o vars) */
2941 extern char **__in_fils;      /* malloced input file list from args */
2942 extern int32 __siz_in_fils;   /* current size of input files */
2943 extern int32 __last_inf;      /* last input file in list */
2944 extern int32 __last_optf;     /* last option file */
2945 extern int32 __last_lbf;      /* last lib/inc file (starts last_inf + 1) */
2946 extern int32 __last_srcf;     /* last src containing file for debugger */
2947 extern struct incloc_t *__inclst_hdr; /* header of included files list */
2948 extern struct incloc_t *__inclst_end; /* end of included files list */
2949 extern struct filpos_t *__filpostab; /* in fils size tab of file line pos. */
2950 extern FILE *__save_log_s;    /* if $nolog executed, value to use if log */
2951 extern int32 __echo_iactcmds_tolog; /* T => echo interactive cmds to log file */
2952 extern FILE *__save_key_s;    /* if $nolog executed, value to use if log */
2953 extern int32 __nokey_seen;    /* $nokey executed and no key */
2954 extern FILE *__in_s;
2955 extern FILE *__log_s;
2956 extern FILE *__cmd_s;         /* command file source or null for tty */
2957 extern FILE *__key_s;         /* if key_s nil but key_fnam not, must open */
2958 extern struct optlst_t *__opt_hdr;   /* header of expanded option list */
2959 extern struct optlst_t *__opt_end;   /* wrk end of expanded option list */
2960 extern word32 *__wsupptab;    /* tab (1 bit/msg) for warn and iact suppress */
2961 extern char *__blnkline;      /* work blank line */
2962 extern char __pv_homedir[RECLEN]; /* home dir - . if HOME env. not set */
2963 extern struct mcchan_t __mulchan_tab[32];/* mc desc. tab (32 built in Ver) */
2964 extern struct fiofd_t **__fio_fdtab; /* array of ptrs to file io stream */
2965 extern char *__fiolp;         /* fio file input work string ptr */
2966 extern char *__fiofp;         /* fio file input work fmt string ptr */
2967 extern long __scanf_pos;      /* byte offset position of scanf in file */
2968 extern sighandler *__old_int_sig;  /* value of quit (^c) signal on entry */
2969 extern int32 __force_base;    /* for output force base if not BASENONE */
2970 extern struct vinstk_t **__vinstk;/* open file/macro list in stack form */
2971 extern struct vinstk_t *__visp;/* pointer to top of open input stack */
2972 extern int32 __vin_top;       /* index of top of current file stack */
2973 extern char *__log_fnam;      /* log file for all terminal output */
2974 extern char *__sdf_opt_log_fnam; /* sdf log file if set by cmd arg */
2975 extern FILE *__sdf_opt_log_s; /* and open file ptr */
2976 extern int32 __sdf_no_warns;  /* T => don't print any SDF warning msgs */
2977 extern int32 __sdf_no_errs;   /* T => don't print any SDF error msgs */
2978 extern int32 __sdf_from_cmdarg; /* T => SDF annotation call from cmd option */
2979 extern char *__cmd_fnam;      /* command interact. input file name */
2980 extern char *__cmd_start_fnam;/* -i startup interactive input file name */
2981 extern char *__key_fnam;      /* key file name and stream */
2982 extern FILE *__tr_s;          /* trace output file - can be stdout */
2983 extern char *__tr_fnam;
2984 extern int32 __cmd_ifi;       /* constant command in_fils index */
2985 extern char *__lic_path;      /* +licpath [path] if option used */
2986 extern FILE *__sdf_s;         /* current SDF back annotate file/stream */
2987 extern struct sdfnamlst_t *__sdflst; /* list of sdf annotate option files */
2988 extern int32 __sdf_sav_enum;  /* saved error num. for annotate inhibit */
2989 extern int32 __sdf_sav_maxerrs; /* saved max errors so won't stop */
2990 extern int32 __has_sdfann_calls;/* T => no sdf annotate systsk calls in src */
2991 extern int32 __sdf_active;    /* T => annotating SDF - for PLI erro code  */
2992 extern struct mod_t *__sdf_mdp; /* special sdf context mod */
2993 
2994 /* cfg variables */
2995 extern char *__cmdl_library;  /* library name to file off the command line */
2996 extern struct mapfiles_t *__map_files_hd; /* hdr of map files from cmd args */
2997 extern struct mapfiles_t *__map_files_tail; /* end of map file list */
2998 extern struct cfglib_t *__cfglib_hd; /* head of list of libs for cfg */
2999 extern struct cfglib_t *__cfglib_tail; /* and tail */
3000 extern struct cfg_t *__cfg_hd;/* head of list of cfgs */
3001 extern struct cfg_t *__cur_cfg;/* current cfg */
3002 extern struct mod_t *__cfg_mdp;/* SJM - remove me - why global */
3003 extern char **__bind_inam_comptab;/* during cfg binding, comp descent comps */
3004 extern int32 __siz_bind_comps;/* current malloc size of table */
3005 extern int32 __last_bind_comp_ndx;/* last currently used comp end index */
3006 extern int32 __cfg_verbose;   /* T => emit cfg reading verbose messages */
3007 
3008 /* file variables */
3009 extern int32 __cur_infi;      /* index in in_fils of current file */
3010 extern struct optlst_t *__new_opt_hdr;/* header of expanded option list */
3011 extern struct optlst_t *__new_opt_end;/* wrk end of expanded option list */
3012 extern struct optlst_t *__log_olp;   /* log option, nil if none */
3013 extern struct optlst_t *__help_olp;  /* help option, nil if none */
3014 extern struct optlst_t *__quiet_olp; /* quiet option, nil if none */
3015 extern struct optlst_t *__verb_olp;  /* verbose option, nil if none */
3016 extern int32 __vpi_argc;      /* global arg count for vpi */
3017 extern char **__vpi_argv;     /* global arg array for vpi */
3018 extern char *__vpi_argv0;     /* argv execed program name */
3019 extern char *__cur_fnam;      /* being read file name for errors */
3020 extern int32 __cur_fnam_ind;  /* index in in_fils of cur_fnam */
3021 extern int32 __sfnam_ind;     /* global file index for current stmt. */
3022 extern int32 __slin_cnt;      /* global line no. for currently check stmt */
3023 extern int32 __vpifnam_ind;   /* vpi_ global current file index */
3024 extern int32 __vpilin_cnt;    /* vpi_ global current line no. */
3025 extern struct expr_t *__srm_xp; /* current string 'file' for sreadmem */
3026 extern char *__srm_strp;      /* char. pos. in sreadmem string */
3027 extern char *__srm_strp_beg;  /* work alloced location for sreadmem string */
3028 extern int32 __srm_strp_len;  /* alloced length */
3029 extern int32 __srm_stargi;    /* current string position number */
3030 extern int32 __in_ifdef_level;/* current processing `ifdef level */
3031 extern int32 __ifdef_skipping;/* T = skipping not included ifdef section */
3032 extern char *__langstr;       /* work string for `language */
3033 extern int32 __doing_langdir; /* T => processing `language directive */
3034 extern int32 __rding_top_level; /* T => reading outside top level construct */
3035 
3036 /* variables for batch tracing */
3037 extern word64 __last_trtime;  /* last trace statement time */
3038 extern word64 __last_evtrtime;/* last event trace time */
3039 extern struct itree_t *__last_tritp;/* last event traced inst. itree loc. */
3040 
3041 /* command processing variables and temps */
3042 extern int32 __pv_err_cnt, __pv_warn_cnt; /* error counts */
3043 extern int32 __inform_cnt;    /* number of informs */
3044 extern int32 __outlinpos;     /* current trunc. output line pos. */
3045 extern long __mem_use;        /* counts allocated mem for debugging */
3046 extern long __mem_allocated;  /* bytes allocated */
3047 extern long __mem_freed;      /* bytes freed */
3048 extern long __memstr_use;     /* counts allocated string mem for debugging */
3049 extern long __arrvmem_use;    /* allocated bytes for Verilog arrays */
3050 extern long __mem_udpuse;     /* number of bytes used by udp tables */
3051 extern word64 __tim_zero;     /* place for time of constant 0 */
3052 extern int32 __num_glbs;      /* total no. of globals in design */
3053 extern int32 __num_inmodglbs; /* glbs thar resolve to intra module refs. */
3054 extern int32 __num_uprel_glbs;/* number of upward relative globals */
3055 extern int32 __nets_removable;/* flat no. of deletable nets */
3056 extern int32 __flnets_removable;/* removable static nets */
3057 extern int32 __gates_removable; /* removable static gates */
3058 extern int32 __flgates_removable; /* flat no. of deletable gates */
3059 extern int32 __contas_removable; /* removabale static cont. assigns */
3060 extern int32 __flcontas_removable; /* flat no. of deletable cont. assigns */
3061 
3062 /* special allocate free variables */
3063 extern struct ncablk_t *__hdr_ncablks; /* blocks used for ncomp recs */
3064 extern int32 __ncablk_nxti;   /* index of next free pos. */
3065 extern struct cpblk_t *__hdr_cpblks; /* blocks used for cell recs*/
3066 extern int32 __cpblk_nxti;    /* index of next free pos. */
3067 extern struct cppblk_t *__hdr_cppblks; /* blocks used for cell pin recs*/
3068 extern int32 __cppblk_nxti;   /* index of next free pos. */
3069 extern struct tnblk_t *__hdr_tnblks;  /* blocks of symb table tree nodes */
3070 extern int32 __tnblk_nxti;    /* index of next free pos. */
3071 extern struct cpnblk_t *__hdr_cpnblks;  /* blocks of explicit cell pnames */
3072 
3073 /* source processing variables */
3074 extern int32 __lin_cnt;       /* line number while reading a file */
3075 extern int32 __saverr_cnt;    /* counter to inhibit more than a err in xpr */
3076 extern int32 __max_errors;    /* maximum errors before stopping */
3077 extern int32 __rding_comment; /* flag so comment non printable chars ok */
3078 extern int32 __total_rd_lines;/* total number of lines read */
3079 extern int32 __total_lang_dirs; /* total num `language directives read */
3080 
3081 /* booleans for program options (flags) */
3082 extern int32 __verbose;       /* T => emit various extra messages */
3083 extern int32 __quiet_msgs;    /* T => do not emit msgs just errors */
3084 extern int32 __no_warns;      /* T => don't print warning msgs */
3085 extern int32 __no_errs;       /* T => don't print error msgs */
3086 extern int32 __no_informs;    /* T => don't print inform msgs (dflt) */
3087 extern int32 __debug_flg;     /* T => turn on debugging output */
3088 extern int32 __opt_debug_flg; /* T => turn on vm compiler debugging output */
3089 extern int32 __st_tracing;    /* T => trace statement execution */
3090 extern int32 __ev_tracing;    /* T => trace event schedules and processes */
3091 extern int32 __pth_tracing;   /* T => trace path delays in detail */
3092 extern int32 __prt_stats;     /* T => print design statics tables */
3093 extern int32 __prt_allstats;  /* T => print design and mod content tabs */
3094 extern int32 __show_cancel_e; /* T => chg val to x on pulse cancelled event */
3095 extern int32 __showe_onevent; /* T => if showing cancel e, drive x on event */
3096 extern int32 __warn_cancel_e; /* T => emit warn cancel_e (indep. of cancel) */
3097 extern int32 __rm_gate_pnd0s; /* T => remove #0 from all gates */
3098 extern int32 __rm_path_pnd0s; /* T => (default) remove all 0 delay paths */
3099 extern int32 __dmpvars_all;   /* T => dumpvars all variables */
3100 
3101 /* command option booleans */
3102 extern int32 __lib_verbose;   /* T => emit src.file/lib source messages */
3103 extern int32 __sdf_verbose;   /* T => emit msgs for SDF annotated delays */
3104 extern int32 __switch_verbose;/* T => emit msgs for switch/tran chan build */
3105 extern int32 __chg_portdir;   /* T => chg port dir to bid. for XL compat */
3106 extern int32 __nb_sep_queue;  /* F => old un-seperated nb in pnd0 queue */
3107 extern int32 __decompile;     /* T => decompile and print Verilog source */
3108 extern int32 __compile_only;  /* T => check syntax (inc. lib.) no quads */
3109 extern int32 __parse_only;    /* T => first pass parse only to chk sep mod */
3110 extern int32 __dflt_ntyp;     /* Verilog wire type for normal nets */
3111 extern int32 __mintypmax_sel; /* for (e:e:e) expressions value to use */
3112 extern int32 __sdf_mintypmax_sel; /* min:nom_max over-ride for $sdf_annotate */
3113 extern int32 __gateeater_on;  /* T => attempt to remove (disconnect) gates */
3114 extern int32 __no_expand;     /* T => make all wire vectors vectored */
3115 extern int32 __in_cell_region;/* T => turn on cell bit for every module */
3116 extern int32 __unconn_drive;  /* if none TOK_NONE else PULL 0 or PULL 1 */
3117 extern int32 __no_specify;    /* T => check but no simulate with specify */
3118 extern int32 __no_tchks;      /* T => check but no simulate with tim chks */
3119 extern int32 __lib_are_cells; /* T => if in lib, the mark as cell (dflt.) */
3120 extern int32 __design_has_cells;/* T => cells somewhere in design */
3121 extern int32 __accelerate;    /* T => use short circuits g/prt code if can */
3122 extern int32 __pli_keep_src;  /* T => keep more source stmt info for pli */
3123 extern int32 __use_impthdels; /* T => use src-dst im path dels */
3124 
3125 /* source input variables and temps */
3126 extern char __lasttoken[IDLEN];/* current last pushed back symbol name */
3127 extern char __token[IDLEN];   /* current symbol (in canonical (lc) form) */
3128 extern int32 __toktyp;        /* place for current toktyp value */
3129 extern int32 __lasttoktyp;    /* push back token type (= UNDEF if none) */
3130 extern int32 __last_attr_prefix;/* push back pending attr prefix state */
3131 extern int32 __itoklen;       /* current number token bit length */
3132 extern int32 __itoksized;     /* T => token is sized */
3133 extern int32 __itokbase;      /* base constant for number token */
3134 extern int32 __itoksizdflt;   /* '[base] form with width (uses dflt.) */
3135 extern int32 __itok_signed;   /* T => token is signed number */
3136 extern double __itok_realval; /* actual scannoer double val */
3137 extern char *__strtoken;      /* growable token to hold string */
3138 extern int32 __strtok_wid;    /* current size of string token */
3139 extern char *__numtoken;      /* growable token to hold numbers */
3140 extern int32 __numtok_wid;    /* current size of number token */
3141 extern int32 __letendnum_state; /* T => letter can end unsized num. */
3142 extern int32 __macro_sep_width; /* T => possible beginning of macro 2 tok num */
3143 extern int32 __maybe_2tok_sized_num; /* T => seeing number after macro num */
3144 extern int32 __macro_sav_nwid;/* value of saved first tok width */
3145 extern int32 __first_linetok; /* T => token first on line */
3146 extern int32 __file_just_op;  /* T => new file and no token yet returned */
3147 extern int32 __first_num_eol; /* T => first tok because number ended line */
3148 extern char *__macwrkstr;     /* work string for macros */
3149 extern int32 __mac_line_len;  /* actual length of macro line in wrk str */
3150 extern int32 __macwrklen;     /* allocated len of mac. work string */
3151 extern struct macarg_t *__macarg_hdr; /* hdr of list of format mac. args */
3152 extern int32 __macbs_flag;    /* T=> 8'h`DEFINE catch multiple bases errors */
3153 extern char *__attrwrkstr;    /* work string for attributes */
3154 extern int32 __attr_line_len; /* actual length of attribute string */
3155 extern int32 __attrwrklen;    /* alloced len of attr work string - grows */
3156 extern char *__attrparsestr;  /* string to parse attr out of */
3157 extern int32 __attrparsestrlen; /* string to parse attr out of */
3158 extern int32 __attr_prefix;   /* T => token has attribute prefix */
3159 extern int32 __attr_fnam_ind; /* location of attr inst. */
3160 extern int32 __attr_lin_cnt;  /* location of attr inst. */
3161 extern struct attr_t __wrk_attr; /* latest read attribute */
3162 extern char *__xs, *__xs2;    /* places to put expr to str trunc messages */
3163 extern int32 __pv_ctv;        /* tmp for white space skipping macros */
3164 extern int32 __syncto_class;  /* token class sync skipping halted at */
3165 extern char *__exprline;      /* expr. output line work string */
3166 extern int32 __exprlinelen;   /* expr. line length */
3167 extern int32 __cur_sofs;      /* ndx of next ofs (position) in expr line */
3168 extern word32 *__acwrk;       /* a value work string for scanning number */
3169 extern word32 *__bcwrk;       /* b value work string for scanning number */
3170 extern word32 __addrtmp[2];   /* up to 32 bit temp with addr. */
3171 extern int32 __abwrkwlen;     /* current acwrk a half length in words */
3172 extern char __portnam[IDLEN];
3173 extern char __pv_varnam[IDLEN]; /* variable name */
3174 extern int32 __expr_is_lval;  /* T => parsing proc. assign lhs */
3175 extern int32 __allow_scope_var; /* T => process systask arg can be scope */
3176 
3177 /* vars needed for pushing back numbers (see var. comment) */
3178 extern int32 __lastitokbase;
3179 extern int32 __lastitoksized;
3180 extern int32 __lastitoksizdflt;
3181 extern int32 __lastitok_signed;
3182 extern int32 __lastitoklen;
3183 extern word32 *__lastacwrk;   /* special malloced push back num value */
3184 extern word32 *__lastbcwrk;
3185 extern double __lastitok_realval;
3186 
3187 /* the module and module subtask specific work variables */
3188 extern struct mod_t *__oinst_mod;/* ptr. to old current module for copying */
3189 extern struct mod_t *__end_mdp; /* end of module def. list */
3190 extern struct cell_t *__end_cp; /* end of module inst. list */
3191 extern int32 __cp_num;          /* counter for unnamed gate/inst pos. */
3192 extern struct conta_t *__end_ca; /* end of module conta list */
3193 extern int32 __conta_num;     /* counter for building symbol for conta */
3194 extern struct varinitlst_t *__end_mod_varinitlst; /* end of mod var inits */
3195 extern struct dfparam_t *__end_dfp;/* module current end of defparam list */
3196 extern struct task_pin_t *__end_tpp; /* end of task port list */
3197 extern struct task_t *__end_tbp;/* end of top level task/functions/blocks */
3198 extern struct task_t *__cur_tsk;/* ptr. to current task */
3199 extern struct net_t *__end_paramnp; /* end of ordered parm decl. list */
3200 extern struct net_t *__end_loc_paramnp; /* end of ordered parm loc decl. list */
3201 extern struct net_t *__end_impparamnp; /* end of ordered imprt parm decl lst */
3202 extern struct net_t *__end_glbparamnp; /* end of ordered glb parm decl. lst */
3203 extern struct net_t *__end_tskparamnp; /* end of task param decl. list */
3204 extern struct net_t *__end_tsk_loc_paramnp; /* end of task param decl. list */
3205 extern struct ialst_t *__end_ialst; /* end of module initial/always list */
3206 extern struct gref_t *__grwrktab;  /* work table for building mod glbs */
3207 extern int32 __grwrktabsiz;        /* its size */
3208 extern int32 __grwrknum;      /* current number of glbs in work table */
3209 extern int32 __cur_declobj;   /* token type of declared mod or task */
3210 extern int32 __pv_stlevel;    /* tmp. for current stmt nesting level */
3211 extern int32 __design_no_strens;/* T => no strengths used in design */
3212 extern int32 __strenprop_chg; /* during propagate pass at least one chged */
3213 extern int32 __splitting;     /* T => in process of splitting module */
3214 extern int32 __processing_pnd0s;/* T => in time unit, in end #0 region */
3215 extern struct dce_expr_t *__cur_dce_expr; /* glb for edge events eval expr */
3216 extern int32 __lofp_port_decls; /* T => exclusive hdr port decls appeared */
3217 extern struct exprlst_t *__impl_evlst_hd; /* hdr of impl @(*) ev expr list */
3218 extern struct exprlst_t *__impl_evlst_tail; /* and its tail */
3219 extern int32 __canbe_impl_evctrl; /* glb switch to allow @(*) as ev ctrl */
3220 
3221 /* variables for dumpvars */
3222 extern int32 __dv_seen;       /* dumpvars seen but not yet setup */
3223 extern int32 __dv_state;      /* processing state of dumpvars */
3224 extern word64 __dv_calltime;  /* time dump var. first (and only) called */
3225 extern int32 __dv_dumplimit_size; /* user set limit of dv file size (0 none) */
3226 extern int32 __dv_file_size;  /* current size of dumpvars file */
3227 extern int32 __dv_time_emitted; /* flag to stop repeated same #[time] */
3228 extern char *__dv_fnam;       /* name of dumpvars output file */
3229 extern int32 __dv_func;       /* global set with type of dumpvar dumping */
3230 extern struct mdvmast_t *__dv_hdr; /* hdr of mast dumpvar rec. list */
3231 extern struct mdvmast_t *__dv_end; /* end of dumpvar rec. list */
3232 extern struct dvchgnets_t *__dv_netfreelst; /* free list of time var chges */
3233 extern int32 __dv_fd;         /* file number of dmpvars fd */
3234 extern char *__dv_buffer;     /* buffer to speed up dumpvars output */
3235 extern int32 __dv_nxti;       /* next free location */
3236 extern int32 __dv_outlinpos;  /* line postion in dump vars file */
3237 extern int32 __next_dvnum;    /* highest so far used dumpvars number */
3238 extern struct dvchgnets_t *__dv_chgnethdr;  /* curr. time var chg list hdr */
3239 extern int32 __dv_isall_form; /* T doing all of design dumpvar setup */
3240 extern int32 __dv_allform_insrc;/* T dumpvars all form in source */
3241 
3242 /* time scale - precision variables */
3243 extern word32 __cur_units;    /* current units (0 (1s) - 15 (1ft) */
3244 extern word32 __cur_prec;     /* current digits of precision (0-15) */
3245 extern word32 __des_timeprec; /* assume -, 0-15 design sim. tick prec. */
3246 extern word32 __tfmt_units;   /* %t output units (also interact. units) */
3247 extern word32 __tfmt_precunits;/* %t number of prec. digits */
3248 extern int32 __des_has_timescales;/* T => design has at least one timescale */
3249 extern char *__tfmt_suf;      /* suffix for %t */
3250 extern int32 __tfmt_minfwid;  /* minimum field width for %t */
3251 extern word64 __itoticks_tab[16];/* table of scales amount from prec. */
3252 extern char __timstr_unitsuf[4];/* to_timstr units suffix if needed */
3253 extern word64 __timstr_mult;  /* multiplier if needed */
3254 extern int32  __nd_timstr_suf;/* T => need to_timstr units */
3255 
3256 /* veriusertfs pli user function and task work variables */
3257 /* SJM 07/16/02 - need internal veriuser tfs for new +loadpli1 option */
3258 extern struct t_tfcell *__shadow_veriusertfs; /* internal copy of table */
3259 extern int32 __last_veriusertf; /* last user veriusertfs tf number */
3260 extern struct tfinst_t *__tfinst;/* current tf_ inst loc. */
3261 extern struct tfrec_t *__tfrec;/* current tf_ record */
3262 extern struct dceauxlst_t *__pvc_dcehdr; /* header of current pvc dces */
3263 extern struct tfrec_t *__tfrec_hdr; /* header of design wide tfrec list */
3264 extern struct tfrec_t *__tfrec_end; /* last el of design wide tfrec list */
3265 extern i_tev_ndx __tehdr_rosynci; /* hdr ndx of slot end ro sync ev lst */
3266 extern i_tev_ndx __teend_rosynci; /* end of slot end ro sync ev lst */
3267 extern int32 __now_resetting; /* reset in progress - for cbs and misctf */
3268 extern int32 __rosync_slot;   /* T => processing tf or vpi  ro synch events */
3269 extern struct loadpli_t *__pli1_dynlib_hd; /* hd of ld pli1 dynamic lb list */
3270 extern struct loadpli_t *__pli1_dynlib_end; /* and its end */
3271 
3272 /* vpi_ work variables */
3273 extern int32 __last_systf;    /* last vpi_ registered sytfs number */
3274 extern int32 __num_vpi_force_cbs; /* number of registered vpi force cbs */
3275 extern int32 __vpi_force_cb_always; /* T => always call back on force */
3276 extern int32 __num_vpi_rel_cbs; /* number of registered vpi rel cbs */
3277 extern int32 __vpi_rel_cb_always; /* T => always call back on release */
3278 extern int32 __allforce_cbs_off; /* T => can't reenter any of all force cbs */
3279 extern int32 __allrel_cbs_off;/* T => can't reenter any of all release cbs */
3280 extern char *__wrks1;         /* work string - can not use xs if func */
3281 extern char *__wrks2;
3282 extern char __wrk_vpiemsg[IDLEN];/* error msg. work string */
3283 extern char __wrk_vpiget_str[IDLEN];/* standard required vpi get str string */
3284 extern char __wrk_vpi_product[256];/* product version */
3285 extern char __wrk_vpi_errcode[256];/* error codes are Cver err num as str */
3286 extern double __wrk_vpi_timedbl;/* time double for vpi error rec */
3287 extern char *__wrkvalbufp;    /* buf for vpi get value value_p contents */
3288 extern int32 __wrkval_buflen; /* and current length */
3289 extern int32 __vpi_vlog_start_done;/* T => startup done, no systf registering */
3290 extern struct systftab_t *__systftab; /* table of vpi_ systf records */
3291 extern int32 __size_systftab; /* current size of systf data rec. table */
3292 extern struct xstk_t *__cur_sysf_xsp; /* tmp stk_t for vpi sysf ret val */
3293 extern struct expr_t *__cur_sysf_expr;/* tmp calling expr. for vpi sysf*/
3294 extern struct st_t *__cur_syst_stp; /* tmp stmt for vpi syst*/
3295 extern struct dceauxlst_t *__cbvc_dcehdr; /* header of current vc cb dces */
3296 extern struct rfcblst_t *__rel_allcb_hdr;
3297 extern struct rfcblst_t *__rel_allcb_end;
3298 extern struct rfcblst_t *__force_allcb_hdr;
3299 extern struct rfcblst_t *__force_allcb_end;
3300 extern i_tev_ndx *__vpicb_tehdri; /* hdr of fixed cb tev list - 1 per class */
3301 extern i_tev_ndx *__vpicb_teendi; /* end of fixed cb tev list - 1 per class */
3302 extern int32 __have_vpi_actions;/* some use of __vpi actions */
3303 extern int32 __have_vpi_gateout_cbs;/* some use of gate out term cbs */
3304 extern struct h_t *__vpi_hfree_hdr;  /* handle free list hdr */
3305 extern struct hrec_t *__vpi_hrecfree_hdr;  /* handle record free list hdr */
3306 extern struct cbrec_t *__vpi_cbrec_hdr; /* all cbs list header */
3307 extern int32 __ithtsiz;       /* size of global work ld/drv handle table */
3308 extern struct h_t *__ithtab;  /* and the work ld/drv handle table */
3309 extern struct hrec_t *__ithrectab; /* and hrec contents of it */
3310 extern int32 __ithtsiz2;      /* size of global work ld/drv handle table */
3311 extern struct h_t *__ithtab2; /* 2nd work for in subtree handles */
3312 extern struct hrec_t *__ithrectab2; /* and hrec contents of it */
3313 extern struct vpisystf_t *__vpi_sysf_hdr; /* hdr sys func call src locs */
3314 extern struct vpisystf_t *__vpi_syst_hdr; /* hdr sys task enable src locs */
3315 extern int32 __in_vpi_errorcb;/* T => if sim ctrl, suppress error msg error */
3316 extern int32 __vpierr_cb_active; /* T => at least one cbError reged */
3317 extern int32 __acc_vpi_erroff;/* acc_ flag to stop internal acc_ error cbs */
3318 extern int32 __errorcb_suppress_msg; /* T => sim control suppress error msg */
3319 extern struct h_t *__cur_vpi_inst;
3320 extern struct hrec_t *__cur_vpi_obj;
3321 extern struct loadpli_t *__vpi_dynlib_hd; /* hd of ld vpi dynamic lib list */
3322 extern struct loadpli_t *__vpi_dynlib_end; /* and its end */
3323 extern struct dcevnt_t *__cbvc_causing_dcep; /* glb for vc cb if it is remed */
3324 
3325 /* specify work variables */
3326 extern struct spfy_t *__cur_spfy;/* current specify block */
3327 extern struct spcpth_t *__end_spcpths; /* end of specify path st. list */
3328 extern int32 __path_num;      /* counter for unnamed paths */
3329 extern struct tchk_t *__end_tchks;/* end of specify time check st. list */
3330 extern struct net_t *__end_msprms;/* end of specify specparam net list */
3331 extern struct tchk_t *__cur_tchk;
3332 extern int32 __tchk_num;      /* counter for unnamed paths */
3333 extern struct symtab_t *__sav_spsytp;/* save loc. of sym tab in spfy sect. */
3334 
3335 /* work compile global variables accessed by routines */
3336 extern int32 __v1stren;       /* wire/inst. Ver. 1 strength */
3337 extern int32 __v0stren;       /* wire/inst. Ver. 0 strength */
3338 extern word32 __pr_iodir;     /* glb. for port ref. expr. I/O direction */
3339 extern int32 __pr_wid;        /* global for total port ref. expr. width */
3340 extern int32 __mpref_explicit;/* T => mod def header port ref explicit */
3341 extern int32 __sym_is_new;    /* set when new symbol added */
3342 extern struct sy_t **__wrkstab;/* malloced work symbol table area */
3343 extern int32 __last_sy;       /* last symbol in work area */
3344 extern int32 __mod_specparams;/* number of declared specparams in mod */
3345 extern int32 __name_assigned_to;/* glb set if func. def. name assigned to */
3346 extern struct sy_t *__locfnamsyp; /* place for func. def. chk func. symbol */
3347 extern int32 __processing_func; /* T => prep or exec of function occuring */
3348 extern struct st_t **__nbstk; /* func. nest nblock stack (nxt for exec) */
3349 extern int32 __nbsti;
3350 extern struct sy_t *__ca1bit_syp; /* gmsym for 1 bit conta converted gate */
3351 extern int32 __chking_conta;  /* T => checking a continuous assignment */
3352 extern int32 __rhs_isgetpat;  /* T => flag for checking stylized getpat */
3353 extern int32 __lhs_changed;   /* T => assignment changed lhs */
3354 extern word32 __badind_a;     /* place for a part of in error index value */
3355 extern word32 __badind_b;     /* and for b part */
3356 extern int32 __badind_wid;    /* width for bad ind (<32 expr can eval to x) */
3357 extern int32 __expr_has_real; /* T => know some real in expr. */
3358 extern int32 __isform_bi_xvi; /* glbl for IS net pin bit index in contab */
3359 extern int32 __lhsxpr_has_ndel; /* T => component wire of lhs has wire del */
3360 extern int32 __checking_only; /* T => no error msg, looking for something */
3361 extern int32 __task_has_tskcall;/* T => task calls other task (not name blk) */
3362 extern int32 __task_has_delay;/* T => task call has del. needs thread */
3363 extern int32 __func_has_fcall;/* T => func contains has non sys fcall */
3364 extern int32 __iact_must_sched; /* T => iact stmt(s) have $stop or loop */
3365 extern int32 __expr_rhs_decl; /* T current expr. is decl. not proc. rhs */
3366 extern int32 __chg_rng_direct;/* T => change rng dir. for implicitly decl */
3367 extern int32 __has_top_mtm;   /* T => for parameter rhs non () m:t:m */
3368 extern int32 __nd_0width_catel_remove; /* fx3 file 0 width concat glb */
3369 
3370 /* current Verilog module/task/block symbol environment */
3371 extern struct symtab_t **__venviron;
3372 extern int32 __top_sti;
3373 extern struct symtab_t *__modsyms;/* separate symbol table for type names */
3374 extern struct symtab_t *__pv_defsyms;/* global table for `defines */
3375 extern struct symtab_t *__syssyms;/* global tab for system tasks and funcs */
3376 extern struct sy_t **__glbsycmps; /* work global name symbols */
3377 extern struct expr_t **__glbxcmps;/* work glbal exprs */
3378 extern int32 __last_gsc;
3379 
3380 /* n.l. access headers and tables */
3381 extern struct mod_t *__modhdr;/* header of top level module list */
3382 extern struct udp_t *__udphead; /* header udps */
3383 extern struct udp_t *__udp_last;/* end udp list */
3384 extern struct inst_t **__top_itab; /* tab of virt inst ptrs of top mods */
3385 extern int32 *__top_ipind;    /* binary searchable top insts index */
3386 extern int32 __numtopm;       /* number of uninstanciated top modules */
3387 extern struct itree_t **__it_roots; /* table of root itree entries */
3388 extern int32 __ualtrepipnum;  /* udp rep. change threshold */
3389 extern struct thread_t *__initalw_thrd_hdr; /* list hd of per inst in/al thds */
3390 extern struct tev_t *__tevtab;/* reallocable tab of events and free evs */
3391 extern int32 __numused_tevtab;/* num used at least once in tev tab */
3392 extern int32 __size_tevtab;   /* num tev's allocated in tev tab */
3393 extern word32 *__contab;      /* design wide constant table */
3394 extern int32 __contabwsiz;    /* currrent size of const tab in words */
3395 extern int32 __contabwi;      /* next free word32 slot in const tab */
3396 extern int32 __opempty_contabi; /* special contab ndx for opempty expr leaf */
3397 extern struct contab_info_t **__contab_hash; /* contab hash information */
3398 
3399 /* n.l. access routines */
3400 extern struct dfparam_t *__dfphdr; /* design wide defparam list header */
3401 extern int32 __num_dfps;      /* number of defparams in source */
3402 extern int32 __num_glbdfps;   /* number of defparams in design */
3403 extern int32 __num_locdfps;   /* number of local defparams */
3404 extern int32 __num_inst_pndparams;/* static number of inst. pound params */
3405 extern int32 __design_gia_pndparams;/* T => at least one gia range pnd params */
3406 extern int32 __design_gi_arrays;  /* T => design has arrays of g/i */
3407 extern int32 __pndparam_splits; /* T => at least one split from pound params */
3408 extern int32 __defparam_splits; /* T => at least one split from def params */
3409 extern int32 __dagmaxdist;    /* max. nested mod. inst. level */
3410 extern struct mod_t **__mdlevhdr; /* array of ptrs to ith lev linked mods */
3411 extern struct cell_pin_t *__cphdr;   /* header of temp. cell pin list */
3412 extern struct cell_pin_t *__cpp_last;/* current last cell pin*/
3413 extern struct tnode_t *__tmp_head;
3414 
3415 extern struct xldlnpp_t *__xldl_hdr; /* other side unproc. xl drv/ld npps */
3416 extern struct xldlnpp_t *__last_xldl;/* end of list - place to add after */
3417 extern struct xldlvtx_t **__xldlvtxind; /* table of xl drv/ld net/bit vtx */
3418 extern int32 __num_xldlvtxs;  /* number of lements in table */
3419 extern int32 __siz_xldlvtxtab;/* current size of table */
3420 
3421 /* udp table building variables */
3422 extern struct wcard_t *__wcardtab; /* level wildcard table */
3423 extern int32 __last_wci;      /* last wild card index for line */
3424 extern word32 *__cur_utab;    /* current udp table */
3425 extern struct utline_t *__cur_utlp; /* current line info struct */
3426 extern word32 __cur_uoval;    /* current udp line output value */
3427 extern int32 __cur_unochange; /* T => cur line has '-' no change output */
3428 extern struct udp_t *__cur_udp; /* current udp struct */
3429 extern word32 __cur_upstate;  /* current last input (state) for wide */
3430 extern int32 __cur_ueipnum;   /* cur. input pos. num of edge (NO_VAL none) */
3431 extern int32 __cur_utabsel;   /* current edge 1st char - 2nd in state line */
3432 
3433 /* expression and function processing variables */
3434 extern int32 __xndi;          /* next place in collected expression list */
3435 extern struct expr_t **__exprtab;/* table to collect expressions into */
3436 extern struct expridtab_t **__expr_idtab; /* expr parse id name info */
3437 extern int32 __exprtabsiz;    /* current operator precedence expr tab siz */
3438 extern int32 __last_xtk;
3439 extern struct expr_t *__root_ndp;/* root of built and alloced expression */
3440 extern struct xstk_t **__xstk;/* expr work vals */
3441 extern int32 __xspi;          /* expr. pointer */
3442 extern int32 __maxxnest;      /* current size of expr. stack - must grow */
3443 extern int32 __maxfcnest;     /* size of func. call task stk - must grow */
3444 extern struct task_t **__fcstk; /* function call nesting stack */
3445 extern int32 __fcspi;           /* fcall tos index */
3446 
3447 /* -y and -v library variables */
3448 extern struct vylib_t *__vyhdr; /* header of lib. file list */
3449 extern struct vylib_t *__end_vy;/* last entry on vy lib. list */
3450 extern int32 __num_ylibs;     /* number of ylibs in options */
3451 extern int32 __num_vlibs;     /* number of vlibs in options */
3452 
3453 extern struct undef_t *__undefhd;/* head of undefined mod/udp list */
3454 extern struct undef_t *__undeftail; /* tail of undefined mod/udp list */
3455 extern int32 __undef_mods;    /* count of undefined modules */
3456 
3457 extern int32 __lib_rescan;    /* T => rescan from start after each */
3458 extern int32 __cur_passres;   /* num mods resolved in current pass */
3459 extern int32 __rescanning_lib;/* T => for `language exclude after 1st pass */
3460 extern int32 __num_ys;        /* number of -y options in lib. */
3461 extern char **__lbexts;       /* tab of -y library extension suffixes */
3462 extern int32 __last_lbx;
3463 extern char **__incdirs;      /* tab of +incdir paths (always / end) */
3464 extern int32 __last_incdir;
3465 
3466 /* simulation preparation variables */
3467 extern int32 __cur_npii;      /* current index of inst. in cur. mod */
3468 extern struct gate_t *__cur_npgp;/* current net-pin processing gate */
3469 extern struct mod_t *__cur_npmdp;/* current net-pin processing module */
3470 extern struct conta_t *__cur_npcap; /* current net pin proc. conta */
3471 extern struct tfrec_t *__cur_nptfrp; /* current net pin tf arg drvr rec */
3472 extern struct net_t *__cur_npnp; /* current net pin net for vpi putv driver */
3473 extern int32 __cur_npnum;     /* current port number (from 0) */
3474 extern int32 __cur_pbi;       /* current bit number for PB ICONN npp */
3475 extern int32 num_optim_cats;  /* number of optimized concats */
3476 extern int32 num_optim_catels;/* number of all elements in optim concats */
3477 extern int32 __cur_lhscati1;  /* if lhs concat, high rhs psel index */
3478 extern int32 __cur_lhscati2;  /* if lhs concat, low rhs psel index */
3479 extern struct st_t **__prpstk;/* during prep., continue stp */
3480 extern int32 __prpsti;        /* top of nested stmt. stack */
3481 extern int32 __nd_parmpnp_free; /* T => after 1st parmnpp need copy not orig */
3482 extern int32 __num_rem_gate_pnd0s; /* number of removed source #0 gates */
3483 extern int32 __num_flat_rem_gate_pnd0s; /* and flat number */
3484 extern int32 __num_rem_mipds; /* number of per bit flat MIPDs 0 delays rmed */
3485 extern int32 __last_modxi;    /* global counter used by n.l expr xform code */
3486 extern int32 __last_modsti;   /* and counter for statements */
3487 extern int32 __optimized_sim; /* generate c code - compile and dl link */
3488 extern int32 __dump_flowg;    /* dump flow graph for debugging */
3489 
3490 /* timing queue scheduling variables */
3491 extern word64 __whetime;      /* current timing wheel end time */
3492 extern word64 __simtime;      /* current simulaton time (make 64 bits ?) */
3493 extern word32 __num_execstmts;/* total number of executed statements */
3494 extern word32 __num_addedexec;/* number of executed added statements */
3495 extern word32 __num_proc_tevents;/* total num simulation events processed */
3496 extern word32 __nxtstmt_freq_update; /* next ev count for xbig freq upd. */
3497 extern word32 __num_cancel_tevents; /* total num sim events processed */
3498 extern int32 __num_twhevents; /* num of evs currently in timing wheel */
3499 extern int32 __num_ovflqevents; /* num of events currently in ovflow q */
3500 extern word32 __inertial_cancels; /* num resched form later inertial del */
3501 extern word32 __newval_rescheds; /* num rescheduled for same time */
3502 extern word32 __num_netchges; /* num of processed net change records */
3503 extern word32 __immed_assigns;/* num immed assign (not scheduled) */
3504 extern word32 __proc_thrd_tevents;/* number of processed thread events */
3505 extern struct q_hdr_t *__qlist_hdr; /* for $q_ system task q list header */
3506 extern int32 __num_switch_vtxs_processed; /* total num tranif chan vtx done */
3507 extern int32 __num_switch_chans; /* total num tranif channels in design */
3508 
3509 /* storage tables variables */
3510 extern byte *__btab;          /* design wide scalar (byte) storage table */
3511 extern int32 __btabbsiz;      /* scalar storage byte table size in bytes */
3512 extern int32 __btabbi;        /* during var init next index to use */
3513 extern byte *__nchgbtab;      /* table for per inst nchg bytes */
3514 extern int32 __nchgbtabbsiz;  /* size in btab of nchg action bits */
3515 extern int32 __nchgbtabbi;    /* during init, next index to use */
3516 extern word32 *__wtab;        /* design wide var but not mem storage area */
3517 extern int32 __wtabwsiz;      /* precomputed size (need ptrs into) in words */
3518 extern int32 __wtabwi;        /* during var init next index to use */
3519 
3520 /* simulation control and state values */
3521 extern int32 __stmt_suspend;  /* set when behavioral code suspends */
3522 extern int32 __run_state;     /* state of current simulation run */
3523 extern int32 __can_exec;      /* T => for vpi sim ctrl - can now exec */
3524 extern int32 __wire_init;     /* T => initializing wires */
3525 extern int32 __no_tmove_levels; /* T => infinite 0 delay loop warn path dist */
3526 extern struct thread_t *__cur_thd;  /* currently executing thread addr. */
3527 extern struct thread_t *__suspended_thd; /* cur thread before suspend */
3528 extern struct itree_t *__suspended_itp; /* cur inst ptr before suspend */
3529 extern struct itree_t *__inst_ptr; /* current if flattened itree place */
3530 extern struct mod_t *__inst_mod;   /* module of current itree inst */
3531 extern int32 __inum;          /* iti num  of current inst (always set) */
3532 extern struct itree_t **__itstk; /* stack of saved itrees */
3533 extern int32 __itspi;         /* top of itree stack */
3534 extern i_tev_ndx __fsusp_tevpi;/* in func. step, event to undo(cancel) */
3535 extern struct itree_t *__tmpitp_freelst; /* free list of wrk itps */
3536 extern struct inst_t *__tmpip_freelst; /* free list of wrk ips */
3537 extern struct mod_t *__last_libmdp; /* libary module just read */
3538 extern int32 __seed;          /* SJM 01/27/04 - glb seed needed if no arg */
3539 
3540 /* execution state variables */
3541 extern word32 __new_gateval;  /* new gate out val (st. possible) */
3542 extern word32 __old_gateval;  /* before gate change (st. possible) */
3543 extern word32 __new_inputval; /* new input value for tracing message */
3544 extern word32 __old_inputval; /* prev. value of input for wide udp eval */
3545 extern word64 __pdlatechgtim; /* for path tracing latest path chg time */
3546 extern word64 __pdmindel;     /* for path minimum path delay */
3547 extern int32 __nd_neg_del_warn; /* T => must emit warn (or err) for <0 del */
3548 extern int32 __force_active;  /* T => for trace deassign while force */
3549 extern int32 __assign_active; /* T => for trace release activates assgn */
3550 extern struct dceauxlst_t *__qcaf_dcehdr; /* header of current qcaf dces */
3551 extern int32 __nxt_chan_id;   /* cnter and size for assigning chan ids */
3552 extern int32 __chanallocsize; /* size of allocated chan tables */
3553 extern struct chanrec_t *__chantab;/* tab of channel records (one per id) */
3554 extern struct vtxlst_t *__stvtxtab[8]; /* per stren value vertex list */
3555 extern struct vtxlst_t *__stvtxtabend[8]; /* and ptr to last el on each */
3556 extern struct vtxlst_t *__chg_vtxlst_hdr; /* list of chged vertices to store */
3557 extern struct vtxlst_t *__chg_vtxlst_end; /* and ptr to end */
3558 extern struct vtxlst_t *__off_vtxlst_hdr; /* bid chan vtx list for marks off */
3559 extern struct vtxlst_t *__off_vtxlst_end; /* and ptr to end */
3560 extern struct vtxlst_t *__vtxlst_freelst; /* free list for vtx lists */
3561 extern struct vtx_t *__vtx_freelst;  /* free list for re-using vtxs */
3562 extern struct edge_t *__edge_freelst; /* free list for re-using edges */
3563 
3564 extern word32 __acum_sb;      /* accumulator for stren tran chan combined */
3565 extern word32 __acum_a;       /* accumulator for tran chan non stren */
3566 extern word32 __acum_b;
3567 extern byte *__acum_sbp;      /* ptr to stacked strength byte */
3568 extern struct xstk_t *__acum_xsp; /* ptr to stacked strength byte */
3569 
3570 /* end of time slot variables, strobe, monitor, time check */
3571 extern struct strblst_t *__strobe_hdr; /* list strobe display at slot end */
3572 extern struct strblst_t *__strobe_end; /* end of strobe display list */
3573 extern struct strblst_t *__strb_freelst; /* head of free strobe elements */
3574 extern struct st_t *__monit_stp;/* monit if chg display at slot end stmt */
3575 extern struct itree_t *__monit_itp; /* current monitor itree element */
3576 extern word32 __slotend_action; /* word32 of 1 bit switches set for action */
3577 extern int32 __monit_active;  /* T => monitor can trigger (default) */
3578 extern struct dceauxlst_t *__monit_dcehdr; /* header of current dces */
3579 extern struct fmonlst_t *__fmon_hdr; /* list of execed (enabled) fmonitors */
3580 extern struct fmonlst_t *__fmon_end;
3581 extern struct fmonlst_t *__cur_fmon; /* current fmon list entry */
3582 extern struct fmselst_t *__fmonse_hdr; /* this slot end fmon eval list */
3583 extern struct fmselst_t *__fmonse_end;
3584 extern struct fmselst_t *__fmse_freelst; /* fmon slot end free list head */
3585 
3586 /* interactive execution variables */
3587 extern struct itree_t *__scope_ptr; /* from $scope itree place */
3588 extern struct task_t *__scope_tskp; /* from $scope task if present */
3589 extern struct symtab_t *__last_iasytp; /* last found symbol symbol table */
3590 extern struct iahist_t *__iahtab;/* table of history commands */
3591 extern int32 __iahsiz;        /* current size of history cmd table */
3592 extern int32 __iah_lasti;     /* current (latest) command */
3593 extern struct hctrl_t *__hctrl_hd; /* head of active iact stmts */
3594 extern struct hctrl_t *__hctrl_end;/* and end */
3595 extern int32 __history_on;    /* collecting and saving history is on */
3596 extern int32 __hist_cur_listnum;/* number to list for :history command */
3597 extern int32 __iasetup;       /* F until interactive entered */
3598 extern int32 __ia_entered;    /* F (also for reset) until iact entered */
3599 extern int32 __iact_state;    /* T => in interactive processing */
3600 extern int32 __iact_can_free; /* T => non monitor/strobe, can free */
3601 extern int32 __no_iact;       /* T => no interactive processing for run */
3602 extern int32 __intsig_prt_snapshot; /* T => on no iact end, print shapshot */
3603 extern int32 __reset_count;   /* count of the number of rests ($reset) */
3604 extern int32 __reset_value;   /* 2nd $reset value preserved after reset */
3605 extern int32 __list_cur_ifi;  /* index in in fils of current source file */
3606 extern int32 __list_cur_fd;   /* current opened file no. (-1 if none) */
3607 extern int32 __list_cur_lini; /* current line no. in current dbg file */
3608 extern int32 __list_cur_listnum;/* number of lines to list at once */
3609 extern int32 __list_arg_lini; /* for :b (:ib), user list argument */
3610 extern int32 __iact_scope_chg;/* T => always move scope to cur on iact st. */
3611 extern struct brkpt_t *__bphdr;/* header of breakpoint list */
3612 extern int32 __nxt_bpnum;     /* next breakpoint number to use */
3613 extern struct dispx_t *__dispxhdr;/* header of display list */
3614 extern int32 __nxt_dispxnum;  /* next display number to use */
3615 extern struct itree_t *__last_stepitp;/* last step inst. itree loc. */
3616 extern struct task_t *__last_steptskp;/* last step task */
3617 extern int32 __last_stepifi;  /* last step in fils index */
3618 extern word64 __last_brktime; /* last break or step time */
3619 extern int32 __dbg_dflt_base; /* :print debugger default base */
3620 extern int32 __iact_stmt_err; /* T => syntax error for iact stmt */
3621 extern struct mod_t *__iact_mdp; /* current iact dummy module */
3622 extern int32 __sav_mtime_units; /* prep of iact statements needs tfmt units */
3623 
3624 /* interactive variables */
3625 extern char *__iahwrkline;    /* interactive command line work area */
3626 extern int32 __iahwrklen;     /* allocated len of iah work string */
3627 extern int32 __pending_enter_iact;/* T => enter iact as soon as can */
3628 extern int32 __iact_reason;   /* reason for entering interactive state */
3629 extern int32 __single_step;   /* T => need to single step */
3630 extern int32 __step_rep_cnt;  /* number of times to repeat step */
3631 extern int32 __step_from_thread;/* T step from non thread loc. (^c?) */
3632 extern struct itree_t *__step_match_itp; /* for istep, exec itp must match */
3633 extern int32 __step_lini;     /* line stepping from (must step to next) */
3634 extern int32 __step_ifi;      /* and file */
3635 extern int32 __verbose_step;  /* T => emit location each step */
3636 extern int32 __stop_before_sim; /* T => enter interactive before sim */
3637 extern int32 __dbg_stop_before; /* if >100, T (-100) stop before sim */
3638 extern struct st_t *__blklast_stp; /* stmt loc. saved last stmt in block */
3639 extern struct dceauxlst_t *__iact_dcehdr; /* header of current iact dces */
3640 
3641 /* event list variables */
3642 extern struct telhdr_t **__twheel;
3643 extern int32 __twhsize;       /* current size for timing wheel */
3644 extern int32 __cur_twi;
3645 extern i_tev_ndx __p0_te_hdri;/* pound 0 event list header */
3646 extern i_tev_ndx __p0_te_endi;/* pound 0 event list end */
3647 extern i_tev_ndx __cur_te_hdri;
3648 extern i_tev_ndx __cur_tevpi; /* ptr to event list for adding to front */
3649 extern i_tev_ndx __cur_te_endi;
3650 extern i_tev_ndx __tefreelsti;/* free list for events */
3651 extern struct tedputp_t *__tedpfreelst; /* tf_ putp rec free list header */
3652 extern struct teputv_t *__teputvfreelst; /* vpi_ put value free list hdr */
3653 extern struct nchglst_t *__nchgfreelst; /* change element free list */
3654 extern struct tc_pendlst_t *__tcpendfreelst; /* free slot end changed tchks */
3655 extern struct dltevlst_t *__dltevfreelst; /* pend double event free list */
3656 extern struct tevlst_t *__ltevfreelst; /* pend event free list */
3657 extern i_tev_ndx __nb_te_hdri; /* non-blocking new end queue hd */
3658 extern i_tev_ndx __nb_te_endi; /* and tail */
3659 
3660 /* net change list variables */
3661 extern struct nchglst_t *__nchg_futhdr; /* header of future net chg list */
3662 extern struct nchglst_t *__nchg_futend; /* end (for add) of future net chgs */
3663 extern struct tc_pendlst_t *__tcpendlst_hdr; /* header of pending */
3664 extern struct tc_pendlst_t *__tcpendlst_end; /* end of pending */
3665 extern i_tev_ndx *__wrkevtab; /* for exit, trace of pending events */
3666 extern int32 __last_wevti;    /* last filled */
3667 extern int32 __size_wrkevtab; /* and current allocated size */
3668 
3669 /* b tree variables */
3670 extern struct bt_t *__btqroot;/* root of timing overflow q */
3671 /* for fringe node, node previous to place where inserted */
3672 /* storage for path to fringe - node passed thru if not fringe */
3673 extern struct bt_t **__btndstk; /* nodes with node list length */
3674 extern struct bt_t **__btndhdrstk;
3675 extern int32 __topi;
3676 extern int32 __max_level;
3677 extern int32 __nd_level;
3678 
3679 
3680 #include "systsks.h"
3681