8180231d971b0018077639c8f325158ece4fb5e5
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.
23 #from parse_tokens import tokens
25 tokens
= lexor
.tokens
# list(set(lexor.tokens).union(set(tokens)))
26 literals
= lexor
.literals
29 ('right', 'K_PLUS_EQ', 'K_MINUS_EQ', 'K_MUL_EQ', 'K_DIV_EQ',
30 'K_MOD_EQ', 'K_AND_EQ', 'K_OR_EQ'),
31 ('right', 'K_XOR_EQ', 'K_LS_EQ', 'K_RS_EQ', 'K_RSS_EQ'),
32 ('right', '?', ':', 'K_inside'),
36 ('left', '^', 'K_NXOR', 'K_NOR'),
37 ('left', '&', 'K_NAND'),
38 ('left', 'K_EQ', 'K_NE', 'K_CEQ', 'K_CNE', 'K_WEQ', 'K_WNE'),
39 ('left', 'K_GE', 'K_LE', '<', '>'),
40 ('left', 'K_LS', 'K_RS', 'K_RSS'),
42 ('left', '*', '/', '%'),
44 ('left', 'UNARY_PREC'),
45 ('nonassoc', 'less_than_K_else'),
46 ('nonassoc', 'K_else'),
48 ('nonassoc', 'K_exclude'),
49 ('nonassoc', 'no_timeunits_declaration'),
50 ('nonassoc', 'one_timeunits_declaration'),
51 ('nonassoc', 'K_timeunit', 'K_timeprecision')
54 # -------------- RULES ----------------
56 #'''source_text : timeunits_declaration_opt _embed0_source_text description_list
58 '''source_text : timeunits_declaration_opt _embed0_source_text description_list
62 def p__embed0_source_text(p
):
63 '''_embed0_source_text : '''
64 # { pform_set_scope_timescale(yyloc); }
66 def p_assertion_item_1(p
):
67 '''assertion_item : concurrent_assertion_item '''
70 def p_assignment_pattern_1(p
):
71 '''assignment_pattern : K_LP expression_list_proper '}' '''
73 # { PEAssignPattern*tmp = new PEAssignPattern(*$2);
79 def p_assignment_pattern_2(p
):
80 '''assignment_pattern : K_LP '}' '''
82 # { PEAssignPattern*tmp = new PEAssignPattern;
87 def p_block_identifier_opt_1(p
):
88 '''block_identifier_opt : IDENTIFIER ':' '''
91 def p_block_identifier_opt_2(p
):
92 '''block_identifier_opt : '''
95 def p_class_declaration_1(p
):
96 '''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 '''
98 # { // Wrap up the class.
99 # if ($11 && $4 && $4->name != $11) {
100 # yyerror(@11, "error: Class end label doesn't match class name.");
105 def p__embed0_class_declaration(p
):
106 '''_embed0_class_declaration : '''
107 # { pform_start_class_declaration(@2, $4, $5.type, $5.exprs, $3); }
109 def p__embed1_class_declaration(p
):
110 '''_embed1_class_declaration : '''
111 # { // Process a class.
112 # pform_end_class_declaration(@9);
115 def p_class_constraint_1(p
):
116 '''class_constraint : constraint_prototype '''
119 def p_class_constraint_2(p
):
120 '''class_constraint : constraint_declaration '''
123 def p_class_identifier_1(p
):
124 '''class_identifier : IDENTIFIER '''
126 # { // Create a synthetic typedef for the class name so that the
127 # // lexor detects the name as a type.
128 # perm_string name = lex_strings.make($1);
129 # class_type_t*tmp = new class_type_t(name);
130 # FILE_NAME(tmp, @1);
131 # pform_set_typedef(name, tmp, NULL);
136 def p_class_identifier_2(p
):
137 '''class_identifier : TYPE_IDENTIFIER '''
139 # { class_type_t*tmp = dynamic_cast<class_type_t*>($1.type);
141 # yyerror(@1, "Type name \"%s\"is not a predeclared class name.", $1.text);
147 def p_class_declaration_endlabel_opt_1(p
):
148 '''class_declaration_endlabel_opt : ':' TYPE_IDENTIFIER '''
150 # { class_type_t*tmp = dynamic_cast<class_type_t*> ($2.type);
152 # yyerror(@2, "error: class declaration endlabel \"%s\" is not a class name\n", $2.text);
155 # $$ = strdupnew(tmp->name.str());
160 def p_class_declaration_endlabel_opt_2(p
):
161 '''class_declaration_endlabel_opt : ':' IDENTIFIER '''
165 def p_class_declaration_endlabel_opt_3(p
):
166 '''class_declaration_endlabel_opt : '''
170 def p_class_declaration_extends_opt_1(p
):
171 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '''
173 # { $$.type = $2.type;
178 def p_class_declaration_extends_opt_2(p
):
179 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '(' expression_list_with_nuls ')' '''
181 # { $$.type = $2.type;
186 def p_class_declaration_extends_opt_3(p
):
187 '''class_declaration_extends_opt : '''
189 # { $$.type = 0; $$.exprs = 0; }
191 def p_class_items_opt_1(p
):
192 '''class_items_opt : class_items '''
195 def p_class_items_opt_2(p
):
196 '''class_items_opt : '''
199 def p_class_items_1(p
):
200 '''class_items : class_items class_item '''
203 def p_class_items_2(p
):
204 '''class_items : class_item '''
207 def p_class_item_1(p
):
208 '''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 '''
210 # { current_function->set_ports($6);
211 # pform_set_constructor_return(current_function);
212 # pform_set_this_class(@3, current_function);
213 # current_function_set_statement(@3, $10);
215 # current_function = 0;
218 def p_class_item_2(p
):
219 '''class_item : property_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
221 # { pform_class_property(@2, $1, $2, $3); }
223 def p_class_item_3(p
):
224 '''class_item : K_const class_item_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
226 # { pform_class_property(@1, $2 | property_qualifier_t::make_const(), $3, $4); }
228 def p_class_item_4(p
):
229 '''class_item : method_qualifier_opt task_declaration '''
231 # { /* The task_declaration rule puts this into the class */ }
233 def p_class_item_5(p
):
234 '''class_item : method_qualifier_opt function_declaration '''
236 # { /* The function_declaration rule puts this into the class */ }
238 def p_class_item_6(p
):
239 '''class_item : K_extern method_qualifier_opt K_function K_new ';' '''
241 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
243 def p_class_item_7(p
):
244 '''class_item : K_extern method_qualifier_opt K_function K_new '(' tf_port_list_opt ')' ';' '''
246 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
248 def p_class_item_8(p
):
249 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER ';' '''
251 # { yyerror(@1, "sorry: External methods are not yet supported.");
255 def p_class_item_9(p
):
256 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' ';' '''
258 # { yyerror(@1, "sorry: External methods are not yet supported.");
262 def p_class_item_10(p
):
263 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER ';' '''
265 # { yyerror(@1, "sorry: External methods are not yet supported.");
269 def p_class_item_11(p
):
270 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER '(' tf_port_list_opt ')' ';' '''
272 # { yyerror(@1, "sorry: External methods are not yet supported.");
276 def p_class_item_12(p
):
277 '''class_item : class_constraint '''
280 def p_class_item_13(p
):
281 '''class_item : property_qualifier_opt data_type error ';' '''
283 # { yyerror(@3, "error: Errors in variable names after data type.");
287 def p_class_item_14(p
):
288 '''class_item : property_qualifier_opt IDENTIFIER error ';' '''
290 # { yyerror(@3, "error: %s doesn't name a type.", $2);
294 def p_class_item_15(p
):
295 '''class_item : method_qualifier_opt K_function K_new error K_endfunction endnew_opt '''
297 # { yyerror(@1, "error: I give up on this class constructor declaration.");
301 def p_class_item_16(p
):
302 '''class_item : error ';' '''
304 # { yyerror(@2, "error: invalid class item.");
308 def p__embed0_class_item(p
):
309 '''_embed0_class_item : '''
310 # { assert(current_function==0);
311 # current_function = pform_push_constructor_scope(@3);
314 def p_class_item_qualifier_1(p
):
315 '''class_item_qualifier : K_static '''
317 # { $$ = property_qualifier_t::make_static(); }
319 def p_class_item_qualifier_2(p
):
320 '''class_item_qualifier : K_protected '''
322 # { $$ = property_qualifier_t::make_protected(); }
324 def p_class_item_qualifier_3(p
):
325 '''class_item_qualifier : K_local '''
327 # { $$ = property_qualifier_t::make_local(); }
329 def p_class_item_qualifier_list_1(p
):
330 '''class_item_qualifier_list : class_item_qualifier_list class_item_qualifier '''
334 def p_class_item_qualifier_list_2(p
):
335 '''class_item_qualifier_list : class_item_qualifier '''
339 def p_class_item_qualifier_opt_1(p
):
340 '''class_item_qualifier_opt : class_item_qualifier_list '''
344 def p_class_item_qualifier_opt_2(p
):
345 '''class_item_qualifier_opt : '''
347 # { $$ = property_qualifier_t::make_none(); }
349 def p_class_new_1(p
):
350 '''class_new : K_new '(' expression_list_with_nuls ')' '''
352 # { list<PExpr*>*expr_list = $3;
353 # strip_tail_items(expr_list);
354 # PENewClass*tmp = new PENewClass(*expr_list);
355 # FILE_NAME(tmp, @1);
360 def p_class_new_2(p
):
361 '''class_new : K_new hierarchy_identifier '''
363 # { PEIdent*tmpi = new PEIdent(*$2);
364 # FILE_NAME(tmpi, @2);
365 # PENewCopy*tmp = new PENewCopy(tmpi);
366 # FILE_NAME(tmp, @1);
371 def p_class_new_3(p
):
372 '''class_new : K_new '''
374 # { PENewClass*tmp = new PENewClass;
375 # FILE_NAME(tmp, @1);
379 def p_concurrent_assertion_item_1(p
):
380 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' property_spec ')' statement_or_null '''
383 # if (gn_assertions_flag) {
384 # yyerror(@2, "sorry: concurrent_assertion_item not supported."
385 # " Try -gno-assertion to turn this message off.");
389 def p_concurrent_assertion_item_2(p
):
390 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' error ')' statement_or_null '''
393 # yyerror(@2, "error: Error in property_spec of concurrent assertion item.");
396 def p_constraint_block_item_1(p
):
397 '''constraint_block_item : constraint_expression '''
400 def p_constraint_block_item_list_1(p
):
401 '''constraint_block_item_list : constraint_block_item_list constraint_block_item '''
404 def p_constraint_block_item_list_2(p
):
405 '''constraint_block_item_list : constraint_block_item '''
408 def p_constraint_block_item_list_opt_1(p
):
409 '''constraint_block_item_list_opt : '''
412 def p_constraint_block_item_list_opt_2(p
):
413 '''constraint_block_item_list_opt : constraint_block_item_list '''
416 def p_constraint_declaration_1(p
):
417 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' constraint_block_item_list_opt '}' '''
419 # { yyerror(@2, "sorry: Constraint declarations not supported."); }
421 def p_constraint_declaration_2(p
):
422 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' error '}' '''
424 # { yyerror(@4, "error: Errors in the constraint block item list."); }
426 def p_constraint_expression_1(p
):
427 '''constraint_expression : expression ';' '''
430 def p_constraint_expression_2(p
):
431 '''constraint_expression : expression K_dist '{' '}' ';' '''
434 def p_constraint_expression_3(p
):
435 '''constraint_expression : expression K_TRIGGER constraint_set '''
438 def p_constraint_expression_4(p
):
439 '''constraint_expression : K_if '(' expression ')' constraint_set %prec less_than_K_else '''
442 def p_constraint_expression_5(p
):
443 '''constraint_expression : K_if '(' expression ')' constraint_set K_else constraint_set '''
446 def p_constraint_expression_6(p
):
447 '''constraint_expression : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' constraint_set '''
450 def p_constraint_expression_list_1(p
):
451 '''constraint_expression_list : constraint_expression_list constraint_expression '''
454 def p_constraint_expression_list_2(p
):
455 '''constraint_expression_list : constraint_expression '''
458 def p_constraint_prototype_1(p
):
459 '''constraint_prototype : K_static_opt K_constraint IDENTIFIER ';' '''
461 # { yyerror(@2, "sorry: Constraint prototypes not supported."); }
463 def p_constraint_set_1(p
):
464 '''constraint_set : constraint_expression '''
467 def p_constraint_set_2(p
):
468 '''constraint_set : '{' constraint_expression_list '}' '''
471 def p_data_declaration_1(p
):
472 '''data_declaration : attribute_list_opt data_type_or_implicit list_of_variable_decl_assignments ';' '''
474 # { data_type_t*data_type = $2;
475 # if (data_type == 0) {
476 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
477 # FILE_NAME(data_type, @2);
479 # pform_makewire(@2, 0, str_strength, $3, NetNet::IMPLICIT_REG, data_type);
482 def p_data_type_1(p
):
483 '''data_type : integer_vector_type unsigned_signed_opt dimensions_opt '''
485 # { ivl_variable_type_t use_vtype = $1;
486 # bool reg_flag = false;
487 # if (use_vtype == IVL_VT_NO_TYPE) {
488 # use_vtype = IVL_VT_LOGIC;
491 # vector_type_t*tmp = new vector_type_t(use_vtype, $2, $3);
492 # tmp->reg_flag = reg_flag;
493 # FILE_NAME(tmp, @1);
497 def p_data_type_2(p
):
498 '''data_type : non_integer_type '''
500 # { real_type_t*tmp = new real_type_t($1);
501 # FILE_NAME(tmp, @1);
505 def p_data_type_3(p
):
506 '''data_type : struct_data_type '''
508 # { if (!$1->packed_flag) {
509 # yyerror(@1, "sorry: Unpacked structs not supported.");
514 def p_data_type_4(p
):
515 '''data_type : enum_data_type '''
519 def p_data_type_5(p
):
520 '''data_type : atom2_type signed_unsigned_opt '''
522 # { atom2_type_t*tmp = new atom2_type_t($1, $2);
523 # FILE_NAME(tmp, @1);
527 def p_data_type_6(p
):
528 '''data_type : K_integer signed_unsigned_opt '''
530 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
531 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, $2, pd);
532 # tmp->reg_flag = true;
533 # tmp->integer_flag = true;
537 def p_data_type_7(p
):
538 '''data_type : K_time '''
540 # { list<pform_range_t>*pd = make_range_from_width(64);
541 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
542 # tmp->reg_flag = !gn_system_verilog();
546 def p_data_type_8(p
):
547 '''data_type : TYPE_IDENTIFIER dimensions_opt '''
550 # parray_type_t*tmp = new parray_type_t($1.type, $2);
551 # FILE_NAME(tmp, @1);
553 # } else $$ = $1.type;
557 def p_data_type_9(p
):
558 '''data_type : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_data_type TYPE_IDENTIFIER '''
560 # { lex_in_package_scope(0);
565 def p_data_type_10(p
):
566 '''data_type : K_string '''
568 # { string_type_t*tmp = new string_type_t;
569 # FILE_NAME(tmp, @1);
573 def p__embed0_data_type(p
):
574 '''_embed0_data_type : '''
575 # { lex_in_package_scope($1); }
577 def p_data_type_or_implicit_1(p
):
578 '''data_type_or_implicit : data_type '''
582 def p_data_type_or_implicit_2(p
):
583 '''data_type_or_implicit : signing dimensions_opt '''
585 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, $1, $2);
586 # tmp->implicit_flag = true;
587 # FILE_NAME(tmp, @1);
591 def p_data_type_or_implicit_3(p
):
592 '''data_type_or_implicit : dimensions '''
594 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, $1);
595 # tmp->implicit_flag = true;
596 # FILE_NAME(tmp, @1);
600 def p_data_type_or_implicit_4(p
):
601 '''data_type_or_implicit : '''
605 def p_data_type_or_implicit_or_void_1(p
):
606 '''data_type_or_implicit_or_void : data_type_or_implicit '''
610 def p_data_type_or_implicit_or_void_2(p
):
611 '''data_type_or_implicit_or_void : K_void '''
613 # { void_type_t*tmp = new void_type_t;
614 # FILE_NAME(tmp, @1);
618 def p_description_1(p
):
619 '''description : module '''
622 def p_description_2(p
):
623 '''description : udp_primitive '''
626 def p_description_3(p
):
627 '''description : config_declaration '''
630 def p_description_4(p
):
631 '''description : nature_declaration '''
634 def p_description_5(p
):
635 '''description : package_declaration '''
638 def p_description_6(p
):
639 '''description : discipline_declaration '''
642 def p_description_7(p
):
643 '''description : package_item '''
646 def p_description_8(p
):
647 '''description : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' '''
649 # { perm_string tmp3 = lex_strings.make($3);
650 # pform_set_type_attrib(tmp3, $5, $7);
655 def p_description_list_1(p
):
656 '''description_list : description '''
659 def p_description_list_2(p
):
660 '''description_list : description_list description '''
663 def p_endnew_opt_1(p
):
664 '''endnew_opt : ':' K_new '''
667 def p_endnew_opt_2(p
):
671 def p_dynamic_array_new_1(p
):
672 '''dynamic_array_new : K_new '[' expression ']' '''
674 # { $$ = new PENewArray($3, 0);
678 def p_dynamic_array_new_2(p
):
679 '''dynamic_array_new : K_new '[' expression ']' '(' expression ')' '''
681 # { $$ = new PENewArray($3, $6);
686 '''for_step : lpvalue '=' expression '''
688 # { PAssign*tmp = new PAssign($1,$3);
689 # FILE_NAME(tmp, @1);
694 '''for_step : inc_or_dec_expression '''
696 # { $$ = pform_compressed_assign_from_inc_dec(@1, $1); }
699 '''for_step : compressed_statement '''
703 def p_function_declaration_1(p
):
704 '''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 '''
706 # { // Last step: check any closing name.
708 # if (strcmp($4,$11) != 0) {
709 # yyerror(@11, "error: End label doesn't match "
712 # if (! gn_system_verilog()) {
713 # yyerror(@11, "error: Function end labels require "
721 def p_function_declaration_2(p
):
722 '''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 '''
724 # { // Last step: check any closing name.
726 # if (strcmp($4,$14) != 0) {
727 # yyerror(@14, "error: End label doesn't match "
730 # if (! gn_system_verilog()) {
731 # yyerror(@14, "error: Function end labels require "
739 def p_function_declaration_3(p
):
740 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER error K_endfunction _embed4_function_declaration endlabel_opt '''
742 # { // Last step: check any closing name.
744 # if (strcmp($4,$8) != 0) {
745 # yyerror(@8, "error: End label doesn't match function name");
747 # if (! gn_system_verilog()) {
748 # yyerror(@8, "error: Function end labels require "
756 def p__embed0_function_declaration(p
):
757 '''_embed0_function_declaration : '''
758 # { assert(current_function == 0);
759 # current_function = pform_push_function_scope(@1, $4, $2);
762 def p__embed1_function_declaration(p
):
763 '''_embed1_function_declaration : '''
764 # { current_function->set_ports($7);
765 # current_function->set_return($3);
766 # current_function_set_statement($8? @8 : @4, $8);
767 # pform_set_this_class(@4, current_function);
769 # current_function = 0;
772 def p__embed2_function_declaration(p
):
773 '''_embed2_function_declaration : '''
774 # { assert(current_function == 0);
775 # current_function = pform_push_function_scope(@1, $4, $2);
778 def p__embed3_function_declaration(p
):
779 '''_embed3_function_declaration : '''
780 # { current_function->set_ports($7);
781 # current_function->set_return($3);
782 # current_function_set_statement($11? @11 : @4, $11);
783 # pform_set_this_class(@4, current_function);
785 # current_function = 0;
786 # if ($7==0 && !gn_system_verilog()) {
787 # yyerror(@4, "error: Empty parenthesis syntax requires SystemVerilog.");
791 def p__embed4_function_declaration(p
):
792 '''_embed4_function_declaration : '''
794 # if (current_function) {
796 # current_function = 0;
798 # assert(current_function == 0);
799 # yyerror(@1, "error: Syntax error defining function.");
803 def p_import_export_1(p
):
804 '''import_export : K_import '''
808 def p_import_export_2(p
):
809 '''import_export : K_export '''
813 def p_implicit_class_handle_1(p
):
814 '''implicit_class_handle : K_this '''
816 # { $$ = pform_create_this(); }
818 def p_implicit_class_handle_2(p
):
819 '''implicit_class_handle : K_super '''
821 # { $$ = pform_create_super(); }
823 def p_inc_or_dec_expression_1(p
):
824 '''inc_or_dec_expression : K_INCR lpvalue %prec UNARY_PREC '''
826 # { PEUnary*tmp = new PEUnary('I', $2);
827 # FILE_NAME(tmp, @2);
831 def p_inc_or_dec_expression_2(p
):
832 '''inc_or_dec_expression : lpvalue K_INCR %prec UNARY_PREC '''
834 # { PEUnary*tmp = new PEUnary('i', $1);
835 # FILE_NAME(tmp, @1);
839 def p_inc_or_dec_expression_3(p
):
840 '''inc_or_dec_expression : K_DECR lpvalue %prec UNARY_PREC '''
842 # { PEUnary*tmp = new PEUnary('D', $2);
843 # FILE_NAME(tmp, @2);
847 def p_inc_or_dec_expression_4(p
):
848 '''inc_or_dec_expression : lpvalue K_DECR %prec UNARY_PREC '''
850 # { PEUnary*tmp = new PEUnary('d', $1);
851 # FILE_NAME(tmp, @1);
855 def p_inside_expression_1(p
):
856 '''inside_expression : expression K_inside '{' open_range_list '}' '''
858 # { yyerror(@2, "sorry: \"inside\" expressions not supported yet.");
862 def p_integer_vector_type_1(p
):
863 '''integer_vector_type : K_reg '''
865 # { $$ = IVL_VT_NO_TYPE; }
867 def p_integer_vector_type_2(p
):
868 '''integer_vector_type : K_bit '''
870 # { $$ = IVL_VT_BOOL; }
872 def p_integer_vector_type_3(p
):
873 '''integer_vector_type : K_logic '''
875 # { $$ = IVL_VT_LOGIC; }
877 def p_integer_vector_type_4(p
):
878 '''integer_vector_type : K_bool '''
880 # { $$ = IVL_VT_BOOL; }
882 def p_join_keyword_1(p
):
883 '''join_keyword : K_join '''
885 # { $$ = PBlock::BL_PAR; }
887 def p_join_keyword_2(p
):
888 '''join_keyword : K_join_none '''
890 # { $$ = PBlock::BL_JOIN_NONE; }
892 def p_join_keyword_3(p
):
893 '''join_keyword : K_join_any '''
895 # { $$ = PBlock::BL_JOIN_ANY; }
897 def p_jump_statement_1(p
):
898 '''jump_statement : K_break ';' '''
900 # { yyerror(@1, "sorry: break statements not supported.");
904 def p_jump_statement_2(p
):
905 '''jump_statement : K_return ';' '''
907 # { PReturn*tmp = new PReturn(0);
908 # FILE_NAME(tmp, @1);
912 def p_jump_statement_3(p
):
913 '''jump_statement : K_return expression ';' '''
915 # { PReturn*tmp = new PReturn($2);
916 # FILE_NAME(tmp, @1);
921 '''lifetime : K_automatic '''
923 # { $$ = LexicalScope::AUTOMATIC; }
926 '''lifetime : K_static '''
928 # { $$ = LexicalScope::STATIC; }
930 def p_lifetime_opt_1(p
):
931 '''lifetime_opt : lifetime '''
935 def p_lifetime_opt_2(p
):
936 '''lifetime_opt : '''
938 # { $$ = LexicalScope::INHERITED; }
940 def p_loop_statement_1(p
):
941 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' for_step ')' statement_or_null '''
943 # { PForStatement*tmp = new PForStatement($3, $5, $7, $9, $11);
944 # FILE_NAME(tmp, @1);
948 def p_loop_statement_2(p
):
949 '''loop_statement : K_for '(' data_type IDENTIFIER '=' expression ';' expression ';' for_step ')' _embed0_loop_statement statement_or_null '''
951 # { pform_name_t tmp_hident;
952 # tmp_hident.push_back(name_component_t(lex_strings.make($4)));
954 # PEIdent*tmp_ident = pform_new_ident(tmp_hident);
955 # FILE_NAME(tmp_ident, @4);
957 # PForStatement*tmp_for = new PForStatement(tmp_ident, $6, $8, $10, $13);
958 # FILE_NAME(tmp_for, @1);
961 # vector<Statement*>tmp_for_list (1);
962 # tmp_for_list[0] = tmp_for;
963 # PBlock*tmp_blk = current_block_stack.top();
964 # current_block_stack.pop();
965 # tmp_blk->set_statement(tmp_for_list);
970 def p_loop_statement_3(p
):
971 '''loop_statement : K_forever statement_or_null '''
973 # { PForever*tmp = new PForever($2);
974 # FILE_NAME(tmp, @1);
978 def p_loop_statement_4(p
):
979 '''loop_statement : K_repeat '(' expression ')' statement_or_null '''
981 # { PRepeat*tmp = new PRepeat($3, $5);
982 # FILE_NAME(tmp, @1);
986 def p_loop_statement_5(p
):
987 '''loop_statement : K_while '(' expression ')' statement_or_null '''
989 # { PWhile*tmp = new PWhile($3, $5);
990 # FILE_NAME(tmp, @1);
994 def p_loop_statement_6(p
):
995 '''loop_statement : K_do statement_or_null K_while '(' expression ')' ';' '''
997 # { PDoWhile*tmp = new PDoWhile($5, $2);
998 # FILE_NAME(tmp, @1);
1002 def p_loop_statement_7(p
):
1003 '''loop_statement : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' _embed1_loop_statement statement_or_null '''
1005 # { PForeach*tmp_for = pform_make_foreach(@1, $3, $5, $9);
1007 # pform_pop_scope();
1008 # vector<Statement*>tmp_for_list(1);
1009 # tmp_for_list[0] = tmp_for;
1010 # PBlock*tmp_blk = current_block_stack.top();
1011 # current_block_stack.pop();
1012 # tmp_blk->set_statement(tmp_for_list);
1016 def p_loop_statement_8(p
):
1017 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' error ')' statement_or_null '''
1020 # yyerror(@1, "error: Error in for loop step assignment.");
1023 def p_loop_statement_9(p
):
1024 '''loop_statement : K_for '(' lpvalue '=' expression ';' error ';' for_step ')' statement_or_null '''
1027 # yyerror(@1, "error: Error in for loop condition expression.");
1030 def p_loop_statement_10(p
):
1031 '''loop_statement : K_for '(' error ')' statement_or_null '''
1034 # yyerror(@1, "error: Incomprehensible for loop.");
1037 def p_loop_statement_11(p
):
1038 '''loop_statement : K_while '(' error ')' statement_or_null '''
1041 # yyerror(@1, "error: Error in while loop condition.");
1044 def p_loop_statement_12(p
):
1045 '''loop_statement : K_do statement_or_null K_while '(' error ')' ';' '''
1048 # yyerror(@1, "error: Error in do/while loop condition.");
1051 def p_loop_statement_13(p
):
1052 '''loop_statement : K_foreach '(' IDENTIFIER '[' error ']' ')' statement_or_null '''
1055 # yyerror(@4, "error: Errors in foreach loop variables list.");
1058 def p__embed0_loop_statement(p
):
1059 '''_embed0_loop_statement : '''
1060 # { static unsigned for_counter = 0;
1061 # char for_block_name [64];
1062 # snprintf(for_block_name, sizeof for_block_name, "$ivl_for_loop%u", for_counter);
1064 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1065 # FILE_NAME(tmp, @1);
1066 # current_block_stack.push(tmp);
1068 # list<decl_assignment_t*>assign_list;
1069 # decl_assignment_t*tmp_assign = new decl_assignment_t;
1070 # tmp_assign->name = lex_strings.make($4);
1071 # assign_list.push_back(tmp_assign);
1072 # pform_makewire(@4, 0, str_strength, &assign_list, NetNet::REG, $3);
1075 def p__embed1_loop_statement(p
):
1076 '''_embed1_loop_statement : '''
1077 # { static unsigned foreach_counter = 0;
1078 # char for_block_name[64];
1079 # snprintf(for_block_name, sizeof for_block_name, "$ivl_foreach%u", foreach_counter);
1080 # foreach_counter += 1;
1082 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1083 # FILE_NAME(tmp, @1);
1084 # current_block_stack.push(tmp);
1086 # pform_make_foreach_declarations(@1, $5);
1089 def p_list_of_variable_decl_assignments_1(p
):
1090 '''list_of_variable_decl_assignments : variable_decl_assignment '''
1092 # { list<decl_assignment_t*>*tmp = new list<decl_assignment_t*>;
1093 # tmp->push_back($1);
1097 def p_list_of_variable_decl_assignments_2(p
):
1098 '''list_of_variable_decl_assignments : list_of_variable_decl_assignments ',' variable_decl_assignment '''
1100 # { list<decl_assignment_t*>*tmp = $1;
1101 # tmp->push_back($3);
1105 def p_variable_decl_assignment_1(p
):
1106 '''variable_decl_assignment : IDENTIFIER dimensions_opt '''
1108 # { decl_assignment_t*tmp = new decl_assignment_t;
1109 # tmp->name = lex_strings.make($1);
1118 def p_variable_decl_assignment_2(p
):
1119 '''variable_decl_assignment : IDENTIFIER '=' expression '''
1121 # { decl_assignment_t*tmp = new decl_assignment_t;
1122 # tmp->name = lex_strings.make($1);
1123 # tmp->expr .reset($3);
1128 def p_variable_decl_assignment_3(p
):
1129 '''variable_decl_assignment : IDENTIFIER '=' K_new '(' ')' '''
1131 # { decl_assignment_t*tmp = new decl_assignment_t;
1132 # tmp->name = lex_strings.make($1);
1133 # PENewClass*expr = new PENewClass;
1134 # FILE_NAME(expr, @3);
1135 # tmp->expr .reset(expr);
1140 def p_loop_variables_1(p
):
1141 '''loop_variables : loop_variables ',' IDENTIFIER '''
1143 # { list<perm_string>*tmp = $1;
1144 # tmp->push_back(lex_strings.make($3));
1149 def p_loop_variables_2(p
):
1150 '''loop_variables : IDENTIFIER '''
1152 # { list<perm_string>*tmp = new list<perm_string>;
1153 # tmp->push_back(lex_strings.make($1));
1158 def p_method_qualifier_1(p
):
1159 '''method_qualifier : K_virtual '''
1162 def p_method_qualifier_2(p
):
1163 '''method_qualifier : class_item_qualifier '''
1166 def p_method_qualifier_opt_1(p
):
1167 '''method_qualifier_opt : method_qualifier '''
1170 def p_method_qualifier_opt_2(p
):
1171 '''method_qualifier_opt : '''
1174 def p_modport_declaration_1(p
):
1175 '''modport_declaration : K_modport _embed0_modport_declaration modport_item_list ';' '''
1178 def p__embed0_modport_declaration(p
):
1179 '''_embed0_modport_declaration : '''
1180 # { if (!pform_in_interface())
1181 # yyerror(@1, "error: modport declarations are only allowed "
1182 # "in interfaces.");
1185 def p_modport_item_list_1(p
):
1186 '''modport_item_list : modport_item '''
1189 def p_modport_item_list_2(p
):
1190 '''modport_item_list : modport_item_list ',' modport_item '''
1193 def p_modport_item_1(p
):
1194 '''modport_item : IDENTIFIER _embed0_modport_item '(' modport_ports_list ')' '''
1196 # { pform_end_modport_item(@1); }
1198 def p__embed0_modport_item(p
):
1199 '''_embed0_modport_item : '''
1200 # { pform_start_modport_item(@1, $1); }
1202 def p_modport_ports_list_1(p
):
1203 '''modport_ports_list : modport_ports_declaration '''
1206 def p_modport_ports_list_2(p
):
1207 '''modport_ports_list : modport_ports_list ',' modport_ports_declaration '''
1210 def p_modport_ports_list_3(p
):
1211 '''modport_ports_list : modport_ports_list ',' modport_simple_port '''
1213 # { if (last_modport_port.type == MP_SIMPLE) {
1214 # pform_add_modport_port(@3, last_modport_port.direction,
1215 # $3->name, $3->parm);
1217 # yyerror(@3, "error: modport expression not allowed here.");
1222 def p_modport_ports_list_4(p
):
1223 '''modport_ports_list : modport_ports_list ',' modport_tf_port '''
1225 # { if (last_modport_port.type != MP_TF)
1226 # yyerror(@3, "error: task/function declaration not allowed here.");
1229 def p_modport_ports_list_5(p
):
1230 '''modport_ports_list : modport_ports_list ',' IDENTIFIER '''
1232 # { if (last_modport_port.type == MP_SIMPLE) {
1233 # pform_add_modport_port(@3, last_modport_port.direction,
1234 # lex_strings.make($3), 0);
1235 # } else if (last_modport_port.type != MP_TF) {
1236 # yyerror(@3, "error: list of identifiers not allowed here.");
1241 def p_modport_ports_list_6(p
):
1242 '''modport_ports_list : modport_ports_list ',' '''
1244 # { yyerror(@2, "error: NULL port declarations are not allowed"); }
1246 def p_modport_ports_declaration_1(p
):
1247 '''modport_ports_declaration : attribute_list_opt port_direction IDENTIFIER '''
1249 # { last_modport_port.type = MP_SIMPLE;
1250 # last_modport_port.direction = $2;
1251 # pform_add_modport_port(@3, $2, lex_strings.make($3), 0);
1256 def p_modport_ports_declaration_2(p
):
1257 '''modport_ports_declaration : attribute_list_opt port_direction modport_simple_port '''
1259 # { last_modport_port.type = MP_SIMPLE;
1260 # last_modport_port.direction = $2;
1261 # pform_add_modport_port(@3, $2, $3->name, $3->parm);
1266 def p_modport_ports_declaration_3(p
):
1267 '''modport_ports_declaration : attribute_list_opt import_export IDENTIFIER '''
1269 # { last_modport_port.type = MP_TF;
1270 # last_modport_port.is_import = $2;
1271 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
1276 def p_modport_ports_declaration_4(p
):
1277 '''modport_ports_declaration : attribute_list_opt import_export modport_tf_port '''
1279 # { last_modport_port.type = MP_TF;
1280 # last_modport_port.is_import = $2;
1281 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
1285 def p_modport_ports_declaration_5(p
):
1286 '''modport_ports_declaration : attribute_list_opt K_clocking IDENTIFIER '''
1288 # { last_modport_port.type = MP_CLOCKING;
1289 # last_modport_port.direction = NetNet::NOT_A_PORT;
1290 # yyerror(@3, "sorry: modport clocking declaration is not yet supported.");
1295 def p_modport_simple_port_1(p
):
1296 '''modport_simple_port : '.' IDENTIFIER '(' expression ')' '''
1298 # { named_pexpr_t*tmp = new named_pexpr_t;
1299 # tmp->name = lex_strings.make($2);
1305 def p_modport_tf_port_1(p
):
1306 '''modport_tf_port : K_task IDENTIFIER '''
1309 def p_modport_tf_port_2(p
):
1310 '''modport_tf_port : K_task IDENTIFIER '(' tf_port_list_opt ')' '''
1313 def p_modport_tf_port_3(p
):
1314 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '''
1317 def p_modport_tf_port_4(p
):
1318 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' '''
1321 def p_non_integer_type_1(p
):
1322 '''non_integer_type : K_real '''
1324 # { $$ = real_type_t::REAL; }
1326 def p_non_integer_type_2(p
):
1327 '''non_integer_type : K_realtime '''
1329 # { $$ = real_type_t::REAL; }
1331 def p_non_integer_type_3(p
):
1332 '''non_integer_type : K_shortreal '''
1334 # { $$ = real_type_t::SHORTREAL; }
1337 '''number : BASED_NUMBER '''
1339 # { $$ = $1; based_size = 0;}
1342 '''number : DEC_NUMBER '''
1344 # { $$ = $1; based_size = 0;}
1347 '''number : DEC_NUMBER BASED_NUMBER '''
1349 # { $$ = pform_verinum_with_size($1,$2, @2.text, @2.first_line);
1353 '''number : UNBASED_NUMBER '''
1355 # { $$ = $1; based_size = 0;}
1358 '''number : DEC_NUMBER UNBASED_NUMBER '''
1360 # { yyerror(@1, "error: Unbased SystemVerilog literal cannot have "
1362 # $$ = $1; based_size = 0;}
1364 def p_open_range_list_1(p
):
1365 '''open_range_list : open_range_list ',' value_range '''
1368 def p_open_range_list_2(p
):
1369 '''open_range_list : value_range '''
1372 def p_package_declaration_1(p
):
1373 '''package_declaration : K_package lifetime_opt IDENTIFIER ';' _embed0_package_declaration timeunits_declaration_opt _embed1_package_declaration package_item_list_opt K_endpackage endlabel_opt '''
1375 # { pform_end_package_declaration(@1);
1376 # // If an end label is present make sure it match the package name.
1378 # if (strcmp($3,$10) != 0) {
1379 # yyerror(@10, "error: End label doesn't match package name");
1386 def p__embed0_package_declaration(p
):
1387 '''_embed0_package_declaration : '''
1388 # { pform_start_package_declaration(@1, $3, $2); }
1390 def p__embed1_package_declaration(p
):
1391 '''_embed1_package_declaration : '''
1392 # { pform_set_scope_timescale(@1); }
1394 def p_module_package_import_list_opt_1(p
):
1395 '''module_package_import_list_opt : '''
1398 def p_module_package_import_list_opt_2(p
):
1399 '''module_package_import_list_opt : package_import_list '''
1402 def p_package_import_list_1(p
):
1403 '''package_import_list : package_import_declaration '''
1406 def p_package_import_list_2(p
):
1407 '''package_import_list : package_import_list package_import_declaration '''
1410 def p_package_import_declaration_1(p
):
1411 '''package_import_declaration : K_import package_import_item_list ';' '''
1415 def p_package_import_item_1(p
):
1416 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '''
1418 # { pform_package_import(@2, $1, $3);
1422 def p_package_import_item_2(p
):
1423 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES '*' '''
1425 # { pform_package_import(@2, $1, 0);
1428 def p_package_import_item_list_1(p
):
1429 '''package_import_item_list : package_import_item_list ',' package_import_item '''
1432 def p_package_import_item_list_2(p
):
1433 '''package_import_item_list : package_import_item '''
1436 def p_package_item_1(p
):
1437 '''package_item : timeunits_declaration '''
1440 def p_package_item_2(p
):
1441 '''package_item : K_parameter param_type parameter_assign_list ';' '''
1444 def p_package_item_3(p
):
1445 '''package_item : K_localparam param_type localparam_assign_list ';' '''
1448 def p_package_item_4(p
):
1449 '''package_item : type_declaration '''
1452 def p_package_item_5(p
):
1453 '''package_item : function_declaration '''
1456 def p_package_item_6(p
):
1457 '''package_item : task_declaration '''
1460 def p_package_item_7(p
):
1461 '''package_item : data_declaration '''
1464 def p_package_item_8(p
):
1465 '''package_item : class_declaration '''
1468 def p_package_item_list_1(p
):
1469 '''package_item_list : package_item_list package_item '''
1472 def p_package_item_list_2(p
):
1473 '''package_item_list : package_item '''
1476 def p_package_item_list_opt_1(p
):
1477 '''package_item_list_opt : package_item_list '''
1480 def p_package_item_list_opt_2(p
):
1481 '''package_item_list_opt : '''
1484 def p_port_direction_1(p
):
1485 '''port_direction : K_input '''
1487 # { $$ = NetNet::PINPUT; }
1489 def p_port_direction_2(p
):
1490 '''port_direction : K_output '''
1492 # { $$ = NetNet::POUTPUT; }
1494 def p_port_direction_3(p
):
1495 '''port_direction : K_inout '''
1497 # { $$ = NetNet::PINOUT; }
1499 def p_port_direction_4(p
):
1500 '''port_direction : K_ref '''
1502 # { $$ = NetNet::PREF;
1503 # if (!gn_system_verilog()) {
1504 # yyerror(@1, "error: Reference ports (ref) require SystemVerilog.");
1505 # $$ = NetNet::PINPUT;
1509 def p_port_direction_opt_1(p
):
1510 '''port_direction_opt : port_direction '''
1514 def p_port_direction_opt_2(p
):
1515 '''port_direction_opt : '''
1517 # { $$ = NetNet::PIMPLICIT; }
1519 def p_property_expr_1(p
):
1520 '''property_expr : expression '''
1523 def p_procedural_assertion_statement_1(p
):
1524 '''procedural_assertion_statement : K_assert '(' expression ')' statement %prec less_than_K_else '''
1526 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1530 def p_procedural_assertion_statement_2(p
):
1531 '''procedural_assertion_statement : K_assert '(' expression ')' K_else statement '''
1533 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1537 def p_procedural_assertion_statement_3(p
):
1538 '''procedural_assertion_statement : K_assert '(' expression ')' statement K_else statement '''
1540 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1544 def p_property_qualifier_1(p
):
1545 '''property_qualifier : class_item_qualifier '''
1548 def p_property_qualifier_2(p
):
1549 '''property_qualifier : random_qualifier '''
1552 def p_property_qualifier_opt_1(p
):
1553 '''property_qualifier_opt : property_qualifier_list '''
1557 def p_property_qualifier_opt_2(p
):
1558 '''property_qualifier_opt : '''
1560 # { $$ = property_qualifier_t::make_none(); }
1562 def p_property_qualifier_list_1(p
):
1563 '''property_qualifier_list : property_qualifier_list property_qualifier '''
1567 def p_property_qualifier_list_2(p
):
1568 '''property_qualifier_list : property_qualifier '''
1572 def p_property_spec_1(p
):
1573 '''property_spec : clocking_event_opt property_spec_disable_iff_opt property_expr '''
1576 def p_property_spec_disable_iff_opt_1(p
):
1577 '''property_spec_disable_iff_opt : K_disable K_iff '(' expression ')' '''
1580 def p_property_spec_disable_iff_opt_2(p
):
1581 '''property_spec_disable_iff_opt : '''
1584 def p_random_qualifier_1(p
):
1585 '''random_qualifier : K_rand '''
1587 # { $$ = property_qualifier_t::make_rand(); }
1589 def p_random_qualifier_2(p
):
1590 '''random_qualifier : K_randc '''
1592 # { $$ = property_qualifier_t::make_randc(); }
1594 def p_real_or_realtime_1(p
):
1595 '''real_or_realtime : K_real '''
1598 def p_real_or_realtime_2(p
):
1599 '''real_or_realtime : K_realtime '''
1603 '''signing : K_signed '''
1608 '''signing : K_unsigned '''
1612 def p_simple_type_or_string_1(p
):
1613 '''simple_type_or_string : integer_vector_type '''
1615 # { ivl_variable_type_t use_vtype = $1;
1616 # bool reg_flag = false;
1617 # if (use_vtype == IVL_VT_NO_TYPE) {
1618 # use_vtype = IVL_VT_LOGIC;
1621 # vector_type_t*tmp = new vector_type_t(use_vtype, false, 0);
1622 # tmp->reg_flag = reg_flag;
1623 # FILE_NAME(tmp, @1);
1627 def p_simple_type_or_string_2(p
):
1628 '''simple_type_or_string : non_integer_type '''
1630 # { real_type_t*tmp = new real_type_t($1);
1631 # FILE_NAME(tmp, @1);
1635 def p_simple_type_or_string_3(p
):
1636 '''simple_type_or_string : atom2_type '''
1638 # { atom2_type_t*tmp = new atom2_type_t($1, true);
1639 # FILE_NAME(tmp, @1);
1643 def p_simple_type_or_string_4(p
):
1644 '''simple_type_or_string : K_integer '''
1646 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
1647 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd);
1648 # tmp->reg_flag = true;
1649 # tmp->integer_flag = true;
1653 def p_simple_type_or_string_5(p
):
1654 '''simple_type_or_string : K_time '''
1656 # { list<pform_range_t>*pd = make_range_from_width(64);
1657 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
1658 # tmp->reg_flag = !gn_system_verilog();
1662 def p_simple_type_or_string_6(p
):
1663 '''simple_type_or_string : TYPE_IDENTIFIER '''
1669 def p_simple_type_or_string_7(p
):
1670 '''simple_type_or_string : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_simple_type_or_string TYPE_IDENTIFIER '''
1672 # { lex_in_package_scope(0);
1677 def p_simple_type_or_string_8(p
):
1678 '''simple_type_or_string : K_string '''
1680 # { string_type_t*tmp = new string_type_t;
1681 # FILE_NAME(tmp, @1);
1685 def p__embed0_simple_type_or_string(p
):
1686 '''_embed0_simple_type_or_string : '''
1687 # { lex_in_package_scope($1); }
1689 def p_statement_1(p
):
1690 '''statement : attribute_list_opt statement_item '''
1692 # { pform_bind_attributes($2->attributes, $1);
1696 def p_statement_or_null_1(p
):
1697 '''statement_or_null : statement '''
1701 def p_statement_or_null_2(p
):
1702 '''statement_or_null : attribute_list_opt ';' '''
1706 def p_stream_expression_1(p
):
1707 '''stream_expression : expression '''
1710 def p_stream_expression_list_1(p
):
1711 '''stream_expression_list : stream_expression_list ',' stream_expression '''
1714 def p_stream_expression_list_2(p
):
1715 '''stream_expression_list : stream_expression '''
1718 def p_stream_operator_1(p
):
1719 '''stream_operator : K_LS '''
1722 def p_stream_operator_2(p
):
1723 '''stream_operator : K_RS '''
1726 def p_streaming_concatenation_1(p
):
1727 '''streaming_concatenation : '{' stream_operator '{' stream_expression_list '}' '}' '''
1729 # { /* streaming concatenation is a SystemVerilog thing. */
1730 # if (gn_system_verilog()) {
1731 # yyerror(@2, "sorry: Streaming concatenation not supported.");
1734 # yyerror(@2, "error: Streaming concatenation requires SystemVerilog");
1739 def p_task_declaration_1(p
):
1740 '''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 '''
1742 # { // Last step: check any closing name. This is done late so
1743 # // that the parser can look ahead to detect the present
1744 # // endlabel_opt but still have the pform_endmodule() called
1745 # // early enough that the lexor can know we are outside the
1748 # if (strcmp($3,$10) != 0) {
1749 # yyerror(@10, "error: End label doesn't match task name");
1751 # if (! gn_system_verilog()) {
1752 # yyerror(@10, "error: Task end labels require "
1753 # "SystemVerilog.");
1760 def p_task_declaration_2(p
):
1761 '''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 '''
1763 # { // Last step: check any closing name. This is done late so
1764 # // that the parser can look ahead to detect the present
1765 # // endlabel_opt but still have the pform_endmodule() called
1766 # // early enough that the lexor can know we are outside the
1769 # if (strcmp($3,$13) != 0) {
1770 # yyerror(@13, "error: End label doesn't match task name");
1772 # if (! gn_system_verilog()) {
1773 # yyerror(@13, "error: Task end labels require "
1774 # "SystemVerilog.");
1781 def p_task_declaration_3(p
):
1782 '''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 '''
1784 # { // Last step: check any closing name. This is done late so
1785 # // that the parser can look ahead to detect the present
1786 # // endlabel_opt but still have the pform_endmodule() called
1787 # // early enough that the lexor can know we are outside the
1790 # if (strcmp($3,$12) != 0) {
1791 # yyerror(@12, "error: End label doesn't match task name");
1793 # if (! gn_system_verilog()) {
1794 # yyerror(@12, "error: Task end labels require "
1795 # "SystemVerilog.");
1802 def p_task_declaration_4(p
):
1803 '''task_declaration : K_task lifetime_opt IDENTIFIER error K_endtask _embed6_task_declaration endlabel_opt '''
1805 # { // Last step: check any closing name. This is done late so
1806 # // that the parser can look ahead to detect the present
1807 # // endlabel_opt but still have the pform_endmodule() called
1808 # // early enough that the lexor can know we are outside the
1811 # if (strcmp($3,$7) != 0) {
1812 # yyerror(@7, "error: End label doesn't match task name");
1814 # if (! gn_system_verilog()) {
1815 # yyerror(@7, "error: Task end labels require "
1816 # "SystemVerilog.");
1823 def p__embed0_task_declaration(p
):
1824 '''_embed0_task_declaration : '''
1825 # { assert(current_task == 0);
1826 # current_task = pform_push_task_scope(@1, $3, $2);
1829 def p__embed1_task_declaration(p
):
1830 '''_embed1_task_declaration : '''
1831 # { current_task->set_ports($6);
1832 # current_task_set_statement(@3, $7);
1833 # pform_set_this_class(@3, current_task);
1834 # pform_pop_scope();
1836 # if ($7 && $7->size() > 1 && !gn_system_verilog()) {
1837 # yyerror(@7, "error: Task body with multiple statements requires SystemVerilog.");
1842 def p__embed2_task_declaration(p
):
1843 '''_embed2_task_declaration : '''
1844 # { assert(current_task == 0);
1845 # current_task = pform_push_task_scope(@1, $3, $2);
1848 def p__embed3_task_declaration(p
):
1849 '''_embed3_task_declaration : '''
1850 # { current_task->set_ports($6);
1851 # current_task_set_statement(@3, $10);
1852 # pform_set_this_class(@3, current_task);
1853 # pform_pop_scope();
1855 # if ($10) delete $10;
1858 def p__embed4_task_declaration(p
):
1859 '''_embed4_task_declaration : '''
1860 # { assert(current_task == 0);
1861 # current_task = pform_push_task_scope(@1, $3, $2);
1864 def p__embed5_task_declaration(p
):
1865 '''_embed5_task_declaration : '''
1866 # { current_task->set_ports(0);
1867 # current_task_set_statement(@3, $9);
1868 # pform_set_this_class(@3, current_task);
1869 # if (! current_task->method_of()) {
1870 # cerr << @3 << ": warning: task definition for \"" << $3
1871 # << "\" has an empty port declaration list!" << endl;
1873 # pform_pop_scope();
1875 # if ($9->size() > 1 && !gn_system_verilog()) {
1876 # yyerror(@9, "error: Task body with multiple statements requires SystemVerilog.");
1881 def p__embed6_task_declaration(p
):
1882 '''_embed6_task_declaration : '''
1884 # if (current_task) {
1885 # pform_pop_scope();
1890 def p_tf_port_declaration_1(p
):
1891 '''tf_port_declaration : port_direction K_reg_opt unsigned_signed_opt dimensions_opt list_of_identifiers ';' '''
1893 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1,
1894 # $2 ? IVL_VT_LOGIC :
1900 def p_tf_port_declaration_2(p
):
1901 '''tf_port_declaration : port_direction K_integer list_of_identifiers ';' '''
1903 # { list<pform_range_t>*range_stub = make_range_from_width(integer_width);
1904 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_LOGIC, true,
1905 # range_stub, $3, true);
1909 def p_tf_port_declaration_3(p
):
1910 '''tf_port_declaration : port_direction K_time list_of_identifiers ';' '''
1912 # { list<pform_range_t>*range_stub = make_range_from_width(64);
1913 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_LOGIC, false,
1918 def p_tf_port_declaration_4(p
):
1919 '''tf_port_declaration : port_direction real_or_realtime list_of_identifiers ';' '''
1921 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_REAL, true,
1926 def p_tf_port_declaration_5(p
):
1927 '''tf_port_declaration : port_direction K_string list_of_identifiers ';' '''
1929 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_STRING, true,
1934 def p_tf_port_item_1(p
):
1935 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER dimensions_opt tf_port_item_expr_opt '''
1937 # { vector<pform_tf_port_t>*tmp;
1938 # NetNet::PortType use_port_type = $1;
1939 # if ((use_port_type == NetNet::PIMPLICIT) && (gn_system_verilog() || ($2 == 0)))
1940 # use_port_type = port_declaration_context.port_type;
1941 # perm_string name = lex_strings.make($3);
1942 # list<perm_string>* ilist = list_from_identifier($3);
1944 # if (use_port_type == NetNet::PIMPLICIT) {
1945 # yyerror(@1, "error: missing task/function port direction.");
1946 # use_port_type = NetNet::PINPUT; // for error recovery
1948 # if (($2 == 0) && ($1==NetNet::PIMPLICIT)) {
1949 # // Detect special case this is an undecorated
1950 # // identifier and we need to get the declaration from
1953 # yyerror(@4, "internal error: How can there be an unpacked range here?\n");
1955 # tmp = pform_make_task_ports(@3, use_port_type,
1956 # port_declaration_context.data_type,
1960 # // Otherwise, the decorations for this identifier
1961 # // indicate the type. Save the type for any right
1962 # // context that may come later.
1963 # port_declaration_context.port_type = use_port_type;
1965 # $2 = new vector_type_t(IVL_VT_LOGIC, false, 0);
1966 # FILE_NAME($2, @3);
1968 # port_declaration_context.data_type = $2;
1969 # tmp = pform_make_task_ports(@3, use_port_type, $2, ilist);
1972 # pform_set_reg_idx(name, $4);
1977 # assert(tmp->size()==1);
1978 # tmp->front().defe = $5;
1982 def p_tf_port_item_2(p
):
1983 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER error '''
1985 # { yyerror(@3, "error: Error in task/function port item after port name %s.", $3);
1990 def p_tf_port_item_expr_opt_1(p
):
1991 '''tf_port_item_expr_opt : '=' expression '''
1993 # { if (! gn_system_verilog()) {
1994 # yyerror(@1, "error: Task/function default arguments require "
1995 # "SystemVerilog.");
2000 def p_tf_port_item_expr_opt_2(p
):
2001 '''tf_port_item_expr_opt : '''
2005 def p_tf_port_list_1(p
):
2006 '''tf_port_list : _embed0_tf_port_list tf_port_item_list '''
2010 def p__embed0_tf_port_list(p
):
2011 '''_embed0_tf_port_list : '''
2012 # { port_declaration_context.port_type = gn_system_verilog() ? NetNet::PINPUT : NetNet::PIMPLICIT;
2013 # port_declaration_context.data_type = 0;
2016 def p_tf_port_item_list_1(p
):
2017 '''tf_port_item_list : tf_port_item_list ',' tf_port_item '''
2019 # { vector<pform_tf_port_t>*tmp;
2021 # size_t s1 = $1->size();
2023 # tmp->resize(tmp->size()+$3->size());
2024 # for (size_t idx = 0 ; idx < $3->size() ; idx += 1)
2025 # tmp->at(s1+idx) = $3->at(idx);
2035 def p_tf_port_item_list_2(p
):
2036 '''tf_port_item_list : tf_port_item '''
2040 def p_tf_port_item_list_3(p
):
2041 '''tf_port_item_list : error ',' tf_port_item '''
2043 # { yyerror(@2, "error: Syntax error in task/function port declaration.");
2047 def p_tf_port_item_list_4(p
):
2048 '''tf_port_item_list : tf_port_item_list ',' '''
2050 # { yyerror(@2, "error: NULL port declarations are not allowed.");
2054 def p_tf_port_item_list_5(p
):
2055 '''tf_port_item_list : tf_port_item_list ';' '''
2057 # { yyerror(@2, "error: ';' is an invalid port declaration separator.");
2061 def p_timeunits_declaration_1(p
):
2062 '''timeunits_declaration : K_timeunit TIME_LITERAL ';' '''
2064 # { pform_set_timeunit($2, allow_timeunit_decl); }
2066 def p_timeunits_declaration_2(p
):
2067 '''timeunits_declaration : K_timeunit TIME_LITERAL '/' TIME_LITERAL ';' '''
2069 # { bool initial_decl = allow_timeunit_decl && allow_timeprec_decl;
2070 # pform_set_timeunit($2, initial_decl);
2071 # pform_set_timeprec($4, initial_decl);
2074 def p_timeunits_declaration_3(p
):
2075 '''timeunits_declaration : K_timeprecision TIME_LITERAL ';' '''
2077 # { pform_set_timeprec($2, allow_timeprec_decl); }
2079 def p_timeunits_declaration_opt_1(p
):
2080 '''timeunits_declaration_opt : %prec no_timeunits_declaration '''
2083 def p_timeunits_declaration_opt_2(p
):
2084 '''timeunits_declaration_opt : timeunits_declaration %prec one_timeunits_declaration '''
2087 def p_timeunits_declaration_opt_3(p
):
2088 '''timeunits_declaration_opt : timeunits_declaration timeunits_declaration '''
2091 def p_value_range_1(p
):
2092 '''value_range : expression '''
2096 def p_value_range_2(p
):
2097 '''value_range : '[' expression ':' expression ']' '''
2101 def p_variable_dimension_1(p
):
2102 '''variable_dimension : '[' expression ':' expression ']' '''
2104 # { list<pform_range_t> *tmp = new list<pform_range_t>;
2105 # pform_range_t index ($2,$4);
2106 # tmp->push_back(index);
2110 def p_variable_dimension_2(p
):
2111 '''variable_dimension : '[' expression ']' '''
2113 # { // SystemVerilog canonical range
2114 # if (!gn_system_verilog()) {
2116 # cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. "
2117 # << "Use at least -g2005-sv to remove this warning." << endl;
2119 # list<pform_range_t> *tmp = new list<pform_range_t>;
2120 # pform_range_t index;
2121 # index.first = new PENumber(new verinum((uint64_t)0, integer_width));
2122 # index.second = new PEBinary('-', $2, new PENumber(new verinum((uint64_t)1, integer_width)));
2123 # tmp->push_back(index);
2127 def p_variable_dimension_3(p
):
2128 '''variable_dimension : '[' ']' '''
2130 # { list<pform_range_t> *tmp = new list<pform_range_t>;
2131 # pform_range_t index (0,0);
2132 # tmp->push_back(index);
2136 def p_variable_dimension_4(p
):
2137 '''variable_dimension : '[' '$' ']' '''
2139 # { // SystemVerilog queue
2140 # list<pform_range_t> *tmp = new list<pform_range_t>;
2141 # pform_range_t index (new PENull,0);
2142 # if (!gn_system_verilog()) {
2143 # yyerror("error: Queue declarations require SystemVerilog.");
2145 # tmp->push_back(index);
2149 def p_variable_lifetime_1(p
):
2150 '''variable_lifetime : lifetime '''
2152 # { if (!gn_system_verilog()) {
2153 # yyerror(@1, "error: overriding the default variable lifetime "
2154 # "requires SystemVerilog.");
2155 # } else if ($1 != pform_peek_scope()->default_lifetime) {
2156 # yyerror(@1, "sorry: overriding the default variable lifetime "
2157 # "is not yet supported.");
2159 # var_lifetime = $1;
2162 def p_attribute_list_opt_1(p
):
2163 '''attribute_list_opt : attribute_instance_list '''
2167 def p_attribute_list_opt_2(p
):
2168 '''attribute_list_opt : '''
2172 def p_attribute_instance_list_1(p
):
2173 '''attribute_instance_list : K_PSTAR K_STARP '''
2177 def p_attribute_instance_list_2(p
):
2178 '''attribute_instance_list : K_PSTAR attribute_list K_STARP '''
2182 def p_attribute_instance_list_3(p
):
2183 '''attribute_instance_list : attribute_instance_list K_PSTAR K_STARP '''
2187 def p_attribute_instance_list_4(p
):
2188 '''attribute_instance_list : attribute_instance_list K_PSTAR attribute_list K_STARP '''
2190 # { list<named_pexpr_t>*tmp = $1;
2192 # tmp->splice(tmp->end(), *$3);
2198 def p_attribute_list_1(p
):
2199 '''attribute_list : attribute_list ',' attribute '''
2201 # { list<named_pexpr_t>*tmp = $1;
2202 # tmp->push_back(*$3);
2207 def p_attribute_list_2(p
):
2208 '''attribute_list : attribute '''
2210 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
2211 # tmp->push_back(*$1);
2216 def p_attribute_1(p
):
2217 '''attribute : IDENTIFIER '''
2219 # { named_pexpr_t*tmp = new named_pexpr_t;
2220 # tmp->name = lex_strings.make($1);
2226 def p_attribute_2(p
):
2227 '''attribute : IDENTIFIER '=' expression '''
2230 # named_pexpr_t*tmp2 = new named_pexpr_t;
2231 # tmp2->name = lex_strings.make($1);
2237 def p_block_item_decl_1(p
):
2238 '''block_item_decl : data_type register_variable_list ';' '''
2240 # { if ($1) pform_set_data_type(@1, $1, $2, NetNet::REG, attributes_in_context);
2243 def p_block_item_decl_2(p
):
2244 '''block_item_decl : variable_lifetime data_type register_variable_list ';' '''
2246 # { if ($2) pform_set_data_type(@2, $2, $3, NetNet::REG, attributes_in_context);
2247 # var_lifetime = LexicalScope::INHERITED;
2250 def p_block_item_decl_3(p
):
2251 '''block_item_decl : K_reg data_type register_variable_list ';' '''
2253 # { if ($2) pform_set_data_type(@2, $2, $3, NetNet::REG, attributes_in_context);
2256 def p_block_item_decl_4(p
):
2257 '''block_item_decl : variable_lifetime K_reg data_type register_variable_list ';' '''
2259 # { if ($3) pform_set_data_type(@3, $3, $4, NetNet::REG, attributes_in_context);
2260 # var_lifetime = LexicalScope::INHERITED;
2263 def p_block_item_decl_5(p
):
2264 '''block_item_decl : K_event event_variable_list ';' '''
2266 # { if ($2) pform_make_events($2, @1.text, @1.first_line);
2269 def p_block_item_decl_6(p
):
2270 '''block_item_decl : K_parameter param_type parameter_assign_list ';' '''
2273 def p_block_item_decl_7(p
):
2274 '''block_item_decl : K_localparam param_type localparam_assign_list ';' '''
2277 def p_block_item_decl_8(p
):
2278 '''block_item_decl : type_declaration '''
2281 def p_block_item_decl_9(p
):
2282 '''block_item_decl : K_integer error ';' '''
2284 # { yyerror(@1, "error: syntax error in integer variable list.");
2288 def p_block_item_decl_10(p
):
2289 '''block_item_decl : K_time error ';' '''
2291 # { yyerror(@1, "error: syntax error in time variable list.");
2295 def p_block_item_decl_11(p
):
2296 '''block_item_decl : K_parameter error ';' '''
2298 # { yyerror(@1, "error: syntax error in parameter list.");
2302 def p_block_item_decl_12(p
):
2303 '''block_item_decl : K_localparam error ';' '''
2305 # { yyerror(@1, "error: syntax error localparam list.");
2309 def p_block_item_decls_1(p
):
2310 '''block_item_decls : block_item_decl '''
2313 def p_block_item_decls_2(p
):
2314 '''block_item_decls : block_item_decls block_item_decl '''
2317 def p_block_item_decls_opt_1(p
):
2318 '''block_item_decls_opt : block_item_decls '''
2322 def p_block_item_decls_opt_2(p
):
2323 '''block_item_decls_opt : '''
2327 def p_type_declaration_1(p
):
2328 '''type_declaration : K_typedef data_type IDENTIFIER dimensions_opt ';' '''
2330 # { perm_string name = lex_strings.make($3);
2331 # pform_set_typedef(name, $2, $4);
2335 def p_type_declaration_2(p
):
2336 '''type_declaration : K_typedef data_type TYPE_IDENTIFIER ';' '''
2338 # { perm_string name = lex_strings.make($3.text);
2339 # if (pform_test_type_identifier_local(name)) {
2340 # yyerror(@3, "error: Typedef identifier \"%s\" is already a type name.", $3.text);
2343 # pform_set_typedef(name, $2, NULL);
2348 def p_type_declaration_3(p
):
2349 '''type_declaration : K_typedef K_class IDENTIFIER ';' '''
2351 # { // Create a synthetic typedef for the class name so that the
2352 # // lexor detects the name as a type.
2353 # perm_string name = lex_strings.make($3);
2354 # class_type_t*tmp = new class_type_t(name);
2355 # FILE_NAME(tmp, @3);
2356 # pform_set_typedef(name, tmp, NULL);
2360 def p_type_declaration_4(p
):
2361 '''type_declaration : K_typedef K_enum IDENTIFIER ';' '''
2363 # { yyerror(@1, "sorry: Enum forward declarations not supported yet."); }
2365 def p_type_declaration_5(p
):
2366 '''type_declaration : K_typedef K_struct IDENTIFIER ';' '''
2368 # { yyerror(@1, "sorry: Struct forward declarations not supported yet."); }
2370 def p_type_declaration_6(p
):
2371 '''type_declaration : K_typedef K_union IDENTIFIER ';' '''
2373 # { yyerror(@1, "sorry: Union forward declarations not supported yet."); }
2375 def p_type_declaration_7(p
):
2376 '''type_declaration : K_typedef IDENTIFIER ';' '''
2378 # { // Create a synthetic typedef for the class name so that the
2379 # // lexor detects the name as a type.
2380 # perm_string name = lex_strings.make($2);
2381 # class_type_t*tmp = new class_type_t(name);
2382 # FILE_NAME(tmp, @2);
2383 # pform_set_typedef(name, tmp, NULL);
2387 def p_type_declaration_8(p
):
2388 '''type_declaration : K_typedef error ';' '''
2390 # { yyerror(@2, "error: Syntax error in typedef clause.");
2394 def p_enum_data_type_1(p
):
2395 '''enum_data_type : K_enum '{' enum_name_list '}' '''
2397 # { enum_type_t*enum_type = new enum_type_t;
2398 # FILE_NAME(enum_type, @1);
2399 # enum_type->names .reset($3);
2400 # enum_type->base_type = IVL_VT_BOOL;
2401 # enum_type->signed_flag = true;
2402 # enum_type->integer_flag = false;
2403 # enum_type->range.reset(make_range_from_width(32));
2407 def p_enum_data_type_2(p
):
2408 '''enum_data_type : K_enum atom2_type signed_unsigned_opt '{' enum_name_list '}' '''
2410 # { enum_type_t*enum_type = new enum_type_t;
2411 # FILE_NAME(enum_type, @1);
2412 # enum_type->names .reset($5);
2413 # enum_type->base_type = IVL_VT_BOOL;
2414 # enum_type->signed_flag = $3;
2415 # enum_type->integer_flag = false;
2416 # enum_type->range.reset(make_range_from_width($2));
2420 def p_enum_data_type_3(p
):
2421 '''enum_data_type : K_enum K_integer signed_unsigned_opt '{' enum_name_list '}' '''
2423 # { enum_type_t*enum_type = new enum_type_t;
2424 # FILE_NAME(enum_type, @1);
2425 # enum_type->names .reset($5);
2426 # enum_type->base_type = IVL_VT_LOGIC;
2427 # enum_type->signed_flag = $3;
2428 # enum_type->integer_flag = true;
2429 # enum_type->range.reset(make_range_from_width(integer_width));
2433 def p_enum_data_type_4(p
):
2434 '''enum_data_type : K_enum K_logic unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2436 # { enum_type_t*enum_type = new enum_type_t;
2437 # FILE_NAME(enum_type, @1);
2438 # enum_type->names .reset($6);
2439 # enum_type->base_type = IVL_VT_LOGIC;
2440 # enum_type->signed_flag = $3;
2441 # enum_type->integer_flag = false;
2442 # enum_type->range.reset($4 ? $4 : make_range_from_width(1));
2446 def p_enum_data_type_5(p
):
2447 '''enum_data_type : K_enum K_reg unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2449 # { enum_type_t*enum_type = new enum_type_t;
2450 # FILE_NAME(enum_type, @1);
2451 # enum_type->names .reset($6);
2452 # enum_type->base_type = IVL_VT_LOGIC;
2453 # enum_type->signed_flag = $3;
2454 # enum_type->integer_flag = false;
2455 # enum_type->range.reset($4 ? $4 : make_range_from_width(1));
2459 def p_enum_data_type_6(p
):
2460 '''enum_data_type : K_enum K_bit unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2462 # { enum_type_t*enum_type = new enum_type_t;
2463 # FILE_NAME(enum_type, @1);
2464 # enum_type->names .reset($6);
2465 # enum_type->base_type = IVL_VT_BOOL;
2466 # enum_type->signed_flag = $3;
2467 # enum_type->integer_flag = false;
2468 # enum_type->range.reset($4 ? $4 : make_range_from_width(1));
2472 def p_enum_name_list_1(p
):
2473 '''enum_name_list : enum_name '''
2478 def p_enum_name_list_2(p
):
2479 '''enum_name_list : enum_name_list ',' enum_name '''
2481 # { list<named_pexpr_t>*lst = $1;
2482 # lst->splice(lst->end(), *$3);
2487 def p_pos_neg_number_1(p
):
2488 '''pos_neg_number : number '''
2493 def p_pos_neg_number_2(p
):
2494 '''pos_neg_number : '-' number '''
2496 # { verinum tmp = -(*($2));
2501 def p_enum_name_1(p
):
2502 '''enum_name : IDENTIFIER '''
2504 # { perm_string name = lex_strings.make($1);
2506 # $$ = make_named_number(name);
2509 def p_enum_name_2(p
):
2510 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '''
2512 # { perm_string name = lex_strings.make($1);
2513 # long count = check_enum_seq_value(@1, $3, false);
2515 # $$ = make_named_numbers(name, 0, count-1);
2519 def p_enum_name_3(p
):
2520 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '''
2522 # { perm_string name = lex_strings.make($1);
2523 # $$ = make_named_numbers(name, check_enum_seq_value(@1, $3, true),
2524 # check_enum_seq_value(@1, $5, true));
2530 def p_enum_name_4(p
):
2531 '''enum_name : IDENTIFIER '=' expression '''
2533 # { perm_string name = lex_strings.make($1);
2535 # $$ = make_named_number(name, $3);
2538 def p_enum_name_5(p
):
2539 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '=' expression '''
2541 # { perm_string name = lex_strings.make($1);
2542 # long count = check_enum_seq_value(@1, $3, false);
2543 # $$ = make_named_numbers(name, 0, count-1, $6);
2548 def p_enum_name_6(p
):
2549 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '=' expression '''
2551 # { perm_string name = lex_strings.make($1);
2552 # $$ = make_named_numbers(name, check_enum_seq_value(@1, $3, true),
2553 # check_enum_seq_value(@1, $5, true), $8);
2559 def p_struct_data_type_1(p
):
2560 '''struct_data_type : K_struct K_packed_opt '{' struct_union_member_list '}' '''
2562 # { struct_type_t*tmp = new struct_type_t;
2563 # FILE_NAME(tmp, @1);
2564 # tmp->packed_flag = $2;
2565 # tmp->union_flag = false;
2566 # tmp->members .reset($4);
2570 def p_struct_data_type_2(p
):
2571 '''struct_data_type : K_union K_packed_opt '{' struct_union_member_list '}' '''
2573 # { struct_type_t*tmp = new struct_type_t;
2574 # FILE_NAME(tmp, @1);
2575 # tmp->packed_flag = $2;
2576 # tmp->union_flag = true;
2577 # tmp->members .reset($4);
2581 def p_struct_data_type_3(p
):
2582 '''struct_data_type : K_struct K_packed_opt '{' error '}' '''
2584 # { yyerror(@3, "error: Errors in struct member list.");
2586 # struct_type_t*tmp = new struct_type_t;
2587 # FILE_NAME(tmp, @1);
2588 # tmp->packed_flag = $2;
2589 # tmp->union_flag = false;
2593 def p_struct_data_type_4(p
):
2594 '''struct_data_type : K_union K_packed_opt '{' error '}' '''
2596 # { yyerror(@3, "error: Errors in union member list.");
2598 # struct_type_t*tmp = new struct_type_t;
2599 # FILE_NAME(tmp, @1);
2600 # tmp->packed_flag = $2;
2601 # tmp->union_flag = true;
2605 def p_struct_union_member_list_1(p
):
2606 '''struct_union_member_list : struct_union_member_list struct_union_member '''
2608 # { list<struct_member_t*>*tmp = $1;
2609 # tmp->push_back($2);
2613 def p_struct_union_member_list_2(p
):
2614 '''struct_union_member_list : struct_union_member '''
2616 # { list<struct_member_t*>*tmp = new list<struct_member_t*>;
2617 # tmp->push_back($1);
2621 def p_struct_union_member_1(p
):
2622 '''struct_union_member : attribute_list_opt data_type list_of_variable_decl_assignments ';' '''
2624 # { struct_member_t*tmp = new struct_member_t;
2625 # FILE_NAME(tmp, @2);
2626 # tmp->type .reset($2);
2627 # tmp->names .reset($3);
2631 def p_struct_union_member_2(p
):
2632 '''struct_union_member : error ';' '''
2634 # { yyerror(@2, "Error in struct/union member.");
2639 def p_case_item_1(p
):
2640 '''case_item : expression_list_proper ':' statement_or_null '''
2642 # { PCase::Item*tmp = new PCase::Item;
2649 def p_case_item_2(p
):
2650 '''case_item : K_default ':' statement_or_null '''
2652 # { PCase::Item*tmp = new PCase::Item;
2657 def p_case_item_3(p
):
2658 '''case_item : K_default statement_or_null '''
2660 # { PCase::Item*tmp = new PCase::Item;
2665 def p_case_item_4(p
):
2666 '''case_item : error ':' statement_or_null '''
2668 # { yyerror(@2, "error: Incomprehensible case expression.");
2672 def p_case_items_1(p
):
2673 '''case_items : case_items case_item '''
2675 # { svector<PCase::Item*>*tmp;
2676 # tmp = new svector<PCase::Item*>(*$1, $2);
2681 def p_case_items_2(p
):
2682 '''case_items : case_item '''
2684 # { svector<PCase::Item*>*tmp = new svector<PCase::Item*>(1);
2689 def p_charge_strength_1(p
):
2690 '''charge_strength : '(' K_small ')' '''
2693 def p_charge_strength_2(p
):
2694 '''charge_strength : '(' K_medium ')' '''
2697 def p_charge_strength_3(p
):
2698 '''charge_strength : '(' K_large ')' '''
2701 def p_charge_strength_opt_1(p
):
2702 '''charge_strength_opt : charge_strength '''
2705 def p_charge_strength_opt_2(p
):
2706 '''charge_strength_opt : '''
2709 def p_defparam_assign_1(p
):
2710 '''defparam_assign : hierarchy_identifier '=' expression '''
2712 # { pform_set_defparam(*$1, $3);
2716 def p_defparam_assign_list_1(p
):
2717 '''defparam_assign_list : defparam_assign '''
2720 def p_defparam_assign_list_2(p
):
2721 '''defparam_assign_list : dimensions defparam_assign '''
2723 # { yyerror(@1, "error: defparam may not include a range.");
2727 def p_defparam_assign_list_3(p
):
2728 '''defparam_assign_list : defparam_assign_list ',' defparam_assign '''
2732 '''delay1 : '#' delay_value_simple '''
2734 # { list<PExpr*>*tmp = new list<PExpr*>;
2735 # tmp->push_back($2);
2740 '''delay1 : '#' '(' delay_value ')' '''
2742 # { list<PExpr*>*tmp = new list<PExpr*>;
2743 # tmp->push_back($3);
2748 '''delay3 : '#' delay_value_simple '''
2750 # { list<PExpr*>*tmp = new list<PExpr*>;
2751 # tmp->push_back($2);
2756 '''delay3 : '#' '(' delay_value ')' '''
2758 # { list<PExpr*>*tmp = new list<PExpr*>;
2759 # tmp->push_back($3);
2764 '''delay3 : '#' '(' delay_value ',' delay_value ')' '''
2766 # { list<PExpr*>*tmp = new list<PExpr*>;
2767 # tmp->push_back($3);
2768 # tmp->push_back($5);
2773 '''delay3 : '#' '(' delay_value ',' delay_value ',' delay_value ')' '''
2775 # { list<PExpr*>*tmp = new list<PExpr*>;
2776 # tmp->push_back($3);
2777 # tmp->push_back($5);
2778 # tmp->push_back($7);
2782 def p_delay3_opt_1(p
):
2783 '''delay3_opt : delay3 '''
2787 def p_delay3_opt_2(p
):
2792 def p_delay_value_list_1(p
):
2793 '''delay_value_list : delay_value '''
2795 # { list<PExpr*>*tmp = new list<PExpr*>;
2796 # tmp->push_back($1);
2800 def p_delay_value_list_2(p
):
2801 '''delay_value_list : delay_value_list ',' delay_value '''
2803 # { list<PExpr*>*tmp = $1;
2804 # tmp->push_back($3);
2808 def p_delay_value_1(p
):
2809 '''delay_value : expression '''
2815 def p_delay_value_2(p
):
2816 '''delay_value : expression ':' expression ':' expression '''
2818 # { $$ = pform_select_mtm_expr($1, $3, $5); }
2820 def p_delay_value_simple_1(p
):
2821 '''delay_value_simple : DEC_NUMBER '''
2823 # { verinum*tmp = $1;
2825 # yyerror(@1, "internal error: delay.");
2828 # $$ = new PENumber(tmp);
2829 # FILE_NAME($$, @1);
2834 def p_delay_value_simple_2(p
):
2835 '''delay_value_simple : REALTIME '''
2837 # { verireal*tmp = $1;
2839 # yyerror(@1, "internal error: delay.");
2842 # $$ = new PEFNumber(tmp);
2843 # FILE_NAME($$, @1);
2847 def p_delay_value_simple_3(p
):
2848 '''delay_value_simple : IDENTIFIER '''
2850 # { PEIdent*tmp = new PEIdent(lex_strings.make($1));
2851 # FILE_NAME(tmp, @1);
2856 def p_delay_value_simple_4(p
):
2857 '''delay_value_simple : TIME_LITERAL '''
2863 # if ($1 == 0 || !get_time_unit($1, unit))
2864 # yyerror(@1, "internal error: delay.");
2866 # double p = pow(10.0,
2867 # (double)(unit - pform_get_timeunit()));
2868 # double time = atof($1) * p;
2870 # verireal *v = new verireal(time);
2871 # $$ = new PEFNumber(v);
2872 # FILE_NAME($$, @1);
2876 def p_optional_semicolon_1(p
):
2877 '''optional_semicolon : ';' '''
2880 def p_optional_semicolon_2(p
):
2881 '''optional_semicolon : '''
2884 def p_discipline_declaration_1(p
):
2885 '''discipline_declaration : K_discipline IDENTIFIER optional_semicolon _embed0_discipline_declaration discipline_items K_enddiscipline '''
2887 # { pform_end_discipline(@1); delete[] $2; }
2889 def p__embed0_discipline_declaration(p
):
2890 '''_embed0_discipline_declaration : '''
2891 # { pform_start_discipline($2); }
2893 def p_discipline_items_1(p
):
2894 '''discipline_items : discipline_items discipline_item '''
2897 def p_discipline_items_2(p
):
2898 '''discipline_items : discipline_item '''
2901 def p_discipline_item_1(p
):
2902 '''discipline_item : K_domain K_discrete ';' '''
2904 # { pform_discipline_domain(@1, IVL_DIS_DISCRETE); }
2906 def p_discipline_item_2(p
):
2907 '''discipline_item : K_domain K_continuous ';' '''
2909 # { pform_discipline_domain(@1, IVL_DIS_CONTINUOUS); }
2911 def p_discipline_item_3(p
):
2912 '''discipline_item : K_potential IDENTIFIER ';' '''
2914 # { pform_discipline_potential(@1, $2); delete[] $2; }
2916 def p_discipline_item_4(p
):
2917 '''discipline_item : K_flow IDENTIFIER ';' '''
2919 # { pform_discipline_flow(@1, $2); delete[] $2; }
2921 def p_nature_declaration_1(p
):
2922 '''nature_declaration : K_nature IDENTIFIER optional_semicolon _embed0_nature_declaration nature_items K_endnature '''
2924 # { pform_end_nature(@1); delete[] $2; }
2926 def p__embed0_nature_declaration(p
):
2927 '''_embed0_nature_declaration : '''
2928 # { pform_start_nature($2); }
2930 def p_nature_items_1(p
):
2931 '''nature_items : nature_items nature_item '''
2934 def p_nature_items_2(p
):
2935 '''nature_items : nature_item '''
2938 def p_nature_item_1(p
):
2939 '''nature_item : K_units '=' STRING ';' '''
2943 def p_nature_item_2(p
):
2944 '''nature_item : K_abstol '=' expression ';' '''
2947 def p_nature_item_3(p
):
2948 '''nature_item : K_access '=' IDENTIFIER ';' '''
2950 # { pform_nature_access(@1, $3); delete[] $3; }
2952 def p_nature_item_4(p
):
2953 '''nature_item : K_idt_nature '=' IDENTIFIER ';' '''
2957 def p_nature_item_5(p
):
2958 '''nature_item : K_ddt_nature '=' IDENTIFIER ';' '''
2962 def p_config_declaration_1(p
):
2963 '''config_declaration : K_config IDENTIFIER ';' K_design lib_cell_identifiers ';' list_of_config_rule_statements K_endconfig '''
2965 # { cerr << @1 << ": sorry: config declarations are not supported and "
2966 # "will be skipped." << endl;
2970 def p_lib_cell_identifiers_1(p
):
2971 '''lib_cell_identifiers : '''
2974 def p_lib_cell_identifiers_2(p
):
2975 '''lib_cell_identifiers : lib_cell_identifiers lib_cell_id '''
2978 def p_list_of_config_rule_statements_1(p
):
2979 '''list_of_config_rule_statements : '''
2982 def p_list_of_config_rule_statements_2(p
):
2983 '''list_of_config_rule_statements : list_of_config_rule_statements config_rule_statement '''
2986 def p_config_rule_statement_1(p
):
2987 '''config_rule_statement : K_default K_liblist list_of_libraries ';' '''
2990 def p_config_rule_statement_2(p
):
2991 '''config_rule_statement : K_instance hierarchy_identifier K_liblist list_of_libraries ';' '''
2995 def p_config_rule_statement_3(p
):
2996 '''config_rule_statement : K_instance hierarchy_identifier K_use lib_cell_id opt_config ';' '''
3000 def p_config_rule_statement_4(p
):
3001 '''config_rule_statement : K_cell lib_cell_id K_liblist list_of_libraries ';' '''
3004 def p_config_rule_statement_5(p
):
3005 '''config_rule_statement : K_cell lib_cell_id K_use lib_cell_id opt_config ';' '''
3008 def p_opt_config_1(p
):
3012 def p_opt_config_2(p
):
3013 '''opt_config : ':' K_config '''
3016 def p_lib_cell_id_1(p
):
3017 '''lib_cell_id : IDENTIFIER '''
3021 def p_lib_cell_id_2(p
):
3022 '''lib_cell_id : IDENTIFIER '.' IDENTIFIER '''
3024 # { delete[] $1; delete[] $3; }
3026 def p_list_of_libraries_1(p
):
3027 '''list_of_libraries : '''
3030 def p_list_of_libraries_2(p
):
3031 '''list_of_libraries : list_of_libraries IDENTIFIER '''
3035 def p_drive_strength_1(p
):
3036 '''drive_strength : '(' dr_strength0 ',' dr_strength1 ')' '''
3038 # { $$.str0 = $2.str0;
3039 # $$.str1 = $4.str1;
3042 def p_drive_strength_2(p
):
3043 '''drive_strength : '(' dr_strength1 ',' dr_strength0 ')' '''
3045 # { $$.str0 = $4.str0;
3046 # $$.str1 = $2.str1;
3049 def p_drive_strength_3(p
):
3050 '''drive_strength : '(' dr_strength0 ',' K_highz1 ')' '''
3052 # { $$.str0 = $2.str0;
3053 # $$.str1 = IVL_DR_HiZ;
3056 def p_drive_strength_4(p
):
3057 '''drive_strength : '(' dr_strength1 ',' K_highz0 ')' '''
3059 # { $$.str0 = IVL_DR_HiZ;
3060 # $$.str1 = $2.str1;
3063 def p_drive_strength_5(p
):
3064 '''drive_strength : '(' K_highz1 ',' dr_strength0 ')' '''
3066 # { $$.str0 = $4.str0;
3067 # $$.str1 = IVL_DR_HiZ;
3070 def p_drive_strength_6(p
):
3071 '''drive_strength : '(' K_highz0 ',' dr_strength1 ')' '''
3073 # { $$.str0 = IVL_DR_HiZ;
3074 # $$.str1 = $4.str1;
3077 def p_drive_strength_opt_1(p
):
3078 '''drive_strength_opt : drive_strength '''
3082 def p_drive_strength_opt_2(p
):
3083 '''drive_strength_opt : '''
3085 # { $$.str0 = IVL_DR_STRONG; $$.str1 = IVL_DR_STRONG; }
3087 def p_dr_strength0_1(p
):
3088 '''dr_strength0 : K_supply0 '''
3090 # { $$.str0 = IVL_DR_SUPPLY; }
3092 def p_dr_strength0_2(p
):
3093 '''dr_strength0 : K_strong0 '''
3095 # { $$.str0 = IVL_DR_STRONG; }
3097 def p_dr_strength0_3(p
):
3098 '''dr_strength0 : K_pull0 '''
3100 # { $$.str0 = IVL_DR_PULL; }
3102 def p_dr_strength0_4(p
):
3103 '''dr_strength0 : K_weak0 '''
3105 # { $$.str0 = IVL_DR_WEAK; }
3107 def p_dr_strength1_1(p
):
3108 '''dr_strength1 : K_supply1 '''
3110 # { $$.str1 = IVL_DR_SUPPLY; }
3112 def p_dr_strength1_2(p
):
3113 '''dr_strength1 : K_strong1 '''
3115 # { $$.str1 = IVL_DR_STRONG; }
3117 def p_dr_strength1_3(p
):
3118 '''dr_strength1 : K_pull1 '''
3120 # { $$.str1 = IVL_DR_PULL; }
3122 def p_dr_strength1_4(p
):
3123 '''dr_strength1 : K_weak1 '''
3125 # { $$.str1 = IVL_DR_WEAK; }
3127 def p_clocking_event_opt_1(p
):
3128 '''clocking_event_opt : event_control '''
3131 def p_clocking_event_opt_2(p
):
3132 '''clocking_event_opt : '''
3135 def p_event_control_1(p
):
3136 '''event_control : '@' hierarchy_identifier '''
3138 # { PEIdent*tmpi = new PEIdent(*$2);
3139 # PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi);
3140 # PEventStatement*tmps = new PEventStatement(tmpe);
3141 # FILE_NAME(tmps, @1);
3146 def p_event_control_2(p
):
3147 '''event_control : '@' '(' event_expression_list ')' '''
3149 # { PEventStatement*tmp = new PEventStatement(*$3);
3150 # FILE_NAME(tmp, @1);
3155 def p_event_control_3(p
):
3156 '''event_control : '@' '(' error ')' '''
3158 # { yyerror(@1, "error: Malformed event control expression.");
3162 def p_event_expression_list_1(p
):
3163 '''event_expression_list : event_expression '''
3167 def p_event_expression_list_2(p
):
3168 '''event_expression_list : event_expression_list K_or event_expression '''
3170 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*$1, *$3);
3176 def p_event_expression_list_3(p
):
3177 '''event_expression_list : event_expression_list ',' event_expression '''
3179 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*$1, *$3);
3185 def p_event_expression_1(p
):
3186 '''event_expression : K_posedge expression '''
3188 # { PEEvent*tmp = new PEEvent(PEEvent::POSEDGE, $2);
3189 # FILE_NAME(tmp, @1);
3190 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3195 def p_event_expression_2(p
):
3196 '''event_expression : K_negedge expression '''
3198 # { PEEvent*tmp = new PEEvent(PEEvent::NEGEDGE, $2);
3199 # FILE_NAME(tmp, @1);
3200 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3205 def p_event_expression_3(p
):
3206 '''event_expression : expression '''
3208 # { PEEvent*tmp = new PEEvent(PEEvent::ANYEDGE, $1);
3209 # FILE_NAME(tmp, @1);
3210 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3215 def p_branch_probe_expression_1(p
):
3216 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ',' IDENTIFIER ')' '''
3218 # { $$ = pform_make_branch_probe_expression(@1, $1, $3, $5); }
3220 def p_branch_probe_expression_2(p
):
3221 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ')' '''
3223 # { $$ = pform_make_branch_probe_expression(@1, $1, $3); }
3225 def p_expression_1(p
):
3226 '''expression : expr_primary_or_typename '''
3230 def p_expression_2(p
):
3231 '''expression : inc_or_dec_expression '''
3235 def p_expression_3(p
):
3236 '''expression : inside_expression '''
3240 def p_expression_4(p
):
3241 '''expression : '+' attribute_list_opt expr_primary %prec UNARY_PREC '''
3245 def p_expression_5(p
):
3246 '''expression : '-' attribute_list_opt expr_primary %prec UNARY_PREC '''
3248 # { PEUnary*tmp = new PEUnary('-', $3);
3249 # FILE_NAME(tmp, @3);
3253 def p_expression_6(p
):
3254 '''expression : '~' attribute_list_opt expr_primary %prec UNARY_PREC '''
3256 # { PEUnary*tmp = new PEUnary('~', $3);
3257 # FILE_NAME(tmp, @3);
3261 def p_expression_7(p
):
3262 '''expression : '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3264 # { PEUnary*tmp = new PEUnary('&', $3);
3265 # FILE_NAME(tmp, @3);
3269 def p_expression_8(p
):
3270 '''expression : '!' attribute_list_opt expr_primary %prec UNARY_PREC '''
3272 # { PEUnary*tmp = new PEUnary('!', $3);
3273 # FILE_NAME(tmp, @3);
3277 def p_expression_9(p
):
3278 '''expression : '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3280 # { PEUnary*tmp = new PEUnary('|', $3);
3281 # FILE_NAME(tmp, @3);
3285 def p_expression_10(p
):
3286 '''expression : '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3288 # { PEUnary*tmp = new PEUnary('^', $3);
3289 # FILE_NAME(tmp, @3);
3293 def p_expression_11(p
):
3294 '''expression : '~' '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3296 # { yyerror(@1, "error: '~' '&' is not a valid expression. "
3297 # "Please use operator '~&' instead.");
3301 def p_expression_12(p
):
3302 '''expression : '~' '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3304 # { yyerror(@1, "error: '~' '|' is not a valid expression. "
3305 # "Please use operator '~|' instead.");
3309 def p_expression_13(p
):
3310 '''expression : '~' '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3312 # { yyerror(@1, "error: '~' '^' is not a valid expression. "
3313 # "Please use operator '~^' instead.");
3317 def p_expression_14(p
):
3318 '''expression : K_NAND attribute_list_opt expr_primary %prec UNARY_PREC '''
3320 # { PEUnary*tmp = new PEUnary('A', $3);
3321 # FILE_NAME(tmp, @3);
3325 def p_expression_15(p
):
3326 '''expression : K_NOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3328 # { PEUnary*tmp = new PEUnary('N', $3);
3329 # FILE_NAME(tmp, @3);
3333 def p_expression_16(p
):
3334 '''expression : K_NXOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3336 # { PEUnary*tmp = new PEUnary('X', $3);
3337 # FILE_NAME(tmp, @3);
3341 def p_expression_17(p
):
3342 '''expression : '!' error %prec UNARY_PREC '''
3344 # { yyerror(@1, "error: Operand of unary ! "
3345 # "is not a primary expression.");
3349 def p_expression_18(p
):
3350 '''expression : '^' error %prec UNARY_PREC '''
3352 # { yyerror(@1, "error: Operand of reduction ^ "
3353 # "is not a primary expression.");
3357 def p_expression_19(p
):
3358 '''expression : expression '^' attribute_list_opt expression '''
3360 # { PEBinary*tmp = new PEBinary('^', $1, $4);
3361 # FILE_NAME(tmp, @2);
3365 def p_expression_20(p
):
3366 '''expression : expression K_POW attribute_list_opt expression '''
3368 # { PEBinary*tmp = new PEBPower('p', $1, $4);
3369 # FILE_NAME(tmp, @2);
3373 def p_expression_21(p
):
3374 '''expression : expression '*' attribute_list_opt expression '''
3376 # { PEBinary*tmp = new PEBinary('*', $1, $4);
3377 # FILE_NAME(tmp, @2);
3381 def p_expression_22(p
):
3382 '''expression : expression '/' attribute_list_opt expression '''
3384 # { PEBinary*tmp = new PEBinary('/', $1, $4);
3385 # FILE_NAME(tmp, @2);
3389 def p_expression_23(p
):
3390 '''expression : expression '%' attribute_list_opt expression '''
3392 # { PEBinary*tmp = new PEBinary('%', $1, $4);
3393 # FILE_NAME(tmp, @2);
3397 def p_expression_24(p
):
3398 '''expression : expression '+' attribute_list_opt expression '''
3400 # { PEBinary*tmp = new PEBinary('+', $1, $4);
3401 # FILE_NAME(tmp, @2);
3405 def p_expression_25(p
):
3406 '''expression : expression '-' attribute_list_opt expression '''
3408 # { PEBinary*tmp = new PEBinary('-', $1, $4);
3409 # FILE_NAME(tmp, @2);
3413 def p_expression_26(p
):
3414 '''expression : expression '&' attribute_list_opt expression '''
3416 # { PEBinary*tmp = new PEBinary('&', $1, $4);
3417 # FILE_NAME(tmp, @2);
3421 def p_expression_27(p
):
3422 '''expression : expression '|' attribute_list_opt expression '''
3424 # { PEBinary*tmp = new PEBinary('|', $1, $4);
3425 # FILE_NAME(tmp, @2);
3429 def p_expression_28(p
):
3430 '''expression : expression K_NAND attribute_list_opt expression '''
3432 # { PEBinary*tmp = new PEBinary('A', $1, $4);
3433 # FILE_NAME(tmp, @2);
3437 def p_expression_29(p
):
3438 '''expression : expression K_NOR attribute_list_opt expression '''
3440 # { PEBinary*tmp = new PEBinary('O', $1, $4);
3441 # FILE_NAME(tmp, @2);
3445 def p_expression_30(p
):
3446 '''expression : expression K_NXOR attribute_list_opt expression '''
3448 # { PEBinary*tmp = new PEBinary('X', $1, $4);
3449 # FILE_NAME(tmp, @2);
3453 def p_expression_31(p
):
3454 '''expression : expression '<' attribute_list_opt expression '''
3456 # { PEBinary*tmp = new PEBComp('<', $1, $4);
3457 # FILE_NAME(tmp, @2);
3461 def p_expression_32(p
):
3462 '''expression : expression '>' attribute_list_opt expression '''
3464 # { PEBinary*tmp = new PEBComp('>', $1, $4);
3465 # FILE_NAME(tmp, @2);
3469 def p_expression_33(p
):
3470 '''expression : expression K_LS attribute_list_opt expression '''
3472 # { PEBinary*tmp = new PEBShift('l', $1, $4);
3473 # FILE_NAME(tmp, @2);
3477 def p_expression_34(p
):
3478 '''expression : expression K_RS attribute_list_opt expression '''
3480 # { PEBinary*tmp = new PEBShift('r', $1, $4);
3481 # FILE_NAME(tmp, @2);
3485 def p_expression_35(p
):
3486 '''expression : expression K_RSS attribute_list_opt expression '''
3488 # { PEBinary*tmp = new PEBShift('R', $1, $4);
3489 # FILE_NAME(tmp, @2);
3493 def p_expression_36(p
):
3494 '''expression : expression K_EQ attribute_list_opt expression '''
3496 # { PEBinary*tmp = new PEBComp('e', $1, $4);
3497 # FILE_NAME(tmp, @2);
3501 def p_expression_37(p
):
3502 '''expression : expression K_CEQ attribute_list_opt expression '''
3504 # { PEBinary*tmp = new PEBComp('E', $1, $4);
3505 # FILE_NAME(tmp, @2);
3509 def p_expression_38(p
):
3510 '''expression : expression K_WEQ attribute_list_opt expression '''
3512 # { PEBinary*tmp = new PEBComp('w', $1, $4);
3513 # FILE_NAME(tmp, @2);
3517 def p_expression_39(p
):
3518 '''expression : expression K_LE attribute_list_opt expression '''
3520 # { PEBinary*tmp = new PEBComp('L', $1, $4);
3521 # FILE_NAME(tmp, @2);
3525 def p_expression_40(p
):
3526 '''expression : expression K_GE attribute_list_opt expression '''
3528 # { PEBinary*tmp = new PEBComp('G', $1, $4);
3529 # FILE_NAME(tmp, @2);
3533 def p_expression_41(p
):
3534 '''expression : expression K_NE attribute_list_opt expression '''
3536 # { PEBinary*tmp = new PEBComp('n', $1, $4);
3537 # FILE_NAME(tmp, @2);
3541 def p_expression_42(p
):
3542 '''expression : expression K_CNE attribute_list_opt expression '''
3544 # { PEBinary*tmp = new PEBComp('N', $1, $4);
3545 # FILE_NAME(tmp, @2);
3549 def p_expression_43(p
):
3550 '''expression : expression K_WNE attribute_list_opt expression '''
3552 # { PEBinary*tmp = new PEBComp('W', $1, $4);
3553 # FILE_NAME(tmp, @2);
3557 def p_expression_44(p
):
3558 '''expression : expression K_LOR attribute_list_opt expression '''
3560 # { PEBinary*tmp = new PEBLogic('o', $1, $4);
3561 # FILE_NAME(tmp, @2);
3565 def p_expression_45(p
):
3566 '''expression : expression K_LAND attribute_list_opt expression '''
3568 # { PEBinary*tmp = new PEBLogic('a', $1, $4);
3569 # FILE_NAME(tmp, @2);
3573 def p_expression_46(p
):
3574 '''expression : expression '?' attribute_list_opt expression ':' expression '''
3576 # { PETernary*tmp = new PETernary($1, $4, $6);
3577 # FILE_NAME(tmp, @2);
3581 def p_expr_mintypmax_1(p
):
3582 '''expr_mintypmax : expression '''
3586 def p_expr_mintypmax_2(p
):
3587 '''expr_mintypmax : expression ':' expression ':' expression '''
3589 # { switch (min_typ_max_flag) {
3606 # if (min_typ_max_warn > 0) {
3607 # cerr << $$->get_fileline() << ": warning: choosing ";
3608 # switch (min_typ_max_flag) {
3619 # cerr << " expression." << endl;
3620 # min_typ_max_warn -= 1;
3624 def p_expression_list_with_nuls_1(p
):
3625 '''expression_list_with_nuls : expression_list_with_nuls ',' expression '''
3627 # { list<PExpr*>*tmp = $1;
3628 # tmp->push_back($3);
3632 def p_expression_list_with_nuls_2(p
):
3633 '''expression_list_with_nuls : expression '''
3635 # { list<PExpr*>*tmp = new list<PExpr*>;
3636 # tmp->push_back($1);
3640 def p_expression_list_with_nuls_3(p
):
3641 '''expression_list_with_nuls : '''
3643 # { list<PExpr*>*tmp = new list<PExpr*>;
3644 # tmp->push_back(0);
3648 def p_expression_list_with_nuls_4(p
):
3649 '''expression_list_with_nuls : expression_list_with_nuls ',' '''
3651 # { list<PExpr*>*tmp = $1;
3652 # tmp->push_back(0);
3656 def p_expression_list_proper_1(p
):
3657 '''expression_list_proper : expression_list_proper ',' expression '''
3659 # { list<PExpr*>*tmp = $1;
3660 # tmp->push_back($3);
3664 def p_expression_list_proper_2(p
):
3665 '''expression_list_proper : expression '''
3667 # { list<PExpr*>*tmp = new list<PExpr*>;
3668 # tmp->push_back($1);
3672 def p_expr_primary_or_typename_1(p
):
3673 '''expr_primary_or_typename : expr_primary '''
3676 def p_expr_primary_or_typename_2(p
):
3677 '''expr_primary_or_typename : TYPE_IDENTIFIER '''
3679 # { PETypename*tmp = new PETypename($1.type);
3680 # FILE_NAME(tmp,@1);
3685 def p_expr_primary_1(p
):
3686 '''expr_primary : number '''
3689 # PENumber*tmp = new PENumber($1);
3690 # FILE_NAME(tmp, @1);
3694 def p_expr_primary_2(p
):
3695 '''expr_primary : REALTIME '''
3697 # { PEFNumber*tmp = new PEFNumber($1);
3698 # FILE_NAME(tmp, @1);
3702 def p_expr_primary_3(p
):
3703 '''expr_primary : STRING '''
3705 # { PEString*tmp = new PEString($1);
3706 # FILE_NAME(tmp, @1);
3710 def p_expr_primary_4(p
):
3711 '''expr_primary : TIME_LITERAL '''
3717 # if ($1 == 0 || !get_time_unit($1, unit))
3718 # yyerror(@1, "internal error: delay.");
3720 # double p = pow(10.0, (double)(unit - pform_get_timeunit()));
3721 # double time = atof($1) * p;
3723 # verireal *v = new verireal(time);
3724 # $$ = new PEFNumber(v);
3725 # FILE_NAME($$, @1);
3729 def p_expr_primary_5(p
):
3730 '''expr_primary : SYSTEM_IDENTIFIER '''
3732 # { perm_string tn = lex_strings.make($1);
3733 # PECallFunction*tmp = new PECallFunction(tn);
3734 # FILE_NAME(tmp, @1);
3739 def p_expr_primary_6(p
):
3740 '''expr_primary : hierarchy_identifier '''
3742 # { PEIdent*tmp = pform_new_ident(*$1);
3743 # FILE_NAME(tmp, @1);
3748 def p_expr_primary_7(p
):
3749 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier '''
3751 # { $$ = pform_package_ident(@2, $1, $3);
3755 def p_expr_primary_8(p
):
3756 '''expr_primary : hierarchy_identifier '(' expression_list_with_nuls ')' '''
3758 # { list<PExpr*>*expr_list = $3;
3759 # strip_tail_items(expr_list);
3760 # PECallFunction*tmp = pform_make_call_function(@1, *$1, *expr_list);
3765 def p_expr_primary_9(p
):
3766 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' '''
3768 # { pform_name_t*t_name = $1;
3769 # while (! $3->empty()) {
3770 # t_name->push_back($3->front());
3773 # list<PExpr*>*expr_list = $5;
3774 # strip_tail_items(expr_list);
3775 # PECallFunction*tmp = pform_make_call_function(@1, *t_name, *expr_list);
3781 def p_expr_primary_10(p
):
3782 '''expr_primary : SYSTEM_IDENTIFIER '(' expression_list_proper ')' '''
3784 # { perm_string tn = lex_strings.make($1);
3785 # PECallFunction*tmp = new PECallFunction(tn, *$3);
3786 # FILE_NAME(tmp, @1);
3791 def p_expr_primary_11(p
):
3792 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')' '''
3794 # { perm_string use_name = lex_strings.make($3);
3795 # PECallFunction*tmp = new PECallFunction($1, use_name, *$5);
3796 # FILE_NAME(tmp, @3);
3801 def p_expr_primary_12(p
):
3802 '''expr_primary : SYSTEM_IDENTIFIER '(' ')' '''
3804 # { perm_string tn = lex_strings.make($1);
3805 # const vector<PExpr*>empty;
3806 # PECallFunction*tmp = new PECallFunction(tn, empty);
3807 # FILE_NAME(tmp, @1);
3810 # if (!gn_system_verilog()) {
3811 # yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
3815 def p_expr_primary_13(p
):
3816 '''expr_primary : implicit_class_handle '''
3818 # { PEIdent*tmp = new PEIdent(*$1);
3819 # FILE_NAME(tmp,@1);
3824 def p_expr_primary_14(p
):
3825 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '''
3827 # { pform_name_t*t_name = $1;
3828 # while (! $3->empty()) {
3829 # t_name->push_back($3->front());
3832 # PEIdent*tmp = new PEIdent(*t_name);
3833 # FILE_NAME(tmp,@1);
3839 def p_expr_primary_15(p
):
3840 '''expr_primary : K_acos '(' expression ')' '''
3842 # { perm_string tn = perm_string::literal("$acos");
3843 # PECallFunction*tmp = make_call_function(tn, $3);
3844 # FILE_NAME(tmp,@1);
3848 def p_expr_primary_16(p
):
3849 '''expr_primary : K_acosh '(' expression ')' '''
3851 # { perm_string tn = perm_string::literal("$acosh");
3852 # PECallFunction*tmp = make_call_function(tn, $3);
3853 # FILE_NAME(tmp,@1);
3857 def p_expr_primary_17(p
):
3858 '''expr_primary : K_asin '(' expression ')' '''
3860 # { perm_string tn = perm_string::literal("$asin");
3861 # PECallFunction*tmp = make_call_function(tn, $3);
3862 # FILE_NAME(tmp,@1);
3866 def p_expr_primary_18(p
):
3867 '''expr_primary : K_asinh '(' expression ')' '''
3869 # { perm_string tn = perm_string::literal("$asinh");
3870 # PECallFunction*tmp = make_call_function(tn, $3);
3871 # FILE_NAME(tmp,@1);
3875 def p_expr_primary_19(p
):
3876 '''expr_primary : K_atan '(' expression ')' '''
3878 # { perm_string tn = perm_string::literal("$atan");
3879 # PECallFunction*tmp = make_call_function(tn, $3);
3880 # FILE_NAME(tmp,@1);
3884 def p_expr_primary_20(p
):
3885 '''expr_primary : K_atanh '(' expression ')' '''
3887 # { perm_string tn = perm_string::literal("$atanh");
3888 # PECallFunction*tmp = make_call_function(tn, $3);
3889 # FILE_NAME(tmp,@1);
3893 def p_expr_primary_21(p
):
3894 '''expr_primary : K_atan2 '(' expression ',' expression ')' '''
3896 # { perm_string tn = perm_string::literal("$atan2");
3897 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3898 # FILE_NAME(tmp,@1);
3902 def p_expr_primary_22(p
):
3903 '''expr_primary : K_ceil '(' expression ')' '''
3905 # { perm_string tn = perm_string::literal("$ceil");
3906 # PECallFunction*tmp = make_call_function(tn, $3);
3907 # FILE_NAME(tmp,@1);
3911 def p_expr_primary_23(p
):
3912 '''expr_primary : K_cos '(' expression ')' '''
3914 # { perm_string tn = perm_string::literal("$cos");
3915 # PECallFunction*tmp = make_call_function(tn, $3);
3916 # FILE_NAME(tmp,@1);
3920 def p_expr_primary_24(p
):
3921 '''expr_primary : K_cosh '(' expression ')' '''
3923 # { perm_string tn = perm_string::literal("$cosh");
3924 # PECallFunction*tmp = make_call_function(tn, $3);
3925 # FILE_NAME(tmp,@1);
3929 def p_expr_primary_25(p
):
3930 '''expr_primary : K_exp '(' expression ')' '''
3932 # { perm_string tn = perm_string::literal("$exp");
3933 # PECallFunction*tmp = make_call_function(tn, $3);
3934 # FILE_NAME(tmp,@1);
3938 def p_expr_primary_26(p
):
3939 '''expr_primary : K_floor '(' expression ')' '''
3941 # { perm_string tn = perm_string::literal("$floor");
3942 # PECallFunction*tmp = make_call_function(tn, $3);
3943 # FILE_NAME(tmp,@1);
3947 def p_expr_primary_27(p
):
3948 '''expr_primary : K_hypot '(' expression ',' expression ')' '''
3950 # { perm_string tn = perm_string::literal("$hypot");
3951 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3952 # FILE_NAME(tmp,@1);
3956 def p_expr_primary_28(p
):
3957 '''expr_primary : K_ln '(' expression ')' '''
3959 # { perm_string tn = perm_string::literal("$ln");
3960 # PECallFunction*tmp = make_call_function(tn, $3);
3961 # FILE_NAME(tmp,@1);
3965 def p_expr_primary_29(p
):
3966 '''expr_primary : K_log '(' expression ')' '''
3968 # { perm_string tn = perm_string::literal("$log10");
3969 # PECallFunction*tmp = make_call_function(tn, $3);
3970 # FILE_NAME(tmp,@1);
3974 def p_expr_primary_30(p
):
3975 '''expr_primary : K_pow '(' expression ',' expression ')' '''
3977 # { perm_string tn = perm_string::literal("$pow");
3978 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3979 # FILE_NAME(tmp,@1);
3983 def p_expr_primary_31(p
):
3984 '''expr_primary : K_sin '(' expression ')' '''
3986 # { perm_string tn = perm_string::literal("$sin");
3987 # PECallFunction*tmp = make_call_function(tn, $3);
3988 # FILE_NAME(tmp,@1);
3992 def p_expr_primary_32(p
):
3993 '''expr_primary : K_sinh '(' expression ')' '''
3995 # { perm_string tn = perm_string::literal("$sinh");
3996 # PECallFunction*tmp = make_call_function(tn, $3);
3997 # FILE_NAME(tmp,@1);
4001 def p_expr_primary_33(p
):
4002 '''expr_primary : K_sqrt '(' expression ')' '''
4004 # { perm_string tn = perm_string::literal("$sqrt");
4005 # PECallFunction*tmp = make_call_function(tn, $3);
4006 # FILE_NAME(tmp,@1);
4010 def p_expr_primary_34(p
):
4011 '''expr_primary : K_tan '(' expression ')' '''
4013 # { perm_string tn = perm_string::literal("$tan");
4014 # PECallFunction*tmp = make_call_function(tn, $3);
4015 # FILE_NAME(tmp,@1);
4019 def p_expr_primary_35(p
):
4020 '''expr_primary : K_tanh '(' expression ')' '''
4022 # { perm_string tn = perm_string::literal("$tanh");
4023 # PECallFunction*tmp = make_call_function(tn, $3);
4024 # FILE_NAME(tmp,@1);
4028 def p_expr_primary_36(p
):
4029 '''expr_primary : K_abs '(' expression ')' '''
4031 # { PEUnary*tmp = new PEUnary('m', $3);
4032 # FILE_NAME(tmp,@1);
4036 def p_expr_primary_37(p
):
4037 '''expr_primary : K_max '(' expression ',' expression ')' '''
4039 # { PEBinary*tmp = new PEBinary('M', $3, $5);
4040 # FILE_NAME(tmp,@1);
4044 def p_expr_primary_38(p
):
4045 '''expr_primary : K_min '(' expression ',' expression ')' '''
4047 # { PEBinary*tmp = new PEBinary('m', $3, $5);
4048 # FILE_NAME(tmp,@1);
4052 def p_expr_primary_39(p
):
4053 '''expr_primary : '(' expr_mintypmax ')' '''
4057 def p_expr_primary_40(p
):
4058 '''expr_primary : '{' expression_list_proper '}' '''
4060 # { PEConcat*tmp = new PEConcat(*$2);
4061 # FILE_NAME(tmp, @1);
4066 def p_expr_primary_41(p
):
4067 '''expr_primary : '{' expression '{' expression_list_proper '}' '}' '''
4070 # PEConcat*tmp = new PEConcat(*$4, rep);
4071 # FILE_NAME(tmp, @1);
4076 def p_expr_primary_42(p
):
4077 '''expr_primary : '{' expression '{' expression_list_proper '}' error '}' '''
4080 # PEConcat*tmp = new PEConcat(*$4, rep);
4081 # FILE_NAME(tmp, @1);
4084 # yyerror(@5, "error: Syntax error between internal '}' "
4085 # "and closing '}' of repeat concatenation.");
4089 def p_expr_primary_43(p
):
4090 '''expr_primary : '{' '}' '''
4092 # { // This is the empty queue syntax.
4093 # if (gn_system_verilog()) {
4094 # list<PExpr*> empty_list;
4095 # PEConcat*tmp = new PEConcat(empty_list);
4096 # FILE_NAME(tmp, @1);
4099 # yyerror(@1, "error: Concatenations are not allowed to be empty.");
4104 def p_expr_primary_44(p
):
4105 '''expr_primary : expr_primary "'" '(' expression ')' '''
4107 # { PExpr*base = $4;
4108 # if (gn_system_verilog()) {
4109 # PECastSize*tmp = new PECastSize($1, base);
4110 # FILE_NAME(tmp, @1);
4113 # yyerror(@1, "error: Size cast requires SystemVerilog.");
4118 def p_expr_primary_45(p
):
4119 '''expr_primary : simple_type_or_string "'" '(' expression ')' '''
4121 # { PExpr*base = $4;
4122 # if (gn_system_verilog()) {
4123 # PECastType*tmp = new PECastType($1, base);
4124 # FILE_NAME(tmp, @1);
4127 # yyerror(@1, "error: Type cast requires SystemVerilog.");
4132 def p_expr_primary_46(p
):
4133 '''expr_primary : assignment_pattern '''
4137 def p_expr_primary_47(p
):
4138 '''expr_primary : streaming_concatenation '''
4142 def p_expr_primary_48(p
):
4143 '''expr_primary : K_null '''
4145 # { PENull*tmp = new PENull;
4146 # FILE_NAME(tmp, @1);
4150 def p_function_item_list_opt_1(p
):
4151 '''function_item_list_opt : function_item_list '''
4155 def p_function_item_list_opt_2(p
):
4156 '''function_item_list_opt : '''
4160 def p_function_item_list_1(p
):
4161 '''function_item_list : function_item '''
4165 def p_function_item_list_2(p
):
4166 '''function_item_list : function_item_list function_item '''
4170 # vector<pform_tf_port_t>*tmp = $1;
4171 # size_t s1 = tmp->size();
4172 # tmp->resize(s1 + $2->size());
4173 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
4174 # tmp->at(s1+idx) = $2->at(idx);
4184 def p_function_item_1(p
):
4185 '''function_item : tf_port_declaration '''
4189 def p_function_item_2(p
):
4190 '''function_item : block_item_decl '''
4194 def p_gate_instance_1(p
):
4195 '''gate_instance : IDENTIFIER '(' expression_list_with_nuls ')' '''
4197 # { lgate*tmp = new lgate;
4200 # tmp->file = @1.text;
4201 # tmp->lineno = @1.first_line;
4206 def p_gate_instance_2(p
):
4207 '''gate_instance : IDENTIFIER dimensions '(' expression_list_with_nuls ')' '''
4209 # { lgate*tmp = new lgate;
4210 # list<pform_range_t>*rng = $2;
4213 # tmp->range = rng->front();
4215 # assert(rng->empty());
4216 # tmp->file = @1.text;
4217 # tmp->lineno = @1.first_line;
4223 def p_gate_instance_3(p
):
4224 '''gate_instance : '(' expression_list_with_nuls ')' '''
4226 # { lgate*tmp = new lgate;
4229 # tmp->file = @1.text;
4230 # tmp->lineno = @1.first_line;
4234 def p_gate_instance_4(p
):
4235 '''gate_instance : IDENTIFIER dimensions '''
4237 # { lgate*tmp = new lgate;
4238 # list<pform_range_t>*rng = $2;
4241 # tmp->parms_by_name = 0;
4242 # tmp->range = rng->front();
4244 # assert(rng->empty());
4245 # tmp->file = @1.text;
4246 # tmp->lineno = @1.first_line;
4252 def p_gate_instance_5(p
):
4253 '''gate_instance : IDENTIFIER '(' port_name_list ')' '''
4255 # { lgate*tmp = new lgate;
4258 # tmp->parms_by_name = $3;
4259 # tmp->file = @1.text;
4260 # tmp->lineno = @1.first_line;
4265 def p_gate_instance_6(p
):
4266 '''gate_instance : IDENTIFIER dimensions '(' port_name_list ')' '''
4268 # { lgate*tmp = new lgate;
4269 # list<pform_range_t>*rng = $2;
4272 # tmp->parms_by_name = $4;
4273 # tmp->range = rng->front();
4275 # assert(rng->empty());
4276 # tmp->file = @1.text;
4277 # tmp->lineno = @1.first_line;
4283 def p_gate_instance_7(p
):
4284 '''gate_instance : IDENTIFIER '(' error ')' '''
4286 # { lgate*tmp = new lgate;
4289 # tmp->parms_by_name = 0;
4290 # tmp->file = @1.text;
4291 # tmp->lineno = @1.first_line;
4292 # yyerror(@2, "error: Syntax error in instance port "
4293 # "expression(s).");
4298 def p_gate_instance_8(p
):
4299 '''gate_instance : IDENTIFIER dimensions '(' error ')' '''
4301 # { lgate*tmp = new lgate;
4304 # tmp->parms_by_name = 0;
4305 # tmp->file = @1.text;
4306 # tmp->lineno = @1.first_line;
4307 # yyerror(@3, "error: Syntax error in instance port "
4308 # "expression(s).");
4313 def p_gate_instance_list_1(p
):
4314 '''gate_instance_list : gate_instance_list ',' gate_instance '''
4316 # { svector<lgate>*tmp1 = $1;
4318 # svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
4324 def p_gate_instance_list_2(p
):
4325 '''gate_instance_list : gate_instance '''
4327 # { svector<lgate>*tmp = new svector<lgate>(1);
4333 def p_gatetype_1(p
):
4334 '''gatetype : K_and '''
4336 # { $$ = PGBuiltin::AND; }
4338 def p_gatetype_2(p
):
4339 '''gatetype : K_nand '''
4341 # { $$ = PGBuiltin::NAND; }
4343 def p_gatetype_3(p
):
4344 '''gatetype : K_or '''
4346 # { $$ = PGBuiltin::OR; }
4348 def p_gatetype_4(p
):
4349 '''gatetype : K_nor '''
4351 # { $$ = PGBuiltin::NOR; }
4353 def p_gatetype_5(p
):
4354 '''gatetype : K_xor '''
4356 # { $$ = PGBuiltin::XOR; }
4358 def p_gatetype_6(p
):
4359 '''gatetype : K_xnor '''
4361 # { $$ = PGBuiltin::XNOR; }
4363 def p_gatetype_7(p
):
4364 '''gatetype : K_buf '''
4366 # { $$ = PGBuiltin::BUF; }
4368 def p_gatetype_8(p
):
4369 '''gatetype : K_bufif0 '''
4371 # { $$ = PGBuiltin::BUFIF0; }
4373 def p_gatetype_9(p
):
4374 '''gatetype : K_bufif1 '''
4376 # { $$ = PGBuiltin::BUFIF1; }
4378 def p_gatetype_10(p
):
4379 '''gatetype : K_not '''
4381 # { $$ = PGBuiltin::NOT; }
4383 def p_gatetype_11(p
):
4384 '''gatetype : K_notif0 '''
4386 # { $$ = PGBuiltin::NOTIF0; }
4388 def p_gatetype_12(p
):
4389 '''gatetype : K_notif1 '''
4391 # { $$ = PGBuiltin::NOTIF1; }
4393 def p_switchtype_1(p
):
4394 '''switchtype : K_nmos '''
4396 # { $$ = PGBuiltin::NMOS; }
4398 def p_switchtype_2(p
):
4399 '''switchtype : K_rnmos '''
4401 # { $$ = PGBuiltin::RNMOS; }
4403 def p_switchtype_3(p
):
4404 '''switchtype : K_pmos '''
4406 # { $$ = PGBuiltin::PMOS; }
4408 def p_switchtype_4(p
):
4409 '''switchtype : K_rpmos '''
4411 # { $$ = PGBuiltin::RPMOS; }
4413 def p_switchtype_5(p
):
4414 '''switchtype : K_cmos '''
4416 # { $$ = PGBuiltin::CMOS; }
4418 def p_switchtype_6(p
):
4419 '''switchtype : K_rcmos '''
4421 # { $$ = PGBuiltin::RCMOS; }
4423 def p_switchtype_7(p
):
4424 '''switchtype : K_tran '''
4426 # { $$ = PGBuiltin::TRAN; }
4428 def p_switchtype_8(p
):
4429 '''switchtype : K_rtran '''
4431 # { $$ = PGBuiltin::RTRAN; }
4433 def p_switchtype_9(p
):
4434 '''switchtype : K_tranif0 '''
4436 # { $$ = PGBuiltin::TRANIF0; }
4438 def p_switchtype_10(p
):
4439 '''switchtype : K_tranif1 '''
4441 # { $$ = PGBuiltin::TRANIF1; }
4443 def p_switchtype_11(p
):
4444 '''switchtype : K_rtranif0 '''
4446 # { $$ = PGBuiltin::RTRANIF0; }
4448 def p_switchtype_12(p
):
4449 '''switchtype : K_rtranif1 '''
4451 # { $$ = PGBuiltin::RTRANIF1; }
4453 def p_hierarchy_identifier_1(p
):
4454 '''hierarchy_identifier : IDENTIFIER '''
4456 # { $$ = new pform_name_t;
4457 # $$->push_back(name_component_t(lex_strings.make($1)));
4461 def p_hierarchy_identifier_2(p
):
4462 '''hierarchy_identifier : hierarchy_identifier '.' IDENTIFIER '''
4464 # { pform_name_t * tmp = $1;
4465 # tmp->push_back(name_component_t(lex_strings.make($3)));
4470 def p_hierarchy_identifier_3(p
):
4471 '''hierarchy_identifier : hierarchy_identifier '[' expression ']' '''
4473 # { pform_name_t * tmp = $1;
4474 # name_component_t&tail = tmp->back();
4475 # index_component_t itmp;
4476 # itmp.sel = index_component_t::SEL_BIT;
4478 # tail.index.push_back(itmp);
4482 def p_hierarchy_identifier_4(p
):
4483 '''hierarchy_identifier : hierarchy_identifier '[' '$' ']' '''
4485 # { pform_name_t * tmp = $1;
4486 # name_component_t&tail = tmp->back();
4487 # if (! gn_system_verilog()) {
4488 # yyerror(@3, "error: Last element expression ($) "
4489 # "requires SystemVerilog. Try enabling SystemVerilog.");
4491 # index_component_t itmp;
4492 # itmp.sel = index_component_t::SEL_BIT_LAST;
4495 # tail.index.push_back(itmp);
4499 def p_hierarchy_identifier_5(p
):
4500 '''hierarchy_identifier : hierarchy_identifier '[' expression ':' expression ']' '''
4502 # { pform_name_t * tmp = $1;
4503 # name_component_t&tail = tmp->back();
4504 # index_component_t itmp;
4505 # itmp.sel = index_component_t::SEL_PART;
4508 # tail.index.push_back(itmp);
4512 def p_hierarchy_identifier_6(p
):
4513 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_POS expression ']' '''
4515 # { pform_name_t * tmp = $1;
4516 # name_component_t&tail = tmp->back();
4517 # index_component_t itmp;
4518 # itmp.sel = index_component_t::SEL_IDX_UP;
4521 # tail.index.push_back(itmp);
4525 def p_hierarchy_identifier_7(p
):
4526 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_NEG expression ']' '''
4528 # { pform_name_t * tmp = $1;
4529 # name_component_t&tail = tmp->back();
4530 # index_component_t itmp;
4531 # itmp.sel = index_component_t::SEL_IDX_DO;
4534 # tail.index.push_back(itmp);
4538 def p_list_of_identifiers_1(p
):
4539 '''list_of_identifiers : IDENTIFIER '''
4541 # { $$ = list_from_identifier($1); }
4543 def p_list_of_identifiers_2(p
):
4544 '''list_of_identifiers : list_of_identifiers ',' IDENTIFIER '''
4546 # { $$ = list_from_identifier($1, $3); }
4548 def p_list_of_port_identifiers_1(p
):
4549 '''list_of_port_identifiers : IDENTIFIER dimensions_opt '''
4551 # { $$ = make_port_list($1, $2, 0); }
4553 def p_list_of_port_identifiers_2(p
):
4554 '''list_of_port_identifiers : list_of_port_identifiers ',' IDENTIFIER dimensions_opt '''
4556 # { $$ = make_port_list($1, $3, $4, 0); }
4558 def p_list_of_variable_port_identifiers_1(p
):
4559 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '''
4561 # { $$ = make_port_list($1, $2, 0); }
4563 def p_list_of_variable_port_identifiers_2(p
):
4564 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '=' expression '''
4566 # { $$ = make_port_list($1, $2, $4); }
4568 def p_list_of_variable_port_identifiers_3(p
):
4569 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '''
4571 # { $$ = make_port_list($1, $3, $4, 0); }
4573 def p_list_of_variable_port_identifiers_4(p
):
4574 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '=' expression '''
4576 # { $$ = make_port_list($1, $3, $4, $6); }
4578 def p_list_of_ports_1(p
):
4579 '''list_of_ports : port_opt '''
4581 # { vector<Module::port_t*>*tmp
4582 # = new vector<Module::port_t*>(1);
4587 def p_list_of_ports_2(p
):
4588 '''list_of_ports : list_of_ports ',' port_opt '''
4590 # { vector<Module::port_t*>*tmp = $1;
4591 # tmp->push_back($3);
4595 def p_list_of_port_declarations_1(p
):
4596 '''list_of_port_declarations : port_declaration '''
4598 # { vector<Module::port_t*>*tmp
4599 # = new vector<Module::port_t*>(1);
4604 def p_list_of_port_declarations_2(p
):
4605 '''list_of_port_declarations : list_of_port_declarations ',' port_declaration '''
4607 # { vector<Module::port_t*>*tmp = $1;
4608 # tmp->push_back($3);
4612 def p_list_of_port_declarations_3(p
):
4613 '''list_of_port_declarations : list_of_port_declarations ',' IDENTIFIER '''
4615 # { Module::port_t*ptmp;
4616 # perm_string name = lex_strings.make($3);
4617 # ptmp = pform_module_port_reference(name, @3.text,
4619 # vector<Module::port_t*>*tmp = $1;
4620 # tmp->push_back(ptmp);
4622 # /* Get the port declaration details, the port type
4623 # and what not, from context data stored by the
4624 # last port_declaration rule. */
4625 # pform_module_define_port(@3, name,
4626 # port_declaration_context.port_type,
4627 # port_declaration_context.port_net_type,
4628 # port_declaration_context.data_type, 0);
4633 def p_list_of_port_declarations_4(p
):
4634 '''list_of_port_declarations : list_of_port_declarations ',' '''
4637 # yyerror(@2, "error: NULL port declarations are not "
4641 def p_list_of_port_declarations_5(p
):
4642 '''list_of_port_declarations : list_of_port_declarations ';' '''
4645 # yyerror(@2, "error: ';' is an invalid port declaration "
4649 def p_port_declaration_1(p
):
4650 '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4652 # { Module::port_t*ptmp;
4653 # perm_string name = lex_strings.make($5);
4654 # data_type_t*use_type = $4;
4655 # if ($6) use_type = new uarray_type_t(use_type, $6);
4656 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4657 # pform_module_define_port(@2, name, NetNet::PINPUT, $3, use_type, $1);
4658 # port_declaration_context.port_type = NetNet::PINPUT;
4659 # port_declaration_context.port_net_type = $3;
4660 # port_declaration_context.data_type = $4;
4665 def p_port_declaration_2(p
):
4666 '''port_declaration : attribute_list_opt K_input K_wreal IDENTIFIER '''
4668 # { Module::port_t*ptmp;
4669 # perm_string name = lex_strings.make($4);
4670 # ptmp = pform_module_port_reference(name, @2.text,
4672 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4673 # FILE_NAME(real_type, @3);
4674 # pform_module_define_port(@2, name, NetNet::PINPUT,
4675 # NetNet::WIRE, real_type, $1);
4676 # port_declaration_context.port_type = NetNet::PINPUT;
4677 # port_declaration_context.port_net_type = NetNet::WIRE;
4678 # port_declaration_context.data_type = real_type;
4683 def p_port_declaration_3(p
):
4684 '''port_declaration : attribute_list_opt K_inout net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4686 # { Module::port_t*ptmp;
4687 # perm_string name = lex_strings.make($5);
4688 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4689 # pform_module_define_port(@2, name, NetNet::PINOUT, $3, $4, $1);
4690 # port_declaration_context.port_type = NetNet::PINOUT;
4691 # port_declaration_context.port_net_type = $3;
4692 # port_declaration_context.data_type = $4;
4695 # yyerror(@6, "sorry: Inout ports with unpacked dimensions not supported.");
4701 def p_port_declaration_4(p
):
4702 '''port_declaration : attribute_list_opt K_inout K_wreal IDENTIFIER '''
4704 # { Module::port_t*ptmp;
4705 # perm_string name = lex_strings.make($4);
4706 # ptmp = pform_module_port_reference(name, @2.text,
4708 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4709 # FILE_NAME(real_type, @3);
4710 # pform_module_define_port(@2, name, NetNet::PINOUT,
4711 # NetNet::WIRE, real_type, $1);
4712 # port_declaration_context.port_type = NetNet::PINOUT;
4713 # port_declaration_context.port_net_type = NetNet::WIRE;
4714 # port_declaration_context.data_type = real_type;
4719 def p_port_declaration_5(p
):
4720 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4722 # { Module::port_t*ptmp;
4723 # perm_string name = lex_strings.make($5);
4724 # data_type_t*use_dtype = $4;
4725 # if ($6) use_dtype = new uarray_type_t(use_dtype, $6);
4726 # NetNet::Type use_type = $3;
4727 # if (use_type == NetNet::IMPLICIT) {
4728 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($4)) {
4729 # if (dtype->reg_flag)
4730 # use_type = NetNet::REG;
4731 # else if (dtype->implicit_flag)
4732 # use_type = NetNet::IMPLICIT;
4734 # use_type = NetNet::IMPLICIT_REG;
4736 # // The SystemVerilog types that can show up as
4737 # // output ports are implicitly (on the inside)
4738 # // variables because "reg" is not valid syntax
4740 # } else if (dynamic_cast<atom2_type_t*> ($4)) {
4741 # use_type = NetNet::IMPLICIT_REG;
4742 # } else if (dynamic_cast<struct_type_t*> ($4)) {
4743 # use_type = NetNet::IMPLICIT_REG;
4744 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> ($4)) {
4745 # if(etype->base_type == IVL_VT_LOGIC)
4746 # use_type = NetNet::IMPLICIT_REG;
4749 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4750 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, use_dtype, $1);
4751 # port_declaration_context.port_type = NetNet::POUTPUT;
4752 # port_declaration_context.port_net_type = use_type;
4753 # port_declaration_context.data_type = $4;
4758 def p_port_declaration_6(p
):
4759 '''port_declaration : attribute_list_opt K_output K_wreal IDENTIFIER '''
4761 # { Module::port_t*ptmp;
4762 # perm_string name = lex_strings.make($4);
4763 # ptmp = pform_module_port_reference(name, @2.text,
4765 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4766 # FILE_NAME(real_type, @3);
4767 # pform_module_define_port(@2, name, NetNet::POUTPUT,
4768 # NetNet::WIRE, real_type, $1);
4769 # port_declaration_context.port_type = NetNet::POUTPUT;
4770 # port_declaration_context.port_net_type = NetNet::WIRE;
4771 # port_declaration_context.data_type = real_type;
4776 def p_port_declaration_7(p
):
4777 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER '=' expression '''
4779 # { Module::port_t*ptmp;
4780 # perm_string name = lex_strings.make($5);
4781 # NetNet::Type use_type = $3;
4782 # if (use_type == NetNet::IMPLICIT) {
4783 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($4)) {
4784 # if (dtype->reg_flag)
4785 # use_type = NetNet::REG;
4787 # use_type = NetNet::IMPLICIT_REG;
4789 # use_type = NetNet::IMPLICIT_REG;
4792 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4793 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, $4, $1);
4794 # port_declaration_context.port_type = NetNet::PINOUT;
4795 # port_declaration_context.port_net_type = use_type;
4796 # port_declaration_context.data_type = $4;
4798 # pform_make_var_init(@5, name, $7);
4804 def p_net_type_opt_1(p
):
4805 '''net_type_opt : net_type '''
4809 def p_net_type_opt_2(p
):
4810 '''net_type_opt : '''
4812 # { $$ = NetNet::IMPLICIT; }
4814 def p_unsigned_signed_opt_1(p
):
4815 '''unsigned_signed_opt : K_signed '''
4819 def p_unsigned_signed_opt_2(p
):
4820 '''unsigned_signed_opt : K_unsigned '''
4824 def p_unsigned_signed_opt_3(p
):
4825 '''unsigned_signed_opt : '''
4829 def p_signed_unsigned_opt_1(p
):
4830 '''signed_unsigned_opt : K_signed '''
4834 def p_signed_unsigned_opt_2(p
):
4835 '''signed_unsigned_opt : K_unsigned '''
4839 def p_signed_unsigned_opt_3(p
):
4840 '''signed_unsigned_opt : '''
4844 def p_atom2_type_1(p
):
4845 '''atom2_type : K_byte '''
4849 def p_atom2_type_2(p
):
4850 '''atom2_type : K_shortint '''
4854 def p_atom2_type_3(p
):
4855 '''atom2_type : K_int '''
4859 def p_atom2_type_4(p
):
4860 '''atom2_type : K_longint '''
4865 '''lpvalue : hierarchy_identifier '''
4867 # { PEIdent*tmp = pform_new_ident(*$1);
4868 # FILE_NAME(tmp, @1);
4874 '''lpvalue : implicit_class_handle '.' hierarchy_identifier '''
4876 # { pform_name_t*t_name = $1;
4877 # while (!$3->empty()) {
4878 # t_name->push_back($3->front());
4881 # PEIdent*tmp = new PEIdent(*t_name);
4882 # FILE_NAME(tmp, @1);
4889 '''lpvalue : '{' expression_list_proper '}' '''
4891 # { PEConcat*tmp = new PEConcat(*$2);
4892 # FILE_NAME(tmp, @1);
4898 '''lpvalue : streaming_concatenation '''
4900 # { yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
4904 def p_cont_assign_1(p
):
4905 '''cont_assign : lpvalue '=' expression '''
4907 # { list<PExpr*>*tmp = new list<PExpr*>;
4908 # tmp->push_back($1);
4909 # tmp->push_back($3);
4913 def p_cont_assign_list_1(p
):
4914 '''cont_assign_list : cont_assign_list ',' cont_assign '''
4916 # { list<PExpr*>*tmp = $1;
4917 # tmp->splice(tmp->end(), *$3);
4922 def p_cont_assign_list_2(p
):
4923 '''cont_assign_list : cont_assign '''
4928 '''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 '''
4930 # { // Last step: check any closing name. This is done late so
4931 # // that the parser can look ahead to detect the present
4932 # // endlabel_opt but still have the pform_endmodule() called
4933 # // early enough that the lexor can know we are outside the
4936 # if (strcmp($4,$17) != 0) {
4939 # yyerror(@17, "error: End label doesn't match "
4943 # yyerror(@17, "error: End label doesn't match "
4947 # yyerror(@17, "error: End label doesn't match "
4948 # "interface name.");
4954 # if (($2 == K_module) && (! gn_system_verilog())) {
4955 # yyerror(@8, "error: Module end labels require "
4956 # "SystemVerilog.");
4963 def p__embed0_module(p
):
4964 '''_embed0_module : '''
4965 # { pform_startmodule(@2, $4, $2==K_program, $2==K_interface, $3, $1); }
4967 def p__embed1_module(p
):
4968 '''_embed1_module : '''
4969 # { pform_module_set_ports($8); }
4971 def p__embed2_module(p
):
4972 '''_embed2_module : '''
4973 # { pform_set_scope_timescale(@2); }
4975 def p__embed3_module(p
):
4976 '''_embed3_module : '''
4977 # { Module::UCDriveType ucd;
4978 # // The lexor detected `unconnected_drive directives and
4979 # // marked what it found in the uc_drive variable. Use that
4980 # // to generate a UCD flag for the module.
4981 # switch (uc_drive) {
4984 # ucd = Module::UCD_NONE;
4987 # ucd = Module::UCD_PULL0;
4990 # ucd = Module::UCD_PULL1;
4993 # // Check that program/endprogram and module/endmodule
4994 # // keywords match.
4998 # yyerror(@15, "error: module not closed by endmodule.");
5001 # yyerror(@15, "error: program not closed by endprogram.");
5004 # yyerror(@15, "error: interface not closed by endinterface.");
5010 # pform_endmodule($4, in_celldefine, ucd);
5013 def p_module_start_1(p
):
5014 '''module_start : K_module '''
5016 # { $$ = K_module; }
5018 def p_module_start_2(p
):
5019 '''module_start : K_macromodule '''
5021 # { $$ = K_module; }
5023 def p_module_start_3(p
):
5024 '''module_start : K_program '''
5026 # { $$ = K_program; }
5028 def p_module_start_4(p
):
5029 '''module_start : K_interface '''
5031 # { $$ = K_interface; }
5033 def p_module_end_1(p
):
5034 '''module_end : K_endmodule '''
5036 # { $$ = K_module; }
5038 def p_module_end_2(p
):
5039 '''module_end : K_endprogram '''
5041 # { $$ = K_program; }
5043 def p_module_end_3(p
):
5044 '''module_end : K_endinterface '''
5046 # { $$ = K_interface; }
5048 def p_endlabel_opt_1(p
):
5049 '''endlabel_opt : ':' IDENTIFIER '''
5053 def p_endlabel_opt_2(p
):
5054 '''endlabel_opt : '''
5058 def p_module_attribute_foreign_1(p
):
5059 '''module_attribute_foreign : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP '''
5063 def p_module_attribute_foreign_2(p
):
5064 '''module_attribute_foreign : '''
5068 def p_module_port_list_opt_1(p
):
5069 '''module_port_list_opt : '(' list_of_ports ')' '''
5073 def p_module_port_list_opt_2(p
):
5074 '''module_port_list_opt : '(' list_of_port_declarations ')' '''
5078 def p_module_port_list_opt_3(p
):
5079 '''module_port_list_opt : '''
5083 def p_module_port_list_opt_4(p
):
5084 '''module_port_list_opt : '(' error ')' '''
5086 # { yyerror(@2, "Errors in port declarations.");
5091 def p_module_parameter_port_list_opt_1(p
):
5092 '''module_parameter_port_list_opt : '''
5095 def p_module_parameter_port_list_opt_2(p
):
5096 '''module_parameter_port_list_opt : '#' '(' module_parameter_port_list ')' '''
5099 def p_module_parameter_port_list_1(p
):
5100 '''module_parameter_port_list : K_parameter param_type parameter_assign '''
5103 def p_module_parameter_port_list_2(p
):
5104 '''module_parameter_port_list : module_parameter_port_list ',' parameter_assign '''
5107 def p_module_parameter_port_list_3(p
):
5108 '''module_parameter_port_list : module_parameter_port_list ',' K_parameter param_type parameter_assign '''
5111 def p_module_item_1(p
):
5112 '''module_item : module '''
5115 def p_module_item_2(p
):
5116 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' '''
5118 # { data_type_t*data_type = $3;
5119 # if (data_type == 0) {
5120 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5121 # FILE_NAME(data_type, @2);
5123 # pform_set_data_type(@2, data_type, $5, $2, $1);
5125 # yyerror(@2, "sorry: net delays not supported.");
5131 def p_module_item_3(p
):
5132 '''module_item : attribute_list_opt K_wreal delay3 net_variable_list ';' '''
5134 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5135 # pform_set_data_type(@2, tmpt, $4, NetNet::WIRE, $1);
5137 # yyerror(@3, "sorry: net delays not supported.");
5143 def p_module_item_4(p
):
5144 '''module_item : attribute_list_opt K_wreal net_variable_list ';' '''
5146 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5147 # pform_set_data_type(@2, tmpt, $3, NetNet::WIRE, $1);
5151 def p_module_item_5(p
):
5152 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_decl_assigns ';' '''
5154 # { data_type_t*data_type = $3;
5155 # if (data_type == 0) {
5156 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5157 # FILE_NAME(data_type, @2);
5159 # pform_makewire(@2, $4, str_strength, $5, $2, data_type);
5161 # yywarn(@2, "Attributes are not supported on net declaration "
5162 # "assignments and will be discarded.");
5167 def p_module_item_6(p
):
5168 '''module_item : attribute_list_opt net_type data_type_or_implicit drive_strength net_decl_assigns ';' '''
5170 # { data_type_t*data_type = $3;
5171 # if (data_type == 0) {
5172 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5173 # FILE_NAME(data_type, @2);
5175 # pform_makewire(@2, 0, $4, $5, $2, data_type);
5177 # yywarn(@2, "Attributes are not supported on net declaration "
5178 # "assignments and will be discarded.");
5183 def p_module_item_7(p
):
5184 '''module_item : attribute_list_opt K_wreal net_decl_assigns ';' '''
5186 # { real_type_t*data_type = new real_type_t(real_type_t::REAL);
5187 # pform_makewire(@2, 0, str_strength, $3, NetNet::WIRE, data_type);
5189 # yywarn(@2, "Attributes are not supported on net declaration "
5190 # "assignments and will be discarded.");
5195 def p_module_item_8(p
):
5196 '''module_item : K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' '''
5198 # { yyerror(@1, "sorry: trireg nets not supported.");
5203 def p_module_item_9(p
):
5204 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit list_of_port_identifiers ';' '''
5206 # { pform_module_define_port(@2, $5, $2, $3, $4, $1); }
5208 def p_module_item_10(p
):
5209 '''module_item : attribute_list_opt port_direction K_wreal list_of_port_identifiers ';' '''
5211 # { real_type_t*real_type = new real_type_t(real_type_t::REAL);
5212 # pform_module_define_port(@2, $4, $2, NetNet::WIRE, real_type, $1);
5215 def p_module_item_11(p
):
5216 '''module_item : attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' '''
5218 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5219 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5220 # if (dtype->implicit_flag)
5221 # use_type = NetNet::NONE;
5223 # if (use_type == NetNet::NONE)
5224 # pform_set_port_type(@2, $4, NetNet::PINOUT, $3, $1);
5226 # pform_module_define_port(@2, $4, NetNet::PINOUT, use_type, $3, $1);
5229 def p_module_item_12(p
):
5230 '''module_item : attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' '''
5232 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5233 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5234 # if (dtype->implicit_flag)
5235 # use_type = NetNet::NONE;
5237 # if (use_type == NetNet::NONE)
5238 # pform_set_port_type(@2, $4, NetNet::PINPUT, $3, $1);
5240 # pform_module_define_port(@2, $4, NetNet::PINPUT, use_type, $3, $1);
5243 def p_module_item_13(p
):
5244 '''module_item : attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' '''
5246 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5247 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5248 # if (dtype->implicit_flag)
5249 # use_type = NetNet::NONE;
5250 # else if (dtype->reg_flag)
5251 # use_type = NetNet::REG;
5253 # use_type = NetNet::IMPLICIT_REG;
5255 # // The SystemVerilog types that can show up as
5256 # // output ports are implicitly (on the inside)
5257 # // variables because "reg" is not valid syntax
5259 # } else if (dynamic_cast<atom2_type_t*> ($3)) {
5260 # use_type = NetNet::IMPLICIT_REG;
5261 # } else if (dynamic_cast<struct_type_t*> ($3)) {
5262 # use_type = NetNet::IMPLICIT_REG;
5263 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> ($3)) {
5264 # if(etype->base_type == IVL_VT_LOGIC)
5265 # use_type = NetNet::IMPLICIT_REG;
5267 # if (use_type == NetNet::NONE)
5268 # pform_set_port_type(@2, $4, NetNet::POUTPUT, $3, $1);
5270 # pform_module_define_port(@2, $4, NetNet::POUTPUT, use_type, $3, $1);
5273 def p_module_item_14(p
):
5274 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit error ';' '''
5276 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5277 # if ($1) delete $1;
5278 # if ($4) delete $4;
5282 def p_module_item_15(p
):
5283 '''module_item : attribute_list_opt K_inout data_type_or_implicit error ';' '''
5285 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5286 # if ($1) delete $1;
5287 # if ($3) delete $3;
5291 def p_module_item_16(p
):
5292 '''module_item : attribute_list_opt K_input data_type_or_implicit error ';' '''
5294 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5295 # if ($1) delete $1;
5296 # if ($3) delete $3;
5300 def p_module_item_17(p
):
5301 '''module_item : attribute_list_opt K_output data_type_or_implicit error ';' '''
5303 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5304 # if ($1) delete $1;
5305 # if ($3) delete $3;
5309 def p_module_item_18(p
):
5310 '''module_item : DISCIPLINE_IDENTIFIER list_of_identifiers ';' '''
5312 # { pform_attach_discipline(@1, $1, $2); }
5314 def p_module_item_19(p
):
5315 '''module_item : attribute_list_opt _embed0_module_item block_item_decl '''
5317 # { delete attributes_in_context;
5318 # attributes_in_context = 0;
5321 def p_module_item_20(p
):
5322 '''module_item : K_defparam _embed1_module_item defparam_assign_list ';' '''
5325 def p_module_item_21(p
):
5326 '''module_item : attribute_list_opt gatetype gate_instance_list ';' '''
5328 # { pform_makegates(@2, $2, str_strength, 0, $3, $1); }
5330 def p_module_item_22(p
):
5331 '''module_item : attribute_list_opt gatetype delay3 gate_instance_list ';' '''
5333 # { pform_makegates(@2, $2, str_strength, $3, $4, $1); }
5335 def p_module_item_23(p
):
5336 '''module_item : attribute_list_opt gatetype drive_strength gate_instance_list ';' '''
5338 # { pform_makegates(@2, $2, $3, 0, $4, $1); }
5340 def p_module_item_24(p
):
5341 '''module_item : attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';' '''
5343 # { pform_makegates(@2, $2, $3, $4, $5, $1); }
5345 def p_module_item_25(p
):
5346 '''module_item : attribute_list_opt switchtype gate_instance_list ';' '''
5348 # { pform_makegates(@2, $2, str_strength, 0, $3, $1); }
5350 def p_module_item_26(p
):
5351 '''module_item : attribute_list_opt switchtype delay3 gate_instance_list ';' '''
5353 # { pform_makegates(@2, $2, str_strength, $3, $4, $1); }
5355 def p_module_item_27(p
):
5356 '''module_item : K_pullup gate_instance_list ';' '''
5358 # { pform_makegates(@1, PGBuiltin::PULLUP, pull_strength, 0, $2, 0); }
5360 def p_module_item_28(p
):
5361 '''module_item : K_pulldown gate_instance_list ';' '''
5363 # { pform_makegates(@1, PGBuiltin::PULLDOWN, pull_strength, 0, $2, 0); }
5365 def p_module_item_29(p
):
5366 '''module_item : K_pullup '(' dr_strength1 ')' gate_instance_list ';' '''
5368 # { pform_makegates(@1, PGBuiltin::PULLUP, $3, 0, $5, 0); }
5370 def p_module_item_30(p
):
5371 '''module_item : K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5373 # { pform_makegates(@1, PGBuiltin::PULLUP, $3, 0, $7, 0); }
5375 def p_module_item_31(p
):
5376 '''module_item : K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5378 # { pform_makegates(@1, PGBuiltin::PULLUP, $5, 0, $7, 0); }
5380 def p_module_item_32(p
):
5381 '''module_item : K_pulldown '(' dr_strength0 ')' gate_instance_list ';' '''
5383 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $3, 0, $5, 0); }
5385 def p_module_item_33(p
):
5386 '''module_item : K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5388 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $5, 0, $7, 0); }
5390 def p_module_item_34(p
):
5391 '''module_item : K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5393 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $3, 0, $7, 0); }
5395 def p_module_item_35(p
):
5396 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' '''
5398 # { perm_string tmp1 = lex_strings.make($2);
5399 # pform_make_modgates(@2, tmp1, $3, $4, $1);
5403 def p_module_item_36(p
):
5404 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt error ';' '''
5406 # { yyerror(@2, "error: Invalid module instantiation");
5408 # if ($1) delete $1;
5411 def p_module_item_37(p
):
5412 '''module_item : K_assign drive_strength_opt delay3_opt cont_assign_list ';' '''
5414 # { pform_make_pgassign_list($4, $3, $2, @1.text, @1.first_line); }
5416 def p_module_item_38(p
):
5417 '''module_item : attribute_list_opt K_always statement_item '''
5419 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, $3, $1);
5420 # FILE_NAME(tmp, @2);
5423 def p_module_item_39(p
):
5424 '''module_item : attribute_list_opt K_always_comb statement_item '''
5426 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_COMB, $3, $1);
5427 # FILE_NAME(tmp, @2);
5430 def p_module_item_40(p
):
5431 '''module_item : attribute_list_opt K_always_ff statement_item '''
5433 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, $3, $1);
5434 # FILE_NAME(tmp, @2);
5437 def p_module_item_41(p
):
5438 '''module_item : attribute_list_opt K_always_latch statement_item '''
5440 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_LATCH, $3, $1);
5441 # FILE_NAME(tmp, @2);
5444 def p_module_item_42(p
):
5445 '''module_item : attribute_list_opt K_initial statement_item '''
5447 # { PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, $3, $1);
5448 # FILE_NAME(tmp, @2);
5451 def p_module_item_43(p
):
5452 '''module_item : attribute_list_opt K_final statement_item '''
5454 # { PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, $3, $1);
5455 # FILE_NAME(tmp, @2);
5458 def p_module_item_44(p
):
5459 '''module_item : attribute_list_opt K_analog analog_statement '''
5461 # { pform_make_analog_behavior(@2, IVL_PR_ALWAYS, $3); }
5463 def p_module_item_45(p
):
5464 '''module_item : attribute_list_opt assertion_item '''
5467 def p_module_item_46(p
):
5468 '''module_item : timeunits_declaration '''
5471 def p_module_item_47(p
):
5472 '''module_item : class_declaration '''
5475 def p_module_item_48(p
):
5476 '''module_item : task_declaration '''
5479 def p_module_item_49(p
):
5480 '''module_item : function_declaration '''
5483 def p_module_item_50(p
):
5484 '''module_item : K_generate generate_item_list_opt K_endgenerate '''
5486 # { // Test for bad nesting. I understand it, but it is illegal.
5487 # if (pform_parent_generate()) {
5488 # cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
5489 # cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
5490 # cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
5495 def p_module_item_51(p
):
5496 '''module_item : K_genvar list_of_identifiers ';' '''
5498 # { pform_genvars(@1, $2); }
5500 def p_module_item_52(p
):
5501 '''module_item : K_for '(' IDENTIFIER '=' expression ';' expression ';' IDENTIFIER '=' expression ')' _embed2_module_item generate_block '''
5503 # { pform_endgenerate(); }
5505 def p_module_item_53(p
):
5506 '''module_item : generate_if generate_block_opt K_else _embed3_module_item generate_block '''
5508 # { pform_endgenerate(); }
5510 def p_module_item_54(p
):
5511 '''module_item : generate_if generate_block_opt %prec less_than_K_else '''
5513 # { pform_endgenerate(); }
5515 def p_module_item_55(p
):
5516 '''module_item : K_case '(' expression ')' _embed4_module_item generate_case_items K_endcase '''
5518 # { pform_endgenerate(); }
5520 def p_module_item_56(p
):
5521 '''module_item : modport_declaration '''
5524 def p_module_item_57(p
):
5525 '''module_item : package_import_declaration '''
5528 def p_module_item_58(p
):
5529 '''module_item : attribute_list_opt K_specparam _embed5_module_item specparam_decl ';' '''
5532 def p_module_item_59(p
):
5533 '''module_item : K_specify _embed6_module_item specify_item_list_opt K_endspecify '''
5536 def p_module_item_60(p
):
5537 '''module_item : K_specify error K_endspecify '''
5539 # { yyerror(@1, "error: syntax error in specify block");
5543 def p_module_item_61(p
):
5544 '''module_item : error ';' '''
5546 # { yyerror(@2, "error: invalid module item.");
5550 def p_module_item_62(p
):
5551 '''module_item : K_assign error '=' expression ';' '''
5553 # { yyerror(@1, "error: syntax error in left side "
5554 # "of continuous assignment.");
5558 def p_module_item_63(p
):
5559 '''module_item : K_assign error ';' '''
5561 # { yyerror(@1, "error: syntax error in "
5562 # "continuous assignment");
5566 def p_module_item_64(p
):
5567 '''module_item : K_function error K_endfunction endlabel_opt '''
5569 # { yyerror(@1, "error: I give up on this "
5570 # "function definition.");
5572 # if (!gn_system_verilog()) {
5573 # yyerror(@4, "error: Function end names require "
5574 # "SystemVerilog.");
5581 def p_module_item_65(p
):
5582 '''module_item : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';' '''
5584 # { perm_string tmp3 = lex_strings.make($3);
5585 # perm_string tmp5 = lex_strings.make($5);
5586 # pform_set_attrib(tmp3, tmp5, $7);
5591 def p_module_item_66(p
):
5592 '''module_item : KK_attribute '(' error ')' ';' '''
5594 # { yyerror(@1, "error: Malformed $attribute parameter list."); }
5596 def p__embed0_module_item(p
):
5597 '''_embed0_module_item : '''
5598 # { attributes_in_context = $1; }
5600 def p__embed1_module_item(p
):
5601 '''_embed1_module_item : '''
5602 # { if (pform_in_interface())
5603 # yyerror(@1, "error: Parameter overrides are not allowed "
5604 # "in interfaces.");
5607 def p__embed2_module_item(p
):
5608 '''_embed2_module_item : '''
5609 # { pform_start_generate_for(@1, $3, $5, $7, $9, $11); }
5611 def p__embed3_module_item(p
):
5612 '''_embed3_module_item : '''
5613 # { pform_start_generate_else(@1); }
5615 def p__embed4_module_item(p
):
5616 '''_embed4_module_item : '''
5617 # { pform_start_generate_case(@1, $3); }
5619 def p__embed5_module_item(p
):
5620 '''_embed5_module_item : '''
5621 # { if (pform_in_interface())
5622 # yyerror(@1, "error: specparam declarations are not allowed "
5623 # "in interfaces.");
5626 def p__embed6_module_item(p
):
5627 '''_embed6_module_item : '''
5628 # { if (pform_in_interface())
5629 # yyerror(@1, "error: specify blocks are not allowed "
5630 # "in interfaces.");
5633 def p_module_item_list_1(p
):
5634 '''module_item_list : module_item_list module_item '''
5637 def p_module_item_list_2(p
):
5638 '''module_item_list : module_item '''
5641 def p_module_item_list_opt_1(p
):
5642 '''module_item_list_opt : module_item_list '''
5645 def p_module_item_list_opt_2(p
):
5646 '''module_item_list_opt : '''
5649 def p_generate_if_1(p
):
5650 '''generate_if : K_if '(' expression ')' '''
5652 # { pform_start_generate_if(@1, $3); }
5654 def p_generate_case_items_1(p
):
5655 '''generate_case_items : generate_case_items generate_case_item '''
5658 def p_generate_case_items_2(p
):
5659 '''generate_case_items : generate_case_item '''
5662 def p_generate_case_item_1(p
):
5663 '''generate_case_item : expression_list_proper ':' _embed0_generate_case_item generate_block_opt '''
5665 # { pform_endgenerate(); }
5667 def p_generate_case_item_2(p
):
5668 '''generate_case_item : K_default ':' _embed1_generate_case_item generate_block_opt '''
5670 # { pform_endgenerate(); }
5672 def p__embed0_generate_case_item(p
):
5673 '''_embed0_generate_case_item : '''
5674 # { pform_generate_case_item(@1, $1); }
5676 def p__embed1_generate_case_item(p
):
5677 '''_embed1_generate_case_item : '''
5678 # { pform_generate_case_item(@1, 0); }
5680 def p_generate_item_1(p
):
5681 '''generate_item : module_item '''
5684 def p_generate_item_2(p
):
5685 '''generate_item : K_begin generate_item_list_opt K_end '''
5687 # { /* Detect and warn about anachronistic begin/end use */
5688 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5690 # cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
5694 def p_generate_item_3(p
):
5695 '''generate_item : K_begin ':' IDENTIFIER _embed0_generate_item generate_item_list_opt K_end '''
5697 # { /* Detect and warn about anachronistic named begin/end use */
5698 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5700 # cerr << @1 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
5702 # pform_endgenerate();
5705 def p__embed0_generate_item(p
):
5706 '''_embed0_generate_item : '''
5708 # pform_start_generate_nblock(@1, $3);
5711 def p_generate_item_list_1(p
):
5712 '''generate_item_list : generate_item_list generate_item '''
5715 def p_generate_item_list_2(p
):
5716 '''generate_item_list : generate_item '''
5719 def p_generate_item_list_opt_1(p
):
5720 '''generate_item_list_opt : generate_item_list '''
5723 def p_generate_item_list_opt_2(p
):
5724 '''generate_item_list_opt : '''
5727 def p_generate_block_1(p
):
5728 '''generate_block : module_item '''
5731 def p_generate_block_2(p
):
5732 '''generate_block : K_begin generate_item_list_opt K_end '''
5735 def p_generate_block_3(p
):
5736 '''generate_block : K_begin ':' IDENTIFIER generate_item_list_opt K_end endlabel_opt '''
5738 # { pform_generate_block_name($3);
5740 # if (strcmp($3,$6) != 0) {
5741 # yyerror(@6, "error: End label doesn't match "
5744 # if (! gn_system_verilog()) {
5745 # yyerror(@6, "error: Begin end labels require "
5746 # "SystemVerilog.");
5753 def p_generate_block_opt_1(p
):
5754 '''generate_block_opt : generate_block '''
5757 def p_generate_block_opt_2(p
):
5758 '''generate_block_opt : ';' '''
5761 def p_net_decl_assign_1(p
):
5762 '''net_decl_assign : IDENTIFIER '=' expression '''
5764 # { net_decl_assign_t*tmp = new net_decl_assign_t;
5766 # tmp->name = lex_strings.make($1);
5772 def p_net_decl_assigns_1(p
):
5773 '''net_decl_assigns : net_decl_assigns ',' net_decl_assign '''
5775 # { net_decl_assign_t*tmp = $1;
5776 # $3->next = tmp->next;
5781 def p_net_decl_assigns_2(p
):
5782 '''net_decl_assigns : net_decl_assign '''
5787 def p_bit_logic_1(p
):
5788 '''bit_logic : K_logic '''
5790 # { $$ = IVL_VT_LOGIC; }
5792 def p_bit_logic_2(p
):
5793 '''bit_logic : K_bool '''
5795 # { $$ = IVL_VT_BOOL; /* Icarus misc */}
5797 def p_bit_logic_3(p
):
5798 '''bit_logic : K_bit '''
5800 # { $$ = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
5802 def p_bit_logic_opt_1(p
):
5803 '''bit_logic_opt : bit_logic '''
5806 def p_bit_logic_opt_2(p
):
5807 '''bit_logic_opt : '''
5809 # { $$ = IVL_VT_NO_TYPE; }
5811 def p_net_type_1(p
):
5812 '''net_type : K_wire '''
5814 # { $$ = NetNet::WIRE; }
5816 def p_net_type_2(p
):
5817 '''net_type : K_tri '''
5819 # { $$ = NetNet::TRI; }
5821 def p_net_type_3(p
):
5822 '''net_type : K_tri1 '''
5824 # { $$ = NetNet::TRI1; }
5826 def p_net_type_4(p
):
5827 '''net_type : K_supply0 '''
5829 # { $$ = NetNet::SUPPLY0; }
5831 def p_net_type_5(p
):
5832 '''net_type : K_wand '''
5834 # { $$ = NetNet::WAND; }
5836 def p_net_type_6(p
):
5837 '''net_type : K_triand '''
5839 # { $$ = NetNet::TRIAND; }
5841 def p_net_type_7(p
):
5842 '''net_type : K_tri0 '''
5844 # { $$ = NetNet::TRI0; }
5846 def p_net_type_8(p
):
5847 '''net_type : K_supply1 '''
5849 # { $$ = NetNet::SUPPLY1; }
5851 def p_net_type_9(p
):
5852 '''net_type : K_wor '''
5854 # { $$ = NetNet::WOR; }
5856 def p_net_type_10(p
):
5857 '''net_type : K_trior '''
5859 # { $$ = NetNet::TRIOR; }
5861 def p_net_type_11(p
):
5862 '''net_type : K_wone '''
5864 # { $$ = NetNet::UNRESOLVED_WIRE;
5865 # cerr << @1.text << ":" << @1.first_line << ": warning: "
5866 # "'wone' is deprecated, please use 'uwire' "
5867 # "instead." << endl;
5870 def p_net_type_12(p
):
5871 '''net_type : K_uwire '''
5873 # { $$ = NetNet::UNRESOLVED_WIRE; }
5875 def p_param_type_1(p
):
5876 '''param_type : bit_logic_opt unsigned_signed_opt dimensions_opt '''
5878 # { param_active_range = $3;
5879 # param_active_signed = $2;
5880 # if (($1 == IVL_VT_NO_TYPE) && ($3 != 0))
5881 # param_active_type = IVL_VT_LOGIC;
5883 # param_active_type = $1;
5886 def p_param_type_2(p
):
5887 '''param_type : K_integer '''
5889 # { param_active_range = make_range_from_width(integer_width);
5890 # param_active_signed = true;
5891 # param_active_type = IVL_VT_LOGIC;
5894 def p_param_type_3(p
):
5895 '''param_type : K_time '''
5897 # { param_active_range = make_range_from_width(64);
5898 # param_active_signed = false;
5899 # param_active_type = IVL_VT_LOGIC;
5902 def p_param_type_4(p
):
5903 '''param_type : real_or_realtime '''
5905 # { param_active_range = 0;
5906 # param_active_signed = true;
5907 # param_active_type = IVL_VT_REAL;
5910 def p_param_type_5(p
):
5911 '''param_type : atom2_type '''
5913 # { param_active_range = make_range_from_width($1);
5914 # param_active_signed = true;
5915 # param_active_type = IVL_VT_BOOL;
5918 def p_param_type_6(p
):
5919 '''param_type : TYPE_IDENTIFIER '''
5921 # { pform_set_param_from_type(@1, $1.type, $1.text, param_active_range,
5922 # param_active_signed, param_active_type);
5926 def p_parameter_assign_list_1(p
):
5927 '''parameter_assign_list : parameter_assign '''
5930 def p_parameter_assign_list_2(p
):
5931 '''parameter_assign_list : parameter_assign_list ',' parameter_assign '''
5934 def p_localparam_assign_list_1(p
):
5935 '''localparam_assign_list : localparam_assign '''
5938 def p_localparam_assign_list_2(p
):
5939 '''localparam_assign_list : localparam_assign_list ',' localparam_assign '''
5942 def p_parameter_assign_1(p
):
5943 '''parameter_assign : IDENTIFIER '=' expression parameter_value_ranges_opt '''
5946 # pform_set_parameter(@1, lex_strings.make($1), param_active_type,
5947 # param_active_signed, param_active_range, tmp, $4);
5951 def p_localparam_assign_1(p
):
5952 '''localparam_assign : IDENTIFIER '=' expression '''
5955 # pform_set_localparam(@1, lex_strings.make($1), param_active_type,
5956 # param_active_signed, param_active_range, tmp);
5960 def p_parameter_value_ranges_opt_1(p
):
5961 '''parameter_value_ranges_opt : parameter_value_ranges '''
5965 def p_parameter_value_ranges_opt_2(p
):
5966 '''parameter_value_ranges_opt : '''
5970 def p_parameter_value_ranges_1(p
):
5971 '''parameter_value_ranges : parameter_value_ranges parameter_value_range '''
5973 # { $$ = $2; $$->next = $1; }
5975 def p_parameter_value_ranges_2(p
):
5976 '''parameter_value_ranges : parameter_value_range '''
5978 # { $$ = $1; $$->next = 0; }
5980 def p_parameter_value_range_1(p
):
5981 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ']' '''
5983 # { $$ = pform_parameter_value_range($1, false, $3, false, $5); }
5985 def p_parameter_value_range_2(p
):
5986 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ')' '''
5988 # { $$ = pform_parameter_value_range($1, false, $3, true, $5); }
5990 def p_parameter_value_range_3(p
):
5991 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ']' '''
5993 # { $$ = pform_parameter_value_range($1, true, $3, false, $5); }
5995 def p_parameter_value_range_4(p
):
5996 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ')' '''
5998 # { $$ = pform_parameter_value_range($1, true, $3, true, $5); }
6000 def p_parameter_value_range_5(p
):
6001 '''parameter_value_range : K_exclude expression '''
6003 # { $$ = pform_parameter_value_range(true, false, $2, false, $2); }
6005 def p_value_range_expression_1(p
):
6006 '''value_range_expression : expression '''
6010 def p_value_range_expression_2(p
):
6011 '''value_range_expression : K_inf '''
6015 def p_value_range_expression_3(p
):
6016 '''value_range_expression : '+' K_inf '''
6020 def p_value_range_expression_4(p
):
6021 '''value_range_expression : '-' K_inf '''
6025 def p_from_exclude_1(p
):
6026 '''from_exclude : K_from '''
6030 def p_from_exclude_2(p
):
6031 '''from_exclude : K_exclude '''
6035 def p_parameter_value_opt_1(p
):
6036 '''parameter_value_opt : '#' '(' expression_list_with_nuls ')' '''
6038 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6039 # tmp->by_order = $3;
6044 def p_parameter_value_opt_2(p
):
6045 '''parameter_value_opt : '#' '(' parameter_value_byname_list ')' '''
6047 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6048 # tmp->by_order = 0;
6049 # tmp->by_name = $3;
6053 def p_parameter_value_opt_3(p
):
6054 '''parameter_value_opt : '#' DEC_NUMBER '''
6057 # PENumber*tmp = new PENumber($2);
6058 # FILE_NAME(tmp, @1);
6060 # struct parmvalue_t*lst = new struct parmvalue_t;
6061 # lst->by_order = new list<PExpr*>;
6062 # lst->by_order->push_back(tmp);
6068 def p_parameter_value_opt_4(p
):
6069 '''parameter_value_opt : '#' REALTIME '''
6072 # PEFNumber*tmp = new PEFNumber($2);
6073 # FILE_NAME(tmp, @1);
6075 # struct parmvalue_t*lst = new struct parmvalue_t;
6076 # lst->by_order = new list<PExpr*>;
6077 # lst->by_order->push_back(tmp);
6082 def p_parameter_value_opt_5(p
):
6083 '''parameter_value_opt : '#' error '''
6085 # { yyerror(@1, "error: syntax error in parameter value "
6086 # "assignment list.");
6090 def p_parameter_value_opt_6(p
):
6091 '''parameter_value_opt : '''
6095 def p_parameter_value_byname_1(p
):
6096 '''parameter_value_byname : '.' IDENTIFIER '(' expression ')' '''
6098 # { named_pexpr_t*tmp = new named_pexpr_t;
6099 # tmp->name = lex_strings.make($2);
6105 def p_parameter_value_byname_2(p
):
6106 '''parameter_value_byname : '.' IDENTIFIER '(' ')' '''
6108 # { named_pexpr_t*tmp = new named_pexpr_t;
6109 # tmp->name = lex_strings.make($2);
6115 def p_parameter_value_byname_list_1(p
):
6116 '''parameter_value_byname_list : parameter_value_byname '''
6118 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6119 # tmp->push_back(*$1);
6124 def p_parameter_value_byname_list_2(p
):
6125 '''parameter_value_byname_list : parameter_value_byname_list ',' parameter_value_byname '''
6127 # { list<named_pexpr_t>*tmp = $1;
6128 # tmp->push_back(*$3);
6134 '''port : port_reference '''
6139 '''port : '.' IDENTIFIER '(' port_reference ')' '''
6141 # { Module::port_t*tmp = $4;
6142 # tmp->name = lex_strings.make($2);
6148 '''port : '{' port_reference_list '}' '''
6150 # { Module::port_t*tmp = $2;
6151 # tmp->name = perm_string();
6156 '''port : '.' IDENTIFIER '(' '{' port_reference_list '}' ')' '''
6158 # { Module::port_t*tmp = $5;
6159 # tmp->name = lex_strings.make($2);
6164 def p_port_opt_1(p
):
6165 '''port_opt : port '''
6169 def p_port_opt_2(p
):
6174 def p_port_name_1(p
):
6175 '''port_name : '.' IDENTIFIER '(' expression ')' '''
6177 # { named_pexpr_t*tmp = new named_pexpr_t;
6178 # tmp->name = lex_strings.make($2);
6184 def p_port_name_2(p
):
6185 '''port_name : '.' IDENTIFIER '(' error ')' '''
6187 # { yyerror(@3, "error: invalid port connection expression.");
6188 # named_pexpr_t*tmp = new named_pexpr_t;
6189 # tmp->name = lex_strings.make($2);
6195 def p_port_name_3(p
):
6196 '''port_name : '.' IDENTIFIER '(' ')' '''
6198 # { named_pexpr_t*tmp = new named_pexpr_t;
6199 # tmp->name = lex_strings.make($2);
6205 def p_port_name_4(p
):
6206 '''port_name : '.' IDENTIFIER '''
6208 # { named_pexpr_t*tmp = new named_pexpr_t;
6209 # tmp->name = lex_strings.make($2);
6210 # tmp->parm = new PEIdent(lex_strings.make($2), true);
6211 # FILE_NAME(tmp->parm, @1);
6216 def p_port_name_5(p
):
6217 '''port_name : K_DOTSTAR '''
6219 # { named_pexpr_t*tmp = new named_pexpr_t;
6220 # tmp->name = lex_strings.make("*");
6225 def p_port_name_list_1(p
):
6226 '''port_name_list : port_name_list ',' port_name '''
6228 # { list<named_pexpr_t>*tmp = $1;
6229 # tmp->push_back(*$3);
6234 def p_port_name_list_2(p
):
6235 '''port_name_list : port_name '''
6237 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6238 # tmp->push_back(*$1);
6243 def p_port_reference_1(p
):
6244 '''port_reference : IDENTIFIER '''
6246 # { Module::port_t*ptmp;
6247 # perm_string name = lex_strings.make($1);
6248 # ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
6253 def p_port_reference_2(p
):
6254 '''port_reference : IDENTIFIER '[' expression ':' expression ']' '''
6256 # { index_component_t itmp;
6257 # itmp.sel = index_component_t::SEL_PART;
6261 # name_component_t ntmp (lex_strings.make($1));
6262 # ntmp.index.push_back(itmp);
6264 # pform_name_t pname;
6265 # pname.push_back(ntmp);
6267 # PEIdent*wtmp = new PEIdent(pname);
6268 # FILE_NAME(wtmp, @1);
6270 # Module::port_t*ptmp = new Module::port_t;
6271 # ptmp->name = perm_string();
6272 # ptmp->expr.push_back(wtmp);
6278 def p_port_reference_3(p
):
6279 '''port_reference : IDENTIFIER '[' expression ']' '''
6281 # { index_component_t itmp;
6282 # itmp.sel = index_component_t::SEL_BIT;
6286 # name_component_t ntmp (lex_strings.make($1));
6287 # ntmp.index.push_back(itmp);
6289 # pform_name_t pname;
6290 # pname.push_back(ntmp);
6292 # PEIdent*tmp = new PEIdent(pname);
6293 # FILE_NAME(tmp, @1);
6295 # Module::port_t*ptmp = new Module::port_t;
6296 # ptmp->name = perm_string();
6297 # ptmp->expr.push_back(tmp);
6302 def p_port_reference_4(p
):
6303 '''port_reference : IDENTIFIER '[' error ']' '''
6305 # { yyerror(@1, "error: invalid port bit select");
6306 # Module::port_t*ptmp = new Module::port_t;
6307 # PEIdent*wtmp = new PEIdent(lex_strings.make($1));
6308 # FILE_NAME(wtmp, @1);
6309 # ptmp->name = lex_strings.make($1);
6310 # ptmp->expr.push_back(wtmp);
6315 def p_port_reference_list_1(p
):
6316 '''port_reference_list : port_reference '''
6320 def p_port_reference_list_2(p
):
6321 '''port_reference_list : port_reference_list ',' port_reference '''
6323 # { Module::port_t*tmp = $1;
6324 # append(tmp->expr, $3->expr);
6329 def p_dimensions_opt_1(p
):
6330 '''dimensions_opt : '''
6334 def p_dimensions_opt_2(p
):
6335 '''dimensions_opt : dimensions '''
6339 def p_dimensions_1(p
):
6340 '''dimensions : variable_dimension '''
6344 def p_dimensions_2(p
):
6345 '''dimensions : dimensions variable_dimension '''
6347 # { list<pform_range_t> *tmp = $1;
6349 # tmp->splice(tmp->end(), *$2);
6355 def p_register_variable_1(p
):
6356 '''register_variable : IDENTIFIER dimensions_opt '''
6358 # { perm_string name = lex_strings.make($1);
6359 # pform_makewire(@1, name, NetNet::REG,
6360 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6361 # pform_set_reg_idx(name, $2);
6365 def p_register_variable_2(p
):
6366 '''register_variable : IDENTIFIER dimensions_opt '=' expression '''
6368 # { if (pform_peek_scope()->var_init_needs_explicit_lifetime()
6369 # && (var_lifetime == LexicalScope::INHERITED)) {
6370 # cerr << @3 << ": warning: Static variable initialization requires "
6371 # "explicit lifetime in this context." << endl;
6374 # perm_string name = lex_strings.make($1);
6375 # pform_makewire(@1, name, NetNet::REG,
6376 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6377 # pform_set_reg_idx(name, $2);
6378 # pform_make_var_init(@1, name, $4);
6382 def p_register_variable_list_1(p
):
6383 '''register_variable_list : register_variable '''
6385 # { list<perm_string>*tmp = new list<perm_string>;
6386 # tmp->push_back(lex_strings.make($1));
6391 def p_register_variable_list_2(p
):
6392 '''register_variable_list : register_variable_list ',' register_variable '''
6394 # { list<perm_string>*tmp = $1;
6395 # tmp->push_back(lex_strings.make($3));
6400 def p_net_variable_1(p
):
6401 '''net_variable : IDENTIFIER dimensions_opt '''
6403 # { perm_string name = lex_strings.make($1);
6404 # pform_makewire(@1, name, NetNet::IMPLICIT,
6405 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6406 # pform_set_reg_idx(name, $2);
6410 def p_net_variable_list_1(p
):
6411 '''net_variable_list : net_variable '''
6413 # { list<perm_string>*tmp = new list<perm_string>;
6414 # tmp->push_back(lex_strings.make($1));
6419 def p_net_variable_list_2(p
):
6420 '''net_variable_list : net_variable_list ',' net_variable '''
6422 # { list<perm_string>*tmp = $1;
6423 # tmp->push_back(lex_strings.make($3));
6428 def p_event_variable_1(p
):
6429 '''event_variable : IDENTIFIER dimensions_opt '''
6432 # yyerror(@2, "sorry: event arrays are not supported.");
6438 def p_event_variable_list_1(p
):
6439 '''event_variable_list : event_variable '''
6441 # { $$ = list_from_identifier($1); }
6443 def p_event_variable_list_2(p
):
6444 '''event_variable_list : event_variable_list ',' event_variable '''
6446 # { $$ = list_from_identifier($1, $3); }
6448 def p_specify_item_1(p
):
6449 '''specify_item : K_specparam specparam_decl ';' '''
6452 def p_specify_item_2(p
):
6453 '''specify_item : specify_simple_path_decl ';' '''
6455 # { pform_module_specify_path($1);
6458 def p_specify_item_3(p
):
6459 '''specify_item : specify_edge_path_decl ';' '''
6461 # { pform_module_specify_path($1);
6464 def p_specify_item_4(p
):
6465 '''specify_item : K_if '(' expression ')' specify_simple_path_decl ';' '''
6467 # { PSpecPath*tmp = $5;
6469 # tmp->conditional = true;
6470 # tmp->condition = $3;
6472 # pform_module_specify_path(tmp);
6475 def p_specify_item_5(p
):
6476 '''specify_item : K_if '(' expression ')' specify_edge_path_decl ';' '''
6478 # { PSpecPath*tmp = $5;
6480 # tmp->conditional = true;
6481 # tmp->condition = $3;
6483 # pform_module_specify_path(tmp);
6486 def p_specify_item_6(p
):
6487 '''specify_item : K_ifnone specify_simple_path_decl ';' '''
6489 # { PSpecPath*tmp = $2;
6491 # tmp->conditional = true;
6492 # tmp->condition = 0;
6494 # pform_module_specify_path(tmp);
6497 def p_specify_item_7(p
):
6498 '''specify_item : K_ifnone specify_edge_path_decl ';' '''
6500 # { yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
6501 # "not supported.");
6505 def p_specify_item_8(p
):
6506 '''specify_item : K_Sfullskew '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6512 def p_specify_item_9(p
):
6513 '''specify_item : K_Shold '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6518 def p_specify_item_10(p
):
6519 '''specify_item : K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6525 def p_specify_item_11(p
):
6526 '''specify_item : K_Speriod '(' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6531 def p_specify_item_12(p
):
6532 '''specify_item : K_Srecovery '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6537 def p_specify_item_13(p
):
6538 '''specify_item : K_Srecrem '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6544 def p_specify_item_14(p
):
6545 '''specify_item : K_Sremoval '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6550 def p_specify_item_15(p
):
6551 '''specify_item : K_Ssetup '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6556 def p_specify_item_16(p
):
6557 '''specify_item : K_Ssetuphold '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6563 def p_specify_item_17(p
):
6564 '''specify_item : K_Sskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6569 def p_specify_item_18(p
):
6570 '''specify_item : K_Stimeskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6575 def p_specify_item_19(p
):
6576 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ',' expression spec_notifier_opt ')' ';' '''
6582 def p_specify_item_20(p
):
6583 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ')' ';' '''
6588 def p_specify_item_21(p
):
6589 '''specify_item : K_pulsestyle_onevent specify_path_identifiers ';' '''
6594 def p_specify_item_22(p
):
6595 '''specify_item : K_pulsestyle_ondetect specify_path_identifiers ';' '''
6600 def p_specify_item_23(p
):
6601 '''specify_item : K_showcancelled specify_path_identifiers ';' '''
6606 def p_specify_item_24(p
):
6607 '''specify_item : K_noshowcancelled specify_path_identifiers ';' '''
6612 def p_specify_item_list_1(p
):
6613 '''specify_item_list : specify_item '''
6616 def p_specify_item_list_2(p
):
6617 '''specify_item_list : specify_item_list specify_item '''
6620 def p_specify_item_list_opt_1(p
):
6621 '''specify_item_list_opt : '''
6625 def p_specify_item_list_opt_2(p
):
6626 '''specify_item_list_opt : specify_item_list '''
6630 def p_specify_edge_path_decl_1(p
):
6631 '''specify_edge_path_decl : specify_edge_path '=' '(' delay_value_list ')' '''
6633 # { $$ = pform_assign_path_delay($1, $4); }
6635 def p_specify_edge_path_decl_2(p
):
6636 '''specify_edge_path_decl : specify_edge_path '=' delay_value_simple '''
6638 # { list<PExpr*>*tmp = new list<PExpr*>;
6639 # tmp->push_back($3);
6640 # $$ = pform_assign_path_delay($1, tmp);
6643 def p_edge_operator_1(p
):
6644 '''edge_operator : K_posedge '''
6648 def p_edge_operator_2(p
):
6649 '''edge_operator : K_negedge '''
6653 def p_specify_edge_path_1(p
):
6654 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6656 # { int edge_flag = 0;
6657 # $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, false, $6, $8); }
6659 def p_specify_edge_path_2(p
):
6660 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6662 # { int edge_flag = $2? 1 : -1;
6663 # $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, false, $7, $9);}
6665 def p_specify_edge_path_3(p
):
6666 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6668 # { int edge_flag = 0;
6669 # $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, true, $6, $8); }
6671 def p_specify_edge_path_4(p
):
6672 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6674 # { int edge_flag = $2? 1 : -1;
6675 # $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, true, $7, $9); }
6677 def p_polarity_operator_1(p
):
6678 '''polarity_operator : K_PO_POS '''
6681 def p_polarity_operator_2(p
):
6682 '''polarity_operator : K_PO_NEG '''
6685 def p_polarity_operator_3(p
):
6686 '''polarity_operator : ':' '''
6689 def p_specify_simple_path_decl_1(p
):
6690 '''specify_simple_path_decl : specify_simple_path '=' '(' delay_value_list ')' '''
6692 # { $$ = pform_assign_path_delay($1, $4); }
6694 def p_specify_simple_path_decl_2(p
):
6695 '''specify_simple_path_decl : specify_simple_path '=' delay_value_simple '''
6697 # { list<PExpr*>*tmp = new list<PExpr*>;
6698 # tmp->push_back($3);
6699 # $$ = pform_assign_path_delay($1, tmp);
6702 def p_specify_simple_path_decl_3(p
):
6703 '''specify_simple_path_decl : specify_simple_path '=' '(' error ')' '''
6705 # { yyerror(@3, "Syntax error in delay value list.");
6710 def p_specify_simple_path_1(p
):
6711 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' '''
6713 # { $$ = pform_make_specify_path(@1, $2, $3, false, $5); }
6715 def p_specify_simple_path_2(p
):
6716 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' '''
6718 # { $$ = pform_make_specify_path(@1, $2, $3, true, $5); }
6720 def p_specify_simple_path_3(p
):
6721 '''specify_simple_path : '(' error ')' '''
6723 # { yyerror(@1, "Invalid simple path");
6727 def p_specify_path_identifiers_1(p
):
6728 '''specify_path_identifiers : IDENTIFIER '''
6730 # { list<perm_string>*tmp = new list<perm_string>;
6731 # tmp->push_back(lex_strings.make($1));
6736 def p_specify_path_identifiers_2(p
):
6737 '''specify_path_identifiers : IDENTIFIER '[' expr_primary ']' '''
6739 # { if (gn_specify_blocks_flag) {
6740 # yywarn(@4, "Bit selects are not currently supported "
6741 # "in path declarations. The declaration "
6742 # "will be applied to the whole vector.");
6744 # list<perm_string>*tmp = new list<perm_string>;
6745 # tmp->push_back(lex_strings.make($1));
6750 def p_specify_path_identifiers_3(p
):
6751 '''specify_path_identifiers : IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6753 # { if (gn_specify_blocks_flag) {
6754 # yywarn(@4, "Part selects are not currently supported "
6755 # "in path declarations. The declaration "
6756 # "will be applied to the whole vector.");
6758 # list<perm_string>*tmp = new list<perm_string>;
6759 # tmp->push_back(lex_strings.make($1));
6764 def p_specify_path_identifiers_4(p
):
6765 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '''
6767 # { list<perm_string>*tmp = $1;
6768 # tmp->push_back(lex_strings.make($3));
6773 def p_specify_path_identifiers_5(p
):
6774 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' '''
6776 # { if (gn_specify_blocks_flag) {
6777 # yywarn(@4, "Bit selects are not currently supported "
6778 # "in path declarations. The declaration "
6779 # "will be applied to the whole vector.");
6781 # list<perm_string>*tmp = $1;
6782 # tmp->push_back(lex_strings.make($3));
6787 def p_specify_path_identifiers_6(p
):
6788 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6790 # { if (gn_specify_blocks_flag) {
6791 # yywarn(@4, "Part selects are not currently supported "
6792 # "in path declarations. The declaration "
6793 # "will be applied to the whole vector.");
6795 # list<perm_string>*tmp = $1;
6796 # tmp->push_back(lex_strings.make($3));
6801 def p_specparam_1(p
):
6802 '''specparam : IDENTIFIER '=' expression '''
6805 # pform_set_specparam(@1, lex_strings.make($1),
6806 # param_active_range, tmp);
6810 def p_specparam_2(p
):
6811 '''specparam : IDENTIFIER '=' expression ':' expression ':' expression '''
6814 # switch (min_typ_max_flag) {
6831 # if (min_typ_max_warn > 0) {
6832 # cerr << tmp->get_fileline() << ": warning: choosing ";
6833 # switch (min_typ_max_flag) {
6844 # cerr << " expression." << endl;
6845 # min_typ_max_warn -= 1;
6847 # pform_set_specparam(@1, lex_strings.make($1),
6848 # param_active_range, tmp);
6852 def p_specparam_3(p
):
6853 '''specparam : PATHPULSE_IDENTIFIER '=' expression '''
6859 def p_specparam_4(p
):
6860 '''specparam : PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' '''
6867 def p_specparam_list_1(p
):
6868 '''specparam_list : specparam '''
6871 def p_specparam_list_2(p
):
6872 '''specparam_list : specparam_list ',' specparam '''
6875 def p_specparam_decl_1(p
):
6876 '''specparam_decl : specparam_list '''
6879 def p_specparam_decl_2(p
):
6880 '''specparam_decl : dimensions _embed0_specparam_decl specparam_list '''
6882 # { param_active_range = 0; }
6884 def p__embed0_specparam_decl(p
):
6885 '''_embed0_specparam_decl : '''
6886 # { param_active_range = $1; }
6888 def p_spec_polarity_1(p
):
6889 '''spec_polarity : '+' '''
6893 def p_spec_polarity_2(p
):
6894 '''spec_polarity : '-' '''
6898 def p_spec_polarity_3(p
):
6899 '''spec_polarity : '''
6903 def p_spec_reference_event_1(p
):
6904 '''spec_reference_event : K_posedge expression '''
6908 def p_spec_reference_event_2(p
):
6909 '''spec_reference_event : K_negedge expression '''
6913 def p_spec_reference_event_3(p
):
6914 '''spec_reference_event : K_posedge expr_primary K_TAND expression '''
6920 def p_spec_reference_event_4(p
):
6921 '''spec_reference_event : K_negedge expr_primary K_TAND expression '''
6927 def p_spec_reference_event_5(p
):
6928 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary '''
6932 def p_spec_reference_event_6(p
):
6933 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression '''
6939 def p_spec_reference_event_7(p
):
6940 '''spec_reference_event : expr_primary K_TAND expression '''
6946 def p_spec_reference_event_8(p
):
6947 '''spec_reference_event : expr_primary '''
6951 def p_edge_descriptor_list_1(p
):
6952 '''edge_descriptor_list : edge_descriptor_list ',' K_edge_descriptor '''
6955 def p_edge_descriptor_list_2(p
):
6956 '''edge_descriptor_list : K_edge_descriptor '''
6959 def p_spec_notifier_opt_1(p
):
6960 '''spec_notifier_opt : '''
6964 def p_spec_notifier_opt_2(p
):
6965 '''spec_notifier_opt : spec_notifier '''
6969 def p_spec_notifier_1(p
):
6970 '''spec_notifier : ',' '''
6972 # { args_after_notifier = 0; }
6974 def p_spec_notifier_2(p
):
6975 '''spec_notifier : ',' hierarchy_identifier '''
6977 # { args_after_notifier = 0; delete $2; }
6979 def p_spec_notifier_3(p
):
6980 '''spec_notifier : spec_notifier ',' '''
6982 # { args_after_notifier += 1; }
6984 def p_spec_notifier_4(p
):
6985 '''spec_notifier : spec_notifier ',' hierarchy_identifier '''
6987 # { args_after_notifier += 1;
6988 # if (args_after_notifier >= 3) {
6989 # cerr << @3 << ": warning: timing checks are not supported "
6990 # "and delayed signal \"" << *$3
6991 # << "\" will not be driven." << endl;
6995 def p_spec_notifier_5(p
):
6996 '''spec_notifier : IDENTIFIER '''
6998 # { args_after_notifier = 0; delete[]$1; }
7000 def p_statement_item_1(p
):
7001 '''statement_item : K_assign lpvalue '=' expression ';' '''
7003 # { PCAssign*tmp = new PCAssign($2, $4);
7004 # FILE_NAME(tmp, @1);
7008 def p_statement_item_2(p
):
7009 '''statement_item : K_deassign lpvalue ';' '''
7011 # { PDeassign*tmp = new PDeassign($2);
7012 # FILE_NAME(tmp, @1);
7016 def p_statement_item_3(p
):
7017 '''statement_item : K_force lpvalue '=' expression ';' '''
7019 # { PForce*tmp = new PForce($2, $4);
7020 # FILE_NAME(tmp, @1);
7024 def p_statement_item_4(p
):
7025 '''statement_item : K_release lpvalue ';' '''
7027 # { PRelease*tmp = new PRelease($2);
7028 # FILE_NAME(tmp, @1);
7032 def p_statement_item_5(p
):
7033 '''statement_item : K_begin K_end '''
7035 # { PBlock*tmp = new PBlock(PBlock::BL_SEQ);
7036 # FILE_NAME(tmp, @1);
7040 def p_statement_item_6(p
):
7041 '''statement_item : K_begin _embed0_statement_item block_item_decls_opt _embed1_statement_item statement_or_null_list K_end '''
7045 # pform_pop_scope();
7046 # assert(! current_block_stack.empty());
7047 # tmp = current_block_stack.top();
7048 # current_block_stack.pop();
7050 # tmp = new PBlock(PBlock::BL_SEQ);
7051 # FILE_NAME(tmp, @1);
7053 # if ($5) tmp->set_statement(*$5);
7058 def p_statement_item_7(p
):
7059 '''statement_item : K_begin ':' IDENTIFIER _embed2_statement_item block_item_decls_opt statement_or_null_list_opt K_end endlabel_opt '''
7061 # { pform_pop_scope();
7062 # assert(! current_block_stack.empty());
7063 # PBlock*tmp = current_block_stack.top();
7064 # current_block_stack.pop();
7065 # if ($6) tmp->set_statement(*$6);
7068 # if (strcmp($3,$8) != 0) {
7069 # yyerror(@8, "error: End label doesn't match begin name");
7071 # if (! gn_system_verilog()) {
7072 # yyerror(@8, "error: Begin end labels require "
7073 # "SystemVerilog.");
7081 def p_statement_item_8(p
):
7082 '''statement_item : K_fork join_keyword '''
7084 # { PBlock*tmp = new PBlock($2);
7085 # FILE_NAME(tmp, @1);
7089 def p_statement_item_9(p
):
7090 '''statement_item : K_fork _embed3_statement_item block_item_decls_opt _embed4_statement_item statement_or_null_list join_keyword '''
7094 # pform_pop_scope();
7095 # assert(! current_block_stack.empty());
7096 # tmp = current_block_stack.top();
7097 # current_block_stack.pop();
7098 # tmp->set_join_type($6);
7100 # tmp = new PBlock($6);
7101 # FILE_NAME(tmp, @1);
7103 # if ($5) tmp->set_statement(*$5);
7108 def p_statement_item_10(p
):
7109 '''statement_item : K_fork ':' IDENTIFIER _embed5_statement_item block_item_decls_opt statement_or_null_list_opt join_keyword endlabel_opt '''
7111 # { pform_pop_scope();
7112 # assert(! current_block_stack.empty());
7113 # PBlock*tmp = current_block_stack.top();
7114 # current_block_stack.pop();
7115 # tmp->set_join_type($7);
7116 # if ($6) tmp->set_statement(*$6);
7119 # if (strcmp($3,$8) != 0) {
7120 # yyerror(@8, "error: End label doesn't match fork name");
7122 # if (! gn_system_verilog()) {
7123 # yyerror(@8, "error: Fork end labels require "
7124 # "SystemVerilog.");
7132 def p_statement_item_11(p
):
7133 '''statement_item : K_disable hierarchy_identifier ';' '''
7135 # { PDisable*tmp = new PDisable(*$2);
7136 # FILE_NAME(tmp, @1);
7141 def p_statement_item_12(p
):
7142 '''statement_item : K_disable K_fork ';' '''
7144 # { pform_name_t tmp_name;
7145 # PDisable*tmp = new PDisable(tmp_name);
7146 # FILE_NAME(tmp, @1);
7150 def p_statement_item_13(p
):
7151 '''statement_item : K_TRIGGER hierarchy_identifier ';' '''
7153 # { PTrigger*tmp = new PTrigger(*$2);
7154 # FILE_NAME(tmp, @1);
7159 def p_statement_item_14(p
):
7160 '''statement_item : procedural_assertion_statement '''
7164 def p_statement_item_15(p
):
7165 '''statement_item : loop_statement '''
7169 def p_statement_item_16(p
):
7170 '''statement_item : jump_statement '''
7174 def p_statement_item_17(p
):
7175 '''statement_item : K_case '(' expression ')' case_items K_endcase '''
7177 # { PCase*tmp = new PCase(NetCase::EQ, $3, $5);
7178 # FILE_NAME(tmp, @1);
7182 def p_statement_item_18(p
):
7183 '''statement_item : K_casex '(' expression ')' case_items K_endcase '''
7185 # { PCase*tmp = new PCase(NetCase::EQX, $3, $5);
7186 # FILE_NAME(tmp, @1);
7190 def p_statement_item_19(p
):
7191 '''statement_item : K_casez '(' expression ')' case_items K_endcase '''
7193 # { PCase*tmp = new PCase(NetCase::EQZ, $3, $5);
7194 # FILE_NAME(tmp, @1);
7198 def p_statement_item_20(p
):
7199 '''statement_item : K_case '(' expression ')' error K_endcase '''
7203 def p_statement_item_21(p
):
7204 '''statement_item : K_casex '(' expression ')' error K_endcase '''
7208 def p_statement_item_22(p
):
7209 '''statement_item : K_casez '(' expression ')' error K_endcase '''
7213 def p_statement_item_23(p
):
7214 '''statement_item : K_if '(' expression ')' statement_or_null %prec less_than_K_else '''
7216 # { PCondit*tmp = new PCondit($3, $5, 0);
7217 # FILE_NAME(tmp, @1);
7221 def p_statement_item_24(p
):
7222 '''statement_item : K_if '(' expression ')' statement_or_null K_else statement_or_null '''
7224 # { PCondit*tmp = new PCondit($3, $5, $7);
7225 # FILE_NAME(tmp, @1);
7229 def p_statement_item_25(p
):
7230 '''statement_item : K_if '(' error ')' statement_or_null %prec less_than_K_else '''
7232 # { yyerror(@1, "error: Malformed conditional expression.");
7236 def p_statement_item_26(p
):
7237 '''statement_item : K_if '(' error ')' statement_or_null K_else statement_or_null '''
7239 # { yyerror(@1, "error: Malformed conditional expression.");
7243 def p_statement_item_27(p
):
7244 '''statement_item : compressed_statement ';' '''
7248 def p_statement_item_28(p
):
7249 '''statement_item : inc_or_dec_expression ';' '''
7251 # { $$ = pform_compressed_assign_from_inc_dec(@1, $1); }
7253 def p_statement_item_29(p
):
7254 '''statement_item : delay1 statement_or_null '''
7256 # { PExpr*del = $1->front();
7257 # assert($1->size() == 1);
7259 # PDelayStatement*tmp = new PDelayStatement(del, $2);
7260 # FILE_NAME(tmp, @1);
7264 def p_statement_item_30(p
):
7265 '''statement_item : event_control statement_or_null '''
7267 # { PEventStatement*tmp = $1;
7269 # yyerror(@1, "error: Invalid event control.");
7272 # tmp->set_statement($2);
7277 def p_statement_item_31(p
):
7278 '''statement_item : '@' '*' statement_or_null '''
7280 # { PEventStatement*tmp = new PEventStatement;
7281 # FILE_NAME(tmp, @1);
7282 # tmp->set_statement($3);
7286 def p_statement_item_32(p
):
7287 '''statement_item : '@' '(' '*' ')' statement_or_null '''
7289 # { PEventStatement*tmp = new PEventStatement;
7290 # FILE_NAME(tmp, @1);
7291 # tmp->set_statement($5);
7295 def p_statement_item_33(p
):
7296 '''statement_item : lpvalue '=' expression ';' '''
7298 # { PAssign*tmp = new PAssign($1,$3);
7299 # FILE_NAME(tmp, @1);
7303 def p_statement_item_34(p
):
7304 '''statement_item : error '=' expression ';' '''
7306 # { yyerror(@2, "Syntax in assignment statement l-value.");
7311 def p_statement_item_35(p
):
7312 '''statement_item : lpvalue K_LE expression ';' '''
7314 # { PAssignNB*tmp = new PAssignNB($1,$3);
7315 # FILE_NAME(tmp, @1);
7319 def p_statement_item_36(p
):
7320 '''statement_item : error K_LE expression ';' '''
7322 # { yyerror(@2, "Syntax in assignment statement l-value.");
7327 def p_statement_item_37(p
):
7328 '''statement_item : lpvalue '=' delay1 expression ';' '''
7330 # { PExpr*del = $3->front(); $3->pop_front();
7331 # assert($3->empty());
7332 # PAssign*tmp = new PAssign($1,del,$4);
7333 # FILE_NAME(tmp, @1);
7337 def p_statement_item_38(p
):
7338 '''statement_item : lpvalue K_LE delay1 expression ';' '''
7340 # { PExpr*del = $3->front(); $3->pop_front();
7341 # assert($3->empty());
7342 # PAssignNB*tmp = new PAssignNB($1,del,$4);
7343 # FILE_NAME(tmp, @1);
7347 def p_statement_item_39(p
):
7348 '''statement_item : lpvalue '=' event_control expression ';' '''
7350 # { PAssign*tmp = new PAssign($1,0,$3,$4);
7351 # FILE_NAME(tmp, @1);
7355 def p_statement_item_40(p
):
7356 '''statement_item : lpvalue '=' K_repeat '(' expression ')' event_control expression ';' '''
7358 # { PAssign*tmp = new PAssign($1,$5,$7,$8);
7359 # FILE_NAME(tmp,@1);
7360 # tmp->set_lineno(@1.first_line);
7364 def p_statement_item_41(p
):
7365 '''statement_item : lpvalue K_LE event_control expression ';' '''
7367 # { PAssignNB*tmp = new PAssignNB($1,0,$3,$4);
7368 # FILE_NAME(tmp, @1);
7372 def p_statement_item_42(p
):
7373 '''statement_item : lpvalue K_LE K_repeat '(' expression ')' event_control expression ';' '''
7375 # { PAssignNB*tmp = new PAssignNB($1,$5,$7,$8);
7376 # FILE_NAME(tmp, @1);
7380 def p_statement_item_43(p
):
7381 '''statement_item : lpvalue '=' dynamic_array_new ';' '''
7383 # { PAssign*tmp = new PAssign($1,$3);
7384 # FILE_NAME(tmp, @1);
7388 def p_statement_item_44(p
):
7389 '''statement_item : lpvalue '=' class_new ';' '''
7391 # { PAssign*tmp = new PAssign($1,$3);
7392 # FILE_NAME(tmp, @1);
7396 def p_statement_item_45(p
):
7397 '''statement_item : K_wait '(' expression ')' statement_or_null '''
7399 # { PEventStatement*tmp;
7400 # PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, $3);
7401 # tmp = new PEventStatement(etmp);
7402 # FILE_NAME(tmp,@1);
7403 # tmp->set_statement($5);
7407 def p_statement_item_46(p
):
7408 '''statement_item : K_wait K_fork ';' '''
7410 # { PEventStatement*tmp = new PEventStatement((PEEvent*)0);
7411 # FILE_NAME(tmp,@1);
7415 def p_statement_item_47(p
):
7416 '''statement_item : SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';' '''
7418 # { PCallTask*tmp = new PCallTask(lex_strings.make($1), *$3);
7419 # FILE_NAME(tmp,@1);
7425 def p_statement_item_48(p
):
7426 '''statement_item : SYSTEM_IDENTIFIER ';' '''
7429 # PCallTask*tmp = new PCallTask(lex_strings.make($1), pt);
7430 # FILE_NAME(tmp,@1);
7435 def p_statement_item_49(p
):
7436 '''statement_item : hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7438 # { PCallTask*tmp = pform_make_call_task(@1, *$1, *$3);
7444 def p_statement_item_50(p
):
7445 '''statement_item : hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';' '''
7447 # { /* ....randomize with { <constraints> } */
7448 # if ($1 && peek_tail_name(*$1) == "randomize") {
7449 # if (!gn_system_verilog())
7450 # yyerror(@2, "error: Randomize with constraint requires SystemVerilog.");
7452 # yyerror(@2, "sorry: Randomize with constraint not supported.");
7454 # yyerror(@2, "error: Constraint block can only be applied to randomize method.");
7457 # PCallTask*tmp = new PCallTask(*$1, pt);
7458 # FILE_NAME(tmp, @1);
7463 def p_statement_item_51(p
):
7464 '''statement_item : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7466 # { pform_name_t*t_name = $1;
7467 # while (! $3->empty()) {
7468 # t_name->push_back($3->front());
7471 # PCallTask*tmp = new PCallTask(*t_name, *$5);
7472 # FILE_NAME(tmp, @1);
7479 def p_statement_item_52(p
):
7480 '''statement_item : hierarchy_identifier ';' '''
7483 # PCallTask*tmp = pform_make_call_task(@1, *$1, pt);
7488 def p_statement_item_53(p
):
7489 '''statement_item : implicit_class_handle '.' K_new '(' expression_list_with_nuls ')' ';' '''
7491 # { PChainConstructor*tmp = new PChainConstructor(*$5);
7492 # FILE_NAME(tmp, @3);
7497 def p_statement_item_54(p
):
7498 '''statement_item : hierarchy_identifier '(' error ')' ';' '''
7500 # { yyerror(@3, "error: Syntax error in task arguments.");
7502 # PCallTask*tmp = pform_make_call_task(@1, *$1, pt);
7507 def p_statement_item_55(p
):
7508 '''statement_item : error ';' '''
7510 # { yyerror(@2, "error: malformed statement");
7515 def p__embed0_statement_item(p
):
7516 '''_embed0_statement_item : '''
7517 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_SEQ);
7518 # FILE_NAME(tmp, @1);
7519 # current_block_stack.push(tmp);
7522 def p__embed1_statement_item(p
):
7523 '''_embed1_statement_item : '''
7525 # if (! gn_system_verilog()) {
7526 # yyerror("error: Variable declaration in unnamed block "
7527 # "requires SystemVerilog.");
7530 # /* If there are no declarations in the scope then just delete it. */
7531 # pform_pop_scope();
7532 # assert(! current_block_stack.empty());
7533 # PBlock*tmp = current_block_stack.top();
7534 # current_block_stack.pop();
7539 def p__embed2_statement_item(p
):
7540 '''_embed2_statement_item : '''
7541 # { PBlock*tmp = pform_push_block_scope($3, PBlock::BL_SEQ);
7542 # FILE_NAME(tmp, @1);
7543 # current_block_stack.push(tmp);
7546 def p__embed3_statement_item(p
):
7547 '''_embed3_statement_item : '''
7548 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
7549 # FILE_NAME(tmp, @1);
7550 # current_block_stack.push(tmp);
7553 def p__embed4_statement_item(p
):
7554 '''_embed4_statement_item : '''
7556 # if (! gn_system_verilog()) {
7557 # yyerror("error: Variable declaration in unnamed block "
7558 # "requires SystemVerilog.");
7561 # /* If there are no declarations in the scope then just delete it. */
7562 # pform_pop_scope();
7563 # assert(! current_block_stack.empty());
7564 # PBlock*tmp = current_block_stack.top();
7565 # current_block_stack.pop();
7570 def p__embed5_statement_item(p
):
7571 '''_embed5_statement_item : '''
7572 # { PBlock*tmp = pform_push_block_scope($3, PBlock::BL_PAR);
7573 # FILE_NAME(tmp, @1);
7574 # current_block_stack.push(tmp);
7577 def p_compressed_statement_1(p
):
7578 '''compressed_statement : lpvalue K_PLUS_EQ expression '''
7580 # { PAssign*tmp = new PAssign($1, '+', $3);
7581 # FILE_NAME(tmp, @1);
7585 def p_compressed_statement_2(p
):
7586 '''compressed_statement : lpvalue K_MINUS_EQ expression '''
7588 # { PAssign*tmp = new PAssign($1, '-', $3);
7589 # FILE_NAME(tmp, @1);
7593 def p_compressed_statement_3(p
):
7594 '''compressed_statement : lpvalue K_MUL_EQ expression '''
7596 # { PAssign*tmp = new PAssign($1, '*', $3);
7597 # FILE_NAME(tmp, @1);
7601 def p_compressed_statement_4(p
):
7602 '''compressed_statement : lpvalue K_DIV_EQ expression '''
7604 # { PAssign*tmp = new PAssign($1, '/', $3);
7605 # FILE_NAME(tmp, @1);
7609 def p_compressed_statement_5(p
):
7610 '''compressed_statement : lpvalue K_MOD_EQ expression '''
7612 # { PAssign*tmp = new PAssign($1, '%', $3);
7613 # FILE_NAME(tmp, @1);
7617 def p_compressed_statement_6(p
):
7618 '''compressed_statement : lpvalue K_AND_EQ expression '''
7620 # { PAssign*tmp = new PAssign($1, '&', $3);
7621 # FILE_NAME(tmp, @1);
7625 def p_compressed_statement_7(p
):
7626 '''compressed_statement : lpvalue K_OR_EQ expression '''
7628 # { PAssign*tmp = new PAssign($1, '|', $3);
7629 # FILE_NAME(tmp, @1);
7633 def p_compressed_statement_8(p
):
7634 '''compressed_statement : lpvalue K_XOR_EQ expression '''
7636 # { PAssign*tmp = new PAssign($1, '^', $3);
7637 # FILE_NAME(tmp, @1);
7641 def p_compressed_statement_9(p
):
7642 '''compressed_statement : lpvalue K_LS_EQ expression '''
7644 # { PAssign *tmp = new PAssign($1, 'l', $3);
7645 # FILE_NAME(tmp, @1);
7649 def p_compressed_statement_10(p
):
7650 '''compressed_statement : lpvalue K_RS_EQ expression '''
7652 # { PAssign*tmp = new PAssign($1, 'r', $3);
7653 # FILE_NAME(tmp, @1);
7657 def p_compressed_statement_11(p
):
7658 '''compressed_statement : lpvalue K_RSS_EQ expression '''
7660 # { PAssign *tmp = new PAssign($1, 'R', $3);
7661 # FILE_NAME(tmp, @1);
7665 def p_statement_or_null_list_opt_1(p
):
7666 '''statement_or_null_list_opt : statement_or_null_list '''
7670 def p_statement_or_null_list_opt_2(p
):
7671 '''statement_or_null_list_opt : '''
7675 def p_statement_or_null_list_1(p
):
7676 '''statement_or_null_list : statement_or_null_list statement_or_null '''
7678 # { vector<Statement*>*tmp = $1;
7679 # if ($2) tmp->push_back($2);
7683 def p_statement_or_null_list_2(p
):
7684 '''statement_or_null_list : statement_or_null '''
7686 # { vector<Statement*>*tmp = new vector<Statement*>(0);
7687 # if ($1) tmp->push_back($1);
7691 def p_analog_statement_1(p
):
7692 '''analog_statement : branch_probe_expression K_CONTRIBUTE expression ';' '''
7694 # { $$ = pform_contribution_statement(@2, $1, $3); }
7696 def p_task_item_1(p
):
7697 '''task_item : block_item_decl '''
7699 # { $$ = new vector<pform_tf_port_t>(0); }
7701 def p_task_item_2(p
):
7702 '''task_item : tf_port_declaration '''
7706 def p_task_item_list_1(p
):
7707 '''task_item_list : task_item_list task_item '''
7709 # { vector<pform_tf_port_t>*tmp = $1;
7710 # size_t s1 = tmp->size();
7711 # tmp->resize(s1 + $2->size());
7712 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
7713 # tmp->at(s1 + idx) = $2->at(idx);
7718 def p_task_item_list_2(p
):
7719 '''task_item_list : task_item '''
7723 def p_task_item_list_opt_1(p
):
7724 '''task_item_list_opt : task_item_list '''
7728 def p_task_item_list_opt_2(p
):
7729 '''task_item_list_opt : '''
7733 def p_tf_port_list_opt_1(p
):
7734 '''tf_port_list_opt : tf_port_list '''
7738 def p_tf_port_list_opt_2(p
):
7739 '''tf_port_list_opt : '''
7743 def p_udp_body_1(p
):
7744 '''udp_body : K_table udp_entry_list K_endtable '''
7746 # { lex_end_table();
7750 def p_udp_body_2(p
):
7751 '''udp_body : K_table K_endtable '''
7753 # { lex_end_table();
7754 # yyerror(@1, "error: Empty UDP table.");
7758 def p_udp_body_3(p
):
7759 '''udp_body : K_table error K_endtable '''
7761 # { lex_end_table();
7762 # yyerror(@2, "Errors in UDP table");
7767 def p_udp_entry_list_1(p
):
7768 '''udp_entry_list : udp_comb_entry_list '''
7771 def p_udp_entry_list_2(p
):
7772 '''udp_entry_list : udp_sequ_entry_list '''
7775 def p_udp_comb_entry_1(p
):
7776 '''udp_comb_entry : udp_input_list ':' udp_output_sym ';' '''
7778 # { char*tmp = new char[strlen($1)+3];
7780 # char*tp = tmp+strlen(tmp);
7788 def p_udp_comb_entry_list_1(p
):
7789 '''udp_comb_entry_list : udp_comb_entry '''
7791 # { list<string>*tmp = new list<string>;
7792 # tmp->push_back($1);
7797 def p_udp_comb_entry_list_2(p
):
7798 '''udp_comb_entry_list : udp_comb_entry_list udp_comb_entry '''
7800 # { list<string>*tmp = $1;
7801 # tmp->push_back($2);
7806 def p_udp_sequ_entry_list_1(p
):
7807 '''udp_sequ_entry_list : udp_sequ_entry '''
7809 # { list<string>*tmp = new list<string>;
7810 # tmp->push_back($1);
7815 def p_udp_sequ_entry_list_2(p
):
7816 '''udp_sequ_entry_list : udp_sequ_entry_list udp_sequ_entry '''
7818 # { list<string>*tmp = $1;
7819 # tmp->push_back($2);
7824 def p_udp_sequ_entry_1(p
):
7825 '''udp_sequ_entry : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' '''
7827 # { char*tmp = new char[strlen($1)+5];
7829 # char*tp = tmp+strlen(tmp);
7838 def p_udp_initial_1(p
):
7839 '''udp_initial : K_initial IDENTIFIER '=' number ';' '''
7841 # { PExpr*etmp = new PENumber($4);
7842 # PEIdent*itmp = new PEIdent(lex_strings.make($2));
7843 # PAssign*atmp = new PAssign(itmp, etmp);
7844 # FILE_NAME(atmp, @2);
7849 def p_udp_init_opt_1(p
):
7850 '''udp_init_opt : udp_initial '''
7854 def p_udp_init_opt_2(p
):
7855 '''udp_init_opt : '''
7859 def p_udp_input_list_1(p
):
7860 '''udp_input_list : udp_input_sym '''
7862 # { char*tmp = new char[2];
7868 def p_udp_input_list_2(p
):
7869 '''udp_input_list : udp_input_list udp_input_sym '''
7871 # { char*tmp = new char[strlen($1)+2];
7873 # char*tp = tmp+strlen(tmp);
7880 def p_udp_input_sym_1(p
):
7881 '''udp_input_sym : '0' '''
7885 def p_udp_input_sym_2(p
):
7886 '''udp_input_sym : '1' '''
7890 def p_udp_input_sym_3(p
):
7891 '''udp_input_sym : 'x' '''
7895 def p_udp_input_sym_4(p
):
7896 '''udp_input_sym : '?' '''
7900 def p_udp_input_sym_5(p
):
7901 '''udp_input_sym : 'b' '''
7905 def p_udp_input_sym_6(p
):
7906 '''udp_input_sym : '*' '''
7910 def p_udp_input_sym_7(p
):
7911 '''udp_input_sym : '%' '''
7915 def p_udp_input_sym_8(p
):
7916 '''udp_input_sym : 'f' '''
7920 def p_udp_input_sym_9(p
):
7921 '''udp_input_sym : 'F' '''
7925 def p_udp_input_sym_10(p
):
7926 '''udp_input_sym : 'l' '''
7930 def p_udp_input_sym_11(p
):
7931 '''udp_input_sym : 'h' '''
7935 def p_udp_input_sym_12(p
):
7936 '''udp_input_sym : 'B' '''
7940 def p_udp_input_sym_13(p
):
7941 '''udp_input_sym : 'r' '''
7945 def p_udp_input_sym_14(p
):
7946 '''udp_input_sym : 'R' '''
7950 def p_udp_input_sym_15(p
):
7951 '''udp_input_sym : 'M' '''
7955 def p_udp_input_sym_16(p
):
7956 '''udp_input_sym : 'n' '''
7960 def p_udp_input_sym_17(p
):
7961 '''udp_input_sym : 'N' '''
7965 def p_udp_input_sym_18(p
):
7966 '''udp_input_sym : 'p' '''
7970 def p_udp_input_sym_19(p
):
7971 '''udp_input_sym : 'P' '''
7975 def p_udp_input_sym_20(p
):
7976 '''udp_input_sym : 'Q' '''
7980 def p_udp_input_sym_21(p
):
7981 '''udp_input_sym : 'q' '''
7985 def p_udp_input_sym_22(p
):
7986 '''udp_input_sym : '_' '''
7990 def p_udp_input_sym_23(p
):
7991 '''udp_input_sym : '+' '''
7995 def p_udp_input_sym_24(p
):
7996 '''udp_input_sym : DEC_NUMBER '''
7998 # { yyerror(@1, "internal error: Input digits parse as decimal number!"); $$ = '0'; }
8000 def p_udp_output_sym_1(p
):
8001 '''udp_output_sym : '0' '''
8005 def p_udp_output_sym_2(p
):
8006 '''udp_output_sym : '1' '''
8010 def p_udp_output_sym_3(p
):
8011 '''udp_output_sym : 'x' '''
8015 def p_udp_output_sym_4(p
):
8016 '''udp_output_sym : '-' '''
8020 def p_udp_output_sym_5(p
):
8021 '''udp_output_sym : DEC_NUMBER '''
8023 # { yyerror(@1, "internal error: Output digits parse as decimal number!"); $$ = '0'; }
8025 def p_udp_port_decl_1(p
):
8026 '''udp_port_decl : K_input list_of_identifiers ';' '''
8028 # { $$ = pform_make_udp_input_ports($2); }
8030 def p_udp_port_decl_2(p
):
8031 '''udp_port_decl : K_output IDENTIFIER ';' '''
8033 # { perm_string pname = lex_strings.make($2);
8034 # PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
8035 # vector<PWire*>*tmp = new vector<PWire*>(1);
8041 def p_udp_port_decl_3(p
):
8042 '''udp_port_decl : K_reg IDENTIFIER ';' '''
8044 # { perm_string pname = lex_strings.make($2);
8045 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
8046 # vector<PWire*>*tmp = new vector<PWire*>(1);
8052 def p_udp_port_decl_4(p
):
8053 '''udp_port_decl : K_reg K_output IDENTIFIER ';' '''
8055 # { perm_string pname = lex_strings.make($3);
8056 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
8057 # vector<PWire*>*tmp = new vector<PWire*>(1);
8063 def p_udp_port_decls_1(p
):
8064 '''udp_port_decls : udp_port_decl '''
8068 def p_udp_port_decls_2(p
):
8069 '''udp_port_decls : udp_port_decls udp_port_decl '''
8071 # { vector<PWire*>*tmp = $1;
8072 # size_t s1 = $1->size();
8073 # tmp->resize(s1+$2->size());
8074 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
8075 # tmp->at(s1+idx) = $2->at(idx);
8080 def p_udp_port_list_1(p
):
8081 '''udp_port_list : IDENTIFIER '''
8083 # { list<perm_string>*tmp = new list<perm_string>;
8084 # tmp->push_back(lex_strings.make($1));
8089 def p_udp_port_list_2(p
):
8090 '''udp_port_list : udp_port_list ',' IDENTIFIER '''
8092 # { list<perm_string>*tmp = $1;
8093 # tmp->push_back(lex_strings.make($3));
8098 def p_udp_reg_opt_1(p
):
8099 '''udp_reg_opt : K_reg '''
8103 def p_udp_reg_opt_2(p
):
8104 '''udp_reg_opt : '''
8108 def p_udp_initial_expr_opt_1(p
):
8109 '''udp_initial_expr_opt : '=' expression '''
8113 def p_udp_initial_expr_opt_2(p
):
8114 '''udp_initial_expr_opt : '''
8118 def p_udp_input_declaration_list_1(p
):
8119 '''udp_input_declaration_list : K_input IDENTIFIER '''
8121 # { list<perm_string>*tmp = new list<perm_string>;
8122 # tmp->push_back(lex_strings.make($2));
8127 def p_udp_input_declaration_list_2(p
):
8128 '''udp_input_declaration_list : udp_input_declaration_list ',' K_input IDENTIFIER '''
8130 # { list<perm_string>*tmp = $1;
8131 # tmp->push_back(lex_strings.make($4));
8136 def p_udp_primitive_1(p
):
8137 '''udp_primitive : K_primitive IDENTIFIER '(' udp_port_list ')' ';' udp_port_decls udp_init_opt udp_body K_endprimitive endlabel_opt '''
8139 # { perm_string tmp2 = lex_strings.make($2);
8140 # pform_make_udp(tmp2, $4, $7, $9, $8,
8141 # @2.text, @2.first_line);
8143 # if (strcmp($2,$11) != 0) {
8144 # yyerror(@11, "error: End label doesn't match "
8145 # "primitive name");
8147 # if (! gn_system_verilog()) {
8148 # yyerror(@11, "error: Primitive end labels "
8149 # "require SystemVerilog.");
8156 def p_udp_primitive_2(p
):
8157 '''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 '''
8159 # { perm_string tmp2 = lex_strings.make($2);
8160 # perm_string tmp6 = lex_strings.make($6);
8161 # pform_make_udp(tmp2, $5, tmp6, $7, $9, $12,
8162 # @2.text, @2.first_line);
8164 # if (strcmp($2,$14) != 0) {
8165 # yyerror(@14, "error: End label doesn't match "
8166 # "primitive name");
8168 # if (! gn_system_verilog()) {
8169 # yyerror(@14, "error: Primitive end labels "
8170 # "require SystemVerilog.");
8178 def p_K_packed_opt_1(p
):
8179 '''K_packed_opt : K_packed '''
8183 def p_K_packed_opt_2(p
):
8184 '''K_packed_opt : '''
8188 def p_K_reg_opt_1(p
):
8189 '''K_reg_opt : K_reg '''
8193 def p_K_reg_opt_2(p
):
8198 def p_K_static_opt_1(p
):
8199 '''K_static_opt : K_static '''
8203 def p_K_static_opt_2(p
):
8204 '''K_static_opt : '''
8209 def p_K_virtual_opt_1(p
):
8210 '''K_virtual_opt : K_virtual '''
8214 def p_K_virtual_opt_2(p
):
8215 '''K_virtual_opt : '''