1 /*
2  * This file is part of the Alliance CAD System
3  * Copyright (C) Laboratoire LIP6 - D�partement ASIM
4  * Universite Pierre et Marie Curie
5  *
6  * Home page          : http://www-asim.lip6.fr/alliance/
7  * E-mail             : mailto:alliance-users@asim.lip6.fr
8  *
9  * This library is free software; you  can redistribute it and/or modify it
10  * under the terms  of the GNU Library General Public  License as published
11  * by the Free Software Foundation; either version 2 of the License, or (at
12  * your option) any later version.
13  *
14  * Alliance VLSI  CAD System  is distributed  in the hope  that it  will be
15  * useful, but WITHOUT  ANY WARRANTY; without even the  implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
17  * Public License for more details.
18  *
19  * You should have received a copy  of the GNU General Public License along
20  * with the GNU C Library; see the  file COPYING. If not, write to the Free
21  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23 
24 /* ###--------------------------------------------------------------### */
25 /* file		: beh111.h						*/
26 /* date		: Mar  8 2000						*/
27 /* version	: v111							*/
28 /* author	: Pirouz BAZARGAN SABET					*/
29 /* contents	: low level library for behavioural description		*/
30 /* ###--------------------------------------------------------------### */
31 
32 #ifndef BEH_BEHDEF
33 #define BEH_BEHDEF
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif /* __cplusplus */
38 
39 	/* ###------------------------------------------------------### */
40 	/*    defines							*/
41 	/* ###------------------------------------------------------### */
42 
43 #define BEH_GENERIC            203698	/* generic ptype code		*/
44 #define BEH_STABLE               0x01	/* description using STABLE	*/
45 
46 #define BEH_NODE_BDD             0x01	/* fig TYPE : expr. BDD		*/
47 #define BEH_NODE_GEX             0x02	/* fig TYPE : expr. GEX		*/
48 #define BEH_NODE_VARLIST         0x04	/* fig TYPE : list of variables	*/
49 #define BEH_NODE_DERIVATE        0x08	/* fig TYPE : derivatives	*/
50 #define BEH_NODE_USER            0x10	/* fig TYPE : user expression	*/
51 #define BEH_NODE_QUAD            0x20	/* fig TYPE : QUAD structure	*/
52 
53 #define BEH_CHK_DRIVERS    0x00000001	/* check output drivers		*/
54 #define BEH_CHK_EMPTY      0x00000002	/* check for empty architecture	*/
55 
56 #define BEH_ARC_VHDL             0x01	/* fig FLAG : VHDL architecture	*/
57 #define BEH_ARC_C                0x02	/* fig FLAG : C    architecture	*/
58 #define BEH_FIG_DEPEND           0x04	/* fig FLAG : forward depend.	*/
59 #define BEH_FIG_ZERODELAY	 0x08	/* fig FLAG : no delay specified*/
60 
61 #define BEH_CND_UNKNOWN          0x00	/* cond. precedence is unknown	*/
62 #define BEH_CND_PRECEDE          0x01	/* cond. has a precedence	*/
63 #define BEH_CND_NOPRECEDE        0x02	/* cond. has no precedence	*/
64 
65 #define BEH_ASG_INERTIAL         0x10	/* assignment FLAG : inertial	*/
66 #define BEH_ASG_TRANSPORT        0x20	/* assignment FLAG : transport	*/
67 
68 #define BEH_FIG__TIMEUNIT        0x07	/* fig TIME UNIT		*/
69 #define BEH_TU__FS                  1	/* fig TIME UNIT : fs		*/
70 #define BEH_TU__PS                  2	/* fig TIME UNIT : ps		*/
71 #define BEH_TU__NS                  3	/* fig TIME UNIT : ns		*/
72 #define BEH_TU__US                  4	/* fig TIME UNIT : us		*/
73 #define BEH_TU__MS                  5	/* fig TIME UNIT : ms		*/
74 
75 	/* ###------------------------------------------------------### */
76 	/*    global variables						*/
77 	/* ###------------------------------------------------------### */
78 
79 extern unsigned int   BEH_LINNUM  ;
80 
81 extern unsigned char  BEH_TIMEUNIT;
82 extern unsigned int   BEH_TIMESTEP;
83 
84 	/* ###------------------------------------------------------### */
85 	/*    structure definitions					*/
86 	/* ###------------------------------------------------------### */
87 
88 struct beden			/* dictionary entry point		*/
89   {
90   struct beden *NEXT;		/* next entry				*/
91   struct bedrd *DATA;		/* data					*/
92   char         *KEY ;		/* key					*/
93   };
94 
95 struct bedrd			/* dictionary record			*/
96   {
97   struct bedrd *NEXT   ;	/* next record				*/
98   char         *KEY    ;	/* context key				*/
99   short         FD0_VAL;	/* data field				*/
100   short         FD1_VAL;	/* data field				*/
101   short         FD2_VAL;	/* data field				*/
102   short         FD3_VAL;	/* data field				*/
103   short         FD4_VAL;	/* data field				*/
104   short         FD5_VAL;	/* data field				*/
105   short         FD6_VAL;	/* data field				*/
106   long          PNT_VAL;	/* data field				*/
107   };
108 
109 typedef struct befig		/* behaviour figure			*/
110   {
111   struct befig   *NEXT     ;	/* next figure				*/
112   char           *NAME     ;	/* figure's name			*/
113   struct bereg   *BEREG    ;	/* list of internal signals (REGISTER)	*/
114   struct bemsg   *BEMSG    ;	/* list of assert instructions		*/
115   struct berin   *BERIN    ;	/* list of inputs (registers and ports)	*/
116   struct beout   *BEOUT    ;	/* list of output ports			*/
117   struct bebus   *BEBUS    ;	/* list of output ports (BUS)		*/
118   struct beaux   *BEAUX    ;	/* list of internal signals		*/
119   struct beaux   *BEDLY    ;	/* internal signals used for 'DELAYED	*/
120   struct bebux   *BEBUX    ;	/* list of internal signals (BUS)	*/
121   struct bepor   *BEPOR    ;	/* list of ports in reverse order	*/
122   struct begen   *BEGEN    ;	/* list of generic data			*/
123   struct circuit *CIRCUI   ;	/* Pointer on Circuit for BDDs		*/
124   struct ptype   *USER     ;	/* reserved for user's applications	*/
125   char            ERRFLG   ;	/* error flag				*/
126   char            TYPE     ;	/* description type			*/
127   unsigned char   FLAG     ;	/* description flag			*/
128   unsigned char   TIME_UNIT;	/* time unit				*/
129   unsigned int    TIME_STEP;	/* minimum time step			*/
130   }
131 befig_list;
132 
133 typedef struct bereg		/* register				*/
134   {
135   struct bereg  *NEXT  ;	/* next register			*/
136   char          *NAME  ;	/* register's name			*/
137   struct biabl  *BIABL ;	/* list of drivers (ABL)		*/
138   struct binode *BINODE;	/* list of drivers (BDD)		*/
139   }
140 bereg_list;
141 
142 typedef struct bemsg		/* assert instruction			*/
143   {
144   struct bemsg	*NEXT   ;	/* next assertion			*/
145   char		*LABEL  ;	/* instruction's label			*/
146   char		*MESSAGE;	/* assertion's message			*/
147   struct chain	*ABL    ;	/* assertion's condition (ABL)		*/
148   struct node	*NODE   ;	/* assertion's condition (BDD)		*/
149   char           LEVEL  ;	/* severity level of the assertion	*/
150   }
151 bemsg_list;
152 
153 typedef struct beout		/* simple output port			*/
154   {
155   struct beout	*NEXT;		/* next output				*/
156   char		*NAME;		/* port's name				*/
157   struct chain	*ABL ;		/* port's equation (ABL)		*/
158   struct node	*NODE;		/* port's equation (BDD)		*/
159   unsigned int   TIME;		/* driver's delay			*/
160   unsigned char  FLAG;		/* driver's flag			*/
161   }
162 beout_list;
163 
164 typedef struct bebus		/* bussed output port			*/
165   {
166   struct bebus	*NEXT  ;	/* next bus port			*/
167   char		*NAME  ;	/* port's name				*/
168   struct biabl	*BIABL ;	/* list of drivers (ABL)		*/
169   struct binode	*BINODE;	/* list of drivers (BDD)		*/
170   char           TYPE  ;	/* port's type : W or M			*/
171   }
172 bebus_list;
173 
174 typedef struct beaux		/* simple internal signal		*/
175   {
176   struct beaux	*NEXT;		/* next signal				*/
177   char		*NAME;		/* signal's name			*/
178   struct chain	*ABL ;		/* signal's equation (ABL)		*/
179   struct node	*NODE;		/* signal's equation (BDD)		*/
180   unsigned int   TIME;		/* driver's delay			*/
181   unsigned char  FLAG;		/* driver's flag			*/
182   }
183 beaux_list;
184 
185 typedef struct bebux		/* bussed internal signal		*/
186   {
187   struct bebux	*NEXT  ;	/* next signal				*/
188   char		*NAME  ;	/* signal's name			*/
189   struct biabl	*BIABL ;	/* list of drivers (ABL)		*/
190   struct binode	*BINODE;	/* list of drivers (BDD)		*/
191   char           TYPE  ;	/* signal's type : W or M		*/
192   }
193 bebux_list;
194 
195 typedef struct bepor		/* port					*/
196   {
197   struct bepor *NEXT     ;	/* next port				*/
198   char         *NAME     ;	/* port's name				*/
199   char          DIRECTION;	/* port's mode (I, O, B, Z, T)		*/
200   char          TYPE     ;	/* port's type (B, M or W)		*/
201   }
202 bepor_list;
203 
204 typedef struct biabl		/* couple of ABL			*/
205   {
206   struct biabl	*NEXT  ;	/* next couple				*/
207   char          *LABEL ;	/* driver's label			*/
208   struct chain	*CNDABL;	/* driver's connection condition (ABL)	*/
209   struct chain	*VALABL;	/* equation of driven value (ABL)	*/
210   struct ptype  *USER  ;	/* user field				*/
211   unsigned int   TIME  ;	/* driver's delay			*/
212   unsigned char  FLAG  ;	/* condition and driver's flag		*/
213   }
214 biabl_list;
215 
216 typedef struct binode		/* couple of BDD			*/
217   {
218   struct binode	*NEXT   ;	/* next figure				*/
219   struct node	*CNDNODE;	/* driver's connection condition (BDD)	*/
220   struct node	*VALNODE;	/* equation of driven value (BDD)	*/
221   unsigned int   TIME   ;	/* driver's delay			*/
222   unsigned char  FLAG  ;	/* driver's flag			*/
223   }
224 binode_list;
225 
226 typedef struct berin		/* primary inputs			*/
227   {
228   struct berin *NEXT;		/* next input				*/
229   char         *NAME;		/* input's name				*/
230   struct chain *OUT_REF;        /* dependent simple output		*/
231   struct chain *BUS_REF;        /* dependent bussed output		*/
232   struct chain *AUX_REF;        /* dependent simple internal signal	*/
233   struct chain *REG_REF;        /* dependent internal register		*/
234   struct chain *BUX_REF;        /* dependent bussed internal signal	*/
235   struct chain *MSG_REF;        /* dependent assertion			*/
236   struct chain *DLY_REF;        /* dependent delayed internal signal	*/
237   }
238 berin_list;
239 
240 typedef struct begen		/* generic				*/
241   {
242   struct begen *NEXT ;		/* next generic				*/
243   char         *NAME ;		/* generic`s name			*/
244   char         *TYPE ;		/* generic type`s name			*/
245   void         *VALUE;		/* generic`s value			*/
246   }
247 begen_list;
248 
249 typedef struct bequad
250   {
251   struct node  *BDD     ;	/* expression using BDD format		*/
252   struct begex *GEX     ;	/* expression using GEX format		*/
253   struct chain *VARLIST ;	/* variable list			*/
254   struct beder *DERIVATE;	/* list of derivate BDDs		*/
255   void         *USER    ;	/* user defined form of the expression	*/
256   }
257 bequad_list;
258 
259 typedef struct beder
260   {
261   struct beder *NEXT ;		/* next derivative			*/
262   struct node  *BDD  ;		/* derivative BDD			*/
263   short         INDEX;		/* index of the variable		*/
264   }
265 beder_list;
266 
267 typedef struct begex
268   {
269   struct chain   *OPERAND;	/* list of operands or NULL for term	*/
270   unsigned int    TERM   ;	/* operator or terminal's index		*/
271   unsigned short  TYPE   ;	/* expression's type index		*/
272   }
273 begex_list;
274 
275 	/* ###------------------------------------------------------### */
276 	/*    functions							*/
277 	/* ###------------------------------------------------------### */
278 
279 extern struct beaux  *beh_addbeaux   ();
280 extern struct bequad *beh_addbequad  ();
281 extern struct bebux  *beh_addbebux   ();
282 extern struct bebus  *beh_addbebus   ();
283 extern struct befig  *beh_addbefig   ();
284 extern struct begen  *beh_addbegen   ();
285 extern struct bemsg  *beh_addbemsg   ();
286 extern struct beout  *beh_addbeout   ();
287 extern struct bepor  *beh_addbepor   ();
288 extern struct bereg  *beh_addbereg   ();
289 extern struct berin  *beh_addberin   ();
290 extern struct biabl  *beh_addbiabl   ();
291 extern struct binode *beh_addbinode  ();
292 
293 extern struct beaux  *beh_apdbeaux   ();
294 extern struct berin  *beh_apdberin   ();
295 
296 extern struct beder  *beh_addbeder   ();
297 extern struct beaux  *beh_delbeaux   ();
298 extern struct bebux  *beh_delbebux   ();
299 extern struct bebus  *beh_delbebus   ();
300 extern struct befig  *beh_delbefig   ();
301 extern struct begen  *beh_delbegen   ();
302 extern struct bemsg  *beh_delbemsg   ();
303 extern struct beout  *beh_delbeout   ();
304 extern struct bepor  *beh_delbepor   ();
305 extern struct bereg  *beh_delbereg   ();
306 extern struct berin  *beh_delberin   ();
307 extern struct biabl  *beh_delbiabl   ();
308 extern struct binode *beh_delbinode  ();
309 extern struct beder  *beh_delbeder   ();
310 extern void           beh_delbequad  ();
311 
312 extern void           beh_frebeaux   ();
313 extern void           beh_frebebux   ();
314 extern void           beh_frebebus   ();
315 extern void           beh_frebefig   ();
316 extern void           beh_frebegen   ();
317 extern void           beh_frebemsg   ();
318 extern void           beh_frebeout   ();
319 extern void           beh_frebepor   ();
320 extern void           beh_frebereg   ();
321 extern void           beh_freberin   ();
322 extern void           beh_frebiabl   ();
323 extern void           beh_frebinode  ();
324 extern void           beh_frebeder   ();
325 
326 extern struct beaux  *beh_rmvbeaux   ();
327 extern struct bebux  *beh_rmvbebux   ();
328 extern struct bebus  *beh_rmvbebus   ();
329 extern struct befig  *beh_rmvbefig   ();
330 extern struct begen  *beh_rmvbegen   ();
331 extern struct bemsg  *beh_rmvbemsg   ();
332 extern struct beout  *beh_rmvbeout   ();
333 extern struct bepor  *beh_rmvbepor   ();
334 extern struct bereg  *beh_rmvbereg   ();
335 extern struct berin  *beh_rmvberin   ();
336 extern struct beder  *beh_rmvbeder   ();
337 
338 extern struct chain  *beh_expstable  ();
339 extern struct chain  *beh_expdelayed ();
340 
341 extern struct chain  *beh_rplstable  ();
342 extern struct chain  *beh_rpldelayed ();
343 
344 extern struct beden **beh_initab     ();
345 extern void           beh_addtab     ();
346 extern long           beh_chktab     ();
347 extern void           beh_fretab     ();
348 
349 extern unsigned int   beh_error      ();
350 extern void           beh_message    ();
351 extern void           beh_toolbug    ();
352 
353 extern char          *beh_vhdlname   ();
354 extern char          *beh_vhvector   ();
355 
356 #ifdef __cplusplus
357 }
358 #endif /* __cplusplus */
359 
360 #endif
361