1 /* -*- tab-width: 4 -*-
2  *
3  * Electric(tm) VLSI Design System
4  *
5  * File: vhdl.h
6  * Header file for VHDL compiler
7  * Written by: Andrew R. Kostiuk, Queen's University
8  *
9  * Copyright (c) 2000 Static Free Software.
10  *
11  * Electric(tm) is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * Electric(tm) is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with Electric(tm); see the file COPYING.  If not, write to
23  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
24  * Boston, Mass 02111-1307, USA.
25  *
26  * Static Free Software
27  * 4119 Alpine Road
28  * Portola Valley, California 94028
29  * info@staticfreesoft.com
30  */
31 
32 #if defined(__cplusplus) && !defined(ALLCPLUSPLUS)
33 extern "C"
34 {
35 #endif
36 
37 /********** General Constants ******************************************/
38 
39 /* #define VHDL50           1 */			/* uncomment to enable VHDL 5.0 */
40 #define FNAMESIZE			200				/* maximum size of file names */
41 #define MAXVHDLLINE			1000			/* maximum line length */
42 #define NOTARGET			0				/* no output target, compile only */
43 #define TARGET_ALS			1				/* output target is ALS file */
44 #define TARGET_QUISC		2				/* output target is QUISC file */
45 #define TARGET_NETLISP		3				/* output target is NETLISP file */
46 #define TARGET_RSIM			4				/* output target is NETLISP for RSIM */
47 #define TARGET_SILOS		5				/* output target is SILOS  (V.01)*/
48 
49 extern TOOL *vhdl_tool;
50 
51 /********** Token Definitions ******************************************/
52 
53 #define NOTOKEN				-1
54 /********** Delimiters **********/
55 #define TOKEN_AMPERSAND		 0
56 #define TOKEN_APOSTROPHE	 1
57 #define TOKEN_LEFTBRACKET	 2
58 #define TOKEN_RIGHTBRACKET	 3
59 #define TOKEN_STAR			 4
60 #define TOKEN_PLUS			 5
61 #define TOKEN_COMMA			 6
62 #define TOKEN_MINUS			 7
63 #define TOKEN_PERIOD		 8
64 #define TOKEN_SLASH			 9
65 #define TOKEN_COLON			10
66 #define TOKEN_SEMICOLON		11
67 #define TOKEN_LT			12
68 #define TOKEN_EQ			13
69 #define TOKEN_GT			14
70 #define TOKEN_VERTICALBAR	15
71 /********** Compound Delimiters **********/
72 #define TOKEN_ARROW			16
73 #define TOKEN_DOUBLEDOT		17
74 #define TOKEN_DOUBLESTAR	18
75 #define TOKEN_VARASSIGN		19
76 #define TOKEN_NE			20
77 #define TOKEN_GE			21
78 #define TOKEN_LE			22
79 #define TOKEN_BOX			23
80 /********** Other Token **********/
81 #define TOKEN_UNKNOWN		24
82 #define TOKEN_IDENTIFIER	25				/* alphanumeric (first char alpha) */
83 #define TOKEN_KEYWORD		26				/* reserved keyword of the language */
84 #define TOKEN_DECIMAL		27				/* decimal literal */
85 #define TOKEN_BASED			28				/* based literal */
86 #define TOKEN_CHAR			29				/* character literal */
87 #define TOKEN_STRING		30				/* string enclosed in double quotes */
88 #define TOKEN_BIT_STRING	31				/* bit string */
89 
90 /********** Keyword Constants ******************************************/
91 
92 #define KEY_ABS				 0
93 #define KEY_AFTER			 1
94 #define KEY_ALIAS			 2
95 #define KEY_AND				 3
96 #ifdef VHDL50
97 #define KEY_ARCHITECTURAL	 4
98 #else
99 #define KEY_ARCHITECTURE	 4
100 #endif
101 #define KEY_ARRAY			 5
102 #define KEY_ASSERTION		 6
103 #define KEY_ATTRIBUTE		 7
104 #define KEY_BEHAVIORAL		 8
105 #define KEY_BEGIN			 9
106 #define KEY_BODY			10
107 #define KEY_CASE			11
108 #define KEY_COMPONENT		12
109 #define KEY_CONNECT			13
110 #define KEY_CONSTANT		14
111 #define KEY_CONVERT			15
112 #define KEY_DOT				16
113 #define KEY_DOWNTO			17
114 #define KEY_ELSE			18
115 #define KEY_ELSIF			19
116 #define KEY_END				20
117 #define KEY_ENTITY			21
118 #define KEY_EXIT			22
119 #define KEY_FOR				23
120 #define KEY_FUNCTION		24
121 #define KEY_GENERATE		25
122 #define KEY_GENERIC			26
123 #define KEY_IF				27
124 #define KEY_IN				28
125 #define KEY_INOUT			29
126 #define KEY_IS				30
127 #define KEY_LINKAGE			31
128 #define KEY_LOOP			32
129 #define KEY_MOD				33
130 #define KEY_NAND			34
131 #define KEY_NEXT			35
132 #define KEY_NOR				36
133 #define KEY_NOT				37
134 #define KEY_NULL			38
135 #define KEY_OF				39
136 #define KEY_OR				40
137 #define KEY_OTHERS			41
138 #define KEY_OUT				42
139 #define KEY_PACKAGE			43
140 #define KEY_PORT			44
141 #define KEY_RANGE			45
142 #define KEY_RECORD			46
143 #define KEY_REM				47
144 #define KEY_REPORT			48
145 #define KEY_RESOLVE			49
146 #define KEY_RETURN			50
147 #define KEY_SEVERITY		51
148 #define KEY_SIGNAL			52
149 #define KEY_STANDARD		53
150 #define KEY_STATIC			54
151 #define KEY_SUBTYPE			55
152 #define KEY_THEN			56
153 #define KEY_TO				57
154 #define KEY_TYPE			58
155 #define KEY_UNITS			59
156 #define KEY_USE				60
157 #define KEY_VARIABLE		61
158 #define KEY_WHEN			62
159 #define KEY_WHILE			63
160 #define KEY_WITH			64
161 #define KEY_XOR				65
162 
163 /* Added to support IEEE Standard */
164 #ifndef VHDL50
165 #define KEY_OPEN			66
166 #define KEY_MAP				67
167 #define KEY_ALL				68
168 #endif
169 
170 #define KEY_LIBRARY			69
171 
172 /********** Keyword Structures *****************************************/
173 
174 #define NOVKEYWORD	((VKEYWORD *)NULL)
175 
176 typedef struct
177 {
178 	CHAR	*name;							/* string defining keyword */
179 	INTBIG	num;							/* number of keyword */
180 } VKEYWORD;
181 
182 /********** Token Structures *****************************************/
183 
184 #define NOTOKENLIST	((TOKENLIST *)NULL)
185 
186 typedef struct Itokenlist
187 {
188 	INTBIG	token;							/* token number */
189 	CHAR	*pointer;						/* NULL if delimiter, */
190 											/* pointer to global name space if identifier, */
191 											/* pointer to keyword table if keyword, */
192 											/* pointer to string if decimal literal, */
193 											/* pointer to string if based literal, */
194 											/* value of character if character literal, */
195 											/* pointer to string if string literal, */
196 											/* pointer to string if bit string literal */
197 	INTBIG	space;							/* TRUE if space before next token */
198 	INTBIG	line_num;						/* line number token occurred */
199 	struct Itokenlist *next;				/* next in list */
200 	struct Itokenlist *last;				/* previous in list */
201 } TOKENLIST;
202 
203 /******** Identifier Table Structures **********************************/
204 
205 /* #define IDENT_TABLE_SIZE 10007 */		/* maximum number of identifiers */
206 #define IDENT_TABLE_SIZE 80021				/* maximum number of identifiers */
207 											/* this value should be prime */
208 											/* for the HASH function */
209 #define MAX_HASH_TRYS	  1000
210 
211 typedef struct
212 {
213 	CHAR	*string;						/* pointer to string, NULL if empty */
214 } IDENTTABLE;
215 
216 /********** Symbol Trees **********************************************/
217 
218 #define NOSYMBOL			0
219 #define SYMBOL_ENTITY		1
220 #define SYMBOL_BODY			2
221 #define SYMBOL_TYPE			3
222 #define SYMBOL_FPORT		4
223 #define SYMBOL_COMPONENT	5
224 #define SYMBOL_SIGNAL		6
225 #define SYMBOL_INSTANCE		7
226 #define SYMBOL_VARIABLE		8
227 #define SYMBOL_LABEL		9
228 #define SYMBOL_PACKAGE		10
229 #define SYMBOL_CONSTANT		11
230 
231 typedef struct Isymboltree
232 {
233 	IDENTTABLE				*value;			/* identifier */
234 	INTBIG					type;			/* type of item */
235 	CHAR					*pointer;		/* pointer to item */
236 	struct Isymboltree		*lptr;			/* left pointer */
237 	struct Isymboltree		*rptr;			/* right pointer */
238 	INTBIG                   seen;			/* flag for deallocation */
239 } SYMBOLTREE;
240 
241 typedef struct Isymbollist
242 {
243 	struct Isymboltree		*root;			/* root of symbol tree */
244 	struct Isymbollist		*last;			/* previous in stack */
245 	struct Isymbollist		*next;			/* next in list */
246 } SYMBOLLIST;
247 
248 /********** Gate Entity Structures *************************************/
249 
250 typedef struct Igate
251 {
252 	IDENTTABLE				*name;			/* name of gate */
253 	CHAR					*header;		/* header line */
254 	struct Igateline		*lines;			/* lines of gate def'n */
255 	INTBIG					flags;			/* flags for general use */
256 	struct Igate			*next;			/* next gate in list */
257 } GATE;
258 
259 typedef struct Igateline
260 {
261 	CHAR					*line;			/* line of gate def'n */
262 	struct Igateline		*next;			/* next line in def'n */
263 } GATELINE;
264 
265 /********** Unresolved Reference List **********************************/
266 
267 typedef struct Iunreslist
268 {
269 	IDENTTABLE				*interfacef;	/* name of reference */
270 	INTBIG					numref;			/* number of references */
271 	struct Iunreslist		*next;			/* next in list */
272 } UNRESLIST;
273 
274 extern UNRESLIST         *vhdl_unresolved_list;
275 
276 /********** ALS Generation Constants *********************************/
277 
278 #define TOP_ENTITY_FLAG		0x0001			/* flag the entity as called */
279 #define ENTITY_WRITTEN		0x0002			/* flag the entity as written */
280 
281 /***********************************************************************/
282 
283 /*
284  * File:  db.h
285  * Description: Header file for VHDL compiler including data base structures and
286  *  constants.
287  */
288 
289 typedef struct Idbunits
290 {
291 	struct Idbinterface		*interfaces;	/* list of interfaces */
292 	struct Idbbody			*bodies;		/* list of bodies */
293 } DBUNITS;
294 
295 typedef struct Idbpackage
296 {
297 	IDENTTABLE				*name;			/* name of package */
298 	struct Isymboltree		*root;			/* root of symbol tree */
299 } DBPACKAGE;
300 
301 typedef struct Idbinterface
302 {
303 	IDENTTABLE				*name;			/* name of interface */
304 	struct Idbportlist		*ports;			/* list of ports */
305 	CHAR					*interfacef;	/* interface declarations */
306 	INTBIG					flags;			/* for later code gen */
307 	struct Idbbody			*bodies;		/* associated bodies */
308 	struct Isymbollist		*symbols;		/* local symbols */
309 	struct Idbinterface		*next;			/* next interface */
310 } DBINTERFACE;
311 
312 #define DBMODE_IN			1
313 #define DBMODE_OUT			2
314 #define DBMODE_DOTOUT		3
315 #define DBMODE_INOUT		4
316 #define DBMODE_LINKAGE		5
317 typedef struct Idbportlist
318 {
319 	IDENTTABLE				*name;			/* name of port */
320 	INTBIG					mode;			/* mode of port */
321 	struct Idbltype			*type;			/* type of port */
322 	INTBIG					flags;			/* general flags */
323 	struct Idbportlist		*next;			/* next in port list */
324 } DBPORTLIST;
325 
326 #define DBTYPE_SINGLE		1
327 #define DBTYPE_ARRAY		2
328 typedef struct Idbltype
329 {
330 	IDENTTABLE				*name;			/* name of type */
331 	INTBIG					type;			/* type of type */
332 	CHAR					*pointer;		/* pointer to info */
333 	struct Idbltype			*subtype;		/* possible subtype */
334 } DBLTYPE;
335 
336 /********** Bodies *****************************************************/
337 
338 #define DBBODY_BEHAVIORAL		1
339 #define DBBODY_ARCHITECTURAL	2
340 typedef struct Idbbody
341 {
342 	INTBIG					classnew;		/* class of body */
343 	IDENTTABLE				*name;			/* name of body - identifier */
344 	IDENTTABLE				*entity;		/* parent entity of body */
345 	struct Idbbodydeclare	*declare;		/* declarations */
346 	struct Idbstatements	*statements;	/* statements in body */
347 	struct Idbinterface		*parent;		/* pointer to parent */
348 	struct Idbbody			*same_parent;	/* bodies of same parent */
349 	struct Idbbody			*next;			/* next body */
350 } DBBODY;
351 
352 typedef struct Idbbodydeclare
353 {
354 	struct Idbcomponents	*components;	/* components */
355 	struct Idbsignals		*bodysignals;		/* signals */
356 } DBBODYDECLARE;
357 
358 typedef struct Idbcomponents
359 {
360 	IDENTTABLE				*name;			/* name of component */
361 	struct Idbportlist		*ports;			/* list of ports */
362 	struct Idbcomponents	*next;			/* next component */
363 } DBCOMPONENTS;
364 
365 typedef struct Idbsignals
366 {
367 	IDENTTABLE				*name;			/* name of signal */
368 	struct Idbltype			*type;			/* type of signal */
369 	struct Idbsignals		*next;			/* next signal */
370 } DBSIGNALS;
371 
372 /********** Architectural Statements ***********************************/
373 
374 typedef struct Idbstatements
375 {
376 	struct Idbinstance		*instances;
377 } DBSTATEMENTS;
378 
379 typedef struct Idbinstance
380 {
381 	IDENTTABLE				*name;			/* identifier */
382 	struct Idbcomponents	*compo;			/* component */
383 	struct Idbaportlist		*ports;			/* ports on instance */
384 	struct Idbinstance		*next;			/* next instance in list */
385 } DBINSTANCE;
386 
387 typedef struct Idbaportlist
388 {
389 	struct Idbname			*name;			/* name of port */
390 	struct Idbportlist		*port;			/* pointer to port on comp */
391 	INTBIG					flags;			/* flags for processing */
392 	struct Idbaportlist		*next;			/* next in list */
393 } DBAPORTLIST;
394 
395 /********** Names ******************************************************/
396 
397 #define DBNAME_IDENTIFIER	1
398 #define DBNAME_INDEXED		2
399 #define DBNAME_CONCATENATED	3
400 typedef struct Idbname
401 {
402 	IDENTTABLE				*name;			/* name of name */
403 	INTBIG					type;			/* type of name */
404 	CHAR					*pointer;		/* NULL if identifier */
405 								 			/* pointer to DBEXPRLIST if indexed */
406 								 			/* pointer to DBNAMELIST if concatenated */
407 	struct Idbltype	*dbtype; 				/* pointer to type */
408 } DBNAME;
409 
410 typedef struct Idbexprlist
411 {
412 	INTBIG					value;			/* value */
413 	struct Idbexprlist		*next;			/* next in list */
414 } DBEXPRLIST;
415 
416 typedef struct Idbdiscreterange
417 {
418 	INTBIG					start;			/* start of range */
419 	INTBIG					end;			/* end of range */
420 } DBDISCRETERANGE;
421 
422 typedef struct Idbindexrange
423 {
424 	struct Idbdiscreterange	*drange;		/* discrete range */
425 	struct Idbindexrange	*next;			/* next in list */
426 } DBINDEXRANGE;
427 
428 typedef struct Idbnamelist
429 {
430 	struct Idbname			*name;			/* name in list */
431 	struct Idbnamelist		*next;			/* next in list */
432 } DBNAMELIST;
433 
434 /***********************************************************************/
435 /***********************************************************************/
436 
437 /*
438  * File:  syntax.h
439  * Description: Header file for VHDL compiler including parse tree structures and
440  *  constants.
441  *    Modified January 3, 1989 for IEEE Standard syntax
442  *  Allan G. Jost, Technical University of Nova Scotia
443  */
444 
445 #define PARSE_ERR		-1					/* parsing error */
446 
447 /******** Parser Constants and Structures ******************************/
448 
449 #define NOUNIT			0
450 #define UNIT_INTERFACE	1
451 #define UNIT_FUNCTION	2
452 #define UNIT_PACKAGE	3
453 #define UNIT_BODY		4
454 
455 #ifdef VHDL50
456 #define UNIT_WITH		5
457 #endif
458 
459 #define UNIT_USE		6
460 typedef struct Iptree
461 {
462 	INTBIG					type;			/* type of entity */
463 	CHAR					*pointer;		/* pointer to design unit */
464 	struct Iptree			*next;			/* pointer to next */
465 } PTREE;
466 
467 /********** Packages ***************************************************/
468 
469 typedef struct Ipackage
470 {
471 	struct Itokenlist		*name;			/* package name */
472 	struct Ipackagedpart	*declare;		/* package declare part */
473 } PACKAGE;
474 
475 typedef struct Ipackagedpart
476 {
477 	struct Ibasicdeclare	*item;			/* package declare item */
478 	struct Ipackagedpart	*next;			/* pointer to next */
479 } PACKAGEDPART;
480 
481 #ifdef VHDL50
482 typedef struct Iwith
483 {
484 	struct Itokenlist		*unit;			/* unit */
485 	struct Iwith			*next;			/* next in list */
486 } WITH;
487 #endif
488 
489 typedef struct Iuse
490 {
491 	struct Itokenlist		*unit;			/* unit */
492 	struct Iuse				*next;			/* next in list */
493 } USE;
494 
495 /********** Interfaces *************************************************/
496 
497 typedef struct Ivinterface
498 {
499 	struct Itokenlist		*name;			/* name of entity */
500 	struct Ifportlist		*ports;			/* list of ports */
501 	CHAR					*interfacef;	/* interface declarations */
502 } VINTERFACE;
503 
504 #define NOMODE				0
505 #define MODE_IN				1
506 #define MODE_OUT			2
507 #define MODE_DOTOUT			3
508 #define MODE_INOUT			4
509 #define MODE_LINKAGE		5
510 typedef struct Ifportlist
511 {
512 	struct Iidentlist		*names;			/* names of port */
513 	INTBIG					mode;			/* mode of port */
514 	struct Ivname			*type;			/* type of port */
515 	struct Ifportlist		*next;			/* next in port list */
516 } FPORTLIST;
517 
518 typedef struct Iidentlist
519 {
520 	struct Itokenlist		*identifier;	/* identifier */
521 	struct Iidentlist		*next;			/* next in list */
522 } IDENTLIST;
523 
524 /********** Bodies *****************************************************/
525 
526 #define NOBODY				0
527 #define BODY_BEHAVIORAL		1
528 #define BODY_ARCHITECTURAL	2
529 typedef struct Ibody
530 {
531 	INTBIG					classnew;		/* class of body */
532 	struct Itokenlist		*name;			/* name of body - identifier */
533 	struct Isimplename		*entity;		/* parent entity of body */
534 	struct Ibodydeclare		*body_declare;	/* body declarations */
535 	struct Istatements		*statements;	/* statements in body */
536 } BODY;
537 
538 #define NOBODYDECLARE			0
539 #define BODYDECLARE_BASIC		1
540 #define BODYDECLARE_COMPONENT	2
541 #define BODYDECLARE_RESOLUTION	3
542 #define BODYDECLARE_LOCAL		4
543 typedef struct Ibodydeclare
544 {
545 	INTBIG					type;			/* type of declaration */
546 	CHAR					*pointer;		/* pointer to part tree */
547 	struct Ibodydeclare		*next;			/* next in list */
548 } BODYDECLARE;
549 
550 /********** Basic Declarations *****************************************/
551 
552 #define NOBASICDECLARE			0
553 #define BASICDECLARE_OBJECT		1
554 #define BASICDECLARE_TYPE		2
555 #define BASICDECLARE_SUBTYPE	3
556 #define BASICDECLARE_CONVERSION	4
557 #define BASICDECLARE_ATTRIBUTE	5
558 #define BASICDECLARE_ATT_SPEC	6
559 typedef struct Ibasicdeclare
560 {
561 	INTBIG					type;			/* type of basic declare */
562 	CHAR					*pointer;		/* pointer to parse tree */
563 } BASICDECLARE;
564 
565 #define NOOBJECTDECLARE			0
566 #define OBJECTDECLARE_CONSTANT	1
567 #define OBJECTDECLARE_SIGNAL	2
568 #define OBJECTDECLARE_VARIABLE	3
569 #define OBJECTDECLARE_ALIAS		4
570 typedef struct Iobjectdeclare
571 {
572 	INTBIG					type;			/* type of object declare */
573 	CHAR					*pointer;		/* pointer to parse tree */
574 } OBJECTDECLARE;
575 
576 typedef struct Isignaldeclare
577 {
578 	struct Iidentlist		*names;			/* list of identifiers */
579 	struct Isubtypeind		*subtype;		/* subtype indicator */
580 } SIGNALDECLARE;
581 
582 typedef struct Ivcomponent
583 {
584 	struct Itokenlist		*name;			/* name of component */
585 	struct Ifportlist		*ports;			/* ports of component */
586 } VCOMPONENT;
587 
588 typedef struct Iconstantdeclare
589 {
590 	struct Itokenlist		*identifier;	/* name of constant */
591 	struct Isubtypeind		*subtype;		/* subtype indicator */
592 	struct Iexpression		*expression;	/* expression */
593 } CONSTANTDECLARE;
594 
595 /********** Types ******************************************************/
596 
597 typedef struct Isubtypeind
598 {
599 	struct Ivname			*type;			/* type of subtype */
600 	struct Iconstraint		*constraint;	/* optional constaint */
601 } SUBTYPEIND;
602 
603 #define NOCONSTAINT			0
604 #define CONSTAINT_RANGE		1
605 #define CONSTAINT_FLOAT		2
606 #define CONSTAINT_INDEX		3
607 typedef struct Iconstaint
608 {
609 	INTBIG					type;			/* type of constaint */
610 	CHAR					*pointer;		/* pointer to parse tree */
611 } CONSTAINT;
612 
613 #define NOTYPE				0
614 #define TYPE_SCALAR			1
615 #define TYPE_COMPOSITE		2
616 typedef struct Itype
617 {
618 	struct Itokenlist		*identifier;	/* name of type */
619 	INTBIG					type;			/* type definition */
620 	CHAR					*pointer;		/* pointer to type */
621 } TYPE;
622 
623 #define NOCOMPOSITE			0
624 #define COMPOSITE_ARRAY		1
625 #define COMPOSITE_RECORD	2
626 typedef struct Icomposite
627 {
628 	INTBIG					type;			/* type of composite */
629 	CHAR					*pointer;		/* pointer to composite */
630 } COMPOSITE;
631 
632 #define NOARRAY				0
633 #define ARRAY_UNCONSTRAINED	1
634 #define ARRAY_CONSTRAINED	2
635 typedef struct Iarray
636 {
637 	INTBIG					type;			/* (un)constrained array */
638 	CHAR					*pointer;		/* pointer to array */
639 } ARRAY;
640 
641 typedef struct Iconstrained
642 {
643 	struct Iindexconstraint	*constraint;	/* index constraint */
644 	struct Isubtypeind		*subtype;		/* subtype indication */
645 } CONSTRAINED;
646 
647 typedef struct Iindexconstraint
648 {
649 	struct Idiscreterange	*discrete;		/* discrete range */
650 	struct Iindexconstraint	*next;			/* possible more */
651 } INDEXCONSTRAINT;
652 
653 /********** Architectural Statements ***********************************/
654 
655 #define NOARCHSTATE				0
656 #define ARCHSTATE_GENERATE		1
657 #define ARCHSTATE_SIG_ASSIGN	2
658 #define ARCHSTATE_IF			3
659 #define ARCHSTATE_CASE			4
660 #define ARCHSTATE_INSTANCE		5
661 #define ARCHSTATE_NULL			6
662 typedef struct Istatements
663 {
664 	INTBIG					type;			/* type of statement */
665 	CHAR					*pointer;		/* pointer to parse tree */
666 	struct Istatements		*next;			/* pointer to next */
667 } STATEMENTS;
668 
669 typedef struct Ivinstance
670 {
671 	struct Itokenlist		*name;			/* optional identifier */
672 	struct Isimplename		*entity;		/* entity of instance */
673 	struct Iaportlist		*ports;			/* ports on instance */
674 } VINSTANCE;
675 
676 #define NOAPORTLIST				0
677 #define APORTLIST_NAME			1
678 #define APORTLIST_TYPE_NAME		2
679 #define APORTLIST_EXPRESSION	3
680 typedef struct Iaportlist
681 {
682 	INTBIG					type;			/* type of actual port */
683 	CHAR					*pointer;		/* pointer to parse tree */
684 	struct Iaportlist		*next;			/* next in list */
685 } APORTLIST;
686 
687 typedef struct Iaportlisttype
688 {
689 	struct Iname			*type;			/* type */
690 	struct Iname			*name;			/* name */
691 } APORTLISTTYPE;
692 
693 typedef struct Igenerate
694 {
695 	struct Itokenlist		*label;			/* optional label */
696 	struct Igenscheme		*gen_scheme;	/* generate scheme */
697 	struct Istatements		*statements;	/* statements */
698 } GENERATE;
699 
700 #define GENSCHEME_FOR		0
701 #define GENSCHEME_IF		1
702 typedef struct Igenscheme
703 {
704 	INTBIG					scheme;			/* scheme (for or if) */
705 	struct Itokenlist		*identifier;	/* if FOR scheme */
706 	struct Idiscreterange	*range;			/* if FOR scheme */
707 	struct Iexpression		*condition;		/* if IF scheme */
708 } GENSCHEME;
709 
710 typedef struct Isigassign
711 {
712 	struct Isignallist		*signal;		/* list of signals */
713 	struct Iwaveformlist	*driver;		/* list of waveforms */
714 } SIGASSIGN;
715 
716 typedef struct Isignallist
717 {
718 	struct Iname			*name;			/* name of signal */
719 	struct Isignallist		*next;			/* next signal in list */
720 } SIGNALLIST;
721 
722 typedef struct Iwaveformlist
723 {
724 	struct Iwaveform		*waveform;		/* waveform element */
725 	struct Iwaveformlist	*next;			/* next waveform in list */
726 } WAVEFORMLIST;
727 
728 typedef struct Iwaveform
729 {
730 	struct Iexpression		*expression;	/* expression */
731 	struct Iexpression		*time_expr;		/* time expression */
732 } WAVEFORM;
733 
734 /********** Names ******************************************************/
735 
736 #define NONAME				0
737 #define NAME_SINGLE			1
738 #define NAME_CONCATENATE	2
739 #define NAME_ATTRIBUTE		3
740 typedef struct Ivname
741 {
742 	INTBIG					type;			/* type of name */
743 	CHAR					*pointer;		/* pointer to parse tree */
744 } VNAME;
745 
746 #define NOSINGLENAME		0
747 #define SINGLENAME_SIMPLE	1
748 #define SINGLENAME_SELECTED	2
749 #define SINGLENAME_INDEXED	3
750 #define SINGLENAME_SLICE	4
751 typedef struct Isinglename
752 {
753 	INTBIG					type;			/* type of simple name */
754 	CHAR					*pointer;		/* pointer to parse tree */
755 } SINGLENAME;
756 
757 typedef struct Isimplename
758 {
759 	struct Itokenlist		*identifier;	/* identifier */
760 } SIMPLENAME;
761 
762 typedef struct Iselectedname
763 {
764 	struct Iselectprefix	*prefix;		/* prefix */
765 	struct Iselectsuffix	*suffix;		/* suffix */
766 } SELECTEDNAME;
767 
768 #define NOSELECTPREFIX			0
769 #define SELECTPREFIX_PREFIX		1
770 #define SELECTPREFIX_STANDARD	2
771 typedef struct Iselectprefix
772 {
773 	INTBIG					type;			/* type of prefix */
774 	CHAR					*pointer;		/* pointer to parse tree */
775 } SELECTPREFIX;
776 
777 #define NOPREFIX				0
778 #define PREFIX_NAME				1
779 #define PREFIX_FUNCTION_CALL	2
780 typedef struct Iprefix
781 {
782 	INTBIG					type;			/* type of prefix */
783 	CHAR					*pointer;		/* pointer to parse tree */
784 } PREFIX;
785 
786 #define NOSELECTSUFFIX			0
787 #define SELECTSUFFIX_SIMPLENAME	1
788 #define SELECTSUFFIX_CHAR_LIT	2			/* character */
789 typedef struct Iselectsuffix
790 {
791 	INTBIG					type;			/* type of suffix */
792 	CHAR					*pointer;		/* pointer to parse tree */
793 } SELECTSUFFIX;
794 
795 typedef struct Iindexedname
796 {
797 	struct Iprefix			*prefix;		/* prefix */
798 	struct Iexprlist		*expr_list;		/* expression list */
799 } INDEXEDNAME;
800 
801 typedef struct Iexprlist
802 {
803 	struct Iexpression		*expression;	/* expression */
804 	struct Iexprlist		*next;			/* next in list */
805 } EXPRLIST;
806 
807 typedef struct Islicename
808 {
809 	struct Iprefix			*prefix;		/* prefix */
810 	struct Idiscreterange	*range;			/* discrete range */
811 } SLICENAME;
812 
813 #define NODISCRETERANGE			0
814 #define DISCRETERANGE_SUBTYPE	1
815 #define DISCRETERANGE_RANGE		2
816 typedef struct Idiscreterange
817 {
818 	INTBIG					type;			/* type of discrete range */
819 	CHAR					*pointer;		/* pointer to parse tree */
820 } DISCRETERANGE;
821 
822 #define NORANGE				0
823 #define RANGE_ATTRIBUTE		1
824 #define RANGE_SIMPLE_EXPR	2
825 typedef struct Irange
826 {
827 	INTBIG					type;			/* type of range */
828 	CHAR					*pointer;		/* pointer to parse tree */
829 } RANGE;
830 
831 typedef struct Irangesimple
832 {
833 	struct Isimpleexpr		*start;			/* start of range */
834 	struct Isimpleexpr		*end;			/* end of range */
835 } RANGESIMPLE;
836 
837 typedef struct Iconcatenatedname
838 {
839 	struct Isinglename		*name;			/* single name */
840 	struct Iconcatenatedname	*next;		/* next in list */
841 } CONCATENATEDNAME;
842 
843 /********** Expressions ************************************************/
844 
845 #define NOLOGOP			0
846 #define LOGOP_AND		1
847 #define LOGOP_OR		2
848 #define LOGOP_NAND		3
849 #define LOGOP_NOR		4
850 #define LOGOP_XOR		5
851 typedef struct Iexpression
852 {
853 	struct Irelation		*relation;		/* first relation */
854 	struct Imrelations		*next;			/* more relations */
855 } EXPRESSION;
856 
857 #define NORELOP			0
858 #define RELOP_EQ		1
859 #define RELOP_NE		2
860 #define RELOP_LT		3
861 #define RELOP_LE		4
862 #define RELOP_GT		5
863 #define RELOP_GE		6
864 typedef struct Irelation
865 {
866 	struct Isimpleexpr		*simple_expr;	/* simple expression */
867 	INTBIG					rel_operator;	/* possible operator */
868 	struct Isimpleexpr		*simple_expr2;	/* possible expression */
869 } RELATION;
870 
871 typedef struct Imrelations
872 {
873 	INTBIG					log_operator;	/* logical operator */
874 	struct Irelation		*relation;		/* relation */
875 	struct Imrelations		*next;			/* more relations */
876 } MRELATIONS;
877 
878 #define NOADDOP			0
879 #define ADDOP_ADD		1
880 #define ADDOP_SUBTRACT		2
881 typedef struct Isimpleexpr
882 {
883 	INTBIG					sign;			/* sign (1 or  -1) */
884 	struct Iterm			*term;			/* first term */
885 	struct Imterms			*next;			/* additional terms */
886 } SIMPLEEXPR;
887 
888 #define NOMULOP				0
889 #define MULOP_MULTIPLY		1
890 #define MULOP_DIVIDE		2
891 #define MULOP_MOD			3
892 #define MULOP_REM			4
893 typedef struct Iterm
894 {
895 	struct Ifactor			*factor;		/* first factor */
896 	struct Imfactors		*next;			/* additional factors */
897 } TERM;
898 
899 typedef struct Imterms
900 {
901 	INTBIG					add_operator;	/* add operator */
902 	struct Iterm			*term;			/* next term */
903 	struct Imterms			*next;			/* any more terms */
904 } MTERMS;
905 
906 #define NOMISCOP			0
907 #define MISCOP_POWER		1
908 #define MISCOP_ABS			2
909 #define MISCOP_NOT			3
910 typedef struct Ifactor
911 {
912 	struct Iprimary			*primary;		/* first primary */
913 	INTBIG					misc_operator;	/* possible operator */
914 	struct Iprimary			*primary2;		/* possible primary */
915 } FACTOR;
916 
917 typedef struct Imfactors
918 {
919 	INTBIG					mul_operator;	/* operator */
920 	struct Ifactor			*factor;		/* next factor */
921 	struct Imfactors		*next;			/* possible more factors */
922 } MFACTORS;
923 
924 #define NOPRIMARY				0
925 #define PRIMARY_NAME			1
926 #define PRIMARY_LITERAL			2
927 #define PRIMARY_AGGREGATE		3
928 #define PRIMARY_CONCATENATION	4
929 #define PRIMARY_FUNCTION_CALL	5
930 #define PRIMARY_TYPE_CONVERSION	6
931 #define PRIMARY_QUALIFIED_EXPR	7
932 #define PRIMARY_EXPRESSION		8
933 typedef struct Iprimary
934 {
935 	INTBIG					type;			/* type of primary */
936 	CHAR					*pointer;		/* pointer to primary */
937 } PRIMARY;
938 
939 #define NOLITERAL			0
940 #define LITERAL_NUMERIC		1
941 #define LITERAL_ENUMERATION	2
942 #define LITERAL_STRING		3
943 #define LITERAL_BIT_STRING	4
944 typedef struct Iliteral
945 {
946 	INTBIG					type;			/* type of literal */
947 	CHAR					*pointer;		/* pointer to parse tree */
948 } LITERAL;
949 
950 #define NONUMERICLITERAL	0
951 
952 /* prototypes for tool interface */
953 void           vhdl_init(INTBIG*, CHAR1*[], TOOL*);
954 void           vhdl_done(void);
955 void           vhdl_set(INTBIG, CHAR*[]);
956 INTBIG         vhdl_request(CHAR*, va_list);
957 void           vhdl_slice(void);
958 
959 /* prototypes for intratool interface */
960 INTBIG         vhdl_evalexpression(EXPRESSION*);
961 INTBIG         vhdl_evalsimpleexpr(SIMPLEEXPR*);
962 IDENTTABLE    *vhdl_findidentkey(CHAR*);
963 DBINTERFACE   *vhdl_findtopinterface(DBUNITS*);
964 void           vhdl_freeparsermemory(void);
965 void           vhdl_freesemantic(void);
966 void           vhdl_freeunresolvedlist(UNRESLIST**);
967 void           vhdl_genals(LIBRARY*, NODEPROTO*);
968 void           vhdl_gennet(INTBIG);
969 void           vhdl_genquisc(void);
970 void           vhdl_gensilos(void);
971 IDENTTABLE    *vhdl_getnameident(VNAME*);
972 TOKENLIST     *vhdl_getnametoken(VNAME*);
973 void           vhdl_getnexttoken(void);
974 IDENTTABLE    *vhdl_getprefixident(PREFIX*);
975 TOKENLIST     *vhdl_getprefixtoken(PREFIX*);
976 DBLTYPE        *vhdl_gettype(IDENTTABLE*);
977 BOOLEAN        vhdl_keysame(TOKENLIST*, INTBIG);
978 IDENTTABLE    *vhdl_makeidentkey(CHAR*);
979 DISCRETERANGE *vhdl_parsediscrete_range(void);
980 EXPRESSION    *vhdl_parseexpression(void);
981 VNAME         *vhdl_parsename(void);
982 BOOLEAN        vhdl_parser(TOKENLIST*);
983 SIMPLEEXPR    *vhdl_parsesimpleexpression(void);
984 SIMPLENAME    *vhdl_parsesimplename(void);
985 SUBTYPEIND    *vhdl_parsesubtype_indication(void);
986 TYPE          *vhdl_parsetype(void);
987 void           vhdl_print(CHAR *fstring, ...);
988 void           vhdl_printoneline(CHAR *fstring, ...);
989 void           vhdl_reporterrormsg(TOKENLIST*, CHAR*);
990 SYMBOLTREE    *vhdl_searchsymbol(IDENTTABLE*, SYMBOLLIST*);
991 BOOLEAN        vhdl_semantic(void);
992 DBNAME        *vhdl_semname(VNAME*);
993 void           vhdl_unresolved(IDENTTABLE*, UNRESLIST**);
994 
995 #if defined(__cplusplus) && !defined(ALLCPLUSPLUS)
996 }
997 #endif
998