source: vis_dev/vl2mv-2.3/src/parser/vlr_int.h @ 38

Last change on this file since 38 was 18, checked in by cecile, 13 years ago

vl2mv added

File size: 7.9 KB
Line 
1/*
2
3  Copyright (c) 1992, 1993
4        Regents of the University of California
5  All rights reserved.
6
7  Use and copying of this software and preparation of derivative works
8  based upon this software are permitted.  However, any distribution of
9  this software or derivative works must include the above copyright
10  notice.
11
12  This software is made available AS IS, and neither the Electronics
13  Research Laboratory or the Universify of California make any
14  warranty about the software, its performance or its conformity to
15  any specification.
16
17  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
18          10/92
19          10/93
20
21  $Id: vlr_int.h,v 1.6 2009/03/09 20:25:58 fabio Exp $
22
23*/
24
25
26#define VL2MV_VERSION "2.1"
27
28#define MAXSTRLEN    16384
29#define MAXBITNUM    32
30#define ERR_CHK      1
31#define ERR_COMPILE  2
32#define ERR_INTERNAL 3
33#define ERR_ASSERT   4
34#define ERR_SEMANTIC 5
35
36#define NODE           "_n"
37#define PC             "_pc"
38#define LABEL          "_label"
39
40
41#define VL_NOND        "$ND"
42
43#define SEP_LBITSELECT "<"
44#define SEP_RBITSELECT ">"
45#define SEP_LARRAY     "<*"
46#define SEP_RARRAY     "*>"
47#define SEP_LTRANGE    "<<"
48#define SEP_RTRANGE    ">>"
49#define SEP_GATEPIN   "$"
50#define SEP_DIR       "___"
51#define SEP_LATCH     "_V_"
52#define SEP_QUASI     "_Q_"
53#define SEP_SEL_VAR   "+"
54#define PIN_INITIAL   "initial"
55#define PIN_DELAYED   "*"
56#define PIN_LATCH     "lat"
57#define PIN_RAWOUT    "raw"
58#define PIN_TRUE      "true"
59#define PIN_FALSE     "false"
60#define PIN_IN        "in"
61#define PIN_PS        "ps"
62#define PIN_NS        "ns"
63#define PIN_FEEDBACK  "@"
64#define PIN_DELAY     "prev"
65#define PIN_EVENT     "e"
66#define PIN_HIDDEN    "*||*"
67#define PIN_INOUT     "_IO_"
68
69
70#define HSIS_EQUAL    "="
71#define HSIS_ARROW    "->"
72#define HSIS_DEFAULT  ".def"
73#define HSIS_SET_BEGIN "("
74#define HSIS_SET_END   ")"
75#define HSIS_SET_SEP   ","
76#define HSIS_BLIF_MVT_TIMER "T"
77#define HSIS_DELTA_TIMER    "dD"
78#define HSIS_TIMER_SEP "&&"
79#define HSIS_COMMENT   "#"
80#define HSIS_MODEL     ".model"
81#define HSIS_TYPE      "type"
82#define HSIS_MEMREAD   "HSIS_READ_MEM"
83#define HSIS_MEMWRITE  "HSIS_WRITE_MEM"
84#define HSIS_REGFILE   "regfile"
85#define HSIS_ADDRESS   "address"
86#define HSIS_VALUE     "value"
87
88
89#define SMV_COMMENT    "--"
90#define SMV_DEFINE     "DEFINE"
91#define SMV_ASSIGN     "ASSIGN"
92#define SMV_VAR        "VAR"
93#define SMV_WIRE       "WIRE"
94#define SMV_MODULE     "MODULE"
95#define SMV_PROLOGUE   ""
96#define SMV_EPILOGUE   ""
97#define SMV_INPUT      "INPUT"
98#define SMV_OUTPUT     "OUTPUT"
99#define SMV_CLOCK      "CLOCK"
100#define SMV_MEMORY     "MEMORY"
101#define SMV_IF         "if"
102#define SMV_COL_ASSIGN ":="
103#define SMV_COLON      ":"
104#define SMV_CMPL       "~"
105#define SMV_NOT        "!"
106#define SMV_AND        "&"
107#define SMV_OR         "|"
108#define SMV_XOR        "^"
109#define SMV_MOD        "mod"
110#define SMV_EQUIV      "<->"
111#define SMV_IMP        "->"
112#define SMV_EQUAL      "="
113#define SMV_NEQUAL     "~="
114#define SMV_LBRACE     "{"
115#define SMV_RBRACE     "}"
116#define SMV_LBRACKET   "("
117#define SMV_RBRACKET   ")"
118#define SMV_COMMA      ","
119#define SMV_RANGE      ".."
120#define SMV_PLUS       "+"
121#define SMV_MINUS      "-"
122#define SMV_LE         "<="
123#define SMV_GE         ">="
124#define SMV_OF         "of"
125#define SMV_ARRAY      "array"
126#define SMV_BOOLEAN    "boolean"
127#define SMV_FOR        "for"
128#define SMV_PROCESS    "process"
129#define SMV_INIT       "init"
130#define SMV_TRANS      "next"
131
132#define SMV_CASE       "case {"
133#define SMV_ESAC       "}"
134#define SMV_CTL_OP     "AEFGUX"
135
136
137#define SMV_BIN_DC     "{0,1}"
138#define SMV_INDEX      "__SMV_index__"
139
140
141#define SCRATCH_FILE  "gate.blif"
142#define OUT_SCRATCH   "gate.o"
143#define SCRIPT_NAME   "script.complement"
144#define SIS_LOG       "sis.log"
145
146
147#define CLOCK         "clk"
148
149
150#define NO_MUX        0x0
151#define MUX_T         0x3   
152#define MUX_F         0x2   
153
154
155#define DEFAULT_MAX_TABLE_SIZE 1
156
157
158#define MACRO_DEFINE  "define"
159#define MACRO_IFDEF   "ifdef"
160#define MACRO_IFNDEF  "ifndef"
161#define MACRO_ELSE    "else"
162#define MACRO_ENDIF   "endif"
163
164
165
166
167
168#define BLIF_GND         "_BLIF_GND"
169#define BLIF_SUP         "_BLIF_SUP"
170#define BLIF_LIB_AND     "_BLIF_AND"
171#define BLIF_LIB_OR      "_BLIF_OR"
172#define BLIF_LIB_XOR     "_BLIF_XOR"
173#define BLIF_LIB_XNOR    "_BLIF_XNOR"
174#define BLIF_LIB_ADD     "_BLIF_ADD"
175#define BLIF_LIB_SUB     "_BLIF_SUB"
176
177
178#define LIB_MUX      0
179
180#define SIG_ST(crt_module) (((crt_module)->type==ModDecl)? \
181                               (((vl_module*)(crt_module))->sig_st): \
182                               (((vl_function*)(crt_module))->sig_st))
183#define YYTRACE(str) if (YYTrace) fprintf(stderr, "%s\n", str);
184#define CpyTRACE(str) if (CpyTrace) fprintf(stderr, "  <Y>%s", str);
185#define CreTRACE(str) if (CreTrace) fprintf(stderr, "  <C>%s", str);
186#define PrtTRACE(str) if (PrtTrace) fprintf(stderr, "  <P>%s", str);
187#define StpTRACE(str) if (StpTrace) fprintf(stderr, "  <S>%s", str);
188#define WrtTRACE(str) if (WrtTrace) fprintf(stderr, "  <W>%s", str);
189#define TODO(str) \
190  {fprintf(stderr, "%d:not implemented (translation not precise)\n%s\n", yylineno, str); }
191#define ASSERT(cond,msg) if (!(cond)) {fprintf(stderr,"ASSERT Fail:%s\n",msg);}
192#define Assert(cond)  if (!cond) {fprintf(stderr,"Assert fail: file \"%s\", line %d\n",__FILE__,__LINE__);exit(ERR_ASSERT);}
193                                     
194#define ISVLCONST(type) ((type)==BitExpr||(type)==IntExpr||(type)==RealExpr)
195#define IS_VLR_REL_OP(type) ((type)==BgtExpr||(type)==BltExpr||(type)==BgeExpr||(type)==BleExpr)
196#define IS_VLR_LOG_OP(type) ((type)==BlandExpr||(type)==BlorExpr)
197#define ISREDUCTION(type) ((type)==UnandExpr||(type)==UnorExpr|| \
198                           (type)==UxnorExpr||(type)==UandExpr|| \
199                           (type)==UorExpr||(type)==UxorExpr)
200#define RIPPLE_INTERFERE(type) ((type)==UandExpr||(type)==UnandExpr|| \
201                                (type)==UorExpr||(type)==UnorExpr|| \
202                                (type)==UxorExpr||(type)==UxnorExpr|| \
203                                (type)==BplusExpr||(type)==BminusExpr|| \
204                                (type)==BltExpr||(type)==BleExpr|| \
205                                (type)==BgtExpr||(type)==BgeExpr)
206#define IS_TRANSITION(sym) ((sym)==PrimR || (sym)==PrimF || (sym)==PrimS || \
207                            (sym)==PrimBB|| (sym)==PrimQ0|| (sym)==PrimQ1|| \
208                            (sym)==PrimQB|| (sym)==Prim0X|| (sym)==Prim1X|| \
209                            (sym)==PrimX0|| (sym)==PrimX1|| (sym)==PrimXB|| \
210                            (sym)==PrimBX)
211
212
213#if defined(_IBMR2) || defined(_snake)
214extern unsigned char yytext[];
215#else
216extern char *yytext;
217#endif
218extern int yylineno;
219extern FILE *yyin;
220extern struct vl_desc *vl_description;
221extern struct vl_module *vl_currentModule;
222extern struct vl_primitive *vl_currentPrimitive;
223extern struct vl_function *vl_currentFunction;
224
225void yyerror ARGS((char *str));
226
227int yywrap ARGS(());
228void skipcommentblock ARGS(());
229void skipcommentline ARGS(());
230void binbin ARGS((char *, char *));
231void octbin ARGS((char *, char *));
232void decbin ARGS((char *, char *));
233void hexbin ARGS((char *, char *));
234char *utol ARGS((char *));
235void memorize_macro ARGS((char *, st_table *));
236void expand_macro ARGS((char *, st_table *));
237
238
239void chk_error ARGS((char *));
240char *chk_malloc ARGS((unsigned));
241void vl_chk_free ARGS((lsGeneric));
242char *vlStrdup ARGS((char *));
243char *strappend ARGS((char*, char*));
244char *strappendS ARGS((char*, char*));
245char *WRT_BLIF_DC ARGS((FILE *));
246char *WRT_BLIF_MV_DC ARGS((FILE *, lsList));
247char *WRT_BLIF_GND ARGS((FILE *));
248char *WRT_BLIF_SUP ARGS((FILE *));
249vl_term *true_term ARGS((FILE *));
250vl_term *false_term ARGS((FILE *));
251int ptrcmp ARGS((const char *, const char *));
252int ptrhash ARGS((char *, int));
253int declcmp ARGS((char *, char *));
254int declhash ARGS((char *, int));
255char *strip_char ARGS((char *, char *));
256FILE *open_file ARGS((char *, char *));
257void close_file ARGS((FILE *));
258char *num_to_binstr ARGS((int, int));
259int min_bit_width ARGS((int));
260char *sys_lib_encode ARGS((int, int, int));
261char *lib_encode ARGS((int, int));
262char *gen_lib_encode ARGS((int, lsList));
263EXTERN int ipower ARGS((int, int));
264char *basename ARGS((char *));
265char *extname ARGS((char *));
Note: See TracBrowser for help on using the repository browser.