fd25dbfc83c7179ed73af7909499cce11a80690b
[sv2nmigen.git] / parse_sv.py
1 # %{
2 # /*
3 # * Copyright (c) 1998-2017 Stephen Williams (steve@icarus.com)
4 # * Copyright CERN 2012-2013 / Stephen Williams (steve@icarus.com)
5 # *
6 # * This source code is free software; you can redistribute it
7 # * and/or modify it in source code form under the terms of the GNU
8 # * General Public License as published by the Free Software
9 # * Foundation; either version 2 of the License, or (at your option)
10 # * any later version.
11 # *
12 # * This program is distributed in the hope that it will be useful,
13 # * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # * GNU General Public License for more details.
16 # *
17 # * You should have received a copy of the GNU General Public License
18 # * along with this program; if not, write to the Free Software
19 # * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 # */
21
22 from lib2to3.pytree import Node, Leaf
23 from lib2to3.pgen2 import token
24 from lib2to3.pygram import python_symbols as syms
25
26 yacc1_debug = 0
27 yacc2_debug = 0
28 parse_debug = 1
29
30 from ply import yacc, lex
31
32 #from parse_tokens import tokens
33 import lexor
34 tokens = lexor.tokens # list(set(lexor.tokens).union(set(tokens)))
35 literals = lexor.literals
36
37 precedence = [\
38 ('right', 'K_PLUS_EQ', 'K_MINUS_EQ', 'K_MUL_EQ', 'K_DIV_EQ',
39 'K_MOD_EQ', 'K_AND_EQ', 'K_OR_EQ'),
40 ('right', 'K_XOR_EQ', 'K_LS_EQ', 'K_RS_EQ', 'K_RSS_EQ'),
41 ('right', '?', ':', 'K_inside'),
42 ('left', 'K_LOR'),
43 ('left', 'K_LAND'),
44 ('left', '|'),
45 ('left', '^', 'K_NXOR', 'K_NOR'),
46 ('left', '&', 'K_NAND'),
47 ('left', 'K_EQ', 'K_NE', 'K_CEQ', 'K_CNE', 'K_WEQ', 'K_WNE'),
48 ('left', 'K_GE', 'K_LE', '<', '>'),
49 ('left', 'K_LS', 'K_RS', 'K_RSS'),
50 ('left', '+', '-'),
51 ('left', '*', '/', '%'),
52 ('left', 'K_POW'),
53 ('left', 'UNARY_PREC'),
54 ('nonassoc', 'less_than_K_else'),
55 ('nonassoc', 'K_else'),
56 ('nonassoc', '('),
57 ('nonassoc', 'K_exclude'),
58 ('nonassoc', 'no_timeunits_declaration'),
59 ('nonassoc', 'one_timeunits_declaration'),
60 ('nonassoc', 'K_timeunit', 'K_timeprecision')
61 ]
62
63
64 IVL_VT_NO_TYPE = 'VT_NO_TYPE'
65 IVL_VT_BOOL = 'VT_BOOL'
66 IVL_VT_LOGIC = 'VT_LOGIC'
67 """
68 IVL_VT_VOID = 0, /* Not used */
69 IVL_VT_NO_TYPE = 1, /* Place holder for missing/unknown type. */
70 IVL_VT_REAL = 2,
71 IVL_VT_BOOL = 3,
72 IVL_VT_LOGIC = 4,
73 IVL_VT_STRING = 5,
74 IVL_VT_DARRAY = 6, /* Array (esp. dynamic array) */
75 IVL_VT_CLASS = 7, /* SystemVerilog class instances */
76 IVL_VT_QUEUE = 8, /* SystemVerilog queue instances */
77 IVL_VT_VECTOR = IVL_VT_LOGIC /* For compatibility */
78 """
79
80 NN_NONE = 'NONE'
81 NN_IMPLICIT = 'IMPLICIT'
82 NN_IMPLICIT_REG = 'IMPLICIT_REG'
83 NN_INTEGER = 'INTEGER'
84 NN_WIRE = 'WIRE'
85 NN_TRI = 'TRI'
86 NN_TRI1 = 'TRI1'
87 NN_SUPPLY0 = 'SUPPLY0'
88 NN_SUPPLY1 = 'SUPPLY1'
89 NN_WAND = 'WAND'
90 NN_TRIAND = 'TRIAND'
91 NN_TRI0 = 'TRI0'
92 NN_WOR = 'WOR'
93 NN_TRIOR = 'TRIOR'
94 NN_REG = 'REG'
95 NN_UNRESOLVED_WIRE = 'UNRESOLVED_WIRE'
96
97 NP_NOT_A_PORT = 'NOT_A_PORT'
98 NP_PIMPLICIT = 'PIMPLICIT'
99 NP_PINPUT = 'PINPUT'
100 NP_POUTPUT = 'POUTPUT'
101 NP_PINOUT = 'PINOUT'
102 NP_PREF = 'PREF'
103
104
105
106
107 class DataType:
108 def __init__(self, typ, signed):
109 self.typ = typ
110 self.signed = signed
111
112 # -------------- RULES ----------------
113 ()
114 def p_source_text_1(p):
115 '''source_text : timeunits_declaration_opt _embed0_source_text description_list '''
116 if(parse_debug>2): print('source_text', list(p))
117 ()
118 def p_source_text_2(p):
119 '''source_text : '''
120 if(parse_debug): print('source_text', list(p))
121 ()
122 def p__embed0_source_text(p):
123 '''_embed0_source_text : '''
124 # { pform_set_scope_timescale(yyloc); }
125 ()
126 def p_assertion_item_1(p):
127 '''assertion_item : concurrent_assertion_item '''
128 if(parse_debug): print('assertion_item_1', list(p))
129 ()
130 def p_assignment_pattern_1(p):
131 '''assignment_pattern : K_LP expression_list_proper '}' '''
132 if(parse_debug): print('assignment_pattern_1', list(p))
133 # { PEAssignPattern*tmp = new PEAssignPattern(*p[2]);
134 # FILE_NAME(tmp, @1);
135 # delete p[2];
136 # p[0] = tmp;
137 # }
138 ()
139 def p_assignment_pattern_2(p):
140 '''assignment_pattern : K_LP '}' '''
141 if(parse_debug): print('assignment_pattern_2', list(p))
142 # { PEAssignPattern*tmp = new PEAssignPattern;
143 # FILE_NAME(tmp, @1);
144 # p[0] = tmp;
145 # }
146 ()
147 def p_block_identifier_opt_1(p):
148 '''block_identifier_opt : IDENTIFIER ':' '''
149 if(parse_debug): print('block_identifier_opt_1', list(p))
150 ()
151 def p_block_identifier_opt_2(p):
152 '''block_identifier_opt : '''
153 if(parse_debug): print('block_identifier_opt_2', list(p))
154 ()
155 def p_class_declaration_1(p):
156 '''class_declaration : K_virtual_opt K_class lifetime_opt class_identifier class_declaration_extends_opt ';' _embed0_class_declaration class_items_opt K_endclass _embed1_class_declaration class_declaration_endlabel_opt '''
157 if(parse_debug): print('class_declaration_1', list(p))
158 # { // Wrap up the class.
159 # if (p[11] && p[4] && p[4]->name != p[11]) {
160 # yyerror(@11, "error: Class end label doesn't match class name.");
161 # delete[]p[11];
162 # }
163 # }
164 ()
165 def p__embed0_class_declaration(p):
166 '''_embed0_class_declaration : '''
167 # { pform_start_class_declaration(@2, p[4], p[5].type, p[5].exprs, p[3]); }
168 ()
169 def p__embed1_class_declaration(p):
170 '''_embed1_class_declaration : '''
171 # { // Process a class.
172 # pform_end_class_declaration(@9);
173 # }
174 ()
175 def p_class_constraint_1(p):
176 '''class_constraint : constraint_prototype '''
177 if(parse_debug): print('class_constraint_1', list(p))
178 ()
179 def p_class_constraint_2(p):
180 '''class_constraint : constraint_declaration '''
181 if(parse_debug): print('class_constraint_2', list(p))
182 ()
183 def p_class_identifier_1(p):
184 '''class_identifier : IDENTIFIER '''
185 if(parse_debug): print('class_identifier_1', list(p))
186 # { // Create a synthetic typedef for the class name so that the
187 # // lexor detects the name as a type.
188 # perm_string name = lex_strings.make(p[1]);
189 # class_type_t*tmp = new class_type_t(name);
190 # FILE_NAME(tmp, @1);
191 # pform_set_typedef(name, tmp, NULL);
192 # delete[]p[1];
193 # p[0] = tmp;
194 # }
195 ()
196 def p_class_identifier_2(p):
197 '''class_identifier : TYPE_IDENTIFIER '''
198 if(parse_debug): print('class_identifier_2', list(p))
199 # { class_type_t*tmp = dynamic_cast<class_type_t*>(p[1].type);
200 # if (tmp == 0) {
201 # yyerror(@1, "Type name \"%s\"is not a predeclared class name.", p[1].text);
202 # }
203 # delete[]p[1].text;
204 # p[0] = tmp;
205 # }
206 ()
207 def p_class_declaration_endlabel_opt_1(p):
208 '''class_declaration_endlabel_opt : ':' TYPE_IDENTIFIER '''
209 if(parse_debug): print('class_declaration_endlabel_opt_1', list(p))
210 # { class_type_t*tmp = dynamic_cast<class_type_t*> (p[2].type);
211 # if (tmp == 0) {
212 # yyerror(@2, "error: class declaration endlabel \"%s\" is not a class name\n", p[2].text);
213 # p[0] = None
214 # } else {
215 # p[0] = strdupnew(tmp->name.str());
216 # }
217 # delete[]p[2].text;
218 # }
219 ()
220 def p_class_declaration_endlabel_opt_2(p):
221 '''class_declaration_endlabel_opt : ':' IDENTIFIER '''
222 if(parse_debug): print('class_declaration_endlabel_opt_2', list(p))
223 p[0] = p[2]
224 ()
225 def p_class_declaration_endlabel_opt_3(p):
226 '''class_declaration_endlabel_opt : '''
227 if(parse_debug): print('class_declaration_endlabel_opt_3', list(p))
228 # { p[0] = None }
229 ()
230 def p_class_declaration_extends_opt_1(p):
231 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '''
232 if(parse_debug): print('class_declaration_extends_opt_1', list(p))
233 # { p[0].type = p[2].type;
234 # p[0].exprs= 0;
235 # delete[]p[2].text;
236 # }
237 ()
238 def p_class_declaration_extends_opt_2(p):
239 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '(' expression_list_with_nuls ')' '''
240 if(parse_debug): print('class_declaration_extends_opt_2', list(p))
241 # { p[0].type = p[2].type;
242 # p[0].exprs = p[4];
243 # delete[]p[2].text;
244 # }
245 ()
246 def p_class_declaration_extends_opt_3(p):
247 '''class_declaration_extends_opt : '''
248 if(parse_debug): print('class_declaration_extends_opt_3', list(p))
249 # { p[0].type = 0; p[0].exprs = 0; }
250 ()
251 def p_class_items_opt_1(p):
252 '''class_items_opt : class_items '''
253 if(parse_debug): print('class_items_opt_1', list(p))
254 ()
255 def p_class_items_opt_2(p):
256 '''class_items_opt : '''
257 if(parse_debug): print('class_items_opt_2', list(p))
258 ()
259 def p_class_items_1(p):
260 '''class_items : class_items class_item '''
261 if(parse_debug): print('class_items_1', list(p))
262 ()
263 def p_class_items_2(p):
264 '''class_items : class_item '''
265 if(parse_debug): print('class_items_2', list(p))
266 ()
267 def p_class_item_1(p):
268 '''class_item : method_qualifier_opt K_function K_new _embed0_class_item '(' tf_port_list_opt ')' ';' function_item_list_opt statement_or_null_list_opt K_endfunction endnew_opt '''
269 if(parse_debug): print('class_item_1', list(p))
270 # { current_function->set_ports(p[6]);
271 # pform_set_constructor_return(current_function);
272 # pform_set_this_class(@3, current_function);
273 # current_function_set_statement(@3, p[10]);
274 # pform_pop_scope();
275 # current_function = 0;
276 # }
277 ()
278 def p_class_item_2(p):
279 '''class_item : property_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
280 if(parse_debug): print('class_item_2', list(p))
281 # { pform_class_property(@2, p[1], p[2], p[3]); }
282 ()
283 def p_class_item_3(p):
284 '''class_item : K_const class_item_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
285 if(parse_debug): print('class_item_3', list(p))
286 # { pform_class_property(@1, p[2] | property_qualifier_t::make_const(), p[3], p[4]); }
287 ()
288 def p_class_item_4(p):
289 '''class_item : method_qualifier_opt task_declaration '''
290 if(parse_debug): print('class_item_4', list(p))
291 # { /* The task_declaration rule puts this into the class */ }
292 ()
293 def p_class_item_5(p):
294 '''class_item : method_qualifier_opt function_declaration '''
295 if(parse_debug): print('class_item_5', list(p))
296 # { /* The function_declaration rule puts this into the class */ }
297 ()
298 def p_class_item_6(p):
299 '''class_item : K_extern method_qualifier_opt K_function K_new ';' '''
300 if(parse_debug): print('class_item_6', list(p))
301 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
302 ()
303 def p_class_item_7(p):
304 '''class_item : K_extern method_qualifier_opt K_function K_new '(' tf_port_list_opt ')' ';' '''
305 if(parse_debug): print('class_item_7', list(p))
306 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
307 ()
308 def p_class_item_8(p):
309 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER ';' '''
310 if(parse_debug): print('class_item_8', list(p))
311 # { yyerror(@1, "sorry: External methods are not yet supported.");
312 # delete[] p[5];
313 # }
314 ()
315 def p_class_item_9(p):
316 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' ';' '''
317 if(parse_debug): print('class_item_9', list(p))
318 # { yyerror(@1, "sorry: External methods are not yet supported.");
319 # delete[] p[5];
320 # }
321 ()
322 def p_class_item_10(p):
323 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER ';' '''
324 if(parse_debug): print('class_item_10', list(p))
325 # { yyerror(@1, "sorry: External methods are not yet supported.");
326 # delete[] p[4];
327 # }
328 ()
329 def p_class_item_11(p):
330 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER '(' tf_port_list_opt ')' ';' '''
331 if(parse_debug): print('class_item_11', list(p))
332 # { yyerror(@1, "sorry: External methods are not yet supported.");
333 # delete[] p[4];
334 # }
335 ()
336 def p_class_item_12(p):
337 '''class_item : class_constraint '''
338 if(parse_debug): print('class_item_12', list(p))
339 ()
340 def p_class_item_13(p):
341 '''class_item : property_qualifier_opt data_type error ';' '''
342 if(parse_debug): print('class_item_13', list(p))
343 # { yyerror(@3, "error: Errors in variable names after data type.");
344 # yyerrok;
345 # }
346 ()
347 def p_class_item_14(p):
348 '''class_item : property_qualifier_opt IDENTIFIER error ';' '''
349 if(parse_debug): print('class_item_14', list(p))
350 # { yyerror(@3, "error: %s doesn't name a type.", p[2]);
351 # yyerrok;
352 # }
353 ()
354 def p_class_item_15(p):
355 '''class_item : method_qualifier_opt K_function K_new error K_endfunction endnew_opt '''
356 if(parse_debug): print('class_item_15', list(p))
357 # { yyerror(@1, "error: I give up on this class constructor declaration.");
358 # yyerrok;
359 # }
360 ()
361 def p_class_item_16(p):
362 '''class_item : error ';' '''
363 if(parse_debug): print('class_item_16', list(p))
364 # { yyerror(@2, "error: invalid class item.");
365 # yyerrok;
366 # }
367 ()
368 def p__embed0_class_item(p):
369 '''_embed0_class_item : '''
370 # { assert(current_function==0);
371 # current_function = pform_push_constructor_scope(@3);
372 # }
373 ()
374 def p_class_item_qualifier_1(p):
375 '''class_item_qualifier : K_static '''
376 if(parse_debug): print('class_item_qualifier_1', list(p))
377 # { p[0] = property_qualifier_t::make_static(); }
378 ()
379 def p_class_item_qualifier_2(p):
380 '''class_item_qualifier : K_protected '''
381 if(parse_debug): print('class_item_qualifier_2', list(p))
382 # { p[0] = property_qualifier_t::make_protected(); }
383 ()
384 def p_class_item_qualifier_3(p):
385 '''class_item_qualifier : K_local '''
386 if(parse_debug): print('class_item_qualifier_3', list(p))
387 # { p[0] = property_qualifier_t::make_local(); }
388 ()
389 def p_class_item_qualifier_list_1(p):
390 '''class_item_qualifier_list : class_item_qualifier_list class_item_qualifier '''
391 if(parse_debug): print('class_item_qualifier_list_1', list(p))
392 # { p[0] = p[1] | p[2]; }
393 ()
394 def p_class_item_qualifier_list_2(p):
395 '''class_item_qualifier_list : class_item_qualifier '''
396 if(parse_debug): print('class_item_qualifier_list_2', list(p))
397 p[0] = p[1]
398 ()
399 def p_class_item_qualifier_opt_1(p):
400 '''class_item_qualifier_opt : class_item_qualifier_list '''
401 if(parse_debug): print('class_item_qualifier_opt_1', list(p))
402 p[0] = p[1]
403 ()
404 def p_class_item_qualifier_opt_2(p):
405 '''class_item_qualifier_opt : '''
406 if(parse_debug): print('class_item_qualifier_opt_2', list(p))
407 # { p[0] = property_qualifier_t::make_none(); }
408 ()
409 def p_class_new_1(p):
410 '''class_new : K_new '(' expression_list_with_nuls ')' '''
411 if(parse_debug): print('class_new_1', list(p))
412 # { list<PExpr*>*expr_list = p[3];
413 # strip_tail_items(expr_list);
414 # PENewClass*tmp = new PENewClass(*expr_list);
415 # FILE_NAME(tmp, @1);
416 # delete p[3];
417 # p[0] = tmp;
418 # }
419 ()
420 def p_class_new_2(p):
421 '''class_new : K_new hierarchy_identifier '''
422 if(parse_debug): print('class_new_2', list(p))
423 # { PEIdent*tmpi = new PEIdent(*p[2]);
424 # FILE_NAME(tmpi, @2);
425 # PENewCopy*tmp = new PENewCopy(tmpi);
426 # FILE_NAME(tmp, @1);
427 # delete p[2];
428 # p[0] = tmp;
429 # }
430 ()
431 def p_class_new_3(p):
432 '''class_new : K_new '''
433 if(parse_debug): print('class_new_3', list(p))
434 # { PENewClass*tmp = new PENewClass;
435 # FILE_NAME(tmp, @1);
436 # p[0] = tmp;
437 # }
438 ()
439 def p_concurrent_assertion_item_1(p):
440 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' property_spec ')' statement_or_null '''
441 if(parse_debug): print('concurrent_assertion_item_1', list(p))
442 # { /* */
443 # if (gn_assertions_flag) {
444 # yyerror(@2, "sorry: concurrent_assertion_item not supported."
445 # " Try -gno-assertion to turn this message off.");
446 # }
447 # }
448 ()
449 def p_concurrent_assertion_item_2(p):
450 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' error ')' statement_or_null '''
451 if(parse_debug): print('concurrent_assertion_item_2', list(p))
452 # { yyerrok;
453 # yyerror(@2, "error: Error in property_spec of concurrent assertion item.");
454 # }
455 ()
456 def p_constraint_block_item_1(p):
457 '''constraint_block_item : constraint_expression '''
458 if(parse_debug): print('constraint_block_item_1', list(p))
459 ()
460 def p_constraint_block_item_list_1(p):
461 '''constraint_block_item_list : constraint_block_item_list constraint_block_item '''
462 if(parse_debug): print('constraint_block_item_list_1', list(p))
463 ()
464 def p_constraint_block_item_list_2(p):
465 '''constraint_block_item_list : constraint_block_item '''
466 if(parse_debug): print('constraint_block_item_list_2', list(p))
467 ()
468 def p_constraint_block_item_list_opt_1(p):
469 '''constraint_block_item_list_opt : '''
470 if(parse_debug): print('constraint_block_item_list_opt_1', list(p))
471 ()
472 def p_constraint_block_item_list_opt_2(p):
473 '''constraint_block_item_list_opt : constraint_block_item_list '''
474 if(parse_debug): print('constraint_block_item_list_opt_2', list(p))
475 ()
476 def p_constraint_declaration_1(p):
477 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' constraint_block_item_list_opt '}' '''
478 if(parse_debug): print('constraint_declaration_1', list(p))
479 # { yyerror(@2, "sorry: Constraint declarations not supported."); }
480 ()
481 def p_constraint_declaration_2(p):
482 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' error '}' '''
483 if(parse_debug): print('constraint_declaration_2', list(p))
484 # { yyerror(@4, "error: Errors in the constraint block item list."); }
485 ()
486 def p_constraint_expression_1(p):
487 '''constraint_expression : expression ';' '''
488 if(parse_debug): print('constraint_expression_1', list(p))
489 ()
490 def p_constraint_expression_2(p):
491 '''constraint_expression : expression K_dist '{' '}' ';' '''
492 if(parse_debug): print('constraint_expression_2', list(p))
493 ()
494 def p_constraint_expression_3(p):
495 '''constraint_expression : expression K_TRIGGER constraint_set '''
496 if(parse_debug): print('constraint_expression_3', list(p))
497 ()
498 def p_constraint_expression_4(p):
499 '''constraint_expression : K_if '(' expression ')' constraint_set %prec less_than_K_else '''
500 if(parse_debug): print('constraint_expression_4', list(p))
501 ()
502 def p_constraint_expression_5(p):
503 '''constraint_expression : K_if '(' expression ')' constraint_set K_else constraint_set '''
504 if(parse_debug): print('constraint_expression_5', list(p))
505 ()
506 def p_constraint_expression_6(p):
507 '''constraint_expression : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' constraint_set '''
508 if(parse_debug): print('constraint_expression_6', list(p))
509 ()
510 def p_constraint_expression_list_1(p):
511 '''constraint_expression_list : constraint_expression_list constraint_expression '''
512 if(parse_debug): print('constraint_expression_list_1', list(p))
513 ()
514 def p_constraint_expression_list_2(p):
515 '''constraint_expression_list : constraint_expression '''
516 if(parse_debug): print('constraint_expression_list_2', list(p))
517 ()
518 def p_constraint_prototype_1(p):
519 '''constraint_prototype : K_static_opt K_constraint IDENTIFIER ';' '''
520 if(parse_debug): print('constraint_prototype_1', list(p))
521 # { yyerror(@2, "sorry: Constraint prototypes not supported."); }
522 ()
523 def p_constraint_set_1(p):
524 '''constraint_set : constraint_expression '''
525 if(parse_debug): print('constraint_set_1', list(p))
526 ()
527 def p_constraint_set_2(p):
528 '''constraint_set : '{' constraint_expression_list '}' '''
529 if(parse_debug): print('constraint_set_2', list(p))
530 ()
531 def p_data_declaration_1(p):
532 '''data_declaration : attribute_list_opt data_type_or_implicit list_of_variable_decl_assignments ';' '''
533 if(parse_debug): print('data_declaration_1', list(p))
534 # { data_type_t*data_type = p[2];
535 # if (data_type == 0) {
536 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
537 # FILE_NAME(data_type, @2);
538 # }
539 # pform_makewire(@2, 0, str_strength, p[3], NetNet::IMPLICIT_REG, data_type);
540 # }
541 ()
542 def p_data_type_1(p):
543 '''data_type : integer_vector_type unsigned_signed_opt dimensions_opt '''
544 if(parse_debug): print('data_type_1', list(p))
545 use_vtype = p[1]
546 reg_flag = False
547 if (use_vtype == IVL_VT_NO_TYPE):
548 use_vtype = IVL_VT_LOGIC
549 reg_flag = True
550 dt = DataType(use_vtype, signed=p[2])
551 dt.dims = p[3]
552 dt.reg_flag = reg_flag
553 p[0] = dt
554 # { ivl_variable_type_t use_vtype = p[1];
555 # bool reg_flag = false;
556 # if (use_vtype == IVL_VT_NO_TYPE) {
557 # use_vtype = IVL_VT_LOGIC;
558 # reg_flag = true;
559 # }
560 # vector_type_t*tmp = new vector_type_t(use_vtype, p[2], p[3]);
561 # tmp->reg_flag = reg_flag;
562 # FILE_NAME(tmp, @1);
563 # p[0] = tmp;
564 # }
565 ()
566 def p_data_type_2(p):
567 '''data_type : non_integer_type '''
568 if(parse_debug): print('data_type_2', list(p))
569 p[0] = p[1]
570 # { real_type_t*tmp = new real_type_t(p[1]);
571 # FILE_NAME(tmp, @1);
572 # p[0] = tmp;
573 # }
574 ()
575 def p_data_type_3(p):
576 '''data_type : struct_data_type '''
577 if(parse_debug): print('data_type_3', list(p))
578 p[0] = p[1]
579 # { if (!p[1]->packed_flag) {
580 # yyerror(@1, "sorry: Unpacked structs not supported.");
581 # }
582 # p[0] = p[1];
583 # }
584 ()
585 def p_data_type_4(p):
586 '''data_type : enum_data_type '''
587 if(parse_debug): print('data_type_4', list(p))
588 p[0] = p[1]
589 ()
590 def p_data_type_5(p):
591 '''data_type : atom2_type signed_unsigned_opt '''
592 if(parse_debug): print('data_type_5', list(p))
593 # { atom2_type_t*tmp = new atom2_type_t(p[1], p[2]);
594 # FILE_NAME(tmp, @1);
595 # p[0] = tmp;
596 # }
597 ()
598 def p_data_type_6(p):
599 '''data_type : K_integer signed_unsigned_opt '''
600 if(parse_debug): print('data_type_6', list(p))
601 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
602 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, p[2], pd);
603 # tmp->reg_flag = true;
604 # tmp->integer_flag = true;
605 # p[0] = tmp;
606 # }
607 ()
608 def p_data_type_7(p):
609 '''data_type : K_time '''
610 if(parse_debug): print('data_type_7', list(p))
611 # { list<pform_range_t>*pd = make_range_from_width(64);
612 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
613 # tmp->reg_flag = !gn_system_verilog();
614 # p[0] = tmp;
615 # }
616 ()
617 def p_data_type_8(p):
618 '''data_type : TYPE_IDENTIFIER dimensions_opt '''
619 if(parse_debug): print('data_type_8', list(p))
620 # { if (p[2]) {
621 # parray_type_t*tmp = new parray_type_t(p[1].type, p[2]);
622 # FILE_NAME(tmp, @1);
623 # p[0] = tmp;
624 # } else p[0] = p[1].type;
625 # delete[]p[1].text;
626 # }
627 ()
628 def p_data_type_9(p):
629 '''data_type : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_data_type TYPE_IDENTIFIER '''
630 if(parse_debug): print('data_type_9', list(p))
631 # { lex_in_package_scope(0);
632 # p[0] = p[4].type;
633 # delete[]p[4].text;
634 # }
635 ()
636 def p_data_type_10(p):
637 '''data_type : K_string '''
638 if(parse_debug): print('data_type_10', list(p))
639 # { string_type_t*tmp = new string_type_t;
640 # FILE_NAME(tmp, @1);
641 # p[0] = tmp;
642 # }
643 ()
644 def p__embed0_data_type(p):
645 '''_embed0_data_type : '''
646 # { lex_in_package_scope(p[1]); }
647 ()
648 def p_data_type_or_implicit_1(p):
649 '''data_type_or_implicit : data_type '''
650 if(parse_debug): print('data_type_or_implicit_1', list(p))
651 p[0] = p[1]
652 ()
653 def p_data_type_or_implicit_2(p):
654 '''data_type_or_implicit : signing dimensions_opt '''
655 if(parse_debug): print('data_type_or_implicit_2', list(p))
656 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, p[1], p[2]);
657 # tmp->implicit_flag = true;
658 # FILE_NAME(tmp, @1);
659 # p[0] = tmp;
660 # }
661 ()
662 def p_data_type_or_implicit_3(p):
663 '''data_type_or_implicit : dimensions '''
664 if(parse_debug): print('data_type_or_implicit_3', list(p))
665 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, p[1]);
666 # tmp->implicit_flag = true;
667 # FILE_NAME(tmp, @1);
668 # p[0] = tmp;
669 # }
670 ()
671 def p_data_type_or_implicit_4(p):
672 '''data_type_or_implicit : '''
673 if(parse_debug>2): print('data_type_or_implicit_4', list(p))
674 # { p[0] = None }
675 ()
676 def p_data_type_or_implicit_or_void_1(p):
677 '''data_type_or_implicit_or_void : data_type_or_implicit '''
678 if(parse_debug): print('data_type_or_implicit_or_void_1', list(p))
679 p[0] = p[1]
680 ()
681 def p_data_type_or_implicit_or_void_2(p):
682 '''data_type_or_implicit_or_void : K_void '''
683 if(parse_debug): print('data_type_or_implicit_or_void_2', list(p))
684 # { void_type_t*tmp = new void_type_t;
685 # FILE_NAME(tmp, @1);
686 # p[0] = tmp;
687 # }
688 ()
689 def p_description_1(p):
690 '''description : module '''
691 if(parse_debug>2): print('description_1', list(p))
692 ()
693 def p_description_2(p):
694 '''description : udp_primitive '''
695 if(parse_debug): print('description_2', list(p))
696 ()
697 def p_description_3(p):
698 '''description : config_declaration '''
699 if(parse_debug): print('description_3', list(p))
700 ()
701 def p_description_4(p):
702 '''description : nature_declaration '''
703 if(parse_debug): print('description_4', list(p))
704 ()
705 def p_description_5(p):
706 '''description : package_declaration '''
707 if(parse_debug): print('description_5', list(p))
708 ()
709 def p_description_6(p):
710 '''description : discipline_declaration '''
711 if(parse_debug): print('description_6', list(p))
712 ()
713 def p_description_7(p):
714 '''description : package_item '''
715 if(parse_debug): print('description_7', list(p))
716 ()
717 def p_description_8(p):
718 '''description : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' '''
719 if(parse_debug): print('description_8', list(p))
720 # { perm_string tmp3 = lex_strings.make(p[3]);
721 # pform_set_type_attrib(tmp3, p[5], p[7]);
722 # delete[] p[3];
723 # delete[] p[5];
724 # }
725 ()
726 def p_description_list_1(p):
727 '''description_list : description '''
728 if(parse_debug>2): print('description_list_1', list(p))
729 ()
730 def p_description_list_2(p):
731 '''description_list : description_list description '''
732 if(parse_debug): print('description_list_2', list(p))
733 ()
734 def p_endnew_opt_1(p):
735 '''endnew_opt : ':' K_new '''
736 if(parse_debug): print('endnew_opt_1', list(p))
737 ()
738 def p_endnew_opt_2(p):
739 '''endnew_opt : '''
740 if(parse_debug): print('endnew_opt_2', list(p))
741 ()
742 def p_dynamic_array_new_1(p):
743 '''dynamic_array_new : K_new '[' expression ']' '''
744 if(parse_debug): print('dynamic_array_new_1', list(p))
745 # { p[0] = new PENewArray(p[3], 0);
746 # FILE_NAME(p[0], @1);
747 # }
748 ()
749 def p_dynamic_array_new_2(p):
750 '''dynamic_array_new : K_new '[' expression ']' '(' expression ')' '''
751 if(parse_debug): print('dynamic_array_new_2', list(p))
752 # { p[0] = new PENewArray(p[3], p[6]);
753 # FILE_NAME(p[0], @1);
754 # }
755 ()
756 def p_for_step_1(p):
757 '''for_step : lpvalue '=' expression '''
758 if(parse_debug): print('for_step_1', list(p))
759 # { PAssign*tmp = new PAssign(p[1],p[3]);
760 # FILE_NAME(tmp, @1);
761 # p[0] = tmp;
762 # }
763 ()
764 def p_for_step_2(p):
765 '''for_step : inc_or_dec_expression '''
766 if(parse_debug): print('for_step_2', list(p))
767 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
768 ()
769 def p_for_step_3(p):
770 '''for_step : compressed_statement '''
771 if(parse_debug): print('for_step_3', list(p))
772 p[0] = p[1]
773 ()
774 def p_function_declaration_1(p):
775 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER ';' _embed0_function_declaration function_item_list statement_or_null_list_opt K_endfunction _embed1_function_declaration endlabel_opt '''
776 if(parse_debug): print('function_declaration_1', list(p))
777 # { // Last step: check any closing name.
778 # if (p[11]) {
779 # if (strcmp(p[4],p[11]) != 0) {
780 # yyerror(@11, "error: End label doesn't match "
781 # "function name");
782 # }
783 # if (! gn_system_verilog()) {
784 # yyerror(@11, "error: Function end labels require "
785 # "SystemVerilog.");
786 # }
787 # delete[]p[11];
788 # }
789 # delete[]p[4];
790 # }
791 ()
792 def p_function_declaration_2(p):
793 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER _embed2_function_declaration '(' tf_port_list_opt ')' ';' block_item_decls_opt statement_or_null_list_opt K_endfunction _embed3_function_declaration endlabel_opt '''
794 if(parse_debug): print('function_declaration_2', list(p))
795 # { // Last step: check any closing name.
796 # if (p[14]) {
797 # if (strcmp(p[4],p[14]) != 0) {
798 # yyerror(@14, "error: End label doesn't match "
799 # "function name");
800 # }
801 # if (! gn_system_verilog()) {
802 # yyerror(@14, "error: Function end labels require "
803 # "SystemVerilog.");
804 # }
805 # delete[]p[14];
806 # }
807 # delete[]p[4];
808 # }
809 ()
810 def p_function_declaration_3(p):
811 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER error K_endfunction _embed4_function_declaration endlabel_opt '''
812 if(parse_debug): print('function_declaration_3', list(p))
813 # { // Last step: check any closing name.
814 # if (p[8]) {
815 # if (strcmp(p[4],p[8]) != 0) {
816 # yyerror(@8, "error: End label doesn't match function name");
817 # }
818 # if (! gn_system_verilog()) {
819 # yyerror(@8, "error: Function end labels require "
820 # "SystemVerilog.");
821 # }
822 # delete[]p[8];
823 # }
824 # delete[]p[4];
825 # }
826 ()
827 def p__embed0_function_declaration(p):
828 '''_embed0_function_declaration : '''
829 # { assert(current_function == 0);
830 # current_function = pform_push_function_scope(@1, p[4], p[2]);
831 # }
832 ()
833 def p__embed1_function_declaration(p):
834 '''_embed1_function_declaration : '''
835 # { current_function->set_ports(p[7]);
836 # current_function->set_return(p[3]);
837 # current_function_set_statement(p[8]? @8 : @4, p[8]);
838 # pform_set_this_class(@4, current_function);
839 # pform_pop_scope();
840 # current_function = 0;
841 # }
842 ()
843 def p__embed2_function_declaration(p):
844 '''_embed2_function_declaration : '''
845 # { assert(current_function == 0);
846 # current_function = pform_push_function_scope(@1, p[4], p[2]);
847 # }
848 ()
849 def p__embed3_function_declaration(p):
850 '''_embed3_function_declaration : '''
851 # { current_function->set_ports(p[7]);
852 # current_function->set_return(p[3]);
853 # current_function_set_statement(p[11]? @11 : @4, p[11]);
854 # pform_set_this_class(@4, current_function);
855 # pform_pop_scope();
856 # current_function = 0;
857 # if (p[7]==0 && !gn_system_verilog()) {
858 # yyerror(@4, "error: Empty parenthesis syntax requires SystemVerilog.");
859 # }
860 # }
861 ()
862 def p__embed4_function_declaration(p):
863 '''_embed4_function_declaration : '''
864 # { /* */
865 # if (current_function) {
866 # pform_pop_scope();
867 # current_function = 0;
868 # }
869 # assert(current_function == 0);
870 # yyerror(@1, "error: Syntax error defining function.");
871 # yyerrok;
872 # }
873 ()
874 def p_import_export_1(p):
875 '''import_export : K_import '''
876 if(parse_debug): print('import_export_1', list(p))
877 p[0] = True
878 ()
879 def p_import_export_2(p):
880 '''import_export : K_export '''
881 if(parse_debug): print('import_export_2', list(p))
882 p[0] = False
883 ()
884 def p_implicit_class_handle_1(p):
885 '''implicit_class_handle : K_this '''
886 if(parse_debug): print('implicit_class_handle_1', list(p))
887 # { p[0] = pform_create_this(); }
888 ()
889 def p_implicit_class_handle_2(p):
890 '''implicit_class_handle : K_super '''
891 if(parse_debug): print('implicit_class_handle_2', list(p))
892 # { p[0] = pform_create_super(); }
893 ()
894 def p_inc_or_dec_expression_1(p):
895 '''inc_or_dec_expression : K_INCR lpvalue %prec UNARY_PREC '''
896 if(parse_debug): print('inc_or_dec_expression_1', list(p))
897 # { PEUnary*tmp = new PEUnary('I', p[2]);
898 # FILE_NAME(tmp, @2);
899 # p[0] = tmp;
900 # }
901 ()
902 def p_inc_or_dec_expression_2(p):
903 '''inc_or_dec_expression : lpvalue K_INCR %prec UNARY_PREC '''
904 if(parse_debug): print('inc_or_dec_expression_2', list(p))
905 # { PEUnary*tmp = new PEUnary('i', p[1]);
906 # FILE_NAME(tmp, @1);
907 # p[0] = tmp;
908 # }
909 ()
910 def p_inc_or_dec_expression_3(p):
911 '''inc_or_dec_expression : K_DECR lpvalue %prec UNARY_PREC '''
912 if(parse_debug): print('inc_or_dec_expression_3', list(p))
913 # { PEUnary*tmp = new PEUnary('D', p[2]);
914 # FILE_NAME(tmp, @2);
915 # p[0] = tmp;
916 # }
917 ()
918 def p_inc_or_dec_expression_4(p):
919 '''inc_or_dec_expression : lpvalue K_DECR %prec UNARY_PREC '''
920 if(parse_debug): print('inc_or_dec_expression_4', list(p))
921 # { PEUnary*tmp = new PEUnary('d', p[1]);
922 # FILE_NAME(tmp, @1);
923 # p[0] = tmp;
924 # }
925 ()
926 def p_inside_expression_1(p):
927 '''inside_expression : expression K_inside '{' open_range_list '}' '''
928 if(parse_debug): print('inside_expression_1', list(p))
929 # { yyerror(@2, "sorry: \"inside\" expressions not supported yet.");
930 # p[0] = None
931 # }
932 ()
933 def p_integer_vector_type_1(p):
934 '''integer_vector_type : K_reg '''
935 if(parse_debug): print('integer_vector_type_1', list(p))
936 p[0] = IVL_VT_NO_TYPE
937 ()
938 def p_integer_vector_type_2(p):
939 '''integer_vector_type : K_bit '''
940 if(parse_debug): print('integer_vector_type_2', list(p))
941 p[0] = IVL_VT_BOOL
942 ()
943 def p_integer_vector_type_3(p):
944 '''integer_vector_type : K_logic '''
945 if(parse_debug): print('integer_vector_type_3', list(p))
946 p[0] = IVL_VT_LOGIC
947 ()
948 def p_integer_vector_type_4(p):
949 '''integer_vector_type : K_bool '''
950 if(parse_debug): print('integer_vector_type_4', list(p))
951 # { p[0] = IVL_VT_BOOL; }
952 ()
953 def p_join_keyword_1(p):
954 '''join_keyword : K_join '''
955 if(parse_debug): print('join_keyword_1', list(p))
956 # { p[0] = PBlock::BL_PAR; }
957 ()
958 def p_join_keyword_2(p):
959 '''join_keyword : K_join_none '''
960 if(parse_debug): print('join_keyword_2', list(p))
961 # { p[0] = PBlock::BL_JOIN_NONE; }
962 ()
963 def p_join_keyword_3(p):
964 '''join_keyword : K_join_any '''
965 if(parse_debug): print('join_keyword_3', list(p))
966 # { p[0] = PBlock::BL_JOIN_ANY; }
967 ()
968 def p_jump_statement_1(p):
969 '''jump_statement : K_break ';' '''
970 if(parse_debug): print('jump_statement_1', list(p))
971 # { yyerror(@1, "sorry: break statements not supported.");
972 # p[0] = None
973 # }
974 ()
975 def p_jump_statement_2(p):
976 '''jump_statement : K_return ';' '''
977 if(parse_debug): print('jump_statement_2', list(p))
978 # { PReturn*tmp = new PReturn(0);
979 # FILE_NAME(tmp, @1);
980 # p[0] = tmp;
981 # }
982 ()
983 def p_jump_statement_3(p):
984 '''jump_statement : K_return expression ';' '''
985 if(parse_debug): print('jump_statement_3', list(p))
986 # { PReturn*tmp = new PReturn(p[2]);
987 # FILE_NAME(tmp, @1);
988 # p[0] = tmp;
989 # }
990 ()
991 def p_lifetime_1(p):
992 '''lifetime : K_automatic '''
993 if(parse_debug): print('lifetime_1', list(p))
994 # { p[0] = LexicalScope::AUTOMATIC; }
995 ()
996 def p_lifetime_2(p):
997 '''lifetime : K_static '''
998 if(parse_debug): print('lifetime_2', list(p))
999 # { p[0] = LexicalScope::STATIC; }
1000 ()
1001 def p_lifetime_opt_1(p):
1002 '''lifetime_opt : lifetime '''
1003 if(parse_debug): print('lifetime_opt_1', list(p))
1004 p[0] = p[1]
1005 ()
1006 def p_lifetime_opt_2(p):
1007 '''lifetime_opt : '''
1008 if(parse_debug>2): print('lifetime_opt_2', list(p))
1009 # { p[0] = LexicalScope::INHERITED; }
1010 ()
1011 def p_loop_statement_1(p):
1012 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' for_step ')' statement_or_null '''
1013 if(parse_debug): print('loop_statement_1', list(p))
1014 # { PForStatement*tmp = new PForStatement(p[3], p[5], p[7], p[9], p[11]);
1015 # FILE_NAME(tmp, @1);
1016 # p[0] = tmp;
1017 # }
1018 ()
1019 def p_loop_statement_2(p):
1020 '''loop_statement : K_for '(' data_type IDENTIFIER '=' expression ';' expression ';' for_step ')' _embed0_loop_statement statement_or_null '''
1021 if(parse_debug): print('loop_statement_2', list(p))
1022 # { pform_name_t tmp_hident;
1023 # tmp_hident.push_back(name_component_t(lex_strings.make(p[4])));
1024 #
1025 # PEIdent*tmp_ident = pform_new_ident(tmp_hident);
1026 # FILE_NAME(tmp_ident, @4);
1027 #
1028 # PForStatement*tmp_for = new PForStatement(tmp_ident, p[6], p[8], p[10], p[13]);
1029 # FILE_NAME(tmp_for, @1);
1030 #
1031 # pform_pop_scope();
1032 # vector<Statement*>tmp_for_list (1);
1033 # tmp_for_list[0] = tmp_for;
1034 # PBlock*tmp_blk = current_block_stack.top();
1035 # current_block_stack.pop();
1036 # tmp_blk->set_statement(tmp_for_list);
1037 # p[0] = tmp_blk;
1038 # delete[]p[4];
1039 # }
1040 ()
1041 def p_loop_statement_3(p):
1042 '''loop_statement : K_forever statement_or_null '''
1043 if(parse_debug): print('loop_statement_3', list(p))
1044 # { PForever*tmp = new PForever(p[2]);
1045 # FILE_NAME(tmp, @1);
1046 # p[0] = tmp;
1047 # }
1048 ()
1049 def p_loop_statement_4(p):
1050 '''loop_statement : K_repeat '(' expression ')' statement_or_null '''
1051 if(parse_debug): print('loop_statement_4', list(p))
1052 # { PRepeat*tmp = new PRepeat(p[3], p[5]);
1053 # FILE_NAME(tmp, @1);
1054 # p[0] = tmp;
1055 # }
1056 ()
1057 def p_loop_statement_5(p):
1058 '''loop_statement : K_while '(' expression ')' statement_or_null '''
1059 if(parse_debug): print('loop_statement_5', list(p))
1060 # { PWhile*tmp = new PWhile(p[3], p[5]);
1061 # FILE_NAME(tmp, @1);
1062 # p[0] = tmp;
1063 # }
1064 ()
1065 def p_loop_statement_6(p):
1066 '''loop_statement : K_do statement_or_null K_while '(' expression ')' ';' '''
1067 if(parse_debug): print('loop_statement_6', list(p))
1068 # { PDoWhile*tmp = new PDoWhile(p[5], p[2]);
1069 # FILE_NAME(tmp, @1);
1070 # p[0] = tmp;
1071 # }
1072 ()
1073 def p_loop_statement_7(p):
1074 '''loop_statement : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' _embed1_loop_statement statement_or_null '''
1075 if(parse_debug): print('loop_statement_7', list(p))
1076 # { PForeach*tmp_for = pform_make_foreach(@1, p[3], p[5], p[9]);
1077 #
1078 # pform_pop_scope();
1079 # vector<Statement*>tmp_for_list(1);
1080 # tmp_for_list[0] = tmp_for;
1081 # PBlock*tmp_blk = current_block_stack.top();
1082 # current_block_stack.pop();
1083 # tmp_blk->set_statement(tmp_for_list);
1084 # p[0] = tmp_blk;
1085 # }
1086 ()
1087 def p_loop_statement_8(p):
1088 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' error ')' statement_or_null '''
1089 if(parse_debug): print('loop_statement_8', list(p))
1090 # { p[0] = None
1091 # yyerror(@1, "error: Error in for loop step assignment.");
1092 # }
1093 ()
1094 def p_loop_statement_9(p):
1095 '''loop_statement : K_for '(' lpvalue '=' expression ';' error ';' for_step ')' statement_or_null '''
1096 if(parse_debug): print('loop_statement_9', list(p))
1097 # { p[0] = None
1098 # yyerror(@1, "error: Error in for loop condition expression.");
1099 # }
1100 ()
1101 def p_loop_statement_10(p):
1102 '''loop_statement : K_for '(' error ')' statement_or_null '''
1103 if(parse_debug): print('loop_statement_10', list(p))
1104 # { p[0] = None
1105 # yyerror(@1, "error: Incomprehensible for loop.");
1106 # }
1107 ()
1108 def p_loop_statement_11(p):
1109 '''loop_statement : K_while '(' error ')' statement_or_null '''
1110 if(parse_debug): print('loop_statement_11', list(p))
1111 # { p[0] = None
1112 # yyerror(@1, "error: Error in while loop condition.");
1113 # }
1114 ()
1115 def p_loop_statement_12(p):
1116 '''loop_statement : K_do statement_or_null K_while '(' error ')' ';' '''
1117 if(parse_debug): print('loop_statement_12', list(p))
1118 # { p[0] = None
1119 # yyerror(@1, "error: Error in do/while loop condition.");
1120 # }
1121 ()
1122 def p_loop_statement_13(p):
1123 '''loop_statement : K_foreach '(' IDENTIFIER '[' error ']' ')' statement_or_null '''
1124 if(parse_debug): print('loop_statement_13', list(p))
1125 # { p[0] = None
1126 # yyerror(@4, "error: Errors in foreach loop variables list.");
1127 # }
1128 ()
1129 def p__embed0_loop_statement(p):
1130 '''_embed0_loop_statement : '''
1131 # { static unsigned for_counter = 0;
1132 # char for_block_name [64];
1133 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_for_loop%u", for_counter);
1134 # for_counter += 1;
1135 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1136 # FILE_NAME(tmp, @1);
1137 # current_block_stack.push(tmp);
1138 #
1139 # list<decl_assignment_t*>assign_list;
1140 # decl_assignment_t*tmp_assign = new decl_assignment_t;
1141 # tmp_assign->name = lex_strings.make(p[4]);
1142 # assign_list.push_back(tmp_assign);
1143 # pform_makewire(@4, 0, str_strength, &assign_list, NetNet::REG, p[3]);
1144 # }
1145 ()
1146 def p__embed1_loop_statement(p):
1147 '''_embed1_loop_statement : '''
1148 # { static unsigned foreach_counter = 0;
1149 # char for_block_name[64];
1150 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_foreach%u", foreach_counter);
1151 # foreach_counter += 1;
1152 #
1153 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1154 # FILE_NAME(tmp, @1);
1155 # current_block_stack.push(tmp);
1156 #
1157 # pform_make_foreach_declarations(@1, p[5]);
1158 # }
1159 ()
1160 def p_list_of_variable_decl_assignments_1(p):
1161 '''list_of_variable_decl_assignments : variable_decl_assignment '''
1162 if(parse_debug): print('list_of_variable_decl_assignments_1', list(p))
1163 # { list<decl_assignment_t*>*tmp = new list<decl_assignment_t*>;
1164 # tmp->push_back(p[1]);
1165 # p[0] = tmp;
1166 # }
1167 ()
1168 def p_list_of_variable_decl_assignments_2(p):
1169 '''list_of_variable_decl_assignments : list_of_variable_decl_assignments ',' variable_decl_assignment '''
1170 if(parse_debug): print('list_of_variable_decl_assignments_2', list(p))
1171 # { list<decl_assignment_t*>*tmp = p[1];
1172 # tmp->push_back(p[3]);
1173 # p[0] = tmp;
1174 # }
1175 ()
1176 def p_variable_decl_assignment_1(p):
1177 '''variable_decl_assignment : IDENTIFIER dimensions_opt '''
1178 if(parse_debug): print('variable_decl_assignment_1', list(p))
1179 # { decl_assignment_t*tmp = new decl_assignment_t;
1180 # tmp->name = lex_strings.make(p[1]);
1181 # if (p[2]) {
1182 # tmp->index = *p[2];
1183 # delete p[2];
1184 # }
1185 # delete[]p[1];
1186 # p[0] = tmp;
1187 # }
1188 ()
1189 def p_variable_decl_assignment_2(p):
1190 '''variable_decl_assignment : IDENTIFIER '=' expression '''
1191 if(parse_debug): print('variable_decl_assignment_2', list(p))
1192 # { decl_assignment_t*tmp = new decl_assignment_t;
1193 # tmp->name = lex_strings.make(p[1]);
1194 # tmp->expr .reset(p[3]);
1195 # delete[]p[1];
1196 # p[0] = tmp;
1197 # }
1198 ()
1199 def p_variable_decl_assignment_3(p):
1200 '''variable_decl_assignment : IDENTIFIER '=' K_new '(' ')' '''
1201 if(parse_debug): print('variable_decl_assignment_3', list(p))
1202 # { decl_assignment_t*tmp = new decl_assignment_t;
1203 # tmp->name = lex_strings.make(p[1]);
1204 # PENewClass*expr = new PENewClass;
1205 # FILE_NAME(expr, @3);
1206 # tmp->expr .reset(expr);
1207 # delete[]p[1];
1208 # p[0] = tmp;
1209 # }
1210 ()
1211 def p_loop_variables_1(p):
1212 '''loop_variables : loop_variables ',' IDENTIFIER '''
1213 if(parse_debug): print('loop_variables_1', list(p))
1214 # { list<perm_string>*tmp = p[1];
1215 # tmp->push_back(lex_strings.make(p[3]));
1216 # delete[]p[3];
1217 # p[0] = tmp;
1218 # }
1219 ()
1220 def p_loop_variables_2(p):
1221 '''loop_variables : IDENTIFIER '''
1222 if(parse_debug): print('loop_variables_2', list(p))
1223 # { list<perm_string>*tmp = new list<perm_string>;
1224 # tmp->push_back(lex_strings.make(p[1]));
1225 # delete[]p[1];
1226 # p[0] = tmp;
1227 # }
1228 ()
1229 def p_method_qualifier_1(p):
1230 '''method_qualifier : K_virtual '''
1231 if(parse_debug): print('method_qualifier_1', list(p))
1232 ()
1233 def p_method_qualifier_2(p):
1234 '''method_qualifier : class_item_qualifier '''
1235 if(parse_debug): print('method_qualifier_2', list(p))
1236 ()
1237 def p_method_qualifier_opt_1(p):
1238 '''method_qualifier_opt : method_qualifier '''
1239 if(parse_debug): print('method_qualifier_opt_1', list(p))
1240 ()
1241 def p_method_qualifier_opt_2(p):
1242 '''method_qualifier_opt : '''
1243 if(parse_debug): print('method_qualifier_opt_2', list(p))
1244 ()
1245 def p_modport_declaration_1(p):
1246 '''modport_declaration : K_modport _embed0_modport_declaration modport_item_list ';' '''
1247 if(parse_debug): print('modport_declaration_1', list(p))
1248 ()
1249 def p__embed0_modport_declaration(p):
1250 '''_embed0_modport_declaration : '''
1251 # { if (!pform_in_interface())
1252 # yyerror(@1, "error: modport declarations are only allowed "
1253 # "in interfaces.");
1254 # }
1255 ()
1256 def p_modport_item_list_1(p):
1257 '''modport_item_list : modport_item '''
1258 if(parse_debug): print('modport_item_list_1', list(p))
1259 ()
1260 def p_modport_item_list_2(p):
1261 '''modport_item_list : modport_item_list ',' modport_item '''
1262 if(parse_debug): print('modport_item_list_2', list(p))
1263 ()
1264 def p_modport_item_1(p):
1265 '''modport_item : IDENTIFIER _embed0_modport_item '(' modport_ports_list ')' '''
1266 if(parse_debug): print('modport_item_1', list(p))
1267 # { pform_end_modport_item(@1); }
1268 ()
1269 def p__embed0_modport_item(p):
1270 '''_embed0_modport_item : '''
1271 # { pform_start_modport_item(@1, p[1]); }
1272 ()
1273 def p_modport_ports_list_1(p):
1274 '''modport_ports_list : modport_ports_declaration '''
1275 if(parse_debug): print('modport_ports_list_1', list(p))
1276 ()
1277 def p_modport_ports_list_2(p):
1278 '''modport_ports_list : modport_ports_list ',' modport_ports_declaration '''
1279 if(parse_debug): print('modport_ports_list_2', list(p))
1280 ()
1281 def p_modport_ports_list_3(p):
1282 '''modport_ports_list : modport_ports_list ',' modport_simple_port '''
1283 if(parse_debug): print('modport_ports_list_3', list(p))
1284 # { if (last_modport_port.type == MP_SIMPLE) {
1285 # pform_add_modport_port(@3, last_modport_port.direction,
1286 # p[3]->name, p[3]->parm);
1287 # } else {
1288 # yyerror(@3, "error: modport expression not allowed here.");
1289 # }
1290 # delete p[3];
1291 # }
1292 ()
1293 def p_modport_ports_list_4(p):
1294 '''modport_ports_list : modport_ports_list ',' modport_tf_port '''
1295 if(parse_debug): print('modport_ports_list_4', list(p))
1296 # { if (last_modport_port.type != MP_TF)
1297 # yyerror(@3, "error: task/function declaration not allowed here.");
1298 # }
1299 ()
1300 def p_modport_ports_list_5(p):
1301 '''modport_ports_list : modport_ports_list ',' IDENTIFIER '''
1302 if(parse_debug): print('modport_ports_list_5', list(p))
1303 # { if (last_modport_port.type == MP_SIMPLE) {
1304 # pform_add_modport_port(@3, last_modport_port.direction,
1305 # lex_strings.make(p[3]), 0);
1306 # } else if (last_modport_port.type != MP_TF) {
1307 # yyerror(@3, "error: list of identifiers not allowed here.");
1308 # }
1309 # delete[] p[3];
1310 # }
1311 ()
1312 def p_modport_ports_list_6(p):
1313 '''modport_ports_list : modport_ports_list ',' '''
1314 if(parse_debug): print('modport_ports_list_6', list(p))
1315 # { yyerror(@2, "error: NULL port declarations are not allowed"); }
1316 ()
1317 def p_modport_ports_declaration_1(p):
1318 '''modport_ports_declaration : attribute_list_opt port_direction IDENTIFIER '''
1319 if(parse_debug): print('modport_ports_declaration_1', list(p))
1320 # { last_modport_port.type = MP_SIMPLE;
1321 # last_modport_port.direction = p[2];
1322 # pform_add_modport_port(@3, p[2], lex_strings.make(p[3]), 0);
1323 # delete[] p[3];
1324 # delete p[1];
1325 # }
1326 ()
1327 def p_modport_ports_declaration_2(p):
1328 '''modport_ports_declaration : attribute_list_opt port_direction modport_simple_port '''
1329 if(parse_debug): print('modport_ports_declaration_2', list(p))
1330 # { last_modport_port.type = MP_SIMPLE;
1331 # last_modport_port.direction = p[2];
1332 # pform_add_modport_port(@3, p[2], p[3]->name, p[3]->parm);
1333 # delete p[3];
1334 # delete p[1];
1335 # }
1336 ()
1337 def p_modport_ports_declaration_3(p):
1338 '''modport_ports_declaration : attribute_list_opt import_export IDENTIFIER '''
1339 if(parse_debug): print('modport_ports_declaration_3', list(p))
1340 # { last_modport_port.type = MP_TF;
1341 # last_modport_port.is_import = p[2];
1342 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
1343 # delete[] p[3];
1344 # delete p[1];
1345 # }
1346 ()
1347 def p_modport_ports_declaration_4(p):
1348 '''modport_ports_declaration : attribute_list_opt import_export modport_tf_port '''
1349 if(parse_debug): print('modport_ports_declaration_4', list(p))
1350 # { last_modport_port.type = MP_TF;
1351 # last_modport_port.is_import = p[2];
1352 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
1353 # delete p[1];
1354 # }
1355 ()
1356 def p_modport_ports_declaration_5(p):
1357 '''modport_ports_declaration : attribute_list_opt K_clocking IDENTIFIER '''
1358 if(parse_debug): print('modport_ports_declaration_5', list(p))
1359 # { last_modport_port.type = MP_CLOCKING;
1360 # last_modport_port.direction = NetNet::NOT_A_PORT;
1361 # yyerror(@3, "sorry: modport clocking declaration is not yet supported.");
1362 # delete[] p[3];
1363 # delete p[1];
1364 # }
1365 ()
1366 def p_modport_simple_port_1(p):
1367 '''modport_simple_port : '.' IDENTIFIER '(' expression ')' '''
1368 if(parse_debug): print('modport_simple_port_1', list(p))
1369 # { named_pexpr_t*tmp = new named_pexpr_t;
1370 # tmp->name = lex_strings.make(p[2]);
1371 # tmp->parm = p[4];
1372 # delete[]p[2];
1373 # p[0] = tmp;
1374 # }
1375 ()
1376 def p_modport_tf_port_1(p):
1377 '''modport_tf_port : K_task IDENTIFIER '''
1378 if(parse_debug): print('modport_tf_port_1', list(p))
1379 ()
1380 def p_modport_tf_port_2(p):
1381 '''modport_tf_port : K_task IDENTIFIER '(' tf_port_list_opt ')' '''
1382 if(parse_debug): print('modport_tf_port_2', list(p))
1383 ()
1384 def p_modport_tf_port_3(p):
1385 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '''
1386 if(parse_debug): print('modport_tf_port_3', list(p))
1387 ()
1388 def p_modport_tf_port_4(p):
1389 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' '''
1390 if(parse_debug): print('modport_tf_port_4', list(p))
1391 ()
1392 def p_non_integer_type_1(p):
1393 '''non_integer_type : K_real '''
1394 if(parse_debug): print('non_integer_type_1', list(p))
1395 # { p[0] = real_type_t::REAL; }
1396 ()
1397 def p_non_integer_type_2(p):
1398 '''non_integer_type : K_realtime '''
1399 if(parse_debug): print('non_integer_type_2', list(p))
1400 # { p[0] = real_type_t::REAL; }
1401 ()
1402 def p_non_integer_type_3(p):
1403 '''non_integer_type : K_shortreal '''
1404 if(parse_debug): print('non_integer_type_3', list(p))
1405 # { p[0] = real_type_t::SHORTREAL; }
1406 ()
1407 def p_number_1(p):
1408 '''number : BASED_NUMBER '''
1409 if(parse_debug): print('number_1', list(p))
1410 # { p[0] = p[1]; based_size = 0;}
1411 ()
1412 def p_number_2(p):
1413 '''number : DEC_NUMBER '''
1414 if(parse_debug): print('number_2', list(p))
1415 num = Leaf(token.NUMBER, "%s" % (p[1]))
1416 p[0] = num
1417 # { p[0] = p[1]; based_size = 0;}
1418 ()
1419 def p_number_3(p):
1420 '''number : DEC_NUMBER BASED_NUMBER '''
1421 if(parse_debug): print('number_3', list(p))
1422 num = Leaf(token.NUMBER, "%s:%s" % (p[1], p[2]))
1423 p[0] = num
1424 # { p[0] = pform_verinum_with_size(p[1],p[2], @2.text, @2.first_line);
1425 # based_size = 0; }
1426 ()
1427 def p_number_4(p):
1428 '''number : UNBASED_NUMBER '''
1429 if(parse_debug): print('number_4', list(p))
1430 # { p[0] = p[1]; based_size = 0;}
1431 ()
1432 def p_number_5(p):
1433 '''number : DEC_NUMBER UNBASED_NUMBER '''
1434 if(parse_debug): print('number_5', list(p))
1435 # { yyerror(@1, "error: Unbased SystemVerilog literal cannot have "
1436 # "a size.");
1437 # p[0] = p[1]; based_size = 0;}
1438 ()
1439 def p_open_range_list_1(p):
1440 '''open_range_list : open_range_list ',' value_range '''
1441 if(parse_debug): print('open_range_list_1', list(p))
1442 ()
1443 def p_open_range_list_2(p):
1444 '''open_range_list : value_range '''
1445 if(parse_debug): print('open_range_list_2', list(p))
1446 ()
1447 def p_package_declaration_1(p):
1448 '''package_declaration : K_package lifetime_opt IDENTIFIER ';' _embed0_package_declaration timeunits_declaration_opt _embed1_package_declaration package_item_list_opt K_endpackage endlabel_opt '''
1449 if(parse_debug): print('package_declaration_1', list(p))
1450 # { pform_end_package_declaration(@1);
1451 # // If an end label is present make sure it match the package name.
1452 # if (p[10]) {
1453 # if (strcmp(p[3],p[10]) != 0) {
1454 # yyerror(@10, "error: End label doesn't match package name");
1455 # }
1456 # delete[]p[10];
1457 # }
1458 # delete[]p[3];
1459 # }
1460 ()
1461 def p__embed0_package_declaration(p):
1462 '''_embed0_package_declaration : '''
1463 # { pform_start_package_declaration(@1, p[3], p[2]); }
1464 ()
1465 def p__embed1_package_declaration(p):
1466 '''_embed1_package_declaration : '''
1467 # { pform_set_scope_timescale(@1); }
1468 ()
1469 def p_module_package_import_list_opt_1(p):
1470 '''module_package_import_list_opt : '''
1471 if(parse_debug>1): print('module_package_import_list_opt_1', list(p))
1472 ()
1473 def p_module_package_import_list_opt_2(p):
1474 '''module_package_import_list_opt : package_import_list '''
1475 if(parse_debug): print('module_package_import_list_opt_2', list(p))
1476 ()
1477 def p_package_import_list_1(p):
1478 '''package_import_list : package_import_declaration '''
1479 if(parse_debug): print('package_import_list_1', list(p))
1480 ()
1481 def p_package_import_list_2(p):
1482 '''package_import_list : package_import_list package_import_declaration '''
1483 if(parse_debug): print('package_import_list_2', list(p))
1484 ()
1485 def p_package_import_declaration_1(p):
1486 '''package_import_declaration : K_import package_import_item_list ';' '''
1487 if(parse_debug): print('package_import_declaration_1', list(p))
1488 # { }
1489 ()
1490 def p_package_import_item_1(p):
1491 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '''
1492 if(parse_debug): print('package_import_item_1', list(p))
1493 # { pform_package_import(@2, p[1], p[3]);
1494 # delete[]p[3];
1495 # }
1496 ()
1497 def p_package_import_item_2(p):
1498 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES '*' '''
1499 if(parse_debug): print('package_import_item_2', list(p))
1500 # { pform_package_import(@2, p[1], 0);
1501 # }
1502 ()
1503 def p_package_import_item_list_1(p):
1504 '''package_import_item_list : package_import_item_list ',' package_import_item '''
1505 if(parse_debug): print('package_import_item_list_1', list(p))
1506 ()
1507 def p_package_import_item_list_2(p):
1508 '''package_import_item_list : package_import_item '''
1509 if(parse_debug): print('package_import_item_list_2', list(p))
1510 ()
1511 def p_package_item_1(p):
1512 '''package_item : timeunits_declaration '''
1513 if(parse_debug): print('package_item_1', list(p))
1514 ()
1515 def p_package_item_2(p):
1516 '''package_item : K_parameter param_type parameter_assign_list ';' '''
1517 if(parse_debug): print('package_item_2', list(p))
1518 ()
1519 def p_package_item_3(p):
1520 '''package_item : K_localparam param_type localparam_assign_list ';' '''
1521 if(parse_debug): print('package_item_3', list(p))
1522 ()
1523 def p_package_item_4(p):
1524 '''package_item : type_declaration '''
1525 if(parse_debug): print('package_item_4', list(p))
1526 ()
1527 def p_package_item_5(p):
1528 '''package_item : function_declaration '''
1529 if(parse_debug): print('package_item_5', list(p))
1530 ()
1531 def p_package_item_6(p):
1532 '''package_item : task_declaration '''
1533 if(parse_debug): print('package_item_6', list(p))
1534 ()
1535 def p_package_item_7(p):
1536 '''package_item : data_declaration '''
1537 if(parse_debug): print('package_item_7', list(p))
1538 ()
1539 def p_package_item_8(p):
1540 '''package_item : class_declaration '''
1541 if(parse_debug): print('package_item_8', list(p))
1542 ()
1543 def p_package_item_list_1(p):
1544 '''package_item_list : package_item_list package_item '''
1545 if(parse_debug): print('package_item_list_1', list(p))
1546 ()
1547 def p_package_item_list_2(p):
1548 '''package_item_list : package_item '''
1549 if(parse_debug): print('package_item_list_2', list(p))
1550 ()
1551 def p_package_item_list_opt_1(p):
1552 '''package_item_list_opt : package_item_list '''
1553 if(parse_debug): print('package_item_list_opt_1', list(p))
1554 ()
1555 def p_package_item_list_opt_2(p):
1556 '''package_item_list_opt : '''
1557 if(parse_debug): print('package_item_list_opt_2', list(p))
1558 ()
1559 def p_port_direction_1(p):
1560 '''port_direction : K_input '''
1561 if(parse_debug): print('port_direction_1', list(p))
1562 # { p[0] = NetNet::PINPUT; }
1563 ()
1564 def p_port_direction_2(p):
1565 '''port_direction : K_output '''
1566 if(parse_debug): print('port_direction_2', list(p))
1567 # { p[0] = NetNet::POUTPUT; }
1568 ()
1569 def p_port_direction_3(p):
1570 '''port_direction : K_inout '''
1571 if(parse_debug): print('port_direction_3', list(p))
1572 # { p[0] = NetNet::PINOUT; }
1573 ()
1574 def p_port_direction_4(p):
1575 '''port_direction : K_ref '''
1576 if(parse_debug): print('port_direction_4', list(p))
1577 # { p[0] = NetNet::PREF;
1578 # if (!gn_system_verilog()) {
1579 # yyerror(@1, "error: Reference ports (ref) require SystemVerilog.");
1580 # p[0] = NetNet::PINPUT;
1581 # }
1582 # }
1583 ()
1584 def p_port_direction_opt_1(p):
1585 '''port_direction_opt : port_direction '''
1586 if(parse_debug): print('port_direction_opt_1', list(p))
1587 p[0] = p[1]
1588 ()
1589 def p_port_direction_opt_2(p):
1590 '''port_direction_opt : '''
1591 if(parse_debug): print('port_direction_opt_2', list(p))
1592 # { p[0] = NetNet::PIMPLICIT; }
1593 ()
1594 def p_property_expr_1(p):
1595 '''property_expr : expression '''
1596 if(parse_debug): print('property_expr_1', list(p))
1597 ()
1598 def p_procedural_assertion_statement_1(p):
1599 '''procedural_assertion_statement : K_assert '(' expression ')' statement %prec less_than_K_else '''
1600 if(parse_debug): print('procedural_assertion_statement_1', list(p))
1601 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1602 # p[0] = None
1603 # }
1604 ()
1605 def p_procedural_assertion_statement_2(p):
1606 '''procedural_assertion_statement : K_assert '(' expression ')' K_else statement '''
1607 if(parse_debug): print('procedural_assertion_statement_2', list(p))
1608 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1609 # p[0] = None
1610 # }
1611 ()
1612 def p_procedural_assertion_statement_3(p):
1613 '''procedural_assertion_statement : K_assert '(' expression ')' statement K_else statement '''
1614 if(parse_debug): print('procedural_assertion_statement_3', list(p))
1615 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1616 # p[0] = None
1617 # }
1618 ()
1619 def p_property_qualifier_1(p):
1620 '''property_qualifier : class_item_qualifier '''
1621 if(parse_debug): print('property_qualifier_1', list(p))
1622 ()
1623 def p_property_qualifier_2(p):
1624 '''property_qualifier : random_qualifier '''
1625 if(parse_debug): print('property_qualifier_2', list(p))
1626 ()
1627 def p_property_qualifier_opt_1(p):
1628 '''property_qualifier_opt : property_qualifier_list '''
1629 if(parse_debug): print('property_qualifier_opt_1', list(p))
1630 p[0] = p[1]
1631 ()
1632 def p_property_qualifier_opt_2(p):
1633 '''property_qualifier_opt : '''
1634 if(parse_debug): print('property_qualifier_opt_2', list(p))
1635 # { p[0] = property_qualifier_t::make_none(); }
1636 ()
1637 def p_property_qualifier_list_1(p):
1638 '''property_qualifier_list : property_qualifier_list property_qualifier '''
1639 if(parse_debug): print('property_qualifier_list_1', list(p))
1640 # { p[0] = p[1] | p[2]; }
1641 ()
1642 def p_property_qualifier_list_2(p):
1643 '''property_qualifier_list : property_qualifier '''
1644 if(parse_debug): print('property_qualifier_list_2', list(p))
1645 p[0] = p[1]
1646 ()
1647 def p_property_spec_1(p):
1648 '''property_spec : clocking_event_opt property_spec_disable_iff_opt property_expr '''
1649 if(parse_debug): print('property_spec_1', list(p))
1650 ()
1651 def p_property_spec_disable_iff_opt_1(p):
1652 '''property_spec_disable_iff_opt : K_disable K_iff '(' expression ')' '''
1653 if(parse_debug): print('property_spec_disable_iff_opt_1', list(p))
1654 ()
1655 def p_property_spec_disable_iff_opt_2(p):
1656 '''property_spec_disable_iff_opt : '''
1657 if(parse_debug): print('property_spec_disable_iff_opt_2', list(p))
1658 ()
1659 def p_random_qualifier_1(p):
1660 '''random_qualifier : K_rand '''
1661 if(parse_debug): print('random_qualifier_1', list(p))
1662 # { p[0] = property_qualifier_t::make_rand(); }
1663 ()
1664 def p_random_qualifier_2(p):
1665 '''random_qualifier : K_randc '''
1666 if(parse_debug): print('random_qualifier_2', list(p))
1667 # { p[0] = property_qualifier_t::make_randc(); }
1668 ()
1669 def p_real_or_realtime_1(p):
1670 '''real_or_realtime : K_real '''
1671 if(parse_debug): print('real_or_realtime_1', list(p))
1672 ()
1673 def p_real_or_realtime_2(p):
1674 '''real_or_realtime : K_realtime '''
1675 if(parse_debug): print('real_or_realtime_2', list(p))
1676 ()
1677 def p_signing_1(p):
1678 '''signing : K_signed '''
1679 if(parse_debug): print('signing_1', list(p))
1680 p[0] = True
1681 ()
1682 def p_signing_2(p):
1683 '''signing : K_unsigned '''
1684 if(parse_debug): print('signing_2', list(p))
1685 p[0] = False
1686 ()
1687 def p_simple_type_or_string_1(p):
1688 '''simple_type_or_string : integer_vector_type '''
1689 if(parse_debug): print('simple_type_or_string_1', list(p))
1690 # { ivl_variable_type_t use_vtype = p[1];
1691 # bool reg_flag = false;
1692 # if (use_vtype == IVL_VT_NO_TYPE) {
1693 # use_vtype = IVL_VT_LOGIC;
1694 # reg_flag = true;
1695 # }
1696 # vector_type_t*tmp = new vector_type_t(use_vtype, false, 0);
1697 # tmp->reg_flag = reg_flag;
1698 # FILE_NAME(tmp, @1);
1699 # p[0] = tmp;
1700 # }
1701 ()
1702 def p_simple_type_or_string_2(p):
1703 '''simple_type_or_string : non_integer_type '''
1704 if(parse_debug): print('simple_type_or_string_2', list(p))
1705 # { real_type_t*tmp = new real_type_t(p[1]);
1706 # FILE_NAME(tmp, @1);
1707 # p[0] = tmp;
1708 # }
1709 ()
1710 def p_simple_type_or_string_3(p):
1711 '''simple_type_or_string : atom2_type '''
1712 if(parse_debug): print('simple_type_or_string_3', list(p))
1713 # { atom2_type_t*tmp = new atom2_type_t(p[1], true);
1714 # FILE_NAME(tmp, @1);
1715 # p[0] = tmp;
1716 # }
1717 ()
1718 def p_simple_type_or_string_4(p):
1719 '''simple_type_or_string : K_integer '''
1720 if(parse_debug): print('simple_type_or_string_4', list(p))
1721 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
1722 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd);
1723 # tmp->reg_flag = true;
1724 # tmp->integer_flag = true;
1725 # p[0] = tmp;
1726 # }
1727 ()
1728 def p_simple_type_or_string_5(p):
1729 '''simple_type_or_string : K_time '''
1730 if(parse_debug): print('simple_type_or_string_5', list(p))
1731 # { list<pform_range_t>*pd = make_range_from_width(64);
1732 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
1733 # tmp->reg_flag = !gn_system_verilog();
1734 # p[0] = tmp;
1735 # }
1736 ()
1737 def p_simple_type_or_string_6(p):
1738 '''simple_type_or_string : TYPE_IDENTIFIER '''
1739 if(parse_debug): print('simple_type_or_string_6', list(p))
1740 # { p[0] = p[1].type;
1741 # delete[]p[1].text;
1742 # }
1743 ()
1744 def p_simple_type_or_string_7(p):
1745 '''simple_type_or_string : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_simple_type_or_string TYPE_IDENTIFIER '''
1746 if(parse_debug): print('simple_type_or_string_7', list(p))
1747 # { lex_in_package_scope(0);
1748 # p[0] = p[4].type;
1749 # delete[]p[4].text;
1750 # }
1751 ()
1752 def p_simple_type_or_string_8(p):
1753 '''simple_type_or_string : K_string '''
1754 if(parse_debug): print('simple_type_or_string_8', list(p))
1755 # { string_type_t*tmp = new string_type_t;
1756 # FILE_NAME(tmp, @1);
1757 # p[0] = tmp;
1758 # }
1759 ()
1760 def p__embed0_simple_type_or_string(p):
1761 '''_embed0_simple_type_or_string : '''
1762 # { lex_in_package_scope(p[1]); }
1763 ()
1764 def p_statement_1(p):
1765 '''statement : attribute_list_opt statement_item '''
1766 if(parse_debug): print('statement_1', list(p))
1767 # { pform_bind_attributes(p[2]->attributes, p[1]);
1768 # p[0] = p[2];
1769 # }
1770 ()
1771 def p_statement_or_null_1(p):
1772 '''statement_or_null : statement '''
1773 if(parse_debug): print('statement_or_null_1', list(p))
1774 p[0] = p[1]
1775 ()
1776 def p_statement_or_null_2(p):
1777 '''statement_or_null : attribute_list_opt ';' '''
1778 if(parse_debug): print('statement_or_null_2', list(p))
1779 # { p[0] = None }
1780 ()
1781 def p_stream_expression_1(p):
1782 '''stream_expression : expression '''
1783 if(parse_debug): print('stream_expression_1', list(p))
1784 ()
1785 def p_stream_expression_list_1(p):
1786 '''stream_expression_list : stream_expression_list ',' stream_expression '''
1787 if(parse_debug): print('stream_expression_list_1', list(p))
1788 ()
1789 def p_stream_expression_list_2(p):
1790 '''stream_expression_list : stream_expression '''
1791 if(parse_debug): print('stream_expression_list_2', list(p))
1792 ()
1793 def p_stream_operator_1(p):
1794 '''stream_operator : K_LS '''
1795 if(parse_debug): print('stream_operator_1', list(p))
1796 ()
1797 def p_stream_operator_2(p):
1798 '''stream_operator : K_RS '''
1799 if(parse_debug): print('stream_operator_2', list(p))
1800 ()
1801 def p_streaming_concatenation_1(p):
1802 '''streaming_concatenation : '{' stream_operator '{' stream_expression_list '}' '}' '''
1803 if(parse_debug): print('streaming_concatenation_1', list(p))
1804 # { /* streaming concatenation is a SystemVerilog thing. */
1805 # if (gn_system_verilog()) {
1806 # yyerror(@2, "sorry: Streaming concatenation not supported.");
1807 # p[0] = None
1808 # } else {
1809 # yyerror(@2, "error: Streaming concatenation requires SystemVerilog");
1810 # p[0] = None
1811 # }
1812 # }
1813 ()
1814 def p_task_declaration_1(p):
1815 '''task_declaration : K_task lifetime_opt IDENTIFIER ';' _embed0_task_declaration task_item_list_opt statement_or_null_list_opt K_endtask _embed1_task_declaration endlabel_opt '''
1816 if(parse_debug): print('task_declaration_1', list(p))
1817 # { // Last step: check any closing name. This is done late so
1818 # // that the parser can look ahead to detect the present
1819 # // endlabel_opt but still have the pform_endmodule() called
1820 # // early enough that the lexor can know we are outside the
1821 # // module.
1822 # if (p[10]) {
1823 # if (strcmp(p[3],p[10]) != 0) {
1824 # yyerror(@10, "error: End label doesn't match task name");
1825 # }
1826 # if (! gn_system_verilog()) {
1827 # yyerror(@10, "error: Task end labels require "
1828 # "SystemVerilog.");
1829 # }
1830 # delete[]p[10];
1831 # }
1832 # delete[]p[3];
1833 # }
1834 ()
1835 def p_task_declaration_2(p):
1836 '''task_declaration : K_task lifetime_opt IDENTIFIER '(' _embed2_task_declaration tf_port_list ')' ';' block_item_decls_opt statement_or_null_list_opt K_endtask _embed3_task_declaration endlabel_opt '''
1837 if(parse_debug): print('task_declaration_2', list(p))
1838 # { // Last step: check any closing name. This is done late so
1839 # // that the parser can look ahead to detect the present
1840 # // endlabel_opt but still have the pform_endmodule() called
1841 # // early enough that the lexor can know we are outside the
1842 # // module.
1843 # if (p[13]) {
1844 # if (strcmp(p[3],p[13]) != 0) {
1845 # yyerror(@13, "error: End label doesn't match task name");
1846 # }
1847 # if (! gn_system_verilog()) {
1848 # yyerror(@13, "error: Task end labels require "
1849 # "SystemVerilog.");
1850 # }
1851 # delete[]p[13];
1852 # }
1853 # delete[]p[3];
1854 # }
1855 ()
1856 def p_task_declaration_3(p):
1857 '''task_declaration : K_task lifetime_opt IDENTIFIER '(' ')' ';' _embed4_task_declaration block_item_decls_opt statement_or_null_list K_endtask _embed5_task_declaration endlabel_opt '''
1858 if(parse_debug): print('task_declaration_3', list(p))
1859 # { // Last step: check any closing name. This is done late so
1860 # // that the parser can look ahead to detect the present
1861 # // endlabel_opt but still have the pform_endmodule() called
1862 # // early enough that the lexor can know we are outside the
1863 # // module.
1864 # if (p[12]) {
1865 # if (strcmp(p[3],p[12]) != 0) {
1866 # yyerror(@12, "error: End label doesn't match task name");
1867 # }
1868 # if (! gn_system_verilog()) {
1869 # yyerror(@12, "error: Task end labels require "
1870 # "SystemVerilog.");
1871 # }
1872 # delete[]p[12];
1873 # }
1874 # delete[]p[3];
1875 # }
1876 ()
1877 def p_task_declaration_4(p):
1878 '''task_declaration : K_task lifetime_opt IDENTIFIER error K_endtask _embed6_task_declaration endlabel_opt '''
1879 if(parse_debug): print('task_declaration_4', list(p))
1880 # { // Last step: check any closing name. This is done late so
1881 # // that the parser can look ahead to detect the present
1882 # // endlabel_opt but still have the pform_endmodule() called
1883 # // early enough that the lexor can know we are outside the
1884 # // module.
1885 # if (p[7]) {
1886 # if (strcmp(p[3],p[7]) != 0) {
1887 # yyerror(@7, "error: End label doesn't match task name");
1888 # }
1889 # if (! gn_system_verilog()) {
1890 # yyerror(@7, "error: Task end labels require "
1891 # "SystemVerilog.");
1892 # }
1893 # delete[]p[7];
1894 # }
1895 # delete[]p[3];
1896 # }
1897 ()
1898 def p__embed0_task_declaration(p):
1899 '''_embed0_task_declaration : '''
1900 # { assert(current_task == 0);
1901 # current_task = pform_push_task_scope(@1, p[3], p[2]);
1902 # }
1903 ()
1904 def p__embed1_task_declaration(p):
1905 '''_embed1_task_declaration : '''
1906 # { current_task->set_ports(p[6]);
1907 # current_task_set_statement(@3, p[7]);
1908 # pform_set_this_class(@3, current_task);
1909 # pform_pop_scope();
1910 # current_task = 0;
1911 # if (p[7] && p[7]->size() > 1 && !gn_system_verilog()) {
1912 # yyerror(@7, "error: Task body with multiple statements requires SystemVerilog.");
1913 # }
1914 # delete p[7];
1915 # }
1916 ()
1917 def p__embed2_task_declaration(p):
1918 '''_embed2_task_declaration : '''
1919 # { assert(current_task == 0);
1920 # current_task = pform_push_task_scope(@1, p[3], p[2]);
1921 # }
1922 ()
1923 def p__embed3_task_declaration(p):
1924 '''_embed3_task_declaration : '''
1925 # { current_task->set_ports(p[6]);
1926 # current_task_set_statement(@3, p[10]);
1927 # pform_set_this_class(@3, current_task);
1928 # pform_pop_scope();
1929 # current_task = 0;
1930 # if (p[10]) delete p[10];
1931 # }
1932 ()
1933 def p__embed4_task_declaration(p):
1934 '''_embed4_task_declaration : '''
1935 # { assert(current_task == 0);
1936 # current_task = pform_push_task_scope(@1, p[3], p[2]);
1937 # }
1938 ()
1939 def p__embed5_task_declaration(p):
1940 '''_embed5_task_declaration : '''
1941 # { current_task->set_ports(0);
1942 # current_task_set_statement(@3, p[9]);
1943 # pform_set_this_class(@3, current_task);
1944 # if (! current_task->method_of()) {
1945 # cerr << @3 << ": warning: task definition for \"" << p[3]
1946 # << "\" has an empty port declaration list!" << endl;
1947 # }
1948 # pform_pop_scope();
1949 # current_task = 0;
1950 # if (p[9]->size() > 1 && !gn_system_verilog()) {
1951 # yyerror(@9, "error: Task body with multiple statements requires SystemVerilog.");
1952 # }
1953 # delete p[9];
1954 # }
1955 ()
1956 def p__embed6_task_declaration(p):
1957 '''_embed6_task_declaration : '''
1958 # {
1959 # if (current_task) {
1960 # pform_pop_scope();
1961 # current_task = 0;
1962 # }
1963 # }
1964 ()
1965 def p_tf_port_declaration_1(p):
1966 '''tf_port_declaration : port_direction K_reg_opt unsigned_signed_opt dimensions_opt list_of_identifiers ';' '''
1967 if(parse_debug): print('tf_port_declaration_1', list(p))
1968 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1],
1969 # p[2] ? IVL_VT_LOGIC :
1970 # IVL_VT_NO_TYPE,
1971 # p[3], p[4], p[5]);
1972 # p[0] = tmp;
1973 # }
1974 ()
1975 def p_tf_port_declaration_2(p):
1976 '''tf_port_declaration : port_direction K_integer list_of_identifiers ';' '''
1977 if(parse_debug): print('tf_port_declaration_2', list(p))
1978 # { list<pform_range_t>*range_stub = make_range_from_width(integer_width);
1979 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, true,
1980 # range_stub, p[3], true);
1981 # p[0] = tmp;
1982 # }
1983 ()
1984 def p_tf_port_declaration_3(p):
1985 '''tf_port_declaration : port_direction K_time list_of_identifiers ';' '''
1986 if(parse_debug): print('tf_port_declaration_3', list(p))
1987 # { list<pform_range_t>*range_stub = make_range_from_width(64);
1988 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, false,
1989 # range_stub, p[3]);
1990 # p[0] = tmp;
1991 # }
1992 ()
1993 def p_tf_port_declaration_4(p):
1994 '''tf_port_declaration : port_direction real_or_realtime list_of_identifiers ';' '''
1995 if(parse_debug): print('tf_port_declaration_4', list(p))
1996 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_REAL, true,
1997 # 0, p[3]);
1998 # p[0] = tmp;
1999 # }
2000 ()
2001 def p_tf_port_declaration_5(p):
2002 '''tf_port_declaration : port_direction K_string list_of_identifiers ';' '''
2003 if(parse_debug): print('tf_port_declaration_5', list(p))
2004 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_STRING, true,
2005 # 0, p[3]);
2006 # p[0] = tmp;
2007 # }
2008 ()
2009 def p_tf_port_item_1(p):
2010 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER dimensions_opt tf_port_item_expr_opt '''
2011 if(parse_debug): print('tf_port_item_1', list(p))
2012 # { vector<pform_tf_port_t>*tmp;
2013 # NetNet::PortType use_port_type = p[1];
2014 # if ((use_port_type == NetNet::PIMPLICIT) && (gn_system_verilog() || (p[2] == 0)))
2015 # use_port_type = port_declaration_context.port_type;
2016 # perm_string name = lex_strings.make(p[3]);
2017 # list<perm_string>* ilist = list_from_identifier(p[3]);
2018 #
2019 # if (use_port_type == NetNet::PIMPLICIT) {
2020 # yyerror(@1, "error: missing task/function port direction.");
2021 # use_port_type = NetNet::PINPUT; // for error recovery
2022 # }
2023 # if ((p[2] == 0) && (p[1]==NetNet::PIMPLICIT)) {
2024 # // Detect special case this is an undecorated
2025 # // identifier and we need to get the declaration from
2026 # // left context.
2027 # if (p[4] != 0) {
2028 # yyerror(@4, "internal error: How can there be an unpacked range here?\n");
2029 # }
2030 # tmp = pform_make_task_ports(@3, use_port_type,
2031 # port_declaration_context.data_type,
2032 # ilist);
2033 #
2034 # } else {
2035 # // Otherwise, the decorations for this identifier
2036 # // indicate the type. Save the type for any right
2037 # // context that may come later.
2038 # port_declaration_context.port_type = use_port_type;
2039 # if (p[2] == 0) {
2040 # p[2] = new vector_type_t(IVL_VT_LOGIC, false, 0);
2041 # FILE_NAME(p[2], @3);
2042 # }
2043 # port_declaration_context.data_type = p[2];
2044 # tmp = pform_make_task_ports(@3, use_port_type, p[2], ilist);
2045 # }
2046 # if (p[4] != 0) {
2047 # pform_set_reg_idx(name, p[4]);
2048 # }
2049 #
2050 # p[0] = tmp;
2051 # if (p[5]) {
2052 # assert(tmp->size()==1);
2053 # tmp->front().defe = p[5];
2054 # }
2055 # }
2056 ()
2057 def p_tf_port_item_2(p):
2058 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER error '''
2059 if(parse_debug): print('tf_port_item_2', list(p))
2060 # { yyerror(@3, "error: Error in task/function port item after port name %s.", p[3]);
2061 # yyerrok;
2062 # p[0] = None
2063 # }
2064 ()
2065 def p_tf_port_item_expr_opt_1(p):
2066 '''tf_port_item_expr_opt : '=' expression '''
2067 if(parse_debug): print('tf_port_item_expr_opt_1', list(p))
2068 # { if (! gn_system_verilog()) {
2069 # yyerror(@1, "error: Task/function default arguments require "
2070 # "SystemVerilog.");
2071 # }
2072 # p[0] = p[2];
2073 # }
2074 ()
2075 def p_tf_port_item_expr_opt_2(p):
2076 '''tf_port_item_expr_opt : '''
2077 if(parse_debug): print('tf_port_item_expr_opt_2', list(p))
2078 # { p[0] = None }
2079 ()
2080 def p_tf_port_list_1(p):
2081 '''tf_port_list : _embed0_tf_port_list tf_port_item_list '''
2082 if(parse_debug): print('tf_port_list_1', list(p))
2083 p[0] = p[2]
2084 ()
2085 def p__embed0_tf_port_list(p):
2086 '''_embed0_tf_port_list : '''
2087 # { port_declaration_context.port_type = gn_system_verilog() ? NetNet::PINPUT : NetNet::PIMPLICIT;
2088 # port_declaration_context.data_type = 0;
2089 # }
2090 ()
2091 def p_tf_port_item_list_1(p):
2092 '''tf_port_item_list : tf_port_item_list ',' tf_port_item '''
2093 if(parse_debug): print('tf_port_item_list_1', list(p))
2094 # { vector<pform_tf_port_t>*tmp;
2095 # if (p[1] && p[3]) {
2096 # size_t s1 = p[1]->size();
2097 # tmp = p[1];
2098 # tmp->resize(tmp->size()+p[3]->size());
2099 # for (size_t idx = 0 ; idx < p[3]->size() ; idx += 1)
2100 # tmp->at(s1+idx) = p[3]->at(idx);
2101 # delete p[3];
2102 # } else if (p[1]) {
2103 # tmp = p[1];
2104 # } else {
2105 # tmp = p[3];
2106 # }
2107 # p[0] = tmp;
2108 # }
2109 ()
2110 def p_tf_port_item_list_2(p):
2111 '''tf_port_item_list : tf_port_item '''
2112 if(parse_debug): print('tf_port_item_list_2', list(p))
2113 p[0] = p[1]
2114 ()
2115 def p_tf_port_item_list_3(p):
2116 '''tf_port_item_list : error ',' tf_port_item '''
2117 if(parse_debug): print('tf_port_item_list_3', list(p))
2118 # { yyerror(@2, "error: Syntax error in task/function port declaration.");
2119 # p[0] = p[3];
2120 # }
2121 ()
2122 def p_tf_port_item_list_4(p):
2123 '''tf_port_item_list : tf_port_item_list ',' '''
2124 if(parse_debug): print('tf_port_item_list_4', list(p))
2125 # { yyerror(@2, "error: NULL port declarations are not allowed.");
2126 # p[0] = p[1];
2127 # }
2128 ()
2129 def p_tf_port_item_list_5(p):
2130 '''tf_port_item_list : tf_port_item_list ';' '''
2131 if(parse_debug): print('tf_port_item_list_5', list(p))
2132 # { yyerror(@2, "error: ';' is an invalid port declaration separator.");
2133 # p[0] = p[1];
2134 # }
2135 ()
2136 def p_timeunits_declaration_1(p):
2137 '''timeunits_declaration : K_timeunit TIME_LITERAL ';' '''
2138 if(parse_debug): print('timeunits_declaration_1', list(p))
2139 # { pform_set_timeunit(p[2], allow_timeunit_decl); }
2140 ()
2141 def p_timeunits_declaration_2(p):
2142 '''timeunits_declaration : K_timeunit TIME_LITERAL '/' TIME_LITERAL ';' '''
2143 if(parse_debug): print('timeunits_declaration_2', list(p))
2144 # { bool initial_decl = allow_timeunit_decl && allow_timeprec_decl;
2145 # pform_set_timeunit(p[2], initial_decl);
2146 # pform_set_timeprec(p[4], initial_decl);
2147 # }
2148 ()
2149 def p_timeunits_declaration_3(p):
2150 '''timeunits_declaration : K_timeprecision TIME_LITERAL ';' '''
2151 if(parse_debug): print('timeunits_declaration_3', list(p))
2152 # { pform_set_timeprec(p[2], allow_timeprec_decl); }
2153 ()
2154 def p_timeunits_declaration_opt_1(p):
2155 '''timeunits_declaration_opt : %prec no_timeunits_declaration '''
2156 if(parse_debug>2): print('timeunits_declaration_opt_1', list(p))
2157 ()
2158 def p_timeunits_declaration_opt_2(p):
2159 '''timeunits_declaration_opt : timeunits_declaration %prec one_timeunits_declaration '''
2160 if(parse_debug): print('timeunits_declaration_opt_2', list(p))
2161 ()
2162 def p_timeunits_declaration_opt_3(p):
2163 '''timeunits_declaration_opt : timeunits_declaration timeunits_declaration '''
2164 if(parse_debug): print('timeunits_declaration_opt_3', list(p))
2165 ()
2166 def p_value_range_1(p):
2167 '''value_range : expression '''
2168 if(parse_debug): print('value_range_1', list(p))
2169 # { }
2170 ()
2171 def p_value_range_2(p):
2172 '''value_range : '[' expression ':' expression ']' '''
2173 if(parse_debug): print('value_range_2', list(p))
2174 # { }
2175 ()
2176 def p_variable_dimension_1(p):
2177 '''variable_dimension : '[' expression ':' expression ']' '''
2178 if(parse_debug): print('variable_dimension_1', list(p))
2179 # { list<pform_range_t> *tmp = new list<pform_range_t>;
2180 # pform_range_t index (p[2],p[4]);
2181 # tmp->push_back(index);
2182 # p[0] = tmp;
2183 # }
2184 # XXX TODO: subscriptlist
2185 start = str(p[4])
2186 end = str(p[2])
2187 if end.endswith("-1"):
2188 end = end[:-2]
2189 elif end.isdigit():
2190 end = str(int(end)+1)
2191 else:
2192 end = "1+%s" % end
2193 p[0] = '[%s:%s]' % (start, end) # python slice is LO:HI+1
2194 ()
2195 def p_variable_dimension_2(p):
2196 '''variable_dimension : '[' expression ']' '''
2197 if(parse_debug): print('variable_dimension_2', list(p))
2198 # { // SystemVerilog canonical range
2199 # if (!gn_system_verilog()) {
2200 # warn_count += 1;
2201 # cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. "
2202 # << "Use at least -g2005-sv to remove this warning." << endl;
2203 # }
2204 # list<pform_range_t> *tmp = new list<pform_range_t>;
2205 # pform_range_t index;
2206 # index.first = new PENumber(new verinum((uint64_t)0, integer_width));
2207 # index.second = new PEBinary('-', p[2], new PENumber(new verinum((uint64_t)1, integer_width)));
2208 # tmp->push_back(index);
2209 # p[0] = tmp;
2210 # }
2211 ()
2212 def p_variable_dimension_3(p):
2213 '''variable_dimension : '[' ']' '''
2214 if(parse_debug): print('variable_dimension_3', list(p))
2215 # { list<pform_range_t> *tmp = new list<pform_range_t>;
2216 # pform_range_t index (0,0);
2217 # tmp->push_back(index);
2218 # p[0] = tmp;
2219 # }
2220 ()
2221 def p_variable_dimension_4(p):
2222 '''variable_dimension : '[' '$' ']' '''
2223 if(parse_debug): print('variable_dimension_4', list(p))
2224 # { // SystemVerilog queue
2225 # list<pform_range_t> *tmp = new list<pform_range_t>;
2226 # pform_range_t index (new PENull,0);
2227 # if (!gn_system_verilog()) {
2228 # yyerror("error: Queue declarations require SystemVerilog.");
2229 # }
2230 # tmp->push_back(index);
2231 # p[0] = tmp;
2232 # }
2233 ()
2234 def p_variable_lifetime_1(p):
2235 '''variable_lifetime : lifetime '''
2236 if(parse_debug): print('variable_lifetime_1', list(p))
2237 # { if (!gn_system_verilog()) {
2238 # yyerror(@1, "error: overriding the default variable lifetime "
2239 # "requires SystemVerilog.");
2240 # } else if (p[1] != pform_peek_scope()->default_lifetime) {
2241 # yyerror(@1, "sorry: overriding the default variable lifetime "
2242 # "is not yet supported.");
2243 # }
2244 # var_lifetime = p[1];
2245 # }
2246 ()
2247 def p_attribute_list_opt_1(p):
2248 '''attribute_list_opt : attribute_instance_list '''
2249 if(parse_debug): print('attribute_list_opt_1', list(p))
2250 p[0] = p[1]
2251 ()
2252 def p_attribute_list_opt_2(p):
2253 '''attribute_list_opt : '''
2254 if(parse_debug > 2): print('attribute_list_opt_2', list(p))
2255 # { p[0] = None }
2256 ()
2257 def p_attribute_instance_list_1(p):
2258 '''attribute_instance_list : K_PSTAR K_STARP '''
2259 if(parse_debug): print('attribute_instance_list_1', list(p))
2260 # { p[0] = None }
2261 ()
2262 def p_attribute_instance_list_2(p):
2263 '''attribute_instance_list : K_PSTAR attribute_list K_STARP '''
2264 if(parse_debug): print('attribute_instance_list_2', list(p))
2265 p[0] = p[2]
2266 ()
2267 def p_attribute_instance_list_3(p):
2268 '''attribute_instance_list : attribute_instance_list K_PSTAR K_STARP '''
2269 if(parse_debug): print('attribute_instance_list_3', list(p))
2270 p[0] = p[1]
2271 ()
2272 def p_attribute_instance_list_4(p):
2273 '''attribute_instance_list : attribute_instance_list K_PSTAR attribute_list K_STARP '''
2274 if(parse_debug): print('attribute_instance_list_4', list(p))
2275 # { list<named_pexpr_t>*tmp = p[1];
2276 # if (tmp) {
2277 # tmp->splice(tmp->end(), *p[3]);
2278 # delete p[3];
2279 # p[0] = tmp;
2280 # } else p[0] = p[3];
2281 # }
2282 ()
2283 def p_attribute_list_1(p):
2284 '''attribute_list : attribute_list ',' attribute '''
2285 if(parse_debug): print('attribute_list_1', list(p))
2286 # { list<named_pexpr_t>*tmp = p[1];
2287 # tmp->push_back(*p[3]);
2288 # delete p[3];
2289 # p[0] = tmp;
2290 # }
2291 ()
2292 def p_attribute_list_2(p):
2293 '''attribute_list : attribute '''
2294 if(parse_debug): print('attribute_list_2', list(p))
2295 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
2296 # tmp->push_back(*p[1]);
2297 # delete p[1];
2298 # p[0] = tmp;
2299 # }
2300 ()
2301 def p_attribute_1(p):
2302 '''attribute : IDENTIFIER '''
2303 if(parse_debug): print('attribute_1', list(p))
2304 # { named_pexpr_t*tmp = new named_pexpr_t;
2305 # tmp->name = lex_strings.make(p[1]);
2306 # tmp->parm = 0;
2307 # delete[]p[1];
2308 # p[0] = tmp;
2309 # }
2310 ()
2311 def p_attribute_2(p):
2312 '''attribute : IDENTIFIER '=' expression '''
2313 if(parse_debug): print('attribute_2', list(p))
2314 # { PExpr*tmp = p[3];
2315 # named_pexpr_t*tmp2 = new named_pexpr_t;
2316 # tmp2->name = lex_strings.make(p[1]);
2317 # tmp2->parm = tmp;
2318 # delete[]p[1];
2319 # p[0] = tmp2;
2320 # }
2321 ()
2322 def p_block_item_decl_1(p):
2323 '''block_item_decl : data_type register_variable_list ';' '''
2324 if(parse_debug): print('block_item_decl_1', list(p))
2325 # { if (p[1]) pform_set_data_type(@1, p[1], p[2], NetNet::REG, attributes_in_context);
2326 # }
2327 ()
2328 def p_block_item_decl_2(p):
2329 '''block_item_decl : variable_lifetime data_type register_variable_list ';' '''
2330 if(parse_debug): print('block_item_decl_2', list(p))
2331 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
2332 # var_lifetime = LexicalScope::INHERITED;
2333 # }
2334 ()
2335 def p_block_item_decl_3(p):
2336 '''block_item_decl : K_reg data_type register_variable_list ';' '''
2337 if(parse_debug): print('block_item_decl_3', list(p))
2338 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
2339 # }
2340 ()
2341 def p_block_item_decl_4(p):
2342 '''block_item_decl : variable_lifetime K_reg data_type register_variable_list ';' '''
2343 if(parse_debug): print('block_item_decl_4', list(p))
2344 # { if (p[3]) pform_set_data_type(@3, p[3], p[4], NetNet::REG, attributes_in_context);
2345 # var_lifetime = LexicalScope::INHERITED;
2346 # }
2347 ()
2348 def p_block_item_decl_5(p):
2349 '''block_item_decl : K_event event_variable_list ';' '''
2350 if(parse_debug): print('block_item_decl_5', list(p))
2351 # { if (p[2]) pform_make_events(p[2], @1.text, @1.first_line);
2352 # }
2353 ()
2354 def p_block_item_decl_6(p):
2355 '''block_item_decl : K_parameter param_type parameter_assign_list ';' '''
2356 if(parse_debug): print('block_item_decl_6', list(p))
2357 ()
2358 def p_block_item_decl_7(p):
2359 '''block_item_decl : K_localparam param_type localparam_assign_list ';' '''
2360 if(parse_debug): print('block_item_decl_7', list(p))
2361 ()
2362 def p_block_item_decl_8(p):
2363 '''block_item_decl : type_declaration '''
2364 if(parse_debug): print('block_item_decl_8', list(p))
2365 ()
2366 def p_block_item_decl_9(p):
2367 '''block_item_decl : K_integer error ';' '''
2368 if(parse_debug): print('block_item_decl_9', list(p))
2369 # { yyerror(@1, "error: syntax error in integer variable list.");
2370 # yyerrok;
2371 # }
2372 ()
2373 def p_block_item_decl_10(p):
2374 '''block_item_decl : K_time error ';' '''
2375 if(parse_debug): print('block_item_decl_10', list(p))
2376 # { yyerror(@1, "error: syntax error in time variable list.");
2377 # yyerrok;
2378 # }
2379 ()
2380 def p_block_item_decl_11(p):
2381 '''block_item_decl : K_parameter error ';' '''
2382 if(parse_debug): print('block_item_decl_11', list(p))
2383 # { yyerror(@1, "error: syntax error in parameter list.");
2384 # yyerrok;
2385 # }
2386 ()
2387 def p_block_item_decl_12(p):
2388 '''block_item_decl : K_localparam error ';' '''
2389 if(parse_debug): print('block_item_decl_12', list(p))
2390 # { yyerror(@1, "error: syntax error localparam list.");
2391 # yyerrok;
2392 # }
2393 ()
2394 def p_block_item_decls_1(p):
2395 '''block_item_decls : block_item_decl '''
2396 if(parse_debug): print('block_item_decls_1', list(p))
2397 ()
2398 def p_block_item_decls_2(p):
2399 '''block_item_decls : block_item_decls block_item_decl '''
2400 if(parse_debug): print('block_item_decls_2', list(p))
2401 ()
2402 def p_block_item_decls_opt_1(p):
2403 '''block_item_decls_opt : block_item_decls '''
2404 if(parse_debug): print('block_item_decls_opt_1', list(p))
2405 p[0] = True
2406 ()
2407 def p_block_item_decls_opt_2(p):
2408 '''block_item_decls_opt : '''
2409 if(parse_debug): print('block_item_decls_opt_2', list(p))
2410 p[0] = False
2411 ()
2412 def p_type_declaration_1(p):
2413 '''type_declaration : K_typedef data_type IDENTIFIER dimensions_opt ';' '''
2414 if(parse_debug): print('type_declaration_1', list(p))
2415 # { perm_string name = lex_strings.make(p[3]);
2416 # pform_set_typedef(name, p[2], p[4]);
2417 # delete[]p[3];
2418 # }
2419 ()
2420 def p_type_declaration_2(p):
2421 '''type_declaration : K_typedef data_type TYPE_IDENTIFIER ';' '''
2422 if(parse_debug): print('type_declaration_2', list(p))
2423 # { perm_string name = lex_strings.make(p[3].text);
2424 # if (pform_test_type_identifier_local(name)) {
2425 # yyerror(@3, "error: Typedef identifier \"%s\" is already a type name.", p[3].text);
2426 #
2427 # } else {
2428 # pform_set_typedef(name, p[2], NULL);
2429 # }
2430 # delete[]p[3].text;
2431 # }
2432 ()
2433 def p_type_declaration_3(p):
2434 '''type_declaration : K_typedef K_class IDENTIFIER ';' '''
2435 if(parse_debug): print('type_declaration_3', list(p))
2436 # { // Create a synthetic typedef for the class name so that the
2437 # // lexor detects the name as a type.
2438 # perm_string name = lex_strings.make(p[3]);
2439 # class_type_t*tmp = new class_type_t(name);
2440 # FILE_NAME(tmp, @3);
2441 # pform_set_typedef(name, tmp, NULL);
2442 # delete[]p[3];
2443 # }
2444 ()
2445 def p_type_declaration_4(p):
2446 '''type_declaration : K_typedef K_enum IDENTIFIER ';' '''
2447 if(parse_debug): print('type_declaration_4', list(p))
2448 # { yyerror(@1, "sorry: Enum forward declarations not supported yet."); }
2449 ()
2450 def p_type_declaration_5(p):
2451 '''type_declaration : K_typedef K_struct IDENTIFIER ';' '''
2452 if(parse_debug): print('type_declaration_5', list(p))
2453 # { yyerror(@1, "sorry: Struct forward declarations not supported yet."); }
2454 ()
2455 def p_type_declaration_6(p):
2456 '''type_declaration : K_typedef K_union IDENTIFIER ';' '''
2457 if(parse_debug): print('type_declaration_6', list(p))
2458 # { yyerror(@1, "sorry: Union forward declarations not supported yet."); }
2459 ()
2460 def p_type_declaration_7(p):
2461 '''type_declaration : K_typedef IDENTIFIER ';' '''
2462 if(parse_debug): print('type_declaration_7', list(p))
2463 # { // Create a synthetic typedef for the class name so that the
2464 # // lexor detects the name as a type.
2465 # perm_string name = lex_strings.make(p[2]);
2466 # class_type_t*tmp = new class_type_t(name);
2467 # FILE_NAME(tmp, @2);
2468 # pform_set_typedef(name, tmp, NULL);
2469 # delete[]p[2];
2470 # }
2471 ()
2472 def p_type_declaration_8(p):
2473 '''type_declaration : K_typedef error ';' '''
2474 if(parse_debug): print('type_declaration_8', list(p))
2475 # { yyerror(@2, "error: Syntax error in typedef clause.");
2476 # yyerrok;
2477 # }
2478 ()
2479 def p_enum_data_type_1(p):
2480 '''enum_data_type : K_enum '{' enum_name_list '}' '''
2481 if(parse_debug): print('enum_data_type_1', list(p))
2482 # { enum_type_t*enum_type = new enum_type_t;
2483 # FILE_NAME(enum_type, @1);
2484 # enum_type->names .reset(p[3]);
2485 # enum_type->base_type = IVL_VT_BOOL;
2486 # enum_type->signed_flag = true;
2487 # enum_type->integer_flag = false;
2488 # enum_type->range.reset(make_range_from_width(32));
2489 # p[0] = enum_type;
2490 # }
2491 ()
2492 def p_enum_data_type_2(p):
2493 '''enum_data_type : K_enum atom2_type signed_unsigned_opt '{' enum_name_list '}' '''
2494 if(parse_debug): print('enum_data_type_2', list(p))
2495 # { enum_type_t*enum_type = new enum_type_t;
2496 # FILE_NAME(enum_type, @1);
2497 # enum_type->names .reset(p[5]);
2498 # enum_type->base_type = IVL_VT_BOOL;
2499 # enum_type->signed_flag = p[3];
2500 # enum_type->integer_flag = false;
2501 # enum_type->range.reset(make_range_from_width(p[2]));
2502 # p[0] = enum_type;
2503 # }
2504 ()
2505 def p_enum_data_type_3(p):
2506 '''enum_data_type : K_enum K_integer signed_unsigned_opt '{' enum_name_list '}' '''
2507 if(parse_debug): print('enum_data_type_3', list(p))
2508 # { enum_type_t*enum_type = new enum_type_t;
2509 # FILE_NAME(enum_type, @1);
2510 # enum_type->names .reset(p[5]);
2511 # enum_type->base_type = IVL_VT_LOGIC;
2512 # enum_type->signed_flag = p[3];
2513 # enum_type->integer_flag = true;
2514 # enum_type->range.reset(make_range_from_width(integer_width));
2515 # p[0] = enum_type;
2516 # }
2517 ()
2518 def p_enum_data_type_4(p):
2519 '''enum_data_type : K_enum K_logic unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2520 if(parse_debug): print('enum_data_type_4', list(p))
2521 # { enum_type_t*enum_type = new enum_type_t;
2522 # FILE_NAME(enum_type, @1);
2523 # enum_type->names .reset(p[6]);
2524 # enum_type->base_type = IVL_VT_LOGIC;
2525 # enum_type->signed_flag = p[3];
2526 # enum_type->integer_flag = false;
2527 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
2528 # p[0] = enum_type;
2529 # }
2530 ()
2531 def p_enum_data_type_5(p):
2532 '''enum_data_type : K_enum K_reg unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2533 if(parse_debug): print('enum_data_type_5', list(p))
2534 # { enum_type_t*enum_type = new enum_type_t;
2535 # FILE_NAME(enum_type, @1);
2536 # enum_type->names .reset(p[6]);
2537 # enum_type->base_type = IVL_VT_LOGIC;
2538 # enum_type->signed_flag = p[3];
2539 # enum_type->integer_flag = false;
2540 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
2541 # p[0] = enum_type;
2542 # }
2543 ()
2544 def p_enum_data_type_6(p):
2545 '''enum_data_type : K_enum K_bit unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2546 if(parse_debug): print('enum_data_type_6', list(p))
2547 # { enum_type_t*enum_type = new enum_type_t;
2548 # FILE_NAME(enum_type, @1);
2549 # enum_type->names .reset(p[6]);
2550 # enum_type->base_type = IVL_VT_BOOL;
2551 # enum_type->signed_flag = p[3];
2552 # enum_type->integer_flag = false;
2553 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
2554 # p[0] = enum_type;
2555 # }
2556 ()
2557 def p_enum_name_list_1(p):
2558 '''enum_name_list : enum_name '''
2559 if(parse_debug): print('enum_name_list_1', list(p))
2560 # { p[0] = p[1];
2561 # }
2562 ()
2563 def p_enum_name_list_2(p):
2564 '''enum_name_list : enum_name_list ',' enum_name '''
2565 if(parse_debug): print('enum_name_list_2', list(p))
2566 # { list<named_pexpr_t>*lst = p[1];
2567 # lst->splice(lst->end(), *p[3]);
2568 # delete p[3];
2569 # p[0] = lst;
2570 # }
2571 ()
2572 def p_pos_neg_number_1(p):
2573 '''pos_neg_number : number '''
2574 if(parse_debug): print('pos_neg_number_1', list(p))
2575 # { p[0] = p[1];
2576 # }
2577 ()
2578 def p_pos_neg_number_2(p):
2579 '''pos_neg_number : '-' number '''
2580 if(parse_debug): print('pos_neg_number_2', list(p))
2581 # { verinum tmp = -(*(p[2]));
2582 # *(p[2]) = tmp;
2583 # p[0] = p[2];
2584 # }
2585 ()
2586 def p_enum_name_1(p):
2587 '''enum_name : IDENTIFIER '''
2588 if(parse_debug): print('enum_name_1', list(p))
2589 # { perm_string name = lex_strings.make(p[1]);
2590 # delete[]p[1];
2591 # p[0] = make_named_number(name);
2592 # }
2593 ()
2594 def p_enum_name_2(p):
2595 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '''
2596 if(parse_debug): print('enum_name_2', list(p))
2597 # { perm_string name = lex_strings.make(p[1]);
2598 # long count = check_enum_seq_value(@1, p[3], false);
2599 # delete[]p[1];
2600 # p[0] = make_named_numbers(name, 0, count-1);
2601 # delete p[3];
2602 # }
2603 ()
2604 def p_enum_name_3(p):
2605 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '''
2606 if(parse_debug): print('enum_name_3', list(p))
2607 # { perm_string name = lex_strings.make(p[1]);
2608 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
2609 # check_enum_seq_value(@1, p[5], true));
2610 # delete[]p[1];
2611 # delete p[3];
2612 # delete p[5];
2613 # }
2614 ()
2615 def p_enum_name_4(p):
2616 '''enum_name : IDENTIFIER '=' expression '''
2617 if(parse_debug): print('enum_name_4', list(p))
2618 # { perm_string name = lex_strings.make(p[1]);
2619 # delete[]p[1];
2620 # p[0] = make_named_number(name, p[3]);
2621 # }
2622 ()
2623 def p_enum_name_5(p):
2624 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '=' expression '''
2625 if(parse_debug): print('enum_name_5', list(p))
2626 # { perm_string name = lex_strings.make(p[1]);
2627 # long count = check_enum_seq_value(@1, p[3], false);
2628 # p[0] = make_named_numbers(name, 0, count-1, p[6]);
2629 # delete[]p[1];
2630 # delete p[3];
2631 # }
2632 ()
2633 def p_enum_name_6(p):
2634 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '=' expression '''
2635 if(parse_debug): print('enum_name_6', list(p))
2636 # { perm_string name = lex_strings.make(p[1]);
2637 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
2638 # check_enum_seq_value(@1, p[5], true), p[8]);
2639 # delete[]p[1];
2640 # delete p[3];
2641 # delete p[5];
2642 # }
2643 ()
2644 def p_struct_data_type_1(p):
2645 '''struct_data_type : K_struct K_packed_opt '{' struct_union_member_list '}' '''
2646 if(parse_debug): print('struct_data_type_1', list(p))
2647 # { struct_type_t*tmp = new struct_type_t;
2648 # FILE_NAME(tmp, @1);
2649 # tmp->packed_flag = p[2];
2650 # tmp->union_flag = false;
2651 # tmp->members .reset(p[4]);
2652 # p[0] = tmp;
2653 # }
2654 ()
2655 def p_struct_data_type_2(p):
2656 '''struct_data_type : K_union K_packed_opt '{' struct_union_member_list '}' '''
2657 if(parse_debug): print('struct_data_type_2', list(p))
2658 # { struct_type_t*tmp = new struct_type_t;
2659 # FILE_NAME(tmp, @1);
2660 # tmp->packed_flag = p[2];
2661 # tmp->union_flag = true;
2662 # tmp->members .reset(p[4]);
2663 # p[0] = tmp;
2664 # }
2665 ()
2666 def p_struct_data_type_3(p):
2667 '''struct_data_type : K_struct K_packed_opt '{' error '}' '''
2668 if(parse_debug): print('struct_data_type_3', list(p))
2669 # { yyerror(@3, "error: Errors in struct member list.");
2670 # yyerrok;
2671 # struct_type_t*tmp = new struct_type_t;
2672 # FILE_NAME(tmp, @1);
2673 # tmp->packed_flag = p[2];
2674 # tmp->union_flag = false;
2675 # p[0] = tmp;
2676 # }
2677 ()
2678 def p_struct_data_type_4(p):
2679 '''struct_data_type : K_union K_packed_opt '{' error '}' '''
2680 if(parse_debug): print('struct_data_type_4', list(p))
2681 # { yyerror(@3, "error: Errors in union member list.");
2682 # yyerrok;
2683 # struct_type_t*tmp = new struct_type_t;
2684 # FILE_NAME(tmp, @1);
2685 # tmp->packed_flag = p[2];
2686 # tmp->union_flag = true;
2687 # p[0] = tmp;
2688 # }
2689 ()
2690 def p_struct_union_member_list_1(p):
2691 '''struct_union_member_list : struct_union_member_list struct_union_member '''
2692 if(parse_debug): print('struct_union_member_list_1', list(p))
2693 # { list<struct_member_t*>*tmp = p[1];
2694 # tmp->push_back(p[2]);
2695 # p[0] = tmp;
2696 # }
2697 ()
2698 def p_struct_union_member_list_2(p):
2699 '''struct_union_member_list : struct_union_member '''
2700 if(parse_debug): print('struct_union_member_list_2', list(p))
2701 # { list<struct_member_t*>*tmp = new list<struct_member_t*>;
2702 # tmp->push_back(p[1]);
2703 # p[0] = tmp;
2704 # }
2705 ()
2706 def p_struct_union_member_1(p):
2707 '''struct_union_member : attribute_list_opt data_type list_of_variable_decl_assignments ';' '''
2708 if(parse_debug): print('struct_union_member_1', list(p))
2709 # { struct_member_t*tmp = new struct_member_t;
2710 # FILE_NAME(tmp, @2);
2711 # tmp->type .reset(p[2]);
2712 # tmp->names .reset(p[3]);
2713 # p[0] = tmp;
2714 # }
2715 ()
2716 def p_struct_union_member_2(p):
2717 '''struct_union_member : error ';' '''
2718 if(parse_debug): print('struct_union_member_2', list(p))
2719 # { yyerror(@2, "Error in struct/union member.");
2720 # yyerrok;
2721 # p[0] = None
2722 # }
2723 ()
2724 def p_case_item_1(p):
2725 '''case_item : expression_list_proper ':' statement_or_null '''
2726 if(parse_debug): print('case_item_1', list(p))
2727 # { PCase::Item*tmp = new PCase::Item;
2728 # tmp->expr = *p[1];
2729 # tmp->stat = p[3];
2730 # delete p[1];
2731 # p[0] = tmp;
2732 # }
2733 ()
2734 def p_case_item_2(p):
2735 '''case_item : K_default ':' statement_or_null '''
2736 if(parse_debug): print('case_item_2', list(p))
2737 # { PCase::Item*tmp = new PCase::Item;
2738 # tmp->stat = p[3];
2739 # p[0] = tmp;
2740 # }
2741 ()
2742 def p_case_item_3(p):
2743 '''case_item : K_default statement_or_null '''
2744 if(parse_debug): print('case_item_3', list(p))
2745 # { PCase::Item*tmp = new PCase::Item;
2746 # tmp->stat = p[2];
2747 # p[0] = tmp;
2748 # }
2749 ()
2750 def p_case_item_4(p):
2751 '''case_item : error ':' statement_or_null '''
2752 if(parse_debug): print('case_item_4', list(p))
2753 # { yyerror(@2, "error: Incomprehensible case expression.");
2754 # yyerrok;
2755 # }
2756 ()
2757 def p_case_items_1(p):
2758 '''case_items : case_items case_item '''
2759 if(parse_debug): print('case_items_1', list(p))
2760 # { svector<PCase::Item*>*tmp;
2761 # tmp = new svector<PCase::Item*>(*p[1], p[2]);
2762 # delete p[1];
2763 # p[0] = tmp;
2764 # }
2765 ()
2766 def p_case_items_2(p):
2767 '''case_items : case_item '''
2768 if(parse_debug): print('case_items_2', list(p))
2769 # { svector<PCase::Item*>*tmp = new svector<PCase::Item*>(1);
2770 # (*tmp)[0] = p[1];
2771 # p[0] = tmp;
2772 # }
2773 ()
2774 def p_charge_strength_1(p):
2775 '''charge_strength : '(' K_small ')' '''
2776 if(parse_debug): print('charge_strength_1', list(p))
2777 ()
2778 def p_charge_strength_2(p):
2779 '''charge_strength : '(' K_medium ')' '''
2780 if(parse_debug): print('charge_strength_2', list(p))
2781 ()
2782 def p_charge_strength_3(p):
2783 '''charge_strength : '(' K_large ')' '''
2784 if(parse_debug): print('charge_strength_3', list(p))
2785 ()
2786 def p_charge_strength_opt_1(p):
2787 '''charge_strength_opt : charge_strength '''
2788 if(parse_debug): print('charge_strength_opt_1', list(p))
2789 ()
2790 def p_charge_strength_opt_2(p):
2791 '''charge_strength_opt : '''
2792 if(parse_debug): print('charge_strength_opt_2', list(p))
2793 ()
2794 def p_defparam_assign_1(p):
2795 '''defparam_assign : hierarchy_identifier '=' expression '''
2796 if(parse_debug): print('defparam_assign_1', list(p))
2797 # { pform_set_defparam(*p[1], p[3]);
2798 # delete p[1];
2799 # }
2800 ()
2801 def p_defparam_assign_list_1(p):
2802 '''defparam_assign_list : defparam_assign '''
2803 if(parse_debug): print('defparam_assign_list_1', list(p))
2804 ()
2805 def p_defparam_assign_list_2(p):
2806 '''defparam_assign_list : dimensions defparam_assign '''
2807 if(parse_debug): print('defparam_assign_list_2', list(p))
2808 # { yyerror(@1, "error: defparam may not include a range.");
2809 # delete p[1];
2810 # }
2811 ()
2812 def p_defparam_assign_list_3(p):
2813 '''defparam_assign_list : defparam_assign_list ',' defparam_assign '''
2814 if(parse_debug): print('defparam_assign_list_3', list(p))
2815 ()
2816 def p_delay1_1(p):
2817 '''delay1 : '#' delay_value_simple '''
2818 if(parse_debug): print('delay1_1', list(p))
2819 # { list<PExpr*>*tmp = new list<PExpr*>;
2820 # tmp->push_back(p[2]);
2821 # p[0] = tmp;
2822 # }
2823 ()
2824 def p_delay1_2(p):
2825 '''delay1 : '#' '(' delay_value ')' '''
2826 if(parse_debug): print('delay1_2', list(p))
2827 # { list<PExpr*>*tmp = new list<PExpr*>;
2828 # tmp->push_back(p[3]);
2829 # p[0] = tmp;
2830 # }
2831 ()
2832 def p_delay3_1(p):
2833 '''delay3 : '#' delay_value_simple '''
2834 if(parse_debug): print('delay3_1', list(p))
2835 # { list<PExpr*>*tmp = new list<PExpr*>;
2836 # tmp->push_back(p[2]);
2837 # p[0] = tmp;
2838 # }
2839 ()
2840 def p_delay3_2(p):
2841 '''delay3 : '#' '(' delay_value ')' '''
2842 if(parse_debug): print('delay3_2', list(p))
2843 # { list<PExpr*>*tmp = new list<PExpr*>;
2844 # tmp->push_back(p[3]);
2845 # p[0] = tmp;
2846 # }
2847 ()
2848 def p_delay3_3(p):
2849 '''delay3 : '#' '(' delay_value ',' delay_value ')' '''
2850 if(parse_debug): print('delay3_3', list(p))
2851 # { list<PExpr*>*tmp = new list<PExpr*>;
2852 # tmp->push_back(p[3]);
2853 # tmp->push_back(p[5]);
2854 # p[0] = tmp;
2855 # }
2856 ()
2857 def p_delay3_4(p):
2858 '''delay3 : '#' '(' delay_value ',' delay_value ',' delay_value ')' '''
2859 if(parse_debug): print('delay3_4', list(p))
2860 # { list<PExpr*>*tmp = new list<PExpr*>;
2861 # tmp->push_back(p[3]);
2862 # tmp->push_back(p[5]);
2863 # tmp->push_back(p[7]);
2864 # p[0] = tmp;
2865 # }
2866 ()
2867 def p_delay3_opt_1(p):
2868 '''delay3_opt : delay3 '''
2869 if(parse_debug): print('delay3_opt_1', list(p))
2870 p[0] = p[1]
2871 ()
2872 def p_delay3_opt_2(p):
2873 '''delay3_opt : '''
2874 if(parse_debug>2): print('delay3_opt_2', list(p))
2875 # { p[0] = None }
2876 ()
2877 def p_delay_value_list_1(p):
2878 '''delay_value_list : delay_value '''
2879 if(parse_debug): print('delay_value_list_1', list(p))
2880 # { list<PExpr*>*tmp = new list<PExpr*>;
2881 # tmp->push_back(p[1]);
2882 # p[0] = tmp;
2883 # }
2884 ()
2885 def p_delay_value_list_2(p):
2886 '''delay_value_list : delay_value_list ',' delay_value '''
2887 if(parse_debug): print('delay_value_list_2', list(p))
2888 # { list<PExpr*>*tmp = p[1];
2889 # tmp->push_back(p[3]);
2890 # p[0] = tmp;
2891 # }
2892 ()
2893 def p_delay_value_1(p):
2894 '''delay_value : expression '''
2895 if(parse_debug): print('delay_value_1', list(p))
2896 # { PExpr*tmp = p[1];
2897 # p[0] = tmp;
2898 # }
2899 ()
2900 def p_delay_value_2(p):
2901 '''delay_value : expression ':' expression ':' expression '''
2902 if(parse_debug): print('delay_value_2', list(p))
2903 # { p[0] = pform_select_mtm_expr(p[1], p[3], p[5]); }
2904 ()
2905 def p_delay_value_simple_1(p):
2906 '''delay_value_simple : DEC_NUMBER '''
2907 if(parse_debug): print('delay_value_simple_1', list(p))
2908 # { verinum*tmp = p[1];
2909 # if (tmp == 0) {
2910 # yyerror(@1, "internal error: delay.");
2911 # p[0] = None
2912 # } else {
2913 # p[0] = new PENumber(tmp);
2914 # FILE_NAME(p[0], @1);
2915 # }
2916 # based_size = 0;
2917 # }
2918 ()
2919 def p_delay_value_simple_2(p):
2920 '''delay_value_simple : REALTIME '''
2921 if(parse_debug): print('delay_value_simple_2', list(p))
2922 # { verireal*tmp = p[1];
2923 # if (tmp == 0) {
2924 # yyerror(@1, "internal error: delay.");
2925 # p[0] = None
2926 # } else {
2927 # p[0] = new PEFNumber(tmp);
2928 # FILE_NAME(p[0], @1);
2929 # }
2930 # }
2931 ()
2932 def p_delay_value_simple_3(p):
2933 '''delay_value_simple : IDENTIFIER '''
2934 if(parse_debug): print('delay_value_simple_3', list(p))
2935 # { PEIdent*tmp = new PEIdent(lex_strings.make(p[1]));
2936 # FILE_NAME(tmp, @1);
2937 # p[0] = tmp;
2938 # delete[]p[1];
2939 # }
2940 ()
2941 def p_delay_value_simple_4(p):
2942 '''delay_value_simple : TIME_LITERAL '''
2943 if(parse_debug): print('delay_value_simple_4', list(p))
2944 # { int unit;
2945 #
2946 # based_size = 0;
2947 # p[0] = 0;
2948 # if (p[1] == 0 || !get_time_unit(p[1], unit))
2949 # yyerror(@1, "internal error: delay.");
2950 # else {
2951 # double p = pow(10.0,
2952 # (double)(unit - pform_get_timeunit()));
2953 # double time = atof(p[1]) * p;
2954 #
2955 # verireal *v = new verireal(time);
2956 # p[0] = new PEFNumber(v);
2957 # FILE_NAME(p[0], @1);
2958 # }
2959 # }
2960 ()
2961 def p_optional_semicolon_1(p):
2962 '''optional_semicolon : ';' '''
2963 if(parse_debug): print('optional_semicolon_1', list(p))
2964 ()
2965 def p_optional_semicolon_2(p):
2966 '''optional_semicolon : '''
2967 if(parse_debug): print('optional_semicolon_2', list(p))
2968 ()
2969 def p_discipline_declaration_1(p):
2970 '''discipline_declaration : K_discipline IDENTIFIER optional_semicolon _embed0_discipline_declaration discipline_items K_enddiscipline '''
2971 if(parse_debug): print('discipline_declaration_1', list(p))
2972 # { pform_end_discipline(@1); delete[] p[2]; }
2973 ()
2974 def p__embed0_discipline_declaration(p):
2975 '''_embed0_discipline_declaration : '''
2976 # { pform_start_discipline(p[2]); }
2977 ()
2978 def p_discipline_items_1(p):
2979 '''discipline_items : discipline_items discipline_item '''
2980 if(parse_debug): print('discipline_items_1', list(p))
2981 ()
2982 def p_discipline_items_2(p):
2983 '''discipline_items : discipline_item '''
2984 if(parse_debug): print('discipline_items_2', list(p))
2985 ()
2986 def p_discipline_item_1(p):
2987 '''discipline_item : K_domain K_discrete ';' '''
2988 if(parse_debug): print('discipline_item_1', list(p))
2989 # { pform_discipline_domain(@1, IVL_DIS_DISCRETE); }
2990 ()
2991 def p_discipline_item_2(p):
2992 '''discipline_item : K_domain K_continuous ';' '''
2993 if(parse_debug): print('discipline_item_2', list(p))
2994 # { pform_discipline_domain(@1, IVL_DIS_CONTINUOUS); }
2995 ()
2996 def p_discipline_item_3(p):
2997 '''discipline_item : K_potential IDENTIFIER ';' '''
2998 if(parse_debug): print('discipline_item_3', list(p))
2999 # { pform_discipline_potential(@1, p[2]); delete[] p[2]; }
3000 ()
3001 def p_discipline_item_4(p):
3002 '''discipline_item : K_flow IDENTIFIER ';' '''
3003 if(parse_debug): print('discipline_item_4', list(p))
3004 # { pform_discipline_flow(@1, p[2]); delete[] p[2]; }
3005 ()
3006 def p_nature_declaration_1(p):
3007 '''nature_declaration : K_nature IDENTIFIER optional_semicolon _embed0_nature_declaration nature_items K_endnature '''
3008 if(parse_debug): print('nature_declaration_1', list(p))
3009 # { pform_end_nature(@1); delete[] p[2]; }
3010 ()
3011 def p__embed0_nature_declaration(p):
3012 '''_embed0_nature_declaration : '''
3013 # { pform_start_nature(p[2]); }
3014 ()
3015 def p_nature_items_1(p):
3016 '''nature_items : nature_items nature_item '''
3017 if(parse_debug): print('nature_items_1', list(p))
3018 ()
3019 def p_nature_items_2(p):
3020 '''nature_items : nature_item '''
3021 if(parse_debug): print('nature_items_2', list(p))
3022 ()
3023 def p_nature_item_1(p):
3024 '''nature_item : K_units '=' STRING ';' '''
3025 if(parse_debug): print('nature_item_1', list(p))
3026 # { delete[] p[3]; }
3027 ()
3028 def p_nature_item_2(p):
3029 '''nature_item : K_abstol '=' expression ';' '''
3030 if(parse_debug): print('nature_item_2', list(p))
3031 ()
3032 def p_nature_item_3(p):
3033 '''nature_item : K_access '=' IDENTIFIER ';' '''
3034 if(parse_debug): print('nature_item_3', list(p))
3035 # { pform_nature_access(@1, p[3]); delete[] p[3]; }
3036 ()
3037 def p_nature_item_4(p):
3038 '''nature_item : K_idt_nature '=' IDENTIFIER ';' '''
3039 if(parse_debug): print('nature_item_4', list(p))
3040 # { delete[] p[3]; }
3041 ()
3042 def p_nature_item_5(p):
3043 '''nature_item : K_ddt_nature '=' IDENTIFIER ';' '''
3044 if(parse_debug): print('nature_item_5', list(p))
3045 # { delete[] p[3]; }
3046 ()
3047 def p_config_declaration_1(p):
3048 '''config_declaration : K_config IDENTIFIER ';' K_design lib_cell_identifiers ';' list_of_config_rule_statements K_endconfig '''
3049 if(parse_debug): print('config_declaration_1', list(p))
3050 # { cerr << @1 << ": sorry: config declarations are not supported and "
3051 # "will be skipped." << endl;
3052 # delete[] p[2];
3053 # }
3054 ()
3055 def p_lib_cell_identifiers_1(p):
3056 '''lib_cell_identifiers : '''
3057 if(parse_debug): print('lib_cell_identifiers_1', list(p))
3058 ()
3059 def p_lib_cell_identifiers_2(p):
3060 '''lib_cell_identifiers : lib_cell_identifiers lib_cell_id '''
3061 if(parse_debug): print('lib_cell_identifiers_2', list(p))
3062 ()
3063 def p_list_of_config_rule_statements_1(p):
3064 '''list_of_config_rule_statements : '''
3065 if(parse_debug): print('list_of_config_rule_statements_1', list(p))
3066 ()
3067 def p_list_of_config_rule_statements_2(p):
3068 '''list_of_config_rule_statements : list_of_config_rule_statements config_rule_statement '''
3069 if(parse_debug): print('list_of_config_rule_statements_2', list(p))
3070 ()
3071 def p_config_rule_statement_1(p):
3072 '''config_rule_statement : K_default K_liblist list_of_libraries ';' '''
3073 if(parse_debug): print('config_rule_statement_1', list(p))
3074 ()
3075 def p_config_rule_statement_2(p):
3076 '''config_rule_statement : K_instance hierarchy_identifier K_liblist list_of_libraries ';' '''
3077 if(parse_debug): print('config_rule_statement_2', list(p))
3078 # { delete p[2]; }
3079 ()
3080 def p_config_rule_statement_3(p):
3081 '''config_rule_statement : K_instance hierarchy_identifier K_use lib_cell_id opt_config ';' '''
3082 if(parse_debug): print('config_rule_statement_3', list(p))
3083 # { delete p[2]; }
3084 ()
3085 def p_config_rule_statement_4(p):
3086 '''config_rule_statement : K_cell lib_cell_id K_liblist list_of_libraries ';' '''
3087 if(parse_debug): print('config_rule_statement_4', list(p))
3088 ()
3089 def p_config_rule_statement_5(p):
3090 '''config_rule_statement : K_cell lib_cell_id K_use lib_cell_id opt_config ';' '''
3091 if(parse_debug): print('config_rule_statement_5', list(p))
3092 ()
3093 def p_opt_config_1(p):
3094 '''opt_config : '''
3095 if(parse_debug): print('opt_config_1', list(p))
3096 ()
3097 def p_opt_config_2(p):
3098 '''opt_config : ':' K_config '''
3099 if(parse_debug): print('opt_config_2', list(p))
3100 ()
3101 def p_lib_cell_id_1(p):
3102 '''lib_cell_id : IDENTIFIER '''
3103 if(parse_debug): print('lib_cell_id_1', list(p))
3104 # { delete[] p[1]; }
3105 ()
3106 def p_lib_cell_id_2(p):
3107 '''lib_cell_id : IDENTIFIER '.' IDENTIFIER '''
3108 if(parse_debug): print('lib_cell_id_2', list(p))
3109 # { delete[] p[1]; delete[] p[3]; }
3110 ()
3111 def p_list_of_libraries_1(p):
3112 '''list_of_libraries : '''
3113 if(parse_debug): print('list_of_libraries_1', list(p))
3114 ()
3115 def p_list_of_libraries_2(p):
3116 '''list_of_libraries : list_of_libraries IDENTIFIER '''
3117 if(parse_debug): print('list_of_libraries_2', list(p))
3118 # { delete[] p[2]; }
3119 ()
3120 def p_drive_strength_1(p):
3121 '''drive_strength : '(' dr_strength0 ',' dr_strength1 ')' '''
3122 if(parse_debug): print('drive_strength_1', list(p))
3123 # { p[0].str0 = p[2].str0;
3124 # p[0].str1 = p[4].str1;
3125 # }
3126 ()
3127 def p_drive_strength_2(p):
3128 '''drive_strength : '(' dr_strength1 ',' dr_strength0 ')' '''
3129 if(parse_debug): print('drive_strength_2', list(p))
3130 # { p[0].str0 = p[4].str0;
3131 # p[0].str1 = p[2].str1;
3132 # }
3133 ()
3134 def p_drive_strength_3(p):
3135 '''drive_strength : '(' dr_strength0 ',' K_highz1 ')' '''
3136 if(parse_debug): print('drive_strength_3', list(p))
3137 # { p[0].str0 = p[2].str0;
3138 # p[0].str1 = IVL_DR_HiZ;
3139 # }
3140 ()
3141 def p_drive_strength_4(p):
3142 '''drive_strength : '(' dr_strength1 ',' K_highz0 ')' '''
3143 if(parse_debug): print('drive_strength_4', list(p))
3144 # { p[0].str0 = IVL_DR_HiZ;
3145 # p[0].str1 = p[2].str1;
3146 # }
3147 ()
3148 def p_drive_strength_5(p):
3149 '''drive_strength : '(' K_highz1 ',' dr_strength0 ')' '''
3150 if(parse_debug): print('drive_strength_5', list(p))
3151 # { p[0].str0 = p[4].str0;
3152 # p[0].str1 = IVL_DR_HiZ;
3153 # }
3154 ()
3155 def p_drive_strength_6(p):
3156 '''drive_strength : '(' K_highz0 ',' dr_strength1 ')' '''
3157 if(parse_debug): print('drive_strength_6', list(p))
3158 # { p[0].str0 = IVL_DR_HiZ;
3159 # p[0].str1 = p[4].str1;
3160 # }
3161 ()
3162 def p_drive_strength_opt_1(p):
3163 '''drive_strength_opt : drive_strength '''
3164 if(parse_debug): print('drive_strength_opt_1', list(p))
3165 p[0] = p[1]
3166 ()
3167 def p_drive_strength_opt_2(p):
3168 '''drive_strength_opt : '''
3169 if(parse_debug>2): print('drive_strength_opt_2', list(p))
3170 # { p[0].str0 = IVL_DR_STRONG; p[0].str1 = IVL_DR_STRONG; }
3171 ()
3172 def p_dr_strength0_1(p):
3173 '''dr_strength0 : K_supply0 '''
3174 if(parse_debug): print('dr_strength0_1', list(p))
3175 # { p[0].str0 = IVL_DR_SUPPLY; }
3176 ()
3177 def p_dr_strength0_2(p):
3178 '''dr_strength0 : K_strong0 '''
3179 if(parse_debug): print('dr_strength0_2', list(p))
3180 # { p[0].str0 = IVL_DR_STRONG; }
3181 ()
3182 def p_dr_strength0_3(p):
3183 '''dr_strength0 : K_pull0 '''
3184 if(parse_debug): print('dr_strength0_3', list(p))
3185 # { p[0].str0 = IVL_DR_PULL; }
3186 ()
3187 def p_dr_strength0_4(p):
3188 '''dr_strength0 : K_weak0 '''
3189 if(parse_debug): print('dr_strength0_4', list(p))
3190 # { p[0].str0 = IVL_DR_WEAK; }
3191 ()
3192 def p_dr_strength1_1(p):
3193 '''dr_strength1 : K_supply1 '''
3194 if(parse_debug): print('dr_strength1_1', list(p))
3195 # { p[0].str1 = IVL_DR_SUPPLY; }
3196 ()
3197 def p_dr_strength1_2(p):
3198 '''dr_strength1 : K_strong1 '''
3199 if(parse_debug): print('dr_strength1_2', list(p))
3200 # { p[0].str1 = IVL_DR_STRONG; }
3201 ()
3202 def p_dr_strength1_3(p):
3203 '''dr_strength1 : K_pull1 '''
3204 if(parse_debug): print('dr_strength1_3', list(p))
3205 # { p[0].str1 = IVL_DR_PULL; }
3206 ()
3207 def p_dr_strength1_4(p):
3208 '''dr_strength1 : K_weak1 '''
3209 if(parse_debug): print('dr_strength1_4', list(p))
3210 # { p[0].str1 = IVL_DR_WEAK; }
3211 ()
3212 def p_clocking_event_opt_1(p):
3213 '''clocking_event_opt : event_control '''
3214 if(parse_debug): print('clocking_event_opt_1', list(p))
3215 ()
3216 def p_clocking_event_opt_2(p):
3217 '''clocking_event_opt : '''
3218 if(parse_debug): print('clocking_event_opt_2', list(p))
3219 ()
3220 def p_event_control_1(p):
3221 '''event_control : '@' hierarchy_identifier '''
3222 if(parse_debug): print('event_control_1', list(p))
3223 # { PEIdent*tmpi = new PEIdent(*p[2]);
3224 # PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi);
3225 # PEventStatement*tmps = new PEventStatement(tmpe);
3226 # FILE_NAME(tmps, @1);
3227 # p[0] = tmps;
3228 # delete p[2];
3229 # }
3230 ()
3231 def p_event_control_2(p):
3232 '''event_control : '@' '(' event_expression_list ')' '''
3233 if(parse_debug): print('event_control_2', list(p))
3234 # { PEventStatement*tmp = new PEventStatement(*p[3]);
3235 # FILE_NAME(tmp, @1);
3236 # delete p[3];
3237 # p[0] = tmp;
3238 # }
3239 ()
3240 def p_event_control_3(p):
3241 '''event_control : '@' '(' error ')' '''
3242 if(parse_debug): print('event_control_3', list(p))
3243 # { yyerror(@1, "error: Malformed event control expression.");
3244 # p[0] = None
3245 # }
3246 ()
3247 def p_event_expression_list_1(p):
3248 '''event_expression_list : event_expression '''
3249 if(parse_debug): print('event_expression_list_1', list(p))
3250 p[0] = p[1]
3251 ()
3252 def p_event_expression_list_2(p):
3253 '''event_expression_list : event_expression_list K_or event_expression '''
3254 if(parse_debug): print('event_expression_list_2', list(p))
3255 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
3256 # delete p[1];
3257 # delete p[3];
3258 # p[0] = tmp;
3259 # }
3260 ()
3261 def p_event_expression_list_3(p):
3262 '''event_expression_list : event_expression_list ',' event_expression '''
3263 if(parse_debug): print('event_expression_list_3', list(p))
3264 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
3265 # delete p[1];
3266 # delete p[3];
3267 # p[0] = tmp;
3268 # }
3269 ()
3270 def p_event_expression_1(p):
3271 '''event_expression : K_posedge expression '''
3272 if(parse_debug): print('event_expression_1', list(p))
3273 # { PEEvent*tmp = new PEEvent(PEEvent::POSEDGE, p[2]);
3274 # FILE_NAME(tmp, @1);
3275 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3276 # (*tl)[0] = tmp;
3277 # p[0] = tl;
3278 # }
3279 ()
3280 def p_event_expression_2(p):
3281 '''event_expression : K_negedge expression '''
3282 if(parse_debug): print('event_expression_2', list(p))
3283 # { PEEvent*tmp = new PEEvent(PEEvent::NEGEDGE, p[2]);
3284 # FILE_NAME(tmp, @1);
3285 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3286 # (*tl)[0] = tmp;
3287 # p[0] = tl;
3288 # }
3289 ()
3290 def p_event_expression_3(p):
3291 '''event_expression : expression '''
3292 if(parse_debug): print('event_expression_3', list(p))
3293 # { PEEvent*tmp = new PEEvent(PEEvent::ANYEDGE, p[1]);
3294 # FILE_NAME(tmp, @1);
3295 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3296 # (*tl)[0] = tmp;
3297 # p[0] = tl;
3298 # }
3299 ()
3300 def p_branch_probe_expression_1(p):
3301 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ',' IDENTIFIER ')' '''
3302 if(parse_debug): print('branch_probe_expression_1', list(p))
3303 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3], p[5]); }
3304 ()
3305 def p_branch_probe_expression_2(p):
3306 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ')' '''
3307 if(parse_debug): print('branch_probe_expression_2', list(p))
3308 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3]); }
3309 ()
3310 def p_expression_1(p):
3311 '''expression : expr_primary_or_typename '''
3312 if(parse_debug>2): print('expression_1', list(p))
3313 p[0] = p[1]
3314 ()
3315 def p_expression_2(p):
3316 '''expression : inc_or_dec_expression '''
3317 if(parse_debug): print('expression_2', list(p))
3318 p[0] = p[1]
3319 ()
3320 def p_expression_3(p):
3321 '''expression : inside_expression '''
3322 if(parse_debug): print('expression_3', list(p))
3323 p[0] = p[1]
3324 ()
3325 def p_expression_4(p):
3326 '''expression : '+' attribute_list_opt expr_primary %prec UNARY_PREC '''
3327 if(parse_debug): print('expression_4', list(p))
3328 p[0] = p[3]
3329 ()
3330 def p_expression_5(p):
3331 '''expression : '-' attribute_list_opt expr_primary %prec UNARY_PREC '''
3332 if(parse_debug): print('expression_5', list(p))
3333 # { PEUnary*tmp = new PEUnary('-', p[3]);
3334 # FILE_NAME(tmp, @3);
3335 # p[0] = tmp;
3336 # }
3337 ()
3338 def p_expression_6(p):
3339 '''expression : '~' attribute_list_opt expr_primary %prec UNARY_PREC '''
3340 if(parse_debug): print('expression_6', list(p))
3341 # { PEUnary*tmp = new PEUnary('~', p[3]);
3342 # FILE_NAME(tmp, @3);
3343 # p[0] = tmp;
3344 # }
3345 ()
3346 def p_expression_7(p):
3347 '''expression : '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3348 if(parse_debug): print('expression_7', list(p))
3349 # { PEUnary*tmp = new PEUnary('&', p[3]);
3350 # FILE_NAME(tmp, @3);
3351 # p[0] = tmp;
3352 # }
3353 ()
3354 def p_expression_8(p):
3355 '''expression : '!' attribute_list_opt expr_primary %prec UNARY_PREC '''
3356 if(parse_debug): print('expression_8', list(p))
3357 # { PEUnary*tmp = new PEUnary('!', p[3]);
3358 # FILE_NAME(tmp, @3);
3359 # p[0] = tmp;
3360 # }
3361 ()
3362 def p_expression_9(p):
3363 '''expression : '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3364 if(parse_debug): print('expression_9', list(p))
3365 # { PEUnary*tmp = new PEUnary('|', p[3]);
3366 # FILE_NAME(tmp, @3);
3367 # p[0] = tmp;
3368 # }
3369 ()
3370 def p_expression_10(p):
3371 '''expression : '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3372 if(parse_debug): print('expression_10', list(p))
3373 # { PEUnary*tmp = new PEUnary('^', p[3]);
3374 # FILE_NAME(tmp, @3);
3375 # p[0] = tmp;
3376 # }
3377 ()
3378 def p_expression_11(p):
3379 '''expression : '~' '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3380 if(parse_debug): print('expression_11', list(p))
3381 # { yyerror(@1, "error: '~' '&' is not a valid expression. "
3382 # "Please use operator '~&' instead.");
3383 # p[0] = None
3384 # }
3385 ()
3386 def p_expression_12(p):
3387 '''expression : '~' '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3388 if(parse_debug): print('expression_12', list(p))
3389 # { yyerror(@1, "error: '~' '|' is not a valid expression. "
3390 # "Please use operator '~|' instead.");
3391 # p[0] = None
3392 # }
3393 ()
3394 def p_expression_13(p):
3395 '''expression : '~' '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3396 if(parse_debug): print('expression_13', list(p))
3397 # { yyerror(@1, "error: '~' '^' is not a valid expression. "
3398 # "Please use operator '~^' instead.");
3399 # p[0] = None
3400 # }
3401 ()
3402 def p_expression_14(p):
3403 '''expression : K_NAND attribute_list_opt expr_primary %prec UNARY_PREC '''
3404 if(parse_debug): print('expression_14', list(p))
3405 # { PEUnary*tmp = new PEUnary('A', p[3]);
3406 # FILE_NAME(tmp, @3);
3407 # p[0] = tmp;
3408 # }
3409 ()
3410 def p_expression_15(p):
3411 '''expression : K_NOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3412 if(parse_debug): print('expression_15', list(p))
3413 # { PEUnary*tmp = new PEUnary('N', p[3]);
3414 # FILE_NAME(tmp, @3);
3415 # p[0] = tmp;
3416 # }
3417 ()
3418 def p_expression_16(p):
3419 '''expression : K_NXOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3420 if(parse_debug): print('expression_16', list(p))
3421 # { PEUnary*tmp = new PEUnary('X', p[3]);
3422 # FILE_NAME(tmp, @3);
3423 # p[0] = tmp;
3424 # }
3425 ()
3426 def p_expression_17(p):
3427 '''expression : '!' error %prec UNARY_PREC '''
3428 if(parse_debug): print('expression_17', list(p))
3429 # { yyerror(@1, "error: Operand of unary ! "
3430 # "is not a primary expression.");
3431 # p[0] = None
3432 # }
3433 ()
3434 def p_expression_18(p):
3435 '''expression : '^' error %prec UNARY_PREC '''
3436 if(parse_debug): print('expression_18', list(p))
3437 # { yyerror(@1, "error: Operand of reduction ^ "
3438 # "is not a primary expression.");
3439 # p[0] = None
3440 # }
3441 ()
3442 def p_expression_19(p):
3443 '''expression : expression '^' attribute_list_opt expression '''
3444 if(parse_debug): print('expression_19', list(p))
3445 # { PEBinary*tmp = new PEBinary('^', p[1], p[4]);
3446 # FILE_NAME(tmp, @2);
3447 # p[0] = tmp;
3448 # }
3449 ()
3450 def p_expression_20(p):
3451 '''expression : expression K_POW attribute_list_opt expression '''
3452 if(parse_debug): print('expression_20', list(p))
3453 # { PEBinary*tmp = new PEBPower('p', p[1], p[4]);
3454 # FILE_NAME(tmp, @2);
3455 # p[0] = tmp;
3456 # }
3457 ()
3458 def p_expression_21(p):
3459 '''expression : expression '*' attribute_list_opt expression '''
3460 if(parse_debug): print('expression_21', list(p))
3461 # { PEBinary*tmp = new PEBinary('*', p[1], p[4]);
3462 # FILE_NAME(tmp, @2);
3463 # p[0] = tmp;
3464 # }
3465 ()
3466 def p_expression_22(p):
3467 '''expression : expression '/' attribute_list_opt expression '''
3468 if(parse_debug): print('expression_22', list(p))
3469 # { PEBinary*tmp = new PEBinary('/', p[1], p[4]);
3470 # FILE_NAME(tmp, @2);
3471 # p[0] = tmp;
3472 # }
3473 ()
3474 def p_expression_23(p):
3475 '''expression : expression '%' attribute_list_opt expression '''
3476 if(parse_debug): print('expression_23', list(p))
3477 # { PEBinary*tmp = new PEBinary('%', p[1], p[4]);
3478 # FILE_NAME(tmp, @2);
3479 # p[0] = tmp;
3480 # }
3481 ()
3482 def p_expression_24(p):
3483 '''expression : expression '+' attribute_list_opt expression '''
3484 if(parse_debug): print('expression_24', list(p))
3485 # { PEBinary*tmp = new PEBinary('+', p[1], p[4]);
3486 # FILE_NAME(tmp, @2);
3487 # p[0] = tmp;
3488 # }
3489 ()
3490 def p_expression_25(p):
3491 '''expression : expression '-' attribute_list_opt expression '''
3492 if(parse_debug): print('expression_25', list(p))
3493 # { PEBinary*tmp = new PEBinary('-', p[1], p[4]);
3494 # FILE_NAME(tmp, @2);
3495 # p[0] = tmp;
3496 # }
3497 p[0] = Node(syms.atom, [p[1], Leaf(token.MINUS, '-'), p[4]])
3498 ()
3499 def p_expression_26(p):
3500 '''expression : expression '&' attribute_list_opt expression '''
3501 if(parse_debug): print('expression_26', list(p))
3502 # { PEBinary*tmp = new PEBinary('&', p[1], p[4]);
3503 # FILE_NAME(tmp, @2);
3504 # p[0] = tmp;
3505 # }
3506 ()
3507 def p_expression_27(p):
3508 '''expression : expression '|' attribute_list_opt expression '''
3509 if(parse_debug): print('expression_27', list(p))
3510 # { PEBinary*tmp = new PEBinary('|', p[1], p[4]);
3511 # FILE_NAME(tmp, @2);
3512 # p[0] = tmp;
3513 # }
3514 ()
3515 def p_expression_28(p):
3516 '''expression : expression K_NAND attribute_list_opt expression '''
3517 if(parse_debug): print('expression_28', list(p))
3518 # { PEBinary*tmp = new PEBinary('A', p[1], p[4]);
3519 # FILE_NAME(tmp, @2);
3520 # p[0] = tmp;
3521 # }
3522 ()
3523 def p_expression_29(p):
3524 '''expression : expression K_NOR attribute_list_opt expression '''
3525 if(parse_debug): print('expression_29', list(p))
3526 # { PEBinary*tmp = new PEBinary('O', p[1], p[4]);
3527 # FILE_NAME(tmp, @2);
3528 # p[0] = tmp;
3529 # }
3530 ()
3531 def p_expression_30(p):
3532 '''expression : expression K_NXOR attribute_list_opt expression '''
3533 if(parse_debug): print('expression_30', list(p))
3534 # { PEBinary*tmp = new PEBinary('X', p[1], p[4]);
3535 # FILE_NAME(tmp, @2);
3536 # p[0] = tmp;
3537 # }
3538 ()
3539 def p_expression_31(p):
3540 '''expression : expression '<' attribute_list_opt expression '''
3541 if(parse_debug): print('expression_31', list(p))
3542 # { PEBinary*tmp = new PEBComp('<', p[1], p[4]);
3543 # FILE_NAME(tmp, @2);
3544 # p[0] = tmp;
3545 # }
3546 ()
3547 def p_expression_32(p):
3548 '''expression : expression '>' attribute_list_opt expression '''
3549 if(parse_debug): print('expression_32', list(p))
3550 # { PEBinary*tmp = new PEBComp('>', p[1], p[4]);
3551 # FILE_NAME(tmp, @2);
3552 # p[0] = tmp;
3553 # }
3554 ()
3555 def p_expression_33(p):
3556 '''expression : expression K_LS attribute_list_opt expression '''
3557 if(parse_debug): print('expression_33', list(p))
3558 # { PEBinary*tmp = new PEBShift('l', p[1], p[4]);
3559 # FILE_NAME(tmp, @2);
3560 # p[0] = tmp;
3561 # }
3562 ()
3563 def p_expression_34(p):
3564 '''expression : expression K_RS attribute_list_opt expression '''
3565 if(parse_debug): print('expression_34', list(p))
3566 # { PEBinary*tmp = new PEBShift('r', p[1], p[4]);
3567 # FILE_NAME(tmp, @2);
3568 # p[0] = tmp;
3569 # }
3570 ()
3571 def p_expression_35(p):
3572 '''expression : expression K_RSS attribute_list_opt expression '''
3573 if(parse_debug): print('expression_35', list(p))
3574 # { PEBinary*tmp = new PEBShift('R', p[1], p[4]);
3575 # FILE_NAME(tmp, @2);
3576 # p[0] = tmp;
3577 # }
3578 ()
3579 def p_expression_36(p):
3580 '''expression : expression K_EQ attribute_list_opt expression '''
3581 if(parse_debug): print('expression_36', list(p))
3582 # { PEBinary*tmp = new PEBComp('e', p[1], p[4]);
3583 # FILE_NAME(tmp, @2);
3584 # p[0] = tmp;
3585 # }
3586 ()
3587 def p_expression_37(p):
3588 '''expression : expression K_CEQ attribute_list_opt expression '''
3589 if(parse_debug): print('expression_37', list(p))
3590 # { PEBinary*tmp = new PEBComp('E', p[1], p[4]);
3591 # FILE_NAME(tmp, @2);
3592 # p[0] = tmp;
3593 # }
3594 ()
3595 def p_expression_38(p):
3596 '''expression : expression K_WEQ attribute_list_opt expression '''
3597 if(parse_debug): print('expression_38', list(p))
3598 # { PEBinary*tmp = new PEBComp('w', p[1], p[4]);
3599 # FILE_NAME(tmp, @2);
3600 # p[0] = tmp;
3601 # }
3602 ()
3603 def p_expression_39(p):
3604 '''expression : expression K_LE attribute_list_opt expression '''
3605 if(parse_debug): print('expression_39', list(p))
3606 # { PEBinary*tmp = new PEBComp('L', p[1], p[4]);
3607 # FILE_NAME(tmp, @2);
3608 # p[0] = tmp;
3609 # }
3610 ()
3611 def p_expression_40(p):
3612 '''expression : expression K_GE attribute_list_opt expression '''
3613 if(parse_debug): print('expression_40', list(p))
3614 # { PEBinary*tmp = new PEBComp('G', p[1], p[4]);
3615 # FILE_NAME(tmp, @2);
3616 # p[0] = tmp;
3617 # }
3618 ()
3619 def p_expression_41(p):
3620 '''expression : expression K_NE attribute_list_opt expression '''
3621 if(parse_debug): print('expression_41', list(p))
3622 # { PEBinary*tmp = new PEBComp('n', p[1], p[4]);
3623 # FILE_NAME(tmp, @2);
3624 # p[0] = tmp;
3625 # }
3626 ()
3627 def p_expression_42(p):
3628 '''expression : expression K_CNE attribute_list_opt expression '''
3629 if(parse_debug): print('expression_42', list(p))
3630 # { PEBinary*tmp = new PEBComp('N', p[1], p[4]);
3631 # FILE_NAME(tmp, @2);
3632 # p[0] = tmp;
3633 # }
3634 ()
3635 def p_expression_43(p):
3636 '''expression : expression K_WNE attribute_list_opt expression '''
3637 if(parse_debug): print('expression_43', list(p))
3638 # { PEBinary*tmp = new PEBComp('W', p[1], p[4]);
3639 # FILE_NAME(tmp, @2);
3640 # p[0] = tmp;
3641 # }
3642 ()
3643 def p_expression_44(p):
3644 '''expression : expression K_LOR attribute_list_opt expression '''
3645 if(parse_debug): print('expression_44', list(p))
3646 # { PEBinary*tmp = new PEBLogic('o', p[1], p[4]);
3647 # FILE_NAME(tmp, @2);
3648 # p[0] = tmp;
3649 # }
3650 ()
3651 def p_expression_45(p):
3652 '''expression : expression K_LAND attribute_list_opt expression '''
3653 if(parse_debug): print('expression_45', list(p))
3654 # { PEBinary*tmp = new PEBLogic('a', p[1], p[4]);
3655 # FILE_NAME(tmp, @2);
3656 # p[0] = tmp;
3657 # }
3658 ()
3659 def p_expression_46(p):
3660 '''expression : expression '?' attribute_list_opt expression ':' expression '''
3661 if(parse_debug): print('expression_46', list(p))
3662 # { PETernary*tmp = new PETernary(p[1], p[4], p[6]);
3663 # FILE_NAME(tmp, @2);
3664 # p[0] = tmp;
3665 # }
3666 ()
3667 def p_expr_mintypmax_1(p):
3668 '''expr_mintypmax : expression '''
3669 if(parse_debug): print('expr_mintypmax_1', list(p))
3670 p[0] = p[1]
3671 ()
3672 def p_expr_mintypmax_2(p):
3673 '''expr_mintypmax : expression ':' expression ':' expression '''
3674 if(parse_debug): print('expr_mintypmax_2', list(p))
3675 # { switch (min_typ_max_flag) {
3676 # case MIN:
3677 # p[0] = p[1];
3678 # delete p[3];
3679 # delete p[5];
3680 # break;
3681 # case TYP:
3682 # delete p[1];
3683 # p[0] = p[3];
3684 # delete p[5];
3685 # break;
3686 # case MAX:
3687 # delete p[1];
3688 # delete p[3];
3689 # p[0] = p[5];
3690 # break;
3691 # }
3692 # if (min_typ_max_warn > 0) {
3693 # cerr << p[0]->get_fileline() << ": warning: choosing ";
3694 # switch (min_typ_max_flag) {
3695 # case MIN:
3696 # cerr << "min";
3697 # break;
3698 # case TYP:
3699 # cerr << "typ";
3700 # break;
3701 # case MAX:
3702 # cerr << "max";
3703 # break;
3704 # }
3705 # cerr << " expression." << endl;
3706 # min_typ_max_warn -= 1;
3707 # }
3708 # }
3709 ()
3710 def p_expression_list_with_nuls_1(p):
3711 '''expression_list_with_nuls : expression_list_with_nuls ',' expression '''
3712 if(parse_debug): print('expression_list_with_nuls_1', list(p))
3713 # { list<PExpr*>*tmp = p[1];
3714 # tmp->push_back(p[3]);
3715 # p[0] = tmp;
3716 # }
3717 ()
3718 def p_expression_list_with_nuls_2(p):
3719 '''expression_list_with_nuls : expression '''
3720 if(parse_debug): print('expression_list_with_nuls_2', list(p))
3721 # { list<PExpr*>*tmp = new list<PExpr*>;
3722 # tmp->push_back(p[1]);
3723 # p[0] = tmp;
3724 # }
3725 ()
3726 def p_expression_list_with_nuls_3(p):
3727 '''expression_list_with_nuls : '''
3728 if(parse_debug): print('expression_list_with_nuls_3', list(p))
3729 # { list<PExpr*>*tmp = new list<PExpr*>;
3730 # tmp->push_back(0);
3731 # p[0] = tmp;
3732 # }
3733 ()
3734 def p_expression_list_with_nuls_4(p):
3735 '''expression_list_with_nuls : expression_list_with_nuls ',' '''
3736 if(parse_debug): print('expression_list_with_nuls_4', list(p))
3737 # { list<PExpr*>*tmp = p[1];
3738 # tmp->push_back(0);
3739 # p[0] = tmp;
3740 # }
3741 ()
3742 def p_expression_list_proper_1(p):
3743 '''expression_list_proper : expression_list_proper ',' expression '''
3744 if(parse_debug): print('expression_list_proper_1', list(p))
3745 # { list<PExpr*>*tmp = p[1];
3746 # tmp->push_back(p[3]);
3747 # p[0] = tmp;
3748 # }
3749 ()
3750 def p_expression_list_proper_2(p):
3751 '''expression_list_proper : expression '''
3752 if(parse_debug): print('expression_list_proper_2', list(p))
3753 # { list<PExpr*>*tmp = new list<PExpr*>;
3754 # tmp->push_back(p[1]);
3755 # p[0] = tmp;
3756 # }
3757 ()
3758 def p_expr_primary_or_typename_1(p):
3759 '''expr_primary_or_typename : expr_primary '''
3760 if(parse_debug>2): print('expr_primary_or_typename_1', list(p))
3761 p[0] = p[1]
3762 ()
3763 def p_expr_primary_or_typename_2(p):
3764 '''expr_primary_or_typename : TYPE_IDENTIFIER '''
3765 if(parse_debug): print('expr_primary_or_typename_2', list(p))
3766 p[0] = p[1]
3767 # { PETypename*tmp = new PETypename(p[1].type);
3768 # FILE_NAME(tmp,@1);
3769 # p[0] = tmp;
3770 # delete[]p[1].text;
3771 # }
3772 ()
3773 def p_expr_primary_1(p):
3774 '''expr_primary : number '''
3775 if(parse_debug): print('expr_primary_1', list(p))
3776 p[0] = p[1]
3777 # { assert(p[1]);
3778 # PENumber*tmp = new PENumber(p[1]);
3779 # FILE_NAME(tmp, @1);
3780 # p[0] = tmp;
3781 # }
3782 ()
3783 def p_expr_primary_2(p):
3784 '''expr_primary : REALTIME '''
3785 if(parse_debug): print('expr_primary_2', list(p))
3786 # { PEFNumber*tmp = new PEFNumber(p[1]);
3787 # FILE_NAME(tmp, @1);
3788 # p[0] = tmp;
3789 # }
3790 ()
3791 def p_expr_primary_3(p):
3792 '''expr_primary : STRING '''
3793 if(parse_debug): print('expr_primary_3', list(p))
3794 # { PEString*tmp = new PEString(p[1]);
3795 # FILE_NAME(tmp, @1);
3796 # p[0] = tmp;
3797 # }
3798 ()
3799 def p_expr_primary_4(p):
3800 '''expr_primary : TIME_LITERAL '''
3801 if(parse_debug): print('expr_primary_4', list(p))
3802 # { int unit;
3803 #
3804 # based_size = 0;
3805 # p[0] = 0;
3806 # if (p[1] == 0 || !get_time_unit(p[1], unit))
3807 # yyerror(@1, "internal error: delay.");
3808 # else {
3809 # double p = pow(10.0, (double)(unit - pform_get_timeunit()));
3810 # double time = atof(p[1]) * p;
3811 #
3812 # verireal *v = new verireal(time);
3813 # p[0] = new PEFNumber(v);
3814 # FILE_NAME(p[0], @1);
3815 # }
3816 # }
3817 ()
3818 def p_expr_primary_5(p):
3819 '''expr_primary : SYSTEM_IDENTIFIER '''
3820 if(parse_debug): print('expr_primary_5', list(p))
3821 # { perm_string tn = lex_strings.make(p[1]);
3822 # PECallFunction*tmp = new PECallFunction(tn);
3823 # FILE_NAME(tmp, @1);
3824 # p[0] = tmp;
3825 # delete[]p[1];
3826 # }
3827 ()
3828 def p_expr_primary_6(p):
3829 '''expr_primary : hierarchy_identifier '''
3830 if(parse_debug>2): print('expr_primary_6', list(p))
3831 p[0] = p[1]
3832 # { PEIdent*tmp = pform_new_ident(*p[1]);
3833 # FILE_NAME(tmp, @1);
3834 # p[0] = tmp;
3835 # delete p[1];
3836 # }
3837 ()
3838 def p_expr_primary_7(p):
3839 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier '''
3840 if(parse_debug): print('expr_primary_7', list(p))
3841 # { p[0] = pform_package_ident(@2, p[1], p[3]);
3842 # delete p[3];
3843 # }
3844 ()
3845 def p_expr_primary_8(p):
3846 '''expr_primary : hierarchy_identifier '(' expression_list_with_nuls ')' '''
3847 if(parse_debug): print('expr_primary_8', list(p))
3848 # { list<PExpr*>*expr_list = p[3];
3849 # strip_tail_items(expr_list);
3850 # PECallFunction*tmp = pform_make_call_function(@1, *p[1], *expr_list);
3851 # delete p[1];
3852 # p[0] = tmp;
3853 # }
3854 ()
3855 def p_expr_primary_9(p):
3856 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' '''
3857 if(parse_debug): print('expr_primary_9', list(p))
3858 # { pform_name_t*t_name = p[1];
3859 # while (! p[3]->empty()) {
3860 # t_name->push_back(p[3]->front());
3861 # p[3]->pop_front();
3862 # }
3863 # list<PExpr*>*expr_list = p[5];
3864 # strip_tail_items(expr_list);
3865 # PECallFunction*tmp = pform_make_call_function(@1, *t_name, *expr_list);
3866 # delete p[1];
3867 # delete p[3];
3868 # p[0] = tmp;
3869 # }
3870 ()
3871 def p_expr_primary_10(p):
3872 '''expr_primary : SYSTEM_IDENTIFIER '(' expression_list_proper ')' '''
3873 if(parse_debug): print('expr_primary_10', list(p))
3874 # { perm_string tn = lex_strings.make(p[1]);
3875 # PECallFunction*tmp = new PECallFunction(tn, *p[3]);
3876 # FILE_NAME(tmp, @1);
3877 # delete[]p[1];
3878 # p[0] = tmp;
3879 # }
3880 ()
3881 def p_expr_primary_11(p):
3882 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')' '''
3883 if(parse_debug): print('expr_primary_11', list(p))
3884 # { perm_string use_name = lex_strings.make(p[3]);
3885 # PECallFunction*tmp = new PECallFunction(p[1], use_name, *p[5]);
3886 # FILE_NAME(tmp, @3);
3887 # delete[]p[3];
3888 # p[0] = tmp;
3889 # }
3890 ()
3891 def p_expr_primary_12(p):
3892 '''expr_primary : SYSTEM_IDENTIFIER '(' ')' '''
3893 if(parse_debug): print('expr_primary_12', list(p))
3894 # { perm_string tn = lex_strings.make(p[1]);
3895 # const vector<PExpr*>empty;
3896 # PECallFunction*tmp = new PECallFunction(tn, empty);
3897 # FILE_NAME(tmp, @1);
3898 # delete[]p[1];
3899 # p[0] = tmp;
3900 # if (!gn_system_verilog()) {
3901 # yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
3902 # }
3903 # }
3904 ()
3905 def p_expr_primary_13(p):
3906 '''expr_primary : implicit_class_handle '''
3907 if(parse_debug): print('expr_primary_13', list(p))
3908 # { PEIdent*tmp = new PEIdent(*p[1]);
3909 # FILE_NAME(tmp,@1);
3910 # delete p[1];
3911 # p[0] = tmp;
3912 # }
3913 ()
3914 def p_expr_primary_14(p):
3915 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '''
3916 if(parse_debug): print('expr_primary_14', list(p))
3917 # { pform_name_t*t_name = p[1];
3918 # while (! p[3]->empty()) {
3919 # t_name->push_back(p[3]->front());
3920 # p[3]->pop_front();
3921 # }
3922 # PEIdent*tmp = new PEIdent(*t_name);
3923 # FILE_NAME(tmp,@1);
3924 # delete p[1];
3925 # delete p[3];
3926 # p[0] = tmp;
3927 # }
3928 ()
3929 def p_expr_primary_15(p):
3930 '''expr_primary : K_acos '(' expression ')' '''
3931 if(parse_debug): print('expr_primary_15', list(p))
3932 # { perm_string tn = perm_string::literal("$acos");
3933 # PECallFunction*tmp = make_call_function(tn, p[3]);
3934 # FILE_NAME(tmp,@1);
3935 # p[0] = tmp;
3936 # }
3937 ()
3938 def p_expr_primary_16(p):
3939 '''expr_primary : K_acosh '(' expression ')' '''
3940 if(parse_debug): print('expr_primary_16', list(p))
3941 # { perm_string tn = perm_string::literal("$acosh");
3942 # PECallFunction*tmp = make_call_function(tn, p[3]);
3943 # FILE_NAME(tmp,@1);
3944 # p[0] = tmp;
3945 # }
3946 ()
3947 def p_expr_primary_17(p):
3948 '''expr_primary : K_asin '(' expression ')' '''
3949 if(parse_debug): print('expr_primary_17', list(p))
3950 # { perm_string tn = perm_string::literal("$asin");
3951 # PECallFunction*tmp = make_call_function(tn, p[3]);
3952 # FILE_NAME(tmp,@1);
3953 # p[0] = tmp;
3954 # }
3955 ()
3956 def p_expr_primary_18(p):
3957 '''expr_primary : K_asinh '(' expression ')' '''
3958 if(parse_debug): print('expr_primary_18', list(p))
3959 # { perm_string tn = perm_string::literal("$asinh");
3960 # PECallFunction*tmp = make_call_function(tn, p[3]);
3961 # FILE_NAME(tmp,@1);
3962 # p[0] = tmp;
3963 # }
3964 ()
3965 def p_expr_primary_19(p):
3966 '''expr_primary : K_atan '(' expression ')' '''
3967 if(parse_debug): print('expr_primary_19', list(p))
3968 # { perm_string tn = perm_string::literal("$atan");
3969 # PECallFunction*tmp = make_call_function(tn, p[3]);
3970 # FILE_NAME(tmp,@1);
3971 # p[0] = tmp;
3972 # }
3973 ()
3974 def p_expr_primary_20(p):
3975 '''expr_primary : K_atanh '(' expression ')' '''
3976 if(parse_debug): print('expr_primary_20', list(p))
3977 # { perm_string tn = perm_string::literal("$atanh");
3978 # PECallFunction*tmp = make_call_function(tn, p[3]);
3979 # FILE_NAME(tmp,@1);
3980 # p[0] = tmp;
3981 # }
3982 ()
3983 def p_expr_primary_21(p):
3984 '''expr_primary : K_atan2 '(' expression ',' expression ')' '''
3985 if(parse_debug): print('expr_primary_21', list(p))
3986 # { perm_string tn = perm_string::literal("$atan2");
3987 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
3988 # FILE_NAME(tmp,@1);
3989 # p[0] = tmp;
3990 # }
3991 ()
3992 def p_expr_primary_22(p):
3993 '''expr_primary : K_ceil '(' expression ')' '''
3994 if(parse_debug): print('expr_primary_22', list(p))
3995 # { perm_string tn = perm_string::literal("$ceil");
3996 # PECallFunction*tmp = make_call_function(tn, p[3]);
3997 # FILE_NAME(tmp,@1);
3998 # p[0] = tmp;
3999 # }
4000 ()
4001 def p_expr_primary_23(p):
4002 '''expr_primary : K_cos '(' expression ')' '''
4003 if(parse_debug): print('expr_primary_23', list(p))
4004 # { perm_string tn = perm_string::literal("$cos");
4005 # PECallFunction*tmp = make_call_function(tn, p[3]);
4006 # FILE_NAME(tmp,@1);
4007 # p[0] = tmp;
4008 # }
4009 ()
4010 def p_expr_primary_24(p):
4011 '''expr_primary : K_cosh '(' expression ')' '''
4012 if(parse_debug): print('expr_primary_24', list(p))
4013 # { perm_string tn = perm_string::literal("$cosh");
4014 # PECallFunction*tmp = make_call_function(tn, p[3]);
4015 # FILE_NAME(tmp,@1);
4016 # p[0] = tmp;
4017 # }
4018 ()
4019 def p_expr_primary_25(p):
4020 '''expr_primary : K_exp '(' expression ')' '''
4021 if(parse_debug): print('expr_primary_25', list(p))
4022 # { perm_string tn = perm_string::literal("$exp");
4023 # PECallFunction*tmp = make_call_function(tn, p[3]);
4024 # FILE_NAME(tmp,@1);
4025 # p[0] = tmp;
4026 # }
4027 ()
4028 def p_expr_primary_26(p):
4029 '''expr_primary : K_floor '(' expression ')' '''
4030 if(parse_debug): print('expr_primary_26', list(p))
4031 # { perm_string tn = perm_string::literal("$floor");
4032 # PECallFunction*tmp = make_call_function(tn, p[3]);
4033 # FILE_NAME(tmp,@1);
4034 # p[0] = tmp;
4035 # }
4036 ()
4037 def p_expr_primary_27(p):
4038 '''expr_primary : K_hypot '(' expression ',' expression ')' '''
4039 if(parse_debug): print('expr_primary_27', list(p))
4040 # { perm_string tn = perm_string::literal("$hypot");
4041 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
4042 # FILE_NAME(tmp,@1);
4043 # p[0] = tmp;
4044 # }
4045 ()
4046 def p_expr_primary_28(p):
4047 '''expr_primary : K_ln '(' expression ')' '''
4048 if(parse_debug): print('expr_primary_28', list(p))
4049 # { perm_string tn = perm_string::literal("$ln");
4050 # PECallFunction*tmp = make_call_function(tn, p[3]);
4051 # FILE_NAME(tmp,@1);
4052 # p[0] = tmp;
4053 # }
4054 ()
4055 def p_expr_primary_29(p):
4056 '''expr_primary : K_log '(' expression ')' '''
4057 if(parse_debug): print('expr_primary_29', list(p))
4058 # { perm_string tn = perm_string::literal("$log10");
4059 # PECallFunction*tmp = make_call_function(tn, p[3]);
4060 # FILE_NAME(tmp,@1);
4061 # p[0] = tmp;
4062 # }
4063 ()
4064 def p_expr_primary_30(p):
4065 '''expr_primary : K_pow '(' expression ',' expression ')' '''
4066 if(parse_debug): print('expr_primary_30', list(p))
4067 # { perm_string tn = perm_string::literal("$pow");
4068 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
4069 # FILE_NAME(tmp,@1);
4070 # p[0] = tmp;
4071 # }
4072 ()
4073 def p_expr_primary_31(p):
4074 '''expr_primary : K_sin '(' expression ')' '''
4075 if(parse_debug): print('expr_primary_31', list(p))
4076 # { perm_string tn = perm_string::literal("$sin");
4077 # PECallFunction*tmp = make_call_function(tn, p[3]);
4078 # FILE_NAME(tmp,@1);
4079 # p[0] = tmp;
4080 # }
4081 ()
4082 def p_expr_primary_32(p):
4083 '''expr_primary : K_sinh '(' expression ')' '''
4084 if(parse_debug): print('expr_primary_32', list(p))
4085 # { perm_string tn = perm_string::literal("$sinh");
4086 # PECallFunction*tmp = make_call_function(tn, p[3]);
4087 # FILE_NAME(tmp,@1);
4088 # p[0] = tmp;
4089 # }
4090 ()
4091 def p_expr_primary_33(p):
4092 '''expr_primary : K_sqrt '(' expression ')' '''
4093 if(parse_debug): print('expr_primary_33', list(p))
4094 # { perm_string tn = perm_string::literal("$sqrt");
4095 # PECallFunction*tmp = make_call_function(tn, p[3]);
4096 # FILE_NAME(tmp,@1);
4097 # p[0] = tmp;
4098 # }
4099 ()
4100 def p_expr_primary_34(p):
4101 '''expr_primary : K_tan '(' expression ')' '''
4102 if(parse_debug): print('expr_primary_34', list(p))
4103 # { perm_string tn = perm_string::literal("$tan");
4104 # PECallFunction*tmp = make_call_function(tn, p[3]);
4105 # FILE_NAME(tmp,@1);
4106 # p[0] = tmp;
4107 # }
4108 ()
4109 def p_expr_primary_35(p):
4110 '''expr_primary : K_tanh '(' expression ')' '''
4111 if(parse_debug): print('expr_primary_35', list(p))
4112 # { perm_string tn = perm_string::literal("$tanh");
4113 # PECallFunction*tmp = make_call_function(tn, p[3]);
4114 # FILE_NAME(tmp,@1);
4115 # p[0] = tmp;
4116 # }
4117 ()
4118 def p_expr_primary_36(p):
4119 '''expr_primary : K_abs '(' expression ')' '''
4120 if(parse_debug): print('expr_primary_36', list(p))
4121 # { PEUnary*tmp = new PEUnary('m', p[3]);
4122 # FILE_NAME(tmp,@1);
4123 # p[0] = tmp;
4124 # }
4125 ()
4126 def p_expr_primary_37(p):
4127 '''expr_primary : K_max '(' expression ',' expression ')' '''
4128 if(parse_debug): print('expr_primary_37', list(p))
4129 # { PEBinary*tmp = new PEBinary('M', p[3], p[5]);
4130 # FILE_NAME(tmp,@1);
4131 # p[0] = tmp;
4132 # }
4133 ()
4134 def p_expr_primary_38(p):
4135 '''expr_primary : K_min '(' expression ',' expression ')' '''
4136 if(parse_debug): print('expr_primary_38', list(p))
4137 # { PEBinary*tmp = new PEBinary('m', p[3], p[5]);
4138 # FILE_NAME(tmp,@1);
4139 # p[0] = tmp;
4140 # }
4141 ()
4142 def p_expr_primary_39(p):
4143 '''expr_primary : '(' expr_mintypmax ')' '''
4144 if(parse_debug): print('expr_primary_39', list(p))
4145 p[0] = p[2]
4146 ()
4147 def p_expr_primary_40(p):
4148 '''expr_primary : '{' expression_list_proper '}' '''
4149 if(parse_debug): print('expr_primary_40', list(p))
4150 # { PEConcat*tmp = new PEConcat(*p[2]);
4151 # FILE_NAME(tmp, @1);
4152 # delete p[2];
4153 # p[0] = tmp;
4154 # }
4155 ()
4156 def p_expr_primary_41(p):
4157 '''expr_primary : '{' expression '{' expression_list_proper '}' '}' '''
4158 if(parse_debug): print('expr_primary_41', list(p))
4159 # { PExpr*rep = p[2];
4160 # PEConcat*tmp = new PEConcat(*p[4], rep);
4161 # FILE_NAME(tmp, @1);
4162 # delete p[4];
4163 # p[0] = tmp;
4164 # }
4165 ()
4166 def p_expr_primary_42(p):
4167 '''expr_primary : '{' expression '{' expression_list_proper '}' error '}' '''
4168 if(parse_debug): print('expr_primary_42', list(p))
4169 # { PExpr*rep = p[2];
4170 # PEConcat*tmp = new PEConcat(*p[4], rep);
4171 # FILE_NAME(tmp, @1);
4172 # delete p[4];
4173 # p[0] = tmp;
4174 # yyerror(@5, "error: Syntax error between internal '}' "
4175 # "and closing '}' of repeat concatenation.");
4176 # yyerrok;
4177 # }
4178 ()
4179 def p_expr_primary_43(p):
4180 '''expr_primary : '{' '}' '''
4181 if(parse_debug): print('expr_primary_43', list(p))
4182 # { // This is the empty queue syntax.
4183 # if (gn_system_verilog()) {
4184 # list<PExpr*> empty_list;
4185 # PEConcat*tmp = new PEConcat(empty_list);
4186 # FILE_NAME(tmp, @1);
4187 # p[0] = tmp;
4188 # } else {
4189 # yyerror(@1, "error: Concatenations are not allowed to be empty.");
4190 # p[0] = None
4191 # }
4192 # }
4193 ()
4194 def p_expr_primary_44(p):
4195 '''expr_primary : expr_primary "'" '(' expression ')' '''
4196 if(parse_debug): print('expr_primary_44', list(p))
4197 # { PExpr*base = p[4];
4198 # if (gn_system_verilog()) {
4199 # PECastSize*tmp = new PECastSize(p[1], base);
4200 # FILE_NAME(tmp, @1);
4201 # p[0] = tmp;
4202 # } else {
4203 # yyerror(@1, "error: Size cast requires SystemVerilog.");
4204 # p[0] = base;
4205 # }
4206 # }
4207 ()
4208 def p_expr_primary_45(p):
4209 '''expr_primary : simple_type_or_string "'" '(' expression ')' '''
4210 if(parse_debug): print('expr_primary_45', list(p))
4211 # { PExpr*base = p[4];
4212 # if (gn_system_verilog()) {
4213 # PECastType*tmp = new PECastType(p[1], base);
4214 # FILE_NAME(tmp, @1);
4215 # p[0] = tmp;
4216 # } else {
4217 # yyerror(@1, "error: Type cast requires SystemVerilog.");
4218 # p[0] = base;
4219 # }
4220 # }
4221 ()
4222 def p_expr_primary_46(p):
4223 '''expr_primary : assignment_pattern '''
4224 if(parse_debug): print('expr_primary_46', list(p))
4225 p[0] = p[1]
4226 ()
4227 def p_expr_primary_47(p):
4228 '''expr_primary : streaming_concatenation '''
4229 if(parse_debug): print('expr_primary_47', list(p))
4230 p[0] = p[1]
4231 ()
4232 def p_expr_primary_48(p):
4233 '''expr_primary : K_null '''
4234 if(parse_debug): print('expr_primary_48', list(p))
4235 # { PENull*tmp = new PENull;
4236 # FILE_NAME(tmp, @1);
4237 # p[0] = tmp;
4238 # }
4239 ()
4240 def p_function_item_list_opt_1(p):
4241 '''function_item_list_opt : function_item_list '''
4242 if(parse_debug): print('function_item_list_opt_1', list(p))
4243 p[0] = p[1]
4244 ()
4245 def p_function_item_list_opt_2(p):
4246 '''function_item_list_opt : '''
4247 if(parse_debug): print('function_item_list_opt_2', list(p))
4248 # { p[0] = None }
4249 ()
4250 def p_function_item_list_1(p):
4251 '''function_item_list : function_item '''
4252 if(parse_debug): print('function_item_list_1', list(p))
4253 p[0] = p[1]
4254 ()
4255 def p_function_item_list_2(p):
4256 '''function_item_list : function_item_list function_item '''
4257 if(parse_debug): print('function_item_list_2', list(p))
4258 # { /* */
4259 # if (p[1] && p[2]) {
4260 # vector<pform_tf_port_t>*tmp = p[1];
4261 # size_t s1 = tmp->size();
4262 # tmp->resize(s1 + p[2]->size());
4263 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
4264 # tmp->at(s1+idx) = p[2]->at(idx);
4265 # delete p[2];
4266 # p[0] = tmp;
4267 # } else if (p[1]) {
4268 # p[0] = p[1];
4269 # } else {
4270 # p[0] = p[2];
4271 # }
4272 # }
4273 ()
4274 def p_function_item_1(p):
4275 '''function_item : tf_port_declaration '''
4276 if(parse_debug): print('function_item_1', list(p))
4277 p[0] = p[1]
4278 ()
4279 def p_function_item_2(p):
4280 '''function_item : block_item_decl '''
4281 if(parse_debug): print('function_item_2', list(p))
4282 # { p[0] = None }
4283 ()
4284 def p_gate_instance_1(p):
4285 '''gate_instance : IDENTIFIER '(' expression_list_with_nuls ')' '''
4286 if(parse_debug): print('gate_instance_1', list(p))
4287 # { lgate*tmp = new lgate;
4288 # tmp->name = p[1];
4289 # tmp->parms = p[3];
4290 # tmp->file = @1.text;
4291 # tmp->lineno = @1.first_line;
4292 # delete[]p[1];
4293 # p[0] = tmp;
4294 # }
4295 ()
4296 def p_gate_instance_2(p):
4297 '''gate_instance : IDENTIFIER dimensions '(' expression_list_with_nuls ')' '''
4298 if(parse_debug): print('gate_instance_2', list(p))
4299 # { lgate*tmp = new lgate;
4300 # list<pform_range_t>*rng = p[2];
4301 # tmp->name = p[1];
4302 # tmp->parms = p[4];
4303 # tmp->range = rng->front();
4304 # rng->pop_front();
4305 # assert(rng->empty());
4306 # tmp->file = @1.text;
4307 # tmp->lineno = @1.first_line;
4308 # delete[]p[1];
4309 # delete rng;
4310 # p[0] = tmp;
4311 # }
4312 ()
4313 def p_gate_instance_3(p):
4314 '''gate_instance : '(' expression_list_with_nuls ')' '''
4315 if(parse_debug): print('gate_instance_3', list(p))
4316 # { lgate*tmp = new lgate;
4317 # tmp->name = "";
4318 # tmp->parms = p[2];
4319 # tmp->file = @1.text;
4320 # tmp->lineno = @1.first_line;
4321 # p[0] = tmp;
4322 # }
4323 ()
4324 def p_gate_instance_4(p):
4325 '''gate_instance : IDENTIFIER dimensions '''
4326 if(parse_debug): print('gate_instance_4', list(p))
4327 # { lgate*tmp = new lgate;
4328 # list<pform_range_t>*rng = p[2];
4329 # tmp->name = p[1];
4330 # tmp->parms = 0;
4331 # tmp->parms_by_name = 0;
4332 # tmp->range = rng->front();
4333 # rng->pop_front();
4334 # assert(rng->empty());
4335 # tmp->file = @1.text;
4336 # tmp->lineno = @1.first_line;
4337 # delete[]p[1];
4338 # delete rng;
4339 # p[0] = tmp;
4340 # }
4341 ()
4342 def p_gate_instance_5(p):
4343 '''gate_instance : IDENTIFIER '(' port_name_list ')' '''
4344 if(parse_debug): print('gate_instance_5', list(p))
4345 # { lgate*tmp = new lgate;
4346 # tmp->name = p[1];
4347 # tmp->parms = 0;
4348 # tmp->parms_by_name = p[3];
4349 # tmp->file = @1.text;
4350 # tmp->lineno = @1.first_line;
4351 # delete[]p[1];
4352 # p[0] = tmp;
4353 # }
4354 ()
4355 def p_gate_instance_6(p):
4356 '''gate_instance : IDENTIFIER dimensions '(' port_name_list ')' '''
4357 if(parse_debug): print('gate_instance_6', list(p))
4358 # { lgate*tmp = new lgate;
4359 # list<pform_range_t>*rng = p[2];
4360 # tmp->name = p[1];
4361 # tmp->parms = 0;
4362 # tmp->parms_by_name = p[4];
4363 # tmp->range = rng->front();
4364 # rng->pop_front();
4365 # assert(rng->empty());
4366 # tmp->file = @1.text;
4367 # tmp->lineno = @1.first_line;
4368 # delete[]p[1];
4369 # delete rng;
4370 # p[0] = tmp;
4371 # }
4372 ()
4373 def p_gate_instance_7(p):
4374 '''gate_instance : IDENTIFIER '(' error ')' '''
4375 if(parse_debug): print('gate_instance_7', list(p))
4376 # { lgate*tmp = new lgate;
4377 # tmp->name = p[1];
4378 # tmp->parms = 0;
4379 # tmp->parms_by_name = 0;
4380 # tmp->file = @1.text;
4381 # tmp->lineno = @1.first_line;
4382 # yyerror(@2, "error: Syntax error in instance port "
4383 # "expression(s).");
4384 # delete[]p[1];
4385 # p[0] = tmp;
4386 # }
4387 ()
4388 def p_gate_instance_8(p):
4389 '''gate_instance : IDENTIFIER dimensions '(' error ')' '''
4390 if(parse_debug): print('gate_instance_8', list(p))
4391 # { lgate*tmp = new lgate;
4392 # tmp->name = p[1];
4393 # tmp->parms = 0;
4394 # tmp->parms_by_name = 0;
4395 # tmp->file = @1.text;
4396 # tmp->lineno = @1.first_line;
4397 # yyerror(@3, "error: Syntax error in instance port "
4398 # "expression(s).");
4399 # delete[]p[1];
4400 # p[0] = tmp;
4401 # }
4402 ()
4403 def p_gate_instance_list_1(p):
4404 '''gate_instance_list : gate_instance_list ',' gate_instance '''
4405 if(parse_debug): print('gate_instance_list_1', list(p))
4406 # { svector<lgate>*tmp1 = p[1];
4407 # lgate*tmp2 = p[3];
4408 # svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
4409 # delete tmp1;
4410 # delete tmp2;
4411 # p[0] = out;
4412 # }
4413 ()
4414 def p_gate_instance_list_2(p):
4415 '''gate_instance_list : gate_instance '''
4416 if(parse_debug): print('gate_instance_list_2', list(p))
4417 # { svector<lgate>*tmp = new svector<lgate>(1);
4418 # (*tmp)[0] = *p[1];
4419 # delete p[1];
4420 # p[0] = tmp;
4421 # }
4422 ()
4423 def p_gatetype_1(p):
4424 '''gatetype : K_and '''
4425 if(parse_debug): print('gatetype_1', list(p))
4426 # { p[0] = PGBuiltin::AND; }
4427 ()
4428 def p_gatetype_2(p):
4429 '''gatetype : K_nand '''
4430 if(parse_debug): print('gatetype_2', list(p))
4431 # { p[0] = PGBuiltin::NAND; }
4432 ()
4433 def p_gatetype_3(p):
4434 '''gatetype : K_or '''
4435 if(parse_debug): print('gatetype_3', list(p))
4436 # { p[0] = PGBuiltin::OR; }
4437 ()
4438 def p_gatetype_4(p):
4439 '''gatetype : K_nor '''
4440 if(parse_debug): print('gatetype_4', list(p))
4441 # { p[0] = PGBuiltin::NOR; }
4442 ()
4443 def p_gatetype_5(p):
4444 '''gatetype : K_xor '''
4445 if(parse_debug): print('gatetype_5', list(p))
4446 # { p[0] = PGBuiltin::XOR; }
4447 ()
4448 def p_gatetype_6(p):
4449 '''gatetype : K_xnor '''
4450 if(parse_debug): print('gatetype_6', list(p))
4451 # { p[0] = PGBuiltin::XNOR; }
4452 ()
4453 def p_gatetype_7(p):
4454 '''gatetype : K_buf '''
4455 if(parse_debug): print('gatetype_7', list(p))
4456 # { p[0] = PGBuiltin::BUF; }
4457 ()
4458 def p_gatetype_8(p):
4459 '''gatetype : K_bufif0 '''
4460 if(parse_debug): print('gatetype_8', list(p))
4461 # { p[0] = PGBuiltin::BUFIF0; }
4462 ()
4463 def p_gatetype_9(p):
4464 '''gatetype : K_bufif1 '''
4465 if(parse_debug): print('gatetype_9', list(p))
4466 # { p[0] = PGBuiltin::BUFIF1; }
4467 ()
4468 def p_gatetype_10(p):
4469 '''gatetype : K_not '''
4470 if(parse_debug): print('gatetype_10', list(p))
4471 # { p[0] = PGBuiltin::NOT; }
4472 ()
4473 def p_gatetype_11(p):
4474 '''gatetype : K_notif0 '''
4475 if(parse_debug): print('gatetype_11', list(p))
4476 # { p[0] = PGBuiltin::NOTIF0; }
4477 ()
4478 def p_gatetype_12(p):
4479 '''gatetype : K_notif1 '''
4480 if(parse_debug): print('gatetype_12', list(p))
4481 # { p[0] = PGBuiltin::NOTIF1; }
4482 ()
4483 def p_switchtype_1(p):
4484 '''switchtype : K_nmos '''
4485 if(parse_debug): print('switchtype_1', list(p))
4486 # { p[0] = PGBuiltin::NMOS; }
4487 ()
4488 def p_switchtype_2(p):
4489 '''switchtype : K_rnmos '''
4490 if(parse_debug): print('switchtype_2', list(p))
4491 # { p[0] = PGBuiltin::RNMOS; }
4492 ()
4493 def p_switchtype_3(p):
4494 '''switchtype : K_pmos '''
4495 if(parse_debug): print('switchtype_3', list(p))
4496 # { p[0] = PGBuiltin::PMOS; }
4497 ()
4498 def p_switchtype_4(p):
4499 '''switchtype : K_rpmos '''
4500 if(parse_debug): print('switchtype_4', list(p))
4501 # { p[0] = PGBuiltin::RPMOS; }
4502 ()
4503 def p_switchtype_5(p):
4504 '''switchtype : K_cmos '''
4505 if(parse_debug): print('switchtype_5', list(p))
4506 # { p[0] = PGBuiltin::CMOS; }
4507 ()
4508 def p_switchtype_6(p):
4509 '''switchtype : K_rcmos '''
4510 if(parse_debug): print('switchtype_6', list(p))
4511 # { p[0] = PGBuiltin::RCMOS; }
4512 ()
4513 def p_switchtype_7(p):
4514 '''switchtype : K_tran '''
4515 if(parse_debug): print('switchtype_7', list(p))
4516 # { p[0] = PGBuiltin::TRAN; }
4517 ()
4518 def p_switchtype_8(p):
4519 '''switchtype : K_rtran '''
4520 if(parse_debug): print('switchtype_8', list(p))
4521 # { p[0] = PGBuiltin::RTRAN; }
4522 ()
4523 def p_switchtype_9(p):
4524 '''switchtype : K_tranif0 '''
4525 if(parse_debug): print('switchtype_9', list(p))
4526 # { p[0] = PGBuiltin::TRANIF0; }
4527 ()
4528 def p_switchtype_10(p):
4529 '''switchtype : K_tranif1 '''
4530 if(parse_debug): print('switchtype_10', list(p))
4531 # { p[0] = PGBuiltin::TRANIF1; }
4532 ()
4533 def p_switchtype_11(p):
4534 '''switchtype : K_rtranif0 '''
4535 if(parse_debug): print('switchtype_11', list(p))
4536 # { p[0] = PGBuiltin::RTRANIF0; }
4537 ()
4538 def p_switchtype_12(p):
4539 '''switchtype : K_rtranif1 '''
4540 if(parse_debug): print('switchtype_12', list(p))
4541 # { p[0] = PGBuiltin::RTRANIF1; }
4542 ()
4543 def p_hierarchy_identifier_1(p):
4544 '''hierarchy_identifier : IDENTIFIER '''
4545 if(parse_debug): print('hierarchy_identifier_1 FIXME', list(p))
4546 lpvalue = Leaf(token.NAME, p[1])
4547 p[0] = lpvalue
4548 # { p[0] = new pform_name_t;
4549 # p[0]->push_back(name_component_t(lex_strings.make(p[1])));
4550 # delete[]p[1];
4551 # }
4552 ()
4553 def p_hierarchy_identifier_2(p):
4554 '''hierarchy_identifier : hierarchy_identifier '.' IDENTIFIER '''
4555 if(parse_debug): print('hierarchy_identifier_2', list(p))
4556 # { pform_name_t * tmp = p[1];
4557 # tmp->push_back(name_component_t(lex_strings.make(p[3])));
4558 # delete[]p[3];
4559 # p[0] = tmp;
4560 # }
4561 ()
4562 def p_hierarchy_identifier_3(p):
4563 '''hierarchy_identifier : hierarchy_identifier '[' expression ']' '''
4564 if(parse_debug): print('hierarchy_identifier_3', list(p))
4565 # { pform_name_t * tmp = p[1];
4566 # name_component_t&tail = tmp->back();
4567 # index_component_t itmp;
4568 # itmp.sel = index_component_t::SEL_BIT;
4569 # itmp.msb = p[3];
4570 # tail.index.push_back(itmp);
4571 # p[0] = tmp;
4572 # }
4573 ()
4574 def p_hierarchy_identifier_4(p):
4575 '''hierarchy_identifier : hierarchy_identifier '[' '$' ']' '''
4576 if(parse_debug): print('hierarchy_identifier_4', list(p))
4577 # { pform_name_t * tmp = p[1];
4578 # name_component_t&tail = tmp->back();
4579 # if (! gn_system_verilog()) {
4580 # yyerror(@3, "error: Last element expression ($) "
4581 # "requires SystemVerilog. Try enabling SystemVerilog.");
4582 # }
4583 # index_component_t itmp;
4584 # itmp.sel = index_component_t::SEL_BIT_LAST;
4585 # itmp.msb = 0;
4586 # itmp.lsb = 0;
4587 # tail.index.push_back(itmp);
4588 # p[0] = tmp;
4589 # }
4590 ()
4591 def p_hierarchy_identifier_5(p):
4592 '''hierarchy_identifier : hierarchy_identifier '[' expression ':' expression ']' '''
4593 if(parse_debug): print('hierarchy_identifier_5', list(p))
4594 # { pform_name_t * tmp = p[1];
4595 # name_component_t&tail = tmp->back();
4596 # index_component_t itmp;
4597 # itmp.sel = index_component_t::SEL_PART;
4598 # itmp.msb = p[3];
4599 # itmp.lsb = p[5];
4600 # tail.index.push_back(itmp);
4601 # p[0] = tmp;
4602 # }
4603 ()
4604 def p_hierarchy_identifier_6(p):
4605 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_POS expression ']' '''
4606 if(parse_debug): print('hierarchy_identifier_6', list(p))
4607 # { pform_name_t * tmp = p[1];
4608 # name_component_t&tail = tmp->back();
4609 # index_component_t itmp;
4610 # itmp.sel = index_component_t::SEL_IDX_UP;
4611 # itmp.msb = p[3];
4612 # itmp.lsb = p[5];
4613 # tail.index.push_back(itmp);
4614 # p[0] = tmp;
4615 # }
4616 ()
4617 def p_hierarchy_identifier_7(p):
4618 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_NEG expression ']' '''
4619 if(parse_debug): print('hierarchy_identifier_7', list(p))
4620 # { pform_name_t * tmp = p[1];
4621 # name_component_t&tail = tmp->back();
4622 # index_component_t itmp;
4623 # itmp.sel = index_component_t::SEL_IDX_DO;
4624 # itmp.msb = p[3];
4625 # itmp.lsb = p[5];
4626 # tail.index.push_back(itmp);
4627 # p[0] = tmp;
4628 # }
4629 ()
4630 def p_list_of_identifiers_1(p):
4631 '''list_of_identifiers : IDENTIFIER '''
4632 if(parse_debug): print('list_of_identifiers_1', list(p))
4633 # { p[0] = list_from_identifier(p[1]); }
4634 ()
4635 def p_list_of_identifiers_2(p):
4636 '''list_of_identifiers : list_of_identifiers ',' IDENTIFIER '''
4637 if(parse_debug): print('list_of_identifiers_2', list(p))
4638 # { p[0] = list_from_identifier(p[1], p[3]); }
4639 ()
4640 def p_list_of_port_identifiers_1(p):
4641 '''list_of_port_identifiers : IDENTIFIER dimensions_opt '''
4642 if(parse_debug): print('list_of_port_identifiers_1', list(p))
4643 # { p[0] = make_port_list(p[1], p[2], 0); }
4644 ()
4645 def p_list_of_port_identifiers_2(p):
4646 '''list_of_port_identifiers : list_of_port_identifiers ',' IDENTIFIER dimensions_opt '''
4647 if(parse_debug): print('list_of_port_identifiers_2', list(p))
4648 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
4649 ()
4650 def p_list_of_variable_port_identifiers_1(p):
4651 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '''
4652 if(parse_debug): print('list_of_variable_port_identifiers_1', list(p))
4653 # { p[0] = make_port_list(p[1], p[2], 0); }
4654 ()
4655 def p_list_of_variable_port_identifiers_2(p):
4656 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '=' expression '''
4657 if(parse_debug): print('list_of_variable_port_identifiers_2', list(p))
4658 # { p[0] = make_port_list(p[1], p[2], p[4]); }
4659 ()
4660 def p_list_of_variable_port_identifiers_3(p):
4661 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '''
4662 if(parse_debug): print('list_of_variable_port_identifiers_3', list(p))
4663 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
4664 ()
4665 def p_list_of_variable_port_identifiers_4(p):
4666 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '=' expression '''
4667 if(parse_debug): print('list_of_variable_port_identifiers_4', list(p))
4668 # { p[0] = make_port_list(p[1], p[3], p[4], p[6]); }
4669 ()
4670 def p_list_of_ports_1(p):
4671 '''list_of_ports : port_opt '''
4672 if(parse_debug): print('list_of_ports_1', list(p))
4673 # { vector<Module::port_t*>*tmp
4674 # = new vector<Module::port_t*>(1);
4675 # (*tmp)[0] = p[1];
4676 # p[0] = tmp;
4677 # }
4678 ()
4679 def p_list_of_ports_2(p):
4680 '''list_of_ports : list_of_ports ',' port_opt '''
4681 if(parse_debug): print('list_of_ports_2', list(p))
4682 # { vector<Module::port_t*>*tmp = p[1];
4683 # tmp->push_back(p[3]);
4684 # p[0] = tmp;
4685 # }
4686 ()
4687 def p_list_of_port_declarations_1(p):
4688 '''list_of_port_declarations : port_declaration '''
4689 if(parse_debug>1): print('list_of_port_declarations_1', list(p))
4690 p[0] = [p[1]]
4691 # { vector<Module::port_t*>*tmp
4692 # = new vector<Module::port_t*>(1);
4693 # (*tmp)[0] = p[1];
4694 # p[0] = tmp;
4695 # }
4696 ()
4697 def p_list_of_port_declarations_2(p):
4698 '''list_of_port_declarations : list_of_port_declarations ',' port_declaration '''
4699 if(parse_debug): print('list_of_port_declarations_2 FIXME', list(p))
4700 # MOVE_TO absyn p[1].append(Leaf(token.NEWLINE, '\n')) # should be a comma
4701 # XXX p[3].prefix=' ' # add a space after the NL, must go in parameter
4702 p[1].append(p[3])
4703 p[0] = p[1]
4704 # { vector<Module::port_t*>*tmp = p[1];
4705 # tmp->push_back(p[3]);
4706 # p[0] = tmp;
4707 # }
4708 ()
4709 def p_list_of_port_declarations_3(p):
4710 '''list_of_port_declarations : list_of_port_declarations ',' IDENTIFIER '''
4711 if(parse_debug): print('list_of_port_declarations_3', list(p))
4712 # { Module::port_t*ptmp;
4713 # perm_string name = lex_strings.make(p[3]);
4714 # ptmp = pform_module_port_reference(name, @3.text,
4715 # @3.first_line);
4716 # vector<Module::port_t*>*tmp = p[1];
4717 # tmp->push_back(ptmp);
4718 #
4719 # /* Get the port declaration details, the port type
4720 # and what not, from context data stored by the
4721 # last port_declaration rule. */
4722 # pform_module_define_port(@3, name,
4723 # port_declaration_context.port_type,
4724 # port_declaration_context.port_net_type,
4725 # port_declaration_context.data_type, 0);
4726 # delete[]p[3];
4727 # p[0] = tmp;
4728 # }
4729 ()
4730 def p_list_of_port_declarations_4(p):
4731 '''list_of_port_declarations : list_of_port_declarations ',' '''
4732 if(parse_debug): print('list_of_port_declarations_4', list(p))
4733 # {
4734 # yyerror(@2, "error: NULL port declarations are not "
4735 # "allowed.");
4736 # }
4737 ()
4738 def p_list_of_port_declarations_5(p):
4739 '''list_of_port_declarations : list_of_port_declarations ';' '''
4740 if(parse_debug): print('list_of_port_declarations_5', list(p))
4741 # {
4742 # yyerror(@2, "error: ';' is an invalid port declaration "
4743 # "separator.");
4744 # }
4745 ()
4746 def p_port_declaration_1(p):
4747 '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4748 if(parse_debug): print('port_declaration_1 FIXME', list(p))
4749 comment, dt, name = p[2], p[4], p[5]
4750 p[0] = absyn.port_decl(comment, dt, name)
4751 # { Module::port_t*ptmp;
4752 # perm_string name = lex_strings.make(p[5]);
4753 # data_type_t*use_type = p[4];
4754 # if (p[6]) use_type = new uarray_type_t(use_type, p[6]);
4755 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4756 # pform_module_define_port(@2, name, NetNet::PINPUT, p[3], use_type, p[1]);
4757 # port_declaration_context.port_type = NetNet::PINPUT;
4758 # port_declaration_context.port_net_type = p[3];
4759 # port_declaration_context.data_type = p[4];
4760 # delete[]p[5];
4761 # p[0] = ptmp;
4762 # }
4763 ()
4764 def p_port_declaration_2(p):
4765 '''port_declaration : attribute_list_opt K_input K_wreal IDENTIFIER '''
4766 if(parse_debug): print('port_declaration_2', list(p))
4767 # { Module::port_t*ptmp;
4768 # perm_string name = lex_strings.make(p[4]);
4769 # ptmp = pform_module_port_reference(name, @2.text,
4770 # @2.first_line);
4771 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4772 # FILE_NAME(real_type, @3);
4773 # pform_module_define_port(@2, name, NetNet::PINPUT,
4774 # NetNet::WIRE, real_type, p[1]);
4775 # port_declaration_context.port_type = NetNet::PINPUT;
4776 # port_declaration_context.port_net_type = NetNet::WIRE;
4777 # port_declaration_context.data_type = real_type;
4778 # delete[]p[4];
4779 # p[0] = ptmp;
4780 # }
4781 ()
4782 def p_port_declaration_3(p):
4783 '''port_declaration : attribute_list_opt K_inout net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4784 if(parse_debug): print('port_declaration_3', list(p))
4785 # { Module::port_t*ptmp;
4786 # perm_string name = lex_strings.make(p[5]);
4787 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4788 # pform_module_define_port(@2, name, NetNet::PINOUT, p[3], p[4], p[1]);
4789 # port_declaration_context.port_type = NetNet::PINOUT;
4790 # port_declaration_context.port_net_type = p[3];
4791 # port_declaration_context.data_type = p[4];
4792 # delete[]p[5];
4793 # if (p[6]) {
4794 # yyerror(@6, "sorry: Inout ports with unpacked dimensions not supported.");
4795 # delete p[6];
4796 # }
4797 # p[0] = ptmp;
4798 # }
4799 ()
4800 def p_port_declaration_4(p):
4801 '''port_declaration : attribute_list_opt K_inout K_wreal IDENTIFIER '''
4802 if(parse_debug): print('port_declaration_4', list(p))
4803 # { Module::port_t*ptmp;
4804 # perm_string name = lex_strings.make(p[4]);
4805 # ptmp = pform_module_port_reference(name, @2.text,
4806 # @2.first_line);
4807 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4808 # FILE_NAME(real_type, @3);
4809 # pform_module_define_port(@2, name, NetNet::PINOUT,
4810 # NetNet::WIRE, real_type, p[1]);
4811 # port_declaration_context.port_type = NetNet::PINOUT;
4812 # port_declaration_context.port_net_type = NetNet::WIRE;
4813 # port_declaration_context.data_type = real_type;
4814 # delete[]p[4];
4815 # p[0] = ptmp;
4816 # }
4817 ()
4818 def p_port_declaration_5(p):
4819 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4820 if(parse_debug): print('port_declaration_5 FIXME', list(p))
4821 comment, dt, name = p[2], p[4], p[5]
4822 p[0] = absyn.port_decl(comment, dt, name)
4823 # { Module::port_t*ptmp;
4824 # perm_string name = lex_strings.make(p[5]);
4825 # data_type_t*use_dtype = p[4];
4826 # if (p[6]) use_dtype = new uarray_type_t(use_dtype, p[6]);
4827 # NetNet::Type use_type = p[3];
4828 # if (use_type == NetNet::IMPLICIT) {
4829 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
4830 # if (dtype->reg_flag)
4831 # use_type = NetNet::REG;
4832 # else if (dtype->implicit_flag)
4833 # use_type = NetNet::IMPLICIT;
4834 # else
4835 # use_type = NetNet::IMPLICIT_REG;
4836 #
4837 # // The SystemVerilog types that can show up as
4838 # // output ports are implicitly (on the inside)
4839 # // variables because "reg" is not valid syntax
4840 # // here.
4841 # } else if (dynamic_cast<atom2_type_t*> (p[4])) {
4842 # use_type = NetNet::IMPLICIT_REG;
4843 # } else if (dynamic_cast<struct_type_t*> (p[4])) {
4844 # use_type = NetNet::IMPLICIT_REG;
4845 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[4])) {
4846 # if(etype->base_type == IVL_VT_LOGIC)
4847 # use_type = NetNet::IMPLICIT_REG;
4848 # }
4849 # }
4850 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4851 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, use_dtype, p[1]);
4852 # port_declaration_context.port_type = NetNet::POUTPUT;
4853 # port_declaration_context.port_net_type = use_type;
4854 # port_declaration_context.data_type = p[4];
4855 # delete[]p[5];
4856 # p[0] = ptmp;
4857 # }
4858 ()
4859 def p_port_declaration_6(p):
4860 '''port_declaration : attribute_list_opt K_output K_wreal IDENTIFIER '''
4861 if(parse_debug): print('port_declaration_6', list(p))
4862 # { Module::port_t*ptmp;
4863 # perm_string name = lex_strings.make(p[4]);
4864 # ptmp = pform_module_port_reference(name, @2.text,
4865 # @2.first_line);
4866 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4867 # FILE_NAME(real_type, @3);
4868 # pform_module_define_port(@2, name, NetNet::POUTPUT,
4869 # NetNet::WIRE, real_type, p[1]);
4870 # port_declaration_context.port_type = NetNet::POUTPUT;
4871 # port_declaration_context.port_net_type = NetNet::WIRE;
4872 # port_declaration_context.data_type = real_type;
4873 # delete[]p[4];
4874 # p[0] = ptmp;
4875 # }
4876 ()
4877 def p_port_declaration_7(p):
4878 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER '=' expression '''
4879 if(parse_debug): print('port_declaration_7', list(p))
4880 # { Module::port_t*ptmp;
4881 # perm_string name = lex_strings.make(p[5]);
4882 # NetNet::Type use_type = p[3];
4883 # if (use_type == NetNet::IMPLICIT) {
4884 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
4885 # if (dtype->reg_flag)
4886 # use_type = NetNet::REG;
4887 # else
4888 # use_type = NetNet::IMPLICIT_REG;
4889 # } else {
4890 # use_type = NetNet::IMPLICIT_REG;
4891 # }
4892 # }
4893 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4894 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, p[4], p[1]);
4895 # port_declaration_context.port_type = NetNet::PINOUT;
4896 # port_declaration_context.port_net_type = use_type;
4897 # port_declaration_context.data_type = p[4];
4898 #
4899 # pform_make_var_init(@5, name, p[7]);
4900 #
4901 # delete[]p[5];
4902 # p[0] = ptmp;
4903 # }
4904 ()
4905 def p_net_type_opt_1(p):
4906 '''net_type_opt : net_type '''
4907 if(parse_debug): print('net_type_opt_1', list(p))
4908 p[0] = p[1]
4909 ()
4910 def p_net_type_opt_2(p):
4911 '''net_type_opt : '''
4912 if(parse_debug>2): print('net_type_opt_2', list(p))
4913 p[0] = NN_IMPLICIT
4914 ()
4915 def p_unsigned_signed_opt_1(p):
4916 '''unsigned_signed_opt : K_signed '''
4917 if(parse_debug): print('unsigned_signed_opt_1', list(p))
4918 p[0] = True
4919 ()
4920 def p_unsigned_signed_opt_2(p):
4921 '''unsigned_signed_opt : K_unsigned '''
4922 if(parse_debug): print('unsigned_signed_opt_2', list(p))
4923 p[0] = False
4924 ()
4925 def p_unsigned_signed_opt_3(p):
4926 '''unsigned_signed_opt : '''
4927 if(parse_debug): print('unsigned_signed_opt_3', list(p))
4928 p[0] = False
4929 ()
4930 def p_signed_unsigned_opt_1(p):
4931 '''signed_unsigned_opt : K_signed '''
4932 if(parse_debug): print('signed_unsigned_opt_1', list(p))
4933 p[0] = True
4934 ()
4935 def p_signed_unsigned_opt_2(p):
4936 '''signed_unsigned_opt : K_unsigned '''
4937 if(parse_debug): print('signed_unsigned_opt_2', list(p))
4938 p[0] = False
4939 ()
4940 def p_signed_unsigned_opt_3(p):
4941 '''signed_unsigned_opt : '''
4942 if(parse_debug): print('signed_unsigned_opt_3', list(p))
4943 p[0] = True
4944 ()
4945 def p_atom2_type_1(p):
4946 '''atom2_type : K_byte '''
4947 if(parse_debug): print('atom2_type_1', list(p))
4948 # { p[0] = 8; }
4949 ()
4950 def p_atom2_type_2(p):
4951 '''atom2_type : K_shortint '''
4952 if(parse_debug): print('atom2_type_2', list(p))
4953 # { p[0] = 16; }
4954 ()
4955 def p_atom2_type_3(p):
4956 '''atom2_type : K_int '''
4957 if(parse_debug): print('atom2_type_3', list(p))
4958 # { p[0] = 32; }
4959 ()
4960 def p_atom2_type_4(p):
4961 '''atom2_type : K_longint '''
4962 if(parse_debug): print('atom2_type_4', list(p))
4963 # { p[0] = 64; }
4964 ()
4965 def p_lpvalue_1(p):
4966 '''lpvalue : hierarchy_identifier '''
4967 if(parse_debug>2): print('lpvalue_1', list(p))
4968 p[0] = p[1]
4969 # { PEIdent*tmp = pform_new_ident(*p[1]);
4970 # FILE_NAME(tmp, @1);
4971 # p[0] = tmp;
4972 # delete p[1];
4973 # }
4974 ()
4975 def p_lpvalue_2(p):
4976 '''lpvalue : implicit_class_handle '.' hierarchy_identifier '''
4977 if(parse_debug): print('lpvalue_2', list(p))
4978 # { pform_name_t*t_name = p[1];
4979 # while (!p[3]->empty()) {
4980 # t_name->push_back(p[3]->front());
4981 # p[3]->pop_front();
4982 # }
4983 # PEIdent*tmp = new PEIdent(*t_name);
4984 # FILE_NAME(tmp, @1);
4985 # p[0] = tmp;
4986 # delete p[1];
4987 # delete p[3];
4988 # }
4989 ()
4990 def p_lpvalue_3(p):
4991 '''lpvalue : '{' expression_list_proper '}' '''
4992 if(parse_debug): print('lpvalue_3', list(p))
4993 # { PEConcat*tmp = new PEConcat(*p[2]);
4994 # FILE_NAME(tmp, @1);
4995 # delete p[2];
4996 # p[0] = tmp;
4997 # }
4998 ()
4999 def p_lpvalue_4(p):
5000 '''lpvalue : streaming_concatenation '''
5001 if(parse_debug): print('lpvalue_4', list(p))
5002 # { yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
5003 # p[0] = None
5004 # }
5005 ()
5006 def p_cont_assign_1(p):
5007 '''cont_assign : lpvalue '=' expression '''
5008 if(parse_debug): print('cont_assign_1', list(p))
5009 absyn.cont_assign_1(p)
5010 # { list<PExpr*>*tmp = new list<PExpr*>;
5011 # tmp->push_back(p[1]);
5012 # tmp->push_back(p[3]);
5013 # p[0] = tmp;
5014 # }
5015 ()
5016 def p_cont_assign_list_1(p):
5017 '''cont_assign_list : cont_assign_list ',' cont_assign '''
5018 if(parse_debug): print('cont_assign_list_1', list(p))
5019 # { list<PExpr*>*tmp = p[1];
5020 # tmp->splice(tmp->end(), *p[3]);
5021 # delete p[3];
5022 # p[0] = tmp;
5023 # }
5024 ()
5025 def p_cont_assign_list_2(p):
5026 '''cont_assign_list : cont_assign '''
5027 if(parse_debug>2): print('cont_assign_list_2', list(p))
5028 p[0] = p[1]
5029 ()
5030 def p_module_1(p):
5031 '''module : attribute_list_opt module_start lifetime_opt IDENTIFIER _embed0_module module_package_import_list_opt module_parameter_port_list_opt module_port_list_opt module_attribute_foreign ';' _embed1_module timeunits_declaration_opt _embed2_module module_item_list_opt module_end _embed3_module endlabel_opt '''
5032 if(parse_debug>2): print('module_1', list(p))
5033 clsdecl = absyn.module_1(p)
5034 p[0] = clsdecl
5035 ()
5036 def p__embed0_module(p):
5037 '''_embed0_module : '''
5038 # { pform_startmodule(@2, p[4], p[2]==K_program, p[2]==K_interface, p[3], p[1]); }
5039 ()
5040 def p__embed1_module(p):
5041 '''_embed1_module : '''
5042 # { pform_module_set_ports(p[8]); }
5043 ()
5044 def p__embed2_module(p):
5045 '''_embed2_module : '''
5046 # { pform_set_scope_timescale(@2); }
5047 ()
5048 def p__embed3_module(p):
5049 '''_embed3_module : '''
5050 # { Module::UCDriveType ucd;
5051 # // The lexor detected `unconnected_drive directives and
5052 # // marked what it found in the uc_drive variable. Use that
5053 # // to generate a UCD flag for the module.
5054 # switch (uc_drive) {
5055 # case UCD_NONE:
5056 # default:
5057 # ucd = Module::UCD_NONE;
5058 # break;
5059 # case UCD_PULL0:
5060 # ucd = Module::UCD_PULL0;
5061 # break;
5062 # case UCD_PULL1:
5063 # ucd = Module::UCD_PULL1;
5064 # break;
5065 # }
5066 # // Check that program/endprogram and module/endmodule
5067 # // keywords match.
5068 # if (p[2] != p[15]) {
5069 # switch (p[2]) {
5070 # case K_module:
5071 # yyerror(@15, "error: module not closed by endmodule.");
5072 # break;
5073 # case K_program:
5074 # yyerror(@15, "error: program not closed by endprogram.");
5075 # break;
5076 # case K_interface:
5077 # yyerror(@15, "error: interface not closed by endinterface.");
5078 # break;
5079 # default:
5080 # break;
5081 # }
5082 # }
5083 # pform_endmodule(p[4], in_celldefine, ucd);
5084 # }
5085 ()
5086 def p_module_start_1(p):
5087 '''module_start : K_module '''
5088 if(parse_debug>1): print('module_start_1', list(p))
5089 # { p[0] = K_module; }
5090 ()
5091 def p_module_start_2(p):
5092 '''module_start : K_macromodule '''
5093 if(parse_debug): print('module_start_2', list(p))
5094 # { p[0] = K_module; }
5095 ()
5096 def p_module_start_3(p):
5097 '''module_start : K_program '''
5098 if(parse_debug): print('module_start_3', list(p))
5099 # { p[0] = K_program; }
5100 ()
5101 def p_module_start_4(p):
5102 '''module_start : K_interface '''
5103 if(parse_debug): print('module_start_4', list(p))
5104 # { p[0] = K_interface; }
5105 ()
5106 def p_module_end_1(p):
5107 '''module_end : K_endmodule '''
5108 if(parse_debug>2): print('module_end_1', list(p))
5109 # { p[0] = K_module; }
5110 ()
5111 def p_module_end_2(p):
5112 '''module_end : K_endprogram '''
5113 if(parse_debug): print('module_end_2', list(p))
5114 # { p[0] = K_program; }
5115 ()
5116 def p_module_end_3(p):
5117 '''module_end : K_endinterface '''
5118 if(parse_debug): print('module_end_3', list(p))
5119 # { p[0] = K_interface; }
5120 ()
5121 def p_endlabel_opt_1(p):
5122 '''endlabel_opt : ':' IDENTIFIER '''
5123 if(parse_debug): print('endlabel_opt_1', list(p))
5124 p[0] = p[2]
5125 ()
5126 def p_endlabel_opt_2(p):
5127 '''endlabel_opt : '''
5128 if(parse_debug>2): print('endlabel_opt_2', list(p))
5129 # { p[0] = None }
5130 ()
5131 def p_module_attribute_foreign_1(p):
5132 '''module_attribute_foreign : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP '''
5133 if(parse_debug): print('module_attribute_foreign_1', list(p))
5134 # { p[0] = None }
5135 ()
5136 def p_module_attribute_foreign_2(p):
5137 '''module_attribute_foreign : '''
5138 if(parse_debug>2): print('module_attribute_foreign_2', list(p))
5139 # { p[0] = None }
5140 ()
5141 def p_module_port_list_opt_1(p):
5142 '''module_port_list_opt : '(' list_of_ports ')' '''
5143 if(parse_debug): print('module_port_list_opt_1', list(p))
5144 p[0] = p[2]
5145 ()
5146 def p_module_port_list_opt_2(p):
5147 '''module_port_list_opt : '(' list_of_port_declarations ')' '''
5148 if(parse_debug>2): print('module_port_list_opt_2', list(p))
5149 p[0] = p[2]
5150 ()
5151 def p_module_port_list_opt_3(p):
5152 '''module_port_list_opt : '''
5153 if(parse_debug): print('module_port_list_opt_3', list(p))
5154 # { p[0] = None }
5155 ()
5156 def p_module_port_list_opt_4(p):
5157 '''module_port_list_opt : '(' error ')' '''
5158 if(parse_debug): print('module_port_list_opt_4', list(p))
5159 # { yyerror(@2, "Errors in port declarations.");
5160 # yyerrok;
5161 # p[0] = None
5162 # }
5163 ()
5164 def p_module_parameter_port_list_opt_1(p):
5165 '''module_parameter_port_list_opt : '''
5166 if(parse_debug>2): print('module_parameter_port_list_opt_1', list(p))
5167 ()
5168 def p_module_parameter_port_list_opt_2(p):
5169 '''module_parameter_port_list_opt : '#' '(' module_parameter_port_list ')' '''
5170 if(parse_debug): print('module_parameter_port_list_opt_2', list(p))
5171 p[0] = p[3]
5172 ()
5173 def p_module_parameter_port_list_1(p):
5174 '''module_parameter_port_list : K_parameter param_type parameter_assign '''
5175 if(parse_debug): print('module_parameter_port_list_1', list(p))
5176 p[0] = [p[3]]
5177 ()
5178 def p_module_parameter_port_list_2(p):
5179 '''module_parameter_port_list : module_parameter_port_list ',' parameter_assign '''
5180 if(parse_debug): print('module_parameter_port_list_2', list(p))
5181 p[0] = p[1].append(p[3])
5182 ()
5183 def p_module_parameter_port_list_3(p):
5184 '''module_parameter_port_list : module_parameter_port_list ',' K_parameter param_type parameter_assign '''
5185 if(parse_debug): print('module_parameter_port_list_3', list(p))
5186 p[1].append(Leaf(token.COMMA, ','))
5187 p[1].append(Leaf(token.NEWLINE, '\n'))
5188 p[5].prefix=' ' # add space after newline
5189 p[1].append(p[5])
5190 p[0] = p[1]
5191 ()
5192 def p_module_item_1(p):
5193 '''module_item : module '''
5194 if(parse_debug): print('module_item_1', list(p))
5195 ()
5196 def p_module_item_2(p):
5197 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' '''
5198 if(parse_debug): print('module_item_2', list(p))
5199 # { data_type_t*data_type = p[3];
5200 # if (data_type == 0) {
5201 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5202 # FILE_NAME(data_type, @2);
5203 # }
5204 # pform_set_data_type(@2, data_type, p[5], p[2], p[1]);
5205 # if (p[4] != 0) {
5206 # yyerror(@2, "sorry: net delays not supported.");
5207 # delete p[4];
5208 # }
5209 # delete p[1];
5210 # }
5211 ()
5212 def p_module_item_3(p):
5213 '''module_item : attribute_list_opt K_wreal delay3 net_variable_list ';' '''
5214 if(parse_debug): print('module_item_3', list(p))
5215 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5216 # pform_set_data_type(@2, tmpt, p[4], NetNet::WIRE, p[1]);
5217 # if (p[3] != 0) {
5218 # yyerror(@3, "sorry: net delays not supported.");
5219 # delete p[3];
5220 # }
5221 # delete p[1];
5222 # }
5223 ()
5224 def p_module_item_4(p):
5225 '''module_item : attribute_list_opt K_wreal net_variable_list ';' '''
5226 if(parse_debug): print('module_item_4', list(p))
5227 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5228 # pform_set_data_type(@2, tmpt, p[3], NetNet::WIRE, p[1]);
5229 # delete p[1];
5230 # }
5231 ()
5232 def p_module_item_5(p):
5233 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_decl_assigns ';' '''
5234 if(parse_debug): print('module_item_5', list(p))
5235 # { data_type_t*data_type = p[3];
5236 # if (data_type == 0) {
5237 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5238 # FILE_NAME(data_type, @2);
5239 # }
5240 # pform_makewire(@2, p[4], str_strength, p[5], p[2], data_type);
5241 # if (p[1]) {
5242 # yywarn(@2, "Attributes are not supported on net declaration "
5243 # "assignments and will be discarded.");
5244 # delete p[1];
5245 # }
5246 # }
5247 ()
5248 def p_module_item_6(p):
5249 '''module_item : attribute_list_opt net_type data_type_or_implicit drive_strength net_decl_assigns ';' '''
5250 if(parse_debug): print('module_item_6', list(p))
5251 # { data_type_t*data_type = p[3];
5252 # if (data_type == 0) {
5253 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5254 # FILE_NAME(data_type, @2);
5255 # }
5256 # pform_makewire(@2, 0, p[4], p[5], p[2], data_type);
5257 # if (p[1]) {
5258 # yywarn(@2, "Attributes are not supported on net declaration "
5259 # "assignments and will be discarded.");
5260 # delete p[1];
5261 # }
5262 # }
5263 ()
5264 def p_module_item_7(p):
5265 '''module_item : attribute_list_opt K_wreal net_decl_assigns ';' '''
5266 if(parse_debug): print('module_item_7', list(p))
5267 # { real_type_t*data_type = new real_type_t(real_type_t::REAL);
5268 # pform_makewire(@2, 0, str_strength, p[3], NetNet::WIRE, data_type);
5269 # if (p[1]) {
5270 # yywarn(@2, "Attributes are not supported on net declaration "
5271 # "assignments and will be discarded.");
5272 # delete p[1];
5273 # }
5274 # }
5275 ()
5276 def p_module_item_8(p):
5277 '''module_item : K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' '''
5278 if(parse_debug): print('module_item_8', list(p))
5279 # { yyerror(@1, "sorry: trireg nets not supported.");
5280 # delete p[3];
5281 # delete p[4];
5282 # }
5283 ()
5284 def p_module_item_9(p):
5285 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit list_of_port_identifiers ';' '''
5286 if(parse_debug): print('module_item_9', list(p))
5287 # { pform_module_define_port(@2, p[5], p[2], p[3], p[4], p[1]); }
5288 ()
5289 def p_module_item_10(p):
5290 '''module_item : attribute_list_opt port_direction K_wreal list_of_port_identifiers ';' '''
5291 if(parse_debug): print('module_item_10', list(p))
5292 # { real_type_t*real_type = new real_type_t(real_type_t::REAL);
5293 # pform_module_define_port(@2, p[4], p[2], NetNet::WIRE, real_type, p[1]);
5294 # }
5295 ()
5296 def p_module_item_11(p):
5297 '''module_item : attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' '''
5298 if(parse_debug): print('module_item_11', list(p))
5299 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
5300 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
5301 # if (dtype->implicit_flag)
5302 # use_type = NetNet::NONE;
5303 # }
5304 # if (use_type == NetNet::NONE)
5305 # pform_set_port_type(@2, p[4], NetNet::PINOUT, p[3], p[1]);
5306 # else
5307 # pform_module_define_port(@2, p[4], NetNet::PINOUT, use_type, p[3], p[1]);
5308 # }
5309 ()
5310 def p_module_item_12(p):
5311 '''module_item : attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' '''
5312 if(parse_debug): print('module_item_12', list(p))
5313 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
5314 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
5315 # if (dtype->implicit_flag)
5316 # use_type = NetNet::NONE;
5317 # }
5318 # if (use_type == NetNet::NONE)
5319 # pform_set_port_type(@2, p[4], NetNet::PINPUT, p[3], p[1]);
5320 # else
5321 # pform_module_define_port(@2, p[4], NetNet::PINPUT, use_type, p[3], p[1]);
5322 # }
5323 ()
5324 def p_module_item_13(p):
5325 '''module_item : attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' '''
5326 if(parse_debug): print('module_item_13', list(p))
5327 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
5328 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
5329 # if (dtype->implicit_flag)
5330 # use_type = NetNet::NONE;
5331 # else if (dtype->reg_flag)
5332 # use_type = NetNet::REG;
5333 # else
5334 # use_type = NetNet::IMPLICIT_REG;
5335 #
5336 # // The SystemVerilog types that can show up as
5337 # // output ports are implicitly (on the inside)
5338 # // variables because "reg" is not valid syntax
5339 # // here.
5340 # } else if (dynamic_cast<atom2_type_t*> (p[3])) {
5341 # use_type = NetNet::IMPLICIT_REG;
5342 # } else if (dynamic_cast<struct_type_t*> (p[3])) {
5343 # use_type = NetNet::IMPLICIT_REG;
5344 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[3])) {
5345 # if(etype->base_type == IVL_VT_LOGIC)
5346 # use_type = NetNet::IMPLICIT_REG;
5347 # }
5348 # if (use_type == NetNet::NONE)
5349 # pform_set_port_type(@2, p[4], NetNet::POUTPUT, p[3], p[1]);
5350 # else
5351 # pform_module_define_port(@2, p[4], NetNet::POUTPUT, use_type, p[3], p[1]);
5352 # }
5353 ()
5354 def p_module_item_14(p):
5355 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit error ';' '''
5356 if(parse_debug): print('module_item_14', list(p))
5357 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5358 # if (p[1]) delete p[1];
5359 # if (p[4]) delete p[4];
5360 # yyerrok;
5361 # }
5362 ()
5363 def p_module_item_15(p):
5364 '''module_item : attribute_list_opt K_inout data_type_or_implicit error ';' '''
5365 if(parse_debug): print('module_item_15', list(p))
5366 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5367 # if (p[1]) delete p[1];
5368 # if (p[3]) delete p[3];
5369 # yyerrok;
5370 # }
5371 ()
5372 def p_module_item_16(p):
5373 '''module_item : attribute_list_opt K_input data_type_or_implicit error ';' '''
5374 if(parse_debug): print('module_item_16', list(p))
5375 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5376 # if (p[1]) delete p[1];
5377 # if (p[3]) delete p[3];
5378 # yyerrok;
5379 # }
5380 ()
5381 def p_module_item_17(p):
5382 '''module_item : attribute_list_opt K_output data_type_or_implicit error ';' '''
5383 if(parse_debug): print('module_item_17', list(p))
5384 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5385 # if (p[1]) delete p[1];
5386 # if (p[3]) delete p[3];
5387 # yyerrok;
5388 # }
5389 ()
5390 def p_module_item_18(p):
5391 '''module_item : DISCIPLINE_IDENTIFIER list_of_identifiers ';' '''
5392 if(parse_debug): print('module_item_18', list(p))
5393 # { pform_attach_discipline(@1, p[1], p[2]); }
5394 ()
5395 def p_module_item_19(p):
5396 '''module_item : attribute_list_opt _embed0_module_item block_item_decl '''
5397 if(parse_debug): print('module_item_19', list(p))
5398 # { delete attributes_in_context;
5399 # attributes_in_context = 0;
5400 # }
5401 ()
5402 def p_module_item_20(p):
5403 '''module_item : K_defparam _embed1_module_item defparam_assign_list ';' '''
5404 if(parse_debug): print('module_item_20', list(p))
5405 ()
5406 def p_module_item_21(p):
5407 '''module_item : attribute_list_opt gatetype gate_instance_list ';' '''
5408 if(parse_debug): print('module_item_21', list(p))
5409 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
5410 ()
5411 def p_module_item_22(p):
5412 '''module_item : attribute_list_opt gatetype delay3 gate_instance_list ';' '''
5413 if(parse_debug): print('module_item_22', list(p))
5414 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
5415 ()
5416 def p_module_item_23(p):
5417 '''module_item : attribute_list_opt gatetype drive_strength gate_instance_list ';' '''
5418 if(parse_debug): print('module_item_23', list(p))
5419 # { pform_makegates(@2, p[2], p[3], 0, p[4], p[1]); }
5420 ()
5421 def p_module_item_24(p):
5422 '''module_item : attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';' '''
5423 if(parse_debug): print('module_item_24', list(p))
5424 # { pform_makegates(@2, p[2], p[3], p[4], p[5], p[1]); }
5425 ()
5426 def p_module_item_25(p):
5427 '''module_item : attribute_list_opt switchtype gate_instance_list ';' '''
5428 if(parse_debug): print('module_item_25', list(p))
5429 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
5430 ()
5431 def p_module_item_26(p):
5432 '''module_item : attribute_list_opt switchtype delay3 gate_instance_list ';' '''
5433 if(parse_debug): print('module_item_26', list(p))
5434 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
5435 ()
5436 def p_module_item_27(p):
5437 '''module_item : K_pullup gate_instance_list ';' '''
5438 if(parse_debug): print('module_item_27', list(p))
5439 # { pform_makegates(@1, PGBuiltin::PULLUP, pull_strength, 0, p[2], 0); }
5440 ()
5441 def p_module_item_28(p):
5442 '''module_item : K_pulldown gate_instance_list ';' '''
5443 if(parse_debug): print('module_item_28', list(p))
5444 # { pform_makegates(@1, PGBuiltin::PULLDOWN, pull_strength, 0, p[2], 0); }
5445 ()
5446 def p_module_item_29(p):
5447 '''module_item : K_pullup '(' dr_strength1 ')' gate_instance_list ';' '''
5448 if(parse_debug): print('module_item_29', list(p))
5449 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[5], 0); }
5450 ()
5451 def p_module_item_30(p):
5452 '''module_item : K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5453 if(parse_debug): print('module_item_30', list(p))
5454 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[7], 0); }
5455 ()
5456 def p_module_item_31(p):
5457 '''module_item : K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5458 if(parse_debug): print('module_item_31', list(p))
5459 # { pform_makegates(@1, PGBuiltin::PULLUP, p[5], 0, p[7], 0); }
5460 ()
5461 def p_module_item_32(p):
5462 '''module_item : K_pulldown '(' dr_strength0 ')' gate_instance_list ';' '''
5463 if(parse_debug): print('module_item_32', list(p))
5464 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[5], 0); }
5465 ()
5466 def p_module_item_33(p):
5467 '''module_item : K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5468 if(parse_debug): print('module_item_33', list(p))
5469 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[5], 0, p[7], 0); }
5470 ()
5471 def p_module_item_34(p):
5472 '''module_item : K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5473 if(parse_debug): print('module_item_34', list(p))
5474 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[7], 0); }
5475 ()
5476 def p_module_item_35(p):
5477 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' '''
5478 if(parse_debug): print('module_item_35', list(p))
5479 # { perm_string tmp1 = lex_strings.make(p[2]);
5480 # pform_make_modgates(@2, tmp1, p[3], p[4], p[1]);
5481 # delete[]p[2];
5482 # }
5483 ()
5484 def p_module_item_36(p):
5485 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt error ';' '''
5486 if(parse_debug): print('module_item_36', list(p))
5487 # { yyerror(@2, "error: Invalid module instantiation");
5488 # delete[]p[2];
5489 # if (p[1]) delete p[1];
5490 # }
5491 ()
5492 def p_module_item_37(p):
5493 '''module_item : K_assign drive_strength_opt delay3_opt cont_assign_list ';' '''
5494 if(parse_debug>2): print('module_item_37', list(p))
5495 # { pform_make_pgassign_list(p[4], p[3], p[2], @1.text, @1.first_line); }
5496 ()
5497 def p_module_item_38(p):
5498 '''module_item : attribute_list_opt K_always statement_item '''
5499 if(parse_debug): print('module_item_38', list(p))
5500 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, p[3], p[1]);
5501 # FILE_NAME(tmp, @2);
5502 # }
5503 ()
5504 def p_module_item_39(p):
5505 '''module_item : attribute_list_opt K_always_comb statement_item '''
5506 if(parse_debug): print('module_item_39', list(p))
5507 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_COMB, p[3], p[1]);
5508 # FILE_NAME(tmp, @2);
5509 # }
5510 ()
5511 def p_module_item_40(p):
5512 '''module_item : attribute_list_opt K_always_ff statement_item '''
5513 if(parse_debug): print('module_item_40', list(p))
5514 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, p[3], p[1]);
5515 # FILE_NAME(tmp, @2);
5516 # }
5517 ()
5518 def p_module_item_41(p):
5519 '''module_item : attribute_list_opt K_always_latch statement_item '''
5520 if(parse_debug): print('module_item_41', list(p))
5521 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_LATCH, p[3], p[1]);
5522 # FILE_NAME(tmp, @2);
5523 # }
5524 ()
5525 def p_module_item_42(p):
5526 '''module_item : attribute_list_opt K_initial statement_item '''
5527 if(parse_debug): print('module_item_42', list(p))
5528 # { PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, p[3], p[1]);
5529 # FILE_NAME(tmp, @2);
5530 # }
5531 ()
5532 def p_module_item_43(p):
5533 '''module_item : attribute_list_opt K_final statement_item '''
5534 if(parse_debug): print('module_item_43', list(p))
5535 # { PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, p[3], p[1]);
5536 # FILE_NAME(tmp, @2);
5537 # }
5538 ()
5539 def p_module_item_44(p):
5540 '''module_item : attribute_list_opt K_analog analog_statement '''
5541 if(parse_debug): print('module_item_44', list(p))
5542 # { pform_make_analog_behavior(@2, IVL_PR_ALWAYS, p[3]); }
5543 ()
5544 def p_module_item_45(p):
5545 '''module_item : attribute_list_opt assertion_item '''
5546 if(parse_debug): print('module_item_45', list(p))
5547 ()
5548 def p_module_item_46(p):
5549 '''module_item : timeunits_declaration '''
5550 if(parse_debug): print('module_item_46', list(p))
5551 ()
5552 def p_module_item_47(p):
5553 '''module_item : class_declaration '''
5554 if(parse_debug): print('module_item_47', list(p))
5555 ()
5556 def p_module_item_48(p):
5557 '''module_item : task_declaration '''
5558 if(parse_debug): print('module_item_48', list(p))
5559 ()
5560 def p_module_item_49(p):
5561 '''module_item : function_declaration '''
5562 if(parse_debug): print('module_item_49', list(p))
5563 ()
5564 def p_module_item_50(p):
5565 '''module_item : K_generate generate_item_list_opt K_endgenerate '''
5566 if(parse_debug): print('module_item_50', list(p))
5567 # { // Test for bad nesting. I understand it, but it is illegal.
5568 # if (pform_parent_generate()) {
5569 # cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
5570 # cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
5571 # cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
5572 # error_count += 1;
5573 # }
5574 # }
5575 ()
5576 def p_module_item_51(p):
5577 '''module_item : K_genvar list_of_identifiers ';' '''
5578 if(parse_debug): print('module_item_51', list(p))
5579 # { pform_genvars(@1, p[2]); }
5580 ()
5581 def p_module_item_52(p):
5582 '''module_item : K_for '(' IDENTIFIER '=' expression ';' expression ';' IDENTIFIER '=' expression ')' _embed2_module_item generate_block '''
5583 if(parse_debug): print('module_item_52', list(p))
5584 # { pform_endgenerate(); }
5585 ()
5586 def p_module_item_53(p):
5587 '''module_item : generate_if generate_block_opt K_else _embed3_module_item generate_block '''
5588 if(parse_debug): print('module_item_53', list(p))
5589 # { pform_endgenerate(); }
5590 ()
5591 def p_module_item_54(p):
5592 '''module_item : generate_if generate_block_opt %prec less_than_K_else '''
5593 if(parse_debug): print('module_item_54', list(p))
5594 # { pform_endgenerate(); }
5595 ()
5596 def p_module_item_55(p):
5597 '''module_item : K_case '(' expression ')' _embed4_module_item generate_case_items K_endcase '''
5598 if(parse_debug): print('module_item_55', list(p))
5599 # { pform_endgenerate(); }
5600 ()
5601 def p_module_item_56(p):
5602 '''module_item : modport_declaration '''
5603 if(parse_debug): print('module_item_56', list(p))
5604 ()
5605 def p_module_item_57(p):
5606 '''module_item : package_import_declaration '''
5607 if(parse_debug): print('module_item_57', list(p))
5608 ()
5609 def p_module_item_58(p):
5610 '''module_item : attribute_list_opt K_specparam _embed5_module_item specparam_decl ';' '''
5611 if(parse_debug): print('module_item_58', list(p))
5612 ()
5613 def p_module_item_59(p):
5614 '''module_item : K_specify _embed6_module_item specify_item_list_opt K_endspecify '''
5615 if(parse_debug): print('module_item_59', list(p))
5616 ()
5617 def p_module_item_60(p):
5618 '''module_item : K_specify error K_endspecify '''
5619 if(parse_debug): print('module_item_60', list(p))
5620 # { yyerror(@1, "error: syntax error in specify block");
5621 # yyerrok;
5622 # }
5623 ()
5624 def p_module_item_61(p):
5625 '''module_item : error ';' '''
5626 if(parse_debug): print('module_item_61', list(p))
5627 # { yyerror(@2, "error: invalid module item.");
5628 # yyerrok;
5629 # }
5630 ()
5631 def p_module_item_62(p):
5632 '''module_item : K_assign error '=' expression ';' '''
5633 if(parse_debug): print('module_item_62', list(p))
5634 # { yyerror(@1, "error: syntax error in left side "
5635 # "of continuous assignment.");
5636 # yyerrok;
5637 # }
5638 ()
5639 def p_module_item_63(p):
5640 '''module_item : K_assign error ';' '''
5641 if(parse_debug): print('module_item_63', list(p))
5642 # { yyerror(@1, "error: syntax error in "
5643 # "continuous assignment");
5644 # yyerrok;
5645 # }
5646 ()
5647 def p_module_item_64(p):
5648 '''module_item : K_function error K_endfunction endlabel_opt '''
5649 if(parse_debug): print('module_item_64', list(p))
5650 # { yyerror(@1, "error: I give up on this "
5651 # "function definition.");
5652 # if (p[4]) {
5653 # if (!gn_system_verilog()) {
5654 # yyerror(@4, "error: Function end names require "
5655 # "SystemVerilog.");
5656 # }
5657 # delete[]p[4];
5658 # }
5659 # yyerrok;
5660 # }
5661 ()
5662 def p_module_item_65(p):
5663 '''module_item : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';' '''
5664 if(parse_debug): print('module_item_65', list(p))
5665 # { perm_string tmp3 = lex_strings.make(p[3]);
5666 # perm_string tmp5 = lex_strings.make(p[5]);
5667 # pform_set_attrib(tmp3, tmp5, p[7]);
5668 # delete[] p[3];
5669 # delete[] p[5];
5670 # }
5671 ()
5672 def p_module_item_66(p):
5673 '''module_item : KK_attribute '(' error ')' ';' '''
5674 if(parse_debug): print('module_item_66', list(p))
5675 # { yyerror(@1, "error: Malformed $attribute parameter list."); }
5676 ()
5677 def p__embed0_module_item(p):
5678 '''_embed0_module_item : '''
5679 # { attributes_in_context = p[1]; }
5680 ()
5681 def p__embed1_module_item(p):
5682 '''_embed1_module_item : '''
5683 # { if (pform_in_interface())
5684 # yyerror(@1, "error: Parameter overrides are not allowed "
5685 # "in interfaces.");
5686 # }
5687 ()
5688 def p__embed2_module_item(p):
5689 '''_embed2_module_item : '''
5690 # { pform_start_generate_for(@1, p[3], p[5], p[7], p[9], p[11]); }
5691 ()
5692 def p__embed3_module_item(p):
5693 '''_embed3_module_item : '''
5694 # { pform_start_generate_else(@1); }
5695 ()
5696 def p__embed4_module_item(p):
5697 '''_embed4_module_item : '''
5698 # { pform_start_generate_case(@1, p[3]); }
5699 ()
5700 def p__embed5_module_item(p):
5701 '''_embed5_module_item : '''
5702 # { if (pform_in_interface())
5703 # yyerror(@1, "error: specparam declarations are not allowed "
5704 # "in interfaces.");
5705 # }
5706 ()
5707 def p__embed6_module_item(p):
5708 '''_embed6_module_item : '''
5709 # { if (pform_in_interface())
5710 # yyerror(@1, "error: specify blocks are not allowed "
5711 # "in interfaces.");
5712 # }
5713 ()
5714 def p_module_item_list_1(p):
5715 '''module_item_list : module_item_list module_item '''
5716 if(parse_debug): print('module_item_list_1', list(p))
5717 ()
5718 def p_module_item_list_2(p):
5719 '''module_item_list : module_item '''
5720 if(parse_debug>2): print('module_item_list_2', list(p))
5721 ()
5722 def p_module_item_list_opt_1(p):
5723 '''module_item_list_opt : module_item_list '''
5724 if(parse_debug>2): print('module_item_list_opt_1', list(p))
5725 ()
5726 def p_module_item_list_opt_2(p):
5727 '''module_item_list_opt : '''
5728 if(parse_debug): print('module_item_list_opt_2', list(p))
5729 ()
5730 def p_generate_if_1(p):
5731 '''generate_if : K_if '(' expression ')' '''
5732 if(parse_debug): print('generate_if_1', list(p))
5733 # { pform_start_generate_if(@1, p[3]); }
5734 ()
5735 def p_generate_case_items_1(p):
5736 '''generate_case_items : generate_case_items generate_case_item '''
5737 if(parse_debug): print('generate_case_items_1', list(p))
5738 ()
5739 def p_generate_case_items_2(p):
5740 '''generate_case_items : generate_case_item '''
5741 if(parse_debug): print('generate_case_items_2', list(p))
5742 ()
5743 def p_generate_case_item_1(p):
5744 '''generate_case_item : expression_list_proper ':' _embed0_generate_case_item generate_block_opt '''
5745 if(parse_debug): print('generate_case_item_1', list(p))
5746 # { pform_endgenerate(); }
5747 ()
5748 def p_generate_case_item_2(p):
5749 '''generate_case_item : K_default ':' _embed1_generate_case_item generate_block_opt '''
5750 if(parse_debug): print('generate_case_item_2', list(p))
5751 # { pform_endgenerate(); }
5752 ()
5753 def p__embed0_generate_case_item(p):
5754 '''_embed0_generate_case_item : '''
5755 # { pform_generate_case_item(@1, p[1]); }
5756 ()
5757 def p__embed1_generate_case_item(p):
5758 '''_embed1_generate_case_item : '''
5759 # { pform_generate_case_item(@1, 0); }
5760 ()
5761 def p_generate_item_1(p):
5762 '''generate_item : module_item '''
5763 if(parse_debug): print('generate_item_1', list(p))
5764 ()
5765 def p_generate_item_2(p):
5766 '''generate_item : K_begin generate_item_list_opt K_end '''
5767 if(parse_debug): print('generate_item_2', list(p))
5768 # { /* Detect and warn about anachronistic begin/end use */
5769 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5770 # warn_count += 1;
5771 # cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
5772 # }
5773 # }
5774 ()
5775 def p_generate_item_3(p):
5776 '''generate_item : K_begin ':' IDENTIFIER _embed0_generate_item generate_item_list_opt K_end '''
5777 if(parse_debug): print('generate_item_3', list(p))
5778 # { /* Detect and warn about anachronistic named begin/end use */
5779 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5780 # warn_count += 1;
5781 # cerr << @1 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
5782 # }
5783 # pform_endgenerate();
5784 # }
5785 ()
5786 def p__embed0_generate_item(p):
5787 '''_embed0_generate_item : '''
5788 # {
5789 # pform_start_generate_nblock(@1, p[3]);
5790 # }
5791 ()
5792 def p_generate_item_list_1(p):
5793 '''generate_item_list : generate_item_list generate_item '''
5794 if(parse_debug): print('generate_item_list_1', list(p))
5795 ()
5796 def p_generate_item_list_2(p):
5797 '''generate_item_list : generate_item '''
5798 if(parse_debug): print('generate_item_list_2', list(p))
5799 ()
5800 def p_generate_item_list_opt_1(p):
5801 '''generate_item_list_opt : generate_item_list '''
5802 if(parse_debug): print('generate_item_list_opt_1', list(p))
5803 ()
5804 def p_generate_item_list_opt_2(p):
5805 '''generate_item_list_opt : '''
5806 if(parse_debug): print('generate_item_list_opt_2', list(p))
5807 ()
5808 def p_generate_block_1(p):
5809 '''generate_block : module_item '''
5810 if(parse_debug): print('generate_block_1', list(p))
5811 ()
5812 def p_generate_block_2(p):
5813 '''generate_block : K_begin generate_item_list_opt K_end '''
5814 if(parse_debug): print('generate_block_2', list(p))
5815 ()
5816 def p_generate_block_3(p):
5817 '''generate_block : K_begin ':' IDENTIFIER generate_item_list_opt K_end endlabel_opt '''
5818 if(parse_debug): print('generate_block_3', list(p))
5819 # { pform_generate_block_name(p[3]);
5820 # if (p[6]) {
5821 # if (strcmp(p[3],p[6]) != 0) {
5822 # yyerror(@6, "error: End label doesn't match "
5823 # "begin name");
5824 # }
5825 # if (! gn_system_verilog()) {
5826 # yyerror(@6, "error: Begin end labels require "
5827 # "SystemVerilog.");
5828 # }
5829 # delete[]p[6];
5830 # }
5831 # delete[]p[3];
5832 # }
5833 ()
5834 def p_generate_block_opt_1(p):
5835 '''generate_block_opt : generate_block '''
5836 if(parse_debug): print('generate_block_opt_1', list(p))
5837 ()
5838 def p_generate_block_opt_2(p):
5839 '''generate_block_opt : ';' '''
5840 if(parse_debug): print('generate_block_opt_2', list(p))
5841 ()
5842 def p_net_decl_assign_1(p):
5843 '''net_decl_assign : IDENTIFIER '=' expression '''
5844 if(parse_debug): print('net_decl_assign_1', list(p))
5845 # { net_decl_assign_t*tmp = new net_decl_assign_t;
5846 # tmp->next = tmp;
5847 # tmp->name = lex_strings.make(p[1]);
5848 # tmp->expr = p[3];
5849 # delete[]p[1];
5850 # p[0] = tmp;
5851 # }
5852 ()
5853 def p_net_decl_assigns_1(p):
5854 '''net_decl_assigns : net_decl_assigns ',' net_decl_assign '''
5855 if(parse_debug): print('net_decl_assigns_1', list(p))
5856 # { net_decl_assign_t*tmp = p[1];
5857 # p[3]->next = tmp->next;
5858 # tmp->next = p[3];
5859 # p[0] = tmp;
5860 # }
5861 ()
5862 def p_net_decl_assigns_2(p):
5863 '''net_decl_assigns : net_decl_assign '''
5864 if(parse_debug): print('net_decl_assigns_2', list(p))
5865 # { p[0] = p[1];
5866 # }
5867 ()
5868 def p_bit_logic_1(p):
5869 '''bit_logic : K_logic '''
5870 if(parse_debug): print('bit_logic_1', list(p))
5871 # { p[0] = IVL_VT_LOGIC; }
5872 ()
5873 def p_bit_logic_2(p):
5874 '''bit_logic : K_bool '''
5875 if(parse_debug): print('bit_logic_2', list(p))
5876 # { p[0] = IVL_VT_BOOL; /* Icarus misc */}
5877 ()
5878 def p_bit_logic_3(p):
5879 '''bit_logic : K_bit '''
5880 if(parse_debug): print('bit_logic_3', list(p))
5881 # { p[0] = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
5882 ()
5883 def p_bit_logic_opt_1(p):
5884 '''bit_logic_opt : bit_logic '''
5885 if(parse_debug): print('bit_logic_opt_1', list(p))
5886 ()
5887 def p_bit_logic_opt_2(p):
5888 '''bit_logic_opt : '''
5889 if(parse_debug): print('bit_logic_opt_2', list(p))
5890 # { p[0] = IVL_VT_NO_TYPE; }
5891 ()
5892 def p_net_type_1(p):
5893 '''net_type : K_wire '''
5894 if(parse_debug): print('net_type_1', list(p))
5895 # { p[0] = NetNet::WIRE; }
5896 ()
5897 def p_net_type_2(p):
5898 '''net_type : K_tri '''
5899 if(parse_debug): print('net_type_2', list(p))
5900 # { p[0] = NetNet::TRI; }
5901 ()
5902 def p_net_type_3(p):
5903 '''net_type : K_tri1 '''
5904 if(parse_debug): print('net_type_3', list(p))
5905 # { p[0] = NetNet::TRI1; }
5906 ()
5907 def p_net_type_4(p):
5908 '''net_type : K_supply0 '''
5909 if(parse_debug): print('net_type_4', list(p))
5910 # { p[0] = NetNet::SUPPLY0; }
5911 ()
5912 def p_net_type_5(p):
5913 '''net_type : K_wand '''
5914 if(parse_debug): print('net_type_5', list(p))
5915 # { p[0] = NetNet::WAND; }
5916 ()
5917 def p_net_type_6(p):
5918 '''net_type : K_triand '''
5919 if(parse_debug): print('net_type_6', list(p))
5920 # { p[0] = NetNet::TRIAND; }
5921 ()
5922 def p_net_type_7(p):
5923 '''net_type : K_tri0 '''
5924 if(parse_debug): print('net_type_7', list(p))
5925 # { p[0] = NetNet::TRI0; }
5926 ()
5927 def p_net_type_8(p):
5928 '''net_type : K_supply1 '''
5929 if(parse_debug): print('net_type_8', list(p))
5930 # { p[0] = NetNet::SUPPLY1; }
5931 ()
5932 def p_net_type_9(p):
5933 '''net_type : K_wor '''
5934 if(parse_debug): print('net_type_9', list(p))
5935 # { p[0] = NetNet::WOR; }
5936 ()
5937 def p_net_type_10(p):
5938 '''net_type : K_trior '''
5939 if(parse_debug): print('net_type_10', list(p))
5940 # { p[0] = NetNet::TRIOR; }
5941 ()
5942 def p_net_type_11(p):
5943 '''net_type : K_wone '''
5944 if(parse_debug): print('net_type_11', list(p))
5945 # { p[0] = NetNet::UNRESOLVED_WIRE;
5946 # cerr << @1.text << ":" << @1.first_line << ": warning: "
5947 # "'wone' is deprecated, please use 'uwire' "
5948 # "instead." << endl;
5949 # }
5950 ()
5951 def p_net_type_12(p):
5952 '''net_type : K_uwire '''
5953 if(parse_debug): print('net_type_12', list(p))
5954 # { p[0] = NetNet::UNRESOLVED_WIRE; }
5955 ()
5956 def p_param_type_1(p):
5957 '''param_type : bit_logic_opt unsigned_signed_opt dimensions_opt '''
5958 if(parse_debug): print('param_type_1', list(p))
5959 # { param_active_range = p[3];
5960 # param_active_signed = p[2];
5961 # if ((p[1] == IVL_VT_NO_TYPE) && (p[3] != 0))
5962 # param_active_type = IVL_VT_LOGIC;
5963 # else
5964 # param_active_type = p[1];
5965 # }
5966 ()
5967 def p_param_type_2(p):
5968 '''param_type : K_integer '''
5969 if(parse_debug): print('param_type_2', list(p))
5970 # { param_active_range = make_range_from_width(integer_width);
5971 # param_active_signed = true;
5972 # param_active_type = IVL_VT_LOGIC;
5973 # }
5974 ()
5975 def p_param_type_3(p):
5976 '''param_type : K_time '''
5977 if(parse_debug): print('param_type_3', list(p))
5978 # { param_active_range = make_range_from_width(64);
5979 # param_active_signed = false;
5980 # param_active_type = IVL_VT_LOGIC;
5981 # }
5982 ()
5983 def p_param_type_4(p):
5984 '''param_type : real_or_realtime '''
5985 if(parse_debug): print('param_type_4', list(p))
5986 # { param_active_range = 0;
5987 # param_active_signed = true;
5988 # param_active_type = IVL_VT_REAL;
5989 # }
5990 ()
5991 def p_param_type_5(p):
5992 '''param_type : atom2_type '''
5993 if(parse_debug): print('param_type_5', list(p))
5994 # { param_active_range = make_range_from_width(p[1]);
5995 # param_active_signed = true;
5996 # param_active_type = IVL_VT_BOOL;
5997 # }
5998 ()
5999 def p_param_type_6(p):
6000 '''param_type : TYPE_IDENTIFIER '''
6001 if(parse_debug): print('param_type_6', list(p))
6002 # { pform_set_param_from_type(@1, p[1].type, p[1].text, param_active_range,
6003 # param_active_signed, param_active_type);
6004 # delete[]p[1].text;
6005 # }
6006 ()
6007 def p_parameter_assign_list_1(p):
6008 '''parameter_assign_list : parameter_assign '''
6009 if(parse_debug): print('parameter_assign_list_1', list(p))
6010 ()
6011 def p_parameter_assign_list_2(p):
6012 '''parameter_assign_list : parameter_assign_list ',' parameter_assign '''
6013 if(parse_debug): print('parameter_assign_list_2', list(p))
6014 ()
6015 def p_localparam_assign_list_1(p):
6016 '''localparam_assign_list : localparam_assign '''
6017 if(parse_debug): print('localparam_assign_list_1', list(p))
6018 ()
6019 def p_localparam_assign_list_2(p):
6020 '''localparam_assign_list : localparam_assign_list ',' localparam_assign '''
6021 if(parse_debug): print('localparam_assign_list_2', list(p))
6022 ()
6023 def p_parameter_assign_1(p):
6024 '''parameter_assign : IDENTIFIER '=' expression parameter_value_ranges_opt '''
6025 if(parse_debug): print('parameter_assign_1', list(p))
6026 tpname = Node(syms.tname, [Leaf(token.NAME, p[1])])
6027 expr = Node(syms.tfpdef, [tpname, Leaf(token.EQUAL, p[2]), p[3] ])
6028 p[0] = expr
6029 # { PExpr*tmp = p[3];
6030 # pform_set_parameter(@1, lex_strings.make(p[1]), param_active_type,
6031 # param_active_signed, param_active_range, tmp, p[4]);
6032 # delete[]p[1];
6033 # }
6034 ()
6035 def p_localparam_assign_1(p):
6036 '''localparam_assign : IDENTIFIER '=' expression '''
6037 if(parse_debug): print('localparam_assign_1', list(p))
6038 # { PExpr*tmp = p[3];
6039 # pform_set_localparam(@1, lex_strings.make(p[1]), param_active_type,
6040 # param_active_signed, param_active_range, tmp);
6041 # delete[]p[1];
6042 # }
6043 ()
6044 def p_parameter_value_ranges_opt_1(p):
6045 '''parameter_value_ranges_opt : parameter_value_ranges '''
6046 if(parse_debug): print('parameter_value_ranges_opt_1', list(p))
6047 p[0] = p[1]
6048 ()
6049 def p_parameter_value_ranges_opt_2(p):
6050 '''parameter_value_ranges_opt : '''
6051 if(parse_debug): print('parameter_value_ranges_opt_2', list(p))
6052 # { p[0] = None }
6053 ()
6054 def p_parameter_value_ranges_1(p):
6055 '''parameter_value_ranges : parameter_value_ranges parameter_value_range '''
6056 if(parse_debug): print('parameter_value_ranges_1', list(p))
6057 # { p[0] = p[2]; p[0]->next = p[1]; }
6058 ()
6059 def p_parameter_value_ranges_2(p):
6060 '''parameter_value_ranges : parameter_value_range '''
6061 if(parse_debug): print('parameter_value_ranges_2', list(p))
6062 # { p[0] = p[1]; p[0]->next = 0; }
6063 ()
6064 def p_parameter_value_range_1(p):
6065 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ']' '''
6066 if(parse_debug): print('parameter_value_range_1', list(p))
6067 # { p[0] = pform_parameter_value_range(p[1], false, p[3], false, p[5]); }
6068 ()
6069 def p_parameter_value_range_2(p):
6070 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ')' '''
6071 if(parse_debug): print('parameter_value_range_2', list(p))
6072 # { p[0] = pform_parameter_value_range(p[1], false, p[3], true, p[5]); }
6073 ()
6074 def p_parameter_value_range_3(p):
6075 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ']' '''
6076 if(parse_debug): print('parameter_value_range_3', list(p))
6077 # { p[0] = pform_parameter_value_range(p[1], true, p[3], false, p[5]); }
6078 ()
6079 def p_parameter_value_range_4(p):
6080 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ')' '''
6081 if(parse_debug): print('parameter_value_range_4', list(p))
6082 # { p[0] = pform_parameter_value_range(p[1], true, p[3], true, p[5]); }
6083 ()
6084 def p_parameter_value_range_5(p):
6085 '''parameter_value_range : K_exclude expression '''
6086 if(parse_debug): print('parameter_value_range_5', list(p))
6087 # { p[0] = pform_parameter_value_range(true, false, p[2], false, p[2]); }
6088 ()
6089 def p_value_range_expression_1(p):
6090 '''value_range_expression : expression '''
6091 if(parse_debug): print('value_range_expression_1', list(p))
6092 p[0] = p[1]
6093 ()
6094 def p_value_range_expression_2(p):
6095 '''value_range_expression : K_inf '''
6096 if(parse_debug): print('value_range_expression_2', list(p))
6097 # { p[0] = None }
6098 ()
6099 def p_value_range_expression_3(p):
6100 '''value_range_expression : '+' K_inf '''
6101 if(parse_debug): print('value_range_expression_3', list(p))
6102 # { p[0] = None }
6103 ()
6104 def p_value_range_expression_4(p):
6105 '''value_range_expression : '-' K_inf '''
6106 if(parse_debug): print('value_range_expression_4', list(p))
6107 # { p[0] = None }
6108 ()
6109 def p_from_exclude_1(p):
6110 '''from_exclude : K_from '''
6111 if(parse_debug): print('from_exclude_1', list(p))
6112 p[0] = False
6113 ()
6114 def p_from_exclude_2(p):
6115 '''from_exclude : K_exclude '''
6116 if(parse_debug): print('from_exclude_2', list(p))
6117 p[0] = True
6118 ()
6119 def p_parameter_value_opt_1(p):
6120 '''parameter_value_opt : '#' '(' expression_list_with_nuls ')' '''
6121 if(parse_debug): print('parameter_value_opt_1', list(p))
6122 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6123 # tmp->by_order = p[3];
6124 # tmp->by_name = 0;
6125 # p[0] = tmp;
6126 # }
6127 ()
6128 def p_parameter_value_opt_2(p):
6129 '''parameter_value_opt : '#' '(' parameter_value_byname_list ')' '''
6130 if(parse_debug): print('parameter_value_opt_2', list(p))
6131 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6132 # tmp->by_order = 0;
6133 # tmp->by_name = p[3];
6134 # p[0] = tmp;
6135 # }
6136 ()
6137 def p_parameter_value_opt_3(p):
6138 '''parameter_value_opt : '#' DEC_NUMBER '''
6139 if(parse_debug): print('parameter_value_opt_3', list(p))
6140 # { assert(p[2]);
6141 # PENumber*tmp = new PENumber(p[2]);
6142 # FILE_NAME(tmp, @1);
6143 #
6144 # struct parmvalue_t*lst = new struct parmvalue_t;
6145 # lst->by_order = new list<PExpr*>;
6146 # lst->by_order->push_back(tmp);
6147 # lst->by_name = 0;
6148 # p[0] = lst;
6149 # based_size = 0;
6150 # }
6151 ()
6152 def p_parameter_value_opt_4(p):
6153 '''parameter_value_opt : '#' REALTIME '''
6154 if(parse_debug): print('parameter_value_opt_4', list(p))
6155 # { assert(p[2]);
6156 # PEFNumber*tmp = new PEFNumber(p[2]);
6157 # FILE_NAME(tmp, @1);
6158 #
6159 # struct parmvalue_t*lst = new struct parmvalue_t;
6160 # lst->by_order = new list<PExpr*>;
6161 # lst->by_order->push_back(tmp);
6162 # lst->by_name = 0;
6163 # p[0] = lst;
6164 # }
6165 ()
6166 def p_parameter_value_opt_5(p):
6167 '''parameter_value_opt : '#' error '''
6168 if(parse_debug): print('parameter_value_opt_5', list(p))
6169 # { yyerror(@1, "error: syntax error in parameter value "
6170 # "assignment list.");
6171 # p[0] = None
6172 # }
6173 ()
6174 def p_parameter_value_opt_6(p):
6175 '''parameter_value_opt : '''
6176 if(parse_debug): print('parameter_value_opt_6', list(p))
6177 # { p[0] = None }
6178 ()
6179 def p_parameter_value_byname_1(p):
6180 '''parameter_value_byname : '.' IDENTIFIER '(' expression ')' '''
6181 if(parse_debug): print('parameter_value_byname_1', list(p))
6182 # { named_pexpr_t*tmp = new named_pexpr_t;
6183 # tmp->name = lex_strings.make(p[2]);
6184 # tmp->parm = p[4];
6185 # delete[]p[2];
6186 # p[0] = tmp;
6187 # }
6188 ()
6189 def p_parameter_value_byname_2(p):
6190 '''parameter_value_byname : '.' IDENTIFIER '(' ')' '''
6191 if(parse_debug): print('parameter_value_byname_2', list(p))
6192 # { named_pexpr_t*tmp = new named_pexpr_t;
6193 # tmp->name = lex_strings.make(p[2]);
6194 # tmp->parm = 0;
6195 # delete[]p[2];
6196 # p[0] = tmp;
6197 # }
6198 ()
6199 def p_parameter_value_byname_list_1(p):
6200 '''parameter_value_byname_list : parameter_value_byname '''
6201 if(parse_debug): print('parameter_value_byname_list_1', list(p))
6202 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6203 # tmp->push_back(*p[1]);
6204 # delete p[1];
6205 # p[0] = tmp;
6206 # }
6207 ()
6208 def p_parameter_value_byname_list_2(p):
6209 '''parameter_value_byname_list : parameter_value_byname_list ',' parameter_value_byname '''
6210 if(parse_debug): print('parameter_value_byname_list_2', list(p))
6211 # { list<named_pexpr_t>*tmp = p[1];
6212 # tmp->push_back(*p[3]);
6213 # delete p[3];
6214 # p[0] = tmp;
6215 # }
6216 ()
6217 def p_port_1(p):
6218 '''port : port_reference '''
6219 if(parse_debug): print('port_1', list(p))
6220 p[0] = p[1]
6221 ()
6222 def p_port_2(p):
6223 '''port : '.' IDENTIFIER '(' port_reference ')' '''
6224 if(parse_debug): print('port_2', list(p))
6225 # { Module::port_t*tmp = p[4];
6226 # tmp->name = lex_strings.make(p[2]);
6227 # delete[]p[2];
6228 # p[0] = tmp;
6229 # }
6230 ()
6231 def p_port_3(p):
6232 '''port : '{' port_reference_list '}' '''
6233 if(parse_debug): print('port_3', list(p))
6234 # { Module::port_t*tmp = p[2];
6235 # tmp->name = perm_string();
6236 # p[0] = tmp;
6237 # }
6238 ()
6239 def p_port_4(p):
6240 '''port : '.' IDENTIFIER '(' '{' port_reference_list '}' ')' '''
6241 if(parse_debug): print('port_4', list(p))
6242 # { Module::port_t*tmp = p[5];
6243 # tmp->name = lex_strings.make(p[2]);
6244 # delete[]p[2];
6245 # p[0] = tmp;
6246 # }
6247 ()
6248 def p_port_opt_1(p):
6249 '''port_opt : port '''
6250 if(parse_debug): print('port_opt_1', list(p))
6251 p[0] = p[1]
6252 ()
6253 def p_port_opt_2(p):
6254 '''port_opt : '''
6255 if(parse_debug): print('port_opt_2', list(p))
6256 # { p[0] = None }
6257 ()
6258 def p_port_name_1(p):
6259 '''port_name : '.' IDENTIFIER '(' expression ')' '''
6260 if(parse_debug): print('port_name_1', list(p))
6261 # { named_pexpr_t*tmp = new named_pexpr_t;
6262 # tmp->name = lex_strings.make(p[2]);
6263 # tmp->parm = p[4];
6264 # delete[]p[2];
6265 # p[0] = tmp;
6266 # }
6267 ()
6268 def p_port_name_2(p):
6269 '''port_name : '.' IDENTIFIER '(' error ')' '''
6270 if(parse_debug): print('port_name_2', list(p))
6271 # { yyerror(@3, "error: invalid port connection expression.");
6272 # named_pexpr_t*tmp = new named_pexpr_t;
6273 # tmp->name = lex_strings.make(p[2]);
6274 # tmp->parm = 0;
6275 # delete[]p[2];
6276 # p[0] = tmp;
6277 # }
6278 ()
6279 def p_port_name_3(p):
6280 '''port_name : '.' IDENTIFIER '(' ')' '''
6281 if(parse_debug): print('port_name_3', list(p))
6282 # { named_pexpr_t*tmp = new named_pexpr_t;
6283 # tmp->name = lex_strings.make(p[2]);
6284 # tmp->parm = 0;
6285 # delete[]p[2];
6286 # p[0] = tmp;
6287 # }
6288 ()
6289 def p_port_name_4(p):
6290 '''port_name : '.' IDENTIFIER '''
6291 if(parse_debug): print('port_name_4', list(p))
6292 # { named_pexpr_t*tmp = new named_pexpr_t;
6293 # tmp->name = lex_strings.make(p[2]);
6294 # tmp->parm = new PEIdent(lex_strings.make(p[2]), true);
6295 # FILE_NAME(tmp->parm, @1);
6296 # delete[]p[2];
6297 # p[0] = tmp;
6298 # }
6299 ()
6300 def p_port_name_5(p):
6301 '''port_name : K_DOTSTAR '''
6302 if(parse_debug): print('port_name_5', list(p))
6303 # { named_pexpr_t*tmp = new named_pexpr_t;
6304 # tmp->name = lex_strings.make("*");
6305 # tmp->parm = 0;
6306 # p[0] = tmp;
6307 # }
6308 ()
6309 def p_port_name_list_1(p):
6310 '''port_name_list : port_name_list ',' port_name '''
6311 if(parse_debug): print('port_name_list_1', list(p))
6312 # { list<named_pexpr_t>*tmp = p[1];
6313 # tmp->push_back(*p[3]);
6314 # delete p[3];
6315 # p[0] = tmp;
6316 # }
6317 ()
6318 def p_port_name_list_2(p):
6319 '''port_name_list : port_name '''
6320 if(parse_debug): print('port_name_list_2', list(p))
6321 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6322 # tmp->push_back(*p[1]);
6323 # delete p[1];
6324 # p[0] = tmp;
6325 # }
6326 ()
6327 def p_port_reference_1(p):
6328 '''port_reference : IDENTIFIER '''
6329 if(parse_debug): print('port_reference_1', list(p))
6330 # { Module::port_t*ptmp;
6331 # perm_string name = lex_strings.make(p[1]);
6332 # ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
6333 # delete[]p[1];
6334 # p[0] = ptmp;
6335 # }
6336 ()
6337 def p_port_reference_2(p):
6338 '''port_reference : IDENTIFIER '[' expression ':' expression ']' '''
6339 if(parse_debug): print('port_reference_2', list(p))
6340 # { index_component_t itmp;
6341 # itmp.sel = index_component_t::SEL_PART;
6342 # itmp.msb = p[3];
6343 # itmp.lsb = p[5];
6344 #
6345 # name_component_t ntmp (lex_strings.make(p[1]));
6346 # ntmp.index.push_back(itmp);
6347 #
6348 # pform_name_t pname;
6349 # pname.push_back(ntmp);
6350 #
6351 # PEIdent*wtmp = new PEIdent(pname);
6352 # FILE_NAME(wtmp, @1);
6353 #
6354 # Module::port_t*ptmp = new Module::port_t;
6355 # ptmp->name = perm_string();
6356 # ptmp->expr.push_back(wtmp);
6357 #
6358 # delete[]p[1];
6359 # p[0] = ptmp;
6360 # }
6361 ()
6362 def p_port_reference_3(p):
6363 '''port_reference : IDENTIFIER '[' expression ']' '''
6364 if(parse_debug): print('port_reference_3', list(p))
6365 # { index_component_t itmp;
6366 # itmp.sel = index_component_t::SEL_BIT;
6367 # itmp.msb = p[3];
6368 # itmp.lsb = 0;
6369 #
6370 # name_component_t ntmp (lex_strings.make(p[1]));
6371 # ntmp.index.push_back(itmp);
6372 #
6373 # pform_name_t pname;
6374 # pname.push_back(ntmp);
6375 #
6376 # PEIdent*tmp = new PEIdent(pname);
6377 # FILE_NAME(tmp, @1);
6378 #
6379 # Module::port_t*ptmp = new Module::port_t;
6380 # ptmp->name = perm_string();
6381 # ptmp->expr.push_back(tmp);
6382 # delete[]p[1];
6383 # p[0] = ptmp;
6384 # }
6385 ()
6386 def p_port_reference_4(p):
6387 '''port_reference : IDENTIFIER '[' error ']' '''
6388 if(parse_debug): print('port_reference_4', list(p))
6389 # { yyerror(@1, "error: invalid port bit select");
6390 # Module::port_t*ptmp = new Module::port_t;
6391 # PEIdent*wtmp = new PEIdent(lex_strings.make(p[1]));
6392 # FILE_NAME(wtmp, @1);
6393 # ptmp->name = lex_strings.make(p[1]);
6394 # ptmp->expr.push_back(wtmp);
6395 # delete[]p[1];
6396 # p[0] = ptmp;
6397 # }
6398 ()
6399 def p_port_reference_list_1(p):
6400 '''port_reference_list : port_reference '''
6401 if(parse_debug): print('port_reference_list_1', list(p))
6402 p[0] = p[1]
6403 ()
6404 def p_port_reference_list_2(p):
6405 '''port_reference_list : port_reference_list ',' port_reference '''
6406 if(parse_debug): print('port_reference_list_2', list(p))
6407 # { Module::port_t*tmp = p[1];
6408 # append(tmp->expr, p[3]->expr);
6409 # delete p[3];
6410 # p[0] = tmp;
6411 # }
6412 ()
6413 def p_dimensions_opt_1(p):
6414 '''dimensions_opt : '''
6415 if(parse_debug>2): print('dimensions_opt_1', list(p))
6416 # { p[0] = None }
6417 ()
6418 def p_dimensions_opt_2(p):
6419 '''dimensions_opt : dimensions '''
6420 if(parse_debug): print('dimensions_opt_2', list(p))
6421 p[0] = p[1]
6422 ()
6423 def p_dimensions_1(p):
6424 '''dimensions : variable_dimension '''
6425 if(parse_debug): print('dimensions_1', list(p))
6426 p[0] = p[1]
6427 ()
6428 def p_dimensions_2(p):
6429 '''dimensions : dimensions variable_dimension '''
6430 if(parse_debug): print('dimensions_2', list(p))
6431 # { list<pform_range_t> *tmp = p[1];
6432 # if (p[2]) {
6433 # tmp->splice(tmp->end(), *p[2]);
6434 # delete p[2];
6435 # }
6436 # p[0] = tmp;
6437 # }
6438 ()
6439 def p_register_variable_1(p):
6440 '''register_variable : IDENTIFIER dimensions_opt '''
6441 if(parse_debug): print('register_variable_1', list(p))
6442 # { perm_string name = lex_strings.make(p[1]);
6443 # pform_makewire(@1, name, NetNet::REG,
6444 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6445 # pform_set_reg_idx(name, p[2]);
6446 # p[0] = p[1];
6447 # }
6448 ()
6449 def p_register_variable_2(p):
6450 '''register_variable : IDENTIFIER dimensions_opt '=' expression '''
6451 if(parse_debug): print('register_variable_2', list(p))
6452 # { if (pform_peek_scope()->var_init_needs_explicit_lifetime()
6453 # && (var_lifetime == LexicalScope::INHERITED)) {
6454 # cerr << @3 << ": warning: Static variable initialization requires "
6455 # "explicit lifetime in this context." << endl;
6456 # warn_count += 1;
6457 # }
6458 # perm_string name = lex_strings.make(p[1]);
6459 # pform_makewire(@1, name, NetNet::REG,
6460 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6461 # pform_set_reg_idx(name, p[2]);
6462 # pform_make_var_init(@1, name, p[4]);
6463 # p[0] = p[1];
6464 # }
6465 ()
6466 def p_register_variable_list_1(p):
6467 '''register_variable_list : register_variable '''
6468 if(parse_debug): print('register_variable_list_1', list(p))
6469 # { list<perm_string>*tmp = new list<perm_string>;
6470 # tmp->push_back(lex_strings.make(p[1]));
6471 # p[0] = tmp;
6472 # delete[]p[1];
6473 # }
6474 ()
6475 def p_register_variable_list_2(p):
6476 '''register_variable_list : register_variable_list ',' register_variable '''
6477 if(parse_debug): print('register_variable_list_2', list(p))
6478 # { list<perm_string>*tmp = p[1];
6479 # tmp->push_back(lex_strings.make(p[3]));
6480 # p[0] = tmp;
6481 # delete[]p[3];
6482 # }
6483 ()
6484 def p_net_variable_1(p):
6485 '''net_variable : IDENTIFIER dimensions_opt '''
6486 if(parse_debug): print('net_variable_1', list(p))
6487 # { perm_string name = lex_strings.make(p[1]);
6488 # pform_makewire(@1, name, NetNet::IMPLICIT,
6489 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6490 # pform_set_reg_idx(name, p[2]);
6491 # p[0] = p[1];
6492 # }
6493 ()
6494 def p_net_variable_list_1(p):
6495 '''net_variable_list : net_variable '''
6496 if(parse_debug): print('net_variable_list_1', list(p))
6497 # { list<perm_string>*tmp = new list<perm_string>;
6498 # tmp->push_back(lex_strings.make(p[1]));
6499 # p[0] = tmp;
6500 # delete[]p[1];
6501 # }
6502 ()
6503 def p_net_variable_list_2(p):
6504 '''net_variable_list : net_variable_list ',' net_variable '''
6505 if(parse_debug): print('net_variable_list_2', list(p))
6506 # { list<perm_string>*tmp = p[1];
6507 # tmp->push_back(lex_strings.make(p[3]));
6508 # p[0] = tmp;
6509 # delete[]p[3];
6510 # }
6511 ()
6512 def p_event_variable_1(p):
6513 '''event_variable : IDENTIFIER dimensions_opt '''
6514 if(parse_debug): print('event_variable_1', list(p))
6515 # { if (p[2]) {
6516 # yyerror(@2, "sorry: event arrays are not supported.");
6517 # delete p[2];
6518 # }
6519 # p[0] = p[1];
6520 # }
6521 ()
6522 def p_event_variable_list_1(p):
6523 '''event_variable_list : event_variable '''
6524 if(parse_debug): print('event_variable_list_1', list(p))
6525 # { p[0] = list_from_identifier(p[1]); }
6526 ()
6527 def p_event_variable_list_2(p):
6528 '''event_variable_list : event_variable_list ',' event_variable '''
6529 if(parse_debug): print('event_variable_list_2', list(p))
6530 # { p[0] = list_from_identifier(p[1], p[3]); }
6531 ()
6532 def p_specify_item_1(p):
6533 '''specify_item : K_specparam specparam_decl ';' '''
6534 if(parse_debug): print('specify_item_1', list(p))
6535 ()
6536 def p_specify_item_2(p):
6537 '''specify_item : specify_simple_path_decl ';' '''
6538 if(parse_debug): print('specify_item_2', list(p))
6539 # { pform_module_specify_path(p[1]);
6540 # }
6541 ()
6542 def p_specify_item_3(p):
6543 '''specify_item : specify_edge_path_decl ';' '''
6544 if(parse_debug): print('specify_item_3', list(p))
6545 # { pform_module_specify_path(p[1]);
6546 # }
6547 ()
6548 def p_specify_item_4(p):
6549 '''specify_item : K_if '(' expression ')' specify_simple_path_decl ';' '''
6550 if(parse_debug): print('specify_item_4', list(p))
6551 # { PSpecPath*tmp = p[5];
6552 # if (tmp) {
6553 # tmp->conditional = true;
6554 # tmp->condition = p[3];
6555 # }
6556 # pform_module_specify_path(tmp);
6557 # }
6558 ()
6559 def p_specify_item_5(p):
6560 '''specify_item : K_if '(' expression ')' specify_edge_path_decl ';' '''
6561 if(parse_debug): print('specify_item_5', list(p))
6562 # { PSpecPath*tmp = p[5];
6563 # if (tmp) {
6564 # tmp->conditional = true;
6565 # tmp->condition = p[3];
6566 # }
6567 # pform_module_specify_path(tmp);
6568 # }
6569 ()
6570 def p_specify_item_6(p):
6571 '''specify_item : K_ifnone specify_simple_path_decl ';' '''
6572 if(parse_debug): print('specify_item_6', list(p))
6573 # { PSpecPath*tmp = p[2];
6574 # if (tmp) {
6575 # tmp->conditional = true;
6576 # tmp->condition = 0;
6577 # }
6578 # pform_module_specify_path(tmp);
6579 # }
6580 ()
6581 def p_specify_item_7(p):
6582 '''specify_item : K_ifnone specify_edge_path_decl ';' '''
6583 if(parse_debug): print('specify_item_7', list(p))
6584 # { yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
6585 # "not supported.");
6586 # yyerrok;
6587 # }
6588 ()
6589 def p_specify_item_8(p):
6590 '''specify_item : K_Sfullskew '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6591 if(parse_debug): print('specify_item_8', list(p))
6592 # { delete p[7];
6593 # delete p[9];
6594 # }
6595 ()
6596 def p_specify_item_9(p):
6597 '''specify_item : K_Shold '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6598 if(parse_debug): print('specify_item_9', list(p))
6599 # { delete p[7];
6600 # }
6601 ()
6602 def p_specify_item_10(p):
6603 '''specify_item : K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6604 if(parse_debug): print('specify_item_10', list(p))
6605 # { delete p[7];
6606 # delete p[9];
6607 # }
6608 ()
6609 def p_specify_item_11(p):
6610 '''specify_item : K_Speriod '(' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6611 if(parse_debug): print('specify_item_11', list(p))
6612 # { delete p[5];
6613 # }
6614 ()
6615 def p_specify_item_12(p):
6616 '''specify_item : K_Srecovery '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6617 if(parse_debug): print('specify_item_12', list(p))
6618 # { delete p[7];
6619 # }
6620 ()
6621 def p_specify_item_13(p):
6622 '''specify_item : K_Srecrem '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6623 if(parse_debug): print('specify_item_13', list(p))
6624 # { delete p[7];
6625 # delete p[9];
6626 # }
6627 ()
6628 def p_specify_item_14(p):
6629 '''specify_item : K_Sremoval '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6630 if(parse_debug): print('specify_item_14', list(p))
6631 # { delete p[7];
6632 # }
6633 ()
6634 def p_specify_item_15(p):
6635 '''specify_item : K_Ssetup '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6636 if(parse_debug): print('specify_item_15', list(p))
6637 # { delete p[7];
6638 # }
6639 ()
6640 def p_specify_item_16(p):
6641 '''specify_item : K_Ssetuphold '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6642 if(parse_debug): print('specify_item_16', list(p))
6643 # { delete p[7];
6644 # delete p[9];
6645 # }
6646 ()
6647 def p_specify_item_17(p):
6648 '''specify_item : K_Sskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6649 if(parse_debug): print('specify_item_17', list(p))
6650 # { delete p[7];
6651 # }
6652 ()
6653 def p_specify_item_18(p):
6654 '''specify_item : K_Stimeskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6655 if(parse_debug): print('specify_item_18', list(p))
6656 # { delete p[7];
6657 # }
6658 ()
6659 def p_specify_item_19(p):
6660 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ',' expression spec_notifier_opt ')' ';' '''
6661 if(parse_debug): print('specify_item_19', list(p))
6662 # { delete p[5];
6663 # delete p[7];
6664 # }
6665 ()
6666 def p_specify_item_20(p):
6667 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ')' ';' '''
6668 if(parse_debug): print('specify_item_20', list(p))
6669 # { delete p[5];
6670 # }
6671 ()
6672 def p_specify_item_21(p):
6673 '''specify_item : K_pulsestyle_onevent specify_path_identifiers ';' '''
6674 if(parse_debug): print('specify_item_21', list(p))
6675 # { delete p[2];
6676 # }
6677 ()
6678 def p_specify_item_22(p):
6679 '''specify_item : K_pulsestyle_ondetect specify_path_identifiers ';' '''
6680 if(parse_debug): print('specify_item_22', list(p))
6681 # { delete p[2];
6682 # }
6683 ()
6684 def p_specify_item_23(p):
6685 '''specify_item : K_showcancelled specify_path_identifiers ';' '''
6686 if(parse_debug): print('specify_item_23', list(p))
6687 # { delete p[2];
6688 # }
6689 ()
6690 def p_specify_item_24(p):
6691 '''specify_item : K_noshowcancelled specify_path_identifiers ';' '''
6692 if(parse_debug): print('specify_item_24', list(p))
6693 # { delete p[2];
6694 # }
6695 ()
6696 def p_specify_item_list_1(p):
6697 '''specify_item_list : specify_item '''
6698 if(parse_debug): print('specify_item_list_1', list(p))
6699 ()
6700 def p_specify_item_list_2(p):
6701 '''specify_item_list : specify_item_list specify_item '''
6702 if(parse_debug): print('specify_item_list_2', list(p))
6703 ()
6704 def p_specify_item_list_opt_1(p):
6705 '''specify_item_list_opt : '''
6706 if(parse_debug): print('specify_item_list_opt_1', list(p))
6707 # { }
6708 ()
6709 def p_specify_item_list_opt_2(p):
6710 '''specify_item_list_opt : specify_item_list '''
6711 if(parse_debug): print('specify_item_list_opt_2', list(p))
6712 # { }
6713 ()
6714 def p_specify_edge_path_decl_1(p):
6715 '''specify_edge_path_decl : specify_edge_path '=' '(' delay_value_list ')' '''
6716 if(parse_debug): print('specify_edge_path_decl_1', list(p))
6717 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
6718 ()
6719 def p_specify_edge_path_decl_2(p):
6720 '''specify_edge_path_decl : specify_edge_path '=' delay_value_simple '''
6721 if(parse_debug): print('specify_edge_path_decl_2', list(p))
6722 # { list<PExpr*>*tmp = new list<PExpr*>;
6723 # tmp->push_back(p[3]);
6724 # p[0] = pform_assign_path_delay(p[1], tmp);
6725 # }
6726 ()
6727 def p_edge_operator_1(p):
6728 '''edge_operator : K_posedge '''
6729 if(parse_debug): print('edge_operator_1', list(p))
6730 p[0] = True
6731 ()
6732 def p_edge_operator_2(p):
6733 '''edge_operator : K_negedge '''
6734 if(parse_debug): print('edge_operator_2', list(p))
6735 p[0] = False
6736 ()
6737 def p_specify_edge_path_1(p):
6738 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6739 if(parse_debug): print('specify_edge_path_1', list(p))
6740 # { int edge_flag = 0;
6741 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], false, p[6], p[8]); }
6742 ()
6743 def p_specify_edge_path_2(p):
6744 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6745 if(parse_debug): print('specify_edge_path_2', list(p))
6746 # { int edge_flag = p[2]? 1 : -1;
6747 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], false, p[7], p[9]);}
6748 ()
6749 def p_specify_edge_path_3(p):
6750 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6751 if(parse_debug): print('specify_edge_path_3', list(p))
6752 # { int edge_flag = 0;
6753 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], true, p[6], p[8]); }
6754 ()
6755 def p_specify_edge_path_4(p):
6756 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6757 if(parse_debug): print('specify_edge_path_4', list(p))
6758 # { int edge_flag = p[2]? 1 : -1;
6759 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], true, p[7], p[9]); }
6760 ()
6761 def p_polarity_operator_1(p):
6762 '''polarity_operator : K_PO_POS '''
6763 if(parse_debug): print('polarity_operator_1', list(p))
6764 ()
6765 def p_polarity_operator_2(p):
6766 '''polarity_operator : K_PO_NEG '''
6767 if(parse_debug): print('polarity_operator_2', list(p))
6768 ()
6769 def p_polarity_operator_3(p):
6770 '''polarity_operator : ':' '''
6771 if(parse_debug): print('polarity_operator_3', list(p))
6772 ()
6773 def p_specify_simple_path_decl_1(p):
6774 '''specify_simple_path_decl : specify_simple_path '=' '(' delay_value_list ')' '''
6775 if(parse_debug): print('specify_simple_path_decl_1', list(p))
6776 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
6777 ()
6778 def p_specify_simple_path_decl_2(p):
6779 '''specify_simple_path_decl : specify_simple_path '=' delay_value_simple '''
6780 if(parse_debug): print('specify_simple_path_decl_2', list(p))
6781 # { list<PExpr*>*tmp = new list<PExpr*>;
6782 # tmp->push_back(p[3]);
6783 # p[0] = pform_assign_path_delay(p[1], tmp);
6784 # }
6785 ()
6786 def p_specify_simple_path_decl_3(p):
6787 '''specify_simple_path_decl : specify_simple_path '=' '(' error ')' '''
6788 if(parse_debug): print('specify_simple_path_decl_3', list(p))
6789 # { yyerror(@3, "Syntax error in delay value list.");
6790 # yyerrok;
6791 # p[0] = None
6792 # }
6793 ()
6794 def p_specify_simple_path_1(p):
6795 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' '''
6796 if(parse_debug): print('specify_simple_path_1', list(p))
6797 # { p[0] = pform_make_specify_path(@1, p[2], p[3], false, p[5]); }
6798 ()
6799 def p_specify_simple_path_2(p):
6800 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' '''
6801 if(parse_debug): print('specify_simple_path_2', list(p))
6802 # { p[0] = pform_make_specify_path(@1, p[2], p[3], true, p[5]); }
6803 ()
6804 def p_specify_simple_path_3(p):
6805 '''specify_simple_path : '(' error ')' '''
6806 if(parse_debug): print('specify_simple_path_3', list(p))
6807 # { yyerror(@1, "Invalid simple path");
6808 # yyerrok;
6809 # }
6810 ()
6811 def p_specify_path_identifiers_1(p):
6812 '''specify_path_identifiers : IDENTIFIER '''
6813 if(parse_debug): print('specify_path_identifiers_1', list(p))
6814 # { list<perm_string>*tmp = new list<perm_string>;
6815 # tmp->push_back(lex_strings.make(p[1]));
6816 # p[0] = tmp;
6817 # delete[]p[1];
6818 # }
6819 ()
6820 def p_specify_path_identifiers_2(p):
6821 '''specify_path_identifiers : IDENTIFIER '[' expr_primary ']' '''
6822 if(parse_debug): print('specify_path_identifiers_2', list(p))
6823 # { if (gn_specify_blocks_flag) {
6824 # yywarn(@4, "Bit selects are not currently supported "
6825 # "in path declarations. The declaration "
6826 # "will be applied to the whole vector.");
6827 # }
6828 # list<perm_string>*tmp = new list<perm_string>;
6829 # tmp->push_back(lex_strings.make(p[1]));
6830 # p[0] = tmp;
6831 # delete[]p[1];
6832 # }
6833 ()
6834 def p_specify_path_identifiers_3(p):
6835 '''specify_path_identifiers : IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6836 if(parse_debug): print('specify_path_identifiers_3', list(p))
6837 # { if (gn_specify_blocks_flag) {
6838 # yywarn(@4, "Part selects are not currently supported "
6839 # "in path declarations. The declaration "
6840 # "will be applied to the whole vector.");
6841 # }
6842 # list<perm_string>*tmp = new list<perm_string>;
6843 # tmp->push_back(lex_strings.make(p[1]));
6844 # p[0] = tmp;
6845 # delete[]p[1];
6846 # }
6847 ()
6848 def p_specify_path_identifiers_4(p):
6849 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '''
6850 if(parse_debug): print('specify_path_identifiers_4', list(p))
6851 # { list<perm_string>*tmp = p[1];
6852 # tmp->push_back(lex_strings.make(p[3]));
6853 # p[0] = tmp;
6854 # delete[]p[3];
6855 # }
6856 ()
6857 def p_specify_path_identifiers_5(p):
6858 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' '''
6859 if(parse_debug): print('specify_path_identifiers_5', list(p))
6860 # { if (gn_specify_blocks_flag) {
6861 # yywarn(@4, "Bit selects are not currently supported "
6862 # "in path declarations. The declaration "
6863 # "will be applied to the whole vector.");
6864 # }
6865 # list<perm_string>*tmp = p[1];
6866 # tmp->push_back(lex_strings.make(p[3]));
6867 # p[0] = tmp;
6868 # delete[]p[3];
6869 # }
6870 ()
6871 def p_specify_path_identifiers_6(p):
6872 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6873 if(parse_debug): print('specify_path_identifiers_6', list(p))
6874 # { if (gn_specify_blocks_flag) {
6875 # yywarn(@4, "Part selects are not currently supported "
6876 # "in path declarations. The declaration "
6877 # "will be applied to the whole vector.");
6878 # }
6879 # list<perm_string>*tmp = p[1];
6880 # tmp->push_back(lex_strings.make(p[3]));
6881 # p[0] = tmp;
6882 # delete[]p[3];
6883 # }
6884 ()
6885 def p_specparam_1(p):
6886 '''specparam : IDENTIFIER '=' expression '''
6887 if(parse_debug): print('specparam_1', list(p))
6888 # { PExpr*tmp = p[3];
6889 # pform_set_specparam(@1, lex_strings.make(p[1]),
6890 # param_active_range, tmp);
6891 # delete[]p[1];
6892 # }
6893 ()
6894 def p_specparam_2(p):
6895 '''specparam : IDENTIFIER '=' expression ':' expression ':' expression '''
6896 if(parse_debug): print('specparam_2', list(p))
6897 # { PExpr*tmp = 0;
6898 # switch (min_typ_max_flag) {
6899 # case MIN:
6900 # tmp = p[3];
6901 # delete p[5];
6902 # delete p[7];
6903 # break;
6904 # case TYP:
6905 # delete p[3];
6906 # tmp = p[5];
6907 # delete p[7];
6908 # break;
6909 # case MAX:
6910 # delete p[3];
6911 # delete p[5];
6912 # tmp = p[7];
6913 # break;
6914 # }
6915 # if (min_typ_max_warn > 0) {
6916 # cerr << tmp->get_fileline() << ": warning: choosing ";
6917 # switch (min_typ_max_flag) {
6918 # case MIN:
6919 # cerr << "min";
6920 # break;
6921 # case TYP:
6922 # cerr << "typ";
6923 # break;
6924 # case MAX:
6925 # cerr << "max";
6926 # break;
6927 # }
6928 # cerr << " expression." << endl;
6929 # min_typ_max_warn -= 1;
6930 # }
6931 # pform_set_specparam(@1, lex_strings.make(p[1]),
6932 # param_active_range, tmp);
6933 # delete[]p[1];
6934 # }
6935 ()
6936 def p_specparam_3(p):
6937 '''specparam : PATHPULSE_IDENTIFIER '=' expression '''
6938 if(parse_debug): print('specparam_3', list(p))
6939 # { delete[]p[1];
6940 # delete p[3];
6941 # }
6942 ()
6943 def p_specparam_4(p):
6944 '''specparam : PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' '''
6945 if(parse_debug): print('specparam_4', list(p))
6946 # { delete[]p[1];
6947 # delete p[4];
6948 # delete p[6];
6949 # }
6950 ()
6951 def p_specparam_list_1(p):
6952 '''specparam_list : specparam '''
6953 if(parse_debug): print('specparam_list_1', list(p))
6954 ()
6955 def p_specparam_list_2(p):
6956 '''specparam_list : specparam_list ',' specparam '''
6957 if(parse_debug): print('specparam_list_2', list(p))
6958 ()
6959 def p_specparam_decl_1(p):
6960 '''specparam_decl : specparam_list '''
6961 if(parse_debug): print('specparam_decl_1', list(p))
6962 ()
6963 def p_specparam_decl_2(p):
6964 '''specparam_decl : dimensions _embed0_specparam_decl specparam_list '''
6965 if(parse_debug): print('specparam_decl_2', list(p))
6966 # { param_active_range = 0; }
6967 ()
6968 def p__embed0_specparam_decl(p):
6969 '''_embed0_specparam_decl : '''
6970 # { param_active_range = p[1]; }
6971 ()
6972 def p_spec_polarity_1(p):
6973 '''spec_polarity : '+' '''
6974 if(parse_debug): print('spec_polarity_1', list(p))
6975 # { p[0] = '+'; }
6976 ()
6977 def p_spec_polarity_2(p):
6978 '''spec_polarity : '-' '''
6979 if(parse_debug): print('spec_polarity_2', list(p))
6980 # { p[0] = '-'; }
6981 ()
6982 def p_spec_polarity_3(p):
6983 '''spec_polarity : '''
6984 if(parse_debug): print('spec_polarity_3', list(p))
6985 # { p[0] = None }
6986 ()
6987 def p_spec_reference_event_1(p):
6988 '''spec_reference_event : K_posedge expression '''
6989 if(parse_debug): print('spec_reference_event_1', list(p))
6990 # { delete p[2]; }
6991 ()
6992 def p_spec_reference_event_2(p):
6993 '''spec_reference_event : K_negedge expression '''
6994 if(parse_debug): print('spec_reference_event_2', list(p))
6995 # { delete p[2]; }
6996 ()
6997 def p_spec_reference_event_3(p):
6998 '''spec_reference_event : K_posedge expr_primary K_TAND expression '''
6999 if(parse_debug): print('spec_reference_event_3', list(p))
7000 # { delete p[2];
7001 # delete p[4];
7002 # }
7003 ()
7004 def p_spec_reference_event_4(p):
7005 '''spec_reference_event : K_negedge expr_primary K_TAND expression '''
7006 if(parse_debug): print('spec_reference_event_4', list(p))
7007 # { delete p[2];
7008 # delete p[4];
7009 # }
7010 ()
7011 def p_spec_reference_event_5(p):
7012 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary '''
7013 if(parse_debug): print('spec_reference_event_5', list(p))
7014 # { delete p[5]; }
7015 ()
7016 def p_spec_reference_event_6(p):
7017 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression '''
7018 if(parse_debug): print('spec_reference_event_6', list(p))
7019 # { delete p[5];
7020 # delete p[7];
7021 # }
7022 ()
7023 def p_spec_reference_event_7(p):
7024 '''spec_reference_event : expr_primary K_TAND expression '''
7025 if(parse_debug): print('spec_reference_event_7', list(p))
7026 # { delete p[1];
7027 # delete p[3];
7028 # }
7029 ()
7030 def p_spec_reference_event_8(p):
7031 '''spec_reference_event : expr_primary '''
7032 if(parse_debug): print('spec_reference_event_8', list(p))
7033 # { delete p[1]; }
7034 ()
7035 def p_edge_descriptor_list_1(p):
7036 '''edge_descriptor_list : edge_descriptor_list ',' K_edge_descriptor '''
7037 if(parse_debug): print('edge_descriptor_list_1', list(p))
7038 ()
7039 def p_edge_descriptor_list_2(p):
7040 '''edge_descriptor_list : K_edge_descriptor '''
7041 if(parse_debug): print('edge_descriptor_list_2', list(p))
7042 ()
7043 def p_spec_notifier_opt_1(p):
7044 '''spec_notifier_opt : '''
7045 if(parse_debug): print('spec_notifier_opt_1', list(p))
7046 # { }
7047 ()
7048 def p_spec_notifier_opt_2(p):
7049 '''spec_notifier_opt : spec_notifier '''
7050 if(parse_debug): print('spec_notifier_opt_2', list(p))
7051 # { }
7052 ()
7053 def p_spec_notifier_1(p):
7054 '''spec_notifier : ',' '''
7055 if(parse_debug): print('spec_notifier_1', list(p))
7056 # { args_after_notifier = 0; }
7057 ()
7058 def p_spec_notifier_2(p):
7059 '''spec_notifier : ',' hierarchy_identifier '''
7060 if(parse_debug): print('spec_notifier_2', list(p))
7061 # { args_after_notifier = 0; delete p[2]; }
7062 ()
7063 def p_spec_notifier_3(p):
7064 '''spec_notifier : spec_notifier ',' '''
7065 if(parse_debug): print('spec_notifier_3', list(p))
7066 # { args_after_notifier += 1; }
7067 ()
7068 def p_spec_notifier_4(p):
7069 '''spec_notifier : spec_notifier ',' hierarchy_identifier '''
7070 if(parse_debug): print('spec_notifier_4', list(p))
7071 # { args_after_notifier += 1;
7072 # if (args_after_notifier >= 3) {
7073 # cerr << @3 << ": warning: timing checks are not supported "
7074 # "and delayed signal \"" << *p[3]
7075 # << "\" will not be driven." << endl;
7076 # }
7077 # delete p[3]; }
7078 ()
7079 def p_spec_notifier_5(p):
7080 '''spec_notifier : IDENTIFIER '''
7081 if(parse_debug): print('spec_notifier_5', list(p))
7082 # { args_after_notifier = 0; delete[]p[1]; }
7083 ()
7084 def p_statement_item_1(p):
7085 '''statement_item : K_assign lpvalue '=' expression ';' '''
7086 if(parse_debug): print('statement_item_1', list(p))
7087 # { PCAssign*tmp = new PCAssign(p[2], p[4]);
7088 # FILE_NAME(tmp, @1);
7089 # p[0] = tmp;
7090 # }
7091 ()
7092 def p_statement_item_2(p):
7093 '''statement_item : K_deassign lpvalue ';' '''
7094 if(parse_debug): print('statement_item_2', list(p))
7095 # { PDeassign*tmp = new PDeassign(p[2]);
7096 # FILE_NAME(tmp, @1);
7097 # p[0] = tmp;
7098 # }
7099 ()
7100 def p_statement_item_3(p):
7101 '''statement_item : K_force lpvalue '=' expression ';' '''
7102 if(parse_debug): print('statement_item_3', list(p))
7103 # { PForce*tmp = new PForce(p[2], p[4]);
7104 # FILE_NAME(tmp, @1);
7105 # p[0] = tmp;
7106 # }
7107 ()
7108 def p_statement_item_4(p):
7109 '''statement_item : K_release lpvalue ';' '''
7110 if(parse_debug): print('statement_item_4', list(p))
7111 # { PRelease*tmp = new PRelease(p[2]);
7112 # FILE_NAME(tmp, @1);
7113 # p[0] = tmp;
7114 # }
7115 ()
7116 def p_statement_item_5(p):
7117 '''statement_item : K_begin K_end '''
7118 if(parse_debug): print('statement_item_5', list(p))
7119 # { PBlock*tmp = new PBlock(PBlock::BL_SEQ);
7120 # FILE_NAME(tmp, @1);
7121 # p[0] = tmp;
7122 # }
7123 ()
7124 def p_statement_item_6(p):
7125 '''statement_item : K_begin _embed0_statement_item block_item_decls_opt _embed1_statement_item statement_or_null_list K_end '''
7126 if(parse_debug): print('statement_item_6', list(p))
7127 # { PBlock*tmp;
7128 # if (p[3]) {
7129 # pform_pop_scope();
7130 # assert(! current_block_stack.empty());
7131 # tmp = current_block_stack.top();
7132 # current_block_stack.pop();
7133 # } else {
7134 # tmp = new PBlock(PBlock::BL_SEQ);
7135 # FILE_NAME(tmp, @1);
7136 # }
7137 # if (p[5]) tmp->set_statement(*p[5]);
7138 # delete p[5];
7139 # p[0] = tmp;
7140 # }
7141 ()
7142 def p_statement_item_7(p):
7143 '''statement_item : K_begin ':' IDENTIFIER _embed2_statement_item block_item_decls_opt statement_or_null_list_opt K_end endlabel_opt '''
7144 if(parse_debug): print('statement_item_7', list(p))
7145 # { pform_pop_scope();
7146 # assert(! current_block_stack.empty());
7147 # PBlock*tmp = current_block_stack.top();
7148 # current_block_stack.pop();
7149 # if (p[6]) tmp->set_statement(*p[6]);
7150 # delete p[6];
7151 # if (p[8]) {
7152 # if (strcmp(p[3],p[8]) != 0) {
7153 # yyerror(@8, "error: End label doesn't match begin name");
7154 # }
7155 # if (! gn_system_verilog()) {
7156 # yyerror(@8, "error: Begin end labels require "
7157 # "SystemVerilog.");
7158 # }
7159 # delete[]p[8];
7160 # }
7161 # delete[]p[3];
7162 # p[0] = tmp;
7163 # }
7164 ()
7165 def p_statement_item_8(p):
7166 '''statement_item : K_fork join_keyword '''
7167 if(parse_debug): print('statement_item_8', list(p))
7168 # { PBlock*tmp = new PBlock(p[2]);
7169 # FILE_NAME(tmp, @1);
7170 # p[0] = tmp;
7171 # }
7172 ()
7173 def p_statement_item_9(p):
7174 '''statement_item : K_fork _embed3_statement_item block_item_decls_opt _embed4_statement_item statement_or_null_list join_keyword '''
7175 if(parse_debug): print('statement_item_9', list(p))
7176 # { PBlock*tmp;
7177 # if (p[3]) {
7178 # pform_pop_scope();
7179 # assert(! current_block_stack.empty());
7180 # tmp = current_block_stack.top();
7181 # current_block_stack.pop();
7182 # tmp->set_join_type(p[6]);
7183 # } else {
7184 # tmp = new PBlock(p[6]);
7185 # FILE_NAME(tmp, @1);
7186 # }
7187 # if (p[5]) tmp->set_statement(*p[5]);
7188 # delete p[5];
7189 # p[0] = tmp;
7190 # }
7191 ()
7192 def p_statement_item_10(p):
7193 '''statement_item : K_fork ':' IDENTIFIER _embed5_statement_item block_item_decls_opt statement_or_null_list_opt join_keyword endlabel_opt '''
7194 if(parse_debug): print('statement_item_10', list(p))
7195 # { pform_pop_scope();
7196 # assert(! current_block_stack.empty());
7197 # PBlock*tmp = current_block_stack.top();
7198 # current_block_stack.pop();
7199 # tmp->set_join_type(p[7]);
7200 # if (p[6]) tmp->set_statement(*p[6]);
7201 # delete p[6];
7202 # if (p[8]) {
7203 # if (strcmp(p[3],p[8]) != 0) {
7204 # yyerror(@8, "error: End label doesn't match fork name");
7205 # }
7206 # if (! gn_system_verilog()) {
7207 # yyerror(@8, "error: Fork end labels require "
7208 # "SystemVerilog.");
7209 # }
7210 # delete[]p[8];
7211 # }
7212 # delete[]p[3];
7213 # p[0] = tmp;
7214 # }
7215 ()
7216 def p_statement_item_11(p):
7217 '''statement_item : K_disable hierarchy_identifier ';' '''
7218 if(parse_debug): print('statement_item_11', list(p))
7219 # { PDisable*tmp = new PDisable(*p[2]);
7220 # FILE_NAME(tmp, @1);
7221 # delete p[2];
7222 # p[0] = tmp;
7223 # }
7224 ()
7225 def p_statement_item_12(p):
7226 '''statement_item : K_disable K_fork ';' '''
7227 if(parse_debug): print('statement_item_12', list(p))
7228 # { pform_name_t tmp_name;
7229 # PDisable*tmp = new PDisable(tmp_name);
7230 # FILE_NAME(tmp, @1);
7231 # p[0] = tmp;
7232 # }
7233 ()
7234 def p_statement_item_13(p):
7235 '''statement_item : K_TRIGGER hierarchy_identifier ';' '''
7236 if(parse_debug): print('statement_item_13', list(p))
7237 # { PTrigger*tmp = new PTrigger(*p[2]);
7238 # FILE_NAME(tmp, @1);
7239 # delete p[2];
7240 # p[0] = tmp;
7241 # }
7242 ()
7243 def p_statement_item_14(p):
7244 '''statement_item : procedural_assertion_statement '''
7245 if(parse_debug): print('statement_item_14', list(p))
7246 p[0] = p[1]
7247 ()
7248 def p_statement_item_15(p):
7249 '''statement_item : loop_statement '''
7250 if(parse_debug): print('statement_item_15', list(p))
7251 p[0] = p[1]
7252 ()
7253 def p_statement_item_16(p):
7254 '''statement_item : jump_statement '''
7255 if(parse_debug): print('statement_item_16', list(p))
7256 p[0] = p[1]
7257 ()
7258 def p_statement_item_17(p):
7259 '''statement_item : K_case '(' expression ')' case_items K_endcase '''
7260 if(parse_debug): print('statement_item_17', list(p))
7261 # { PCase*tmp = new PCase(NetCase::EQ, p[3], p[5]);
7262 # FILE_NAME(tmp, @1);
7263 # p[0] = tmp;
7264 # }
7265 ()
7266 def p_statement_item_18(p):
7267 '''statement_item : K_casex '(' expression ')' case_items K_endcase '''
7268 if(parse_debug): print('statement_item_18', list(p))
7269 # { PCase*tmp = new PCase(NetCase::EQX, p[3], p[5]);
7270 # FILE_NAME(tmp, @1);
7271 # p[0] = tmp;
7272 # }
7273 ()
7274 def p_statement_item_19(p):
7275 '''statement_item : K_casez '(' expression ')' case_items K_endcase '''
7276 if(parse_debug): print('statement_item_19', list(p))
7277 # { PCase*tmp = new PCase(NetCase::EQZ, p[3], p[5]);
7278 # FILE_NAME(tmp, @1);
7279 # p[0] = tmp;
7280 # }
7281 ()
7282 def p_statement_item_20(p):
7283 '''statement_item : K_case '(' expression ')' error K_endcase '''
7284 if(parse_debug): print('statement_item_20', list(p))
7285 # { yyerrok; }
7286 ()
7287 def p_statement_item_21(p):
7288 '''statement_item : K_casex '(' expression ')' error K_endcase '''
7289 if(parse_debug): print('statement_item_21', list(p))
7290 # { yyerrok; }
7291 ()
7292 def p_statement_item_22(p):
7293 '''statement_item : K_casez '(' expression ')' error K_endcase '''
7294 if(parse_debug): print('statement_item_22', list(p))
7295 # { yyerrok; }
7296 ()
7297 def p_statement_item_23(p):
7298 '''statement_item : K_if '(' expression ')' statement_or_null %prec less_than_K_else '''
7299 if(parse_debug): print('statement_item_23', list(p))
7300 # { PCondit*tmp = new PCondit(p[3], p[5], 0);
7301 # FILE_NAME(tmp, @1);
7302 # p[0] = tmp;
7303 # }
7304 ()
7305 def p_statement_item_24(p):
7306 '''statement_item : K_if '(' expression ')' statement_or_null K_else statement_or_null '''
7307 if(parse_debug): print('statement_item_24', list(p))
7308 # { PCondit*tmp = new PCondit(p[3], p[5], p[7]);
7309 # FILE_NAME(tmp, @1);
7310 # p[0] = tmp;
7311 # }
7312 ()
7313 def p_statement_item_25(p):
7314 '''statement_item : K_if '(' error ')' statement_or_null %prec less_than_K_else '''
7315 if(parse_debug): print('statement_item_25', list(p))
7316 # { yyerror(@1, "error: Malformed conditional expression.");
7317 # p[0] = p[5];
7318 # }
7319 ()
7320 def p_statement_item_26(p):
7321 '''statement_item : K_if '(' error ')' statement_or_null K_else statement_or_null '''
7322 if(parse_debug): print('statement_item_26', list(p))
7323 # { yyerror(@1, "error: Malformed conditional expression.");
7324 # p[0] = p[5];
7325 # }
7326 ()
7327 def p_statement_item_27(p):
7328 '''statement_item : compressed_statement ';' '''
7329 if(parse_debug): print('statement_item_27', list(p))
7330 p[0] = p[1]
7331 ()
7332 def p_statement_item_28(p):
7333 '''statement_item : inc_or_dec_expression ';' '''
7334 if(parse_debug): print('statement_item_28', list(p))
7335 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
7336 ()
7337 def p_statement_item_29(p):
7338 '''statement_item : delay1 statement_or_null '''
7339 if(parse_debug): print('statement_item_29', list(p))
7340 # { PExpr*del = p[1]->front();
7341 # assert(p[1]->size() == 1);
7342 # delete p[1];
7343 # PDelayStatement*tmp = new PDelayStatement(del, p[2]);
7344 # FILE_NAME(tmp, @1);
7345 # p[0] = tmp;
7346 # }
7347 ()
7348 def p_statement_item_30(p):
7349 '''statement_item : event_control statement_or_null '''
7350 if(parse_debug): print('statement_item_30', list(p))
7351 # { PEventStatement*tmp = p[1];
7352 # if (tmp == 0) {
7353 # yyerror(@1, "error: Invalid event control.");
7354 # p[0] = None
7355 # } else {
7356 # tmp->set_statement(p[2]);
7357 # p[0] = tmp;
7358 # }
7359 # }
7360 ()
7361 def p_statement_item_31(p):
7362 '''statement_item : '@' '*' statement_or_null '''
7363 if(parse_debug): print('statement_item_31', list(p))
7364 # { PEventStatement*tmp = new PEventStatement;
7365 # FILE_NAME(tmp, @1);
7366 # tmp->set_statement(p[3]);
7367 # p[0] = tmp;
7368 # }
7369 ()
7370 def p_statement_item_32(p):
7371 '''statement_item : '@' '(' '*' ')' statement_or_null '''
7372 if(parse_debug): print('statement_item_32', list(p))
7373 # { PEventStatement*tmp = new PEventStatement;
7374 # FILE_NAME(tmp, @1);
7375 # tmp->set_statement(p[5]);
7376 # p[0] = tmp;
7377 # }
7378 ()
7379 def p_statement_item_33(p):
7380 '''statement_item : lpvalue '=' expression ';' '''
7381 if(parse_debug): print('statement_item33', list(p))
7382 if p[3]:
7383 expr = Node(syms.expr_stmt, [p[1], Leaf(token.EQUAL, p[2]), p[3] ])
7384 if(parse_debug): print ("expr TODO", repr(expr))
7385 else:
7386 expr = Node(syms.expr_stmt, [p[1], Leaf(token.EQUAL, p[2]), ])
7387 if(parse_debug): print ("expr", repr(expr))
7388 if(parse_debug): print ("expr (python):'%s'" % expr)
7389 p[0] = expr
7390 # { PAssign*tmp = new PAssign(p[1],p[3]);
7391 # FILE_NAME(tmp, @1);
7392 # p[0] = tmp;
7393 # }
7394 ()
7395 def p_statement_item_34(p):
7396 '''statement_item : error '=' expression ';' '''
7397 if(parse_debug): print('statement_item_34', list(p))
7398 # { yyerror(@2, "Syntax in assignment statement l-value.");
7399 # yyerrok;
7400 # p[0] = new PNoop;
7401 # }
7402 ()
7403 def p_statement_item_35(p):
7404 '''statement_item : lpvalue K_LE expression ';' '''
7405 if(parse_debug): print('statement_item_35', list(p))
7406 # { PAssignNB*tmp = new PAssignNB(p[1],p[3]);
7407 # FILE_NAME(tmp, @1);
7408 # p[0] = tmp;
7409 # }
7410 ()
7411 def p_statement_item_36(p):
7412 '''statement_item : error K_LE expression ';' '''
7413 if(parse_debug): print('statement_item_36', list(p))
7414 # { yyerror(@2, "Syntax in assignment statement l-value.");
7415 # yyerrok;
7416 # p[0] = new PNoop;
7417 # }
7418 ()
7419 def p_statement_item_37(p):
7420 '''statement_item : lpvalue '=' delay1 expression ';' '''
7421 if(parse_debug): print('statement_item_37', list(p))
7422 # { PExpr*del = p[3]->front(); p[3]->pop_front();
7423 # assert(p[3]->empty());
7424 # PAssign*tmp = new PAssign(p[1],del,p[4]);
7425 # FILE_NAME(tmp, @1);
7426 # p[0] = tmp;
7427 # }
7428 ()
7429 def p_statement_item_38(p):
7430 '''statement_item : lpvalue K_LE delay1 expression ';' '''
7431 if(parse_debug): print('statement_item_38', list(p))
7432 # { PExpr*del = p[3]->front(); p[3]->pop_front();
7433 # assert(p[3]->empty());
7434 # PAssignNB*tmp = new PAssignNB(p[1],del,p[4]);
7435 # FILE_NAME(tmp, @1);
7436 # p[0] = tmp;
7437 # }
7438 ()
7439 def p_statement_item_39(p):
7440 '''statement_item : lpvalue '=' event_control expression ';' '''
7441 if(parse_debug): print('statement_item_39', list(p))
7442 # { PAssign*tmp = new PAssign(p[1],0,p[3],p[4]);
7443 # FILE_NAME(tmp, @1);
7444 # p[0] = tmp;
7445 # }
7446 ()
7447 def p_statement_item_40(p):
7448 '''statement_item : lpvalue '=' K_repeat '(' expression ')' event_control expression ';' '''
7449 if(parse_debug): print('statement_item_40', list(p))
7450 # { PAssign*tmp = new PAssign(p[1],p[5],p[7],p[8]);
7451 # FILE_NAME(tmp,@1);
7452 # tmp->set_lineno(@1.first_line);
7453 # p[0] = tmp;
7454 # }
7455 ()
7456 def p_statement_item_41(p):
7457 '''statement_item : lpvalue K_LE event_control expression ';' '''
7458 if(parse_debug): print('statement_item_41', list(p))
7459 # { PAssignNB*tmp = new PAssignNB(p[1],0,p[3],p[4]);
7460 # FILE_NAME(tmp, @1);
7461 # p[0] = tmp;
7462 # }
7463 ()
7464 def p_statement_item_42(p):
7465 '''statement_item : lpvalue K_LE K_repeat '(' expression ')' event_control expression ';' '''
7466 if(parse_debug): print('statement_item_42', list(p))
7467 # { PAssignNB*tmp = new PAssignNB(p[1],p[5],p[7],p[8]);
7468 # FILE_NAME(tmp, @1);
7469 # p[0] = tmp;
7470 # }
7471 ()
7472 def p_statement_item_43(p):
7473 '''statement_item : lpvalue '=' dynamic_array_new ';' '''
7474 if(parse_debug): print('statement_item_43', list(p))
7475 # { PAssign*tmp = new PAssign(p[1],p[3]);
7476 # FILE_NAME(tmp, @1);
7477 # p[0] = tmp;
7478 # }
7479 ()
7480 def p_statement_item_44(p):
7481 '''statement_item : lpvalue '=' class_new ';' '''
7482 if(parse_debug): print('statement_item_44', list(p))
7483 # { PAssign*tmp = new PAssign(p[1],p[3]);
7484 # FILE_NAME(tmp, @1);
7485 # p[0] = tmp;
7486 # }
7487 ()
7488 def p_statement_item_45(p):
7489 '''statement_item : K_wait '(' expression ')' statement_or_null '''
7490 if(parse_debug): print('statement_item_45', list(p))
7491 # { PEventStatement*tmp;
7492 # PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, p[3]);
7493 # tmp = new PEventStatement(etmp);
7494 # FILE_NAME(tmp,@1);
7495 # tmp->set_statement(p[5]);
7496 # p[0] = tmp;
7497 # }
7498 ()
7499 def p_statement_item_46(p):
7500 '''statement_item : K_wait K_fork ';' '''
7501 if(parse_debug): print('statement_item_46', list(p))
7502 # { PEventStatement*tmp = new PEventStatement((PEEvent*)0);
7503 # FILE_NAME(tmp,@1);
7504 # p[0] = tmp;
7505 # }
7506 ()
7507 def p_statement_item_47(p):
7508 '''statement_item : SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';' '''
7509 if(parse_debug): print('statement_item_47', list(p))
7510 # { PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), *p[3]);
7511 # FILE_NAME(tmp,@1);
7512 # delete[]p[1];
7513 # delete p[3];
7514 # p[0] = tmp;
7515 # }
7516 ()
7517 def p_statement_item_48(p):
7518 '''statement_item : SYSTEM_IDENTIFIER ';' '''
7519 if(parse_debug): print('statement_item_48', list(p))
7520 # { list<PExpr*>pt;
7521 # PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), pt);
7522 # FILE_NAME(tmp,@1);
7523 # delete[]p[1];
7524 # p[0] = tmp;
7525 # }
7526 ()
7527 def p_statement_item_49(p):
7528 '''statement_item : hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7529 if(parse_debug): print('statement_item_49', list(p))
7530 # { PCallTask*tmp = pform_make_call_task(@1, *p[1], *p[3]);
7531 # delete p[1];
7532 # delete p[3];
7533 # p[0] = tmp;
7534 # }
7535 ()
7536 def p_statement_item_50(p):
7537 '''statement_item : hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';' '''
7538 if(parse_debug): print('statement_item_50', list(p))
7539 # { /* ....randomize with { <constraints> } */
7540 # if (p[1] && peek_tail_name(*p[1]) == "randomize") {
7541 # if (!gn_system_verilog())
7542 # yyerror(@2, "error: Randomize with constraint requires SystemVerilog.");
7543 # else
7544 # yyerror(@2, "sorry: Randomize with constraint not supported.");
7545 # } else {
7546 # yyerror(@2, "error: Constraint block can only be applied to randomize method.");
7547 # }
7548 # list<PExpr*>pt;
7549 # PCallTask*tmp = new PCallTask(*p[1], pt);
7550 # FILE_NAME(tmp, @1);
7551 # delete p[1];
7552 # p[0] = tmp;
7553 # }
7554 ()
7555 def p_statement_item_51(p):
7556 '''statement_item : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7557 if(parse_debug): print('statement_item_51', list(p))
7558 # { pform_name_t*t_name = p[1];
7559 # while (! p[3]->empty()) {
7560 # t_name->push_back(p[3]->front());
7561 # p[3]->pop_front();
7562 # }
7563 # PCallTask*tmp = new PCallTask(*t_name, *p[5]);
7564 # FILE_NAME(tmp, @1);
7565 # delete p[1];
7566 # delete p[3];
7567 # delete p[5];
7568 # p[0] = tmp;
7569 # }
7570 ()
7571 def p_statement_item_52(p):
7572 '''statement_item : hierarchy_identifier ';' '''
7573 if(parse_debug): print('statement_item_52', list(p))
7574 # { list<PExpr*>pt;
7575 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
7576 # delete p[1];
7577 # p[0] = tmp;
7578 # }
7579 ()
7580 def p_statement_item_53(p):
7581 '''statement_item : implicit_class_handle '.' K_new '(' expression_list_with_nuls ')' ';' '''
7582 if(parse_debug): print('statement_item_53', list(p))
7583 # { PChainConstructor*tmp = new PChainConstructor(*p[5]);
7584 # FILE_NAME(tmp, @3);
7585 # delete p[1];
7586 # p[0] = tmp;
7587 # }
7588 ()
7589 def p_statement_item_54(p):
7590 '''statement_item : hierarchy_identifier '(' error ')' ';' '''
7591 if(parse_debug): print('statement_item_54', list(p))
7592 # { yyerror(@3, "error: Syntax error in task arguments.");
7593 # list<PExpr*>pt;
7594 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
7595 # delete p[1];
7596 # p[0] = tmp;
7597 # }
7598 ()
7599 def p_statement_item_55(p):
7600 '''statement_item : error ';' '''
7601 if(parse_debug): print('statement_item_55', list(p))
7602 # { yyerror(@2, "error: malformed statement");
7603 # yyerrok;
7604 # p[0] = new PNoop;
7605 # }
7606 ()
7607 def p__embed0_statement_item(p):
7608 '''_embed0_statement_item : '''
7609 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_SEQ);
7610 # FILE_NAME(tmp, @1);
7611 # current_block_stack.push(tmp);
7612 # }
7613 ()
7614 def p__embed1_statement_item(p):
7615 '''_embed1_statement_item : '''
7616 # { if (p[3]) {
7617 # if (! gn_system_verilog()) {
7618 # yyerror("error: Variable declaration in unnamed block "
7619 # "requires SystemVerilog.");
7620 # }
7621 # } else {
7622 # /* If there are no declarations in the scope then just delete it. */
7623 # pform_pop_scope();
7624 # assert(! current_block_stack.empty());
7625 # PBlock*tmp = current_block_stack.top();
7626 # current_block_stack.pop();
7627 # delete tmp;
7628 # }
7629 # }
7630 ()
7631 def p__embed2_statement_item(p):
7632 '''_embed2_statement_item : '''
7633 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_SEQ);
7634 # FILE_NAME(tmp, @1);
7635 # current_block_stack.push(tmp);
7636 # }
7637 ()
7638 def p__embed3_statement_item(p):
7639 '''_embed3_statement_item : '''
7640 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
7641 # FILE_NAME(tmp, @1);
7642 # current_block_stack.push(tmp);
7643 # }
7644 ()
7645 def p__embed4_statement_item(p):
7646 '''_embed4_statement_item : '''
7647 # { if (p[3]) {
7648 # if (! gn_system_verilog()) {
7649 # yyerror("error: Variable declaration in unnamed block "
7650 # "requires SystemVerilog.");
7651 # }
7652 # } else {
7653 # /* If there are no declarations in the scope then just delete it. */
7654 # pform_pop_scope();
7655 # assert(! current_block_stack.empty());
7656 # PBlock*tmp = current_block_stack.top();
7657 # current_block_stack.pop();
7658 # delete tmp;
7659 # }
7660 # }
7661 ()
7662 def p__embed5_statement_item(p):
7663 '''_embed5_statement_item : '''
7664 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_PAR);
7665 # FILE_NAME(tmp, @1);
7666 # current_block_stack.push(tmp);
7667 # }
7668 ()
7669 def p_compressed_statement_1(p):
7670 '''compressed_statement : lpvalue K_PLUS_EQ expression '''
7671 if(parse_debug): print('compressed_statement_1', list(p))
7672 # { PAssign*tmp = new PAssign(p[1], '+', p[3]);
7673 # FILE_NAME(tmp, @1);
7674 # p[0] = tmp;
7675 # }
7676 ()
7677 def p_compressed_statement_2(p):
7678 '''compressed_statement : lpvalue K_MINUS_EQ expression '''
7679 if(parse_debug): print('compressed_statement_2', list(p))
7680 # { PAssign*tmp = new PAssign(p[1], '-', p[3]);
7681 # FILE_NAME(tmp, @1);
7682 # p[0] = tmp;
7683 # }
7684 ()
7685 def p_compressed_statement_3(p):
7686 '''compressed_statement : lpvalue K_MUL_EQ expression '''
7687 if(parse_debug): print('compressed_statement_3', list(p))
7688 # { PAssign*tmp = new PAssign(p[1], '*', p[3]);
7689 # FILE_NAME(tmp, @1);
7690 # p[0] = tmp;
7691 # }
7692 ()
7693 def p_compressed_statement_4(p):
7694 '''compressed_statement : lpvalue K_DIV_EQ expression '''
7695 if(parse_debug): print('compressed_statement_4', list(p))
7696 # { PAssign*tmp = new PAssign(p[1], '/', p[3]);
7697 # FILE_NAME(tmp, @1);
7698 # p[0] = tmp;
7699 # }
7700 ()
7701 def p_compressed_statement_5(p):
7702 '''compressed_statement : lpvalue K_MOD_EQ expression '''
7703 if(parse_debug): print('compressed_statement_5', list(p))
7704 # { PAssign*tmp = new PAssign(p[1], '%', p[3]);
7705 # FILE_NAME(tmp, @1);
7706 # p[0] = tmp;
7707 # }
7708 ()
7709 def p_compressed_statement_6(p):
7710 '''compressed_statement : lpvalue K_AND_EQ expression '''
7711 if(parse_debug): print('compressed_statement_6', list(p))
7712 # { PAssign*tmp = new PAssign(p[1], '&', p[3]);
7713 # FILE_NAME(tmp, @1);
7714 # p[0] = tmp;
7715 # }
7716 ()
7717 def p_compressed_statement_7(p):
7718 '''compressed_statement : lpvalue K_OR_EQ expression '''
7719 if(parse_debug): print('compressed_statement_7', list(p))
7720 # { PAssign*tmp = new PAssign(p[1], '|', p[3]);
7721 # FILE_NAME(tmp, @1);
7722 # p[0] = tmp;
7723 # }
7724 ()
7725 def p_compressed_statement_8(p):
7726 '''compressed_statement : lpvalue K_XOR_EQ expression '''
7727 if(parse_debug): print('compressed_statement_8', list(p))
7728 # { PAssign*tmp = new PAssign(p[1], '^', p[3]);
7729 # FILE_NAME(tmp, @1);
7730 # p[0] = tmp;
7731 # }
7732 ()
7733 def p_compressed_statement_9(p):
7734 '''compressed_statement : lpvalue K_LS_EQ expression '''
7735 if(parse_debug): print('compressed_statement_9', list(p))
7736 # { PAssign *tmp = new PAssign(p[1], 'l', p[3]);
7737 # FILE_NAME(tmp, @1);
7738 # p[0] = tmp;
7739 # }
7740 ()
7741 def p_compressed_statement_10(p):
7742 '''compressed_statement : lpvalue K_RS_EQ expression '''
7743 if(parse_debug): print('compressed_statement_10', list(p))
7744 # { PAssign*tmp = new PAssign(p[1], 'r', p[3]);
7745 # FILE_NAME(tmp, @1);
7746 # p[0] = tmp;
7747 # }
7748 ()
7749 def p_compressed_statement_11(p):
7750 '''compressed_statement : lpvalue K_RSS_EQ expression '''
7751 if(parse_debug): print('compressed_statement_11', list(p))
7752 # { PAssign *tmp = new PAssign(p[1], 'R', p[3]);
7753 # FILE_NAME(tmp, @1);
7754 # p[0] = tmp;
7755 # }
7756 ()
7757 def p_statement_or_null_list_opt_1(p):
7758 '''statement_or_null_list_opt : statement_or_null_list '''
7759 if(parse_debug): print('statement_or_null_list_opt_1', list(p))
7760 p[0] = p[1]
7761 ()
7762 def p_statement_or_null_list_opt_2(p):
7763 '''statement_or_null_list_opt : '''
7764 if(parse_debug): print('statement_or_null_list_opt_2', list(p))
7765 # { p[0] = None }
7766 ()
7767 def p_statement_or_null_list_1(p):
7768 '''statement_or_null_list : statement_or_null_list statement_or_null '''
7769 if(parse_debug): print('statement_or_null_list_1', list(p))
7770 # { vector<Statement*>*tmp = p[1];
7771 # if (p[2]) tmp->push_back(p[2]);
7772 # p[0] = tmp;
7773 # }
7774 ()
7775 def p_statement_or_null_list_2(p):
7776 '''statement_or_null_list : statement_or_null '''
7777 if(parse_debug): print('statement_or_null_list_2', list(p))
7778 # { vector<Statement*>*tmp = new vector<Statement*>(0);
7779 # if (p[1]) tmp->push_back(p[1]);
7780 # p[0] = tmp;
7781 # }
7782 ()
7783 def p_analog_statement_1(p):
7784 '''analog_statement : branch_probe_expression K_CONTRIBUTE expression ';' '''
7785 if(parse_debug): print('analog_statement_1', list(p))
7786 # { p[0] = pform_contribution_statement(@2, p[1], p[3]); }
7787 ()
7788 def p_task_item_1(p):
7789 '''task_item : block_item_decl '''
7790 if(parse_debug): print('task_item_1', list(p))
7791 # { p[0] = new vector<pform_tf_port_t>(0); }
7792 ()
7793 def p_task_item_2(p):
7794 '''task_item : tf_port_declaration '''
7795 if(parse_debug): print('task_item_2', list(p))
7796 p[0] = p[1]
7797 ()
7798 def p_task_item_list_1(p):
7799 '''task_item_list : task_item_list task_item '''
7800 if(parse_debug): print('task_item_list_1', list(p))
7801 # { vector<pform_tf_port_t>*tmp = p[1];
7802 # size_t s1 = tmp->size();
7803 # tmp->resize(s1 + p[2]->size());
7804 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
7805 # tmp->at(s1 + idx) = p[2]->at(idx);
7806 # delete p[2];
7807 # p[0] = tmp;
7808 # }
7809 ()
7810 def p_task_item_list_2(p):
7811 '''task_item_list : task_item '''
7812 if(parse_debug): print('task_item_list_2', list(p))
7813 p[0] = p[1]
7814 ()
7815 def p_task_item_list_opt_1(p):
7816 '''task_item_list_opt : task_item_list '''
7817 if(parse_debug): print('task_item_list_opt_1', list(p))
7818 p[0] = p[1]
7819 ()
7820 def p_task_item_list_opt_2(p):
7821 '''task_item_list_opt : '''
7822 if(parse_debug): print('task_item_list_opt_2', list(p))
7823 # { p[0] = None }
7824 ()
7825 def p_tf_port_list_opt_1(p):
7826 '''tf_port_list_opt : tf_port_list '''
7827 if(parse_debug): print('tf_port_list_opt_1', list(p))
7828 p[0] = p[1]
7829 ()
7830 def p_tf_port_list_opt_2(p):
7831 '''tf_port_list_opt : '''
7832 if(parse_debug): print('tf_port_list_opt_2', list(p))
7833 # { p[0] = None }
7834 ()
7835 def p_udp_body_1(p):
7836 '''udp_body : K_table udp_entry_list K_endtable '''
7837 if(parse_debug): print('udp_body_1', list(p))
7838 # { lex_end_table();
7839 # p[0] = p[2];
7840 # }
7841 ()
7842 def p_udp_body_2(p):
7843 '''udp_body : K_table K_endtable '''
7844 if(parse_debug): print('udp_body_2', list(p))
7845 # { lex_end_table();
7846 # yyerror(@1, "error: Empty UDP table.");
7847 # p[0] = None
7848 # }
7849 ()
7850 def p_udp_body_3(p):
7851 '''udp_body : K_table error K_endtable '''
7852 if(parse_debug): print('udp_body_3', list(p))
7853 # { lex_end_table();
7854 # yyerror(@2, "Errors in UDP table");
7855 # yyerrok;
7856 # p[0] = None
7857 # }
7858 ()
7859 def p_udp_entry_list_1(p):
7860 '''udp_entry_list : udp_comb_entry_list '''
7861 if(parse_debug): print('udp_entry_list_1', list(p))
7862 ()
7863 def p_udp_entry_list_2(p):
7864 '''udp_entry_list : udp_sequ_entry_list '''
7865 if(parse_debug): print('udp_entry_list_2', list(p))
7866 ()
7867 def p_udp_comb_entry_1(p):
7868 '''udp_comb_entry : udp_input_list ':' udp_output_sym ';' '''
7869 if(parse_debug): print('udp_comb_entry_1', list(p))
7870 # { char*tmp = new char[strlen(p[1])+3];
7871 # strcpy(tmp, p[1]);
7872 # char*tp = tmp+strlen(tmp);
7873 # *tp++ = ':';
7874 # *tp++ = p[3];
7875 # *tp++ = 0;
7876 # delete[]p[1];
7877 # p[0] = tmp;
7878 # }
7879 ()
7880 def p_udp_comb_entry_list_1(p):
7881 '''udp_comb_entry_list : udp_comb_entry '''
7882 if(parse_debug): print('udp_comb_entry_list_1', list(p))
7883 # { list<string>*tmp = new list<string>;
7884 # tmp->push_back(p[1]);
7885 # delete[]p[1];
7886 # p[0] = tmp;
7887 # }
7888 ()
7889 def p_udp_comb_entry_list_2(p):
7890 '''udp_comb_entry_list : udp_comb_entry_list udp_comb_entry '''
7891 if(parse_debug): print('udp_comb_entry_list_2', list(p))
7892 # { list<string>*tmp = p[1];
7893 # tmp->push_back(p[2]);
7894 # delete[]p[2];
7895 # p[0] = tmp;
7896 # }
7897 ()
7898 def p_udp_sequ_entry_list_1(p):
7899 '''udp_sequ_entry_list : udp_sequ_entry '''
7900 if(parse_debug): print('udp_sequ_entry_list_1', list(p))
7901 # { list<string>*tmp = new list<string>;
7902 # tmp->push_back(p[1]);
7903 # delete[]p[1];
7904 # p[0] = tmp;
7905 # }
7906 ()
7907 def p_udp_sequ_entry_list_2(p):
7908 '''udp_sequ_entry_list : udp_sequ_entry_list udp_sequ_entry '''
7909 if(parse_debug): print('udp_sequ_entry_list_2', list(p))
7910 # { list<string>*tmp = p[1];
7911 # tmp->push_back(p[2]);
7912 # delete[]p[2];
7913 # p[0] = tmp;
7914 # }
7915 ()
7916 def p_udp_sequ_entry_1(p):
7917 '''udp_sequ_entry : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' '''
7918 if(parse_debug): print('udp_sequ_entry_1', list(p))
7919 # { char*tmp = new char[strlen(p[1])+5];
7920 # strcpy(tmp, p[1]);
7921 # char*tp = tmp+strlen(tmp);
7922 # *tp++ = ':';
7923 # *tp++ = p[3];
7924 # *tp++ = ':';
7925 # *tp++ = p[5];
7926 # *tp++ = 0;
7927 # p[0] = tmp;
7928 # }
7929 ()
7930 def p_udp_initial_1(p):
7931 '''udp_initial : K_initial IDENTIFIER '=' number ';' '''
7932 if(parse_debug): print('udp_initial_1', list(p))
7933 # { PExpr*etmp = new PENumber(p[4]);
7934 # PEIdent*itmp = new PEIdent(lex_strings.make(p[2]));
7935 # PAssign*atmp = new PAssign(itmp, etmp);
7936 # FILE_NAME(atmp, @2);
7937 # delete[]p[2];
7938 # p[0] = atmp;
7939 # }
7940 ()
7941 def p_udp_init_opt_1(p):
7942 '''udp_init_opt : udp_initial '''
7943 if(parse_debug): print('udp_init_opt_1', list(p))
7944 p[0] = p[1]
7945 ()
7946 def p_udp_init_opt_2(p):
7947 '''udp_init_opt : '''
7948 if(parse_debug): print('udp_init_opt_2', list(p))
7949 # { p[0] = None }
7950 ()
7951 def p_udp_input_list_1(p):
7952 '''udp_input_list : udp_input_sym '''
7953 if(parse_debug): print('udp_input_list_1', list(p))
7954 # { char*tmp = new char[2];
7955 # tmp[0] = p[1];
7956 # tmp[1] = 0;
7957 # p[0] = tmp;
7958 # }
7959 ()
7960 def p_udp_input_list_2(p):
7961 '''udp_input_list : udp_input_list udp_input_sym '''
7962 if(parse_debug): print('udp_input_list_2', list(p))
7963 # { char*tmp = new char[strlen(p[1])+2];
7964 # strcpy(tmp, p[1]);
7965 # char*tp = tmp+strlen(tmp);
7966 # *tp++ = p[2];
7967 # *tp++ = 0;
7968 # delete[]p[1];
7969 # p[0] = tmp;
7970 # }
7971 ()
7972 def p_udp_input_sym_1(p):
7973 '''udp_input_sym : '0' '''
7974 if(parse_debug): print('udp_input_sym_1', list(p))
7975 # { p[0] = '0'; }
7976 ()
7977 def p_udp_input_sym_2(p):
7978 '''udp_input_sym : '1' '''
7979 if(parse_debug): print('udp_input_sym_2', list(p))
7980 # { p[0] = '1'; }
7981 ()
7982 def p_udp_input_sym_3(p):
7983 '''udp_input_sym : 'x' '''
7984 if(parse_debug): print('udp_input_sym_3', list(p))
7985 # { p[0] = 'x'; }
7986 ()
7987 def p_udp_input_sym_4(p):
7988 '''udp_input_sym : '?' '''
7989 if(parse_debug): print('udp_input_sym_4', list(p))
7990 # { p[0] = '?'; }
7991 ()
7992 def p_udp_input_sym_5(p):
7993 '''udp_input_sym : 'b' '''
7994 if(parse_debug): print('udp_input_sym_5', list(p))
7995 # { p[0] = 'b'; }
7996 ()
7997 def p_udp_input_sym_6(p):
7998 '''udp_input_sym : '*' '''
7999 if(parse_debug): print('udp_input_sym_6', list(p))
8000 # { p[0] = '*'; }
8001 ()
8002 def p_udp_input_sym_7(p):
8003 '''udp_input_sym : '%' '''
8004 if(parse_debug): print('udp_input_sym_7', list(p))
8005 # { p[0] = '%'; }
8006 ()
8007 def p_udp_input_sym_8(p):
8008 '''udp_input_sym : 'f' '''
8009 if(parse_debug): print('udp_input_sym_8', list(p))
8010 # { p[0] = 'f'; }
8011 ()
8012 def p_udp_input_sym_9(p):
8013 '''udp_input_sym : 'F' '''
8014 if(parse_debug): print('udp_input_sym_9', list(p))
8015 # { p[0] = 'F'; }
8016 ()
8017 def p_udp_input_sym_10(p):
8018 '''udp_input_sym : 'l' '''
8019 if(parse_debug): print('udp_input_sym_10', list(p))
8020 # { p[0] = 'l'; }
8021 ()
8022 def p_udp_input_sym_11(p):
8023 '''udp_input_sym : 'h' '''
8024 if(parse_debug): print('udp_input_sym_11', list(p))
8025 # { p[0] = 'h'; }
8026 ()
8027 def p_udp_input_sym_12(p):
8028 '''udp_input_sym : 'B' '''
8029 if(parse_debug): print('udp_input_sym_12', list(p))
8030 # { p[0] = 'B'; }
8031 ()
8032 def p_udp_input_sym_13(p):
8033 '''udp_input_sym : 'r' '''
8034 if(parse_debug): print('udp_input_sym_13', list(p))
8035 # { p[0] = 'r'; }
8036 ()
8037 def p_udp_input_sym_14(p):
8038 '''udp_input_sym : 'R' '''
8039 if(parse_debug): print('udp_input_sym_14', list(p))
8040 # { p[0] = 'R'; }
8041 ()
8042 def p_udp_input_sym_15(p):
8043 '''udp_input_sym : 'M' '''
8044 if(parse_debug): print('udp_input_sym_15', list(p))
8045 # { p[0] = 'M'; }
8046 ()
8047 def p_udp_input_sym_16(p):
8048 '''udp_input_sym : 'n' '''
8049 if(parse_debug): print('udp_input_sym_16', list(p))
8050 # { p[0] = 'n'; }
8051 ()
8052 def p_udp_input_sym_17(p):
8053 '''udp_input_sym : 'N' '''
8054 if(parse_debug): print('udp_input_sym_17', list(p))
8055 # { p[0] = 'N'; }
8056 ()
8057 def p_udp_input_sym_18(p):
8058 '''udp_input_sym : 'p' '''
8059 if(parse_debug): print('udp_input_sym_18', list(p))
8060 # { p[0] = 'p'; }
8061 ()
8062 def p_udp_input_sym_19(p):
8063 '''udp_input_sym : 'P' '''
8064 if(parse_debug): print('udp_input_sym_19', list(p))
8065 # { p[0] = 'P'; }
8066 ()
8067 def p_udp_input_sym_20(p):
8068 '''udp_input_sym : 'Q' '''
8069 if(parse_debug): print('udp_input_sym_20', list(p))
8070 # { p[0] = 'Q'; }
8071 ()
8072 def p_udp_input_sym_21(p):
8073 '''udp_input_sym : 'q' '''
8074 if(parse_debug): print('udp_input_sym_21', list(p))
8075 # { p[0] = 'q'; }
8076 ()
8077 def p_udp_input_sym_22(p):
8078 '''udp_input_sym : '_' '''
8079 if(parse_debug): print('udp_input_sym_22', list(p))
8080 # { p[0] = '_'; }
8081 ()
8082 def p_udp_input_sym_23(p):
8083 '''udp_input_sym : '+' '''
8084 if(parse_debug): print('udp_input_sym_23', list(p))
8085 # { p[0] = '+'; }
8086 ()
8087 def p_udp_input_sym_24(p):
8088 '''udp_input_sym : DEC_NUMBER '''
8089 if(parse_debug): print('udp_input_sym_24', list(p))
8090 # { yyerror(@1, "internal error: Input digits parse as decimal number!"); p[0] = '0'; }
8091 ()
8092 def p_udp_output_sym_1(p):
8093 '''udp_output_sym : '0' '''
8094 if(parse_debug): print('udp_output_sym_1', list(p))
8095 # { p[0] = '0'; }
8096 ()
8097 def p_udp_output_sym_2(p):
8098 '''udp_output_sym : '1' '''
8099 if(parse_debug): print('udp_output_sym_2', list(p))
8100 # { p[0] = '1'; }
8101 ()
8102 def p_udp_output_sym_3(p):
8103 '''udp_output_sym : 'x' '''
8104 if(parse_debug): print('udp_output_sym_3', list(p))
8105 # { p[0] = 'x'; }
8106 ()
8107 def p_udp_output_sym_4(p):
8108 '''udp_output_sym : '-' '''
8109 if(parse_debug): print('udp_output_sym_4', list(p))
8110 # { p[0] = '-'; }
8111 ()
8112 def p_udp_output_sym_5(p):
8113 '''udp_output_sym : DEC_NUMBER '''
8114 if(parse_debug): print('udp_output_sym_5', list(p))
8115 # { yyerror(@1, "internal error: Output digits parse as decimal number!"); p[0] = '0'; }
8116 ()
8117 def p_udp_port_decl_1(p):
8118 '''udp_port_decl : K_input list_of_identifiers ';' '''
8119 if(parse_debug): print('udp_port_decl_1', list(p))
8120 # { p[0] = pform_make_udp_input_ports(p[2]); }
8121 ()
8122 def p_udp_port_decl_2(p):
8123 '''udp_port_decl : K_output IDENTIFIER ';' '''
8124 if(parse_debug): print('udp_port_decl_2', list(p))
8125 # { perm_string pname = lex_strings.make(p[2]);
8126 # PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
8127 # vector<PWire*>*tmp = new vector<PWire*>(1);
8128 # (*tmp)[0] = pp;
8129 # p[0] = tmp;
8130 # delete[]p[2];
8131 # }
8132 ()
8133 def p_udp_port_decl_3(p):
8134 '''udp_port_decl : K_reg IDENTIFIER ';' '''
8135 if(parse_debug): print('udp_port_decl_3', list(p))
8136 # { perm_string pname = lex_strings.make(p[2]);
8137 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
8138 # vector<PWire*>*tmp = new vector<PWire*>(1);
8139 # (*tmp)[0] = pp;
8140 # p[0] = tmp;
8141 # delete[]p[2];
8142 # }
8143 ()
8144 def p_udp_port_decl_4(p):
8145 '''udp_port_decl : K_reg K_output IDENTIFIER ';' '''
8146 if(parse_debug): print('udp_port_decl_4', list(p))
8147 # { perm_string pname = lex_strings.make(p[3]);
8148 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
8149 # vector<PWire*>*tmp = new vector<PWire*>(1);
8150 # (*tmp)[0] = pp;
8151 # p[0] = tmp;
8152 # delete[]p[3];
8153 # }
8154 ()
8155 def p_udp_port_decls_1(p):
8156 '''udp_port_decls : udp_port_decl '''
8157 if(parse_debug): print('udp_port_decls_1', list(p))
8158 p[0] = p[1]
8159 ()
8160 def p_udp_port_decls_2(p):
8161 '''udp_port_decls : udp_port_decls udp_port_decl '''
8162 if(parse_debug): print('udp_port_decls_2', list(p))
8163 # { vector<PWire*>*tmp = p[1];
8164 # size_t s1 = p[1]->size();
8165 # tmp->resize(s1+p[2]->size());
8166 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
8167 # tmp->at(s1+idx) = p[2]->at(idx);
8168 # p[0] = tmp;
8169 # delete p[2];
8170 # }
8171 ()
8172 def p_udp_port_list_1(p):
8173 '''udp_port_list : IDENTIFIER '''
8174 if(parse_debug): print('udp_port_list_1', list(p))
8175 # { list<perm_string>*tmp = new list<perm_string>;
8176 # tmp->push_back(lex_strings.make(p[1]));
8177 # delete[]p[1];
8178 # p[0] = tmp;
8179 # }
8180 ()
8181 def p_udp_port_list_2(p):
8182 '''udp_port_list : udp_port_list ',' IDENTIFIER '''
8183 if(parse_debug): print('udp_port_list_2', list(p))
8184 # { list<perm_string>*tmp = p[1];
8185 # tmp->push_back(lex_strings.make(p[3]));
8186 # delete[]p[3];
8187 # p[0] = tmp;
8188 # }
8189 ()
8190 def p_udp_reg_opt_1(p):
8191 '''udp_reg_opt : K_reg '''
8192 if(parse_debug): print('udp_reg_opt_1', list(p))
8193 p[0] = True
8194 ()
8195 def p_udp_reg_opt_2(p):
8196 '''udp_reg_opt : '''
8197 if(parse_debug): print('udp_reg_opt_2', list(p))
8198 p[0] = False
8199 ()
8200 def p_udp_initial_expr_opt_1(p):
8201 '''udp_initial_expr_opt : '=' expression '''
8202 if(parse_debug): print('udp_initial_expr_opt_1', list(p))
8203 p[0] = p[2]
8204 ()
8205 def p_udp_initial_expr_opt_2(p):
8206 '''udp_initial_expr_opt : '''
8207 if(parse_debug): print('udp_initial_expr_opt_2', list(p))
8208 # { p[0] = None }
8209 ()
8210 def p_udp_input_declaration_list_1(p):
8211 '''udp_input_declaration_list : K_input IDENTIFIER '''
8212 if(parse_debug): print('udp_input_declaration_list_1', list(p))
8213 # { list<perm_string>*tmp = new list<perm_string>;
8214 # tmp->push_back(lex_strings.make(p[2]));
8215 # p[0] = tmp;
8216 # delete[]p[2];
8217 # }
8218 ()
8219 def p_udp_input_declaration_list_2(p):
8220 '''udp_input_declaration_list : udp_input_declaration_list ',' K_input IDENTIFIER '''
8221 if(parse_debug): print('udp_input_declaration_list_2', list(p))
8222 # { list<perm_string>*tmp = p[1];
8223 # tmp->push_back(lex_strings.make(p[4]));
8224 # p[0] = tmp;
8225 # delete[]p[4];
8226 # }
8227 ()
8228 def p_udp_primitive_1(p):
8229 '''udp_primitive : K_primitive IDENTIFIER '(' udp_port_list ')' ';' udp_port_decls udp_init_opt udp_body K_endprimitive endlabel_opt '''
8230 if(parse_debug): print('udp_primitive_1', list(p))
8231 # { perm_string tmp2 = lex_strings.make(p[2]);
8232 # pform_make_udp(tmp2, p[4], p[7], p[9], p[8],
8233 # @2.text, @2.first_line);
8234 # if (p[11]) {
8235 # if (strcmp(p[2],p[11]) != 0) {
8236 # yyerror(@11, "error: End label doesn't match "
8237 # "primitive name");
8238 # }
8239 # if (! gn_system_verilog()) {
8240 # yyerror(@11, "error: Primitive end labels "
8241 # "require SystemVerilog.");
8242 # }
8243 # delete[]p[11];
8244 # }
8245 # delete[]p[2];
8246 # }
8247 ()
8248 def p_udp_primitive_2(p):
8249 '''udp_primitive : K_primitive IDENTIFIER '(' K_output udp_reg_opt IDENTIFIER udp_initial_expr_opt ',' udp_input_declaration_list ')' ';' udp_body K_endprimitive endlabel_opt '''
8250 if(parse_debug): print('udp_primitive_2', list(p))
8251 # { perm_string tmp2 = lex_strings.make(p[2]);
8252 # perm_string tmp6 = lex_strings.make(p[6]);
8253 # pform_make_udp(tmp2, p[5], tmp6, p[7], p[9], p[12],
8254 # @2.text, @2.first_line);
8255 # if (p[14]) {
8256 # if (strcmp(p[2],p[14]) != 0) {
8257 # yyerror(@14, "error: End label doesn't match "
8258 # "primitive name");
8259 # }
8260 # if (! gn_system_verilog()) {
8261 # yyerror(@14, "error: Primitive end labels "
8262 # "require SystemVerilog.");
8263 # }
8264 # delete[]p[14];
8265 # }
8266 # delete[]p[2];
8267 # delete[]p[6];
8268 # }
8269 ()
8270 def p_K_packed_opt_1(p):
8271 '''K_packed_opt : K_packed '''
8272 if(parse_debug): print('K_packed_opt', list(p))
8273 p[0] = True
8274 ()
8275 def p_K_packed_opt_2(p):
8276 '''K_packed_opt : '''
8277 if(parse_debug): print('K_packed_opt', list(p))
8278 p[0] = False
8279 ()
8280 def p_K_reg_opt_1(p):
8281 '''K_reg_opt : K_reg '''
8282 if(parse_debug): print('K_reg_opt', list(p))
8283 p[0] = True
8284 ()
8285 def p_K_reg_opt_2(p):
8286 '''K_reg_opt : '''
8287 if(parse_debug): print('K_reg_opt', list(p))
8288 p[0] = False
8289 ()
8290 def p_K_static_opt_1(p):
8291 '''K_static_opt : K_static '''
8292 if(parse_debug): print('K_static_opt', list(p))
8293 p[0] = True
8294 ()
8295 def p_K_static_opt_2(p):
8296 '''K_static_opt : '''
8297 if(parse_debug): print('K_static_opt', list(p))
8298 p[0] = False
8299 ()
8300
8301 def p_K_virtual_opt_1(p):
8302 '''K_virtual_opt : K_virtual '''
8303 if(parse_debug): print(p)
8304 p[0] = True
8305 ()
8306 def p_K_virtual_opt_2(p):
8307 '''K_virtual_opt : '''
8308 if(parse_debug): print(p)
8309 p[0] = False
8310 ()
8311
8312 def p_error(p):
8313 if(parse_debug): print ("error", p)
8314 exit(0)
8315
8316 yacc.yacc(debug=0)
8317