This repository has been archived by the owner on Jul 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsdfcpars.yy
330 lines (294 loc) · 6.22 KB
/
sdfcpars.yy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
/*****************************************************************************
* Copyright 1994-2005, Elliot Mednick and Mark Hummel
* This file is part of Veriwell.
*
* Veriwell is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Veriwell is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Foobar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/
/* sdfcpars.y - BISON/YACC parser for sdf configuration info */
%{
#define YYERROR_VERBOSE
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "glue.h"
#include "acc_user.h"
#include "sdflex.h"
#include "sdf.h"
#include "sdfclex.h"
#include "sdfcpars.h"
#ifdef __cplusplus
int sdfconfig_lex( YYSTYPE* );
#endif // __cplusplus
/* Used in BISON.SIM */
extern char *token_buffer;
#define yymaxdepth sdfconfig_maxdepth
#define yyparse sdfconfig_parse
#define yylex sdfconfig_lex
#define yyerror sdfconfig_error
#define yylval sdfconfig_lval
#define yychar sdfconfig_char
#define yydebug sdfconfig_debug
#define yypact sdfconfig_pact
#define yyr1 sdfconfig_r1
#define yyr2 sdfconfig_r2
#define yydef sdfconfig_def
#define yychk sdfconfig_chk
#define yypgo sdfconfig_pgo
#define yyact sdfconfig_act
#define yyexca sdfconfig_exca
#define yyerrflag sdfconfig_errflag
#define yynerrs sdfconfig_nerrs
#define yyps sdfconfig_ps
#define yypv sdfconfig_pv
#define yys sdfconfig_s
#define yy_yys sdfconfig_yys
#define yystate sdfconfig_state
#define yytmp sdfconfig_tmp
#define yyv sdfconfig_v
#define yy_yyv sdfconfig_yyv
#define yyval sdfconfig_val
#define yylloc sdfconfig_lloc
#define yyreds sdfconfig_reds
#define yytoks sdfconfig_toks
#define yylhs sdfconfig_yylhs
#define yylen sdfconfig_yylen
#define yydefred sdfconfig_yydefred
#define yydgoto sdfconfig_yydgoto
#define yysindex sdfconfig_yysindex
#define yyrindex sdfconfig_yyrindex
#define yygindex sdfconfig_yygindex
#define yytable sdfconfig_yytable
#define yycheck sdfconfig_yycheck
#define yyname sdfconfig_yyname
#define yyrule sdfconfig_yyrule
void initSDFCParse()
{
sdfclexInit();
}
%}
%expect 0
%pure_parser
%union {
int integer;
double floating;
char *ptr;
eScaleType_t etype;
eDelayType_t dtype;
eSDFConstruct_t stype;
eVerilogConstruct_t vtype;
};
%nonassoc IF
%nonassoc ELSE
%right <code> '?' ':'
%left <code> OROR
%left <code> ANDAND
%left <code> ANDANDAND
%left <code> '|'
%left <code> '^' XNOR
%left <code> '&'
%left <code> LOGICAL_EQUALITY LOGICAL_INEQUALITY CASE_EQUALITY CASE_INEQUALITY
%left <code> LT LE GT GE
%left <code> LEFT_SHIFT RIGHT_SHIFT
%left <code> '+' '-'
%left <code> '*' '/' '%'
%left <code> '(' '['
%right <code> '!' '~'
%right <code> REDUCTION_NOR
%right <code> REDUCTION_NAND
%right <code> UNARY
%token <integer> INTEGER
%token <integer> SCALAR_CONSTANT
%token <floating> FLOATING
%token <ptr> QSTRING
%token <ptr> IDENTIFIER
%token <stype> IOPATH
%token <stype> PORT
%token <stype> INTERCONNECT
%token <stype> NETDELAY
%token <stype> DEVICE
%token <stype> SETUP
%token <stype> HOLD
%token <stype> SETUPHOLD
%token <stype> RECOVERY
%token <stype> SKEW
%token <stype> WIDTH
%token <stype> PERIOD
%token <stype> NOCHANGE
%token <stype> PATHPULSE
%token <vtype> IGNORE
%token <vtype> INTERMOD_PATH
%token <vtype> MIPD
%token <vtype> CELL
%token <vtype> USE
%token INTERCONNECT_MIPD
%token <dtype> MINIMUM
%token <dtype> MAXIMUM
%token <dtype> AVERAGE
%token MTM
%token TOOL_CONTROL
%token <dtype> TYPICAL
%token SCALE_FACTORS
%token SCALE_TYPE
%token <etype> FROM_MINIMUM
%token <etype> FROM_TYPICAL
%token <etype> FROM_MAXIMUM
%token <etype> FROM_MTM
%token FROM_FILE
%token TURNOFF_DELAY
%token TURNON_DELAY
%token MODULE
%token MAP_INNER
%token ADD
%token OVERRIDE
%token IGNORE
%token EOF_
%type <floating> real
%type <dtype> min_typ_max
%type <dtype> min_max_avg
%type <etype> stype
%type <stype> sdf_construct
%type <vtype> veritool_map
%%
config
: statements EOF_
| EOF_
;
statements
: statement
| statement statements
;
statement
: map
;
map
: sdf_construct '=' veritool_map sc
{
if( ! setMap( $1, $3 ) ) {
sdfconfig_error( "illegal construct mapping" );
}
}
| INTERCONNECT_MIPD '=' min_max_avg sc
{
setInterconnectMipd( $3 );
}
| MTM '=' min_typ_max sc
{
setMTMSpec( $3 );
}
| MTM '=' TOOL_CONTROL sc
{
setMTMSpec( eTOOL_CONTROL );
}
| SCALE_FACTORS '=' real ':' real ':' real sc
{
setScaleFactors( $3, $5, $7 );
}
| SCALE_TYPE '=' stype sc
{
setScaleType( $3 );
}
| TURNOFF_DELAY '=' min_max_avg sc
{
setTurnOffDelay( $3 );
}
| TURNOFF_DELAY '=' FROM_FILE sc
{
setTurnOffDelay( eFROM_FILE );
}
;
stype
: FROM_MINIMUM
{ $$ = eFROM_MINIMUM; }
| FROM_TYPICAL
{ $$ = eFROM_TYPICAL; }
| FROM_MAXIMUM
{ $$ = eFROM_MAXIMUM; }
| FROM_MTM
{ $$ = eFROM_MTM; }
;
real
: FLOATING
| INTEGER
{
$$ = (double) $1;
}
;
sdf_construct
: IOPATH
{ $$ = eIOPATH; }
| PORT
{ $$ = ePORT; }
| INTERCONNECT
{ $$ = eINTERCONNECT; }
| NETDELAY
{ $$ = eNETDELAY; }
| DEVICE
{ $$ = eDEVICE; }
| SETUP
{ $$ = eSETUP; }
| HOLD
{ $$ = eHOLD; }
| SETUPHOLD
{ $$ = eSETUPHOLD; }
| RECOVERY
{ $$ = eRECOVERY; }
| SKEW
{ $$ = eSKEW; }
| WIDTH
{ $$ = eWIDTH; }
| PERIOD
{ $$ = ePERIOD; }
| NOCHANGE
{ $$ = eNOCHANGE; }
| PATHPULSE
{ $$ = ePATHPULSE; }
;
veritool_map
: IGNORE
{ $$ = eVIGNORE; }
| INTERMOD_PATH
{ $$ = eVINTERMODPATH; }
| MIPD
{ $$ = eVMIPD; }
| CELL
{ $$ = eVCELL; }
| USE
{ $$ = eVUSE; }
;
min_max_avg
: MINIMUM
{ $$ = eMINIMUM; }
| MAXIMUM
{ $$ = eMAXIMUM; }
| AVERAGE
{ $$ = eAVERAGE; }
;
min_typ_max
: MINIMUM
{ $$ = eMINIMUM; }
| TYPICAL
{ $$ = eTYPICAL; }
| MAXIMUM
{ $$ = eMAXIMUM; }
;
/*
"Important" terminals
*/
sc
: ';'
{ yyerrok; }
;
%%