3 # * Copyright (c) 1998-2017 Stephen Williams (steve@icarus.com)
4 # * Copyright CERN 2012-2013 / Stephen Williams (steve@icarus.com)
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.
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.
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.
22 from lib2to3
.pytree
import Node
, Leaf
23 from lib2to3
.pgen2
import token
24 from lib2to3
.pygram
import python_symbols
as syms
26 from ply
import yacc
, lex
28 #from parse_tokens import tokens
30 tokens
= lexor
.tokens
# list(set(lexor.tokens).union(set(tokens)))
31 literals
= lexor
.literals
34 ('right', 'K_PLUS_EQ', 'K_MINUS_EQ', 'K_MUL_EQ', 'K_DIV_EQ',
35 'K_MOD_EQ', 'K_AND_EQ', 'K_OR_EQ'),
36 ('right', 'K_XOR_EQ', 'K_LS_EQ', 'K_RS_EQ', 'K_RSS_EQ'),
37 ('right', '?', ':', 'K_inside'),
41 ('left', '^', 'K_NXOR', 'K_NOR'),
42 ('left', '&', 'K_NAND'),
43 ('left', 'K_EQ', 'K_NE', 'K_CEQ', 'K_CNE', 'K_WEQ', 'K_WNE'),
44 ('left', 'K_GE', 'K_LE', '<', '>'),
45 ('left', 'K_LS', 'K_RS', 'K_RSS'),
47 ('left', '*', '/', '%'),
49 ('left', 'UNARY_PREC'),
50 ('nonassoc', 'less_than_K_else'),
51 ('nonassoc', 'K_else'),
53 ('nonassoc', 'K_exclude'),
54 ('nonassoc', 'no_timeunits_declaration'),
55 ('nonassoc', 'one_timeunits_declaration'),
56 ('nonassoc', 'K_timeunit', 'K_timeprecision')
60 IVL_VT_NO_TYPE
= 'VT_NO_TYPE'
61 IVL_VT_BOOL
= 'VT_BOOL'
62 IVL_VT_LOGIC
= 'VT_LOGIC'
65 NN_IMPLICIT
= 'IMPLICIT'
66 NN_IMPLICIT_REG
= 'IMPLICIT_REG'
67 NN_INTEGER
= 'INTEGER'
71 NN_SUPPLY0
= 'SUPPLY0'
72 NN_SUPPLY1
= 'SUPPLY1'
79 NN_UNRESOLVED_WIRE
= 'UNRESOLVED_WIRE'
81 NP_NOT_A_PORT
= 'NOT_A_PORT'
82 NP_PIMPLICIT
= 'PIMPLICIT'
84 NP_POUTPUT
= 'POUTPUT'
89 # -------------- RULES ----------------
91 def p_source_text_1(p
):
92 '''source_text : timeunits_declaration_opt _embed0_source_text description_list '''
93 print('source_text', list(p
))
95 def p_source_text_2(p
):
97 print('source_text', list(p
))
99 def p__embed0_source_text(p
):
100 '''_embed0_source_text : '''
101 # { pform_set_scope_timescale(yyloc); }
103 def p_assertion_item_1(p
):
104 '''assertion_item : concurrent_assertion_item '''
105 print('assertion_item_1', list(p
))
107 def p_assignment_pattern_1(p
):
108 '''assignment_pattern : K_LP expression_list_proper '}' '''
109 print('assignment_pattern_1', list(p
))
110 # { PEAssignPattern*tmp = new PEAssignPattern(*$2);
111 # FILE_NAME(tmp, @1);
116 def p_assignment_pattern_2(p
):
117 '''assignment_pattern : K_LP '}' '''
118 print('assignment_pattern_2', list(p
))
119 # { PEAssignPattern*tmp = new PEAssignPattern;
120 # FILE_NAME(tmp, @1);
124 def p_block_identifier_opt_1(p
):
125 '''block_identifier_opt : IDENTIFIER ':' '''
126 print('block_identifier_opt_1', list(p
))
128 def p_block_identifier_opt_2(p
):
129 '''block_identifier_opt : '''
130 print('block_identifier_opt_2', list(p
))
132 def p_class_declaration_1(p
):
133 '''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 '''
134 print('class_declaration_1', list(p
))
135 # { // Wrap up the class.
136 # if ($11 && $4 && $4->name != $11) {
137 # yyerror(@11, "error: Class end label doesn't match class name.");
142 def p__embed0_class_declaration(p
):
143 '''_embed0_class_declaration : '''
144 # { pform_start_class_declaration(@2, $4, $5.type, $5.exprs, $3); }
146 def p__embed1_class_declaration(p
):
147 '''_embed1_class_declaration : '''
148 # { // Process a class.
149 # pform_end_class_declaration(@9);
152 def p_class_constraint_1(p
):
153 '''class_constraint : constraint_prototype '''
154 print('class_constraint_1', list(p
))
156 def p_class_constraint_2(p
):
157 '''class_constraint : constraint_declaration '''
158 print('class_constraint_2', list(p
))
160 def p_class_identifier_1(p
):
161 '''class_identifier : IDENTIFIER '''
162 print('class_identifier_1', list(p
))
163 # { // Create a synthetic typedef for the class name so that the
164 # // lexor detects the name as a type.
165 # perm_string name = lex_strings.make($1);
166 # class_type_t*tmp = new class_type_t(name);
167 # FILE_NAME(tmp, @1);
168 # pform_set_typedef(name, tmp, NULL);
173 def p_class_identifier_2(p
):
174 '''class_identifier : TYPE_IDENTIFIER '''
175 print('class_identifier_2', list(p
))
176 # { class_type_t*tmp = dynamic_cast<class_type_t*>($1.type);
178 # yyerror(@1, "Type name \"%s\"is not a predeclared class name.", $1.text);
184 def p_class_declaration_endlabel_opt_1(p
):
185 '''class_declaration_endlabel_opt : ':' TYPE_IDENTIFIER '''
186 print('class_declaration_endlabel_opt_1', list(p
))
187 # { class_type_t*tmp = dynamic_cast<class_type_t*> ($2.type);
189 # yyerror(@2, "error: class declaration endlabel \"%s\" is not a class name\n", $2.text);
192 # $$ = strdupnew(tmp->name.str());
197 def p_class_declaration_endlabel_opt_2(p
):
198 '''class_declaration_endlabel_opt : ':' IDENTIFIER '''
199 print('class_declaration_endlabel_opt_2', list(p
))
202 def p_class_declaration_endlabel_opt_3(p
):
203 '''class_declaration_endlabel_opt : '''
204 print('class_declaration_endlabel_opt_3', list(p
))
207 def p_class_declaration_extends_opt_1(p
):
208 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '''
209 print('class_declaration_extends_opt_1', list(p
))
210 # { $$.type = $2.type;
215 def p_class_declaration_extends_opt_2(p
):
216 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '(' expression_list_with_nuls ')' '''
217 print('class_declaration_extends_opt_2', list(p
))
218 # { $$.type = $2.type;
223 def p_class_declaration_extends_opt_3(p
):
224 '''class_declaration_extends_opt : '''
225 print('class_declaration_extends_opt_3', list(p
))
226 # { $$.type = 0; $$.exprs = 0; }
228 def p_class_items_opt_1(p
):
229 '''class_items_opt : class_items '''
230 print('class_items_opt_1', list(p
))
232 def p_class_items_opt_2(p
):
233 '''class_items_opt : '''
234 print('class_items_opt_2', list(p
))
236 def p_class_items_1(p
):
237 '''class_items : class_items class_item '''
238 print('class_items_1', list(p
))
240 def p_class_items_2(p
):
241 '''class_items : class_item '''
242 print('class_items_2', list(p
))
244 def p_class_item_1(p
):
245 '''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 '''
246 print('class_item_1', list(p
))
247 # { current_function->set_ports($6);
248 # pform_set_constructor_return(current_function);
249 # pform_set_this_class(@3, current_function);
250 # current_function_set_statement(@3, $10);
252 # current_function = 0;
255 def p_class_item_2(p
):
256 '''class_item : property_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
257 print('class_item_2', list(p
))
258 # { pform_class_property(@2, $1, $2, $3); }
260 def p_class_item_3(p
):
261 '''class_item : K_const class_item_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
262 print('class_item_3', list(p
))
263 # { pform_class_property(@1, $2 | property_qualifier_t::make_const(), $3, $4); }
265 def p_class_item_4(p
):
266 '''class_item : method_qualifier_opt task_declaration '''
267 print('class_item_4', list(p
))
268 # { /* The task_declaration rule puts this into the class */ }
270 def p_class_item_5(p
):
271 '''class_item : method_qualifier_opt function_declaration '''
272 print('class_item_5', list(p
))
273 # { /* The function_declaration rule puts this into the class */ }
275 def p_class_item_6(p
):
276 '''class_item : K_extern method_qualifier_opt K_function K_new ';' '''
277 print('class_item_6', list(p
))
278 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
280 def p_class_item_7(p
):
281 '''class_item : K_extern method_qualifier_opt K_function K_new '(' tf_port_list_opt ')' ';' '''
282 print('class_item_7', list(p
))
283 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
285 def p_class_item_8(p
):
286 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER ';' '''
287 print('class_item_8', list(p
))
288 # { yyerror(@1, "sorry: External methods are not yet supported.");
292 def p_class_item_9(p
):
293 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' ';' '''
294 print('class_item_9', list(p
))
295 # { yyerror(@1, "sorry: External methods are not yet supported.");
299 def p_class_item_10(p
):
300 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER ';' '''
301 print('class_item_10', list(p
))
302 # { yyerror(@1, "sorry: External methods are not yet supported.");
306 def p_class_item_11(p
):
307 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER '(' tf_port_list_opt ')' ';' '''
308 print('class_item_11', list(p
))
309 # { yyerror(@1, "sorry: External methods are not yet supported.");
313 def p_class_item_12(p
):
314 '''class_item : class_constraint '''
315 print('class_item_12', list(p
))
317 def p_class_item_13(p
):
318 '''class_item : property_qualifier_opt data_type error ';' '''
319 print('class_item_13', list(p
))
320 # { yyerror(@3, "error: Errors in variable names after data type.");
324 def p_class_item_14(p
):
325 '''class_item : property_qualifier_opt IDENTIFIER error ';' '''
326 print('class_item_14', list(p
))
327 # { yyerror(@3, "error: %s doesn't name a type.", $2);
331 def p_class_item_15(p
):
332 '''class_item : method_qualifier_opt K_function K_new error K_endfunction endnew_opt '''
333 print('class_item_15', list(p
))
334 # { yyerror(@1, "error: I give up on this class constructor declaration.");
338 def p_class_item_16(p
):
339 '''class_item : error ';' '''
340 print('class_item_16', list(p
))
341 # { yyerror(@2, "error: invalid class item.");
345 def p__embed0_class_item(p
):
346 '''_embed0_class_item : '''
347 # { assert(current_function==0);
348 # current_function = pform_push_constructor_scope(@3);
351 def p_class_item_qualifier_1(p
):
352 '''class_item_qualifier : K_static '''
353 print('class_item_qualifier_1', list(p
))
354 # { $$ = property_qualifier_t::make_static(); }
356 def p_class_item_qualifier_2(p
):
357 '''class_item_qualifier : K_protected '''
358 print('class_item_qualifier_2', list(p
))
359 # { $$ = property_qualifier_t::make_protected(); }
361 def p_class_item_qualifier_3(p
):
362 '''class_item_qualifier : K_local '''
363 print('class_item_qualifier_3', list(p
))
364 # { $$ = property_qualifier_t::make_local(); }
366 def p_class_item_qualifier_list_1(p
):
367 '''class_item_qualifier_list : class_item_qualifier_list class_item_qualifier '''
368 print('class_item_qualifier_list_1', list(p
))
371 def p_class_item_qualifier_list_2(p
):
372 '''class_item_qualifier_list : class_item_qualifier '''
373 print('class_item_qualifier_list_2', list(p
))
376 def p_class_item_qualifier_opt_1(p
):
377 '''class_item_qualifier_opt : class_item_qualifier_list '''
378 print('class_item_qualifier_opt_1', list(p
))
381 def p_class_item_qualifier_opt_2(p
):
382 '''class_item_qualifier_opt : '''
383 print('class_item_qualifier_opt_2', list(p
))
384 # { $$ = property_qualifier_t::make_none(); }
386 def p_class_new_1(p
):
387 '''class_new : K_new '(' expression_list_with_nuls ')' '''
388 print('class_new_1', list(p
))
389 # { list<PExpr*>*expr_list = $3;
390 # strip_tail_items(expr_list);
391 # PENewClass*tmp = new PENewClass(*expr_list);
392 # FILE_NAME(tmp, @1);
397 def p_class_new_2(p
):
398 '''class_new : K_new hierarchy_identifier '''
399 print('class_new_2', list(p
))
400 # { PEIdent*tmpi = new PEIdent(*$2);
401 # FILE_NAME(tmpi, @2);
402 # PENewCopy*tmp = new PENewCopy(tmpi);
403 # FILE_NAME(tmp, @1);
408 def p_class_new_3(p
):
409 '''class_new : K_new '''
410 print('class_new_3', list(p
))
411 # { PENewClass*tmp = new PENewClass;
412 # FILE_NAME(tmp, @1);
416 def p_concurrent_assertion_item_1(p
):
417 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' property_spec ')' statement_or_null '''
418 print('concurrent_assertion_item_1', list(p
))
420 # if (gn_assertions_flag) {
421 # yyerror(@2, "sorry: concurrent_assertion_item not supported."
422 # " Try -gno-assertion to turn this message off.");
426 def p_concurrent_assertion_item_2(p
):
427 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' error ')' statement_or_null '''
428 print('concurrent_assertion_item_2', list(p
))
430 # yyerror(@2, "error: Error in property_spec of concurrent assertion item.");
433 def p_constraint_block_item_1(p
):
434 '''constraint_block_item : constraint_expression '''
435 print('constraint_block_item_1', list(p
))
437 def p_constraint_block_item_list_1(p
):
438 '''constraint_block_item_list : constraint_block_item_list constraint_block_item '''
439 print('constraint_block_item_list_1', list(p
))
441 def p_constraint_block_item_list_2(p
):
442 '''constraint_block_item_list : constraint_block_item '''
443 print('constraint_block_item_list_2', list(p
))
445 def p_constraint_block_item_list_opt_1(p
):
446 '''constraint_block_item_list_opt : '''
447 print('constraint_block_item_list_opt_1', list(p
))
449 def p_constraint_block_item_list_opt_2(p
):
450 '''constraint_block_item_list_opt : constraint_block_item_list '''
451 print('constraint_block_item_list_opt_2', list(p
))
453 def p_constraint_declaration_1(p
):
454 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' constraint_block_item_list_opt '}' '''
455 print('constraint_declaration_1', list(p
))
456 # { yyerror(@2, "sorry: Constraint declarations not supported."); }
458 def p_constraint_declaration_2(p
):
459 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' error '}' '''
460 print('constraint_declaration_2', list(p
))
461 # { yyerror(@4, "error: Errors in the constraint block item list."); }
463 def p_constraint_expression_1(p
):
464 '''constraint_expression : expression ';' '''
465 print('constraint_expression_1', list(p
))
467 def p_constraint_expression_2(p
):
468 '''constraint_expression : expression K_dist '{' '}' ';' '''
469 print('constraint_expression_2', list(p
))
471 def p_constraint_expression_3(p
):
472 '''constraint_expression : expression K_TRIGGER constraint_set '''
473 print('constraint_expression_3', list(p
))
475 def p_constraint_expression_4(p
):
476 '''constraint_expression : K_if '(' expression ')' constraint_set %prec less_than_K_else '''
477 print('constraint_expression_4', list(p
))
479 def p_constraint_expression_5(p
):
480 '''constraint_expression : K_if '(' expression ')' constraint_set K_else constraint_set '''
481 print('constraint_expression_5', list(p
))
483 def p_constraint_expression_6(p
):
484 '''constraint_expression : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' constraint_set '''
485 print('constraint_expression_6', list(p
))
487 def p_constraint_expression_list_1(p
):
488 '''constraint_expression_list : constraint_expression_list constraint_expression '''
489 print('constraint_expression_list_1', list(p
))
491 def p_constraint_expression_list_2(p
):
492 '''constraint_expression_list : constraint_expression '''
493 print('constraint_expression_list_2', list(p
))
495 def p_constraint_prototype_1(p
):
496 '''constraint_prototype : K_static_opt K_constraint IDENTIFIER ';' '''
497 print('constraint_prototype_1', list(p
))
498 # { yyerror(@2, "sorry: Constraint prototypes not supported."); }
500 def p_constraint_set_1(p
):
501 '''constraint_set : constraint_expression '''
502 print('constraint_set_1', list(p
))
504 def p_constraint_set_2(p
):
505 '''constraint_set : '{' constraint_expression_list '}' '''
506 print('constraint_set_2', list(p
))
508 def p_data_declaration_1(p
):
509 '''data_declaration : attribute_list_opt data_type_or_implicit list_of_variable_decl_assignments ';' '''
510 print('data_declaration_1', list(p
))
511 # { data_type_t*data_type = $2;
512 # if (data_type == 0) {
513 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
514 # FILE_NAME(data_type, @2);
516 # pform_makewire(@2, 0, str_strength, $3, NetNet::IMPLICIT_REG, data_type);
519 def p_data_type_1(p
):
520 '''data_type : integer_vector_type unsigned_signed_opt dimensions_opt '''
521 print('data_type_1', list(p
))
522 # { ivl_variable_type_t use_vtype = $1;
523 # bool reg_flag = false;
524 # if (use_vtype == IVL_VT_NO_TYPE) {
525 # use_vtype = IVL_VT_LOGIC;
528 # vector_type_t*tmp = new vector_type_t(use_vtype, $2, $3);
529 # tmp->reg_flag = reg_flag;
530 # FILE_NAME(tmp, @1);
534 def p_data_type_2(p
):
535 '''data_type : non_integer_type '''
536 print('data_type_2', list(p
))
537 # { real_type_t*tmp = new real_type_t($1);
538 # FILE_NAME(tmp, @1);
542 def p_data_type_3(p
):
543 '''data_type : struct_data_type '''
544 print('data_type_3', list(p
))
545 # { if (!$1->packed_flag) {
546 # yyerror(@1, "sorry: Unpacked structs not supported.");
551 def p_data_type_4(p
):
552 '''data_type : enum_data_type '''
553 print('data_type_4', list(p
))
556 def p_data_type_5(p
):
557 '''data_type : atom2_type signed_unsigned_opt '''
558 print('data_type_5', list(p
))
559 # { atom2_type_t*tmp = new atom2_type_t($1, $2);
560 # FILE_NAME(tmp, @1);
564 def p_data_type_6(p
):
565 '''data_type : K_integer signed_unsigned_opt '''
566 print('data_type_6', list(p
))
567 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
568 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, $2, pd);
569 # tmp->reg_flag = true;
570 # tmp->integer_flag = true;
574 def p_data_type_7(p
):
575 '''data_type : K_time '''
576 print('data_type_7', list(p
))
577 # { list<pform_range_t>*pd = make_range_from_width(64);
578 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
579 # tmp->reg_flag = !gn_system_verilog();
583 def p_data_type_8(p
):
584 '''data_type : TYPE_IDENTIFIER dimensions_opt '''
585 print('data_type_8', list(p
))
587 # parray_type_t*tmp = new parray_type_t($1.type, $2);
588 # FILE_NAME(tmp, @1);
590 # } else $$ = $1.type;
594 def p_data_type_9(p
):
595 '''data_type : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_data_type TYPE_IDENTIFIER '''
596 print('data_type_9', list(p
))
597 # { lex_in_package_scope(0);
602 def p_data_type_10(p
):
603 '''data_type : K_string '''
604 print('data_type_10', list(p
))
605 # { string_type_t*tmp = new string_type_t;
606 # FILE_NAME(tmp, @1);
610 def p__embed0_data_type(p
):
611 '''_embed0_data_type : '''
612 # { lex_in_package_scope($1); }
614 def p_data_type_or_implicit_1(p
):
615 '''data_type_or_implicit : data_type '''
616 print('data_type_or_implicit_1', list(p
))
619 def p_data_type_or_implicit_2(p
):
620 '''data_type_or_implicit : signing dimensions_opt '''
621 print('data_type_or_implicit_2', list(p
))
622 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, $1, $2);
623 # tmp->implicit_flag = true;
624 # FILE_NAME(tmp, @1);
628 def p_data_type_or_implicit_3(p
):
629 '''data_type_or_implicit : dimensions '''
630 print('data_type_or_implicit_3', list(p
))
631 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, $1);
632 # tmp->implicit_flag = true;
633 # FILE_NAME(tmp, @1);
637 def p_data_type_or_implicit_4(p
):
638 '''data_type_or_implicit : '''
639 print('data_type_or_implicit_4', list(p
))
642 def p_data_type_or_implicit_or_void_1(p
):
643 '''data_type_or_implicit_or_void : data_type_or_implicit '''
644 print('data_type_or_implicit_or_void_1', list(p
))
647 def p_data_type_or_implicit_or_void_2(p
):
648 '''data_type_or_implicit_or_void : K_void '''
649 print('data_type_or_implicit_or_void_2', list(p
))
650 # { void_type_t*tmp = new void_type_t;
651 # FILE_NAME(tmp, @1);
655 def p_description_1(p
):
656 '''description : module '''
657 print('description_1', list(p
))
659 def p_description_2(p
):
660 '''description : udp_primitive '''
661 print('description_2', list(p
))
663 def p_description_3(p
):
664 '''description : config_declaration '''
665 print('description_3', list(p
))
667 def p_description_4(p
):
668 '''description : nature_declaration '''
669 print('description_4', list(p
))
671 def p_description_5(p
):
672 '''description : package_declaration '''
673 print('description_5', list(p
))
675 def p_description_6(p
):
676 '''description : discipline_declaration '''
677 print('description_6', list(p
))
679 def p_description_7(p
):
680 '''description : package_item '''
681 print('description_7', list(p
))
683 def p_description_8(p
):
684 '''description : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' '''
685 print('description_8', list(p
))
686 # { perm_string tmp3 = lex_strings.make($3);
687 # pform_set_type_attrib(tmp3, $5, $7);
692 def p_description_list_1(p
):
693 '''description_list : description '''
694 print('description_list_1', list(p
))
696 def p_description_list_2(p
):
697 '''description_list : description_list description '''
698 print('description_list_2', list(p
))
700 def p_endnew_opt_1(p
):
701 '''endnew_opt : ':' K_new '''
702 print('endnew_opt_1', list(p
))
704 def p_endnew_opt_2(p
):
706 print('endnew_opt_2', list(p
))
708 def p_dynamic_array_new_1(p
):
709 '''dynamic_array_new : K_new '[' expression ']' '''
710 print('dynamic_array_new_1', list(p
))
711 # { $$ = new PENewArray($3, 0);
715 def p_dynamic_array_new_2(p
):
716 '''dynamic_array_new : K_new '[' expression ']' '(' expression ')' '''
717 print('dynamic_array_new_2', list(p
))
718 # { $$ = new PENewArray($3, $6);
723 '''for_step : lpvalue '=' expression '''
724 print('for_step_1', list(p
))
725 # { PAssign*tmp = new PAssign($1,$3);
726 # FILE_NAME(tmp, @1);
731 '''for_step : inc_or_dec_expression '''
732 print('for_step_2', list(p
))
733 # { $$ = pform_compressed_assign_from_inc_dec(@1, $1); }
736 '''for_step : compressed_statement '''
737 print('for_step_3', list(p
))
740 def p_function_declaration_1(p
):
741 '''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 '''
742 print('function_declaration_1', list(p
))
743 # { // Last step: check any closing name.
745 # if (strcmp($4,$11) != 0) {
746 # yyerror(@11, "error: End label doesn't match "
749 # if (! gn_system_verilog()) {
750 # yyerror(@11, "error: Function end labels require "
758 def p_function_declaration_2(p
):
759 '''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 '''
760 print('function_declaration_2', list(p
))
761 # { // Last step: check any closing name.
763 # if (strcmp($4,$14) != 0) {
764 # yyerror(@14, "error: End label doesn't match "
767 # if (! gn_system_verilog()) {
768 # yyerror(@14, "error: Function end labels require "
776 def p_function_declaration_3(p
):
777 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER error K_endfunction _embed4_function_declaration endlabel_opt '''
778 print('function_declaration_3', list(p
))
779 # { // Last step: check any closing name.
781 # if (strcmp($4,$8) != 0) {
782 # yyerror(@8, "error: End label doesn't match function name");
784 # if (! gn_system_verilog()) {
785 # yyerror(@8, "error: Function end labels require "
793 def p__embed0_function_declaration(p
):
794 '''_embed0_function_declaration : '''
795 # { assert(current_function == 0);
796 # current_function = pform_push_function_scope(@1, $4, $2);
799 def p__embed1_function_declaration(p
):
800 '''_embed1_function_declaration : '''
801 # { current_function->set_ports($7);
802 # current_function->set_return($3);
803 # current_function_set_statement($8? @8 : @4, $8);
804 # pform_set_this_class(@4, current_function);
806 # current_function = 0;
809 def p__embed2_function_declaration(p
):
810 '''_embed2_function_declaration : '''
811 # { assert(current_function == 0);
812 # current_function = pform_push_function_scope(@1, $4, $2);
815 def p__embed3_function_declaration(p
):
816 '''_embed3_function_declaration : '''
817 # { current_function->set_ports($7);
818 # current_function->set_return($3);
819 # current_function_set_statement($11? @11 : @4, $11);
820 # pform_set_this_class(@4, current_function);
822 # current_function = 0;
823 # if ($7==0 && !gn_system_verilog()) {
824 # yyerror(@4, "error: Empty parenthesis syntax requires SystemVerilog.");
828 def p__embed4_function_declaration(p
):
829 '''_embed4_function_declaration : '''
831 # if (current_function) {
833 # current_function = 0;
835 # assert(current_function == 0);
836 # yyerror(@1, "error: Syntax error defining function.");
840 def p_import_export_1(p
):
841 '''import_export : K_import '''
842 print('import_export_1', list(p
))
845 def p_import_export_2(p
):
846 '''import_export : K_export '''
847 print('import_export_2', list(p
))
850 def p_implicit_class_handle_1(p
):
851 '''implicit_class_handle : K_this '''
852 print('implicit_class_handle_1', list(p
))
853 # { $$ = pform_create_this(); }
855 def p_implicit_class_handle_2(p
):
856 '''implicit_class_handle : K_super '''
857 print('implicit_class_handle_2', list(p
))
858 # { $$ = pform_create_super(); }
860 def p_inc_or_dec_expression_1(p
):
861 '''inc_or_dec_expression : K_INCR lpvalue %prec UNARY_PREC '''
862 print('inc_or_dec_expression_1', list(p
))
863 # { PEUnary*tmp = new PEUnary('I', $2);
864 # FILE_NAME(tmp, @2);
868 def p_inc_or_dec_expression_2(p
):
869 '''inc_or_dec_expression : lpvalue K_INCR %prec UNARY_PREC '''
870 print('inc_or_dec_expression_2', list(p
))
871 # { PEUnary*tmp = new PEUnary('i', $1);
872 # FILE_NAME(tmp, @1);
876 def p_inc_or_dec_expression_3(p
):
877 '''inc_or_dec_expression : K_DECR lpvalue %prec UNARY_PREC '''
878 print('inc_or_dec_expression_3', list(p
))
879 # { PEUnary*tmp = new PEUnary('D', $2);
880 # FILE_NAME(tmp, @2);
884 def p_inc_or_dec_expression_4(p
):
885 '''inc_or_dec_expression : lpvalue K_DECR %prec UNARY_PREC '''
886 print('inc_or_dec_expression_4', list(p
))
887 # { PEUnary*tmp = new PEUnary('d', $1);
888 # FILE_NAME(tmp, @1);
892 def p_inside_expression_1(p
):
893 '''inside_expression : expression K_inside '{' open_range_list '}' '''
894 print('inside_expression_1', list(p
))
895 # { yyerror(@2, "sorry: \"inside\" expressions not supported yet.");
899 def p_integer_vector_type_1(p
):
900 '''integer_vector_type : K_reg '''
901 print('integer_vector_type_1', list(p
))
902 p
[0] = IVL_VT_NO_TYPE
904 def p_integer_vector_type_2(p
):
905 '''integer_vector_type : K_bit '''
906 print('integer_vector_type_2', list(p
))
909 def p_integer_vector_type_3(p
):
910 '''integer_vector_type : K_logic '''
911 print('integer_vector_type_3', list(p
))
914 def p_integer_vector_type_4(p
):
915 '''integer_vector_type : K_bool '''
916 print('integer_vector_type_4', list(p
))
917 # { $$ = IVL_VT_BOOL; }
919 def p_join_keyword_1(p
):
920 '''join_keyword : K_join '''
921 print('join_keyword_1', list(p
))
922 # { $$ = PBlock::BL_PAR; }
924 def p_join_keyword_2(p
):
925 '''join_keyword : K_join_none '''
926 print('join_keyword_2', list(p
))
927 # { $$ = PBlock::BL_JOIN_NONE; }
929 def p_join_keyword_3(p
):
930 '''join_keyword : K_join_any '''
931 print('join_keyword_3', list(p
))
932 # { $$ = PBlock::BL_JOIN_ANY; }
934 def p_jump_statement_1(p
):
935 '''jump_statement : K_break ';' '''
936 print('jump_statement_1', list(p
))
937 # { yyerror(@1, "sorry: break statements not supported.");
941 def p_jump_statement_2(p
):
942 '''jump_statement : K_return ';' '''
943 print('jump_statement_2', list(p
))
944 # { PReturn*tmp = new PReturn(0);
945 # FILE_NAME(tmp, @1);
949 def p_jump_statement_3(p
):
950 '''jump_statement : K_return expression ';' '''
951 print('jump_statement_3', list(p
))
952 # { PReturn*tmp = new PReturn($2);
953 # FILE_NAME(tmp, @1);
958 '''lifetime : K_automatic '''
959 print('lifetime_1', list(p
))
960 # { $$ = LexicalScope::AUTOMATIC; }
963 '''lifetime : K_static '''
964 print('lifetime_2', list(p
))
965 # { $$ = LexicalScope::STATIC; }
967 def p_lifetime_opt_1(p
):
968 '''lifetime_opt : lifetime '''
969 print('lifetime_opt_1', list(p
))
972 def p_lifetime_opt_2(p
):
973 '''lifetime_opt : '''
974 print('lifetime_opt_2', list(p
))
975 # { $$ = LexicalScope::INHERITED; }
977 def p_loop_statement_1(p
):
978 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' for_step ')' statement_or_null '''
979 print('loop_statement_1', list(p
))
980 # { PForStatement*tmp = new PForStatement($3, $5, $7, $9, $11);
981 # FILE_NAME(tmp, @1);
985 def p_loop_statement_2(p
):
986 '''loop_statement : K_for '(' data_type IDENTIFIER '=' expression ';' expression ';' for_step ')' _embed0_loop_statement statement_or_null '''
987 print('loop_statement_2', list(p
))
988 # { pform_name_t tmp_hident;
989 # tmp_hident.push_back(name_component_t(lex_strings.make($4)));
991 # PEIdent*tmp_ident = pform_new_ident(tmp_hident);
992 # FILE_NAME(tmp_ident, @4);
994 # PForStatement*tmp_for = new PForStatement(tmp_ident, $6, $8, $10, $13);
995 # FILE_NAME(tmp_for, @1);
998 # vector<Statement*>tmp_for_list (1);
999 # tmp_for_list[0] = tmp_for;
1000 # PBlock*tmp_blk = current_block_stack.top();
1001 # current_block_stack.pop();
1002 # tmp_blk->set_statement(tmp_for_list);
1007 def p_loop_statement_3(p
):
1008 '''loop_statement : K_forever statement_or_null '''
1009 print('loop_statement_3', list(p
))
1010 # { PForever*tmp = new PForever($2);
1011 # FILE_NAME(tmp, @1);
1015 def p_loop_statement_4(p
):
1016 '''loop_statement : K_repeat '(' expression ')' statement_or_null '''
1017 print('loop_statement_4', list(p
))
1018 # { PRepeat*tmp = new PRepeat($3, $5);
1019 # FILE_NAME(tmp, @1);
1023 def p_loop_statement_5(p
):
1024 '''loop_statement : K_while '(' expression ')' statement_or_null '''
1025 print('loop_statement_5', list(p
))
1026 # { PWhile*tmp = new PWhile($3, $5);
1027 # FILE_NAME(tmp, @1);
1031 def p_loop_statement_6(p
):
1032 '''loop_statement : K_do statement_or_null K_while '(' expression ')' ';' '''
1033 print('loop_statement_6', list(p
))
1034 # { PDoWhile*tmp = new PDoWhile($5, $2);
1035 # FILE_NAME(tmp, @1);
1039 def p_loop_statement_7(p
):
1040 '''loop_statement : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' _embed1_loop_statement statement_or_null '''
1041 print('loop_statement_7', list(p
))
1042 # { PForeach*tmp_for = pform_make_foreach(@1, $3, $5, $9);
1044 # pform_pop_scope();
1045 # vector<Statement*>tmp_for_list(1);
1046 # tmp_for_list[0] = tmp_for;
1047 # PBlock*tmp_blk = current_block_stack.top();
1048 # current_block_stack.pop();
1049 # tmp_blk->set_statement(tmp_for_list);
1053 def p_loop_statement_8(p
):
1054 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' error ')' statement_or_null '''
1055 print('loop_statement_8', list(p
))
1057 # yyerror(@1, "error: Error in for loop step assignment.");
1060 def p_loop_statement_9(p
):
1061 '''loop_statement : K_for '(' lpvalue '=' expression ';' error ';' for_step ')' statement_or_null '''
1062 print('loop_statement_9', list(p
))
1064 # yyerror(@1, "error: Error in for loop condition expression.");
1067 def p_loop_statement_10(p
):
1068 '''loop_statement : K_for '(' error ')' statement_or_null '''
1069 print('loop_statement_10', list(p
))
1071 # yyerror(@1, "error: Incomprehensible for loop.");
1074 def p_loop_statement_11(p
):
1075 '''loop_statement : K_while '(' error ')' statement_or_null '''
1076 print('loop_statement_11', list(p
))
1078 # yyerror(@1, "error: Error in while loop condition.");
1081 def p_loop_statement_12(p
):
1082 '''loop_statement : K_do statement_or_null K_while '(' error ')' ';' '''
1083 print('loop_statement_12', list(p
))
1085 # yyerror(@1, "error: Error in do/while loop condition.");
1088 def p_loop_statement_13(p
):
1089 '''loop_statement : K_foreach '(' IDENTIFIER '[' error ']' ')' statement_or_null '''
1090 print('loop_statement_13', list(p
))
1092 # yyerror(@4, "error: Errors in foreach loop variables list.");
1095 def p__embed0_loop_statement(p
):
1096 '''_embed0_loop_statement : '''
1097 # { static unsigned for_counter = 0;
1098 # char for_block_name [64];
1099 # snprintf(for_block_name, sizeof for_block_name, "$ivl_for_loop%u", for_counter);
1101 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1102 # FILE_NAME(tmp, @1);
1103 # current_block_stack.push(tmp);
1105 # list<decl_assignment_t*>assign_list;
1106 # decl_assignment_t*tmp_assign = new decl_assignment_t;
1107 # tmp_assign->name = lex_strings.make($4);
1108 # assign_list.push_back(tmp_assign);
1109 # pform_makewire(@4, 0, str_strength, &assign_list, NetNet::REG, $3);
1112 def p__embed1_loop_statement(p
):
1113 '''_embed1_loop_statement : '''
1114 # { static unsigned foreach_counter = 0;
1115 # char for_block_name[64];
1116 # snprintf(for_block_name, sizeof for_block_name, "$ivl_foreach%u", foreach_counter);
1117 # foreach_counter += 1;
1119 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1120 # FILE_NAME(tmp, @1);
1121 # current_block_stack.push(tmp);
1123 # pform_make_foreach_declarations(@1, $5);
1126 def p_list_of_variable_decl_assignments_1(p
):
1127 '''list_of_variable_decl_assignments : variable_decl_assignment '''
1128 print('list_of_variable_decl_assignments_1', list(p
))
1129 # { list<decl_assignment_t*>*tmp = new list<decl_assignment_t*>;
1130 # tmp->push_back($1);
1134 def p_list_of_variable_decl_assignments_2(p
):
1135 '''list_of_variable_decl_assignments : list_of_variable_decl_assignments ',' variable_decl_assignment '''
1136 print('list_of_variable_decl_assignments_2', list(p
))
1137 # { list<decl_assignment_t*>*tmp = $1;
1138 # tmp->push_back($3);
1142 def p_variable_decl_assignment_1(p
):
1143 '''variable_decl_assignment : IDENTIFIER dimensions_opt '''
1144 print('variable_decl_assignment_1', list(p
))
1145 # { decl_assignment_t*tmp = new decl_assignment_t;
1146 # tmp->name = lex_strings.make($1);
1155 def p_variable_decl_assignment_2(p
):
1156 '''variable_decl_assignment : IDENTIFIER '=' expression '''
1157 print('variable_decl_assignment_2', list(p
))
1158 # { decl_assignment_t*tmp = new decl_assignment_t;
1159 # tmp->name = lex_strings.make($1);
1160 # tmp->expr .reset($3);
1165 def p_variable_decl_assignment_3(p
):
1166 '''variable_decl_assignment : IDENTIFIER '=' K_new '(' ')' '''
1167 print('variable_decl_assignment_3', list(p
))
1168 # { decl_assignment_t*tmp = new decl_assignment_t;
1169 # tmp->name = lex_strings.make($1);
1170 # PENewClass*expr = new PENewClass;
1171 # FILE_NAME(expr, @3);
1172 # tmp->expr .reset(expr);
1177 def p_loop_variables_1(p
):
1178 '''loop_variables : loop_variables ',' IDENTIFIER '''
1179 print('loop_variables_1', list(p
))
1180 # { list<perm_string>*tmp = $1;
1181 # tmp->push_back(lex_strings.make($3));
1186 def p_loop_variables_2(p
):
1187 '''loop_variables : IDENTIFIER '''
1188 print('loop_variables_2', list(p
))
1189 # { list<perm_string>*tmp = new list<perm_string>;
1190 # tmp->push_back(lex_strings.make($1));
1195 def p_method_qualifier_1(p
):
1196 '''method_qualifier : K_virtual '''
1197 print('method_qualifier_1', list(p
))
1199 def p_method_qualifier_2(p
):
1200 '''method_qualifier : class_item_qualifier '''
1201 print('method_qualifier_2', list(p
))
1203 def p_method_qualifier_opt_1(p
):
1204 '''method_qualifier_opt : method_qualifier '''
1205 print('method_qualifier_opt_1', list(p
))
1207 def p_method_qualifier_opt_2(p
):
1208 '''method_qualifier_opt : '''
1209 print('method_qualifier_opt_2', list(p
))
1211 def p_modport_declaration_1(p
):
1212 '''modport_declaration : K_modport _embed0_modport_declaration modport_item_list ';' '''
1213 print('modport_declaration_1', list(p
))
1215 def p__embed0_modport_declaration(p
):
1216 '''_embed0_modport_declaration : '''
1217 # { if (!pform_in_interface())
1218 # yyerror(@1, "error: modport declarations are only allowed "
1219 # "in interfaces.");
1222 def p_modport_item_list_1(p
):
1223 '''modport_item_list : modport_item '''
1224 print('modport_item_list_1', list(p
))
1226 def p_modport_item_list_2(p
):
1227 '''modport_item_list : modport_item_list ',' modport_item '''
1228 print('modport_item_list_2', list(p
))
1230 def p_modport_item_1(p
):
1231 '''modport_item : IDENTIFIER _embed0_modport_item '(' modport_ports_list ')' '''
1232 print('modport_item_1', list(p
))
1233 # { pform_end_modport_item(@1); }
1235 def p__embed0_modport_item(p
):
1236 '''_embed0_modport_item : '''
1237 # { pform_start_modport_item(@1, $1); }
1239 def p_modport_ports_list_1(p
):
1240 '''modport_ports_list : modport_ports_declaration '''
1241 print('modport_ports_list_1', list(p
))
1243 def p_modport_ports_list_2(p
):
1244 '''modport_ports_list : modport_ports_list ',' modport_ports_declaration '''
1245 print('modport_ports_list_2', list(p
))
1247 def p_modport_ports_list_3(p
):
1248 '''modport_ports_list : modport_ports_list ',' modport_simple_port '''
1249 print('modport_ports_list_3', list(p
))
1250 # { if (last_modport_port.type == MP_SIMPLE) {
1251 # pform_add_modport_port(@3, last_modport_port.direction,
1252 # $3->name, $3->parm);
1254 # yyerror(@3, "error: modport expression not allowed here.");
1259 def p_modport_ports_list_4(p
):
1260 '''modport_ports_list : modport_ports_list ',' modport_tf_port '''
1261 print('modport_ports_list_4', list(p
))
1262 # { if (last_modport_port.type != MP_TF)
1263 # yyerror(@3, "error: task/function declaration not allowed here.");
1266 def p_modport_ports_list_5(p
):
1267 '''modport_ports_list : modport_ports_list ',' IDENTIFIER '''
1268 print('modport_ports_list_5', list(p
))
1269 # { if (last_modport_port.type == MP_SIMPLE) {
1270 # pform_add_modport_port(@3, last_modport_port.direction,
1271 # lex_strings.make($3), 0);
1272 # } else if (last_modport_port.type != MP_TF) {
1273 # yyerror(@3, "error: list of identifiers not allowed here.");
1278 def p_modport_ports_list_6(p
):
1279 '''modport_ports_list : modport_ports_list ',' '''
1280 print('modport_ports_list_6', list(p
))
1281 # { yyerror(@2, "error: NULL port declarations are not allowed"); }
1283 def p_modport_ports_declaration_1(p
):
1284 '''modport_ports_declaration : attribute_list_opt port_direction IDENTIFIER '''
1285 print('modport_ports_declaration_1', list(p
))
1286 # { last_modport_port.type = MP_SIMPLE;
1287 # last_modport_port.direction = $2;
1288 # pform_add_modport_port(@3, $2, lex_strings.make($3), 0);
1293 def p_modport_ports_declaration_2(p
):
1294 '''modport_ports_declaration : attribute_list_opt port_direction modport_simple_port '''
1295 print('modport_ports_declaration_2', list(p
))
1296 # { last_modport_port.type = MP_SIMPLE;
1297 # last_modport_port.direction = $2;
1298 # pform_add_modport_port(@3, $2, $3->name, $3->parm);
1303 def p_modport_ports_declaration_3(p
):
1304 '''modport_ports_declaration : attribute_list_opt import_export IDENTIFIER '''
1305 print('modport_ports_declaration_3', list(p
))
1306 # { last_modport_port.type = MP_TF;
1307 # last_modport_port.is_import = $2;
1308 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
1313 def p_modport_ports_declaration_4(p
):
1314 '''modport_ports_declaration : attribute_list_opt import_export modport_tf_port '''
1315 print('modport_ports_declaration_4', list(p
))
1316 # { last_modport_port.type = MP_TF;
1317 # last_modport_port.is_import = $2;
1318 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
1322 def p_modport_ports_declaration_5(p
):
1323 '''modport_ports_declaration : attribute_list_opt K_clocking IDENTIFIER '''
1324 print('modport_ports_declaration_5', list(p
))
1325 # { last_modport_port.type = MP_CLOCKING;
1326 # last_modport_port.direction = NetNet::NOT_A_PORT;
1327 # yyerror(@3, "sorry: modport clocking declaration is not yet supported.");
1332 def p_modport_simple_port_1(p
):
1333 '''modport_simple_port : '.' IDENTIFIER '(' expression ')' '''
1334 print('modport_simple_port_1', list(p
))
1335 # { named_pexpr_t*tmp = new named_pexpr_t;
1336 # tmp->name = lex_strings.make($2);
1342 def p_modport_tf_port_1(p
):
1343 '''modport_tf_port : K_task IDENTIFIER '''
1344 print('modport_tf_port_1', list(p
))
1346 def p_modport_tf_port_2(p
):
1347 '''modport_tf_port : K_task IDENTIFIER '(' tf_port_list_opt ')' '''
1348 print('modport_tf_port_2', list(p
))
1350 def p_modport_tf_port_3(p
):
1351 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '''
1352 print('modport_tf_port_3', list(p
))
1354 def p_modport_tf_port_4(p
):
1355 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' '''
1356 print('modport_tf_port_4', list(p
))
1358 def p_non_integer_type_1(p
):
1359 '''non_integer_type : K_real '''
1360 print('non_integer_type_1', list(p
))
1361 # { $$ = real_type_t::REAL; }
1363 def p_non_integer_type_2(p
):
1364 '''non_integer_type : K_realtime '''
1365 print('non_integer_type_2', list(p
))
1366 # { $$ = real_type_t::REAL; }
1368 def p_non_integer_type_3(p
):
1369 '''non_integer_type : K_shortreal '''
1370 print('non_integer_type_3', list(p
))
1371 # { $$ = real_type_t::SHORTREAL; }
1374 '''number : BASED_NUMBER '''
1375 print('number_1', list(p
))
1376 # { $$ = $1; based_size = 0;}
1379 '''number : DEC_NUMBER '''
1380 print('number_2', list(p
))
1381 num
= Leaf(token
.NUMBER
, "%s" % (p
[1]))
1383 # { $$ = $1; based_size = 0;}
1386 '''number : DEC_NUMBER BASED_NUMBER '''
1387 print('number_3', list(p
))
1388 num
= Leaf(token
.NUMBER
, "%s:%s" % (p
[1], p
[2]))
1390 # { $$ = pform_verinum_with_size($1,$2, @2.text, @2.first_line);
1394 '''number : UNBASED_NUMBER '''
1395 print('number_4', list(p
))
1396 # { $$ = $1; based_size = 0;}
1399 '''number : DEC_NUMBER UNBASED_NUMBER '''
1400 print('number_5', list(p
))
1401 # { yyerror(@1, "error: Unbased SystemVerilog literal cannot have "
1403 # $$ = $1; based_size = 0;}
1405 def p_open_range_list_1(p
):
1406 '''open_range_list : open_range_list ',' value_range '''
1407 print('open_range_list_1', list(p
))
1409 def p_open_range_list_2(p
):
1410 '''open_range_list : value_range '''
1411 print('open_range_list_2', list(p
))
1413 def p_package_declaration_1(p
):
1414 '''package_declaration : K_package lifetime_opt IDENTIFIER ';' _embed0_package_declaration timeunits_declaration_opt _embed1_package_declaration package_item_list_opt K_endpackage endlabel_opt '''
1415 print('package_declaration_1', list(p
))
1416 # { pform_end_package_declaration(@1);
1417 # // If an end label is present make sure it match the package name.
1419 # if (strcmp($3,$10) != 0) {
1420 # yyerror(@10, "error: End label doesn't match package name");
1427 def p__embed0_package_declaration(p
):
1428 '''_embed0_package_declaration : '''
1429 # { pform_start_package_declaration(@1, $3, $2); }
1431 def p__embed1_package_declaration(p
):
1432 '''_embed1_package_declaration : '''
1433 # { pform_set_scope_timescale(@1); }
1435 def p_module_package_import_list_opt_1(p
):
1436 '''module_package_import_list_opt : '''
1437 print('module_package_import_list_opt_1', list(p
))
1439 def p_module_package_import_list_opt_2(p
):
1440 '''module_package_import_list_opt : package_import_list '''
1441 print('module_package_import_list_opt_2', list(p
))
1443 def p_package_import_list_1(p
):
1444 '''package_import_list : package_import_declaration '''
1445 print('package_import_list_1', list(p
))
1447 def p_package_import_list_2(p
):
1448 '''package_import_list : package_import_list package_import_declaration '''
1449 print('package_import_list_2', list(p
))
1451 def p_package_import_declaration_1(p
):
1452 '''package_import_declaration : K_import package_import_item_list ';' '''
1453 print('package_import_declaration_1', list(p
))
1456 def p_package_import_item_1(p
):
1457 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '''
1458 print('package_import_item_1', list(p
))
1459 # { pform_package_import(@2, $1, $3);
1463 def p_package_import_item_2(p
):
1464 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES '*' '''
1465 print('package_import_item_2', list(p
))
1466 # { pform_package_import(@2, $1, 0);
1469 def p_package_import_item_list_1(p
):
1470 '''package_import_item_list : package_import_item_list ',' package_import_item '''
1471 print('package_import_item_list_1', list(p
))
1473 def p_package_import_item_list_2(p
):
1474 '''package_import_item_list : package_import_item '''
1475 print('package_import_item_list_2', list(p
))
1477 def p_package_item_1(p
):
1478 '''package_item : timeunits_declaration '''
1479 print('package_item_1', list(p
))
1481 def p_package_item_2(p
):
1482 '''package_item : K_parameter param_type parameter_assign_list ';' '''
1483 print('package_item_2', list(p
))
1485 def p_package_item_3(p
):
1486 '''package_item : K_localparam param_type localparam_assign_list ';' '''
1487 print('package_item_3', list(p
))
1489 def p_package_item_4(p
):
1490 '''package_item : type_declaration '''
1491 print('package_item_4', list(p
))
1493 def p_package_item_5(p
):
1494 '''package_item : function_declaration '''
1495 print('package_item_5', list(p
))
1497 def p_package_item_6(p
):
1498 '''package_item : task_declaration '''
1499 print('package_item_6', list(p
))
1501 def p_package_item_7(p
):
1502 '''package_item : data_declaration '''
1503 print('package_item_7', list(p
))
1505 def p_package_item_8(p
):
1506 '''package_item : class_declaration '''
1507 print('package_item_8', list(p
))
1509 def p_package_item_list_1(p
):
1510 '''package_item_list : package_item_list package_item '''
1511 print('package_item_list_1', list(p
))
1513 def p_package_item_list_2(p
):
1514 '''package_item_list : package_item '''
1515 print('package_item_list_2', list(p
))
1517 def p_package_item_list_opt_1(p
):
1518 '''package_item_list_opt : package_item_list '''
1519 print('package_item_list_opt_1', list(p
))
1521 def p_package_item_list_opt_2(p
):
1522 '''package_item_list_opt : '''
1523 print('package_item_list_opt_2', list(p
))
1525 def p_port_direction_1(p
):
1526 '''port_direction : K_input '''
1527 print('port_direction_1', list(p
))
1528 # { $$ = NetNet::PINPUT; }
1530 def p_port_direction_2(p
):
1531 '''port_direction : K_output '''
1532 print('port_direction_2', list(p
))
1533 # { $$ = NetNet::POUTPUT; }
1535 def p_port_direction_3(p
):
1536 '''port_direction : K_inout '''
1537 print('port_direction_3', list(p
))
1538 # { $$ = NetNet::PINOUT; }
1540 def p_port_direction_4(p
):
1541 '''port_direction : K_ref '''
1542 print('port_direction_4', list(p
))
1543 # { $$ = NetNet::PREF;
1544 # if (!gn_system_verilog()) {
1545 # yyerror(@1, "error: Reference ports (ref) require SystemVerilog.");
1546 # $$ = NetNet::PINPUT;
1550 def p_port_direction_opt_1(p
):
1551 '''port_direction_opt : port_direction '''
1552 print('port_direction_opt_1', list(p
))
1555 def p_port_direction_opt_2(p
):
1556 '''port_direction_opt : '''
1557 print('port_direction_opt_2', list(p
))
1558 # { $$ = NetNet::PIMPLICIT; }
1560 def p_property_expr_1(p
):
1561 '''property_expr : expression '''
1562 print('property_expr_1', list(p
))
1564 def p_procedural_assertion_statement_1(p
):
1565 '''procedural_assertion_statement : K_assert '(' expression ')' statement %prec less_than_K_else '''
1566 print('procedural_assertion_statement_1', list(p
))
1567 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1571 def p_procedural_assertion_statement_2(p
):
1572 '''procedural_assertion_statement : K_assert '(' expression ')' K_else statement '''
1573 print('procedural_assertion_statement_2', list(p
))
1574 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1578 def p_procedural_assertion_statement_3(p
):
1579 '''procedural_assertion_statement : K_assert '(' expression ')' statement K_else statement '''
1580 print('procedural_assertion_statement_3', list(p
))
1581 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1585 def p_property_qualifier_1(p
):
1586 '''property_qualifier : class_item_qualifier '''
1587 print('property_qualifier_1', list(p
))
1589 def p_property_qualifier_2(p
):
1590 '''property_qualifier : random_qualifier '''
1591 print('property_qualifier_2', list(p
))
1593 def p_property_qualifier_opt_1(p
):
1594 '''property_qualifier_opt : property_qualifier_list '''
1595 print('property_qualifier_opt_1', list(p
))
1598 def p_property_qualifier_opt_2(p
):
1599 '''property_qualifier_opt : '''
1600 print('property_qualifier_opt_2', list(p
))
1601 # { $$ = property_qualifier_t::make_none(); }
1603 def p_property_qualifier_list_1(p
):
1604 '''property_qualifier_list : property_qualifier_list property_qualifier '''
1605 print('property_qualifier_list_1', list(p
))
1608 def p_property_qualifier_list_2(p
):
1609 '''property_qualifier_list : property_qualifier '''
1610 print('property_qualifier_list_2', list(p
))
1613 def p_property_spec_1(p
):
1614 '''property_spec : clocking_event_opt property_spec_disable_iff_opt property_expr '''
1615 print('property_spec_1', list(p
))
1617 def p_property_spec_disable_iff_opt_1(p
):
1618 '''property_spec_disable_iff_opt : K_disable K_iff '(' expression ')' '''
1619 print('property_spec_disable_iff_opt_1', list(p
))
1621 def p_property_spec_disable_iff_opt_2(p
):
1622 '''property_spec_disable_iff_opt : '''
1623 print('property_spec_disable_iff_opt_2', list(p
))
1625 def p_random_qualifier_1(p
):
1626 '''random_qualifier : K_rand '''
1627 print('random_qualifier_1', list(p
))
1628 # { $$ = property_qualifier_t::make_rand(); }
1630 def p_random_qualifier_2(p
):
1631 '''random_qualifier : K_randc '''
1632 print('random_qualifier_2', list(p
))
1633 # { $$ = property_qualifier_t::make_randc(); }
1635 def p_real_or_realtime_1(p
):
1636 '''real_or_realtime : K_real '''
1637 print('real_or_realtime_1', list(p
))
1639 def p_real_or_realtime_2(p
):
1640 '''real_or_realtime : K_realtime '''
1641 print('real_or_realtime_2', list(p
))
1644 '''signing : K_signed '''
1645 print('signing_1', list(p
))
1649 '''signing : K_unsigned '''
1650 print('signing_2', list(p
))
1653 def p_simple_type_or_string_1(p
):
1654 '''simple_type_or_string : integer_vector_type '''
1655 print('simple_type_or_string_1', list(p
))
1656 # { ivl_variable_type_t use_vtype = $1;
1657 # bool reg_flag = false;
1658 # if (use_vtype == IVL_VT_NO_TYPE) {
1659 # use_vtype = IVL_VT_LOGIC;
1662 # vector_type_t*tmp = new vector_type_t(use_vtype, false, 0);
1663 # tmp->reg_flag = reg_flag;
1664 # FILE_NAME(tmp, @1);
1668 def p_simple_type_or_string_2(p
):
1669 '''simple_type_or_string : non_integer_type '''
1670 print('simple_type_or_string_2', list(p
))
1671 # { real_type_t*tmp = new real_type_t($1);
1672 # FILE_NAME(tmp, @1);
1676 def p_simple_type_or_string_3(p
):
1677 '''simple_type_or_string : atom2_type '''
1678 print('simple_type_or_string_3', list(p
))
1679 # { atom2_type_t*tmp = new atom2_type_t($1, true);
1680 # FILE_NAME(tmp, @1);
1684 def p_simple_type_or_string_4(p
):
1685 '''simple_type_or_string : K_integer '''
1686 print('simple_type_or_string_4', list(p
))
1687 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
1688 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd);
1689 # tmp->reg_flag = true;
1690 # tmp->integer_flag = true;
1694 def p_simple_type_or_string_5(p
):
1695 '''simple_type_or_string : K_time '''
1696 print('simple_type_or_string_5', list(p
))
1697 # { list<pform_range_t>*pd = make_range_from_width(64);
1698 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
1699 # tmp->reg_flag = !gn_system_verilog();
1703 def p_simple_type_or_string_6(p
):
1704 '''simple_type_or_string : TYPE_IDENTIFIER '''
1705 print('simple_type_or_string_6', list(p
))
1710 def p_simple_type_or_string_7(p
):
1711 '''simple_type_or_string : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_simple_type_or_string TYPE_IDENTIFIER '''
1712 print('simple_type_or_string_7', list(p
))
1713 # { lex_in_package_scope(0);
1718 def p_simple_type_or_string_8(p
):
1719 '''simple_type_or_string : K_string '''
1720 print('simple_type_or_string_8', list(p
))
1721 # { string_type_t*tmp = new string_type_t;
1722 # FILE_NAME(tmp, @1);
1726 def p__embed0_simple_type_or_string(p
):
1727 '''_embed0_simple_type_or_string : '''
1728 # { lex_in_package_scope($1); }
1730 def p_statement_1(p
):
1731 '''statement : attribute_list_opt statement_item '''
1732 print('statement_1', list(p
))
1733 # { pform_bind_attributes($2->attributes, $1);
1737 def p_statement_or_null_1(p
):
1738 '''statement_or_null : statement '''
1739 print('statement_or_null_1', list(p
))
1742 def p_statement_or_null_2(p
):
1743 '''statement_or_null : attribute_list_opt ';' '''
1744 print('statement_or_null_2', list(p
))
1747 def p_stream_expression_1(p
):
1748 '''stream_expression : expression '''
1749 print('stream_expression_1', list(p
))
1751 def p_stream_expression_list_1(p
):
1752 '''stream_expression_list : stream_expression_list ',' stream_expression '''
1753 print('stream_expression_list_1', list(p
))
1755 def p_stream_expression_list_2(p
):
1756 '''stream_expression_list : stream_expression '''
1757 print('stream_expression_list_2', list(p
))
1759 def p_stream_operator_1(p
):
1760 '''stream_operator : K_LS '''
1761 print('stream_operator_1', list(p
))
1763 def p_stream_operator_2(p
):
1764 '''stream_operator : K_RS '''
1765 print('stream_operator_2', list(p
))
1767 def p_streaming_concatenation_1(p
):
1768 '''streaming_concatenation : '{' stream_operator '{' stream_expression_list '}' '}' '''
1769 print('streaming_concatenation_1', list(p
))
1770 # { /* streaming concatenation is a SystemVerilog thing. */
1771 # if (gn_system_verilog()) {
1772 # yyerror(@2, "sorry: Streaming concatenation not supported.");
1775 # yyerror(@2, "error: Streaming concatenation requires SystemVerilog");
1780 def p_task_declaration_1(p
):
1781 '''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 '''
1782 print('task_declaration_1', list(p
))
1783 # { // Last step: check any closing name. This is done late so
1784 # // that the parser can look ahead to detect the present
1785 # // endlabel_opt but still have the pform_endmodule() called
1786 # // early enough that the lexor can know we are outside the
1789 # if (strcmp($3,$10) != 0) {
1790 # yyerror(@10, "error: End label doesn't match task name");
1792 # if (! gn_system_verilog()) {
1793 # yyerror(@10, "error: Task end labels require "
1794 # "SystemVerilog.");
1801 def p_task_declaration_2(p
):
1802 '''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 '''
1803 print('task_declaration_2', list(p
))
1804 # { // Last step: check any closing name. This is done late so
1805 # // that the parser can look ahead to detect the present
1806 # // endlabel_opt but still have the pform_endmodule() called
1807 # // early enough that the lexor can know we are outside the
1810 # if (strcmp($3,$13) != 0) {
1811 # yyerror(@13, "error: End label doesn't match task name");
1813 # if (! gn_system_verilog()) {
1814 # yyerror(@13, "error: Task end labels require "
1815 # "SystemVerilog.");
1822 def p_task_declaration_3(p
):
1823 '''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 '''
1824 print('task_declaration_3', list(p
))
1825 # { // Last step: check any closing name. This is done late so
1826 # // that the parser can look ahead to detect the present
1827 # // endlabel_opt but still have the pform_endmodule() called
1828 # // early enough that the lexor can know we are outside the
1831 # if (strcmp($3,$12) != 0) {
1832 # yyerror(@12, "error: End label doesn't match task name");
1834 # if (! gn_system_verilog()) {
1835 # yyerror(@12, "error: Task end labels require "
1836 # "SystemVerilog.");
1843 def p_task_declaration_4(p
):
1844 '''task_declaration : K_task lifetime_opt IDENTIFIER error K_endtask _embed6_task_declaration endlabel_opt '''
1845 print('task_declaration_4', list(p
))
1846 # { // Last step: check any closing name. This is done late so
1847 # // that the parser can look ahead to detect the present
1848 # // endlabel_opt but still have the pform_endmodule() called
1849 # // early enough that the lexor can know we are outside the
1852 # if (strcmp($3,$7) != 0) {
1853 # yyerror(@7, "error: End label doesn't match task name");
1855 # if (! gn_system_verilog()) {
1856 # yyerror(@7, "error: Task end labels require "
1857 # "SystemVerilog.");
1864 def p__embed0_task_declaration(p
):
1865 '''_embed0_task_declaration : '''
1866 # { assert(current_task == 0);
1867 # current_task = pform_push_task_scope(@1, $3, $2);
1870 def p__embed1_task_declaration(p
):
1871 '''_embed1_task_declaration : '''
1872 # { current_task->set_ports($6);
1873 # current_task_set_statement(@3, $7);
1874 # pform_set_this_class(@3, current_task);
1875 # pform_pop_scope();
1877 # if ($7 && $7->size() > 1 && !gn_system_verilog()) {
1878 # yyerror(@7, "error: Task body with multiple statements requires SystemVerilog.");
1883 def p__embed2_task_declaration(p
):
1884 '''_embed2_task_declaration : '''
1885 # { assert(current_task == 0);
1886 # current_task = pform_push_task_scope(@1, $3, $2);
1889 def p__embed3_task_declaration(p
):
1890 '''_embed3_task_declaration : '''
1891 # { current_task->set_ports($6);
1892 # current_task_set_statement(@3, $10);
1893 # pform_set_this_class(@3, current_task);
1894 # pform_pop_scope();
1896 # if ($10) delete $10;
1899 def p__embed4_task_declaration(p
):
1900 '''_embed4_task_declaration : '''
1901 # { assert(current_task == 0);
1902 # current_task = pform_push_task_scope(@1, $3, $2);
1905 def p__embed5_task_declaration(p
):
1906 '''_embed5_task_declaration : '''
1907 # { current_task->set_ports(0);
1908 # current_task_set_statement(@3, $9);
1909 # pform_set_this_class(@3, current_task);
1910 # if (! current_task->method_of()) {
1911 # cerr << @3 << ": warning: task definition for \"" << $3
1912 # << "\" has an empty port declaration list!" << endl;
1914 # pform_pop_scope();
1916 # if ($9->size() > 1 && !gn_system_verilog()) {
1917 # yyerror(@9, "error: Task body with multiple statements requires SystemVerilog.");
1922 def p__embed6_task_declaration(p
):
1923 '''_embed6_task_declaration : '''
1925 # if (current_task) {
1926 # pform_pop_scope();
1931 def p_tf_port_declaration_1(p
):
1932 '''tf_port_declaration : port_direction K_reg_opt unsigned_signed_opt dimensions_opt list_of_identifiers ';' '''
1933 print('tf_port_declaration_1', list(p
))
1934 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1,
1935 # $2 ? IVL_VT_LOGIC :
1941 def p_tf_port_declaration_2(p
):
1942 '''tf_port_declaration : port_direction K_integer list_of_identifiers ';' '''
1943 print('tf_port_declaration_2', list(p
))
1944 # { list<pform_range_t>*range_stub = make_range_from_width(integer_width);
1945 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_LOGIC, true,
1946 # range_stub, $3, true);
1950 def p_tf_port_declaration_3(p
):
1951 '''tf_port_declaration : port_direction K_time list_of_identifiers ';' '''
1952 print('tf_port_declaration_3', list(p
))
1953 # { list<pform_range_t>*range_stub = make_range_from_width(64);
1954 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_LOGIC, false,
1959 def p_tf_port_declaration_4(p
):
1960 '''tf_port_declaration : port_direction real_or_realtime list_of_identifiers ';' '''
1961 print('tf_port_declaration_4', list(p
))
1962 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_REAL, true,
1967 def p_tf_port_declaration_5(p
):
1968 '''tf_port_declaration : port_direction K_string list_of_identifiers ';' '''
1969 print('tf_port_declaration_5', list(p
))
1970 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_STRING, true,
1975 def p_tf_port_item_1(p
):
1976 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER dimensions_opt tf_port_item_expr_opt '''
1977 print('tf_port_item_1', list(p
))
1978 # { vector<pform_tf_port_t>*tmp;
1979 # NetNet::PortType use_port_type = $1;
1980 # if ((use_port_type == NetNet::PIMPLICIT) && (gn_system_verilog() || ($2 == 0)))
1981 # use_port_type = port_declaration_context.port_type;
1982 # perm_string name = lex_strings.make($3);
1983 # list<perm_string>* ilist = list_from_identifier($3);
1985 # if (use_port_type == NetNet::PIMPLICIT) {
1986 # yyerror(@1, "error: missing task/function port direction.");
1987 # use_port_type = NetNet::PINPUT; // for error recovery
1989 # if (($2 == 0) && ($1==NetNet::PIMPLICIT)) {
1990 # // Detect special case this is an undecorated
1991 # // identifier and we need to get the declaration from
1994 # yyerror(@4, "internal error: How can there be an unpacked range here?\n");
1996 # tmp = pform_make_task_ports(@3, use_port_type,
1997 # port_declaration_context.data_type,
2001 # // Otherwise, the decorations for this identifier
2002 # // indicate the type. Save the type for any right
2003 # // context that may come later.
2004 # port_declaration_context.port_type = use_port_type;
2006 # $2 = new vector_type_t(IVL_VT_LOGIC, false, 0);
2007 # FILE_NAME($2, @3);
2009 # port_declaration_context.data_type = $2;
2010 # tmp = pform_make_task_ports(@3, use_port_type, $2, ilist);
2013 # pform_set_reg_idx(name, $4);
2018 # assert(tmp->size()==1);
2019 # tmp->front().defe = $5;
2023 def p_tf_port_item_2(p
):
2024 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER error '''
2025 print('tf_port_item_2', list(p
))
2026 # { yyerror(@3, "error: Error in task/function port item after port name %s.", $3);
2031 def p_tf_port_item_expr_opt_1(p
):
2032 '''tf_port_item_expr_opt : '=' expression '''
2033 print('tf_port_item_expr_opt_1', list(p
))
2034 # { if (! gn_system_verilog()) {
2035 # yyerror(@1, "error: Task/function default arguments require "
2036 # "SystemVerilog.");
2041 def p_tf_port_item_expr_opt_2(p
):
2042 '''tf_port_item_expr_opt : '''
2043 print('tf_port_item_expr_opt_2', list(p
))
2046 def p_tf_port_list_1(p
):
2047 '''tf_port_list : _embed0_tf_port_list tf_port_item_list '''
2048 print('tf_port_list_1', list(p
))
2051 def p__embed0_tf_port_list(p
):
2052 '''_embed0_tf_port_list : '''
2053 # { port_declaration_context.port_type = gn_system_verilog() ? NetNet::PINPUT : NetNet::PIMPLICIT;
2054 # port_declaration_context.data_type = 0;
2057 def p_tf_port_item_list_1(p
):
2058 '''tf_port_item_list : tf_port_item_list ',' tf_port_item '''
2059 print('tf_port_item_list_1', list(p
))
2060 # { vector<pform_tf_port_t>*tmp;
2062 # size_t s1 = $1->size();
2064 # tmp->resize(tmp->size()+$3->size());
2065 # for (size_t idx = 0 ; idx < $3->size() ; idx += 1)
2066 # tmp->at(s1+idx) = $3->at(idx);
2076 def p_tf_port_item_list_2(p
):
2077 '''tf_port_item_list : tf_port_item '''
2078 print('tf_port_item_list_2', list(p
))
2081 def p_tf_port_item_list_3(p
):
2082 '''tf_port_item_list : error ',' tf_port_item '''
2083 print('tf_port_item_list_3', list(p
))
2084 # { yyerror(@2, "error: Syntax error in task/function port declaration.");
2088 def p_tf_port_item_list_4(p
):
2089 '''tf_port_item_list : tf_port_item_list ',' '''
2090 print('tf_port_item_list_4', list(p
))
2091 # { yyerror(@2, "error: NULL port declarations are not allowed.");
2095 def p_tf_port_item_list_5(p
):
2096 '''tf_port_item_list : tf_port_item_list ';' '''
2097 print('tf_port_item_list_5', list(p
))
2098 # { yyerror(@2, "error: ';' is an invalid port declaration separator.");
2102 def p_timeunits_declaration_1(p
):
2103 '''timeunits_declaration : K_timeunit TIME_LITERAL ';' '''
2104 print('timeunits_declaration_1', list(p
))
2105 # { pform_set_timeunit($2, allow_timeunit_decl); }
2107 def p_timeunits_declaration_2(p
):
2108 '''timeunits_declaration : K_timeunit TIME_LITERAL '/' TIME_LITERAL ';' '''
2109 print('timeunits_declaration_2', list(p
))
2110 # { bool initial_decl = allow_timeunit_decl && allow_timeprec_decl;
2111 # pform_set_timeunit($2, initial_decl);
2112 # pform_set_timeprec($4, initial_decl);
2115 def p_timeunits_declaration_3(p
):
2116 '''timeunits_declaration : K_timeprecision TIME_LITERAL ';' '''
2117 print('timeunits_declaration_3', list(p
))
2118 # { pform_set_timeprec($2, allow_timeprec_decl); }
2120 def p_timeunits_declaration_opt_1(p
):
2121 '''timeunits_declaration_opt : %prec no_timeunits_declaration '''
2122 print('timeunits_declaration_opt_1', list(p
))
2124 def p_timeunits_declaration_opt_2(p
):
2125 '''timeunits_declaration_opt : timeunits_declaration %prec one_timeunits_declaration '''
2126 print('timeunits_declaration_opt_2', list(p
))
2128 def p_timeunits_declaration_opt_3(p
):
2129 '''timeunits_declaration_opt : timeunits_declaration timeunits_declaration '''
2130 print('timeunits_declaration_opt_3', list(p
))
2132 def p_value_range_1(p
):
2133 '''value_range : expression '''
2134 print('value_range_1', list(p
))
2137 def p_value_range_2(p
):
2138 '''value_range : '[' expression ':' expression ']' '''
2139 print('value_range_2', list(p
))
2142 def p_variable_dimension_1(p
):
2143 '''variable_dimension : '[' expression ':' expression ']' '''
2144 print('variable_dimension_1', list(p
))
2145 # { list<pform_range_t> *tmp = new list<pform_range_t>;
2146 # pform_range_t index ($2,$4);
2147 # tmp->push_back(index);
2151 def p_variable_dimension_2(p
):
2152 '''variable_dimension : '[' expression ']' '''
2153 print('variable_dimension_2', list(p
))
2154 # { // SystemVerilog canonical range
2155 # if (!gn_system_verilog()) {
2157 # cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. "
2158 # << "Use at least -g2005-sv to remove this warning." << endl;
2160 # list<pform_range_t> *tmp = new list<pform_range_t>;
2161 # pform_range_t index;
2162 # index.first = new PENumber(new verinum((uint64_t)0, integer_width));
2163 # index.second = new PEBinary('-', $2, new PENumber(new verinum((uint64_t)1, integer_width)));
2164 # tmp->push_back(index);
2168 def p_variable_dimension_3(p
):
2169 '''variable_dimension : '[' ']' '''
2170 print('variable_dimension_3', list(p
))
2171 # { list<pform_range_t> *tmp = new list<pform_range_t>;
2172 # pform_range_t index (0,0);
2173 # tmp->push_back(index);
2177 def p_variable_dimension_4(p
):
2178 '''variable_dimension : '[' '$' ']' '''
2179 print('variable_dimension_4', list(p
))
2180 # { // SystemVerilog queue
2181 # list<pform_range_t> *tmp = new list<pform_range_t>;
2182 # pform_range_t index (new PENull,0);
2183 # if (!gn_system_verilog()) {
2184 # yyerror("error: Queue declarations require SystemVerilog.");
2186 # tmp->push_back(index);
2190 def p_variable_lifetime_1(p
):
2191 '''variable_lifetime : lifetime '''
2192 print('variable_lifetime_1', list(p
))
2193 # { if (!gn_system_verilog()) {
2194 # yyerror(@1, "error: overriding the default variable lifetime "
2195 # "requires SystemVerilog.");
2196 # } else if ($1 != pform_peek_scope()->default_lifetime) {
2197 # yyerror(@1, "sorry: overriding the default variable lifetime "
2198 # "is not yet supported.");
2200 # var_lifetime = $1;
2203 def p_attribute_list_opt_1(p
):
2204 '''attribute_list_opt : attribute_instance_list '''
2205 print('attribute_list_opt_1', list(p
))
2208 def p_attribute_list_opt_2(p
):
2209 '''attribute_list_opt : '''
2210 print('attribute_list_opt_2', list(p
))
2213 def p_attribute_instance_list_1(p
):
2214 '''attribute_instance_list : K_PSTAR K_STARP '''
2215 print('attribute_instance_list_1', list(p
))
2218 def p_attribute_instance_list_2(p
):
2219 '''attribute_instance_list : K_PSTAR attribute_list K_STARP '''
2220 print('attribute_instance_list_2', list(p
))
2223 def p_attribute_instance_list_3(p
):
2224 '''attribute_instance_list : attribute_instance_list K_PSTAR K_STARP '''
2225 print('attribute_instance_list_3', list(p
))
2228 def p_attribute_instance_list_4(p
):
2229 '''attribute_instance_list : attribute_instance_list K_PSTAR attribute_list K_STARP '''
2230 print('attribute_instance_list_4', list(p
))
2231 # { list<named_pexpr_t>*tmp = $1;
2233 # tmp->splice(tmp->end(), *$3);
2239 def p_attribute_list_1(p
):
2240 '''attribute_list : attribute_list ',' attribute '''
2241 print('attribute_list_1', list(p
))
2242 # { list<named_pexpr_t>*tmp = $1;
2243 # tmp->push_back(*$3);
2248 def p_attribute_list_2(p
):
2249 '''attribute_list : attribute '''
2250 print('attribute_list_2', list(p
))
2251 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
2252 # tmp->push_back(*$1);
2257 def p_attribute_1(p
):
2258 '''attribute : IDENTIFIER '''
2259 print('attribute_1', list(p
))
2260 # { named_pexpr_t*tmp = new named_pexpr_t;
2261 # tmp->name = lex_strings.make($1);
2267 def p_attribute_2(p
):
2268 '''attribute : IDENTIFIER '=' expression '''
2269 print('attribute_2', list(p
))
2271 # named_pexpr_t*tmp2 = new named_pexpr_t;
2272 # tmp2->name = lex_strings.make($1);
2278 def p_block_item_decl_1(p
):
2279 '''block_item_decl : data_type register_variable_list ';' '''
2280 print('block_item_decl_1', list(p
))
2281 # { if ($1) pform_set_data_type(@1, $1, $2, NetNet::REG, attributes_in_context);
2284 def p_block_item_decl_2(p
):
2285 '''block_item_decl : variable_lifetime data_type register_variable_list ';' '''
2286 print('block_item_decl_2', list(p
))
2287 # { if ($2) pform_set_data_type(@2, $2, $3, NetNet::REG, attributes_in_context);
2288 # var_lifetime = LexicalScope::INHERITED;
2291 def p_block_item_decl_3(p
):
2292 '''block_item_decl : K_reg data_type register_variable_list ';' '''
2293 print('block_item_decl_3', list(p
))
2294 # { if ($2) pform_set_data_type(@2, $2, $3, NetNet::REG, attributes_in_context);
2297 def p_block_item_decl_4(p
):
2298 '''block_item_decl : variable_lifetime K_reg data_type register_variable_list ';' '''
2299 print('block_item_decl_4', list(p
))
2300 # { if ($3) pform_set_data_type(@3, $3, $4, NetNet::REG, attributes_in_context);
2301 # var_lifetime = LexicalScope::INHERITED;
2304 def p_block_item_decl_5(p
):
2305 '''block_item_decl : K_event event_variable_list ';' '''
2306 print('block_item_decl_5', list(p
))
2307 # { if ($2) pform_make_events($2, @1.text, @1.first_line);
2310 def p_block_item_decl_6(p
):
2311 '''block_item_decl : K_parameter param_type parameter_assign_list ';' '''
2312 print('block_item_decl_6', list(p
))
2314 def p_block_item_decl_7(p
):
2315 '''block_item_decl : K_localparam param_type localparam_assign_list ';' '''
2316 print('block_item_decl_7', list(p
))
2318 def p_block_item_decl_8(p
):
2319 '''block_item_decl : type_declaration '''
2320 print('block_item_decl_8', list(p
))
2322 def p_block_item_decl_9(p
):
2323 '''block_item_decl : K_integer error ';' '''
2324 print('block_item_decl_9', list(p
))
2325 # { yyerror(@1, "error: syntax error in integer variable list.");
2329 def p_block_item_decl_10(p
):
2330 '''block_item_decl : K_time error ';' '''
2331 print('block_item_decl_10', list(p
))
2332 # { yyerror(@1, "error: syntax error in time variable list.");
2336 def p_block_item_decl_11(p
):
2337 '''block_item_decl : K_parameter error ';' '''
2338 print('block_item_decl_11', list(p
))
2339 # { yyerror(@1, "error: syntax error in parameter list.");
2343 def p_block_item_decl_12(p
):
2344 '''block_item_decl : K_localparam error ';' '''
2345 print('block_item_decl_12', list(p
))
2346 # { yyerror(@1, "error: syntax error localparam list.");
2350 def p_block_item_decls_1(p
):
2351 '''block_item_decls : block_item_decl '''
2352 print('block_item_decls_1', list(p
))
2354 def p_block_item_decls_2(p
):
2355 '''block_item_decls : block_item_decls block_item_decl '''
2356 print('block_item_decls_2', list(p
))
2358 def p_block_item_decls_opt_1(p
):
2359 '''block_item_decls_opt : block_item_decls '''
2360 print('block_item_decls_opt_1', list(p
))
2363 def p_block_item_decls_opt_2(p
):
2364 '''block_item_decls_opt : '''
2365 print('block_item_decls_opt_2', list(p
))
2368 def p_type_declaration_1(p
):
2369 '''type_declaration : K_typedef data_type IDENTIFIER dimensions_opt ';' '''
2370 print('type_declaration_1', list(p
))
2371 # { perm_string name = lex_strings.make($3);
2372 # pform_set_typedef(name, $2, $4);
2376 def p_type_declaration_2(p
):
2377 '''type_declaration : K_typedef data_type TYPE_IDENTIFIER ';' '''
2378 print('type_declaration_2', list(p
))
2379 # { perm_string name = lex_strings.make($3.text);
2380 # if (pform_test_type_identifier_local(name)) {
2381 # yyerror(@3, "error: Typedef identifier \"%s\" is already a type name.", $3.text);
2384 # pform_set_typedef(name, $2, NULL);
2389 def p_type_declaration_3(p
):
2390 '''type_declaration : K_typedef K_class IDENTIFIER ';' '''
2391 print('type_declaration_3', list(p
))
2392 # { // Create a synthetic typedef for the class name so that the
2393 # // lexor detects the name as a type.
2394 # perm_string name = lex_strings.make($3);
2395 # class_type_t*tmp = new class_type_t(name);
2396 # FILE_NAME(tmp, @3);
2397 # pform_set_typedef(name, tmp, NULL);
2401 def p_type_declaration_4(p
):
2402 '''type_declaration : K_typedef K_enum IDENTIFIER ';' '''
2403 print('type_declaration_4', list(p
))
2404 # { yyerror(@1, "sorry: Enum forward declarations not supported yet."); }
2406 def p_type_declaration_5(p
):
2407 '''type_declaration : K_typedef K_struct IDENTIFIER ';' '''
2408 print('type_declaration_5', list(p
))
2409 # { yyerror(@1, "sorry: Struct forward declarations not supported yet."); }
2411 def p_type_declaration_6(p
):
2412 '''type_declaration : K_typedef K_union IDENTIFIER ';' '''
2413 print('type_declaration_6', list(p
))
2414 # { yyerror(@1, "sorry: Union forward declarations not supported yet."); }
2416 def p_type_declaration_7(p
):
2417 '''type_declaration : K_typedef IDENTIFIER ';' '''
2418 print('type_declaration_7', list(p
))
2419 # { // Create a synthetic typedef for the class name so that the
2420 # // lexor detects the name as a type.
2421 # perm_string name = lex_strings.make($2);
2422 # class_type_t*tmp = new class_type_t(name);
2423 # FILE_NAME(tmp, @2);
2424 # pform_set_typedef(name, tmp, NULL);
2428 def p_type_declaration_8(p
):
2429 '''type_declaration : K_typedef error ';' '''
2430 print('type_declaration_8', list(p
))
2431 # { yyerror(@2, "error: Syntax error in typedef clause.");
2435 def p_enum_data_type_1(p
):
2436 '''enum_data_type : K_enum '{' enum_name_list '}' '''
2437 print('enum_data_type_1', list(p
))
2438 # { enum_type_t*enum_type = new enum_type_t;
2439 # FILE_NAME(enum_type, @1);
2440 # enum_type->names .reset($3);
2441 # enum_type->base_type = IVL_VT_BOOL;
2442 # enum_type->signed_flag = true;
2443 # enum_type->integer_flag = false;
2444 # enum_type->range.reset(make_range_from_width(32));
2448 def p_enum_data_type_2(p
):
2449 '''enum_data_type : K_enum atom2_type signed_unsigned_opt '{' enum_name_list '}' '''
2450 print('enum_data_type_2', list(p
))
2451 # { enum_type_t*enum_type = new enum_type_t;
2452 # FILE_NAME(enum_type, @1);
2453 # enum_type->names .reset($5);
2454 # enum_type->base_type = IVL_VT_BOOL;
2455 # enum_type->signed_flag = $3;
2456 # enum_type->integer_flag = false;
2457 # enum_type->range.reset(make_range_from_width($2));
2461 def p_enum_data_type_3(p
):
2462 '''enum_data_type : K_enum K_integer signed_unsigned_opt '{' enum_name_list '}' '''
2463 print('enum_data_type_3', list(p
))
2464 # { enum_type_t*enum_type = new enum_type_t;
2465 # FILE_NAME(enum_type, @1);
2466 # enum_type->names .reset($5);
2467 # enum_type->base_type = IVL_VT_LOGIC;
2468 # enum_type->signed_flag = $3;
2469 # enum_type->integer_flag = true;
2470 # enum_type->range.reset(make_range_from_width(integer_width));
2474 def p_enum_data_type_4(p
):
2475 '''enum_data_type : K_enum K_logic unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2476 print('enum_data_type_4', list(p
))
2477 # { enum_type_t*enum_type = new enum_type_t;
2478 # FILE_NAME(enum_type, @1);
2479 # enum_type->names .reset($6);
2480 # enum_type->base_type = IVL_VT_LOGIC;
2481 # enum_type->signed_flag = $3;
2482 # enum_type->integer_flag = false;
2483 # enum_type->range.reset($4 ? $4 : make_range_from_width(1));
2487 def p_enum_data_type_5(p
):
2488 '''enum_data_type : K_enum K_reg unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2489 print('enum_data_type_5', list(p
))
2490 # { enum_type_t*enum_type = new enum_type_t;
2491 # FILE_NAME(enum_type, @1);
2492 # enum_type->names .reset($6);
2493 # enum_type->base_type = IVL_VT_LOGIC;
2494 # enum_type->signed_flag = $3;
2495 # enum_type->integer_flag = false;
2496 # enum_type->range.reset($4 ? $4 : make_range_from_width(1));
2500 def p_enum_data_type_6(p
):
2501 '''enum_data_type : K_enum K_bit unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2502 print('enum_data_type_6', list(p
))
2503 # { enum_type_t*enum_type = new enum_type_t;
2504 # FILE_NAME(enum_type, @1);
2505 # enum_type->names .reset($6);
2506 # enum_type->base_type = IVL_VT_BOOL;
2507 # enum_type->signed_flag = $3;
2508 # enum_type->integer_flag = false;
2509 # enum_type->range.reset($4 ? $4 : make_range_from_width(1));
2513 def p_enum_name_list_1(p
):
2514 '''enum_name_list : enum_name '''
2515 print('enum_name_list_1', list(p
))
2519 def p_enum_name_list_2(p
):
2520 '''enum_name_list : enum_name_list ',' enum_name '''
2521 print('enum_name_list_2', list(p
))
2522 # { list<named_pexpr_t>*lst = $1;
2523 # lst->splice(lst->end(), *$3);
2528 def p_pos_neg_number_1(p
):
2529 '''pos_neg_number : number '''
2530 print('pos_neg_number_1', list(p
))
2534 def p_pos_neg_number_2(p
):
2535 '''pos_neg_number : '-' number '''
2536 print('pos_neg_number_2', list(p
))
2537 # { verinum tmp = -(*($2));
2542 def p_enum_name_1(p
):
2543 '''enum_name : IDENTIFIER '''
2544 print('enum_name_1', list(p
))
2545 # { perm_string name = lex_strings.make($1);
2547 # $$ = make_named_number(name);
2550 def p_enum_name_2(p
):
2551 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '''
2552 print('enum_name_2', list(p
))
2553 # { perm_string name = lex_strings.make($1);
2554 # long count = check_enum_seq_value(@1, $3, false);
2556 # $$ = make_named_numbers(name, 0, count-1);
2560 def p_enum_name_3(p
):
2561 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '''
2562 print('enum_name_3', list(p
))
2563 # { perm_string name = lex_strings.make($1);
2564 # $$ = make_named_numbers(name, check_enum_seq_value(@1, $3, true),
2565 # check_enum_seq_value(@1, $5, true));
2571 def p_enum_name_4(p
):
2572 '''enum_name : IDENTIFIER '=' expression '''
2573 print('enum_name_4', list(p
))
2574 # { perm_string name = lex_strings.make($1);
2576 # $$ = make_named_number(name, $3);
2579 def p_enum_name_5(p
):
2580 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '=' expression '''
2581 print('enum_name_5', list(p
))
2582 # { perm_string name = lex_strings.make($1);
2583 # long count = check_enum_seq_value(@1, $3, false);
2584 # $$ = make_named_numbers(name, 0, count-1, $6);
2589 def p_enum_name_6(p
):
2590 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '=' expression '''
2591 print('enum_name_6', list(p
))
2592 # { perm_string name = lex_strings.make($1);
2593 # $$ = make_named_numbers(name, check_enum_seq_value(@1, $3, true),
2594 # check_enum_seq_value(@1, $5, true), $8);
2600 def p_struct_data_type_1(p
):
2601 '''struct_data_type : K_struct K_packed_opt '{' struct_union_member_list '}' '''
2602 print('struct_data_type_1', list(p
))
2603 # { struct_type_t*tmp = new struct_type_t;
2604 # FILE_NAME(tmp, @1);
2605 # tmp->packed_flag = $2;
2606 # tmp->union_flag = false;
2607 # tmp->members .reset($4);
2611 def p_struct_data_type_2(p
):
2612 '''struct_data_type : K_union K_packed_opt '{' struct_union_member_list '}' '''
2613 print('struct_data_type_2', list(p
))
2614 # { struct_type_t*tmp = new struct_type_t;
2615 # FILE_NAME(tmp, @1);
2616 # tmp->packed_flag = $2;
2617 # tmp->union_flag = true;
2618 # tmp->members .reset($4);
2622 def p_struct_data_type_3(p
):
2623 '''struct_data_type : K_struct K_packed_opt '{' error '}' '''
2624 print('struct_data_type_3', list(p
))
2625 # { yyerror(@3, "error: Errors in struct member list.");
2627 # struct_type_t*tmp = new struct_type_t;
2628 # FILE_NAME(tmp, @1);
2629 # tmp->packed_flag = $2;
2630 # tmp->union_flag = false;
2634 def p_struct_data_type_4(p
):
2635 '''struct_data_type : K_union K_packed_opt '{' error '}' '''
2636 print('struct_data_type_4', list(p
))
2637 # { yyerror(@3, "error: Errors in union member list.");
2639 # struct_type_t*tmp = new struct_type_t;
2640 # FILE_NAME(tmp, @1);
2641 # tmp->packed_flag = $2;
2642 # tmp->union_flag = true;
2646 def p_struct_union_member_list_1(p
):
2647 '''struct_union_member_list : struct_union_member_list struct_union_member '''
2648 print('struct_union_member_list_1', list(p
))
2649 # { list<struct_member_t*>*tmp = $1;
2650 # tmp->push_back($2);
2654 def p_struct_union_member_list_2(p
):
2655 '''struct_union_member_list : struct_union_member '''
2656 print('struct_union_member_list_2', list(p
))
2657 # { list<struct_member_t*>*tmp = new list<struct_member_t*>;
2658 # tmp->push_back($1);
2662 def p_struct_union_member_1(p
):
2663 '''struct_union_member : attribute_list_opt data_type list_of_variable_decl_assignments ';' '''
2664 print('struct_union_member_1', list(p
))
2665 # { struct_member_t*tmp = new struct_member_t;
2666 # FILE_NAME(tmp, @2);
2667 # tmp->type .reset($2);
2668 # tmp->names .reset($3);
2672 def p_struct_union_member_2(p
):
2673 '''struct_union_member : error ';' '''
2674 print('struct_union_member_2', list(p
))
2675 # { yyerror(@2, "Error in struct/union member.");
2680 def p_case_item_1(p
):
2681 '''case_item : expression_list_proper ':' statement_or_null '''
2682 print('case_item_1', list(p
))
2683 # { PCase::Item*tmp = new PCase::Item;
2690 def p_case_item_2(p
):
2691 '''case_item : K_default ':' statement_or_null '''
2692 print('case_item_2', list(p
))
2693 # { PCase::Item*tmp = new PCase::Item;
2698 def p_case_item_3(p
):
2699 '''case_item : K_default statement_or_null '''
2700 print('case_item_3', list(p
))
2701 # { PCase::Item*tmp = new PCase::Item;
2706 def p_case_item_4(p
):
2707 '''case_item : error ':' statement_or_null '''
2708 print('case_item_4', list(p
))
2709 # { yyerror(@2, "error: Incomprehensible case expression.");
2713 def p_case_items_1(p
):
2714 '''case_items : case_items case_item '''
2715 print('case_items_1', list(p
))
2716 # { svector<PCase::Item*>*tmp;
2717 # tmp = new svector<PCase::Item*>(*$1, $2);
2722 def p_case_items_2(p
):
2723 '''case_items : case_item '''
2724 print('case_items_2', list(p
))
2725 # { svector<PCase::Item*>*tmp = new svector<PCase::Item*>(1);
2730 def p_charge_strength_1(p
):
2731 '''charge_strength : '(' K_small ')' '''
2732 print('charge_strength_1', list(p
))
2734 def p_charge_strength_2(p
):
2735 '''charge_strength : '(' K_medium ')' '''
2736 print('charge_strength_2', list(p
))
2738 def p_charge_strength_3(p
):
2739 '''charge_strength : '(' K_large ')' '''
2740 print('charge_strength_3', list(p
))
2742 def p_charge_strength_opt_1(p
):
2743 '''charge_strength_opt : charge_strength '''
2744 print('charge_strength_opt_1', list(p
))
2746 def p_charge_strength_opt_2(p
):
2747 '''charge_strength_opt : '''
2748 print('charge_strength_opt_2', list(p
))
2750 def p_defparam_assign_1(p
):
2751 '''defparam_assign : hierarchy_identifier '=' expression '''
2752 print('defparam_assign_1', list(p
))
2753 # { pform_set_defparam(*$1, $3);
2757 def p_defparam_assign_list_1(p
):
2758 '''defparam_assign_list : defparam_assign '''
2759 print('defparam_assign_list_1', list(p
))
2761 def p_defparam_assign_list_2(p
):
2762 '''defparam_assign_list : dimensions defparam_assign '''
2763 print('defparam_assign_list_2', list(p
))
2764 # { yyerror(@1, "error: defparam may not include a range.");
2768 def p_defparam_assign_list_3(p
):
2769 '''defparam_assign_list : defparam_assign_list ',' defparam_assign '''
2770 print('defparam_assign_list_3', list(p
))
2773 '''delay1 : '#' delay_value_simple '''
2774 print('delay1_1', list(p
))
2775 # { list<PExpr*>*tmp = new list<PExpr*>;
2776 # tmp->push_back($2);
2781 '''delay1 : '#' '(' delay_value ')' '''
2782 print('delay1_2', list(p
))
2783 # { list<PExpr*>*tmp = new list<PExpr*>;
2784 # tmp->push_back($3);
2789 '''delay3 : '#' delay_value_simple '''
2790 print('delay3_1', list(p
))
2791 # { list<PExpr*>*tmp = new list<PExpr*>;
2792 # tmp->push_back($2);
2797 '''delay3 : '#' '(' delay_value ')' '''
2798 print('delay3_2', list(p
))
2799 # { list<PExpr*>*tmp = new list<PExpr*>;
2800 # tmp->push_back($3);
2805 '''delay3 : '#' '(' delay_value ',' delay_value ')' '''
2806 print('delay3_3', list(p
))
2807 # { list<PExpr*>*tmp = new list<PExpr*>;
2808 # tmp->push_back($3);
2809 # tmp->push_back($5);
2814 '''delay3 : '#' '(' delay_value ',' delay_value ',' delay_value ')' '''
2815 print('delay3_4', list(p
))
2816 # { list<PExpr*>*tmp = new list<PExpr*>;
2817 # tmp->push_back($3);
2818 # tmp->push_back($5);
2819 # tmp->push_back($7);
2823 def p_delay3_opt_1(p
):
2824 '''delay3_opt : delay3 '''
2825 print('delay3_opt_1', list(p
))
2828 def p_delay3_opt_2(p
):
2830 print('delay3_opt_2', list(p
))
2833 def p_delay_value_list_1(p
):
2834 '''delay_value_list : delay_value '''
2835 print('delay_value_list_1', list(p
))
2836 # { list<PExpr*>*tmp = new list<PExpr*>;
2837 # tmp->push_back($1);
2841 def p_delay_value_list_2(p
):
2842 '''delay_value_list : delay_value_list ',' delay_value '''
2843 print('delay_value_list_2', list(p
))
2844 # { list<PExpr*>*tmp = $1;
2845 # tmp->push_back($3);
2849 def p_delay_value_1(p
):
2850 '''delay_value : expression '''
2851 print('delay_value_1', list(p
))
2856 def p_delay_value_2(p
):
2857 '''delay_value : expression ':' expression ':' expression '''
2858 print('delay_value_2', list(p
))
2859 # { $$ = pform_select_mtm_expr($1, $3, $5); }
2861 def p_delay_value_simple_1(p
):
2862 '''delay_value_simple : DEC_NUMBER '''
2863 print('delay_value_simple_1', list(p
))
2864 # { verinum*tmp = $1;
2866 # yyerror(@1, "internal error: delay.");
2869 # $$ = new PENumber(tmp);
2870 # FILE_NAME($$, @1);
2875 def p_delay_value_simple_2(p
):
2876 '''delay_value_simple : REALTIME '''
2877 print('delay_value_simple_2', list(p
))
2878 # { verireal*tmp = $1;
2880 # yyerror(@1, "internal error: delay.");
2883 # $$ = new PEFNumber(tmp);
2884 # FILE_NAME($$, @1);
2888 def p_delay_value_simple_3(p
):
2889 '''delay_value_simple : IDENTIFIER '''
2890 print('delay_value_simple_3', list(p
))
2891 # { PEIdent*tmp = new PEIdent(lex_strings.make($1));
2892 # FILE_NAME(tmp, @1);
2897 def p_delay_value_simple_4(p
):
2898 '''delay_value_simple : TIME_LITERAL '''
2899 print('delay_value_simple_4', list(p
))
2904 # if ($1 == 0 || !get_time_unit($1, unit))
2905 # yyerror(@1, "internal error: delay.");
2907 # double p = pow(10.0,
2908 # (double)(unit - pform_get_timeunit()));
2909 # double time = atof($1) * p;
2911 # verireal *v = new verireal(time);
2912 # $$ = new PEFNumber(v);
2913 # FILE_NAME($$, @1);
2917 def p_optional_semicolon_1(p
):
2918 '''optional_semicolon : ';' '''
2919 print('optional_semicolon_1', list(p
))
2921 def p_optional_semicolon_2(p
):
2922 '''optional_semicolon : '''
2923 print('optional_semicolon_2', list(p
))
2925 def p_discipline_declaration_1(p
):
2926 '''discipline_declaration : K_discipline IDENTIFIER optional_semicolon _embed0_discipline_declaration discipline_items K_enddiscipline '''
2927 print('discipline_declaration_1', list(p
))
2928 # { pform_end_discipline(@1); delete[] $2; }
2930 def p__embed0_discipline_declaration(p
):
2931 '''_embed0_discipline_declaration : '''
2932 # { pform_start_discipline($2); }
2934 def p_discipline_items_1(p
):
2935 '''discipline_items : discipline_items discipline_item '''
2936 print('discipline_items_1', list(p
))
2938 def p_discipline_items_2(p
):
2939 '''discipline_items : discipline_item '''
2940 print('discipline_items_2', list(p
))
2942 def p_discipline_item_1(p
):
2943 '''discipline_item : K_domain K_discrete ';' '''
2944 print('discipline_item_1', list(p
))
2945 # { pform_discipline_domain(@1, IVL_DIS_DISCRETE); }
2947 def p_discipline_item_2(p
):
2948 '''discipline_item : K_domain K_continuous ';' '''
2949 print('discipline_item_2', list(p
))
2950 # { pform_discipline_domain(@1, IVL_DIS_CONTINUOUS); }
2952 def p_discipline_item_3(p
):
2953 '''discipline_item : K_potential IDENTIFIER ';' '''
2954 print('discipline_item_3', list(p
))
2955 # { pform_discipline_potential(@1, $2); delete[] $2; }
2957 def p_discipline_item_4(p
):
2958 '''discipline_item : K_flow IDENTIFIER ';' '''
2959 print('discipline_item_4', list(p
))
2960 # { pform_discipline_flow(@1, $2); delete[] $2; }
2962 def p_nature_declaration_1(p
):
2963 '''nature_declaration : K_nature IDENTIFIER optional_semicolon _embed0_nature_declaration nature_items K_endnature '''
2964 print('nature_declaration_1', list(p
))
2965 # { pform_end_nature(@1); delete[] $2; }
2967 def p__embed0_nature_declaration(p
):
2968 '''_embed0_nature_declaration : '''
2969 # { pform_start_nature($2); }
2971 def p_nature_items_1(p
):
2972 '''nature_items : nature_items nature_item '''
2973 print('nature_items_1', list(p
))
2975 def p_nature_items_2(p
):
2976 '''nature_items : nature_item '''
2977 print('nature_items_2', list(p
))
2979 def p_nature_item_1(p
):
2980 '''nature_item : K_units '=' STRING ';' '''
2981 print('nature_item_1', list(p
))
2984 def p_nature_item_2(p
):
2985 '''nature_item : K_abstol '=' expression ';' '''
2986 print('nature_item_2', list(p
))
2988 def p_nature_item_3(p
):
2989 '''nature_item : K_access '=' IDENTIFIER ';' '''
2990 print('nature_item_3', list(p
))
2991 # { pform_nature_access(@1, $3); delete[] $3; }
2993 def p_nature_item_4(p
):
2994 '''nature_item : K_idt_nature '=' IDENTIFIER ';' '''
2995 print('nature_item_4', list(p
))
2998 def p_nature_item_5(p
):
2999 '''nature_item : K_ddt_nature '=' IDENTIFIER ';' '''
3000 print('nature_item_5', list(p
))
3003 def p_config_declaration_1(p
):
3004 '''config_declaration : K_config IDENTIFIER ';' K_design lib_cell_identifiers ';' list_of_config_rule_statements K_endconfig '''
3005 print('config_declaration_1', list(p
))
3006 # { cerr << @1 << ": sorry: config declarations are not supported and "
3007 # "will be skipped." << endl;
3011 def p_lib_cell_identifiers_1(p
):
3012 '''lib_cell_identifiers : '''
3013 print('lib_cell_identifiers_1', list(p
))
3015 def p_lib_cell_identifiers_2(p
):
3016 '''lib_cell_identifiers : lib_cell_identifiers lib_cell_id '''
3017 print('lib_cell_identifiers_2', list(p
))
3019 def p_list_of_config_rule_statements_1(p
):
3020 '''list_of_config_rule_statements : '''
3021 print('list_of_config_rule_statements_1', list(p
))
3023 def p_list_of_config_rule_statements_2(p
):
3024 '''list_of_config_rule_statements : list_of_config_rule_statements config_rule_statement '''
3025 print('list_of_config_rule_statements_2', list(p
))
3027 def p_config_rule_statement_1(p
):
3028 '''config_rule_statement : K_default K_liblist list_of_libraries ';' '''
3029 print('config_rule_statement_1', list(p
))
3031 def p_config_rule_statement_2(p
):
3032 '''config_rule_statement : K_instance hierarchy_identifier K_liblist list_of_libraries ';' '''
3033 print('config_rule_statement_2', list(p
))
3036 def p_config_rule_statement_3(p
):
3037 '''config_rule_statement : K_instance hierarchy_identifier K_use lib_cell_id opt_config ';' '''
3038 print('config_rule_statement_3', list(p
))
3041 def p_config_rule_statement_4(p
):
3042 '''config_rule_statement : K_cell lib_cell_id K_liblist list_of_libraries ';' '''
3043 print('config_rule_statement_4', list(p
))
3045 def p_config_rule_statement_5(p
):
3046 '''config_rule_statement : K_cell lib_cell_id K_use lib_cell_id opt_config ';' '''
3047 print('config_rule_statement_5', list(p
))
3049 def p_opt_config_1(p
):
3051 print('opt_config_1', list(p
))
3053 def p_opt_config_2(p
):
3054 '''opt_config : ':' K_config '''
3055 print('opt_config_2', list(p
))
3057 def p_lib_cell_id_1(p
):
3058 '''lib_cell_id : IDENTIFIER '''
3059 print('lib_cell_id_1', list(p
))
3062 def p_lib_cell_id_2(p
):
3063 '''lib_cell_id : IDENTIFIER '.' IDENTIFIER '''
3064 print('lib_cell_id_2', list(p
))
3065 # { delete[] $1; delete[] $3; }
3067 def p_list_of_libraries_1(p
):
3068 '''list_of_libraries : '''
3069 print('list_of_libraries_1', list(p
))
3071 def p_list_of_libraries_2(p
):
3072 '''list_of_libraries : list_of_libraries IDENTIFIER '''
3073 print('list_of_libraries_2', list(p
))
3076 def p_drive_strength_1(p
):
3077 '''drive_strength : '(' dr_strength0 ',' dr_strength1 ')' '''
3078 print('drive_strength_1', list(p
))
3079 # { $$.str0 = $2.str0;
3080 # $$.str1 = $4.str1;
3083 def p_drive_strength_2(p
):
3084 '''drive_strength : '(' dr_strength1 ',' dr_strength0 ')' '''
3085 print('drive_strength_2', list(p
))
3086 # { $$.str0 = $4.str0;
3087 # $$.str1 = $2.str1;
3090 def p_drive_strength_3(p
):
3091 '''drive_strength : '(' dr_strength0 ',' K_highz1 ')' '''
3092 print('drive_strength_3', list(p
))
3093 # { $$.str0 = $2.str0;
3094 # $$.str1 = IVL_DR_HiZ;
3097 def p_drive_strength_4(p
):
3098 '''drive_strength : '(' dr_strength1 ',' K_highz0 ')' '''
3099 print('drive_strength_4', list(p
))
3100 # { $$.str0 = IVL_DR_HiZ;
3101 # $$.str1 = $2.str1;
3104 def p_drive_strength_5(p
):
3105 '''drive_strength : '(' K_highz1 ',' dr_strength0 ')' '''
3106 print('drive_strength_5', list(p
))
3107 # { $$.str0 = $4.str0;
3108 # $$.str1 = IVL_DR_HiZ;
3111 def p_drive_strength_6(p
):
3112 '''drive_strength : '(' K_highz0 ',' dr_strength1 ')' '''
3113 print('drive_strength_6', list(p
))
3114 # { $$.str0 = IVL_DR_HiZ;
3115 # $$.str1 = $4.str1;
3118 def p_drive_strength_opt_1(p
):
3119 '''drive_strength_opt : drive_strength '''
3120 print('drive_strength_opt_1', list(p
))
3123 def p_drive_strength_opt_2(p
):
3124 '''drive_strength_opt : '''
3125 print('drive_strength_opt_2', list(p
))
3126 # { $$.str0 = IVL_DR_STRONG; $$.str1 = IVL_DR_STRONG; }
3128 def p_dr_strength0_1(p
):
3129 '''dr_strength0 : K_supply0 '''
3130 print('dr_strength0_1', list(p
))
3131 # { $$.str0 = IVL_DR_SUPPLY; }
3133 def p_dr_strength0_2(p
):
3134 '''dr_strength0 : K_strong0 '''
3135 print('dr_strength0_2', list(p
))
3136 # { $$.str0 = IVL_DR_STRONG; }
3138 def p_dr_strength0_3(p
):
3139 '''dr_strength0 : K_pull0 '''
3140 print('dr_strength0_3', list(p
))
3141 # { $$.str0 = IVL_DR_PULL; }
3143 def p_dr_strength0_4(p
):
3144 '''dr_strength0 : K_weak0 '''
3145 print('dr_strength0_4', list(p
))
3146 # { $$.str0 = IVL_DR_WEAK; }
3148 def p_dr_strength1_1(p
):
3149 '''dr_strength1 : K_supply1 '''
3150 print('dr_strength1_1', list(p
))
3151 # { $$.str1 = IVL_DR_SUPPLY; }
3153 def p_dr_strength1_2(p
):
3154 '''dr_strength1 : K_strong1 '''
3155 print('dr_strength1_2', list(p
))
3156 # { $$.str1 = IVL_DR_STRONG; }
3158 def p_dr_strength1_3(p
):
3159 '''dr_strength1 : K_pull1 '''
3160 print('dr_strength1_3', list(p
))
3161 # { $$.str1 = IVL_DR_PULL; }
3163 def p_dr_strength1_4(p
):
3164 '''dr_strength1 : K_weak1 '''
3165 print('dr_strength1_4', list(p
))
3166 # { $$.str1 = IVL_DR_WEAK; }
3168 def p_clocking_event_opt_1(p
):
3169 '''clocking_event_opt : event_control '''
3170 print('clocking_event_opt_1', list(p
))
3172 def p_clocking_event_opt_2(p
):
3173 '''clocking_event_opt : '''
3174 print('clocking_event_opt_2', list(p
))
3176 def p_event_control_1(p
):
3177 '''event_control : '@' hierarchy_identifier '''
3178 print('event_control_1', list(p
))
3179 # { PEIdent*tmpi = new PEIdent(*$2);
3180 # PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi);
3181 # PEventStatement*tmps = new PEventStatement(tmpe);
3182 # FILE_NAME(tmps, @1);
3187 def p_event_control_2(p
):
3188 '''event_control : '@' '(' event_expression_list ')' '''
3189 print('event_control_2', list(p
))
3190 # { PEventStatement*tmp = new PEventStatement(*$3);
3191 # FILE_NAME(tmp, @1);
3196 def p_event_control_3(p
):
3197 '''event_control : '@' '(' error ')' '''
3198 print('event_control_3', list(p
))
3199 # { yyerror(@1, "error: Malformed event control expression.");
3203 def p_event_expression_list_1(p
):
3204 '''event_expression_list : event_expression '''
3205 print('event_expression_list_1', list(p
))
3208 def p_event_expression_list_2(p
):
3209 '''event_expression_list : event_expression_list K_or event_expression '''
3210 print('event_expression_list_2', list(p
))
3211 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*$1, *$3);
3217 def p_event_expression_list_3(p
):
3218 '''event_expression_list : event_expression_list ',' event_expression '''
3219 print('event_expression_list_3', list(p
))
3220 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*$1, *$3);
3226 def p_event_expression_1(p
):
3227 '''event_expression : K_posedge expression '''
3228 print('event_expression_1', list(p
))
3229 # { PEEvent*tmp = new PEEvent(PEEvent::POSEDGE, $2);
3230 # FILE_NAME(tmp, @1);
3231 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3236 def p_event_expression_2(p
):
3237 '''event_expression : K_negedge expression '''
3238 print('event_expression_2', list(p
))
3239 # { PEEvent*tmp = new PEEvent(PEEvent::NEGEDGE, $2);
3240 # FILE_NAME(tmp, @1);
3241 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3246 def p_event_expression_3(p
):
3247 '''event_expression : expression '''
3248 print('event_expression_3', list(p
))
3249 # { PEEvent*tmp = new PEEvent(PEEvent::ANYEDGE, $1);
3250 # FILE_NAME(tmp, @1);
3251 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3256 def p_branch_probe_expression_1(p
):
3257 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ',' IDENTIFIER ')' '''
3258 print('branch_probe_expression_1', list(p
))
3259 # { $$ = pform_make_branch_probe_expression(@1, $1, $3, $5); }
3261 def p_branch_probe_expression_2(p
):
3262 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ')' '''
3263 print('branch_probe_expression_2', list(p
))
3264 # { $$ = pform_make_branch_probe_expression(@1, $1, $3); }
3266 def p_expression_1(p
):
3267 '''expression : expr_primary_or_typename '''
3268 print('expression_1', list(p
))
3271 def p_expression_2(p
):
3272 '''expression : inc_or_dec_expression '''
3273 print('expression_2', list(p
))
3276 def p_expression_3(p
):
3277 '''expression : inside_expression '''
3278 print('expression_3', list(p
))
3281 def p_expression_4(p
):
3282 '''expression : '+' attribute_list_opt expr_primary %prec UNARY_PREC '''
3283 print('expression_4', list(p
))
3286 def p_expression_5(p
):
3287 '''expression : '-' attribute_list_opt expr_primary %prec UNARY_PREC '''
3288 print('expression_5', list(p
))
3289 # { PEUnary*tmp = new PEUnary('-', $3);
3290 # FILE_NAME(tmp, @3);
3294 def p_expression_6(p
):
3295 '''expression : '~' attribute_list_opt expr_primary %prec UNARY_PREC '''
3296 print('expression_6', list(p
))
3297 # { PEUnary*tmp = new PEUnary('~', $3);
3298 # FILE_NAME(tmp, @3);
3302 def p_expression_7(p
):
3303 '''expression : '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3304 print('expression_7', list(p
))
3305 # { PEUnary*tmp = new PEUnary('&', $3);
3306 # FILE_NAME(tmp, @3);
3310 def p_expression_8(p
):
3311 '''expression : '!' attribute_list_opt expr_primary %prec UNARY_PREC '''
3312 print('expression_8', list(p
))
3313 # { PEUnary*tmp = new PEUnary('!', $3);
3314 # FILE_NAME(tmp, @3);
3318 def p_expression_9(p
):
3319 '''expression : '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3320 print('expression_9', list(p
))
3321 # { PEUnary*tmp = new PEUnary('|', $3);
3322 # FILE_NAME(tmp, @3);
3326 def p_expression_10(p
):
3327 '''expression : '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3328 print('expression_10', list(p
))
3329 # { PEUnary*tmp = new PEUnary('^', $3);
3330 # FILE_NAME(tmp, @3);
3334 def p_expression_11(p
):
3335 '''expression : '~' '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3336 print('expression_11', list(p
))
3337 # { yyerror(@1, "error: '~' '&' is not a valid expression. "
3338 # "Please use operator '~&' instead.");
3342 def p_expression_12(p
):
3343 '''expression : '~' '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3344 print('expression_12', list(p
))
3345 # { yyerror(@1, "error: '~' '|' is not a valid expression. "
3346 # "Please use operator '~|' instead.");
3350 def p_expression_13(p
):
3351 '''expression : '~' '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3352 print('expression_13', list(p
))
3353 # { yyerror(@1, "error: '~' '^' is not a valid expression. "
3354 # "Please use operator '~^' instead.");
3358 def p_expression_14(p
):
3359 '''expression : K_NAND attribute_list_opt expr_primary %prec UNARY_PREC '''
3360 print('expression_14', list(p
))
3361 # { PEUnary*tmp = new PEUnary('A', $3);
3362 # FILE_NAME(tmp, @3);
3366 def p_expression_15(p
):
3367 '''expression : K_NOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3368 print('expression_15', list(p
))
3369 # { PEUnary*tmp = new PEUnary('N', $3);
3370 # FILE_NAME(tmp, @3);
3374 def p_expression_16(p
):
3375 '''expression : K_NXOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3376 print('expression_16', list(p
))
3377 # { PEUnary*tmp = new PEUnary('X', $3);
3378 # FILE_NAME(tmp, @3);
3382 def p_expression_17(p
):
3383 '''expression : '!' error %prec UNARY_PREC '''
3384 print('expression_17', list(p
))
3385 # { yyerror(@1, "error: Operand of unary ! "
3386 # "is not a primary expression.");
3390 def p_expression_18(p
):
3391 '''expression : '^' error %prec UNARY_PREC '''
3392 print('expression_18', list(p
))
3393 # { yyerror(@1, "error: Operand of reduction ^ "
3394 # "is not a primary expression.");
3398 def p_expression_19(p
):
3399 '''expression : expression '^' attribute_list_opt expression '''
3400 print('expression_19', list(p
))
3401 # { PEBinary*tmp = new PEBinary('^', $1, $4);
3402 # FILE_NAME(tmp, @2);
3406 def p_expression_20(p
):
3407 '''expression : expression K_POW attribute_list_opt expression '''
3408 print('expression_20', list(p
))
3409 # { PEBinary*tmp = new PEBPower('p', $1, $4);
3410 # FILE_NAME(tmp, @2);
3414 def p_expression_21(p
):
3415 '''expression : expression '*' attribute_list_opt expression '''
3416 print('expression_21', list(p
))
3417 # { PEBinary*tmp = new PEBinary('*', $1, $4);
3418 # FILE_NAME(tmp, @2);
3422 def p_expression_22(p
):
3423 '''expression : expression '/' attribute_list_opt expression '''
3424 print('expression_22', list(p
))
3425 # { PEBinary*tmp = new PEBinary('/', $1, $4);
3426 # FILE_NAME(tmp, @2);
3430 def p_expression_23(p
):
3431 '''expression : expression '%' attribute_list_opt expression '''
3432 print('expression_23', list(p
))
3433 # { PEBinary*tmp = new PEBinary('%', $1, $4);
3434 # FILE_NAME(tmp, @2);
3438 def p_expression_24(p
):
3439 '''expression : expression '+' attribute_list_opt expression '''
3440 print('expression_24', list(p
))
3441 # { PEBinary*tmp = new PEBinary('+', $1, $4);
3442 # FILE_NAME(tmp, @2);
3446 def p_expression_25(p
):
3447 '''expression : expression '-' attribute_list_opt expression '''
3448 print('expression_25', list(p
))
3449 # { PEBinary*tmp = new PEBinary('-', $1, $4);
3450 # FILE_NAME(tmp, @2);
3454 def p_expression_26(p
):
3455 '''expression : expression '&' attribute_list_opt expression '''
3456 print('expression_26', list(p
))
3457 # { PEBinary*tmp = new PEBinary('&', $1, $4);
3458 # FILE_NAME(tmp, @2);
3462 def p_expression_27(p
):
3463 '''expression : expression '|' attribute_list_opt expression '''
3464 print('expression_27', list(p
))
3465 # { PEBinary*tmp = new PEBinary('|', $1, $4);
3466 # FILE_NAME(tmp, @2);
3470 def p_expression_28(p
):
3471 '''expression : expression K_NAND attribute_list_opt expression '''
3472 print('expression_28', list(p
))
3473 # { PEBinary*tmp = new PEBinary('A', $1, $4);
3474 # FILE_NAME(tmp, @2);
3478 def p_expression_29(p
):
3479 '''expression : expression K_NOR attribute_list_opt expression '''
3480 print('expression_29', list(p
))
3481 # { PEBinary*tmp = new PEBinary('O', $1, $4);
3482 # FILE_NAME(tmp, @2);
3486 def p_expression_30(p
):
3487 '''expression : expression K_NXOR attribute_list_opt expression '''
3488 print('expression_30', list(p
))
3489 # { PEBinary*tmp = new PEBinary('X', $1, $4);
3490 # FILE_NAME(tmp, @2);
3494 def p_expression_31(p
):
3495 '''expression : expression '<' attribute_list_opt expression '''
3496 print('expression_31', list(p
))
3497 # { PEBinary*tmp = new PEBComp('<', $1, $4);
3498 # FILE_NAME(tmp, @2);
3502 def p_expression_32(p
):
3503 '''expression : expression '>' attribute_list_opt expression '''
3504 print('expression_32', list(p
))
3505 # { PEBinary*tmp = new PEBComp('>', $1, $4);
3506 # FILE_NAME(tmp, @2);
3510 def p_expression_33(p
):
3511 '''expression : expression K_LS attribute_list_opt expression '''
3512 print('expression_33', list(p
))
3513 # { PEBinary*tmp = new PEBShift('l', $1, $4);
3514 # FILE_NAME(tmp, @2);
3518 def p_expression_34(p
):
3519 '''expression : expression K_RS attribute_list_opt expression '''
3520 print('expression_34', list(p
))
3521 # { PEBinary*tmp = new PEBShift('r', $1, $4);
3522 # FILE_NAME(tmp, @2);
3526 def p_expression_35(p
):
3527 '''expression : expression K_RSS attribute_list_opt expression '''
3528 print('expression_35', list(p
))
3529 # { PEBinary*tmp = new PEBShift('R', $1, $4);
3530 # FILE_NAME(tmp, @2);
3534 def p_expression_36(p
):
3535 '''expression : expression K_EQ attribute_list_opt expression '''
3536 print('expression_36', list(p
))
3537 # { PEBinary*tmp = new PEBComp('e', $1, $4);
3538 # FILE_NAME(tmp, @2);
3542 def p_expression_37(p
):
3543 '''expression : expression K_CEQ attribute_list_opt expression '''
3544 print('expression_37', list(p
))
3545 # { PEBinary*tmp = new PEBComp('E', $1, $4);
3546 # FILE_NAME(tmp, @2);
3550 def p_expression_38(p
):
3551 '''expression : expression K_WEQ attribute_list_opt expression '''
3552 print('expression_38', list(p
))
3553 # { PEBinary*tmp = new PEBComp('w', $1, $4);
3554 # FILE_NAME(tmp, @2);
3558 def p_expression_39(p
):
3559 '''expression : expression K_LE attribute_list_opt expression '''
3560 print('expression_39', list(p
))
3561 # { PEBinary*tmp = new PEBComp('L', $1, $4);
3562 # FILE_NAME(tmp, @2);
3566 def p_expression_40(p
):
3567 '''expression : expression K_GE attribute_list_opt expression '''
3568 print('expression_40', list(p
))
3569 # { PEBinary*tmp = new PEBComp('G', $1, $4);
3570 # FILE_NAME(tmp, @2);
3574 def p_expression_41(p
):
3575 '''expression : expression K_NE attribute_list_opt expression '''
3576 print('expression_41', list(p
))
3577 # { PEBinary*tmp = new PEBComp('n', $1, $4);
3578 # FILE_NAME(tmp, @2);
3582 def p_expression_42(p
):
3583 '''expression : expression K_CNE attribute_list_opt expression '''
3584 print('expression_42', list(p
))
3585 # { PEBinary*tmp = new PEBComp('N', $1, $4);
3586 # FILE_NAME(tmp, @2);
3590 def p_expression_43(p
):
3591 '''expression : expression K_WNE attribute_list_opt expression '''
3592 print('expression_43', list(p
))
3593 # { PEBinary*tmp = new PEBComp('W', $1, $4);
3594 # FILE_NAME(tmp, @2);
3598 def p_expression_44(p
):
3599 '''expression : expression K_LOR attribute_list_opt expression '''
3600 print('expression_44', list(p
))
3601 # { PEBinary*tmp = new PEBLogic('o', $1, $4);
3602 # FILE_NAME(tmp, @2);
3606 def p_expression_45(p
):
3607 '''expression : expression K_LAND attribute_list_opt expression '''
3608 print('expression_45', list(p
))
3609 # { PEBinary*tmp = new PEBLogic('a', $1, $4);
3610 # FILE_NAME(tmp, @2);
3614 def p_expression_46(p
):
3615 '''expression : expression '?' attribute_list_opt expression ':' expression '''
3616 print('expression_46', list(p
))
3617 # { PETernary*tmp = new PETernary($1, $4, $6);
3618 # FILE_NAME(tmp, @2);
3622 def p_expr_mintypmax_1(p
):
3623 '''expr_mintypmax : expression '''
3624 print('expr_mintypmax_1', list(p
))
3627 def p_expr_mintypmax_2(p
):
3628 '''expr_mintypmax : expression ':' expression ':' expression '''
3629 print('expr_mintypmax_2', list(p
))
3630 # { switch (min_typ_max_flag) {
3647 # if (min_typ_max_warn > 0) {
3648 # cerr << $$->get_fileline() << ": warning: choosing ";
3649 # switch (min_typ_max_flag) {
3660 # cerr << " expression." << endl;
3661 # min_typ_max_warn -= 1;
3665 def p_expression_list_with_nuls_1(p
):
3666 '''expression_list_with_nuls : expression_list_with_nuls ',' expression '''
3667 print('expression_list_with_nuls_1', list(p
))
3668 # { list<PExpr*>*tmp = $1;
3669 # tmp->push_back($3);
3673 def p_expression_list_with_nuls_2(p
):
3674 '''expression_list_with_nuls : expression '''
3675 print('expression_list_with_nuls_2', list(p
))
3676 # { list<PExpr*>*tmp = new list<PExpr*>;
3677 # tmp->push_back($1);
3681 def p_expression_list_with_nuls_3(p
):
3682 '''expression_list_with_nuls : '''
3683 print('expression_list_with_nuls_3', list(p
))
3684 # { list<PExpr*>*tmp = new list<PExpr*>;
3685 # tmp->push_back(0);
3689 def p_expression_list_with_nuls_4(p
):
3690 '''expression_list_with_nuls : expression_list_with_nuls ',' '''
3691 print('expression_list_with_nuls_4', list(p
))
3692 # { list<PExpr*>*tmp = $1;
3693 # tmp->push_back(0);
3697 def p_expression_list_proper_1(p
):
3698 '''expression_list_proper : expression_list_proper ',' expression '''
3699 print('expression_list_proper_1', list(p
))
3700 # { list<PExpr*>*tmp = $1;
3701 # tmp->push_back($3);
3705 def p_expression_list_proper_2(p
):
3706 '''expression_list_proper : expression '''
3707 print('expression_list_proper_2', list(p
))
3708 # { list<PExpr*>*tmp = new list<PExpr*>;
3709 # tmp->push_back($1);
3713 def p_expr_primary_or_typename_1(p
):
3714 '''expr_primary_or_typename : expr_primary '''
3715 print('expr_primary_or_typename_1', list(p
))
3718 def p_expr_primary_or_typename_2(p
):
3719 '''expr_primary_or_typename : TYPE_IDENTIFIER '''
3720 print('expr_primary_or_typename_2', list(p
))
3722 # { PETypename*tmp = new PETypename($1.type);
3723 # FILE_NAME(tmp,@1);
3728 def p_expr_primary_1(p
):
3729 '''expr_primary : number '''
3730 print('expr_primary_1', list(p
))
3733 # PENumber*tmp = new PENumber($1);
3734 # FILE_NAME(tmp, @1);
3738 def p_expr_primary_2(p
):
3739 '''expr_primary : REALTIME '''
3740 print('expr_primary_2', list(p
))
3741 # { PEFNumber*tmp = new PEFNumber($1);
3742 # FILE_NAME(tmp, @1);
3746 def p_expr_primary_3(p
):
3747 '''expr_primary : STRING '''
3748 print('expr_primary_3', list(p
))
3749 # { PEString*tmp = new PEString($1);
3750 # FILE_NAME(tmp, @1);
3754 def p_expr_primary_4(p
):
3755 '''expr_primary : TIME_LITERAL '''
3756 print('expr_primary_4', list(p
))
3761 # if ($1 == 0 || !get_time_unit($1, unit))
3762 # yyerror(@1, "internal error: delay.");
3764 # double p = pow(10.0, (double)(unit - pform_get_timeunit()));
3765 # double time = atof($1) * p;
3767 # verireal *v = new verireal(time);
3768 # $$ = new PEFNumber(v);
3769 # FILE_NAME($$, @1);
3773 def p_expr_primary_5(p
):
3774 '''expr_primary : SYSTEM_IDENTIFIER '''
3775 print('expr_primary_5', list(p
))
3776 # { perm_string tn = lex_strings.make($1);
3777 # PECallFunction*tmp = new PECallFunction(tn);
3778 # FILE_NAME(tmp, @1);
3783 def p_expr_primary_6(p
):
3784 '''expr_primary : hierarchy_identifier '''
3785 print('expr_primary_6', list(p
))
3787 # { PEIdent*tmp = pform_new_ident(*$1);
3788 # FILE_NAME(tmp, @1);
3793 def p_expr_primary_7(p
):
3794 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier '''
3795 print('expr_primary_7', list(p
))
3796 # { $$ = pform_package_ident(@2, $1, $3);
3800 def p_expr_primary_8(p
):
3801 '''expr_primary : hierarchy_identifier '(' expression_list_with_nuls ')' '''
3802 print('expr_primary_8', list(p
))
3803 # { list<PExpr*>*expr_list = $3;
3804 # strip_tail_items(expr_list);
3805 # PECallFunction*tmp = pform_make_call_function(@1, *$1, *expr_list);
3810 def p_expr_primary_9(p
):
3811 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' '''
3812 print('expr_primary_9', list(p
))
3813 # { pform_name_t*t_name = $1;
3814 # while (! $3->empty()) {
3815 # t_name->push_back($3->front());
3818 # list<PExpr*>*expr_list = $5;
3819 # strip_tail_items(expr_list);
3820 # PECallFunction*tmp = pform_make_call_function(@1, *t_name, *expr_list);
3826 def p_expr_primary_10(p
):
3827 '''expr_primary : SYSTEM_IDENTIFIER '(' expression_list_proper ')' '''
3828 print('expr_primary_10', list(p
))
3829 # { perm_string tn = lex_strings.make($1);
3830 # PECallFunction*tmp = new PECallFunction(tn, *$3);
3831 # FILE_NAME(tmp, @1);
3836 def p_expr_primary_11(p
):
3837 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')' '''
3838 print('expr_primary_11', list(p
))
3839 # { perm_string use_name = lex_strings.make($3);
3840 # PECallFunction*tmp = new PECallFunction($1, use_name, *$5);
3841 # FILE_NAME(tmp, @3);
3846 def p_expr_primary_12(p
):
3847 '''expr_primary : SYSTEM_IDENTIFIER '(' ')' '''
3848 print('expr_primary_12', list(p
))
3849 # { perm_string tn = lex_strings.make($1);
3850 # const vector<PExpr*>empty;
3851 # PECallFunction*tmp = new PECallFunction(tn, empty);
3852 # FILE_NAME(tmp, @1);
3855 # if (!gn_system_verilog()) {
3856 # yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
3860 def p_expr_primary_13(p
):
3861 '''expr_primary : implicit_class_handle '''
3862 print('expr_primary_13', list(p
))
3863 # { PEIdent*tmp = new PEIdent(*$1);
3864 # FILE_NAME(tmp,@1);
3869 def p_expr_primary_14(p
):
3870 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '''
3871 print('expr_primary_14', list(p
))
3872 # { pform_name_t*t_name = $1;
3873 # while (! $3->empty()) {
3874 # t_name->push_back($3->front());
3877 # PEIdent*tmp = new PEIdent(*t_name);
3878 # FILE_NAME(tmp,@1);
3884 def p_expr_primary_15(p
):
3885 '''expr_primary : K_acos '(' expression ')' '''
3886 print('expr_primary_15', list(p
))
3887 # { perm_string tn = perm_string::literal("$acos");
3888 # PECallFunction*tmp = make_call_function(tn, $3);
3889 # FILE_NAME(tmp,@1);
3893 def p_expr_primary_16(p
):
3894 '''expr_primary : K_acosh '(' expression ')' '''
3895 print('expr_primary_16', list(p
))
3896 # { perm_string tn = perm_string::literal("$acosh");
3897 # PECallFunction*tmp = make_call_function(tn, $3);
3898 # FILE_NAME(tmp,@1);
3902 def p_expr_primary_17(p
):
3903 '''expr_primary : K_asin '(' expression ')' '''
3904 print('expr_primary_17', list(p
))
3905 # { perm_string tn = perm_string::literal("$asin");
3906 # PECallFunction*tmp = make_call_function(tn, $3);
3907 # FILE_NAME(tmp,@1);
3911 def p_expr_primary_18(p
):
3912 '''expr_primary : K_asinh '(' expression ')' '''
3913 print('expr_primary_18', list(p
))
3914 # { perm_string tn = perm_string::literal("$asinh");
3915 # PECallFunction*tmp = make_call_function(tn, $3);
3916 # FILE_NAME(tmp,@1);
3920 def p_expr_primary_19(p
):
3921 '''expr_primary : K_atan '(' expression ')' '''
3922 print('expr_primary_19', list(p
))
3923 # { perm_string tn = perm_string::literal("$atan");
3924 # PECallFunction*tmp = make_call_function(tn, $3);
3925 # FILE_NAME(tmp,@1);
3929 def p_expr_primary_20(p
):
3930 '''expr_primary : K_atanh '(' expression ')' '''
3931 print('expr_primary_20', list(p
))
3932 # { perm_string tn = perm_string::literal("$atanh");
3933 # PECallFunction*tmp = make_call_function(tn, $3);
3934 # FILE_NAME(tmp,@1);
3938 def p_expr_primary_21(p
):
3939 '''expr_primary : K_atan2 '(' expression ',' expression ')' '''
3940 print('expr_primary_21', list(p
))
3941 # { perm_string tn = perm_string::literal("$atan2");
3942 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3943 # FILE_NAME(tmp,@1);
3947 def p_expr_primary_22(p
):
3948 '''expr_primary : K_ceil '(' expression ')' '''
3949 print('expr_primary_22', list(p
))
3950 # { perm_string tn = perm_string::literal("$ceil");
3951 # PECallFunction*tmp = make_call_function(tn, $3);
3952 # FILE_NAME(tmp,@1);
3956 def p_expr_primary_23(p
):
3957 '''expr_primary : K_cos '(' expression ')' '''
3958 print('expr_primary_23', list(p
))
3959 # { perm_string tn = perm_string::literal("$cos");
3960 # PECallFunction*tmp = make_call_function(tn, $3);
3961 # FILE_NAME(tmp,@1);
3965 def p_expr_primary_24(p
):
3966 '''expr_primary : K_cosh '(' expression ')' '''
3967 print('expr_primary_24', list(p
))
3968 # { perm_string tn = perm_string::literal("$cosh");
3969 # PECallFunction*tmp = make_call_function(tn, $3);
3970 # FILE_NAME(tmp,@1);
3974 def p_expr_primary_25(p
):
3975 '''expr_primary : K_exp '(' expression ')' '''
3976 print('expr_primary_25', list(p
))
3977 # { perm_string tn = perm_string::literal("$exp");
3978 # PECallFunction*tmp = make_call_function(tn, $3);
3979 # FILE_NAME(tmp,@1);
3983 def p_expr_primary_26(p
):
3984 '''expr_primary : K_floor '(' expression ')' '''
3985 print('expr_primary_26', list(p
))
3986 # { perm_string tn = perm_string::literal("$floor");
3987 # PECallFunction*tmp = make_call_function(tn, $3);
3988 # FILE_NAME(tmp,@1);
3992 def p_expr_primary_27(p
):
3993 '''expr_primary : K_hypot '(' expression ',' expression ')' '''
3994 print('expr_primary_27', list(p
))
3995 # { perm_string tn = perm_string::literal("$hypot");
3996 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3997 # FILE_NAME(tmp,@1);
4001 def p_expr_primary_28(p
):
4002 '''expr_primary : K_ln '(' expression ')' '''
4003 print('expr_primary_28', list(p
))
4004 # { perm_string tn = perm_string::literal("$ln");
4005 # PECallFunction*tmp = make_call_function(tn, $3);
4006 # FILE_NAME(tmp,@1);
4010 def p_expr_primary_29(p
):
4011 '''expr_primary : K_log '(' expression ')' '''
4012 print('expr_primary_29', list(p
))
4013 # { perm_string tn = perm_string::literal("$log10");
4014 # PECallFunction*tmp = make_call_function(tn, $3);
4015 # FILE_NAME(tmp,@1);
4019 def p_expr_primary_30(p
):
4020 '''expr_primary : K_pow '(' expression ',' expression ')' '''
4021 print('expr_primary_30', list(p
))
4022 # { perm_string tn = perm_string::literal("$pow");
4023 # PECallFunction*tmp = make_call_function(tn, $3, $5);
4024 # FILE_NAME(tmp,@1);
4028 def p_expr_primary_31(p
):
4029 '''expr_primary : K_sin '(' expression ')' '''
4030 print('expr_primary_31', list(p
))
4031 # { perm_string tn = perm_string::literal("$sin");
4032 # PECallFunction*tmp = make_call_function(tn, $3);
4033 # FILE_NAME(tmp,@1);
4037 def p_expr_primary_32(p
):
4038 '''expr_primary : K_sinh '(' expression ')' '''
4039 print('expr_primary_32', list(p
))
4040 # { perm_string tn = perm_string::literal("$sinh");
4041 # PECallFunction*tmp = make_call_function(tn, $3);
4042 # FILE_NAME(tmp,@1);
4046 def p_expr_primary_33(p
):
4047 '''expr_primary : K_sqrt '(' expression ')' '''
4048 print('expr_primary_33', list(p
))
4049 # { perm_string tn = perm_string::literal("$sqrt");
4050 # PECallFunction*tmp = make_call_function(tn, $3);
4051 # FILE_NAME(tmp,@1);
4055 def p_expr_primary_34(p
):
4056 '''expr_primary : K_tan '(' expression ')' '''
4057 print('expr_primary_34', list(p
))
4058 # { perm_string tn = perm_string::literal("$tan");
4059 # PECallFunction*tmp = make_call_function(tn, $3);
4060 # FILE_NAME(tmp,@1);
4064 def p_expr_primary_35(p
):
4065 '''expr_primary : K_tanh '(' expression ')' '''
4066 print('expr_primary_35', list(p
))
4067 # { perm_string tn = perm_string::literal("$tanh");
4068 # PECallFunction*tmp = make_call_function(tn, $3);
4069 # FILE_NAME(tmp,@1);
4073 def p_expr_primary_36(p
):
4074 '''expr_primary : K_abs '(' expression ')' '''
4075 print('expr_primary_36', list(p
))
4076 # { PEUnary*tmp = new PEUnary('m', $3);
4077 # FILE_NAME(tmp,@1);
4081 def p_expr_primary_37(p
):
4082 '''expr_primary : K_max '(' expression ',' expression ')' '''
4083 print('expr_primary_37', list(p
))
4084 # { PEBinary*tmp = new PEBinary('M', $3, $5);
4085 # FILE_NAME(tmp,@1);
4089 def p_expr_primary_38(p
):
4090 '''expr_primary : K_min '(' expression ',' expression ')' '''
4091 print('expr_primary_38', list(p
))
4092 # { PEBinary*tmp = new PEBinary('m', $3, $5);
4093 # FILE_NAME(tmp,@1);
4097 def p_expr_primary_39(p
):
4098 '''expr_primary : '(' expr_mintypmax ')' '''
4099 print('expr_primary_39', list(p
))
4102 def p_expr_primary_40(p
):
4103 '''expr_primary : '{' expression_list_proper '}' '''
4104 print('expr_primary_40', list(p
))
4105 # { PEConcat*tmp = new PEConcat(*$2);
4106 # FILE_NAME(tmp, @1);
4111 def p_expr_primary_41(p
):
4112 '''expr_primary : '{' expression '{' expression_list_proper '}' '}' '''
4113 print('expr_primary_41', list(p
))
4115 # PEConcat*tmp = new PEConcat(*$4, rep);
4116 # FILE_NAME(tmp, @1);
4121 def p_expr_primary_42(p
):
4122 '''expr_primary : '{' expression '{' expression_list_proper '}' error '}' '''
4123 print('expr_primary_42', list(p
))
4125 # PEConcat*tmp = new PEConcat(*$4, rep);
4126 # FILE_NAME(tmp, @1);
4129 # yyerror(@5, "error: Syntax error between internal '}' "
4130 # "and closing '}' of repeat concatenation.");
4134 def p_expr_primary_43(p
):
4135 '''expr_primary : '{' '}' '''
4136 print('expr_primary_43', list(p
))
4137 # { // This is the empty queue syntax.
4138 # if (gn_system_verilog()) {
4139 # list<PExpr*> empty_list;
4140 # PEConcat*tmp = new PEConcat(empty_list);
4141 # FILE_NAME(tmp, @1);
4144 # yyerror(@1, "error: Concatenations are not allowed to be empty.");
4149 def p_expr_primary_44(p
):
4150 '''expr_primary : expr_primary "'" '(' expression ')' '''
4151 print('expr_primary_44', list(p
))
4152 # { PExpr*base = $4;
4153 # if (gn_system_verilog()) {
4154 # PECastSize*tmp = new PECastSize($1, base);
4155 # FILE_NAME(tmp, @1);
4158 # yyerror(@1, "error: Size cast requires SystemVerilog.");
4163 def p_expr_primary_45(p
):
4164 '''expr_primary : simple_type_or_string "'" '(' expression ')' '''
4165 print('expr_primary_45', list(p
))
4166 # { PExpr*base = $4;
4167 # if (gn_system_verilog()) {
4168 # PECastType*tmp = new PECastType($1, base);
4169 # FILE_NAME(tmp, @1);
4172 # yyerror(@1, "error: Type cast requires SystemVerilog.");
4177 def p_expr_primary_46(p
):
4178 '''expr_primary : assignment_pattern '''
4179 print('expr_primary_46', list(p
))
4182 def p_expr_primary_47(p
):
4183 '''expr_primary : streaming_concatenation '''
4184 print('expr_primary_47', list(p
))
4187 def p_expr_primary_48(p
):
4188 '''expr_primary : K_null '''
4189 print('expr_primary_48', list(p
))
4190 # { PENull*tmp = new PENull;
4191 # FILE_NAME(tmp, @1);
4195 def p_function_item_list_opt_1(p
):
4196 '''function_item_list_opt : function_item_list '''
4197 print('function_item_list_opt_1', list(p
))
4200 def p_function_item_list_opt_2(p
):
4201 '''function_item_list_opt : '''
4202 print('function_item_list_opt_2', list(p
))
4205 def p_function_item_list_1(p
):
4206 '''function_item_list : function_item '''
4207 print('function_item_list_1', list(p
))
4210 def p_function_item_list_2(p
):
4211 '''function_item_list : function_item_list function_item '''
4212 print('function_item_list_2', list(p
))
4215 # vector<pform_tf_port_t>*tmp = $1;
4216 # size_t s1 = tmp->size();
4217 # tmp->resize(s1 + $2->size());
4218 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
4219 # tmp->at(s1+idx) = $2->at(idx);
4229 def p_function_item_1(p
):
4230 '''function_item : tf_port_declaration '''
4231 print('function_item_1', list(p
))
4234 def p_function_item_2(p
):
4235 '''function_item : block_item_decl '''
4236 print('function_item_2', list(p
))
4239 def p_gate_instance_1(p
):
4240 '''gate_instance : IDENTIFIER '(' expression_list_with_nuls ')' '''
4241 print('gate_instance_1', list(p
))
4242 # { lgate*tmp = new lgate;
4245 # tmp->file = @1.text;
4246 # tmp->lineno = @1.first_line;
4251 def p_gate_instance_2(p
):
4252 '''gate_instance : IDENTIFIER dimensions '(' expression_list_with_nuls ')' '''
4253 print('gate_instance_2', list(p
))
4254 # { lgate*tmp = new lgate;
4255 # list<pform_range_t>*rng = $2;
4258 # tmp->range = rng->front();
4260 # assert(rng->empty());
4261 # tmp->file = @1.text;
4262 # tmp->lineno = @1.first_line;
4268 def p_gate_instance_3(p
):
4269 '''gate_instance : '(' expression_list_with_nuls ')' '''
4270 print('gate_instance_3', list(p
))
4271 # { lgate*tmp = new lgate;
4274 # tmp->file = @1.text;
4275 # tmp->lineno = @1.first_line;
4279 def p_gate_instance_4(p
):
4280 '''gate_instance : IDENTIFIER dimensions '''
4281 print('gate_instance_4', list(p
))
4282 # { lgate*tmp = new lgate;
4283 # list<pform_range_t>*rng = $2;
4286 # tmp->parms_by_name = 0;
4287 # tmp->range = rng->front();
4289 # assert(rng->empty());
4290 # tmp->file = @1.text;
4291 # tmp->lineno = @1.first_line;
4297 def p_gate_instance_5(p
):
4298 '''gate_instance : IDENTIFIER '(' port_name_list ')' '''
4299 print('gate_instance_5', list(p
))
4300 # { lgate*tmp = new lgate;
4303 # tmp->parms_by_name = $3;
4304 # tmp->file = @1.text;
4305 # tmp->lineno = @1.first_line;
4310 def p_gate_instance_6(p
):
4311 '''gate_instance : IDENTIFIER dimensions '(' port_name_list ')' '''
4312 print('gate_instance_6', list(p
))
4313 # { lgate*tmp = new lgate;
4314 # list<pform_range_t>*rng = $2;
4317 # tmp->parms_by_name = $4;
4318 # tmp->range = rng->front();
4320 # assert(rng->empty());
4321 # tmp->file = @1.text;
4322 # tmp->lineno = @1.first_line;
4328 def p_gate_instance_7(p
):
4329 '''gate_instance : IDENTIFIER '(' error ')' '''
4330 print('gate_instance_7', list(p
))
4331 # { lgate*tmp = new lgate;
4334 # tmp->parms_by_name = 0;
4335 # tmp->file = @1.text;
4336 # tmp->lineno = @1.first_line;
4337 # yyerror(@2, "error: Syntax error in instance port "
4338 # "expression(s).");
4343 def p_gate_instance_8(p
):
4344 '''gate_instance : IDENTIFIER dimensions '(' error ')' '''
4345 print('gate_instance_8', list(p
))
4346 # { lgate*tmp = new lgate;
4349 # tmp->parms_by_name = 0;
4350 # tmp->file = @1.text;
4351 # tmp->lineno = @1.first_line;
4352 # yyerror(@3, "error: Syntax error in instance port "
4353 # "expression(s).");
4358 def p_gate_instance_list_1(p
):
4359 '''gate_instance_list : gate_instance_list ',' gate_instance '''
4360 print('gate_instance_list_1', list(p
))
4361 # { svector<lgate>*tmp1 = $1;
4363 # svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
4369 def p_gate_instance_list_2(p
):
4370 '''gate_instance_list : gate_instance '''
4371 print('gate_instance_list_2', list(p
))
4372 # { svector<lgate>*tmp = new svector<lgate>(1);
4378 def p_gatetype_1(p
):
4379 '''gatetype : K_and '''
4380 print('gatetype_1', list(p
))
4381 # { $$ = PGBuiltin::AND; }
4383 def p_gatetype_2(p
):
4384 '''gatetype : K_nand '''
4385 print('gatetype_2', list(p
))
4386 # { $$ = PGBuiltin::NAND; }
4388 def p_gatetype_3(p
):
4389 '''gatetype : K_or '''
4390 print('gatetype_3', list(p
))
4391 # { $$ = PGBuiltin::OR; }
4393 def p_gatetype_4(p
):
4394 '''gatetype : K_nor '''
4395 print('gatetype_4', list(p
))
4396 # { $$ = PGBuiltin::NOR; }
4398 def p_gatetype_5(p
):
4399 '''gatetype : K_xor '''
4400 print('gatetype_5', list(p
))
4401 # { $$ = PGBuiltin::XOR; }
4403 def p_gatetype_6(p
):
4404 '''gatetype : K_xnor '''
4405 print('gatetype_6', list(p
))
4406 # { $$ = PGBuiltin::XNOR; }
4408 def p_gatetype_7(p
):
4409 '''gatetype : K_buf '''
4410 print('gatetype_7', list(p
))
4411 # { $$ = PGBuiltin::BUF; }
4413 def p_gatetype_8(p
):
4414 '''gatetype : K_bufif0 '''
4415 print('gatetype_8', list(p
))
4416 # { $$ = PGBuiltin::BUFIF0; }
4418 def p_gatetype_9(p
):
4419 '''gatetype : K_bufif1 '''
4420 print('gatetype_9', list(p
))
4421 # { $$ = PGBuiltin::BUFIF1; }
4423 def p_gatetype_10(p
):
4424 '''gatetype : K_not '''
4425 print('gatetype_10', list(p
))
4426 # { $$ = PGBuiltin::NOT; }
4428 def p_gatetype_11(p
):
4429 '''gatetype : K_notif0 '''
4430 print('gatetype_11', list(p
))
4431 # { $$ = PGBuiltin::NOTIF0; }
4433 def p_gatetype_12(p
):
4434 '''gatetype : K_notif1 '''
4435 print('gatetype_12', list(p
))
4436 # { $$ = PGBuiltin::NOTIF1; }
4438 def p_switchtype_1(p
):
4439 '''switchtype : K_nmos '''
4440 print('switchtype_1', list(p
))
4441 # { $$ = PGBuiltin::NMOS; }
4443 def p_switchtype_2(p
):
4444 '''switchtype : K_rnmos '''
4445 print('switchtype_2', list(p
))
4446 # { $$ = PGBuiltin::RNMOS; }
4448 def p_switchtype_3(p
):
4449 '''switchtype : K_pmos '''
4450 print('switchtype_3', list(p
))
4451 # { $$ = PGBuiltin::PMOS; }
4453 def p_switchtype_4(p
):
4454 '''switchtype : K_rpmos '''
4455 print('switchtype_4', list(p
))
4456 # { $$ = PGBuiltin::RPMOS; }
4458 def p_switchtype_5(p
):
4459 '''switchtype : K_cmos '''
4460 print('switchtype_5', list(p
))
4461 # { $$ = PGBuiltin::CMOS; }
4463 def p_switchtype_6(p
):
4464 '''switchtype : K_rcmos '''
4465 print('switchtype_6', list(p
))
4466 # { $$ = PGBuiltin::RCMOS; }
4468 def p_switchtype_7(p
):
4469 '''switchtype : K_tran '''
4470 print('switchtype_7', list(p
))
4471 # { $$ = PGBuiltin::TRAN; }
4473 def p_switchtype_8(p
):
4474 '''switchtype : K_rtran '''
4475 print('switchtype_8', list(p
))
4476 # { $$ = PGBuiltin::RTRAN; }
4478 def p_switchtype_9(p
):
4479 '''switchtype : K_tranif0 '''
4480 print('switchtype_9', list(p
))
4481 # { $$ = PGBuiltin::TRANIF0; }
4483 def p_switchtype_10(p
):
4484 '''switchtype : K_tranif1 '''
4485 print('switchtype_10', list(p
))
4486 # { $$ = PGBuiltin::TRANIF1; }
4488 def p_switchtype_11(p
):
4489 '''switchtype : K_rtranif0 '''
4490 print('switchtype_11', list(p
))
4491 # { $$ = PGBuiltin::RTRANIF0; }
4493 def p_switchtype_12(p
):
4494 '''switchtype : K_rtranif1 '''
4495 print('switchtype_12', list(p
))
4496 # { $$ = PGBuiltin::RTRANIF1; }
4498 def p_hierarchy_identifier_1(p
):
4499 '''hierarchy_identifier : IDENTIFIER '''
4500 print('hierarchy_identifier_1', list(p
))
4501 lpvalue
= Leaf(token
.NAME
, p
[1])
4503 # { $$ = new pform_name_t;
4504 # $$->push_back(name_component_t(lex_strings.make($1)));
4508 def p_hierarchy_identifier_2(p
):
4509 '''hierarchy_identifier : hierarchy_identifier '.' IDENTIFIER '''
4510 print('hierarchy_identifier_2', list(p
))
4511 # { pform_name_t * tmp = $1;
4512 # tmp->push_back(name_component_t(lex_strings.make($3)));
4517 def p_hierarchy_identifier_3(p
):
4518 '''hierarchy_identifier : hierarchy_identifier '[' expression ']' '''
4519 print('hierarchy_identifier_3', list(p
))
4520 # { pform_name_t * tmp = $1;
4521 # name_component_t&tail = tmp->back();
4522 # index_component_t itmp;
4523 # itmp.sel = index_component_t::SEL_BIT;
4525 # tail.index.push_back(itmp);
4529 def p_hierarchy_identifier_4(p
):
4530 '''hierarchy_identifier : hierarchy_identifier '[' '$' ']' '''
4531 print('hierarchy_identifier_4', list(p
))
4532 # { pform_name_t * tmp = $1;
4533 # name_component_t&tail = tmp->back();
4534 # if (! gn_system_verilog()) {
4535 # yyerror(@3, "error: Last element expression ($) "
4536 # "requires SystemVerilog. Try enabling SystemVerilog.");
4538 # index_component_t itmp;
4539 # itmp.sel = index_component_t::SEL_BIT_LAST;
4542 # tail.index.push_back(itmp);
4546 def p_hierarchy_identifier_5(p
):
4547 '''hierarchy_identifier : hierarchy_identifier '[' expression ':' expression ']' '''
4548 print('hierarchy_identifier_5', list(p
))
4549 # { pform_name_t * tmp = $1;
4550 # name_component_t&tail = tmp->back();
4551 # index_component_t itmp;
4552 # itmp.sel = index_component_t::SEL_PART;
4555 # tail.index.push_back(itmp);
4559 def p_hierarchy_identifier_6(p
):
4560 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_POS expression ']' '''
4561 print('hierarchy_identifier_6', list(p
))
4562 # { pform_name_t * tmp = $1;
4563 # name_component_t&tail = tmp->back();
4564 # index_component_t itmp;
4565 # itmp.sel = index_component_t::SEL_IDX_UP;
4568 # tail.index.push_back(itmp);
4572 def p_hierarchy_identifier_7(p
):
4573 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_NEG expression ']' '''
4574 print('hierarchy_identifier_7', list(p
))
4575 # { pform_name_t * tmp = $1;
4576 # name_component_t&tail = tmp->back();
4577 # index_component_t itmp;
4578 # itmp.sel = index_component_t::SEL_IDX_DO;
4581 # tail.index.push_back(itmp);
4585 def p_list_of_identifiers_1(p
):
4586 '''list_of_identifiers : IDENTIFIER '''
4587 print('list_of_identifiers_1', list(p
))
4588 # { $$ = list_from_identifier($1); }
4590 def p_list_of_identifiers_2(p
):
4591 '''list_of_identifiers : list_of_identifiers ',' IDENTIFIER '''
4592 print('list_of_identifiers_2', list(p
))
4593 # { $$ = list_from_identifier($1, $3); }
4595 def p_list_of_port_identifiers_1(p
):
4596 '''list_of_port_identifiers : IDENTIFIER dimensions_opt '''
4597 print('list_of_port_identifiers_1', list(p
))
4598 # { $$ = make_port_list($1, $2, 0); }
4600 def p_list_of_port_identifiers_2(p
):
4601 '''list_of_port_identifiers : list_of_port_identifiers ',' IDENTIFIER dimensions_opt '''
4602 print('list_of_port_identifiers_2', list(p
))
4603 # { $$ = make_port_list($1, $3, $4, 0); }
4605 def p_list_of_variable_port_identifiers_1(p
):
4606 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '''
4607 print('list_of_variable_port_identifiers_1', list(p
))
4608 # { $$ = make_port_list($1, $2, 0); }
4610 def p_list_of_variable_port_identifiers_2(p
):
4611 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '=' expression '''
4612 print('list_of_variable_port_identifiers_2', list(p
))
4613 # { $$ = make_port_list($1, $2, $4); }
4615 def p_list_of_variable_port_identifiers_3(p
):
4616 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '''
4617 print('list_of_variable_port_identifiers_3', list(p
))
4618 # { $$ = make_port_list($1, $3, $4, 0); }
4620 def p_list_of_variable_port_identifiers_4(p
):
4621 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '=' expression '''
4622 print('list_of_variable_port_identifiers_4', list(p
))
4623 # { $$ = make_port_list($1, $3, $4, $6); }
4625 def p_list_of_ports_1(p
):
4626 '''list_of_ports : port_opt '''
4627 print('list_of_ports_1', list(p
))
4628 # { vector<Module::port_t*>*tmp
4629 # = new vector<Module::port_t*>(1);
4634 def p_list_of_ports_2(p
):
4635 '''list_of_ports : list_of_ports ',' port_opt '''
4636 print('list_of_ports_2', list(p
))
4637 # { vector<Module::port_t*>*tmp = $1;
4638 # tmp->push_back($3);
4642 def p_list_of_port_declarations_1(p
):
4643 '''list_of_port_declarations : port_declaration '''
4644 print('list_of_port_declarations_1', list(p
))
4645 # { vector<Module::port_t*>*tmp
4646 # = new vector<Module::port_t*>(1);
4651 def p_list_of_port_declarations_2(p
):
4652 '''list_of_port_declarations : list_of_port_declarations ',' port_declaration '''
4653 print('list_of_port_declarations_2', list(p
))
4654 # { vector<Module::port_t*>*tmp = $1;
4655 # tmp->push_back($3);
4659 def p_list_of_port_declarations_3(p
):
4660 '''list_of_port_declarations : list_of_port_declarations ',' IDENTIFIER '''
4661 print('list_of_port_declarations_3', list(p
))
4662 # { Module::port_t*ptmp;
4663 # perm_string name = lex_strings.make($3);
4664 # ptmp = pform_module_port_reference(name, @3.text,
4666 # vector<Module::port_t*>*tmp = $1;
4667 # tmp->push_back(ptmp);
4669 # /* Get the port declaration details, the port type
4670 # and what not, from context data stored by the
4671 # last port_declaration rule. */
4672 # pform_module_define_port(@3, name,
4673 # port_declaration_context.port_type,
4674 # port_declaration_context.port_net_type,
4675 # port_declaration_context.data_type, 0);
4680 def p_list_of_port_declarations_4(p
):
4681 '''list_of_port_declarations : list_of_port_declarations ',' '''
4682 print('list_of_port_declarations_4', list(p
))
4684 # yyerror(@2, "error: NULL port declarations are not "
4688 def p_list_of_port_declarations_5(p
):
4689 '''list_of_port_declarations : list_of_port_declarations ';' '''
4690 print('list_of_port_declarations_5', list(p
))
4692 # yyerror(@2, "error: ';' is an invalid port declaration "
4696 def p_port_declaration_1(p
):
4697 '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4698 print('port_declaration_1', list(p
))
4699 # { Module::port_t*ptmp;
4700 # perm_string name = lex_strings.make($5);
4701 # data_type_t*use_type = $4;
4702 # if ($6) use_type = new uarray_type_t(use_type, $6);
4703 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4704 # pform_module_define_port(@2, name, NetNet::PINPUT, $3, use_type, $1);
4705 # port_declaration_context.port_type = NetNet::PINPUT;
4706 # port_declaration_context.port_net_type = $3;
4707 # port_declaration_context.data_type = $4;
4712 def p_port_declaration_2(p
):
4713 '''port_declaration : attribute_list_opt K_input K_wreal IDENTIFIER '''
4714 print('port_declaration_2', list(p
))
4715 # { Module::port_t*ptmp;
4716 # perm_string name = lex_strings.make($4);
4717 # ptmp = pform_module_port_reference(name, @2.text,
4719 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4720 # FILE_NAME(real_type, @3);
4721 # pform_module_define_port(@2, name, NetNet::PINPUT,
4722 # NetNet::WIRE, real_type, $1);
4723 # port_declaration_context.port_type = NetNet::PINPUT;
4724 # port_declaration_context.port_net_type = NetNet::WIRE;
4725 # port_declaration_context.data_type = real_type;
4730 def p_port_declaration_3(p
):
4731 '''port_declaration : attribute_list_opt K_inout net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4732 print('port_declaration_3', list(p
))
4733 # { Module::port_t*ptmp;
4734 # perm_string name = lex_strings.make($5);
4735 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4736 # pform_module_define_port(@2, name, NetNet::PINOUT, $3, $4, $1);
4737 # port_declaration_context.port_type = NetNet::PINOUT;
4738 # port_declaration_context.port_net_type = $3;
4739 # port_declaration_context.data_type = $4;
4742 # yyerror(@6, "sorry: Inout ports with unpacked dimensions not supported.");
4748 def p_port_declaration_4(p
):
4749 '''port_declaration : attribute_list_opt K_inout K_wreal IDENTIFIER '''
4750 print('port_declaration_4', list(p
))
4751 # { Module::port_t*ptmp;
4752 # perm_string name = lex_strings.make($4);
4753 # ptmp = pform_module_port_reference(name, @2.text,
4755 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4756 # FILE_NAME(real_type, @3);
4757 # pform_module_define_port(@2, name, NetNet::PINOUT,
4758 # NetNet::WIRE, real_type, $1);
4759 # port_declaration_context.port_type = NetNet::PINOUT;
4760 # port_declaration_context.port_net_type = NetNet::WIRE;
4761 # port_declaration_context.data_type = real_type;
4766 def p_port_declaration_5(p
):
4767 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4768 print('port_declaration_5', list(p
))
4769 # { Module::port_t*ptmp;
4770 # perm_string name = lex_strings.make($5);
4771 # data_type_t*use_dtype = $4;
4772 # if ($6) use_dtype = new uarray_type_t(use_dtype, $6);
4773 # NetNet::Type use_type = $3;
4774 # if (use_type == NetNet::IMPLICIT) {
4775 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($4)) {
4776 # if (dtype->reg_flag)
4777 # use_type = NetNet::REG;
4778 # else if (dtype->implicit_flag)
4779 # use_type = NetNet::IMPLICIT;
4781 # use_type = NetNet::IMPLICIT_REG;
4783 # // The SystemVerilog types that can show up as
4784 # // output ports are implicitly (on the inside)
4785 # // variables because "reg" is not valid syntax
4787 # } else if (dynamic_cast<atom2_type_t*> ($4)) {
4788 # use_type = NetNet::IMPLICIT_REG;
4789 # } else if (dynamic_cast<struct_type_t*> ($4)) {
4790 # use_type = NetNet::IMPLICIT_REG;
4791 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> ($4)) {
4792 # if(etype->base_type == IVL_VT_LOGIC)
4793 # use_type = NetNet::IMPLICIT_REG;
4796 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4797 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, use_dtype, $1);
4798 # port_declaration_context.port_type = NetNet::POUTPUT;
4799 # port_declaration_context.port_net_type = use_type;
4800 # port_declaration_context.data_type = $4;
4805 def p_port_declaration_6(p
):
4806 '''port_declaration : attribute_list_opt K_output K_wreal IDENTIFIER '''
4807 print('port_declaration_6', list(p
))
4808 # { Module::port_t*ptmp;
4809 # perm_string name = lex_strings.make($4);
4810 # ptmp = pform_module_port_reference(name, @2.text,
4812 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4813 # FILE_NAME(real_type, @3);
4814 # pform_module_define_port(@2, name, NetNet::POUTPUT,
4815 # NetNet::WIRE, real_type, $1);
4816 # port_declaration_context.port_type = NetNet::POUTPUT;
4817 # port_declaration_context.port_net_type = NetNet::WIRE;
4818 # port_declaration_context.data_type = real_type;
4823 def p_port_declaration_7(p
):
4824 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER '=' expression '''
4825 print('port_declaration_7', list(p
))
4826 # { Module::port_t*ptmp;
4827 # perm_string name = lex_strings.make($5);
4828 # NetNet::Type use_type = $3;
4829 # if (use_type == NetNet::IMPLICIT) {
4830 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($4)) {
4831 # if (dtype->reg_flag)
4832 # use_type = NetNet::REG;
4834 # use_type = NetNet::IMPLICIT_REG;
4836 # use_type = NetNet::IMPLICIT_REG;
4839 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4840 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, $4, $1);
4841 # port_declaration_context.port_type = NetNet::PINOUT;
4842 # port_declaration_context.port_net_type = use_type;
4843 # port_declaration_context.data_type = $4;
4845 # pform_make_var_init(@5, name, $7);
4851 def p_net_type_opt_1(p
):
4852 '''net_type_opt : net_type '''
4853 print('net_type_opt_1', list(p
))
4856 def p_net_type_opt_2(p
):
4857 '''net_type_opt : '''
4858 print('net_type_opt_2', list(p
))
4859 # { $$ = NetNet::IMPLICIT; }
4861 def p_unsigned_signed_opt_1(p
):
4862 '''unsigned_signed_opt : K_signed '''
4863 print('unsigned_signed_opt_1', list(p
))
4866 def p_unsigned_signed_opt_2(p
):
4867 '''unsigned_signed_opt : K_unsigned '''
4868 print('unsigned_signed_opt_2', list(p
))
4871 def p_unsigned_signed_opt_3(p
):
4872 '''unsigned_signed_opt : '''
4873 print('unsigned_signed_opt_3', list(p
))
4876 def p_signed_unsigned_opt_1(p
):
4877 '''signed_unsigned_opt : K_signed '''
4878 print('signed_unsigned_opt_1', list(p
))
4881 def p_signed_unsigned_opt_2(p
):
4882 '''signed_unsigned_opt : K_unsigned '''
4883 print('signed_unsigned_opt_2', list(p
))
4886 def p_signed_unsigned_opt_3(p
):
4887 '''signed_unsigned_opt : '''
4888 print('signed_unsigned_opt_3', list(p
))
4891 def p_atom2_type_1(p
):
4892 '''atom2_type : K_byte '''
4893 print('atom2_type_1', list(p
))
4896 def p_atom2_type_2(p
):
4897 '''atom2_type : K_shortint '''
4898 print('atom2_type_2', list(p
))
4901 def p_atom2_type_3(p
):
4902 '''atom2_type : K_int '''
4903 print('atom2_type_3', list(p
))
4906 def p_atom2_type_4(p
):
4907 '''atom2_type : K_longint '''
4908 print('atom2_type_4', list(p
))
4912 '''lpvalue : hierarchy_identifier '''
4913 print('lpvalue_1', list(p
))
4915 # { PEIdent*tmp = pform_new_ident(*$1);
4916 # FILE_NAME(tmp, @1);
4922 '''lpvalue : implicit_class_handle '.' hierarchy_identifier '''
4923 print('lpvalue_2', list(p
))
4924 # { pform_name_t*t_name = $1;
4925 # while (!$3->empty()) {
4926 # t_name->push_back($3->front());
4929 # PEIdent*tmp = new PEIdent(*t_name);
4930 # FILE_NAME(tmp, @1);
4937 '''lpvalue : '{' expression_list_proper '}' '''
4938 print('lpvalue_3', list(p
))
4939 # { PEConcat*tmp = new PEConcat(*$2);
4940 # FILE_NAME(tmp, @1);
4946 '''lpvalue : streaming_concatenation '''
4947 print('lpvalue_4', list(p
))
4948 # { yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
4952 def p_cont_assign_1(p
):
4953 '''cont_assign : lpvalue '=' expression '''
4954 print('cont_assign_1', list(p
))
4955 # { list<PExpr*>*tmp = new list<PExpr*>;
4956 # tmp->push_back($1);
4957 # tmp->push_back($3);
4961 def p_cont_assign_list_1(p
):
4962 '''cont_assign_list : cont_assign_list ',' cont_assign '''
4963 print('cont_assign_list_1', list(p
))
4964 # { list<PExpr*>*tmp = $1;
4965 # tmp->splice(tmp->end(), *$3);
4970 def p_cont_assign_list_2(p
):
4971 '''cont_assign_list : cont_assign '''
4972 print('cont_assign_list_2', list(p
))
4976 '''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 '''
4977 print('module_1', list(p
))
4979 clsname
= [Leaf(token
.NAME
, 'class'),
4980 Leaf(token
.NAME
, p
[4], prefix
=' '),
4981 Leaf(token
.COLON
, ':')]
4982 pass_stmt
= Node(syms
.pass_stmt
, [Leaf(token
.NAME
, "pass"),])
4984 params
= [Leaf(token
.LPAR
, '(')] + params
+ [Leaf(token
.RPAR
, ')')]
4985 fn
= [Leaf(token
.NAME
, 'def'),
4986 Leaf(token
.NAME
, '__init__', prefix
=' '),
4987 Node(syms
.parameters
, params
),
4988 Leaf(token
.COLON
, ':')]
4989 fndef
= Node(syms
.funcdef
, fn
)
4990 stmts
= Node(syms
.stmt
, [fndef
])
4992 stmts
= Node(syms
.small_stmt
, [pass_stmt
, Leaf(token
.NEWLINE
, '\n')])
4993 stmts
= Node(syms
.stmt
, [stmts
])
4994 suite
= Node(syms
.suite
, [Leaf(token
.NEWLINE
, '\n'),
4995 Leaf(token
.INDENT
, ' '),
4997 Leaf(token
.DEDENT
, '')
4999 clsdecl
= Node(syms
.classdef
, clsname
+ [suite
],
5000 prefix
='', fixers_applied
=[])
5001 clsdecl
= Node(syms
.compound_stmt
, [clsdecl
])
5002 print ("clsdecl", repr(clsdecl
))
5004 print (str(clsdecl
))
5006 # { // Last step: check any closing name. This is done late so
5007 # // that the parser can look ahead to detect the present
5008 # // endlabel_opt but still have the pform_endmodule() called
5009 # // early enough that the lexor can know we are outside the
5012 # if (strcmp($4,$17) != 0) {
5015 # yyerror(@17, "error: End label doesn't match "
5019 # yyerror(@17, "error: End label doesn't match "
5023 # yyerror(@17, "error: End label doesn't match "
5024 # "interface name.");
5030 # if (($2 == K_module) && (! gn_system_verilog())) {
5031 # yyerror(@8, "error: Module end labels require "
5032 # "SystemVerilog.");
5039 def p__embed0_module(p
):
5040 '''_embed0_module : '''
5041 # { pform_startmodule(@2, $4, $2==K_program, $2==K_interface, $3, $1); }
5043 def p__embed1_module(p
):
5044 '''_embed1_module : '''
5045 # { pform_module_set_ports($8); }
5047 def p__embed2_module(p
):
5048 '''_embed2_module : '''
5049 # { pform_set_scope_timescale(@2); }
5051 def p__embed3_module(p
):
5052 '''_embed3_module : '''
5053 # { Module::UCDriveType ucd;
5054 # // The lexor detected `unconnected_drive directives and
5055 # // marked what it found in the uc_drive variable. Use that
5056 # // to generate a UCD flag for the module.
5057 # switch (uc_drive) {
5060 # ucd = Module::UCD_NONE;
5063 # ucd = Module::UCD_PULL0;
5066 # ucd = Module::UCD_PULL1;
5069 # // Check that program/endprogram and module/endmodule
5070 # // keywords match.
5074 # yyerror(@15, "error: module not closed by endmodule.");
5077 # yyerror(@15, "error: program not closed by endprogram.");
5080 # yyerror(@15, "error: interface not closed by endinterface.");
5086 # pform_endmodule($4, in_celldefine, ucd);
5089 def p_module_start_1(p
):
5090 '''module_start : K_module '''
5091 print('module_start_1', list(p
))
5092 # { $$ = K_module; }
5094 def p_module_start_2(p
):
5095 '''module_start : K_macromodule '''
5096 print('module_start_2', list(p
))
5097 # { $$ = K_module; }
5099 def p_module_start_3(p
):
5100 '''module_start : K_program '''
5101 print('module_start_3', list(p
))
5102 # { $$ = K_program; }
5104 def p_module_start_4(p
):
5105 '''module_start : K_interface '''
5106 print('module_start_4', list(p
))
5107 # { $$ = K_interface; }
5109 def p_module_end_1(p
):
5110 '''module_end : K_endmodule '''
5111 print('module_end_1', list(p
))
5112 # { $$ = K_module; }
5114 def p_module_end_2(p
):
5115 '''module_end : K_endprogram '''
5116 print('module_end_2', list(p
))
5117 # { $$ = K_program; }
5119 def p_module_end_3(p
):
5120 '''module_end : K_endinterface '''
5121 print('module_end_3', list(p
))
5122 # { $$ = K_interface; }
5124 def p_endlabel_opt_1(p
):
5125 '''endlabel_opt : ':' IDENTIFIER '''
5126 print('endlabel_opt_1', list(p
))
5129 def p_endlabel_opt_2(p
):
5130 '''endlabel_opt : '''
5131 print('endlabel_opt_2', list(p
))
5134 def p_module_attribute_foreign_1(p
):
5135 '''module_attribute_foreign : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP '''
5136 print('module_attribute_foreign_1', list(p
))
5139 def p_module_attribute_foreign_2(p
):
5140 '''module_attribute_foreign : '''
5141 print('module_attribute_foreign_2', list(p
))
5144 def p_module_port_list_opt_1(p
):
5145 '''module_port_list_opt : '(' list_of_ports ')' '''
5146 print('module_port_list_opt_1', list(p
))
5149 def p_module_port_list_opt_2(p
):
5150 '''module_port_list_opt : '(' list_of_port_declarations ')' '''
5151 print('module_port_list_opt_2', list(p
))
5154 def p_module_port_list_opt_3(p
):
5155 '''module_port_list_opt : '''
5156 print('module_port_list_opt_3', list(p
))
5159 def p_module_port_list_opt_4(p
):
5160 '''module_port_list_opt : '(' error ')' '''
5161 print('module_port_list_opt_4', list(p
))
5162 # { yyerror(@2, "Errors in port declarations.");
5167 def p_module_parameter_port_list_opt_1(p
):
5168 '''module_parameter_port_list_opt : '''
5169 print('module_parameter_port_list_opt_1', list(p
))
5171 def p_module_parameter_port_list_opt_2(p
):
5172 '''module_parameter_port_list_opt : '#' '(' module_parameter_port_list ')' '''
5173 print('module_parameter_port_list_opt_2', list(p
))
5176 def p_module_parameter_port_list_1(p
):
5177 '''module_parameter_port_list : K_parameter param_type parameter_assign '''
5178 print('module_parameter_port_list_1', list(p
))
5181 def p_module_parameter_port_list_2(p
):
5182 '''module_parameter_port_list : module_parameter_port_list ',' parameter_assign '''
5183 print('module_parameter_port_list_2', list(p
))
5184 p
[0] = p
[1].append(p
[3])
5186 def p_module_parameter_port_list_3(p
):
5187 '''module_parameter_port_list : module_parameter_port_list ',' K_parameter param_type parameter_assign '''
5188 print('module_parameter_port_list_3', list(p
))
5189 p
[1].append(Leaf(token
.COMMA
, ','))
5190 p
[5].prefix
=' ' # add a space after the comma, must go in the parameter
5194 def p_module_item_1(p
):
5195 '''module_item : module '''
5196 print('module_item_1', list(p
))
5198 def p_module_item_2(p
):
5199 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' '''
5200 print('module_item_2', list(p
))
5201 # { data_type_t*data_type = $3;
5202 # if (data_type == 0) {
5203 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5204 # FILE_NAME(data_type, @2);
5206 # pform_set_data_type(@2, data_type, $5, $2, $1);
5208 # yyerror(@2, "sorry: net delays not supported.");
5214 def p_module_item_3(p
):
5215 '''module_item : attribute_list_opt K_wreal delay3 net_variable_list ';' '''
5216 print('module_item_3', list(p
))
5217 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5218 # pform_set_data_type(@2, tmpt, $4, NetNet::WIRE, $1);
5220 # yyerror(@3, "sorry: net delays not supported.");
5226 def p_module_item_4(p
):
5227 '''module_item : attribute_list_opt K_wreal net_variable_list ';' '''
5228 print('module_item_4', list(p
))
5229 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5230 # pform_set_data_type(@2, tmpt, $3, NetNet::WIRE, $1);
5234 def p_module_item_5(p
):
5235 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_decl_assigns ';' '''
5236 print('module_item_5', list(p
))
5237 # { data_type_t*data_type = $3;
5238 # if (data_type == 0) {
5239 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5240 # FILE_NAME(data_type, @2);
5242 # pform_makewire(@2, $4, str_strength, $5, $2, data_type);
5244 # yywarn(@2, "Attributes are not supported on net declaration "
5245 # "assignments and will be discarded.");
5250 def p_module_item_6(p
):
5251 '''module_item : attribute_list_opt net_type data_type_or_implicit drive_strength net_decl_assigns ';' '''
5252 print('module_item_6', list(p
))
5253 # { data_type_t*data_type = $3;
5254 # if (data_type == 0) {
5255 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5256 # FILE_NAME(data_type, @2);
5258 # pform_makewire(@2, 0, $4, $5, $2, data_type);
5260 # yywarn(@2, "Attributes are not supported on net declaration "
5261 # "assignments and will be discarded.");
5266 def p_module_item_7(p
):
5267 '''module_item : attribute_list_opt K_wreal net_decl_assigns ';' '''
5268 print('module_item_7', list(p
))
5269 # { real_type_t*data_type = new real_type_t(real_type_t::REAL);
5270 # pform_makewire(@2, 0, str_strength, $3, NetNet::WIRE, data_type);
5272 # yywarn(@2, "Attributes are not supported on net declaration "
5273 # "assignments and will be discarded.");
5278 def p_module_item_8(p
):
5279 '''module_item : K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' '''
5280 print('module_item_8', list(p
))
5281 # { yyerror(@1, "sorry: trireg nets not supported.");
5286 def p_module_item_9(p
):
5287 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit list_of_port_identifiers ';' '''
5288 print('module_item_9', list(p
))
5289 # { pform_module_define_port(@2, $5, $2, $3, $4, $1); }
5291 def p_module_item_10(p
):
5292 '''module_item : attribute_list_opt port_direction K_wreal list_of_port_identifiers ';' '''
5293 print('module_item_10', list(p
))
5294 # { real_type_t*real_type = new real_type_t(real_type_t::REAL);
5295 # pform_module_define_port(@2, $4, $2, NetNet::WIRE, real_type, $1);
5298 def p_module_item_11(p
):
5299 '''module_item : attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' '''
5300 print('module_item_11', list(p
))
5301 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5302 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5303 # if (dtype->implicit_flag)
5304 # use_type = NetNet::NONE;
5306 # if (use_type == NetNet::NONE)
5307 # pform_set_port_type(@2, $4, NetNet::PINOUT, $3, $1);
5309 # pform_module_define_port(@2, $4, NetNet::PINOUT, use_type, $3, $1);
5312 def p_module_item_12(p
):
5313 '''module_item : attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' '''
5314 print('module_item_12', list(p
))
5315 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5316 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5317 # if (dtype->implicit_flag)
5318 # use_type = NetNet::NONE;
5320 # if (use_type == NetNet::NONE)
5321 # pform_set_port_type(@2, $4, NetNet::PINPUT, $3, $1);
5323 # pform_module_define_port(@2, $4, NetNet::PINPUT, use_type, $3, $1);
5326 def p_module_item_13(p
):
5327 '''module_item : attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' '''
5328 print('module_item_13', list(p
))
5329 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5330 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5331 # if (dtype->implicit_flag)
5332 # use_type = NetNet::NONE;
5333 # else if (dtype->reg_flag)
5334 # use_type = NetNet::REG;
5336 # use_type = NetNet::IMPLICIT_REG;
5338 # // The SystemVerilog types that can show up as
5339 # // output ports are implicitly (on the inside)
5340 # // variables because "reg" is not valid syntax
5342 # } else if (dynamic_cast<atom2_type_t*> ($3)) {
5343 # use_type = NetNet::IMPLICIT_REG;
5344 # } else if (dynamic_cast<struct_type_t*> ($3)) {
5345 # use_type = NetNet::IMPLICIT_REG;
5346 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> ($3)) {
5347 # if(etype->base_type == IVL_VT_LOGIC)
5348 # use_type = NetNet::IMPLICIT_REG;
5350 # if (use_type == NetNet::NONE)
5351 # pform_set_port_type(@2, $4, NetNet::POUTPUT, $3, $1);
5353 # pform_module_define_port(@2, $4, NetNet::POUTPUT, use_type, $3, $1);
5356 def p_module_item_14(p
):
5357 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit error ';' '''
5358 print('module_item_14', list(p
))
5359 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5360 # if ($1) delete $1;
5361 # if ($4) delete $4;
5365 def p_module_item_15(p
):
5366 '''module_item : attribute_list_opt K_inout data_type_or_implicit error ';' '''
5367 print('module_item_15', list(p
))
5368 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5369 # if ($1) delete $1;
5370 # if ($3) delete $3;
5374 def p_module_item_16(p
):
5375 '''module_item : attribute_list_opt K_input data_type_or_implicit error ';' '''
5376 print('module_item_16', list(p
))
5377 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5378 # if ($1) delete $1;
5379 # if ($3) delete $3;
5383 def p_module_item_17(p
):
5384 '''module_item : attribute_list_opt K_output data_type_or_implicit error ';' '''
5385 print('module_item_17', list(p
))
5386 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5387 # if ($1) delete $1;
5388 # if ($3) delete $3;
5392 def p_module_item_18(p
):
5393 '''module_item : DISCIPLINE_IDENTIFIER list_of_identifiers ';' '''
5394 print('module_item_18', list(p
))
5395 # { pform_attach_discipline(@1, $1, $2); }
5397 def p_module_item_19(p
):
5398 '''module_item : attribute_list_opt _embed0_module_item block_item_decl '''
5399 print('module_item_19', list(p
))
5400 # { delete attributes_in_context;
5401 # attributes_in_context = 0;
5404 def p_module_item_20(p
):
5405 '''module_item : K_defparam _embed1_module_item defparam_assign_list ';' '''
5406 print('module_item_20', list(p
))
5408 def p_module_item_21(p
):
5409 '''module_item : attribute_list_opt gatetype gate_instance_list ';' '''
5410 print('module_item_21', list(p
))
5411 # { pform_makegates(@2, $2, str_strength, 0, $3, $1); }
5413 def p_module_item_22(p
):
5414 '''module_item : attribute_list_opt gatetype delay3 gate_instance_list ';' '''
5415 print('module_item_22', list(p
))
5416 # { pform_makegates(@2, $2, str_strength, $3, $4, $1); }
5418 def p_module_item_23(p
):
5419 '''module_item : attribute_list_opt gatetype drive_strength gate_instance_list ';' '''
5420 print('module_item_23', list(p
))
5421 # { pform_makegates(@2, $2, $3, 0, $4, $1); }
5423 def p_module_item_24(p
):
5424 '''module_item : attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';' '''
5425 print('module_item_24', list(p
))
5426 # { pform_makegates(@2, $2, $3, $4, $5, $1); }
5428 def p_module_item_25(p
):
5429 '''module_item : attribute_list_opt switchtype gate_instance_list ';' '''
5430 print('module_item_25', list(p
))
5431 # { pform_makegates(@2, $2, str_strength, 0, $3, $1); }
5433 def p_module_item_26(p
):
5434 '''module_item : attribute_list_opt switchtype delay3 gate_instance_list ';' '''
5435 print('module_item_26', list(p
))
5436 # { pform_makegates(@2, $2, str_strength, $3, $4, $1); }
5438 def p_module_item_27(p
):
5439 '''module_item : K_pullup gate_instance_list ';' '''
5440 print('module_item_27', list(p
))
5441 # { pform_makegates(@1, PGBuiltin::PULLUP, pull_strength, 0, $2, 0); }
5443 def p_module_item_28(p
):
5444 '''module_item : K_pulldown gate_instance_list ';' '''
5445 print('module_item_28', list(p
))
5446 # { pform_makegates(@1, PGBuiltin::PULLDOWN, pull_strength, 0, $2, 0); }
5448 def p_module_item_29(p
):
5449 '''module_item : K_pullup '(' dr_strength1 ')' gate_instance_list ';' '''
5450 print('module_item_29', list(p
))
5451 # { pform_makegates(@1, PGBuiltin::PULLUP, $3, 0, $5, 0); }
5453 def p_module_item_30(p
):
5454 '''module_item : K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5455 print('module_item_30', list(p
))
5456 # { pform_makegates(@1, PGBuiltin::PULLUP, $3, 0, $7, 0); }
5458 def p_module_item_31(p
):
5459 '''module_item : K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5460 print('module_item_31', list(p
))
5461 # { pform_makegates(@1, PGBuiltin::PULLUP, $5, 0, $7, 0); }
5463 def p_module_item_32(p
):
5464 '''module_item : K_pulldown '(' dr_strength0 ')' gate_instance_list ';' '''
5465 print('module_item_32', list(p
))
5466 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $3, 0, $5, 0); }
5468 def p_module_item_33(p
):
5469 '''module_item : K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5470 print('module_item_33', list(p
))
5471 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $5, 0, $7, 0); }
5473 def p_module_item_34(p
):
5474 '''module_item : K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5475 print('module_item_34', list(p
))
5476 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $3, 0, $7, 0); }
5478 def p_module_item_35(p
):
5479 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' '''
5480 print('module_item_35', list(p
))
5481 # { perm_string tmp1 = lex_strings.make($2);
5482 # pform_make_modgates(@2, tmp1, $3, $4, $1);
5486 def p_module_item_36(p
):
5487 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt error ';' '''
5488 print('module_item_36', list(p
))
5489 # { yyerror(@2, "error: Invalid module instantiation");
5491 # if ($1) delete $1;
5494 def p_module_item_37(p
):
5495 '''module_item : K_assign drive_strength_opt delay3_opt cont_assign_list ';' '''
5496 print('module_item_37', list(p
))
5497 # { pform_make_pgassign_list($4, $3, $2, @1.text, @1.first_line); }
5499 def p_module_item_38(p
):
5500 '''module_item : attribute_list_opt K_always statement_item '''
5501 print('module_item_38', list(p
))
5502 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, $3, $1);
5503 # FILE_NAME(tmp, @2);
5506 def p_module_item_39(p
):
5507 '''module_item : attribute_list_opt K_always_comb statement_item '''
5508 print('module_item_39', list(p
))
5509 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_COMB, $3, $1);
5510 # FILE_NAME(tmp, @2);
5513 def p_module_item_40(p
):
5514 '''module_item : attribute_list_opt K_always_ff statement_item '''
5515 print('module_item_40', list(p
))
5516 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, $3, $1);
5517 # FILE_NAME(tmp, @2);
5520 def p_module_item_41(p
):
5521 '''module_item : attribute_list_opt K_always_latch statement_item '''
5522 print('module_item_41', list(p
))
5523 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_LATCH, $3, $1);
5524 # FILE_NAME(tmp, @2);
5527 def p_module_item_42(p
):
5528 '''module_item : attribute_list_opt K_initial statement_item '''
5529 print('module_item_42', list(p
))
5530 # { PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, $3, $1);
5531 # FILE_NAME(tmp, @2);
5534 def p_module_item_43(p
):
5535 '''module_item : attribute_list_opt K_final statement_item '''
5536 print('module_item_43', list(p
))
5537 # { PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, $3, $1);
5538 # FILE_NAME(tmp, @2);
5541 def p_module_item_44(p
):
5542 '''module_item : attribute_list_opt K_analog analog_statement '''
5543 print('module_item_44', list(p
))
5544 # { pform_make_analog_behavior(@2, IVL_PR_ALWAYS, $3); }
5546 def p_module_item_45(p
):
5547 '''module_item : attribute_list_opt assertion_item '''
5548 print('module_item_45', list(p
))
5550 def p_module_item_46(p
):
5551 '''module_item : timeunits_declaration '''
5552 print('module_item_46', list(p
))
5554 def p_module_item_47(p
):
5555 '''module_item : class_declaration '''
5556 print('module_item_47', list(p
))
5558 def p_module_item_48(p
):
5559 '''module_item : task_declaration '''
5560 print('module_item_48', list(p
))
5562 def p_module_item_49(p
):
5563 '''module_item : function_declaration '''
5564 print('module_item_49', list(p
))
5566 def p_module_item_50(p
):
5567 '''module_item : K_generate generate_item_list_opt K_endgenerate '''
5568 print('module_item_50', list(p
))
5569 # { // Test for bad nesting. I understand it, but it is illegal.
5570 # if (pform_parent_generate()) {
5571 # cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
5572 # cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
5573 # cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
5578 def p_module_item_51(p
):
5579 '''module_item : K_genvar list_of_identifiers ';' '''
5580 print('module_item_51', list(p
))
5581 # { pform_genvars(@1, $2); }
5583 def p_module_item_52(p
):
5584 '''module_item : K_for '(' IDENTIFIER '=' expression ';' expression ';' IDENTIFIER '=' expression ')' _embed2_module_item generate_block '''
5585 print('module_item_52', list(p
))
5586 # { pform_endgenerate(); }
5588 def p_module_item_53(p
):
5589 '''module_item : generate_if generate_block_opt K_else _embed3_module_item generate_block '''
5590 print('module_item_53', list(p
))
5591 # { pform_endgenerate(); }
5593 def p_module_item_54(p
):
5594 '''module_item : generate_if generate_block_opt %prec less_than_K_else '''
5595 print('module_item_54', list(p
))
5596 # { pform_endgenerate(); }
5598 def p_module_item_55(p
):
5599 '''module_item : K_case '(' expression ')' _embed4_module_item generate_case_items K_endcase '''
5600 print('module_item_55', list(p
))
5601 # { pform_endgenerate(); }
5603 def p_module_item_56(p
):
5604 '''module_item : modport_declaration '''
5605 print('module_item_56', list(p
))
5607 def p_module_item_57(p
):
5608 '''module_item : package_import_declaration '''
5609 print('module_item_57', list(p
))
5611 def p_module_item_58(p
):
5612 '''module_item : attribute_list_opt K_specparam _embed5_module_item specparam_decl ';' '''
5613 print('module_item_58', list(p
))
5615 def p_module_item_59(p
):
5616 '''module_item : K_specify _embed6_module_item specify_item_list_opt K_endspecify '''
5617 print('module_item_59', list(p
))
5619 def p_module_item_60(p
):
5620 '''module_item : K_specify error K_endspecify '''
5621 print('module_item_60', list(p
))
5622 # { yyerror(@1, "error: syntax error in specify block");
5626 def p_module_item_61(p
):
5627 '''module_item : error ';' '''
5628 print('module_item_61', list(p
))
5629 # { yyerror(@2, "error: invalid module item.");
5633 def p_module_item_62(p
):
5634 '''module_item : K_assign error '=' expression ';' '''
5635 print('module_item_62', list(p
))
5636 # { yyerror(@1, "error: syntax error in left side "
5637 # "of continuous assignment.");
5641 def p_module_item_63(p
):
5642 '''module_item : K_assign error ';' '''
5643 print('module_item_63', list(p
))
5644 # { yyerror(@1, "error: syntax error in "
5645 # "continuous assignment");
5649 def p_module_item_64(p
):
5650 '''module_item : K_function error K_endfunction endlabel_opt '''
5651 print('module_item_64', list(p
))
5652 # { yyerror(@1, "error: I give up on this "
5653 # "function definition.");
5655 # if (!gn_system_verilog()) {
5656 # yyerror(@4, "error: Function end names require "
5657 # "SystemVerilog.");
5664 def p_module_item_65(p
):
5665 '''module_item : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';' '''
5666 print('module_item_65', list(p
))
5667 # { perm_string tmp3 = lex_strings.make($3);
5668 # perm_string tmp5 = lex_strings.make($5);
5669 # pform_set_attrib(tmp3, tmp5, $7);
5674 def p_module_item_66(p
):
5675 '''module_item : KK_attribute '(' error ')' ';' '''
5676 print('module_item_66', list(p
))
5677 # { yyerror(@1, "error: Malformed $attribute parameter list."); }
5679 def p__embed0_module_item(p
):
5680 '''_embed0_module_item : '''
5681 # { attributes_in_context = $1; }
5683 def p__embed1_module_item(p
):
5684 '''_embed1_module_item : '''
5685 # { if (pform_in_interface())
5686 # yyerror(@1, "error: Parameter overrides are not allowed "
5687 # "in interfaces.");
5690 def p__embed2_module_item(p
):
5691 '''_embed2_module_item : '''
5692 # { pform_start_generate_for(@1, $3, $5, $7, $9, $11); }
5694 def p__embed3_module_item(p
):
5695 '''_embed3_module_item : '''
5696 # { pform_start_generate_else(@1); }
5698 def p__embed4_module_item(p
):
5699 '''_embed4_module_item : '''
5700 # { pform_start_generate_case(@1, $3); }
5702 def p__embed5_module_item(p
):
5703 '''_embed5_module_item : '''
5704 # { if (pform_in_interface())
5705 # yyerror(@1, "error: specparam declarations are not allowed "
5706 # "in interfaces.");
5709 def p__embed6_module_item(p
):
5710 '''_embed6_module_item : '''
5711 # { if (pform_in_interface())
5712 # yyerror(@1, "error: specify blocks are not allowed "
5713 # "in interfaces.");
5716 def p_module_item_list_1(p
):
5717 '''module_item_list : module_item_list module_item '''
5718 print('module_item_list_1', list(p
))
5720 def p_module_item_list_2(p
):
5721 '''module_item_list : module_item '''
5722 print('module_item_list_2', list(p
))
5724 def p_module_item_list_opt_1(p
):
5725 '''module_item_list_opt : module_item_list '''
5726 print('module_item_list_opt_1', list(p
))
5728 def p_module_item_list_opt_2(p
):
5729 '''module_item_list_opt : '''
5730 print('module_item_list_opt_2', list(p
))
5732 def p_generate_if_1(p
):
5733 '''generate_if : K_if '(' expression ')' '''
5734 print('generate_if_1', list(p
))
5735 # { pform_start_generate_if(@1, $3); }
5737 def p_generate_case_items_1(p
):
5738 '''generate_case_items : generate_case_items generate_case_item '''
5739 print('generate_case_items_1', list(p
))
5741 def p_generate_case_items_2(p
):
5742 '''generate_case_items : generate_case_item '''
5743 print('generate_case_items_2', list(p
))
5745 def p_generate_case_item_1(p
):
5746 '''generate_case_item : expression_list_proper ':' _embed0_generate_case_item generate_block_opt '''
5747 print('generate_case_item_1', list(p
))
5748 # { pform_endgenerate(); }
5750 def p_generate_case_item_2(p
):
5751 '''generate_case_item : K_default ':' _embed1_generate_case_item generate_block_opt '''
5752 print('generate_case_item_2', list(p
))
5753 # { pform_endgenerate(); }
5755 def p__embed0_generate_case_item(p
):
5756 '''_embed0_generate_case_item : '''
5757 # { pform_generate_case_item(@1, $1); }
5759 def p__embed1_generate_case_item(p
):
5760 '''_embed1_generate_case_item : '''
5761 # { pform_generate_case_item(@1, 0); }
5763 def p_generate_item_1(p
):
5764 '''generate_item : module_item '''
5765 print('generate_item_1', list(p
))
5767 def p_generate_item_2(p
):
5768 '''generate_item : K_begin generate_item_list_opt K_end '''
5769 print('generate_item_2', list(p
))
5770 # { /* Detect and warn about anachronistic begin/end use */
5771 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5773 # cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
5777 def p_generate_item_3(p
):
5778 '''generate_item : K_begin ':' IDENTIFIER _embed0_generate_item generate_item_list_opt K_end '''
5779 print('generate_item_3', list(p
))
5780 # { /* Detect and warn about anachronistic named begin/end use */
5781 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5783 # cerr << @1 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
5785 # pform_endgenerate();
5788 def p__embed0_generate_item(p
):
5789 '''_embed0_generate_item : '''
5791 # pform_start_generate_nblock(@1, $3);
5794 def p_generate_item_list_1(p
):
5795 '''generate_item_list : generate_item_list generate_item '''
5796 print('generate_item_list_1', list(p
))
5798 def p_generate_item_list_2(p
):
5799 '''generate_item_list : generate_item '''
5800 print('generate_item_list_2', list(p
))
5802 def p_generate_item_list_opt_1(p
):
5803 '''generate_item_list_opt : generate_item_list '''
5804 print('generate_item_list_opt_1', list(p
))
5806 def p_generate_item_list_opt_2(p
):
5807 '''generate_item_list_opt : '''
5808 print('generate_item_list_opt_2', list(p
))
5810 def p_generate_block_1(p
):
5811 '''generate_block : module_item '''
5812 print('generate_block_1', list(p
))
5814 def p_generate_block_2(p
):
5815 '''generate_block : K_begin generate_item_list_opt K_end '''
5816 print('generate_block_2', list(p
))
5818 def p_generate_block_3(p
):
5819 '''generate_block : K_begin ':' IDENTIFIER generate_item_list_opt K_end endlabel_opt '''
5820 print('generate_block_3', list(p
))
5821 # { pform_generate_block_name($3);
5823 # if (strcmp($3,$6) != 0) {
5824 # yyerror(@6, "error: End label doesn't match "
5827 # if (! gn_system_verilog()) {
5828 # yyerror(@6, "error: Begin end labels require "
5829 # "SystemVerilog.");
5836 def p_generate_block_opt_1(p
):
5837 '''generate_block_opt : generate_block '''
5838 print('generate_block_opt_1', list(p
))
5840 def p_generate_block_opt_2(p
):
5841 '''generate_block_opt : ';' '''
5842 print('generate_block_opt_2', list(p
))
5844 def p_net_decl_assign_1(p
):
5845 '''net_decl_assign : IDENTIFIER '=' expression '''
5846 print('net_decl_assign_1', list(p
))
5847 # { net_decl_assign_t*tmp = new net_decl_assign_t;
5849 # tmp->name = lex_strings.make($1);
5855 def p_net_decl_assigns_1(p
):
5856 '''net_decl_assigns : net_decl_assigns ',' net_decl_assign '''
5857 print('net_decl_assigns_1', list(p
))
5858 # { net_decl_assign_t*tmp = $1;
5859 # $3->next = tmp->next;
5864 def p_net_decl_assigns_2(p
):
5865 '''net_decl_assigns : net_decl_assign '''
5866 print('net_decl_assigns_2', list(p
))
5870 def p_bit_logic_1(p
):
5871 '''bit_logic : K_logic '''
5872 print('bit_logic_1', list(p
))
5873 # { $$ = IVL_VT_LOGIC; }
5875 def p_bit_logic_2(p
):
5876 '''bit_logic : K_bool '''
5877 print('bit_logic_2', list(p
))
5878 # { $$ = IVL_VT_BOOL; /* Icarus misc */}
5880 def p_bit_logic_3(p
):
5881 '''bit_logic : K_bit '''
5882 print('bit_logic_3', list(p
))
5883 # { $$ = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
5885 def p_bit_logic_opt_1(p
):
5886 '''bit_logic_opt : bit_logic '''
5887 print('bit_logic_opt_1', list(p
))
5889 def p_bit_logic_opt_2(p
):
5890 '''bit_logic_opt : '''
5891 print('bit_logic_opt_2', list(p
))
5892 # { $$ = IVL_VT_NO_TYPE; }
5894 def p_net_type_1(p
):
5895 '''net_type : K_wire '''
5896 print('net_type_1', list(p
))
5897 # { $$ = NetNet::WIRE; }
5899 def p_net_type_2(p
):
5900 '''net_type : K_tri '''
5901 print('net_type_2', list(p
))
5902 # { $$ = NetNet::TRI; }
5904 def p_net_type_3(p
):
5905 '''net_type : K_tri1 '''
5906 print('net_type_3', list(p
))
5907 # { $$ = NetNet::TRI1; }
5909 def p_net_type_4(p
):
5910 '''net_type : K_supply0 '''
5911 print('net_type_4', list(p
))
5912 # { $$ = NetNet::SUPPLY0; }
5914 def p_net_type_5(p
):
5915 '''net_type : K_wand '''
5916 print('net_type_5', list(p
))
5917 # { $$ = NetNet::WAND; }
5919 def p_net_type_6(p
):
5920 '''net_type : K_triand '''
5921 print('net_type_6', list(p
))
5922 # { $$ = NetNet::TRIAND; }
5924 def p_net_type_7(p
):
5925 '''net_type : K_tri0 '''
5926 print('net_type_7', list(p
))
5927 # { $$ = NetNet::TRI0; }
5929 def p_net_type_8(p
):
5930 '''net_type : K_supply1 '''
5931 print('net_type_8', list(p
))
5932 # { $$ = NetNet::SUPPLY1; }
5934 def p_net_type_9(p
):
5935 '''net_type : K_wor '''
5936 print('net_type_9', list(p
))
5937 # { $$ = NetNet::WOR; }
5939 def p_net_type_10(p
):
5940 '''net_type : K_trior '''
5941 print('net_type_10', list(p
))
5942 # { $$ = NetNet::TRIOR; }
5944 def p_net_type_11(p
):
5945 '''net_type : K_wone '''
5946 print('net_type_11', list(p
))
5947 # { $$ = NetNet::UNRESOLVED_WIRE;
5948 # cerr << @1.text << ":" << @1.first_line << ": warning: "
5949 # "'wone' is deprecated, please use 'uwire' "
5950 # "instead." << endl;
5953 def p_net_type_12(p
):
5954 '''net_type : K_uwire '''
5955 print('net_type_12', list(p
))
5956 # { $$ = NetNet::UNRESOLVED_WIRE; }
5958 def p_param_type_1(p
):
5959 '''param_type : bit_logic_opt unsigned_signed_opt dimensions_opt '''
5960 print('param_type_1', list(p
))
5961 # { param_active_range = $3;
5962 # param_active_signed = $2;
5963 # if (($1 == IVL_VT_NO_TYPE) && ($3 != 0))
5964 # param_active_type = IVL_VT_LOGIC;
5966 # param_active_type = $1;
5969 def p_param_type_2(p
):
5970 '''param_type : K_integer '''
5971 print('param_type_2', list(p
))
5972 # { param_active_range = make_range_from_width(integer_width);
5973 # param_active_signed = true;
5974 # param_active_type = IVL_VT_LOGIC;
5977 def p_param_type_3(p
):
5978 '''param_type : K_time '''
5979 print('param_type_3', list(p
))
5980 # { param_active_range = make_range_from_width(64);
5981 # param_active_signed = false;
5982 # param_active_type = IVL_VT_LOGIC;
5985 def p_param_type_4(p
):
5986 '''param_type : real_or_realtime '''
5987 print('param_type_4', list(p
))
5988 # { param_active_range = 0;
5989 # param_active_signed = true;
5990 # param_active_type = IVL_VT_REAL;
5993 def p_param_type_5(p
):
5994 '''param_type : atom2_type '''
5995 print('param_type_5', list(p
))
5996 # { param_active_range = make_range_from_width($1);
5997 # param_active_signed = true;
5998 # param_active_type = IVL_VT_BOOL;
6001 def p_param_type_6(p
):
6002 '''param_type : TYPE_IDENTIFIER '''
6003 print('param_type_6', list(p
))
6004 # { pform_set_param_from_type(@1, $1.type, $1.text, param_active_range,
6005 # param_active_signed, param_active_type);
6009 def p_parameter_assign_list_1(p
):
6010 '''parameter_assign_list : parameter_assign '''
6011 print('parameter_assign_list_1', list(p
))
6013 def p_parameter_assign_list_2(p
):
6014 '''parameter_assign_list : parameter_assign_list ',' parameter_assign '''
6015 print('parameter_assign_list_2', list(p
))
6017 def p_localparam_assign_list_1(p
):
6018 '''localparam_assign_list : localparam_assign '''
6019 print('localparam_assign_list_1', list(p
))
6021 def p_localparam_assign_list_2(p
):
6022 '''localparam_assign_list : localparam_assign_list ',' localparam_assign '''
6023 print('localparam_assign_list_2', list(p
))
6025 def p_parameter_assign_1(p
):
6026 '''parameter_assign : IDENTIFIER '=' expression parameter_value_ranges_opt '''
6027 print('parameter_assign_1', list(p
))
6028 tpname
= Node(syms
.tname
, [Leaf(token
.NAME
, p
[1])])
6029 expr
= Node(syms
.tfpdef
, [tpname
, Leaf(token
.EQUAL
, p
[2]), p
[3] ])
6032 # pform_set_parameter(@1, lex_strings.make($1), param_active_type,
6033 # param_active_signed, param_active_range, tmp, $4);
6037 def p_localparam_assign_1(p
):
6038 '''localparam_assign : IDENTIFIER '=' expression '''
6039 print('localparam_assign_1', list(p
))
6041 # pform_set_localparam(@1, lex_strings.make($1), param_active_type,
6042 # param_active_signed, param_active_range, tmp);
6046 def p_parameter_value_ranges_opt_1(p
):
6047 '''parameter_value_ranges_opt : parameter_value_ranges '''
6048 print('parameter_value_ranges_opt_1', list(p
))
6051 def p_parameter_value_ranges_opt_2(p
):
6052 '''parameter_value_ranges_opt : '''
6053 print('parameter_value_ranges_opt_2', list(p
))
6056 def p_parameter_value_ranges_1(p
):
6057 '''parameter_value_ranges : parameter_value_ranges parameter_value_range '''
6058 print('parameter_value_ranges_1', list(p
))
6059 # { $$ = $2; $$->next = $1; }
6061 def p_parameter_value_ranges_2(p
):
6062 '''parameter_value_ranges : parameter_value_range '''
6063 print('parameter_value_ranges_2', list(p
))
6064 # { $$ = $1; $$->next = 0; }
6066 def p_parameter_value_range_1(p
):
6067 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ']' '''
6068 print('parameter_value_range_1', list(p
))
6069 # { $$ = pform_parameter_value_range($1, false, $3, false, $5); }
6071 def p_parameter_value_range_2(p
):
6072 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ')' '''
6073 print('parameter_value_range_2', list(p
))
6074 # { $$ = pform_parameter_value_range($1, false, $3, true, $5); }
6076 def p_parameter_value_range_3(p
):
6077 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ']' '''
6078 print('parameter_value_range_3', list(p
))
6079 # { $$ = pform_parameter_value_range($1, true, $3, false, $5); }
6081 def p_parameter_value_range_4(p
):
6082 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ')' '''
6083 print('parameter_value_range_4', list(p
))
6084 # { $$ = pform_parameter_value_range($1, true, $3, true, $5); }
6086 def p_parameter_value_range_5(p
):
6087 '''parameter_value_range : K_exclude expression '''
6088 print('parameter_value_range_5', list(p
))
6089 # { $$ = pform_parameter_value_range(true, false, $2, false, $2); }
6091 def p_value_range_expression_1(p
):
6092 '''value_range_expression : expression '''
6093 print('value_range_expression_1', list(p
))
6096 def p_value_range_expression_2(p
):
6097 '''value_range_expression : K_inf '''
6098 print('value_range_expression_2', list(p
))
6101 def p_value_range_expression_3(p
):
6102 '''value_range_expression : '+' K_inf '''
6103 print('value_range_expression_3', list(p
))
6106 def p_value_range_expression_4(p
):
6107 '''value_range_expression : '-' K_inf '''
6108 print('value_range_expression_4', list(p
))
6111 def p_from_exclude_1(p
):
6112 '''from_exclude : K_from '''
6113 print('from_exclude_1', list(p
))
6116 def p_from_exclude_2(p
):
6117 '''from_exclude : K_exclude '''
6118 print('from_exclude_2', list(p
))
6121 def p_parameter_value_opt_1(p
):
6122 '''parameter_value_opt : '#' '(' expression_list_with_nuls ')' '''
6123 print('parameter_value_opt_1', list(p
))
6124 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6125 # tmp->by_order = $3;
6130 def p_parameter_value_opt_2(p
):
6131 '''parameter_value_opt : '#' '(' parameter_value_byname_list ')' '''
6132 print('parameter_value_opt_2', list(p
))
6133 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6134 # tmp->by_order = 0;
6135 # tmp->by_name = $3;
6139 def p_parameter_value_opt_3(p
):
6140 '''parameter_value_opt : '#' DEC_NUMBER '''
6141 print('parameter_value_opt_3', list(p
))
6143 # PENumber*tmp = new PENumber($2);
6144 # FILE_NAME(tmp, @1);
6146 # struct parmvalue_t*lst = new struct parmvalue_t;
6147 # lst->by_order = new list<PExpr*>;
6148 # lst->by_order->push_back(tmp);
6154 def p_parameter_value_opt_4(p
):
6155 '''parameter_value_opt : '#' REALTIME '''
6156 print('parameter_value_opt_4', list(p
))
6158 # PEFNumber*tmp = new PEFNumber($2);
6159 # FILE_NAME(tmp, @1);
6161 # struct parmvalue_t*lst = new struct parmvalue_t;
6162 # lst->by_order = new list<PExpr*>;
6163 # lst->by_order->push_back(tmp);
6168 def p_parameter_value_opt_5(p
):
6169 '''parameter_value_opt : '#' error '''
6170 print('parameter_value_opt_5', list(p
))
6171 # { yyerror(@1, "error: syntax error in parameter value "
6172 # "assignment list.");
6176 def p_parameter_value_opt_6(p
):
6177 '''parameter_value_opt : '''
6178 print('parameter_value_opt_6', list(p
))
6181 def p_parameter_value_byname_1(p
):
6182 '''parameter_value_byname : '.' IDENTIFIER '(' expression ')' '''
6183 print('parameter_value_byname_1', list(p
))
6184 # { named_pexpr_t*tmp = new named_pexpr_t;
6185 # tmp->name = lex_strings.make($2);
6191 def p_parameter_value_byname_2(p
):
6192 '''parameter_value_byname : '.' IDENTIFIER '(' ')' '''
6193 print('parameter_value_byname_2', list(p
))
6194 # { named_pexpr_t*tmp = new named_pexpr_t;
6195 # tmp->name = lex_strings.make($2);
6201 def p_parameter_value_byname_list_1(p
):
6202 '''parameter_value_byname_list : parameter_value_byname '''
6203 print('parameter_value_byname_list_1', list(p
))
6204 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6205 # tmp->push_back(*$1);
6210 def p_parameter_value_byname_list_2(p
):
6211 '''parameter_value_byname_list : parameter_value_byname_list ',' parameter_value_byname '''
6212 print('parameter_value_byname_list_2', list(p
))
6213 # { list<named_pexpr_t>*tmp = $1;
6214 # tmp->push_back(*$3);
6220 '''port : port_reference '''
6221 print('port_1', list(p
))
6225 '''port : '.' IDENTIFIER '(' port_reference ')' '''
6226 print('port_2', list(p
))
6227 # { Module::port_t*tmp = $4;
6228 # tmp->name = lex_strings.make($2);
6234 '''port : '{' port_reference_list '}' '''
6235 print('port_3', list(p
))
6236 # { Module::port_t*tmp = $2;
6237 # tmp->name = perm_string();
6242 '''port : '.' IDENTIFIER '(' '{' port_reference_list '}' ')' '''
6243 print('port_4', list(p
))
6244 # { Module::port_t*tmp = $5;
6245 # tmp->name = lex_strings.make($2);
6250 def p_port_opt_1(p
):
6251 '''port_opt : port '''
6252 print('port_opt_1', list(p
))
6255 def p_port_opt_2(p
):
6257 print('port_opt_2', list(p
))
6260 def p_port_name_1(p
):
6261 '''port_name : '.' IDENTIFIER '(' expression ')' '''
6262 print('port_name_1', list(p
))
6263 # { named_pexpr_t*tmp = new named_pexpr_t;
6264 # tmp->name = lex_strings.make($2);
6270 def p_port_name_2(p
):
6271 '''port_name : '.' IDENTIFIER '(' error ')' '''
6272 print('port_name_2', list(p
))
6273 # { yyerror(@3, "error: invalid port connection expression.");
6274 # named_pexpr_t*tmp = new named_pexpr_t;
6275 # tmp->name = lex_strings.make($2);
6281 def p_port_name_3(p
):
6282 '''port_name : '.' IDENTIFIER '(' ')' '''
6283 print('port_name_3', list(p
))
6284 # { named_pexpr_t*tmp = new named_pexpr_t;
6285 # tmp->name = lex_strings.make($2);
6291 def p_port_name_4(p
):
6292 '''port_name : '.' IDENTIFIER '''
6293 print('port_name_4', list(p
))
6294 # { named_pexpr_t*tmp = new named_pexpr_t;
6295 # tmp->name = lex_strings.make($2);
6296 # tmp->parm = new PEIdent(lex_strings.make($2), true);
6297 # FILE_NAME(tmp->parm, @1);
6302 def p_port_name_5(p
):
6303 '''port_name : K_DOTSTAR '''
6304 print('port_name_5', list(p
))
6305 # { named_pexpr_t*tmp = new named_pexpr_t;
6306 # tmp->name = lex_strings.make("*");
6311 def p_port_name_list_1(p
):
6312 '''port_name_list : port_name_list ',' port_name '''
6313 print('port_name_list_1', list(p
))
6314 # { list<named_pexpr_t>*tmp = $1;
6315 # tmp->push_back(*$3);
6320 def p_port_name_list_2(p
):
6321 '''port_name_list : port_name '''
6322 print('port_name_list_2', list(p
))
6323 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6324 # tmp->push_back(*$1);
6329 def p_port_reference_1(p
):
6330 '''port_reference : IDENTIFIER '''
6331 print('port_reference_1', list(p
))
6332 # { Module::port_t*ptmp;
6333 # perm_string name = lex_strings.make($1);
6334 # ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
6339 def p_port_reference_2(p
):
6340 '''port_reference : IDENTIFIER '[' expression ':' expression ']' '''
6341 print('port_reference_2', list(p
))
6342 # { index_component_t itmp;
6343 # itmp.sel = index_component_t::SEL_PART;
6347 # name_component_t ntmp (lex_strings.make($1));
6348 # ntmp.index.push_back(itmp);
6350 # pform_name_t pname;
6351 # pname.push_back(ntmp);
6353 # PEIdent*wtmp = new PEIdent(pname);
6354 # FILE_NAME(wtmp, @1);
6356 # Module::port_t*ptmp = new Module::port_t;
6357 # ptmp->name = perm_string();
6358 # ptmp->expr.push_back(wtmp);
6364 def p_port_reference_3(p
):
6365 '''port_reference : IDENTIFIER '[' expression ']' '''
6366 print('port_reference_3', list(p
))
6367 # { index_component_t itmp;
6368 # itmp.sel = index_component_t::SEL_BIT;
6372 # name_component_t ntmp (lex_strings.make($1));
6373 # ntmp.index.push_back(itmp);
6375 # pform_name_t pname;
6376 # pname.push_back(ntmp);
6378 # PEIdent*tmp = new PEIdent(pname);
6379 # FILE_NAME(tmp, @1);
6381 # Module::port_t*ptmp = new Module::port_t;
6382 # ptmp->name = perm_string();
6383 # ptmp->expr.push_back(tmp);
6388 def p_port_reference_4(p
):
6389 '''port_reference : IDENTIFIER '[' error ']' '''
6390 print('port_reference_4', list(p
))
6391 # { yyerror(@1, "error: invalid port bit select");
6392 # Module::port_t*ptmp = new Module::port_t;
6393 # PEIdent*wtmp = new PEIdent(lex_strings.make($1));
6394 # FILE_NAME(wtmp, @1);
6395 # ptmp->name = lex_strings.make($1);
6396 # ptmp->expr.push_back(wtmp);
6401 def p_port_reference_list_1(p
):
6402 '''port_reference_list : port_reference '''
6403 print('port_reference_list_1', list(p
))
6406 def p_port_reference_list_2(p
):
6407 '''port_reference_list : port_reference_list ',' port_reference '''
6408 print('port_reference_list_2', list(p
))
6409 # { Module::port_t*tmp = $1;
6410 # append(tmp->expr, $3->expr);
6415 def p_dimensions_opt_1(p
):
6416 '''dimensions_opt : '''
6417 print('dimensions_opt_1', list(p
))
6420 def p_dimensions_opt_2(p
):
6421 '''dimensions_opt : dimensions '''
6422 print('dimensions_opt_2', list(p
))
6425 def p_dimensions_1(p
):
6426 '''dimensions : variable_dimension '''
6427 print('dimensions_1', list(p
))
6430 def p_dimensions_2(p
):
6431 '''dimensions : dimensions variable_dimension '''
6432 print('dimensions_2', list(p
))
6433 # { list<pform_range_t> *tmp = $1;
6435 # tmp->splice(tmp->end(), *$2);
6441 def p_register_variable_1(p
):
6442 '''register_variable : IDENTIFIER dimensions_opt '''
6443 print('register_variable_1', list(p
))
6444 # { perm_string name = lex_strings.make($1);
6445 # pform_makewire(@1, name, NetNet::REG,
6446 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6447 # pform_set_reg_idx(name, $2);
6451 def p_register_variable_2(p
):
6452 '''register_variable : IDENTIFIER dimensions_opt '=' expression '''
6453 print('register_variable_2', list(p
))
6454 # { if (pform_peek_scope()->var_init_needs_explicit_lifetime()
6455 # && (var_lifetime == LexicalScope::INHERITED)) {
6456 # cerr << @3 << ": warning: Static variable initialization requires "
6457 # "explicit lifetime in this context." << endl;
6460 # perm_string name = lex_strings.make($1);
6461 # pform_makewire(@1, name, NetNet::REG,
6462 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6463 # pform_set_reg_idx(name, $2);
6464 # pform_make_var_init(@1, name, $4);
6468 def p_register_variable_list_1(p
):
6469 '''register_variable_list : register_variable '''
6470 print('register_variable_list_1', list(p
))
6471 # { list<perm_string>*tmp = new list<perm_string>;
6472 # tmp->push_back(lex_strings.make($1));
6477 def p_register_variable_list_2(p
):
6478 '''register_variable_list : register_variable_list ',' register_variable '''
6479 print('register_variable_list_2', list(p
))
6480 # { list<perm_string>*tmp = $1;
6481 # tmp->push_back(lex_strings.make($3));
6486 def p_net_variable_1(p
):
6487 '''net_variable : IDENTIFIER dimensions_opt '''
6488 print('net_variable_1', list(p
))
6489 # { perm_string name = lex_strings.make($1);
6490 # pform_makewire(@1, name, NetNet::IMPLICIT,
6491 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6492 # pform_set_reg_idx(name, $2);
6496 def p_net_variable_list_1(p
):
6497 '''net_variable_list : net_variable '''
6498 print('net_variable_list_1', list(p
))
6499 # { list<perm_string>*tmp = new list<perm_string>;
6500 # tmp->push_back(lex_strings.make($1));
6505 def p_net_variable_list_2(p
):
6506 '''net_variable_list : net_variable_list ',' net_variable '''
6507 print('net_variable_list_2', list(p
))
6508 # { list<perm_string>*tmp = $1;
6509 # tmp->push_back(lex_strings.make($3));
6514 def p_event_variable_1(p
):
6515 '''event_variable : IDENTIFIER dimensions_opt '''
6516 print('event_variable_1', list(p
))
6518 # yyerror(@2, "sorry: event arrays are not supported.");
6524 def p_event_variable_list_1(p
):
6525 '''event_variable_list : event_variable '''
6526 print('event_variable_list_1', list(p
))
6527 # { $$ = list_from_identifier($1); }
6529 def p_event_variable_list_2(p
):
6530 '''event_variable_list : event_variable_list ',' event_variable '''
6531 print('event_variable_list_2', list(p
))
6532 # { $$ = list_from_identifier($1, $3); }
6534 def p_specify_item_1(p
):
6535 '''specify_item : K_specparam specparam_decl ';' '''
6536 print('specify_item_1', list(p
))
6538 def p_specify_item_2(p
):
6539 '''specify_item : specify_simple_path_decl ';' '''
6540 print('specify_item_2', list(p
))
6541 # { pform_module_specify_path($1);
6544 def p_specify_item_3(p
):
6545 '''specify_item : specify_edge_path_decl ';' '''
6546 print('specify_item_3', list(p
))
6547 # { pform_module_specify_path($1);
6550 def p_specify_item_4(p
):
6551 '''specify_item : K_if '(' expression ')' specify_simple_path_decl ';' '''
6552 print('specify_item_4', list(p
))
6553 # { PSpecPath*tmp = $5;
6555 # tmp->conditional = true;
6556 # tmp->condition = $3;
6558 # pform_module_specify_path(tmp);
6561 def p_specify_item_5(p
):
6562 '''specify_item : K_if '(' expression ')' specify_edge_path_decl ';' '''
6563 print('specify_item_5', list(p
))
6564 # { PSpecPath*tmp = $5;
6566 # tmp->conditional = true;
6567 # tmp->condition = $3;
6569 # pform_module_specify_path(tmp);
6572 def p_specify_item_6(p
):
6573 '''specify_item : K_ifnone specify_simple_path_decl ';' '''
6574 print('specify_item_6', list(p
))
6575 # { PSpecPath*tmp = $2;
6577 # tmp->conditional = true;
6578 # tmp->condition = 0;
6580 # pform_module_specify_path(tmp);
6583 def p_specify_item_7(p
):
6584 '''specify_item : K_ifnone specify_edge_path_decl ';' '''
6585 print('specify_item_7', list(p
))
6586 # { yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
6587 # "not supported.");
6591 def p_specify_item_8(p
):
6592 '''specify_item : K_Sfullskew '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6593 print('specify_item_8', list(p
))
6598 def p_specify_item_9(p
):
6599 '''specify_item : K_Shold '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6600 print('specify_item_9', list(p
))
6604 def p_specify_item_10(p
):
6605 '''specify_item : K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6606 print('specify_item_10', list(p
))
6611 def p_specify_item_11(p
):
6612 '''specify_item : K_Speriod '(' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6613 print('specify_item_11', list(p
))
6617 def p_specify_item_12(p
):
6618 '''specify_item : K_Srecovery '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6619 print('specify_item_12', list(p
))
6623 def p_specify_item_13(p
):
6624 '''specify_item : K_Srecrem '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6625 print('specify_item_13', list(p
))
6630 def p_specify_item_14(p
):
6631 '''specify_item : K_Sremoval '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6632 print('specify_item_14', list(p
))
6636 def p_specify_item_15(p
):
6637 '''specify_item : K_Ssetup '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6638 print('specify_item_15', list(p
))
6642 def p_specify_item_16(p
):
6643 '''specify_item : K_Ssetuphold '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6644 print('specify_item_16', list(p
))
6649 def p_specify_item_17(p
):
6650 '''specify_item : K_Sskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6651 print('specify_item_17', list(p
))
6655 def p_specify_item_18(p
):
6656 '''specify_item : K_Stimeskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6657 print('specify_item_18', list(p
))
6661 def p_specify_item_19(p
):
6662 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ',' expression spec_notifier_opt ')' ';' '''
6663 print('specify_item_19', list(p
))
6668 def p_specify_item_20(p
):
6669 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ')' ';' '''
6670 print('specify_item_20', list(p
))
6674 def p_specify_item_21(p
):
6675 '''specify_item : K_pulsestyle_onevent specify_path_identifiers ';' '''
6676 print('specify_item_21', list(p
))
6680 def p_specify_item_22(p
):
6681 '''specify_item : K_pulsestyle_ondetect specify_path_identifiers ';' '''
6682 print('specify_item_22', list(p
))
6686 def p_specify_item_23(p
):
6687 '''specify_item : K_showcancelled specify_path_identifiers ';' '''
6688 print('specify_item_23', list(p
))
6692 def p_specify_item_24(p
):
6693 '''specify_item : K_noshowcancelled specify_path_identifiers ';' '''
6694 print('specify_item_24', list(p
))
6698 def p_specify_item_list_1(p
):
6699 '''specify_item_list : specify_item '''
6700 print('specify_item_list_1', list(p
))
6702 def p_specify_item_list_2(p
):
6703 '''specify_item_list : specify_item_list specify_item '''
6704 print('specify_item_list_2', list(p
))
6706 def p_specify_item_list_opt_1(p
):
6707 '''specify_item_list_opt : '''
6708 print('specify_item_list_opt_1', list(p
))
6711 def p_specify_item_list_opt_2(p
):
6712 '''specify_item_list_opt : specify_item_list '''
6713 print('specify_item_list_opt_2', list(p
))
6716 def p_specify_edge_path_decl_1(p
):
6717 '''specify_edge_path_decl : specify_edge_path '=' '(' delay_value_list ')' '''
6718 print('specify_edge_path_decl_1', list(p
))
6719 # { $$ = pform_assign_path_delay($1, $4); }
6721 def p_specify_edge_path_decl_2(p
):
6722 '''specify_edge_path_decl : specify_edge_path '=' delay_value_simple '''
6723 print('specify_edge_path_decl_2', list(p
))
6724 # { list<PExpr*>*tmp = new list<PExpr*>;
6725 # tmp->push_back($3);
6726 # $$ = pform_assign_path_delay($1, tmp);
6729 def p_edge_operator_1(p
):
6730 '''edge_operator : K_posedge '''
6731 print('edge_operator_1', list(p
))
6734 def p_edge_operator_2(p
):
6735 '''edge_operator : K_negedge '''
6736 print('edge_operator_2', list(p
))
6739 def p_specify_edge_path_1(p
):
6740 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6741 print('specify_edge_path_1', list(p
))
6742 # { int edge_flag = 0;
6743 # $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, false, $6, $8); }
6745 def p_specify_edge_path_2(p
):
6746 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6747 print('specify_edge_path_2', list(p
))
6748 # { int edge_flag = $2? 1 : -1;
6749 # $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, false, $7, $9);}
6751 def p_specify_edge_path_3(p
):
6752 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6753 print('specify_edge_path_3', list(p
))
6754 # { int edge_flag = 0;
6755 # $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, true, $6, $8); }
6757 def p_specify_edge_path_4(p
):
6758 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6759 print('specify_edge_path_4', list(p
))
6760 # { int edge_flag = $2? 1 : -1;
6761 # $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, true, $7, $9); }
6763 def p_polarity_operator_1(p
):
6764 '''polarity_operator : K_PO_POS '''
6765 print('polarity_operator_1', list(p
))
6767 def p_polarity_operator_2(p
):
6768 '''polarity_operator : K_PO_NEG '''
6769 print('polarity_operator_2', list(p
))
6771 def p_polarity_operator_3(p
):
6772 '''polarity_operator : ':' '''
6773 print('polarity_operator_3', list(p
))
6775 def p_specify_simple_path_decl_1(p
):
6776 '''specify_simple_path_decl : specify_simple_path '=' '(' delay_value_list ')' '''
6777 print('specify_simple_path_decl_1', list(p
))
6778 # { $$ = pform_assign_path_delay($1, $4); }
6780 def p_specify_simple_path_decl_2(p
):
6781 '''specify_simple_path_decl : specify_simple_path '=' delay_value_simple '''
6782 print('specify_simple_path_decl_2', list(p
))
6783 # { list<PExpr*>*tmp = new list<PExpr*>;
6784 # tmp->push_back($3);
6785 # $$ = pform_assign_path_delay($1, tmp);
6788 def p_specify_simple_path_decl_3(p
):
6789 '''specify_simple_path_decl : specify_simple_path '=' '(' error ')' '''
6790 print('specify_simple_path_decl_3', list(p
))
6791 # { yyerror(@3, "Syntax error in delay value list.");
6796 def p_specify_simple_path_1(p
):
6797 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' '''
6798 print('specify_simple_path_1', list(p
))
6799 # { $$ = pform_make_specify_path(@1, $2, $3, false, $5); }
6801 def p_specify_simple_path_2(p
):
6802 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' '''
6803 print('specify_simple_path_2', list(p
))
6804 # { $$ = pform_make_specify_path(@1, $2, $3, true, $5); }
6806 def p_specify_simple_path_3(p
):
6807 '''specify_simple_path : '(' error ')' '''
6808 print('specify_simple_path_3', list(p
))
6809 # { yyerror(@1, "Invalid simple path");
6813 def p_specify_path_identifiers_1(p
):
6814 '''specify_path_identifiers : IDENTIFIER '''
6815 print('specify_path_identifiers_1', list(p
))
6816 # { list<perm_string>*tmp = new list<perm_string>;
6817 # tmp->push_back(lex_strings.make($1));
6822 def p_specify_path_identifiers_2(p
):
6823 '''specify_path_identifiers : IDENTIFIER '[' expr_primary ']' '''
6824 print('specify_path_identifiers_2', list(p
))
6825 # { if (gn_specify_blocks_flag) {
6826 # yywarn(@4, "Bit selects are not currently supported "
6827 # "in path declarations. The declaration "
6828 # "will be applied to the whole vector.");
6830 # list<perm_string>*tmp = new list<perm_string>;
6831 # tmp->push_back(lex_strings.make($1));
6836 def p_specify_path_identifiers_3(p
):
6837 '''specify_path_identifiers : IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6838 print('specify_path_identifiers_3', list(p
))
6839 # { if (gn_specify_blocks_flag) {
6840 # yywarn(@4, "Part selects are not currently supported "
6841 # "in path declarations. The declaration "
6842 # "will be applied to the whole vector.");
6844 # list<perm_string>*tmp = new list<perm_string>;
6845 # tmp->push_back(lex_strings.make($1));
6850 def p_specify_path_identifiers_4(p
):
6851 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '''
6852 print('specify_path_identifiers_4', list(p
))
6853 # { list<perm_string>*tmp = $1;
6854 # tmp->push_back(lex_strings.make($3));
6859 def p_specify_path_identifiers_5(p
):
6860 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' '''
6861 print('specify_path_identifiers_5', list(p
))
6862 # { if (gn_specify_blocks_flag) {
6863 # yywarn(@4, "Bit selects are not currently supported "
6864 # "in path declarations. The declaration "
6865 # "will be applied to the whole vector.");
6867 # list<perm_string>*tmp = $1;
6868 # tmp->push_back(lex_strings.make($3));
6873 def p_specify_path_identifiers_6(p
):
6874 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6875 print('specify_path_identifiers_6', list(p
))
6876 # { if (gn_specify_blocks_flag) {
6877 # yywarn(@4, "Part selects are not currently supported "
6878 # "in path declarations. The declaration "
6879 # "will be applied to the whole vector.");
6881 # list<perm_string>*tmp = $1;
6882 # tmp->push_back(lex_strings.make($3));
6887 def p_specparam_1(p
):
6888 '''specparam : IDENTIFIER '=' expression '''
6889 print('specparam_1', list(p
))
6891 # pform_set_specparam(@1, lex_strings.make($1),
6892 # param_active_range, tmp);
6896 def p_specparam_2(p
):
6897 '''specparam : IDENTIFIER '=' expression ':' expression ':' expression '''
6898 print('specparam_2', list(p
))
6900 # switch (min_typ_max_flag) {
6917 # if (min_typ_max_warn > 0) {
6918 # cerr << tmp->get_fileline() << ": warning: choosing ";
6919 # switch (min_typ_max_flag) {
6930 # cerr << " expression." << endl;
6931 # min_typ_max_warn -= 1;
6933 # pform_set_specparam(@1, lex_strings.make($1),
6934 # param_active_range, tmp);
6938 def p_specparam_3(p
):
6939 '''specparam : PATHPULSE_IDENTIFIER '=' expression '''
6940 print('specparam_3', list(p
))
6945 def p_specparam_4(p
):
6946 '''specparam : PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' '''
6947 print('specparam_4', list(p
))
6953 def p_specparam_list_1(p
):
6954 '''specparam_list : specparam '''
6955 print('specparam_list_1', list(p
))
6957 def p_specparam_list_2(p
):
6958 '''specparam_list : specparam_list ',' specparam '''
6959 print('specparam_list_2', list(p
))
6961 def p_specparam_decl_1(p
):
6962 '''specparam_decl : specparam_list '''
6963 print('specparam_decl_1', list(p
))
6965 def p_specparam_decl_2(p
):
6966 '''specparam_decl : dimensions _embed0_specparam_decl specparam_list '''
6967 print('specparam_decl_2', list(p
))
6968 # { param_active_range = 0; }
6970 def p__embed0_specparam_decl(p
):
6971 '''_embed0_specparam_decl : '''
6972 # { param_active_range = $1; }
6974 def p_spec_polarity_1(p
):
6975 '''spec_polarity : '+' '''
6976 print('spec_polarity_1', list(p
))
6979 def p_spec_polarity_2(p
):
6980 '''spec_polarity : '-' '''
6981 print('spec_polarity_2', list(p
))
6984 def p_spec_polarity_3(p
):
6985 '''spec_polarity : '''
6986 print('spec_polarity_3', list(p
))
6989 def p_spec_reference_event_1(p
):
6990 '''spec_reference_event : K_posedge expression '''
6991 print('spec_reference_event_1', list(p
))
6994 def p_spec_reference_event_2(p
):
6995 '''spec_reference_event : K_negedge expression '''
6996 print('spec_reference_event_2', list(p
))
6999 def p_spec_reference_event_3(p
):
7000 '''spec_reference_event : K_posedge expr_primary K_TAND expression '''
7001 print('spec_reference_event_3', list(p
))
7006 def p_spec_reference_event_4(p
):
7007 '''spec_reference_event : K_negedge expr_primary K_TAND expression '''
7008 print('spec_reference_event_4', list(p
))
7013 def p_spec_reference_event_5(p
):
7014 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary '''
7015 print('spec_reference_event_5', list(p
))
7018 def p_spec_reference_event_6(p
):
7019 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression '''
7020 print('spec_reference_event_6', list(p
))
7025 def p_spec_reference_event_7(p
):
7026 '''spec_reference_event : expr_primary K_TAND expression '''
7027 print('spec_reference_event_7', list(p
))
7032 def p_spec_reference_event_8(p
):
7033 '''spec_reference_event : expr_primary '''
7034 print('spec_reference_event_8', list(p
))
7037 def p_edge_descriptor_list_1(p
):
7038 '''edge_descriptor_list : edge_descriptor_list ',' K_edge_descriptor '''
7039 print('edge_descriptor_list_1', list(p
))
7041 def p_edge_descriptor_list_2(p
):
7042 '''edge_descriptor_list : K_edge_descriptor '''
7043 print('edge_descriptor_list_2', list(p
))
7045 def p_spec_notifier_opt_1(p
):
7046 '''spec_notifier_opt : '''
7047 print('spec_notifier_opt_1', list(p
))
7050 def p_spec_notifier_opt_2(p
):
7051 '''spec_notifier_opt : spec_notifier '''
7052 print('spec_notifier_opt_2', list(p
))
7055 def p_spec_notifier_1(p
):
7056 '''spec_notifier : ',' '''
7057 print('spec_notifier_1', list(p
))
7058 # { args_after_notifier = 0; }
7060 def p_spec_notifier_2(p
):
7061 '''spec_notifier : ',' hierarchy_identifier '''
7062 print('spec_notifier_2', list(p
))
7063 # { args_after_notifier = 0; delete $2; }
7065 def p_spec_notifier_3(p
):
7066 '''spec_notifier : spec_notifier ',' '''
7067 print('spec_notifier_3', list(p
))
7068 # { args_after_notifier += 1; }
7070 def p_spec_notifier_4(p
):
7071 '''spec_notifier : spec_notifier ',' hierarchy_identifier '''
7072 print('spec_notifier_4', list(p
))
7073 # { args_after_notifier += 1;
7074 # if (args_after_notifier >= 3) {
7075 # cerr << @3 << ": warning: timing checks are not supported "
7076 # "and delayed signal \"" << *$3
7077 # << "\" will not be driven." << endl;
7081 def p_spec_notifier_5(p
):
7082 '''spec_notifier : IDENTIFIER '''
7083 print('spec_notifier_5', list(p
))
7084 # { args_after_notifier = 0; delete[]$1; }
7086 def p_statement_item_1(p
):
7087 '''statement_item : K_assign lpvalue '=' expression ';' '''
7088 print('statement_item_1', list(p
))
7089 # { PCAssign*tmp = new PCAssign($2, $4);
7090 # FILE_NAME(tmp, @1);
7094 def p_statement_item_2(p
):
7095 '''statement_item : K_deassign lpvalue ';' '''
7096 print('statement_item_2', list(p
))
7097 # { PDeassign*tmp = new PDeassign($2);
7098 # FILE_NAME(tmp, @1);
7102 def p_statement_item_3(p
):
7103 '''statement_item : K_force lpvalue '=' expression ';' '''
7104 print('statement_item_3', list(p
))
7105 # { PForce*tmp = new PForce($2, $4);
7106 # FILE_NAME(tmp, @1);
7110 def p_statement_item_4(p
):
7111 '''statement_item : K_release lpvalue ';' '''
7112 print('statement_item_4', list(p
))
7113 # { PRelease*tmp = new PRelease($2);
7114 # FILE_NAME(tmp, @1);
7118 def p_statement_item_5(p
):
7119 '''statement_item : K_begin K_end '''
7120 print('statement_item_5', list(p
))
7121 # { PBlock*tmp = new PBlock(PBlock::BL_SEQ);
7122 # FILE_NAME(tmp, @1);
7126 def p_statement_item_6(p
):
7127 '''statement_item : K_begin _embed0_statement_item block_item_decls_opt _embed1_statement_item statement_or_null_list K_end '''
7128 print('statement_item_6', list(p
))
7131 # pform_pop_scope();
7132 # assert(! current_block_stack.empty());
7133 # tmp = current_block_stack.top();
7134 # current_block_stack.pop();
7136 # tmp = new PBlock(PBlock::BL_SEQ);
7137 # FILE_NAME(tmp, @1);
7139 # if ($5) tmp->set_statement(*$5);
7144 def p_statement_item_7(p
):
7145 '''statement_item : K_begin ':' IDENTIFIER _embed2_statement_item block_item_decls_opt statement_or_null_list_opt K_end endlabel_opt '''
7146 print('statement_item_7', list(p
))
7147 # { pform_pop_scope();
7148 # assert(! current_block_stack.empty());
7149 # PBlock*tmp = current_block_stack.top();
7150 # current_block_stack.pop();
7151 # if ($6) tmp->set_statement(*$6);
7154 # if (strcmp($3,$8) != 0) {
7155 # yyerror(@8, "error: End label doesn't match begin name");
7157 # if (! gn_system_verilog()) {
7158 # yyerror(@8, "error: Begin end labels require "
7159 # "SystemVerilog.");
7167 def p_statement_item_8(p
):
7168 '''statement_item : K_fork join_keyword '''
7169 print('statement_item_8', list(p
))
7170 # { PBlock*tmp = new PBlock($2);
7171 # FILE_NAME(tmp, @1);
7175 def p_statement_item_9(p
):
7176 '''statement_item : K_fork _embed3_statement_item block_item_decls_opt _embed4_statement_item statement_or_null_list join_keyword '''
7177 print('statement_item_9', list(p
))
7180 # pform_pop_scope();
7181 # assert(! current_block_stack.empty());
7182 # tmp = current_block_stack.top();
7183 # current_block_stack.pop();
7184 # tmp->set_join_type($6);
7186 # tmp = new PBlock($6);
7187 # FILE_NAME(tmp, @1);
7189 # if ($5) tmp->set_statement(*$5);
7194 def p_statement_item_10(p
):
7195 '''statement_item : K_fork ':' IDENTIFIER _embed5_statement_item block_item_decls_opt statement_or_null_list_opt join_keyword endlabel_opt '''
7196 print('statement_item_10', list(p
))
7197 # { pform_pop_scope();
7198 # assert(! current_block_stack.empty());
7199 # PBlock*tmp = current_block_stack.top();
7200 # current_block_stack.pop();
7201 # tmp->set_join_type($7);
7202 # if ($6) tmp->set_statement(*$6);
7205 # if (strcmp($3,$8) != 0) {
7206 # yyerror(@8, "error: End label doesn't match fork name");
7208 # if (! gn_system_verilog()) {
7209 # yyerror(@8, "error: Fork end labels require "
7210 # "SystemVerilog.");
7218 def p_statement_item_11(p
):
7219 '''statement_item : K_disable hierarchy_identifier ';' '''
7220 print('statement_item_11', list(p
))
7221 # { PDisable*tmp = new PDisable(*$2);
7222 # FILE_NAME(tmp, @1);
7227 def p_statement_item_12(p
):
7228 '''statement_item : K_disable K_fork ';' '''
7229 print('statement_item_12', list(p
))
7230 # { pform_name_t tmp_name;
7231 # PDisable*tmp = new PDisable(tmp_name);
7232 # FILE_NAME(tmp, @1);
7236 def p_statement_item_13(p
):
7237 '''statement_item : K_TRIGGER hierarchy_identifier ';' '''
7238 print('statement_item_13', list(p
))
7239 # { PTrigger*tmp = new PTrigger(*$2);
7240 # FILE_NAME(tmp, @1);
7245 def p_statement_item_14(p
):
7246 '''statement_item : procedural_assertion_statement '''
7247 print('statement_item_14', list(p
))
7250 def p_statement_item_15(p
):
7251 '''statement_item : loop_statement '''
7252 print('statement_item_15', list(p
))
7255 def p_statement_item_16(p
):
7256 '''statement_item : jump_statement '''
7257 print('statement_item_16', list(p
))
7260 def p_statement_item_17(p
):
7261 '''statement_item : K_case '(' expression ')' case_items K_endcase '''
7262 print('statement_item_17', list(p
))
7263 # { PCase*tmp = new PCase(NetCase::EQ, $3, $5);
7264 # FILE_NAME(tmp, @1);
7268 def p_statement_item_18(p
):
7269 '''statement_item : K_casex '(' expression ')' case_items K_endcase '''
7270 print('statement_item_18', list(p
))
7271 # { PCase*tmp = new PCase(NetCase::EQX, $3, $5);
7272 # FILE_NAME(tmp, @1);
7276 def p_statement_item_19(p
):
7277 '''statement_item : K_casez '(' expression ')' case_items K_endcase '''
7278 print('statement_item_19', list(p
))
7279 # { PCase*tmp = new PCase(NetCase::EQZ, $3, $5);
7280 # FILE_NAME(tmp, @1);
7284 def p_statement_item_20(p
):
7285 '''statement_item : K_case '(' expression ')' error K_endcase '''
7286 print('statement_item_20', list(p
))
7289 def p_statement_item_21(p
):
7290 '''statement_item : K_casex '(' expression ')' error K_endcase '''
7291 print('statement_item_21', list(p
))
7294 def p_statement_item_22(p
):
7295 '''statement_item : K_casez '(' expression ')' error K_endcase '''
7296 print('statement_item_22', list(p
))
7299 def p_statement_item_23(p
):
7300 '''statement_item : K_if '(' expression ')' statement_or_null %prec less_than_K_else '''
7301 print('statement_item_23', list(p
))
7302 # { PCondit*tmp = new PCondit($3, $5, 0);
7303 # FILE_NAME(tmp, @1);
7307 def p_statement_item_24(p
):
7308 '''statement_item : K_if '(' expression ')' statement_or_null K_else statement_or_null '''
7309 print('statement_item_24', list(p
))
7310 # { PCondit*tmp = new PCondit($3, $5, $7);
7311 # FILE_NAME(tmp, @1);
7315 def p_statement_item_25(p
):
7316 '''statement_item : K_if '(' error ')' statement_or_null %prec less_than_K_else '''
7317 print('statement_item_25', list(p
))
7318 # { yyerror(@1, "error: Malformed conditional expression.");
7322 def p_statement_item_26(p
):
7323 '''statement_item : K_if '(' error ')' statement_or_null K_else statement_or_null '''
7324 print('statement_item_26', list(p
))
7325 # { yyerror(@1, "error: Malformed conditional expression.");
7329 def p_statement_item_27(p
):
7330 '''statement_item : compressed_statement ';' '''
7331 print('statement_item_27', list(p
))
7334 def p_statement_item_28(p
):
7335 '''statement_item : inc_or_dec_expression ';' '''
7336 print('statement_item_28', list(p
))
7337 # { $$ = pform_compressed_assign_from_inc_dec(@1, $1); }
7339 def p_statement_item_29(p
):
7340 '''statement_item : delay1 statement_or_null '''
7341 print('statement_item_29', list(p
))
7342 # { PExpr*del = $1->front();
7343 # assert($1->size() == 1);
7345 # PDelayStatement*tmp = new PDelayStatement(del, $2);
7346 # FILE_NAME(tmp, @1);
7350 def p_statement_item_30(p
):
7351 '''statement_item : event_control statement_or_null '''
7352 print('statement_item_30', list(p
))
7353 # { PEventStatement*tmp = $1;
7355 # yyerror(@1, "error: Invalid event control.");
7358 # tmp->set_statement($2);
7363 def p_statement_item_31(p
):
7364 '''statement_item : '@' '*' statement_or_null '''
7365 print('statement_item_31', list(p
))
7366 # { PEventStatement*tmp = new PEventStatement;
7367 # FILE_NAME(tmp, @1);
7368 # tmp->set_statement($3);
7372 def p_statement_item_32(p
):
7373 '''statement_item : '@' '(' '*' ')' statement_or_null '''
7374 print('statement_item_32', list(p
))
7375 # { PEventStatement*tmp = new PEventStatement;
7376 # FILE_NAME(tmp, @1);
7377 # tmp->set_statement($5);
7381 def p_statement_item_33(p
):
7382 '''statement_item : lpvalue '=' expression ';' '''
7383 print('statement_item33', list(p
))
7385 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), p
[3] ])
7386 print ("expr TODO", repr(expr
))
7388 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), ])
7389 print ("expr", repr(expr
))
7390 print ("expr (python):'%s'" % expr
)
7392 # { PAssign*tmp = new PAssign($1,$3);
7393 # FILE_NAME(tmp, @1);
7397 def p_statement_item_34(p
):
7398 '''statement_item : error '=' expression ';' '''
7399 print('statement_item_34', list(p
))
7400 # { yyerror(@2, "Syntax in assignment statement l-value.");
7405 def p_statement_item_35(p
):
7406 '''statement_item : lpvalue K_LE expression ';' '''
7407 print('statement_item_35', list(p
))
7408 # { PAssignNB*tmp = new PAssignNB($1,$3);
7409 # FILE_NAME(tmp, @1);
7413 def p_statement_item_36(p
):
7414 '''statement_item : error K_LE expression ';' '''
7415 print('statement_item_36', list(p
))
7416 # { yyerror(@2, "Syntax in assignment statement l-value.");
7421 def p_statement_item_37(p
):
7422 '''statement_item : lpvalue '=' delay1 expression ';' '''
7423 print('statement_item_37', list(p
))
7424 # { PExpr*del = $3->front(); $3->pop_front();
7425 # assert($3->empty());
7426 # PAssign*tmp = new PAssign($1,del,$4);
7427 # FILE_NAME(tmp, @1);
7431 def p_statement_item_38(p
):
7432 '''statement_item : lpvalue K_LE delay1 expression ';' '''
7433 print('statement_item_38', list(p
))
7434 # { PExpr*del = $3->front(); $3->pop_front();
7435 # assert($3->empty());
7436 # PAssignNB*tmp = new PAssignNB($1,del,$4);
7437 # FILE_NAME(tmp, @1);
7441 def p_statement_item_39(p
):
7442 '''statement_item : lpvalue '=' event_control expression ';' '''
7443 print('statement_item_39', list(p
))
7444 # { PAssign*tmp = new PAssign($1,0,$3,$4);
7445 # FILE_NAME(tmp, @1);
7449 def p_statement_item_40(p
):
7450 '''statement_item : lpvalue '=' K_repeat '(' expression ')' event_control expression ';' '''
7451 print('statement_item_40', list(p
))
7452 # { PAssign*tmp = new PAssign($1,$5,$7,$8);
7453 # FILE_NAME(tmp,@1);
7454 # tmp->set_lineno(@1.first_line);
7458 def p_statement_item_41(p
):
7459 '''statement_item : lpvalue K_LE event_control expression ';' '''
7460 print('statement_item_41', list(p
))
7461 # { PAssignNB*tmp = new PAssignNB($1,0,$3,$4);
7462 # FILE_NAME(tmp, @1);
7466 def p_statement_item_42(p
):
7467 '''statement_item : lpvalue K_LE K_repeat '(' expression ')' event_control expression ';' '''
7468 print('statement_item_42', list(p
))
7469 # { PAssignNB*tmp = new PAssignNB($1,$5,$7,$8);
7470 # FILE_NAME(tmp, @1);
7474 def p_statement_item_43(p
):
7475 '''statement_item : lpvalue '=' dynamic_array_new ';' '''
7476 print('statement_item_43', list(p
))
7477 # { PAssign*tmp = new PAssign($1,$3);
7478 # FILE_NAME(tmp, @1);
7482 def p_statement_item_44(p
):
7483 '''statement_item : lpvalue '=' class_new ';' '''
7484 print('statement_item_44', list(p
))
7485 # { PAssign*tmp = new PAssign($1,$3);
7486 # FILE_NAME(tmp, @1);
7490 def p_statement_item_45(p
):
7491 '''statement_item : K_wait '(' expression ')' statement_or_null '''
7492 print('statement_item_45', list(p
))
7493 # { PEventStatement*tmp;
7494 # PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, $3);
7495 # tmp = new PEventStatement(etmp);
7496 # FILE_NAME(tmp,@1);
7497 # tmp->set_statement($5);
7501 def p_statement_item_46(p
):
7502 '''statement_item : K_wait K_fork ';' '''
7503 print('statement_item_46', list(p
))
7504 # { PEventStatement*tmp = new PEventStatement((PEEvent*)0);
7505 # FILE_NAME(tmp,@1);
7509 def p_statement_item_47(p
):
7510 '''statement_item : SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';' '''
7511 print('statement_item_47', list(p
))
7512 # { PCallTask*tmp = new PCallTask(lex_strings.make($1), *$3);
7513 # FILE_NAME(tmp,@1);
7519 def p_statement_item_48(p
):
7520 '''statement_item : SYSTEM_IDENTIFIER ';' '''
7521 print('statement_item_48', list(p
))
7523 # PCallTask*tmp = new PCallTask(lex_strings.make($1), pt);
7524 # FILE_NAME(tmp,@1);
7529 def p_statement_item_49(p
):
7530 '''statement_item : hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7531 print('statement_item_49', list(p
))
7532 # { PCallTask*tmp = pform_make_call_task(@1, *$1, *$3);
7538 def p_statement_item_50(p
):
7539 '''statement_item : hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';' '''
7540 print('statement_item_50', list(p
))
7541 # { /* ....randomize with { <constraints> } */
7542 # if ($1 && peek_tail_name(*$1) == "randomize") {
7543 # if (!gn_system_verilog())
7544 # yyerror(@2, "error: Randomize with constraint requires SystemVerilog.");
7546 # yyerror(@2, "sorry: Randomize with constraint not supported.");
7548 # yyerror(@2, "error: Constraint block can only be applied to randomize method.");
7551 # PCallTask*tmp = new PCallTask(*$1, pt);
7552 # FILE_NAME(tmp, @1);
7557 def p_statement_item_51(p
):
7558 '''statement_item : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7559 print('statement_item_51', list(p
))
7560 # { pform_name_t*t_name = $1;
7561 # while (! $3->empty()) {
7562 # t_name->push_back($3->front());
7565 # PCallTask*tmp = new PCallTask(*t_name, *$5);
7566 # FILE_NAME(tmp, @1);
7573 def p_statement_item_52(p
):
7574 '''statement_item : hierarchy_identifier ';' '''
7575 print('statement_item_52', list(p
))
7577 # PCallTask*tmp = pform_make_call_task(@1, *$1, pt);
7582 def p_statement_item_53(p
):
7583 '''statement_item : implicit_class_handle '.' K_new '(' expression_list_with_nuls ')' ';' '''
7584 print('statement_item_53', list(p
))
7585 # { PChainConstructor*tmp = new PChainConstructor(*$5);
7586 # FILE_NAME(tmp, @3);
7591 def p_statement_item_54(p
):
7592 '''statement_item : hierarchy_identifier '(' error ')' ';' '''
7593 print('statement_item_54', list(p
))
7594 # { yyerror(@3, "error: Syntax error in task arguments.");
7596 # PCallTask*tmp = pform_make_call_task(@1, *$1, pt);
7601 def p_statement_item_55(p
):
7602 '''statement_item : error ';' '''
7603 print('statement_item_55', list(p
))
7604 # { yyerror(@2, "error: malformed statement");
7609 def p__embed0_statement_item(p
):
7610 '''_embed0_statement_item : '''
7611 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_SEQ);
7612 # FILE_NAME(tmp, @1);
7613 # current_block_stack.push(tmp);
7616 def p__embed1_statement_item(p
):
7617 '''_embed1_statement_item : '''
7619 # if (! gn_system_verilog()) {
7620 # yyerror("error: Variable declaration in unnamed block "
7621 # "requires SystemVerilog.");
7624 # /* If there are no declarations in the scope then just delete it. */
7625 # pform_pop_scope();
7626 # assert(! current_block_stack.empty());
7627 # PBlock*tmp = current_block_stack.top();
7628 # current_block_stack.pop();
7633 def p__embed2_statement_item(p
):
7634 '''_embed2_statement_item : '''
7635 # { PBlock*tmp = pform_push_block_scope($3, PBlock::BL_SEQ);
7636 # FILE_NAME(tmp, @1);
7637 # current_block_stack.push(tmp);
7640 def p__embed3_statement_item(p
):
7641 '''_embed3_statement_item : '''
7642 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
7643 # FILE_NAME(tmp, @1);
7644 # current_block_stack.push(tmp);
7647 def p__embed4_statement_item(p
):
7648 '''_embed4_statement_item : '''
7650 # if (! gn_system_verilog()) {
7651 # yyerror("error: Variable declaration in unnamed block "
7652 # "requires SystemVerilog.");
7655 # /* If there are no declarations in the scope then just delete it. */
7656 # pform_pop_scope();
7657 # assert(! current_block_stack.empty());
7658 # PBlock*tmp = current_block_stack.top();
7659 # current_block_stack.pop();
7664 def p__embed5_statement_item(p
):
7665 '''_embed5_statement_item : '''
7666 # { PBlock*tmp = pform_push_block_scope($3, PBlock::BL_PAR);
7667 # FILE_NAME(tmp, @1);
7668 # current_block_stack.push(tmp);
7671 def p_compressed_statement_1(p
):
7672 '''compressed_statement : lpvalue K_PLUS_EQ expression '''
7673 print('compressed_statement_1', list(p
))
7674 # { PAssign*tmp = new PAssign($1, '+', $3);
7675 # FILE_NAME(tmp, @1);
7679 def p_compressed_statement_2(p
):
7680 '''compressed_statement : lpvalue K_MINUS_EQ expression '''
7681 print('compressed_statement_2', list(p
))
7682 # { PAssign*tmp = new PAssign($1, '-', $3);
7683 # FILE_NAME(tmp, @1);
7687 def p_compressed_statement_3(p
):
7688 '''compressed_statement : lpvalue K_MUL_EQ expression '''
7689 print('compressed_statement_3', list(p
))
7690 # { PAssign*tmp = new PAssign($1, '*', $3);
7691 # FILE_NAME(tmp, @1);
7695 def p_compressed_statement_4(p
):
7696 '''compressed_statement : lpvalue K_DIV_EQ expression '''
7697 print('compressed_statement_4', list(p
))
7698 # { PAssign*tmp = new PAssign($1, '/', $3);
7699 # FILE_NAME(tmp, @1);
7703 def p_compressed_statement_5(p
):
7704 '''compressed_statement : lpvalue K_MOD_EQ expression '''
7705 print('compressed_statement_5', list(p
))
7706 # { PAssign*tmp = new PAssign($1, '%', $3);
7707 # FILE_NAME(tmp, @1);
7711 def p_compressed_statement_6(p
):
7712 '''compressed_statement : lpvalue K_AND_EQ expression '''
7713 print('compressed_statement_6', list(p
))
7714 # { PAssign*tmp = new PAssign($1, '&', $3);
7715 # FILE_NAME(tmp, @1);
7719 def p_compressed_statement_7(p
):
7720 '''compressed_statement : lpvalue K_OR_EQ expression '''
7721 print('compressed_statement_7', list(p
))
7722 # { PAssign*tmp = new PAssign($1, '|', $3);
7723 # FILE_NAME(tmp, @1);
7727 def p_compressed_statement_8(p
):
7728 '''compressed_statement : lpvalue K_XOR_EQ expression '''
7729 print('compressed_statement_8', list(p
))
7730 # { PAssign*tmp = new PAssign($1, '^', $3);
7731 # FILE_NAME(tmp, @1);
7735 def p_compressed_statement_9(p
):
7736 '''compressed_statement : lpvalue K_LS_EQ expression '''
7737 print('compressed_statement_9', list(p
))
7738 # { PAssign *tmp = new PAssign($1, 'l', $3);
7739 # FILE_NAME(tmp, @1);
7743 def p_compressed_statement_10(p
):
7744 '''compressed_statement : lpvalue K_RS_EQ expression '''
7745 print('compressed_statement_10', list(p
))
7746 # { PAssign*tmp = new PAssign($1, 'r', $3);
7747 # FILE_NAME(tmp, @1);
7751 def p_compressed_statement_11(p
):
7752 '''compressed_statement : lpvalue K_RSS_EQ expression '''
7753 print('compressed_statement_11', list(p
))
7754 # { PAssign *tmp = new PAssign($1, 'R', $3);
7755 # FILE_NAME(tmp, @1);
7759 def p_statement_or_null_list_opt_1(p
):
7760 '''statement_or_null_list_opt : statement_or_null_list '''
7761 print('statement_or_null_list_opt_1', list(p
))
7764 def p_statement_or_null_list_opt_2(p
):
7765 '''statement_or_null_list_opt : '''
7766 print('statement_or_null_list_opt_2', list(p
))
7769 def p_statement_or_null_list_1(p
):
7770 '''statement_or_null_list : statement_or_null_list statement_or_null '''
7771 print('statement_or_null_list_1', list(p
))
7772 # { vector<Statement*>*tmp = $1;
7773 # if ($2) tmp->push_back($2);
7777 def p_statement_or_null_list_2(p
):
7778 '''statement_or_null_list : statement_or_null '''
7779 print('statement_or_null_list_2', list(p
))
7780 # { vector<Statement*>*tmp = new vector<Statement*>(0);
7781 # if ($1) tmp->push_back($1);
7785 def p_analog_statement_1(p
):
7786 '''analog_statement : branch_probe_expression K_CONTRIBUTE expression ';' '''
7787 print('analog_statement_1', list(p
))
7788 # { $$ = pform_contribution_statement(@2, $1, $3); }
7790 def p_task_item_1(p
):
7791 '''task_item : block_item_decl '''
7792 print('task_item_1', list(p
))
7793 # { $$ = new vector<pform_tf_port_t>(0); }
7795 def p_task_item_2(p
):
7796 '''task_item : tf_port_declaration '''
7797 print('task_item_2', list(p
))
7800 def p_task_item_list_1(p
):
7801 '''task_item_list : task_item_list task_item '''
7802 print('task_item_list_1', list(p
))
7803 # { vector<pform_tf_port_t>*tmp = $1;
7804 # size_t s1 = tmp->size();
7805 # tmp->resize(s1 + $2->size());
7806 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
7807 # tmp->at(s1 + idx) = $2->at(idx);
7812 def p_task_item_list_2(p
):
7813 '''task_item_list : task_item '''
7814 print('task_item_list_2', list(p
))
7817 def p_task_item_list_opt_1(p
):
7818 '''task_item_list_opt : task_item_list '''
7819 print('task_item_list_opt_1', list(p
))
7822 def p_task_item_list_opt_2(p
):
7823 '''task_item_list_opt : '''
7824 print('task_item_list_opt_2', list(p
))
7827 def p_tf_port_list_opt_1(p
):
7828 '''tf_port_list_opt : tf_port_list '''
7829 print('tf_port_list_opt_1', list(p
))
7832 def p_tf_port_list_opt_2(p
):
7833 '''tf_port_list_opt : '''
7834 print('tf_port_list_opt_2', list(p
))
7837 def p_udp_body_1(p
):
7838 '''udp_body : K_table udp_entry_list K_endtable '''
7839 print('udp_body_1', list(p
))
7840 # { lex_end_table();
7844 def p_udp_body_2(p
):
7845 '''udp_body : K_table K_endtable '''
7846 print('udp_body_2', list(p
))
7847 # { lex_end_table();
7848 # yyerror(@1, "error: Empty UDP table.");
7852 def p_udp_body_3(p
):
7853 '''udp_body : K_table error K_endtable '''
7854 print('udp_body_3', list(p
))
7855 # { lex_end_table();
7856 # yyerror(@2, "Errors in UDP table");
7861 def p_udp_entry_list_1(p
):
7862 '''udp_entry_list : udp_comb_entry_list '''
7863 print('udp_entry_list_1', list(p
))
7865 def p_udp_entry_list_2(p
):
7866 '''udp_entry_list : udp_sequ_entry_list '''
7867 print('udp_entry_list_2', list(p
))
7869 def p_udp_comb_entry_1(p
):
7870 '''udp_comb_entry : udp_input_list ':' udp_output_sym ';' '''
7871 print('udp_comb_entry_1', list(p
))
7872 # { char*tmp = new char[strlen($1)+3];
7874 # char*tp = tmp+strlen(tmp);
7882 def p_udp_comb_entry_list_1(p
):
7883 '''udp_comb_entry_list : udp_comb_entry '''
7884 print('udp_comb_entry_list_1', list(p
))
7885 # { list<string>*tmp = new list<string>;
7886 # tmp->push_back($1);
7891 def p_udp_comb_entry_list_2(p
):
7892 '''udp_comb_entry_list : udp_comb_entry_list udp_comb_entry '''
7893 print('udp_comb_entry_list_2', list(p
))
7894 # { list<string>*tmp = $1;
7895 # tmp->push_back($2);
7900 def p_udp_sequ_entry_list_1(p
):
7901 '''udp_sequ_entry_list : udp_sequ_entry '''
7902 print('udp_sequ_entry_list_1', list(p
))
7903 # { list<string>*tmp = new list<string>;
7904 # tmp->push_back($1);
7909 def p_udp_sequ_entry_list_2(p
):
7910 '''udp_sequ_entry_list : udp_sequ_entry_list udp_sequ_entry '''
7911 print('udp_sequ_entry_list_2', list(p
))
7912 # { list<string>*tmp = $1;
7913 # tmp->push_back($2);
7918 def p_udp_sequ_entry_1(p
):
7919 '''udp_sequ_entry : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' '''
7920 print('udp_sequ_entry_1', list(p
))
7921 # { char*tmp = new char[strlen($1)+5];
7923 # char*tp = tmp+strlen(tmp);
7932 def p_udp_initial_1(p
):
7933 '''udp_initial : K_initial IDENTIFIER '=' number ';' '''
7934 print('udp_initial_1', list(p
))
7935 # { PExpr*etmp = new PENumber($4);
7936 # PEIdent*itmp = new PEIdent(lex_strings.make($2));
7937 # PAssign*atmp = new PAssign(itmp, etmp);
7938 # FILE_NAME(atmp, @2);
7943 def p_udp_init_opt_1(p
):
7944 '''udp_init_opt : udp_initial '''
7945 print('udp_init_opt_1', list(p
))
7948 def p_udp_init_opt_2(p
):
7949 '''udp_init_opt : '''
7950 print('udp_init_opt_2', list(p
))
7953 def p_udp_input_list_1(p
):
7954 '''udp_input_list : udp_input_sym '''
7955 print('udp_input_list_1', list(p
))
7956 # { char*tmp = new char[2];
7962 def p_udp_input_list_2(p
):
7963 '''udp_input_list : udp_input_list udp_input_sym '''
7964 print('udp_input_list_2', list(p
))
7965 # { char*tmp = new char[strlen($1)+2];
7967 # char*tp = tmp+strlen(tmp);
7974 def p_udp_input_sym_1(p
):
7975 '''udp_input_sym : '0' '''
7976 print('udp_input_sym_1', list(p
))
7979 def p_udp_input_sym_2(p
):
7980 '''udp_input_sym : '1' '''
7981 print('udp_input_sym_2', list(p
))
7984 def p_udp_input_sym_3(p
):
7985 '''udp_input_sym : 'x' '''
7986 print('udp_input_sym_3', list(p
))
7989 def p_udp_input_sym_4(p
):
7990 '''udp_input_sym : '?' '''
7991 print('udp_input_sym_4', list(p
))
7994 def p_udp_input_sym_5(p
):
7995 '''udp_input_sym : 'b' '''
7996 print('udp_input_sym_5', list(p
))
7999 def p_udp_input_sym_6(p
):
8000 '''udp_input_sym : '*' '''
8001 print('udp_input_sym_6', list(p
))
8004 def p_udp_input_sym_7(p
):
8005 '''udp_input_sym : '%' '''
8006 print('udp_input_sym_7', list(p
))
8009 def p_udp_input_sym_8(p
):
8010 '''udp_input_sym : 'f' '''
8011 print('udp_input_sym_8', list(p
))
8014 def p_udp_input_sym_9(p
):
8015 '''udp_input_sym : 'F' '''
8016 print('udp_input_sym_9', list(p
))
8019 def p_udp_input_sym_10(p
):
8020 '''udp_input_sym : 'l' '''
8021 print('udp_input_sym_10', list(p
))
8024 def p_udp_input_sym_11(p
):
8025 '''udp_input_sym : 'h' '''
8026 print('udp_input_sym_11', list(p
))
8029 def p_udp_input_sym_12(p
):
8030 '''udp_input_sym : 'B' '''
8031 print('udp_input_sym_12', list(p
))
8034 def p_udp_input_sym_13(p
):
8035 '''udp_input_sym : 'r' '''
8036 print('udp_input_sym_13', list(p
))
8039 def p_udp_input_sym_14(p
):
8040 '''udp_input_sym : 'R' '''
8041 print('udp_input_sym_14', list(p
))
8044 def p_udp_input_sym_15(p
):
8045 '''udp_input_sym : 'M' '''
8046 print('udp_input_sym_15', list(p
))
8049 def p_udp_input_sym_16(p
):
8050 '''udp_input_sym : 'n' '''
8051 print('udp_input_sym_16', list(p
))
8054 def p_udp_input_sym_17(p
):
8055 '''udp_input_sym : 'N' '''
8056 print('udp_input_sym_17', list(p
))
8059 def p_udp_input_sym_18(p
):
8060 '''udp_input_sym : 'p' '''
8061 print('udp_input_sym_18', list(p
))
8064 def p_udp_input_sym_19(p
):
8065 '''udp_input_sym : 'P' '''
8066 print('udp_input_sym_19', list(p
))
8069 def p_udp_input_sym_20(p
):
8070 '''udp_input_sym : 'Q' '''
8071 print('udp_input_sym_20', list(p
))
8074 def p_udp_input_sym_21(p
):
8075 '''udp_input_sym : 'q' '''
8076 print('udp_input_sym_21', list(p
))
8079 def p_udp_input_sym_22(p
):
8080 '''udp_input_sym : '_' '''
8081 print('udp_input_sym_22', list(p
))
8084 def p_udp_input_sym_23(p
):
8085 '''udp_input_sym : '+' '''
8086 print('udp_input_sym_23', list(p
))
8089 def p_udp_input_sym_24(p
):
8090 '''udp_input_sym : DEC_NUMBER '''
8091 print('udp_input_sym_24', list(p
))
8092 # { yyerror(@1, "internal error: Input digits parse as decimal number!"); $$ = '0'; }
8094 def p_udp_output_sym_1(p
):
8095 '''udp_output_sym : '0' '''
8096 print('udp_output_sym_1', list(p
))
8099 def p_udp_output_sym_2(p
):
8100 '''udp_output_sym : '1' '''
8101 print('udp_output_sym_2', list(p
))
8104 def p_udp_output_sym_3(p
):
8105 '''udp_output_sym : 'x' '''
8106 print('udp_output_sym_3', list(p
))
8109 def p_udp_output_sym_4(p
):
8110 '''udp_output_sym : '-' '''
8111 print('udp_output_sym_4', list(p
))
8114 def p_udp_output_sym_5(p
):
8115 '''udp_output_sym : DEC_NUMBER '''
8116 print('udp_output_sym_5', list(p
))
8117 # { yyerror(@1, "internal error: Output digits parse as decimal number!"); $$ = '0'; }
8119 def p_udp_port_decl_1(p
):
8120 '''udp_port_decl : K_input list_of_identifiers ';' '''
8121 print('udp_port_decl_1', list(p
))
8122 # { $$ = pform_make_udp_input_ports($2); }
8124 def p_udp_port_decl_2(p
):
8125 '''udp_port_decl : K_output IDENTIFIER ';' '''
8126 print('udp_port_decl_2', list(p
))
8127 # { perm_string pname = lex_strings.make($2);
8128 # PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
8129 # vector<PWire*>*tmp = new vector<PWire*>(1);
8135 def p_udp_port_decl_3(p
):
8136 '''udp_port_decl : K_reg IDENTIFIER ';' '''
8137 print('udp_port_decl_3', list(p
))
8138 # { perm_string pname = lex_strings.make($2);
8139 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
8140 # vector<PWire*>*tmp = new vector<PWire*>(1);
8146 def p_udp_port_decl_4(p
):
8147 '''udp_port_decl : K_reg K_output IDENTIFIER ';' '''
8148 print('udp_port_decl_4', list(p
))
8149 # { perm_string pname = lex_strings.make($3);
8150 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
8151 # vector<PWire*>*tmp = new vector<PWire*>(1);
8157 def p_udp_port_decls_1(p
):
8158 '''udp_port_decls : udp_port_decl '''
8159 print('udp_port_decls_1', list(p
))
8162 def p_udp_port_decls_2(p
):
8163 '''udp_port_decls : udp_port_decls udp_port_decl '''
8164 print('udp_port_decls_2', list(p
))
8165 # { vector<PWire*>*tmp = $1;
8166 # size_t s1 = $1->size();
8167 # tmp->resize(s1+$2->size());
8168 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
8169 # tmp->at(s1+idx) = $2->at(idx);
8174 def p_udp_port_list_1(p
):
8175 '''udp_port_list : IDENTIFIER '''
8176 print('udp_port_list_1', list(p
))
8177 # { list<perm_string>*tmp = new list<perm_string>;
8178 # tmp->push_back(lex_strings.make($1));
8183 def p_udp_port_list_2(p
):
8184 '''udp_port_list : udp_port_list ',' IDENTIFIER '''
8185 print('udp_port_list_2', list(p
))
8186 # { list<perm_string>*tmp = $1;
8187 # tmp->push_back(lex_strings.make($3));
8192 def p_udp_reg_opt_1(p
):
8193 '''udp_reg_opt : K_reg '''
8194 print('udp_reg_opt_1', list(p
))
8197 def p_udp_reg_opt_2(p
):
8198 '''udp_reg_opt : '''
8199 print('udp_reg_opt_2', list(p
))
8202 def p_udp_initial_expr_opt_1(p
):
8203 '''udp_initial_expr_opt : '=' expression '''
8204 print('udp_initial_expr_opt_1', list(p
))
8207 def p_udp_initial_expr_opt_2(p
):
8208 '''udp_initial_expr_opt : '''
8209 print('udp_initial_expr_opt_2', list(p
))
8212 def p_udp_input_declaration_list_1(p
):
8213 '''udp_input_declaration_list : K_input IDENTIFIER '''
8214 print('udp_input_declaration_list_1', list(p
))
8215 # { list<perm_string>*tmp = new list<perm_string>;
8216 # tmp->push_back(lex_strings.make($2));
8221 def p_udp_input_declaration_list_2(p
):
8222 '''udp_input_declaration_list : udp_input_declaration_list ',' K_input IDENTIFIER '''
8223 print('udp_input_declaration_list_2', list(p
))
8224 # { list<perm_string>*tmp = $1;
8225 # tmp->push_back(lex_strings.make($4));
8230 def p_udp_primitive_1(p
):
8231 '''udp_primitive : K_primitive IDENTIFIER '(' udp_port_list ')' ';' udp_port_decls udp_init_opt udp_body K_endprimitive endlabel_opt '''
8232 print('udp_primitive_1', list(p
))
8233 # { perm_string tmp2 = lex_strings.make($2);
8234 # pform_make_udp(tmp2, $4, $7, $9, $8,
8235 # @2.text, @2.first_line);
8237 # if (strcmp($2,$11) != 0) {
8238 # yyerror(@11, "error: End label doesn't match "
8239 # "primitive name");
8241 # if (! gn_system_verilog()) {
8242 # yyerror(@11, "error: Primitive end labels "
8243 # "require SystemVerilog.");
8250 def p_udp_primitive_2(p
):
8251 '''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 '''
8252 print('udp_primitive_2', list(p
))
8253 # { perm_string tmp2 = lex_strings.make($2);
8254 # perm_string tmp6 = lex_strings.make($6);
8255 # pform_make_udp(tmp2, $5, tmp6, $7, $9, $12,
8256 # @2.text, @2.first_line);
8258 # if (strcmp($2,$14) != 0) {
8259 # yyerror(@14, "error: End label doesn't match "
8260 # "primitive name");
8262 # if (! gn_system_verilog()) {
8263 # yyerror(@14, "error: Primitive end labels "
8264 # "require SystemVerilog.");
8272 def p_K_packed_opt_1(p
):
8273 '''K_packed_opt : K_packed '''
8274 print('K_packed_opt', list(p
))
8277 def p_K_packed_opt_2(p
):
8278 '''K_packed_opt : '''
8279 print('K_packed_opt', list(p
))
8282 def p_K_reg_opt_1(p
):
8283 '''K_reg_opt : K_reg '''
8284 print('K_reg_opt', list(p
))
8287 def p_K_reg_opt_2(p
):
8289 print('K_reg_opt', list(p
))
8292 def p_K_static_opt_1(p
):
8293 '''K_static_opt : K_static '''
8294 print('K_static_opt', list(p
))
8297 def p_K_static_opt_2(p
):
8298 '''K_static_opt : '''
8299 print('K_static_opt', list(p
))
8303 def p_K_virtual_opt_1(p
):
8304 '''K_virtual_opt : K_virtual '''
8308 def p_K_virtual_opt_2(p
):
8309 '''K_virtual_opt : '''