1 /*------------------------------------------------------------\
2 |                                                             |
3 | This file is part of the Alliance CAD System Copyright      |
4 | (C) Laboratoire LIP6 - D�partement ASIM Universite P&M Curie|
5 |                                                             |
6 | Home page      : http://www-asim.lip6.fr/alliance/          |
7 | E-mail         : mailto:alliance-users@asim.lip6.fr       |
8 |                                                             |
9 | This progam is  free software; you can redistribute it      |
10 | and/or modify it under the  terms of the GNU Library General|
11 | Public License as published by the Free Software Foundation |
12 | either version 2 of the License, or (at your option) any    |
13 | later version.                                              |
14 |                                                             |
15 | Alliance VLSI  CAD System  is distributed  in the hope that |
16 | it  will be useful, but WITHOUT  ANY WARRANTY;              |
17 | without even the  implied warranty of MERCHANTABILITY or    |
18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General       |
19 | Public License for more details.                            |
20 |                                                             |
21 | You should have received a copy  of the GNU General Public  |
22 | License along with the GNU C Library; see the file COPYING. |
23 | If not, write to the Free Software Foundation, Inc.,        |
24 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.                     |
25 |                                                             |
26 \------------------------------------------------------------*/
27 /*------------------------------------------------------\
28 |                                                       |
29 |  Title   :   Structures and fonctions for VEX         |
30 |                                                       |
31 |  Date    :            04.02.97                        |
32 |                                                       |
33 |  Author  :        Jacomme Ludovic                     |
34 |                                                       |
35 \------------------------------------------------------*/
36 
37 # ifndef VEX_103_H
38 # define VEX_103_H
39 
40 /*------------------------------------------------------\
41 |                                                       |
42 |                      Constants                        |
43 |                                                       |
44 \------------------------------------------------------*/
45 
46 # ifndef __P
47 #  if defined(__STDC__) ||  defined(__GNUC__)
48 #   define __P(x) x
49 #  else
50 #   define __P(x) ()
51 #  endif
52 # endif
53 
54 /*------------------------------------------------------\
55 |                                                       |
56 |                       View Mode                       |
57 |                                                       |
58 \------------------------------------------------------*/
59 
60 # define VEX_VIEW_VHDL      0
61 # define VEX_VIEW_VERILOG   1
62 
63 /*------------------------------------------------------\
64 |                                                       |
65 |                       Node Type                       |
66 |                                                       |
67 \------------------------------------------------------*/
68 
69 # define VEX_NODE_ATOM_MASK      (unsigned short)(0x1000)
70 # define VEX_NODE_OPER_MASK      (unsigned short)(0x2000)
71 # define VEX_NODE_FUNC_MASK      (unsigned short)(0x4000)
72 # define VEX_NODE_TYPE_MASK      (unsigned short)(0x7000)
73 
74 # define VEX_NODE_TAG_MASK       (unsigned short)(0x8000)
75 
76 # define VEX_ATOM_LITERAL_MASK   (unsigned short)(0x0100)  /*Literal Name    */
77 # define VEX_NODE_SIGNED_MASK    (unsigned short)(0x0200)  /*Signed Unsigned */
78 # define VEX_NODE_BIT_MASK       (unsigned short)(0x0400)  /*Bit Vector      */
79 # define VEX_NODE_DOWN_MASK      (unsigned short)(0x0800)  /*Down Up         */
80 # define VEX_NODE_VAR_WIDTH_MASK (unsigned short)(0x0080)  /*Variable Width  */
81 
82 # define VEX_NODE_USER1_MASK     (unsigned short)(0x0020)
83 # define VEX_NODE_USER2_MASK     (unsigned short)(0x0040)
84 
85 # define VEX_NODE_VHDL_TYPE_MASK (unsigned short)(0x001f)
86 
87 /*------------------------------------------------------\
88 |                                                       |
89 |                    Macro Node Type                    |
90 |                                                       |
91 \------------------------------------------------------*/
92 
93 # define IsVexNodeAtom( N )  ( (N)->TYPE &   VEX_NODE_ATOM_MASK )
94 # define SetVexNodeAtom( N ) ( (N)->TYPE = ((N)->TYPE & ~VEX_NODE_TYPE_MASK )\
95                                                       |  VEX_NODE_ATOM_MASK )
96 # define IsVexNodeOper( N )  ( (N)->TYPE &   VEX_NODE_OPER_MASK )
97 # define SetVexNodeOper( N ) ( (N)->TYPE = ((N)->TYPE & ~VEX_NODE_TYPE_MASK )\
98                                                       |  VEX_NODE_OPER_MASK )
99 # define IsVexNodeFunc( N )  ( (N)->TYPE &   VEX_NODE_FUNC_MASK )
100 # define SetVexNodeFunc( N ) ( (N)->TYPE = ((N)->TYPE & ~VEX_NODE_TYPE_MASK )\
101                                                         |  VEX_NODE_FUNC_MASK )
102 
103 /*------------------------------------------------------\
104 |                                                       |
105 |                    Macro Node Width                   |
106 |                                                       |
107 \------------------------------------------------------*/
108 
109 # define IsVexNodeVarWidth( N )    ( (N)->TYPE &   VEX_NODE_VAR_WIDTH_MASK )
110 # define SetVexNodeVarWidth( N )   ( (N)->TYPE |=  VEX_NODE_VAR_WIDTH_MASK )
111 # define ClearVexNodeVarWidth( N ) ( (N)->TYPE &= ~VEX_NODE_VAR_WIDTH_MASK )
112 
113 /*------------------------------------------------------\
114 |                                                       |
115 |                    Macro Node Signed                  |
116 |                                                       |
117 \------------------------------------------------------*/
118 
119 # define IsVexNodeSigned( N )    ( (N)->TYPE &   VEX_NODE_SIGNED_MASK )
120 # define SetVexNodeSigned( N )   ( (N)->TYPE |=  VEX_NODE_SIGNED_MASK )
121 # define ClearVexNodeSigned( N ) ( (N)->TYPE &= ~VEX_NODE_SIGNED_MASK )
122 
123 /*------------------------------------------------------\
124 |                                                       |
125 |                    Macro Node Bit                     |
126 |                                                       |
127 \------------------------------------------------------*/
128 
129 # define IsVexNodeBit( N )    ( (N)->TYPE &   VEX_NODE_BIT_MASK )
130 # define SetVexNodeBit( N )   ( (N)->TYPE |=  VEX_NODE_BIT_MASK )
131 # define ClearVexNodeBit( N ) ( (N)->TYPE &= ~VEX_NODE_BIT_MASK )
132 
133 /*------------------------------------------------------\
134 |                                                       |
135 |                    Macro Node Direction               |
136 |                                                       |
137 \------------------------------------------------------*/
138 
139 # define IsVexNodeDown( N )    ( (N)->TYPE &   VEX_NODE_DOWN_MASK )
140 # define SetVexNodeDown( N )   ( (N)->TYPE |=  VEX_NODE_DOWN_MASK )
141 # define ClearVexNodeDown( N ) ( (N)->TYPE &= ~VEX_NODE_DOWN_MASK )
142 
143 /*------------------------------------------------------\
144 |                                                       |
145 |                    Macro Node Tag                     |
146 |                                                       |
147 \------------------------------------------------------*/
148 
149 # define IsVexNodeTag( N )    ( (N)->TYPE &   VEX_NODE_TAG_MASK )
150 # define SetVexNodeTag( N )   ( (N)->TYPE |=  VEX_NODE_TAG_MASK )
151 # define ClearVexNodeTag( N ) ( (N)->TYPE &= ~VEX_NODE_TAG_MASK )
152 
153 /*------------------------------------------------------\
154 |                                                       |
155 |                       Macro Atom                      |
156 |                                                       |
157 \------------------------------------------------------*/
158 
159 # define IsVexAtomLiteral( N )    ( (N)->TYPE &   VEX_ATOM_LITERAL_MASK )
160 # define SetVexAtomLiteral( N )   ( (N)->TYPE |=  VEX_ATOM_LITERAL_MASK )
161 # define ClearVexAtomLiteral( N ) ( (N)->TYPE &= ~VEX_ATOM_LITERAL_MASK )
162 
163 # define IsVexAtomVarWidth( N )  ( IsVexNodeVarWidth( N ) )
164 # define SetVexAtomVarWidth( N ) ( SetVexNodeVarWidth( N ) )
165 # define IsVexAtomStaWidth( N )  ( ! IsVexNodeVarWidth( N ) )
166 # define SetVexAtomStaWidth( N ) ( ClearVexNodeVarWidth( N ) )
167 
168 # define IsVexAtomBit( N )       ( IsVexNodeBit( N ) )
169 # define SetVexAtomBit( N )      ( SetVexNodeBit( N ) )
170 # define IsVexAtomVector( N )    ( ! IsVexNodeBit( N ) )
171 # define SetVexAtomVector( N )   ( ClearVexNodeBit( N ) )
172 
173 # define IsVexAtomSigned( N )    ( IsVexNodeSigned( N ) )
174 # define SetVexAtomSigned( N )   ( SetVexNodeSigned( N ) )
175 # define IsVexAtomUnsigned( N )  ( ! IsVexNodeSigned( N ) )
176 # define SetVexAtomUnsigned( N ) ( ClearVexNodeSigned( N ) )
177 
178 # define IsVexAtomDown( N )      ( IsVexNodeDown( N ) )
179 # define SetVexAtomDown( N )     ( SetVexNodeDown( N ) )
180 # define IsVexAtomUp( N )        ( ! IsVexNodeDown( N ) )
181 # define SetVexAtomUp( N )       ( ClearVexNodeDown( N ) )
182 
183 /*------------------------------------------------------\
184 |                                                       |
185 |                       Macro Oper                      |
186 |                                                       |
187 \------------------------------------------------------*/
188 
189 # define IsVexOperVarWidth( N )  ( IsVexNodeVarWidth( N ) )
190 # define SetVexOperVarWidth( N ) ( SetVexNodeVarWidth( N ) )
191 # define IsVexOperStaWidth( N )  ( ! IsVexNodeVarWidth( N ) )
192 # define SetVexOperStaWidth( N ) ( ClearVexNodeVarWidth( N ) )
193 
194 # define IsVexOperBit( N )       ( IsVexNodeBit( N ) )
195 # define SetVexOperBit( N )      ( SetVexNodeBit( N ) )
196 # define IsVexOperVector( N )    ( ! IsVexNodeBit( N ) )
197 # define SetVexOperVector( N )   ( ClearVexNodeBit( N ) )
198 
199 # define IsVexOperSigned( N )    ( IsVexNodeSigned( N ) )
200 # define SetVexOperSigned( N )   ( SetVexNodeSigned( N ) )
201 # define IsVexOperUnsigned( N )  ( ! IsVexNodeSigned( N ) )
202 # define SetVexOperUnsigned( N ) ( ClearVexNodeSigned( N ) )
203 
204 # define IsVexOperDown( N )      ( IsVexNodeDown( N ) )
205 # define SetVexOperDown( N )     ( SetVexNodeDown( N ) )
206 # define IsVexOperUp( N )        ( ! IsVexNodeDown( N ) )
207 # define SetVexOperUp( N )       ( ClearVexNodeDown( N ) )
208 
209 /*------------------------------------------------------\
210 |                                                       |
211 |                       Macro Func                      |
212 |                                                       |
213 \------------------------------------------------------*/
214 
215 # define IsVexFuncVarWidth( N )  ( IsVexNodeVarWidth( N ) )
216 # define SetVexFuncVarWidth( N ) ( SetVexNodeVarWidth( N ) )
217 # define IsVexFuncStaWidth( N )  ( ! IsVexNodeVarWidth( N ) )
218 # define SetVexFuncStaWidth( N ) ( ClearVexNodeVarWidth( N ) )
219 
220 # define IsVexFuncBit( N )       ( IsVexNodeBit( N ) )
221 # define SetVexFuncBit( N )      ( SetVexNodeBit( N ) )
222 # define IsVexFuncVector( N )    ( ! IsVexNodeBit( N ) )
223 # define SetVexFuncVector( N )   ( ClearVexNodeBit( N ) )
224 
225 # define IsVexFuncSigned( N )    ( IsVexNodeSigned( N ) )
226 # define SetVexFuncSigned( N )   ( SetVexNodeSigned( N ) )
227 # define IsVexFuncUnsigned( N )  ( ! IsVexNodeSigned( N ) )
228 # define SetVexFuncUnsigned( N ) ( ClearVexNodeSigned( N ) )
229 
230 # define IsVexFuncDown( N )      ( IsVexNodeDown( N ) )
231 # define SetVexFuncDown( N )     ( SetVexNodeDown( N ) )
232 # define IsVexFuncUp( N )        ( ! IsVexNodeDown( N ) )
233 # define SetVexFuncUp( N )       ( ClearVexNodeDown( N ) )
234 
235 /*------------------------------------------------------\
236 |                                                       |
237 |                       Macro Type                      |
238 |                                                       |
239 \------------------------------------------------------*/
240 
241 # define SetVexVhdlType( N, T ) ((N)->TYPE = ((N)->TYPE & ~VEX_NODE_VHDL_TYPE_MASK)|(T))
242 # define GetVexVhdlType( N )    ((N)->TYPE & VEX_NODE_VHDL_TYPE_MASK)
243 
244 /*------------------------------------------------------\
245 |                                                       |
246 |                      Operators                        |
247 |                                                       |
248 \------------------------------------------------------*/
249 
250 # define VEX_CONCAT           0
251 # define VEX_NOT              1
252 # define VEX_NEG              2
253 # define VEX_EVENT            3
254 # define VEX_OR               4
255 # define VEX_AND              5
256 # define VEX_XOR              6
257 # define VEX_NOR              7
258 # define VEX_NAND             8
259 # define VEX_NXOR             9
260 # define VEX_EQ              10
261 # define VEX_NE              11
262 # define VEX_LT              12
263 # define VEX_LE              13
264 # define VEX_GT              14
265 # define VEX_GE              15
266 # define VEX_ADD             16
267 # define VEX_SUB             17
268 # define VEX_MUL             18
269 # define VEX_DIV             19
270 # define VEX_EXP             20
271 # define VEX_MOD             21
272 # define VEX_REM             22
273 # define VEX_TO              23
274 # define VEX_DOWNTO          24
275 # define VEX_INDEX           25
276 # define VEX_LEFT            26
277 # define VEX_RIGHT           27
278 # define VEX_LOW             28
279 # define VEX_HIGH            29
280 # define VEX_LENGTH          30
281 # define VEX_RANGE           31
282 # define VEX_REV_RANGE       32
283 # define VEX_DRIVER          33
284 # define VEX_IFT             34
285 # define VEX_ARRAY           35
286 # define VEX_INDEX_N         36
287 # define VEX_OTHERS          37
288 # define VEX_NUM_BIT         38
289 # define VEX_ABS             39
290 
291 # define VEX_AF              40
292 # define VEX_AG              41
293 # define VEX_AX              42
294 # define VEX_AU              43
295 # define VEX_EF              44
296 # define VEX_EG              45
297 # define VEX_EX              46
298 # define VEX_EU              47
299 # define VEX_EQUIV           48
300 # define VEX_IMPLY           49
301 
302 # define VEX_MAX_OPERATOR    50
303 
304 /*------------------------------------------------------\
305 |                                                       |
306 |                       Vhdl Type                       |
307 |                                                       |
308 \------------------------------------------------------*/
309 
310 # define VEX_TYPE_SEVERITY            0
311 # define VEX_TYPE_BOOLEAN             1
312 # define VEX_TYPE_CHARACTER           2
313 # define VEX_TYPE_STRING              3
314 # define VEX_TYPE_BIT                 4
315 # define VEX_TYPE_INTEGER             5
316 # define VEX_TYPE_NATURAL             6
317 # define VEX_TYPE_BIT_VECTOR          7
318 # define VEX_TYPE_STD_ULOGIC          8
319 # define VEX_TYPE_STD_LOGIC           9
320 # define VEX_TYPE_STD_ULOGIC_VECTOR  10
321 # define VEX_TYPE_STD_LOGIC_VECTOR   11
322 # define VEX_TYPE_X01                12
323 # define VEX_TYPE_X01Z               13
324 # define VEX_TYPE_UX01               14
325 # define VEX_TYPE_UX01Z              15
326 # define VEX_TYPE_UNSIGNED           16
327 # define VEX_TYPE_SIGNED             17
328 # define VEX_TYPE_SMALL_INT          18
329 # define VEX_TYPE_REG_BIT            19
330 # define VEX_TYPE_REG_VECTOR         20
331 # define VEX_TYPE_MUX_BIT            21
332 # define VEX_TYPE_MUX_VECTOR         22
333 # define VEX_TYPE_WOR_BIT            23
334 # define VEX_TYPE_WOR_VECTOR         24
335 # define VEX_TYPE_ENUMERATE          25
336 # define VEX_TYPE_ARRAY              26
337 
338 # define VEX_MAX_TYPE                27
339 
340 /*------------------------------------------------------\
341 |                                                       |
342 |                      Std Function                     |
343 |                                                       |
344 \------------------------------------------------------*/
345 
346 # define VEX_STD_TO_BIT                  0
347 # define VEX_STD_TO_BITVECTOR            1
348 # define VEX_STD_TO_STDULOGIC            2
349 # define VEX_STD_TO_STDLOGICVECTOR       3
350 # define VEX_STD_TO_STDULOGICVECTOR      4
351 # define VEX_STD_TO_X01                  5
352 # define VEX_STD_TO_X01Z                 6
353 # define VEX_STD_TO_UX01                 7
354 # define VEX_STD_RISING_EDGE             8
355 # define VEX_STD_FALLING_EDGE            9
356 # define VEX_STD_IS_X                   10
357 # define VEX_STD_ABS                    11
358 # define VEX_STD_SHL                    12
359 # define VEX_STD_SHR                    13
360 # define VEX_STD_CONV_INTEGER           14
361 # define VEX_STD_CONV_UNSIGNED          15
362 # define VEX_STD_CONV_SIGNED            16
363 # define VEX_STD_CONV_STD_LOGIC_VECTOR  17
364 # define VEX_STD_EXT                    18
365 # define VEX_STD_SXT                    19
366 # define VEX_STD_SHIFT_LEFT             20
367 # define VEX_STD_SHIFT_RIGHT            21
368 # define VEX_STD_ROTATE_LEFT            22
369 # define VEX_STD_ROTATE_RIGHT           23
370 # define VEX_STD_RESIZE                 24
371 # define VEX_STD_TO_INTEGER             25
372 # define VEX_STD_TO_UNSIGNED            26
373 # define VEX_STD_TO_SIGNED              27
374 # define VEX_STD_STD_LOGIC_VECTOR       28
375 # define VEX_STD_STD_ULOGIC_VECTOR      29
376 # define VEX_STD_SIGNED                 30
377 # define VEX_STD_UNSIGNED               31
378 
379 # define VEX_MAX_STD_FUNC               32
380 
381 /*------------------------------------------------------\
382 |                                                       |
383 |                        Literals 9                     |
384 |                                                       |
385 \------------------------------------------------------*/
386 
387 # define VEX_UNINIT_ID       0      /*  Uninitialized    */
388 # define VEX_UNKNOWN_ID      1      /*  Forcing  Unknown */
389 # define VEX_ZERO_ID         2      /*  Forcing  0       */
390 # define VEX_ONE_ID          3      /*  Forcing  1       */
391 # define VEX_TRISTATE_ID     4      /*  High Impedance   */
392 # define VEX_WEAK_UNKNOWN_ID 5      /*  Weak     Unknown */
393 # define VEX_WEAK_ZERO_ID    6      /*  Weak     0       */
394 # define VEX_WEAK_ONE_ID     7      /*  Weak     1       */
395 # define VEX_DC_ID           8      /*  Don't care       */
396 # define VEX_MAX_ID          9
397 
398 /*------------------------------------------------------\
399 |                                                       |
400 |                    Macro Literals 9                   |
401 |                                                       |
402 \------------------------------------------------------*/
403 
404 # define VEX_UNINIT         VEX_LITERAL_BY_ID[ VEX_UNINIT_ID       ]
405 # define VEX_UNKNOWN        VEX_LITERAL_BY_ID[ VEX_UNKNOWN_ID      ]
406 # define VEX_ZERO           VEX_LITERAL_BY_ID[ VEX_ZERO_ID         ]
407 # define VEX_ONE            VEX_LITERAL_BY_ID[ VEX_ONE_ID          ]
408 # define VEX_TRISTATE       VEX_LITERAL_BY_ID[ VEX_TRISTATE_ID     ]
409 # define VEX_WEAK_UNKNOWN   VEX_LITERAL_BY_ID[ VEX_WEAK_UNKNOWN_ID ]
410 # define VEX_WEAK_ZERO      VEX_LITERAL_BY_ID[ VEX_WEAK_ZERO_ID    ]
411 # define VEX_WEAK_ONE       VEX_LITERAL_BY_ID[ VEX_WEAK_ONE_ID     ]
412 # define VEX_DC             VEX_LITERAL_BY_ID[ VEX_DC_ID           ]
413 
414 /*------------------------------------------------------\
415 |                                                       |
416 |                    Macro Atom Literals 9              |
417 |                                                       |
418 \------------------------------------------------------*/
419 
420 # define VEX_ATOM_UNINIT        VEX_ATOM_BY_ID[ VEX_UNINIT_ID       ]
421 # define VEX_ATOM_UNKNOWN       VEX_ATOM_BY_ID[ VEX_UNKNOWN_ID      ]
422 # define VEX_ATOM_ZERO          VEX_ATOM_BY_ID[ VEX_ZERO_ID         ]
423 # define VEX_ATOM_ONE           VEX_ATOM_BY_ID[ VEX_ONE_ID          ]
424 # define VEX_ATOM_TRISTATE      VEX_ATOM_BY_ID[ VEX_TRISTATE_ID     ]
425 # define VEX_ATOM_WEAK_UNKNOWN  VEX_ATOM_BY_ID[ VEX_WEAK_UNKNOWN_ID ]
426 # define VEX_ATOM_WEAK_ZERO     VEX_ATOM_BY_ID[ VEX_WEAK_ZERO_ID    ]
427 # define VEX_ATOM_WEAK_ONE      VEX_ATOM_BY_ID[ VEX_WEAK_ONE_ID     ]
428 # define VEX_ATOM_DC            VEX_ATOM_BY_ID[ VEX_DC_ID           ]
429 
430 /*------------------------------------------------------\
431 |                                                       |
432 |                    Macro Oper Types                   |
433 |                                                       |
434 \------------------------------------------------------*/
435 
436 # define GetVexFuncValue( N )     ( (char    *)(N)->VALUE    )
437 # define SetVexFuncValue( N, F )  ( (N)->VALUE = (void *)(F) )
438 
439 # define GetVexOperValue( N )     ( (long     )(N)->VALUE    )
440 # define SetVexOperValue( N, O )  ( (N)->VALUE = (void *)(O) )
441 
442 # define GetVexAtomValue( N )     ( (char    *)(N)->VALUE    )
443 # define SetVexAtomValue( N, A )  ( (N)->VALUE = (void *)(A) )
444 
445 # define GetVexOperand( C )       ( (vexexpr *)(C)->DATA     )
446 # define GetVexOperandL( C )      ( (C)->DATA                )
447 # define SetVexOperand( C, O )    ( (C)->DATA = (void *)(O)  )
448 
449 /*------------------------------------------------------\
450 |                                                       |
451 |                         Type                          |
452 |                                                       |
453 \------------------------------------------------------*/
454 
455   typedef  struct  vexexpr
456   {
457     chain_list *OPERAND;
458     void       *VALUE;
459     short       TYPE;
460     short       LEFT;
461     short       RIGHT;
462     short       WIDTH;
463 
464   } vexexpr;
465 
466 /*------------------------------------------------------\
467 |                                                       |
468 |                     Global Variable                   |
469 |                                                       |
470 \------------------------------------------------------*/
471 
472    extern char *VEX_OPER_NAME[ VEX_MAX_OPERATOR ];
473    extern char *VEX_OPER_UPPER_NAME[ VEX_MAX_OPERATOR ];
474    extern char *VEX_OPER_VERILOG_NAME[ VEX_MAX_OPERATOR ];
475    extern char *VEX_TYPE_NAME[ VEX_MAX_TYPE ];
476    extern long  VEX_OPER_NOT[ VEX_MAX_OPERATOR ];
477    extern char  VEX_LITERAL_BY_ID[ VEX_MAX_ID ];
478    extern char *VEX_ATOM_BY_ID[ VEX_MAX_ID ];
479    extern char *VEX_STD_FUNC_NAME[ VEX_MAX_STD_FUNC ];
480    extern char *VEX_STD_FUNC_UPPER_NAME[ VEX_MAX_STD_FUNC ];
481 
482 /*------------------------------------------------------\
483 |                                                       |
484 |                        Functions                      |
485 |                                                       |
486 \------------------------------------------------------*/
487 /*------------------------------------------------------\
488 |                                                       |
489 |                Initialize Functions                   |
490 |                                                       |
491 \------------------------------------------------------*/
492 
493    extern void  vexenv __P(());
494 
495 /*------------------------------------------------------\
496 |                                                       |
497 |                      Node Functions                   |
498 |                                                       |
499 \------------------------------------------------------*/
500 
501    extern vexexpr *allocvexnode __P(());
502    extern vexexpr *dupvexnode __P((vexexpr *Node));
503    extern vexexpr *copyvexnode __P((vexexpr *Target, vexexpr *Source));
504    extern void     freevexnode __P((vexexpr *Node));
505 
506 /*------------------------------------------------------\
507 |                                                       |
508 |                    Create Functions                   |
509 |                                                       |
510 \------------------------------------------------------*/
511 
512    extern vexexpr *createvexatombit __P((char *Name));
513    extern vexexpr *createvexatomvec __P((char *Name, short Left, short Right));
514    extern vexexpr *createvexatomlit __P((char *Name));
515    extern vexexpr *createvexatomveclit __P((unsigned char Literal, short Width));
516    extern vexexpr *createvexatomlong __P((long Integer, short Width, short Signed));
517    extern vexexpr *createvexatomlongarray __P((long *Array, short Size, short Width, short Signed));
518 
519    extern vexexpr *createvexoper __P((long Oper, short Width));
520    extern vexexpr *createvexbinexpr __P((long Oper, short Width, vexexpr *Expr1, vexexpr *Expr2));
521    extern vexexpr *createvexternaryexpr __P((long Oper, short Width, \
522                                       vexexpr *Expr1, vexexpr *Expr2, vexexpr *Expr3));
523    extern vexexpr *createvexunaryexpr __P((long Oper, short Width, vexexpr *Expr));
524 
525    extern vexexpr *createvexfunc __P((char *Func, short Width));
526 
527 /*------------------------------------------------------\
528 |                                                       |
529 |                   Simplify Functions                  |
530 |                                                       |
531 \------------------------------------------------------*/
532 
533    extern vexexpr *simpvexexpr __P((vexexpr *Expr));
534    extern vexexpr *simpvexexpreq __P((vexexpr *Expr));
535    extern vexexpr *simpvexexprothers __P((vexexpr *Expr, short Width ));
536 
537 /*------------------------------------------------------\
538 |                                                       |
539 |                   Optimize Functions                  |
540 |                                                       |
541 \------------------------------------------------------*/
542 
543    extern vexexpr *optimvexnotexpr __P((vexexpr *Expr));
544    extern vexexpr *optimvexbinexpr __P((long Oper, short Width, vexexpr *Expr1, vexexpr *Expr2));
545 
546 /*------------------------------------------------------\
547 |                                                       |
548 |                      Add Functions                    |
549 |                                                       |
550 \------------------------------------------------------*/
551 
552    extern void  addvexqexpr __P((vexexpr *Expr1, vexexpr *Expr2));
553    extern void  addvexhexpr __P((vexexpr *Expr1, vexexpr *Expr2));
554 
555 /*------------------------------------------------------\
556 |                                                       |
557 |                    Duplicate Functions                |
558 |                                                       |
559 \------------------------------------------------------*/
560 
561    extern vexexpr *dupvexexpr __P((vexexpr *Expr));
562 
563 /*------------------------------------------------------\
564 |                                                       |
565 |                      Del Functions                    |
566 |                                                       |
567 \------------------------------------------------------*/
568 
569    extern void  delvexexpr    __P((vexexpr *Expr));
570    extern void  delvexexprnum __P((vexexpr *Expr, int Number));
571 
572 /*------------------------------------------------------\
573 |                                                       |
574 |                     Free Functions                    |
575 |                                                       |
576 \------------------------------------------------------*/
577 
578    extern void  freevexexpr __P((vexexpr *Expr));
579 
580 /*------------------------------------------------------\
581 |                                                       |
582 |                      Is Functions                     |
583 |                                                       |
584 \------------------------------------------------------*/
585 
586    extern int  isvexunaryoper       __P((long Oper));
587    extern int  isvexbinaryoper      __P((long Oper));
588    extern int  isvexternaryoper     __P((long Oper));
589    extern int  isvexoperinexpr      __P((vexexpr *Expr, long Oper));
590    extern int  isvexarithoperinexpr __P((vexexpr *Expr));
591    extern int  isvexnameinexpr      __P((vexexpr *Expr, char *Name));
592    extern int  isvexpositiveoper    __P((long Oper));
593    extern int  isvexnegativeoper    __P((long Oper));
594    extern int  isvexequalexpr       __P((vexexpr *Expr1, vexexpr *Expr2));
595    extern int  isvextypedivisible   __P((int Type));
596    extern int  isvextypevector      __P((int Type));
597 
598 /*------------------------------------------------------\
599 |                                                       |
600 |                      Get Functions                    |
601 |                                                       |
602 \------------------------------------------------------*/
603 
604    extern char *getvexvectorname __P((char *Vector, long *Index));
605    extern char *getvexopername __P((long Oper));
606    extern char *getvexatomname  __P((vexexpr *Expr));
607    extern char *getvexoperuppername __P((long Oper));
608    extern char *getvexoperverilogname __P((long Oper));
609    extern long  getvexoperbyname __P((char *Name));
610    extern long  getvexnotoper __P((long Oper));
611 
612    extern char    *getvexarrayname __P((vexexpr *Atom));
613    extern vexexpr *getvexarrayatom __P((vexexpr *Expr));
614 
615    extern chain_list *getvexatombitname __P((vexexpr *Expr));
616    extern chain_list *getvexexprsupport __P((vexexpr *Expr));
617    extern chain_list *unionvexexprsupport __P((chain_list *Support, vexexpr *Expr));
618 
619    extern ptype_list *getvexatombitnameptype __P((vexexpr *Expr));
620    extern ptype_list *getvexexprsupportptype __P((vexexpr *Expr));
621    extern ptype_list *unionvexexprsupportptype __P((ptype_list *Support, vexexpr *Expr));
622 
623    extern chain_list *getvexexprallname __P((vexexpr *Expr));
624    extern chain_list *unionvexexprallname __P((chain_list *AllName, vexexpr *Expr));
625 
626    extern int  getvextypescalar __P((int Type));
627 
628    extern long getvexexprdepth   __P((vexexpr *Expr));
629    extern long getvexexprnumnode __P((vexexpr *Expr));
630    extern int  getvexliteralid   __P((char Literal));
631    extern int  getvexstdfuncid   __P((char *FuncName));
632 
633    extern int  getvexvectorpos __P((vexexpr *Vector, short Index));
634    extern int  getvexvectorindex __P((vexexpr *Atom, short Position));
635    extern int  getvexvectormin __P((vexexpr *Expr));
636    extern int  getvexvectormax __P((vexexpr *Expr));
637 
638    extern int getvexintnumbit __P((long Size));
639    extern int getvexintervalnumbit __P((long Left, long Right));
640 
641 /*------------------------------------------------------\
642 |                                                       |
643 |                    Eval Functions                     |
644 |                                                       |
645 \------------------------------------------------------*/
646 
647    extern int  evalvexatomlong __P((vexexpr *Expr, long *PLong));
648 
649    extern int  evalvexnotliteral __P((char Literal, char *PChar));
650    extern int  evalvexandliteral __P((char Literal1, char Literal2, char *PChar));
651    extern int  evalvexorliteral __P((char Literal1, char Literal2, char *PChar));
652    extern int  evalvexxorliteral __P((char Literal1, char Literal2, char *PChar));
653 
654 /*------------------------------------------------------\
655 |                                                       |
656 |                   Extend Sign Functions               |
657 |                                                       |
658 \------------------------------------------------------*/
659 
660    extern vexexpr *extendvexatomsign __P((vexexpr *Expr, short Width));
661 
662 /*------------------------------------------------------\
663 |                                                       |
664 |                       Shift  Functions                |
665 |                                                       |
666 \------------------------------------------------------*/
667 
668    extern vexexpr *shiftvexatomleft __P((vexexpr *Expr, short Count ));
669    extern vexexpr *shiftvexatomright __P((vexexpr *Expr, short Count ));
670 
671 /*------------------------------------------------------\
672 |                                                       |
673 |                      Slice Functions                  |
674 |                                                       |
675 \------------------------------------------------------*/
676 
677    extern vexexpr *slicevexatomvec __P((vexexpr *Expr, short Left, short Right));
678 
679 /*------------------------------------------------------\
680 |                                                       |
681 |                    Unflat Functions                   |
682 |                                                       |
683 \------------------------------------------------------*/
684 
685    extern vexexpr *unflatvexexpr __P((vexexpr *Expr));
686 
687 /*------------------------------------------------------\
688 |                                                       |
689 |                      View Functions                   |
690 |                                                       |
691 \------------------------------------------------------*/
692 
693    extern void  viewvexexprfile __P((FILE *VexFile, vexexpr *Expr));
694    extern void  viewvexexpr __P((vexexpr *Expr));
695    extern void  viewvexexprln __P((vexexpr *Expr));
696    extern void  viewvexexprbound __P((vexexpr *Expr));
697    extern void  viewvexexprboundln __P((vexexpr *Expr));
698 
699    extern char *viewvexexprstr __P((vexexpr *Expr));
700    extern char *viewvexexprstrbound __P((vexexpr *Expr));
701 
702    extern int  getvexviewmode __P(());
703    extern void  setvexviewmode __P((int Mode));
704 
705 # endif
706