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
]
119 # -------------- RULES ----------------
123 def p_source_text_1(p
):
124 '''source_text : timeunits_declaration_opt _embed0_source_text description_list '''
126 print('source_text', list(p
))
132 def p_source_text_2(p
):
135 print('source_text', list(p
))
141 def p__embed0_source_text(p
):
142 '''_embed0_source_text : '''
145 # { pform_set_scope_timescale(yyloc); }
149 def p_assertion_item_1(p
):
150 '''assertion_item : concurrent_assertion_item '''
152 print('assertion_item_1', list(p
))
158 def p_assignment_pattern_1(p
):
159 '''assignment_pattern : K_LP expression_list_proper '}' '''
161 print('assignment_pattern_1', list(p
))
164 # { PEAssignPattern*tmp = new PEAssignPattern(*p[2]);
165 # FILE_NAME(tmp, @1);
172 def p_assignment_pattern_2(p
):
173 '''assignment_pattern : K_LP '}' '''
175 print('assignment_pattern_2', list(p
))
178 # { PEAssignPattern*tmp = new PEAssignPattern;
179 # FILE_NAME(tmp, @1);
185 def p_block_identifier_opt_1(p
):
186 '''block_identifier_opt : IDENTIFIER ':' '''
188 print('block_identifier_opt_1', list(p
))
194 def p_block_identifier_opt_2(p
):
195 '''block_identifier_opt : '''
197 print('block_identifier_opt_2', list(p
))
203 def p_class_declaration_1(p
):
204 '''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 '''
206 print('class_declaration_1', list(p
))
209 # { // Wrap up the class.
210 # if (p[11] && p[4] && p[4]->name != p[11]) {
211 # yyerror(@11, "error: Class end label doesn't match class name.");
218 def p__embed0_class_declaration(p
):
219 '''_embed0_class_declaration : '''
222 # { pform_start_class_declaration(@2, p[4], p[5].type, p[5].exprs, p[3]); }
226 def p__embed1_class_declaration(p
):
227 '''_embed1_class_declaration : '''
230 # { // Process a class.
231 # pform_end_class_declaration(@9);
236 def p_class_constraint_1(p
):
237 '''class_constraint : constraint_prototype '''
239 print('class_constraint_1', list(p
))
245 def p_class_constraint_2(p
):
246 '''class_constraint : constraint_declaration '''
248 print('class_constraint_2', list(p
))
254 def p_class_identifier_1(p
):
255 '''class_identifier : IDENTIFIER '''
257 print('class_identifier_1', list(p
))
260 # { // Create a synthetic typedef for the class name so that the
261 # // lexor detects the name as a type.
262 # perm_string name = lex_strings.make(p[1]);
263 # class_type_t*tmp = new class_type_t(name);
264 # FILE_NAME(tmp, @1);
265 # pform_set_typedef(name, tmp, NULL);
272 def p_class_identifier_2(p
):
273 '''class_identifier : TYPE_IDENTIFIER '''
275 print('class_identifier_2', list(p
))
278 # { class_type_t*tmp = dynamic_cast<class_type_t*>(p[1].type);
280 # yyerror(@1, "Type name \"%s\"is not a predeclared class name.", p[1].text);
288 def p_class_declaration_endlabel_opt_1(p
):
289 '''class_declaration_endlabel_opt : ':' TYPE_IDENTIFIER '''
291 print('class_declaration_endlabel_opt_1', list(p
))
294 # { class_type_t*tmp = dynamic_cast<class_type_t*> (p[2].type);
296 # yyerror(@2, "error: class declaration endlabel \"%s\" is not a class name\n", p[2].text);
299 # p[0] = strdupnew(tmp->name.str());
306 def p_class_declaration_endlabel_opt_2(p
):
307 '''class_declaration_endlabel_opt : ':' IDENTIFIER '''
309 print('class_declaration_endlabel_opt_2', list(p
))
316 def p_class_declaration_endlabel_opt_3(p
):
317 '''class_declaration_endlabel_opt : '''
319 print('class_declaration_endlabel_opt_3', list(p
))
326 def p_class_declaration_extends_opt_1(p
):
327 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '''
329 print('class_declaration_extends_opt_1', list(p
))
332 # { p[0].type = p[2].type;
339 def p_class_declaration_extends_opt_2(p
):
340 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '(' expression_list_with_nuls ')' '''
342 print('class_declaration_extends_opt_2', list(p
))
345 # { p[0].type = p[2].type;
352 def p_class_declaration_extends_opt_3(p
):
353 '''class_declaration_extends_opt : '''
355 print('class_declaration_extends_opt_3', list(p
))
358 # { p[0].type = 0; p[0].exprs = 0; }
362 def p_class_items_opt_1(p
):
363 '''class_items_opt : class_items '''
365 print('class_items_opt_1', list(p
))
371 def p_class_items_opt_2(p
):
372 '''class_items_opt : '''
374 print('class_items_opt_2', list(p
))
380 def p_class_items_1(p
):
381 '''class_items : class_items class_item '''
383 print('class_items_1', list(p
))
389 def p_class_items_2(p
):
390 '''class_items : class_item '''
392 print('class_items_2', list(p
))
398 def p_class_item_1(p
):
399 '''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 '''
401 print('class_item_1', list(p
))
404 # { current_function->set_ports(p[6]);
405 # pform_set_constructor_return(current_function);
406 # pform_set_this_class(@3, current_function);
407 # current_function_set_statement(@3, p[10]);
409 # current_function = 0;
414 def p_class_item_2(p
):
415 '''class_item : property_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
417 print('class_item_2', list(p
))
420 # { pform_class_property(@2, p[1], p[2], p[3]); }
424 def p_class_item_3(p
):
425 '''class_item : K_const class_item_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
427 print('class_item_3', list(p
))
430 # { pform_class_property(@1, p[2] | property_qualifier_t::make_const(), p[3], p[4]); }
434 def p_class_item_4(p
):
435 '''class_item : method_qualifier_opt task_declaration '''
437 print('class_item_4', list(p
))
440 # { /* The task_declaration rule puts this into the class */ }
444 def p_class_item_5(p
):
445 '''class_item : method_qualifier_opt function_declaration '''
447 print('class_item_5', list(p
))
450 # { /* The function_declaration rule puts this into the class */ }
454 def p_class_item_6(p
):
455 '''class_item : K_extern method_qualifier_opt K_function K_new ';' '''
457 print('class_item_6', list(p
))
460 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
464 def p_class_item_7(p
):
465 '''class_item : K_extern method_qualifier_opt K_function K_new '(' tf_port_list_opt ')' ';' '''
467 print('class_item_7', list(p
))
470 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
474 def p_class_item_8(p
):
475 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER ';' '''
477 print('class_item_8', list(p
))
480 # { yyerror(@1, "sorry: External methods are not yet supported.");
486 def p_class_item_9(p
):
487 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' ';' '''
489 print('class_item_9', list(p
))
492 # { yyerror(@1, "sorry: External methods are not yet supported.");
498 def p_class_item_10(p
):
499 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER ';' '''
501 print('class_item_10', list(p
))
504 # { yyerror(@1, "sorry: External methods are not yet supported.");
510 def p_class_item_11(p
):
511 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER '(' tf_port_list_opt ')' ';' '''
513 print('class_item_11', list(p
))
516 # { yyerror(@1, "sorry: External methods are not yet supported.");
522 def p_class_item_12(p
):
523 '''class_item : class_constraint '''
525 print('class_item_12', list(p
))
531 def p_class_item_13(p
):
532 '''class_item : property_qualifier_opt data_type error ';' '''
534 print('class_item_13', list(p
))
537 # { yyerror(@3, "error: Errors in variable names after data type.");
543 def p_class_item_14(p
):
544 '''class_item : property_qualifier_opt IDENTIFIER error ';' '''
546 print('class_item_14', list(p
))
549 # { yyerror(@3, "error: %s doesn't name a type.", p[2]);
555 def p_class_item_15(p
):
556 '''class_item : method_qualifier_opt K_function K_new error K_endfunction endnew_opt '''
558 print('class_item_15', list(p
))
561 # { yyerror(@1, "error: I give up on this class constructor declaration.");
567 def p_class_item_16(p
):
568 '''class_item : error ';' '''
570 print('class_item_16', list(p
))
573 # { yyerror(@2, "error: invalid class item.");
579 def p__embed0_class_item(p
):
580 '''_embed0_class_item : '''
583 # { assert(current_function==0);
584 # current_function = pform_push_constructor_scope(@3);
589 def p_class_item_qualifier_1(p
):
590 '''class_item_qualifier : K_static '''
592 print('class_item_qualifier_1', list(p
))
595 # { p[0] = property_qualifier_t::make_static(); }
599 def p_class_item_qualifier_2(p
):
600 '''class_item_qualifier : K_protected '''
602 print('class_item_qualifier_2', list(p
))
605 # { p[0] = property_qualifier_t::make_protected(); }
609 def p_class_item_qualifier_3(p
):
610 '''class_item_qualifier : K_local '''
612 print('class_item_qualifier_3', list(p
))
615 # { p[0] = property_qualifier_t::make_local(); }
619 def p_class_item_qualifier_list_1(p
):
620 '''class_item_qualifier_list : class_item_qualifier_list class_item_qualifier '''
622 print('class_item_qualifier_list_1', list(p
))
625 # { p[0] = p[1] | p[2]; }
629 def p_class_item_qualifier_list_2(p
):
630 '''class_item_qualifier_list : class_item_qualifier '''
632 print('class_item_qualifier_list_2', list(p
))
639 def p_class_item_qualifier_opt_1(p
):
640 '''class_item_qualifier_opt : class_item_qualifier_list '''
642 print('class_item_qualifier_opt_1', list(p
))
649 def p_class_item_qualifier_opt_2(p
):
650 '''class_item_qualifier_opt : '''
652 print('class_item_qualifier_opt_2', list(p
))
655 # { p[0] = property_qualifier_t::make_none(); }
659 def p_class_new_1(p
):
660 '''class_new : K_new '(' expression_list_with_nuls ')' '''
662 print('class_new_1', list(p
))
665 # { list<PExpr*>*expr_list = p[3];
666 # strip_tail_items(expr_list);
667 # PENewClass*tmp = new PENewClass(*expr_list);
668 # FILE_NAME(tmp, @1);
675 def p_class_new_2(p
):
676 '''class_new : K_new hierarchy_identifier '''
678 print('class_new_2', list(p
))
681 # { PEIdent*tmpi = new PEIdent(*p[2]);
682 # FILE_NAME(tmpi, @2);
683 # PENewCopy*tmp = new PENewCopy(tmpi);
684 # FILE_NAME(tmp, @1);
691 def p_class_new_3(p
):
692 '''class_new : K_new '''
694 print('class_new_3', list(p
))
697 # { PENewClass*tmp = new PENewClass;
698 # FILE_NAME(tmp, @1);
704 def p_concurrent_assertion_item_1(p
):
705 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' property_spec ')' statement_or_null '''
707 print('concurrent_assertion_item_1', list(p
))
711 # if (gn_assertions_flag) {
712 # yyerror(@2, "sorry: concurrent_assertion_item not supported."
713 # " Try -gno-assertion to turn this message off.");
719 def p_concurrent_assertion_item_2(p
):
720 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' error ')' statement_or_null '''
722 print('concurrent_assertion_item_2', list(p
))
726 # yyerror(@2, "error: Error in property_spec of concurrent assertion item.");
731 def p_constraint_block_item_1(p
):
732 '''constraint_block_item : constraint_expression '''
734 print('constraint_block_item_1', list(p
))
740 def p_constraint_block_item_list_1(p
):
741 '''constraint_block_item_list : constraint_block_item_list constraint_block_item '''
743 print('constraint_block_item_list_1', list(p
))
749 def p_constraint_block_item_list_2(p
):
750 '''constraint_block_item_list : constraint_block_item '''
752 print('constraint_block_item_list_2', list(p
))
758 def p_constraint_block_item_list_opt_1(p
):
759 '''constraint_block_item_list_opt : '''
761 print('constraint_block_item_list_opt_1', list(p
))
767 def p_constraint_block_item_list_opt_2(p
):
768 '''constraint_block_item_list_opt : constraint_block_item_list '''
770 print('constraint_block_item_list_opt_2', list(p
))
776 def p_constraint_declaration_1(p
):
777 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' constraint_block_item_list_opt '}' '''
779 print('constraint_declaration_1', list(p
))
782 # { yyerror(@2, "sorry: Constraint declarations not supported."); }
786 def p_constraint_declaration_2(p
):
787 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' error '}' '''
789 print('constraint_declaration_2', list(p
))
792 # { yyerror(@4, "error: Errors in the constraint block item list."); }
796 def p_constraint_expression_1(p
):
797 '''constraint_expression : expression ';' '''
799 print('constraint_expression_1', list(p
))
805 def p_constraint_expression_2(p
):
806 '''constraint_expression : expression K_dist '{' '}' ';' '''
808 print('constraint_expression_2', list(p
))
814 def p_constraint_expression_3(p
):
815 '''constraint_expression : expression K_TRIGGER constraint_set '''
817 print('constraint_expression_3', list(p
))
823 def p_constraint_expression_4(p
):
824 '''constraint_expression : K_if '(' expression ')' constraint_set %prec less_than_K_else '''
826 print('constraint_expression_4', list(p
))
832 def p_constraint_expression_5(p
):
833 '''constraint_expression : K_if '(' expression ')' constraint_set K_else constraint_set '''
835 print('constraint_expression_5', list(p
))
841 def p_constraint_expression_6(p
):
842 '''constraint_expression : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' constraint_set '''
844 print('constraint_expression_6', list(p
))
850 def p_constraint_expression_list_1(p
):
851 '''constraint_expression_list : constraint_expression_list constraint_expression '''
853 print('constraint_expression_list_1', list(p
))
859 def p_constraint_expression_list_2(p
):
860 '''constraint_expression_list : constraint_expression '''
862 print('constraint_expression_list_2', list(p
))
868 def p_constraint_prototype_1(p
):
869 '''constraint_prototype : K_static_opt K_constraint IDENTIFIER ';' '''
871 print('constraint_prototype_1', list(p
))
874 # { yyerror(@2, "sorry: Constraint prototypes not supported."); }
878 def p_constraint_set_1(p
):
879 '''constraint_set : constraint_expression '''
881 print('constraint_set_1', list(p
))
887 def p_constraint_set_2(p
):
888 '''constraint_set : '{' constraint_expression_list '}' '''
890 print('constraint_set_2', list(p
))
896 def p_data_declaration_1(p
):
897 '''data_declaration : attribute_list_opt data_type_or_implicit list_of_variable_decl_assignments ';' '''
899 print('data_declaration_1', list(p
))
902 # { data_type_t*data_type = p[2];
903 # if (data_type == 0) {
904 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
905 # FILE_NAME(data_type, @2);
907 # pform_makewire(@2, 0, str_strength, p[3], NetNet::IMPLICIT_REG, data_type);
912 def p_data_type_1(p
):
913 '''data_type : integer_vector_type unsigned_signed_opt dimensions_opt '''
915 print('data_type_1', list(p
))
918 if (use_vtype
== IVL_VT_NO_TYPE
):
919 use_vtype
= IVL_VT_LOGIC
921 dt
= DataType(use_vtype
, signed
=p
[2])
923 dt
.reg_flag
= reg_flag
927 # { ivl_variable_type_t use_vtype = p[1];
928 # bool reg_flag = false;
929 # if (use_vtype == IVL_VT_NO_TYPE) {
930 # use_vtype = IVL_VT_LOGIC;
933 # vector_type_t*tmp = new vector_type_t(use_vtype, p[2], p[3]);
934 # tmp->reg_flag = reg_flag;
935 # FILE_NAME(tmp, @1);
941 def p_data_type_2(p
):
942 '''data_type : non_integer_type '''
944 print('data_type_2', list(p
))
948 # { real_type_t*tmp = new real_type_t(p[1]);
949 # FILE_NAME(tmp, @1);
955 def p_data_type_3(p
):
956 '''data_type : struct_data_type '''
958 print('data_type_3', list(p
))
962 # { if (!p[1]->packed_flag) {
963 # yyerror(@1, "sorry: Unpacked structs not supported.");
970 def p_data_type_4(p
):
971 '''data_type : enum_data_type '''
973 print('data_type_4', list(p
))
980 def p_data_type_5(p
):
981 '''data_type : atom2_type signed_unsigned_opt '''
983 print('data_type_5', list(p
))
986 # { atom2_type_t*tmp = new atom2_type_t(p[1], p[2]);
987 # FILE_NAME(tmp, @1);
993 def p_data_type_6(p
):
994 '''data_type : K_integer signed_unsigned_opt '''
996 print('data_type_6', list(p
))
999 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
1000 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, p[2], pd);
1001 # tmp->reg_flag = true;
1002 # tmp->integer_flag = true;
1008 def p_data_type_7(p
):
1009 '''data_type : K_time '''
1011 print('data_type_7', list(p
))
1014 # { list<pform_range_t>*pd = make_range_from_width(64);
1015 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
1016 # tmp->reg_flag = !gn_system_verilog();
1022 def p_data_type_8(p
):
1023 '''data_type : TYPE_IDENTIFIER dimensions_opt '''
1025 print('data_type_8', list(p
))
1029 # parray_type_t*tmp = new parray_type_t(p[1].type, p[2]);
1030 # FILE_NAME(tmp, @1);
1032 # } else p[0] = p[1].type;
1033 # delete[]p[1].text;
1038 def p_data_type_9(p
):
1039 '''data_type : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_data_type TYPE_IDENTIFIER '''
1041 print('data_type_9', list(p
))
1044 # { lex_in_package_scope(0);
1046 # delete[]p[4].text;
1051 def p_data_type_10(p
):
1052 '''data_type : K_string '''
1054 print('data_type_10', list(p
))
1057 # { string_type_t*tmp = new string_type_t;
1058 # FILE_NAME(tmp, @1);
1064 def p__embed0_data_type(p
):
1065 '''_embed0_data_type : '''
1068 # { lex_in_package_scope(p[1]); }
1072 def p_data_type_or_implicit_1(p
):
1073 '''data_type_or_implicit : data_type '''
1075 print('data_type_or_implicit_1', list(p
))
1082 def p_data_type_or_implicit_2(p
):
1083 '''data_type_or_implicit : signing dimensions_opt '''
1085 print('data_type_or_implicit_2', list(p
))
1088 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, p[1], p[2]);
1089 # tmp->implicit_flag = true;
1090 # FILE_NAME(tmp, @1);
1096 def p_data_type_or_implicit_3(p
):
1097 '''data_type_or_implicit : dimensions '''
1099 print('data_type_or_implicit_3', list(p
))
1103 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, p[1]);
1104 # tmp->implicit_flag = true;
1105 # FILE_NAME(tmp, @1);
1111 def p_data_type_or_implicit_4(p
):
1112 '''data_type_or_implicit : '''
1113 if(parse_debug
> 2):
1114 print('data_type_or_implicit_4', list(p
))
1121 def p_data_type_or_implicit_or_void_1(p
):
1122 '''data_type_or_implicit_or_void : data_type_or_implicit '''
1124 print('data_type_or_implicit_or_void_1', list(p
))
1131 def p_data_type_or_implicit_or_void_2(p
):
1132 '''data_type_or_implicit_or_void : K_void '''
1134 print('data_type_or_implicit_or_void_2', list(p
))
1137 # { void_type_t*tmp = new void_type_t;
1138 # FILE_NAME(tmp, @1);
1144 def p_description_1(p
):
1145 '''description : module '''
1146 if(parse_debug
> 2):
1147 print('description_1', list(p
))
1153 def p_description_2(p
):
1154 '''description : udp_primitive '''
1156 print('description_2', list(p
))
1162 def p_description_3(p
):
1163 '''description : config_declaration '''
1165 print('description_3', list(p
))
1171 def p_description_4(p
):
1172 '''description : nature_declaration '''
1174 print('description_4', list(p
))
1180 def p_description_5(p
):
1181 '''description : package_declaration '''
1183 print('description_5', list(p
))
1189 def p_description_6(p
):
1190 '''description : discipline_declaration '''
1192 print('description_6', list(p
))
1198 def p_description_7(p
):
1199 '''description : package_item '''
1201 print('description_7', list(p
))
1207 def p_description_8(p
):
1208 '''description : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' '''
1210 print('description_8', list(p
))
1213 # { perm_string tmp3 = lex_strings.make(p[3]);
1214 # pform_set_type_attrib(tmp3, p[5], p[7]);
1221 def p_description_list_1(p
):
1222 '''description_list : description '''
1223 if(parse_debug
> 2):
1224 print('description_list_1', list(p
))
1230 def p_description_list_2(p
):
1231 '''description_list : description_list description '''
1233 print('description_list_2', list(p
))
1239 def p_endnew_opt_1(p
):
1240 '''endnew_opt : ':' K_new '''
1242 print('endnew_opt_1', list(p
))
1248 def p_endnew_opt_2(p
):
1251 print('endnew_opt_2', list(p
))
1257 def p_dynamic_array_new_1(p
):
1258 '''dynamic_array_new : K_new '[' expression ']' '''
1260 print('dynamic_array_new_1', list(p
))
1263 # { p[0] = new PENewArray(p[3], 0);
1264 # FILE_NAME(p[0], @1);
1269 def p_dynamic_array_new_2(p
):
1270 '''dynamic_array_new : K_new '[' expression ']' '(' expression ')' '''
1272 print('dynamic_array_new_2', list(p
))
1275 # { p[0] = new PENewArray(p[3], p[6]);
1276 # FILE_NAME(p[0], @1);
1281 def p_for_step_1(p
):
1282 '''for_step : lpvalue '=' expression '''
1284 print('for_step_1', list(p
))
1287 # { PAssign*tmp = new PAssign(p[1],p[3]);
1288 # FILE_NAME(tmp, @1);
1294 def p_for_step_2(p
):
1295 '''for_step : inc_or_dec_expression '''
1297 print('for_step_2', list(p
))
1300 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
1304 def p_for_step_3(p
):
1305 '''for_step : compressed_statement '''
1307 print('for_step_3', list(p
))
1314 def p_function_declaration_1(p
):
1315 '''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 '''
1317 print('function_declaration_1', list(p
))
1320 # { // Last step: check any closing name.
1322 # if (strcmp(p[4],p[11]) != 0) {
1323 # yyerror(@11, "error: End label doesn't match "
1326 # if (! gn_system_verilog()) {
1327 # yyerror(@11, "error: Function end labels require "
1328 # "SystemVerilog.");
1337 def p_function_declaration_2(p
):
1338 '''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 '''
1340 print('function_declaration_2', list(p
))
1343 # { // Last step: check any closing name.
1345 # if (strcmp(p[4],p[14]) != 0) {
1346 # yyerror(@14, "error: End label doesn't match "
1349 # if (! gn_system_verilog()) {
1350 # yyerror(@14, "error: Function end labels require "
1351 # "SystemVerilog.");
1360 def p_function_declaration_3(p
):
1361 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER error K_endfunction _embed4_function_declaration endlabel_opt '''
1363 print('function_declaration_3', list(p
))
1366 # { // Last step: check any closing name.
1368 # if (strcmp(p[4],p[8]) != 0) {
1369 # yyerror(@8, "error: End label doesn't match function name");
1371 # if (! gn_system_verilog()) {
1372 # yyerror(@8, "error: Function end labels require "
1373 # "SystemVerilog.");
1382 def p__embed0_function_declaration(p
):
1383 '''_embed0_function_declaration : '''
1386 # { assert(current_function == 0);
1387 # current_function = pform_push_function_scope(@1, p[4], p[2]);
1392 def p__embed1_function_declaration(p
):
1393 '''_embed1_function_declaration : '''
1396 # { current_function->set_ports(p[7]);
1397 # current_function->set_return(p[3]);
1398 # current_function_set_statement(p[8]? @8 : @4, p[8]);
1399 # pform_set_this_class(@4, current_function);
1400 # pform_pop_scope();
1401 # current_function = 0;
1406 def p__embed2_function_declaration(p
):
1407 '''_embed2_function_declaration : '''
1410 # { assert(current_function == 0);
1411 # current_function = pform_push_function_scope(@1, p[4], p[2]);
1416 def p__embed3_function_declaration(p
):
1417 '''_embed3_function_declaration : '''
1420 # { current_function->set_ports(p[7]);
1421 # current_function->set_return(p[3]);
1422 # current_function_set_statement(p[11]? @11 : @4, p[11]);
1423 # pform_set_this_class(@4, current_function);
1424 # pform_pop_scope();
1425 # current_function = 0;
1426 # if (p[7]==0 && !gn_system_verilog()) {
1427 # yyerror(@4, "error: Empty parenthesis syntax requires SystemVerilog.");
1433 def p__embed4_function_declaration(p
):
1434 '''_embed4_function_declaration : '''
1438 # if (current_function) {
1439 # pform_pop_scope();
1440 # current_function = 0;
1442 # assert(current_function == 0);
1443 # yyerror(@1, "error: Syntax error defining function.");
1449 def p_import_export_1(p
):
1450 '''import_export : K_import '''
1452 print('import_export_1', list(p
))
1459 def p_import_export_2(p
):
1460 '''import_export : K_export '''
1462 print('import_export_2', list(p
))
1469 def p_implicit_class_handle_1(p
):
1470 '''implicit_class_handle : K_this '''
1472 print('implicit_class_handle_1', list(p
))
1475 # { p[0] = pform_create_this(); }
1479 def p_implicit_class_handle_2(p
):
1480 '''implicit_class_handle : K_super '''
1482 print('implicit_class_handle_2', list(p
))
1485 # { p[0] = pform_create_super(); }
1489 def p_inc_or_dec_expression_1(p
):
1490 '''inc_or_dec_expression : K_INCR lpvalue %prec UNARY_PREC '''
1492 print('inc_or_dec_expression_1', list(p
))
1495 # { PEUnary*tmp = new PEUnary('I', p[2]);
1496 # FILE_NAME(tmp, @2);
1502 def p_inc_or_dec_expression_2(p
):
1503 '''inc_or_dec_expression : lpvalue K_INCR %prec UNARY_PREC '''
1505 print('inc_or_dec_expression_2', list(p
))
1508 # { PEUnary*tmp = new PEUnary('i', p[1]);
1509 # FILE_NAME(tmp, @1);
1515 def p_inc_or_dec_expression_3(p
):
1516 '''inc_or_dec_expression : K_DECR lpvalue %prec UNARY_PREC '''
1518 print('inc_or_dec_expression_3', list(p
))
1521 # { PEUnary*tmp = new PEUnary('D', p[2]);
1522 # FILE_NAME(tmp, @2);
1528 def p_inc_or_dec_expression_4(p
):
1529 '''inc_or_dec_expression : lpvalue K_DECR %prec UNARY_PREC '''
1531 print('inc_or_dec_expression_4', list(p
))
1534 # { PEUnary*tmp = new PEUnary('d', p[1]);
1535 # FILE_NAME(tmp, @1);
1541 def p_inside_expression_1(p
):
1542 '''inside_expression : expression K_inside '{' open_range_list '}' '''
1544 print('inside_expression_1', list(p
))
1547 # { yyerror(@2, "sorry: \"inside\" expressions not supported yet.");
1553 def p_integer_vector_type_1(p
):
1554 '''integer_vector_type : K_reg '''
1556 print('integer_vector_type_1', list(p
))
1557 p
[0] = IVL_VT_NO_TYPE
1563 def p_integer_vector_type_2(p
):
1564 '''integer_vector_type : K_bit '''
1566 print('integer_vector_type_2', list(p
))
1573 def p_integer_vector_type_3(p
):
1574 '''integer_vector_type : K_logic '''
1576 print('integer_vector_type_3', list(p
))
1583 def p_integer_vector_type_4(p
):
1584 '''integer_vector_type : K_bool '''
1586 print('integer_vector_type_4', list(p
))
1589 # { p[0] = IVL_VT_BOOL; }
1593 def p_join_keyword_1(p
):
1594 '''join_keyword : K_join '''
1596 print('join_keyword_1', list(p
))
1599 # { p[0] = PBlock::BL_PAR; }
1603 def p_join_keyword_2(p
):
1604 '''join_keyword : K_join_none '''
1606 print('join_keyword_2', list(p
))
1609 # { p[0] = PBlock::BL_JOIN_NONE; }
1613 def p_join_keyword_3(p
):
1614 '''join_keyword : K_join_any '''
1616 print('join_keyword_3', list(p
))
1619 # { p[0] = PBlock::BL_JOIN_ANY; }
1623 def p_jump_statement_1(p
):
1624 '''jump_statement : K_break ';' '''
1626 print('jump_statement_1', list(p
))
1629 # { yyerror(@1, "sorry: break statements not supported.");
1635 def p_jump_statement_2(p
):
1636 '''jump_statement : K_return ';' '''
1638 print('jump_statement_2', list(p
))
1641 # { PReturn*tmp = new PReturn(0);
1642 # FILE_NAME(tmp, @1);
1648 def p_jump_statement_3(p
):
1649 '''jump_statement : K_return expression ';' '''
1651 print('jump_statement_3', list(p
))
1654 # { PReturn*tmp = new PReturn(p[2]);
1655 # FILE_NAME(tmp, @1);
1661 def p_lifetime_1(p
):
1662 '''lifetime : K_automatic '''
1664 print('lifetime_1', list(p
))
1667 # { p[0] = LexicalScope::AUTOMATIC; }
1671 def p_lifetime_2(p
):
1672 '''lifetime : K_static '''
1674 print('lifetime_2', list(p
))
1677 # { p[0] = LexicalScope::STATIC; }
1681 def p_lifetime_opt_1(p
):
1682 '''lifetime_opt : lifetime '''
1684 print('lifetime_opt_1', list(p
))
1691 def p_lifetime_opt_2(p
):
1692 '''lifetime_opt : '''
1693 if(parse_debug
> 2):
1694 print('lifetime_opt_2', list(p
))
1697 # { p[0] = LexicalScope::INHERITED; }
1701 def p_loop_statement_1(p
):
1702 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' for_step ')' statement_or_null '''
1704 print('loop_statement_1', list(p
))
1707 # { PForStatement*tmp = new PForStatement(p[3], p[5], p[7], p[9], p[11]);
1708 # FILE_NAME(tmp, @1);
1714 def p_loop_statement_2(p
):
1715 '''loop_statement : K_for '(' data_type IDENTIFIER '=' expression ';' expression ';' for_step ')' _embed0_loop_statement statement_or_null '''
1717 print('loop_statement_2', list(p
))
1720 # { pform_name_t tmp_hident;
1721 # tmp_hident.push_back(name_component_t(lex_strings.make(p[4])));
1723 # PEIdent*tmp_ident = pform_new_ident(tmp_hident);
1724 # FILE_NAME(tmp_ident, @4);
1726 # PForStatement*tmp_for = new PForStatement(tmp_ident, p[6], p[8], p[10], p[13]);
1727 # FILE_NAME(tmp_for, @1);
1729 # pform_pop_scope();
1730 # vector<Statement*>tmp_for_list (1);
1731 # tmp_for_list[0] = tmp_for;
1732 # PBlock*tmp_blk = current_block_stack.top();
1733 # current_block_stack.pop();
1734 # tmp_blk->set_statement(tmp_for_list);
1741 def p_loop_statement_3(p
):
1742 '''loop_statement : K_forever statement_or_null '''
1744 print('loop_statement_3', list(p
))
1747 # { PForever*tmp = new PForever(p[2]);
1748 # FILE_NAME(tmp, @1);
1754 def p_loop_statement_4(p
):
1755 '''loop_statement : K_repeat '(' expression ')' statement_or_null '''
1757 print('loop_statement_4', list(p
))
1760 # { PRepeat*tmp = new PRepeat(p[3], p[5]);
1761 # FILE_NAME(tmp, @1);
1767 def p_loop_statement_5(p
):
1768 '''loop_statement : K_while '(' expression ')' statement_or_null '''
1770 print('loop_statement_5', list(p
))
1773 # { PWhile*tmp = new PWhile(p[3], p[5]);
1774 # FILE_NAME(tmp, @1);
1780 def p_loop_statement_6(p
):
1781 '''loop_statement : K_do statement_or_null K_while '(' expression ')' ';' '''
1783 print('loop_statement_6', list(p
))
1786 # { PDoWhile*tmp = new PDoWhile(p[5], p[2]);
1787 # FILE_NAME(tmp, @1);
1793 def p_loop_statement_7(p
):
1794 '''loop_statement : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' _embed1_loop_statement statement_or_null '''
1796 print('loop_statement_7', list(p
))
1799 # { PForeach*tmp_for = pform_make_foreach(@1, p[3], p[5], p[9]);
1801 # pform_pop_scope();
1802 # vector<Statement*>tmp_for_list(1);
1803 # tmp_for_list[0] = tmp_for;
1804 # PBlock*tmp_blk = current_block_stack.top();
1805 # current_block_stack.pop();
1806 # tmp_blk->set_statement(tmp_for_list);
1812 def p_loop_statement_8(p
):
1813 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' error ')' statement_or_null '''
1815 print('loop_statement_8', list(p
))
1819 # yyerror(@1, "error: Error in for loop step assignment.");
1824 def p_loop_statement_9(p
):
1825 '''loop_statement : K_for '(' lpvalue '=' expression ';' error ';' for_step ')' statement_or_null '''
1827 print('loop_statement_9', list(p
))
1831 # yyerror(@1, "error: Error in for loop condition expression.");
1836 def p_loop_statement_10(p
):
1837 '''loop_statement : K_for '(' error ')' statement_or_null '''
1839 print('loop_statement_10', list(p
))
1843 # yyerror(@1, "error: Incomprehensible for loop.");
1848 def p_loop_statement_11(p
):
1849 '''loop_statement : K_while '(' error ')' statement_or_null '''
1851 print('loop_statement_11', list(p
))
1855 # yyerror(@1, "error: Error in while loop condition.");
1860 def p_loop_statement_12(p
):
1861 '''loop_statement : K_do statement_or_null K_while '(' error ')' ';' '''
1863 print('loop_statement_12', list(p
))
1867 # yyerror(@1, "error: Error in do/while loop condition.");
1872 def p_loop_statement_13(p
):
1873 '''loop_statement : K_foreach '(' IDENTIFIER '[' error ']' ')' statement_or_null '''
1875 print('loop_statement_13', list(p
))
1879 # yyerror(@4, "error: Errors in foreach loop variables list.");
1884 def p__embed0_loop_statement(p
):
1885 '''_embed0_loop_statement : '''
1888 # { static unsigned for_counter = 0;
1889 # char for_block_name [64];
1890 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_for_loop%u", for_counter);
1892 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1893 # FILE_NAME(tmp, @1);
1894 # current_block_stack.push(tmp);
1896 # list<decl_assignment_t*>assign_list;
1897 # decl_assignment_t*tmp_assign = new decl_assignment_t;
1898 # tmp_assign->name = lex_strings.make(p[4]);
1899 # assign_list.push_back(tmp_assign);
1900 # pform_makewire(@4, 0, str_strength, &assign_list, NetNet::REG, p[3]);
1905 def p__embed1_loop_statement(p
):
1906 '''_embed1_loop_statement : '''
1909 # { static unsigned foreach_counter = 0;
1910 # char for_block_name[64];
1911 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_foreach%u", foreach_counter);
1912 # foreach_counter += 1;
1914 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1915 # FILE_NAME(tmp, @1);
1916 # current_block_stack.push(tmp);
1918 # pform_make_foreach_declarations(@1, p[5]);
1923 def p_list_of_variable_decl_assignments_1(p
):
1924 '''list_of_variable_decl_assignments : variable_decl_assignment '''
1926 print('list_of_variable_decl_assignments_1', list(p
))
1929 # { list<decl_assignment_t*>*tmp = new list<decl_assignment_t*>;
1930 # tmp->push_back(p[1]);
1936 def p_list_of_variable_decl_assignments_2(p
):
1937 '''list_of_variable_decl_assignments : list_of_variable_decl_assignments ',' variable_decl_assignment '''
1939 print('list_of_variable_decl_assignments_2', list(p
))
1942 # { list<decl_assignment_t*>*tmp = p[1];
1943 # tmp->push_back(p[3]);
1949 def p_variable_decl_assignment_1(p
):
1950 '''variable_decl_assignment : IDENTIFIER dimensions_opt '''
1952 print('variable_decl_assignment_1', list(p
))
1955 # { decl_assignment_t*tmp = new decl_assignment_t;
1956 # tmp->name = lex_strings.make(p[1]);
1958 # tmp->index = *p[2];
1967 def p_variable_decl_assignment_2(p
):
1968 '''variable_decl_assignment : IDENTIFIER '=' expression '''
1970 print('variable_decl_assignment_2', list(p
))
1973 # { decl_assignment_t*tmp = new decl_assignment_t;
1974 # tmp->name = lex_strings.make(p[1]);
1975 # tmp->expr .reset(p[3]);
1982 def p_variable_decl_assignment_3(p
):
1983 '''variable_decl_assignment : IDENTIFIER '=' K_new '(' ')' '''
1985 print('variable_decl_assignment_3', list(p
))
1988 # { decl_assignment_t*tmp = new decl_assignment_t;
1989 # tmp->name = lex_strings.make(p[1]);
1990 # PENewClass*expr = new PENewClass;
1991 # FILE_NAME(expr, @3);
1992 # tmp->expr .reset(expr);
1999 def p_loop_variables_1(p
):
2000 '''loop_variables : loop_variables ',' IDENTIFIER '''
2002 print('loop_variables_1', list(p
))
2005 # { list<perm_string>*tmp = p[1];
2006 # tmp->push_back(lex_strings.make(p[3]));
2013 def p_loop_variables_2(p
):
2014 '''loop_variables : IDENTIFIER '''
2016 print('loop_variables_2', list(p
))
2019 # { list<perm_string>*tmp = new list<perm_string>;
2020 # tmp->push_back(lex_strings.make(p[1]));
2027 def p_method_qualifier_1(p
):
2028 '''method_qualifier : K_virtual '''
2030 print('method_qualifier_1', list(p
))
2036 def p_method_qualifier_2(p
):
2037 '''method_qualifier : class_item_qualifier '''
2039 print('method_qualifier_2', list(p
))
2045 def p_method_qualifier_opt_1(p
):
2046 '''method_qualifier_opt : method_qualifier '''
2048 print('method_qualifier_opt_1', list(p
))
2054 def p_method_qualifier_opt_2(p
):
2055 '''method_qualifier_opt : '''
2057 print('method_qualifier_opt_2', list(p
))
2063 def p_modport_declaration_1(p
):
2064 '''modport_declaration : K_modport _embed0_modport_declaration modport_item_list ';' '''
2066 print('modport_declaration_1', list(p
))
2072 def p__embed0_modport_declaration(p
):
2073 '''_embed0_modport_declaration : '''
2076 # { if (!pform_in_interface())
2077 # yyerror(@1, "error: modport declarations are only allowed "
2078 # "in interfaces.");
2083 def p_modport_item_list_1(p
):
2084 '''modport_item_list : modport_item '''
2086 print('modport_item_list_1', list(p
))
2092 def p_modport_item_list_2(p
):
2093 '''modport_item_list : modport_item_list ',' modport_item '''
2095 print('modport_item_list_2', list(p
))
2101 def p_modport_item_1(p
):
2102 '''modport_item : IDENTIFIER _embed0_modport_item '(' modport_ports_list ')' '''
2104 print('modport_item_1', list(p
))
2107 # { pform_end_modport_item(@1); }
2111 def p__embed0_modport_item(p
):
2112 '''_embed0_modport_item : '''
2115 # { pform_start_modport_item(@1, p[1]); }
2119 def p_modport_ports_list_1(p
):
2120 '''modport_ports_list : modport_ports_declaration '''
2122 print('modport_ports_list_1', list(p
))
2128 def p_modport_ports_list_2(p
):
2129 '''modport_ports_list : modport_ports_list ',' modport_ports_declaration '''
2131 print('modport_ports_list_2', list(p
))
2137 def p_modport_ports_list_3(p
):
2138 '''modport_ports_list : modport_ports_list ',' modport_simple_port '''
2140 print('modport_ports_list_3', list(p
))
2143 # { if (last_modport_port.type == MP_SIMPLE) {
2144 # pform_add_modport_port(@3, last_modport_port.direction,
2145 # p[3]->name, p[3]->parm);
2147 # yyerror(@3, "error: modport expression not allowed here.");
2154 def p_modport_ports_list_4(p
):
2155 '''modport_ports_list : modport_ports_list ',' modport_tf_port '''
2157 print('modport_ports_list_4', list(p
))
2160 # { if (last_modport_port.type != MP_TF)
2161 # yyerror(@3, "error: task/function declaration not allowed here.");
2166 def p_modport_ports_list_5(p
):
2167 '''modport_ports_list : modport_ports_list ',' IDENTIFIER '''
2169 print('modport_ports_list_5', list(p
))
2172 # { if (last_modport_port.type == MP_SIMPLE) {
2173 # pform_add_modport_port(@3, last_modport_port.direction,
2174 # lex_strings.make(p[3]), 0);
2175 # } else if (last_modport_port.type != MP_TF) {
2176 # yyerror(@3, "error: list of identifiers not allowed here.");
2183 def p_modport_ports_list_6(p
):
2184 '''modport_ports_list : modport_ports_list ',' '''
2186 print('modport_ports_list_6', list(p
))
2189 # { yyerror(@2, "error: NULL port declarations are not allowed"); }
2193 def p_modport_ports_declaration_1(p
):
2194 '''modport_ports_declaration : attribute_list_opt port_direction IDENTIFIER '''
2196 print('modport_ports_declaration_1', list(p
))
2199 # { last_modport_port.type = MP_SIMPLE;
2200 # last_modport_port.direction = p[2];
2201 # pform_add_modport_port(@3, p[2], lex_strings.make(p[3]), 0);
2208 def p_modport_ports_declaration_2(p
):
2209 '''modport_ports_declaration : attribute_list_opt port_direction modport_simple_port '''
2211 print('modport_ports_declaration_2', list(p
))
2214 # { last_modport_port.type = MP_SIMPLE;
2215 # last_modport_port.direction = p[2];
2216 # pform_add_modport_port(@3, p[2], p[3]->name, p[3]->parm);
2223 def p_modport_ports_declaration_3(p
):
2224 '''modport_ports_declaration : attribute_list_opt import_export IDENTIFIER '''
2226 print('modport_ports_declaration_3', list(p
))
2229 # { last_modport_port.type = MP_TF;
2230 # last_modport_port.is_import = p[2];
2231 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
2238 def p_modport_ports_declaration_4(p
):
2239 '''modport_ports_declaration : attribute_list_opt import_export modport_tf_port '''
2241 print('modport_ports_declaration_4', list(p
))
2244 # { last_modport_port.type = MP_TF;
2245 # last_modport_port.is_import = p[2];
2246 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
2252 def p_modport_ports_declaration_5(p
):
2253 '''modport_ports_declaration : attribute_list_opt K_clocking IDENTIFIER '''
2255 print('modport_ports_declaration_5', list(p
))
2258 # { last_modport_port.type = MP_CLOCKING;
2259 # last_modport_port.direction = NetNet::NOT_A_PORT;
2260 # yyerror(@3, "sorry: modport clocking declaration is not yet supported.");
2267 def p_modport_simple_port_1(p
):
2268 '''modport_simple_port : '.' IDENTIFIER '(' expression ')' '''
2270 print('modport_simple_port_1', list(p
))
2273 # { named_pexpr_t*tmp = new named_pexpr_t;
2274 # tmp->name = lex_strings.make(p[2]);
2282 def p_modport_tf_port_1(p
):
2283 '''modport_tf_port : K_task IDENTIFIER '''
2285 print('modport_tf_port_1', list(p
))
2291 def p_modport_tf_port_2(p
):
2292 '''modport_tf_port : K_task IDENTIFIER '(' tf_port_list_opt ')' '''
2294 print('modport_tf_port_2', list(p
))
2300 def p_modport_tf_port_3(p
):
2301 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '''
2303 print('modport_tf_port_3', list(p
))
2309 def p_modport_tf_port_4(p
):
2310 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' '''
2312 print('modport_tf_port_4', list(p
))
2318 def p_non_integer_type_1(p
):
2319 '''non_integer_type : K_real '''
2321 print('non_integer_type_1', list(p
))
2324 # { p[0] = real_type_t::REAL; }
2328 def p_non_integer_type_2(p
):
2329 '''non_integer_type : K_realtime '''
2331 print('non_integer_type_2', list(p
))
2334 # { p[0] = real_type_t::REAL; }
2338 def p_non_integer_type_3(p
):
2339 '''non_integer_type : K_shortreal '''
2341 print('non_integer_type_3', list(p
))
2344 # { p[0] = real_type_t::SHORTREAL; }
2349 '''number : BASED_NUMBER '''
2351 print('number_1', list(p
))
2353 p
[1] = p
[1].replace("'b", "0b")
2354 p
[1] = p
[1].replace("'x", "0x")
2355 num
= Leaf(token
.NUMBER
, "%s" % (p
[1]))
2359 # { p[0] = p[1]; based_size = 0;}
2364 '''number : DEC_NUMBER '''
2366 print('number_2', list(p
))
2367 p
[1] = p
[1].replace("'b", "0b")
2368 p
[1] = p
[1].replace("'x", "0x")
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
))
2382 p
[2] = p
[2].replace("'b", "0b")
2383 p
[2] = p
[2].replace("'x", "0x")
2385 num
= Leaf(token
.NUMBER
, "%s" % (p
[2]))
2389 # { p[0] = pform_verinum_with_size(p[1],p[2], @2.text, @2.first_line);
2395 '''number : UNBASED_NUMBER '''
2397 print('number_4', list(p
))
2400 # { p[0] = p[1]; based_size = 0;}
2405 '''number : DEC_NUMBER UNBASED_NUMBER '''
2407 print('number_5', list(p
))
2410 # { yyerror(@1, "error: Unbased SystemVerilog literal cannot have "
2412 # p[0] = p[1]; based_size = 0;}
2416 def p_open_range_list_1(p
):
2417 '''open_range_list : open_range_list ',' value_range '''
2419 print('open_range_list_1', list(p
))
2425 def p_open_range_list_2(p
):
2426 '''open_range_list : value_range '''
2428 print('open_range_list_2', list(p
))
2434 def p_package_declaration_1(p
):
2435 '''package_declaration : K_package lifetime_opt IDENTIFIER ';' _embed0_package_declaration timeunits_declaration_opt _embed1_package_declaration package_item_list_opt K_endpackage endlabel_opt '''
2437 print('package_declaration_1', list(p
))
2440 # { pform_end_package_declaration(@1);
2441 # // If an end label is present make sure it match the package name.
2443 # if (strcmp(p[3],p[10]) != 0) {
2444 # yyerror(@10, "error: End label doesn't match package name");
2453 def p__embed0_package_declaration(p
):
2454 '''_embed0_package_declaration : '''
2457 # { pform_start_package_declaration(@1, p[3], p[2]); }
2461 def p__embed1_package_declaration(p
):
2462 '''_embed1_package_declaration : '''
2465 # { pform_set_scope_timescale(@1); }
2469 def p_module_package_import_list_opt_1(p
):
2470 '''module_package_import_list_opt : '''
2471 if(parse_debug
> 1):
2472 print('module_package_import_list_opt_1', list(p
))
2478 def p_module_package_import_list_opt_2(p
):
2479 '''module_package_import_list_opt : package_import_list '''
2481 print('module_package_import_list_opt_2', list(p
))
2487 def p_package_import_list_1(p
):
2488 '''package_import_list : package_import_declaration '''
2490 print('package_import_list_1', list(p
))
2496 def p_package_import_list_2(p
):
2497 '''package_import_list : package_import_list package_import_declaration '''
2499 print('package_import_list_2', list(p
))
2505 def p_package_import_declaration_1(p
):
2506 '''package_import_declaration : K_import package_import_item_list ';' '''
2508 print('package_import_declaration_1', list(p
))
2515 def p_package_import_item_1(p
):
2516 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '''
2518 print('package_import_item_1', list(p
))
2521 # { pform_package_import(@2, p[1], p[3]);
2527 def p_package_import_item_2(p
):
2528 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES '*' '''
2530 print('package_import_item_2', list(p
))
2533 # { pform_package_import(@2, p[1], 0);
2538 def p_package_import_item_list_1(p
):
2539 '''package_import_item_list : package_import_item_list ',' package_import_item '''
2541 print('package_import_item_list_1', list(p
))
2547 def p_package_import_item_list_2(p
):
2548 '''package_import_item_list : package_import_item '''
2550 print('package_import_item_list_2', list(p
))
2556 def p_package_item_1(p
):
2557 '''package_item : timeunits_declaration '''
2559 print('package_item_1', list(p
))
2565 def p_package_item_2(p
):
2566 '''package_item : K_parameter param_type parameter_assign_list ';' '''
2568 print('package_item_2', list(p
))
2574 def p_package_item_3(p
):
2575 '''package_item : K_localparam param_type localparam_assign_list ';' '''
2577 print('package_item_3', list(p
))
2583 def p_package_item_4(p
):
2584 '''package_item : type_declaration '''
2586 print('package_item_4', list(p
))
2592 def p_package_item_5(p
):
2593 '''package_item : function_declaration '''
2595 print('package_item_5', list(p
))
2601 def p_package_item_6(p
):
2602 '''package_item : task_declaration '''
2604 print('package_item_6', list(p
))
2610 def p_package_item_7(p
):
2611 '''package_item : data_declaration '''
2613 print('package_item_7', list(p
))
2619 def p_package_item_8(p
):
2620 '''package_item : class_declaration '''
2622 print('package_item_8', list(p
))
2628 def p_package_item_list_1(p
):
2629 '''package_item_list : package_item_list package_item '''
2631 print('package_item_list_1', list(p
))
2637 def p_package_item_list_2(p
):
2638 '''package_item_list : package_item '''
2640 print('package_item_list_2', list(p
))
2646 def p_package_item_list_opt_1(p
):
2647 '''package_item_list_opt : package_item_list '''
2649 print('package_item_list_opt_1', list(p
))
2655 def p_package_item_list_opt_2(p
):
2656 '''package_item_list_opt : '''
2658 print('package_item_list_opt_2', list(p
))
2664 def p_port_direction_1(p
):
2665 '''port_direction : K_input '''
2667 print('port_direction_1', list(p
))
2670 # { p[0] = NetNet::PINPUT; }
2674 def p_port_direction_2(p
):
2675 '''port_direction : K_output '''
2677 print('port_direction_2', list(p
))
2680 # { p[0] = NetNet::POUTPUT; }
2684 def p_port_direction_3(p
):
2685 '''port_direction : K_inout '''
2687 print('port_direction_3', list(p
))
2690 # { p[0] = NetNet::PINOUT; }
2694 def p_port_direction_4(p
):
2695 '''port_direction : K_ref '''
2697 print('port_direction_4', list(p
))
2700 # { p[0] = NetNet::PREF;
2701 # if (!gn_system_verilog()) {
2702 # yyerror(@1, "error: Reference ports (ref) require SystemVerilog.");
2703 # p[0] = NetNet::PINPUT;
2709 def p_port_direction_opt_1(p
):
2710 '''port_direction_opt : port_direction '''
2712 print('port_direction_opt_1', list(p
))
2719 def p_port_direction_opt_2(p
):
2720 '''port_direction_opt : '''
2722 print('port_direction_opt_2', list(p
))
2725 # { p[0] = NetNet::PIMPLICIT; }
2729 def p_property_expr_1(p
):
2730 '''property_expr : expression '''
2732 print('property_expr_1', list(p
))
2738 def p_procedural_assertion_statement_1(p
):
2739 '''procedural_assertion_statement : K_assert '(' expression ')' statement %prec less_than_K_else '''
2741 print('procedural_assertion_statement_1', list(p
))
2744 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2750 def p_procedural_assertion_statement_2(p
):
2751 '''procedural_assertion_statement : K_assert '(' expression ')' K_else statement '''
2753 print('procedural_assertion_statement_2', list(p
))
2756 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2762 def p_procedural_assertion_statement_3(p
):
2763 '''procedural_assertion_statement : K_assert '(' expression ')' statement K_else statement '''
2765 print('procedural_assertion_statement_3', list(p
))
2768 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2774 def p_property_qualifier_1(p
):
2775 '''property_qualifier : class_item_qualifier '''
2777 print('property_qualifier_1', list(p
))
2783 def p_property_qualifier_2(p
):
2784 '''property_qualifier : random_qualifier '''
2786 print('property_qualifier_2', list(p
))
2792 def p_property_qualifier_opt_1(p
):
2793 '''property_qualifier_opt : property_qualifier_list '''
2795 print('property_qualifier_opt_1', list(p
))
2802 def p_property_qualifier_opt_2(p
):
2803 '''property_qualifier_opt : '''
2805 print('property_qualifier_opt_2', list(p
))
2808 # { p[0] = property_qualifier_t::make_none(); }
2812 def p_property_qualifier_list_1(p
):
2813 '''property_qualifier_list : property_qualifier_list property_qualifier '''
2815 print('property_qualifier_list_1', list(p
))
2818 # { p[0] = p[1] | p[2]; }
2822 def p_property_qualifier_list_2(p
):
2823 '''property_qualifier_list : property_qualifier '''
2825 print('property_qualifier_list_2', list(p
))
2832 def p_property_spec_1(p
):
2833 '''property_spec : clocking_event_opt property_spec_disable_iff_opt property_expr '''
2835 print('property_spec_1', list(p
))
2841 def p_property_spec_disable_iff_opt_1(p
):
2842 '''property_spec_disable_iff_opt : K_disable K_iff '(' expression ')' '''
2844 print('property_spec_disable_iff_opt_1', list(p
))
2850 def p_property_spec_disable_iff_opt_2(p
):
2851 '''property_spec_disable_iff_opt : '''
2853 print('property_spec_disable_iff_opt_2', list(p
))
2859 def p_random_qualifier_1(p
):
2860 '''random_qualifier : K_rand '''
2862 print('random_qualifier_1', list(p
))
2865 # { p[0] = property_qualifier_t::make_rand(); }
2869 def p_random_qualifier_2(p
):
2870 '''random_qualifier : K_randc '''
2872 print('random_qualifier_2', list(p
))
2875 # { p[0] = property_qualifier_t::make_randc(); }
2879 def p_real_or_realtime_1(p
):
2880 '''real_or_realtime : K_real '''
2882 print('real_or_realtime_1', list(p
))
2888 def p_real_or_realtime_2(p
):
2889 '''real_or_realtime : K_realtime '''
2891 print('real_or_realtime_2', list(p
))
2898 '''signing : K_signed '''
2900 print('signing_1', list(p
))
2908 '''signing : K_unsigned '''
2910 print('signing_2', list(p
))
2917 def p_simple_type_or_string_1(p
):
2918 '''simple_type_or_string : integer_vector_type '''
2920 print('simple_type_or_string_1', list(p
))
2923 # { ivl_variable_type_t use_vtype = p[1];
2924 # bool reg_flag = false;
2925 # if (use_vtype == IVL_VT_NO_TYPE) {
2926 # use_vtype = IVL_VT_LOGIC;
2929 # vector_type_t*tmp = new vector_type_t(use_vtype, false, 0);
2930 # tmp->reg_flag = reg_flag;
2931 # FILE_NAME(tmp, @1);
2937 def p_simple_type_or_string_2(p
):
2938 '''simple_type_or_string : non_integer_type '''
2940 print('simple_type_or_string_2', list(p
))
2943 # { real_type_t*tmp = new real_type_t(p[1]);
2944 # FILE_NAME(tmp, @1);
2950 def p_simple_type_or_string_3(p
):
2951 '''simple_type_or_string : atom2_type '''
2953 print('simple_type_or_string_3', list(p
))
2956 # { atom2_type_t*tmp = new atom2_type_t(p[1], true);
2957 # FILE_NAME(tmp, @1);
2963 def p_simple_type_or_string_4(p
):
2964 '''simple_type_or_string : K_integer '''
2966 print('simple_type_or_string_4', list(p
))
2969 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
2970 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd);
2971 # tmp->reg_flag = true;
2972 # tmp->integer_flag = true;
2978 def p_simple_type_or_string_5(p
):
2979 '''simple_type_or_string : K_time '''
2981 print('simple_type_or_string_5', list(p
))
2984 # { list<pform_range_t>*pd = make_range_from_width(64);
2985 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
2986 # tmp->reg_flag = !gn_system_verilog();
2992 def p_simple_type_or_string_6(p
):
2993 '''simple_type_or_string : TYPE_IDENTIFIER '''
2995 print('simple_type_or_string_6', list(p
))
2998 # { p[0] = p[1].type;
2999 # delete[]p[1].text;
3004 def p_simple_type_or_string_7(p
):
3005 '''simple_type_or_string : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_simple_type_or_string TYPE_IDENTIFIER '''
3007 print('simple_type_or_string_7', list(p
))
3010 # { lex_in_package_scope(0);
3012 # delete[]p[4].text;
3017 def p_simple_type_or_string_8(p
):
3018 '''simple_type_or_string : K_string '''
3020 print('simple_type_or_string_8', list(p
))
3023 # { string_type_t*tmp = new string_type_t;
3024 # FILE_NAME(tmp, @1);
3030 def p__embed0_simple_type_or_string(p
):
3031 '''_embed0_simple_type_or_string : '''
3034 # { lex_in_package_scope(p[1]); }
3038 def p_statement_1(p
):
3039 '''statement : attribute_list_opt statement_item '''
3041 print('statement_1', list(p
))
3043 # { pform_bind_attributes(p[2]->attributes, p[1]);
3050 def p_statement_or_null_1(p
):
3051 '''statement_or_null : statement '''
3053 print('statement_or_null_1', list(p
))
3060 def p_statement_or_null_2(p
):
3061 '''statement_or_null : attribute_list_opt ';' '''
3063 print('statement_or_null_2', list(p
))
3065 raise(Exception("p_statement_or_null_2"))
3072 def p_stream_expression_1(p
):
3073 '''stream_expression : expression '''
3075 print('stream_expression_1', list(p
))
3081 def p_stream_expression_list_1(p
):
3082 '''stream_expression_list : stream_expression_list ',' stream_expression '''
3084 print('stream_expression_list_1', list(p
))
3090 def p_stream_expression_list_2(p
):
3091 '''stream_expression_list : stream_expression '''
3093 print('stream_expression_list_2', list(p
))
3099 def p_stream_operator_1(p
):
3100 '''stream_operator : K_LS '''
3102 print('stream_operator_1', list(p
))
3108 def p_stream_operator_2(p
):
3109 '''stream_operator : K_RS '''
3111 print('stream_operator_2', list(p
))
3117 def p_streaming_concatenation_1(p
):
3118 '''streaming_concatenation : '{' stream_operator '{' stream_expression_list '}' '}' '''
3120 print('streaming_concatenation_1', list(p
))
3123 # { /* streaming concatenation is a SystemVerilog thing. */
3124 # if (gn_system_verilog()) {
3125 # yyerror(@2, "sorry: Streaming concatenation not supported.");
3128 # yyerror(@2, "error: Streaming concatenation requires SystemVerilog");
3135 def p_task_declaration_1(p
):
3136 '''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 '''
3138 print('task_declaration_1', list(p
))
3141 # { // Last step: check any closing name. This is done late so
3142 # // that the parser can look ahead to detect the present
3143 # // endlabel_opt but still have the pform_endmodule() called
3144 # // early enough that the lexor can know we are outside the
3147 # if (strcmp(p[3],p[10]) != 0) {
3148 # yyerror(@10, "error: End label doesn't match task name");
3150 # if (! gn_system_verilog()) {
3151 # yyerror(@10, "error: Task end labels require "
3152 # "SystemVerilog.");
3161 def p_task_declaration_2(p
):
3162 '''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 '''
3164 print('task_declaration_2', list(p
))
3167 # { // Last step: check any closing name. This is done late so
3168 # // that the parser can look ahead to detect the present
3169 # // endlabel_opt but still have the pform_endmodule() called
3170 # // early enough that the lexor can know we are outside the
3173 # if (strcmp(p[3],p[13]) != 0) {
3174 # yyerror(@13, "error: End label doesn't match task name");
3176 # if (! gn_system_verilog()) {
3177 # yyerror(@13, "error: Task end labels require "
3178 # "SystemVerilog.");
3187 def p_task_declaration_3(p
):
3188 '''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 '''
3190 print('task_declaration_3', list(p
))
3193 # { // Last step: check any closing name. This is done late so
3194 # // that the parser can look ahead to detect the present
3195 # // endlabel_opt but still have the pform_endmodule() called
3196 # // early enough that the lexor can know we are outside the
3199 # if (strcmp(p[3],p[12]) != 0) {
3200 # yyerror(@12, "error: End label doesn't match task name");
3202 # if (! gn_system_verilog()) {
3203 # yyerror(@12, "error: Task end labels require "
3204 # "SystemVerilog.");
3213 def p_task_declaration_4(p
):
3214 '''task_declaration : K_task lifetime_opt IDENTIFIER error K_endtask _embed6_task_declaration endlabel_opt '''
3216 print('task_declaration_4', list(p
))
3219 # { // Last step: check any closing name. This is done late so
3220 # // that the parser can look ahead to detect the present
3221 # // endlabel_opt but still have the pform_endmodule() called
3222 # // early enough that the lexor can know we are outside the
3225 # if (strcmp(p[3],p[7]) != 0) {
3226 # yyerror(@7, "error: End label doesn't match task name");
3228 # if (! gn_system_verilog()) {
3229 # yyerror(@7, "error: Task end labels require "
3230 # "SystemVerilog.");
3239 def p__embed0_task_declaration(p
):
3240 '''_embed0_task_declaration : '''
3243 # { assert(current_task == 0);
3244 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3249 def p__embed1_task_declaration(p
):
3250 '''_embed1_task_declaration : '''
3253 # { current_task->set_ports(p[6]);
3254 # current_task_set_statement(@3, p[7]);
3255 # pform_set_this_class(@3, current_task);
3256 # pform_pop_scope();
3258 # if (p[7] && p[7]->size() > 1 && !gn_system_verilog()) {
3259 # yyerror(@7, "error: Task body with multiple statements requires SystemVerilog.");
3266 def p__embed2_task_declaration(p
):
3267 '''_embed2_task_declaration : '''
3270 # { assert(current_task == 0);
3271 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3276 def p__embed3_task_declaration(p
):
3277 '''_embed3_task_declaration : '''
3280 # { current_task->set_ports(p[6]);
3281 # current_task_set_statement(@3, p[10]);
3282 # pform_set_this_class(@3, current_task);
3283 # pform_pop_scope();
3285 # if (p[10]) delete p[10];
3290 def p__embed4_task_declaration(p
):
3291 '''_embed4_task_declaration : '''
3294 # { assert(current_task == 0);
3295 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3300 def p__embed5_task_declaration(p
):
3301 '''_embed5_task_declaration : '''
3304 # { current_task->set_ports(0);
3305 # current_task_set_statement(@3, p[9]);
3306 # pform_set_this_class(@3, current_task);
3307 # if (! current_task->method_of()) {
3308 # cerr << @3 << ": warning: task definition for \"" << p[3]
3309 # << "\" has an empty port declaration list!" << endl;
3311 # pform_pop_scope();
3313 # if (p[9]->size() > 1 && !gn_system_verilog()) {
3314 # yyerror(@9, "error: Task body with multiple statements requires SystemVerilog.");
3321 def p__embed6_task_declaration(p
):
3322 '''_embed6_task_declaration : '''
3326 # if (current_task) {
3327 # pform_pop_scope();
3334 def p_tf_port_declaration_1(p
):
3335 '''tf_port_declaration : port_direction K_reg_opt unsigned_signed_opt dimensions_opt list_of_identifiers ';' '''
3337 print('tf_port_declaration_1', list(p
))
3340 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1],
3341 # p[2] ? IVL_VT_LOGIC :
3343 # p[3], p[4], p[5]);
3349 def p_tf_port_declaration_2(p
):
3350 '''tf_port_declaration : port_direction K_integer list_of_identifiers ';' '''
3352 print('tf_port_declaration_2', list(p
))
3355 # { list<pform_range_t>*range_stub = make_range_from_width(integer_width);
3356 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, true,
3357 # range_stub, p[3], true);
3363 def p_tf_port_declaration_3(p
):
3364 '''tf_port_declaration : port_direction K_time list_of_identifiers ';' '''
3366 print('tf_port_declaration_3', list(p
))
3369 # { list<pform_range_t>*range_stub = make_range_from_width(64);
3370 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, false,
3371 # range_stub, p[3]);
3377 def p_tf_port_declaration_4(p
):
3378 '''tf_port_declaration : port_direction real_or_realtime list_of_identifiers ';' '''
3380 print('tf_port_declaration_4', list(p
))
3383 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_REAL, true,
3390 def p_tf_port_declaration_5(p
):
3391 '''tf_port_declaration : port_direction K_string list_of_identifiers ';' '''
3393 print('tf_port_declaration_5', list(p
))
3396 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_STRING, true,
3403 def p_tf_port_item_1(p
):
3404 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER dimensions_opt tf_port_item_expr_opt '''
3406 print('tf_port_item_1', list(p
))
3409 # { vector<pform_tf_port_t>*tmp;
3410 # NetNet::PortType use_port_type = p[1];
3411 # if ((use_port_type == NetNet::PIMPLICIT) && (gn_system_verilog() || (p[2] == 0)))
3412 # use_port_type = port_declaration_context.port_type;
3413 # perm_string name = lex_strings.make(p[3]);
3414 # list<perm_string>* ilist = list_from_identifier(p[3]);
3416 # if (use_port_type == NetNet::PIMPLICIT) {
3417 # yyerror(@1, "error: missing task/function port direction.");
3418 # use_port_type = NetNet::PINPUT; // for error recovery
3420 # if ((p[2] == 0) && (p[1]==NetNet::PIMPLICIT)) {
3421 # // Detect special case this is an undecorated
3422 # // identifier and we need to get the declaration from
3425 # yyerror(@4, "internal error: How can there be an unpacked range here?\n");
3427 # tmp = pform_make_task_ports(@3, use_port_type,
3428 # port_declaration_context.data_type,
3432 # // Otherwise, the decorations for this identifier
3433 # // indicate the type. Save the type for any right
3434 # // context that may come later.
3435 # port_declaration_context.port_type = use_port_type;
3437 # p[2] = new vector_type_t(IVL_VT_LOGIC, false, 0);
3438 # FILE_NAME(p[2], @3);
3440 # port_declaration_context.data_type = p[2];
3441 # tmp = pform_make_task_ports(@3, use_port_type, p[2], ilist);
3444 # pform_set_reg_idx(name, p[4]);
3449 # assert(tmp->size()==1);
3450 # tmp->front().defe = p[5];
3456 def p_tf_port_item_2(p
):
3457 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER error '''
3459 print('tf_port_item_2', list(p
))
3462 # { yyerror(@3, "error: Error in task/function port item after port name %s.", p[3]);
3469 def p_tf_port_item_expr_opt_1(p
):
3470 '''tf_port_item_expr_opt : '=' expression '''
3472 print('tf_port_item_expr_opt_1', list(p
))
3475 # { if (! gn_system_verilog()) {
3476 # yyerror(@1, "error: Task/function default arguments require "
3477 # "SystemVerilog.");
3484 def p_tf_port_item_expr_opt_2(p
):
3485 '''tf_port_item_expr_opt : '''
3487 print('tf_port_item_expr_opt_2', list(p
))
3494 def p_tf_port_list_1(p
):
3495 '''tf_port_list : _embed0_tf_port_list tf_port_item_list '''
3497 print('tf_port_list_1', list(p
))
3504 def p__embed0_tf_port_list(p
):
3505 '''_embed0_tf_port_list : '''
3508 # { port_declaration_context.port_type = gn_system_verilog() ? NetNet::PINPUT : NetNet::PIMPLICIT;
3509 # port_declaration_context.data_type = 0;
3514 def p_tf_port_item_list_1(p
):
3515 '''tf_port_item_list : tf_port_item_list ',' tf_port_item '''
3517 print('tf_port_item_list_1', list(p
))
3520 # { vector<pform_tf_port_t>*tmp;
3521 # if (p[1] && p[3]) {
3522 # size_t s1 = p[1]->size();
3524 # tmp->resize(tmp->size()+p[3]->size());
3525 # for (size_t idx = 0 ; idx < p[3]->size() ; idx += 1)
3526 # tmp->at(s1+idx) = p[3]->at(idx);
3528 # } else if (p[1]) {
3538 def p_tf_port_item_list_2(p
):
3539 '''tf_port_item_list : tf_port_item '''
3541 print('tf_port_item_list_2', list(p
))
3548 def p_tf_port_item_list_3(p
):
3549 '''tf_port_item_list : error ',' tf_port_item '''
3551 print('tf_port_item_list_3', list(p
))
3554 # { yyerror(@2, "error: Syntax error in task/function port declaration.");
3560 def p_tf_port_item_list_4(p
):
3561 '''tf_port_item_list : tf_port_item_list ',' '''
3563 print('tf_port_item_list_4', list(p
))
3566 # { yyerror(@2, "error: NULL port declarations are not allowed.");
3572 def p_tf_port_item_list_5(p
):
3573 '''tf_port_item_list : tf_port_item_list ';' '''
3575 print('tf_port_item_list_5', list(p
))
3578 # { yyerror(@2, "error: ';' is an invalid port declaration separator.");
3584 def p_timeunits_declaration_1(p
):
3585 '''timeunits_declaration : K_timeunit TIME_LITERAL ';' '''
3587 print('timeunits_declaration_1', list(p
))
3590 # { pform_set_timeunit(p[2], allow_timeunit_decl); }
3594 def p_timeunits_declaration_2(p
):
3595 '''timeunits_declaration : K_timeunit TIME_LITERAL '/' TIME_LITERAL ';' '''
3597 print('timeunits_declaration_2', list(p
))
3600 # { bool initial_decl = allow_timeunit_decl && allow_timeprec_decl;
3601 # pform_set_timeunit(p[2], initial_decl);
3602 # pform_set_timeprec(p[4], initial_decl);
3607 def p_timeunits_declaration_3(p
):
3608 '''timeunits_declaration : K_timeprecision TIME_LITERAL ';' '''
3610 print('timeunits_declaration_3', list(p
))
3613 # { pform_set_timeprec(p[2], allow_timeprec_decl); }
3617 def p_timeunits_declaration_opt_1(p
):
3618 '''timeunits_declaration_opt : %prec no_timeunits_declaration '''
3619 if(parse_debug
> 2):
3620 print('timeunits_declaration_opt_1', list(p
))
3626 def p_timeunits_declaration_opt_2(p
):
3627 '''timeunits_declaration_opt : timeunits_declaration %prec one_timeunits_declaration '''
3629 print('timeunits_declaration_opt_2', list(p
))
3635 def p_timeunits_declaration_opt_3(p
):
3636 '''timeunits_declaration_opt : timeunits_declaration timeunits_declaration '''
3638 print('timeunits_declaration_opt_3', list(p
))
3644 def p_value_range_1(p
):
3645 '''value_range : expression '''
3647 print('value_range_1', list(p
))
3654 def p_value_range_2(p
):
3655 '''value_range : '[' expression ':' expression ']' '''
3657 print('value_range_2', list(p
))
3664 def p_variable_dimension_1(p
):
3665 '''variable_dimension : '[' expression ':' expression ']' '''
3667 print('variable_dimension_1', list(p
))
3668 # { list<pform_range_t> *tmp = new list<pform_range_t>;
3669 # pform_range_t index (p[2],p[4]);
3670 # tmp->push_back(index);
3673 # XXX TODO: subscriptlist
3676 if end
.endswith("-1"):
3679 end
= str(int(end
)+1)
3682 p
[0] = '[%s:%s]' % (start
, end
) # python slice is LO:HI+1
3688 def p_variable_dimension_2(p
):
3689 '''variable_dimension : '[' expression ']' '''
3691 print('variable_dimension_2', list(p
))
3694 # { // SystemVerilog canonical range
3695 # if (!gn_system_verilog()) {
3697 # cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. "
3698 # << "Use at least -g2005-sv to remove this warning." << endl;
3700 # list<pform_range_t> *tmp = new list<pform_range_t>;
3701 # pform_range_t index;
3702 # index.first = new PENumber(new verinum((uint64_t)0, integer_width));
3703 # index.second = new PEBinary('-', p[2], new PENumber(new verinum((uint64_t)1, integer_width)));
3704 # tmp->push_back(index);
3710 def p_variable_dimension_3(p
):
3711 '''variable_dimension : '[' ']' '''
3713 print('variable_dimension_3', list(p
))
3716 # { list<pform_range_t> *tmp = new list<pform_range_t>;
3717 # pform_range_t index (0,0);
3718 # tmp->push_back(index);
3724 def p_variable_dimension_4(p
):
3725 '''variable_dimension : '[' '$' ']' '''
3727 print('variable_dimension_4', list(p
))
3730 # { // SystemVerilog queue
3731 # list<pform_range_t> *tmp = new list<pform_range_t>;
3732 # pform_range_t index (new PENull,0);
3733 # if (!gn_system_verilog()) {
3734 # yyerror("error: Queue declarations require SystemVerilog.");
3736 # tmp->push_back(index);
3742 def p_variable_lifetime_1(p
):
3743 '''variable_lifetime : lifetime '''
3745 print('variable_lifetime_1', list(p
))
3748 # { if (!gn_system_verilog()) {
3749 # yyerror(@1, "error: overriding the default variable lifetime "
3750 # "requires SystemVerilog.");
3751 # } else if (p[1] != pform_peek_scope()->default_lifetime) {
3752 # yyerror(@1, "sorry: overriding the default variable lifetime "
3753 # "is not yet supported.");
3755 # var_lifetime = p[1];
3760 def p_attribute_list_opt_1(p
):
3761 '''attribute_list_opt : attribute_instance_list '''
3763 print('attribute_list_opt_1', list(p
))
3770 def p_attribute_list_opt_2(p
):
3771 '''attribute_list_opt : '''
3772 if(parse_debug
> 2):
3773 print('attribute_list_opt_2', list(p
))
3780 def p_attribute_instance_list_1(p
):
3781 '''attribute_instance_list : K_PSTAR K_STARP '''
3783 print('attribute_instance_list_1', list(p
))
3790 def p_attribute_instance_list_2(p
):
3791 '''attribute_instance_list : K_PSTAR attribute_list K_STARP '''
3793 print('attribute_instance_list_2', list(p
))
3800 def p_attribute_instance_list_3(p
):
3801 '''attribute_instance_list : attribute_instance_list K_PSTAR K_STARP '''
3803 print('attribute_instance_list_3', list(p
))
3810 def p_attribute_instance_list_4(p
):
3811 '''attribute_instance_list : attribute_instance_list K_PSTAR attribute_list K_STARP '''
3813 print('attribute_instance_list_4', list(p
))
3816 # { list<named_pexpr_t>*tmp = p[1];
3818 # tmp->splice(tmp->end(), *p[3]);
3821 # } else p[0] = p[3];
3826 def p_attribute_list_1(p
):
3827 '''attribute_list : attribute_list ',' attribute '''
3829 print('attribute_list_1', list(p
))
3832 # { list<named_pexpr_t>*tmp = p[1];
3833 # tmp->push_back(*p[3]);
3840 def p_attribute_list_2(p
):
3841 '''attribute_list : attribute '''
3843 print('attribute_list_2', list(p
))
3846 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
3847 # tmp->push_back(*p[1]);
3854 def p_attribute_1(p
):
3855 '''attribute : IDENTIFIER '''
3857 print('attribute_1', list(p
))
3860 # { named_pexpr_t*tmp = new named_pexpr_t;
3861 # tmp->name = lex_strings.make(p[1]);
3869 def p_attribute_2(p
):
3870 '''attribute : IDENTIFIER '=' expression '''
3872 print('attribute_2', list(p
))
3875 # { PExpr*tmp = p[3];
3876 # named_pexpr_t*tmp2 = new named_pexpr_t;
3877 # tmp2->name = lex_strings.make(p[1]);
3885 def p_block_item_decl_1(p
):
3886 '''block_item_decl : data_type register_variable_list ';' '''
3888 print('block_item_decl_1', list(p
))
3891 # { if (p[1]) pform_set_data_type(@1, p[1], p[2], NetNet::REG, attributes_in_context);
3896 def p_block_item_decl_2(p
):
3897 '''block_item_decl : variable_lifetime data_type register_variable_list ';' '''
3899 print('block_item_decl_2', list(p
))
3902 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
3903 # var_lifetime = LexicalScope::INHERITED;
3908 def p_block_item_decl_3(p
):
3909 '''block_item_decl : K_reg data_type register_variable_list ';' '''
3911 print('block_item_decl_3', list(p
))
3914 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
3919 def p_block_item_decl_4(p
):
3920 '''block_item_decl : variable_lifetime K_reg data_type register_variable_list ';' '''
3922 print('block_item_decl_4', list(p
))
3925 # { if (p[3]) pform_set_data_type(@3, p[3], p[4], NetNet::REG, attributes_in_context);
3926 # var_lifetime = LexicalScope::INHERITED;
3931 def p_block_item_decl_5(p
):
3932 '''block_item_decl : K_event event_variable_list ';' '''
3934 print('block_item_decl_5', list(p
))
3937 # { if (p[2]) pform_make_events(p[2], @1.text, @1.first_line);
3942 def p_block_item_decl_6(p
):
3943 '''block_item_decl : K_parameter param_type parameter_assign_list ';' '''
3945 print('block_item_decl_6', list(p
))
3951 def p_block_item_decl_7(p
):
3952 '''block_item_decl : K_localparam param_type localparam_assign_list ';' '''
3954 print('block_item_decl_7', list(p
))
3960 def p_block_item_decl_8(p
):
3961 '''block_item_decl : type_declaration '''
3963 print('block_item_decl_8', list(p
))
3969 def p_block_item_decl_9(p
):
3970 '''block_item_decl : K_integer error ';' '''
3972 print('block_item_decl_9', list(p
))
3975 # { yyerror(@1, "error: syntax error in integer variable list.");
3981 def p_block_item_decl_10(p
):
3982 '''block_item_decl : K_time error ';' '''
3984 print('block_item_decl_10', list(p
))
3987 # { yyerror(@1, "error: syntax error in time variable list.");
3993 def p_block_item_decl_11(p
):
3994 '''block_item_decl : K_parameter error ';' '''
3996 print('block_item_decl_11', list(p
))
3999 # { yyerror(@1, "error: syntax error in parameter list.");
4005 def p_block_item_decl_12(p
):
4006 '''block_item_decl : K_localparam error ';' '''
4008 print('block_item_decl_12', list(p
))
4011 # { yyerror(@1, "error: syntax error localparam list.");
4017 def p_block_item_decls_1(p
):
4018 '''block_item_decls : block_item_decl '''
4020 print('block_item_decls_1', list(p
))
4026 def p_block_item_decls_2(p
):
4027 '''block_item_decls : block_item_decls block_item_decl '''
4029 print('block_item_decls_2', list(p
))
4035 def p_block_item_decls_opt_1(p
):
4036 '''block_item_decls_opt : block_item_decls '''
4038 print('block_item_decls_opt_1', list(p
))
4045 def p_block_item_decls_opt_2(p
):
4046 '''block_item_decls_opt : '''
4048 print('block_item_decls_opt_2', list(p
))
4055 def p_type_declaration_1(p
):
4056 '''type_declaration : K_typedef data_type IDENTIFIER dimensions_opt ';' '''
4058 print('type_declaration_1', list(p
))
4061 # { perm_string name = lex_strings.make(p[3]);
4062 # pform_set_typedef(name, p[2], p[4]);
4068 def p_type_declaration_2(p
):
4069 '''type_declaration : K_typedef data_type TYPE_IDENTIFIER ';' '''
4071 print('type_declaration_2', list(p
))
4074 # { perm_string name = lex_strings.make(p[3].text);
4075 # if (pform_test_type_identifier_local(name)) {
4076 # yyerror(@3, "error: Typedef identifier \"%s\" is already a type name.", p[3].text);
4079 # pform_set_typedef(name, p[2], NULL);
4081 # delete[]p[3].text;
4086 def p_type_declaration_3(p
):
4087 '''type_declaration : K_typedef K_class IDENTIFIER ';' '''
4089 print('type_declaration_3', list(p
))
4092 # { // Create a synthetic typedef for the class name so that the
4093 # // lexor detects the name as a type.
4094 # perm_string name = lex_strings.make(p[3]);
4095 # class_type_t*tmp = new class_type_t(name);
4096 # FILE_NAME(tmp, @3);
4097 # pform_set_typedef(name, tmp, NULL);
4103 def p_type_declaration_4(p
):
4104 '''type_declaration : K_typedef K_enum IDENTIFIER ';' '''
4106 print('type_declaration_4', list(p
))
4109 # { yyerror(@1, "sorry: Enum forward declarations not supported yet."); }
4113 def p_type_declaration_5(p
):
4114 '''type_declaration : K_typedef K_struct IDENTIFIER ';' '''
4116 print('type_declaration_5', list(p
))
4119 # { yyerror(@1, "sorry: Struct forward declarations not supported yet."); }
4123 def p_type_declaration_6(p
):
4124 '''type_declaration : K_typedef K_union IDENTIFIER ';' '''
4126 print('type_declaration_6', list(p
))
4129 # { yyerror(@1, "sorry: Union forward declarations not supported yet."); }
4133 def p_type_declaration_7(p
):
4134 '''type_declaration : K_typedef IDENTIFIER ';' '''
4136 print('type_declaration_7', list(p
))
4139 # { // Create a synthetic typedef for the class name so that the
4140 # // lexor detects the name as a type.
4141 # perm_string name = lex_strings.make(p[2]);
4142 # class_type_t*tmp = new class_type_t(name);
4143 # FILE_NAME(tmp, @2);
4144 # pform_set_typedef(name, tmp, NULL);
4150 def p_type_declaration_8(p
):
4151 '''type_declaration : K_typedef error ';' '''
4153 print('type_declaration_8', list(p
))
4156 # { yyerror(@2, "error: Syntax error in typedef clause.");
4162 def p_enum_data_type_1(p
):
4163 '''enum_data_type : K_enum '{' enum_name_list '}' '''
4165 print('enum_data_type_1', list(p
))
4168 # { enum_type_t*enum_type = new enum_type_t;
4169 # FILE_NAME(enum_type, @1);
4170 # enum_type->names .reset(p[3]);
4171 # enum_type->base_type = IVL_VT_BOOL;
4172 # enum_type->signed_flag = true;
4173 # enum_type->integer_flag = false;
4174 # enum_type->range.reset(make_range_from_width(32));
4180 def p_enum_data_type_2(p
):
4181 '''enum_data_type : K_enum atom2_type signed_unsigned_opt '{' enum_name_list '}' '''
4183 print('enum_data_type_2', list(p
))
4186 # { enum_type_t*enum_type = new enum_type_t;
4187 # FILE_NAME(enum_type, @1);
4188 # enum_type->names .reset(p[5]);
4189 # enum_type->base_type = IVL_VT_BOOL;
4190 # enum_type->signed_flag = p[3];
4191 # enum_type->integer_flag = false;
4192 # enum_type->range.reset(make_range_from_width(p[2]));
4198 def p_enum_data_type_3(p
):
4199 '''enum_data_type : K_enum K_integer signed_unsigned_opt '{' enum_name_list '}' '''
4201 print('enum_data_type_3', list(p
))
4204 # { enum_type_t*enum_type = new enum_type_t;
4205 # FILE_NAME(enum_type, @1);
4206 # enum_type->names .reset(p[5]);
4207 # enum_type->base_type = IVL_VT_LOGIC;
4208 # enum_type->signed_flag = p[3];
4209 # enum_type->integer_flag = true;
4210 # enum_type->range.reset(make_range_from_width(integer_width));
4216 def p_enum_data_type_4(p
):
4217 '''enum_data_type : K_enum K_logic unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
4219 print('enum_data_type_4', list(p
))
4222 # { enum_type_t*enum_type = new enum_type_t;
4223 # FILE_NAME(enum_type, @1);
4224 # enum_type->names .reset(p[6]);
4225 # enum_type->base_type = IVL_VT_LOGIC;
4226 # enum_type->signed_flag = p[3];
4227 # enum_type->integer_flag = false;
4228 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4234 def p_enum_data_type_5(p
):
4235 '''enum_data_type : K_enum K_reg unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
4237 print('enum_data_type_5', list(p
))
4240 # { enum_type_t*enum_type = new enum_type_t;
4241 # FILE_NAME(enum_type, @1);
4242 # enum_type->names .reset(p[6]);
4243 # enum_type->base_type = IVL_VT_LOGIC;
4244 # enum_type->signed_flag = p[3];
4245 # enum_type->integer_flag = false;
4246 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4252 def p_enum_data_type_6(p
):
4253 '''enum_data_type : K_enum K_bit unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
4255 print('enum_data_type_6', list(p
))
4258 # { enum_type_t*enum_type = new enum_type_t;
4259 # FILE_NAME(enum_type, @1);
4260 # enum_type->names .reset(p[6]);
4261 # enum_type->base_type = IVL_VT_BOOL;
4262 # enum_type->signed_flag = p[3];
4263 # enum_type->integer_flag = false;
4264 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4270 def p_enum_name_list_1(p
):
4271 '''enum_name_list : enum_name '''
4273 print('enum_name_list_1', list(p
))
4281 def p_enum_name_list_2(p
):
4282 '''enum_name_list : enum_name_list ',' enum_name '''
4284 print('enum_name_list_2', list(p
))
4287 # { list<named_pexpr_t>*lst = p[1];
4288 # lst->splice(lst->end(), *p[3]);
4295 def p_pos_neg_number_1(p
):
4296 '''pos_neg_number : number '''
4298 print('pos_neg_number_1', list(p
))
4306 def p_pos_neg_number_2(p
):
4307 '''pos_neg_number : '-' number '''
4309 print('pos_neg_number_2', list(p
))
4312 # { verinum tmp = -(*(p[2]));
4319 def p_enum_name_1(p
):
4320 '''enum_name : IDENTIFIER '''
4322 print('enum_name_1', list(p
))
4325 # { perm_string name = lex_strings.make(p[1]);
4327 # p[0] = make_named_number(name);
4332 def p_enum_name_2(p
):
4333 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '''
4335 print('enum_name_2', list(p
))
4338 # { perm_string name = lex_strings.make(p[1]);
4339 # long count = check_enum_seq_value(@1, p[3], false);
4341 # p[0] = make_named_numbers(name, 0, count-1);
4347 def p_enum_name_3(p
):
4348 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '''
4350 print('enum_name_3', list(p
))
4353 # { perm_string name = lex_strings.make(p[1]);
4354 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
4355 # check_enum_seq_value(@1, p[5], true));
4363 def p_enum_name_4(p
):
4364 '''enum_name : IDENTIFIER '=' expression '''
4366 print('enum_name_4', list(p
))
4369 # { perm_string name = lex_strings.make(p[1]);
4371 # p[0] = make_named_number(name, p[3]);
4376 def p_enum_name_5(p
):
4377 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '=' expression '''
4379 print('enum_name_5', list(p
))
4382 # { perm_string name = lex_strings.make(p[1]);
4383 # long count = check_enum_seq_value(@1, p[3], false);
4384 # p[0] = make_named_numbers(name, 0, count-1, p[6]);
4391 def p_enum_name_6(p
):
4392 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '=' expression '''
4394 print('enum_name_6', list(p
))
4397 # { perm_string name = lex_strings.make(p[1]);
4398 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
4399 # check_enum_seq_value(@1, p[5], true), p[8]);
4407 def p_struct_data_type_1(p
):
4408 '''struct_data_type : K_struct K_packed_opt '{' struct_union_member_list '}' '''
4410 print('struct_data_type_1', list(p
))
4413 # { struct_type_t*tmp = new struct_type_t;
4414 # FILE_NAME(tmp, @1);
4415 # tmp->packed_flag = p[2];
4416 # tmp->union_flag = false;
4417 # tmp->members .reset(p[4]);
4423 def p_struct_data_type_2(p
):
4424 '''struct_data_type : K_union K_packed_opt '{' struct_union_member_list '}' '''
4426 print('struct_data_type_2', list(p
))
4429 # { struct_type_t*tmp = new struct_type_t;
4430 # FILE_NAME(tmp, @1);
4431 # tmp->packed_flag = p[2];
4432 # tmp->union_flag = true;
4433 # tmp->members .reset(p[4]);
4439 def p_struct_data_type_3(p
):
4440 '''struct_data_type : K_struct K_packed_opt '{' error '}' '''
4442 print('struct_data_type_3', list(p
))
4445 # { yyerror(@3, "error: Errors in struct member list.");
4447 # struct_type_t*tmp = new struct_type_t;
4448 # FILE_NAME(tmp, @1);
4449 # tmp->packed_flag = p[2];
4450 # tmp->union_flag = false;
4456 def p_struct_data_type_4(p
):
4457 '''struct_data_type : K_union K_packed_opt '{' error '}' '''
4459 print('struct_data_type_4', list(p
))
4462 # { yyerror(@3, "error: Errors in union member list.");
4464 # struct_type_t*tmp = new struct_type_t;
4465 # FILE_NAME(tmp, @1);
4466 # tmp->packed_flag = p[2];
4467 # tmp->union_flag = true;
4473 def p_struct_union_member_list_1(p
):
4474 '''struct_union_member_list : struct_union_member_list struct_union_member '''
4476 print('struct_union_member_list_1', list(p
))
4479 # { list<struct_member_t*>*tmp = p[1];
4480 # tmp->push_back(p[2]);
4486 def p_struct_union_member_list_2(p
):
4487 '''struct_union_member_list : struct_union_member '''
4489 print('struct_union_member_list_2', list(p
))
4492 # { list<struct_member_t*>*tmp = new list<struct_member_t*>;
4493 # tmp->push_back(p[1]);
4499 def p_struct_union_member_1(p
):
4500 '''struct_union_member : attribute_list_opt data_type list_of_variable_decl_assignments ';' '''
4502 print('struct_union_member_1', list(p
))
4505 # { struct_member_t*tmp = new struct_member_t;
4506 # FILE_NAME(tmp, @2);
4507 # tmp->type .reset(p[2]);
4508 # tmp->names .reset(p[3]);
4514 def p_struct_union_member_2(p
):
4515 '''struct_union_member : error ';' '''
4517 print('struct_union_member_2', list(p
))
4520 # { yyerror(@2, "Error in struct/union member.");
4527 def p_case_item_1(p
):
4528 '''case_item : expression_list_proper ':' statement_or_null '''
4530 print('case_item_1', list(p
))
4533 # { PCase::Item*tmp = new PCase::Item;
4534 # tmp->expr = *p[1];
4542 def p_case_item_2(p
):
4543 '''case_item : K_default ':' statement_or_null '''
4545 print('case_item_2', list(p
))
4548 # { PCase::Item*tmp = new PCase::Item;
4555 def p_case_item_3(p
):
4556 '''case_item : K_default statement_or_null '''
4558 print('case_item_3', list(p
))
4561 # { PCase::Item*tmp = new PCase::Item;
4568 def p_case_item_4(p
):
4569 '''case_item : error ':' statement_or_null '''
4571 print('case_item_4', list(p
))
4574 # { yyerror(@2, "error: Incomprehensible case expression.");
4580 def p_case_items_1(p
):
4581 '''case_items : case_items case_item '''
4583 print('case_items_1', list(p
))
4586 # { svector<PCase::Item*>*tmp;
4587 # tmp = new svector<PCase::Item*>(*p[1], p[2]);
4594 def p_case_items_2(p
):
4595 '''case_items : case_item '''
4597 print('case_items_2', list(p
))
4600 # { svector<PCase::Item*>*tmp = new svector<PCase::Item*>(1);
4607 def p_charge_strength_1(p
):
4608 '''charge_strength : '(' K_small ')' '''
4610 print('charge_strength_1', list(p
))
4616 def p_charge_strength_2(p
):
4617 '''charge_strength : '(' K_medium ')' '''
4619 print('charge_strength_2', list(p
))
4625 def p_charge_strength_3(p
):
4626 '''charge_strength : '(' K_large ')' '''
4628 print('charge_strength_3', list(p
))
4634 def p_charge_strength_opt_1(p
):
4635 '''charge_strength_opt : charge_strength '''
4637 print('charge_strength_opt_1', list(p
))
4643 def p_charge_strength_opt_2(p
):
4644 '''charge_strength_opt : '''
4646 print('charge_strength_opt_2', list(p
))
4652 def p_defparam_assign_1(p
):
4653 '''defparam_assign : hierarchy_identifier '=' expression '''
4655 print('defparam_assign_1', list(p
))
4658 # { pform_set_defparam(*p[1], p[3]);
4664 def p_defparam_assign_list_1(p
):
4665 '''defparam_assign_list : defparam_assign '''
4667 print('defparam_assign_list_1', list(p
))
4673 def p_defparam_assign_list_2(p
):
4674 '''defparam_assign_list : dimensions defparam_assign '''
4676 print('defparam_assign_list_2', list(p
))
4679 # { yyerror(@1, "error: defparam may not include a range.");
4685 def p_defparam_assign_list_3(p
):
4686 '''defparam_assign_list : defparam_assign_list ',' defparam_assign '''
4688 print('defparam_assign_list_3', list(p
))
4695 '''delay1 : '#' delay_value_simple '''
4697 print('delay1_1', list(p
))
4700 # { list<PExpr*>*tmp = new list<PExpr*>;
4701 # tmp->push_back(p[2]);
4708 '''delay1 : '#' '(' delay_value ')' '''
4710 print('delay1_2', list(p
))
4713 # { list<PExpr*>*tmp = new list<PExpr*>;
4714 # tmp->push_back(p[3]);
4721 '''delay3 : '#' delay_value_simple '''
4723 print('delay3_1', list(p
))
4726 # { list<PExpr*>*tmp = new list<PExpr*>;
4727 # tmp->push_back(p[2]);
4734 '''delay3 : '#' '(' delay_value ')' '''
4736 print('delay3_2', list(p
))
4739 # { list<PExpr*>*tmp = new list<PExpr*>;
4740 # tmp->push_back(p[3]);
4747 '''delay3 : '#' '(' delay_value ',' delay_value ')' '''
4749 print('delay3_3', list(p
))
4752 # { list<PExpr*>*tmp = new list<PExpr*>;
4753 # tmp->push_back(p[3]);
4754 # tmp->push_back(p[5]);
4761 '''delay3 : '#' '(' delay_value ',' delay_value ',' delay_value ')' '''
4763 print('delay3_4', list(p
))
4766 # { list<PExpr*>*tmp = new list<PExpr*>;
4767 # tmp->push_back(p[3]);
4768 # tmp->push_back(p[5]);
4769 # tmp->push_back(p[7]);
4775 def p_delay3_opt_1(p
):
4776 '''delay3_opt : delay3 '''
4778 print('delay3_opt_1', list(p
))
4785 def p_delay3_opt_2(p
):
4787 if(parse_debug
> 2):
4788 print('delay3_opt_2', list(p
))
4795 def p_delay_value_list_1(p
):
4796 '''delay_value_list : delay_value '''
4798 print('delay_value_list_1', list(p
))
4801 # { list<PExpr*>*tmp = new list<PExpr*>;
4802 # tmp->push_back(p[1]);
4808 def p_delay_value_list_2(p
):
4809 '''delay_value_list : delay_value_list ',' delay_value '''
4811 print('delay_value_list_2', list(p
))
4814 # { list<PExpr*>*tmp = p[1];
4815 # tmp->push_back(p[3]);
4821 def p_delay_value_1(p
):
4822 '''delay_value : expression '''
4824 print('delay_value_1', list(p
))
4827 # { PExpr*tmp = p[1];
4833 def p_delay_value_2(p
):
4834 '''delay_value : expression ':' expression ':' expression '''
4836 print('delay_value_2', list(p
))
4839 # { p[0] = pform_select_mtm_expr(p[1], p[3], p[5]); }
4843 def p_delay_value_simple_1(p
):
4844 '''delay_value_simple : DEC_NUMBER '''
4846 print('delay_value_simple_1', list(p
))
4849 # { verinum*tmp = p[1];
4851 # yyerror(@1, "internal error: delay.");
4854 # p[0] = new PENumber(tmp);
4855 # FILE_NAME(p[0], @1);
4862 def p_delay_value_simple_2(p
):
4863 '''delay_value_simple : REALTIME '''
4865 print('delay_value_simple_2', list(p
))
4868 # { verireal*tmp = p[1];
4870 # yyerror(@1, "internal error: delay.");
4873 # p[0] = new PEFNumber(tmp);
4874 # FILE_NAME(p[0], @1);
4880 def p_delay_value_simple_3(p
):
4881 '''delay_value_simple : IDENTIFIER '''
4883 print('delay_value_simple_3', list(p
))
4886 # { PEIdent*tmp = new PEIdent(lex_strings.make(p[1]));
4887 # FILE_NAME(tmp, @1);
4894 def p_delay_value_simple_4(p
):
4895 '''delay_value_simple : TIME_LITERAL '''
4897 print('delay_value_simple_4', list(p
))
4904 # if (p[1] == 0 || !get_time_unit(p[1], unit))
4905 # yyerror(@1, "internal error: delay.");
4907 # double p = pow(10.0,
4908 # (double)(unit - pform_get_timeunit()));
4909 # double time = atof(p[1]) * p;
4911 # verireal *v = new verireal(time);
4912 # p[0] = new PEFNumber(v);
4913 # FILE_NAME(p[0], @1);
4919 def p_optional_semicolon_1(p
):
4920 '''optional_semicolon : ';' '''
4922 print('optional_semicolon_1', list(p
))
4928 def p_optional_semicolon_2(p
):
4929 '''optional_semicolon : '''
4931 print('optional_semicolon_2', list(p
))
4937 def p_discipline_declaration_1(p
):
4938 '''discipline_declaration : K_discipline IDENTIFIER optional_semicolon _embed0_discipline_declaration discipline_items K_enddiscipline '''
4940 print('discipline_declaration_1', list(p
))
4943 # { pform_end_discipline(@1); delete[] p[2]; }
4947 def p__embed0_discipline_declaration(p
):
4948 '''_embed0_discipline_declaration : '''
4951 # { pform_start_discipline(p[2]); }
4955 def p_discipline_items_1(p
):
4956 '''discipline_items : discipline_items discipline_item '''
4958 print('discipline_items_1', list(p
))
4964 def p_discipline_items_2(p
):
4965 '''discipline_items : discipline_item '''
4967 print('discipline_items_2', list(p
))
4973 def p_discipline_item_1(p
):
4974 '''discipline_item : K_domain K_discrete ';' '''
4976 print('discipline_item_1', list(p
))
4979 # { pform_discipline_domain(@1, IVL_DIS_DISCRETE); }
4983 def p_discipline_item_2(p
):
4984 '''discipline_item : K_domain K_continuous ';' '''
4986 print('discipline_item_2', list(p
))
4989 # { pform_discipline_domain(@1, IVL_DIS_CONTINUOUS); }
4993 def p_discipline_item_3(p
):
4994 '''discipline_item : K_potential IDENTIFIER ';' '''
4996 print('discipline_item_3', list(p
))
4999 # { pform_discipline_potential(@1, p[2]); delete[] p[2]; }
5003 def p_discipline_item_4(p
):
5004 '''discipline_item : K_flow IDENTIFIER ';' '''
5006 print('discipline_item_4', list(p
))
5009 # { pform_discipline_flow(@1, p[2]); delete[] p[2]; }
5013 def p_nature_declaration_1(p
):
5014 '''nature_declaration : K_nature IDENTIFIER optional_semicolon _embed0_nature_declaration nature_items K_endnature '''
5016 print('nature_declaration_1', list(p
))
5019 # { pform_end_nature(@1); delete[] p[2]; }
5023 def p__embed0_nature_declaration(p
):
5024 '''_embed0_nature_declaration : '''
5027 # { pform_start_nature(p[2]); }
5031 def p_nature_items_1(p
):
5032 '''nature_items : nature_items nature_item '''
5034 print('nature_items_1', list(p
))
5040 def p_nature_items_2(p
):
5041 '''nature_items : nature_item '''
5043 print('nature_items_2', list(p
))
5049 def p_nature_item_1(p
):
5050 '''nature_item : K_units '=' STRING ';' '''
5052 print('nature_item_1', list(p
))
5055 # { delete[] p[3]; }
5059 def p_nature_item_2(p
):
5060 '''nature_item : K_abstol '=' expression ';' '''
5062 print('nature_item_2', list(p
))
5068 def p_nature_item_3(p
):
5069 '''nature_item : K_access '=' IDENTIFIER ';' '''
5071 print('nature_item_3', list(p
))
5074 # { pform_nature_access(@1, p[3]); delete[] p[3]; }
5078 def p_nature_item_4(p
):
5079 '''nature_item : K_idt_nature '=' IDENTIFIER ';' '''
5081 print('nature_item_4', list(p
))
5084 # { delete[] p[3]; }
5088 def p_nature_item_5(p
):
5089 '''nature_item : K_ddt_nature '=' IDENTIFIER ';' '''
5091 print('nature_item_5', list(p
))
5094 # { delete[] p[3]; }
5098 def p_config_declaration_1(p
):
5099 '''config_declaration : K_config IDENTIFIER ';' K_design lib_cell_identifiers ';' list_of_config_rule_statements K_endconfig '''
5101 print('config_declaration_1', list(p
))
5104 # { cerr << @1 << ": sorry: config declarations are not supported and "
5105 # "will be skipped." << endl;
5111 def p_lib_cell_identifiers_1(p
):
5112 '''lib_cell_identifiers : '''
5114 print('lib_cell_identifiers_1', list(p
))
5120 def p_lib_cell_identifiers_2(p
):
5121 '''lib_cell_identifiers : lib_cell_identifiers lib_cell_id '''
5123 print('lib_cell_identifiers_2', list(p
))
5129 def p_list_of_config_rule_statements_1(p
):
5130 '''list_of_config_rule_statements : '''
5132 print('list_of_config_rule_statements_1', list(p
))
5138 def p_list_of_config_rule_statements_2(p
):
5139 '''list_of_config_rule_statements : list_of_config_rule_statements config_rule_statement '''
5141 print('list_of_config_rule_statements_2', list(p
))
5147 def p_config_rule_statement_1(p
):
5148 '''config_rule_statement : K_default K_liblist list_of_libraries ';' '''
5150 print('config_rule_statement_1', list(p
))
5156 def p_config_rule_statement_2(p
):
5157 '''config_rule_statement : K_instance hierarchy_identifier K_liblist list_of_libraries ';' '''
5159 print('config_rule_statement_2', list(p
))
5166 def p_config_rule_statement_3(p
):
5167 '''config_rule_statement : K_instance hierarchy_identifier K_use lib_cell_id opt_config ';' '''
5169 print('config_rule_statement_3', list(p
))
5176 def p_config_rule_statement_4(p
):
5177 '''config_rule_statement : K_cell lib_cell_id K_liblist list_of_libraries ';' '''
5179 print('config_rule_statement_4', list(p
))
5185 def p_config_rule_statement_5(p
):
5186 '''config_rule_statement : K_cell lib_cell_id K_use lib_cell_id opt_config ';' '''
5188 print('config_rule_statement_5', list(p
))
5194 def p_opt_config_1(p
):
5197 print('opt_config_1', list(p
))
5203 def p_opt_config_2(p
):
5204 '''opt_config : ':' K_config '''
5206 print('opt_config_2', list(p
))
5212 def p_lib_cell_id_1(p
):
5213 '''lib_cell_id : IDENTIFIER '''
5215 print('lib_cell_id_1', list(p
))
5218 # { delete[] p[1]; }
5222 def p_lib_cell_id_2(p
):
5223 '''lib_cell_id : IDENTIFIER '.' IDENTIFIER '''
5225 print('lib_cell_id_2', list(p
))
5228 # { delete[] p[1]; delete[] p[3]; }
5232 def p_list_of_libraries_1(p
):
5233 '''list_of_libraries : '''
5235 print('list_of_libraries_1', list(p
))
5241 def p_list_of_libraries_2(p
):
5242 '''list_of_libraries : list_of_libraries IDENTIFIER '''
5244 print('list_of_libraries_2', list(p
))
5247 # { delete[] p[2]; }
5251 def p_drive_strength_1(p
):
5252 '''drive_strength : '(' dr_strength0 ',' dr_strength1 ')' '''
5254 print('drive_strength_1', list(p
))
5257 # { p[0].str0 = p[2].str0;
5258 # p[0].str1 = p[4].str1;
5263 def p_drive_strength_2(p
):
5264 '''drive_strength : '(' dr_strength1 ',' dr_strength0 ')' '''
5266 print('drive_strength_2', list(p
))
5269 # { p[0].str0 = p[4].str0;
5270 # p[0].str1 = p[2].str1;
5275 def p_drive_strength_3(p
):
5276 '''drive_strength : '(' dr_strength0 ',' K_highz1 ')' '''
5278 print('drive_strength_3', list(p
))
5281 # { p[0].str0 = p[2].str0;
5282 # p[0].str1 = IVL_DR_HiZ;
5287 def p_drive_strength_4(p
):
5288 '''drive_strength : '(' dr_strength1 ',' K_highz0 ')' '''
5290 print('drive_strength_4', list(p
))
5293 # { p[0].str0 = IVL_DR_HiZ;
5294 # p[0].str1 = p[2].str1;
5299 def p_drive_strength_5(p
):
5300 '''drive_strength : '(' K_highz1 ',' dr_strength0 ')' '''
5302 print('drive_strength_5', list(p
))
5305 # { p[0].str0 = p[4].str0;
5306 # p[0].str1 = IVL_DR_HiZ;
5311 def p_drive_strength_6(p
):
5312 '''drive_strength : '(' K_highz0 ',' dr_strength1 ')' '''
5314 print('drive_strength_6', list(p
))
5317 # { p[0].str0 = IVL_DR_HiZ;
5318 # p[0].str1 = p[4].str1;
5323 def p_drive_strength_opt_1(p
):
5324 '''drive_strength_opt : drive_strength '''
5326 print('drive_strength_opt_1', list(p
))
5333 def p_drive_strength_opt_2(p
):
5334 '''drive_strength_opt : '''
5335 if(parse_debug
> 2):
5336 print('drive_strength_opt_2', list(p
))
5339 # { p[0].str0 = IVL_DR_STRONG; p[0].str1 = IVL_DR_STRONG; }
5343 def p_dr_strength0_1(p
):
5344 '''dr_strength0 : K_supply0 '''
5346 print('dr_strength0_1', list(p
))
5349 # { p[0].str0 = IVL_DR_SUPPLY; }
5353 def p_dr_strength0_2(p
):
5354 '''dr_strength0 : K_strong0 '''
5356 print('dr_strength0_2', list(p
))
5359 # { p[0].str0 = IVL_DR_STRONG; }
5363 def p_dr_strength0_3(p
):
5364 '''dr_strength0 : K_pull0 '''
5366 print('dr_strength0_3', list(p
))
5369 # { p[0].str0 = IVL_DR_PULL; }
5373 def p_dr_strength0_4(p
):
5374 '''dr_strength0 : K_weak0 '''
5376 print('dr_strength0_4', list(p
))
5379 # { p[0].str0 = IVL_DR_WEAK; }
5383 def p_dr_strength1_1(p
):
5384 '''dr_strength1 : K_supply1 '''
5386 print('dr_strength1_1', list(p
))
5389 # { p[0].str1 = IVL_DR_SUPPLY; }
5393 def p_dr_strength1_2(p
):
5394 '''dr_strength1 : K_strong1 '''
5396 print('dr_strength1_2', list(p
))
5399 # { p[0].str1 = IVL_DR_STRONG; }
5403 def p_dr_strength1_3(p
):
5404 '''dr_strength1 : K_pull1 '''
5406 print('dr_strength1_3', list(p
))
5409 # { p[0].str1 = IVL_DR_PULL; }
5413 def p_dr_strength1_4(p
):
5414 '''dr_strength1 : K_weak1 '''
5416 print('dr_strength1_4', list(p
))
5419 # { p[0].str1 = IVL_DR_WEAK; }
5423 def p_clocking_event_opt_1(p
):
5424 '''clocking_event_opt : event_control '''
5426 print('clocking_event_opt_1', list(p
))
5432 def p_clocking_event_opt_2(p
):
5433 '''clocking_event_opt : '''
5435 print('clocking_event_opt_2', list(p
))
5441 def p_event_control_1(p
):
5442 '''event_control : '@' hierarchy_identifier '''
5444 print('event_control_1', list(p
))
5447 # { PEIdent*tmpi = new PEIdent(*p[2]);
5448 # PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi);
5449 # PEventStatement*tmps = new PEventStatement(tmpe);
5450 # FILE_NAME(tmps, @1);
5457 def p_event_control_2(p
):
5458 '''event_control : '@' '(' event_expression_list ')' '''
5460 print('event_control_2', list(p
))
5463 # { PEventStatement*tmp = new PEventStatement(*p[3]);
5464 # FILE_NAME(tmp, @1);
5471 def p_event_control_3(p
):
5472 '''event_control : '@' '(' error ')' '''
5474 print('event_control_3', list(p
))
5477 # { yyerror(@1, "error: Malformed event control expression.");
5483 def p_event_expression_list_1(p
):
5484 '''event_expression_list : event_expression '''
5486 print('event_expression_list_1', list(p
))
5493 def p_event_expression_list_2(p
):
5494 '''event_expression_list : event_expression_list K_or event_expression '''
5496 print('event_expression_list_2', list(p
))
5499 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
5507 def p_event_expression_list_3(p
):
5508 '''event_expression_list : event_expression_list ',' event_expression '''
5510 print('event_expression_list_3', list(p
))
5513 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
5521 def p_event_expression_1(p
):
5522 '''event_expression : K_posedge expression '''
5524 print('event_expression_1', list(p
))
5527 # { PEEvent*tmp = new PEEvent(PEEvent::POSEDGE, p[2]);
5528 # FILE_NAME(tmp, @1);
5529 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5536 def p_event_expression_2(p
):
5537 '''event_expression : K_negedge expression '''
5539 print('event_expression_2', list(p
))
5542 # { PEEvent*tmp = new PEEvent(PEEvent::NEGEDGE, p[2]);
5543 # FILE_NAME(tmp, @1);
5544 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5551 def p_event_expression_3(p
):
5552 '''event_expression : expression '''
5554 print('event_expression_3', list(p
))
5557 # { PEEvent*tmp = new PEEvent(PEEvent::ANYEDGE, p[1]);
5558 # FILE_NAME(tmp, @1);
5559 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5566 def p_branch_probe_expression_1(p
):
5567 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ',' IDENTIFIER ')' '''
5569 print('branch_probe_expression_1', list(p
))
5572 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3], p[5]); }
5576 def p_branch_probe_expression_2(p
):
5577 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ')' '''
5579 print('branch_probe_expression_2', list(p
))
5582 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3]); }
5586 def p_expression_1(p
):
5587 '''expression : expr_primary_or_typename '''
5588 if(parse_debug
> 2):
5589 print('expression_1', list(p
))
5596 def p_expression_2(p
):
5597 '''expression : inc_or_dec_expression '''
5599 print('expression_2', list(p
))
5606 def p_expression_3(p
):
5607 '''expression : inside_expression '''
5609 print('expression_3', list(p
))
5616 def p_expression_4(p
):
5617 '''expression : '+' attribute_list_opt expr_primary %prec UNARY_PREC '''
5619 print('expression_4', list(p
))
5626 def PEUnary(op
, o1
):
5627 #Leaf(token.STRING, ' ')
5629 return Node(syms
.atom
, [op
, o1
])
5631 return "error in PEUnary: "+str(op
)+","+str(o1
)
5634 def PEBinary(op
, o1
, o2
):
5636 return Node(syms
.atom
, [o1
, Leaf(token
.STRING
, ' '), op
, Leaf(token
.STRING
, ' '), o2
])
5638 return "error in PEBinary: "+str(op
)+","+str(o1
)+","+str(o2
)
5643 def p_expression_5(p
):
5644 '''expression : '-' attribute_list_opt expr_primary %prec UNARY_PREC '''
5646 print('expression_5', list(p
))
5648 p
[0] = PEUnary(Leaf(token
.MINUS
, '-'), p
[3])
5651 # { PEUnary*tmp = new PEUnary('-', p[3]);
5652 # FILE_NAME(tmp, @3);
5658 def p_expression_6(p
):
5659 '''expression : '~' attribute_list_opt expr_primary %prec UNARY_PREC '''
5661 print('expression_6', list(p
))
5663 p
[0] = PEUnary(Leaf(token
.TILDE
, '~'), p
[3])
5666 # { PEUnary*tmp = new PEUnary('~', p[3]);
5667 # FILE_NAME(tmp, @3);
5673 def p_expression_7(p
):
5674 '''expression : '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
5676 print('expression_7', list(p
))
5678 p
[0] = PEUnary(Leaf(token
.AMPER
, '&'), p
[3])
5681 # { PEUnary*tmp = new PEUnary('&', p[3]);
5682 # FILE_NAME(tmp, @3);
5688 def p_expression_8(p
):
5689 '''expression : '!' attribute_list_opt expr_primary %prec UNARY_PREC '''
5691 print('expression_8', list(p
))
5693 p
[0] = PEUnary(Leaf(token
.STRING
, '!'), p
[3])
5696 # { PEUnary*tmp = new PEUnary('!', p[3]);
5697 # FILE_NAME(tmp, @3);
5703 def p_expression_9(p
):
5704 '''expression : '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
5706 print('expression_9', list(p
))
5708 p
[0] = PEUnary(Leaf(token
.STRING
, '|'), p
[3])
5711 # { PEUnary*tmp = new PEUnary('|', p[3]);
5712 # FILE_NAME(tmp, @3);
5718 def p_expression_10(p
):
5719 '''expression : '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
5721 print('expression_10', list(p
))
5723 p
[0] = PEUnary(Leaf(token
.STRING
, '^'), p
[3])
5726 # { PEUnary*tmp = new PEUnary('^', p[3]);
5727 # FILE_NAME(tmp, @3);
5733 def p_expression_11(p
):
5734 '''expression : '~' '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
5736 print('expression_11', list(p
))
5739 # { yyerror(@1, "error: '~' '&' is not a valid expression. "
5740 # "Please use operator '~&' instead.");
5746 def p_expression_12(p
):
5747 '''expression : '~' '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
5749 print('expression_12', list(p
))
5752 # { yyerror(@1, "error: '~' '|' is not a valid expression. "
5753 # "Please use operator '~|' instead.");
5759 def p_expression_13(p
):
5760 '''expression : '~' '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
5762 print('expression_13', list(p
))
5765 # { yyerror(@1, "error: '~' '^' is not a valid expression. "
5766 # "Please use operator '~^' instead.");
5772 def p_expression_14(p
):
5773 '''expression : K_NAND attribute_list_opt expr_primary %prec UNARY_PREC '''
5775 print('expression_14', list(p
))
5777 p
[0] = PEUnary(Leaf(token
.STRING
, 'K_NAND'), p
[3])
5780 # { PEUnary*tmp = new PEUnary('A', p[3]);
5781 # FILE_NAME(tmp, @3);
5787 def p_expression_15(p
):
5788 '''expression : K_NOR attribute_list_opt expr_primary %prec UNARY_PREC '''
5790 print('expression_15', list(p
))
5792 p
[0] = PEUnary(Leaf(token
.STRING
, 'K_NOR'), p
[3])
5795 # { PEUnary*tmp = new PEUnary('N', p[3]);
5796 # FILE_NAME(tmp, @3);
5802 def p_expression_16(p
):
5803 '''expression : K_NXOR attribute_list_opt expr_primary %prec UNARY_PREC '''
5805 print('expression_16', list(p
))
5807 p
[0] = PEUnary(Leaf(token
.STRING
, 'K_NXOR'), p
[3])
5810 # { PEUnary*tmp = new PEUnary('X', p[3]);
5811 # FILE_NAME(tmp, @3);
5817 def p_expression_17(p
):
5818 '''expression : '!' error %prec UNARY_PREC '''
5820 print('expression_17', list(p
))
5823 # { yyerror(@1, "error: Operand of unary ! "
5824 # "is not a primary expression.");
5830 def p_expression_18(p
):
5831 '''expression : '^' error %prec UNARY_PREC '''
5833 print('expression_18', list(p
))
5836 # { yyerror(@1, "error: Operand of reduction ^ "
5837 # "is not a primary expression.");
5843 def p_expression_19(p
):
5844 '''expression : expression '^' attribute_list_opt expression '''
5846 print('expression_19', list(p
))
5848 p
[0] = PEBinary(Leaf(token
.STRING
, '^'), p
[1], p
[4])
5851 # { PEBinary*tmp = new PEBinary('^', p[1], p[4]);
5852 # FILE_NAME(tmp, @2);
5858 def p_expression_20(p
):
5859 '''expression : expression K_POW attribute_list_opt expression '''
5861 print('expression_20', list(p
))
5863 p
[0] = PEBinary(Leaf(token
.STRING
, '**'), p
[1], p
[4])
5866 # { PEBinary*tmp = new PEBPower('p', p[1], p[4]);
5867 # FILE_NAME(tmp, @2);
5873 def p_expression_21(p
):
5874 '''expression : expression '*' attribute_list_opt expression '''
5876 print('expression_21', list(p
))
5878 p
[0] = PEBinary(Leaf(token
.STRING
, '*'), p
[1], p
[4])
5881 # { PEBinary*tmp = new PEBinary('*', p[1], p[4]);
5882 # FILE_NAME(tmp, @2);
5888 def p_expression_22(p
):
5889 '''expression : expression '/' attribute_list_opt expression '''
5891 print('expression_22', list(p
))
5893 p
[0] = PEBinary(Leaf(token
.STRING
, '/'), p
[1], p
[4])
5896 # { PEBinary*tmp = new PEBinary('/', p[1], p[4]);
5897 # FILE_NAME(tmp, @2);
5903 def p_expression_23(p
):
5904 '''expression : expression '%' attribute_list_opt expression '''
5906 print('expression_23', list(p
))
5908 p
[0] = PEBinary(Leaf(token
.STRING
, '%'), p
[1], p
[4])
5911 # { PEBinary*tmp = new PEBinary('%', p[1], p[4]);
5912 # FILE_NAME(tmp, @2);
5918 def p_expression_24(p
):
5919 '''expression : expression '+' attribute_list_opt expression '''
5921 print('expression_24', list(p
))
5923 # { PEBinary*tmp = new PEBinary('+', p[1], p[4]);
5924 # FILE_NAME(tmp, @2);
5927 p
[0] = PEBinary(Leaf(token
.PLUS
, '+'), p
[1], p
[4])
5933 def p_expression_25(p
):
5934 '''expression : expression '-' attribute_list_opt expression '''
5935 if(parse_debug
> 2):
5936 print('expression_25', list(p
))
5937 # { PEBinary*tmp = new PEBinary('-', p[1], p[4]);
5938 # FILE_NAME(tmp, @2);
5941 p
[0] = PEBinary(Leaf(token
.MINUS
, '-'), p
[1], p
[4])
5947 def p_expression_26(p
):
5948 '''expression : expression '&' attribute_list_opt expression '''
5949 if(parse_debug
> 2):
5950 print('expression_26', list(p
))
5952 p
[0] = PEBinary(Leaf(token
.AMPER
, '&'), p
[1], p
[4])
5955 # { PEBinary*tmp = new PEBinary('&', p[1], p[4]);
5956 # FILE_NAME(tmp, @2);
5962 def p_expression_27(p
):
5963 '''expression : expression '|' attribute_list_opt expression '''
5964 if(parse_debug
> 2):
5965 print('expression_27', list(p
))
5967 p
[0] = PEBinary(Leaf(token
.VBAR
, '|'), p
[1], p
[4])
5969 # { PEBinary*tmp = new PEBinary('|', p[1], p[4]);
5970 # FILE_NAME(tmp, @2);
5976 def p_expression_28(p
):
5977 '''expression : expression K_NAND attribute_list_opt expression '''
5979 print('expression_28', list(p
))
5981 p
[0] = PEBinary(Leaf(token
.STRING
, '~&'), p
[1], p
[4])
5984 # { PEBinary*tmp = new PEBinary('A', p[1], p[4]);
5985 # FILE_NAME(tmp, @2);
5991 def p_expression_29(p
):
5992 '''expression : expression K_NOR attribute_list_opt expression '''
5994 print('expression_29', list(p
))
5996 p
[0] = PEBinary(Leaf(token
.STRING
, '~|'), p
[1], p
[4])
5999 # { PEBinary*tmp = new PEBinary('O', p[1], p[4]);
6000 # FILE_NAME(tmp, @2);
6006 def p_expression_30(p
):
6007 '''expression : expression K_NXOR attribute_list_opt expression '''
6009 print('expression_30', list(p
))
6011 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_XNOR'), p
[1], p
[4])
6014 # { PEBinary*tmp = new PEBinary('X', p[1], p[4]);
6015 # FILE_NAME(tmp, @2);
6021 def p_expression_31(p
):
6022 '''expression : expression '<' attribute_list_opt expression '''
6024 print('expression_31', list(p
))
6026 p
[0] = PEBinary(Leaf(token
.STRING
, '<'), p
[1], p
[4])
6029 # { PEBinary*tmp = new PEBComp('<', p[1], p[4]);
6030 # FILE_NAME(tmp, @2);
6036 def p_expression_32(p
):
6037 '''expression : expression '>' attribute_list_opt expression '''
6039 print('expression_32', list(p
))
6041 p
[0] = PEBinary(Leaf(token
.STRING
, '>'), p
[1], p
[4])
6044 # { PEBinary*tmp = new PEBComp('>', p[1], p[4]);
6045 # FILE_NAME(tmp, @2);
6051 def p_expression_33(p
):
6052 '''expression : expression K_LS attribute_list_opt expression '''
6054 print('expression_33', list(p
))
6056 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_LS'), p
[1], p
[4])
6059 # { PEBinary*tmp = new PEBShift('l', p[1], p[4]);
6060 # FILE_NAME(tmp, @2);
6066 def p_expression_34(p
):
6067 '''expression : expression K_RS attribute_list_opt expression '''
6069 print('expression_34', list(p
))
6071 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_RS'), p
[1], p
[4])
6074 # { PEBinary*tmp = new PEBShift('r', p[1], p[4]);
6075 # FILE_NAME(tmp, @2);
6081 def p_expression_35(p
):
6082 '''expression : expression K_RSS attribute_list_opt expression '''
6084 print('expression_35', list(p
))
6086 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_RSS'), p
[1], p
[4])
6089 # { PEBinary*tmp = new PEBShift('R', p[1], p[4]);
6090 # FILE_NAME(tmp, @2);
6096 def p_expression_36(p
):
6097 '''expression : expression K_EQ attribute_list_opt expression '''
6099 print('expression_36', list(p
))
6101 p
[0] = PEBinary(Leaf(token
.STRING
, '=='), p
[1], p
[4])
6104 # { PEBinary*tmp = new PEBComp('e', p[1], p[4]);
6105 # FILE_NAME(tmp, @2);
6111 def p_expression_37(p
):
6112 '''expression : expression K_CEQ attribute_list_opt expression '''
6114 print('expression_37', list(p
))
6116 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_CEQ'), p
[1], p
[4])
6119 # { PEBinary*tmp = new PEBComp('E', p[1], p[4]);
6120 # FILE_NAME(tmp, @2);
6126 def p_expression_38(p
):
6127 '''expression : expression K_WEQ attribute_list_opt expression '''
6129 print('expression_38', list(p
))
6131 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_WEQ'), p
[1], p
[4])
6134 # { PEBinary*tmp = new PEBComp('w', p[1], p[4]);
6135 # FILE_NAME(tmp, @2);
6141 def p_expression_39(p
):
6142 '''expression : expression K_LE attribute_list_opt expression '''
6144 print('expression_39', list(p
))
6146 p
[0] = PEBinary(Leaf(token
.STRING
, '<='), p
[1], p
[4])
6149 # { PEBinary*tmp = new PEBComp('L', p[1], p[4]);
6150 # FILE_NAME(tmp, @2);
6156 def p_expression_40(p
):
6157 '''expression : expression K_GE attribute_list_opt expression '''
6159 print('expression_40', list(p
))
6161 p
[0] = PEBinary(Leaf(token
.STRING
, '>='), p
[1], p
[4])
6164 # { PEBinary*tmp = new PEBComp('G', p[1], p[4]);
6165 # FILE_NAME(tmp, @2);
6171 def p_expression_41(p
):
6172 '''expression : expression K_NE attribute_list_opt expression '''
6174 print('expression_41', list(p
))
6176 p
[0] = PEBinary(Leaf(token
.STRING
, '!='), p
[1], p
[4])
6179 # { PEBinary*tmp = new PEBComp('n', p[1], p[4]);
6180 # FILE_NAME(tmp, @2);
6186 def p_expression_42(p
):
6187 '''expression : expression K_CNE attribute_list_opt expression '''
6189 print('expression_42', list(p
))
6191 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_CNE'), p
[1], p
[4])
6194 # { PEBinary*tmp = new PEBComp('N', p[1], p[4]);
6195 # FILE_NAME(tmp, @2);
6201 def p_expression_43(p
):
6202 '''expression : expression K_WNE attribute_list_opt expression '''
6204 print('expression_43', list(p
))
6206 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_WNE'), p
[1], p
[4])
6209 # { PEBinary*tmp = new PEBComp('W', p[1], p[4]);
6210 # FILE_NAME(tmp, @2);
6216 def p_expression_44(p
):
6217 '''expression : expression K_LOR attribute_list_opt expression '''
6219 print('expression_44', list(p
))
6221 p
[0] = PEBinary(Leaf(token
.STRING
, '||'), p
[1], p
[4])
6224 # { PEBinary*tmp = new PEBLogic('o', p[1], p[4]);
6225 # FILE_NAME(tmp, @2);
6231 def p_expression_45(p
):
6232 '''expression : expression K_LAND attribute_list_opt expression '''
6234 print('expression_45', list(p
))
6236 p
[0] = PEBinary(Leaf(token
.STRING
, '&&'), p
[1], p
[4])
6239 # { PEBinary*tmp = new PEBLogic('a', p[1], p[4]);
6240 # FILE_NAME(tmp, @2);
6246 def p_expression_46(p
):
6247 '''expression : expression '?' attribute_list_opt expression ':' expression '''
6249 print('expression_46', list(p
))
6252 p
[0] = Node(syms
.atom
, [p
[1], Leaf(token
.STRING
, ' ? '),
6253 p
[4], Leaf(token
.STRING
, ' : '), p
[6]])
6255 p
[0] = "error in PETernary"
6258 # { PETernary*tmp = new PETernary(p[1], p[4], p[6]);
6259 # FILE_NAME(tmp, @2);
6265 def p_expr_mintypmax_1(p
):
6266 '''expr_mintypmax : expression '''
6268 print('expr_mintypmax_1', list(p
))
6275 def p_expr_mintypmax_2(p
):
6276 '''expr_mintypmax : expression ':' expression ':' expression '''
6278 print('expr_mintypmax_2', list(p
))
6281 # { switch (min_typ_max_flag) {
6298 # if (min_typ_max_warn > 0) {
6299 # cerr << p[0]->get_fileline() << ": warning: choosing ";
6300 # switch (min_typ_max_flag) {
6311 # cerr << " expression." << endl;
6312 # min_typ_max_warn -= 1;
6318 def p_expression_list_with_nuls_1(p
):
6319 '''expression_list_with_nuls : expression_list_with_nuls ',' expression '''
6321 print('expression_list_with_nuls_1', list(p
))
6324 # { list<PExpr*>*tmp = p[1];
6325 # tmp->push_back(p[3]);
6331 def p_expression_list_with_nuls_2(p
):
6332 '''expression_list_with_nuls : expression '''
6334 print('expression_list_with_nuls_2', list(p
))
6337 # { list<PExpr*>*tmp = new list<PExpr*>;
6338 # tmp->push_back(p[1]);
6344 def p_expression_list_with_nuls_3(p
):
6345 '''expression_list_with_nuls : '''
6347 print('expression_list_with_nuls_3', list(p
))
6350 # { list<PExpr*>*tmp = new list<PExpr*>;
6351 # tmp->push_back(0);
6357 def p_expression_list_with_nuls_4(p
):
6358 '''expression_list_with_nuls : expression_list_with_nuls ',' '''
6360 print('expression_list_with_nuls_4', list(p
))
6363 # { list<PExpr*>*tmp = p[1];
6364 # tmp->push_back(0);
6370 def p_expression_list_proper_1(p
):
6371 '''expression_list_proper : expression_list_proper ',' expression '''
6373 print('expression_list_proper_1', list(p
))
6376 # { list<PExpr*>*tmp = p[1];
6377 # tmp->push_back(p[3]);
6383 def p_expression_list_proper_2(p
):
6384 '''expression_list_proper : expression '''
6386 print('expression_list_proper_2', list(p
))
6389 # { list<PExpr*>*tmp = new list<PExpr*>;
6390 # tmp->push_back(p[1]);
6396 def p_expr_primary_or_typename_1(p
):
6397 '''expr_primary_or_typename : expr_primary '''
6398 if(parse_debug
> 2):
6399 print('expr_primary_or_typename_1', list(p
))
6406 def p_expr_primary_or_typename_2(p
):
6407 '''expr_primary_or_typename : TYPE_IDENTIFIER '''
6409 print('expr_primary_or_typename_2', list(p
))
6413 # { PETypename*tmp = new PETypename(p[1].type);
6414 # FILE_NAME(tmp,@1);
6416 # delete[]p[1].text;
6421 def p_expr_primary_1(p
):
6422 '''expr_primary : number '''
6424 print('expr_primary_1', list(p
))
6429 # PENumber*tmp = new PENumber(p[1]);
6430 # FILE_NAME(tmp, @1);
6436 def p_expr_primary_2(p
):
6437 '''expr_primary : REALTIME '''
6439 print('expr_primary_2', list(p
))
6442 # { PEFNumber*tmp = new PEFNumber(p[1]);
6443 # FILE_NAME(tmp, @1);
6449 def p_expr_primary_3(p
):
6450 '''expr_primary : STRING '''
6452 print('expr_primary_3', list(p
))
6455 # { PEString*tmp = new PEString(p[1]);
6456 # FILE_NAME(tmp, @1);
6462 def p_expr_primary_4(p
):
6463 '''expr_primary : TIME_LITERAL '''
6465 print('expr_primary_4', list(p
))
6472 # if (p[1] == 0 || !get_time_unit(p[1], unit))
6473 # yyerror(@1, "internal error: delay.");
6475 # double p = pow(10.0, (double)(unit - pform_get_timeunit()));
6476 # double time = atof(p[1]) * p;
6478 # verireal *v = new verireal(time);
6479 # p[0] = new PEFNumber(v);
6480 # FILE_NAME(p[0], @1);
6486 def p_expr_primary_5(p
):
6487 '''expr_primary : SYSTEM_IDENTIFIER '''
6489 print('expr_primary_5', list(p
))
6492 # { perm_string tn = lex_strings.make(p[1]);
6493 # PECallFunction*tmp = new PECallFunction(tn);
6494 # FILE_NAME(tmp, @1);
6501 def p_expr_primary_6(p
):
6502 '''expr_primary : hierarchy_identifier '''
6503 if(parse_debug
> 2):
6504 print('expr_primary_6', list(p
))
6508 # { PEIdent*tmp = pform_new_ident(*p[1]);
6509 # FILE_NAME(tmp, @1);
6516 def p_expr_primary_7(p
):
6517 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier '''
6519 print('expr_primary_7', list(p
))
6522 # { p[0] = pform_package_ident(@2, p[1], p[3]);
6528 def p_expr_primary_8(p
):
6529 '''expr_primary : hierarchy_identifier '(' expression_list_with_nuls ')' '''
6531 print('expr_primary_8', list(p
))
6534 # { list<PExpr*>*expr_list = p[3];
6535 # strip_tail_items(expr_list);
6536 # PECallFunction*tmp = pform_make_call_function(@1, *p[1], *expr_list);
6543 def p_expr_primary_9(p
):
6544 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' '''
6546 print('expr_primary_9', list(p
))
6549 # { pform_name_t*t_name = p[1];
6550 # while (! p[3]->empty()) {
6551 # t_name->push_back(p[3]->front());
6552 # p[3]->pop_front();
6554 # list<PExpr*>*expr_list = p[5];
6555 # strip_tail_items(expr_list);
6556 # PECallFunction*tmp = pform_make_call_function(@1, *t_name, *expr_list);
6564 def p_expr_primary_10(p
):
6565 '''expr_primary : SYSTEM_IDENTIFIER '(' expression_list_proper ')' '''
6567 print('expr_primary_10', list(p
))
6570 # { perm_string tn = lex_strings.make(p[1]);
6571 # PECallFunction*tmp = new PECallFunction(tn, *p[3]);
6572 # FILE_NAME(tmp, @1);
6579 def p_expr_primary_11(p
):
6580 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')' '''
6582 print('expr_primary_11', list(p
))
6585 # { perm_string use_name = lex_strings.make(p[3]);
6586 # PECallFunction*tmp = new PECallFunction(p[1], use_name, *p[5]);
6587 # FILE_NAME(tmp, @3);
6594 def p_expr_primary_12(p
):
6595 '''expr_primary : SYSTEM_IDENTIFIER '(' ')' '''
6597 print('expr_primary_12', list(p
))
6600 # { perm_string tn = lex_strings.make(p[1]);
6601 # const vector<PExpr*>empty;
6602 # PECallFunction*tmp = new PECallFunction(tn, empty);
6603 # FILE_NAME(tmp, @1);
6606 # if (!gn_system_verilog()) {
6607 # yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
6613 def p_expr_primary_13(p
):
6614 '''expr_primary : implicit_class_handle '''
6616 print('expr_primary_13', list(p
))
6619 # { PEIdent*tmp = new PEIdent(*p[1]);
6620 # FILE_NAME(tmp,@1);
6627 def p_expr_primary_14(p
):
6628 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '''
6630 print('expr_primary_14', list(p
))
6633 # { pform_name_t*t_name = p[1];
6634 # while (! p[3]->empty()) {
6635 # t_name->push_back(p[3]->front());
6636 # p[3]->pop_front();
6638 # PEIdent*tmp = new PEIdent(*t_name);
6639 # FILE_NAME(tmp,@1);
6647 def p_expr_primary_15(p
):
6648 '''expr_primary : K_acos '(' expression ')' '''
6650 print('expr_primary_15', list(p
))
6653 # { perm_string tn = perm_string::literal("$acos");
6654 # PECallFunction*tmp = make_call_function(tn, p[3]);
6655 # FILE_NAME(tmp,@1);
6661 def p_expr_primary_16(p
):
6662 '''expr_primary : K_acosh '(' expression ')' '''
6664 print('expr_primary_16', list(p
))
6667 # { perm_string tn = perm_string::literal("$acosh");
6668 # PECallFunction*tmp = make_call_function(tn, p[3]);
6669 # FILE_NAME(tmp,@1);
6675 def p_expr_primary_17(p
):
6676 '''expr_primary : K_asin '(' expression ')' '''
6678 print('expr_primary_17', list(p
))
6681 # { perm_string tn = perm_string::literal("$asin");
6682 # PECallFunction*tmp = make_call_function(tn, p[3]);
6683 # FILE_NAME(tmp,@1);
6689 def p_expr_primary_18(p
):
6690 '''expr_primary : K_asinh '(' expression ')' '''
6692 print('expr_primary_18', list(p
))
6695 # { perm_string tn = perm_string::literal("$asinh");
6696 # PECallFunction*tmp = make_call_function(tn, p[3]);
6697 # FILE_NAME(tmp,@1);
6703 def p_expr_primary_19(p
):
6704 '''expr_primary : K_atan '(' expression ')' '''
6706 print('expr_primary_19', list(p
))
6709 # { perm_string tn = perm_string::literal("$atan");
6710 # PECallFunction*tmp = make_call_function(tn, p[3]);
6711 # FILE_NAME(tmp,@1);
6717 def p_expr_primary_20(p
):
6718 '''expr_primary : K_atanh '(' expression ')' '''
6720 print('expr_primary_20', list(p
))
6723 # { perm_string tn = perm_string::literal("$atanh");
6724 # PECallFunction*tmp = make_call_function(tn, p[3]);
6725 # FILE_NAME(tmp,@1);
6731 def p_expr_primary_21(p
):
6732 '''expr_primary : K_atan2 '(' expression ',' expression ')' '''
6734 print('expr_primary_21', list(p
))
6737 # { perm_string tn = perm_string::literal("$atan2");
6738 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6739 # FILE_NAME(tmp,@1);
6745 def p_expr_primary_22(p
):
6746 '''expr_primary : K_ceil '(' expression ')' '''
6748 print('expr_primary_22', list(p
))
6751 # { perm_string tn = perm_string::literal("$ceil");
6752 # PECallFunction*tmp = make_call_function(tn, p[3]);
6753 # FILE_NAME(tmp,@1);
6759 def p_expr_primary_23(p
):
6760 '''expr_primary : K_cos '(' expression ')' '''
6762 print('expr_primary_23', list(p
))
6765 # { perm_string tn = perm_string::literal("$cos");
6766 # PECallFunction*tmp = make_call_function(tn, p[3]);
6767 # FILE_NAME(tmp,@1);
6773 def p_expr_primary_24(p
):
6774 '''expr_primary : K_cosh '(' expression ')' '''
6776 print('expr_primary_24', list(p
))
6779 # { perm_string tn = perm_string::literal("$cosh");
6780 # PECallFunction*tmp = make_call_function(tn, p[3]);
6781 # FILE_NAME(tmp,@1);
6787 def p_expr_primary_25(p
):
6788 '''expr_primary : K_exp '(' expression ')' '''
6790 print('expr_primary_25', list(p
))
6793 # { perm_string tn = perm_string::literal("$exp");
6794 # PECallFunction*tmp = make_call_function(tn, p[3]);
6795 # FILE_NAME(tmp,@1);
6801 def p_expr_primary_26(p
):
6802 '''expr_primary : K_floor '(' expression ')' '''
6804 print('expr_primary_26', list(p
))
6807 # { perm_string tn = perm_string::literal("$floor");
6808 # PECallFunction*tmp = make_call_function(tn, p[3]);
6809 # FILE_NAME(tmp,@1);
6815 def p_expr_primary_27(p
):
6816 '''expr_primary : K_hypot '(' expression ',' expression ')' '''
6818 print('expr_primary_27', list(p
))
6821 # { perm_string tn = perm_string::literal("$hypot");
6822 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6823 # FILE_NAME(tmp,@1);
6829 def p_expr_primary_28(p
):
6830 '''expr_primary : K_ln '(' expression ')' '''
6832 print('expr_primary_28', list(p
))
6835 # { perm_string tn = perm_string::literal("$ln");
6836 # PECallFunction*tmp = make_call_function(tn, p[3]);
6837 # FILE_NAME(tmp,@1);
6843 def p_expr_primary_29(p
):
6844 '''expr_primary : K_log '(' expression ')' '''
6846 print('expr_primary_29', list(p
))
6849 # { perm_string tn = perm_string::literal("$log10");
6850 # PECallFunction*tmp = make_call_function(tn, p[3]);
6851 # FILE_NAME(tmp,@1);
6857 def p_expr_primary_30(p
):
6858 '''expr_primary : K_pow '(' expression ',' expression ')' '''
6860 print('expr_primary_30', list(p
))
6863 # { perm_string tn = perm_string::literal("$pow");
6864 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6865 # FILE_NAME(tmp,@1);
6871 def p_expr_primary_31(p
):
6872 '''expr_primary : K_sin '(' expression ')' '''
6874 print('expr_primary_31', list(p
))
6877 # { perm_string tn = perm_string::literal("$sin");
6878 # PECallFunction*tmp = make_call_function(tn, p[3]);
6879 # FILE_NAME(tmp,@1);
6885 def p_expr_primary_32(p
):
6886 '''expr_primary : K_sinh '(' expression ')' '''
6888 print('expr_primary_32', list(p
))
6891 # { perm_string tn = perm_string::literal("$sinh");
6892 # PECallFunction*tmp = make_call_function(tn, p[3]);
6893 # FILE_NAME(tmp,@1);
6899 def p_expr_primary_33(p
):
6900 '''expr_primary : K_sqrt '(' expression ')' '''
6902 print('expr_primary_33', list(p
))
6905 # { perm_string tn = perm_string::literal("$sqrt");
6906 # PECallFunction*tmp = make_call_function(tn, p[3]);
6907 # FILE_NAME(tmp,@1);
6913 def p_expr_primary_34(p
):
6914 '''expr_primary : K_tan '(' expression ')' '''
6916 print('expr_primary_34', list(p
))
6919 # { perm_string tn = perm_string::literal("$tan");
6920 # PECallFunction*tmp = make_call_function(tn, p[3]);
6921 # FILE_NAME(tmp,@1);
6927 def p_expr_primary_35(p
):
6928 '''expr_primary : K_tanh '(' expression ')' '''
6930 print('expr_primary_35', list(p
))
6933 # { perm_string tn = perm_string::literal("$tanh");
6934 # PECallFunction*tmp = make_call_function(tn, p[3]);
6935 # FILE_NAME(tmp,@1);
6941 def p_expr_primary_36(p
):
6942 '''expr_primary : K_abs '(' expression ')' '''
6944 print('expr_primary_36', list(p
))
6947 # { PEUnary*tmp = new PEUnary('m', p[3]);
6948 # FILE_NAME(tmp,@1);
6954 def p_expr_primary_37(p
):
6955 '''expr_primary : K_max '(' expression ',' expression ')' '''
6957 print('expr_primary_37', list(p
))
6960 # { PEBinary*tmp = new PEBinary('M', p[3], p[5]);
6961 # FILE_NAME(tmp,@1);
6967 def p_expr_primary_38(p
):
6968 '''expr_primary : K_min '(' expression ',' expression ')' '''
6970 print('expr_primary_38', list(p
))
6973 # { PEBinary*tmp = new PEBinary('m', p[3], p[5]);
6974 # FILE_NAME(tmp,@1);
6980 def p_expr_primary_39(p
):
6981 '''expr_primary : '(' expr_mintypmax ')' '''
6983 print('expr_primary_39', list(p
))
6990 def p_expr_primary_40(p
):
6991 '''expr_primary : '{' expression_list_proper '}' '''
6993 print('expr_primary_40', list(p
))
6996 # { PEConcat*tmp = new PEConcat(*p[2]);
6997 # FILE_NAME(tmp, @1);
7004 def p_expr_primary_41(p
):
7005 '''expr_primary : '{' expression '{' expression_list_proper '}' '}' '''
7007 print('expr_primary_41', list(p
))
7010 # { PExpr*rep = p[2];
7011 # PEConcat*tmp = new PEConcat(*p[4], rep);
7012 # FILE_NAME(tmp, @1);
7019 def p_expr_primary_42(p
):
7020 '''expr_primary : '{' expression '{' expression_list_proper '}' error '}' '''
7022 print('expr_primary_42', list(p
))
7025 # { PExpr*rep = p[2];
7026 # PEConcat*tmp = new PEConcat(*p[4], rep);
7027 # FILE_NAME(tmp, @1);
7030 # yyerror(@5, "error: Syntax error between internal '}' "
7031 # "and closing '}' of repeat concatenation.");
7037 def p_expr_primary_43(p
):
7038 '''expr_primary : '{' '}' '''
7040 print('expr_primary_43', list(p
))
7043 # { // This is the empty queue syntax.
7044 # if (gn_system_verilog()) {
7045 # list<PExpr*> empty_list;
7046 # PEConcat*tmp = new PEConcat(empty_list);
7047 # FILE_NAME(tmp, @1);
7050 # yyerror(@1, "error: Concatenations are not allowed to be empty.");
7057 def p_expr_primary_44(p
):
7058 '''expr_primary : expr_primary "'" '(' expression ')' '''
7060 print('expr_primary_44', list(p
))
7063 # { PExpr*base = p[4];
7064 # if (gn_system_verilog()) {
7065 # PECastSize*tmp = new PECastSize(p[1], base);
7066 # FILE_NAME(tmp, @1);
7069 # yyerror(@1, "error: Size cast requires SystemVerilog.");
7076 def p_expr_primary_45(p
):
7077 '''expr_primary : simple_type_or_string "'" '(' expression ')' '''
7079 print('expr_primary_45', list(p
))
7082 # { PExpr*base = p[4];
7083 # if (gn_system_verilog()) {
7084 # PECastType*tmp = new PECastType(p[1], base);
7085 # FILE_NAME(tmp, @1);
7088 # yyerror(@1, "error: Type cast requires SystemVerilog.");
7095 def p_expr_primary_46(p
):
7096 '''expr_primary : assignment_pattern '''
7098 print('expr_primary_46', list(p
))
7105 def p_expr_primary_47(p
):
7106 '''expr_primary : streaming_concatenation '''
7108 print('expr_primary_47', list(p
))
7115 def p_expr_primary_48(p
):
7116 '''expr_primary : K_null '''
7118 print('expr_primary_48', list(p
))
7121 # { PENull*tmp = new PENull;
7122 # FILE_NAME(tmp, @1);
7128 def p_function_item_list_opt_1(p
):
7129 '''function_item_list_opt : function_item_list '''
7131 print('function_item_list_opt_1', list(p
))
7138 def p_function_item_list_opt_2(p
):
7139 '''function_item_list_opt : '''
7141 print('function_item_list_opt_2', list(p
))
7148 def p_function_item_list_1(p
):
7149 '''function_item_list : function_item '''
7151 print('function_item_list_1', list(p
))
7158 def p_function_item_list_2(p
):
7159 '''function_item_list : function_item_list function_item '''
7161 print('function_item_list_2', list(p
))
7165 # if (p[1] && p[2]) {
7166 # vector<pform_tf_port_t>*tmp = p[1];
7167 # size_t s1 = tmp->size();
7168 # tmp->resize(s1 + p[2]->size());
7169 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
7170 # tmp->at(s1+idx) = p[2]->at(idx);
7173 # } else if (p[1]) {
7182 def p_function_item_1(p
):
7183 '''function_item : tf_port_declaration '''
7185 print('function_item_1', list(p
))
7192 def p_function_item_2(p
):
7193 '''function_item : block_item_decl '''
7195 print('function_item_2', list(p
))
7202 def p_gate_instance_1(p
):
7203 '''gate_instance : IDENTIFIER '(' expression_list_with_nuls ')' '''
7205 print('gate_instance_1', list(p
))
7208 # { lgate*tmp = new lgate;
7210 # tmp->parms = p[3];
7211 # tmp->file = @1.text;
7212 # tmp->lineno = @1.first_line;
7219 def p_gate_instance_2(p
):
7220 '''gate_instance : IDENTIFIER dimensions '(' expression_list_with_nuls ')' '''
7222 print('gate_instance_2', list(p
))
7225 # { lgate*tmp = new lgate;
7226 # list<pform_range_t>*rng = p[2];
7228 # tmp->parms = p[4];
7229 # tmp->range = rng->front();
7231 # assert(rng->empty());
7232 # tmp->file = @1.text;
7233 # tmp->lineno = @1.first_line;
7241 def p_gate_instance_3(p
):
7242 '''gate_instance : '(' expression_list_with_nuls ')' '''
7244 print('gate_instance_3', list(p
))
7247 # { lgate*tmp = new lgate;
7249 # tmp->parms = p[2];
7250 # tmp->file = @1.text;
7251 # tmp->lineno = @1.first_line;
7257 def p_gate_instance_4(p
):
7258 '''gate_instance : IDENTIFIER dimensions '''
7260 print('gate_instance_4', list(p
))
7263 # { lgate*tmp = new lgate;
7264 # list<pform_range_t>*rng = p[2];
7267 # tmp->parms_by_name = 0;
7268 # tmp->range = rng->front();
7270 # assert(rng->empty());
7271 # tmp->file = @1.text;
7272 # tmp->lineno = @1.first_line;
7280 def p_gate_instance_5(p
):
7281 '''gate_instance : IDENTIFIER '(' port_name_list ')' '''
7283 print('gate_instance_5', list(p
))
7286 # { lgate*tmp = new lgate;
7289 # tmp->parms_by_name = p[3];
7290 # tmp->file = @1.text;
7291 # tmp->lineno = @1.first_line;
7298 def p_gate_instance_6(p
):
7299 '''gate_instance : IDENTIFIER dimensions '(' port_name_list ')' '''
7301 print('gate_instance_6', list(p
))
7304 # { lgate*tmp = new lgate;
7305 # list<pform_range_t>*rng = p[2];
7308 # tmp->parms_by_name = p[4];
7309 # tmp->range = rng->front();
7311 # assert(rng->empty());
7312 # tmp->file = @1.text;
7313 # tmp->lineno = @1.first_line;
7321 def p_gate_instance_7(p
):
7322 '''gate_instance : IDENTIFIER '(' error ')' '''
7324 print('gate_instance_7', list(p
))
7327 # { lgate*tmp = new lgate;
7330 # tmp->parms_by_name = 0;
7331 # tmp->file = @1.text;
7332 # tmp->lineno = @1.first_line;
7333 # yyerror(@2, "error: Syntax error in instance port "
7334 # "expression(s).");
7341 def p_gate_instance_8(p
):
7342 '''gate_instance : IDENTIFIER dimensions '(' error ')' '''
7344 print('gate_instance_8', list(p
))
7347 # { lgate*tmp = new lgate;
7350 # tmp->parms_by_name = 0;
7351 # tmp->file = @1.text;
7352 # tmp->lineno = @1.first_line;
7353 # yyerror(@3, "error: Syntax error in instance port "
7354 # "expression(s).");
7361 def p_gate_instance_list_1(p
):
7362 '''gate_instance_list : gate_instance_list ',' gate_instance '''
7364 print('gate_instance_list_1', list(p
))
7367 # { svector<lgate>*tmp1 = p[1];
7368 # lgate*tmp2 = p[3];
7369 # svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
7377 def p_gate_instance_list_2(p
):
7378 '''gate_instance_list : gate_instance '''
7380 print('gate_instance_list_2', list(p
))
7383 # { svector<lgate>*tmp = new svector<lgate>(1);
7384 # (*tmp)[0] = *p[1];
7391 def p_gatetype_1(p
):
7392 '''gatetype : K_and '''
7394 print('gatetype_1', list(p
))
7397 # { p[0] = PGBuiltin::AND; }
7401 def p_gatetype_2(p
):
7402 '''gatetype : K_nand '''
7404 print('gatetype_2', list(p
))
7407 # { p[0] = PGBuiltin::NAND; }
7411 def p_gatetype_3(p
):
7412 '''gatetype : K_or '''
7414 print('gatetype_3', list(p
))
7417 # { p[0] = PGBuiltin::OR; }
7421 def p_gatetype_4(p
):
7422 '''gatetype : K_nor '''
7424 print('gatetype_4', list(p
))
7427 # { p[0] = PGBuiltin::NOR; }
7431 def p_gatetype_5(p
):
7432 '''gatetype : K_xor '''
7434 print('gatetype_5', list(p
))
7437 # { p[0] = PGBuiltin::XOR; }
7441 def p_gatetype_6(p
):
7442 '''gatetype : K_xnor '''
7444 print('gatetype_6', list(p
))
7447 # { p[0] = PGBuiltin::XNOR; }
7451 def p_gatetype_7(p
):
7452 '''gatetype : K_buf '''
7454 print('gatetype_7', list(p
))
7457 # { p[0] = PGBuiltin::BUF; }
7461 def p_gatetype_8(p
):
7462 '''gatetype : K_bufif0 '''
7464 print('gatetype_8', list(p
))
7467 # { p[0] = PGBuiltin::BUFIF0; }
7471 def p_gatetype_9(p
):
7472 '''gatetype : K_bufif1 '''
7474 print('gatetype_9', list(p
))
7477 # { p[0] = PGBuiltin::BUFIF1; }
7481 def p_gatetype_10(p
):
7482 '''gatetype : K_not '''
7484 print('gatetype_10', list(p
))
7487 # { p[0] = PGBuiltin::NOT; }
7491 def p_gatetype_11(p
):
7492 '''gatetype : K_notif0 '''
7494 print('gatetype_11', list(p
))
7497 # { p[0] = PGBuiltin::NOTIF0; }
7501 def p_gatetype_12(p
):
7502 '''gatetype : K_notif1 '''
7504 print('gatetype_12', list(p
))
7507 # { p[0] = PGBuiltin::NOTIF1; }
7511 def p_switchtype_1(p
):
7512 '''switchtype : K_nmos '''
7514 print('switchtype_1', list(p
))
7517 # { p[0] = PGBuiltin::NMOS; }
7521 def p_switchtype_2(p
):
7522 '''switchtype : K_rnmos '''
7524 print('switchtype_2', list(p
))
7527 # { p[0] = PGBuiltin::RNMOS; }
7531 def p_switchtype_3(p
):
7532 '''switchtype : K_pmos '''
7534 print('switchtype_3', list(p
))
7537 # { p[0] = PGBuiltin::PMOS; }
7541 def p_switchtype_4(p
):
7542 '''switchtype : K_rpmos '''
7544 print('switchtype_4', list(p
))
7547 # { p[0] = PGBuiltin::RPMOS; }
7551 def p_switchtype_5(p
):
7552 '''switchtype : K_cmos '''
7554 print('switchtype_5', list(p
))
7557 # { p[0] = PGBuiltin::CMOS; }
7561 def p_switchtype_6(p
):
7562 '''switchtype : K_rcmos '''
7564 print('switchtype_6', list(p
))
7567 # { p[0] = PGBuiltin::RCMOS; }
7571 def p_switchtype_7(p
):
7572 '''switchtype : K_tran '''
7574 print('switchtype_7', list(p
))
7577 # { p[0] = PGBuiltin::TRAN; }
7581 def p_switchtype_8(p
):
7582 '''switchtype : K_rtran '''
7584 print('switchtype_8', list(p
))
7587 # { p[0] = PGBuiltin::RTRAN; }
7591 def p_switchtype_9(p
):
7592 '''switchtype : K_tranif0 '''
7594 print('switchtype_9', list(p
))
7597 # { p[0] = PGBuiltin::TRANIF0; }
7601 def p_switchtype_10(p
):
7602 '''switchtype : K_tranif1 '''
7604 print('switchtype_10', list(p
))
7607 # { p[0] = PGBuiltin::TRANIF1; }
7611 def p_switchtype_11(p
):
7612 '''switchtype : K_rtranif0 '''
7614 print('switchtype_11', list(p
))
7617 # { p[0] = PGBuiltin::RTRANIF0; }
7621 def p_switchtype_12(p
):
7622 '''switchtype : K_rtranif1 '''
7624 print('switchtype_12', list(p
))
7627 # { p[0] = PGBuiltin::RTRANIF1; }
7631 def p_hierarchy_identifier_1(p
):
7632 '''hierarchy_identifier : IDENTIFIER '''
7634 print('hierarchy_identifier_1 FIXME', list(p
))
7635 lpvalue
= Leaf(token
.NAME
, p
[1])
7639 # { p[0] = new pform_name_t;
7640 # p[0]->push_back(name_component_t(lex_strings.make(p[1])));
7646 def p_hierarchy_identifier_2(p
):
7647 '''hierarchy_identifier : hierarchy_identifier '.' IDENTIFIER '''
7649 print('hierarchy_identifier_2', list(p
))
7652 # { pform_name_t * tmp = p[1];
7653 # tmp->push_back(name_component_t(lex_strings.make(p[3])));
7660 def p_hierarchy_identifier_3(p
):
7661 '''hierarchy_identifier : hierarchy_identifier '[' expression ']' '''
7663 print('hierarchy_identifier_3', list(p
))
7665 p
[0] = Node(syms
.atom
, [p
[1], Leaf(
7666 token
.STRING
, '['), p
[3], Leaf(token
.STRING
, ']')])
7669 # { pform_name_t * tmp = p[1];
7670 # name_component_t&tail = tmp->back();
7671 # index_component_t itmp;
7672 # itmp.sel = index_component_t::SEL_BIT;
7674 # tail.index.push_back(itmp);
7680 def p_hierarchy_identifier_4(p
):
7681 '''hierarchy_identifier : hierarchy_identifier '[' '$' ']' '''
7683 print('hierarchy_identifier_4', list(p
))
7686 # { pform_name_t * tmp = p[1];
7687 # name_component_t&tail = tmp->back();
7688 # if (! gn_system_verilog()) {
7689 # yyerror(@3, "error: Last element expression ($) "
7690 # "requires SystemVerilog. Try enabling SystemVerilog.");
7692 # index_component_t itmp;
7693 # itmp.sel = index_component_t::SEL_BIT_LAST;
7696 # tail.index.push_back(itmp);
7702 def p_hierarchy_identifier_5(p
):
7703 '''hierarchy_identifier : hierarchy_identifier '[' expression ':' expression ']' '''
7705 print('hierarchy_identifier_5', list(p
))
7708 # { pform_name_t * tmp = p[1];
7709 # name_component_t&tail = tmp->back();
7710 # index_component_t itmp;
7711 # itmp.sel = index_component_t::SEL_PART;
7714 # tail.index.push_back(itmp);
7720 def p_hierarchy_identifier_6(p
):
7721 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_POS expression ']' '''
7723 print('hierarchy_identifier_6', list(p
))
7726 # { pform_name_t * tmp = p[1];
7727 # name_component_t&tail = tmp->back();
7728 # index_component_t itmp;
7729 # itmp.sel = index_component_t::SEL_IDX_UP;
7732 # tail.index.push_back(itmp);
7738 def p_hierarchy_identifier_7(p
):
7739 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_NEG expression ']' '''
7741 print('hierarchy_identifier_7', list(p
))
7744 # { pform_name_t * tmp = p[1];
7745 # name_component_t&tail = tmp->back();
7746 # index_component_t itmp;
7747 # itmp.sel = index_component_t::SEL_IDX_DO;
7750 # tail.index.push_back(itmp);
7756 def p_list_of_identifiers_1(p
):
7757 '''list_of_identifiers : IDENTIFIER '''
7759 print('list_of_identifiers_1', list(p
))
7762 # { p[0] = list_from_identifier(p[1]); }
7766 def p_list_of_identifiers_2(p
):
7767 '''list_of_identifiers : list_of_identifiers ',' IDENTIFIER '''
7769 print('list_of_identifiers_2', list(p
))
7772 # { p[0] = list_from_identifier(p[1], p[3]); }
7776 def p_list_of_port_identifiers_1(p
):
7777 '''list_of_port_identifiers : IDENTIFIER dimensions_opt '''
7779 print('list_of_port_identifiers_1', list(p
))
7782 # { p[0] = make_port_list(p[1], p[2], 0); }
7786 def p_list_of_port_identifiers_2(p
):
7787 '''list_of_port_identifiers : list_of_port_identifiers ',' IDENTIFIER dimensions_opt '''
7789 print('list_of_port_identifiers_2', list(p
))
7792 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
7796 def p_list_of_variable_port_identifiers_1(p
):
7797 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '''
7799 print('list_of_variable_port_identifiers_1', list(p
))
7802 # { p[0] = make_port_list(p[1], p[2], 0); }
7806 def p_list_of_variable_port_identifiers_2(p
):
7807 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '=' expression '''
7809 print('list_of_variable_port_identifiers_2', list(p
))
7812 # { p[0] = make_port_list(p[1], p[2], p[4]); }
7816 def p_list_of_variable_port_identifiers_3(p
):
7817 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '''
7819 print('list_of_variable_port_identifiers_3', list(p
))
7822 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
7826 def p_list_of_variable_port_identifiers_4(p
):
7827 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '=' expression '''
7829 print('list_of_variable_port_identifiers_4', list(p
))
7832 # { p[0] = make_port_list(p[1], p[3], p[4], p[6]); }
7836 def p_list_of_ports_1(p
):
7837 '''list_of_ports : port_opt '''
7839 print('list_of_ports_1', list(p
))
7842 # { vector<Module::port_t*>*tmp
7843 # = new vector<Module::port_t*>(1);
7850 def p_list_of_ports_2(p
):
7851 '''list_of_ports : list_of_ports ',' port_opt '''
7853 print('list_of_ports_2', list(p
))
7856 # { vector<Module::port_t*>*tmp = p[1];
7857 # tmp->push_back(p[3]);
7863 def p_list_of_port_declarations_1(p
):
7864 '''list_of_port_declarations : port_declaration '''
7865 if(parse_debug
> 1):
7866 print('list_of_port_declarations_1', list(p
))
7870 # { vector<Module::port_t*>*tmp
7871 # = new vector<Module::port_t*>(1);
7878 def p_list_of_port_declarations_2(p
):
7879 '''list_of_port_declarations : list_of_port_declarations ',' port_declaration '''
7881 print('list_of_port_declarations_2 FIXME', list(p
))
7882 # MOVE_TO absyn p[1].append(Leaf(token.NEWLINE, '\n')) # should be a comma
7883 # XXX p[3].prefix=' ' # add a space after the NL, must go in parameter
7888 # { vector<Module::port_t*>*tmp = p[1];
7889 # tmp->push_back(p[3]);
7895 def p_list_of_port_declarations_3(p
):
7896 '''list_of_port_declarations : list_of_port_declarations ',' IDENTIFIER '''
7898 print('list_of_port_declarations_3', list(p
))
7901 # { Module::port_t*ptmp;
7902 # perm_string name = lex_strings.make(p[3]);
7903 # ptmp = pform_module_port_reference(name, @3.text,
7905 # vector<Module::port_t*>*tmp = p[1];
7906 # tmp->push_back(ptmp);
7908 # /* Get the port declaration details, the port type
7909 # and what not, from context data stored by the
7910 # last port_declaration rule. */
7911 # pform_module_define_port(@3, name,
7912 # port_declaration_context.port_type,
7913 # port_declaration_context.port_net_type,
7914 # port_declaration_context.data_type, 0);
7921 def p_list_of_port_declarations_4(p
):
7922 '''list_of_port_declarations : list_of_port_declarations ',' '''
7924 print('list_of_port_declarations_4', list(p
))
7928 # yyerror(@2, "error: NULL port declarations are not "
7934 def p_list_of_port_declarations_5(p
):
7935 '''list_of_port_declarations : list_of_port_declarations ';' '''
7937 print('list_of_port_declarations_5', list(p
))
7941 # yyerror(@2, "error: ';' is an invalid port declaration "
7947 def p_port_declaration_1(p
):
7948 '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7950 print('port_declaration_1 FIXME', list(p
))
7951 comment
, dt
, name
= p
[2], p
[4], p
[5]
7952 p
[0] = absyn
.port_decl(comment
, dt
, name
)
7955 # { Module::port_t*ptmp;
7956 # perm_string name = lex_strings.make(p[5]);
7957 # data_type_t*use_type = p[4];
7958 # if (p[6]) use_type = new uarray_type_t(use_type, p[6]);
7959 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7960 # pform_module_define_port(@2, name, NetNet::PINPUT, p[3], use_type, p[1]);
7961 # port_declaration_context.port_type = NetNet::PINPUT;
7962 # port_declaration_context.port_net_type = p[3];
7963 # port_declaration_context.data_type = p[4];
7970 def p_port_declaration_2(p
):
7971 '''port_declaration : attribute_list_opt K_input K_wreal IDENTIFIER '''
7973 print('port_declaration_2', list(p
))
7976 # { Module::port_t*ptmp;
7977 # perm_string name = lex_strings.make(p[4]);
7978 # ptmp = pform_module_port_reference(name, @2.text,
7980 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7981 # FILE_NAME(real_type, @3);
7982 # pform_module_define_port(@2, name, NetNet::PINPUT,
7983 # NetNet::WIRE, real_type, p[1]);
7984 # port_declaration_context.port_type = NetNet::PINPUT;
7985 # port_declaration_context.port_net_type = NetNet::WIRE;
7986 # port_declaration_context.data_type = real_type;
7993 def p_port_declaration_3(p
):
7994 '''port_declaration : attribute_list_opt K_inout net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7996 print('port_declaration_3', list(p
))
7999 # { Module::port_t*ptmp;
8000 # perm_string name = lex_strings.make(p[5]);
8001 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
8002 # pform_module_define_port(@2, name, NetNet::PINOUT, p[3], p[4], p[1]);
8003 # port_declaration_context.port_type = NetNet::PINOUT;
8004 # port_declaration_context.port_net_type = p[3];
8005 # port_declaration_context.data_type = p[4];
8008 # yyerror(@6, "sorry: Inout ports with unpacked dimensions not supported.");
8016 def p_port_declaration_4(p
):
8017 '''port_declaration : attribute_list_opt K_inout K_wreal IDENTIFIER '''
8019 print('port_declaration_4', list(p
))
8022 # { Module::port_t*ptmp;
8023 # perm_string name = lex_strings.make(p[4]);
8024 # ptmp = pform_module_port_reference(name, @2.text,
8026 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
8027 # FILE_NAME(real_type, @3);
8028 # pform_module_define_port(@2, name, NetNet::PINOUT,
8029 # NetNet::WIRE, real_type, p[1]);
8030 # port_declaration_context.port_type = NetNet::PINOUT;
8031 # port_declaration_context.port_net_type = NetNet::WIRE;
8032 # port_declaration_context.data_type = real_type;
8039 def p_port_declaration_5(p
):
8040 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
8042 print('port_declaration_5 FIXME', list(p
))
8043 comment
, dt
, name
= p
[2], p
[4], p
[5]
8044 p
[0] = absyn
.port_decl(comment
, dt
, name
)
8047 # { Module::port_t*ptmp;
8048 # perm_string name = lex_strings.make(p[5]);
8049 # data_type_t*use_dtype = p[4];
8050 # if (p[6]) use_dtype = new uarray_type_t(use_dtype, p[6]);
8051 # NetNet::Type use_type = p[3];
8052 # if (use_type == NetNet::IMPLICIT) {
8053 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
8054 # if (dtype->reg_flag)
8055 # use_type = NetNet::REG;
8056 # else if (dtype->implicit_flag)
8057 # use_type = NetNet::IMPLICIT;
8059 # use_type = NetNet::IMPLICIT_REG;
8061 # // The SystemVerilog types that can show up as
8062 # // output ports are implicitly (on the inside)
8063 # // variables because "reg" is not valid syntax
8065 # } else if (dynamic_cast<atom2_type_t*> (p[4])) {
8066 # use_type = NetNet::IMPLICIT_REG;
8067 # } else if (dynamic_cast<struct_type_t*> (p[4])) {
8068 # use_type = NetNet::IMPLICIT_REG;
8069 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[4])) {
8070 # if(etype->base_type == IVL_VT_LOGIC)
8071 # use_type = NetNet::IMPLICIT_REG;
8074 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
8075 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, use_dtype, p[1]);
8076 # port_declaration_context.port_type = NetNet::POUTPUT;
8077 # port_declaration_context.port_net_type = use_type;
8078 # port_declaration_context.data_type = p[4];
8085 def p_port_declaration_6(p
):
8086 '''port_declaration : attribute_list_opt K_output K_wreal IDENTIFIER '''
8088 print('port_declaration_6', list(p
))
8091 # { Module::port_t*ptmp;
8092 # perm_string name = lex_strings.make(p[4]);
8093 # ptmp = pform_module_port_reference(name, @2.text,
8095 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
8096 # FILE_NAME(real_type, @3);
8097 # pform_module_define_port(@2, name, NetNet::POUTPUT,
8098 # NetNet::WIRE, real_type, p[1]);
8099 # port_declaration_context.port_type = NetNet::POUTPUT;
8100 # port_declaration_context.port_net_type = NetNet::WIRE;
8101 # port_declaration_context.data_type = real_type;
8108 def p_port_declaration_7(p
):
8109 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER '=' expression '''
8111 print('port_declaration_7', list(p
))
8114 # { Module::port_t*ptmp;
8115 # perm_string name = lex_strings.make(p[5]);
8116 # NetNet::Type use_type = p[3];
8117 # if (use_type == NetNet::IMPLICIT) {
8118 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
8119 # if (dtype->reg_flag)
8120 # use_type = NetNet::REG;
8122 # use_type = NetNet::IMPLICIT_REG;
8124 # use_type = NetNet::IMPLICIT_REG;
8127 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
8128 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, p[4], p[1]);
8129 # port_declaration_context.port_type = NetNet::PINOUT;
8130 # port_declaration_context.port_net_type = use_type;
8131 # port_declaration_context.data_type = p[4];
8133 # pform_make_var_init(@5, name, p[7]);
8141 def p_net_type_opt_1(p
):
8142 '''net_type_opt : net_type '''
8144 print('net_type_opt_1', list(p
))
8151 def p_net_type_opt_2(p
):
8152 '''net_type_opt : '''
8153 if(parse_debug
> 2):
8154 print('net_type_opt_2', list(p
))
8161 def p_unsigned_signed_opt_1(p
):
8162 '''unsigned_signed_opt : K_signed '''
8164 print('unsigned_signed_opt_1', list(p
))
8171 def p_unsigned_signed_opt_2(p
):
8172 '''unsigned_signed_opt : K_unsigned '''
8174 print('unsigned_signed_opt_2', list(p
))
8181 def p_unsigned_signed_opt_3(p
):
8182 '''unsigned_signed_opt : '''
8184 print('unsigned_signed_opt_3', list(p
))
8191 def p_signed_unsigned_opt_1(p
):
8192 '''signed_unsigned_opt : K_signed '''
8194 print('signed_unsigned_opt_1', list(p
))
8201 def p_signed_unsigned_opt_2(p
):
8202 '''signed_unsigned_opt : K_unsigned '''
8204 print('signed_unsigned_opt_2', list(p
))
8211 def p_signed_unsigned_opt_3(p
):
8212 '''signed_unsigned_opt : '''
8214 print('signed_unsigned_opt_3', list(p
))
8221 def p_atom2_type_1(p
):
8222 '''atom2_type : K_byte '''
8224 print('atom2_type_1', list(p
))
8231 def p_atom2_type_2(p
):
8232 '''atom2_type : K_shortint '''
8234 print('atom2_type_2', list(p
))
8241 def p_atom2_type_3(p
):
8242 '''atom2_type : K_int '''
8244 print('atom2_type_3', list(p
))
8251 def p_atom2_type_4(p
):
8252 '''atom2_type : K_longint '''
8254 print('atom2_type_4', list(p
))
8262 '''lpvalue : hierarchy_identifier '''
8263 if(parse_debug
> 2):
8264 print('lpvalue_1', list(p
))
8268 # { PEIdent*tmp = pform_new_ident(*p[1]);
8269 # FILE_NAME(tmp, @1);
8277 '''lpvalue : implicit_class_handle '.' hierarchy_identifier '''
8279 print('lpvalue_2', list(p
))
8282 # { pform_name_t*t_name = p[1];
8283 # while (!p[3]->empty()) {
8284 # t_name->push_back(p[3]->front());
8285 # p[3]->pop_front();
8287 # PEIdent*tmp = new PEIdent(*t_name);
8288 # FILE_NAME(tmp, @1);
8297 '''lpvalue : '{' expression_list_proper '}' '''
8299 print('lpvalue_3', list(p
))
8302 # { PEConcat*tmp = new PEConcat(*p[2]);
8303 # FILE_NAME(tmp, @1);
8311 '''lpvalue : streaming_concatenation '''
8313 print('lpvalue_4', list(p
))
8316 # { yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
8322 def p_cont_assign_1(p
):
8323 '''cont_assign : lpvalue '=' expression '''
8325 print('cont_assign_1', list(p
))
8326 absyn
.cont_assign_1(p
)
8329 # { list<PExpr*>*tmp = new list<PExpr*>;
8330 # tmp->push_back(p[1]);
8331 # tmp->push_back(p[3]);
8337 def p_cont_assign_list_1(p
):
8338 '''cont_assign_list : cont_assign_list ',' cont_assign '''
8340 print('cont_assign_list_1', list(p
))
8343 # { list<PExpr*>*tmp = p[1];
8344 # tmp->splice(tmp->end(), *p[3]);
8351 def p_cont_assign_list_2(p
):
8352 '''cont_assign_list : cont_assign '''
8353 if(parse_debug
> 2):
8354 print('cont_assign_list_2', list(p
))
8362 '''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 '''
8363 if(parse_debug
> 2):
8364 print('module_1', list(p
))
8365 clsdecl
= absyn
.module_1(p
)
8372 def p__embed0_module(p
):
8373 '''_embed0_module : '''
8376 # { pform_startmodule(@2, p[4], p[2]==K_program, p[2]==K_interface, p[3], p[1]); }
8380 def p__embed1_module(p
):
8381 '''_embed1_module : '''
8384 # { pform_module_set_ports(p[8]); }
8388 def p__embed2_module(p
):
8389 '''_embed2_module : '''
8392 # { pform_set_scope_timescale(@2); }
8396 def p__embed3_module(p
):
8397 '''_embed3_module : '''
8400 # { Module::UCDriveType ucd;
8401 # // The lexor detected `unconnected_drive directives and
8402 # // marked what it found in the uc_drive variable. Use that
8403 # // to generate a UCD flag for the module.
8404 # switch (uc_drive) {
8407 # ucd = Module::UCD_NONE;
8410 # ucd = Module::UCD_PULL0;
8413 # ucd = Module::UCD_PULL1;
8416 # // Check that program/endprogram and module/endmodule
8417 # // keywords match.
8418 # if (p[2] != p[15]) {
8421 # yyerror(@15, "error: module not closed by endmodule.");
8424 # yyerror(@15, "error: program not closed by endprogram.");
8427 # yyerror(@15, "error: interface not closed by endinterface.");
8433 # pform_endmodule(p[4], in_celldefine, ucd);
8438 def p_module_start_1(p
):
8439 '''module_start : K_module '''
8440 if(parse_debug
> 1):
8441 print('module_start_1', list(p
))
8444 # { p[0] = K_module; }
8448 def p_module_start_2(p
):
8449 '''module_start : K_macromodule '''
8451 print('module_start_2', list(p
))
8454 # { p[0] = K_module; }
8458 def p_module_start_3(p
):
8459 '''module_start : K_program '''
8461 print('module_start_3', list(p
))
8464 # { p[0] = K_program; }
8468 def p_module_start_4(p
):
8469 '''module_start : K_interface '''
8471 print('module_start_4', list(p
))
8474 # { p[0] = K_interface; }
8478 def p_module_end_1(p
):
8479 '''module_end : K_endmodule '''
8480 if(parse_debug
> 2):
8481 print('module_end_1', list(p
))
8484 # { p[0] = K_module; }
8488 def p_module_end_2(p
):
8489 '''module_end : K_endprogram '''
8491 print('module_end_2', list(p
))
8494 # { p[0] = K_program; }
8498 def p_module_end_3(p
):
8499 '''module_end : K_endinterface '''
8501 print('module_end_3', list(p
))
8504 # { p[0] = K_interface; }
8508 def p_endlabel_opt_1(p
):
8509 '''endlabel_opt : ':' IDENTIFIER '''
8511 print('endlabel_opt_1', list(p
))
8518 def p_endlabel_opt_2(p
):
8519 '''endlabel_opt : '''
8520 if(parse_debug
> 2):
8521 print('endlabel_opt_2', list(p
))
8528 def p_module_attribute_foreign_1(p
):
8529 '''module_attribute_foreign : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP '''
8531 print('module_attribute_foreign_1', list(p
))
8538 def p_module_attribute_foreign_2(p
):
8539 '''module_attribute_foreign : '''
8540 if(parse_debug
> 2):
8541 print('module_attribute_foreign_2', list(p
))
8548 def p_module_port_list_opt_1(p
):
8549 '''module_port_list_opt : '(' list_of_ports ')' '''
8551 print('module_port_list_opt_1', list(p
))
8558 def p_module_port_list_opt_2(p
):
8559 '''module_port_list_opt : '(' list_of_port_declarations ')' '''
8560 if(parse_debug
> 2):
8561 print('module_port_list_opt_2', list(p
))
8568 def p_module_port_list_opt_3(p
):
8569 '''module_port_list_opt : '''
8571 print('module_port_list_opt_3', list(p
))
8578 def p_module_port_list_opt_4(p
):
8579 '''module_port_list_opt : '(' error ')' '''
8581 print('module_port_list_opt_4', list(p
))
8584 # { yyerror(@2, "Errors in port declarations.");
8591 def p_module_parameter_port_list_opt_1(p
):
8592 '''module_parameter_port_list_opt : '''
8593 if(parse_debug
> 2):
8594 print('module_parameter_port_list_opt_1', list(p
))
8600 def p_module_parameter_port_list_opt_2(p
):
8601 '''module_parameter_port_list_opt : '#' '(' module_parameter_port_list ')' '''
8603 print('module_parameter_port_list_opt_2', list(p
))
8610 def p_module_parameter_port_list_1(p
):
8611 '''module_parameter_port_list : K_parameter param_type parameter_assign '''
8613 print('module_parameter_port_list_1', list(p
))
8620 def p_module_parameter_port_list_2(p
):
8621 '''module_parameter_port_list : module_parameter_port_list ',' parameter_assign '''
8623 print('module_parameter_port_list_2', list(p
))
8624 p
[0] = p
[1].append(p
[3])
8630 def p_module_parameter_port_list_3(p
):
8631 '''module_parameter_port_list : module_parameter_port_list ',' K_parameter param_type parameter_assign '''
8633 print('module_parameter_port_list_3', list(p
))
8634 p
[1].append(Leaf(token
.COMMA
, ','))
8635 p
[1].append(Leaf(token
.NEWLINE
, '\n'))
8636 p
[5].prefix
= ' ' # add space after newline
8644 def p_module_item_1(p
):
8645 '''module_item : module '''
8647 print('module_item_1', list(p
))
8653 def p_module_item_2(p
):
8654 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' '''
8656 print('module_item_2', list(p
))
8658 p
[0] = absyn
.module_item_2(p
[2], p
[3], p
[5])
8659 #p[0] = ["module_item_2"]+list(p)
8662 # { data_type_t*data_type = p[3];
8663 # if (data_type == 0) {
8664 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8665 # FILE_NAME(data_type, @2);
8667 # pform_set_data_type(@2, data_type, p[5], p[2], p[1]);
8669 # yyerror(@2, "sorry: net delays not supported.");
8677 def p_module_item_3(p
):
8678 '''module_item : attribute_list_opt K_wreal delay3 net_variable_list ';' '''
8680 print('module_item_3', list(p
))
8683 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
8684 # pform_set_data_type(@2, tmpt, p[4], NetNet::WIRE, p[1]);
8686 # yyerror(@3, "sorry: net delays not supported.");
8694 def p_module_item_4(p
):
8695 '''module_item : attribute_list_opt K_wreal net_variable_list ';' '''
8697 print('module_item_4', list(p
))
8700 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
8701 # pform_set_data_type(@2, tmpt, p[3], NetNet::WIRE, p[1]);
8707 def p_module_item_5(p
):
8708 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_decl_assigns ';' '''
8710 print('module_item_5', list(p
))
8713 # { data_type_t*data_type = p[3];
8714 # if (data_type == 0) {
8715 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8716 # FILE_NAME(data_type, @2);
8718 # pform_makewire(@2, p[4], str_strength, p[5], p[2], data_type);
8720 # yywarn(@2, "Attributes are not supported on net declaration "
8721 # "assignments and will be discarded.");
8728 def p_module_item_6(p
):
8729 '''module_item : attribute_list_opt net_type data_type_or_implicit drive_strength net_decl_assigns ';' '''
8731 print('module_item_6', list(p
))
8734 # { data_type_t*data_type = p[3];
8735 # if (data_type == 0) {
8736 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8737 # FILE_NAME(data_type, @2);
8739 # pform_makewire(@2, 0, p[4], p[5], p[2], data_type);
8741 # yywarn(@2, "Attributes are not supported on net declaration "
8742 # "assignments and will be discarded.");
8749 def p_module_item_7(p
):
8750 '''module_item : attribute_list_opt K_wreal net_decl_assigns ';' '''
8752 print('module_item_7', list(p
))
8755 # { real_type_t*data_type = new real_type_t(real_type_t::REAL);
8756 # pform_makewire(@2, 0, str_strength, p[3], NetNet::WIRE, data_type);
8758 # yywarn(@2, "Attributes are not supported on net declaration "
8759 # "assignments and will be discarded.");
8766 def p_module_item_8(p
):
8767 '''module_item : K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' '''
8769 print('module_item_8', list(p
))
8772 # { yyerror(@1, "sorry: trireg nets not supported.");
8779 def p_module_item_9(p
):
8780 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit list_of_port_identifiers ';' '''
8782 print('module_item_9', list(p
))
8785 # { pform_module_define_port(@2, p[5], p[2], p[3], p[4], p[1]); }
8789 def p_module_item_10(p
):
8790 '''module_item : attribute_list_opt port_direction K_wreal list_of_port_identifiers ';' '''
8792 print('module_item_10', list(p
))
8795 # { real_type_t*real_type = new real_type_t(real_type_t::REAL);
8796 # pform_module_define_port(@2, p[4], p[2], NetNet::WIRE, real_type, p[1]);
8801 def p_module_item_11(p
):
8802 '''module_item : attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' '''
8804 print('module_item_11', list(p
))
8807 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8808 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8809 # if (dtype->implicit_flag)
8810 # use_type = NetNet::NONE;
8812 # if (use_type == NetNet::NONE)
8813 # pform_set_port_type(@2, p[4], NetNet::PINOUT, p[3], p[1]);
8815 # pform_module_define_port(@2, p[4], NetNet::PINOUT, use_type, p[3], p[1]);
8820 def p_module_item_12(p
):
8821 '''module_item : attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' '''
8823 print('module_item_12', list(p
))
8826 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8827 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8828 # if (dtype->implicit_flag)
8829 # use_type = NetNet::NONE;
8831 # if (use_type == NetNet::NONE)
8832 # pform_set_port_type(@2, p[4], NetNet::PINPUT, p[3], p[1]);
8834 # pform_module_define_port(@2, p[4], NetNet::PINPUT, use_type, p[3], p[1]);
8839 def p_module_item_13(p
):
8840 '''module_item : attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' '''
8842 print('module_item_13', list(p
))
8845 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8846 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8847 # if (dtype->implicit_flag)
8848 # use_type = NetNet::NONE;
8849 # else if (dtype->reg_flag)
8850 # use_type = NetNet::REG;
8852 # use_type = NetNet::IMPLICIT_REG;
8854 # // The SystemVerilog types that can show up as
8855 # // output ports are implicitly (on the inside)
8856 # // variables because "reg" is not valid syntax
8858 # } else if (dynamic_cast<atom2_type_t*> (p[3])) {
8859 # use_type = NetNet::IMPLICIT_REG;
8860 # } else if (dynamic_cast<struct_type_t*> (p[3])) {
8861 # use_type = NetNet::IMPLICIT_REG;
8862 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[3])) {
8863 # if(etype->base_type == IVL_VT_LOGIC)
8864 # use_type = NetNet::IMPLICIT_REG;
8866 # if (use_type == NetNet::NONE)
8867 # pform_set_port_type(@2, p[4], NetNet::POUTPUT, p[3], p[1]);
8869 # pform_module_define_port(@2, p[4], NetNet::POUTPUT, use_type, p[3], p[1]);
8874 def p_module_item_14(p
):
8875 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit error ';' '''
8877 print('module_item_14', list(p
))
8880 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8881 # if (p[1]) delete p[1];
8882 # if (p[4]) delete p[4];
8888 def p_module_item_15(p
):
8889 '''module_item : attribute_list_opt K_inout data_type_or_implicit error ';' '''
8891 print('module_item_15', list(p
))
8894 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8895 # if (p[1]) delete p[1];
8896 # if (p[3]) delete p[3];
8902 def p_module_item_16(p
):
8903 '''module_item : attribute_list_opt K_input data_type_or_implicit error ';' '''
8905 print('module_item_16', list(p
))
8908 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8909 # if (p[1]) delete p[1];
8910 # if (p[3]) delete p[3];
8916 def p_module_item_17(p
):
8917 '''module_item : attribute_list_opt K_output data_type_or_implicit error ';' '''
8919 print('module_item_17', list(p
))
8922 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8923 # if (p[1]) delete p[1];
8924 # if (p[3]) delete p[3];
8930 def p_module_item_18(p
):
8931 '''module_item : DISCIPLINE_IDENTIFIER list_of_identifiers ';' '''
8933 print('module_item_18', list(p
))
8936 # { pform_attach_discipline(@1, p[1], p[2]); }
8940 def p_module_item_19(p
):
8941 '''module_item : attribute_list_opt _embed0_module_item block_item_decl '''
8943 print('module_item_19', list(p
))
8946 # { delete attributes_in_context;
8947 # attributes_in_context = 0;
8952 def p_module_item_20(p
):
8953 '''module_item : K_defparam _embed1_module_item defparam_assign_list ';' '''
8955 print('module_item_20', list(p
))
8961 def p_module_item_21(p
):
8962 '''module_item : attribute_list_opt gatetype gate_instance_list ';' '''
8964 print('module_item_21', list(p
))
8967 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
8971 def p_module_item_22(p
):
8972 '''module_item : attribute_list_opt gatetype delay3 gate_instance_list ';' '''
8974 print('module_item_22', list(p
))
8977 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
8981 def p_module_item_23(p
):
8982 '''module_item : attribute_list_opt gatetype drive_strength gate_instance_list ';' '''
8984 print('module_item_23', list(p
))
8987 # { pform_makegates(@2, p[2], p[3], 0, p[4], p[1]); }
8991 def p_module_item_24(p
):
8992 '''module_item : attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';' '''
8994 print('module_item_24', list(p
))
8997 # { pform_makegates(@2, p[2], p[3], p[4], p[5], p[1]); }
9001 def p_module_item_25(p
):
9002 '''module_item : attribute_list_opt switchtype gate_instance_list ';' '''
9004 print('module_item_25', list(p
))
9007 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
9011 def p_module_item_26(p
):
9012 '''module_item : attribute_list_opt switchtype delay3 gate_instance_list ';' '''
9014 print('module_item_26', list(p
))
9017 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
9021 def p_module_item_27(p
):
9022 '''module_item : K_pullup gate_instance_list ';' '''
9024 print('module_item_27', list(p
))
9027 # { pform_makegates(@1, PGBuiltin::PULLUP, pull_strength, 0, p[2], 0); }
9031 def p_module_item_28(p
):
9032 '''module_item : K_pulldown gate_instance_list ';' '''
9034 print('module_item_28', list(p
))
9037 # { pform_makegates(@1, PGBuiltin::PULLDOWN, pull_strength, 0, p[2], 0); }
9041 def p_module_item_29(p
):
9042 '''module_item : K_pullup '(' dr_strength1 ')' gate_instance_list ';' '''
9044 print('module_item_29', list(p
))
9047 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[5], 0); }
9051 def p_module_item_30(p
):
9052 '''module_item : K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
9054 print('module_item_30', list(p
))
9057 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[7], 0); }
9061 def p_module_item_31(p
):
9062 '''module_item : K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
9064 print('module_item_31', list(p
))
9067 # { pform_makegates(@1, PGBuiltin::PULLUP, p[5], 0, p[7], 0); }
9071 def p_module_item_32(p
):
9072 '''module_item : K_pulldown '(' dr_strength0 ')' gate_instance_list ';' '''
9074 print('module_item_32', list(p
))
9077 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[5], 0); }
9081 def p_module_item_33(p
):
9082 '''module_item : K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
9084 print('module_item_33', list(p
))
9087 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[5], 0, p[7], 0); }
9091 def p_module_item_34(p
):
9092 '''module_item : K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
9094 print('module_item_34', list(p
))
9097 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[7], 0); }
9101 def p_module_item_35(p
):
9102 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' '''
9104 print('module_item_35', list(p
))
9107 # { perm_string tmp1 = lex_strings.make(p[2]);
9108 # pform_make_modgates(@2, tmp1, p[3], p[4], p[1]);
9114 def p_module_item_36(p
):
9115 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt error ';' '''
9117 print('module_item_36', list(p
))
9120 # { yyerror(@2, "error: Invalid module instantiation");
9122 # if (p[1]) delete p[1];
9127 def p_module_item_37(p
):
9128 '''module_item : K_assign drive_strength_opt delay3_opt cont_assign_list ';' '''
9129 if(parse_debug
> 2):
9130 print('module_item_37', list(p
))
9133 # { pform_make_pgassign_list(p[4], p[3], p[2], @1.text, @1.first_line); }
9137 def p_module_item_38(p
):
9138 '''module_item : attribute_list_opt K_always statement_item '''
9140 print('module_item_38', list(p
))
9143 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, p[3], p[1]);
9144 # FILE_NAME(tmp, @2);
9149 def p_module_item_39(p
):
9150 '''module_item : attribute_list_opt K_always_comb statement_item '''
9152 print('module_item_39', list(p
))
9154 absyn
.always_comb(p
[3], p
[1])
9157 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_COMB, p[3], p[1]);
9158 # FILE_NAME(tmp, @2);
9163 def p_module_item_40(p
):
9164 '''module_item : attribute_list_opt K_always_ff statement_item '''
9166 print('module_item_40', list(p
))
9168 absyn
.always_ff(p
[3], p
[1])
9171 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, p[3], p[1]);
9172 # FILE_NAME(tmp, @2);
9177 def p_module_item_41(p
):
9178 '''module_item : attribute_list_opt K_always_latch statement_item '''
9180 print('module_item_41', list(p
))
9183 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_LATCH, p[3], p[1]);
9184 # FILE_NAME(tmp, @2);
9189 def p_module_item_42(p
):
9190 '''module_item : attribute_list_opt K_initial statement_item '''
9192 print('module_item_42', list(p
))
9195 # { PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, p[3], p[1]);
9196 # FILE_NAME(tmp, @2);
9201 def p_module_item_43(p
):
9202 '''module_item : attribute_list_opt K_final statement_item '''
9204 print('module_item_43', list(p
))
9207 # { PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, p[3], p[1]);
9208 # FILE_NAME(tmp, @2);
9213 def p_module_item_44(p
):
9214 '''module_item : attribute_list_opt K_analog analog_statement '''
9216 print('module_item_44', list(p
))
9219 # { pform_make_analog_behavior(@2, IVL_PR_ALWAYS, p[3]); }
9223 def p_module_item_45(p
):
9224 '''module_item : attribute_list_opt assertion_item '''
9226 print('module_item_45', list(p
))
9232 def p_module_item_46(p
):
9233 '''module_item : timeunits_declaration '''
9235 print('module_item_46', list(p
))
9241 def p_module_item_47(p
):
9242 '''module_item : class_declaration '''
9244 print('module_item_47', list(p
))
9250 def p_module_item_48(p
):
9251 '''module_item : task_declaration '''
9253 print('module_item_48', list(p
))
9259 def p_module_item_49(p
):
9260 '''module_item : function_declaration '''
9262 print('module_item_49', list(p
))
9268 def p_module_item_50(p
):
9269 '''module_item : K_generate generate_item_list_opt K_endgenerate '''
9271 print('module_item_50', list(p
))
9274 # { // Test for bad nesting. I understand it, but it is illegal.
9275 # if (pform_parent_generate()) {
9276 # cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
9277 # cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
9278 # cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
9285 def p_module_item_51(p
):
9286 '''module_item : K_genvar list_of_identifiers ';' '''
9288 print('module_item_51', list(p
))
9291 # { pform_genvars(@1, p[2]); }
9295 def p_module_item_52(p
):
9296 '''module_item : K_for '(' IDENTIFIER '=' expression ';' expression ';' IDENTIFIER '=' expression ')' _embed2_module_item generate_block '''
9298 print('module_item_52', list(p
))
9301 # { pform_endgenerate(); }
9305 def p_module_item_53(p
):
9306 '''module_item : generate_if generate_block_opt K_else _embed3_module_item generate_block '''
9308 print('module_item_53', list(p
))
9311 # { pform_endgenerate(); }
9315 def p_module_item_54(p
):
9316 '''module_item : generate_if generate_block_opt %prec less_than_K_else '''
9318 print('module_item_54', list(p
))
9321 # { pform_endgenerate(); }
9325 def p_module_item_55(p
):
9326 '''module_item : K_case '(' expression ')' _embed4_module_item generate_case_items K_endcase '''
9328 print('module_item_55', list(p
))
9331 # { pform_endgenerate(); }
9335 def p_module_item_56(p
):
9336 '''module_item : modport_declaration '''
9338 print('module_item_56', list(p
))
9344 def p_module_item_57(p
):
9345 '''module_item : package_import_declaration '''
9347 print('module_item_57', list(p
))
9353 def p_module_item_58(p
):
9354 '''module_item : attribute_list_opt K_specparam _embed5_module_item specparam_decl ';' '''
9356 print('module_item_58', list(p
))
9362 def p_module_item_59(p
):
9363 '''module_item : K_specify _embed6_module_item specify_item_list_opt K_endspecify '''
9365 print('module_item_59', list(p
))
9371 def p_module_item_60(p
):
9372 '''module_item : K_specify error K_endspecify '''
9374 print('module_item_60', list(p
))
9377 # { yyerror(@1, "error: syntax error in specify block");
9383 def p_module_item_61(p
):
9384 '''module_item : error ';' '''
9386 print('module_item_61', list(p
))
9389 # { yyerror(@2, "error: invalid module item.");
9395 def p_module_item_62(p
):
9396 '''module_item : K_assign error '=' expression ';' '''
9398 print('module_item_62', list(p
))
9401 # { yyerror(@1, "error: syntax error in left side "
9402 # "of continuous assignment.");
9408 def p_module_item_63(p
):
9409 '''module_item : K_assign error ';' '''
9411 print('module_item_63', list(p
))
9414 # { yyerror(@1, "error: syntax error in "
9415 # "continuous assignment");
9421 def p_module_item_64(p
):
9422 '''module_item : K_function error K_endfunction endlabel_opt '''
9424 print('module_item_64', list(p
))
9427 # { yyerror(@1, "error: I give up on this "
9428 # "function definition.");
9430 # if (!gn_system_verilog()) {
9431 # yyerror(@4, "error: Function end names require "
9432 # "SystemVerilog.");
9441 def p_module_item_65(p
):
9442 '''module_item : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';' '''
9444 print('module_item_65', list(p
))
9447 # { perm_string tmp3 = lex_strings.make(p[3]);
9448 # perm_string tmp5 = lex_strings.make(p[5]);
9449 # pform_set_attrib(tmp3, tmp5, p[7]);
9456 def p_module_item_66(p
):
9457 '''module_item : KK_attribute '(' error ')' ';' '''
9459 print('module_item_66', list(p
))
9462 # { yyerror(@1, "error: Malformed $attribute parameter list."); }
9466 def p__embed0_module_item(p
):
9467 '''_embed0_module_item : '''
9470 # { attributes_in_context = p[1]; }
9474 def p__embed1_module_item(p
):
9475 '''_embed1_module_item : '''
9478 # { if (pform_in_interface())
9479 # yyerror(@1, "error: Parameter overrides are not allowed "
9480 # "in interfaces.");
9485 def p__embed2_module_item(p
):
9486 '''_embed2_module_item : '''
9489 # { pform_start_generate_for(@1, p[3], p[5], p[7], p[9], p[11]); }
9493 def p__embed3_module_item(p
):
9494 '''_embed3_module_item : '''
9497 # { pform_start_generate_else(@1); }
9501 def p__embed4_module_item(p
):
9502 '''_embed4_module_item : '''
9505 # { pform_start_generate_case(@1, p[3]); }
9509 def p__embed5_module_item(p
):
9510 '''_embed5_module_item : '''
9513 # { if (pform_in_interface())
9514 # yyerror(@1, "error: specparam declarations are not allowed "
9515 # "in interfaces.");
9520 def p__embed6_module_item(p
):
9521 '''_embed6_module_item : '''
9524 # { if (pform_in_interface())
9525 # yyerror(@1, "error: specify blocks are not allowed "
9526 # "in interfaces.");
9531 def p_module_item_list_1(p
):
9532 '''module_item_list : module_item_list module_item '''
9534 print('module_item_list_1', list(p
))
9540 def p_module_item_list_2(p
):
9541 '''module_item_list : module_item '''
9542 if(parse_debug
> 2):
9543 print('module_item_list_2', list(p
))
9549 def p_module_item_list_opt_1(p
):
9550 '''module_item_list_opt : module_item_list '''
9551 if(parse_debug
> 2):
9552 print('module_item_list_opt_1', list(p
))
9558 def p_module_item_list_opt_2(p
):
9559 '''module_item_list_opt : '''
9561 print('module_item_list_opt_2', list(p
))
9567 def p_generate_if_1(p
):
9568 '''generate_if : K_if '(' expression ')' '''
9570 print('generate_if_1', list(p
))
9573 # { pform_start_generate_if(@1, p[3]); }
9577 def p_generate_case_items_1(p
):
9578 '''generate_case_items : generate_case_items generate_case_item '''
9580 print('generate_case_items_1', list(p
))
9586 def p_generate_case_items_2(p
):
9587 '''generate_case_items : generate_case_item '''
9589 print('generate_case_items_2', list(p
))
9595 def p_generate_case_item_1(p
):
9596 '''generate_case_item : expression_list_proper ':' _embed0_generate_case_item generate_block_opt '''
9598 print('generate_case_item_1', list(p
))
9601 # { pform_endgenerate(); }
9605 def p_generate_case_item_2(p
):
9606 '''generate_case_item : K_default ':' _embed1_generate_case_item generate_block_opt '''
9608 print('generate_case_item_2', list(p
))
9611 # { pform_endgenerate(); }
9615 def p__embed0_generate_case_item(p
):
9616 '''_embed0_generate_case_item : '''
9619 # { pform_generate_case_item(@1, p[1]); }
9623 def p__embed1_generate_case_item(p
):
9624 '''_embed1_generate_case_item : '''
9627 # { pform_generate_case_item(@1, 0); }
9631 def p_generate_item_1(p
):
9632 '''generate_item : module_item '''
9634 print('generate_item_1', list(p
))
9640 def p_generate_item_2(p
):
9641 '''generate_item : K_begin generate_item_list_opt K_end '''
9643 print('generate_item_2', list(p
))
9646 # { /* Detect and warn about anachronistic begin/end use */
9647 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
9649 # cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
9655 def p_generate_item_3(p
):
9656 '''generate_item : K_begin ':' IDENTIFIER _embed0_generate_item generate_item_list_opt K_end '''
9658 print('generate_item_3', list(p
))
9661 # { /* Detect and warn about anachronistic named begin/end use */
9662 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
9664 # cerr << @1 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
9666 # pform_endgenerate();
9671 def p__embed0_generate_item(p
):
9672 '''_embed0_generate_item : '''
9676 # pform_start_generate_nblock(@1, p[3]);
9681 def p_generate_item_list_1(p
):
9682 '''generate_item_list : generate_item_list generate_item '''
9684 print('generate_item_list_1', list(p
))
9690 def p_generate_item_list_2(p
):
9691 '''generate_item_list : generate_item '''
9693 print('generate_item_list_2', list(p
))
9699 def p_generate_item_list_opt_1(p
):
9700 '''generate_item_list_opt : generate_item_list '''
9702 print('generate_item_list_opt_1', list(p
))
9708 def p_generate_item_list_opt_2(p
):
9709 '''generate_item_list_opt : '''
9711 print('generate_item_list_opt_2', list(p
))
9717 def p_generate_block_1(p
):
9718 '''generate_block : module_item '''
9720 print('generate_block_1', list(p
))
9726 def p_generate_block_2(p
):
9727 '''generate_block : K_begin generate_item_list_opt K_end '''
9729 print('generate_block_2', list(p
))
9735 def p_generate_block_3(p
):
9736 '''generate_block : K_begin ':' IDENTIFIER generate_item_list_opt K_end endlabel_opt '''
9738 print('generate_block_3', list(p
))
9741 # { pform_generate_block_name(p[3]);
9743 # if (strcmp(p[3],p[6]) != 0) {
9744 # yyerror(@6, "error: End label doesn't match "
9747 # if (! gn_system_verilog()) {
9748 # yyerror(@6, "error: Begin end labels require "
9749 # "SystemVerilog.");
9758 def p_generate_block_opt_1(p
):
9759 '''generate_block_opt : generate_block '''
9761 print('generate_block_opt_1', list(p
))
9767 def p_generate_block_opt_2(p
):
9768 '''generate_block_opt : ';' '''
9770 print('generate_block_opt_2', list(p
))
9776 def p_net_decl_assign_1(p
):
9777 '''net_decl_assign : IDENTIFIER '=' expression '''
9779 print('net_decl_assign_1', list(p
))
9782 # { net_decl_assign_t*tmp = new net_decl_assign_t;
9784 # tmp->name = lex_strings.make(p[1]);
9792 def p_net_decl_assigns_1(p
):
9793 '''net_decl_assigns : net_decl_assigns ',' net_decl_assign '''
9795 print('net_decl_assigns_1', list(p
))
9798 # { net_decl_assign_t*tmp = p[1];
9799 # p[3]->next = tmp->next;
9806 def p_net_decl_assigns_2(p
):
9807 '''net_decl_assigns : net_decl_assign '''
9809 print('net_decl_assigns_2', list(p
))
9817 def p_bit_logic_1(p
):
9818 '''bit_logic : K_logic '''
9820 print('bit_logic_1', list(p
))
9823 # { p[0] = IVL_VT_LOGIC; }
9827 def p_bit_logic_2(p
):
9828 '''bit_logic : K_bool '''
9830 print('bit_logic_2', list(p
))
9833 # { p[0] = IVL_VT_BOOL; /* Icarus misc */}
9837 def p_bit_logic_3(p
):
9838 '''bit_logic : K_bit '''
9840 print('bit_logic_3', list(p
))
9843 # { p[0] = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
9847 def p_bit_logic_opt_1(p
):
9848 '''bit_logic_opt : bit_logic '''
9850 print('bit_logic_opt_1', list(p
))
9856 def p_bit_logic_opt_2(p
):
9857 '''bit_logic_opt : '''
9859 print('bit_logic_opt_2', list(p
))
9862 # { p[0] = IVL_VT_NO_TYPE; }
9866 def p_net_type_1(p
):
9867 '''net_type : K_wire '''
9868 if(parse_debug
> 2):
9869 print('net_type_1', list(p
))
9877 def p_net_type_2(p
):
9878 '''net_type : K_tri '''
9880 print('net_type_2', list(p
))
9883 # { p[0] = NetNet::TRI; }
9887 def p_net_type_3(p
):
9888 '''net_type : K_tri1 '''
9890 print('net_type_3', list(p
))
9893 # { p[0] = NetNet::TRI1; }
9897 def p_net_type_4(p
):
9898 '''net_type : K_supply0 '''
9900 print('net_type_4', list(p
))
9903 # { p[0] = NetNet::SUPPLY0; }
9907 def p_net_type_5(p
):
9908 '''net_type : K_wand '''
9910 print('net_type_5', list(p
))
9913 # { p[0] = NetNet::WAND; }
9917 def p_net_type_6(p
):
9918 '''net_type : K_triand '''
9920 print('net_type_6', list(p
))
9923 # { p[0] = NetNet::TRIAND; }
9927 def p_net_type_7(p
):
9928 '''net_type : K_tri0 '''
9930 print('net_type_7', list(p
))
9933 # { p[0] = NetNet::TRI0; }
9937 def p_net_type_8(p
):
9938 '''net_type : K_supply1 '''
9940 print('net_type_8', list(p
))
9943 # { p[0] = NetNet::SUPPLY1; }
9947 def p_net_type_9(p
):
9948 '''net_type : K_wor '''
9950 print('net_type_9', list(p
))
9953 # { p[0] = NetNet::WOR; }
9957 def p_net_type_10(p
):
9958 '''net_type : K_trior '''
9960 print('net_type_10', list(p
))
9963 # { p[0] = NetNet::TRIOR; }
9967 def p_net_type_11(p
):
9968 '''net_type : K_wone '''
9970 print('net_type_11', list(p
))
9973 # { p[0] = NetNet::UNRESOLVED_WIRE;
9974 # cerr << @1.text << ":" << @1.first_line << ": warning: "
9975 # "'wone' is deprecated, please use 'uwire' "
9976 # "instead." << endl;
9981 def p_net_type_12(p
):
9982 '''net_type : K_uwire '''
9984 print('net_type_12', list(p
))
9987 # { p[0] = NetNet::UNRESOLVED_WIRE; }
9991 def p_param_type_1(p
):
9992 '''param_type : bit_logic_opt unsigned_signed_opt dimensions_opt '''
9994 print('param_type_1', list(p
))
9997 # { param_active_range = p[3];
9998 # param_active_signed = p[2];
9999 # if ((p[1] == IVL_VT_NO_TYPE) && (p[3] != 0))
10000 # param_active_type = IVL_VT_LOGIC;
10002 # param_active_type = p[1];
10007 def p_param_type_2(p
):
10008 '''param_type : K_integer '''
10010 print('param_type_2', list(p
))
10013 # { param_active_range = make_range_from_width(integer_width);
10014 # param_active_signed = true;
10015 # param_active_type = IVL_VT_LOGIC;
10020 def p_param_type_3(p
):
10021 '''param_type : K_time '''
10023 print('param_type_3', list(p
))
10026 # { param_active_range = make_range_from_width(64);
10027 # param_active_signed = false;
10028 # param_active_type = IVL_VT_LOGIC;
10033 def p_param_type_4(p
):
10034 '''param_type : real_or_realtime '''
10036 print('param_type_4', list(p
))
10039 # { param_active_range = 0;
10040 # param_active_signed = true;
10041 # param_active_type = IVL_VT_REAL;
10046 def p_param_type_5(p
):
10047 '''param_type : atom2_type '''
10049 print('param_type_5', list(p
))
10052 # { param_active_range = make_range_from_width(p[1]);
10053 # param_active_signed = true;
10054 # param_active_type = IVL_VT_BOOL;
10059 def p_param_type_6(p
):
10060 '''param_type : TYPE_IDENTIFIER '''
10062 print('param_type_6', list(p
))
10065 # { pform_set_param_from_type(@1, p[1].type, p[1].text, param_active_range,
10066 # param_active_signed, param_active_type);
10067 # delete[]p[1].text;
10072 def p_parameter_assign_list_1(p
):
10073 '''parameter_assign_list : parameter_assign '''
10075 print('parameter_assign_list_1', list(p
))
10081 def p_parameter_assign_list_2(p
):
10082 '''parameter_assign_list : parameter_assign_list ',' parameter_assign '''
10084 print('parameter_assign_list_2', list(p
))
10090 def p_localparam_assign_list_1(p
):
10091 '''localparam_assign_list : localparam_assign '''
10093 print('localparam_assign_list_1', list(p
))
10099 def p_localparam_assign_list_2(p
):
10100 '''localparam_assign_list : localparam_assign_list ',' localparam_assign '''
10102 print('localparam_assign_list_2', list(p
))
10108 def p_parameter_assign_1(p
):
10109 '''parameter_assign : IDENTIFIER '=' expression parameter_value_ranges_opt '''
10111 print('parameter_assign_1', list(p
))
10112 tpname
= Node(syms
.tname
, [Leaf(token
.NAME
, p
[1])])
10113 expr
= Node(syms
.tfpdef
, [tpname
, Leaf(token
.EQUAL
, p
[2]), p
[3]])
10117 # { PExpr*tmp = p[3];
10118 # pform_set_parameter(@1, lex_strings.make(p[1]), param_active_type,
10119 # param_active_signed, param_active_range, tmp, p[4]);
10125 def p_localparam_assign_1(p
):
10126 '''localparam_assign : IDENTIFIER '=' expression '''
10128 print('localparam_assign_1', list(p
))
10131 # { PExpr*tmp = p[3];
10132 # pform_set_localparam(@1, lex_strings.make(p[1]), param_active_type,
10133 # param_active_signed, param_active_range, tmp);
10139 def p_parameter_value_ranges_opt_1(p
):
10140 '''parameter_value_ranges_opt : parameter_value_ranges '''
10142 print('parameter_value_ranges_opt_1', list(p
))
10149 def p_parameter_value_ranges_opt_2(p
):
10150 '''parameter_value_ranges_opt : '''
10152 print('parameter_value_ranges_opt_2', list(p
))
10159 def p_parameter_value_ranges_1(p
):
10160 '''parameter_value_ranges : parameter_value_ranges parameter_value_range '''
10162 print('parameter_value_ranges_1', list(p
))
10165 # { p[0] = p[2]; p[0]->next = p[1]; }
10169 def p_parameter_value_ranges_2(p
):
10170 '''parameter_value_ranges : parameter_value_range '''
10172 print('parameter_value_ranges_2', list(p
))
10175 # { p[0] = p[1]; p[0]->next = 0; }
10179 def p_parameter_value_range_1(p
):
10180 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ']' '''
10182 print('parameter_value_range_1', list(p
))
10185 # { p[0] = pform_parameter_value_range(p[1], false, p[3], false, p[5]); }
10189 def p_parameter_value_range_2(p
):
10190 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ')' '''
10192 print('parameter_value_range_2', list(p
))
10195 # { p[0] = pform_parameter_value_range(p[1], false, p[3], true, p[5]); }
10199 def p_parameter_value_range_3(p
):
10200 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ']' '''
10202 print('parameter_value_range_3', list(p
))
10205 # { p[0] = pform_parameter_value_range(p[1], true, p[3], false, p[5]); }
10209 def p_parameter_value_range_4(p
):
10210 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ')' '''
10212 print('parameter_value_range_4', list(p
))
10215 # { p[0] = pform_parameter_value_range(p[1], true, p[3], true, p[5]); }
10219 def p_parameter_value_range_5(p
):
10220 '''parameter_value_range : K_exclude expression '''
10222 print('parameter_value_range_5', list(p
))
10225 # { p[0] = pform_parameter_value_range(true, false, p[2], false, p[2]); }
10229 def p_value_range_expression_1(p
):
10230 '''value_range_expression : expression '''
10232 print('value_range_expression_1', list(p
))
10239 def p_value_range_expression_2(p
):
10240 '''value_range_expression : K_inf '''
10242 print('value_range_expression_2', list(p
))
10249 def p_value_range_expression_3(p
):
10250 '''value_range_expression : '+' K_inf '''
10252 print('value_range_expression_3', list(p
))
10259 def p_value_range_expression_4(p
):
10260 '''value_range_expression : '-' K_inf '''
10262 print('value_range_expression_4', list(p
))
10269 def p_from_exclude_1(p
):
10270 '''from_exclude : K_from '''
10272 print('from_exclude_1', list(p
))
10279 def p_from_exclude_2(p
):
10280 '''from_exclude : K_exclude '''
10282 print('from_exclude_2', list(p
))
10289 def p_parameter_value_opt_1(p
):
10290 '''parameter_value_opt : '#' '(' expression_list_with_nuls ')' '''
10292 print('parameter_value_opt_1', list(p
))
10295 # { struct parmvalue_t*tmp = new struct parmvalue_t;
10296 # tmp->by_order = p[3];
10297 # tmp->by_name = 0;
10303 def p_parameter_value_opt_2(p
):
10304 '''parameter_value_opt : '#' '(' parameter_value_byname_list ')' '''
10306 print('parameter_value_opt_2', list(p
))
10309 # { struct parmvalue_t*tmp = new struct parmvalue_t;
10310 # tmp->by_order = 0;
10311 # tmp->by_name = p[3];
10317 def p_parameter_value_opt_3(p
):
10318 '''parameter_value_opt : '#' DEC_NUMBER '''
10320 print('parameter_value_opt_3', list(p
))
10324 # PENumber*tmp = new PENumber(p[2]);
10325 # FILE_NAME(tmp, @1);
10327 # struct parmvalue_t*lst = new struct parmvalue_t;
10328 # lst->by_order = new list<PExpr*>;
10329 # lst->by_order->push_back(tmp);
10330 # lst->by_name = 0;
10337 def p_parameter_value_opt_4(p
):
10338 '''parameter_value_opt : '#' REALTIME '''
10340 print('parameter_value_opt_4', list(p
))
10344 # PEFNumber*tmp = new PEFNumber(p[2]);
10345 # FILE_NAME(tmp, @1);
10347 # struct parmvalue_t*lst = new struct parmvalue_t;
10348 # lst->by_order = new list<PExpr*>;
10349 # lst->by_order->push_back(tmp);
10350 # lst->by_name = 0;
10356 def p_parameter_value_opt_5(p
):
10357 '''parameter_value_opt : '#' error '''
10359 print('parameter_value_opt_5', list(p
))
10362 # { yyerror(@1, "error: syntax error in parameter value "
10363 # "assignment list.");
10369 def p_parameter_value_opt_6(p
):
10370 '''parameter_value_opt : '''
10372 print('parameter_value_opt_6', list(p
))
10379 def p_parameter_value_byname_1(p
):
10380 '''parameter_value_byname : '.' IDENTIFIER '(' expression ')' '''
10382 print('parameter_value_byname_1', list(p
))
10385 # { named_pexpr_t*tmp = new named_pexpr_t;
10386 # tmp->name = lex_strings.make(p[2]);
10387 # tmp->parm = p[4];
10394 def p_parameter_value_byname_2(p
):
10395 '''parameter_value_byname : '.' IDENTIFIER '(' ')' '''
10397 print('parameter_value_byname_2', list(p
))
10400 # { named_pexpr_t*tmp = new named_pexpr_t;
10401 # tmp->name = lex_strings.make(p[2]);
10409 def p_parameter_value_byname_list_1(p
):
10410 '''parameter_value_byname_list : parameter_value_byname '''
10412 print('parameter_value_byname_list_1', list(p
))
10415 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
10416 # tmp->push_back(*p[1]);
10423 def p_parameter_value_byname_list_2(p
):
10424 '''parameter_value_byname_list : parameter_value_byname_list ',' parameter_value_byname '''
10426 print('parameter_value_byname_list_2', list(p
))
10429 # { list<named_pexpr_t>*tmp = p[1];
10430 # tmp->push_back(*p[3]);
10438 '''port : port_reference '''
10440 print('port_1', list(p
))
10448 '''port : '.' IDENTIFIER '(' port_reference ')' '''
10450 print('port_2', list(p
))
10453 # { Module::port_t*tmp = p[4];
10454 # tmp->name = lex_strings.make(p[2]);
10462 '''port : '{' port_reference_list '}' '''
10464 print('port_3', list(p
))
10467 # { Module::port_t*tmp = p[2];
10468 # tmp->name = perm_string();
10475 '''port : '.' IDENTIFIER '(' '{' port_reference_list '}' ')' '''
10477 print('port_4', list(p
))
10480 # { Module::port_t*tmp = p[5];
10481 # tmp->name = lex_strings.make(p[2]);
10488 def p_port_opt_1(p
):
10489 '''port_opt : port '''
10491 print('port_opt_1', list(p
))
10498 def p_port_opt_2(p
):
10501 print('port_opt_2', list(p
))
10508 def p_port_name_1(p
):
10509 '''port_name : '.' IDENTIFIER '(' expression ')' '''
10511 print('port_name_1', list(p
))
10514 # { named_pexpr_t*tmp = new named_pexpr_t;
10515 # tmp->name = lex_strings.make(p[2]);
10516 # tmp->parm = p[4];
10523 def p_port_name_2(p
):
10524 '''port_name : '.' IDENTIFIER '(' error ')' '''
10526 print('port_name_2', list(p
))
10529 # { yyerror(@3, "error: invalid port connection expression.");
10530 # named_pexpr_t*tmp = new named_pexpr_t;
10531 # tmp->name = lex_strings.make(p[2]);
10539 def p_port_name_3(p
):
10540 '''port_name : '.' IDENTIFIER '(' ')' '''
10542 print('port_name_3', list(p
))
10545 # { named_pexpr_t*tmp = new named_pexpr_t;
10546 # tmp->name = lex_strings.make(p[2]);
10554 def p_port_name_4(p
):
10555 '''port_name : '.' IDENTIFIER '''
10557 print('port_name_4', list(p
))
10560 # { named_pexpr_t*tmp = new named_pexpr_t;
10561 # tmp->name = lex_strings.make(p[2]);
10562 # tmp->parm = new PEIdent(lex_strings.make(p[2]), true);
10563 # FILE_NAME(tmp->parm, @1);
10570 def p_port_name_5(p
):
10571 '''port_name : K_DOTSTAR '''
10573 print('port_name_5', list(p
))
10576 # { named_pexpr_t*tmp = new named_pexpr_t;
10577 # tmp->name = lex_strings.make("*");
10584 def p_port_name_list_1(p
):
10585 '''port_name_list : port_name_list ',' port_name '''
10587 print('port_name_list_1', list(p
))
10590 # { list<named_pexpr_t>*tmp = p[1];
10591 # tmp->push_back(*p[3]);
10598 def p_port_name_list_2(p
):
10599 '''port_name_list : port_name '''
10601 print('port_name_list_2', list(p
))
10604 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
10605 # tmp->push_back(*p[1]);
10612 def p_port_reference_1(p
):
10613 '''port_reference : IDENTIFIER '''
10615 print('port_reference_1', list(p
))
10618 # { Module::port_t*ptmp;
10619 # perm_string name = lex_strings.make(p[1]);
10620 # ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
10627 def p_port_reference_2(p
):
10628 '''port_reference : IDENTIFIER '[' expression ':' expression ']' '''
10630 print('port_reference_2', list(p
))
10633 # { index_component_t itmp;
10634 # itmp.sel = index_component_t::SEL_PART;
10638 # name_component_t ntmp (lex_strings.make(p[1]));
10639 # ntmp.index.push_back(itmp);
10641 # pform_name_t pname;
10642 # pname.push_back(ntmp);
10644 # PEIdent*wtmp = new PEIdent(pname);
10645 # FILE_NAME(wtmp, @1);
10647 # Module::port_t*ptmp = new Module::port_t;
10648 # ptmp->name = perm_string();
10649 # ptmp->expr.push_back(wtmp);
10657 def p_port_reference_3(p
):
10658 '''port_reference : IDENTIFIER '[' expression ']' '''
10660 print('port_reference_3', list(p
))
10663 # { index_component_t itmp;
10664 # itmp.sel = index_component_t::SEL_BIT;
10668 # name_component_t ntmp (lex_strings.make(p[1]));
10669 # ntmp.index.push_back(itmp);
10671 # pform_name_t pname;
10672 # pname.push_back(ntmp);
10674 # PEIdent*tmp = new PEIdent(pname);
10675 # FILE_NAME(tmp, @1);
10677 # Module::port_t*ptmp = new Module::port_t;
10678 # ptmp->name = perm_string();
10679 # ptmp->expr.push_back(tmp);
10686 def p_port_reference_4(p
):
10687 '''port_reference : IDENTIFIER '[' error ']' '''
10689 print('port_reference_4', list(p
))
10692 # { yyerror(@1, "error: invalid port bit select");
10693 # Module::port_t*ptmp = new Module::port_t;
10694 # PEIdent*wtmp = new PEIdent(lex_strings.make(p[1]));
10695 # FILE_NAME(wtmp, @1);
10696 # ptmp->name = lex_strings.make(p[1]);
10697 # ptmp->expr.push_back(wtmp);
10704 def p_port_reference_list_1(p
):
10705 '''port_reference_list : port_reference '''
10707 print('port_reference_list_1', list(p
))
10714 def p_port_reference_list_2(p
):
10715 '''port_reference_list : port_reference_list ',' port_reference '''
10717 print('port_reference_list_2', list(p
))
10720 # { Module::port_t*tmp = p[1];
10721 # append(tmp->expr, p[3]->expr);
10728 def p_dimensions_opt_1(p
):
10729 '''dimensions_opt : '''
10730 if(parse_debug
> 2):
10731 print('dimensions_opt_1', list(p
))
10738 def p_dimensions_opt_2(p
):
10739 '''dimensions_opt : dimensions '''
10741 print('dimensions_opt_2', list(p
))
10748 def p_dimensions_1(p
):
10749 '''dimensions : variable_dimension '''
10751 print('dimensions_1', list(p
))
10758 def p_dimensions_2(p
):
10759 '''dimensions : dimensions variable_dimension '''
10761 print('dimensions_2', list(p
))
10764 # { list<pform_range_t> *tmp = p[1];
10766 # tmp->splice(tmp->end(), *p[2]);
10774 def p_register_variable_1(p
):
10775 '''register_variable : IDENTIFIER dimensions_opt '''
10777 print('register_variable_1', list(p
))
10780 # { perm_string name = lex_strings.make(p[1]);
10781 # pform_makewire(@1, name, NetNet::REG,
10782 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10783 # pform_set_reg_idx(name, p[2]);
10789 def p_register_variable_2(p
):
10790 '''register_variable : IDENTIFIER dimensions_opt '=' expression '''
10792 print('register_variable_2', list(p
))
10795 # { if (pform_peek_scope()->var_init_needs_explicit_lifetime()
10796 # && (var_lifetime == LexicalScope::INHERITED)) {
10797 # cerr << @3 << ": warning: Static variable initialization requires "
10798 # "explicit lifetime in this context." << endl;
10801 # perm_string name = lex_strings.make(p[1]);
10802 # pform_makewire(@1, name, NetNet::REG,
10803 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10804 # pform_set_reg_idx(name, p[2]);
10805 # pform_make_var_init(@1, name, p[4]);
10811 def p_register_variable_list_1(p
):
10812 '''register_variable_list : register_variable '''
10814 print('register_variable_list_1', list(p
))
10817 # { list<perm_string>*tmp = new list<perm_string>;
10818 # tmp->push_back(lex_strings.make(p[1]));
10825 def p_register_variable_list_2(p
):
10826 '''register_variable_list : register_variable_list ',' register_variable '''
10828 print('register_variable_list_2', list(p
))
10831 # { list<perm_string>*tmp = p[1];
10832 # tmp->push_back(lex_strings.make(p[3]));
10839 def p_net_variable_1(p
):
10840 '''net_variable : IDENTIFIER dimensions_opt '''
10841 if(parse_debug
> 2):
10842 print('net_variable_1', list(p
))
10844 #p[0]= ('net_variable_1', list(p))
10846 # { perm_string name = lex_strings.make(p[1]);
10847 # pform_makewire(@1, name, NetNet::IMPLICIT,
10848 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10849 # pform_set_reg_idx(name, p[2]);
10850 p
[0] = [p
[1], p
[2]]
10856 def p_net_variable_list_1(p
):
10857 '''net_variable_list : net_variable '''
10858 if(parse_debug
> 2):
10859 print('net_variable_list_1', list(p
))
10863 # { list<perm_string>*tmp = new list<perm_string>;
10864 # tmp->push_back(lex_strings.make(p[1]));
10871 def p_net_variable_list_2(p
):
10872 '''net_variable_list : net_variable_list ',' net_variable '''
10873 if(parse_debug
> 2):
10874 print('net_variable_list_2', list(p
))
10878 # { list<perm_string>*tmp = p[1];
10879 # tmp->push_back(lex_strings.make(p[3]));
10886 def p_event_variable_1(p
):
10887 '''event_variable : IDENTIFIER dimensions_opt '''
10889 print('event_variable_1', list(p
))
10893 # yyerror(@2, "sorry: event arrays are not supported.");
10901 def p_event_variable_list_1(p
):
10902 '''event_variable_list : event_variable '''
10904 print('event_variable_list_1', list(p
))
10907 # { p[0] = list_from_identifier(p[1]); }
10911 def p_event_variable_list_2(p
):
10912 '''event_variable_list : event_variable_list ',' event_variable '''
10914 print('event_variable_list_2', list(p
))
10917 # { p[0] = list_from_identifier(p[1], p[3]); }
10921 def p_specify_item_1(p
):
10922 '''specify_item : K_specparam specparam_decl ';' '''
10924 print('specify_item_1', list(p
))
10930 def p_specify_item_2(p
):
10931 '''specify_item : specify_simple_path_decl ';' '''
10933 print('specify_item_2', list(p
))
10936 # { pform_module_specify_path(p[1]);
10941 def p_specify_item_3(p
):
10942 '''specify_item : specify_edge_path_decl ';' '''
10944 print('specify_item_3', list(p
))
10947 # { pform_module_specify_path(p[1]);
10952 def p_specify_item_4(p
):
10953 '''specify_item : K_if '(' expression ')' specify_simple_path_decl ';' '''
10955 print('specify_item_4', list(p
))
10958 # { PSpecPath*tmp = p[5];
10960 # tmp->conditional = true;
10961 # tmp->condition = p[3];
10963 # pform_module_specify_path(tmp);
10968 def p_specify_item_5(p
):
10969 '''specify_item : K_if '(' expression ')' specify_edge_path_decl ';' '''
10971 print('specify_item_5', list(p
))
10974 # { PSpecPath*tmp = p[5];
10976 # tmp->conditional = true;
10977 # tmp->condition = p[3];
10979 # pform_module_specify_path(tmp);
10984 def p_specify_item_6(p
):
10985 '''specify_item : K_ifnone specify_simple_path_decl ';' '''
10987 print('specify_item_6', list(p
))
10990 # { PSpecPath*tmp = p[2];
10992 # tmp->conditional = true;
10993 # tmp->condition = 0;
10995 # pform_module_specify_path(tmp);
11000 def p_specify_item_7(p
):
11001 '''specify_item : K_ifnone specify_edge_path_decl ';' '''
11003 print('specify_item_7', list(p
))
11006 # { yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
11007 # "not supported.");
11013 def p_specify_item_8(p
):
11014 '''specify_item : K_Sfullskew '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
11016 print('specify_item_8', list(p
))
11025 def p_specify_item_9(p
):
11026 '''specify_item : K_Shold '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
11028 print('specify_item_9', list(p
))
11036 def p_specify_item_10(p
):
11037 '''specify_item : K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
11039 print('specify_item_10', list(p
))
11048 def p_specify_item_11(p
):
11049 '''specify_item : K_Speriod '(' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
11051 print('specify_item_11', list(p
))
11059 def p_specify_item_12(p
):
11060 '''specify_item : K_Srecovery '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
11062 print('specify_item_12', list(p
))
11070 def p_specify_item_13(p
):
11071 '''specify_item : K_Srecrem '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
11073 print('specify_item_13', list(p
))
11082 def p_specify_item_14(p
):
11083 '''specify_item : K_Sremoval '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
11085 print('specify_item_14', list(p
))
11093 def p_specify_item_15(p
):
11094 '''specify_item : K_Ssetup '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
11096 print('specify_item_15', list(p
))
11104 def p_specify_item_16(p
):
11105 '''specify_item : K_Ssetuphold '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
11107 print('specify_item_16', list(p
))
11116 def p_specify_item_17(p
):
11117 '''specify_item : K_Sskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
11119 print('specify_item_17', list(p
))
11127 def p_specify_item_18(p
):
11128 '''specify_item : K_Stimeskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
11130 print('specify_item_18', list(p
))
11138 def p_specify_item_19(p
):
11139 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ',' expression spec_notifier_opt ')' ';' '''
11141 print('specify_item_19', list(p
))
11150 def p_specify_item_20(p
):
11151 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ')' ';' '''
11153 print('specify_item_20', list(p
))
11161 def p_specify_item_21(p
):
11162 '''specify_item : K_pulsestyle_onevent specify_path_identifiers ';' '''
11164 print('specify_item_21', list(p
))
11172 def p_specify_item_22(p
):
11173 '''specify_item : K_pulsestyle_ondetect specify_path_identifiers ';' '''
11175 print('specify_item_22', list(p
))
11183 def p_specify_item_23(p
):
11184 '''specify_item : K_showcancelled specify_path_identifiers ';' '''
11186 print('specify_item_23', list(p
))
11194 def p_specify_item_24(p
):
11195 '''specify_item : K_noshowcancelled specify_path_identifiers ';' '''
11197 print('specify_item_24', list(p
))
11205 def p_specify_item_list_1(p
):
11206 '''specify_item_list : specify_item '''
11208 print('specify_item_list_1', list(p
))
11214 def p_specify_item_list_2(p
):
11215 '''specify_item_list : specify_item_list specify_item '''
11217 print('specify_item_list_2', list(p
))
11223 def p_specify_item_list_opt_1(p
):
11224 '''specify_item_list_opt : '''
11226 print('specify_item_list_opt_1', list(p
))
11233 def p_specify_item_list_opt_2(p
):
11234 '''specify_item_list_opt : specify_item_list '''
11236 print('specify_item_list_opt_2', list(p
))
11243 def p_specify_edge_path_decl_1(p
):
11244 '''specify_edge_path_decl : specify_edge_path '=' '(' delay_value_list ')' '''
11246 print('specify_edge_path_decl_1', list(p
))
11249 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
11253 def p_specify_edge_path_decl_2(p
):
11254 '''specify_edge_path_decl : specify_edge_path '=' delay_value_simple '''
11256 print('specify_edge_path_decl_2', list(p
))
11259 # { list<PExpr*>*tmp = new list<PExpr*>;
11260 # tmp->push_back(p[3]);
11261 # p[0] = pform_assign_path_delay(p[1], tmp);
11266 def p_edge_operator_1(p
):
11267 '''edge_operator : K_posedge '''
11269 print('edge_operator_1', list(p
))
11276 def p_edge_operator_2(p
):
11277 '''edge_operator : K_negedge '''
11279 print('edge_operator_2', list(p
))
11286 def p_specify_edge_path_1(p
):
11287 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
11289 print('specify_edge_path_1', list(p
))
11292 # { int edge_flag = 0;
11293 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], false, p[6], p[8]); }
11297 def p_specify_edge_path_2(p
):
11298 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
11300 print('specify_edge_path_2', list(p
))
11303 # { int edge_flag = p[2]? 1 : -1;
11304 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], false, p[7], p[9]);}
11308 def p_specify_edge_path_3(p
):
11309 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
11311 print('specify_edge_path_3', list(p
))
11314 # { int edge_flag = 0;
11315 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], true, p[6], p[8]); }
11319 def p_specify_edge_path_4(p
):
11320 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
11322 print('specify_edge_path_4', list(p
))
11325 # { int edge_flag = p[2]? 1 : -1;
11326 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], true, p[7], p[9]); }
11330 def p_polarity_operator_1(p
):
11331 '''polarity_operator : K_PO_POS '''
11333 print('polarity_operator_1', list(p
))
11339 def p_polarity_operator_2(p
):
11340 '''polarity_operator : K_PO_NEG '''
11342 print('polarity_operator_2', list(p
))
11348 def p_polarity_operator_3(p
):
11349 '''polarity_operator : ':' '''
11351 print('polarity_operator_3', list(p
))
11357 def p_specify_simple_path_decl_1(p
):
11358 '''specify_simple_path_decl : specify_simple_path '=' '(' delay_value_list ')' '''
11360 print('specify_simple_path_decl_1', list(p
))
11363 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
11367 def p_specify_simple_path_decl_2(p
):
11368 '''specify_simple_path_decl : specify_simple_path '=' delay_value_simple '''
11370 print('specify_simple_path_decl_2', list(p
))
11373 # { list<PExpr*>*tmp = new list<PExpr*>;
11374 # tmp->push_back(p[3]);
11375 # p[0] = pform_assign_path_delay(p[1], tmp);
11380 def p_specify_simple_path_decl_3(p
):
11381 '''specify_simple_path_decl : specify_simple_path '=' '(' error ')' '''
11383 print('specify_simple_path_decl_3', list(p
))
11386 # { yyerror(@3, "Syntax error in delay value list.");
11393 def p_specify_simple_path_1(p
):
11394 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' '''
11396 print('specify_simple_path_1', list(p
))
11399 # { p[0] = pform_make_specify_path(@1, p[2], p[3], false, p[5]); }
11403 def p_specify_simple_path_2(p
):
11404 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' '''
11406 print('specify_simple_path_2', list(p
))
11409 # { p[0] = pform_make_specify_path(@1, p[2], p[3], true, p[5]); }
11413 def p_specify_simple_path_3(p
):
11414 '''specify_simple_path : '(' error ')' '''
11416 print('specify_simple_path_3', list(p
))
11419 # { yyerror(@1, "Invalid simple path");
11425 def p_specify_path_identifiers_1(p
):
11426 '''specify_path_identifiers : IDENTIFIER '''
11428 print('specify_path_identifiers_1', list(p
))
11431 # { list<perm_string>*tmp = new list<perm_string>;
11432 # tmp->push_back(lex_strings.make(p[1]));
11439 def p_specify_path_identifiers_2(p
):
11440 '''specify_path_identifiers : IDENTIFIER '[' expr_primary ']' '''
11442 print('specify_path_identifiers_2', list(p
))
11445 # { if (gn_specify_blocks_flag) {
11446 # yywarn(@4, "Bit selects are not currently supported "
11447 # "in path declarations. The declaration "
11448 # "will be applied to the whole vector.");
11450 # list<perm_string>*tmp = new list<perm_string>;
11451 # tmp->push_back(lex_strings.make(p[1]));
11458 def p_specify_path_identifiers_3(p
):
11459 '''specify_path_identifiers : IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
11461 print('specify_path_identifiers_3', list(p
))
11464 # { if (gn_specify_blocks_flag) {
11465 # yywarn(@4, "Part selects are not currently supported "
11466 # "in path declarations. The declaration "
11467 # "will be applied to the whole vector.");
11469 # list<perm_string>*tmp = new list<perm_string>;
11470 # tmp->push_back(lex_strings.make(p[1]));
11477 def p_specify_path_identifiers_4(p
):
11478 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '''
11480 print('specify_path_identifiers_4', list(p
))
11483 # { list<perm_string>*tmp = p[1];
11484 # tmp->push_back(lex_strings.make(p[3]));
11491 def p_specify_path_identifiers_5(p
):
11492 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' '''
11494 print('specify_path_identifiers_5', list(p
))
11497 # { if (gn_specify_blocks_flag) {
11498 # yywarn(@4, "Bit selects are not currently supported "
11499 # "in path declarations. The declaration "
11500 # "will be applied to the whole vector.");
11502 # list<perm_string>*tmp = p[1];
11503 # tmp->push_back(lex_strings.make(p[3]));
11510 def p_specify_path_identifiers_6(p
):
11511 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
11513 print('specify_path_identifiers_6', list(p
))
11516 # { if (gn_specify_blocks_flag) {
11517 # yywarn(@4, "Part selects are not currently supported "
11518 # "in path declarations. The declaration "
11519 # "will be applied to the whole vector.");
11521 # list<perm_string>*tmp = p[1];
11522 # tmp->push_back(lex_strings.make(p[3]));
11529 def p_specparam_1(p
):
11530 '''specparam : IDENTIFIER '=' expression '''
11532 print('specparam_1', list(p
))
11535 # { PExpr*tmp = p[3];
11536 # pform_set_specparam(@1, lex_strings.make(p[1]),
11537 # param_active_range, tmp);
11543 def p_specparam_2(p
):
11544 '''specparam : IDENTIFIER '=' expression ':' expression ':' expression '''
11546 print('specparam_2', list(p
))
11550 # switch (min_typ_max_flag) {
11567 # if (min_typ_max_warn > 0) {
11568 # cerr << tmp->get_fileline() << ": warning: choosing ";
11569 # switch (min_typ_max_flag) {
11580 # cerr << " expression." << endl;
11581 # min_typ_max_warn -= 1;
11583 # pform_set_specparam(@1, lex_strings.make(p[1]),
11584 # param_active_range, tmp);
11590 def p_specparam_3(p
):
11591 '''specparam : PATHPULSE_IDENTIFIER '=' expression '''
11593 print('specparam_3', list(p
))
11602 def p_specparam_4(p
):
11603 '''specparam : PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' '''
11605 print('specparam_4', list(p
))
11615 def p_specparam_list_1(p
):
11616 '''specparam_list : specparam '''
11618 print('specparam_list_1', list(p
))
11624 def p_specparam_list_2(p
):
11625 '''specparam_list : specparam_list ',' specparam '''
11627 print('specparam_list_2', list(p
))
11633 def p_specparam_decl_1(p
):
11634 '''specparam_decl : specparam_list '''
11636 print('specparam_decl_1', list(p
))
11642 def p_specparam_decl_2(p
):
11643 '''specparam_decl : dimensions _embed0_specparam_decl specparam_list '''
11645 print('specparam_decl_2', list(p
))
11648 # { param_active_range = 0; }
11652 def p__embed0_specparam_decl(p
):
11653 '''_embed0_specparam_decl : '''
11656 # { param_active_range = p[1]; }
11660 def p_spec_polarity_1(p
):
11661 '''spec_polarity : '+' '''
11663 print('spec_polarity_1', list(p
))
11670 def p_spec_polarity_2(p
):
11671 '''spec_polarity : '-' '''
11673 print('spec_polarity_2', list(p
))
11680 def p_spec_polarity_3(p
):
11681 '''spec_polarity : '''
11683 print('spec_polarity_3', list(p
))
11690 def p_spec_reference_event_1(p
):
11691 '''spec_reference_event : K_posedge expression '''
11693 print('spec_reference_event_1', list(p
))
11700 def p_spec_reference_event_2(p
):
11701 '''spec_reference_event : K_negedge expression '''
11703 print('spec_reference_event_2', list(p
))
11710 def p_spec_reference_event_3(p
):
11711 '''spec_reference_event : K_posedge expr_primary K_TAND expression '''
11713 print('spec_reference_event_3', list(p
))
11722 def p_spec_reference_event_4(p
):
11723 '''spec_reference_event : K_negedge expr_primary K_TAND expression '''
11725 print('spec_reference_event_4', list(p
))
11734 def p_spec_reference_event_5(p
):
11735 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary '''
11737 print('spec_reference_event_5', list(p
))
11744 def p_spec_reference_event_6(p
):
11745 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression '''
11747 print('spec_reference_event_6', list(p
))
11756 def p_spec_reference_event_7(p
):
11757 '''spec_reference_event : expr_primary K_TAND expression '''
11759 print('spec_reference_event_7', list(p
))
11768 def p_spec_reference_event_8(p
):
11769 '''spec_reference_event : expr_primary '''
11771 print('spec_reference_event_8', list(p
))
11778 def p_edge_descriptor_list_1(p
):
11779 '''edge_descriptor_list : edge_descriptor_list ',' K_edge_descriptor '''
11781 print('edge_descriptor_list_1', list(p
))
11787 def p_edge_descriptor_list_2(p
):
11788 '''edge_descriptor_list : K_edge_descriptor '''
11790 print('edge_descriptor_list_2', list(p
))
11796 def p_spec_notifier_opt_1(p
):
11797 '''spec_notifier_opt : '''
11799 print('spec_notifier_opt_1', list(p
))
11806 def p_spec_notifier_opt_2(p
):
11807 '''spec_notifier_opt : spec_notifier '''
11809 print('spec_notifier_opt_2', list(p
))
11816 def p_spec_notifier_1(p
):
11817 '''spec_notifier : ',' '''
11819 print('spec_notifier_1', list(p
))
11822 # { args_after_notifier = 0; }
11826 def p_spec_notifier_2(p
):
11827 '''spec_notifier : ',' hierarchy_identifier '''
11829 print('spec_notifier_2', list(p
))
11832 # { args_after_notifier = 0; delete p[2]; }
11836 def p_spec_notifier_3(p
):
11837 '''spec_notifier : spec_notifier ',' '''
11839 print('spec_notifier_3', list(p
))
11842 # { args_after_notifier += 1; }
11846 def p_spec_notifier_4(p
):
11847 '''spec_notifier : spec_notifier ',' hierarchy_identifier '''
11849 print('spec_notifier_4', list(p
))
11852 # { args_after_notifier += 1;
11853 # if (args_after_notifier >= 3) {
11854 # cerr << @3 << ": warning: timing checks are not supported "
11855 # "and delayed signal \"" << *p[3]
11856 # << "\" will not be driven." << endl;
11862 def p_spec_notifier_5(p
):
11863 '''spec_notifier : IDENTIFIER '''
11865 print('spec_notifier_5', list(p
))
11868 # { args_after_notifier = 0; delete[]p[1]; }
11872 def p_statement_item_1(p
):
11873 '''statement_item : K_assign lpvalue '=' expression ';' '''
11875 print('statement_item_1', list(p
))
11878 # { PCAssign*tmp = new PCAssign(p[2], p[4]);
11879 # FILE_NAME(tmp, @1);
11884 # TODO: read all statement items
11887 def p_statement_item_2(p
):
11888 '''statement_item : K_deassign lpvalue ';' '''
11890 print('statement_item_2', list(p
))
11893 # { PDeassign*tmp = new PDeassign(p[2]);
11894 # FILE_NAME(tmp, @1);
11900 def p_statement_item_3(p
):
11901 '''statement_item : K_force lpvalue '=' expression ';' '''
11903 print('statement_item_3', list(p
))
11906 # { PForce*tmp = new PForce(p[2], p[4]);
11907 # FILE_NAME(tmp, @1);
11913 def p_statement_item_4(p
):
11914 '''statement_item : K_release lpvalue ';' '''
11916 print('statement_item_4', list(p
))
11919 # { PRelease*tmp = new PRelease(p[2]);
11920 # FILE_NAME(tmp, @1);
11926 def p_statement_item_5(p
):
11927 '''statement_item : K_begin K_end '''
11929 print('statement_item_5', list(p
))
11932 # { PBlock*tmp = new PBlock(PBlock::BL_SEQ);
11933 # FILE_NAME(tmp, @1);
11939 def p_statement_item_6(p
):
11940 '''statement_item : K_begin _embed0_statement_item block_item_decls_opt _embed1_statement_item statement_or_null_list K_end '''
11942 print('statement_item_6', list(p
))
11946 throw(Exception("assert(! current_block_stack.empty());"))
11955 # pform_pop_scope();
11956 # assert(! current_block_stack.empty());
11957 # tmp = current_block_stack.top();
11958 # current_block_stack.pop();
11960 # tmp = new PBlock(PBlock::BL_SEQ);
11961 # FILE_NAME(tmp, @1);
11963 # if (p[5]) tmp->set_statement(*p[5]);
11970 def p_statement_item_7(p
):
11971 '''statement_item : K_begin ':' IDENTIFIER _embed2_statement_item block_item_decls_opt statement_or_null_list_opt K_end endlabel_opt '''
11973 print('statement_item_7', list(p
))
11978 # { pform_pop_scope();
11979 # assert(! current_block_stack.empty());
11980 # PBlock*tmp = current_block_stack.top();
11981 # current_block_stack.pop();
11982 # if (p[6]) tmp->set_statement(*p[6]);
11985 # if (strcmp(p[3],p[8]) != 0) {
11986 # yyerror(@8, "error: End label doesn't match begin name");
11988 # if (! gn_system_verilog()) {
11989 # yyerror(@8, "error: Begin end labels require "
11990 # "SystemVerilog.");
12000 def p_statement_item_8(p
):
12001 '''statement_item : K_fork join_keyword '''
12003 print('statement_item_8', list(p
))
12006 # { PBlock*tmp = new PBlock(p[2]);
12007 # FILE_NAME(tmp, @1);
12013 def p_statement_item_9(p
):
12014 '''statement_item : K_fork _embed3_statement_item block_item_decls_opt _embed4_statement_item statement_or_null_list join_keyword '''
12016 print('statement_item_9', list(p
))
12021 # pform_pop_scope();
12022 # assert(! current_block_stack.empty());
12023 # tmp = current_block_stack.top();
12024 # current_block_stack.pop();
12025 # tmp->set_join_type(p[6]);
12027 # tmp = new PBlock(p[6]);
12028 # FILE_NAME(tmp, @1);
12030 # if (p[5]) tmp->set_statement(*p[5]);
12037 def p_statement_item_10(p
):
12038 '''statement_item : K_fork ':' IDENTIFIER _embed5_statement_item block_item_decls_opt statement_or_null_list_opt join_keyword endlabel_opt '''
12040 print('statement_item_10', list(p
))
12043 # { pform_pop_scope();
12044 # assert(! current_block_stack.empty());
12045 # PBlock*tmp = current_block_stack.top();
12046 # current_block_stack.pop();
12047 # tmp->set_join_type(p[7]);
12048 # if (p[6]) tmp->set_statement(*p[6]);
12051 # if (strcmp(p[3],p[8]) != 0) {
12052 # yyerror(@8, "error: End label doesn't match fork name");
12054 # if (! gn_system_verilog()) {
12055 # yyerror(@8, "error: Fork end labels require "
12056 # "SystemVerilog.");
12066 def p_statement_item_11(p
):
12067 '''statement_item : K_disable hierarchy_identifier ';' '''
12069 print('statement_item_11', list(p
))
12072 # { PDisable*tmp = new PDisable(*p[2]);
12073 # FILE_NAME(tmp, @1);
12080 def p_statement_item_12(p
):
12081 '''statement_item : K_disable K_fork ';' '''
12083 print('statement_item_12', list(p
))
12086 # { pform_name_t tmp_name;
12087 # PDisable*tmp = new PDisable(tmp_name);
12088 # FILE_NAME(tmp, @1);
12094 def p_statement_item_13(p
):
12095 '''statement_item : K_TRIGGER hierarchy_identifier ';' '''
12097 print('statement_item_13', list(p
))
12100 # { PTrigger*tmp = new PTrigger(*p[2]);
12101 # FILE_NAME(tmp, @1);
12108 def p_statement_item_14(p
):
12109 '''statement_item : procedural_assertion_statement '''
12111 print('statement_item_14', list(p
))
12118 def p_statement_item_15(p
):
12119 '''statement_item : loop_statement '''
12121 print('statement_item_15', list(p
))
12128 def p_statement_item_16(p
):
12129 '''statement_item : jump_statement '''
12131 print('statement_item_16', list(p
))
12138 def p_statement_item_17(p
):
12139 '''statement_item : K_case '(' expression ')' case_items K_endcase '''
12141 print('statement_item_17', list(p
))
12144 # { PCase*tmp = new PCase(NetCase::EQ, p[3], p[5]);
12145 # FILE_NAME(tmp, @1);
12151 def p_statement_item_18(p
):
12152 '''statement_item : K_casex '(' expression ')' case_items K_endcase '''
12154 print('statement_item_18', list(p
))
12157 # { PCase*tmp = new PCase(NetCase::EQX, p[3], p[5]);
12158 # FILE_NAME(tmp, @1);
12164 def p_statement_item_19(p
):
12165 '''statement_item : K_casez '(' expression ')' case_items K_endcase '''
12167 print('statement_item_19', list(p
))
12170 # { PCase*tmp = new PCase(NetCase::EQZ, p[3], p[5]);
12171 # FILE_NAME(tmp, @1);
12177 def p_statement_item_20(p
):
12178 '''statement_item : K_case '(' expression ')' error K_endcase '''
12180 print('statement_item_20', list(p
))
12187 def p_statement_item_21(p
):
12188 '''statement_item : K_casex '(' expression ')' error K_endcase '''
12190 print('statement_item_21', list(p
))
12197 def p_statement_item_22(p
):
12198 '''statement_item : K_casez '(' expression ')' error K_endcase '''
12200 print('statement_item_22', list(p
))
12207 def p_statement_item_23(p
):
12208 '''statement_item : K_if '(' expression ')' statement_or_null %prec less_than_K_else '''
12210 print('statement_item_23', list(p
))
12212 p
[0] = absyn
.cond_statement3(p
[3], p
[5], None)
12215 # { PCondit*tmp = new PCondit(p[3], p[5], 0);
12216 # FILE_NAME(tmp, @1);
12222 def p_statement_item_24(p
):
12223 '''statement_item : K_if '(' expression ')' statement_or_null K_else statement_or_null '''
12225 print('statement_item_24', list(p
))
12227 p
[0] = absyn
.cond_statement3(p
[3], p
[5], p
[7])
12229 # { PCondit*tmp = new PCondit(p[3], p[5], p[7]);
12230 # FILE_NAME(tmp, @1);
12236 def p_statement_item_25(p
):
12237 '''statement_item : K_if '(' error ')' statement_or_null %prec less_than_K_else '''
12239 print('statement_item_25', list(p
))
12242 # { yyerror(@1, "error: Malformed conditional expression.");
12248 def p_statement_item_26(p
):
12249 '''statement_item : K_if '(' error ')' statement_or_null K_else statement_or_null '''
12251 print('statement_item_26', list(p
))
12254 # { yyerror(@1, "error: Malformed conditional expression.");
12260 def p_statement_item_27(p
):
12261 '''statement_item : compressed_statement ';' '''
12263 print('statement_item_27', list(p
))
12270 def p_statement_item_28(p
):
12271 '''statement_item : inc_or_dec_expression ';' '''
12273 print('statement_item_28', list(p
))
12276 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
12280 def p_statement_item_29(p
):
12281 '''statement_item : delay1 statement_or_null '''
12283 print('statement_item_29', list(p
))
12286 # { PExpr*del = p[1]->front();
12287 # assert(p[1]->size() == 1);
12289 # PDelayStatement*tmp = new PDelayStatement(del, p[2]);
12290 # FILE_NAME(tmp, @1);
12296 def p_statement_item_30(p
):
12297 '''statement_item : event_control statement_or_null '''
12299 print('statement_item_30', list(p
))
12301 p
[0] = [p
[1], p
[2]]
12304 # { PEventStatement*tmp = p[1];
12306 # yyerror(@1, "error: Invalid event control.");
12309 # tmp->set_statement(p[2]);
12316 def p_statement_item_31(p
):
12317 '''statement_item : '@' '*' statement_or_null '''
12319 print('statement_item_31', list(p
))
12322 # { PEventStatement*tmp = new PEventStatement;
12323 # FILE_NAME(tmp, @1);
12324 # tmp->set_statement(p[3]);
12330 def p_statement_item_32(p
):
12331 '''statement_item : '@' '(' '*' ')' statement_or_null '''
12333 print('statement_item_32', list(p
))
12336 # { PEventStatement*tmp = new PEventStatement;
12337 # FILE_NAME(tmp, @1);
12338 # tmp->set_statement(p[5]);
12344 def p_statement_item_33(p
):
12345 '''statement_item : lpvalue '=' expression ';' '''
12348 print('statement_item33', list(p))
12350 expr = Node(syms.expr_stmt, [p[1], Leaf(token.EQUAL, p[2]), p[3]])
12352 print("expr TODO", repr(expr))
12354 expr = Node(syms.expr_stmt, [p[1], Leaf(token.EQUAL, p[2]), ])
12356 print("expr", repr(expr))
12358 print("expr (python):'%s'" % expr)
12361 p
[0] = absyn
.assign3(p
[1], p
[2], p
[3])
12364 # { PAssign*tmp = new PAssign(p[1],p[3]);
12365 # FILE_NAME(tmp, @1);
12371 def p_statement_item_34(p
):
12372 '''statement_item : error '=' expression ';' '''
12374 print('statement_item_34', list(p
))
12377 # { yyerror(@2, "Syntax in assignment statement l-value.");
12379 # p[0] = new PNoop;
12384 def p_statement_item_35(p
):
12385 '''statement_item : lpvalue K_LE expression ';' '''
12387 print('statement_item_35', list(p
))
12389 p
[0] = absyn
.assign3(p
[1], p
[2], p
[3])
12392 # { PAssignNB*tmp = new PAssignNB(p[1],p[3]);
12393 # FILE_NAME(tmp, @1);
12399 def p_statement_item_36(p
):
12400 '''statement_item : error K_LE expression ';' '''
12402 print('statement_item_36', list(p
))
12405 # { yyerror(@2, "Syntax in assignment statement l-value.");
12407 # p[0] = new PNoop;
12412 def p_statement_item_37(p
):
12413 '''statement_item : lpvalue '=' delay1 expression ';' '''
12415 print('statement_item_37', list(p
))
12418 # { PExpr*del = p[3]->front(); p[3]->pop_front();
12419 # assert(p[3]->empty());
12420 # PAssign*tmp = new PAssign(p[1],del,p[4]);
12421 # FILE_NAME(tmp, @1);
12427 def p_statement_item_38(p
):
12428 '''statement_item : lpvalue K_LE delay1 expression ';' '''
12430 print('statement_item_38', list(p
))
12433 # { PExpr*del = p[3]->front(); p[3]->pop_front();
12434 # assert(p[3]->empty());
12435 # PAssignNB*tmp = new PAssignNB(p[1],del,p[4]);
12436 # FILE_NAME(tmp, @1);
12442 def p_statement_item_39(p
):
12443 '''statement_item : lpvalue '=' event_control expression ';' '''
12445 print('statement_item_39', list(p
))
12448 # { PAssign*tmp = new PAssign(p[1],0,p[3],p[4]);
12449 # FILE_NAME(tmp, @1);
12455 def p_statement_item_40(p
):
12456 '''statement_item : lpvalue '=' K_repeat '(' expression ')' event_control expression ';' '''
12458 print('statement_item_40', list(p
))
12461 # { PAssign*tmp = new PAssign(p[1],p[5],p[7],p[8]);
12462 # FILE_NAME(tmp,@1);
12463 # tmp->set_lineno(@1.first_line);
12469 def p_statement_item_41(p
):
12470 '''statement_item : lpvalue K_LE event_control expression ';' '''
12472 print('statement_item_41', list(p
))
12475 # { PAssignNB*tmp = new PAssignNB(p[1],0,p[3],p[4]);
12476 # FILE_NAME(tmp, @1);
12482 def p_statement_item_42(p
):
12483 '''statement_item : lpvalue K_LE K_repeat '(' expression ')' event_control expression ';' '''
12485 print('statement_item_42', list(p
))
12488 # { PAssignNB*tmp = new PAssignNB(p[1],p[5],p[7],p[8]);
12489 # FILE_NAME(tmp, @1);
12495 def p_statement_item_43(p
):
12496 '''statement_item : lpvalue '=' dynamic_array_new ';' '''
12498 print('statement_item_43', list(p
))
12501 # { PAssign*tmp = new PAssign(p[1],p[3]);
12502 # FILE_NAME(tmp, @1);
12508 def p_statement_item_44(p
):
12509 '''statement_item : lpvalue '=' class_new ';' '''
12511 print('statement_item_44', list(p
))
12514 # { PAssign*tmp = new PAssign(p[1],p[3]);
12515 # FILE_NAME(tmp, @1);
12521 def p_statement_item_45(p
):
12522 '''statement_item : K_wait '(' expression ')' statement_or_null '''
12524 print('statement_item_45', list(p
))
12527 # { PEventStatement*tmp;
12528 # PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, p[3]);
12529 # tmp = new PEventStatement(etmp);
12530 # FILE_NAME(tmp,@1);
12531 # tmp->set_statement(p[5]);
12537 def p_statement_item_46(p
):
12538 '''statement_item : K_wait K_fork ';' '''
12540 print('statement_item_46', list(p
))
12543 # { PEventStatement*tmp = new PEventStatement((PEEvent*)0);
12544 # FILE_NAME(tmp,@1);
12550 def p_statement_item_47(p
):
12551 '''statement_item : SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';' '''
12553 print('statement_item_47', list(p
))
12556 # { PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), *p[3]);
12557 # FILE_NAME(tmp,@1);
12565 def p_statement_item_48(p
):
12566 '''statement_item : SYSTEM_IDENTIFIER ';' '''
12568 print('statement_item_48', list(p
))
12571 # { list<PExpr*>pt;
12572 # PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), pt);
12573 # FILE_NAME(tmp,@1);
12580 def p_statement_item_49(p
):
12581 '''statement_item : hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
12583 print('statement_item_49', list(p
))
12586 # { PCallTask*tmp = pform_make_call_task(@1, *p[1], *p[3]);
12594 def p_statement_item_50(p
):
12595 '''statement_item : hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';' '''
12597 print('statement_item_50', list(p
))
12600 # { /* ....randomize with { <constraints> } */
12601 # if (p[1] && peek_tail_name(*p[1]) == "randomize") {
12602 # if (!gn_system_verilog())
12603 # yyerror(@2, "error: Randomize with constraint requires SystemVerilog.");
12605 # yyerror(@2, "sorry: Randomize with constraint not supported.");
12607 # yyerror(@2, "error: Constraint block can only be applied to randomize method.");
12610 # PCallTask*tmp = new PCallTask(*p[1], pt);
12611 # FILE_NAME(tmp, @1);
12618 def p_statement_item_51(p
):
12619 '''statement_item : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
12621 print('statement_item_51', list(p
))
12624 # { pform_name_t*t_name = p[1];
12625 # while (! p[3]->empty()) {
12626 # t_name->push_back(p[3]->front());
12627 # p[3]->pop_front();
12629 # PCallTask*tmp = new PCallTask(*t_name, *p[5]);
12630 # FILE_NAME(tmp, @1);
12639 def p_statement_item_52(p
):
12640 '''statement_item : hierarchy_identifier ';' '''
12642 print('statement_item_52', list(p
))
12645 # { list<PExpr*>pt;
12646 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
12653 def p_statement_item_53(p
):
12654 '''statement_item : implicit_class_handle '.' K_new '(' expression_list_with_nuls ')' ';' '''
12656 print('statement_item_53', list(p
))
12659 # { PChainConstructor*tmp = new PChainConstructor(*p[5]);
12660 # FILE_NAME(tmp, @3);
12667 def p_statement_item_54(p
):
12668 '''statement_item : hierarchy_identifier '(' error ')' ';' '''
12670 print('statement_item_54', list(p
))
12673 # { yyerror(@3, "error: Syntax error in task arguments.");
12675 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
12682 def p_statement_item_55(p
):
12683 '''statement_item : error ';' '''
12685 print('statement_item_55', list(p
))
12688 # { yyerror(@2, "error: malformed statement");
12690 # p[0] = new PNoop;
12695 def p__embed0_statement_item(p
):
12696 '''_embed0_statement_item : '''
12699 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_SEQ);
12700 # FILE_NAME(tmp, @1);
12701 # current_block_stack.push(tmp);
12706 def p__embed1_statement_item(p
):
12707 '''_embed1_statement_item : '''
12711 # if (! gn_system_verilog()) {
12712 # yyerror("error: Variable declaration in unnamed block "
12713 # "requires SystemVerilog.");
12716 # /* If there are no declarations in the scope then just delete it. */
12717 # pform_pop_scope();
12718 # assert(! current_block_stack.empty());
12719 # PBlock*tmp = current_block_stack.top();
12720 # current_block_stack.pop();
12727 def p__embed2_statement_item(p
):
12728 '''_embed2_statement_item : '''
12731 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_SEQ);
12732 # FILE_NAME(tmp, @1);
12733 # current_block_stack.push(tmp);
12738 def p__embed3_statement_item(p
):
12739 '''_embed3_statement_item : '''
12742 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
12743 # FILE_NAME(tmp, @1);
12744 # current_block_stack.push(tmp);
12749 def p__embed4_statement_item(p
):
12750 '''_embed4_statement_item : '''
12754 # if (! gn_system_verilog()) {
12755 # yyerror("error: Variable declaration in unnamed block "
12756 # "requires SystemVerilog.");
12759 # /* If there are no declarations in the scope then just delete it. */
12760 # pform_pop_scope();
12761 # assert(! current_block_stack.empty());
12762 # PBlock*tmp = current_block_stack.top();
12763 # current_block_stack.pop();
12770 def p__embed5_statement_item(p
):
12771 '''_embed5_statement_item : '''
12774 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_PAR);
12775 # FILE_NAME(tmp, @1);
12776 # current_block_stack.push(tmp);
12781 def p_compressed_statement_1(p
):
12782 '''compressed_statement : lpvalue K_PLUS_EQ expression '''
12784 print('compressed_statement_1', list(p
))
12787 # { PAssign*tmp = new PAssign(p[1], '+', p[3]);
12788 # FILE_NAME(tmp, @1);
12794 def p_compressed_statement_2(p
):
12795 '''compressed_statement : lpvalue K_MINUS_EQ expression '''
12797 print('compressed_statement_2', list(p
))
12800 # { PAssign*tmp = new PAssign(p[1], '-', p[3]);
12801 # FILE_NAME(tmp, @1);
12807 def p_compressed_statement_3(p
):
12808 '''compressed_statement : lpvalue K_MUL_EQ expression '''
12810 print('compressed_statement_3', list(p
))
12813 # { PAssign*tmp = new PAssign(p[1], '*', p[3]);
12814 # FILE_NAME(tmp, @1);
12820 def p_compressed_statement_4(p
):
12821 '''compressed_statement : lpvalue K_DIV_EQ expression '''
12823 print('compressed_statement_4', list(p
))
12826 # { PAssign*tmp = new PAssign(p[1], '/', p[3]);
12827 # FILE_NAME(tmp, @1);
12833 def p_compressed_statement_5(p
):
12834 '''compressed_statement : lpvalue K_MOD_EQ expression '''
12836 print('compressed_statement_5', list(p
))
12839 # { PAssign*tmp = new PAssign(p[1], '%', p[3]);
12840 # FILE_NAME(tmp, @1);
12846 def p_compressed_statement_6(p
):
12847 '''compressed_statement : lpvalue K_AND_EQ expression '''
12849 print('compressed_statement_6', list(p
))
12852 # { PAssign*tmp = new PAssign(p[1], '&', p[3]);
12853 # FILE_NAME(tmp, @1);
12859 def p_compressed_statement_7(p
):
12860 '''compressed_statement : lpvalue K_OR_EQ expression '''
12862 print('compressed_statement_7', list(p
))
12865 # { PAssign*tmp = new PAssign(p[1], '|', p[3]);
12866 # FILE_NAME(tmp, @1);
12872 def p_compressed_statement_8(p
):
12873 '''compressed_statement : lpvalue K_XOR_EQ expression '''
12875 print('compressed_statement_8', list(p
))
12878 # { PAssign*tmp = new PAssign(p[1], '^', p[3]);
12879 # FILE_NAME(tmp, @1);
12885 def p_compressed_statement_9(p
):
12886 '''compressed_statement : lpvalue K_LS_EQ expression '''
12888 print('compressed_statement_9', list(p
))
12891 # { PAssign *tmp = new PAssign(p[1], 'l', p[3]);
12892 # FILE_NAME(tmp, @1);
12898 def p_compressed_statement_10(p
):
12899 '''compressed_statement : lpvalue K_RS_EQ expression '''
12901 print('compressed_statement_10', list(p
))
12904 # { PAssign*tmp = new PAssign(p[1], 'r', p[3]);
12905 # FILE_NAME(tmp, @1);
12911 def p_compressed_statement_11(p
):
12912 '''compressed_statement : lpvalue K_RSS_EQ expression '''
12914 print('compressed_statement_11', list(p
))
12917 # { PAssign *tmp = new PAssign(p[1], 'R', p[3]);
12918 # FILE_NAME(tmp, @1);
12924 def p_statement_or_null_list_opt_1(p
):
12925 '''statement_or_null_list_opt : statement_or_null_list '''
12927 print('statement_or_null_list_opt_1', list(p
))
12934 def p_statement_or_null_list_opt_2(p
):
12935 '''statement_or_null_list_opt : '''
12937 print('statement_or_null_list_opt_2', list(p
))
12944 def p_statement_or_null_list_1(p
):
12945 '''statement_or_null_list : statement_or_null_list statement_or_null '''
12947 print('statement_or_null_list_1', list(p
))
12952 tmp
= StatementList()
12954 tmp
.add_statement(p
[2])
12957 # { vector<Statement*>*tmp = p[1];
12958 # if (p[2]) tmp->push_back(p[2]);
12964 def p_statement_or_null_list_2(p
):
12965 '''statement_or_null_list : statement_or_null '''
12967 print('statement_or_null_list_2', list(p
))
12969 tmp
= StatementList()
12971 tmp
.add_statement(p
[1])
12975 # { vector<Statement*>*tmp = new vector<Statement*>(0);
12976 # if (p[1]) tmp->push_back(p[1]);
12982 def p_analog_statement_1(p
):
12983 '''analog_statement : branch_probe_expression K_CONTRIBUTE expression ';' '''
12985 print('analog_statement_1', list(p
))
12988 # { p[0] = pform_contribution_statement(@2, p[1], p[3]); }
12992 def p_task_item_1(p
):
12993 '''task_item : block_item_decl '''
12995 print('task_item_1', list(p
))
12998 # { p[0] = new vector<pform_tf_port_t>(0); }
13002 def p_task_item_2(p
):
13003 '''task_item : tf_port_declaration '''
13005 print('task_item_2', list(p
))
13012 def p_task_item_list_1(p
):
13013 '''task_item_list : task_item_list task_item '''
13015 print('task_item_list_1', list(p
))
13018 # { vector<pform_tf_port_t>*tmp = p[1];
13019 # size_t s1 = tmp->size();
13020 # tmp->resize(s1 + p[2]->size());
13021 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
13022 # tmp->at(s1 + idx) = p[2]->at(idx);
13029 def p_task_item_list_2(p
):
13030 '''task_item_list : task_item '''
13032 print('task_item_list_2', list(p
))
13039 def p_task_item_list_opt_1(p
):
13040 '''task_item_list_opt : task_item_list '''
13042 print('task_item_list_opt_1', list(p
))
13049 def p_task_item_list_opt_2(p
):
13050 '''task_item_list_opt : '''
13052 print('task_item_list_opt_2', list(p
))
13059 def p_tf_port_list_opt_1(p
):
13060 '''tf_port_list_opt : tf_port_list '''
13062 print('tf_port_list_opt_1', list(p
))
13069 def p_tf_port_list_opt_2(p
):
13070 '''tf_port_list_opt : '''
13072 print('tf_port_list_opt_2', list(p
))
13079 def p_udp_body_1(p
):
13080 '''udp_body : K_table udp_entry_list K_endtable '''
13082 print('udp_body_1', list(p
))
13085 # { lex_end_table();
13091 def p_udp_body_2(p
):
13092 '''udp_body : K_table K_endtable '''
13094 print('udp_body_2', list(p
))
13097 # { lex_end_table();
13098 # yyerror(@1, "error: Empty UDP table.");
13104 def p_udp_body_3(p
):
13105 '''udp_body : K_table error K_endtable '''
13107 print('udp_body_3', list(p
))
13110 # { lex_end_table();
13111 # yyerror(@2, "Errors in UDP table");
13118 def p_udp_entry_list_1(p
):
13119 '''udp_entry_list : udp_comb_entry_list '''
13121 print('udp_entry_list_1', list(p
))
13127 def p_udp_entry_list_2(p
):
13128 '''udp_entry_list : udp_sequ_entry_list '''
13130 print('udp_entry_list_2', list(p
))
13136 def p_udp_comb_entry_1(p
):
13137 '''udp_comb_entry : udp_input_list ':' udp_output_sym ';' '''
13139 print('udp_comb_entry_1', list(p
))
13142 # { char*tmp = new char[strlen(p[1])+3];
13143 # strcpy(tmp, p[1]);
13144 # char*tp = tmp+strlen(tmp);
13154 def p_udp_comb_entry_list_1(p
):
13155 '''udp_comb_entry_list : udp_comb_entry '''
13157 print('udp_comb_entry_list_1', list(p
))
13160 # { list<string>*tmp = new list<string>;
13161 # tmp->push_back(p[1]);
13168 def p_udp_comb_entry_list_2(p
):
13169 '''udp_comb_entry_list : udp_comb_entry_list udp_comb_entry '''
13171 print('udp_comb_entry_list_2', list(p
))
13174 # { list<string>*tmp = p[1];
13175 # tmp->push_back(p[2]);
13182 def p_udp_sequ_entry_list_1(p
):
13183 '''udp_sequ_entry_list : udp_sequ_entry '''
13185 print('udp_sequ_entry_list_1', list(p
))
13188 # { list<string>*tmp = new list<string>;
13189 # tmp->push_back(p[1]);
13196 def p_udp_sequ_entry_list_2(p
):
13197 '''udp_sequ_entry_list : udp_sequ_entry_list udp_sequ_entry '''
13199 print('udp_sequ_entry_list_2', list(p
))
13202 # { list<string>*tmp = p[1];
13203 # tmp->push_back(p[2]);
13210 def p_udp_sequ_entry_1(p
):
13211 '''udp_sequ_entry : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' '''
13213 print('udp_sequ_entry_1', list(p
))
13216 # { char*tmp = new char[strlen(p[1])+5];
13217 # strcpy(tmp, p[1]);
13218 # char*tp = tmp+strlen(tmp);
13229 def p_udp_initial_1(p
):
13230 '''udp_initial : K_initial IDENTIFIER '=' number ';' '''
13232 print('udp_initial_1', list(p
))
13235 # { PExpr*etmp = new PENumber(p[4]);
13236 # PEIdent*itmp = new PEIdent(lex_strings.make(p[2]));
13237 # PAssign*atmp = new PAssign(itmp, etmp);
13238 # FILE_NAME(atmp, @2);
13245 def p_udp_init_opt_1(p
):
13246 '''udp_init_opt : udp_initial '''
13248 print('udp_init_opt_1', list(p
))
13255 def p_udp_init_opt_2(p
):
13256 '''udp_init_opt : '''
13258 print('udp_init_opt_2', list(p
))
13265 def p_udp_input_list_1(p
):
13266 '''udp_input_list : udp_input_sym '''
13268 print('udp_input_list_1', list(p
))
13271 # { char*tmp = new char[2];
13279 def p_udp_input_list_2(p
):
13280 '''udp_input_list : udp_input_list udp_input_sym '''
13282 print('udp_input_list_2', list(p
))
13285 # { char*tmp = new char[strlen(p[1])+2];
13286 # strcpy(tmp, p[1]);
13287 # char*tp = tmp+strlen(tmp);
13296 def p_udp_input_sym_1(p
):
13297 '''udp_input_sym : '0' '''
13299 print('udp_input_sym_1', list(p
))
13306 def p_udp_input_sym_2(p
):
13307 '''udp_input_sym : '1' '''
13309 print('udp_input_sym_2', list(p
))
13316 def p_udp_input_sym_3(p
):
13317 '''udp_input_sym : 'x' '''
13319 print('udp_input_sym_3', list(p
))
13326 def p_udp_input_sym_4(p
):
13327 '''udp_input_sym : '?' '''
13329 print('udp_input_sym_4', list(p
))
13336 def p_udp_input_sym_5(p
):
13337 '''udp_input_sym : 'b' '''
13339 print('udp_input_sym_5', list(p
))
13346 def p_udp_input_sym_6(p
):
13347 '''udp_input_sym : '*' '''
13349 print('udp_input_sym_6', list(p
))
13356 def p_udp_input_sym_7(p
):
13357 '''udp_input_sym : '%' '''
13359 print('udp_input_sym_7', list(p
))
13366 def p_udp_input_sym_8(p
):
13367 '''udp_input_sym : 'f' '''
13369 print('udp_input_sym_8', list(p
))
13376 def p_udp_input_sym_9(p
):
13377 '''udp_input_sym : 'F' '''
13379 print('udp_input_sym_9', list(p
))
13386 def p_udp_input_sym_10(p
):
13387 '''udp_input_sym : 'l' '''
13389 print('udp_input_sym_10', list(p
))
13396 def p_udp_input_sym_11(p
):
13397 '''udp_input_sym : 'h' '''
13399 print('udp_input_sym_11', list(p
))
13406 def p_udp_input_sym_12(p
):
13407 '''udp_input_sym : 'B' '''
13409 print('udp_input_sym_12', list(p
))
13416 def p_udp_input_sym_13(p
):
13417 '''udp_input_sym : 'r' '''
13419 print('udp_input_sym_13', list(p
))
13426 def p_udp_input_sym_14(p
):
13427 '''udp_input_sym : 'R' '''
13429 print('udp_input_sym_14', list(p
))
13436 def p_udp_input_sym_15(p
):
13437 '''udp_input_sym : 'M' '''
13439 print('udp_input_sym_15', list(p
))
13446 def p_udp_input_sym_16(p
):
13447 '''udp_input_sym : 'n' '''
13449 print('udp_input_sym_16', list(p
))
13456 def p_udp_input_sym_17(p
):
13457 '''udp_input_sym : 'N' '''
13459 print('udp_input_sym_17', list(p
))
13466 def p_udp_input_sym_18(p
):
13467 '''udp_input_sym : 'p' '''
13469 print('udp_input_sym_18', list(p
))
13476 def p_udp_input_sym_19(p
):
13477 '''udp_input_sym : 'P' '''
13479 print('udp_input_sym_19', list(p
))
13486 def p_udp_input_sym_20(p
):
13487 '''udp_input_sym : 'Q' '''
13489 print('udp_input_sym_20', list(p
))
13496 def p_udp_input_sym_21(p
):
13497 '''udp_input_sym : 'q' '''
13499 print('udp_input_sym_21', list(p
))
13506 def p_udp_input_sym_22(p
):
13507 '''udp_input_sym : '_' '''
13509 print('udp_input_sym_22', list(p
))
13516 def p_udp_input_sym_23(p
):
13517 '''udp_input_sym : '+' '''
13519 print('udp_input_sym_23', list(p
))
13526 def p_udp_input_sym_24(p
):
13527 '''udp_input_sym : DEC_NUMBER '''
13529 print('udp_input_sym_24', list(p
))
13532 # { yyerror(@1, "internal error: Input digits parse as decimal number!"); p[0] = '0'; }
13536 def p_udp_output_sym_1(p
):
13537 '''udp_output_sym : '0' '''
13539 print('udp_output_sym_1', list(p
))
13546 def p_udp_output_sym_2(p
):
13547 '''udp_output_sym : '1' '''
13549 print('udp_output_sym_2', list(p
))
13556 def p_udp_output_sym_3(p
):
13557 '''udp_output_sym : 'x' '''
13559 print('udp_output_sym_3', list(p
))
13566 def p_udp_output_sym_4(p
):
13567 '''udp_output_sym : '-' '''
13569 print('udp_output_sym_4', list(p
))
13576 def p_udp_output_sym_5(p
):
13577 '''udp_output_sym : DEC_NUMBER '''
13579 print('udp_output_sym_5', list(p
))
13582 # { yyerror(@1, "internal error: Output digits parse as decimal number!"); p[0] = '0'; }
13586 def p_udp_port_decl_1(p
):
13587 '''udp_port_decl : K_input list_of_identifiers ';' '''
13589 print('udp_port_decl_1', list(p
))
13592 # { p[0] = pform_make_udp_input_ports(p[2]); }
13596 def p_udp_port_decl_2(p
):
13597 '''udp_port_decl : K_output IDENTIFIER ';' '''
13599 print('udp_port_decl_2', list(p
))
13602 # { perm_string pname = lex_strings.make(p[2]);
13603 # PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
13604 # vector<PWire*>*tmp = new vector<PWire*>(1);
13612 def p_udp_port_decl_3(p
):
13613 '''udp_port_decl : K_reg IDENTIFIER ';' '''
13615 print('udp_port_decl_3', list(p
))
13618 # { perm_string pname = lex_strings.make(p[2]);
13619 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
13620 # vector<PWire*>*tmp = new vector<PWire*>(1);
13628 def p_udp_port_decl_4(p
):
13629 '''udp_port_decl : K_reg K_output IDENTIFIER ';' '''
13631 print('udp_port_decl_4', list(p
))
13634 # { perm_string pname = lex_strings.make(p[3]);
13635 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
13636 # vector<PWire*>*tmp = new vector<PWire*>(1);
13644 def p_udp_port_decls_1(p
):
13645 '''udp_port_decls : udp_port_decl '''
13647 print('udp_port_decls_1', list(p
))
13654 def p_udp_port_decls_2(p
):
13655 '''udp_port_decls : udp_port_decls udp_port_decl '''
13657 print('udp_port_decls_2', list(p
))
13660 # { vector<PWire*>*tmp = p[1];
13661 # size_t s1 = p[1]->size();
13662 # tmp->resize(s1+p[2]->size());
13663 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
13664 # tmp->at(s1+idx) = p[2]->at(idx);
13671 def p_udp_port_list_1(p
):
13672 '''udp_port_list : IDENTIFIER '''
13674 print('udp_port_list_1', list(p
))
13677 # { list<perm_string>*tmp = new list<perm_string>;
13678 # tmp->push_back(lex_strings.make(p[1]));
13685 def p_udp_port_list_2(p
):
13686 '''udp_port_list : udp_port_list ',' IDENTIFIER '''
13688 print('udp_port_list_2', list(p
))
13691 # { list<perm_string>*tmp = p[1];
13692 # tmp->push_back(lex_strings.make(p[3]));
13699 def p_udp_reg_opt_1(p
):
13700 '''udp_reg_opt : K_reg '''
13702 print('udp_reg_opt_1', list(p
))
13709 def p_udp_reg_opt_2(p
):
13710 '''udp_reg_opt : '''
13712 print('udp_reg_opt_2', list(p
))
13719 def p_udp_initial_expr_opt_1(p
):
13720 '''udp_initial_expr_opt : '=' expression '''
13722 print('udp_initial_expr_opt_1', list(p
))
13729 def p_udp_initial_expr_opt_2(p
):
13730 '''udp_initial_expr_opt : '''
13732 print('udp_initial_expr_opt_2', list(p
))
13739 def p_udp_input_declaration_list_1(p
):
13740 '''udp_input_declaration_list : K_input IDENTIFIER '''
13742 print('udp_input_declaration_list_1', list(p
))
13745 # { list<perm_string>*tmp = new list<perm_string>;
13746 # tmp->push_back(lex_strings.make(p[2]));
13753 def p_udp_input_declaration_list_2(p
):
13754 '''udp_input_declaration_list : udp_input_declaration_list ',' K_input IDENTIFIER '''
13756 print('udp_input_declaration_list_2', list(p
))
13759 # { list<perm_string>*tmp = p[1];
13760 # tmp->push_back(lex_strings.make(p[4]));
13767 def p_udp_primitive_1(p
):
13768 '''udp_primitive : K_primitive IDENTIFIER '(' udp_port_list ')' ';' udp_port_decls udp_init_opt udp_body K_endprimitive endlabel_opt '''
13770 print('udp_primitive_1', list(p
))
13773 # { perm_string tmp2 = lex_strings.make(p[2]);
13774 # pform_make_udp(tmp2, p[4], p[7], p[9], p[8],
13775 # @2.text, @2.first_line);
13777 # if (strcmp(p[2],p[11]) != 0) {
13778 # yyerror(@11, "error: End label doesn't match "
13779 # "primitive name");
13781 # if (! gn_system_verilog()) {
13782 # yyerror(@11, "error: Primitive end labels "
13783 # "require SystemVerilog.");
13792 def p_udp_primitive_2(p
):
13793 '''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 '''
13795 print('udp_primitive_2', list(p
))
13798 # { perm_string tmp2 = lex_strings.make(p[2]);
13799 # perm_string tmp6 = lex_strings.make(p[6]);
13800 # pform_make_udp(tmp2, p[5], tmp6, p[7], p[9], p[12],
13801 # @2.text, @2.first_line);
13803 # if (strcmp(p[2],p[14]) != 0) {
13804 # yyerror(@14, "error: End label doesn't match "
13805 # "primitive name");
13807 # if (! gn_system_verilog()) {
13808 # yyerror(@14, "error: Primitive end labels "
13809 # "require SystemVerilog.");
13819 def p_K_packed_opt_1(p
):
13820 '''K_packed_opt : K_packed '''
13822 print('K_packed_opt', list(p
))
13829 def p_K_packed_opt_2(p
):
13830 '''K_packed_opt : '''
13832 print('K_packed_opt', list(p
))
13839 def p_K_reg_opt_1(p
):
13840 '''K_reg_opt : K_reg '''
13842 print('K_reg_opt', list(p
))
13849 def p_K_reg_opt_2(p
):
13852 print('K_reg_opt', list(p
))
13859 def p_K_static_opt_1(p
):
13860 '''K_static_opt : K_static '''
13862 print('K_static_opt', list(p
))
13869 def p_K_static_opt_2(p
):
13870 '''K_static_opt : '''
13872 print('K_static_opt', list(p
))
13879 def p_K_virtual_opt_1(p
):
13880 '''K_virtual_opt : K_virtual '''
13889 def p_K_virtual_opt_2(p
):
13890 '''K_virtual_opt : '''