427f399e7a287b54f99d5173f35e56038fa4eac3
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 ply
import yacc
, lex
24 from lib2to3
.pytree
import Node
, Leaf
25 from lib2to3
.pgen2
import token
26 from lib2to3
.pygram
import python_symbols
as syms
33 #from parse_tokens import tokens
34 tokens
= lexor
.tokens
# list(set(lexor.tokens).union(set(tokens)))
35 literals
= lexor
.literals
38 ('right', 'K_PLUS_EQ', 'K_MINUS_EQ', 'K_MUL_EQ', 'K_DIV_EQ',
39 'K_MOD_EQ', 'K_AND_EQ', 'K_OR_EQ'),
40 ('right', 'K_XOR_EQ', 'K_LS_EQ', 'K_RS_EQ', 'K_RSS_EQ'),
41 ('right', '?', ':', 'K_inside'),
45 ('left', '^', 'K_NXOR', 'K_NOR'),
46 ('left', '&', 'K_NAND'),
47 ('left', 'K_EQ', 'K_NE', 'K_CEQ', 'K_CNE', 'K_WEQ', 'K_WNE'),
48 ('left', 'K_GE', 'K_LE', '<', '>'),
49 ('left', 'K_LS', 'K_RS', 'K_RSS'),
51 ('left', '*', '/', '%'),
53 ('left', 'UNARY_PREC'),
54 ('nonassoc', 'less_than_K_else'),
55 ('nonassoc', 'K_else'),
57 ('nonassoc', 'K_exclude'),
58 ('nonassoc', 'no_timeunits_declaration'),
59 ('nonassoc', 'one_timeunits_declaration'),
60 ('nonassoc', 'K_timeunit', 'K_timeprecision')
64 IVL_VT_NO_TYPE
= 'VT_NO_TYPE'
65 IVL_VT_BOOL
= 'VT_BOOL'
66 IVL_VT_LOGIC
= 'VT_LOGIC'
68 IVL_VT_VOID = 0, /* Not used */
69 IVL_VT_NO_TYPE = 1, /* Place holder for missing/unknown type. */
74 IVL_VT_DARRAY = 6, /* Array (esp. dynamic array) */
75 IVL_VT_CLASS = 7, /* SystemVerilog class instances */
76 IVL_VT_QUEUE = 8, /* SystemVerilog queue instances */
77 IVL_VT_VECTOR = IVL_VT_LOGIC /* For compatibility */
81 NN_IMPLICIT
= 'IMPLICIT'
82 NN_IMPLICIT_REG
= 'IMPLICIT_REG'
83 NN_INTEGER
= 'INTEGER'
87 NN_SUPPLY0
= 'SUPPLY0'
88 NN_SUPPLY1
= 'SUPPLY1'
95 NN_UNRESOLVED_WIRE
= 'UNRESOLVED_WIRE'
97 NP_NOT_A_PORT
= 'NOT_A_PORT'
98 NP_PIMPLICIT
= 'PIMPLICIT'
100 NP_POUTPUT
= 'POUTPUT'
106 def __init__(self
, typ
, signed
):
115 def add_statement(self
, s
):
116 self
.statements
+= [s
]
120 def __init__(self
, l
, op
, r
):
126 # -------------- RULES ----------------
130 def p_source_text_1(p
):
131 '''source_text : timeunits_declaration_opt _embed0_source_text description_list '''
133 print('source_text', list(p
))
139 def p_source_text_2(p
):
142 print('source_text', list(p
))
148 def p__embed0_source_text(p
):
149 '''_embed0_source_text : '''
152 # { pform_set_scope_timescale(yyloc); }
156 def p_assertion_item_1(p
):
157 '''assertion_item : concurrent_assertion_item '''
159 print('assertion_item_1', list(p
))
165 def p_assignment_pattern_1(p
):
166 '''assignment_pattern : K_LP expression_list_proper '}' '''
168 print('assignment_pattern_1', list(p
))
171 # { PEAssignPattern*tmp = new PEAssignPattern(*p[2]);
172 # FILE_NAME(tmp, @1);
179 def p_assignment_pattern_2(p
):
180 '''assignment_pattern : K_LP '}' '''
182 print('assignment_pattern_2', list(p
))
185 # { PEAssignPattern*tmp = new PEAssignPattern;
186 # FILE_NAME(tmp, @1);
192 def p_block_identifier_opt_1(p
):
193 '''block_identifier_opt : IDENTIFIER ':' '''
195 print('block_identifier_opt_1', list(p
))
201 def p_block_identifier_opt_2(p
):
202 '''block_identifier_opt : '''
204 print('block_identifier_opt_2', list(p
))
210 def p_class_declaration_1(p
):
211 '''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 '''
213 print('class_declaration_1', list(p
))
216 # { // Wrap up the class.
217 # if (p[11] && p[4] && p[4]->name != p[11]) {
218 # yyerror(@11, "error: Class end label doesn't match class name.");
225 def p__embed0_class_declaration(p
):
226 '''_embed0_class_declaration : '''
229 # { pform_start_class_declaration(@2, p[4], p[5].type, p[5].exprs, p[3]); }
233 def p__embed1_class_declaration(p
):
234 '''_embed1_class_declaration : '''
237 # { // Process a class.
238 # pform_end_class_declaration(@9);
243 def p_class_constraint_1(p
):
244 '''class_constraint : constraint_prototype '''
246 print('class_constraint_1', list(p
))
252 def p_class_constraint_2(p
):
253 '''class_constraint : constraint_declaration '''
255 print('class_constraint_2', list(p
))
261 def p_class_identifier_1(p
):
262 '''class_identifier : IDENTIFIER '''
264 print('class_identifier_1', list(p
))
267 # { // Create a synthetic typedef for the class name so that the
268 # // lexor detects the name as a type.
269 # perm_string name = lex_strings.make(p[1]);
270 # class_type_t*tmp = new class_type_t(name);
271 # FILE_NAME(tmp, @1);
272 # pform_set_typedef(name, tmp, NULL);
279 def p_class_identifier_2(p
):
280 '''class_identifier : TYPE_IDENTIFIER '''
282 print('class_identifier_2', list(p
))
285 # { class_type_t*tmp = dynamic_cast<class_type_t*>(p[1].type);
287 # yyerror(@1, "Type name \"%s\"is not a predeclared class name.", p[1].text);
295 def p_class_declaration_endlabel_opt_1(p
):
296 '''class_declaration_endlabel_opt : ':' TYPE_IDENTIFIER '''
298 print('class_declaration_endlabel_opt_1', list(p
))
301 # { class_type_t*tmp = dynamic_cast<class_type_t*> (p[2].type);
303 # yyerror(@2, "error: class declaration endlabel \"%s\" is not a class name\n", p[2].text);
306 # p[0] = strdupnew(tmp->name.str());
313 def p_class_declaration_endlabel_opt_2(p
):
314 '''class_declaration_endlabel_opt : ':' IDENTIFIER '''
316 print('class_declaration_endlabel_opt_2', list(p
))
323 def p_class_declaration_endlabel_opt_3(p
):
324 '''class_declaration_endlabel_opt : '''
326 print('class_declaration_endlabel_opt_3', list(p
))
333 def p_class_declaration_extends_opt_1(p
):
334 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '''
336 print('class_declaration_extends_opt_1', list(p
))
339 # { p[0].type = p[2].type;
346 def p_class_declaration_extends_opt_2(p
):
347 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '(' expression_list_with_nuls ')' '''
349 print('class_declaration_extends_opt_2', list(p
))
352 # { p[0].type = p[2].type;
359 def p_class_declaration_extends_opt_3(p
):
360 '''class_declaration_extends_opt : '''
362 print('class_declaration_extends_opt_3', list(p
))
365 # { p[0].type = 0; p[0].exprs = 0; }
369 def p_class_items_opt_1(p
):
370 '''class_items_opt : class_items '''
372 print('class_items_opt_1', list(p
))
378 def p_class_items_opt_2(p
):
379 '''class_items_opt : '''
381 print('class_items_opt_2', list(p
))
387 def p_class_items_1(p
):
388 '''class_items : class_items class_item '''
390 print('class_items_1', list(p
))
396 def p_class_items_2(p
):
397 '''class_items : class_item '''
399 print('class_items_2', list(p
))
405 def p_class_item_1(p
):
406 '''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 '''
408 print('class_item_1', list(p
))
411 # { current_function->set_ports(p[6]);
412 # pform_set_constructor_return(current_function);
413 # pform_set_this_class(@3, current_function);
414 # current_function_set_statement(@3, p[10]);
416 # current_function = 0;
421 def p_class_item_2(p
):
422 '''class_item : property_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
424 print('class_item_2', list(p
))
427 # { pform_class_property(@2, p[1], p[2], p[3]); }
431 def p_class_item_3(p
):
432 '''class_item : K_const class_item_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
434 print('class_item_3', list(p
))
437 # { pform_class_property(@1, p[2] | property_qualifier_t::make_const(), p[3], p[4]); }
441 def p_class_item_4(p
):
442 '''class_item : method_qualifier_opt task_declaration '''
444 print('class_item_4', list(p
))
447 # { /* The task_declaration rule puts this into the class */ }
451 def p_class_item_5(p
):
452 '''class_item : method_qualifier_opt function_declaration '''
454 print('class_item_5', list(p
))
457 # { /* The function_declaration rule puts this into the class */ }
461 def p_class_item_6(p
):
462 '''class_item : K_extern method_qualifier_opt K_function K_new ';' '''
464 print('class_item_6', list(p
))
467 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
471 def p_class_item_7(p
):
472 '''class_item : K_extern method_qualifier_opt K_function K_new '(' tf_port_list_opt ')' ';' '''
474 print('class_item_7', list(p
))
477 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
481 def p_class_item_8(p
):
482 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER ';' '''
484 print('class_item_8', list(p
))
487 # { yyerror(@1, "sorry: External methods are not yet supported.");
493 def p_class_item_9(p
):
494 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' ';' '''
496 print('class_item_9', list(p
))
499 # { yyerror(@1, "sorry: External methods are not yet supported.");
505 def p_class_item_10(p
):
506 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER ';' '''
508 print('class_item_10', list(p
))
511 # { yyerror(@1, "sorry: External methods are not yet supported.");
517 def p_class_item_11(p
):
518 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER '(' tf_port_list_opt ')' ';' '''
520 print('class_item_11', list(p
))
523 # { yyerror(@1, "sorry: External methods are not yet supported.");
529 def p_class_item_12(p
):
530 '''class_item : class_constraint '''
532 print('class_item_12', list(p
))
538 def p_class_item_13(p
):
539 '''class_item : property_qualifier_opt data_type error ';' '''
541 print('class_item_13', list(p
))
544 # { yyerror(@3, "error: Errors in variable names after data type.");
550 def p_class_item_14(p
):
551 '''class_item : property_qualifier_opt IDENTIFIER error ';' '''
553 print('class_item_14', list(p
))
556 # { yyerror(@3, "error: %s doesn't name a type.", p[2]);
562 def p_class_item_15(p
):
563 '''class_item : method_qualifier_opt K_function K_new error K_endfunction endnew_opt '''
565 print('class_item_15', list(p
))
568 # { yyerror(@1, "error: I give up on this class constructor declaration.");
574 def p_class_item_16(p
):
575 '''class_item : error ';' '''
577 print('class_item_16', list(p
))
580 # { yyerror(@2, "error: invalid class item.");
586 def p__embed0_class_item(p
):
587 '''_embed0_class_item : '''
590 # { assert(current_function==0);
591 # current_function = pform_push_constructor_scope(@3);
596 def p_class_item_qualifier_1(p
):
597 '''class_item_qualifier : K_static '''
599 print('class_item_qualifier_1', list(p
))
602 # { p[0] = property_qualifier_t::make_static(); }
606 def p_class_item_qualifier_2(p
):
607 '''class_item_qualifier : K_protected '''
609 print('class_item_qualifier_2', list(p
))
612 # { p[0] = property_qualifier_t::make_protected(); }
616 def p_class_item_qualifier_3(p
):
617 '''class_item_qualifier : K_local '''
619 print('class_item_qualifier_3', list(p
))
622 # { p[0] = property_qualifier_t::make_local(); }
626 def p_class_item_qualifier_list_1(p
):
627 '''class_item_qualifier_list : class_item_qualifier_list class_item_qualifier '''
629 print('class_item_qualifier_list_1', list(p
))
632 # { p[0] = p[1] | p[2]; }
636 def p_class_item_qualifier_list_2(p
):
637 '''class_item_qualifier_list : class_item_qualifier '''
639 print('class_item_qualifier_list_2', list(p
))
646 def p_class_item_qualifier_opt_1(p
):
647 '''class_item_qualifier_opt : class_item_qualifier_list '''
649 print('class_item_qualifier_opt_1', list(p
))
656 def p_class_item_qualifier_opt_2(p
):
657 '''class_item_qualifier_opt : '''
659 print('class_item_qualifier_opt_2', list(p
))
662 # { p[0] = property_qualifier_t::make_none(); }
666 def p_class_new_1(p
):
667 '''class_new : K_new '(' expression_list_with_nuls ')' '''
669 print('class_new_1', list(p
))
672 # { list<PExpr*>*expr_list = p[3];
673 # strip_tail_items(expr_list);
674 # PENewClass*tmp = new PENewClass(*expr_list);
675 # FILE_NAME(tmp, @1);
682 def p_class_new_2(p
):
683 '''class_new : K_new hierarchy_identifier '''
685 print('class_new_2', list(p
))
688 # { PEIdent*tmpi = new PEIdent(*p[2]);
689 # FILE_NAME(tmpi, @2);
690 # PENewCopy*tmp = new PENewCopy(tmpi);
691 # FILE_NAME(tmp, @1);
698 def p_class_new_3(p
):
699 '''class_new : K_new '''
701 print('class_new_3', list(p
))
704 # { PENewClass*tmp = new PENewClass;
705 # FILE_NAME(tmp, @1);
711 def p_concurrent_assertion_item_1(p
):
712 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' property_spec ')' statement_or_null '''
714 print('concurrent_assertion_item_1', list(p
))
718 # if (gn_assertions_flag) {
719 # yyerror(@2, "sorry: concurrent_assertion_item not supported."
720 # " Try -gno-assertion to turn this message off.");
726 def p_concurrent_assertion_item_2(p
):
727 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' error ')' statement_or_null '''
729 print('concurrent_assertion_item_2', list(p
))
733 # yyerror(@2, "error: Error in property_spec of concurrent assertion item.");
738 def p_constraint_block_item_1(p
):
739 '''constraint_block_item : constraint_expression '''
741 print('constraint_block_item_1', list(p
))
747 def p_constraint_block_item_list_1(p
):
748 '''constraint_block_item_list : constraint_block_item_list constraint_block_item '''
750 print('constraint_block_item_list_1', list(p
))
756 def p_constraint_block_item_list_2(p
):
757 '''constraint_block_item_list : constraint_block_item '''
759 print('constraint_block_item_list_2', list(p
))
765 def p_constraint_block_item_list_opt_1(p
):
766 '''constraint_block_item_list_opt : '''
768 print('constraint_block_item_list_opt_1', list(p
))
774 def p_constraint_block_item_list_opt_2(p
):
775 '''constraint_block_item_list_opt : constraint_block_item_list '''
777 print('constraint_block_item_list_opt_2', list(p
))
783 def p_constraint_declaration_1(p
):
784 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' constraint_block_item_list_opt '}' '''
786 print('constraint_declaration_1', list(p
))
789 # { yyerror(@2, "sorry: Constraint declarations not supported."); }
793 def p_constraint_declaration_2(p
):
794 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' error '}' '''
796 print('constraint_declaration_2', list(p
))
799 # { yyerror(@4, "error: Errors in the constraint block item list."); }
803 def p_constraint_expression_1(p
):
804 '''constraint_expression : expression ';' '''
806 print('constraint_expression_1', list(p
))
812 def p_constraint_expression_2(p
):
813 '''constraint_expression : expression K_dist '{' '}' ';' '''
815 print('constraint_expression_2', list(p
))
821 def p_constraint_expression_3(p
):
822 '''constraint_expression : expression K_TRIGGER constraint_set '''
824 print('constraint_expression_3', list(p
))
830 def p_constraint_expression_4(p
):
831 '''constraint_expression : K_if '(' expression ')' constraint_set %prec less_than_K_else '''
833 print('constraint_expression_4', list(p
))
839 def p_constraint_expression_5(p
):
840 '''constraint_expression : K_if '(' expression ')' constraint_set K_else constraint_set '''
842 print('constraint_expression_5', list(p
))
848 def p_constraint_expression_6(p
):
849 '''constraint_expression : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' constraint_set '''
851 print('constraint_expression_6', list(p
))
857 def p_constraint_expression_list_1(p
):
858 '''constraint_expression_list : constraint_expression_list constraint_expression '''
860 print('constraint_expression_list_1', list(p
))
866 def p_constraint_expression_list_2(p
):
867 '''constraint_expression_list : constraint_expression '''
869 print('constraint_expression_list_2', list(p
))
875 def p_constraint_prototype_1(p
):
876 '''constraint_prototype : K_static_opt K_constraint IDENTIFIER ';' '''
878 print('constraint_prototype_1', list(p
))
881 # { yyerror(@2, "sorry: Constraint prototypes not supported."); }
885 def p_constraint_set_1(p
):
886 '''constraint_set : constraint_expression '''
888 print('constraint_set_1', list(p
))
894 def p_constraint_set_2(p
):
895 '''constraint_set : '{' constraint_expression_list '}' '''
897 print('constraint_set_2', list(p
))
903 def p_data_declaration_1(p
):
904 '''data_declaration : attribute_list_opt data_type_or_implicit list_of_variable_decl_assignments ';' '''
906 print('data_declaration_1', list(p
))
909 # { data_type_t*data_type = p[2];
910 # if (data_type == 0) {
911 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
912 # FILE_NAME(data_type, @2);
914 # pform_makewire(@2, 0, str_strength, p[3], NetNet::IMPLICIT_REG, data_type);
919 def p_data_type_1(p
):
920 '''data_type : integer_vector_type unsigned_signed_opt dimensions_opt '''
922 print('data_type_1', list(p
))
925 if (use_vtype
== IVL_VT_NO_TYPE
):
926 use_vtype
= IVL_VT_LOGIC
928 dt
= DataType(use_vtype
, signed
=p
[2])
930 dt
.reg_flag
= reg_flag
934 # { ivl_variable_type_t use_vtype = p[1];
935 # bool reg_flag = false;
936 # if (use_vtype == IVL_VT_NO_TYPE) {
937 # use_vtype = IVL_VT_LOGIC;
940 # vector_type_t*tmp = new vector_type_t(use_vtype, p[2], p[3]);
941 # tmp->reg_flag = reg_flag;
942 # FILE_NAME(tmp, @1);
948 def p_data_type_2(p
):
949 '''data_type : non_integer_type '''
951 print('data_type_2', list(p
))
955 # { real_type_t*tmp = new real_type_t(p[1]);
956 # FILE_NAME(tmp, @1);
962 def p_data_type_3(p
):
963 '''data_type : struct_data_type '''
965 print('data_type_3', list(p
))
969 # { if (!p[1]->packed_flag) {
970 # yyerror(@1, "sorry: Unpacked structs not supported.");
977 def p_data_type_4(p
):
978 '''data_type : enum_data_type '''
980 print('data_type_4', list(p
))
987 def p_data_type_5(p
):
988 '''data_type : atom2_type signed_unsigned_opt '''
990 print('data_type_5', list(p
))
993 # { atom2_type_t*tmp = new atom2_type_t(p[1], p[2]);
994 # FILE_NAME(tmp, @1);
1000 def p_data_type_6(p
):
1001 '''data_type : K_integer signed_unsigned_opt '''
1003 print('data_type_6', list(p
))
1006 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
1007 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, p[2], pd);
1008 # tmp->reg_flag = true;
1009 # tmp->integer_flag = true;
1015 def p_data_type_7(p
):
1016 '''data_type : K_time '''
1018 print('data_type_7', list(p
))
1021 # { list<pform_range_t>*pd = make_range_from_width(64);
1022 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
1023 # tmp->reg_flag = !gn_system_verilog();
1029 def p_data_type_8(p
):
1030 '''data_type : TYPE_IDENTIFIER dimensions_opt '''
1032 print('data_type_8', list(p
))
1036 # parray_type_t*tmp = new parray_type_t(p[1].type, p[2]);
1037 # FILE_NAME(tmp, @1);
1039 # } else p[0] = p[1].type;
1040 # delete[]p[1].text;
1045 def p_data_type_9(p
):
1046 '''data_type : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_data_type TYPE_IDENTIFIER '''
1048 print('data_type_9', list(p
))
1051 # { lex_in_package_scope(0);
1053 # delete[]p[4].text;
1058 def p_data_type_10(p
):
1059 '''data_type : K_string '''
1061 print('data_type_10', list(p
))
1064 # { string_type_t*tmp = new string_type_t;
1065 # FILE_NAME(tmp, @1);
1071 def p__embed0_data_type(p
):
1072 '''_embed0_data_type : '''
1075 # { lex_in_package_scope(p[1]); }
1079 def p_data_type_or_implicit_1(p
):
1080 '''data_type_or_implicit : data_type '''
1082 print('data_type_or_implicit_1', list(p
))
1089 def p_data_type_or_implicit_2(p
):
1090 '''data_type_or_implicit : signing dimensions_opt '''
1092 print('data_type_or_implicit_2', list(p
))
1095 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, p[1], p[2]);
1096 # tmp->implicit_flag = true;
1097 # FILE_NAME(tmp, @1);
1103 def p_data_type_or_implicit_3(p
):
1104 '''data_type_or_implicit : dimensions '''
1106 print('data_type_or_implicit_3', list(p
))
1110 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, p[1]);
1111 # tmp->implicit_flag = true;
1112 # FILE_NAME(tmp, @1);
1118 def p_data_type_or_implicit_4(p
):
1119 '''data_type_or_implicit : '''
1120 if(parse_debug
> 2):
1121 print('data_type_or_implicit_4', list(p
))
1128 def p_data_type_or_implicit_or_void_1(p
):
1129 '''data_type_or_implicit_or_void : data_type_or_implicit '''
1131 print('data_type_or_implicit_or_void_1', list(p
))
1138 def p_data_type_or_implicit_or_void_2(p
):
1139 '''data_type_or_implicit_or_void : K_void '''
1141 print('data_type_or_implicit_or_void_2', list(p
))
1144 # { void_type_t*tmp = new void_type_t;
1145 # FILE_NAME(tmp, @1);
1151 def p_description_1(p
):
1152 '''description : module '''
1153 if(parse_debug
> 2):
1154 print('description_1', list(p
))
1160 def p_description_2(p
):
1161 '''description : udp_primitive '''
1163 print('description_2', list(p
))
1169 def p_description_3(p
):
1170 '''description : config_declaration '''
1172 print('description_3', list(p
))
1178 def p_description_4(p
):
1179 '''description : nature_declaration '''
1181 print('description_4', list(p
))
1187 def p_description_5(p
):
1188 '''description : package_declaration '''
1190 print('description_5', list(p
))
1196 def p_description_6(p
):
1197 '''description : discipline_declaration '''
1199 print('description_6', list(p
))
1205 def p_description_7(p
):
1206 '''description : package_item '''
1208 print('description_7', list(p
))
1214 def p_description_8(p
):
1215 '''description : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' '''
1217 print('description_8', list(p
))
1220 # { perm_string tmp3 = lex_strings.make(p[3]);
1221 # pform_set_type_attrib(tmp3, p[5], p[7]);
1228 def p_description_list_1(p
):
1229 '''description_list : description '''
1230 if(parse_debug
> 2):
1231 print('description_list_1', list(p
))
1237 def p_description_list_2(p
):
1238 '''description_list : description_list description '''
1240 print('description_list_2', list(p
))
1246 def p_endnew_opt_1(p
):
1247 '''endnew_opt : ':' K_new '''
1249 print('endnew_opt_1', list(p
))
1255 def p_endnew_opt_2(p
):
1258 print('endnew_opt_2', list(p
))
1264 def p_dynamic_array_new_1(p
):
1265 '''dynamic_array_new : K_new '[' expression ']' '''
1267 print('dynamic_array_new_1', list(p
))
1270 # { p[0] = new PENewArray(p[3], 0);
1271 # FILE_NAME(p[0], @1);
1276 def p_dynamic_array_new_2(p
):
1277 '''dynamic_array_new : K_new '[' expression ']' '(' expression ')' '''
1279 print('dynamic_array_new_2', list(p
))
1282 # { p[0] = new PENewArray(p[3], p[6]);
1283 # FILE_NAME(p[0], @1);
1288 def p_for_step_1(p
):
1289 '''for_step : lpvalue '=' expression '''
1291 print('for_step_1', list(p
))
1294 # { PAssign*tmp = new PAssign(p[1],p[3]);
1295 # FILE_NAME(tmp, @1);
1301 def p_for_step_2(p
):
1302 '''for_step : inc_or_dec_expression '''
1304 print('for_step_2', list(p
))
1307 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
1311 def p_for_step_3(p
):
1312 '''for_step : compressed_statement '''
1314 print('for_step_3', list(p
))
1321 def p_function_declaration_1(p
):
1322 '''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 '''
1324 print('function_declaration_1', list(p
))
1327 # { // Last step: check any closing name.
1329 # if (strcmp(p[4],p[11]) != 0) {
1330 # yyerror(@11, "error: End label doesn't match "
1333 # if (! gn_system_verilog()) {
1334 # yyerror(@11, "error: Function end labels require "
1335 # "SystemVerilog.");
1344 def p_function_declaration_2(p
):
1345 '''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 '''
1347 print('function_declaration_2', list(p
))
1350 # { // Last step: check any closing name.
1352 # if (strcmp(p[4],p[14]) != 0) {
1353 # yyerror(@14, "error: End label doesn't match "
1356 # if (! gn_system_verilog()) {
1357 # yyerror(@14, "error: Function end labels require "
1358 # "SystemVerilog.");
1367 def p_function_declaration_3(p
):
1368 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER error K_endfunction _embed4_function_declaration endlabel_opt '''
1370 print('function_declaration_3', list(p
))
1373 # { // Last step: check any closing name.
1375 # if (strcmp(p[4],p[8]) != 0) {
1376 # yyerror(@8, "error: End label doesn't match function name");
1378 # if (! gn_system_verilog()) {
1379 # yyerror(@8, "error: Function end labels require "
1380 # "SystemVerilog.");
1389 def p__embed0_function_declaration(p
):
1390 '''_embed0_function_declaration : '''
1393 # { assert(current_function == 0);
1394 # current_function = pform_push_function_scope(@1, p[4], p[2]);
1399 def p__embed1_function_declaration(p
):
1400 '''_embed1_function_declaration : '''
1403 # { current_function->set_ports(p[7]);
1404 # current_function->set_return(p[3]);
1405 # current_function_set_statement(p[8]? @8 : @4, p[8]);
1406 # pform_set_this_class(@4, current_function);
1407 # pform_pop_scope();
1408 # current_function = 0;
1413 def p__embed2_function_declaration(p
):
1414 '''_embed2_function_declaration : '''
1417 # { assert(current_function == 0);
1418 # current_function = pform_push_function_scope(@1, p[4], p[2]);
1423 def p__embed3_function_declaration(p
):
1424 '''_embed3_function_declaration : '''
1427 # { current_function->set_ports(p[7]);
1428 # current_function->set_return(p[3]);
1429 # current_function_set_statement(p[11]? @11 : @4, p[11]);
1430 # pform_set_this_class(@4, current_function);
1431 # pform_pop_scope();
1432 # current_function = 0;
1433 # if (p[7]==0 && !gn_system_verilog()) {
1434 # yyerror(@4, "error: Empty parenthesis syntax requires SystemVerilog.");
1440 def p__embed4_function_declaration(p
):
1441 '''_embed4_function_declaration : '''
1445 # if (current_function) {
1446 # pform_pop_scope();
1447 # current_function = 0;
1449 # assert(current_function == 0);
1450 # yyerror(@1, "error: Syntax error defining function.");
1456 def p_import_export_1(p
):
1457 '''import_export : K_import '''
1459 print('import_export_1', list(p
))
1466 def p_import_export_2(p
):
1467 '''import_export : K_export '''
1469 print('import_export_2', list(p
))
1476 def p_implicit_class_handle_1(p
):
1477 '''implicit_class_handle : K_this '''
1479 print('implicit_class_handle_1', list(p
))
1482 # { p[0] = pform_create_this(); }
1486 def p_implicit_class_handle_2(p
):
1487 '''implicit_class_handle : K_super '''
1489 print('implicit_class_handle_2', list(p
))
1492 # { p[0] = pform_create_super(); }
1496 def p_inc_or_dec_expression_1(p
):
1497 '''inc_or_dec_expression : K_INCR lpvalue %prec UNARY_PREC '''
1499 print('inc_or_dec_expression_1', list(p
))
1502 # { PEUnary*tmp = new PEUnary('I', p[2]);
1503 # FILE_NAME(tmp, @2);
1509 def p_inc_or_dec_expression_2(p
):
1510 '''inc_or_dec_expression : lpvalue K_INCR %prec UNARY_PREC '''
1512 print('inc_or_dec_expression_2', list(p
))
1515 # { PEUnary*tmp = new PEUnary('i', p[1]);
1516 # FILE_NAME(tmp, @1);
1522 def p_inc_or_dec_expression_3(p
):
1523 '''inc_or_dec_expression : K_DECR lpvalue %prec UNARY_PREC '''
1525 print('inc_or_dec_expression_3', list(p
))
1528 # { PEUnary*tmp = new PEUnary('D', p[2]);
1529 # FILE_NAME(tmp, @2);
1535 def p_inc_or_dec_expression_4(p
):
1536 '''inc_or_dec_expression : lpvalue K_DECR %prec UNARY_PREC '''
1538 print('inc_or_dec_expression_4', list(p
))
1541 # { PEUnary*tmp = new PEUnary('d', p[1]);
1542 # FILE_NAME(tmp, @1);
1548 def p_inside_expression_1(p
):
1549 '''inside_expression : expression K_inside '{' open_range_list '}' '''
1551 print('inside_expression_1', list(p
))
1554 # { yyerror(@2, "sorry: \"inside\" expressions not supported yet.");
1560 def p_integer_vector_type_1(p
):
1561 '''integer_vector_type : K_reg '''
1563 print('integer_vector_type_1', list(p
))
1564 p
[0] = IVL_VT_NO_TYPE
1570 def p_integer_vector_type_2(p
):
1571 '''integer_vector_type : K_bit '''
1573 print('integer_vector_type_2', list(p
))
1580 def p_integer_vector_type_3(p
):
1581 '''integer_vector_type : K_logic '''
1583 print('integer_vector_type_3', list(p
))
1590 def p_integer_vector_type_4(p
):
1591 '''integer_vector_type : K_bool '''
1593 print('integer_vector_type_4', list(p
))
1596 # { p[0] = IVL_VT_BOOL; }
1600 def p_join_keyword_1(p
):
1601 '''join_keyword : K_join '''
1603 print('join_keyword_1', list(p
))
1606 # { p[0] = PBlock::BL_PAR; }
1610 def p_join_keyword_2(p
):
1611 '''join_keyword : K_join_none '''
1613 print('join_keyword_2', list(p
))
1616 # { p[0] = PBlock::BL_JOIN_NONE; }
1620 def p_join_keyword_3(p
):
1621 '''join_keyword : K_join_any '''
1623 print('join_keyword_3', list(p
))
1626 # { p[0] = PBlock::BL_JOIN_ANY; }
1630 def p_jump_statement_1(p
):
1631 '''jump_statement : K_break ';' '''
1633 print('jump_statement_1', list(p
))
1636 # { yyerror(@1, "sorry: break statements not supported.");
1642 def p_jump_statement_2(p
):
1643 '''jump_statement : K_return ';' '''
1645 print('jump_statement_2', list(p
))
1648 # { PReturn*tmp = new PReturn(0);
1649 # FILE_NAME(tmp, @1);
1655 def p_jump_statement_3(p
):
1656 '''jump_statement : K_return expression ';' '''
1658 print('jump_statement_3', list(p
))
1661 # { PReturn*tmp = new PReturn(p[2]);
1662 # FILE_NAME(tmp, @1);
1668 def p_lifetime_1(p
):
1669 '''lifetime : K_automatic '''
1671 print('lifetime_1', list(p
))
1674 # { p[0] = LexicalScope::AUTOMATIC; }
1678 def p_lifetime_2(p
):
1679 '''lifetime : K_static '''
1681 print('lifetime_2', list(p
))
1684 # { p[0] = LexicalScope::STATIC; }
1688 def p_lifetime_opt_1(p
):
1689 '''lifetime_opt : lifetime '''
1691 print('lifetime_opt_1', list(p
))
1698 def p_lifetime_opt_2(p
):
1699 '''lifetime_opt : '''
1700 if(parse_debug
> 2):
1701 print('lifetime_opt_2', list(p
))
1704 # { p[0] = LexicalScope::INHERITED; }
1708 def p_loop_statement_1(p
):
1709 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' for_step ')' statement_or_null '''
1711 print('loop_statement_1', list(p
))
1714 # { PForStatement*tmp = new PForStatement(p[3], p[5], p[7], p[9], p[11]);
1715 # FILE_NAME(tmp, @1);
1721 def p_loop_statement_2(p
):
1722 '''loop_statement : K_for '(' data_type IDENTIFIER '=' expression ';' expression ';' for_step ')' _embed0_loop_statement statement_or_null '''
1724 print('loop_statement_2', list(p
))
1727 # { pform_name_t tmp_hident;
1728 # tmp_hident.push_back(name_component_t(lex_strings.make(p[4])));
1730 # PEIdent*tmp_ident = pform_new_ident(tmp_hident);
1731 # FILE_NAME(tmp_ident, @4);
1733 # PForStatement*tmp_for = new PForStatement(tmp_ident, p[6], p[8], p[10], p[13]);
1734 # FILE_NAME(tmp_for, @1);
1736 # pform_pop_scope();
1737 # vector<Statement*>tmp_for_list (1);
1738 # tmp_for_list[0] = tmp_for;
1739 # PBlock*tmp_blk = current_block_stack.top();
1740 # current_block_stack.pop();
1741 # tmp_blk->set_statement(tmp_for_list);
1748 def p_loop_statement_3(p
):
1749 '''loop_statement : K_forever statement_or_null '''
1751 print('loop_statement_3', list(p
))
1754 # { PForever*tmp = new PForever(p[2]);
1755 # FILE_NAME(tmp, @1);
1761 def p_loop_statement_4(p
):
1762 '''loop_statement : K_repeat '(' expression ')' statement_or_null '''
1764 print('loop_statement_4', list(p
))
1767 # { PRepeat*tmp = new PRepeat(p[3], p[5]);
1768 # FILE_NAME(tmp, @1);
1774 def p_loop_statement_5(p
):
1775 '''loop_statement : K_while '(' expression ')' statement_or_null '''
1777 print('loop_statement_5', list(p
))
1780 # { PWhile*tmp = new PWhile(p[3], p[5]);
1781 # FILE_NAME(tmp, @1);
1787 def p_loop_statement_6(p
):
1788 '''loop_statement : K_do statement_or_null K_while '(' expression ')' ';' '''
1790 print('loop_statement_6', list(p
))
1793 # { PDoWhile*tmp = new PDoWhile(p[5], p[2]);
1794 # FILE_NAME(tmp, @1);
1800 def p_loop_statement_7(p
):
1801 '''loop_statement : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' _embed1_loop_statement statement_or_null '''
1803 print('loop_statement_7', list(p
))
1806 # { PForeach*tmp_for = pform_make_foreach(@1, p[3], p[5], p[9]);
1808 # pform_pop_scope();
1809 # vector<Statement*>tmp_for_list(1);
1810 # tmp_for_list[0] = tmp_for;
1811 # PBlock*tmp_blk = current_block_stack.top();
1812 # current_block_stack.pop();
1813 # tmp_blk->set_statement(tmp_for_list);
1819 def p_loop_statement_8(p
):
1820 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' error ')' statement_or_null '''
1822 print('loop_statement_8', list(p
))
1826 # yyerror(@1, "error: Error in for loop step assignment.");
1831 def p_loop_statement_9(p
):
1832 '''loop_statement : K_for '(' lpvalue '=' expression ';' error ';' for_step ')' statement_or_null '''
1834 print('loop_statement_9', list(p
))
1838 # yyerror(@1, "error: Error in for loop condition expression.");
1843 def p_loop_statement_10(p
):
1844 '''loop_statement : K_for '(' error ')' statement_or_null '''
1846 print('loop_statement_10', list(p
))
1850 # yyerror(@1, "error: Incomprehensible for loop.");
1855 def p_loop_statement_11(p
):
1856 '''loop_statement : K_while '(' error ')' statement_or_null '''
1858 print('loop_statement_11', list(p
))
1862 # yyerror(@1, "error: Error in while loop condition.");
1867 def p_loop_statement_12(p
):
1868 '''loop_statement : K_do statement_or_null K_while '(' error ')' ';' '''
1870 print('loop_statement_12', list(p
))
1874 # yyerror(@1, "error: Error in do/while loop condition.");
1879 def p_loop_statement_13(p
):
1880 '''loop_statement : K_foreach '(' IDENTIFIER '[' error ']' ')' statement_or_null '''
1882 print('loop_statement_13', list(p
))
1886 # yyerror(@4, "error: Errors in foreach loop variables list.");
1891 def p__embed0_loop_statement(p
):
1892 '''_embed0_loop_statement : '''
1895 # { static unsigned for_counter = 0;
1896 # char for_block_name [64];
1897 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_for_loop%u", for_counter);
1899 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1900 # FILE_NAME(tmp, @1);
1901 # current_block_stack.push(tmp);
1903 # list<decl_assignment_t*>assign_list;
1904 # decl_assignment_t*tmp_assign = new decl_assignment_t;
1905 # tmp_assign->name = lex_strings.make(p[4]);
1906 # assign_list.push_back(tmp_assign);
1907 # pform_makewire(@4, 0, str_strength, &assign_list, NetNet::REG, p[3]);
1912 def p__embed1_loop_statement(p
):
1913 '''_embed1_loop_statement : '''
1916 # { static unsigned foreach_counter = 0;
1917 # char for_block_name[64];
1918 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_foreach%u", foreach_counter);
1919 # foreach_counter += 1;
1921 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1922 # FILE_NAME(tmp, @1);
1923 # current_block_stack.push(tmp);
1925 # pform_make_foreach_declarations(@1, p[5]);
1930 def p_list_of_variable_decl_assignments_1(p
):
1931 '''list_of_variable_decl_assignments : variable_decl_assignment '''
1933 print('list_of_variable_decl_assignments_1', list(p
))
1936 # { list<decl_assignment_t*>*tmp = new list<decl_assignment_t*>;
1937 # tmp->push_back(p[1]);
1943 def p_list_of_variable_decl_assignments_2(p
):
1944 '''list_of_variable_decl_assignments : list_of_variable_decl_assignments ',' variable_decl_assignment '''
1946 print('list_of_variable_decl_assignments_2', list(p
))
1949 # { list<decl_assignment_t*>*tmp = p[1];
1950 # tmp->push_back(p[3]);
1956 def p_variable_decl_assignment_1(p
):
1957 '''variable_decl_assignment : IDENTIFIER dimensions_opt '''
1959 print('variable_decl_assignment_1', list(p
))
1962 # { decl_assignment_t*tmp = new decl_assignment_t;
1963 # tmp->name = lex_strings.make(p[1]);
1965 # tmp->index = *p[2];
1974 def p_variable_decl_assignment_2(p
):
1975 '''variable_decl_assignment : IDENTIFIER '=' expression '''
1977 print('variable_decl_assignment_2', list(p
))
1980 # { decl_assignment_t*tmp = new decl_assignment_t;
1981 # tmp->name = lex_strings.make(p[1]);
1982 # tmp->expr .reset(p[3]);
1989 def p_variable_decl_assignment_3(p
):
1990 '''variable_decl_assignment : IDENTIFIER '=' K_new '(' ')' '''
1992 print('variable_decl_assignment_3', list(p
))
1995 # { decl_assignment_t*tmp = new decl_assignment_t;
1996 # tmp->name = lex_strings.make(p[1]);
1997 # PENewClass*expr = new PENewClass;
1998 # FILE_NAME(expr, @3);
1999 # tmp->expr .reset(expr);
2006 def p_loop_variables_1(p
):
2007 '''loop_variables : loop_variables ',' IDENTIFIER '''
2009 print('loop_variables_1', list(p
))
2012 # { list<perm_string>*tmp = p[1];
2013 # tmp->push_back(lex_strings.make(p[3]));
2020 def p_loop_variables_2(p
):
2021 '''loop_variables : IDENTIFIER '''
2023 print('loop_variables_2', list(p
))
2026 # { list<perm_string>*tmp = new list<perm_string>;
2027 # tmp->push_back(lex_strings.make(p[1]));
2034 def p_method_qualifier_1(p
):
2035 '''method_qualifier : K_virtual '''
2037 print('method_qualifier_1', list(p
))
2043 def p_method_qualifier_2(p
):
2044 '''method_qualifier : class_item_qualifier '''
2046 print('method_qualifier_2', list(p
))
2052 def p_method_qualifier_opt_1(p
):
2053 '''method_qualifier_opt : method_qualifier '''
2055 print('method_qualifier_opt_1', list(p
))
2061 def p_method_qualifier_opt_2(p
):
2062 '''method_qualifier_opt : '''
2064 print('method_qualifier_opt_2', list(p
))
2070 def p_modport_declaration_1(p
):
2071 '''modport_declaration : K_modport _embed0_modport_declaration modport_item_list ';' '''
2073 print('modport_declaration_1', list(p
))
2079 def p__embed0_modport_declaration(p
):
2080 '''_embed0_modport_declaration : '''
2083 # { if (!pform_in_interface())
2084 # yyerror(@1, "error: modport declarations are only allowed "
2085 # "in interfaces.");
2090 def p_modport_item_list_1(p
):
2091 '''modport_item_list : modport_item '''
2093 print('modport_item_list_1', list(p
))
2099 def p_modport_item_list_2(p
):
2100 '''modport_item_list : modport_item_list ',' modport_item '''
2102 print('modport_item_list_2', list(p
))
2108 def p_modport_item_1(p
):
2109 '''modport_item : IDENTIFIER _embed0_modport_item '(' modport_ports_list ')' '''
2111 print('modport_item_1', list(p
))
2114 # { pform_end_modport_item(@1); }
2118 def p__embed0_modport_item(p
):
2119 '''_embed0_modport_item : '''
2122 # { pform_start_modport_item(@1, p[1]); }
2126 def p_modport_ports_list_1(p
):
2127 '''modport_ports_list : modport_ports_declaration '''
2129 print('modport_ports_list_1', list(p
))
2135 def p_modport_ports_list_2(p
):
2136 '''modport_ports_list : modport_ports_list ',' modport_ports_declaration '''
2138 print('modport_ports_list_2', list(p
))
2144 def p_modport_ports_list_3(p
):
2145 '''modport_ports_list : modport_ports_list ',' modport_simple_port '''
2147 print('modport_ports_list_3', list(p
))
2150 # { if (last_modport_port.type == MP_SIMPLE) {
2151 # pform_add_modport_port(@3, last_modport_port.direction,
2152 # p[3]->name, p[3]->parm);
2154 # yyerror(@3, "error: modport expression not allowed here.");
2161 def p_modport_ports_list_4(p
):
2162 '''modport_ports_list : modport_ports_list ',' modport_tf_port '''
2164 print('modport_ports_list_4', list(p
))
2167 # { if (last_modport_port.type != MP_TF)
2168 # yyerror(@3, "error: task/function declaration not allowed here.");
2173 def p_modport_ports_list_5(p
):
2174 '''modport_ports_list : modport_ports_list ',' IDENTIFIER '''
2176 print('modport_ports_list_5', list(p
))
2179 # { if (last_modport_port.type == MP_SIMPLE) {
2180 # pform_add_modport_port(@3, last_modport_port.direction,
2181 # lex_strings.make(p[3]), 0);
2182 # } else if (last_modport_port.type != MP_TF) {
2183 # yyerror(@3, "error: list of identifiers not allowed here.");
2190 def p_modport_ports_list_6(p
):
2191 '''modport_ports_list : modport_ports_list ',' '''
2193 print('modport_ports_list_6', list(p
))
2196 # { yyerror(@2, "error: NULL port declarations are not allowed"); }
2200 def p_modport_ports_declaration_1(p
):
2201 '''modport_ports_declaration : attribute_list_opt port_direction IDENTIFIER '''
2203 print('modport_ports_declaration_1', list(p
))
2206 # { last_modport_port.type = MP_SIMPLE;
2207 # last_modport_port.direction = p[2];
2208 # pform_add_modport_port(@3, p[2], lex_strings.make(p[3]), 0);
2215 def p_modport_ports_declaration_2(p
):
2216 '''modport_ports_declaration : attribute_list_opt port_direction modport_simple_port '''
2218 print('modport_ports_declaration_2', list(p
))
2221 # { last_modport_port.type = MP_SIMPLE;
2222 # last_modport_port.direction = p[2];
2223 # pform_add_modport_port(@3, p[2], p[3]->name, p[3]->parm);
2230 def p_modport_ports_declaration_3(p
):
2231 '''modport_ports_declaration : attribute_list_opt import_export IDENTIFIER '''
2233 print('modport_ports_declaration_3', list(p
))
2236 # { last_modport_port.type = MP_TF;
2237 # last_modport_port.is_import = p[2];
2238 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
2245 def p_modport_ports_declaration_4(p
):
2246 '''modport_ports_declaration : attribute_list_opt import_export modport_tf_port '''
2248 print('modport_ports_declaration_4', list(p
))
2251 # { last_modport_port.type = MP_TF;
2252 # last_modport_port.is_import = p[2];
2253 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
2259 def p_modport_ports_declaration_5(p
):
2260 '''modport_ports_declaration : attribute_list_opt K_clocking IDENTIFIER '''
2262 print('modport_ports_declaration_5', list(p
))
2265 # { last_modport_port.type = MP_CLOCKING;
2266 # last_modport_port.direction = NetNet::NOT_A_PORT;
2267 # yyerror(@3, "sorry: modport clocking declaration is not yet supported.");
2274 def p_modport_simple_port_1(p
):
2275 '''modport_simple_port : '.' IDENTIFIER '(' expression ')' '''
2277 print('modport_simple_port_1', list(p
))
2280 # { named_pexpr_t*tmp = new named_pexpr_t;
2281 # tmp->name = lex_strings.make(p[2]);
2289 def p_modport_tf_port_1(p
):
2290 '''modport_tf_port : K_task IDENTIFIER '''
2292 print('modport_tf_port_1', list(p
))
2298 def p_modport_tf_port_2(p
):
2299 '''modport_tf_port : K_task IDENTIFIER '(' tf_port_list_opt ')' '''
2301 print('modport_tf_port_2', list(p
))
2307 def p_modport_tf_port_3(p
):
2308 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '''
2310 print('modport_tf_port_3', list(p
))
2316 def p_modport_tf_port_4(p
):
2317 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' '''
2319 print('modport_tf_port_4', list(p
))
2325 def p_non_integer_type_1(p
):
2326 '''non_integer_type : K_real '''
2328 print('non_integer_type_1', list(p
))
2331 # { p[0] = real_type_t::REAL; }
2335 def p_non_integer_type_2(p
):
2336 '''non_integer_type : K_realtime '''
2338 print('non_integer_type_2', list(p
))
2341 # { p[0] = real_type_t::REAL; }
2345 def p_non_integer_type_3(p
):
2346 '''non_integer_type : K_shortreal '''
2348 print('non_integer_type_3', list(p
))
2351 # { p[0] = real_type_t::SHORTREAL; }
2356 '''number : BASED_NUMBER '''
2358 print('number_1', list(p
))
2361 # { p[0] = p[1]; based_size = 0;}
2366 '''number : DEC_NUMBER '''
2368 print('number_2', list(p
))
2369 num
= Leaf(token
.NUMBER
, "%s" % (p
[1]))
2373 # { p[0] = p[1]; based_size = 0;}
2378 '''number : DEC_NUMBER BASED_NUMBER '''
2380 print('number_3', list(p
))
2381 num
= Leaf(token
.NUMBER
, "%s:%s" % (p
[1], p
[2]))
2385 # { p[0] = pform_verinum_with_size(p[1],p[2], @2.text, @2.first_line);
2391 '''number : UNBASED_NUMBER '''
2393 print('number_4', list(p
))
2396 # { p[0] = p[1]; based_size = 0;}
2401 '''number : DEC_NUMBER UNBASED_NUMBER '''
2403 print('number_5', list(p
))
2406 # { yyerror(@1, "error: Unbased SystemVerilog literal cannot have "
2408 # p[0] = p[1]; based_size = 0;}
2412 def p_open_range_list_1(p
):
2413 '''open_range_list : open_range_list ',' value_range '''
2415 print('open_range_list_1', list(p
))
2421 def p_open_range_list_2(p
):
2422 '''open_range_list : value_range '''
2424 print('open_range_list_2', list(p
))
2430 def p_package_declaration_1(p
):
2431 '''package_declaration : K_package lifetime_opt IDENTIFIER ';' _embed0_package_declaration timeunits_declaration_opt _embed1_package_declaration package_item_list_opt K_endpackage endlabel_opt '''
2433 print('package_declaration_1', list(p
))
2436 # { pform_end_package_declaration(@1);
2437 # // If an end label is present make sure it match the package name.
2439 # if (strcmp(p[3],p[10]) != 0) {
2440 # yyerror(@10, "error: End label doesn't match package name");
2449 def p__embed0_package_declaration(p
):
2450 '''_embed0_package_declaration : '''
2453 # { pform_start_package_declaration(@1, p[3], p[2]); }
2457 def p__embed1_package_declaration(p
):
2458 '''_embed1_package_declaration : '''
2461 # { pform_set_scope_timescale(@1); }
2465 def p_module_package_import_list_opt_1(p
):
2466 '''module_package_import_list_opt : '''
2467 if(parse_debug
> 1):
2468 print('module_package_import_list_opt_1', list(p
))
2474 def p_module_package_import_list_opt_2(p
):
2475 '''module_package_import_list_opt : package_import_list '''
2477 print('module_package_import_list_opt_2', list(p
))
2483 def p_package_import_list_1(p
):
2484 '''package_import_list : package_import_declaration '''
2486 print('package_import_list_1', list(p
))
2492 def p_package_import_list_2(p
):
2493 '''package_import_list : package_import_list package_import_declaration '''
2495 print('package_import_list_2', list(p
))
2501 def p_package_import_declaration_1(p
):
2502 '''package_import_declaration : K_import package_import_item_list ';' '''
2504 print('package_import_declaration_1', list(p
))
2511 def p_package_import_item_1(p
):
2512 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '''
2514 print('package_import_item_1', list(p
))
2517 # { pform_package_import(@2, p[1], p[3]);
2523 def p_package_import_item_2(p
):
2524 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES '*' '''
2526 print('package_import_item_2', list(p
))
2529 # { pform_package_import(@2, p[1], 0);
2534 def p_package_import_item_list_1(p
):
2535 '''package_import_item_list : package_import_item_list ',' package_import_item '''
2537 print('package_import_item_list_1', list(p
))
2543 def p_package_import_item_list_2(p
):
2544 '''package_import_item_list : package_import_item '''
2546 print('package_import_item_list_2', list(p
))
2552 def p_package_item_1(p
):
2553 '''package_item : timeunits_declaration '''
2555 print('package_item_1', list(p
))
2561 def p_package_item_2(p
):
2562 '''package_item : K_parameter param_type parameter_assign_list ';' '''
2564 print('package_item_2', list(p
))
2570 def p_package_item_3(p
):
2571 '''package_item : K_localparam param_type localparam_assign_list ';' '''
2573 print('package_item_3', list(p
))
2579 def p_package_item_4(p
):
2580 '''package_item : type_declaration '''
2582 print('package_item_4', list(p
))
2588 def p_package_item_5(p
):
2589 '''package_item : function_declaration '''
2591 print('package_item_5', list(p
))
2597 def p_package_item_6(p
):
2598 '''package_item : task_declaration '''
2600 print('package_item_6', list(p
))
2606 def p_package_item_7(p
):
2607 '''package_item : data_declaration '''
2609 print('package_item_7', list(p
))
2615 def p_package_item_8(p
):
2616 '''package_item : class_declaration '''
2618 print('package_item_8', list(p
))
2624 def p_package_item_list_1(p
):
2625 '''package_item_list : package_item_list package_item '''
2627 print('package_item_list_1', list(p
))
2633 def p_package_item_list_2(p
):
2634 '''package_item_list : package_item '''
2636 print('package_item_list_2', list(p
))
2642 def p_package_item_list_opt_1(p
):
2643 '''package_item_list_opt : package_item_list '''
2645 print('package_item_list_opt_1', list(p
))
2651 def p_package_item_list_opt_2(p
):
2652 '''package_item_list_opt : '''
2654 print('package_item_list_opt_2', list(p
))
2660 def p_port_direction_1(p
):
2661 '''port_direction : K_input '''
2663 print('port_direction_1', list(p
))
2666 # { p[0] = NetNet::PINPUT; }
2670 def p_port_direction_2(p
):
2671 '''port_direction : K_output '''
2673 print('port_direction_2', list(p
))
2676 # { p[0] = NetNet::POUTPUT; }
2680 def p_port_direction_3(p
):
2681 '''port_direction : K_inout '''
2683 print('port_direction_3', list(p
))
2686 # { p[0] = NetNet::PINOUT; }
2690 def p_port_direction_4(p
):
2691 '''port_direction : K_ref '''
2693 print('port_direction_4', list(p
))
2696 # { p[0] = NetNet::PREF;
2697 # if (!gn_system_verilog()) {
2698 # yyerror(@1, "error: Reference ports (ref) require SystemVerilog.");
2699 # p[0] = NetNet::PINPUT;
2705 def p_port_direction_opt_1(p
):
2706 '''port_direction_opt : port_direction '''
2708 print('port_direction_opt_1', list(p
))
2715 def p_port_direction_opt_2(p
):
2716 '''port_direction_opt : '''
2718 print('port_direction_opt_2', list(p
))
2721 # { p[0] = NetNet::PIMPLICIT; }
2725 def p_property_expr_1(p
):
2726 '''property_expr : expression '''
2728 print('property_expr_1', list(p
))
2734 def p_procedural_assertion_statement_1(p
):
2735 '''procedural_assertion_statement : K_assert '(' expression ')' statement %prec less_than_K_else '''
2737 print('procedural_assertion_statement_1', list(p
))
2740 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2746 def p_procedural_assertion_statement_2(p
):
2747 '''procedural_assertion_statement : K_assert '(' expression ')' K_else statement '''
2749 print('procedural_assertion_statement_2', list(p
))
2752 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2758 def p_procedural_assertion_statement_3(p
):
2759 '''procedural_assertion_statement : K_assert '(' expression ')' statement K_else statement '''
2761 print('procedural_assertion_statement_3', list(p
))
2764 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2770 def p_property_qualifier_1(p
):
2771 '''property_qualifier : class_item_qualifier '''
2773 print('property_qualifier_1', list(p
))
2779 def p_property_qualifier_2(p
):
2780 '''property_qualifier : random_qualifier '''
2782 print('property_qualifier_2', list(p
))
2788 def p_property_qualifier_opt_1(p
):
2789 '''property_qualifier_opt : property_qualifier_list '''
2791 print('property_qualifier_opt_1', list(p
))
2798 def p_property_qualifier_opt_2(p
):
2799 '''property_qualifier_opt : '''
2801 print('property_qualifier_opt_2', list(p
))
2804 # { p[0] = property_qualifier_t::make_none(); }
2808 def p_property_qualifier_list_1(p
):
2809 '''property_qualifier_list : property_qualifier_list property_qualifier '''
2811 print('property_qualifier_list_1', list(p
))
2814 # { p[0] = p[1] | p[2]; }
2818 def p_property_qualifier_list_2(p
):
2819 '''property_qualifier_list : property_qualifier '''
2821 print('property_qualifier_list_2', list(p
))
2828 def p_property_spec_1(p
):
2829 '''property_spec : clocking_event_opt property_spec_disable_iff_opt property_expr '''
2831 print('property_spec_1', list(p
))
2837 def p_property_spec_disable_iff_opt_1(p
):
2838 '''property_spec_disable_iff_opt : K_disable K_iff '(' expression ')' '''
2840 print('property_spec_disable_iff_opt_1', list(p
))
2846 def p_property_spec_disable_iff_opt_2(p
):
2847 '''property_spec_disable_iff_opt : '''
2849 print('property_spec_disable_iff_opt_2', list(p
))
2855 def p_random_qualifier_1(p
):
2856 '''random_qualifier : K_rand '''
2858 print('random_qualifier_1', list(p
))
2861 # { p[0] = property_qualifier_t::make_rand(); }
2865 def p_random_qualifier_2(p
):
2866 '''random_qualifier : K_randc '''
2868 print('random_qualifier_2', list(p
))
2871 # { p[0] = property_qualifier_t::make_randc(); }
2875 def p_real_or_realtime_1(p
):
2876 '''real_or_realtime : K_real '''
2878 print('real_or_realtime_1', list(p
))
2884 def p_real_or_realtime_2(p
):
2885 '''real_or_realtime : K_realtime '''
2887 print('real_or_realtime_2', list(p
))
2894 '''signing : K_signed '''
2896 print('signing_1', list(p
))
2904 '''signing : K_unsigned '''
2906 print('signing_2', list(p
))
2913 def p_simple_type_or_string_1(p
):
2914 '''simple_type_or_string : integer_vector_type '''
2916 print('simple_type_or_string_1', list(p
))
2919 # { ivl_variable_type_t use_vtype = p[1];
2920 # bool reg_flag = false;
2921 # if (use_vtype == IVL_VT_NO_TYPE) {
2922 # use_vtype = IVL_VT_LOGIC;
2925 # vector_type_t*tmp = new vector_type_t(use_vtype, false, 0);
2926 # tmp->reg_flag = reg_flag;
2927 # FILE_NAME(tmp, @1);
2933 def p_simple_type_or_string_2(p
):
2934 '''simple_type_or_string : non_integer_type '''
2936 print('simple_type_or_string_2', list(p
))
2939 # { real_type_t*tmp = new real_type_t(p[1]);
2940 # FILE_NAME(tmp, @1);
2946 def p_simple_type_or_string_3(p
):
2947 '''simple_type_or_string : atom2_type '''
2949 print('simple_type_or_string_3', list(p
))
2952 # { atom2_type_t*tmp = new atom2_type_t(p[1], true);
2953 # FILE_NAME(tmp, @1);
2959 def p_simple_type_or_string_4(p
):
2960 '''simple_type_or_string : K_integer '''
2962 print('simple_type_or_string_4', list(p
))
2965 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
2966 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd);
2967 # tmp->reg_flag = true;
2968 # tmp->integer_flag = true;
2974 def p_simple_type_or_string_5(p
):
2975 '''simple_type_or_string : K_time '''
2977 print('simple_type_or_string_5', list(p
))
2980 # { list<pform_range_t>*pd = make_range_from_width(64);
2981 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
2982 # tmp->reg_flag = !gn_system_verilog();
2988 def p_simple_type_or_string_6(p
):
2989 '''simple_type_or_string : TYPE_IDENTIFIER '''
2991 print('simple_type_or_string_6', list(p
))
2994 # { p[0] = p[1].type;
2995 # delete[]p[1].text;
3000 def p_simple_type_or_string_7(p
):
3001 '''simple_type_or_string : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_simple_type_or_string TYPE_IDENTIFIER '''
3003 print('simple_type_or_string_7', list(p
))
3006 # { lex_in_package_scope(0);
3008 # delete[]p[4].text;
3013 def p_simple_type_or_string_8(p
):
3014 '''simple_type_or_string : K_string '''
3016 print('simple_type_or_string_8', list(p
))
3019 # { string_type_t*tmp = new string_type_t;
3020 # FILE_NAME(tmp, @1);
3026 def p__embed0_simple_type_or_string(p
):
3027 '''_embed0_simple_type_or_string : '''
3030 # { lex_in_package_scope(p[1]); }
3034 def p_statement_1(p
):
3035 '''statement : attribute_list_opt statement_item '''
3037 print('statement_1', list(p
))
3039 # { pform_bind_attributes(p[2]->attributes, p[1]);
3046 def p_statement_or_null_1(p
):
3047 '''statement_or_null : statement '''
3049 print('statement_or_null_1', list(p
))
3056 def p_statement_or_null_2(p
):
3057 '''statement_or_null : attribute_list_opt ';' '''
3059 print('statement_or_null_2', list(p
))
3061 raise(Exception("p_statement_or_null_2"))
3068 def p_stream_expression_1(p
):
3069 '''stream_expression : expression '''
3071 print('stream_expression_1', list(p
))
3077 def p_stream_expression_list_1(p
):
3078 '''stream_expression_list : stream_expression_list ',' stream_expression '''
3080 print('stream_expression_list_1', list(p
))
3086 def p_stream_expression_list_2(p
):
3087 '''stream_expression_list : stream_expression '''
3089 print('stream_expression_list_2', list(p
))
3095 def p_stream_operator_1(p
):
3096 '''stream_operator : K_LS '''
3098 print('stream_operator_1', list(p
))
3104 def p_stream_operator_2(p
):
3105 '''stream_operator : K_RS '''
3107 print('stream_operator_2', list(p
))
3113 def p_streaming_concatenation_1(p
):
3114 '''streaming_concatenation : '{' stream_operator '{' stream_expression_list '}' '}' '''
3116 print('streaming_concatenation_1', list(p
))
3119 # { /* streaming concatenation is a SystemVerilog thing. */
3120 # if (gn_system_verilog()) {
3121 # yyerror(@2, "sorry: Streaming concatenation not supported.");
3124 # yyerror(@2, "error: Streaming concatenation requires SystemVerilog");
3131 def p_task_declaration_1(p
):
3132 '''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 '''
3134 print('task_declaration_1', list(p
))
3137 # { // Last step: check any closing name. This is done late so
3138 # // that the parser can look ahead to detect the present
3139 # // endlabel_opt but still have the pform_endmodule() called
3140 # // early enough that the lexor can know we are outside the
3143 # if (strcmp(p[3],p[10]) != 0) {
3144 # yyerror(@10, "error: End label doesn't match task name");
3146 # if (! gn_system_verilog()) {
3147 # yyerror(@10, "error: Task end labels require "
3148 # "SystemVerilog.");
3157 def p_task_declaration_2(p
):
3158 '''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 '''
3160 print('task_declaration_2', list(p
))
3163 # { // Last step: check any closing name. This is done late so
3164 # // that the parser can look ahead to detect the present
3165 # // endlabel_opt but still have the pform_endmodule() called
3166 # // early enough that the lexor can know we are outside the
3169 # if (strcmp(p[3],p[13]) != 0) {
3170 # yyerror(@13, "error: End label doesn't match task name");
3172 # if (! gn_system_verilog()) {
3173 # yyerror(@13, "error: Task end labels require "
3174 # "SystemVerilog.");
3183 def p_task_declaration_3(p
):
3184 '''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 '''
3186 print('task_declaration_3', list(p
))
3189 # { // Last step: check any closing name. This is done late so
3190 # // that the parser can look ahead to detect the present
3191 # // endlabel_opt but still have the pform_endmodule() called
3192 # // early enough that the lexor can know we are outside the
3195 # if (strcmp(p[3],p[12]) != 0) {
3196 # yyerror(@12, "error: End label doesn't match task name");
3198 # if (! gn_system_verilog()) {
3199 # yyerror(@12, "error: Task end labels require "
3200 # "SystemVerilog.");
3209 def p_task_declaration_4(p
):
3210 '''task_declaration : K_task lifetime_opt IDENTIFIER error K_endtask _embed6_task_declaration endlabel_opt '''
3212 print('task_declaration_4', list(p
))
3215 # { // Last step: check any closing name. This is done late so
3216 # // that the parser can look ahead to detect the present
3217 # // endlabel_opt but still have the pform_endmodule() called
3218 # // early enough that the lexor can know we are outside the
3221 # if (strcmp(p[3],p[7]) != 0) {
3222 # yyerror(@7, "error: End label doesn't match task name");
3224 # if (! gn_system_verilog()) {
3225 # yyerror(@7, "error: Task end labels require "
3226 # "SystemVerilog.");
3235 def p__embed0_task_declaration(p
):
3236 '''_embed0_task_declaration : '''
3239 # { assert(current_task == 0);
3240 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3245 def p__embed1_task_declaration(p
):
3246 '''_embed1_task_declaration : '''
3249 # { current_task->set_ports(p[6]);
3250 # current_task_set_statement(@3, p[7]);
3251 # pform_set_this_class(@3, current_task);
3252 # pform_pop_scope();
3254 # if (p[7] && p[7]->size() > 1 && !gn_system_verilog()) {
3255 # yyerror(@7, "error: Task body with multiple statements requires SystemVerilog.");
3262 def p__embed2_task_declaration(p
):
3263 '''_embed2_task_declaration : '''
3266 # { assert(current_task == 0);
3267 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3272 def p__embed3_task_declaration(p
):
3273 '''_embed3_task_declaration : '''
3276 # { current_task->set_ports(p[6]);
3277 # current_task_set_statement(@3, p[10]);
3278 # pform_set_this_class(@3, current_task);
3279 # pform_pop_scope();
3281 # if (p[10]) delete p[10];
3286 def p__embed4_task_declaration(p
):
3287 '''_embed4_task_declaration : '''
3290 # { assert(current_task == 0);
3291 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3296 def p__embed5_task_declaration(p
):
3297 '''_embed5_task_declaration : '''
3300 # { current_task->set_ports(0);
3301 # current_task_set_statement(@3, p[9]);
3302 # pform_set_this_class(@3, current_task);
3303 # if (! current_task->method_of()) {
3304 # cerr << @3 << ": warning: task definition for \"" << p[3]
3305 # << "\" has an empty port declaration list!" << endl;
3307 # pform_pop_scope();
3309 # if (p[9]->size() > 1 && !gn_system_verilog()) {
3310 # yyerror(@9, "error: Task body with multiple statements requires SystemVerilog.");
3317 def p__embed6_task_declaration(p
):
3318 '''_embed6_task_declaration : '''
3322 # if (current_task) {
3323 # pform_pop_scope();
3330 def p_tf_port_declaration_1(p
):
3331 '''tf_port_declaration : port_direction K_reg_opt unsigned_signed_opt dimensions_opt list_of_identifiers ';' '''
3333 print('tf_port_declaration_1', list(p
))
3336 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1],
3337 # p[2] ? IVL_VT_LOGIC :
3339 # p[3], p[4], p[5]);
3345 def p_tf_port_declaration_2(p
):
3346 '''tf_port_declaration : port_direction K_integer list_of_identifiers ';' '''
3348 print('tf_port_declaration_2', list(p
))
3351 # { list<pform_range_t>*range_stub = make_range_from_width(integer_width);
3352 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, true,
3353 # range_stub, p[3], true);
3359 def p_tf_port_declaration_3(p
):
3360 '''tf_port_declaration : port_direction K_time list_of_identifiers ';' '''
3362 print('tf_port_declaration_3', list(p
))
3365 # { list<pform_range_t>*range_stub = make_range_from_width(64);
3366 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, false,
3367 # range_stub, p[3]);
3373 def p_tf_port_declaration_4(p
):
3374 '''tf_port_declaration : port_direction real_or_realtime list_of_identifiers ';' '''
3376 print('tf_port_declaration_4', list(p
))
3379 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_REAL, true,
3386 def p_tf_port_declaration_5(p
):
3387 '''tf_port_declaration : port_direction K_string list_of_identifiers ';' '''
3389 print('tf_port_declaration_5', list(p
))
3392 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_STRING, true,
3399 def p_tf_port_item_1(p
):
3400 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER dimensions_opt tf_port_item_expr_opt '''
3402 print('tf_port_item_1', list(p
))
3405 # { vector<pform_tf_port_t>*tmp;
3406 # NetNet::PortType use_port_type = p[1];
3407 # if ((use_port_type == NetNet::PIMPLICIT) && (gn_system_verilog() || (p[2] == 0)))
3408 # use_port_type = port_declaration_context.port_type;
3409 # perm_string name = lex_strings.make(p[3]);
3410 # list<perm_string>* ilist = list_from_identifier(p[3]);
3412 # if (use_port_type == NetNet::PIMPLICIT) {
3413 # yyerror(@1, "error: missing task/function port direction.");
3414 # use_port_type = NetNet::PINPUT; // for error recovery
3416 # if ((p[2] == 0) && (p[1]==NetNet::PIMPLICIT)) {
3417 # // Detect special case this is an undecorated
3418 # // identifier and we need to get the declaration from
3421 # yyerror(@4, "internal error: How can there be an unpacked range here?\n");
3423 # tmp = pform_make_task_ports(@3, use_port_type,
3424 # port_declaration_context.data_type,
3428 # // Otherwise, the decorations for this identifier
3429 # // indicate the type. Save the type for any right
3430 # // context that may come later.
3431 # port_declaration_context.port_type = use_port_type;
3433 # p[2] = new vector_type_t(IVL_VT_LOGIC, false, 0);
3434 # FILE_NAME(p[2], @3);
3436 # port_declaration_context.data_type = p[2];
3437 # tmp = pform_make_task_ports(@3, use_port_type, p[2], ilist);
3440 # pform_set_reg_idx(name, p[4]);
3445 # assert(tmp->size()==1);
3446 # tmp->front().defe = p[5];
3452 def p_tf_port_item_2(p
):
3453 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER error '''
3455 print('tf_port_item_2', list(p
))
3458 # { yyerror(@3, "error: Error in task/function port item after port name %s.", p[3]);
3465 def p_tf_port_item_expr_opt_1(p
):
3466 '''tf_port_item_expr_opt : '=' expression '''
3468 print('tf_port_item_expr_opt_1', list(p
))
3471 # { if (! gn_system_verilog()) {
3472 # yyerror(@1, "error: Task/function default arguments require "
3473 # "SystemVerilog.");
3480 def p_tf_port_item_expr_opt_2(p
):
3481 '''tf_port_item_expr_opt : '''
3483 print('tf_port_item_expr_opt_2', list(p
))
3490 def p_tf_port_list_1(p
):
3491 '''tf_port_list : _embed0_tf_port_list tf_port_item_list '''
3493 print('tf_port_list_1', list(p
))
3500 def p__embed0_tf_port_list(p
):
3501 '''_embed0_tf_port_list : '''
3504 # { port_declaration_context.port_type = gn_system_verilog() ? NetNet::PINPUT : NetNet::PIMPLICIT;
3505 # port_declaration_context.data_type = 0;
3510 def p_tf_port_item_list_1(p
):
3511 '''tf_port_item_list : tf_port_item_list ',' tf_port_item '''
3513 print('tf_port_item_list_1', list(p
))
3516 # { vector<pform_tf_port_t>*tmp;
3517 # if (p[1] && p[3]) {
3518 # size_t s1 = p[1]->size();
3520 # tmp->resize(tmp->size()+p[3]->size());
3521 # for (size_t idx = 0 ; idx < p[3]->size() ; idx += 1)
3522 # tmp->at(s1+idx) = p[3]->at(idx);
3524 # } else if (p[1]) {
3534 def p_tf_port_item_list_2(p
):
3535 '''tf_port_item_list : tf_port_item '''
3537 print('tf_port_item_list_2', list(p
))
3544 def p_tf_port_item_list_3(p
):
3545 '''tf_port_item_list : error ',' tf_port_item '''
3547 print('tf_port_item_list_3', list(p
))
3550 # { yyerror(@2, "error: Syntax error in task/function port declaration.");
3556 def p_tf_port_item_list_4(p
):
3557 '''tf_port_item_list : tf_port_item_list ',' '''
3559 print('tf_port_item_list_4', list(p
))
3562 # { yyerror(@2, "error: NULL port declarations are not allowed.");
3568 def p_tf_port_item_list_5(p
):
3569 '''tf_port_item_list : tf_port_item_list ';' '''
3571 print('tf_port_item_list_5', list(p
))
3574 # { yyerror(@2, "error: ';' is an invalid port declaration separator.");
3580 def p_timeunits_declaration_1(p
):
3581 '''timeunits_declaration : K_timeunit TIME_LITERAL ';' '''
3583 print('timeunits_declaration_1', list(p
))
3586 # { pform_set_timeunit(p[2], allow_timeunit_decl); }
3590 def p_timeunits_declaration_2(p
):
3591 '''timeunits_declaration : K_timeunit TIME_LITERAL '/' TIME_LITERAL ';' '''
3593 print('timeunits_declaration_2', list(p
))
3596 # { bool initial_decl = allow_timeunit_decl && allow_timeprec_decl;
3597 # pform_set_timeunit(p[2], initial_decl);
3598 # pform_set_timeprec(p[4], initial_decl);
3603 def p_timeunits_declaration_3(p
):
3604 '''timeunits_declaration : K_timeprecision TIME_LITERAL ';' '''
3606 print('timeunits_declaration_3', list(p
))
3609 # { pform_set_timeprec(p[2], allow_timeprec_decl); }
3613 def p_timeunits_declaration_opt_1(p
):
3614 '''timeunits_declaration_opt : %prec no_timeunits_declaration '''
3615 if(parse_debug
> 2):
3616 print('timeunits_declaration_opt_1', list(p
))
3622 def p_timeunits_declaration_opt_2(p
):
3623 '''timeunits_declaration_opt : timeunits_declaration %prec one_timeunits_declaration '''
3625 print('timeunits_declaration_opt_2', list(p
))
3631 def p_timeunits_declaration_opt_3(p
):
3632 '''timeunits_declaration_opt : timeunits_declaration timeunits_declaration '''
3634 print('timeunits_declaration_opt_3', list(p
))
3640 def p_value_range_1(p
):
3641 '''value_range : expression '''
3643 print('value_range_1', list(p
))
3650 def p_value_range_2(p
):
3651 '''value_range : '[' expression ':' expression ']' '''
3653 print('value_range_2', list(p
))
3660 def p_variable_dimension_1(p
):
3661 '''variable_dimension : '[' expression ':' expression ']' '''
3663 print('variable_dimension_1', list(p
))
3664 # { list<pform_range_t> *tmp = new list<pform_range_t>;
3665 # pform_range_t index (p[2],p[4]);
3666 # tmp->push_back(index);
3669 # XXX TODO: subscriptlist
3672 if end
.endswith("-1"):
3675 end
= str(int(end
)+1)
3678 p
[0] = '[%s:%s]' % (start
, end
) # python slice is LO:HI+1
3684 def p_variable_dimension_2(p
):
3685 '''variable_dimension : '[' expression ']' '''
3687 print('variable_dimension_2', list(p
))
3690 # { // SystemVerilog canonical range
3691 # if (!gn_system_verilog()) {
3693 # cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. "
3694 # << "Use at least -g2005-sv to remove this warning." << endl;
3696 # list<pform_range_t> *tmp = new list<pform_range_t>;
3697 # pform_range_t index;
3698 # index.first = new PENumber(new verinum((uint64_t)0, integer_width));
3699 # index.second = new PEBinary('-', p[2], new PENumber(new verinum((uint64_t)1, integer_width)));
3700 # tmp->push_back(index);
3706 def p_variable_dimension_3(p
):
3707 '''variable_dimension : '[' ']' '''
3709 print('variable_dimension_3', list(p
))
3712 # { list<pform_range_t> *tmp = new list<pform_range_t>;
3713 # pform_range_t index (0,0);
3714 # tmp->push_back(index);
3720 def p_variable_dimension_4(p
):
3721 '''variable_dimension : '[' '$' ']' '''
3723 print('variable_dimension_4', list(p
))
3726 # { // SystemVerilog queue
3727 # list<pform_range_t> *tmp = new list<pform_range_t>;
3728 # pform_range_t index (new PENull,0);
3729 # if (!gn_system_verilog()) {
3730 # yyerror("error: Queue declarations require SystemVerilog.");
3732 # tmp->push_back(index);
3738 def p_variable_lifetime_1(p
):
3739 '''variable_lifetime : lifetime '''
3741 print('variable_lifetime_1', list(p
))
3744 # { if (!gn_system_verilog()) {
3745 # yyerror(@1, "error: overriding the default variable lifetime "
3746 # "requires SystemVerilog.");
3747 # } else if (p[1] != pform_peek_scope()->default_lifetime) {
3748 # yyerror(@1, "sorry: overriding the default variable lifetime "
3749 # "is not yet supported.");
3751 # var_lifetime = p[1];
3756 def p_attribute_list_opt_1(p
):
3757 '''attribute_list_opt : attribute_instance_list '''
3759 print('attribute_list_opt_1', list(p
))
3766 def p_attribute_list_opt_2(p
):
3767 '''attribute_list_opt : '''
3768 if(parse_debug
> 2):
3769 print('attribute_list_opt_2', list(p
))
3776 def p_attribute_instance_list_1(p
):
3777 '''attribute_instance_list : K_PSTAR K_STARP '''
3779 print('attribute_instance_list_1', list(p
))
3786 def p_attribute_instance_list_2(p
):
3787 '''attribute_instance_list : K_PSTAR attribute_list K_STARP '''
3789 print('attribute_instance_list_2', list(p
))
3796 def p_attribute_instance_list_3(p
):
3797 '''attribute_instance_list : attribute_instance_list K_PSTAR K_STARP '''
3799 print('attribute_instance_list_3', list(p
))
3806 def p_attribute_instance_list_4(p
):
3807 '''attribute_instance_list : attribute_instance_list K_PSTAR attribute_list K_STARP '''
3809 print('attribute_instance_list_4', list(p
))
3812 # { list<named_pexpr_t>*tmp = p[1];
3814 # tmp->splice(tmp->end(), *p[3]);
3817 # } else p[0] = p[3];
3822 def p_attribute_list_1(p
):
3823 '''attribute_list : attribute_list ',' attribute '''
3825 print('attribute_list_1', list(p
))
3828 # { list<named_pexpr_t>*tmp = p[1];
3829 # tmp->push_back(*p[3]);
3836 def p_attribute_list_2(p
):
3837 '''attribute_list : attribute '''
3839 print('attribute_list_2', list(p
))
3842 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
3843 # tmp->push_back(*p[1]);
3850 def p_attribute_1(p
):
3851 '''attribute : IDENTIFIER '''
3853 print('attribute_1', list(p
))
3856 # { named_pexpr_t*tmp = new named_pexpr_t;
3857 # tmp->name = lex_strings.make(p[1]);
3865 def p_attribute_2(p
):
3866 '''attribute : IDENTIFIER '=' expression '''
3868 print('attribute_2', list(p
))
3871 # { PExpr*tmp = p[3];
3872 # named_pexpr_t*tmp2 = new named_pexpr_t;
3873 # tmp2->name = lex_strings.make(p[1]);
3881 def p_block_item_decl_1(p
):
3882 '''block_item_decl : data_type register_variable_list ';' '''
3884 print('block_item_decl_1', list(p
))
3887 # { if (p[1]) pform_set_data_type(@1, p[1], p[2], NetNet::REG, attributes_in_context);
3892 def p_block_item_decl_2(p
):
3893 '''block_item_decl : variable_lifetime data_type register_variable_list ';' '''
3895 print('block_item_decl_2', list(p
))
3898 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
3899 # var_lifetime = LexicalScope::INHERITED;
3904 def p_block_item_decl_3(p
):
3905 '''block_item_decl : K_reg data_type register_variable_list ';' '''
3907 print('block_item_decl_3', list(p
))
3910 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
3915 def p_block_item_decl_4(p
):
3916 '''block_item_decl : variable_lifetime K_reg data_type register_variable_list ';' '''
3918 print('block_item_decl_4', list(p
))
3921 # { if (p[3]) pform_set_data_type(@3, p[3], p[4], NetNet::REG, attributes_in_context);
3922 # var_lifetime = LexicalScope::INHERITED;
3927 def p_block_item_decl_5(p
):
3928 '''block_item_decl : K_event event_variable_list ';' '''
3930 print('block_item_decl_5', list(p
))
3933 # { if (p[2]) pform_make_events(p[2], @1.text, @1.first_line);
3938 def p_block_item_decl_6(p
):
3939 '''block_item_decl : K_parameter param_type parameter_assign_list ';' '''
3941 print('block_item_decl_6', list(p
))
3947 def p_block_item_decl_7(p
):
3948 '''block_item_decl : K_localparam param_type localparam_assign_list ';' '''
3950 print('block_item_decl_7', list(p
))
3956 def p_block_item_decl_8(p
):
3957 '''block_item_decl : type_declaration '''
3959 print('block_item_decl_8', list(p
))
3965 def p_block_item_decl_9(p
):
3966 '''block_item_decl : K_integer error ';' '''
3968 print('block_item_decl_9', list(p
))
3971 # { yyerror(@1, "error: syntax error in integer variable list.");
3977 def p_block_item_decl_10(p
):
3978 '''block_item_decl : K_time error ';' '''
3980 print('block_item_decl_10', list(p
))
3983 # { yyerror(@1, "error: syntax error in time variable list.");
3989 def p_block_item_decl_11(p
):
3990 '''block_item_decl : K_parameter error ';' '''
3992 print('block_item_decl_11', list(p
))
3995 # { yyerror(@1, "error: syntax error in parameter list.");
4001 def p_block_item_decl_12(p
):
4002 '''block_item_decl : K_localparam error ';' '''
4004 print('block_item_decl_12', list(p
))
4007 # { yyerror(@1, "error: syntax error localparam list.");
4013 def p_block_item_decls_1(p
):
4014 '''block_item_decls : block_item_decl '''
4016 print('block_item_decls_1', list(p
))
4022 def p_block_item_decls_2(p
):
4023 '''block_item_decls : block_item_decls block_item_decl '''
4025 print('block_item_decls_2', list(p
))
4031 def p_block_item_decls_opt_1(p
):
4032 '''block_item_decls_opt : block_item_decls '''
4034 print('block_item_decls_opt_1', list(p
))
4041 def p_block_item_decls_opt_2(p
):
4042 '''block_item_decls_opt : '''
4044 print('block_item_decls_opt_2', list(p
))
4051 def p_type_declaration_1(p
):
4052 '''type_declaration : K_typedef data_type IDENTIFIER dimensions_opt ';' '''
4054 print('type_declaration_1', list(p
))
4057 # { perm_string name = lex_strings.make(p[3]);
4058 # pform_set_typedef(name, p[2], p[4]);
4064 def p_type_declaration_2(p
):
4065 '''type_declaration : K_typedef data_type TYPE_IDENTIFIER ';' '''
4067 print('type_declaration_2', list(p
))
4070 # { perm_string name = lex_strings.make(p[3].text);
4071 # if (pform_test_type_identifier_local(name)) {
4072 # yyerror(@3, "error: Typedef identifier \"%s\" is already a type name.", p[3].text);
4075 # pform_set_typedef(name, p[2], NULL);
4077 # delete[]p[3].text;
4082 def p_type_declaration_3(p
):
4083 '''type_declaration : K_typedef K_class IDENTIFIER ';' '''
4085 print('type_declaration_3', list(p
))
4088 # { // Create a synthetic typedef for the class name so that the
4089 # // lexor detects the name as a type.
4090 # perm_string name = lex_strings.make(p[3]);
4091 # class_type_t*tmp = new class_type_t(name);
4092 # FILE_NAME(tmp, @3);
4093 # pform_set_typedef(name, tmp, NULL);
4099 def p_type_declaration_4(p
):
4100 '''type_declaration : K_typedef K_enum IDENTIFIER ';' '''
4102 print('type_declaration_4', list(p
))
4105 # { yyerror(@1, "sorry: Enum forward declarations not supported yet."); }
4109 def p_type_declaration_5(p
):
4110 '''type_declaration : K_typedef K_struct IDENTIFIER ';' '''
4112 print('type_declaration_5', list(p
))
4115 # { yyerror(@1, "sorry: Struct forward declarations not supported yet."); }
4119 def p_type_declaration_6(p
):
4120 '''type_declaration : K_typedef K_union IDENTIFIER ';' '''
4122 print('type_declaration_6', list(p
))
4125 # { yyerror(@1, "sorry: Union forward declarations not supported yet."); }
4129 def p_type_declaration_7(p
):
4130 '''type_declaration : K_typedef IDENTIFIER ';' '''
4132 print('type_declaration_7', list(p
))
4135 # { // Create a synthetic typedef for the class name so that the
4136 # // lexor detects the name as a type.
4137 # perm_string name = lex_strings.make(p[2]);
4138 # class_type_t*tmp = new class_type_t(name);
4139 # FILE_NAME(tmp, @2);
4140 # pform_set_typedef(name, tmp, NULL);
4146 def p_type_declaration_8(p
):
4147 '''type_declaration : K_typedef error ';' '''
4149 print('type_declaration_8', list(p
))
4152 # { yyerror(@2, "error: Syntax error in typedef clause.");
4158 def p_enum_data_type_1(p
):
4159 '''enum_data_type : K_enum '{' enum_name_list '}' '''
4161 print('enum_data_type_1', list(p
))
4164 # { enum_type_t*enum_type = new enum_type_t;
4165 # FILE_NAME(enum_type, @1);
4166 # enum_type->names .reset(p[3]);
4167 # enum_type->base_type = IVL_VT_BOOL;
4168 # enum_type->signed_flag = true;
4169 # enum_type->integer_flag = false;
4170 # enum_type->range.reset(make_range_from_width(32));
4176 def p_enum_data_type_2(p
):
4177 '''enum_data_type : K_enum atom2_type signed_unsigned_opt '{' enum_name_list '}' '''
4179 print('enum_data_type_2', list(p
))
4182 # { enum_type_t*enum_type = new enum_type_t;
4183 # FILE_NAME(enum_type, @1);
4184 # enum_type->names .reset(p[5]);
4185 # enum_type->base_type = IVL_VT_BOOL;
4186 # enum_type->signed_flag = p[3];
4187 # enum_type->integer_flag = false;
4188 # enum_type->range.reset(make_range_from_width(p[2]));
4194 def p_enum_data_type_3(p
):
4195 '''enum_data_type : K_enum K_integer signed_unsigned_opt '{' enum_name_list '}' '''
4197 print('enum_data_type_3', list(p
))
4200 # { enum_type_t*enum_type = new enum_type_t;
4201 # FILE_NAME(enum_type, @1);
4202 # enum_type->names .reset(p[5]);
4203 # enum_type->base_type = IVL_VT_LOGIC;
4204 # enum_type->signed_flag = p[3];
4205 # enum_type->integer_flag = true;
4206 # enum_type->range.reset(make_range_from_width(integer_width));
4212 def p_enum_data_type_4(p
):
4213 '''enum_data_type : K_enum K_logic unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
4215 print('enum_data_type_4', list(p
))
4218 # { enum_type_t*enum_type = new enum_type_t;
4219 # FILE_NAME(enum_type, @1);
4220 # enum_type->names .reset(p[6]);
4221 # enum_type->base_type = IVL_VT_LOGIC;
4222 # enum_type->signed_flag = p[3];
4223 # enum_type->integer_flag = false;
4224 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4230 def p_enum_data_type_5(p
):
4231 '''enum_data_type : K_enum K_reg unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
4233 print('enum_data_type_5', list(p
))
4236 # { enum_type_t*enum_type = new enum_type_t;
4237 # FILE_NAME(enum_type, @1);
4238 # enum_type->names .reset(p[6]);
4239 # enum_type->base_type = IVL_VT_LOGIC;
4240 # enum_type->signed_flag = p[3];
4241 # enum_type->integer_flag = false;
4242 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4248 def p_enum_data_type_6(p
):
4249 '''enum_data_type : K_enum K_bit unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
4251 print('enum_data_type_6', list(p
))
4254 # { enum_type_t*enum_type = new enum_type_t;
4255 # FILE_NAME(enum_type, @1);
4256 # enum_type->names .reset(p[6]);
4257 # enum_type->base_type = IVL_VT_BOOL;
4258 # enum_type->signed_flag = p[3];
4259 # enum_type->integer_flag = false;
4260 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4266 def p_enum_name_list_1(p
):
4267 '''enum_name_list : enum_name '''
4269 print('enum_name_list_1', list(p
))
4277 def p_enum_name_list_2(p
):
4278 '''enum_name_list : enum_name_list ',' enum_name '''
4280 print('enum_name_list_2', list(p
))
4283 # { list<named_pexpr_t>*lst = p[1];
4284 # lst->splice(lst->end(), *p[3]);
4291 def p_pos_neg_number_1(p
):
4292 '''pos_neg_number : number '''
4294 print('pos_neg_number_1', list(p
))
4302 def p_pos_neg_number_2(p
):
4303 '''pos_neg_number : '-' number '''
4305 print('pos_neg_number_2', list(p
))
4308 # { verinum tmp = -(*(p[2]));
4315 def p_enum_name_1(p
):
4316 '''enum_name : IDENTIFIER '''
4318 print('enum_name_1', list(p
))
4321 # { perm_string name = lex_strings.make(p[1]);
4323 # p[0] = make_named_number(name);
4328 def p_enum_name_2(p
):
4329 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '''
4331 print('enum_name_2', list(p
))
4334 # { perm_string name = lex_strings.make(p[1]);
4335 # long count = check_enum_seq_value(@1, p[3], false);
4337 # p[0] = make_named_numbers(name, 0, count-1);
4343 def p_enum_name_3(p
):
4344 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '''
4346 print('enum_name_3', list(p
))
4349 # { perm_string name = lex_strings.make(p[1]);
4350 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
4351 # check_enum_seq_value(@1, p[5], true));
4359 def p_enum_name_4(p
):
4360 '''enum_name : IDENTIFIER '=' expression '''
4362 print('enum_name_4', list(p
))
4365 # { perm_string name = lex_strings.make(p[1]);
4367 # p[0] = make_named_number(name, p[3]);
4372 def p_enum_name_5(p
):
4373 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '=' expression '''
4375 print('enum_name_5', list(p
))
4378 # { perm_string name = lex_strings.make(p[1]);
4379 # long count = check_enum_seq_value(@1, p[3], false);
4380 # p[0] = make_named_numbers(name, 0, count-1, p[6]);
4387 def p_enum_name_6(p
):
4388 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '=' expression '''
4390 print('enum_name_6', list(p
))
4393 # { perm_string name = lex_strings.make(p[1]);
4394 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
4395 # check_enum_seq_value(@1, p[5], true), p[8]);
4403 def p_struct_data_type_1(p
):
4404 '''struct_data_type : K_struct K_packed_opt '{' struct_union_member_list '}' '''
4406 print('struct_data_type_1', list(p
))
4409 # { struct_type_t*tmp = new struct_type_t;
4410 # FILE_NAME(tmp, @1);
4411 # tmp->packed_flag = p[2];
4412 # tmp->union_flag = false;
4413 # tmp->members .reset(p[4]);
4419 def p_struct_data_type_2(p
):
4420 '''struct_data_type : K_union K_packed_opt '{' struct_union_member_list '}' '''
4422 print('struct_data_type_2', list(p
))
4425 # { struct_type_t*tmp = new struct_type_t;
4426 # FILE_NAME(tmp, @1);
4427 # tmp->packed_flag = p[2];
4428 # tmp->union_flag = true;
4429 # tmp->members .reset(p[4]);
4435 def p_struct_data_type_3(p
):
4436 '''struct_data_type : K_struct K_packed_opt '{' error '}' '''
4438 print('struct_data_type_3', list(p
))
4441 # { yyerror(@3, "error: Errors in struct member list.");
4443 # struct_type_t*tmp = new struct_type_t;
4444 # FILE_NAME(tmp, @1);
4445 # tmp->packed_flag = p[2];
4446 # tmp->union_flag = false;
4452 def p_struct_data_type_4(p
):
4453 '''struct_data_type : K_union K_packed_opt '{' error '}' '''
4455 print('struct_data_type_4', list(p
))
4458 # { yyerror(@3, "error: Errors in union member list.");
4460 # struct_type_t*tmp = new struct_type_t;
4461 # FILE_NAME(tmp, @1);
4462 # tmp->packed_flag = p[2];
4463 # tmp->union_flag = true;
4469 def p_struct_union_member_list_1(p
):
4470 '''struct_union_member_list : struct_union_member_list struct_union_member '''
4472 print('struct_union_member_list_1', list(p
))
4475 # { list<struct_member_t*>*tmp = p[1];
4476 # tmp->push_back(p[2]);
4482 def p_struct_union_member_list_2(p
):
4483 '''struct_union_member_list : struct_union_member '''
4485 print('struct_union_member_list_2', list(p
))
4488 # { list<struct_member_t*>*tmp = new list<struct_member_t*>;
4489 # tmp->push_back(p[1]);
4495 def p_struct_union_member_1(p
):
4496 '''struct_union_member : attribute_list_opt data_type list_of_variable_decl_assignments ';' '''
4498 print('struct_union_member_1', list(p
))
4501 # { struct_member_t*tmp = new struct_member_t;
4502 # FILE_NAME(tmp, @2);
4503 # tmp->type .reset(p[2]);
4504 # tmp->names .reset(p[3]);
4510 def p_struct_union_member_2(p
):
4511 '''struct_union_member : error ';' '''
4513 print('struct_union_member_2', list(p
))
4516 # { yyerror(@2, "Error in struct/union member.");
4523 def p_case_item_1(p
):
4524 '''case_item : expression_list_proper ':' statement_or_null '''
4526 print('case_item_1', list(p
))
4529 # { PCase::Item*tmp = new PCase::Item;
4530 # tmp->expr = *p[1];
4538 def p_case_item_2(p
):
4539 '''case_item : K_default ':' statement_or_null '''
4541 print('case_item_2', list(p
))
4544 # { PCase::Item*tmp = new PCase::Item;
4551 def p_case_item_3(p
):
4552 '''case_item : K_default statement_or_null '''
4554 print('case_item_3', list(p
))
4557 # { PCase::Item*tmp = new PCase::Item;
4564 def p_case_item_4(p
):
4565 '''case_item : error ':' statement_or_null '''
4567 print('case_item_4', list(p
))
4570 # { yyerror(@2, "error: Incomprehensible case expression.");
4576 def p_case_items_1(p
):
4577 '''case_items : case_items case_item '''
4579 print('case_items_1', list(p
))
4582 # { svector<PCase::Item*>*tmp;
4583 # tmp = new svector<PCase::Item*>(*p[1], p[2]);
4590 def p_case_items_2(p
):
4591 '''case_items : case_item '''
4593 print('case_items_2', list(p
))
4596 # { svector<PCase::Item*>*tmp = new svector<PCase::Item*>(1);
4603 def p_charge_strength_1(p
):
4604 '''charge_strength : '(' K_small ')' '''
4606 print('charge_strength_1', list(p
))
4612 def p_charge_strength_2(p
):
4613 '''charge_strength : '(' K_medium ')' '''
4615 print('charge_strength_2', list(p
))
4621 def p_charge_strength_3(p
):
4622 '''charge_strength : '(' K_large ')' '''
4624 print('charge_strength_3', list(p
))
4630 def p_charge_strength_opt_1(p
):
4631 '''charge_strength_opt : charge_strength '''
4633 print('charge_strength_opt_1', list(p
))
4639 def p_charge_strength_opt_2(p
):
4640 '''charge_strength_opt : '''
4642 print('charge_strength_opt_2', list(p
))
4648 def p_defparam_assign_1(p
):
4649 '''defparam_assign : hierarchy_identifier '=' expression '''
4651 print('defparam_assign_1', list(p
))
4654 # { pform_set_defparam(*p[1], p[3]);
4660 def p_defparam_assign_list_1(p
):
4661 '''defparam_assign_list : defparam_assign '''
4663 print('defparam_assign_list_1', list(p
))
4669 def p_defparam_assign_list_2(p
):
4670 '''defparam_assign_list : dimensions defparam_assign '''
4672 print('defparam_assign_list_2', list(p
))
4675 # { yyerror(@1, "error: defparam may not include a range.");
4681 def p_defparam_assign_list_3(p
):
4682 '''defparam_assign_list : defparam_assign_list ',' defparam_assign '''
4684 print('defparam_assign_list_3', list(p
))
4691 '''delay1 : '#' delay_value_simple '''
4693 print('delay1_1', list(p
))
4696 # { list<PExpr*>*tmp = new list<PExpr*>;
4697 # tmp->push_back(p[2]);
4704 '''delay1 : '#' '(' delay_value ')' '''
4706 print('delay1_2', list(p
))
4709 # { list<PExpr*>*tmp = new list<PExpr*>;
4710 # tmp->push_back(p[3]);
4717 '''delay3 : '#' delay_value_simple '''
4719 print('delay3_1', list(p
))
4722 # { list<PExpr*>*tmp = new list<PExpr*>;
4723 # tmp->push_back(p[2]);
4730 '''delay3 : '#' '(' delay_value ')' '''
4732 print('delay3_2', list(p
))
4735 # { list<PExpr*>*tmp = new list<PExpr*>;
4736 # tmp->push_back(p[3]);
4743 '''delay3 : '#' '(' delay_value ',' delay_value ')' '''
4745 print('delay3_3', list(p
))
4748 # { list<PExpr*>*tmp = new list<PExpr*>;
4749 # tmp->push_back(p[3]);
4750 # tmp->push_back(p[5]);
4757 '''delay3 : '#' '(' delay_value ',' delay_value ',' delay_value ')' '''
4759 print('delay3_4', list(p
))
4762 # { list<PExpr*>*tmp = new list<PExpr*>;
4763 # tmp->push_back(p[3]);
4764 # tmp->push_back(p[5]);
4765 # tmp->push_back(p[7]);
4771 def p_delay3_opt_1(p
):
4772 '''delay3_opt : delay3 '''
4774 print('delay3_opt_1', list(p
))
4781 def p_delay3_opt_2(p
):
4783 if(parse_debug
> 2):
4784 print('delay3_opt_2', list(p
))
4791 def p_delay_value_list_1(p
):
4792 '''delay_value_list : delay_value '''
4794 print('delay_value_list_1', list(p
))
4797 # { list<PExpr*>*tmp = new list<PExpr*>;
4798 # tmp->push_back(p[1]);
4804 def p_delay_value_list_2(p
):
4805 '''delay_value_list : delay_value_list ',' delay_value '''
4807 print('delay_value_list_2', list(p
))
4810 # { list<PExpr*>*tmp = p[1];
4811 # tmp->push_back(p[3]);
4817 def p_delay_value_1(p
):
4818 '''delay_value : expression '''
4820 print('delay_value_1', list(p
))
4823 # { PExpr*tmp = p[1];
4829 def p_delay_value_2(p
):
4830 '''delay_value : expression ':' expression ':' expression '''
4832 print('delay_value_2', list(p
))
4835 # { p[0] = pform_select_mtm_expr(p[1], p[3], p[5]); }
4839 def p_delay_value_simple_1(p
):
4840 '''delay_value_simple : DEC_NUMBER '''
4842 print('delay_value_simple_1', list(p
))
4845 # { verinum*tmp = p[1];
4847 # yyerror(@1, "internal error: delay.");
4850 # p[0] = new PENumber(tmp);
4851 # FILE_NAME(p[0], @1);
4858 def p_delay_value_simple_2(p
):
4859 '''delay_value_simple : REALTIME '''
4861 print('delay_value_simple_2', list(p
))
4864 # { verireal*tmp = p[1];
4866 # yyerror(@1, "internal error: delay.");
4869 # p[0] = new PEFNumber(tmp);
4870 # FILE_NAME(p[0], @1);
4876 def p_delay_value_simple_3(p
):
4877 '''delay_value_simple : IDENTIFIER '''
4879 print('delay_value_simple_3', list(p
))
4882 # { PEIdent*tmp = new PEIdent(lex_strings.make(p[1]));
4883 # FILE_NAME(tmp, @1);
4890 def p_delay_value_simple_4(p
):
4891 '''delay_value_simple : TIME_LITERAL '''
4893 print('delay_value_simple_4', list(p
))
4900 # if (p[1] == 0 || !get_time_unit(p[1], unit))
4901 # yyerror(@1, "internal error: delay.");
4903 # double p = pow(10.0,
4904 # (double)(unit - pform_get_timeunit()));
4905 # double time = atof(p[1]) * p;
4907 # verireal *v = new verireal(time);
4908 # p[0] = new PEFNumber(v);
4909 # FILE_NAME(p[0], @1);
4915 def p_optional_semicolon_1(p
):
4916 '''optional_semicolon : ';' '''
4918 print('optional_semicolon_1', list(p
))
4924 def p_optional_semicolon_2(p
):
4925 '''optional_semicolon : '''
4927 print('optional_semicolon_2', list(p
))
4933 def p_discipline_declaration_1(p
):
4934 '''discipline_declaration : K_discipline IDENTIFIER optional_semicolon _embed0_discipline_declaration discipline_items K_enddiscipline '''
4936 print('discipline_declaration_1', list(p
))
4939 # { pform_end_discipline(@1); delete[] p[2]; }
4943 def p__embed0_discipline_declaration(p
):
4944 '''_embed0_discipline_declaration : '''
4947 # { pform_start_discipline(p[2]); }
4951 def p_discipline_items_1(p
):
4952 '''discipline_items : discipline_items discipline_item '''
4954 print('discipline_items_1', list(p
))
4960 def p_discipline_items_2(p
):
4961 '''discipline_items : discipline_item '''
4963 print('discipline_items_2', list(p
))
4969 def p_discipline_item_1(p
):
4970 '''discipline_item : K_domain K_discrete ';' '''
4972 print('discipline_item_1', list(p
))
4975 # { pform_discipline_domain(@1, IVL_DIS_DISCRETE); }
4979 def p_discipline_item_2(p
):
4980 '''discipline_item : K_domain K_continuous ';' '''
4982 print('discipline_item_2', list(p
))
4985 # { pform_discipline_domain(@1, IVL_DIS_CONTINUOUS); }
4989 def p_discipline_item_3(p
):
4990 '''discipline_item : K_potential IDENTIFIER ';' '''
4992 print('discipline_item_3', list(p
))
4995 # { pform_discipline_potential(@1, p[2]); delete[] p[2]; }
4999 def p_discipline_item_4(p
):
5000 '''discipline_item : K_flow IDENTIFIER ';' '''
5002 print('discipline_item_4', list(p
))
5005 # { pform_discipline_flow(@1, p[2]); delete[] p[2]; }
5009 def p_nature_declaration_1(p
):
5010 '''nature_declaration : K_nature IDENTIFIER optional_semicolon _embed0_nature_declaration nature_items K_endnature '''
5012 print('nature_declaration_1', list(p
))
5015 # { pform_end_nature(@1); delete[] p[2]; }
5019 def p__embed0_nature_declaration(p
):
5020 '''_embed0_nature_declaration : '''
5023 # { pform_start_nature(p[2]); }
5027 def p_nature_items_1(p
):
5028 '''nature_items : nature_items nature_item '''
5030 print('nature_items_1', list(p
))
5036 def p_nature_items_2(p
):
5037 '''nature_items : nature_item '''
5039 print('nature_items_2', list(p
))
5045 def p_nature_item_1(p
):
5046 '''nature_item : K_units '=' STRING ';' '''
5048 print('nature_item_1', list(p
))
5051 # { delete[] p[3]; }
5055 def p_nature_item_2(p
):
5056 '''nature_item : K_abstol '=' expression ';' '''
5058 print('nature_item_2', list(p
))
5064 def p_nature_item_3(p
):
5065 '''nature_item : K_access '=' IDENTIFIER ';' '''
5067 print('nature_item_3', list(p
))
5070 # { pform_nature_access(@1, p[3]); delete[] p[3]; }
5074 def p_nature_item_4(p
):
5075 '''nature_item : K_idt_nature '=' IDENTIFIER ';' '''
5077 print('nature_item_4', list(p
))
5080 # { delete[] p[3]; }
5084 def p_nature_item_5(p
):
5085 '''nature_item : K_ddt_nature '=' IDENTIFIER ';' '''
5087 print('nature_item_5', list(p
))
5090 # { delete[] p[3]; }
5094 def p_config_declaration_1(p
):
5095 '''config_declaration : K_config IDENTIFIER ';' K_design lib_cell_identifiers ';' list_of_config_rule_statements K_endconfig '''
5097 print('config_declaration_1', list(p
))
5100 # { cerr << @1 << ": sorry: config declarations are not supported and "
5101 # "will be skipped." << endl;
5107 def p_lib_cell_identifiers_1(p
):
5108 '''lib_cell_identifiers : '''
5110 print('lib_cell_identifiers_1', list(p
))
5116 def p_lib_cell_identifiers_2(p
):
5117 '''lib_cell_identifiers : lib_cell_identifiers lib_cell_id '''
5119 print('lib_cell_identifiers_2', list(p
))
5125 def p_list_of_config_rule_statements_1(p
):
5126 '''list_of_config_rule_statements : '''
5128 print('list_of_config_rule_statements_1', list(p
))
5134 def p_list_of_config_rule_statements_2(p
):
5135 '''list_of_config_rule_statements : list_of_config_rule_statements config_rule_statement '''
5137 print('list_of_config_rule_statements_2', list(p
))
5143 def p_config_rule_statement_1(p
):
5144 '''config_rule_statement : K_default K_liblist list_of_libraries ';' '''
5146 print('config_rule_statement_1', list(p
))
5152 def p_config_rule_statement_2(p
):
5153 '''config_rule_statement : K_instance hierarchy_identifier K_liblist list_of_libraries ';' '''
5155 print('config_rule_statement_2', list(p
))
5162 def p_config_rule_statement_3(p
):
5163 '''config_rule_statement : K_instance hierarchy_identifier K_use lib_cell_id opt_config ';' '''
5165 print('config_rule_statement_3', list(p
))
5172 def p_config_rule_statement_4(p
):
5173 '''config_rule_statement : K_cell lib_cell_id K_liblist list_of_libraries ';' '''
5175 print('config_rule_statement_4', list(p
))
5181 def p_config_rule_statement_5(p
):
5182 '''config_rule_statement : K_cell lib_cell_id K_use lib_cell_id opt_config ';' '''
5184 print('config_rule_statement_5', list(p
))
5190 def p_opt_config_1(p
):
5193 print('opt_config_1', list(p
))
5199 def p_opt_config_2(p
):
5200 '''opt_config : ':' K_config '''
5202 print('opt_config_2', list(p
))
5208 def p_lib_cell_id_1(p
):
5209 '''lib_cell_id : IDENTIFIER '''
5211 print('lib_cell_id_1', list(p
))
5214 # { delete[] p[1]; }
5218 def p_lib_cell_id_2(p
):
5219 '''lib_cell_id : IDENTIFIER '.' IDENTIFIER '''
5221 print('lib_cell_id_2', list(p
))
5224 # { delete[] p[1]; delete[] p[3]; }
5228 def p_list_of_libraries_1(p
):
5229 '''list_of_libraries : '''
5231 print('list_of_libraries_1', list(p
))
5237 def p_list_of_libraries_2(p
):
5238 '''list_of_libraries : list_of_libraries IDENTIFIER '''
5240 print('list_of_libraries_2', list(p
))
5243 # { delete[] p[2]; }
5247 def p_drive_strength_1(p
):
5248 '''drive_strength : '(' dr_strength0 ',' dr_strength1 ')' '''
5250 print('drive_strength_1', list(p
))
5253 # { p[0].str0 = p[2].str0;
5254 # p[0].str1 = p[4].str1;
5259 def p_drive_strength_2(p
):
5260 '''drive_strength : '(' dr_strength1 ',' dr_strength0 ')' '''
5262 print('drive_strength_2', list(p
))
5265 # { p[0].str0 = p[4].str0;
5266 # p[0].str1 = p[2].str1;
5271 def p_drive_strength_3(p
):
5272 '''drive_strength : '(' dr_strength0 ',' K_highz1 ')' '''
5274 print('drive_strength_3', list(p
))
5277 # { p[0].str0 = p[2].str0;
5278 # p[0].str1 = IVL_DR_HiZ;
5283 def p_drive_strength_4(p
):
5284 '''drive_strength : '(' dr_strength1 ',' K_highz0 ')' '''
5286 print('drive_strength_4', list(p
))
5289 # { p[0].str0 = IVL_DR_HiZ;
5290 # p[0].str1 = p[2].str1;
5295 def p_drive_strength_5(p
):
5296 '''drive_strength : '(' K_highz1 ',' dr_strength0 ')' '''
5298 print('drive_strength_5', list(p
))
5301 # { p[0].str0 = p[4].str0;
5302 # p[0].str1 = IVL_DR_HiZ;
5307 def p_drive_strength_6(p
):
5308 '''drive_strength : '(' K_highz0 ',' dr_strength1 ')' '''
5310 print('drive_strength_6', list(p
))
5313 # { p[0].str0 = IVL_DR_HiZ;
5314 # p[0].str1 = p[4].str1;
5319 def p_drive_strength_opt_1(p
):
5320 '''drive_strength_opt : drive_strength '''
5322 print('drive_strength_opt_1', list(p
))
5329 def p_drive_strength_opt_2(p
):
5330 '''drive_strength_opt : '''
5331 if(parse_debug
> 2):
5332 print('drive_strength_opt_2', list(p
))
5335 # { p[0].str0 = IVL_DR_STRONG; p[0].str1 = IVL_DR_STRONG; }
5339 def p_dr_strength0_1(p
):
5340 '''dr_strength0 : K_supply0 '''
5342 print('dr_strength0_1', list(p
))
5345 # { p[0].str0 = IVL_DR_SUPPLY; }
5349 def p_dr_strength0_2(p
):
5350 '''dr_strength0 : K_strong0 '''
5352 print('dr_strength0_2', list(p
))
5355 # { p[0].str0 = IVL_DR_STRONG; }
5359 def p_dr_strength0_3(p
):
5360 '''dr_strength0 : K_pull0 '''
5362 print('dr_strength0_3', list(p
))
5365 # { p[0].str0 = IVL_DR_PULL; }
5369 def p_dr_strength0_4(p
):
5370 '''dr_strength0 : K_weak0 '''
5372 print('dr_strength0_4', list(p
))
5375 # { p[0].str0 = IVL_DR_WEAK; }
5379 def p_dr_strength1_1(p
):
5380 '''dr_strength1 : K_supply1 '''
5382 print('dr_strength1_1', list(p
))
5385 # { p[0].str1 = IVL_DR_SUPPLY; }
5389 def p_dr_strength1_2(p
):
5390 '''dr_strength1 : K_strong1 '''
5392 print('dr_strength1_2', list(p
))
5395 # { p[0].str1 = IVL_DR_STRONG; }
5399 def p_dr_strength1_3(p
):
5400 '''dr_strength1 : K_pull1 '''
5402 print('dr_strength1_3', list(p
))
5405 # { p[0].str1 = IVL_DR_PULL; }
5409 def p_dr_strength1_4(p
):
5410 '''dr_strength1 : K_weak1 '''
5412 print('dr_strength1_4', list(p
))
5415 # { p[0].str1 = IVL_DR_WEAK; }
5419 def p_clocking_event_opt_1(p
):
5420 '''clocking_event_opt : event_control '''
5422 print('clocking_event_opt_1', list(p
))
5428 def p_clocking_event_opt_2(p
):
5429 '''clocking_event_opt : '''
5431 print('clocking_event_opt_2', list(p
))
5437 def p_event_control_1(p
):
5438 '''event_control : '@' hierarchy_identifier '''
5440 print('event_control_1', list(p
))
5443 # { PEIdent*tmpi = new PEIdent(*p[2]);
5444 # PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi);
5445 # PEventStatement*tmps = new PEventStatement(tmpe);
5446 # FILE_NAME(tmps, @1);
5453 def p_event_control_2(p
):
5454 '''event_control : '@' '(' event_expression_list ')' '''
5456 print('event_control_2', list(p
))
5459 # { PEventStatement*tmp = new PEventStatement(*p[3]);
5460 # FILE_NAME(tmp, @1);
5467 def p_event_control_3(p
):
5468 '''event_control : '@' '(' error ')' '''
5470 print('event_control_3', list(p
))
5473 # { yyerror(@1, "error: Malformed event control expression.");
5479 def p_event_expression_list_1(p
):
5480 '''event_expression_list : event_expression '''
5482 print('event_expression_list_1', list(p
))
5489 def p_event_expression_list_2(p
):
5490 '''event_expression_list : event_expression_list K_or event_expression '''
5492 print('event_expression_list_2', list(p
))
5495 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
5503 def p_event_expression_list_3(p
):
5504 '''event_expression_list : event_expression_list ',' event_expression '''
5506 print('event_expression_list_3', list(p
))
5509 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
5517 def p_event_expression_1(p
):
5518 '''event_expression : K_posedge expression '''
5520 print('event_expression_1', list(p
))
5523 # { PEEvent*tmp = new PEEvent(PEEvent::POSEDGE, p[2]);
5524 # FILE_NAME(tmp, @1);
5525 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5532 def p_event_expression_2(p
):
5533 '''event_expression : K_negedge expression '''
5535 print('event_expression_2', list(p
))
5538 # { PEEvent*tmp = new PEEvent(PEEvent::NEGEDGE, p[2]);
5539 # FILE_NAME(tmp, @1);
5540 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5547 def p_event_expression_3(p
):
5548 '''event_expression : expression '''
5550 print('event_expression_3', list(p
))
5553 # { PEEvent*tmp = new PEEvent(PEEvent::ANYEDGE, p[1]);
5554 # FILE_NAME(tmp, @1);
5555 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5562 def p_branch_probe_expression_1(p
):
5563 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ',' IDENTIFIER ')' '''
5565 print('branch_probe_expression_1', list(p
))
5568 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3], p[5]); }
5572 def p_branch_probe_expression_2(p
):
5573 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ')' '''
5575 print('branch_probe_expression_2', list(p
))
5578 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3]); }
5582 def p_expression_1(p
):
5583 '''expression : expr_primary_or_typename '''
5584 if(parse_debug
> 2):
5585 print('expression_1', list(p
))
5592 def p_expression_2(p
):
5593 '''expression : inc_or_dec_expression '''
5595 print('expression_2', list(p
))
5602 def p_expression_3(p
):
5603 '''expression : inside_expression '''
5605 print('expression_3', list(p
))
5612 def p_expression_4(p
):
5613 '''expression : '+' attribute_list_opt expr_primary %prec UNARY_PREC '''
5615 print('expression_4', list(p
))
5622 def PEUnary(op
, o1
):
5623 #Leaf(token.STRING, ' ')
5625 return Node(syms
.atom
, [op
, o1
])
5627 return "error in PEUnary: "+str(op
)+","+str(o1
)
5630 def PEBinary(op
, o1
, o2
):
5632 return Node(syms
.atom
, [o1
, Leaf(token
.STRING
, ' '), op
, Leaf(token
.STRING
, ' '), o2
])
5634 return "error in PEBinary: "+str(op
)+","+str(o1
)+","+str(o2
)
5639 def p_expression_5(p
):
5640 '''expression : '-' attribute_list_opt expr_primary %prec UNARY_PREC '''
5642 print('expression_5', list(p
))
5644 p
[0] = PEUnary(Leaf(token
.MINUS
, '-'), p
[3])
5647 # { PEUnary*tmp = new PEUnary('-', p[3]);
5648 # FILE_NAME(tmp, @3);
5654 def p_expression_6(p
):
5655 '''expression : '~' attribute_list_opt expr_primary %prec UNARY_PREC '''
5657 print('expression_6', list(p
))
5659 p
[0] = PEUnary(Leaf(token
.TILDE
, '~'), p
[3])
5662 # { PEUnary*tmp = new PEUnary('~', p[3]);
5663 # FILE_NAME(tmp, @3);
5669 def p_expression_7(p
):
5670 '''expression : '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
5672 print('expression_7', list(p
))
5674 p
[0] = PEUnary(Leaf(token
.AMPER
, '&'), p
[3])
5677 # { PEUnary*tmp = new PEUnary('&', p[3]);
5678 # FILE_NAME(tmp, @3);
5684 def p_expression_8(p
):
5685 '''expression : '!' attribute_list_opt expr_primary %prec UNARY_PREC '''
5687 print('expression_8', list(p
))
5689 p
[0] = PEUnary(Leaf(token
.STRING
, '!'), p
[3])
5692 # { PEUnary*tmp = new PEUnary('!', p[3]);
5693 # FILE_NAME(tmp, @3);
5699 def p_expression_9(p
):
5700 '''expression : '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
5702 print('expression_9', list(p
))
5704 p
[0] = PEUnary(Leaf(token
.STRING
, '|'), p
[3])
5707 # { PEUnary*tmp = new PEUnary('|', p[3]);
5708 # FILE_NAME(tmp, @3);
5714 def p_expression_10(p
):
5715 '''expression : '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
5717 print('expression_10', list(p
))
5719 p
[0] = PEUnary(Leaf(token
.STRING
, '^'), p
[3])
5722 # { PEUnary*tmp = new PEUnary('^', p[3]);
5723 # FILE_NAME(tmp, @3);
5729 def p_expression_11(p
):
5730 '''expression : '~' '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
5732 print('expression_11', list(p
))
5735 # { yyerror(@1, "error: '~' '&' is not a valid expression. "
5736 # "Please use operator '~&' instead.");
5742 def p_expression_12(p
):
5743 '''expression : '~' '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
5745 print('expression_12', list(p
))
5748 # { yyerror(@1, "error: '~' '|' is not a valid expression. "
5749 # "Please use operator '~|' instead.");
5755 def p_expression_13(p
):
5756 '''expression : '~' '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
5758 print('expression_13', list(p
))
5761 # { yyerror(@1, "error: '~' '^' is not a valid expression. "
5762 # "Please use operator '~^' instead.");
5768 def p_expression_14(p
):
5769 '''expression : K_NAND attribute_list_opt expr_primary %prec UNARY_PREC '''
5771 print('expression_14', list(p
))
5773 p
[0] = PEUnary(Leaf(token
.STRING
, 'K_NAND'), p
[3])
5776 # { PEUnary*tmp = new PEUnary('A', p[3]);
5777 # FILE_NAME(tmp, @3);
5783 def p_expression_15(p
):
5784 '''expression : K_NOR attribute_list_opt expr_primary %prec UNARY_PREC '''
5786 print('expression_15', list(p
))
5788 p
[0] = PEUnary(Leaf(token
.STRING
, 'K_NOR'), p
[3])
5791 # { PEUnary*tmp = new PEUnary('N', p[3]);
5792 # FILE_NAME(tmp, @3);
5798 def p_expression_16(p
):
5799 '''expression : K_NXOR attribute_list_opt expr_primary %prec UNARY_PREC '''
5801 print('expression_16', list(p
))
5803 p
[0] = PEUnary(Leaf(token
.STRING
, 'K_NXOR'), p
[3])
5806 # { PEUnary*tmp = new PEUnary('X', p[3]);
5807 # FILE_NAME(tmp, @3);
5813 def p_expression_17(p
):
5814 '''expression : '!' error %prec UNARY_PREC '''
5816 print('expression_17', list(p
))
5819 # { yyerror(@1, "error: Operand of unary ! "
5820 # "is not a primary expression.");
5826 def p_expression_18(p
):
5827 '''expression : '^' error %prec UNARY_PREC '''
5829 print('expression_18', list(p
))
5832 # { yyerror(@1, "error: Operand of reduction ^ "
5833 # "is not a primary expression.");
5839 def p_expression_19(p
):
5840 '''expression : expression '^' attribute_list_opt expression '''
5842 print('expression_19', list(p
))
5844 p
[0] = PEBinary(Leaf(token
.STRING
, '^'), p
[1], p
[4])
5847 # { PEBinary*tmp = new PEBinary('^', p[1], p[4]);
5848 # FILE_NAME(tmp, @2);
5854 def p_expression_20(p
):
5855 '''expression : expression K_POW attribute_list_opt expression '''
5857 print('expression_20', list(p
))
5859 p
[0] = PEBinary(Leaf(token
.STRING
, '**'), p
[1], p
[4])
5862 # { PEBinary*tmp = new PEBPower('p', p[1], p[4]);
5863 # FILE_NAME(tmp, @2);
5869 def p_expression_21(p
):
5870 '''expression : expression '*' attribute_list_opt expression '''
5872 print('expression_21', list(p
))
5874 p
[0] = PEBinary(Leaf(token
.STRING
, '*'), p
[1], p
[4])
5877 # { PEBinary*tmp = new PEBinary('*', p[1], p[4]);
5878 # FILE_NAME(tmp, @2);
5884 def p_expression_22(p
):
5885 '''expression : expression '/' attribute_list_opt expression '''
5887 print('expression_22', list(p
))
5889 p
[0] = PEBinary(Leaf(token
.STRING
, '/'), p
[1], p
[4])
5892 # { PEBinary*tmp = new PEBinary('/', p[1], p[4]);
5893 # FILE_NAME(tmp, @2);
5899 def p_expression_23(p
):
5900 '''expression : expression '%' attribute_list_opt expression '''
5902 print('expression_23', list(p
))
5904 p
[0] = PEBinary(Leaf(token
.STRING
, '%'), p
[1], p
[4])
5907 # { PEBinary*tmp = new PEBinary('%', p[1], p[4]);
5908 # FILE_NAME(tmp, @2);
5914 def p_expression_24(p
):
5915 '''expression : expression '+' attribute_list_opt expression '''
5917 print('expression_24', list(p
))
5919 # { PEBinary*tmp = new PEBinary('+', p[1], p[4]);
5920 # FILE_NAME(tmp, @2);
5923 p
[0] = PEBinary(Leaf(token
.PLUS
, '+'), p
[1], p
[4])
5929 def p_expression_25(p
):
5930 '''expression : expression '-' attribute_list_opt expression '''
5931 if(parse_debug
> 2):
5932 print('expression_25', list(p
))
5933 # { PEBinary*tmp = new PEBinary('-', p[1], p[4]);
5934 # FILE_NAME(tmp, @2);
5937 p
[0] = PEBinary(Leaf(token
.MINUS
, '-'), p
[1], p
[4])
5943 def p_expression_26(p
):
5944 '''expression : expression '&' attribute_list_opt expression '''
5945 if(parse_debug
> 2):
5946 print('expression_26', list(p
))
5948 p
[0] = PEBinary(Leaf(token
.AMPER
, '&'), p
[1], p
[4])
5951 # { PEBinary*tmp = new PEBinary('&', p[1], p[4]);
5952 # FILE_NAME(tmp, @2);
5958 def p_expression_27(p
):
5959 '''expression : expression '|' attribute_list_opt expression '''
5960 if(parse_debug
> 2):
5961 print('expression_27', list(p
))
5963 p
[0] = PEBinary(Leaf(token
.VBAR
, '|'), p
[1], p
[4])
5965 # { PEBinary*tmp = new PEBinary('|', p[1], p[4]);
5966 # FILE_NAME(tmp, @2);
5972 def p_expression_28(p
):
5973 '''expression : expression K_NAND attribute_list_opt expression '''
5975 print('expression_28', list(p
))
5977 p
[0] = PEBinary(Leaf(token
.STRING
, '~&'), p
[1], p
[4])
5980 # { PEBinary*tmp = new PEBinary('A', p[1], p[4]);
5981 # FILE_NAME(tmp, @2);
5987 def p_expression_29(p
):
5988 '''expression : expression K_NOR attribute_list_opt expression '''
5990 print('expression_29', list(p
))
5992 p
[0] = PEBinary(Leaf(token
.STRING
, '~|'), p
[1], p
[4])
5995 # { PEBinary*tmp = new PEBinary('O', p[1], p[4]);
5996 # FILE_NAME(tmp, @2);
6002 def p_expression_30(p
):
6003 '''expression : expression K_NXOR attribute_list_opt expression '''
6005 print('expression_30', list(p
))
6007 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_XNOR'), p
[1], p
[4])
6010 # { PEBinary*tmp = new PEBinary('X', p[1], p[4]);
6011 # FILE_NAME(tmp, @2);
6017 def p_expression_31(p
):
6018 '''expression : expression '<' attribute_list_opt expression '''
6020 print('expression_31', list(p
))
6022 p
[0] = PEBinary(Leaf(token
.STRING
, '<'), p
[1], p
[4])
6025 # { PEBinary*tmp = new PEBComp('<', p[1], p[4]);
6026 # FILE_NAME(tmp, @2);
6032 def p_expression_32(p
):
6033 '''expression : expression '>' attribute_list_opt expression '''
6035 print('expression_32', list(p
))
6037 p
[0] = PEBinary(Leaf(token
.STRING
, '>'), p
[1], p
[4])
6040 # { PEBinary*tmp = new PEBComp('>', p[1], p[4]);
6041 # FILE_NAME(tmp, @2);
6047 def p_expression_33(p
):
6048 '''expression : expression K_LS attribute_list_opt expression '''
6050 print('expression_33', list(p
))
6052 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_LS'), p
[1], p
[4])
6055 # { PEBinary*tmp = new PEBShift('l', p[1], p[4]);
6056 # FILE_NAME(tmp, @2);
6062 def p_expression_34(p
):
6063 '''expression : expression K_RS attribute_list_opt expression '''
6065 print('expression_34', list(p
))
6067 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_RS'), p
[1], p
[4])
6070 # { PEBinary*tmp = new PEBShift('r', p[1], p[4]);
6071 # FILE_NAME(tmp, @2);
6077 def p_expression_35(p
):
6078 '''expression : expression K_RSS attribute_list_opt expression '''
6080 print('expression_35', list(p
))
6082 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_RSS'), p
[1], p
[4])
6085 # { PEBinary*tmp = new PEBShift('R', p[1], p[4]);
6086 # FILE_NAME(tmp, @2);
6092 def p_expression_36(p
):
6093 '''expression : expression K_EQ attribute_list_opt expression '''
6095 print('expression_36', list(p
))
6097 p
[0] = PEBinary(Leaf(token
.STRING
, '=='), p
[1], p
[4])
6100 # { PEBinary*tmp = new PEBComp('e', p[1], p[4]);
6101 # FILE_NAME(tmp, @2);
6107 def p_expression_37(p
):
6108 '''expression : expression K_CEQ attribute_list_opt expression '''
6110 print('expression_37', list(p
))
6112 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_CEQ'), p
[1], p
[4])
6115 # { PEBinary*tmp = new PEBComp('E', p[1], p[4]);
6116 # FILE_NAME(tmp, @2);
6122 def p_expression_38(p
):
6123 '''expression : expression K_WEQ attribute_list_opt expression '''
6125 print('expression_38', list(p
))
6127 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_WEQ'), p
[1], p
[4])
6130 # { PEBinary*tmp = new PEBComp('w', p[1], p[4]);
6131 # FILE_NAME(tmp, @2);
6137 def p_expression_39(p
):
6138 '''expression : expression K_LE attribute_list_opt expression '''
6140 print('expression_39', list(p
))
6142 p
[0] = PEBinary(Leaf(token
.STRING
, '<='), p
[1], p
[4])
6145 # { PEBinary*tmp = new PEBComp('L', p[1], p[4]);
6146 # FILE_NAME(tmp, @2);
6152 def p_expression_40(p
):
6153 '''expression : expression K_GE attribute_list_opt expression '''
6155 print('expression_40', list(p
))
6157 p
[0] = PEBinary(Leaf(token
.STRING
, '>='), p
[1], p
[4])
6160 # { PEBinary*tmp = new PEBComp('G', p[1], p[4]);
6161 # FILE_NAME(tmp, @2);
6167 def p_expression_41(p
):
6168 '''expression : expression K_NE attribute_list_opt expression '''
6170 print('expression_41', list(p
))
6172 p
[0] = PEBinary(Leaf(token
.STRING
, '!='), p
[1], p
[4])
6175 # { PEBinary*tmp = new PEBComp('n', p[1], p[4]);
6176 # FILE_NAME(tmp, @2);
6182 def p_expression_42(p
):
6183 '''expression : expression K_CNE attribute_list_opt expression '''
6185 print('expression_42', list(p
))
6187 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_CNE'), p
[1], p
[4])
6190 # { PEBinary*tmp = new PEBComp('N', p[1], p[4]);
6191 # FILE_NAME(tmp, @2);
6197 def p_expression_43(p
):
6198 '''expression : expression K_WNE attribute_list_opt expression '''
6200 print('expression_43', list(p
))
6202 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_WNE'), p
[1], p
[4])
6205 # { PEBinary*tmp = new PEBComp('W', p[1], p[4]);
6206 # FILE_NAME(tmp, @2);
6212 def p_expression_44(p
):
6213 '''expression : expression K_LOR attribute_list_opt expression '''
6215 print('expression_44', list(p
))
6217 p
[0] = PEBinary(Leaf(token
.STRING
, '||'), p
[1], p
[4])
6220 # { PEBinary*tmp = new PEBLogic('o', p[1], p[4]);
6221 # FILE_NAME(tmp, @2);
6227 def p_expression_45(p
):
6228 '''expression : expression K_LAND attribute_list_opt expression '''
6230 print('expression_45', list(p
))
6232 p
[0] = PEBinary(Leaf(token
.STRING
, '&&'), p
[1], p
[4])
6235 # { PEBinary*tmp = new PEBLogic('a', p[1], p[4]);
6236 # FILE_NAME(tmp, @2);
6242 def p_expression_46(p
):
6243 '''expression : expression '?' attribute_list_opt expression ':' expression '''
6245 print('expression_46', list(p
))
6247 p
[0] = Node(syms
.atom
, [p
[1], Leaf(token
.STRING
, ' ? '),
6248 p
[4], Leaf(token
.STRING
, ' : '), p
[6]])
6251 # { PETernary*tmp = new PETernary(p[1], p[4], p[6]);
6252 # FILE_NAME(tmp, @2);
6258 def p_expr_mintypmax_1(p
):
6259 '''expr_mintypmax : expression '''
6261 print('expr_mintypmax_1', list(p
))
6268 def p_expr_mintypmax_2(p
):
6269 '''expr_mintypmax : expression ':' expression ':' expression '''
6271 print('expr_mintypmax_2', list(p
))
6274 # { switch (min_typ_max_flag) {
6291 # if (min_typ_max_warn > 0) {
6292 # cerr << p[0]->get_fileline() << ": warning: choosing ";
6293 # switch (min_typ_max_flag) {
6304 # cerr << " expression." << endl;
6305 # min_typ_max_warn -= 1;
6311 def p_expression_list_with_nuls_1(p
):
6312 '''expression_list_with_nuls : expression_list_with_nuls ',' expression '''
6314 print('expression_list_with_nuls_1', list(p
))
6317 # { list<PExpr*>*tmp = p[1];
6318 # tmp->push_back(p[3]);
6324 def p_expression_list_with_nuls_2(p
):
6325 '''expression_list_with_nuls : expression '''
6327 print('expression_list_with_nuls_2', list(p
))
6330 # { list<PExpr*>*tmp = new list<PExpr*>;
6331 # tmp->push_back(p[1]);
6337 def p_expression_list_with_nuls_3(p
):
6338 '''expression_list_with_nuls : '''
6340 print('expression_list_with_nuls_3', list(p
))
6343 # { list<PExpr*>*tmp = new list<PExpr*>;
6344 # tmp->push_back(0);
6350 def p_expression_list_with_nuls_4(p
):
6351 '''expression_list_with_nuls : expression_list_with_nuls ',' '''
6353 print('expression_list_with_nuls_4', list(p
))
6356 # { list<PExpr*>*tmp = p[1];
6357 # tmp->push_back(0);
6363 def p_expression_list_proper_1(p
):
6364 '''expression_list_proper : expression_list_proper ',' expression '''
6366 print('expression_list_proper_1', list(p
))
6369 # { list<PExpr*>*tmp = p[1];
6370 # tmp->push_back(p[3]);
6376 def p_expression_list_proper_2(p
):
6377 '''expression_list_proper : expression '''
6379 print('expression_list_proper_2', list(p
))
6382 # { list<PExpr*>*tmp = new list<PExpr*>;
6383 # tmp->push_back(p[1]);
6389 def p_expr_primary_or_typename_1(p
):
6390 '''expr_primary_or_typename : expr_primary '''
6391 if(parse_debug
> 2):
6392 print('expr_primary_or_typename_1', list(p
))
6399 def p_expr_primary_or_typename_2(p
):
6400 '''expr_primary_or_typename : TYPE_IDENTIFIER '''
6402 print('expr_primary_or_typename_2', list(p
))
6406 # { PETypename*tmp = new PETypename(p[1].type);
6407 # FILE_NAME(tmp,@1);
6409 # delete[]p[1].text;
6414 def p_expr_primary_1(p
):
6415 '''expr_primary : number '''
6417 print('expr_primary_1', list(p
))
6422 # PENumber*tmp = new PENumber(p[1]);
6423 # FILE_NAME(tmp, @1);
6429 def p_expr_primary_2(p
):
6430 '''expr_primary : REALTIME '''
6432 print('expr_primary_2', list(p
))
6435 # { PEFNumber*tmp = new PEFNumber(p[1]);
6436 # FILE_NAME(tmp, @1);
6442 def p_expr_primary_3(p
):
6443 '''expr_primary : STRING '''
6445 print('expr_primary_3', list(p
))
6448 # { PEString*tmp = new PEString(p[1]);
6449 # FILE_NAME(tmp, @1);
6455 def p_expr_primary_4(p
):
6456 '''expr_primary : TIME_LITERAL '''
6458 print('expr_primary_4', list(p
))
6465 # if (p[1] == 0 || !get_time_unit(p[1], unit))
6466 # yyerror(@1, "internal error: delay.");
6468 # double p = pow(10.0, (double)(unit - pform_get_timeunit()));
6469 # double time = atof(p[1]) * p;
6471 # verireal *v = new verireal(time);
6472 # p[0] = new PEFNumber(v);
6473 # FILE_NAME(p[0], @1);
6479 def p_expr_primary_5(p
):
6480 '''expr_primary : SYSTEM_IDENTIFIER '''
6482 print('expr_primary_5', list(p
))
6485 # { perm_string tn = lex_strings.make(p[1]);
6486 # PECallFunction*tmp = new PECallFunction(tn);
6487 # FILE_NAME(tmp, @1);
6494 def p_expr_primary_6(p
):
6495 '''expr_primary : hierarchy_identifier '''
6496 if(parse_debug
> 2):
6497 print('expr_primary_6', list(p
))
6501 # { PEIdent*tmp = pform_new_ident(*p[1]);
6502 # FILE_NAME(tmp, @1);
6509 def p_expr_primary_7(p
):
6510 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier '''
6512 print('expr_primary_7', list(p
))
6515 # { p[0] = pform_package_ident(@2, p[1], p[3]);
6521 def p_expr_primary_8(p
):
6522 '''expr_primary : hierarchy_identifier '(' expression_list_with_nuls ')' '''
6524 print('expr_primary_8', list(p
))
6527 # { list<PExpr*>*expr_list = p[3];
6528 # strip_tail_items(expr_list);
6529 # PECallFunction*tmp = pform_make_call_function(@1, *p[1], *expr_list);
6536 def p_expr_primary_9(p
):
6537 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' '''
6539 print('expr_primary_9', list(p
))
6542 # { pform_name_t*t_name = p[1];
6543 # while (! p[3]->empty()) {
6544 # t_name->push_back(p[3]->front());
6545 # p[3]->pop_front();
6547 # list<PExpr*>*expr_list = p[5];
6548 # strip_tail_items(expr_list);
6549 # PECallFunction*tmp = pform_make_call_function(@1, *t_name, *expr_list);
6557 def p_expr_primary_10(p
):
6558 '''expr_primary : SYSTEM_IDENTIFIER '(' expression_list_proper ')' '''
6560 print('expr_primary_10', list(p
))
6563 # { perm_string tn = lex_strings.make(p[1]);
6564 # PECallFunction*tmp = new PECallFunction(tn, *p[3]);
6565 # FILE_NAME(tmp, @1);
6572 def p_expr_primary_11(p
):
6573 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')' '''
6575 print('expr_primary_11', list(p
))
6578 # { perm_string use_name = lex_strings.make(p[3]);
6579 # PECallFunction*tmp = new PECallFunction(p[1], use_name, *p[5]);
6580 # FILE_NAME(tmp, @3);
6587 def p_expr_primary_12(p
):
6588 '''expr_primary : SYSTEM_IDENTIFIER '(' ')' '''
6590 print('expr_primary_12', list(p
))
6593 # { perm_string tn = lex_strings.make(p[1]);
6594 # const vector<PExpr*>empty;
6595 # PECallFunction*tmp = new PECallFunction(tn, empty);
6596 # FILE_NAME(tmp, @1);
6599 # if (!gn_system_verilog()) {
6600 # yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
6606 def p_expr_primary_13(p
):
6607 '''expr_primary : implicit_class_handle '''
6609 print('expr_primary_13', list(p
))
6612 # { PEIdent*tmp = new PEIdent(*p[1]);
6613 # FILE_NAME(tmp,@1);
6620 def p_expr_primary_14(p
):
6621 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '''
6623 print('expr_primary_14', list(p
))
6626 # { pform_name_t*t_name = p[1];
6627 # while (! p[3]->empty()) {
6628 # t_name->push_back(p[3]->front());
6629 # p[3]->pop_front();
6631 # PEIdent*tmp = new PEIdent(*t_name);
6632 # FILE_NAME(tmp,@1);
6640 def p_expr_primary_15(p
):
6641 '''expr_primary : K_acos '(' expression ')' '''
6643 print('expr_primary_15', list(p
))
6646 # { perm_string tn = perm_string::literal("$acos");
6647 # PECallFunction*tmp = make_call_function(tn, p[3]);
6648 # FILE_NAME(tmp,@1);
6654 def p_expr_primary_16(p
):
6655 '''expr_primary : K_acosh '(' expression ')' '''
6657 print('expr_primary_16', list(p
))
6660 # { perm_string tn = perm_string::literal("$acosh");
6661 # PECallFunction*tmp = make_call_function(tn, p[3]);
6662 # FILE_NAME(tmp,@1);
6668 def p_expr_primary_17(p
):
6669 '''expr_primary : K_asin '(' expression ')' '''
6671 print('expr_primary_17', list(p
))
6674 # { perm_string tn = perm_string::literal("$asin");
6675 # PECallFunction*tmp = make_call_function(tn, p[3]);
6676 # FILE_NAME(tmp,@1);
6682 def p_expr_primary_18(p
):
6683 '''expr_primary : K_asinh '(' expression ')' '''
6685 print('expr_primary_18', list(p
))
6688 # { perm_string tn = perm_string::literal("$asinh");
6689 # PECallFunction*tmp = make_call_function(tn, p[3]);
6690 # FILE_NAME(tmp,@1);
6696 def p_expr_primary_19(p
):
6697 '''expr_primary : K_atan '(' expression ')' '''
6699 print('expr_primary_19', list(p
))
6702 # { perm_string tn = perm_string::literal("$atan");
6703 # PECallFunction*tmp = make_call_function(tn, p[3]);
6704 # FILE_NAME(tmp,@1);
6710 def p_expr_primary_20(p
):
6711 '''expr_primary : K_atanh '(' expression ')' '''
6713 print('expr_primary_20', list(p
))
6716 # { perm_string tn = perm_string::literal("$atanh");
6717 # PECallFunction*tmp = make_call_function(tn, p[3]);
6718 # FILE_NAME(tmp,@1);
6724 def p_expr_primary_21(p
):
6725 '''expr_primary : K_atan2 '(' expression ',' expression ')' '''
6727 print('expr_primary_21', list(p
))
6730 # { perm_string tn = perm_string::literal("$atan2");
6731 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6732 # FILE_NAME(tmp,@1);
6738 def p_expr_primary_22(p
):
6739 '''expr_primary : K_ceil '(' expression ')' '''
6741 print('expr_primary_22', list(p
))
6744 # { perm_string tn = perm_string::literal("$ceil");
6745 # PECallFunction*tmp = make_call_function(tn, p[3]);
6746 # FILE_NAME(tmp,@1);
6752 def p_expr_primary_23(p
):
6753 '''expr_primary : K_cos '(' expression ')' '''
6755 print('expr_primary_23', list(p
))
6758 # { perm_string tn = perm_string::literal("$cos");
6759 # PECallFunction*tmp = make_call_function(tn, p[3]);
6760 # FILE_NAME(tmp,@1);
6766 def p_expr_primary_24(p
):
6767 '''expr_primary : K_cosh '(' expression ')' '''
6769 print('expr_primary_24', list(p
))
6772 # { perm_string tn = perm_string::literal("$cosh");
6773 # PECallFunction*tmp = make_call_function(tn, p[3]);
6774 # FILE_NAME(tmp,@1);
6780 def p_expr_primary_25(p
):
6781 '''expr_primary : K_exp '(' expression ')' '''
6783 print('expr_primary_25', list(p
))
6786 # { perm_string tn = perm_string::literal("$exp");
6787 # PECallFunction*tmp = make_call_function(tn, p[3]);
6788 # FILE_NAME(tmp,@1);
6794 def p_expr_primary_26(p
):
6795 '''expr_primary : K_floor '(' expression ')' '''
6797 print('expr_primary_26', list(p
))
6800 # { perm_string tn = perm_string::literal("$floor");
6801 # PECallFunction*tmp = make_call_function(tn, p[3]);
6802 # FILE_NAME(tmp,@1);
6808 def p_expr_primary_27(p
):
6809 '''expr_primary : K_hypot '(' expression ',' expression ')' '''
6811 print('expr_primary_27', list(p
))
6814 # { perm_string tn = perm_string::literal("$hypot");
6815 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6816 # FILE_NAME(tmp,@1);
6822 def p_expr_primary_28(p
):
6823 '''expr_primary : K_ln '(' expression ')' '''
6825 print('expr_primary_28', list(p
))
6828 # { perm_string tn = perm_string::literal("$ln");
6829 # PECallFunction*tmp = make_call_function(tn, p[3]);
6830 # FILE_NAME(tmp,@1);
6836 def p_expr_primary_29(p
):
6837 '''expr_primary : K_log '(' expression ')' '''
6839 print('expr_primary_29', list(p
))
6842 # { perm_string tn = perm_string::literal("$log10");
6843 # PECallFunction*tmp = make_call_function(tn, p[3]);
6844 # FILE_NAME(tmp,@1);
6850 def p_expr_primary_30(p
):
6851 '''expr_primary : K_pow '(' expression ',' expression ')' '''
6853 print('expr_primary_30', list(p
))
6856 # { perm_string tn = perm_string::literal("$pow");
6857 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6858 # FILE_NAME(tmp,@1);
6864 def p_expr_primary_31(p
):
6865 '''expr_primary : K_sin '(' expression ')' '''
6867 print('expr_primary_31', list(p
))
6870 # { perm_string tn = perm_string::literal("$sin");
6871 # PECallFunction*tmp = make_call_function(tn, p[3]);
6872 # FILE_NAME(tmp,@1);
6878 def p_expr_primary_32(p
):
6879 '''expr_primary : K_sinh '(' expression ')' '''
6881 print('expr_primary_32', list(p
))
6884 # { perm_string tn = perm_string::literal("$sinh");
6885 # PECallFunction*tmp = make_call_function(tn, p[3]);
6886 # FILE_NAME(tmp,@1);
6892 def p_expr_primary_33(p
):
6893 '''expr_primary : K_sqrt '(' expression ')' '''
6895 print('expr_primary_33', list(p
))
6898 # { perm_string tn = perm_string::literal("$sqrt");
6899 # PECallFunction*tmp = make_call_function(tn, p[3]);
6900 # FILE_NAME(tmp,@1);
6906 def p_expr_primary_34(p
):
6907 '''expr_primary : K_tan '(' expression ')' '''
6909 print('expr_primary_34', list(p
))
6912 # { perm_string tn = perm_string::literal("$tan");
6913 # PECallFunction*tmp = make_call_function(tn, p[3]);
6914 # FILE_NAME(tmp,@1);
6920 def p_expr_primary_35(p
):
6921 '''expr_primary : K_tanh '(' expression ')' '''
6923 print('expr_primary_35', list(p
))
6926 # { perm_string tn = perm_string::literal("$tanh");
6927 # PECallFunction*tmp = make_call_function(tn, p[3]);
6928 # FILE_NAME(tmp,@1);
6934 def p_expr_primary_36(p
):
6935 '''expr_primary : K_abs '(' expression ')' '''
6937 print('expr_primary_36', list(p
))
6940 # { PEUnary*tmp = new PEUnary('m', p[3]);
6941 # FILE_NAME(tmp,@1);
6947 def p_expr_primary_37(p
):
6948 '''expr_primary : K_max '(' expression ',' expression ')' '''
6950 print('expr_primary_37', list(p
))
6953 # { PEBinary*tmp = new PEBinary('M', p[3], p[5]);
6954 # FILE_NAME(tmp,@1);
6960 def p_expr_primary_38(p
):
6961 '''expr_primary : K_min '(' expression ',' expression ')' '''
6963 print('expr_primary_38', list(p
))
6966 # { PEBinary*tmp = new PEBinary('m', p[3], p[5]);
6967 # FILE_NAME(tmp,@1);
6973 def p_expr_primary_39(p
):
6974 '''expr_primary : '(' expr_mintypmax ')' '''
6976 print('expr_primary_39', list(p
))
6983 def p_expr_primary_40(p
):
6984 '''expr_primary : '{' expression_list_proper '}' '''
6986 print('expr_primary_40', list(p
))
6989 # { PEConcat*tmp = new PEConcat(*p[2]);
6990 # FILE_NAME(tmp, @1);
6997 def p_expr_primary_41(p
):
6998 '''expr_primary : '{' expression '{' expression_list_proper '}' '}' '''
7000 print('expr_primary_41', list(p
))
7003 # { PExpr*rep = p[2];
7004 # PEConcat*tmp = new PEConcat(*p[4], rep);
7005 # FILE_NAME(tmp, @1);
7012 def p_expr_primary_42(p
):
7013 '''expr_primary : '{' expression '{' expression_list_proper '}' error '}' '''
7015 print('expr_primary_42', list(p
))
7018 # { PExpr*rep = p[2];
7019 # PEConcat*tmp = new PEConcat(*p[4], rep);
7020 # FILE_NAME(tmp, @1);
7023 # yyerror(@5, "error: Syntax error between internal '}' "
7024 # "and closing '}' of repeat concatenation.");
7030 def p_expr_primary_43(p
):
7031 '''expr_primary : '{' '}' '''
7033 print('expr_primary_43', list(p
))
7036 # { // This is the empty queue syntax.
7037 # if (gn_system_verilog()) {
7038 # list<PExpr*> empty_list;
7039 # PEConcat*tmp = new PEConcat(empty_list);
7040 # FILE_NAME(tmp, @1);
7043 # yyerror(@1, "error: Concatenations are not allowed to be empty.");
7050 def p_expr_primary_44(p
):
7051 '''expr_primary : expr_primary "'" '(' expression ')' '''
7053 print('expr_primary_44', list(p
))
7056 # { PExpr*base = p[4];
7057 # if (gn_system_verilog()) {
7058 # PECastSize*tmp = new PECastSize(p[1], base);
7059 # FILE_NAME(tmp, @1);
7062 # yyerror(@1, "error: Size cast requires SystemVerilog.");
7069 def p_expr_primary_45(p
):
7070 '''expr_primary : simple_type_or_string "'" '(' expression ')' '''
7072 print('expr_primary_45', list(p
))
7075 # { PExpr*base = p[4];
7076 # if (gn_system_verilog()) {
7077 # PECastType*tmp = new PECastType(p[1], base);
7078 # FILE_NAME(tmp, @1);
7081 # yyerror(@1, "error: Type cast requires SystemVerilog.");
7088 def p_expr_primary_46(p
):
7089 '''expr_primary : assignment_pattern '''
7091 print('expr_primary_46', list(p
))
7098 def p_expr_primary_47(p
):
7099 '''expr_primary : streaming_concatenation '''
7101 print('expr_primary_47', list(p
))
7108 def p_expr_primary_48(p
):
7109 '''expr_primary : K_null '''
7111 print('expr_primary_48', list(p
))
7114 # { PENull*tmp = new PENull;
7115 # FILE_NAME(tmp, @1);
7121 def p_function_item_list_opt_1(p
):
7122 '''function_item_list_opt : function_item_list '''
7124 print('function_item_list_opt_1', list(p
))
7131 def p_function_item_list_opt_2(p
):
7132 '''function_item_list_opt : '''
7134 print('function_item_list_opt_2', list(p
))
7141 def p_function_item_list_1(p
):
7142 '''function_item_list : function_item '''
7144 print('function_item_list_1', list(p
))
7151 def p_function_item_list_2(p
):
7152 '''function_item_list : function_item_list function_item '''
7154 print('function_item_list_2', list(p
))
7158 # if (p[1] && p[2]) {
7159 # vector<pform_tf_port_t>*tmp = p[1];
7160 # size_t s1 = tmp->size();
7161 # tmp->resize(s1 + p[2]->size());
7162 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
7163 # tmp->at(s1+idx) = p[2]->at(idx);
7166 # } else if (p[1]) {
7175 def p_function_item_1(p
):
7176 '''function_item : tf_port_declaration '''
7178 print('function_item_1', list(p
))
7185 def p_function_item_2(p
):
7186 '''function_item : block_item_decl '''
7188 print('function_item_2', list(p
))
7195 def p_gate_instance_1(p
):
7196 '''gate_instance : IDENTIFIER '(' expression_list_with_nuls ')' '''
7198 print('gate_instance_1', list(p
))
7201 # { lgate*tmp = new lgate;
7203 # tmp->parms = p[3];
7204 # tmp->file = @1.text;
7205 # tmp->lineno = @1.first_line;
7212 def p_gate_instance_2(p
):
7213 '''gate_instance : IDENTIFIER dimensions '(' expression_list_with_nuls ')' '''
7215 print('gate_instance_2', list(p
))
7218 # { lgate*tmp = new lgate;
7219 # list<pform_range_t>*rng = p[2];
7221 # tmp->parms = p[4];
7222 # tmp->range = rng->front();
7224 # assert(rng->empty());
7225 # tmp->file = @1.text;
7226 # tmp->lineno = @1.first_line;
7234 def p_gate_instance_3(p
):
7235 '''gate_instance : '(' expression_list_with_nuls ')' '''
7237 print('gate_instance_3', list(p
))
7240 # { lgate*tmp = new lgate;
7242 # tmp->parms = p[2];
7243 # tmp->file = @1.text;
7244 # tmp->lineno = @1.first_line;
7250 def p_gate_instance_4(p
):
7251 '''gate_instance : IDENTIFIER dimensions '''
7253 print('gate_instance_4', list(p
))
7256 # { lgate*tmp = new lgate;
7257 # list<pform_range_t>*rng = p[2];
7260 # tmp->parms_by_name = 0;
7261 # tmp->range = rng->front();
7263 # assert(rng->empty());
7264 # tmp->file = @1.text;
7265 # tmp->lineno = @1.first_line;
7273 def p_gate_instance_5(p
):
7274 '''gate_instance : IDENTIFIER '(' port_name_list ')' '''
7276 print('gate_instance_5', list(p
))
7279 # { lgate*tmp = new lgate;
7282 # tmp->parms_by_name = p[3];
7283 # tmp->file = @1.text;
7284 # tmp->lineno = @1.first_line;
7291 def p_gate_instance_6(p
):
7292 '''gate_instance : IDENTIFIER dimensions '(' port_name_list ')' '''
7294 print('gate_instance_6', list(p
))
7297 # { lgate*tmp = new lgate;
7298 # list<pform_range_t>*rng = p[2];
7301 # tmp->parms_by_name = p[4];
7302 # tmp->range = rng->front();
7304 # assert(rng->empty());
7305 # tmp->file = @1.text;
7306 # tmp->lineno = @1.first_line;
7314 def p_gate_instance_7(p
):
7315 '''gate_instance : IDENTIFIER '(' error ')' '''
7317 print('gate_instance_7', list(p
))
7320 # { lgate*tmp = new lgate;
7323 # tmp->parms_by_name = 0;
7324 # tmp->file = @1.text;
7325 # tmp->lineno = @1.first_line;
7326 # yyerror(@2, "error: Syntax error in instance port "
7327 # "expression(s).");
7334 def p_gate_instance_8(p
):
7335 '''gate_instance : IDENTIFIER dimensions '(' error ')' '''
7337 print('gate_instance_8', list(p
))
7340 # { lgate*tmp = new lgate;
7343 # tmp->parms_by_name = 0;
7344 # tmp->file = @1.text;
7345 # tmp->lineno = @1.first_line;
7346 # yyerror(@3, "error: Syntax error in instance port "
7347 # "expression(s).");
7354 def p_gate_instance_list_1(p
):
7355 '''gate_instance_list : gate_instance_list ',' gate_instance '''
7357 print('gate_instance_list_1', list(p
))
7360 # { svector<lgate>*tmp1 = p[1];
7361 # lgate*tmp2 = p[3];
7362 # svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
7370 def p_gate_instance_list_2(p
):
7371 '''gate_instance_list : gate_instance '''
7373 print('gate_instance_list_2', list(p
))
7376 # { svector<lgate>*tmp = new svector<lgate>(1);
7377 # (*tmp)[0] = *p[1];
7384 def p_gatetype_1(p
):
7385 '''gatetype : K_and '''
7387 print('gatetype_1', list(p
))
7390 # { p[0] = PGBuiltin::AND; }
7394 def p_gatetype_2(p
):
7395 '''gatetype : K_nand '''
7397 print('gatetype_2', list(p
))
7400 # { p[0] = PGBuiltin::NAND; }
7404 def p_gatetype_3(p
):
7405 '''gatetype : K_or '''
7407 print('gatetype_3', list(p
))
7410 # { p[0] = PGBuiltin::OR; }
7414 def p_gatetype_4(p
):
7415 '''gatetype : K_nor '''
7417 print('gatetype_4', list(p
))
7420 # { p[0] = PGBuiltin::NOR; }
7424 def p_gatetype_5(p
):
7425 '''gatetype : K_xor '''
7427 print('gatetype_5', list(p
))
7430 # { p[0] = PGBuiltin::XOR; }
7434 def p_gatetype_6(p
):
7435 '''gatetype : K_xnor '''
7437 print('gatetype_6', list(p
))
7440 # { p[0] = PGBuiltin::XNOR; }
7444 def p_gatetype_7(p
):
7445 '''gatetype : K_buf '''
7447 print('gatetype_7', list(p
))
7450 # { p[0] = PGBuiltin::BUF; }
7454 def p_gatetype_8(p
):
7455 '''gatetype : K_bufif0 '''
7457 print('gatetype_8', list(p
))
7460 # { p[0] = PGBuiltin::BUFIF0; }
7464 def p_gatetype_9(p
):
7465 '''gatetype : K_bufif1 '''
7467 print('gatetype_9', list(p
))
7470 # { p[0] = PGBuiltin::BUFIF1; }
7474 def p_gatetype_10(p
):
7475 '''gatetype : K_not '''
7477 print('gatetype_10', list(p
))
7480 # { p[0] = PGBuiltin::NOT; }
7484 def p_gatetype_11(p
):
7485 '''gatetype : K_notif0 '''
7487 print('gatetype_11', list(p
))
7490 # { p[0] = PGBuiltin::NOTIF0; }
7494 def p_gatetype_12(p
):
7495 '''gatetype : K_notif1 '''
7497 print('gatetype_12', list(p
))
7500 # { p[0] = PGBuiltin::NOTIF1; }
7504 def p_switchtype_1(p
):
7505 '''switchtype : K_nmos '''
7507 print('switchtype_1', list(p
))
7510 # { p[0] = PGBuiltin::NMOS; }
7514 def p_switchtype_2(p
):
7515 '''switchtype : K_rnmos '''
7517 print('switchtype_2', list(p
))
7520 # { p[0] = PGBuiltin::RNMOS; }
7524 def p_switchtype_3(p
):
7525 '''switchtype : K_pmos '''
7527 print('switchtype_3', list(p
))
7530 # { p[0] = PGBuiltin::PMOS; }
7534 def p_switchtype_4(p
):
7535 '''switchtype : K_rpmos '''
7537 print('switchtype_4', list(p
))
7540 # { p[0] = PGBuiltin::RPMOS; }
7544 def p_switchtype_5(p
):
7545 '''switchtype : K_cmos '''
7547 print('switchtype_5', list(p
))
7550 # { p[0] = PGBuiltin::CMOS; }
7554 def p_switchtype_6(p
):
7555 '''switchtype : K_rcmos '''
7557 print('switchtype_6', list(p
))
7560 # { p[0] = PGBuiltin::RCMOS; }
7564 def p_switchtype_7(p
):
7565 '''switchtype : K_tran '''
7567 print('switchtype_7', list(p
))
7570 # { p[0] = PGBuiltin::TRAN; }
7574 def p_switchtype_8(p
):
7575 '''switchtype : K_rtran '''
7577 print('switchtype_8', list(p
))
7580 # { p[0] = PGBuiltin::RTRAN; }
7584 def p_switchtype_9(p
):
7585 '''switchtype : K_tranif0 '''
7587 print('switchtype_9', list(p
))
7590 # { p[0] = PGBuiltin::TRANIF0; }
7594 def p_switchtype_10(p
):
7595 '''switchtype : K_tranif1 '''
7597 print('switchtype_10', list(p
))
7600 # { p[0] = PGBuiltin::TRANIF1; }
7604 def p_switchtype_11(p
):
7605 '''switchtype : K_rtranif0 '''
7607 print('switchtype_11', list(p
))
7610 # { p[0] = PGBuiltin::RTRANIF0; }
7614 def p_switchtype_12(p
):
7615 '''switchtype : K_rtranif1 '''
7617 print('switchtype_12', list(p
))
7620 # { p[0] = PGBuiltin::RTRANIF1; }
7624 def p_hierarchy_identifier_1(p
):
7625 '''hierarchy_identifier : IDENTIFIER '''
7627 print('hierarchy_identifier_1 FIXME', list(p
))
7628 lpvalue
= Leaf(token
.NAME
, p
[1])
7632 # { p[0] = new pform_name_t;
7633 # p[0]->push_back(name_component_t(lex_strings.make(p[1])));
7639 def p_hierarchy_identifier_2(p
):
7640 '''hierarchy_identifier : hierarchy_identifier '.' IDENTIFIER '''
7642 print('hierarchy_identifier_2', list(p
))
7645 # { pform_name_t * tmp = p[1];
7646 # tmp->push_back(name_component_t(lex_strings.make(p[3])));
7653 def p_hierarchy_identifier_3(p
):
7654 '''hierarchy_identifier : hierarchy_identifier '[' expression ']' '''
7656 print('hierarchy_identifier_3', list(p
))
7659 # { pform_name_t * tmp = p[1];
7660 # name_component_t&tail = tmp->back();
7661 # index_component_t itmp;
7662 # itmp.sel = index_component_t::SEL_BIT;
7664 # tail.index.push_back(itmp);
7670 def p_hierarchy_identifier_4(p
):
7671 '''hierarchy_identifier : hierarchy_identifier '[' '$' ']' '''
7673 print('hierarchy_identifier_4', list(p
))
7676 # { pform_name_t * tmp = p[1];
7677 # name_component_t&tail = tmp->back();
7678 # if (! gn_system_verilog()) {
7679 # yyerror(@3, "error: Last element expression ($) "
7680 # "requires SystemVerilog. Try enabling SystemVerilog.");
7682 # index_component_t itmp;
7683 # itmp.sel = index_component_t::SEL_BIT_LAST;
7686 # tail.index.push_back(itmp);
7692 def p_hierarchy_identifier_5(p
):
7693 '''hierarchy_identifier : hierarchy_identifier '[' expression ':' expression ']' '''
7695 print('hierarchy_identifier_5', list(p
))
7698 # { pform_name_t * tmp = p[1];
7699 # name_component_t&tail = tmp->back();
7700 # index_component_t itmp;
7701 # itmp.sel = index_component_t::SEL_PART;
7704 # tail.index.push_back(itmp);
7710 def p_hierarchy_identifier_6(p
):
7711 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_POS expression ']' '''
7713 print('hierarchy_identifier_6', list(p
))
7716 # { pform_name_t * tmp = p[1];
7717 # name_component_t&tail = tmp->back();
7718 # index_component_t itmp;
7719 # itmp.sel = index_component_t::SEL_IDX_UP;
7722 # tail.index.push_back(itmp);
7728 def p_hierarchy_identifier_7(p
):
7729 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_NEG expression ']' '''
7731 print('hierarchy_identifier_7', list(p
))
7734 # { pform_name_t * tmp = p[1];
7735 # name_component_t&tail = tmp->back();
7736 # index_component_t itmp;
7737 # itmp.sel = index_component_t::SEL_IDX_DO;
7740 # tail.index.push_back(itmp);
7746 def p_list_of_identifiers_1(p
):
7747 '''list_of_identifiers : IDENTIFIER '''
7749 print('list_of_identifiers_1', list(p
))
7752 # { p[0] = list_from_identifier(p[1]); }
7756 def p_list_of_identifiers_2(p
):
7757 '''list_of_identifiers : list_of_identifiers ',' IDENTIFIER '''
7759 print('list_of_identifiers_2', list(p
))
7762 # { p[0] = list_from_identifier(p[1], p[3]); }
7766 def p_list_of_port_identifiers_1(p
):
7767 '''list_of_port_identifiers : IDENTIFIER dimensions_opt '''
7769 print('list_of_port_identifiers_1', list(p
))
7772 # { p[0] = make_port_list(p[1], p[2], 0); }
7776 def p_list_of_port_identifiers_2(p
):
7777 '''list_of_port_identifiers : list_of_port_identifiers ',' IDENTIFIER dimensions_opt '''
7779 print('list_of_port_identifiers_2', list(p
))
7782 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
7786 def p_list_of_variable_port_identifiers_1(p
):
7787 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '''
7789 print('list_of_variable_port_identifiers_1', list(p
))
7792 # { p[0] = make_port_list(p[1], p[2], 0); }
7796 def p_list_of_variable_port_identifiers_2(p
):
7797 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '=' expression '''
7799 print('list_of_variable_port_identifiers_2', list(p
))
7802 # { p[0] = make_port_list(p[1], p[2], p[4]); }
7806 def p_list_of_variable_port_identifiers_3(p
):
7807 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '''
7809 print('list_of_variable_port_identifiers_3', list(p
))
7812 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
7816 def p_list_of_variable_port_identifiers_4(p
):
7817 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '=' expression '''
7819 print('list_of_variable_port_identifiers_4', list(p
))
7822 # { p[0] = make_port_list(p[1], p[3], p[4], p[6]); }
7826 def p_list_of_ports_1(p
):
7827 '''list_of_ports : port_opt '''
7829 print('list_of_ports_1', list(p
))
7832 # { vector<Module::port_t*>*tmp
7833 # = new vector<Module::port_t*>(1);
7840 def p_list_of_ports_2(p
):
7841 '''list_of_ports : list_of_ports ',' port_opt '''
7843 print('list_of_ports_2', list(p
))
7846 # { vector<Module::port_t*>*tmp = p[1];
7847 # tmp->push_back(p[3]);
7853 def p_list_of_port_declarations_1(p
):
7854 '''list_of_port_declarations : port_declaration '''
7855 if(parse_debug
> 1):
7856 print('list_of_port_declarations_1', list(p
))
7860 # { vector<Module::port_t*>*tmp
7861 # = new vector<Module::port_t*>(1);
7868 def p_list_of_port_declarations_2(p
):
7869 '''list_of_port_declarations : list_of_port_declarations ',' port_declaration '''
7871 print('list_of_port_declarations_2 FIXME', list(p
))
7872 # MOVE_TO absyn p[1].append(Leaf(token.NEWLINE, '\n')) # should be a comma
7873 # XXX p[3].prefix=' ' # add a space after the NL, must go in parameter
7878 # { vector<Module::port_t*>*tmp = p[1];
7879 # tmp->push_back(p[3]);
7885 def p_list_of_port_declarations_3(p
):
7886 '''list_of_port_declarations : list_of_port_declarations ',' IDENTIFIER '''
7888 print('list_of_port_declarations_3', list(p
))
7891 # { Module::port_t*ptmp;
7892 # perm_string name = lex_strings.make(p[3]);
7893 # ptmp = pform_module_port_reference(name, @3.text,
7895 # vector<Module::port_t*>*tmp = p[1];
7896 # tmp->push_back(ptmp);
7898 # /* Get the port declaration details, the port type
7899 # and what not, from context data stored by the
7900 # last port_declaration rule. */
7901 # pform_module_define_port(@3, name,
7902 # port_declaration_context.port_type,
7903 # port_declaration_context.port_net_type,
7904 # port_declaration_context.data_type, 0);
7911 def p_list_of_port_declarations_4(p
):
7912 '''list_of_port_declarations : list_of_port_declarations ',' '''
7914 print('list_of_port_declarations_4', list(p
))
7918 # yyerror(@2, "error: NULL port declarations are not "
7924 def p_list_of_port_declarations_5(p
):
7925 '''list_of_port_declarations : list_of_port_declarations ';' '''
7927 print('list_of_port_declarations_5', list(p
))
7931 # yyerror(@2, "error: ';' is an invalid port declaration "
7937 def p_port_declaration_1(p
):
7938 '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7940 print('port_declaration_1 FIXME', list(p
))
7941 comment
, dt
, name
= p
[2], p
[4], p
[5]
7942 p
[0] = absyn
.port_decl(comment
, dt
, name
)
7945 # { Module::port_t*ptmp;
7946 # perm_string name = lex_strings.make(p[5]);
7947 # data_type_t*use_type = p[4];
7948 # if (p[6]) use_type = new uarray_type_t(use_type, p[6]);
7949 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7950 # pform_module_define_port(@2, name, NetNet::PINPUT, p[3], use_type, p[1]);
7951 # port_declaration_context.port_type = NetNet::PINPUT;
7952 # port_declaration_context.port_net_type = p[3];
7953 # port_declaration_context.data_type = p[4];
7960 def p_port_declaration_2(p
):
7961 '''port_declaration : attribute_list_opt K_input K_wreal IDENTIFIER '''
7963 print('port_declaration_2', list(p
))
7966 # { Module::port_t*ptmp;
7967 # perm_string name = lex_strings.make(p[4]);
7968 # ptmp = pform_module_port_reference(name, @2.text,
7970 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7971 # FILE_NAME(real_type, @3);
7972 # pform_module_define_port(@2, name, NetNet::PINPUT,
7973 # NetNet::WIRE, real_type, p[1]);
7974 # port_declaration_context.port_type = NetNet::PINPUT;
7975 # port_declaration_context.port_net_type = NetNet::WIRE;
7976 # port_declaration_context.data_type = real_type;
7983 def p_port_declaration_3(p
):
7984 '''port_declaration : attribute_list_opt K_inout net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7986 print('port_declaration_3', list(p
))
7989 # { Module::port_t*ptmp;
7990 # perm_string name = lex_strings.make(p[5]);
7991 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7992 # pform_module_define_port(@2, name, NetNet::PINOUT, p[3], p[4], p[1]);
7993 # port_declaration_context.port_type = NetNet::PINOUT;
7994 # port_declaration_context.port_net_type = p[3];
7995 # port_declaration_context.data_type = p[4];
7998 # yyerror(@6, "sorry: Inout ports with unpacked dimensions not supported.");
8006 def p_port_declaration_4(p
):
8007 '''port_declaration : attribute_list_opt K_inout K_wreal IDENTIFIER '''
8009 print('port_declaration_4', list(p
))
8012 # { Module::port_t*ptmp;
8013 # perm_string name = lex_strings.make(p[4]);
8014 # ptmp = pform_module_port_reference(name, @2.text,
8016 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
8017 # FILE_NAME(real_type, @3);
8018 # pform_module_define_port(@2, name, NetNet::PINOUT,
8019 # NetNet::WIRE, real_type, p[1]);
8020 # port_declaration_context.port_type = NetNet::PINOUT;
8021 # port_declaration_context.port_net_type = NetNet::WIRE;
8022 # port_declaration_context.data_type = real_type;
8029 def p_port_declaration_5(p
):
8030 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
8032 print('port_declaration_5 FIXME', list(p
))
8033 comment
, dt
, name
= p
[2], p
[4], p
[5]
8034 p
[0] = absyn
.port_decl(comment
, dt
, name
)
8037 # { Module::port_t*ptmp;
8038 # perm_string name = lex_strings.make(p[5]);
8039 # data_type_t*use_dtype = p[4];
8040 # if (p[6]) use_dtype = new uarray_type_t(use_dtype, p[6]);
8041 # NetNet::Type use_type = p[3];
8042 # if (use_type == NetNet::IMPLICIT) {
8043 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
8044 # if (dtype->reg_flag)
8045 # use_type = NetNet::REG;
8046 # else if (dtype->implicit_flag)
8047 # use_type = NetNet::IMPLICIT;
8049 # use_type = NetNet::IMPLICIT_REG;
8051 # // The SystemVerilog types that can show up as
8052 # // output ports are implicitly (on the inside)
8053 # // variables because "reg" is not valid syntax
8055 # } else if (dynamic_cast<atom2_type_t*> (p[4])) {
8056 # use_type = NetNet::IMPLICIT_REG;
8057 # } else if (dynamic_cast<struct_type_t*> (p[4])) {
8058 # use_type = NetNet::IMPLICIT_REG;
8059 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[4])) {
8060 # if(etype->base_type == IVL_VT_LOGIC)
8061 # use_type = NetNet::IMPLICIT_REG;
8064 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
8065 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, use_dtype, p[1]);
8066 # port_declaration_context.port_type = NetNet::POUTPUT;
8067 # port_declaration_context.port_net_type = use_type;
8068 # port_declaration_context.data_type = p[4];
8075 def p_port_declaration_6(p
):
8076 '''port_declaration : attribute_list_opt K_output K_wreal IDENTIFIER '''
8078 print('port_declaration_6', list(p
))
8081 # { Module::port_t*ptmp;
8082 # perm_string name = lex_strings.make(p[4]);
8083 # ptmp = pform_module_port_reference(name, @2.text,
8085 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
8086 # FILE_NAME(real_type, @3);
8087 # pform_module_define_port(@2, name, NetNet::POUTPUT,
8088 # NetNet::WIRE, real_type, p[1]);
8089 # port_declaration_context.port_type = NetNet::POUTPUT;
8090 # port_declaration_context.port_net_type = NetNet::WIRE;
8091 # port_declaration_context.data_type = real_type;
8098 def p_port_declaration_7(p
):
8099 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER '=' expression '''
8101 print('port_declaration_7', list(p
))
8104 # { Module::port_t*ptmp;
8105 # perm_string name = lex_strings.make(p[5]);
8106 # NetNet::Type use_type = p[3];
8107 # if (use_type == NetNet::IMPLICIT) {
8108 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
8109 # if (dtype->reg_flag)
8110 # use_type = NetNet::REG;
8112 # use_type = NetNet::IMPLICIT_REG;
8114 # use_type = NetNet::IMPLICIT_REG;
8117 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
8118 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, p[4], p[1]);
8119 # port_declaration_context.port_type = NetNet::PINOUT;
8120 # port_declaration_context.port_net_type = use_type;
8121 # port_declaration_context.data_type = p[4];
8123 # pform_make_var_init(@5, name, p[7]);
8131 def p_net_type_opt_1(p
):
8132 '''net_type_opt : net_type '''
8134 print('net_type_opt_1', list(p
))
8141 def p_net_type_opt_2(p
):
8142 '''net_type_opt : '''
8143 if(parse_debug
> 2):
8144 print('net_type_opt_2', list(p
))
8151 def p_unsigned_signed_opt_1(p
):
8152 '''unsigned_signed_opt : K_signed '''
8154 print('unsigned_signed_opt_1', list(p
))
8161 def p_unsigned_signed_opt_2(p
):
8162 '''unsigned_signed_opt : K_unsigned '''
8164 print('unsigned_signed_opt_2', list(p
))
8171 def p_unsigned_signed_opt_3(p
):
8172 '''unsigned_signed_opt : '''
8174 print('unsigned_signed_opt_3', list(p
))
8181 def p_signed_unsigned_opt_1(p
):
8182 '''signed_unsigned_opt : K_signed '''
8184 print('signed_unsigned_opt_1', list(p
))
8191 def p_signed_unsigned_opt_2(p
):
8192 '''signed_unsigned_opt : K_unsigned '''
8194 print('signed_unsigned_opt_2', list(p
))
8201 def p_signed_unsigned_opt_3(p
):
8202 '''signed_unsigned_opt : '''
8204 print('signed_unsigned_opt_3', list(p
))
8211 def p_atom2_type_1(p
):
8212 '''atom2_type : K_byte '''
8214 print('atom2_type_1', list(p
))
8221 def p_atom2_type_2(p
):
8222 '''atom2_type : K_shortint '''
8224 print('atom2_type_2', list(p
))
8231 def p_atom2_type_3(p
):
8232 '''atom2_type : K_int '''
8234 print('atom2_type_3', list(p
))
8241 def p_atom2_type_4(p
):
8242 '''atom2_type : K_longint '''
8244 print('atom2_type_4', list(p
))
8252 '''lpvalue : hierarchy_identifier '''
8253 if(parse_debug
> 2):
8254 print('lpvalue_1', list(p
))
8258 # { PEIdent*tmp = pform_new_ident(*p[1]);
8259 # FILE_NAME(tmp, @1);
8267 '''lpvalue : implicit_class_handle '.' hierarchy_identifier '''
8269 print('lpvalue_2', list(p
))
8272 # { pform_name_t*t_name = p[1];
8273 # while (!p[3]->empty()) {
8274 # t_name->push_back(p[3]->front());
8275 # p[3]->pop_front();
8277 # PEIdent*tmp = new PEIdent(*t_name);
8278 # FILE_NAME(tmp, @1);
8287 '''lpvalue : '{' expression_list_proper '}' '''
8289 print('lpvalue_3', list(p
))
8292 # { PEConcat*tmp = new PEConcat(*p[2]);
8293 # FILE_NAME(tmp, @1);
8301 '''lpvalue : streaming_concatenation '''
8303 print('lpvalue_4', list(p
))
8306 # { yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
8312 def p_cont_assign_1(p
):
8313 '''cont_assign : lpvalue '=' expression '''
8315 print('cont_assign_1', list(p
))
8316 absyn
.cont_assign_1(p
)
8319 # { list<PExpr*>*tmp = new list<PExpr*>;
8320 # tmp->push_back(p[1]);
8321 # tmp->push_back(p[3]);
8327 def p_cont_assign_list_1(p
):
8328 '''cont_assign_list : cont_assign_list ',' cont_assign '''
8330 print('cont_assign_list_1', list(p
))
8333 # { list<PExpr*>*tmp = p[1];
8334 # tmp->splice(tmp->end(), *p[3]);
8341 def p_cont_assign_list_2(p
):
8342 '''cont_assign_list : cont_assign '''
8343 if(parse_debug
> 2):
8344 print('cont_assign_list_2', list(p
))
8352 '''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 '''
8353 if(parse_debug
> 2):
8354 print('module_1', list(p
))
8355 clsdecl
= absyn
.module_1(p
)
8362 def p__embed0_module(p
):
8363 '''_embed0_module : '''
8366 # { pform_startmodule(@2, p[4], p[2]==K_program, p[2]==K_interface, p[3], p[1]); }
8370 def p__embed1_module(p
):
8371 '''_embed1_module : '''
8374 # { pform_module_set_ports(p[8]); }
8378 def p__embed2_module(p
):
8379 '''_embed2_module : '''
8382 # { pform_set_scope_timescale(@2); }
8386 def p__embed3_module(p
):
8387 '''_embed3_module : '''
8390 # { Module::UCDriveType ucd;
8391 # // The lexor detected `unconnected_drive directives and
8392 # // marked what it found in the uc_drive variable. Use that
8393 # // to generate a UCD flag for the module.
8394 # switch (uc_drive) {
8397 # ucd = Module::UCD_NONE;
8400 # ucd = Module::UCD_PULL0;
8403 # ucd = Module::UCD_PULL1;
8406 # // Check that program/endprogram and module/endmodule
8407 # // keywords match.
8408 # if (p[2] != p[15]) {
8411 # yyerror(@15, "error: module not closed by endmodule.");
8414 # yyerror(@15, "error: program not closed by endprogram.");
8417 # yyerror(@15, "error: interface not closed by endinterface.");
8423 # pform_endmodule(p[4], in_celldefine, ucd);
8428 def p_module_start_1(p
):
8429 '''module_start : K_module '''
8430 if(parse_debug
> 1):
8431 print('module_start_1', list(p
))
8434 # { p[0] = K_module; }
8438 def p_module_start_2(p
):
8439 '''module_start : K_macromodule '''
8441 print('module_start_2', list(p
))
8444 # { p[0] = K_module; }
8448 def p_module_start_3(p
):
8449 '''module_start : K_program '''
8451 print('module_start_3', list(p
))
8454 # { p[0] = K_program; }
8458 def p_module_start_4(p
):
8459 '''module_start : K_interface '''
8461 print('module_start_4', list(p
))
8464 # { p[0] = K_interface; }
8468 def p_module_end_1(p
):
8469 '''module_end : K_endmodule '''
8470 if(parse_debug
> 2):
8471 print('module_end_1', list(p
))
8474 # { p[0] = K_module; }
8478 def p_module_end_2(p
):
8479 '''module_end : K_endprogram '''
8481 print('module_end_2', list(p
))
8484 # { p[0] = K_program; }
8488 def p_module_end_3(p
):
8489 '''module_end : K_endinterface '''
8491 print('module_end_3', list(p
))
8494 # { p[0] = K_interface; }
8498 def p_endlabel_opt_1(p
):
8499 '''endlabel_opt : ':' IDENTIFIER '''
8501 print('endlabel_opt_1', list(p
))
8508 def p_endlabel_opt_2(p
):
8509 '''endlabel_opt : '''
8510 if(parse_debug
> 2):
8511 print('endlabel_opt_2', list(p
))
8518 def p_module_attribute_foreign_1(p
):
8519 '''module_attribute_foreign : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP '''
8521 print('module_attribute_foreign_1', list(p
))
8528 def p_module_attribute_foreign_2(p
):
8529 '''module_attribute_foreign : '''
8530 if(parse_debug
> 2):
8531 print('module_attribute_foreign_2', list(p
))
8538 def p_module_port_list_opt_1(p
):
8539 '''module_port_list_opt : '(' list_of_ports ')' '''
8541 print('module_port_list_opt_1', list(p
))
8548 def p_module_port_list_opt_2(p
):
8549 '''module_port_list_opt : '(' list_of_port_declarations ')' '''
8550 if(parse_debug
> 2):
8551 print('module_port_list_opt_2', list(p
))
8558 def p_module_port_list_opt_3(p
):
8559 '''module_port_list_opt : '''
8561 print('module_port_list_opt_3', list(p
))
8568 def p_module_port_list_opt_4(p
):
8569 '''module_port_list_opt : '(' error ')' '''
8571 print('module_port_list_opt_4', list(p
))
8574 # { yyerror(@2, "Errors in port declarations.");
8581 def p_module_parameter_port_list_opt_1(p
):
8582 '''module_parameter_port_list_opt : '''
8583 if(parse_debug
> 2):
8584 print('module_parameter_port_list_opt_1', list(p
))
8590 def p_module_parameter_port_list_opt_2(p
):
8591 '''module_parameter_port_list_opt : '#' '(' module_parameter_port_list ')' '''
8593 print('module_parameter_port_list_opt_2', list(p
))
8600 def p_module_parameter_port_list_1(p
):
8601 '''module_parameter_port_list : K_parameter param_type parameter_assign '''
8603 print('module_parameter_port_list_1', list(p
))
8610 def p_module_parameter_port_list_2(p
):
8611 '''module_parameter_port_list : module_parameter_port_list ',' parameter_assign '''
8613 print('module_parameter_port_list_2', list(p
))
8614 p
[0] = p
[1].append(p
[3])
8620 def p_module_parameter_port_list_3(p
):
8621 '''module_parameter_port_list : module_parameter_port_list ',' K_parameter param_type parameter_assign '''
8623 print('module_parameter_port_list_3', list(p
))
8624 p
[1].append(Leaf(token
.COMMA
, ','))
8625 p
[1].append(Leaf(token
.NEWLINE
, '\n'))
8626 p
[5].prefix
= ' ' # add space after newline
8634 def p_module_item_1(p
):
8635 '''module_item : module '''
8637 print('module_item_1', list(p
))
8643 def p_module_item_2(p
):
8644 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' '''
8646 print('module_item_2', list(p
))
8648 p
[0] = absyn
.module_item_2(p
[2], p
[3], p
[5])
8649 #p[0] = ["module_item_2"]+list(p)
8652 # { data_type_t*data_type = p[3];
8653 # if (data_type == 0) {
8654 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8655 # FILE_NAME(data_type, @2);
8657 # pform_set_data_type(@2, data_type, p[5], p[2], p[1]);
8659 # yyerror(@2, "sorry: net delays not supported.");
8667 def p_module_item_3(p
):
8668 '''module_item : attribute_list_opt K_wreal delay3 net_variable_list ';' '''
8670 print('module_item_3', list(p
))
8673 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
8674 # pform_set_data_type(@2, tmpt, p[4], NetNet::WIRE, p[1]);
8676 # yyerror(@3, "sorry: net delays not supported.");
8684 def p_module_item_4(p
):
8685 '''module_item : attribute_list_opt K_wreal net_variable_list ';' '''
8687 print('module_item_4', list(p
))
8690 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
8691 # pform_set_data_type(@2, tmpt, p[3], NetNet::WIRE, p[1]);
8697 def p_module_item_5(p
):
8698 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_decl_assigns ';' '''
8700 print('module_item_5', list(p
))
8703 # { data_type_t*data_type = p[3];
8704 # if (data_type == 0) {
8705 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8706 # FILE_NAME(data_type, @2);
8708 # pform_makewire(@2, p[4], str_strength, p[5], p[2], data_type);
8710 # yywarn(@2, "Attributes are not supported on net declaration "
8711 # "assignments and will be discarded.");
8718 def p_module_item_6(p
):
8719 '''module_item : attribute_list_opt net_type data_type_or_implicit drive_strength net_decl_assigns ';' '''
8721 print('module_item_6', list(p
))
8724 # { data_type_t*data_type = p[3];
8725 # if (data_type == 0) {
8726 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8727 # FILE_NAME(data_type, @2);
8729 # pform_makewire(@2, 0, p[4], p[5], p[2], data_type);
8731 # yywarn(@2, "Attributes are not supported on net declaration "
8732 # "assignments and will be discarded.");
8739 def p_module_item_7(p
):
8740 '''module_item : attribute_list_opt K_wreal net_decl_assigns ';' '''
8742 print('module_item_7', list(p
))
8745 # { real_type_t*data_type = new real_type_t(real_type_t::REAL);
8746 # pform_makewire(@2, 0, str_strength, p[3], NetNet::WIRE, data_type);
8748 # yywarn(@2, "Attributes are not supported on net declaration "
8749 # "assignments and will be discarded.");
8756 def p_module_item_8(p
):
8757 '''module_item : K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' '''
8759 print('module_item_8', list(p
))
8762 # { yyerror(@1, "sorry: trireg nets not supported.");
8769 def p_module_item_9(p
):
8770 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit list_of_port_identifiers ';' '''
8772 print('module_item_9', list(p
))
8775 # { pform_module_define_port(@2, p[5], p[2], p[3], p[4], p[1]); }
8779 def p_module_item_10(p
):
8780 '''module_item : attribute_list_opt port_direction K_wreal list_of_port_identifiers ';' '''
8782 print('module_item_10', list(p
))
8785 # { real_type_t*real_type = new real_type_t(real_type_t::REAL);
8786 # pform_module_define_port(@2, p[4], p[2], NetNet::WIRE, real_type, p[1]);
8791 def p_module_item_11(p
):
8792 '''module_item : attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' '''
8794 print('module_item_11', list(p
))
8797 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8798 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8799 # if (dtype->implicit_flag)
8800 # use_type = NetNet::NONE;
8802 # if (use_type == NetNet::NONE)
8803 # pform_set_port_type(@2, p[4], NetNet::PINOUT, p[3], p[1]);
8805 # pform_module_define_port(@2, p[4], NetNet::PINOUT, use_type, p[3], p[1]);
8810 def p_module_item_12(p
):
8811 '''module_item : attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' '''
8813 print('module_item_12', list(p
))
8816 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8817 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8818 # if (dtype->implicit_flag)
8819 # use_type = NetNet::NONE;
8821 # if (use_type == NetNet::NONE)
8822 # pform_set_port_type(@2, p[4], NetNet::PINPUT, p[3], p[1]);
8824 # pform_module_define_port(@2, p[4], NetNet::PINPUT, use_type, p[3], p[1]);
8829 def p_module_item_13(p
):
8830 '''module_item : attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' '''
8832 print('module_item_13', list(p
))
8835 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8836 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8837 # if (dtype->implicit_flag)
8838 # use_type = NetNet::NONE;
8839 # else if (dtype->reg_flag)
8840 # use_type = NetNet::REG;
8842 # use_type = NetNet::IMPLICIT_REG;
8844 # // The SystemVerilog types that can show up as
8845 # // output ports are implicitly (on the inside)
8846 # // variables because "reg" is not valid syntax
8848 # } else if (dynamic_cast<atom2_type_t*> (p[3])) {
8849 # use_type = NetNet::IMPLICIT_REG;
8850 # } else if (dynamic_cast<struct_type_t*> (p[3])) {
8851 # use_type = NetNet::IMPLICIT_REG;
8852 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[3])) {
8853 # if(etype->base_type == IVL_VT_LOGIC)
8854 # use_type = NetNet::IMPLICIT_REG;
8856 # if (use_type == NetNet::NONE)
8857 # pform_set_port_type(@2, p[4], NetNet::POUTPUT, p[3], p[1]);
8859 # pform_module_define_port(@2, p[4], NetNet::POUTPUT, use_type, p[3], p[1]);
8864 def p_module_item_14(p
):
8865 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit error ';' '''
8867 print('module_item_14', list(p
))
8870 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8871 # if (p[1]) delete p[1];
8872 # if (p[4]) delete p[4];
8878 def p_module_item_15(p
):
8879 '''module_item : attribute_list_opt K_inout data_type_or_implicit error ';' '''
8881 print('module_item_15', list(p
))
8884 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8885 # if (p[1]) delete p[1];
8886 # if (p[3]) delete p[3];
8892 def p_module_item_16(p
):
8893 '''module_item : attribute_list_opt K_input data_type_or_implicit error ';' '''
8895 print('module_item_16', list(p
))
8898 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8899 # if (p[1]) delete p[1];
8900 # if (p[3]) delete p[3];
8906 def p_module_item_17(p
):
8907 '''module_item : attribute_list_opt K_output data_type_or_implicit error ';' '''
8909 print('module_item_17', list(p
))
8912 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8913 # if (p[1]) delete p[1];
8914 # if (p[3]) delete p[3];
8920 def p_module_item_18(p
):
8921 '''module_item : DISCIPLINE_IDENTIFIER list_of_identifiers ';' '''
8923 print('module_item_18', list(p
))
8926 # { pform_attach_discipline(@1, p[1], p[2]); }
8930 def p_module_item_19(p
):
8931 '''module_item : attribute_list_opt _embed0_module_item block_item_decl '''
8933 print('module_item_19', list(p
))
8936 # { delete attributes_in_context;
8937 # attributes_in_context = 0;
8942 def p_module_item_20(p
):
8943 '''module_item : K_defparam _embed1_module_item defparam_assign_list ';' '''
8945 print('module_item_20', list(p
))
8951 def p_module_item_21(p
):
8952 '''module_item : attribute_list_opt gatetype gate_instance_list ';' '''
8954 print('module_item_21', list(p
))
8957 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
8961 def p_module_item_22(p
):
8962 '''module_item : attribute_list_opt gatetype delay3 gate_instance_list ';' '''
8964 print('module_item_22', list(p
))
8967 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
8971 def p_module_item_23(p
):
8972 '''module_item : attribute_list_opt gatetype drive_strength gate_instance_list ';' '''
8974 print('module_item_23', list(p
))
8977 # { pform_makegates(@2, p[2], p[3], 0, p[4], p[1]); }
8981 def p_module_item_24(p
):
8982 '''module_item : attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';' '''
8984 print('module_item_24', list(p
))
8987 # { pform_makegates(@2, p[2], p[3], p[4], p[5], p[1]); }
8991 def p_module_item_25(p
):
8992 '''module_item : attribute_list_opt switchtype gate_instance_list ';' '''
8994 print('module_item_25', list(p
))
8997 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
9001 def p_module_item_26(p
):
9002 '''module_item : attribute_list_opt switchtype delay3 gate_instance_list ';' '''
9004 print('module_item_26', list(p
))
9007 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
9011 def p_module_item_27(p
):
9012 '''module_item : K_pullup gate_instance_list ';' '''
9014 print('module_item_27', list(p
))
9017 # { pform_makegates(@1, PGBuiltin::PULLUP, pull_strength, 0, p[2], 0); }
9021 def p_module_item_28(p
):
9022 '''module_item : K_pulldown gate_instance_list ';' '''
9024 print('module_item_28', list(p
))
9027 # { pform_makegates(@1, PGBuiltin::PULLDOWN, pull_strength, 0, p[2], 0); }
9031 def p_module_item_29(p
):
9032 '''module_item : K_pullup '(' dr_strength1 ')' gate_instance_list ';' '''
9034 print('module_item_29', list(p
))
9037 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[5], 0); }
9041 def p_module_item_30(p
):
9042 '''module_item : K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
9044 print('module_item_30', list(p
))
9047 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[7], 0); }
9051 def p_module_item_31(p
):
9052 '''module_item : K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
9054 print('module_item_31', list(p
))
9057 # { pform_makegates(@1, PGBuiltin::PULLUP, p[5], 0, p[7], 0); }
9061 def p_module_item_32(p
):
9062 '''module_item : K_pulldown '(' dr_strength0 ')' gate_instance_list ';' '''
9064 print('module_item_32', list(p
))
9067 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[5], 0); }
9071 def p_module_item_33(p
):
9072 '''module_item : K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
9074 print('module_item_33', list(p
))
9077 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[5], 0, p[7], 0); }
9081 def p_module_item_34(p
):
9082 '''module_item : K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
9084 print('module_item_34', list(p
))
9087 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[7], 0); }
9091 def p_module_item_35(p
):
9092 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' '''
9094 print('module_item_35', list(p
))
9097 # { perm_string tmp1 = lex_strings.make(p[2]);
9098 # pform_make_modgates(@2, tmp1, p[3], p[4], p[1]);
9104 def p_module_item_36(p
):
9105 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt error ';' '''
9107 print('module_item_36', list(p
))
9110 # { yyerror(@2, "error: Invalid module instantiation");
9112 # if (p[1]) delete p[1];
9117 def p_module_item_37(p
):
9118 '''module_item : K_assign drive_strength_opt delay3_opt cont_assign_list ';' '''
9119 if(parse_debug
> 2):
9120 print('module_item_37', list(p
))
9123 # { pform_make_pgassign_list(p[4], p[3], p[2], @1.text, @1.first_line); }
9127 def p_module_item_38(p
):
9128 '''module_item : attribute_list_opt K_always statement_item '''
9130 print('module_item_38', list(p
))
9133 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, p[3], p[1]);
9134 # FILE_NAME(tmp, @2);
9139 def p_module_item_39(p
):
9140 '''module_item : attribute_list_opt K_always_comb statement_item '''
9142 print('module_item_39', list(p
))
9144 absyn
.always_comb(p
[3], p
[1])
9147 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_COMB, p[3], p[1]);
9148 # FILE_NAME(tmp, @2);
9153 def p_module_item_40(p
):
9154 '''module_item : attribute_list_opt K_always_ff statement_item '''
9156 print('module_item_40', list(p
))
9159 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, p[3], p[1]);
9160 # FILE_NAME(tmp, @2);
9165 def p_module_item_41(p
):
9166 '''module_item : attribute_list_opt K_always_latch statement_item '''
9168 print('module_item_41', list(p
))
9171 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_LATCH, p[3], p[1]);
9172 # FILE_NAME(tmp, @2);
9177 def p_module_item_42(p
):
9178 '''module_item : attribute_list_opt K_initial statement_item '''
9180 print('module_item_42', list(p
))
9183 # { PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, p[3], p[1]);
9184 # FILE_NAME(tmp, @2);
9189 def p_module_item_43(p
):
9190 '''module_item : attribute_list_opt K_final statement_item '''
9192 print('module_item_43', list(p
))
9195 # { PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, p[3], p[1]);
9196 # FILE_NAME(tmp, @2);
9201 def p_module_item_44(p
):
9202 '''module_item : attribute_list_opt K_analog analog_statement '''
9204 print('module_item_44', list(p
))
9207 # { pform_make_analog_behavior(@2, IVL_PR_ALWAYS, p[3]); }
9211 def p_module_item_45(p
):
9212 '''module_item : attribute_list_opt assertion_item '''
9214 print('module_item_45', list(p
))
9220 def p_module_item_46(p
):
9221 '''module_item : timeunits_declaration '''
9223 print('module_item_46', list(p
))
9229 def p_module_item_47(p
):
9230 '''module_item : class_declaration '''
9232 print('module_item_47', list(p
))
9238 def p_module_item_48(p
):
9239 '''module_item : task_declaration '''
9241 print('module_item_48', list(p
))
9247 def p_module_item_49(p
):
9248 '''module_item : function_declaration '''
9250 print('module_item_49', list(p
))
9256 def p_module_item_50(p
):
9257 '''module_item : K_generate generate_item_list_opt K_endgenerate '''
9259 print('module_item_50', list(p
))
9262 # { // Test for bad nesting. I understand it, but it is illegal.
9263 # if (pform_parent_generate()) {
9264 # cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
9265 # cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
9266 # cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
9273 def p_module_item_51(p
):
9274 '''module_item : K_genvar list_of_identifiers ';' '''
9276 print('module_item_51', list(p
))
9279 # { pform_genvars(@1, p[2]); }
9283 def p_module_item_52(p
):
9284 '''module_item : K_for '(' IDENTIFIER '=' expression ';' expression ';' IDENTIFIER '=' expression ')' _embed2_module_item generate_block '''
9286 print('module_item_52', list(p
))
9289 # { pform_endgenerate(); }
9293 def p_module_item_53(p
):
9294 '''module_item : generate_if generate_block_opt K_else _embed3_module_item generate_block '''
9296 print('module_item_53', list(p
))
9299 # { pform_endgenerate(); }
9303 def p_module_item_54(p
):
9304 '''module_item : generate_if generate_block_opt %prec less_than_K_else '''
9306 print('module_item_54', list(p
))
9309 # { pform_endgenerate(); }
9313 def p_module_item_55(p
):
9314 '''module_item : K_case '(' expression ')' _embed4_module_item generate_case_items K_endcase '''
9316 print('module_item_55', list(p
))
9319 # { pform_endgenerate(); }
9323 def p_module_item_56(p
):
9324 '''module_item : modport_declaration '''
9326 print('module_item_56', list(p
))
9332 def p_module_item_57(p
):
9333 '''module_item : package_import_declaration '''
9335 print('module_item_57', list(p
))
9341 def p_module_item_58(p
):
9342 '''module_item : attribute_list_opt K_specparam _embed5_module_item specparam_decl ';' '''
9344 print('module_item_58', list(p
))
9350 def p_module_item_59(p
):
9351 '''module_item : K_specify _embed6_module_item specify_item_list_opt K_endspecify '''
9353 print('module_item_59', list(p
))
9359 def p_module_item_60(p
):
9360 '''module_item : K_specify error K_endspecify '''
9362 print('module_item_60', list(p
))
9365 # { yyerror(@1, "error: syntax error in specify block");
9371 def p_module_item_61(p
):
9372 '''module_item : error ';' '''
9374 print('module_item_61', list(p
))
9377 # { yyerror(@2, "error: invalid module item.");
9383 def p_module_item_62(p
):
9384 '''module_item : K_assign error '=' expression ';' '''
9386 print('module_item_62', list(p
))
9389 # { yyerror(@1, "error: syntax error in left side "
9390 # "of continuous assignment.");
9396 def p_module_item_63(p
):
9397 '''module_item : K_assign error ';' '''
9399 print('module_item_63', list(p
))
9402 # { yyerror(@1, "error: syntax error in "
9403 # "continuous assignment");
9409 def p_module_item_64(p
):
9410 '''module_item : K_function error K_endfunction endlabel_opt '''
9412 print('module_item_64', list(p
))
9415 # { yyerror(@1, "error: I give up on this "
9416 # "function definition.");
9418 # if (!gn_system_verilog()) {
9419 # yyerror(@4, "error: Function end names require "
9420 # "SystemVerilog.");
9429 def p_module_item_65(p
):
9430 '''module_item : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';' '''
9432 print('module_item_65', list(p
))
9435 # { perm_string tmp3 = lex_strings.make(p[3]);
9436 # perm_string tmp5 = lex_strings.make(p[5]);
9437 # pform_set_attrib(tmp3, tmp5, p[7]);
9444 def p_module_item_66(p
):
9445 '''module_item : KK_attribute '(' error ')' ';' '''
9447 print('module_item_66', list(p
))
9450 # { yyerror(@1, "error: Malformed $attribute parameter list."); }
9454 def p__embed0_module_item(p
):
9455 '''_embed0_module_item : '''
9458 # { attributes_in_context = p[1]; }
9462 def p__embed1_module_item(p
):
9463 '''_embed1_module_item : '''
9466 # { if (pform_in_interface())
9467 # yyerror(@1, "error: Parameter overrides are not allowed "
9468 # "in interfaces.");
9473 def p__embed2_module_item(p
):
9474 '''_embed2_module_item : '''
9477 # { pform_start_generate_for(@1, p[3], p[5], p[7], p[9], p[11]); }
9481 def p__embed3_module_item(p
):
9482 '''_embed3_module_item : '''
9485 # { pform_start_generate_else(@1); }
9489 def p__embed4_module_item(p
):
9490 '''_embed4_module_item : '''
9493 # { pform_start_generate_case(@1, p[3]); }
9497 def p__embed5_module_item(p
):
9498 '''_embed5_module_item : '''
9501 # { if (pform_in_interface())
9502 # yyerror(@1, "error: specparam declarations are not allowed "
9503 # "in interfaces.");
9508 def p__embed6_module_item(p
):
9509 '''_embed6_module_item : '''
9512 # { if (pform_in_interface())
9513 # yyerror(@1, "error: specify blocks are not allowed "
9514 # "in interfaces.");
9519 def p_module_item_list_1(p
):
9520 '''module_item_list : module_item_list module_item '''
9522 print('module_item_list_1', list(p
))
9528 def p_module_item_list_2(p
):
9529 '''module_item_list : module_item '''
9530 if(parse_debug
> 2):
9531 print('module_item_list_2', list(p
))
9537 def p_module_item_list_opt_1(p
):
9538 '''module_item_list_opt : module_item_list '''
9539 if(parse_debug
> 2):
9540 print('module_item_list_opt_1', list(p
))
9546 def p_module_item_list_opt_2(p
):
9547 '''module_item_list_opt : '''
9549 print('module_item_list_opt_2', list(p
))
9555 def p_generate_if_1(p
):
9556 '''generate_if : K_if '(' expression ')' '''
9558 print('generate_if_1', list(p
))
9561 # { pform_start_generate_if(@1, p[3]); }
9565 def p_generate_case_items_1(p
):
9566 '''generate_case_items : generate_case_items generate_case_item '''
9568 print('generate_case_items_1', list(p
))
9574 def p_generate_case_items_2(p
):
9575 '''generate_case_items : generate_case_item '''
9577 print('generate_case_items_2', list(p
))
9583 def p_generate_case_item_1(p
):
9584 '''generate_case_item : expression_list_proper ':' _embed0_generate_case_item generate_block_opt '''
9586 print('generate_case_item_1', list(p
))
9589 # { pform_endgenerate(); }
9593 def p_generate_case_item_2(p
):
9594 '''generate_case_item : K_default ':' _embed1_generate_case_item generate_block_opt '''
9596 print('generate_case_item_2', list(p
))
9599 # { pform_endgenerate(); }
9603 def p__embed0_generate_case_item(p
):
9604 '''_embed0_generate_case_item : '''
9607 # { pform_generate_case_item(@1, p[1]); }
9611 def p__embed1_generate_case_item(p
):
9612 '''_embed1_generate_case_item : '''
9615 # { pform_generate_case_item(@1, 0); }
9619 def p_generate_item_1(p
):
9620 '''generate_item : module_item '''
9622 print('generate_item_1', list(p
))
9628 def p_generate_item_2(p
):
9629 '''generate_item : K_begin generate_item_list_opt K_end '''
9631 print('generate_item_2', list(p
))
9634 # { /* Detect and warn about anachronistic begin/end use */
9635 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
9637 # cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
9643 def p_generate_item_3(p
):
9644 '''generate_item : K_begin ':' IDENTIFIER _embed0_generate_item generate_item_list_opt K_end '''
9646 print('generate_item_3', list(p
))
9649 # { /* Detect and warn about anachronistic named begin/end use */
9650 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
9652 # cerr << @1 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
9654 # pform_endgenerate();
9659 def p__embed0_generate_item(p
):
9660 '''_embed0_generate_item : '''
9664 # pform_start_generate_nblock(@1, p[3]);
9669 def p_generate_item_list_1(p
):
9670 '''generate_item_list : generate_item_list generate_item '''
9672 print('generate_item_list_1', list(p
))
9678 def p_generate_item_list_2(p
):
9679 '''generate_item_list : generate_item '''
9681 print('generate_item_list_2', list(p
))
9687 def p_generate_item_list_opt_1(p
):
9688 '''generate_item_list_opt : generate_item_list '''
9690 print('generate_item_list_opt_1', list(p
))
9696 def p_generate_item_list_opt_2(p
):
9697 '''generate_item_list_opt : '''
9699 print('generate_item_list_opt_2', list(p
))
9705 def p_generate_block_1(p
):
9706 '''generate_block : module_item '''
9708 print('generate_block_1', list(p
))
9714 def p_generate_block_2(p
):
9715 '''generate_block : K_begin generate_item_list_opt K_end '''
9717 print('generate_block_2', list(p
))
9723 def p_generate_block_3(p
):
9724 '''generate_block : K_begin ':' IDENTIFIER generate_item_list_opt K_end endlabel_opt '''
9726 print('generate_block_3', list(p
))
9729 # { pform_generate_block_name(p[3]);
9731 # if (strcmp(p[3],p[6]) != 0) {
9732 # yyerror(@6, "error: End label doesn't match "
9735 # if (! gn_system_verilog()) {
9736 # yyerror(@6, "error: Begin end labels require "
9737 # "SystemVerilog.");
9746 def p_generate_block_opt_1(p
):
9747 '''generate_block_opt : generate_block '''
9749 print('generate_block_opt_1', list(p
))
9755 def p_generate_block_opt_2(p
):
9756 '''generate_block_opt : ';' '''
9758 print('generate_block_opt_2', list(p
))
9764 def p_net_decl_assign_1(p
):
9765 '''net_decl_assign : IDENTIFIER '=' expression '''
9767 print('net_decl_assign_1', list(p
))
9770 # { net_decl_assign_t*tmp = new net_decl_assign_t;
9772 # tmp->name = lex_strings.make(p[1]);
9780 def p_net_decl_assigns_1(p
):
9781 '''net_decl_assigns : net_decl_assigns ',' net_decl_assign '''
9783 print('net_decl_assigns_1', list(p
))
9786 # { net_decl_assign_t*tmp = p[1];
9787 # p[3]->next = tmp->next;
9794 def p_net_decl_assigns_2(p
):
9795 '''net_decl_assigns : net_decl_assign '''
9797 print('net_decl_assigns_2', list(p
))
9805 def p_bit_logic_1(p
):
9806 '''bit_logic : K_logic '''
9808 print('bit_logic_1', list(p
))
9811 # { p[0] = IVL_VT_LOGIC; }
9815 def p_bit_logic_2(p
):
9816 '''bit_logic : K_bool '''
9818 print('bit_logic_2', list(p
))
9821 # { p[0] = IVL_VT_BOOL; /* Icarus misc */}
9825 def p_bit_logic_3(p
):
9826 '''bit_logic : K_bit '''
9828 print('bit_logic_3', list(p
))
9831 # { p[0] = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
9835 def p_bit_logic_opt_1(p
):
9836 '''bit_logic_opt : bit_logic '''
9838 print('bit_logic_opt_1', list(p
))
9844 def p_bit_logic_opt_2(p
):
9845 '''bit_logic_opt : '''
9847 print('bit_logic_opt_2', list(p
))
9850 # { p[0] = IVL_VT_NO_TYPE; }
9854 def p_net_type_1(p
):
9855 '''net_type : K_wire '''
9856 if(parse_debug
> 2):
9857 print('net_type_1', list(p
))
9865 def p_net_type_2(p
):
9866 '''net_type : K_tri '''
9868 print('net_type_2', list(p
))
9871 # { p[0] = NetNet::TRI; }
9875 def p_net_type_3(p
):
9876 '''net_type : K_tri1 '''
9878 print('net_type_3', list(p
))
9881 # { p[0] = NetNet::TRI1; }
9885 def p_net_type_4(p
):
9886 '''net_type : K_supply0 '''
9888 print('net_type_4', list(p
))
9891 # { p[0] = NetNet::SUPPLY0; }
9895 def p_net_type_5(p
):
9896 '''net_type : K_wand '''
9898 print('net_type_5', list(p
))
9901 # { p[0] = NetNet::WAND; }
9905 def p_net_type_6(p
):
9906 '''net_type : K_triand '''
9908 print('net_type_6', list(p
))
9911 # { p[0] = NetNet::TRIAND; }
9915 def p_net_type_7(p
):
9916 '''net_type : K_tri0 '''
9918 print('net_type_7', list(p
))
9921 # { p[0] = NetNet::TRI0; }
9925 def p_net_type_8(p
):
9926 '''net_type : K_supply1 '''
9928 print('net_type_8', list(p
))
9931 # { p[0] = NetNet::SUPPLY1; }
9935 def p_net_type_9(p
):
9936 '''net_type : K_wor '''
9938 print('net_type_9', list(p
))
9941 # { p[0] = NetNet::WOR; }
9945 def p_net_type_10(p
):
9946 '''net_type : K_trior '''
9948 print('net_type_10', list(p
))
9951 # { p[0] = NetNet::TRIOR; }
9955 def p_net_type_11(p
):
9956 '''net_type : K_wone '''
9958 print('net_type_11', list(p
))
9961 # { p[0] = NetNet::UNRESOLVED_WIRE;
9962 # cerr << @1.text << ":" << @1.first_line << ": warning: "
9963 # "'wone' is deprecated, please use 'uwire' "
9964 # "instead." << endl;
9969 def p_net_type_12(p
):
9970 '''net_type : K_uwire '''
9972 print('net_type_12', list(p
))
9975 # { p[0] = NetNet::UNRESOLVED_WIRE; }
9979 def p_param_type_1(p
):
9980 '''param_type : bit_logic_opt unsigned_signed_opt dimensions_opt '''
9982 print('param_type_1', list(p
))
9985 # { param_active_range = p[3];
9986 # param_active_signed = p[2];
9987 # if ((p[1] == IVL_VT_NO_TYPE) && (p[3] != 0))
9988 # param_active_type = IVL_VT_LOGIC;
9990 # param_active_type = p[1];
9995 def p_param_type_2(p
):
9996 '''param_type : K_integer '''
9998 print('param_type_2', list(p
))
10001 # { param_active_range = make_range_from_width(integer_width);
10002 # param_active_signed = true;
10003 # param_active_type = IVL_VT_LOGIC;
10008 def p_param_type_3(p
):
10009 '''param_type : K_time '''
10011 print('param_type_3', list(p
))
10014 # { param_active_range = make_range_from_width(64);
10015 # param_active_signed = false;
10016 # param_active_type = IVL_VT_LOGIC;
10021 def p_param_type_4(p
):
10022 '''param_type : real_or_realtime '''
10024 print('param_type_4', list(p
))
10027 # { param_active_range = 0;
10028 # param_active_signed = true;
10029 # param_active_type = IVL_VT_REAL;
10034 def p_param_type_5(p
):
10035 '''param_type : atom2_type '''
10037 print('param_type_5', list(p
))
10040 # { param_active_range = make_range_from_width(p[1]);
10041 # param_active_signed = true;
10042 # param_active_type = IVL_VT_BOOL;
10047 def p_param_type_6(p
):
10048 '''param_type : TYPE_IDENTIFIER '''
10050 print('param_type_6', list(p
))
10053 # { pform_set_param_from_type(@1, p[1].type, p[1].text, param_active_range,
10054 # param_active_signed, param_active_type);
10055 # delete[]p[1].text;
10060 def p_parameter_assign_list_1(p
):
10061 '''parameter_assign_list : parameter_assign '''
10063 print('parameter_assign_list_1', list(p
))
10069 def p_parameter_assign_list_2(p
):
10070 '''parameter_assign_list : parameter_assign_list ',' parameter_assign '''
10072 print('parameter_assign_list_2', list(p
))
10078 def p_localparam_assign_list_1(p
):
10079 '''localparam_assign_list : localparam_assign '''
10081 print('localparam_assign_list_1', list(p
))
10087 def p_localparam_assign_list_2(p
):
10088 '''localparam_assign_list : localparam_assign_list ',' localparam_assign '''
10090 print('localparam_assign_list_2', list(p
))
10096 def p_parameter_assign_1(p
):
10097 '''parameter_assign : IDENTIFIER '=' expression parameter_value_ranges_opt '''
10099 print('parameter_assign_1', list(p
))
10100 tpname
= Node(syms
.tname
, [Leaf(token
.NAME
, p
[1])])
10101 expr
= Node(syms
.tfpdef
, [tpname
, Leaf(token
.EQUAL
, p
[2]), p
[3]])
10105 # { PExpr*tmp = p[3];
10106 # pform_set_parameter(@1, lex_strings.make(p[1]), param_active_type,
10107 # param_active_signed, param_active_range, tmp, p[4]);
10113 def p_localparam_assign_1(p
):
10114 '''localparam_assign : IDENTIFIER '=' expression '''
10116 print('localparam_assign_1', list(p
))
10119 # { PExpr*tmp = p[3];
10120 # pform_set_localparam(@1, lex_strings.make(p[1]), param_active_type,
10121 # param_active_signed, param_active_range, tmp);
10127 def p_parameter_value_ranges_opt_1(p
):
10128 '''parameter_value_ranges_opt : parameter_value_ranges '''
10130 print('parameter_value_ranges_opt_1', list(p
))
10137 def p_parameter_value_ranges_opt_2(p
):
10138 '''parameter_value_ranges_opt : '''
10140 print('parameter_value_ranges_opt_2', list(p
))
10147 def p_parameter_value_ranges_1(p
):
10148 '''parameter_value_ranges : parameter_value_ranges parameter_value_range '''
10150 print('parameter_value_ranges_1', list(p
))
10153 # { p[0] = p[2]; p[0]->next = p[1]; }
10157 def p_parameter_value_ranges_2(p
):
10158 '''parameter_value_ranges : parameter_value_range '''
10160 print('parameter_value_ranges_2', list(p
))
10163 # { p[0] = p[1]; p[0]->next = 0; }
10167 def p_parameter_value_range_1(p
):
10168 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ']' '''
10170 print('parameter_value_range_1', list(p
))
10173 # { p[0] = pform_parameter_value_range(p[1], false, p[3], false, p[5]); }
10177 def p_parameter_value_range_2(p
):
10178 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ')' '''
10180 print('parameter_value_range_2', list(p
))
10183 # { p[0] = pform_parameter_value_range(p[1], false, p[3], true, p[5]); }
10187 def p_parameter_value_range_3(p
):
10188 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ']' '''
10190 print('parameter_value_range_3', list(p
))
10193 # { p[0] = pform_parameter_value_range(p[1], true, p[3], false, p[5]); }
10197 def p_parameter_value_range_4(p
):
10198 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ')' '''
10200 print('parameter_value_range_4', list(p
))
10203 # { p[0] = pform_parameter_value_range(p[1], true, p[3], true, p[5]); }
10207 def p_parameter_value_range_5(p
):
10208 '''parameter_value_range : K_exclude expression '''
10210 print('parameter_value_range_5', list(p
))
10213 # { p[0] = pform_parameter_value_range(true, false, p[2], false, p[2]); }
10217 def p_value_range_expression_1(p
):
10218 '''value_range_expression : expression '''
10220 print('value_range_expression_1', list(p
))
10227 def p_value_range_expression_2(p
):
10228 '''value_range_expression : K_inf '''
10230 print('value_range_expression_2', list(p
))
10237 def p_value_range_expression_3(p
):
10238 '''value_range_expression : '+' K_inf '''
10240 print('value_range_expression_3', list(p
))
10247 def p_value_range_expression_4(p
):
10248 '''value_range_expression : '-' K_inf '''
10250 print('value_range_expression_4', list(p
))
10257 def p_from_exclude_1(p
):
10258 '''from_exclude : K_from '''
10260 print('from_exclude_1', list(p
))
10267 def p_from_exclude_2(p
):
10268 '''from_exclude : K_exclude '''
10270 print('from_exclude_2', list(p
))
10277 def p_parameter_value_opt_1(p
):
10278 '''parameter_value_opt : '#' '(' expression_list_with_nuls ')' '''
10280 print('parameter_value_opt_1', list(p
))
10283 # { struct parmvalue_t*tmp = new struct parmvalue_t;
10284 # tmp->by_order = p[3];
10285 # tmp->by_name = 0;
10291 def p_parameter_value_opt_2(p
):
10292 '''parameter_value_opt : '#' '(' parameter_value_byname_list ')' '''
10294 print('parameter_value_opt_2', list(p
))
10297 # { struct parmvalue_t*tmp = new struct parmvalue_t;
10298 # tmp->by_order = 0;
10299 # tmp->by_name = p[3];
10305 def p_parameter_value_opt_3(p
):
10306 '''parameter_value_opt : '#' DEC_NUMBER '''
10308 print('parameter_value_opt_3', list(p
))
10312 # PENumber*tmp = new PENumber(p[2]);
10313 # FILE_NAME(tmp, @1);
10315 # struct parmvalue_t*lst = new struct parmvalue_t;
10316 # lst->by_order = new list<PExpr*>;
10317 # lst->by_order->push_back(tmp);
10318 # lst->by_name = 0;
10325 def p_parameter_value_opt_4(p
):
10326 '''parameter_value_opt : '#' REALTIME '''
10328 print('parameter_value_opt_4', list(p
))
10332 # PEFNumber*tmp = new PEFNumber(p[2]);
10333 # FILE_NAME(tmp, @1);
10335 # struct parmvalue_t*lst = new struct parmvalue_t;
10336 # lst->by_order = new list<PExpr*>;
10337 # lst->by_order->push_back(tmp);
10338 # lst->by_name = 0;
10344 def p_parameter_value_opt_5(p
):
10345 '''parameter_value_opt : '#' error '''
10347 print('parameter_value_opt_5', list(p
))
10350 # { yyerror(@1, "error: syntax error in parameter value "
10351 # "assignment list.");
10357 def p_parameter_value_opt_6(p
):
10358 '''parameter_value_opt : '''
10360 print('parameter_value_opt_6', list(p
))
10367 def p_parameter_value_byname_1(p
):
10368 '''parameter_value_byname : '.' IDENTIFIER '(' expression ')' '''
10370 print('parameter_value_byname_1', list(p
))
10373 # { named_pexpr_t*tmp = new named_pexpr_t;
10374 # tmp->name = lex_strings.make(p[2]);
10375 # tmp->parm = p[4];
10382 def p_parameter_value_byname_2(p
):
10383 '''parameter_value_byname : '.' IDENTIFIER '(' ')' '''
10385 print('parameter_value_byname_2', list(p
))
10388 # { named_pexpr_t*tmp = new named_pexpr_t;
10389 # tmp->name = lex_strings.make(p[2]);
10397 def p_parameter_value_byname_list_1(p
):
10398 '''parameter_value_byname_list : parameter_value_byname '''
10400 print('parameter_value_byname_list_1', list(p
))
10403 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
10404 # tmp->push_back(*p[1]);
10411 def p_parameter_value_byname_list_2(p
):
10412 '''parameter_value_byname_list : parameter_value_byname_list ',' parameter_value_byname '''
10414 print('parameter_value_byname_list_2', list(p
))
10417 # { list<named_pexpr_t>*tmp = p[1];
10418 # tmp->push_back(*p[3]);
10426 '''port : port_reference '''
10428 print('port_1', list(p
))
10436 '''port : '.' IDENTIFIER '(' port_reference ')' '''
10438 print('port_2', list(p
))
10441 # { Module::port_t*tmp = p[4];
10442 # tmp->name = lex_strings.make(p[2]);
10450 '''port : '{' port_reference_list '}' '''
10452 print('port_3', list(p
))
10455 # { Module::port_t*tmp = p[2];
10456 # tmp->name = perm_string();
10463 '''port : '.' IDENTIFIER '(' '{' port_reference_list '}' ')' '''
10465 print('port_4', list(p
))
10468 # { Module::port_t*tmp = p[5];
10469 # tmp->name = lex_strings.make(p[2]);
10476 def p_port_opt_1(p
):
10477 '''port_opt : port '''
10479 print('port_opt_1', list(p
))
10486 def p_port_opt_2(p
):
10489 print('port_opt_2', list(p
))
10496 def p_port_name_1(p
):
10497 '''port_name : '.' IDENTIFIER '(' expression ')' '''
10499 print('port_name_1', list(p
))
10502 # { named_pexpr_t*tmp = new named_pexpr_t;
10503 # tmp->name = lex_strings.make(p[2]);
10504 # tmp->parm = p[4];
10511 def p_port_name_2(p
):
10512 '''port_name : '.' IDENTIFIER '(' error ')' '''
10514 print('port_name_2', list(p
))
10517 # { yyerror(@3, "error: invalid port connection expression.");
10518 # named_pexpr_t*tmp = new named_pexpr_t;
10519 # tmp->name = lex_strings.make(p[2]);
10527 def p_port_name_3(p
):
10528 '''port_name : '.' IDENTIFIER '(' ')' '''
10530 print('port_name_3', list(p
))
10533 # { named_pexpr_t*tmp = new named_pexpr_t;
10534 # tmp->name = lex_strings.make(p[2]);
10542 def p_port_name_4(p
):
10543 '''port_name : '.' IDENTIFIER '''
10545 print('port_name_4', list(p
))
10548 # { named_pexpr_t*tmp = new named_pexpr_t;
10549 # tmp->name = lex_strings.make(p[2]);
10550 # tmp->parm = new PEIdent(lex_strings.make(p[2]), true);
10551 # FILE_NAME(tmp->parm, @1);
10558 def p_port_name_5(p
):
10559 '''port_name : K_DOTSTAR '''
10561 print('port_name_5', list(p
))
10564 # { named_pexpr_t*tmp = new named_pexpr_t;
10565 # tmp->name = lex_strings.make("*");
10572 def p_port_name_list_1(p
):
10573 '''port_name_list : port_name_list ',' port_name '''
10575 print('port_name_list_1', list(p
))
10578 # { list<named_pexpr_t>*tmp = p[1];
10579 # tmp->push_back(*p[3]);
10586 def p_port_name_list_2(p
):
10587 '''port_name_list : port_name '''
10589 print('port_name_list_2', list(p
))
10592 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
10593 # tmp->push_back(*p[1]);
10600 def p_port_reference_1(p
):
10601 '''port_reference : IDENTIFIER '''
10603 print('port_reference_1', list(p
))
10606 # { Module::port_t*ptmp;
10607 # perm_string name = lex_strings.make(p[1]);
10608 # ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
10615 def p_port_reference_2(p
):
10616 '''port_reference : IDENTIFIER '[' expression ':' expression ']' '''
10618 print('port_reference_2', list(p
))
10621 # { index_component_t itmp;
10622 # itmp.sel = index_component_t::SEL_PART;
10626 # name_component_t ntmp (lex_strings.make(p[1]));
10627 # ntmp.index.push_back(itmp);
10629 # pform_name_t pname;
10630 # pname.push_back(ntmp);
10632 # PEIdent*wtmp = new PEIdent(pname);
10633 # FILE_NAME(wtmp, @1);
10635 # Module::port_t*ptmp = new Module::port_t;
10636 # ptmp->name = perm_string();
10637 # ptmp->expr.push_back(wtmp);
10645 def p_port_reference_3(p
):
10646 '''port_reference : IDENTIFIER '[' expression ']' '''
10648 print('port_reference_3', list(p
))
10651 # { index_component_t itmp;
10652 # itmp.sel = index_component_t::SEL_BIT;
10656 # name_component_t ntmp (lex_strings.make(p[1]));
10657 # ntmp.index.push_back(itmp);
10659 # pform_name_t pname;
10660 # pname.push_back(ntmp);
10662 # PEIdent*tmp = new PEIdent(pname);
10663 # FILE_NAME(tmp, @1);
10665 # Module::port_t*ptmp = new Module::port_t;
10666 # ptmp->name = perm_string();
10667 # ptmp->expr.push_back(tmp);
10674 def p_port_reference_4(p
):
10675 '''port_reference : IDENTIFIER '[' error ']' '''
10677 print('port_reference_4', list(p
))
10680 # { yyerror(@1, "error: invalid port bit select");
10681 # Module::port_t*ptmp = new Module::port_t;
10682 # PEIdent*wtmp = new PEIdent(lex_strings.make(p[1]));
10683 # FILE_NAME(wtmp, @1);
10684 # ptmp->name = lex_strings.make(p[1]);
10685 # ptmp->expr.push_back(wtmp);
10692 def p_port_reference_list_1(p
):
10693 '''port_reference_list : port_reference '''
10695 print('port_reference_list_1', list(p
))
10702 def p_port_reference_list_2(p
):
10703 '''port_reference_list : port_reference_list ',' port_reference '''
10705 print('port_reference_list_2', list(p
))
10708 # { Module::port_t*tmp = p[1];
10709 # append(tmp->expr, p[3]->expr);
10716 def p_dimensions_opt_1(p
):
10717 '''dimensions_opt : '''
10718 if(parse_debug
> 2):
10719 print('dimensions_opt_1', list(p
))
10726 def p_dimensions_opt_2(p
):
10727 '''dimensions_opt : dimensions '''
10729 print('dimensions_opt_2', list(p
))
10736 def p_dimensions_1(p
):
10737 '''dimensions : variable_dimension '''
10739 print('dimensions_1', list(p
))
10746 def p_dimensions_2(p
):
10747 '''dimensions : dimensions variable_dimension '''
10749 print('dimensions_2', list(p
))
10752 # { list<pform_range_t> *tmp = p[1];
10754 # tmp->splice(tmp->end(), *p[2]);
10762 def p_register_variable_1(p
):
10763 '''register_variable : IDENTIFIER dimensions_opt '''
10765 print('register_variable_1', list(p
))
10768 # { perm_string name = lex_strings.make(p[1]);
10769 # pform_makewire(@1, name, NetNet::REG,
10770 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10771 # pform_set_reg_idx(name, p[2]);
10777 def p_register_variable_2(p
):
10778 '''register_variable : IDENTIFIER dimensions_opt '=' expression '''
10780 print('register_variable_2', list(p
))
10783 # { if (pform_peek_scope()->var_init_needs_explicit_lifetime()
10784 # && (var_lifetime == LexicalScope::INHERITED)) {
10785 # cerr << @3 << ": warning: Static variable initialization requires "
10786 # "explicit lifetime in this context." << endl;
10789 # perm_string name = lex_strings.make(p[1]);
10790 # pform_makewire(@1, name, NetNet::REG,
10791 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10792 # pform_set_reg_idx(name, p[2]);
10793 # pform_make_var_init(@1, name, p[4]);
10799 def p_register_variable_list_1(p
):
10800 '''register_variable_list : register_variable '''
10802 print('register_variable_list_1', list(p
))
10805 # { list<perm_string>*tmp = new list<perm_string>;
10806 # tmp->push_back(lex_strings.make(p[1]));
10813 def p_register_variable_list_2(p
):
10814 '''register_variable_list : register_variable_list ',' register_variable '''
10816 print('register_variable_list_2', list(p
))
10819 # { list<perm_string>*tmp = p[1];
10820 # tmp->push_back(lex_strings.make(p[3]));
10827 def p_net_variable_1(p
):
10828 '''net_variable : IDENTIFIER dimensions_opt '''
10829 if(parse_debug
> 2):
10830 print('net_variable_1', list(p
))
10832 #p[0]= ('net_variable_1', list(p))
10834 # { perm_string name = lex_strings.make(p[1]);
10835 # pform_makewire(@1, name, NetNet::IMPLICIT,
10836 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10837 # pform_set_reg_idx(name, p[2]);
10838 p
[0] = [p
[1], p
[2]]
10844 def p_net_variable_list_1(p
):
10845 '''net_variable_list : net_variable '''
10846 if(parse_debug
> 2):
10847 print('net_variable_list_1', list(p
))
10851 # { list<perm_string>*tmp = new list<perm_string>;
10852 # tmp->push_back(lex_strings.make(p[1]));
10859 def p_net_variable_list_2(p
):
10860 '''net_variable_list : net_variable_list ',' net_variable '''
10861 if(parse_debug
> 2):
10862 print('net_variable_list_2', list(p
))
10866 # { list<perm_string>*tmp = p[1];
10867 # tmp->push_back(lex_strings.make(p[3]));
10874 def p_event_variable_1(p
):
10875 '''event_variable : IDENTIFIER dimensions_opt '''
10877 print('event_variable_1', list(p
))
10881 # yyerror(@2, "sorry: event arrays are not supported.");
10889 def p_event_variable_list_1(p
):
10890 '''event_variable_list : event_variable '''
10892 print('event_variable_list_1', list(p
))
10895 # { p[0] = list_from_identifier(p[1]); }
10899 def p_event_variable_list_2(p
):
10900 '''event_variable_list : event_variable_list ',' event_variable '''
10902 print('event_variable_list_2', list(p
))
10905 # { p[0] = list_from_identifier(p[1], p[3]); }
10909 def p_specify_item_1(p
):
10910 '''specify_item : K_specparam specparam_decl ';' '''
10912 print('specify_item_1', list(p
))
10918 def p_specify_item_2(p
):
10919 '''specify_item : specify_simple_path_decl ';' '''
10921 print('specify_item_2', list(p
))
10924 # { pform_module_specify_path(p[1]);
10929 def p_specify_item_3(p
):
10930 '''specify_item : specify_edge_path_decl ';' '''
10932 print('specify_item_3', list(p
))
10935 # { pform_module_specify_path(p[1]);
10940 def p_specify_item_4(p
):
10941 '''specify_item : K_if '(' expression ')' specify_simple_path_decl ';' '''
10943 print('specify_item_4', list(p
))
10946 # { PSpecPath*tmp = p[5];
10948 # tmp->conditional = true;
10949 # tmp->condition = p[3];
10951 # pform_module_specify_path(tmp);
10956 def p_specify_item_5(p
):
10957 '''specify_item : K_if '(' expression ')' specify_edge_path_decl ';' '''
10959 print('specify_item_5', list(p
))
10962 # { PSpecPath*tmp = p[5];
10964 # tmp->conditional = true;
10965 # tmp->condition = p[3];
10967 # pform_module_specify_path(tmp);
10972 def p_specify_item_6(p
):
10973 '''specify_item : K_ifnone specify_simple_path_decl ';' '''
10975 print('specify_item_6', list(p
))
10978 # { PSpecPath*tmp = p[2];
10980 # tmp->conditional = true;
10981 # tmp->condition = 0;
10983 # pform_module_specify_path(tmp);
10988 def p_specify_item_7(p
):
10989 '''specify_item : K_ifnone specify_edge_path_decl ';' '''
10991 print('specify_item_7', list(p
))
10994 # { yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
10995 # "not supported.");
11001 def p_specify_item_8(p
):
11002 '''specify_item : K_Sfullskew '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
11004 print('specify_item_8', list(p
))
11013 def p_specify_item_9(p
):
11014 '''specify_item : K_Shold '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
11016 print('specify_item_9', list(p
))
11024 def p_specify_item_10(p
):
11025 '''specify_item : K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
11027 print('specify_item_10', list(p
))
11036 def p_specify_item_11(p
):
11037 '''specify_item : K_Speriod '(' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
11039 print('specify_item_11', list(p
))
11047 def p_specify_item_12(p
):
11048 '''specify_item : K_Srecovery '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
11050 print('specify_item_12', list(p
))
11058 def p_specify_item_13(p
):
11059 '''specify_item : K_Srecrem '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
11061 print('specify_item_13', list(p
))
11070 def p_specify_item_14(p
):
11071 '''specify_item : K_Sremoval '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
11073 print('specify_item_14', list(p
))
11081 def p_specify_item_15(p
):
11082 '''specify_item : K_Ssetup '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
11084 print('specify_item_15', list(p
))
11092 def p_specify_item_16(p
):
11093 '''specify_item : K_Ssetuphold '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
11095 print('specify_item_16', list(p
))
11104 def p_specify_item_17(p
):
11105 '''specify_item : K_Sskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
11107 print('specify_item_17', list(p
))
11115 def p_specify_item_18(p
):
11116 '''specify_item : K_Stimeskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
11118 print('specify_item_18', list(p
))
11126 def p_specify_item_19(p
):
11127 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ',' expression spec_notifier_opt ')' ';' '''
11129 print('specify_item_19', list(p
))
11138 def p_specify_item_20(p
):
11139 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ')' ';' '''
11141 print('specify_item_20', list(p
))
11149 def p_specify_item_21(p
):
11150 '''specify_item : K_pulsestyle_onevent specify_path_identifiers ';' '''
11152 print('specify_item_21', list(p
))
11160 def p_specify_item_22(p
):
11161 '''specify_item : K_pulsestyle_ondetect specify_path_identifiers ';' '''
11163 print('specify_item_22', list(p
))
11171 def p_specify_item_23(p
):
11172 '''specify_item : K_showcancelled specify_path_identifiers ';' '''
11174 print('specify_item_23', list(p
))
11182 def p_specify_item_24(p
):
11183 '''specify_item : K_noshowcancelled specify_path_identifiers ';' '''
11185 print('specify_item_24', list(p
))
11193 def p_specify_item_list_1(p
):
11194 '''specify_item_list : specify_item '''
11196 print('specify_item_list_1', list(p
))
11202 def p_specify_item_list_2(p
):
11203 '''specify_item_list : specify_item_list specify_item '''
11205 print('specify_item_list_2', list(p
))
11211 def p_specify_item_list_opt_1(p
):
11212 '''specify_item_list_opt : '''
11214 print('specify_item_list_opt_1', list(p
))
11221 def p_specify_item_list_opt_2(p
):
11222 '''specify_item_list_opt : specify_item_list '''
11224 print('specify_item_list_opt_2', list(p
))
11231 def p_specify_edge_path_decl_1(p
):
11232 '''specify_edge_path_decl : specify_edge_path '=' '(' delay_value_list ')' '''
11234 print('specify_edge_path_decl_1', list(p
))
11237 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
11241 def p_specify_edge_path_decl_2(p
):
11242 '''specify_edge_path_decl : specify_edge_path '=' delay_value_simple '''
11244 print('specify_edge_path_decl_2', list(p
))
11247 # { list<PExpr*>*tmp = new list<PExpr*>;
11248 # tmp->push_back(p[3]);
11249 # p[0] = pform_assign_path_delay(p[1], tmp);
11254 def p_edge_operator_1(p
):
11255 '''edge_operator : K_posedge '''
11257 print('edge_operator_1', list(p
))
11264 def p_edge_operator_2(p
):
11265 '''edge_operator : K_negedge '''
11267 print('edge_operator_2', list(p
))
11274 def p_specify_edge_path_1(p
):
11275 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
11277 print('specify_edge_path_1', list(p
))
11280 # { int edge_flag = 0;
11281 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], false, p[6], p[8]); }
11285 def p_specify_edge_path_2(p
):
11286 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
11288 print('specify_edge_path_2', list(p
))
11291 # { int edge_flag = p[2]? 1 : -1;
11292 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], false, p[7], p[9]);}
11296 def p_specify_edge_path_3(p
):
11297 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
11299 print('specify_edge_path_3', list(p
))
11302 # { int edge_flag = 0;
11303 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], true, p[6], p[8]); }
11307 def p_specify_edge_path_4(p
):
11308 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
11310 print('specify_edge_path_4', list(p
))
11313 # { int edge_flag = p[2]? 1 : -1;
11314 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], true, p[7], p[9]); }
11318 def p_polarity_operator_1(p
):
11319 '''polarity_operator : K_PO_POS '''
11321 print('polarity_operator_1', list(p
))
11327 def p_polarity_operator_2(p
):
11328 '''polarity_operator : K_PO_NEG '''
11330 print('polarity_operator_2', list(p
))
11336 def p_polarity_operator_3(p
):
11337 '''polarity_operator : ':' '''
11339 print('polarity_operator_3', list(p
))
11345 def p_specify_simple_path_decl_1(p
):
11346 '''specify_simple_path_decl : specify_simple_path '=' '(' delay_value_list ')' '''
11348 print('specify_simple_path_decl_1', list(p
))
11351 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
11355 def p_specify_simple_path_decl_2(p
):
11356 '''specify_simple_path_decl : specify_simple_path '=' delay_value_simple '''
11358 print('specify_simple_path_decl_2', list(p
))
11361 # { list<PExpr*>*tmp = new list<PExpr*>;
11362 # tmp->push_back(p[3]);
11363 # p[0] = pform_assign_path_delay(p[1], tmp);
11368 def p_specify_simple_path_decl_3(p
):
11369 '''specify_simple_path_decl : specify_simple_path '=' '(' error ')' '''
11371 print('specify_simple_path_decl_3', list(p
))
11374 # { yyerror(@3, "Syntax error in delay value list.");
11381 def p_specify_simple_path_1(p
):
11382 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' '''
11384 print('specify_simple_path_1', list(p
))
11387 # { p[0] = pform_make_specify_path(@1, p[2], p[3], false, p[5]); }
11391 def p_specify_simple_path_2(p
):
11392 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' '''
11394 print('specify_simple_path_2', list(p
))
11397 # { p[0] = pform_make_specify_path(@1, p[2], p[3], true, p[5]); }
11401 def p_specify_simple_path_3(p
):
11402 '''specify_simple_path : '(' error ')' '''
11404 print('specify_simple_path_3', list(p
))
11407 # { yyerror(@1, "Invalid simple path");
11413 def p_specify_path_identifiers_1(p
):
11414 '''specify_path_identifiers : IDENTIFIER '''
11416 print('specify_path_identifiers_1', list(p
))
11419 # { list<perm_string>*tmp = new list<perm_string>;
11420 # tmp->push_back(lex_strings.make(p[1]));
11427 def p_specify_path_identifiers_2(p
):
11428 '''specify_path_identifiers : IDENTIFIER '[' expr_primary ']' '''
11430 print('specify_path_identifiers_2', list(p
))
11433 # { if (gn_specify_blocks_flag) {
11434 # yywarn(@4, "Bit selects are not currently supported "
11435 # "in path declarations. The declaration "
11436 # "will be applied to the whole vector.");
11438 # list<perm_string>*tmp = new list<perm_string>;
11439 # tmp->push_back(lex_strings.make(p[1]));
11446 def p_specify_path_identifiers_3(p
):
11447 '''specify_path_identifiers : IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
11449 print('specify_path_identifiers_3', list(p
))
11452 # { if (gn_specify_blocks_flag) {
11453 # yywarn(@4, "Part selects are not currently supported "
11454 # "in path declarations. The declaration "
11455 # "will be applied to the whole vector.");
11457 # list<perm_string>*tmp = new list<perm_string>;
11458 # tmp->push_back(lex_strings.make(p[1]));
11465 def p_specify_path_identifiers_4(p
):
11466 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '''
11468 print('specify_path_identifiers_4', list(p
))
11471 # { list<perm_string>*tmp = p[1];
11472 # tmp->push_back(lex_strings.make(p[3]));
11479 def p_specify_path_identifiers_5(p
):
11480 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' '''
11482 print('specify_path_identifiers_5', list(p
))
11485 # { if (gn_specify_blocks_flag) {
11486 # yywarn(@4, "Bit selects are not currently supported "
11487 # "in path declarations. The declaration "
11488 # "will be applied to the whole vector.");
11490 # list<perm_string>*tmp = p[1];
11491 # tmp->push_back(lex_strings.make(p[3]));
11498 def p_specify_path_identifiers_6(p
):
11499 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
11501 print('specify_path_identifiers_6', list(p
))
11504 # { if (gn_specify_blocks_flag) {
11505 # yywarn(@4, "Part selects are not currently supported "
11506 # "in path declarations. The declaration "
11507 # "will be applied to the whole vector.");
11509 # list<perm_string>*tmp = p[1];
11510 # tmp->push_back(lex_strings.make(p[3]));
11517 def p_specparam_1(p
):
11518 '''specparam : IDENTIFIER '=' expression '''
11520 print('specparam_1', list(p
))
11523 # { PExpr*tmp = p[3];
11524 # pform_set_specparam(@1, lex_strings.make(p[1]),
11525 # param_active_range, tmp);
11531 def p_specparam_2(p
):
11532 '''specparam : IDENTIFIER '=' expression ':' expression ':' expression '''
11534 print('specparam_2', list(p
))
11538 # switch (min_typ_max_flag) {
11555 # if (min_typ_max_warn > 0) {
11556 # cerr << tmp->get_fileline() << ": warning: choosing ";
11557 # switch (min_typ_max_flag) {
11568 # cerr << " expression." << endl;
11569 # min_typ_max_warn -= 1;
11571 # pform_set_specparam(@1, lex_strings.make(p[1]),
11572 # param_active_range, tmp);
11578 def p_specparam_3(p
):
11579 '''specparam : PATHPULSE_IDENTIFIER '=' expression '''
11581 print('specparam_3', list(p
))
11590 def p_specparam_4(p
):
11591 '''specparam : PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' '''
11593 print('specparam_4', list(p
))
11603 def p_specparam_list_1(p
):
11604 '''specparam_list : specparam '''
11606 print('specparam_list_1', list(p
))
11612 def p_specparam_list_2(p
):
11613 '''specparam_list : specparam_list ',' specparam '''
11615 print('specparam_list_2', list(p
))
11621 def p_specparam_decl_1(p
):
11622 '''specparam_decl : specparam_list '''
11624 print('specparam_decl_1', list(p
))
11630 def p_specparam_decl_2(p
):
11631 '''specparam_decl : dimensions _embed0_specparam_decl specparam_list '''
11633 print('specparam_decl_2', list(p
))
11636 # { param_active_range = 0; }
11640 def p__embed0_specparam_decl(p
):
11641 '''_embed0_specparam_decl : '''
11644 # { param_active_range = p[1]; }
11648 def p_spec_polarity_1(p
):
11649 '''spec_polarity : '+' '''
11651 print('spec_polarity_1', list(p
))
11658 def p_spec_polarity_2(p
):
11659 '''spec_polarity : '-' '''
11661 print('spec_polarity_2', list(p
))
11668 def p_spec_polarity_3(p
):
11669 '''spec_polarity : '''
11671 print('spec_polarity_3', list(p
))
11678 def p_spec_reference_event_1(p
):
11679 '''spec_reference_event : K_posedge expression '''
11681 print('spec_reference_event_1', list(p
))
11688 def p_spec_reference_event_2(p
):
11689 '''spec_reference_event : K_negedge expression '''
11691 print('spec_reference_event_2', list(p
))
11698 def p_spec_reference_event_3(p
):
11699 '''spec_reference_event : K_posedge expr_primary K_TAND expression '''
11701 print('spec_reference_event_3', list(p
))
11710 def p_spec_reference_event_4(p
):
11711 '''spec_reference_event : K_negedge expr_primary K_TAND expression '''
11713 print('spec_reference_event_4', list(p
))
11722 def p_spec_reference_event_5(p
):
11723 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary '''
11725 print('spec_reference_event_5', list(p
))
11732 def p_spec_reference_event_6(p
):
11733 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression '''
11735 print('spec_reference_event_6', list(p
))
11744 def p_spec_reference_event_7(p
):
11745 '''spec_reference_event : expr_primary K_TAND expression '''
11747 print('spec_reference_event_7', list(p
))
11756 def p_spec_reference_event_8(p
):
11757 '''spec_reference_event : expr_primary '''
11759 print('spec_reference_event_8', list(p
))
11766 def p_edge_descriptor_list_1(p
):
11767 '''edge_descriptor_list : edge_descriptor_list ',' K_edge_descriptor '''
11769 print('edge_descriptor_list_1', list(p
))
11775 def p_edge_descriptor_list_2(p
):
11776 '''edge_descriptor_list : K_edge_descriptor '''
11778 print('edge_descriptor_list_2', list(p
))
11784 def p_spec_notifier_opt_1(p
):
11785 '''spec_notifier_opt : '''
11787 print('spec_notifier_opt_1', list(p
))
11794 def p_spec_notifier_opt_2(p
):
11795 '''spec_notifier_opt : spec_notifier '''
11797 print('spec_notifier_opt_2', list(p
))
11804 def p_spec_notifier_1(p
):
11805 '''spec_notifier : ',' '''
11807 print('spec_notifier_1', list(p
))
11810 # { args_after_notifier = 0; }
11814 def p_spec_notifier_2(p
):
11815 '''spec_notifier : ',' hierarchy_identifier '''
11817 print('spec_notifier_2', list(p
))
11820 # { args_after_notifier = 0; delete p[2]; }
11824 def p_spec_notifier_3(p
):
11825 '''spec_notifier : spec_notifier ',' '''
11827 print('spec_notifier_3', list(p
))
11830 # { args_after_notifier += 1; }
11834 def p_spec_notifier_4(p
):
11835 '''spec_notifier : spec_notifier ',' hierarchy_identifier '''
11837 print('spec_notifier_4', list(p
))
11840 # { args_after_notifier += 1;
11841 # if (args_after_notifier >= 3) {
11842 # cerr << @3 << ": warning: timing checks are not supported "
11843 # "and delayed signal \"" << *p[3]
11844 # << "\" will not be driven." << endl;
11850 def p_spec_notifier_5(p
):
11851 '''spec_notifier : IDENTIFIER '''
11853 print('spec_notifier_5', list(p
))
11856 # { args_after_notifier = 0; delete[]p[1]; }
11860 def p_statement_item_1(p
):
11861 '''statement_item : K_assign lpvalue '=' expression ';' '''
11863 print('statement_item_1', list(p
))
11866 # { PCAssign*tmp = new PCAssign(p[2], p[4]);
11867 # FILE_NAME(tmp, @1);
11873 def p_statement_item_2(p
):
11874 '''statement_item : K_deassign lpvalue ';' '''
11876 print('statement_item_2', list(p
))
11879 # { PDeassign*tmp = new PDeassign(p[2]);
11880 # FILE_NAME(tmp, @1);
11886 def p_statement_item_3(p
):
11887 '''statement_item : K_force lpvalue '=' expression ';' '''
11889 print('statement_item_3', list(p
))
11892 # { PForce*tmp = new PForce(p[2], p[4]);
11893 # FILE_NAME(tmp, @1);
11899 def p_statement_item_4(p
):
11900 '''statement_item : K_release lpvalue ';' '''
11902 print('statement_item_4', list(p
))
11905 # { PRelease*tmp = new PRelease(p[2]);
11906 # FILE_NAME(tmp, @1);
11912 def p_statement_item_5(p
):
11913 '''statement_item : K_begin K_end '''
11915 print('statement_item_5', list(p
))
11918 # { PBlock*tmp = new PBlock(PBlock::BL_SEQ);
11919 # FILE_NAME(tmp, @1);
11925 def p_statement_item_6(p
):
11926 '''statement_item : K_begin _embed0_statement_item block_item_decls_opt _embed1_statement_item statement_or_null_list K_end '''
11928 print('statement_item_6', list(p
))
11933 # pform_pop_scope();
11934 # assert(! current_block_stack.empty());
11935 # tmp = current_block_stack.top();
11936 # current_block_stack.pop();
11938 # tmp = new PBlock(PBlock::BL_SEQ);
11939 # FILE_NAME(tmp, @1);
11941 # if (p[5]) tmp->set_statement(*p[5]);
11948 def p_statement_item_7(p
):
11949 '''statement_item : K_begin ':' IDENTIFIER _embed2_statement_item block_item_decls_opt statement_or_null_list_opt K_end endlabel_opt '''
11951 print('statement_item_7', list(p
))
11956 # { pform_pop_scope();
11957 # assert(! current_block_stack.empty());
11958 # PBlock*tmp = current_block_stack.top();
11959 # current_block_stack.pop();
11960 # if (p[6]) tmp->set_statement(*p[6]);
11963 # if (strcmp(p[3],p[8]) != 0) {
11964 # yyerror(@8, "error: End label doesn't match begin name");
11966 # if (! gn_system_verilog()) {
11967 # yyerror(@8, "error: Begin end labels require "
11968 # "SystemVerilog.");
11978 def p_statement_item_8(p
):
11979 '''statement_item : K_fork join_keyword '''
11981 print('statement_item_8', list(p
))
11984 # { PBlock*tmp = new PBlock(p[2]);
11985 # FILE_NAME(tmp, @1);
11991 def p_statement_item_9(p
):
11992 '''statement_item : K_fork _embed3_statement_item block_item_decls_opt _embed4_statement_item statement_or_null_list join_keyword '''
11994 print('statement_item_9', list(p
))
11999 # pform_pop_scope();
12000 # assert(! current_block_stack.empty());
12001 # tmp = current_block_stack.top();
12002 # current_block_stack.pop();
12003 # tmp->set_join_type(p[6]);
12005 # tmp = new PBlock(p[6]);
12006 # FILE_NAME(tmp, @1);
12008 # if (p[5]) tmp->set_statement(*p[5]);
12015 def p_statement_item_10(p
):
12016 '''statement_item : K_fork ':' IDENTIFIER _embed5_statement_item block_item_decls_opt statement_or_null_list_opt join_keyword endlabel_opt '''
12018 print('statement_item_10', list(p
))
12021 # { pform_pop_scope();
12022 # assert(! current_block_stack.empty());
12023 # PBlock*tmp = current_block_stack.top();
12024 # current_block_stack.pop();
12025 # tmp->set_join_type(p[7]);
12026 # if (p[6]) tmp->set_statement(*p[6]);
12029 # if (strcmp(p[3],p[8]) != 0) {
12030 # yyerror(@8, "error: End label doesn't match fork name");
12032 # if (! gn_system_verilog()) {
12033 # yyerror(@8, "error: Fork end labels require "
12034 # "SystemVerilog.");
12044 def p_statement_item_11(p
):
12045 '''statement_item : K_disable hierarchy_identifier ';' '''
12047 print('statement_item_11', list(p
))
12050 # { PDisable*tmp = new PDisable(*p[2]);
12051 # FILE_NAME(tmp, @1);
12058 def p_statement_item_12(p
):
12059 '''statement_item : K_disable K_fork ';' '''
12061 print('statement_item_12', list(p
))
12064 # { pform_name_t tmp_name;
12065 # PDisable*tmp = new PDisable(tmp_name);
12066 # FILE_NAME(tmp, @1);
12072 def p_statement_item_13(p
):
12073 '''statement_item : K_TRIGGER hierarchy_identifier ';' '''
12075 print('statement_item_13', list(p
))
12078 # { PTrigger*tmp = new PTrigger(*p[2]);
12079 # FILE_NAME(tmp, @1);
12086 def p_statement_item_14(p
):
12087 '''statement_item : procedural_assertion_statement '''
12089 print('statement_item_14', list(p
))
12096 def p_statement_item_15(p
):
12097 '''statement_item : loop_statement '''
12099 print('statement_item_15', list(p
))
12106 def p_statement_item_16(p
):
12107 '''statement_item : jump_statement '''
12109 print('statement_item_16', list(p
))
12116 def p_statement_item_17(p
):
12117 '''statement_item : K_case '(' expression ')' case_items K_endcase '''
12119 print('statement_item_17', list(p
))
12122 # { PCase*tmp = new PCase(NetCase::EQ, p[3], p[5]);
12123 # FILE_NAME(tmp, @1);
12129 def p_statement_item_18(p
):
12130 '''statement_item : K_casex '(' expression ')' case_items K_endcase '''
12132 print('statement_item_18', list(p
))
12135 # { PCase*tmp = new PCase(NetCase::EQX, p[3], p[5]);
12136 # FILE_NAME(tmp, @1);
12142 def p_statement_item_19(p
):
12143 '''statement_item : K_casez '(' expression ')' case_items K_endcase '''
12145 print('statement_item_19', list(p
))
12148 # { PCase*tmp = new PCase(NetCase::EQZ, p[3], p[5]);
12149 # FILE_NAME(tmp, @1);
12155 def p_statement_item_20(p
):
12156 '''statement_item : K_case '(' expression ')' error K_endcase '''
12158 print('statement_item_20', list(p
))
12165 def p_statement_item_21(p
):
12166 '''statement_item : K_casex '(' expression ')' error K_endcase '''
12168 print('statement_item_21', list(p
))
12175 def p_statement_item_22(p
):
12176 '''statement_item : K_casez '(' expression ')' error K_endcase '''
12178 print('statement_item_22', list(p
))
12185 def p_statement_item_23(p
):
12186 '''statement_item : K_if '(' expression ')' statement_or_null %prec less_than_K_else '''
12188 print('statement_item_23', list(p
))
12191 # { PCondit*tmp = new PCondit(p[3], p[5], 0);
12192 # FILE_NAME(tmp, @1);
12198 def p_statement_item_24(p
):
12199 '''statement_item : K_if '(' expression ')' statement_or_null K_else statement_or_null '''
12201 print('statement_item_24', list(p
))
12204 # { PCondit*tmp = new PCondit(p[3], p[5], p[7]);
12205 # FILE_NAME(tmp, @1);
12211 def p_statement_item_25(p
):
12212 '''statement_item : K_if '(' error ')' statement_or_null %prec less_than_K_else '''
12214 print('statement_item_25', list(p
))
12217 # { yyerror(@1, "error: Malformed conditional expression.");
12223 def p_statement_item_26(p
):
12224 '''statement_item : K_if '(' error ')' statement_or_null K_else statement_or_null '''
12226 print('statement_item_26', list(p
))
12229 # { yyerror(@1, "error: Malformed conditional expression.");
12235 def p_statement_item_27(p
):
12236 '''statement_item : compressed_statement ';' '''
12238 print('statement_item_27', list(p
))
12245 def p_statement_item_28(p
):
12246 '''statement_item : inc_or_dec_expression ';' '''
12248 print('statement_item_28', list(p
))
12251 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
12255 def p_statement_item_29(p
):
12256 '''statement_item : delay1 statement_or_null '''
12258 print('statement_item_29', list(p
))
12261 # { PExpr*del = p[1]->front();
12262 # assert(p[1]->size() == 1);
12264 # PDelayStatement*tmp = new PDelayStatement(del, p[2]);
12265 # FILE_NAME(tmp, @1);
12271 def p_statement_item_30(p
):
12272 '''statement_item : event_control statement_or_null '''
12274 print('statement_item_30', list(p
))
12277 # { PEventStatement*tmp = p[1];
12279 # yyerror(@1, "error: Invalid event control.");
12282 # tmp->set_statement(p[2]);
12289 def p_statement_item_31(p
):
12290 '''statement_item : '@' '*' statement_or_null '''
12292 print('statement_item_31', list(p
))
12295 # { PEventStatement*tmp = new PEventStatement;
12296 # FILE_NAME(tmp, @1);
12297 # tmp->set_statement(p[3]);
12303 def p_statement_item_32(p
):
12304 '''statement_item : '@' '(' '*' ')' statement_or_null '''
12306 print('statement_item_32', list(p
))
12309 # { PEventStatement*tmp = new PEventStatement;
12310 # FILE_NAME(tmp, @1);
12311 # tmp->set_statement(p[5]);
12317 def p_statement_item_33(p
):
12318 '''statement_item : lpvalue '=' expression ';' '''
12321 print('statement_item33', list(p))
12323 expr = Node(syms.expr_stmt, [p[1], Leaf(token.EQUAL, p[2]), p[3]])
12325 print("expr TODO", repr(expr))
12327 expr = Node(syms.expr_stmt, [p[1], Leaf(token.EQUAL, p[2]), ])
12329 print("expr", repr(expr))
12331 print("expr (python):'%s'" % expr)
12334 p
[0] = absyn
.assign3(p
[1], p
[2], p
[3])
12337 # { PAssign*tmp = new PAssign(p[1],p[3]);
12338 # FILE_NAME(tmp, @1);
12344 def p_statement_item_34(p
):
12345 '''statement_item : error '=' expression ';' '''
12347 print('statement_item_34', list(p
))
12350 # { yyerror(@2, "Syntax in assignment statement l-value.");
12352 # p[0] = new PNoop;
12357 def p_statement_item_35(p
):
12358 '''statement_item : lpvalue K_LE expression ';' '''
12360 print('statement_item_35', list(p
))
12363 # { PAssignNB*tmp = new PAssignNB(p[1],p[3]);
12364 # FILE_NAME(tmp, @1);
12370 def p_statement_item_36(p
):
12371 '''statement_item : error K_LE expression ';' '''
12373 print('statement_item_36', list(p
))
12376 # { yyerror(@2, "Syntax in assignment statement l-value.");
12378 # p[0] = new PNoop;
12383 def p_statement_item_37(p
):
12384 '''statement_item : lpvalue '=' delay1 expression ';' '''
12386 print('statement_item_37', list(p
))
12389 # { PExpr*del = p[3]->front(); p[3]->pop_front();
12390 # assert(p[3]->empty());
12391 # PAssign*tmp = new PAssign(p[1],del,p[4]);
12392 # FILE_NAME(tmp, @1);
12398 def p_statement_item_38(p
):
12399 '''statement_item : lpvalue K_LE delay1 expression ';' '''
12401 print('statement_item_38', list(p
))
12404 # { PExpr*del = p[3]->front(); p[3]->pop_front();
12405 # assert(p[3]->empty());
12406 # PAssignNB*tmp = new PAssignNB(p[1],del,p[4]);
12407 # FILE_NAME(tmp, @1);
12413 def p_statement_item_39(p
):
12414 '''statement_item : lpvalue '=' event_control expression ';' '''
12416 print('statement_item_39', list(p
))
12419 # { PAssign*tmp = new PAssign(p[1],0,p[3],p[4]);
12420 # FILE_NAME(tmp, @1);
12426 def p_statement_item_40(p
):
12427 '''statement_item : lpvalue '=' K_repeat '(' expression ')' event_control expression ';' '''
12429 print('statement_item_40', list(p
))
12432 # { PAssign*tmp = new PAssign(p[1],p[5],p[7],p[8]);
12433 # FILE_NAME(tmp,@1);
12434 # tmp->set_lineno(@1.first_line);
12440 def p_statement_item_41(p
):
12441 '''statement_item : lpvalue K_LE event_control expression ';' '''
12443 print('statement_item_41', list(p
))
12446 # { PAssignNB*tmp = new PAssignNB(p[1],0,p[3],p[4]);
12447 # FILE_NAME(tmp, @1);
12453 def p_statement_item_42(p
):
12454 '''statement_item : lpvalue K_LE K_repeat '(' expression ')' event_control expression ';' '''
12456 print('statement_item_42', list(p
))
12459 # { PAssignNB*tmp = new PAssignNB(p[1],p[5],p[7],p[8]);
12460 # FILE_NAME(tmp, @1);
12466 def p_statement_item_43(p
):
12467 '''statement_item : lpvalue '=' dynamic_array_new ';' '''
12469 print('statement_item_43', list(p
))
12472 # { PAssign*tmp = new PAssign(p[1],p[3]);
12473 # FILE_NAME(tmp, @1);
12479 def p_statement_item_44(p
):
12480 '''statement_item : lpvalue '=' class_new ';' '''
12482 print('statement_item_44', list(p
))
12485 # { PAssign*tmp = new PAssign(p[1],p[3]);
12486 # FILE_NAME(tmp, @1);
12492 def p_statement_item_45(p
):
12493 '''statement_item : K_wait '(' expression ')' statement_or_null '''
12495 print('statement_item_45', list(p
))
12498 # { PEventStatement*tmp;
12499 # PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, p[3]);
12500 # tmp = new PEventStatement(etmp);
12501 # FILE_NAME(tmp,@1);
12502 # tmp->set_statement(p[5]);
12508 def p_statement_item_46(p
):
12509 '''statement_item : K_wait K_fork ';' '''
12511 print('statement_item_46', list(p
))
12514 # { PEventStatement*tmp = new PEventStatement((PEEvent*)0);
12515 # FILE_NAME(tmp,@1);
12521 def p_statement_item_47(p
):
12522 '''statement_item : SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';' '''
12524 print('statement_item_47', list(p
))
12527 # { PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), *p[3]);
12528 # FILE_NAME(tmp,@1);
12536 def p_statement_item_48(p
):
12537 '''statement_item : SYSTEM_IDENTIFIER ';' '''
12539 print('statement_item_48', list(p
))
12542 # { list<PExpr*>pt;
12543 # PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), pt);
12544 # FILE_NAME(tmp,@1);
12551 def p_statement_item_49(p
):
12552 '''statement_item : hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
12554 print('statement_item_49', list(p
))
12557 # { PCallTask*tmp = pform_make_call_task(@1, *p[1], *p[3]);
12565 def p_statement_item_50(p
):
12566 '''statement_item : hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';' '''
12568 print('statement_item_50', list(p
))
12571 # { /* ....randomize with { <constraints> } */
12572 # if (p[1] && peek_tail_name(*p[1]) == "randomize") {
12573 # if (!gn_system_verilog())
12574 # yyerror(@2, "error: Randomize with constraint requires SystemVerilog.");
12576 # yyerror(@2, "sorry: Randomize with constraint not supported.");
12578 # yyerror(@2, "error: Constraint block can only be applied to randomize method.");
12581 # PCallTask*tmp = new PCallTask(*p[1], pt);
12582 # FILE_NAME(tmp, @1);
12589 def p_statement_item_51(p
):
12590 '''statement_item : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
12592 print('statement_item_51', list(p
))
12595 # { pform_name_t*t_name = p[1];
12596 # while (! p[3]->empty()) {
12597 # t_name->push_back(p[3]->front());
12598 # p[3]->pop_front();
12600 # PCallTask*tmp = new PCallTask(*t_name, *p[5]);
12601 # FILE_NAME(tmp, @1);
12610 def p_statement_item_52(p
):
12611 '''statement_item : hierarchy_identifier ';' '''
12613 print('statement_item_52', list(p
))
12616 # { list<PExpr*>pt;
12617 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
12624 def p_statement_item_53(p
):
12625 '''statement_item : implicit_class_handle '.' K_new '(' expression_list_with_nuls ')' ';' '''
12627 print('statement_item_53', list(p
))
12630 # { PChainConstructor*tmp = new PChainConstructor(*p[5]);
12631 # FILE_NAME(tmp, @3);
12638 def p_statement_item_54(p
):
12639 '''statement_item : hierarchy_identifier '(' error ')' ';' '''
12641 print('statement_item_54', list(p
))
12644 # { yyerror(@3, "error: Syntax error in task arguments.");
12646 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
12653 def p_statement_item_55(p
):
12654 '''statement_item : error ';' '''
12656 print('statement_item_55', list(p
))
12659 # { yyerror(@2, "error: malformed statement");
12661 # p[0] = new PNoop;
12666 def p__embed0_statement_item(p
):
12667 '''_embed0_statement_item : '''
12670 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_SEQ);
12671 # FILE_NAME(tmp, @1);
12672 # current_block_stack.push(tmp);
12677 def p__embed1_statement_item(p
):
12678 '''_embed1_statement_item : '''
12682 # if (! gn_system_verilog()) {
12683 # yyerror("error: Variable declaration in unnamed block "
12684 # "requires SystemVerilog.");
12687 # /* If there are no declarations in the scope then just delete it. */
12688 # pform_pop_scope();
12689 # assert(! current_block_stack.empty());
12690 # PBlock*tmp = current_block_stack.top();
12691 # current_block_stack.pop();
12698 def p__embed2_statement_item(p
):
12699 '''_embed2_statement_item : '''
12702 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_SEQ);
12703 # FILE_NAME(tmp, @1);
12704 # current_block_stack.push(tmp);
12709 def p__embed3_statement_item(p
):
12710 '''_embed3_statement_item : '''
12713 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
12714 # FILE_NAME(tmp, @1);
12715 # current_block_stack.push(tmp);
12720 def p__embed4_statement_item(p
):
12721 '''_embed4_statement_item : '''
12725 # if (! gn_system_verilog()) {
12726 # yyerror("error: Variable declaration in unnamed block "
12727 # "requires SystemVerilog.");
12730 # /* If there are no declarations in the scope then just delete it. */
12731 # pform_pop_scope();
12732 # assert(! current_block_stack.empty());
12733 # PBlock*tmp = current_block_stack.top();
12734 # current_block_stack.pop();
12741 def p__embed5_statement_item(p
):
12742 '''_embed5_statement_item : '''
12745 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_PAR);
12746 # FILE_NAME(tmp, @1);
12747 # current_block_stack.push(tmp);
12752 def p_compressed_statement_1(p
):
12753 '''compressed_statement : lpvalue K_PLUS_EQ expression '''
12755 print('compressed_statement_1', list(p
))
12758 # { PAssign*tmp = new PAssign(p[1], '+', p[3]);
12759 # FILE_NAME(tmp, @1);
12765 def p_compressed_statement_2(p
):
12766 '''compressed_statement : lpvalue K_MINUS_EQ expression '''
12768 print('compressed_statement_2', list(p
))
12771 # { PAssign*tmp = new PAssign(p[1], '-', p[3]);
12772 # FILE_NAME(tmp, @1);
12778 def p_compressed_statement_3(p
):
12779 '''compressed_statement : lpvalue K_MUL_EQ expression '''
12781 print('compressed_statement_3', list(p
))
12784 # { PAssign*tmp = new PAssign(p[1], '*', p[3]);
12785 # FILE_NAME(tmp, @1);
12791 def p_compressed_statement_4(p
):
12792 '''compressed_statement : lpvalue K_DIV_EQ expression '''
12794 print('compressed_statement_4', list(p
))
12797 # { PAssign*tmp = new PAssign(p[1], '/', p[3]);
12798 # FILE_NAME(tmp, @1);
12804 def p_compressed_statement_5(p
):
12805 '''compressed_statement : lpvalue K_MOD_EQ expression '''
12807 print('compressed_statement_5', list(p
))
12810 # { PAssign*tmp = new PAssign(p[1], '%', p[3]);
12811 # FILE_NAME(tmp, @1);
12817 def p_compressed_statement_6(p
):
12818 '''compressed_statement : lpvalue K_AND_EQ expression '''
12820 print('compressed_statement_6', list(p
))
12823 # { PAssign*tmp = new PAssign(p[1], '&', p[3]);
12824 # FILE_NAME(tmp, @1);
12830 def p_compressed_statement_7(p
):
12831 '''compressed_statement : lpvalue K_OR_EQ expression '''
12833 print('compressed_statement_7', list(p
))
12836 # { PAssign*tmp = new PAssign(p[1], '|', p[3]);
12837 # FILE_NAME(tmp, @1);
12843 def p_compressed_statement_8(p
):
12844 '''compressed_statement : lpvalue K_XOR_EQ expression '''
12846 print('compressed_statement_8', list(p
))
12849 # { PAssign*tmp = new PAssign(p[1], '^', p[3]);
12850 # FILE_NAME(tmp, @1);
12856 def p_compressed_statement_9(p
):
12857 '''compressed_statement : lpvalue K_LS_EQ expression '''
12859 print('compressed_statement_9', list(p
))
12862 # { PAssign *tmp = new PAssign(p[1], 'l', p[3]);
12863 # FILE_NAME(tmp, @1);
12869 def p_compressed_statement_10(p
):
12870 '''compressed_statement : lpvalue K_RS_EQ expression '''
12872 print('compressed_statement_10', list(p
))
12875 # { PAssign*tmp = new PAssign(p[1], 'r', p[3]);
12876 # FILE_NAME(tmp, @1);
12882 def p_compressed_statement_11(p
):
12883 '''compressed_statement : lpvalue K_RSS_EQ expression '''
12885 print('compressed_statement_11', list(p
))
12888 # { PAssign *tmp = new PAssign(p[1], 'R', p[3]);
12889 # FILE_NAME(tmp, @1);
12895 def p_statement_or_null_list_opt_1(p
):
12896 '''statement_or_null_list_opt : statement_or_null_list '''
12898 print('statement_or_null_list_opt_1', list(p
))
12905 def p_statement_or_null_list_opt_2(p
):
12906 '''statement_or_null_list_opt : '''
12908 print('statement_or_null_list_opt_2', list(p
))
12915 def p_statement_or_null_list_1(p
):
12916 '''statement_or_null_list : statement_or_null_list statement_or_null '''
12918 print('statement_or_null_list_1', list(p
))
12923 tmp
= StatementList()
12925 tmp
.add_statement(p
[2])
12928 # { vector<Statement*>*tmp = p[1];
12929 # if (p[2]) tmp->push_back(p[2]);
12935 def p_statement_or_null_list_2(p
):
12936 '''statement_or_null_list : statement_or_null '''
12938 print('statement_or_null_list_2', list(p
))
12940 tmp
= StatementList()
12942 tmp
.add_statement(p
[1])
12946 # { vector<Statement*>*tmp = new vector<Statement*>(0);
12947 # if (p[1]) tmp->push_back(p[1]);
12953 def p_analog_statement_1(p
):
12954 '''analog_statement : branch_probe_expression K_CONTRIBUTE expression ';' '''
12956 print('analog_statement_1', list(p
))
12959 # { p[0] = pform_contribution_statement(@2, p[1], p[3]); }
12963 def p_task_item_1(p
):
12964 '''task_item : block_item_decl '''
12966 print('task_item_1', list(p
))
12969 # { p[0] = new vector<pform_tf_port_t>(0); }
12973 def p_task_item_2(p
):
12974 '''task_item : tf_port_declaration '''
12976 print('task_item_2', list(p
))
12983 def p_task_item_list_1(p
):
12984 '''task_item_list : task_item_list task_item '''
12986 print('task_item_list_1', list(p
))
12989 # { vector<pform_tf_port_t>*tmp = p[1];
12990 # size_t s1 = tmp->size();
12991 # tmp->resize(s1 + p[2]->size());
12992 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
12993 # tmp->at(s1 + idx) = p[2]->at(idx);
13000 def p_task_item_list_2(p
):
13001 '''task_item_list : task_item '''
13003 print('task_item_list_2', list(p
))
13010 def p_task_item_list_opt_1(p
):
13011 '''task_item_list_opt : task_item_list '''
13013 print('task_item_list_opt_1', list(p
))
13020 def p_task_item_list_opt_2(p
):
13021 '''task_item_list_opt : '''
13023 print('task_item_list_opt_2', list(p
))
13030 def p_tf_port_list_opt_1(p
):
13031 '''tf_port_list_opt : tf_port_list '''
13033 print('tf_port_list_opt_1', list(p
))
13040 def p_tf_port_list_opt_2(p
):
13041 '''tf_port_list_opt : '''
13043 print('tf_port_list_opt_2', list(p
))
13050 def p_udp_body_1(p
):
13051 '''udp_body : K_table udp_entry_list K_endtable '''
13053 print('udp_body_1', list(p
))
13056 # { lex_end_table();
13062 def p_udp_body_2(p
):
13063 '''udp_body : K_table K_endtable '''
13065 print('udp_body_2', list(p
))
13068 # { lex_end_table();
13069 # yyerror(@1, "error: Empty UDP table.");
13075 def p_udp_body_3(p
):
13076 '''udp_body : K_table error K_endtable '''
13078 print('udp_body_3', list(p
))
13081 # { lex_end_table();
13082 # yyerror(@2, "Errors in UDP table");
13089 def p_udp_entry_list_1(p
):
13090 '''udp_entry_list : udp_comb_entry_list '''
13092 print('udp_entry_list_1', list(p
))
13098 def p_udp_entry_list_2(p
):
13099 '''udp_entry_list : udp_sequ_entry_list '''
13101 print('udp_entry_list_2', list(p
))
13107 def p_udp_comb_entry_1(p
):
13108 '''udp_comb_entry : udp_input_list ':' udp_output_sym ';' '''
13110 print('udp_comb_entry_1', list(p
))
13113 # { char*tmp = new char[strlen(p[1])+3];
13114 # strcpy(tmp, p[1]);
13115 # char*tp = tmp+strlen(tmp);
13125 def p_udp_comb_entry_list_1(p
):
13126 '''udp_comb_entry_list : udp_comb_entry '''
13128 print('udp_comb_entry_list_1', list(p
))
13131 # { list<string>*tmp = new list<string>;
13132 # tmp->push_back(p[1]);
13139 def p_udp_comb_entry_list_2(p
):
13140 '''udp_comb_entry_list : udp_comb_entry_list udp_comb_entry '''
13142 print('udp_comb_entry_list_2', list(p
))
13145 # { list<string>*tmp = p[1];
13146 # tmp->push_back(p[2]);
13153 def p_udp_sequ_entry_list_1(p
):
13154 '''udp_sequ_entry_list : udp_sequ_entry '''
13156 print('udp_sequ_entry_list_1', list(p
))
13159 # { list<string>*tmp = new list<string>;
13160 # tmp->push_back(p[1]);
13167 def p_udp_sequ_entry_list_2(p
):
13168 '''udp_sequ_entry_list : udp_sequ_entry_list udp_sequ_entry '''
13170 print('udp_sequ_entry_list_2', list(p
))
13173 # { list<string>*tmp = p[1];
13174 # tmp->push_back(p[2]);
13181 def p_udp_sequ_entry_1(p
):
13182 '''udp_sequ_entry : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' '''
13184 print('udp_sequ_entry_1', list(p
))
13187 # { char*tmp = new char[strlen(p[1])+5];
13188 # strcpy(tmp, p[1]);
13189 # char*tp = tmp+strlen(tmp);
13200 def p_udp_initial_1(p
):
13201 '''udp_initial : K_initial IDENTIFIER '=' number ';' '''
13203 print('udp_initial_1', list(p
))
13206 # { PExpr*etmp = new PENumber(p[4]);
13207 # PEIdent*itmp = new PEIdent(lex_strings.make(p[2]));
13208 # PAssign*atmp = new PAssign(itmp, etmp);
13209 # FILE_NAME(atmp, @2);
13216 def p_udp_init_opt_1(p
):
13217 '''udp_init_opt : udp_initial '''
13219 print('udp_init_opt_1', list(p
))
13226 def p_udp_init_opt_2(p
):
13227 '''udp_init_opt : '''
13229 print('udp_init_opt_2', list(p
))
13236 def p_udp_input_list_1(p
):
13237 '''udp_input_list : udp_input_sym '''
13239 print('udp_input_list_1', list(p
))
13242 # { char*tmp = new char[2];
13250 def p_udp_input_list_2(p
):
13251 '''udp_input_list : udp_input_list udp_input_sym '''
13253 print('udp_input_list_2', list(p
))
13256 # { char*tmp = new char[strlen(p[1])+2];
13257 # strcpy(tmp, p[1]);
13258 # char*tp = tmp+strlen(tmp);
13267 def p_udp_input_sym_1(p
):
13268 '''udp_input_sym : '0' '''
13270 print('udp_input_sym_1', list(p
))
13277 def p_udp_input_sym_2(p
):
13278 '''udp_input_sym : '1' '''
13280 print('udp_input_sym_2', list(p
))
13287 def p_udp_input_sym_3(p
):
13288 '''udp_input_sym : 'x' '''
13290 print('udp_input_sym_3', list(p
))
13297 def p_udp_input_sym_4(p
):
13298 '''udp_input_sym : '?' '''
13300 print('udp_input_sym_4', list(p
))
13307 def p_udp_input_sym_5(p
):
13308 '''udp_input_sym : 'b' '''
13310 print('udp_input_sym_5', list(p
))
13317 def p_udp_input_sym_6(p
):
13318 '''udp_input_sym : '*' '''
13320 print('udp_input_sym_6', list(p
))
13327 def p_udp_input_sym_7(p
):
13328 '''udp_input_sym : '%' '''
13330 print('udp_input_sym_7', list(p
))
13337 def p_udp_input_sym_8(p
):
13338 '''udp_input_sym : 'f' '''
13340 print('udp_input_sym_8', list(p
))
13347 def p_udp_input_sym_9(p
):
13348 '''udp_input_sym : 'F' '''
13350 print('udp_input_sym_9', list(p
))
13357 def p_udp_input_sym_10(p
):
13358 '''udp_input_sym : 'l' '''
13360 print('udp_input_sym_10', list(p
))
13367 def p_udp_input_sym_11(p
):
13368 '''udp_input_sym : 'h' '''
13370 print('udp_input_sym_11', list(p
))
13377 def p_udp_input_sym_12(p
):
13378 '''udp_input_sym : 'B' '''
13380 print('udp_input_sym_12', list(p
))
13387 def p_udp_input_sym_13(p
):
13388 '''udp_input_sym : 'r' '''
13390 print('udp_input_sym_13', list(p
))
13397 def p_udp_input_sym_14(p
):
13398 '''udp_input_sym : 'R' '''
13400 print('udp_input_sym_14', list(p
))
13407 def p_udp_input_sym_15(p
):
13408 '''udp_input_sym : 'M' '''
13410 print('udp_input_sym_15', list(p
))
13417 def p_udp_input_sym_16(p
):
13418 '''udp_input_sym : 'n' '''
13420 print('udp_input_sym_16', list(p
))
13427 def p_udp_input_sym_17(p
):
13428 '''udp_input_sym : 'N' '''
13430 print('udp_input_sym_17', list(p
))
13437 def p_udp_input_sym_18(p
):
13438 '''udp_input_sym : 'p' '''
13440 print('udp_input_sym_18', list(p
))
13447 def p_udp_input_sym_19(p
):
13448 '''udp_input_sym : 'P' '''
13450 print('udp_input_sym_19', list(p
))
13457 def p_udp_input_sym_20(p
):
13458 '''udp_input_sym : 'Q' '''
13460 print('udp_input_sym_20', list(p
))
13467 def p_udp_input_sym_21(p
):
13468 '''udp_input_sym : 'q' '''
13470 print('udp_input_sym_21', list(p
))
13477 def p_udp_input_sym_22(p
):
13478 '''udp_input_sym : '_' '''
13480 print('udp_input_sym_22', list(p
))
13487 def p_udp_input_sym_23(p
):
13488 '''udp_input_sym : '+' '''
13490 print('udp_input_sym_23', list(p
))
13497 def p_udp_input_sym_24(p
):
13498 '''udp_input_sym : DEC_NUMBER '''
13500 print('udp_input_sym_24', list(p
))
13503 # { yyerror(@1, "internal error: Input digits parse as decimal number!"); p[0] = '0'; }
13507 def p_udp_output_sym_1(p
):
13508 '''udp_output_sym : '0' '''
13510 print('udp_output_sym_1', list(p
))
13517 def p_udp_output_sym_2(p
):
13518 '''udp_output_sym : '1' '''
13520 print('udp_output_sym_2', list(p
))
13527 def p_udp_output_sym_3(p
):
13528 '''udp_output_sym : 'x' '''
13530 print('udp_output_sym_3', list(p
))
13537 def p_udp_output_sym_4(p
):
13538 '''udp_output_sym : '-' '''
13540 print('udp_output_sym_4', list(p
))
13547 def p_udp_output_sym_5(p
):
13548 '''udp_output_sym : DEC_NUMBER '''
13550 print('udp_output_sym_5', list(p
))
13553 # { yyerror(@1, "internal error: Output digits parse as decimal number!"); p[0] = '0'; }
13557 def p_udp_port_decl_1(p
):
13558 '''udp_port_decl : K_input list_of_identifiers ';' '''
13560 print('udp_port_decl_1', list(p
))
13563 # { p[0] = pform_make_udp_input_ports(p[2]); }
13567 def p_udp_port_decl_2(p
):
13568 '''udp_port_decl : K_output IDENTIFIER ';' '''
13570 print('udp_port_decl_2', list(p
))
13573 # { perm_string pname = lex_strings.make(p[2]);
13574 # PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
13575 # vector<PWire*>*tmp = new vector<PWire*>(1);
13583 def p_udp_port_decl_3(p
):
13584 '''udp_port_decl : K_reg IDENTIFIER ';' '''
13586 print('udp_port_decl_3', list(p
))
13589 # { perm_string pname = lex_strings.make(p[2]);
13590 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
13591 # vector<PWire*>*tmp = new vector<PWire*>(1);
13599 def p_udp_port_decl_4(p
):
13600 '''udp_port_decl : K_reg K_output IDENTIFIER ';' '''
13602 print('udp_port_decl_4', list(p
))
13605 # { perm_string pname = lex_strings.make(p[3]);
13606 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
13607 # vector<PWire*>*tmp = new vector<PWire*>(1);
13615 def p_udp_port_decls_1(p
):
13616 '''udp_port_decls : udp_port_decl '''
13618 print('udp_port_decls_1', list(p
))
13625 def p_udp_port_decls_2(p
):
13626 '''udp_port_decls : udp_port_decls udp_port_decl '''
13628 print('udp_port_decls_2', list(p
))
13631 # { vector<PWire*>*tmp = p[1];
13632 # size_t s1 = p[1]->size();
13633 # tmp->resize(s1+p[2]->size());
13634 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
13635 # tmp->at(s1+idx) = p[2]->at(idx);
13642 def p_udp_port_list_1(p
):
13643 '''udp_port_list : IDENTIFIER '''
13645 print('udp_port_list_1', list(p
))
13648 # { list<perm_string>*tmp = new list<perm_string>;
13649 # tmp->push_back(lex_strings.make(p[1]));
13656 def p_udp_port_list_2(p
):
13657 '''udp_port_list : udp_port_list ',' IDENTIFIER '''
13659 print('udp_port_list_2', list(p
))
13662 # { list<perm_string>*tmp = p[1];
13663 # tmp->push_back(lex_strings.make(p[3]));
13670 def p_udp_reg_opt_1(p
):
13671 '''udp_reg_opt : K_reg '''
13673 print('udp_reg_opt_1', list(p
))
13680 def p_udp_reg_opt_2(p
):
13681 '''udp_reg_opt : '''
13683 print('udp_reg_opt_2', list(p
))
13690 def p_udp_initial_expr_opt_1(p
):
13691 '''udp_initial_expr_opt : '=' expression '''
13693 print('udp_initial_expr_opt_1', list(p
))
13700 def p_udp_initial_expr_opt_2(p
):
13701 '''udp_initial_expr_opt : '''
13703 print('udp_initial_expr_opt_2', list(p
))
13710 def p_udp_input_declaration_list_1(p
):
13711 '''udp_input_declaration_list : K_input IDENTIFIER '''
13713 print('udp_input_declaration_list_1', list(p
))
13716 # { list<perm_string>*tmp = new list<perm_string>;
13717 # tmp->push_back(lex_strings.make(p[2]));
13724 def p_udp_input_declaration_list_2(p
):
13725 '''udp_input_declaration_list : udp_input_declaration_list ',' K_input IDENTIFIER '''
13727 print('udp_input_declaration_list_2', list(p
))
13730 # { list<perm_string>*tmp = p[1];
13731 # tmp->push_back(lex_strings.make(p[4]));
13738 def p_udp_primitive_1(p
):
13739 '''udp_primitive : K_primitive IDENTIFIER '(' udp_port_list ')' ';' udp_port_decls udp_init_opt udp_body K_endprimitive endlabel_opt '''
13741 print('udp_primitive_1', list(p
))
13744 # { perm_string tmp2 = lex_strings.make(p[2]);
13745 # pform_make_udp(tmp2, p[4], p[7], p[9], p[8],
13746 # @2.text, @2.first_line);
13748 # if (strcmp(p[2],p[11]) != 0) {
13749 # yyerror(@11, "error: End label doesn't match "
13750 # "primitive name");
13752 # if (! gn_system_verilog()) {
13753 # yyerror(@11, "error: Primitive end labels "
13754 # "require SystemVerilog.");
13763 def p_udp_primitive_2(p
):
13764 '''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 '''
13766 print('udp_primitive_2', list(p
))
13769 # { perm_string tmp2 = lex_strings.make(p[2]);
13770 # perm_string tmp6 = lex_strings.make(p[6]);
13771 # pform_make_udp(tmp2, p[5], tmp6, p[7], p[9], p[12],
13772 # @2.text, @2.first_line);
13774 # if (strcmp(p[2],p[14]) != 0) {
13775 # yyerror(@14, "error: End label doesn't match "
13776 # "primitive name");
13778 # if (! gn_system_verilog()) {
13779 # yyerror(@14, "error: Primitive end labels "
13780 # "require SystemVerilog.");
13790 def p_K_packed_opt_1(p
):
13791 '''K_packed_opt : K_packed '''
13793 print('K_packed_opt', list(p
))
13800 def p_K_packed_opt_2(p
):
13801 '''K_packed_opt : '''
13803 print('K_packed_opt', list(p
))
13810 def p_K_reg_opt_1(p
):
13811 '''K_reg_opt : K_reg '''
13813 print('K_reg_opt', list(p
))
13820 def p_K_reg_opt_2(p
):
13823 print('K_reg_opt', list(p
))
13830 def p_K_static_opt_1(p
):
13831 '''K_static_opt : K_static '''
13833 print('K_static_opt', list(p
))
13840 def p_K_static_opt_2(p
):
13841 '''K_static_opt : '''
13843 print('K_static_opt', list(p
))
13850 def p_K_virtual_opt_1(p
):
13851 '''K_virtual_opt : K_virtual '''
13860 def p_K_virtual_opt_2(p
):
13861 '''K_virtual_opt : '''