6a153fffe282fa2aafa6f7a762e98809ef11656e
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
))
2354 # { p[0] = p[1]; based_size = 0;}
2359 '''number : DEC_NUMBER '''
2361 print('number_2', list(p
))
2362 num
= Leaf(token
.NUMBER
, "%s" % (p
[1]))
2366 # { p[0] = p[1]; based_size = 0;}
2371 '''number : DEC_NUMBER BASED_NUMBER '''
2373 print('number_3', list(p
))
2374 num
= Leaf(token
.NUMBER
, "%s:%s" % (p
[1], p
[2]))
2378 # { p[0] = pform_verinum_with_size(p[1],p[2], @2.text, @2.first_line);
2384 '''number : UNBASED_NUMBER '''
2386 print('number_4', list(p
))
2389 # { p[0] = p[1]; based_size = 0;}
2394 '''number : DEC_NUMBER UNBASED_NUMBER '''
2396 print('number_5', list(p
))
2399 # { yyerror(@1, "error: Unbased SystemVerilog literal cannot have "
2401 # p[0] = p[1]; based_size = 0;}
2405 def p_open_range_list_1(p
):
2406 '''open_range_list : open_range_list ',' value_range '''
2408 print('open_range_list_1', list(p
))
2414 def p_open_range_list_2(p
):
2415 '''open_range_list : value_range '''
2417 print('open_range_list_2', list(p
))
2423 def p_package_declaration_1(p
):
2424 '''package_declaration : K_package lifetime_opt IDENTIFIER ';' _embed0_package_declaration timeunits_declaration_opt _embed1_package_declaration package_item_list_opt K_endpackage endlabel_opt '''
2426 print('package_declaration_1', list(p
))
2429 # { pform_end_package_declaration(@1);
2430 # // If an end label is present make sure it match the package name.
2432 # if (strcmp(p[3],p[10]) != 0) {
2433 # yyerror(@10, "error: End label doesn't match package name");
2442 def p__embed0_package_declaration(p
):
2443 '''_embed0_package_declaration : '''
2446 # { pform_start_package_declaration(@1, p[3], p[2]); }
2450 def p__embed1_package_declaration(p
):
2451 '''_embed1_package_declaration : '''
2454 # { pform_set_scope_timescale(@1); }
2458 def p_module_package_import_list_opt_1(p
):
2459 '''module_package_import_list_opt : '''
2460 if(parse_debug
> 1):
2461 print('module_package_import_list_opt_1', list(p
))
2467 def p_module_package_import_list_opt_2(p
):
2468 '''module_package_import_list_opt : package_import_list '''
2470 print('module_package_import_list_opt_2', list(p
))
2476 def p_package_import_list_1(p
):
2477 '''package_import_list : package_import_declaration '''
2479 print('package_import_list_1', list(p
))
2485 def p_package_import_list_2(p
):
2486 '''package_import_list : package_import_list package_import_declaration '''
2488 print('package_import_list_2', list(p
))
2494 def p_package_import_declaration_1(p
):
2495 '''package_import_declaration : K_import package_import_item_list ';' '''
2497 print('package_import_declaration_1', list(p
))
2504 def p_package_import_item_1(p
):
2505 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '''
2507 print('package_import_item_1', list(p
))
2510 # { pform_package_import(@2, p[1], p[3]);
2516 def p_package_import_item_2(p
):
2517 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES '*' '''
2519 print('package_import_item_2', list(p
))
2522 # { pform_package_import(@2, p[1], 0);
2527 def p_package_import_item_list_1(p
):
2528 '''package_import_item_list : package_import_item_list ',' package_import_item '''
2530 print('package_import_item_list_1', list(p
))
2536 def p_package_import_item_list_2(p
):
2537 '''package_import_item_list : package_import_item '''
2539 print('package_import_item_list_2', list(p
))
2545 def p_package_item_1(p
):
2546 '''package_item : timeunits_declaration '''
2548 print('package_item_1', list(p
))
2554 def p_package_item_2(p
):
2555 '''package_item : K_parameter param_type parameter_assign_list ';' '''
2557 print('package_item_2', list(p
))
2563 def p_package_item_3(p
):
2564 '''package_item : K_localparam param_type localparam_assign_list ';' '''
2566 print('package_item_3', list(p
))
2572 def p_package_item_4(p
):
2573 '''package_item : type_declaration '''
2575 print('package_item_4', list(p
))
2581 def p_package_item_5(p
):
2582 '''package_item : function_declaration '''
2584 print('package_item_5', list(p
))
2590 def p_package_item_6(p
):
2591 '''package_item : task_declaration '''
2593 print('package_item_6', list(p
))
2599 def p_package_item_7(p
):
2600 '''package_item : data_declaration '''
2602 print('package_item_7', list(p
))
2608 def p_package_item_8(p
):
2609 '''package_item : class_declaration '''
2611 print('package_item_8', list(p
))
2617 def p_package_item_list_1(p
):
2618 '''package_item_list : package_item_list package_item '''
2620 print('package_item_list_1', list(p
))
2626 def p_package_item_list_2(p
):
2627 '''package_item_list : package_item '''
2629 print('package_item_list_2', list(p
))
2635 def p_package_item_list_opt_1(p
):
2636 '''package_item_list_opt : package_item_list '''
2638 print('package_item_list_opt_1', list(p
))
2644 def p_package_item_list_opt_2(p
):
2645 '''package_item_list_opt : '''
2647 print('package_item_list_opt_2', list(p
))
2653 def p_port_direction_1(p
):
2654 '''port_direction : K_input '''
2656 print('port_direction_1', list(p
))
2659 # { p[0] = NetNet::PINPUT; }
2663 def p_port_direction_2(p
):
2664 '''port_direction : K_output '''
2666 print('port_direction_2', list(p
))
2669 # { p[0] = NetNet::POUTPUT; }
2673 def p_port_direction_3(p
):
2674 '''port_direction : K_inout '''
2676 print('port_direction_3', list(p
))
2679 # { p[0] = NetNet::PINOUT; }
2683 def p_port_direction_4(p
):
2684 '''port_direction : K_ref '''
2686 print('port_direction_4', list(p
))
2689 # { p[0] = NetNet::PREF;
2690 # if (!gn_system_verilog()) {
2691 # yyerror(@1, "error: Reference ports (ref) require SystemVerilog.");
2692 # p[0] = NetNet::PINPUT;
2698 def p_port_direction_opt_1(p
):
2699 '''port_direction_opt : port_direction '''
2701 print('port_direction_opt_1', list(p
))
2708 def p_port_direction_opt_2(p
):
2709 '''port_direction_opt : '''
2711 print('port_direction_opt_2', list(p
))
2714 # { p[0] = NetNet::PIMPLICIT; }
2718 def p_property_expr_1(p
):
2719 '''property_expr : expression '''
2721 print('property_expr_1', list(p
))
2727 def p_procedural_assertion_statement_1(p
):
2728 '''procedural_assertion_statement : K_assert '(' expression ')' statement %prec less_than_K_else '''
2730 print('procedural_assertion_statement_1', list(p
))
2733 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2739 def p_procedural_assertion_statement_2(p
):
2740 '''procedural_assertion_statement : K_assert '(' expression ')' K_else statement '''
2742 print('procedural_assertion_statement_2', list(p
))
2745 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2751 def p_procedural_assertion_statement_3(p
):
2752 '''procedural_assertion_statement : K_assert '(' expression ')' statement K_else statement '''
2754 print('procedural_assertion_statement_3', list(p
))
2757 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2763 def p_property_qualifier_1(p
):
2764 '''property_qualifier : class_item_qualifier '''
2766 print('property_qualifier_1', list(p
))
2772 def p_property_qualifier_2(p
):
2773 '''property_qualifier : random_qualifier '''
2775 print('property_qualifier_2', list(p
))
2781 def p_property_qualifier_opt_1(p
):
2782 '''property_qualifier_opt : property_qualifier_list '''
2784 print('property_qualifier_opt_1', list(p
))
2791 def p_property_qualifier_opt_2(p
):
2792 '''property_qualifier_opt : '''
2794 print('property_qualifier_opt_2', list(p
))
2797 # { p[0] = property_qualifier_t::make_none(); }
2801 def p_property_qualifier_list_1(p
):
2802 '''property_qualifier_list : property_qualifier_list property_qualifier '''
2804 print('property_qualifier_list_1', list(p
))
2807 # { p[0] = p[1] | p[2]; }
2811 def p_property_qualifier_list_2(p
):
2812 '''property_qualifier_list : property_qualifier '''
2814 print('property_qualifier_list_2', list(p
))
2821 def p_property_spec_1(p
):
2822 '''property_spec : clocking_event_opt property_spec_disable_iff_opt property_expr '''
2824 print('property_spec_1', list(p
))
2830 def p_property_spec_disable_iff_opt_1(p
):
2831 '''property_spec_disable_iff_opt : K_disable K_iff '(' expression ')' '''
2833 print('property_spec_disable_iff_opt_1', list(p
))
2839 def p_property_spec_disable_iff_opt_2(p
):
2840 '''property_spec_disable_iff_opt : '''
2842 print('property_spec_disable_iff_opt_2', list(p
))
2848 def p_random_qualifier_1(p
):
2849 '''random_qualifier : K_rand '''
2851 print('random_qualifier_1', list(p
))
2854 # { p[0] = property_qualifier_t::make_rand(); }
2858 def p_random_qualifier_2(p
):
2859 '''random_qualifier : K_randc '''
2861 print('random_qualifier_2', list(p
))
2864 # { p[0] = property_qualifier_t::make_randc(); }
2868 def p_real_or_realtime_1(p
):
2869 '''real_or_realtime : K_real '''
2871 print('real_or_realtime_1', list(p
))
2877 def p_real_or_realtime_2(p
):
2878 '''real_or_realtime : K_realtime '''
2880 print('real_or_realtime_2', list(p
))
2887 '''signing : K_signed '''
2889 print('signing_1', list(p
))
2897 '''signing : K_unsigned '''
2899 print('signing_2', list(p
))
2906 def p_simple_type_or_string_1(p
):
2907 '''simple_type_or_string : integer_vector_type '''
2909 print('simple_type_or_string_1', list(p
))
2912 # { ivl_variable_type_t use_vtype = p[1];
2913 # bool reg_flag = false;
2914 # if (use_vtype == IVL_VT_NO_TYPE) {
2915 # use_vtype = IVL_VT_LOGIC;
2918 # vector_type_t*tmp = new vector_type_t(use_vtype, false, 0);
2919 # tmp->reg_flag = reg_flag;
2920 # FILE_NAME(tmp, @1);
2926 def p_simple_type_or_string_2(p
):
2927 '''simple_type_or_string : non_integer_type '''
2929 print('simple_type_or_string_2', list(p
))
2932 # { real_type_t*tmp = new real_type_t(p[1]);
2933 # FILE_NAME(tmp, @1);
2939 def p_simple_type_or_string_3(p
):
2940 '''simple_type_or_string : atom2_type '''
2942 print('simple_type_or_string_3', list(p
))
2945 # { atom2_type_t*tmp = new atom2_type_t(p[1], true);
2946 # FILE_NAME(tmp, @1);
2952 def p_simple_type_or_string_4(p
):
2953 '''simple_type_or_string : K_integer '''
2955 print('simple_type_or_string_4', list(p
))
2958 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
2959 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd);
2960 # tmp->reg_flag = true;
2961 # tmp->integer_flag = true;
2967 def p_simple_type_or_string_5(p
):
2968 '''simple_type_or_string : K_time '''
2970 print('simple_type_or_string_5', list(p
))
2973 # { list<pform_range_t>*pd = make_range_from_width(64);
2974 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
2975 # tmp->reg_flag = !gn_system_verilog();
2981 def p_simple_type_or_string_6(p
):
2982 '''simple_type_or_string : TYPE_IDENTIFIER '''
2984 print('simple_type_or_string_6', list(p
))
2987 # { p[0] = p[1].type;
2988 # delete[]p[1].text;
2993 def p_simple_type_or_string_7(p
):
2994 '''simple_type_or_string : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_simple_type_or_string TYPE_IDENTIFIER '''
2996 print('simple_type_or_string_7', list(p
))
2999 # { lex_in_package_scope(0);
3001 # delete[]p[4].text;
3006 def p_simple_type_or_string_8(p
):
3007 '''simple_type_or_string : K_string '''
3009 print('simple_type_or_string_8', list(p
))
3012 # { string_type_t*tmp = new string_type_t;
3013 # FILE_NAME(tmp, @1);
3019 def p__embed0_simple_type_or_string(p
):
3020 '''_embed0_simple_type_or_string : '''
3023 # { lex_in_package_scope(p[1]); }
3027 def p_statement_1(p
):
3028 '''statement : attribute_list_opt statement_item '''
3030 print('statement_1', list(p
))
3032 # { pform_bind_attributes(p[2]->attributes, p[1]);
3039 def p_statement_or_null_1(p
):
3040 '''statement_or_null : statement '''
3042 print('statement_or_null_1', list(p
))
3049 def p_statement_or_null_2(p
):
3050 '''statement_or_null : attribute_list_opt ';' '''
3052 print('statement_or_null_2', list(p
))
3054 raise(Exception("p_statement_or_null_2"))
3061 def p_stream_expression_1(p
):
3062 '''stream_expression : expression '''
3064 print('stream_expression_1', list(p
))
3070 def p_stream_expression_list_1(p
):
3071 '''stream_expression_list : stream_expression_list ',' stream_expression '''
3073 print('stream_expression_list_1', list(p
))
3079 def p_stream_expression_list_2(p
):
3080 '''stream_expression_list : stream_expression '''
3082 print('stream_expression_list_2', list(p
))
3088 def p_stream_operator_1(p
):
3089 '''stream_operator : K_LS '''
3091 print('stream_operator_1', list(p
))
3097 def p_stream_operator_2(p
):
3098 '''stream_operator : K_RS '''
3100 print('stream_operator_2', list(p
))
3106 def p_streaming_concatenation_1(p
):
3107 '''streaming_concatenation : '{' stream_operator '{' stream_expression_list '}' '}' '''
3109 print('streaming_concatenation_1', list(p
))
3112 # { /* streaming concatenation is a SystemVerilog thing. */
3113 # if (gn_system_verilog()) {
3114 # yyerror(@2, "sorry: Streaming concatenation not supported.");
3117 # yyerror(@2, "error: Streaming concatenation requires SystemVerilog");
3124 def p_task_declaration_1(p
):
3125 '''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 '''
3127 print('task_declaration_1', list(p
))
3130 # { // Last step: check any closing name. This is done late so
3131 # // that the parser can look ahead to detect the present
3132 # // endlabel_opt but still have the pform_endmodule() called
3133 # // early enough that the lexor can know we are outside the
3136 # if (strcmp(p[3],p[10]) != 0) {
3137 # yyerror(@10, "error: End label doesn't match task name");
3139 # if (! gn_system_verilog()) {
3140 # yyerror(@10, "error: Task end labels require "
3141 # "SystemVerilog.");
3150 def p_task_declaration_2(p
):
3151 '''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 '''
3153 print('task_declaration_2', list(p
))
3156 # { // Last step: check any closing name. This is done late so
3157 # // that the parser can look ahead to detect the present
3158 # // endlabel_opt but still have the pform_endmodule() called
3159 # // early enough that the lexor can know we are outside the
3162 # if (strcmp(p[3],p[13]) != 0) {
3163 # yyerror(@13, "error: End label doesn't match task name");
3165 # if (! gn_system_verilog()) {
3166 # yyerror(@13, "error: Task end labels require "
3167 # "SystemVerilog.");
3176 def p_task_declaration_3(p
):
3177 '''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 '''
3179 print('task_declaration_3', list(p
))
3182 # { // Last step: check any closing name. This is done late so
3183 # // that the parser can look ahead to detect the present
3184 # // endlabel_opt but still have the pform_endmodule() called
3185 # // early enough that the lexor can know we are outside the
3188 # if (strcmp(p[3],p[12]) != 0) {
3189 # yyerror(@12, "error: End label doesn't match task name");
3191 # if (! gn_system_verilog()) {
3192 # yyerror(@12, "error: Task end labels require "
3193 # "SystemVerilog.");
3202 def p_task_declaration_4(p
):
3203 '''task_declaration : K_task lifetime_opt IDENTIFIER error K_endtask _embed6_task_declaration endlabel_opt '''
3205 print('task_declaration_4', list(p
))
3208 # { // Last step: check any closing name. This is done late so
3209 # // that the parser can look ahead to detect the present
3210 # // endlabel_opt but still have the pform_endmodule() called
3211 # // early enough that the lexor can know we are outside the
3214 # if (strcmp(p[3],p[7]) != 0) {
3215 # yyerror(@7, "error: End label doesn't match task name");
3217 # if (! gn_system_verilog()) {
3218 # yyerror(@7, "error: Task end labels require "
3219 # "SystemVerilog.");
3228 def p__embed0_task_declaration(p
):
3229 '''_embed0_task_declaration : '''
3232 # { assert(current_task == 0);
3233 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3238 def p__embed1_task_declaration(p
):
3239 '''_embed1_task_declaration : '''
3242 # { current_task->set_ports(p[6]);
3243 # current_task_set_statement(@3, p[7]);
3244 # pform_set_this_class(@3, current_task);
3245 # pform_pop_scope();
3247 # if (p[7] && p[7]->size() > 1 && !gn_system_verilog()) {
3248 # yyerror(@7, "error: Task body with multiple statements requires SystemVerilog.");
3255 def p__embed2_task_declaration(p
):
3256 '''_embed2_task_declaration : '''
3259 # { assert(current_task == 0);
3260 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3265 def p__embed3_task_declaration(p
):
3266 '''_embed3_task_declaration : '''
3269 # { current_task->set_ports(p[6]);
3270 # current_task_set_statement(@3, p[10]);
3271 # pform_set_this_class(@3, current_task);
3272 # pform_pop_scope();
3274 # if (p[10]) delete p[10];
3279 def p__embed4_task_declaration(p
):
3280 '''_embed4_task_declaration : '''
3283 # { assert(current_task == 0);
3284 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3289 def p__embed5_task_declaration(p
):
3290 '''_embed5_task_declaration : '''
3293 # { current_task->set_ports(0);
3294 # current_task_set_statement(@3, p[9]);
3295 # pform_set_this_class(@3, current_task);
3296 # if (! current_task->method_of()) {
3297 # cerr << @3 << ": warning: task definition for \"" << p[3]
3298 # << "\" has an empty port declaration list!" << endl;
3300 # pform_pop_scope();
3302 # if (p[9]->size() > 1 && !gn_system_verilog()) {
3303 # yyerror(@9, "error: Task body with multiple statements requires SystemVerilog.");
3310 def p__embed6_task_declaration(p
):
3311 '''_embed6_task_declaration : '''
3315 # if (current_task) {
3316 # pform_pop_scope();
3323 def p_tf_port_declaration_1(p
):
3324 '''tf_port_declaration : port_direction K_reg_opt unsigned_signed_opt dimensions_opt list_of_identifiers ';' '''
3326 print('tf_port_declaration_1', list(p
))
3329 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1],
3330 # p[2] ? IVL_VT_LOGIC :
3332 # p[3], p[4], p[5]);
3338 def p_tf_port_declaration_2(p
):
3339 '''tf_port_declaration : port_direction K_integer list_of_identifiers ';' '''
3341 print('tf_port_declaration_2', list(p
))
3344 # { list<pform_range_t>*range_stub = make_range_from_width(integer_width);
3345 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, true,
3346 # range_stub, p[3], true);
3352 def p_tf_port_declaration_3(p
):
3353 '''tf_port_declaration : port_direction K_time list_of_identifiers ';' '''
3355 print('tf_port_declaration_3', list(p
))
3358 # { list<pform_range_t>*range_stub = make_range_from_width(64);
3359 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, false,
3360 # range_stub, p[3]);
3366 def p_tf_port_declaration_4(p
):
3367 '''tf_port_declaration : port_direction real_or_realtime list_of_identifiers ';' '''
3369 print('tf_port_declaration_4', list(p
))
3372 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_REAL, true,
3379 def p_tf_port_declaration_5(p
):
3380 '''tf_port_declaration : port_direction K_string list_of_identifiers ';' '''
3382 print('tf_port_declaration_5', list(p
))
3385 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_STRING, true,
3392 def p_tf_port_item_1(p
):
3393 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER dimensions_opt tf_port_item_expr_opt '''
3395 print('tf_port_item_1', list(p
))
3398 # { vector<pform_tf_port_t>*tmp;
3399 # NetNet::PortType use_port_type = p[1];
3400 # if ((use_port_type == NetNet::PIMPLICIT) && (gn_system_verilog() || (p[2] == 0)))
3401 # use_port_type = port_declaration_context.port_type;
3402 # perm_string name = lex_strings.make(p[3]);
3403 # list<perm_string>* ilist = list_from_identifier(p[3]);
3405 # if (use_port_type == NetNet::PIMPLICIT) {
3406 # yyerror(@1, "error: missing task/function port direction.");
3407 # use_port_type = NetNet::PINPUT; // for error recovery
3409 # if ((p[2] == 0) && (p[1]==NetNet::PIMPLICIT)) {
3410 # // Detect special case this is an undecorated
3411 # // identifier and we need to get the declaration from
3414 # yyerror(@4, "internal error: How can there be an unpacked range here?\n");
3416 # tmp = pform_make_task_ports(@3, use_port_type,
3417 # port_declaration_context.data_type,
3421 # // Otherwise, the decorations for this identifier
3422 # // indicate the type. Save the type for any right
3423 # // context that may come later.
3424 # port_declaration_context.port_type = use_port_type;
3426 # p[2] = new vector_type_t(IVL_VT_LOGIC, false, 0);
3427 # FILE_NAME(p[2], @3);
3429 # port_declaration_context.data_type = p[2];
3430 # tmp = pform_make_task_ports(@3, use_port_type, p[2], ilist);
3433 # pform_set_reg_idx(name, p[4]);
3438 # assert(tmp->size()==1);
3439 # tmp->front().defe = p[5];
3445 def p_tf_port_item_2(p
):
3446 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER error '''
3448 print('tf_port_item_2', list(p
))
3451 # { yyerror(@3, "error: Error in task/function port item after port name %s.", p[3]);
3458 def p_tf_port_item_expr_opt_1(p
):
3459 '''tf_port_item_expr_opt : '=' expression '''
3461 print('tf_port_item_expr_opt_1', list(p
))
3464 # { if (! gn_system_verilog()) {
3465 # yyerror(@1, "error: Task/function default arguments require "
3466 # "SystemVerilog.");
3473 def p_tf_port_item_expr_opt_2(p
):
3474 '''tf_port_item_expr_opt : '''
3476 print('tf_port_item_expr_opt_2', list(p
))
3483 def p_tf_port_list_1(p
):
3484 '''tf_port_list : _embed0_tf_port_list tf_port_item_list '''
3486 print('tf_port_list_1', list(p
))
3493 def p__embed0_tf_port_list(p
):
3494 '''_embed0_tf_port_list : '''
3497 # { port_declaration_context.port_type = gn_system_verilog() ? NetNet::PINPUT : NetNet::PIMPLICIT;
3498 # port_declaration_context.data_type = 0;
3503 def p_tf_port_item_list_1(p
):
3504 '''tf_port_item_list : tf_port_item_list ',' tf_port_item '''
3506 print('tf_port_item_list_1', list(p
))
3509 # { vector<pform_tf_port_t>*tmp;
3510 # if (p[1] && p[3]) {
3511 # size_t s1 = p[1]->size();
3513 # tmp->resize(tmp->size()+p[3]->size());
3514 # for (size_t idx = 0 ; idx < p[3]->size() ; idx += 1)
3515 # tmp->at(s1+idx) = p[3]->at(idx);
3517 # } else if (p[1]) {
3527 def p_tf_port_item_list_2(p
):
3528 '''tf_port_item_list : tf_port_item '''
3530 print('tf_port_item_list_2', list(p
))
3537 def p_tf_port_item_list_3(p
):
3538 '''tf_port_item_list : error ',' tf_port_item '''
3540 print('tf_port_item_list_3', list(p
))
3543 # { yyerror(@2, "error: Syntax error in task/function port declaration.");
3549 def p_tf_port_item_list_4(p
):
3550 '''tf_port_item_list : tf_port_item_list ',' '''
3552 print('tf_port_item_list_4', list(p
))
3555 # { yyerror(@2, "error: NULL port declarations are not allowed.");
3561 def p_tf_port_item_list_5(p
):
3562 '''tf_port_item_list : tf_port_item_list ';' '''
3564 print('tf_port_item_list_5', list(p
))
3567 # { yyerror(@2, "error: ';' is an invalid port declaration separator.");
3573 def p_timeunits_declaration_1(p
):
3574 '''timeunits_declaration : K_timeunit TIME_LITERAL ';' '''
3576 print('timeunits_declaration_1', list(p
))
3579 # { pform_set_timeunit(p[2], allow_timeunit_decl); }
3583 def p_timeunits_declaration_2(p
):
3584 '''timeunits_declaration : K_timeunit TIME_LITERAL '/' TIME_LITERAL ';' '''
3586 print('timeunits_declaration_2', list(p
))
3589 # { bool initial_decl = allow_timeunit_decl && allow_timeprec_decl;
3590 # pform_set_timeunit(p[2], initial_decl);
3591 # pform_set_timeprec(p[4], initial_decl);
3596 def p_timeunits_declaration_3(p
):
3597 '''timeunits_declaration : K_timeprecision TIME_LITERAL ';' '''
3599 print('timeunits_declaration_3', list(p
))
3602 # { pform_set_timeprec(p[2], allow_timeprec_decl); }
3606 def p_timeunits_declaration_opt_1(p
):
3607 '''timeunits_declaration_opt : %prec no_timeunits_declaration '''
3608 if(parse_debug
> 2):
3609 print('timeunits_declaration_opt_1', list(p
))
3615 def p_timeunits_declaration_opt_2(p
):
3616 '''timeunits_declaration_opt : timeunits_declaration %prec one_timeunits_declaration '''
3618 print('timeunits_declaration_opt_2', list(p
))
3624 def p_timeunits_declaration_opt_3(p
):
3625 '''timeunits_declaration_opt : timeunits_declaration timeunits_declaration '''
3627 print('timeunits_declaration_opt_3', list(p
))
3633 def p_value_range_1(p
):
3634 '''value_range : expression '''
3636 print('value_range_1', list(p
))
3643 def p_value_range_2(p
):
3644 '''value_range : '[' expression ':' expression ']' '''
3646 print('value_range_2', list(p
))
3653 def p_variable_dimension_1(p
):
3654 '''variable_dimension : '[' expression ':' expression ']' '''
3656 print('variable_dimension_1', list(p
))
3657 # { list<pform_range_t> *tmp = new list<pform_range_t>;
3658 # pform_range_t index (p[2],p[4]);
3659 # tmp->push_back(index);
3662 # XXX TODO: subscriptlist
3665 if end
.endswith("-1"):
3668 end
= str(int(end
)+1)
3671 p
[0] = '[%s:%s]' % (start
, end
) # python slice is LO:HI+1
3677 def p_variable_dimension_2(p
):
3678 '''variable_dimension : '[' expression ']' '''
3680 print('variable_dimension_2', list(p
))
3683 # { // SystemVerilog canonical range
3684 # if (!gn_system_verilog()) {
3686 # cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. "
3687 # << "Use at least -g2005-sv to remove this warning." << endl;
3689 # list<pform_range_t> *tmp = new list<pform_range_t>;
3690 # pform_range_t index;
3691 # index.first = new PENumber(new verinum((uint64_t)0, integer_width));
3692 # index.second = new PEBinary('-', p[2], new PENumber(new verinum((uint64_t)1, integer_width)));
3693 # tmp->push_back(index);
3699 def p_variable_dimension_3(p
):
3700 '''variable_dimension : '[' ']' '''
3702 print('variable_dimension_3', list(p
))
3705 # { list<pform_range_t> *tmp = new list<pform_range_t>;
3706 # pform_range_t index (0,0);
3707 # tmp->push_back(index);
3713 def p_variable_dimension_4(p
):
3714 '''variable_dimension : '[' '$' ']' '''
3716 print('variable_dimension_4', list(p
))
3719 # { // SystemVerilog queue
3720 # list<pform_range_t> *tmp = new list<pform_range_t>;
3721 # pform_range_t index (new PENull,0);
3722 # if (!gn_system_verilog()) {
3723 # yyerror("error: Queue declarations require SystemVerilog.");
3725 # tmp->push_back(index);
3731 def p_variable_lifetime_1(p
):
3732 '''variable_lifetime : lifetime '''
3734 print('variable_lifetime_1', list(p
))
3737 # { if (!gn_system_verilog()) {
3738 # yyerror(@1, "error: overriding the default variable lifetime "
3739 # "requires SystemVerilog.");
3740 # } else if (p[1] != pform_peek_scope()->default_lifetime) {
3741 # yyerror(@1, "sorry: overriding the default variable lifetime "
3742 # "is not yet supported.");
3744 # var_lifetime = p[1];
3749 def p_attribute_list_opt_1(p
):
3750 '''attribute_list_opt : attribute_instance_list '''
3752 print('attribute_list_opt_1', list(p
))
3759 def p_attribute_list_opt_2(p
):
3760 '''attribute_list_opt : '''
3761 if(parse_debug
> 2):
3762 print('attribute_list_opt_2', list(p
))
3769 def p_attribute_instance_list_1(p
):
3770 '''attribute_instance_list : K_PSTAR K_STARP '''
3772 print('attribute_instance_list_1', list(p
))
3779 def p_attribute_instance_list_2(p
):
3780 '''attribute_instance_list : K_PSTAR attribute_list K_STARP '''
3782 print('attribute_instance_list_2', list(p
))
3789 def p_attribute_instance_list_3(p
):
3790 '''attribute_instance_list : attribute_instance_list K_PSTAR K_STARP '''
3792 print('attribute_instance_list_3', list(p
))
3799 def p_attribute_instance_list_4(p
):
3800 '''attribute_instance_list : attribute_instance_list K_PSTAR attribute_list K_STARP '''
3802 print('attribute_instance_list_4', list(p
))
3805 # { list<named_pexpr_t>*tmp = p[1];
3807 # tmp->splice(tmp->end(), *p[3]);
3810 # } else p[0] = p[3];
3815 def p_attribute_list_1(p
):
3816 '''attribute_list : attribute_list ',' attribute '''
3818 print('attribute_list_1', list(p
))
3821 # { list<named_pexpr_t>*tmp = p[1];
3822 # tmp->push_back(*p[3]);
3829 def p_attribute_list_2(p
):
3830 '''attribute_list : attribute '''
3832 print('attribute_list_2', list(p
))
3835 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
3836 # tmp->push_back(*p[1]);
3843 def p_attribute_1(p
):
3844 '''attribute : IDENTIFIER '''
3846 print('attribute_1', list(p
))
3849 # { named_pexpr_t*tmp = new named_pexpr_t;
3850 # tmp->name = lex_strings.make(p[1]);
3858 def p_attribute_2(p
):
3859 '''attribute : IDENTIFIER '=' expression '''
3861 print('attribute_2', list(p
))
3864 # { PExpr*tmp = p[3];
3865 # named_pexpr_t*tmp2 = new named_pexpr_t;
3866 # tmp2->name = lex_strings.make(p[1]);
3874 def p_block_item_decl_1(p
):
3875 '''block_item_decl : data_type register_variable_list ';' '''
3877 print('block_item_decl_1', list(p
))
3880 # { if (p[1]) pform_set_data_type(@1, p[1], p[2], NetNet::REG, attributes_in_context);
3885 def p_block_item_decl_2(p
):
3886 '''block_item_decl : variable_lifetime data_type register_variable_list ';' '''
3888 print('block_item_decl_2', list(p
))
3891 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
3892 # var_lifetime = LexicalScope::INHERITED;
3897 def p_block_item_decl_3(p
):
3898 '''block_item_decl : K_reg data_type register_variable_list ';' '''
3900 print('block_item_decl_3', list(p
))
3903 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
3908 def p_block_item_decl_4(p
):
3909 '''block_item_decl : variable_lifetime K_reg data_type register_variable_list ';' '''
3911 print('block_item_decl_4', list(p
))
3914 # { if (p[3]) pform_set_data_type(@3, p[3], p[4], NetNet::REG, attributes_in_context);
3915 # var_lifetime = LexicalScope::INHERITED;
3920 def p_block_item_decl_5(p
):
3921 '''block_item_decl : K_event event_variable_list ';' '''
3923 print('block_item_decl_5', list(p
))
3926 # { if (p[2]) pform_make_events(p[2], @1.text, @1.first_line);
3931 def p_block_item_decl_6(p
):
3932 '''block_item_decl : K_parameter param_type parameter_assign_list ';' '''
3934 print('block_item_decl_6', list(p
))
3940 def p_block_item_decl_7(p
):
3941 '''block_item_decl : K_localparam param_type localparam_assign_list ';' '''
3943 print('block_item_decl_7', list(p
))
3949 def p_block_item_decl_8(p
):
3950 '''block_item_decl : type_declaration '''
3952 print('block_item_decl_8', list(p
))
3958 def p_block_item_decl_9(p
):
3959 '''block_item_decl : K_integer error ';' '''
3961 print('block_item_decl_9', list(p
))
3964 # { yyerror(@1, "error: syntax error in integer variable list.");
3970 def p_block_item_decl_10(p
):
3971 '''block_item_decl : K_time error ';' '''
3973 print('block_item_decl_10', list(p
))
3976 # { yyerror(@1, "error: syntax error in time variable list.");
3982 def p_block_item_decl_11(p
):
3983 '''block_item_decl : K_parameter error ';' '''
3985 print('block_item_decl_11', list(p
))
3988 # { yyerror(@1, "error: syntax error in parameter list.");
3994 def p_block_item_decl_12(p
):
3995 '''block_item_decl : K_localparam error ';' '''
3997 print('block_item_decl_12', list(p
))
4000 # { yyerror(@1, "error: syntax error localparam list.");
4006 def p_block_item_decls_1(p
):
4007 '''block_item_decls : block_item_decl '''
4009 print('block_item_decls_1', list(p
))
4015 def p_block_item_decls_2(p
):
4016 '''block_item_decls : block_item_decls block_item_decl '''
4018 print('block_item_decls_2', list(p
))
4024 def p_block_item_decls_opt_1(p
):
4025 '''block_item_decls_opt : block_item_decls '''
4027 print('block_item_decls_opt_1', list(p
))
4034 def p_block_item_decls_opt_2(p
):
4035 '''block_item_decls_opt : '''
4037 print('block_item_decls_opt_2', list(p
))
4044 def p_type_declaration_1(p
):
4045 '''type_declaration : K_typedef data_type IDENTIFIER dimensions_opt ';' '''
4047 print('type_declaration_1', list(p
))
4050 # { perm_string name = lex_strings.make(p[3]);
4051 # pform_set_typedef(name, p[2], p[4]);
4057 def p_type_declaration_2(p
):
4058 '''type_declaration : K_typedef data_type TYPE_IDENTIFIER ';' '''
4060 print('type_declaration_2', list(p
))
4063 # { perm_string name = lex_strings.make(p[3].text);
4064 # if (pform_test_type_identifier_local(name)) {
4065 # yyerror(@3, "error: Typedef identifier \"%s\" is already a type name.", p[3].text);
4068 # pform_set_typedef(name, p[2], NULL);
4070 # delete[]p[3].text;
4075 def p_type_declaration_3(p
):
4076 '''type_declaration : K_typedef K_class IDENTIFIER ';' '''
4078 print('type_declaration_3', list(p
))
4081 # { // Create a synthetic typedef for the class name so that the
4082 # // lexor detects the name as a type.
4083 # perm_string name = lex_strings.make(p[3]);
4084 # class_type_t*tmp = new class_type_t(name);
4085 # FILE_NAME(tmp, @3);
4086 # pform_set_typedef(name, tmp, NULL);
4092 def p_type_declaration_4(p
):
4093 '''type_declaration : K_typedef K_enum IDENTIFIER ';' '''
4095 print('type_declaration_4', list(p
))
4098 # { yyerror(@1, "sorry: Enum forward declarations not supported yet."); }
4102 def p_type_declaration_5(p
):
4103 '''type_declaration : K_typedef K_struct IDENTIFIER ';' '''
4105 print('type_declaration_5', list(p
))
4108 # { yyerror(@1, "sorry: Struct forward declarations not supported yet."); }
4112 def p_type_declaration_6(p
):
4113 '''type_declaration : K_typedef K_union IDENTIFIER ';' '''
4115 print('type_declaration_6', list(p
))
4118 # { yyerror(@1, "sorry: Union forward declarations not supported yet."); }
4122 def p_type_declaration_7(p
):
4123 '''type_declaration : K_typedef IDENTIFIER ';' '''
4125 print('type_declaration_7', list(p
))
4128 # { // Create a synthetic typedef for the class name so that the
4129 # // lexor detects the name as a type.
4130 # perm_string name = lex_strings.make(p[2]);
4131 # class_type_t*tmp = new class_type_t(name);
4132 # FILE_NAME(tmp, @2);
4133 # pform_set_typedef(name, tmp, NULL);
4139 def p_type_declaration_8(p
):
4140 '''type_declaration : K_typedef error ';' '''
4142 print('type_declaration_8', list(p
))
4145 # { yyerror(@2, "error: Syntax error in typedef clause.");
4151 def p_enum_data_type_1(p
):
4152 '''enum_data_type : K_enum '{' enum_name_list '}' '''
4154 print('enum_data_type_1', list(p
))
4157 # { enum_type_t*enum_type = new enum_type_t;
4158 # FILE_NAME(enum_type, @1);
4159 # enum_type->names .reset(p[3]);
4160 # enum_type->base_type = IVL_VT_BOOL;
4161 # enum_type->signed_flag = true;
4162 # enum_type->integer_flag = false;
4163 # enum_type->range.reset(make_range_from_width(32));
4169 def p_enum_data_type_2(p
):
4170 '''enum_data_type : K_enum atom2_type signed_unsigned_opt '{' enum_name_list '}' '''
4172 print('enum_data_type_2', list(p
))
4175 # { enum_type_t*enum_type = new enum_type_t;
4176 # FILE_NAME(enum_type, @1);
4177 # enum_type->names .reset(p[5]);
4178 # enum_type->base_type = IVL_VT_BOOL;
4179 # enum_type->signed_flag = p[3];
4180 # enum_type->integer_flag = false;
4181 # enum_type->range.reset(make_range_from_width(p[2]));
4187 def p_enum_data_type_3(p
):
4188 '''enum_data_type : K_enum K_integer signed_unsigned_opt '{' enum_name_list '}' '''
4190 print('enum_data_type_3', list(p
))
4193 # { enum_type_t*enum_type = new enum_type_t;
4194 # FILE_NAME(enum_type, @1);
4195 # enum_type->names .reset(p[5]);
4196 # enum_type->base_type = IVL_VT_LOGIC;
4197 # enum_type->signed_flag = p[3];
4198 # enum_type->integer_flag = true;
4199 # enum_type->range.reset(make_range_from_width(integer_width));
4205 def p_enum_data_type_4(p
):
4206 '''enum_data_type : K_enum K_logic unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
4208 print('enum_data_type_4', list(p
))
4211 # { enum_type_t*enum_type = new enum_type_t;
4212 # FILE_NAME(enum_type, @1);
4213 # enum_type->names .reset(p[6]);
4214 # enum_type->base_type = IVL_VT_LOGIC;
4215 # enum_type->signed_flag = p[3];
4216 # enum_type->integer_flag = false;
4217 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4223 def p_enum_data_type_5(p
):
4224 '''enum_data_type : K_enum K_reg unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
4226 print('enum_data_type_5', list(p
))
4229 # { enum_type_t*enum_type = new enum_type_t;
4230 # FILE_NAME(enum_type, @1);
4231 # enum_type->names .reset(p[6]);
4232 # enum_type->base_type = IVL_VT_LOGIC;
4233 # enum_type->signed_flag = p[3];
4234 # enum_type->integer_flag = false;
4235 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4241 def p_enum_data_type_6(p
):
4242 '''enum_data_type : K_enum K_bit unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
4244 print('enum_data_type_6', list(p
))
4247 # { enum_type_t*enum_type = new enum_type_t;
4248 # FILE_NAME(enum_type, @1);
4249 # enum_type->names .reset(p[6]);
4250 # enum_type->base_type = IVL_VT_BOOL;
4251 # enum_type->signed_flag = p[3];
4252 # enum_type->integer_flag = false;
4253 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4259 def p_enum_name_list_1(p
):
4260 '''enum_name_list : enum_name '''
4262 print('enum_name_list_1', list(p
))
4270 def p_enum_name_list_2(p
):
4271 '''enum_name_list : enum_name_list ',' enum_name '''
4273 print('enum_name_list_2', list(p
))
4276 # { list<named_pexpr_t>*lst = p[1];
4277 # lst->splice(lst->end(), *p[3]);
4284 def p_pos_neg_number_1(p
):
4285 '''pos_neg_number : number '''
4287 print('pos_neg_number_1', list(p
))
4295 def p_pos_neg_number_2(p
):
4296 '''pos_neg_number : '-' number '''
4298 print('pos_neg_number_2', list(p
))
4301 # { verinum tmp = -(*(p[2]));
4308 def p_enum_name_1(p
):
4309 '''enum_name : IDENTIFIER '''
4311 print('enum_name_1', list(p
))
4314 # { perm_string name = lex_strings.make(p[1]);
4316 # p[0] = make_named_number(name);
4321 def p_enum_name_2(p
):
4322 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '''
4324 print('enum_name_2', list(p
))
4327 # { perm_string name = lex_strings.make(p[1]);
4328 # long count = check_enum_seq_value(@1, p[3], false);
4330 # p[0] = make_named_numbers(name, 0, count-1);
4336 def p_enum_name_3(p
):
4337 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '''
4339 print('enum_name_3', list(p
))
4342 # { perm_string name = lex_strings.make(p[1]);
4343 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
4344 # check_enum_seq_value(@1, p[5], true));
4352 def p_enum_name_4(p
):
4353 '''enum_name : IDENTIFIER '=' expression '''
4355 print('enum_name_4', list(p
))
4358 # { perm_string name = lex_strings.make(p[1]);
4360 # p[0] = make_named_number(name, p[3]);
4365 def p_enum_name_5(p
):
4366 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '=' expression '''
4368 print('enum_name_5', list(p
))
4371 # { perm_string name = lex_strings.make(p[1]);
4372 # long count = check_enum_seq_value(@1, p[3], false);
4373 # p[0] = make_named_numbers(name, 0, count-1, p[6]);
4380 def p_enum_name_6(p
):
4381 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '=' expression '''
4383 print('enum_name_6', list(p
))
4386 # { perm_string name = lex_strings.make(p[1]);
4387 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
4388 # check_enum_seq_value(@1, p[5], true), p[8]);
4396 def p_struct_data_type_1(p
):
4397 '''struct_data_type : K_struct K_packed_opt '{' struct_union_member_list '}' '''
4399 print('struct_data_type_1', list(p
))
4402 # { struct_type_t*tmp = new struct_type_t;
4403 # FILE_NAME(tmp, @1);
4404 # tmp->packed_flag = p[2];
4405 # tmp->union_flag = false;
4406 # tmp->members .reset(p[4]);
4412 def p_struct_data_type_2(p
):
4413 '''struct_data_type : K_union K_packed_opt '{' struct_union_member_list '}' '''
4415 print('struct_data_type_2', list(p
))
4418 # { struct_type_t*tmp = new struct_type_t;
4419 # FILE_NAME(tmp, @1);
4420 # tmp->packed_flag = p[2];
4421 # tmp->union_flag = true;
4422 # tmp->members .reset(p[4]);
4428 def p_struct_data_type_3(p
):
4429 '''struct_data_type : K_struct K_packed_opt '{' error '}' '''
4431 print('struct_data_type_3', list(p
))
4434 # { yyerror(@3, "error: Errors in struct member list.");
4436 # struct_type_t*tmp = new struct_type_t;
4437 # FILE_NAME(tmp, @1);
4438 # tmp->packed_flag = p[2];
4439 # tmp->union_flag = false;
4445 def p_struct_data_type_4(p
):
4446 '''struct_data_type : K_union K_packed_opt '{' error '}' '''
4448 print('struct_data_type_4', list(p
))
4451 # { yyerror(@3, "error: Errors in union member list.");
4453 # struct_type_t*tmp = new struct_type_t;
4454 # FILE_NAME(tmp, @1);
4455 # tmp->packed_flag = p[2];
4456 # tmp->union_flag = true;
4462 def p_struct_union_member_list_1(p
):
4463 '''struct_union_member_list : struct_union_member_list struct_union_member '''
4465 print('struct_union_member_list_1', list(p
))
4468 # { list<struct_member_t*>*tmp = p[1];
4469 # tmp->push_back(p[2]);
4475 def p_struct_union_member_list_2(p
):
4476 '''struct_union_member_list : struct_union_member '''
4478 print('struct_union_member_list_2', list(p
))
4481 # { list<struct_member_t*>*tmp = new list<struct_member_t*>;
4482 # tmp->push_back(p[1]);
4488 def p_struct_union_member_1(p
):
4489 '''struct_union_member : attribute_list_opt data_type list_of_variable_decl_assignments ';' '''
4491 print('struct_union_member_1', list(p
))
4494 # { struct_member_t*tmp = new struct_member_t;
4495 # FILE_NAME(tmp, @2);
4496 # tmp->type .reset(p[2]);
4497 # tmp->names .reset(p[3]);
4503 def p_struct_union_member_2(p
):
4504 '''struct_union_member : error ';' '''
4506 print('struct_union_member_2', list(p
))
4509 # { yyerror(@2, "Error in struct/union member.");
4516 def p_case_item_1(p
):
4517 '''case_item : expression_list_proper ':' statement_or_null '''
4519 print('case_item_1', list(p
))
4522 # { PCase::Item*tmp = new PCase::Item;
4523 # tmp->expr = *p[1];
4531 def p_case_item_2(p
):
4532 '''case_item : K_default ':' statement_or_null '''
4534 print('case_item_2', list(p
))
4537 # { PCase::Item*tmp = new PCase::Item;
4544 def p_case_item_3(p
):
4545 '''case_item : K_default statement_or_null '''
4547 print('case_item_3', list(p
))
4550 # { PCase::Item*tmp = new PCase::Item;
4557 def p_case_item_4(p
):
4558 '''case_item : error ':' statement_or_null '''
4560 print('case_item_4', list(p
))
4563 # { yyerror(@2, "error: Incomprehensible case expression.");
4569 def p_case_items_1(p
):
4570 '''case_items : case_items case_item '''
4572 print('case_items_1', list(p
))
4575 # { svector<PCase::Item*>*tmp;
4576 # tmp = new svector<PCase::Item*>(*p[1], p[2]);
4583 def p_case_items_2(p
):
4584 '''case_items : case_item '''
4586 print('case_items_2', list(p
))
4589 # { svector<PCase::Item*>*tmp = new svector<PCase::Item*>(1);
4596 def p_charge_strength_1(p
):
4597 '''charge_strength : '(' K_small ')' '''
4599 print('charge_strength_1', list(p
))
4605 def p_charge_strength_2(p
):
4606 '''charge_strength : '(' K_medium ')' '''
4608 print('charge_strength_2', list(p
))
4614 def p_charge_strength_3(p
):
4615 '''charge_strength : '(' K_large ')' '''
4617 print('charge_strength_3', list(p
))
4623 def p_charge_strength_opt_1(p
):
4624 '''charge_strength_opt : charge_strength '''
4626 print('charge_strength_opt_1', list(p
))
4632 def p_charge_strength_opt_2(p
):
4633 '''charge_strength_opt : '''
4635 print('charge_strength_opt_2', list(p
))
4641 def p_defparam_assign_1(p
):
4642 '''defparam_assign : hierarchy_identifier '=' expression '''
4644 print('defparam_assign_1', list(p
))
4647 # { pform_set_defparam(*p[1], p[3]);
4653 def p_defparam_assign_list_1(p
):
4654 '''defparam_assign_list : defparam_assign '''
4656 print('defparam_assign_list_1', list(p
))
4662 def p_defparam_assign_list_2(p
):
4663 '''defparam_assign_list : dimensions defparam_assign '''
4665 print('defparam_assign_list_2', list(p
))
4668 # { yyerror(@1, "error: defparam may not include a range.");
4674 def p_defparam_assign_list_3(p
):
4675 '''defparam_assign_list : defparam_assign_list ',' defparam_assign '''
4677 print('defparam_assign_list_3', list(p
))
4684 '''delay1 : '#' delay_value_simple '''
4686 print('delay1_1', list(p
))
4689 # { list<PExpr*>*tmp = new list<PExpr*>;
4690 # tmp->push_back(p[2]);
4697 '''delay1 : '#' '(' delay_value ')' '''
4699 print('delay1_2', list(p
))
4702 # { list<PExpr*>*tmp = new list<PExpr*>;
4703 # tmp->push_back(p[3]);
4710 '''delay3 : '#' delay_value_simple '''
4712 print('delay3_1', list(p
))
4715 # { list<PExpr*>*tmp = new list<PExpr*>;
4716 # tmp->push_back(p[2]);
4723 '''delay3 : '#' '(' delay_value ')' '''
4725 print('delay3_2', list(p
))
4728 # { list<PExpr*>*tmp = new list<PExpr*>;
4729 # tmp->push_back(p[3]);
4736 '''delay3 : '#' '(' delay_value ',' delay_value ')' '''
4738 print('delay3_3', list(p
))
4741 # { list<PExpr*>*tmp = new list<PExpr*>;
4742 # tmp->push_back(p[3]);
4743 # tmp->push_back(p[5]);
4750 '''delay3 : '#' '(' delay_value ',' delay_value ',' delay_value ')' '''
4752 print('delay3_4', list(p
))
4755 # { list<PExpr*>*tmp = new list<PExpr*>;
4756 # tmp->push_back(p[3]);
4757 # tmp->push_back(p[5]);
4758 # tmp->push_back(p[7]);
4764 def p_delay3_opt_1(p
):
4765 '''delay3_opt : delay3 '''
4767 print('delay3_opt_1', list(p
))
4774 def p_delay3_opt_2(p
):
4776 if(parse_debug
> 2):
4777 print('delay3_opt_2', list(p
))
4784 def p_delay_value_list_1(p
):
4785 '''delay_value_list : delay_value '''
4787 print('delay_value_list_1', list(p
))
4790 # { list<PExpr*>*tmp = new list<PExpr*>;
4791 # tmp->push_back(p[1]);
4797 def p_delay_value_list_2(p
):
4798 '''delay_value_list : delay_value_list ',' delay_value '''
4800 print('delay_value_list_2', list(p
))
4803 # { list<PExpr*>*tmp = p[1];
4804 # tmp->push_back(p[3]);
4810 def p_delay_value_1(p
):
4811 '''delay_value : expression '''
4813 print('delay_value_1', list(p
))
4816 # { PExpr*tmp = p[1];
4822 def p_delay_value_2(p
):
4823 '''delay_value : expression ':' expression ':' expression '''
4825 print('delay_value_2', list(p
))
4828 # { p[0] = pform_select_mtm_expr(p[1], p[3], p[5]); }
4832 def p_delay_value_simple_1(p
):
4833 '''delay_value_simple : DEC_NUMBER '''
4835 print('delay_value_simple_1', list(p
))
4838 # { verinum*tmp = p[1];
4840 # yyerror(@1, "internal error: delay.");
4843 # p[0] = new PENumber(tmp);
4844 # FILE_NAME(p[0], @1);
4851 def p_delay_value_simple_2(p
):
4852 '''delay_value_simple : REALTIME '''
4854 print('delay_value_simple_2', list(p
))
4857 # { verireal*tmp = p[1];
4859 # yyerror(@1, "internal error: delay.");
4862 # p[0] = new PEFNumber(tmp);
4863 # FILE_NAME(p[0], @1);
4869 def p_delay_value_simple_3(p
):
4870 '''delay_value_simple : IDENTIFIER '''
4872 print('delay_value_simple_3', list(p
))
4875 # { PEIdent*tmp = new PEIdent(lex_strings.make(p[1]));
4876 # FILE_NAME(tmp, @1);
4883 def p_delay_value_simple_4(p
):
4884 '''delay_value_simple : TIME_LITERAL '''
4886 print('delay_value_simple_4', list(p
))
4893 # if (p[1] == 0 || !get_time_unit(p[1], unit))
4894 # yyerror(@1, "internal error: delay.");
4896 # double p = pow(10.0,
4897 # (double)(unit - pform_get_timeunit()));
4898 # double time = atof(p[1]) * p;
4900 # verireal *v = new verireal(time);
4901 # p[0] = new PEFNumber(v);
4902 # FILE_NAME(p[0], @1);
4908 def p_optional_semicolon_1(p
):
4909 '''optional_semicolon : ';' '''
4911 print('optional_semicolon_1', list(p
))
4917 def p_optional_semicolon_2(p
):
4918 '''optional_semicolon : '''
4920 print('optional_semicolon_2', list(p
))
4926 def p_discipline_declaration_1(p
):
4927 '''discipline_declaration : K_discipline IDENTIFIER optional_semicolon _embed0_discipline_declaration discipline_items K_enddiscipline '''
4929 print('discipline_declaration_1', list(p
))
4932 # { pform_end_discipline(@1); delete[] p[2]; }
4936 def p__embed0_discipline_declaration(p
):
4937 '''_embed0_discipline_declaration : '''
4940 # { pform_start_discipline(p[2]); }
4944 def p_discipline_items_1(p
):
4945 '''discipline_items : discipline_items discipline_item '''
4947 print('discipline_items_1', list(p
))
4953 def p_discipline_items_2(p
):
4954 '''discipline_items : discipline_item '''
4956 print('discipline_items_2', list(p
))
4962 def p_discipline_item_1(p
):
4963 '''discipline_item : K_domain K_discrete ';' '''
4965 print('discipline_item_1', list(p
))
4968 # { pform_discipline_domain(@1, IVL_DIS_DISCRETE); }
4972 def p_discipline_item_2(p
):
4973 '''discipline_item : K_domain K_continuous ';' '''
4975 print('discipline_item_2', list(p
))
4978 # { pform_discipline_domain(@1, IVL_DIS_CONTINUOUS); }
4982 def p_discipline_item_3(p
):
4983 '''discipline_item : K_potential IDENTIFIER ';' '''
4985 print('discipline_item_3', list(p
))
4988 # { pform_discipline_potential(@1, p[2]); delete[] p[2]; }
4992 def p_discipline_item_4(p
):
4993 '''discipline_item : K_flow IDENTIFIER ';' '''
4995 print('discipline_item_4', list(p
))
4998 # { pform_discipline_flow(@1, p[2]); delete[] p[2]; }
5002 def p_nature_declaration_1(p
):
5003 '''nature_declaration : K_nature IDENTIFIER optional_semicolon _embed0_nature_declaration nature_items K_endnature '''
5005 print('nature_declaration_1', list(p
))
5008 # { pform_end_nature(@1); delete[] p[2]; }
5012 def p__embed0_nature_declaration(p
):
5013 '''_embed0_nature_declaration : '''
5016 # { pform_start_nature(p[2]); }
5020 def p_nature_items_1(p
):
5021 '''nature_items : nature_items nature_item '''
5023 print('nature_items_1', list(p
))
5029 def p_nature_items_2(p
):
5030 '''nature_items : nature_item '''
5032 print('nature_items_2', list(p
))
5038 def p_nature_item_1(p
):
5039 '''nature_item : K_units '=' STRING ';' '''
5041 print('nature_item_1', list(p
))
5044 # { delete[] p[3]; }
5048 def p_nature_item_2(p
):
5049 '''nature_item : K_abstol '=' expression ';' '''
5051 print('nature_item_2', list(p
))
5057 def p_nature_item_3(p
):
5058 '''nature_item : K_access '=' IDENTIFIER ';' '''
5060 print('nature_item_3', list(p
))
5063 # { pform_nature_access(@1, p[3]); delete[] p[3]; }
5067 def p_nature_item_4(p
):
5068 '''nature_item : K_idt_nature '=' IDENTIFIER ';' '''
5070 print('nature_item_4', list(p
))
5073 # { delete[] p[3]; }
5077 def p_nature_item_5(p
):
5078 '''nature_item : K_ddt_nature '=' IDENTIFIER ';' '''
5080 print('nature_item_5', list(p
))
5083 # { delete[] p[3]; }
5087 def p_config_declaration_1(p
):
5088 '''config_declaration : K_config IDENTIFIER ';' K_design lib_cell_identifiers ';' list_of_config_rule_statements K_endconfig '''
5090 print('config_declaration_1', list(p
))
5093 # { cerr << @1 << ": sorry: config declarations are not supported and "
5094 # "will be skipped." << endl;
5100 def p_lib_cell_identifiers_1(p
):
5101 '''lib_cell_identifiers : '''
5103 print('lib_cell_identifiers_1', list(p
))
5109 def p_lib_cell_identifiers_2(p
):
5110 '''lib_cell_identifiers : lib_cell_identifiers lib_cell_id '''
5112 print('lib_cell_identifiers_2', list(p
))
5118 def p_list_of_config_rule_statements_1(p
):
5119 '''list_of_config_rule_statements : '''
5121 print('list_of_config_rule_statements_1', list(p
))
5127 def p_list_of_config_rule_statements_2(p
):
5128 '''list_of_config_rule_statements : list_of_config_rule_statements config_rule_statement '''
5130 print('list_of_config_rule_statements_2', list(p
))
5136 def p_config_rule_statement_1(p
):
5137 '''config_rule_statement : K_default K_liblist list_of_libraries ';' '''
5139 print('config_rule_statement_1', list(p
))
5145 def p_config_rule_statement_2(p
):
5146 '''config_rule_statement : K_instance hierarchy_identifier K_liblist list_of_libraries ';' '''
5148 print('config_rule_statement_2', list(p
))
5155 def p_config_rule_statement_3(p
):
5156 '''config_rule_statement : K_instance hierarchy_identifier K_use lib_cell_id opt_config ';' '''
5158 print('config_rule_statement_3', list(p
))
5165 def p_config_rule_statement_4(p
):
5166 '''config_rule_statement : K_cell lib_cell_id K_liblist list_of_libraries ';' '''
5168 print('config_rule_statement_4', list(p
))
5174 def p_config_rule_statement_5(p
):
5175 '''config_rule_statement : K_cell lib_cell_id K_use lib_cell_id opt_config ';' '''
5177 print('config_rule_statement_5', list(p
))
5183 def p_opt_config_1(p
):
5186 print('opt_config_1', list(p
))
5192 def p_opt_config_2(p
):
5193 '''opt_config : ':' K_config '''
5195 print('opt_config_2', list(p
))
5201 def p_lib_cell_id_1(p
):
5202 '''lib_cell_id : IDENTIFIER '''
5204 print('lib_cell_id_1', list(p
))
5207 # { delete[] p[1]; }
5211 def p_lib_cell_id_2(p
):
5212 '''lib_cell_id : IDENTIFIER '.' IDENTIFIER '''
5214 print('lib_cell_id_2', list(p
))
5217 # { delete[] p[1]; delete[] p[3]; }
5221 def p_list_of_libraries_1(p
):
5222 '''list_of_libraries : '''
5224 print('list_of_libraries_1', list(p
))
5230 def p_list_of_libraries_2(p
):
5231 '''list_of_libraries : list_of_libraries IDENTIFIER '''
5233 print('list_of_libraries_2', list(p
))
5236 # { delete[] p[2]; }
5240 def p_drive_strength_1(p
):
5241 '''drive_strength : '(' dr_strength0 ',' dr_strength1 ')' '''
5243 print('drive_strength_1', list(p
))
5246 # { p[0].str0 = p[2].str0;
5247 # p[0].str1 = p[4].str1;
5252 def p_drive_strength_2(p
):
5253 '''drive_strength : '(' dr_strength1 ',' dr_strength0 ')' '''
5255 print('drive_strength_2', list(p
))
5258 # { p[0].str0 = p[4].str0;
5259 # p[0].str1 = p[2].str1;
5264 def p_drive_strength_3(p
):
5265 '''drive_strength : '(' dr_strength0 ',' K_highz1 ')' '''
5267 print('drive_strength_3', list(p
))
5270 # { p[0].str0 = p[2].str0;
5271 # p[0].str1 = IVL_DR_HiZ;
5276 def p_drive_strength_4(p
):
5277 '''drive_strength : '(' dr_strength1 ',' K_highz0 ')' '''
5279 print('drive_strength_4', list(p
))
5282 # { p[0].str0 = IVL_DR_HiZ;
5283 # p[0].str1 = p[2].str1;
5288 def p_drive_strength_5(p
):
5289 '''drive_strength : '(' K_highz1 ',' dr_strength0 ')' '''
5291 print('drive_strength_5', list(p
))
5294 # { p[0].str0 = p[4].str0;
5295 # p[0].str1 = IVL_DR_HiZ;
5300 def p_drive_strength_6(p
):
5301 '''drive_strength : '(' K_highz0 ',' dr_strength1 ')' '''
5303 print('drive_strength_6', list(p
))
5306 # { p[0].str0 = IVL_DR_HiZ;
5307 # p[0].str1 = p[4].str1;
5312 def p_drive_strength_opt_1(p
):
5313 '''drive_strength_opt : drive_strength '''
5315 print('drive_strength_opt_1', list(p
))
5322 def p_drive_strength_opt_2(p
):
5323 '''drive_strength_opt : '''
5324 if(parse_debug
> 2):
5325 print('drive_strength_opt_2', list(p
))
5328 # { p[0].str0 = IVL_DR_STRONG; p[0].str1 = IVL_DR_STRONG; }
5332 def p_dr_strength0_1(p
):
5333 '''dr_strength0 : K_supply0 '''
5335 print('dr_strength0_1', list(p
))
5338 # { p[0].str0 = IVL_DR_SUPPLY; }
5342 def p_dr_strength0_2(p
):
5343 '''dr_strength0 : K_strong0 '''
5345 print('dr_strength0_2', list(p
))
5348 # { p[0].str0 = IVL_DR_STRONG; }
5352 def p_dr_strength0_3(p
):
5353 '''dr_strength0 : K_pull0 '''
5355 print('dr_strength0_3', list(p
))
5358 # { p[0].str0 = IVL_DR_PULL; }
5362 def p_dr_strength0_4(p
):
5363 '''dr_strength0 : K_weak0 '''
5365 print('dr_strength0_4', list(p
))
5368 # { p[0].str0 = IVL_DR_WEAK; }
5372 def p_dr_strength1_1(p
):
5373 '''dr_strength1 : K_supply1 '''
5375 print('dr_strength1_1', list(p
))
5378 # { p[0].str1 = IVL_DR_SUPPLY; }
5382 def p_dr_strength1_2(p
):
5383 '''dr_strength1 : K_strong1 '''
5385 print('dr_strength1_2', list(p
))
5388 # { p[0].str1 = IVL_DR_STRONG; }
5392 def p_dr_strength1_3(p
):
5393 '''dr_strength1 : K_pull1 '''
5395 print('dr_strength1_3', list(p
))
5398 # { p[0].str1 = IVL_DR_PULL; }
5402 def p_dr_strength1_4(p
):
5403 '''dr_strength1 : K_weak1 '''
5405 print('dr_strength1_4', list(p
))
5408 # { p[0].str1 = IVL_DR_WEAK; }
5412 def p_clocking_event_opt_1(p
):
5413 '''clocking_event_opt : event_control '''
5415 print('clocking_event_opt_1', list(p
))
5421 def p_clocking_event_opt_2(p
):
5422 '''clocking_event_opt : '''
5424 print('clocking_event_opt_2', list(p
))
5430 def p_event_control_1(p
):
5431 '''event_control : '@' hierarchy_identifier '''
5433 print('event_control_1', list(p
))
5436 # { PEIdent*tmpi = new PEIdent(*p[2]);
5437 # PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi);
5438 # PEventStatement*tmps = new PEventStatement(tmpe);
5439 # FILE_NAME(tmps, @1);
5446 def p_event_control_2(p
):
5447 '''event_control : '@' '(' event_expression_list ')' '''
5449 print('event_control_2', list(p
))
5452 # { PEventStatement*tmp = new PEventStatement(*p[3]);
5453 # FILE_NAME(tmp, @1);
5460 def p_event_control_3(p
):
5461 '''event_control : '@' '(' error ')' '''
5463 print('event_control_3', list(p
))
5466 # { yyerror(@1, "error: Malformed event control expression.");
5472 def p_event_expression_list_1(p
):
5473 '''event_expression_list : event_expression '''
5475 print('event_expression_list_1', list(p
))
5482 def p_event_expression_list_2(p
):
5483 '''event_expression_list : event_expression_list K_or event_expression '''
5485 print('event_expression_list_2', list(p
))
5488 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
5496 def p_event_expression_list_3(p
):
5497 '''event_expression_list : event_expression_list ',' event_expression '''
5499 print('event_expression_list_3', list(p
))
5502 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
5510 def p_event_expression_1(p
):
5511 '''event_expression : K_posedge expression '''
5513 print('event_expression_1', list(p
))
5516 # { PEEvent*tmp = new PEEvent(PEEvent::POSEDGE, p[2]);
5517 # FILE_NAME(tmp, @1);
5518 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5525 def p_event_expression_2(p
):
5526 '''event_expression : K_negedge expression '''
5528 print('event_expression_2', list(p
))
5531 # { PEEvent*tmp = new PEEvent(PEEvent::NEGEDGE, p[2]);
5532 # FILE_NAME(tmp, @1);
5533 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5540 def p_event_expression_3(p
):
5541 '''event_expression : expression '''
5543 print('event_expression_3', list(p
))
5546 # { PEEvent*tmp = new PEEvent(PEEvent::ANYEDGE, p[1]);
5547 # FILE_NAME(tmp, @1);
5548 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5555 def p_branch_probe_expression_1(p
):
5556 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ',' IDENTIFIER ')' '''
5558 print('branch_probe_expression_1', list(p
))
5561 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3], p[5]); }
5565 def p_branch_probe_expression_2(p
):
5566 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ')' '''
5568 print('branch_probe_expression_2', list(p
))
5571 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3]); }
5575 def p_expression_1(p
):
5576 '''expression : expr_primary_or_typename '''
5577 if(parse_debug
> 2):
5578 print('expression_1', list(p
))
5585 def p_expression_2(p
):
5586 '''expression : inc_or_dec_expression '''
5588 print('expression_2', list(p
))
5595 def p_expression_3(p
):
5596 '''expression : inside_expression '''
5598 print('expression_3', list(p
))
5605 def p_expression_4(p
):
5606 '''expression : '+' attribute_list_opt expr_primary %prec UNARY_PREC '''
5608 print('expression_4', list(p
))
5615 def PEUnary(op
, o1
):
5616 #Leaf(token.STRING, ' ')
5618 return Node(syms
.atom
, [op
, o1
])
5620 return "error in PEUnary: "+str(op
)+","+str(o1
)
5623 def PEBinary(op
, o1
, o2
):
5625 return Node(syms
.atom
, [o1
, Leaf(token
.STRING
, ' '), op
, Leaf(token
.STRING
, ' '), o2
])
5627 return "error in PEBinary: "+str(op
)+","+str(o1
)+","+str(o2
)
5632 def p_expression_5(p
):
5633 '''expression : '-' attribute_list_opt expr_primary %prec UNARY_PREC '''
5635 print('expression_5', list(p
))
5637 p
[0] = PEUnary(Leaf(token
.MINUS
, '-'), p
[3])
5640 # { PEUnary*tmp = new PEUnary('-', p[3]);
5641 # FILE_NAME(tmp, @3);
5647 def p_expression_6(p
):
5648 '''expression : '~' attribute_list_opt expr_primary %prec UNARY_PREC '''
5650 print('expression_6', list(p
))
5652 p
[0] = PEUnary(Leaf(token
.TILDE
, '~'), p
[3])
5655 # { PEUnary*tmp = new PEUnary('~', p[3]);
5656 # FILE_NAME(tmp, @3);
5662 def p_expression_7(p
):
5663 '''expression : '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
5665 print('expression_7', list(p
))
5667 p
[0] = PEUnary(Leaf(token
.AMPER
, '&'), p
[3])
5670 # { PEUnary*tmp = new PEUnary('&', p[3]);
5671 # FILE_NAME(tmp, @3);
5677 def p_expression_8(p
):
5678 '''expression : '!' attribute_list_opt expr_primary %prec UNARY_PREC '''
5680 print('expression_8', list(p
))
5682 p
[0] = PEUnary(Leaf(token
.STRING
, '!'), p
[3])
5685 # { PEUnary*tmp = new PEUnary('!', p[3]);
5686 # FILE_NAME(tmp, @3);
5692 def p_expression_9(p
):
5693 '''expression : '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
5695 print('expression_9', list(p
))
5697 p
[0] = PEUnary(Leaf(token
.STRING
, '|'), p
[3])
5700 # { PEUnary*tmp = new PEUnary('|', p[3]);
5701 # FILE_NAME(tmp, @3);
5707 def p_expression_10(p
):
5708 '''expression : '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
5710 print('expression_10', list(p
))
5712 p
[0] = PEUnary(Leaf(token
.STRING
, '^'), p
[3])
5715 # { PEUnary*tmp = new PEUnary('^', p[3]);
5716 # FILE_NAME(tmp, @3);
5722 def p_expression_11(p
):
5723 '''expression : '~' '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
5725 print('expression_11', list(p
))
5728 # { yyerror(@1, "error: '~' '&' is not a valid expression. "
5729 # "Please use operator '~&' instead.");
5735 def p_expression_12(p
):
5736 '''expression : '~' '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
5738 print('expression_12', list(p
))
5741 # { yyerror(@1, "error: '~' '|' is not a valid expression. "
5742 # "Please use operator '~|' instead.");
5748 def p_expression_13(p
):
5749 '''expression : '~' '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
5751 print('expression_13', list(p
))
5754 # { yyerror(@1, "error: '~' '^' is not a valid expression. "
5755 # "Please use operator '~^' instead.");
5761 def p_expression_14(p
):
5762 '''expression : K_NAND attribute_list_opt expr_primary %prec UNARY_PREC '''
5764 print('expression_14', list(p
))
5766 p
[0] = PEUnary(Leaf(token
.STRING
, 'K_NAND'), p
[3])
5769 # { PEUnary*tmp = new PEUnary('A', p[3]);
5770 # FILE_NAME(tmp, @3);
5776 def p_expression_15(p
):
5777 '''expression : K_NOR attribute_list_opt expr_primary %prec UNARY_PREC '''
5779 print('expression_15', list(p
))
5781 p
[0] = PEUnary(Leaf(token
.STRING
, 'K_NOR'), p
[3])
5784 # { PEUnary*tmp = new PEUnary('N', p[3]);
5785 # FILE_NAME(tmp, @3);
5791 def p_expression_16(p
):
5792 '''expression : K_NXOR attribute_list_opt expr_primary %prec UNARY_PREC '''
5794 print('expression_16', list(p
))
5796 p
[0] = PEUnary(Leaf(token
.STRING
, 'K_NXOR'), p
[3])
5799 # { PEUnary*tmp = new PEUnary('X', p[3]);
5800 # FILE_NAME(tmp, @3);
5806 def p_expression_17(p
):
5807 '''expression : '!' error %prec UNARY_PREC '''
5809 print('expression_17', list(p
))
5812 # { yyerror(@1, "error: Operand of unary ! "
5813 # "is not a primary expression.");
5819 def p_expression_18(p
):
5820 '''expression : '^' error %prec UNARY_PREC '''
5822 print('expression_18', list(p
))
5825 # { yyerror(@1, "error: Operand of reduction ^ "
5826 # "is not a primary expression.");
5832 def p_expression_19(p
):
5833 '''expression : expression '^' attribute_list_opt expression '''
5835 print('expression_19', list(p
))
5837 p
[0] = PEBinary(Leaf(token
.STRING
, '^'), p
[1], p
[4])
5840 # { PEBinary*tmp = new PEBinary('^', p[1], p[4]);
5841 # FILE_NAME(tmp, @2);
5847 def p_expression_20(p
):
5848 '''expression : expression K_POW attribute_list_opt expression '''
5850 print('expression_20', list(p
))
5852 p
[0] = PEBinary(Leaf(token
.STRING
, '**'), p
[1], p
[4])
5855 # { PEBinary*tmp = new PEBPower('p', p[1], p[4]);
5856 # FILE_NAME(tmp, @2);
5862 def p_expression_21(p
):
5863 '''expression : expression '*' attribute_list_opt expression '''
5865 print('expression_21', list(p
))
5867 p
[0] = PEBinary(Leaf(token
.STRING
, '*'), p
[1], p
[4])
5870 # { PEBinary*tmp = new PEBinary('*', p[1], p[4]);
5871 # FILE_NAME(tmp, @2);
5877 def p_expression_22(p
):
5878 '''expression : expression '/' attribute_list_opt expression '''
5880 print('expression_22', list(p
))
5882 p
[0] = PEBinary(Leaf(token
.STRING
, '/'), p
[1], p
[4])
5885 # { PEBinary*tmp = new PEBinary('/', p[1], p[4]);
5886 # FILE_NAME(tmp, @2);
5892 def p_expression_23(p
):
5893 '''expression : expression '%' attribute_list_opt expression '''
5895 print('expression_23', list(p
))
5897 p
[0] = PEBinary(Leaf(token
.STRING
, '%'), p
[1], p
[4])
5900 # { PEBinary*tmp = new PEBinary('%', p[1], p[4]);
5901 # FILE_NAME(tmp, @2);
5907 def p_expression_24(p
):
5908 '''expression : expression '+' attribute_list_opt expression '''
5910 print('expression_24', list(p
))
5912 # { PEBinary*tmp = new PEBinary('+', p[1], p[4]);
5913 # FILE_NAME(tmp, @2);
5916 p
[0] = PEBinary(Leaf(token
.PLUS
, '+'), p
[1], p
[4])
5922 def p_expression_25(p
):
5923 '''expression : expression '-' attribute_list_opt expression '''
5924 if(parse_debug
> 2):
5925 print('expression_25', list(p
))
5926 # { PEBinary*tmp = new PEBinary('-', p[1], p[4]);
5927 # FILE_NAME(tmp, @2);
5930 p
[0] = PEBinary(Leaf(token
.MINUS
, '-'), p
[1], p
[4])
5936 def p_expression_26(p
):
5937 '''expression : expression '&' attribute_list_opt expression '''
5938 if(parse_debug
> 2):
5939 print('expression_26', list(p
))
5941 p
[0] = PEBinary(Leaf(token
.AMPER
, '&'), p
[1], p
[4])
5944 # { PEBinary*tmp = new PEBinary('&', p[1], p[4]);
5945 # FILE_NAME(tmp, @2);
5951 def p_expression_27(p
):
5952 '''expression : expression '|' attribute_list_opt expression '''
5953 if(parse_debug
> 2):
5954 print('expression_27', list(p
))
5956 p
[0] = PEBinary(Leaf(token
.VBAR
, '|'), p
[1], p
[4])
5958 # { PEBinary*tmp = new PEBinary('|', p[1], p[4]);
5959 # FILE_NAME(tmp, @2);
5965 def p_expression_28(p
):
5966 '''expression : expression K_NAND attribute_list_opt expression '''
5968 print('expression_28', list(p
))
5970 p
[0] = PEBinary(Leaf(token
.STRING
, '~&'), p
[1], p
[4])
5973 # { PEBinary*tmp = new PEBinary('A', p[1], p[4]);
5974 # FILE_NAME(tmp, @2);
5980 def p_expression_29(p
):
5981 '''expression : expression K_NOR attribute_list_opt expression '''
5983 print('expression_29', list(p
))
5985 p
[0] = PEBinary(Leaf(token
.STRING
, '~|'), p
[1], p
[4])
5988 # { PEBinary*tmp = new PEBinary('O', p[1], p[4]);
5989 # FILE_NAME(tmp, @2);
5995 def p_expression_30(p
):
5996 '''expression : expression K_NXOR attribute_list_opt expression '''
5998 print('expression_30', list(p
))
6000 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_XNOR'), p
[1], p
[4])
6003 # { PEBinary*tmp = new PEBinary('X', p[1], p[4]);
6004 # FILE_NAME(tmp, @2);
6010 def p_expression_31(p
):
6011 '''expression : expression '<' attribute_list_opt expression '''
6013 print('expression_31', list(p
))
6015 p
[0] = PEBinary(Leaf(token
.STRING
, '<'), p
[1], p
[4])
6018 # { PEBinary*tmp = new PEBComp('<', p[1], p[4]);
6019 # FILE_NAME(tmp, @2);
6025 def p_expression_32(p
):
6026 '''expression : expression '>' attribute_list_opt expression '''
6028 print('expression_32', list(p
))
6030 p
[0] = PEBinary(Leaf(token
.STRING
, '>'), p
[1], p
[4])
6033 # { PEBinary*tmp = new PEBComp('>', p[1], p[4]);
6034 # FILE_NAME(tmp, @2);
6040 def p_expression_33(p
):
6041 '''expression : expression K_LS attribute_list_opt expression '''
6043 print('expression_33', list(p
))
6045 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_LS'), p
[1], p
[4])
6048 # { PEBinary*tmp = new PEBShift('l', p[1], p[4]);
6049 # FILE_NAME(tmp, @2);
6055 def p_expression_34(p
):
6056 '''expression : expression K_RS attribute_list_opt expression '''
6058 print('expression_34', list(p
))
6060 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_RS'), p
[1], p
[4])
6063 # { PEBinary*tmp = new PEBShift('r', p[1], p[4]);
6064 # FILE_NAME(tmp, @2);
6070 def p_expression_35(p
):
6071 '''expression : expression K_RSS attribute_list_opt expression '''
6073 print('expression_35', list(p
))
6075 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_RSS'), p
[1], p
[4])
6078 # { PEBinary*tmp = new PEBShift('R', p[1], p[4]);
6079 # FILE_NAME(tmp, @2);
6085 def p_expression_36(p
):
6086 '''expression : expression K_EQ attribute_list_opt expression '''
6088 print('expression_36', list(p
))
6090 p
[0] = PEBinary(Leaf(token
.STRING
, '=='), p
[1], p
[4])
6093 # { PEBinary*tmp = new PEBComp('e', p[1], p[4]);
6094 # FILE_NAME(tmp, @2);
6100 def p_expression_37(p
):
6101 '''expression : expression K_CEQ attribute_list_opt expression '''
6103 print('expression_37', list(p
))
6105 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_CEQ'), p
[1], p
[4])
6108 # { PEBinary*tmp = new PEBComp('E', p[1], p[4]);
6109 # FILE_NAME(tmp, @2);
6115 def p_expression_38(p
):
6116 '''expression : expression K_WEQ attribute_list_opt expression '''
6118 print('expression_38', list(p
))
6120 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_WEQ'), p
[1], p
[4])
6123 # { PEBinary*tmp = new PEBComp('w', p[1], p[4]);
6124 # FILE_NAME(tmp, @2);
6130 def p_expression_39(p
):
6131 '''expression : expression K_LE attribute_list_opt expression '''
6133 print('expression_39', list(p
))
6135 p
[0] = PEBinary(Leaf(token
.STRING
, '<='), p
[1], p
[4])
6138 # { PEBinary*tmp = new PEBComp('L', p[1], p[4]);
6139 # FILE_NAME(tmp, @2);
6145 def p_expression_40(p
):
6146 '''expression : expression K_GE attribute_list_opt expression '''
6148 print('expression_40', list(p
))
6150 p
[0] = PEBinary(Leaf(token
.STRING
, '>='), p
[1], p
[4])
6153 # { PEBinary*tmp = new PEBComp('G', p[1], p[4]);
6154 # FILE_NAME(tmp, @2);
6160 def p_expression_41(p
):
6161 '''expression : expression K_NE attribute_list_opt expression '''
6163 print('expression_41', list(p
))
6165 p
[0] = PEBinary(Leaf(token
.STRING
, '!='), p
[1], p
[4])
6168 # { PEBinary*tmp = new PEBComp('n', p[1], p[4]);
6169 # FILE_NAME(tmp, @2);
6175 def p_expression_42(p
):
6176 '''expression : expression K_CNE attribute_list_opt expression '''
6178 print('expression_42', list(p
))
6180 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_CNE'), p
[1], p
[4])
6183 # { PEBinary*tmp = new PEBComp('N', p[1], p[4]);
6184 # FILE_NAME(tmp, @2);
6190 def p_expression_43(p
):
6191 '''expression : expression K_WNE attribute_list_opt expression '''
6193 print('expression_43', list(p
))
6195 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_WNE'), p
[1], p
[4])
6198 # { PEBinary*tmp = new PEBComp('W', p[1], p[4]);
6199 # FILE_NAME(tmp, @2);
6205 def p_expression_44(p
):
6206 '''expression : expression K_LOR attribute_list_opt expression '''
6208 print('expression_44', list(p
))
6210 p
[0] = PEBinary(Leaf(token
.STRING
, '||'), p
[1], p
[4])
6213 # { PEBinary*tmp = new PEBLogic('o', p[1], p[4]);
6214 # FILE_NAME(tmp, @2);
6220 def p_expression_45(p
):
6221 '''expression : expression K_LAND attribute_list_opt expression '''
6223 print('expression_45', list(p
))
6225 p
[0] = PEBinary(Leaf(token
.STRING
, '&&'), p
[1], p
[4])
6228 # { PEBinary*tmp = new PEBLogic('a', p[1], p[4]);
6229 # FILE_NAME(tmp, @2);
6235 def p_expression_46(p
):
6236 '''expression : expression '?' attribute_list_opt expression ':' expression '''
6238 print('expression_46', list(p
))
6240 p
[0] = Node(syms
.atom
, [p
[1], Leaf(token
.STRING
, ' ? '),
6241 p
[4], Leaf(token
.STRING
, ' : '), p
[6]])
6244 # { PETernary*tmp = new PETernary(p[1], p[4], p[6]);
6245 # FILE_NAME(tmp, @2);
6251 def p_expr_mintypmax_1(p
):
6252 '''expr_mintypmax : expression '''
6254 print('expr_mintypmax_1', list(p
))
6261 def p_expr_mintypmax_2(p
):
6262 '''expr_mintypmax : expression ':' expression ':' expression '''
6264 print('expr_mintypmax_2', list(p
))
6267 # { switch (min_typ_max_flag) {
6284 # if (min_typ_max_warn > 0) {
6285 # cerr << p[0]->get_fileline() << ": warning: choosing ";
6286 # switch (min_typ_max_flag) {
6297 # cerr << " expression." << endl;
6298 # min_typ_max_warn -= 1;
6304 def p_expression_list_with_nuls_1(p
):
6305 '''expression_list_with_nuls : expression_list_with_nuls ',' expression '''
6307 print('expression_list_with_nuls_1', list(p
))
6310 # { list<PExpr*>*tmp = p[1];
6311 # tmp->push_back(p[3]);
6317 def p_expression_list_with_nuls_2(p
):
6318 '''expression_list_with_nuls : expression '''
6320 print('expression_list_with_nuls_2', list(p
))
6323 # { list<PExpr*>*tmp = new list<PExpr*>;
6324 # tmp->push_back(p[1]);
6330 def p_expression_list_with_nuls_3(p
):
6331 '''expression_list_with_nuls : '''
6333 print('expression_list_with_nuls_3', list(p
))
6336 # { list<PExpr*>*tmp = new list<PExpr*>;
6337 # tmp->push_back(0);
6343 def p_expression_list_with_nuls_4(p
):
6344 '''expression_list_with_nuls : expression_list_with_nuls ',' '''
6346 print('expression_list_with_nuls_4', list(p
))
6349 # { list<PExpr*>*tmp = p[1];
6350 # tmp->push_back(0);
6356 def p_expression_list_proper_1(p
):
6357 '''expression_list_proper : expression_list_proper ',' expression '''
6359 print('expression_list_proper_1', list(p
))
6362 # { list<PExpr*>*tmp = p[1];
6363 # tmp->push_back(p[3]);
6369 def p_expression_list_proper_2(p
):
6370 '''expression_list_proper : expression '''
6372 print('expression_list_proper_2', list(p
))
6375 # { list<PExpr*>*tmp = new list<PExpr*>;
6376 # tmp->push_back(p[1]);
6382 def p_expr_primary_or_typename_1(p
):
6383 '''expr_primary_or_typename : expr_primary '''
6384 if(parse_debug
> 2):
6385 print('expr_primary_or_typename_1', list(p
))
6392 def p_expr_primary_or_typename_2(p
):
6393 '''expr_primary_or_typename : TYPE_IDENTIFIER '''
6395 print('expr_primary_or_typename_2', list(p
))
6399 # { PETypename*tmp = new PETypename(p[1].type);
6400 # FILE_NAME(tmp,@1);
6402 # delete[]p[1].text;
6407 def p_expr_primary_1(p
):
6408 '''expr_primary : number '''
6410 print('expr_primary_1', list(p
))
6415 # PENumber*tmp = new PENumber(p[1]);
6416 # FILE_NAME(tmp, @1);
6422 def p_expr_primary_2(p
):
6423 '''expr_primary : REALTIME '''
6425 print('expr_primary_2', list(p
))
6428 # { PEFNumber*tmp = new PEFNumber(p[1]);
6429 # FILE_NAME(tmp, @1);
6435 def p_expr_primary_3(p
):
6436 '''expr_primary : STRING '''
6438 print('expr_primary_3', list(p
))
6441 # { PEString*tmp = new PEString(p[1]);
6442 # FILE_NAME(tmp, @1);
6448 def p_expr_primary_4(p
):
6449 '''expr_primary : TIME_LITERAL '''
6451 print('expr_primary_4', list(p
))
6458 # if (p[1] == 0 || !get_time_unit(p[1], unit))
6459 # yyerror(@1, "internal error: delay.");
6461 # double p = pow(10.0, (double)(unit - pform_get_timeunit()));
6462 # double time = atof(p[1]) * p;
6464 # verireal *v = new verireal(time);
6465 # p[0] = new PEFNumber(v);
6466 # FILE_NAME(p[0], @1);
6472 def p_expr_primary_5(p
):
6473 '''expr_primary : SYSTEM_IDENTIFIER '''
6475 print('expr_primary_5', list(p
))
6478 # { perm_string tn = lex_strings.make(p[1]);
6479 # PECallFunction*tmp = new PECallFunction(tn);
6480 # FILE_NAME(tmp, @1);
6487 def p_expr_primary_6(p
):
6488 '''expr_primary : hierarchy_identifier '''
6489 if(parse_debug
> 2):
6490 print('expr_primary_6', list(p
))
6494 # { PEIdent*tmp = pform_new_ident(*p[1]);
6495 # FILE_NAME(tmp, @1);
6502 def p_expr_primary_7(p
):
6503 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier '''
6505 print('expr_primary_7', list(p
))
6508 # { p[0] = pform_package_ident(@2, p[1], p[3]);
6514 def p_expr_primary_8(p
):
6515 '''expr_primary : hierarchy_identifier '(' expression_list_with_nuls ')' '''
6517 print('expr_primary_8', list(p
))
6520 # { list<PExpr*>*expr_list = p[3];
6521 # strip_tail_items(expr_list);
6522 # PECallFunction*tmp = pform_make_call_function(@1, *p[1], *expr_list);
6529 def p_expr_primary_9(p
):
6530 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' '''
6532 print('expr_primary_9', list(p
))
6535 # { pform_name_t*t_name = p[1];
6536 # while (! p[3]->empty()) {
6537 # t_name->push_back(p[3]->front());
6538 # p[3]->pop_front();
6540 # list<PExpr*>*expr_list = p[5];
6541 # strip_tail_items(expr_list);
6542 # PECallFunction*tmp = pform_make_call_function(@1, *t_name, *expr_list);
6550 def p_expr_primary_10(p
):
6551 '''expr_primary : SYSTEM_IDENTIFIER '(' expression_list_proper ')' '''
6553 print('expr_primary_10', list(p
))
6556 # { perm_string tn = lex_strings.make(p[1]);
6557 # PECallFunction*tmp = new PECallFunction(tn, *p[3]);
6558 # FILE_NAME(tmp, @1);
6565 def p_expr_primary_11(p
):
6566 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')' '''
6568 print('expr_primary_11', list(p
))
6571 # { perm_string use_name = lex_strings.make(p[3]);
6572 # PECallFunction*tmp = new PECallFunction(p[1], use_name, *p[5]);
6573 # FILE_NAME(tmp, @3);
6580 def p_expr_primary_12(p
):
6581 '''expr_primary : SYSTEM_IDENTIFIER '(' ')' '''
6583 print('expr_primary_12', list(p
))
6586 # { perm_string tn = lex_strings.make(p[1]);
6587 # const vector<PExpr*>empty;
6588 # PECallFunction*tmp = new PECallFunction(tn, empty);
6589 # FILE_NAME(tmp, @1);
6592 # if (!gn_system_verilog()) {
6593 # yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
6599 def p_expr_primary_13(p
):
6600 '''expr_primary : implicit_class_handle '''
6602 print('expr_primary_13', list(p
))
6605 # { PEIdent*tmp = new PEIdent(*p[1]);
6606 # FILE_NAME(tmp,@1);
6613 def p_expr_primary_14(p
):
6614 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '''
6616 print('expr_primary_14', list(p
))
6619 # { pform_name_t*t_name = p[1];
6620 # while (! p[3]->empty()) {
6621 # t_name->push_back(p[3]->front());
6622 # p[3]->pop_front();
6624 # PEIdent*tmp = new PEIdent(*t_name);
6625 # FILE_NAME(tmp,@1);
6633 def p_expr_primary_15(p
):
6634 '''expr_primary : K_acos '(' expression ')' '''
6636 print('expr_primary_15', list(p
))
6639 # { perm_string tn = perm_string::literal("$acos");
6640 # PECallFunction*tmp = make_call_function(tn, p[3]);
6641 # FILE_NAME(tmp,@1);
6647 def p_expr_primary_16(p
):
6648 '''expr_primary : K_acosh '(' expression ')' '''
6650 print('expr_primary_16', list(p
))
6653 # { perm_string tn = perm_string::literal("$acosh");
6654 # PECallFunction*tmp = make_call_function(tn, p[3]);
6655 # FILE_NAME(tmp,@1);
6661 def p_expr_primary_17(p
):
6662 '''expr_primary : K_asin '(' expression ')' '''
6664 print('expr_primary_17', list(p
))
6667 # { perm_string tn = perm_string::literal("$asin");
6668 # PECallFunction*tmp = make_call_function(tn, p[3]);
6669 # FILE_NAME(tmp,@1);
6675 def p_expr_primary_18(p
):
6676 '''expr_primary : K_asinh '(' expression ')' '''
6678 print('expr_primary_18', list(p
))
6681 # { perm_string tn = perm_string::literal("$asinh");
6682 # PECallFunction*tmp = make_call_function(tn, p[3]);
6683 # FILE_NAME(tmp,@1);
6689 def p_expr_primary_19(p
):
6690 '''expr_primary : K_atan '(' expression ')' '''
6692 print('expr_primary_19', list(p
))
6695 # { perm_string tn = perm_string::literal("$atan");
6696 # PECallFunction*tmp = make_call_function(tn, p[3]);
6697 # FILE_NAME(tmp,@1);
6703 def p_expr_primary_20(p
):
6704 '''expr_primary : K_atanh '(' expression ')' '''
6706 print('expr_primary_20', list(p
))
6709 # { perm_string tn = perm_string::literal("$atanh");
6710 # PECallFunction*tmp = make_call_function(tn, p[3]);
6711 # FILE_NAME(tmp,@1);
6717 def p_expr_primary_21(p
):
6718 '''expr_primary : K_atan2 '(' expression ',' expression ')' '''
6720 print('expr_primary_21', list(p
))
6723 # { perm_string tn = perm_string::literal("$atan2");
6724 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6725 # FILE_NAME(tmp,@1);
6731 def p_expr_primary_22(p
):
6732 '''expr_primary : K_ceil '(' expression ')' '''
6734 print('expr_primary_22', list(p
))
6737 # { perm_string tn = perm_string::literal("$ceil");
6738 # PECallFunction*tmp = make_call_function(tn, p[3]);
6739 # FILE_NAME(tmp,@1);
6745 def p_expr_primary_23(p
):
6746 '''expr_primary : K_cos '(' expression ')' '''
6748 print('expr_primary_23', list(p
))
6751 # { perm_string tn = perm_string::literal("$cos");
6752 # PECallFunction*tmp = make_call_function(tn, p[3]);
6753 # FILE_NAME(tmp,@1);
6759 def p_expr_primary_24(p
):
6760 '''expr_primary : K_cosh '(' expression ')' '''
6762 print('expr_primary_24', list(p
))
6765 # { perm_string tn = perm_string::literal("$cosh");
6766 # PECallFunction*tmp = make_call_function(tn, p[3]);
6767 # FILE_NAME(tmp,@1);
6773 def p_expr_primary_25(p
):
6774 '''expr_primary : K_exp '(' expression ')' '''
6776 print('expr_primary_25', list(p
))
6779 # { perm_string tn = perm_string::literal("$exp");
6780 # PECallFunction*tmp = make_call_function(tn, p[3]);
6781 # FILE_NAME(tmp,@1);
6787 def p_expr_primary_26(p
):
6788 '''expr_primary : K_floor '(' expression ')' '''
6790 print('expr_primary_26', list(p
))
6793 # { perm_string tn = perm_string::literal("$floor");
6794 # PECallFunction*tmp = make_call_function(tn, p[3]);
6795 # FILE_NAME(tmp,@1);
6801 def p_expr_primary_27(p
):
6802 '''expr_primary : K_hypot '(' expression ',' expression ')' '''
6804 print('expr_primary_27', list(p
))
6807 # { perm_string tn = perm_string::literal("$hypot");
6808 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6809 # FILE_NAME(tmp,@1);
6815 def p_expr_primary_28(p
):
6816 '''expr_primary : K_ln '(' expression ')' '''
6818 print('expr_primary_28', list(p
))
6821 # { perm_string tn = perm_string::literal("$ln");
6822 # PECallFunction*tmp = make_call_function(tn, p[3]);
6823 # FILE_NAME(tmp,@1);
6829 def p_expr_primary_29(p
):
6830 '''expr_primary : K_log '(' expression ')' '''
6832 print('expr_primary_29', list(p
))
6835 # { perm_string tn = perm_string::literal("$log10");
6836 # PECallFunction*tmp = make_call_function(tn, p[3]);
6837 # FILE_NAME(tmp,@1);
6843 def p_expr_primary_30(p
):
6844 '''expr_primary : K_pow '(' expression ',' expression ')' '''
6846 print('expr_primary_30', list(p
))
6849 # { perm_string tn = perm_string::literal("$pow");
6850 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6851 # FILE_NAME(tmp,@1);
6857 def p_expr_primary_31(p
):
6858 '''expr_primary : K_sin '(' expression ')' '''
6860 print('expr_primary_31', list(p
))
6863 # { perm_string tn = perm_string::literal("$sin");
6864 # PECallFunction*tmp = make_call_function(tn, p[3]);
6865 # FILE_NAME(tmp,@1);
6871 def p_expr_primary_32(p
):
6872 '''expr_primary : K_sinh '(' expression ')' '''
6874 print('expr_primary_32', list(p
))
6877 # { perm_string tn = perm_string::literal("$sinh");
6878 # PECallFunction*tmp = make_call_function(tn, p[3]);
6879 # FILE_NAME(tmp,@1);
6885 def p_expr_primary_33(p
):
6886 '''expr_primary : K_sqrt '(' expression ')' '''
6888 print('expr_primary_33', list(p
))
6891 # { perm_string tn = perm_string::literal("$sqrt");
6892 # PECallFunction*tmp = make_call_function(tn, p[3]);
6893 # FILE_NAME(tmp,@1);
6899 def p_expr_primary_34(p
):
6900 '''expr_primary : K_tan '(' expression ')' '''
6902 print('expr_primary_34', list(p
))
6905 # { perm_string tn = perm_string::literal("$tan");
6906 # PECallFunction*tmp = make_call_function(tn, p[3]);
6907 # FILE_NAME(tmp,@1);
6913 def p_expr_primary_35(p
):
6914 '''expr_primary : K_tanh '(' expression ')' '''
6916 print('expr_primary_35', list(p
))
6919 # { perm_string tn = perm_string::literal("$tanh");
6920 # PECallFunction*tmp = make_call_function(tn, p[3]);
6921 # FILE_NAME(tmp,@1);
6927 def p_expr_primary_36(p
):
6928 '''expr_primary : K_abs '(' expression ')' '''
6930 print('expr_primary_36', list(p
))
6933 # { PEUnary*tmp = new PEUnary('m', p[3]);
6934 # FILE_NAME(tmp,@1);
6940 def p_expr_primary_37(p
):
6941 '''expr_primary : K_max '(' expression ',' expression ')' '''
6943 print('expr_primary_37', list(p
))
6946 # { PEBinary*tmp = new PEBinary('M', p[3], p[5]);
6947 # FILE_NAME(tmp,@1);
6953 def p_expr_primary_38(p
):
6954 '''expr_primary : K_min '(' expression ',' expression ')' '''
6956 print('expr_primary_38', list(p
))
6959 # { PEBinary*tmp = new PEBinary('m', p[3], p[5]);
6960 # FILE_NAME(tmp,@1);
6966 def p_expr_primary_39(p
):
6967 '''expr_primary : '(' expr_mintypmax ')' '''
6969 print('expr_primary_39', list(p
))
6976 def p_expr_primary_40(p
):
6977 '''expr_primary : '{' expression_list_proper '}' '''
6979 print('expr_primary_40', list(p
))
6982 # { PEConcat*tmp = new PEConcat(*p[2]);
6983 # FILE_NAME(tmp, @1);
6990 def p_expr_primary_41(p
):
6991 '''expr_primary : '{' expression '{' expression_list_proper '}' '}' '''
6993 print('expr_primary_41', list(p
))
6996 # { PExpr*rep = p[2];
6997 # PEConcat*tmp = new PEConcat(*p[4], rep);
6998 # FILE_NAME(tmp, @1);
7005 def p_expr_primary_42(p
):
7006 '''expr_primary : '{' expression '{' expression_list_proper '}' error '}' '''
7008 print('expr_primary_42', list(p
))
7011 # { PExpr*rep = p[2];
7012 # PEConcat*tmp = new PEConcat(*p[4], rep);
7013 # FILE_NAME(tmp, @1);
7016 # yyerror(@5, "error: Syntax error between internal '}' "
7017 # "and closing '}' of repeat concatenation.");
7023 def p_expr_primary_43(p
):
7024 '''expr_primary : '{' '}' '''
7026 print('expr_primary_43', list(p
))
7029 # { // This is the empty queue syntax.
7030 # if (gn_system_verilog()) {
7031 # list<PExpr*> empty_list;
7032 # PEConcat*tmp = new PEConcat(empty_list);
7033 # FILE_NAME(tmp, @1);
7036 # yyerror(@1, "error: Concatenations are not allowed to be empty.");
7043 def p_expr_primary_44(p
):
7044 '''expr_primary : expr_primary "'" '(' expression ')' '''
7046 print('expr_primary_44', list(p
))
7049 # { PExpr*base = p[4];
7050 # if (gn_system_verilog()) {
7051 # PECastSize*tmp = new PECastSize(p[1], base);
7052 # FILE_NAME(tmp, @1);
7055 # yyerror(@1, "error: Size cast requires SystemVerilog.");
7062 def p_expr_primary_45(p
):
7063 '''expr_primary : simple_type_or_string "'" '(' expression ')' '''
7065 print('expr_primary_45', list(p
))
7068 # { PExpr*base = p[4];
7069 # if (gn_system_verilog()) {
7070 # PECastType*tmp = new PECastType(p[1], base);
7071 # FILE_NAME(tmp, @1);
7074 # yyerror(@1, "error: Type cast requires SystemVerilog.");
7081 def p_expr_primary_46(p
):
7082 '''expr_primary : assignment_pattern '''
7084 print('expr_primary_46', list(p
))
7091 def p_expr_primary_47(p
):
7092 '''expr_primary : streaming_concatenation '''
7094 print('expr_primary_47', list(p
))
7101 def p_expr_primary_48(p
):
7102 '''expr_primary : K_null '''
7104 print('expr_primary_48', list(p
))
7107 # { PENull*tmp = new PENull;
7108 # FILE_NAME(tmp, @1);
7114 def p_function_item_list_opt_1(p
):
7115 '''function_item_list_opt : function_item_list '''
7117 print('function_item_list_opt_1', list(p
))
7124 def p_function_item_list_opt_2(p
):
7125 '''function_item_list_opt : '''
7127 print('function_item_list_opt_2', list(p
))
7134 def p_function_item_list_1(p
):
7135 '''function_item_list : function_item '''
7137 print('function_item_list_1', list(p
))
7144 def p_function_item_list_2(p
):
7145 '''function_item_list : function_item_list function_item '''
7147 print('function_item_list_2', list(p
))
7151 # if (p[1] && p[2]) {
7152 # vector<pform_tf_port_t>*tmp = p[1];
7153 # size_t s1 = tmp->size();
7154 # tmp->resize(s1 + p[2]->size());
7155 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
7156 # tmp->at(s1+idx) = p[2]->at(idx);
7159 # } else if (p[1]) {
7168 def p_function_item_1(p
):
7169 '''function_item : tf_port_declaration '''
7171 print('function_item_1', list(p
))
7178 def p_function_item_2(p
):
7179 '''function_item : block_item_decl '''
7181 print('function_item_2', list(p
))
7188 def p_gate_instance_1(p
):
7189 '''gate_instance : IDENTIFIER '(' expression_list_with_nuls ')' '''
7191 print('gate_instance_1', list(p
))
7194 # { lgate*tmp = new lgate;
7196 # tmp->parms = p[3];
7197 # tmp->file = @1.text;
7198 # tmp->lineno = @1.first_line;
7205 def p_gate_instance_2(p
):
7206 '''gate_instance : IDENTIFIER dimensions '(' expression_list_with_nuls ')' '''
7208 print('gate_instance_2', list(p
))
7211 # { lgate*tmp = new lgate;
7212 # list<pform_range_t>*rng = p[2];
7214 # tmp->parms = p[4];
7215 # tmp->range = rng->front();
7217 # assert(rng->empty());
7218 # tmp->file = @1.text;
7219 # tmp->lineno = @1.first_line;
7227 def p_gate_instance_3(p
):
7228 '''gate_instance : '(' expression_list_with_nuls ')' '''
7230 print('gate_instance_3', list(p
))
7233 # { lgate*tmp = new lgate;
7235 # tmp->parms = p[2];
7236 # tmp->file = @1.text;
7237 # tmp->lineno = @1.first_line;
7243 def p_gate_instance_4(p
):
7244 '''gate_instance : IDENTIFIER dimensions '''
7246 print('gate_instance_4', list(p
))
7249 # { lgate*tmp = new lgate;
7250 # list<pform_range_t>*rng = p[2];
7253 # tmp->parms_by_name = 0;
7254 # tmp->range = rng->front();
7256 # assert(rng->empty());
7257 # tmp->file = @1.text;
7258 # tmp->lineno = @1.first_line;
7266 def p_gate_instance_5(p
):
7267 '''gate_instance : IDENTIFIER '(' port_name_list ')' '''
7269 print('gate_instance_5', list(p
))
7272 # { lgate*tmp = new lgate;
7275 # tmp->parms_by_name = p[3];
7276 # tmp->file = @1.text;
7277 # tmp->lineno = @1.first_line;
7284 def p_gate_instance_6(p
):
7285 '''gate_instance : IDENTIFIER dimensions '(' port_name_list ')' '''
7287 print('gate_instance_6', list(p
))
7290 # { lgate*tmp = new lgate;
7291 # list<pform_range_t>*rng = p[2];
7294 # tmp->parms_by_name = p[4];
7295 # tmp->range = rng->front();
7297 # assert(rng->empty());
7298 # tmp->file = @1.text;
7299 # tmp->lineno = @1.first_line;
7307 def p_gate_instance_7(p
):
7308 '''gate_instance : IDENTIFIER '(' error ')' '''
7310 print('gate_instance_7', list(p
))
7313 # { lgate*tmp = new lgate;
7316 # tmp->parms_by_name = 0;
7317 # tmp->file = @1.text;
7318 # tmp->lineno = @1.first_line;
7319 # yyerror(@2, "error: Syntax error in instance port "
7320 # "expression(s).");
7327 def p_gate_instance_8(p
):
7328 '''gate_instance : IDENTIFIER dimensions '(' error ')' '''
7330 print('gate_instance_8', list(p
))
7333 # { lgate*tmp = new lgate;
7336 # tmp->parms_by_name = 0;
7337 # tmp->file = @1.text;
7338 # tmp->lineno = @1.first_line;
7339 # yyerror(@3, "error: Syntax error in instance port "
7340 # "expression(s).");
7347 def p_gate_instance_list_1(p
):
7348 '''gate_instance_list : gate_instance_list ',' gate_instance '''
7350 print('gate_instance_list_1', list(p
))
7353 # { svector<lgate>*tmp1 = p[1];
7354 # lgate*tmp2 = p[3];
7355 # svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
7363 def p_gate_instance_list_2(p
):
7364 '''gate_instance_list : gate_instance '''
7366 print('gate_instance_list_2', list(p
))
7369 # { svector<lgate>*tmp = new svector<lgate>(1);
7370 # (*tmp)[0] = *p[1];
7377 def p_gatetype_1(p
):
7378 '''gatetype : K_and '''
7380 print('gatetype_1', list(p
))
7383 # { p[0] = PGBuiltin::AND; }
7387 def p_gatetype_2(p
):
7388 '''gatetype : K_nand '''
7390 print('gatetype_2', list(p
))
7393 # { p[0] = PGBuiltin::NAND; }
7397 def p_gatetype_3(p
):
7398 '''gatetype : K_or '''
7400 print('gatetype_3', list(p
))
7403 # { p[0] = PGBuiltin::OR; }
7407 def p_gatetype_4(p
):
7408 '''gatetype : K_nor '''
7410 print('gatetype_4', list(p
))
7413 # { p[0] = PGBuiltin::NOR; }
7417 def p_gatetype_5(p
):
7418 '''gatetype : K_xor '''
7420 print('gatetype_5', list(p
))
7423 # { p[0] = PGBuiltin::XOR; }
7427 def p_gatetype_6(p
):
7428 '''gatetype : K_xnor '''
7430 print('gatetype_6', list(p
))
7433 # { p[0] = PGBuiltin::XNOR; }
7437 def p_gatetype_7(p
):
7438 '''gatetype : K_buf '''
7440 print('gatetype_7', list(p
))
7443 # { p[0] = PGBuiltin::BUF; }
7447 def p_gatetype_8(p
):
7448 '''gatetype : K_bufif0 '''
7450 print('gatetype_8', list(p
))
7453 # { p[0] = PGBuiltin::BUFIF0; }
7457 def p_gatetype_9(p
):
7458 '''gatetype : K_bufif1 '''
7460 print('gatetype_9', list(p
))
7463 # { p[0] = PGBuiltin::BUFIF1; }
7467 def p_gatetype_10(p
):
7468 '''gatetype : K_not '''
7470 print('gatetype_10', list(p
))
7473 # { p[0] = PGBuiltin::NOT; }
7477 def p_gatetype_11(p
):
7478 '''gatetype : K_notif0 '''
7480 print('gatetype_11', list(p
))
7483 # { p[0] = PGBuiltin::NOTIF0; }
7487 def p_gatetype_12(p
):
7488 '''gatetype : K_notif1 '''
7490 print('gatetype_12', list(p
))
7493 # { p[0] = PGBuiltin::NOTIF1; }
7497 def p_switchtype_1(p
):
7498 '''switchtype : K_nmos '''
7500 print('switchtype_1', list(p
))
7503 # { p[0] = PGBuiltin::NMOS; }
7507 def p_switchtype_2(p
):
7508 '''switchtype : K_rnmos '''
7510 print('switchtype_2', list(p
))
7513 # { p[0] = PGBuiltin::RNMOS; }
7517 def p_switchtype_3(p
):
7518 '''switchtype : K_pmos '''
7520 print('switchtype_3', list(p
))
7523 # { p[0] = PGBuiltin::PMOS; }
7527 def p_switchtype_4(p
):
7528 '''switchtype : K_rpmos '''
7530 print('switchtype_4', list(p
))
7533 # { p[0] = PGBuiltin::RPMOS; }
7537 def p_switchtype_5(p
):
7538 '''switchtype : K_cmos '''
7540 print('switchtype_5', list(p
))
7543 # { p[0] = PGBuiltin::CMOS; }
7547 def p_switchtype_6(p
):
7548 '''switchtype : K_rcmos '''
7550 print('switchtype_6', list(p
))
7553 # { p[0] = PGBuiltin::RCMOS; }
7557 def p_switchtype_7(p
):
7558 '''switchtype : K_tran '''
7560 print('switchtype_7', list(p
))
7563 # { p[0] = PGBuiltin::TRAN; }
7567 def p_switchtype_8(p
):
7568 '''switchtype : K_rtran '''
7570 print('switchtype_8', list(p
))
7573 # { p[0] = PGBuiltin::RTRAN; }
7577 def p_switchtype_9(p
):
7578 '''switchtype : K_tranif0 '''
7580 print('switchtype_9', list(p
))
7583 # { p[0] = PGBuiltin::TRANIF0; }
7587 def p_switchtype_10(p
):
7588 '''switchtype : K_tranif1 '''
7590 print('switchtype_10', list(p
))
7593 # { p[0] = PGBuiltin::TRANIF1; }
7597 def p_switchtype_11(p
):
7598 '''switchtype : K_rtranif0 '''
7600 print('switchtype_11', list(p
))
7603 # { p[0] = PGBuiltin::RTRANIF0; }
7607 def p_switchtype_12(p
):
7608 '''switchtype : K_rtranif1 '''
7610 print('switchtype_12', list(p
))
7613 # { p[0] = PGBuiltin::RTRANIF1; }
7617 def p_hierarchy_identifier_1(p
):
7618 '''hierarchy_identifier : IDENTIFIER '''
7620 print('hierarchy_identifier_1 FIXME', list(p
))
7621 lpvalue
= Leaf(token
.NAME
, p
[1])
7625 # { p[0] = new pform_name_t;
7626 # p[0]->push_back(name_component_t(lex_strings.make(p[1])));
7632 def p_hierarchy_identifier_2(p
):
7633 '''hierarchy_identifier : hierarchy_identifier '.' IDENTIFIER '''
7635 print('hierarchy_identifier_2', list(p
))
7638 # { pform_name_t * tmp = p[1];
7639 # tmp->push_back(name_component_t(lex_strings.make(p[3])));
7646 def p_hierarchy_identifier_3(p
):
7647 '''hierarchy_identifier : hierarchy_identifier '[' expression ']' '''
7649 print('hierarchy_identifier_3', list(p
))
7652 # { pform_name_t * tmp = p[1];
7653 # name_component_t&tail = tmp->back();
7654 # index_component_t itmp;
7655 # itmp.sel = index_component_t::SEL_BIT;
7657 # tail.index.push_back(itmp);
7663 def p_hierarchy_identifier_4(p
):
7664 '''hierarchy_identifier : hierarchy_identifier '[' '$' ']' '''
7666 print('hierarchy_identifier_4', list(p
))
7669 # { pform_name_t * tmp = p[1];
7670 # name_component_t&tail = tmp->back();
7671 # if (! gn_system_verilog()) {
7672 # yyerror(@3, "error: Last element expression ($) "
7673 # "requires SystemVerilog. Try enabling SystemVerilog.");
7675 # index_component_t itmp;
7676 # itmp.sel = index_component_t::SEL_BIT_LAST;
7679 # tail.index.push_back(itmp);
7685 def p_hierarchy_identifier_5(p
):
7686 '''hierarchy_identifier : hierarchy_identifier '[' expression ':' expression ']' '''
7688 print('hierarchy_identifier_5', list(p
))
7691 # { pform_name_t * tmp = p[1];
7692 # name_component_t&tail = tmp->back();
7693 # index_component_t itmp;
7694 # itmp.sel = index_component_t::SEL_PART;
7697 # tail.index.push_back(itmp);
7703 def p_hierarchy_identifier_6(p
):
7704 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_POS expression ']' '''
7706 print('hierarchy_identifier_6', list(p
))
7709 # { pform_name_t * tmp = p[1];
7710 # name_component_t&tail = tmp->back();
7711 # index_component_t itmp;
7712 # itmp.sel = index_component_t::SEL_IDX_UP;
7715 # tail.index.push_back(itmp);
7721 def p_hierarchy_identifier_7(p
):
7722 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_NEG expression ']' '''
7724 print('hierarchy_identifier_7', list(p
))
7727 # { pform_name_t * tmp = p[1];
7728 # name_component_t&tail = tmp->back();
7729 # index_component_t itmp;
7730 # itmp.sel = index_component_t::SEL_IDX_DO;
7733 # tail.index.push_back(itmp);
7739 def p_list_of_identifiers_1(p
):
7740 '''list_of_identifiers : IDENTIFIER '''
7742 print('list_of_identifiers_1', list(p
))
7745 # { p[0] = list_from_identifier(p[1]); }
7749 def p_list_of_identifiers_2(p
):
7750 '''list_of_identifiers : list_of_identifiers ',' IDENTIFIER '''
7752 print('list_of_identifiers_2', list(p
))
7755 # { p[0] = list_from_identifier(p[1], p[3]); }
7759 def p_list_of_port_identifiers_1(p
):
7760 '''list_of_port_identifiers : IDENTIFIER dimensions_opt '''
7762 print('list_of_port_identifiers_1', list(p
))
7765 # { p[0] = make_port_list(p[1], p[2], 0); }
7769 def p_list_of_port_identifiers_2(p
):
7770 '''list_of_port_identifiers : list_of_port_identifiers ',' IDENTIFIER dimensions_opt '''
7772 print('list_of_port_identifiers_2', list(p
))
7775 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
7779 def p_list_of_variable_port_identifiers_1(p
):
7780 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '''
7782 print('list_of_variable_port_identifiers_1', list(p
))
7785 # { p[0] = make_port_list(p[1], p[2], 0); }
7789 def p_list_of_variable_port_identifiers_2(p
):
7790 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '=' expression '''
7792 print('list_of_variable_port_identifiers_2', list(p
))
7795 # { p[0] = make_port_list(p[1], p[2], p[4]); }
7799 def p_list_of_variable_port_identifiers_3(p
):
7800 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '''
7802 print('list_of_variable_port_identifiers_3', list(p
))
7805 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
7809 def p_list_of_variable_port_identifiers_4(p
):
7810 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '=' expression '''
7812 print('list_of_variable_port_identifiers_4', list(p
))
7815 # { p[0] = make_port_list(p[1], p[3], p[4], p[6]); }
7819 def p_list_of_ports_1(p
):
7820 '''list_of_ports : port_opt '''
7822 print('list_of_ports_1', list(p
))
7825 # { vector<Module::port_t*>*tmp
7826 # = new vector<Module::port_t*>(1);
7833 def p_list_of_ports_2(p
):
7834 '''list_of_ports : list_of_ports ',' port_opt '''
7836 print('list_of_ports_2', list(p
))
7839 # { vector<Module::port_t*>*tmp = p[1];
7840 # tmp->push_back(p[3]);
7846 def p_list_of_port_declarations_1(p
):
7847 '''list_of_port_declarations : port_declaration '''
7848 if(parse_debug
> 1):
7849 print('list_of_port_declarations_1', list(p
))
7853 # { vector<Module::port_t*>*tmp
7854 # = new vector<Module::port_t*>(1);
7861 def p_list_of_port_declarations_2(p
):
7862 '''list_of_port_declarations : list_of_port_declarations ',' port_declaration '''
7864 print('list_of_port_declarations_2 FIXME', list(p
))
7865 # MOVE_TO absyn p[1].append(Leaf(token.NEWLINE, '\n')) # should be a comma
7866 # XXX p[3].prefix=' ' # add a space after the NL, must go in parameter
7871 # { vector<Module::port_t*>*tmp = p[1];
7872 # tmp->push_back(p[3]);
7878 def p_list_of_port_declarations_3(p
):
7879 '''list_of_port_declarations : list_of_port_declarations ',' IDENTIFIER '''
7881 print('list_of_port_declarations_3', list(p
))
7884 # { Module::port_t*ptmp;
7885 # perm_string name = lex_strings.make(p[3]);
7886 # ptmp = pform_module_port_reference(name, @3.text,
7888 # vector<Module::port_t*>*tmp = p[1];
7889 # tmp->push_back(ptmp);
7891 # /* Get the port declaration details, the port type
7892 # and what not, from context data stored by the
7893 # last port_declaration rule. */
7894 # pform_module_define_port(@3, name,
7895 # port_declaration_context.port_type,
7896 # port_declaration_context.port_net_type,
7897 # port_declaration_context.data_type, 0);
7904 def p_list_of_port_declarations_4(p
):
7905 '''list_of_port_declarations : list_of_port_declarations ',' '''
7907 print('list_of_port_declarations_4', list(p
))
7911 # yyerror(@2, "error: NULL port declarations are not "
7917 def p_list_of_port_declarations_5(p
):
7918 '''list_of_port_declarations : list_of_port_declarations ';' '''
7920 print('list_of_port_declarations_5', list(p
))
7924 # yyerror(@2, "error: ';' is an invalid port declaration "
7930 def p_port_declaration_1(p
):
7931 '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7933 print('port_declaration_1 FIXME', list(p
))
7934 comment
, dt
, name
= p
[2], p
[4], p
[5]
7935 p
[0] = absyn
.port_decl(comment
, dt
, name
)
7938 # { Module::port_t*ptmp;
7939 # perm_string name = lex_strings.make(p[5]);
7940 # data_type_t*use_type = p[4];
7941 # if (p[6]) use_type = new uarray_type_t(use_type, p[6]);
7942 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7943 # pform_module_define_port(@2, name, NetNet::PINPUT, p[3], use_type, p[1]);
7944 # port_declaration_context.port_type = NetNet::PINPUT;
7945 # port_declaration_context.port_net_type = p[3];
7946 # port_declaration_context.data_type = p[4];
7953 def p_port_declaration_2(p
):
7954 '''port_declaration : attribute_list_opt K_input K_wreal IDENTIFIER '''
7956 print('port_declaration_2', list(p
))
7959 # { Module::port_t*ptmp;
7960 # perm_string name = lex_strings.make(p[4]);
7961 # ptmp = pform_module_port_reference(name, @2.text,
7963 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7964 # FILE_NAME(real_type, @3);
7965 # pform_module_define_port(@2, name, NetNet::PINPUT,
7966 # NetNet::WIRE, real_type, p[1]);
7967 # port_declaration_context.port_type = NetNet::PINPUT;
7968 # port_declaration_context.port_net_type = NetNet::WIRE;
7969 # port_declaration_context.data_type = real_type;
7976 def p_port_declaration_3(p
):
7977 '''port_declaration : attribute_list_opt K_inout net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7979 print('port_declaration_3', list(p
))
7982 # { Module::port_t*ptmp;
7983 # perm_string name = lex_strings.make(p[5]);
7984 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7985 # pform_module_define_port(@2, name, NetNet::PINOUT, p[3], p[4], p[1]);
7986 # port_declaration_context.port_type = NetNet::PINOUT;
7987 # port_declaration_context.port_net_type = p[3];
7988 # port_declaration_context.data_type = p[4];
7991 # yyerror(@6, "sorry: Inout ports with unpacked dimensions not supported.");
7999 def p_port_declaration_4(p
):
8000 '''port_declaration : attribute_list_opt K_inout K_wreal IDENTIFIER '''
8002 print('port_declaration_4', list(p
))
8005 # { Module::port_t*ptmp;
8006 # perm_string name = lex_strings.make(p[4]);
8007 # ptmp = pform_module_port_reference(name, @2.text,
8009 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
8010 # FILE_NAME(real_type, @3);
8011 # pform_module_define_port(@2, name, NetNet::PINOUT,
8012 # NetNet::WIRE, real_type, p[1]);
8013 # port_declaration_context.port_type = NetNet::PINOUT;
8014 # port_declaration_context.port_net_type = NetNet::WIRE;
8015 # port_declaration_context.data_type = real_type;
8022 def p_port_declaration_5(p
):
8023 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
8025 print('port_declaration_5 FIXME', list(p
))
8026 comment
, dt
, name
= p
[2], p
[4], p
[5]
8027 p
[0] = absyn
.port_decl(comment
, dt
, name
)
8030 # { Module::port_t*ptmp;
8031 # perm_string name = lex_strings.make(p[5]);
8032 # data_type_t*use_dtype = p[4];
8033 # if (p[6]) use_dtype = new uarray_type_t(use_dtype, p[6]);
8034 # NetNet::Type use_type = p[3];
8035 # if (use_type == NetNet::IMPLICIT) {
8036 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
8037 # if (dtype->reg_flag)
8038 # use_type = NetNet::REG;
8039 # else if (dtype->implicit_flag)
8040 # use_type = NetNet::IMPLICIT;
8042 # use_type = NetNet::IMPLICIT_REG;
8044 # // The SystemVerilog types that can show up as
8045 # // output ports are implicitly (on the inside)
8046 # // variables because "reg" is not valid syntax
8048 # } else if (dynamic_cast<atom2_type_t*> (p[4])) {
8049 # use_type = NetNet::IMPLICIT_REG;
8050 # } else if (dynamic_cast<struct_type_t*> (p[4])) {
8051 # use_type = NetNet::IMPLICIT_REG;
8052 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[4])) {
8053 # if(etype->base_type == IVL_VT_LOGIC)
8054 # use_type = NetNet::IMPLICIT_REG;
8057 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
8058 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, use_dtype, p[1]);
8059 # port_declaration_context.port_type = NetNet::POUTPUT;
8060 # port_declaration_context.port_net_type = use_type;
8061 # port_declaration_context.data_type = p[4];
8068 def p_port_declaration_6(p
):
8069 '''port_declaration : attribute_list_opt K_output K_wreal IDENTIFIER '''
8071 print('port_declaration_6', list(p
))
8074 # { Module::port_t*ptmp;
8075 # perm_string name = lex_strings.make(p[4]);
8076 # ptmp = pform_module_port_reference(name, @2.text,
8078 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
8079 # FILE_NAME(real_type, @3);
8080 # pform_module_define_port(@2, name, NetNet::POUTPUT,
8081 # NetNet::WIRE, real_type, p[1]);
8082 # port_declaration_context.port_type = NetNet::POUTPUT;
8083 # port_declaration_context.port_net_type = NetNet::WIRE;
8084 # port_declaration_context.data_type = real_type;
8091 def p_port_declaration_7(p
):
8092 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER '=' expression '''
8094 print('port_declaration_7', list(p
))
8097 # { Module::port_t*ptmp;
8098 # perm_string name = lex_strings.make(p[5]);
8099 # NetNet::Type use_type = p[3];
8100 # if (use_type == NetNet::IMPLICIT) {
8101 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
8102 # if (dtype->reg_flag)
8103 # use_type = NetNet::REG;
8105 # use_type = NetNet::IMPLICIT_REG;
8107 # use_type = NetNet::IMPLICIT_REG;
8110 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
8111 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, p[4], p[1]);
8112 # port_declaration_context.port_type = NetNet::PINOUT;
8113 # port_declaration_context.port_net_type = use_type;
8114 # port_declaration_context.data_type = p[4];
8116 # pform_make_var_init(@5, name, p[7]);
8124 def p_net_type_opt_1(p
):
8125 '''net_type_opt : net_type '''
8127 print('net_type_opt_1', list(p
))
8134 def p_net_type_opt_2(p
):
8135 '''net_type_opt : '''
8136 if(parse_debug
> 2):
8137 print('net_type_opt_2', list(p
))
8144 def p_unsigned_signed_opt_1(p
):
8145 '''unsigned_signed_opt : K_signed '''
8147 print('unsigned_signed_opt_1', list(p
))
8154 def p_unsigned_signed_opt_2(p
):
8155 '''unsigned_signed_opt : K_unsigned '''
8157 print('unsigned_signed_opt_2', list(p
))
8164 def p_unsigned_signed_opt_3(p
):
8165 '''unsigned_signed_opt : '''
8167 print('unsigned_signed_opt_3', list(p
))
8174 def p_signed_unsigned_opt_1(p
):
8175 '''signed_unsigned_opt : K_signed '''
8177 print('signed_unsigned_opt_1', list(p
))
8184 def p_signed_unsigned_opt_2(p
):
8185 '''signed_unsigned_opt : K_unsigned '''
8187 print('signed_unsigned_opt_2', list(p
))
8194 def p_signed_unsigned_opt_3(p
):
8195 '''signed_unsigned_opt : '''
8197 print('signed_unsigned_opt_3', list(p
))
8204 def p_atom2_type_1(p
):
8205 '''atom2_type : K_byte '''
8207 print('atom2_type_1', list(p
))
8214 def p_atom2_type_2(p
):
8215 '''atom2_type : K_shortint '''
8217 print('atom2_type_2', list(p
))
8224 def p_atom2_type_3(p
):
8225 '''atom2_type : K_int '''
8227 print('atom2_type_3', list(p
))
8234 def p_atom2_type_4(p
):
8235 '''atom2_type : K_longint '''
8237 print('atom2_type_4', list(p
))
8245 '''lpvalue : hierarchy_identifier '''
8246 if(parse_debug
> 2):
8247 print('lpvalue_1', list(p
))
8251 # { PEIdent*tmp = pform_new_ident(*p[1]);
8252 # FILE_NAME(tmp, @1);
8260 '''lpvalue : implicit_class_handle '.' hierarchy_identifier '''
8262 print('lpvalue_2', list(p
))
8265 # { pform_name_t*t_name = p[1];
8266 # while (!p[3]->empty()) {
8267 # t_name->push_back(p[3]->front());
8268 # p[3]->pop_front();
8270 # PEIdent*tmp = new PEIdent(*t_name);
8271 # FILE_NAME(tmp, @1);
8280 '''lpvalue : '{' expression_list_proper '}' '''
8282 print('lpvalue_3', list(p
))
8285 # { PEConcat*tmp = new PEConcat(*p[2]);
8286 # FILE_NAME(tmp, @1);
8294 '''lpvalue : streaming_concatenation '''
8296 print('lpvalue_4', list(p
))
8299 # { yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
8305 def p_cont_assign_1(p
):
8306 '''cont_assign : lpvalue '=' expression '''
8308 print('cont_assign_1', list(p
))
8309 absyn
.cont_assign_1(p
)
8312 # { list<PExpr*>*tmp = new list<PExpr*>;
8313 # tmp->push_back(p[1]);
8314 # tmp->push_back(p[3]);
8320 def p_cont_assign_list_1(p
):
8321 '''cont_assign_list : cont_assign_list ',' cont_assign '''
8323 print('cont_assign_list_1', list(p
))
8326 # { list<PExpr*>*tmp = p[1];
8327 # tmp->splice(tmp->end(), *p[3]);
8334 def p_cont_assign_list_2(p
):
8335 '''cont_assign_list : cont_assign '''
8336 if(parse_debug
> 2):
8337 print('cont_assign_list_2', list(p
))
8345 '''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 '''
8346 if(parse_debug
> 2):
8347 print('module_1', list(p
))
8348 clsdecl
= absyn
.module_1(p
)
8355 def p__embed0_module(p
):
8356 '''_embed0_module : '''
8359 # { pform_startmodule(@2, p[4], p[2]==K_program, p[2]==K_interface, p[3], p[1]); }
8363 def p__embed1_module(p
):
8364 '''_embed1_module : '''
8367 # { pform_module_set_ports(p[8]); }
8371 def p__embed2_module(p
):
8372 '''_embed2_module : '''
8375 # { pform_set_scope_timescale(@2); }
8379 def p__embed3_module(p
):
8380 '''_embed3_module : '''
8383 # { Module::UCDriveType ucd;
8384 # // The lexor detected `unconnected_drive directives and
8385 # // marked what it found in the uc_drive variable. Use that
8386 # // to generate a UCD flag for the module.
8387 # switch (uc_drive) {
8390 # ucd = Module::UCD_NONE;
8393 # ucd = Module::UCD_PULL0;
8396 # ucd = Module::UCD_PULL1;
8399 # // Check that program/endprogram and module/endmodule
8400 # // keywords match.
8401 # if (p[2] != p[15]) {
8404 # yyerror(@15, "error: module not closed by endmodule.");
8407 # yyerror(@15, "error: program not closed by endprogram.");
8410 # yyerror(@15, "error: interface not closed by endinterface.");
8416 # pform_endmodule(p[4], in_celldefine, ucd);
8421 def p_module_start_1(p
):
8422 '''module_start : K_module '''
8423 if(parse_debug
> 1):
8424 print('module_start_1', list(p
))
8427 # { p[0] = K_module; }
8431 def p_module_start_2(p
):
8432 '''module_start : K_macromodule '''
8434 print('module_start_2', list(p
))
8437 # { p[0] = K_module; }
8441 def p_module_start_3(p
):
8442 '''module_start : K_program '''
8444 print('module_start_3', list(p
))
8447 # { p[0] = K_program; }
8451 def p_module_start_4(p
):
8452 '''module_start : K_interface '''
8454 print('module_start_4', list(p
))
8457 # { p[0] = K_interface; }
8461 def p_module_end_1(p
):
8462 '''module_end : K_endmodule '''
8463 if(parse_debug
> 2):
8464 print('module_end_1', list(p
))
8467 # { p[0] = K_module; }
8471 def p_module_end_2(p
):
8472 '''module_end : K_endprogram '''
8474 print('module_end_2', list(p
))
8477 # { p[0] = K_program; }
8481 def p_module_end_3(p
):
8482 '''module_end : K_endinterface '''
8484 print('module_end_3', list(p
))
8487 # { p[0] = K_interface; }
8491 def p_endlabel_opt_1(p
):
8492 '''endlabel_opt : ':' IDENTIFIER '''
8494 print('endlabel_opt_1', list(p
))
8501 def p_endlabel_opt_2(p
):
8502 '''endlabel_opt : '''
8503 if(parse_debug
> 2):
8504 print('endlabel_opt_2', list(p
))
8511 def p_module_attribute_foreign_1(p
):
8512 '''module_attribute_foreign : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP '''
8514 print('module_attribute_foreign_1', list(p
))
8521 def p_module_attribute_foreign_2(p
):
8522 '''module_attribute_foreign : '''
8523 if(parse_debug
> 2):
8524 print('module_attribute_foreign_2', list(p
))
8531 def p_module_port_list_opt_1(p
):
8532 '''module_port_list_opt : '(' list_of_ports ')' '''
8534 print('module_port_list_opt_1', list(p
))
8541 def p_module_port_list_opt_2(p
):
8542 '''module_port_list_opt : '(' list_of_port_declarations ')' '''
8543 if(parse_debug
> 2):
8544 print('module_port_list_opt_2', list(p
))
8551 def p_module_port_list_opt_3(p
):
8552 '''module_port_list_opt : '''
8554 print('module_port_list_opt_3', list(p
))
8561 def p_module_port_list_opt_4(p
):
8562 '''module_port_list_opt : '(' error ')' '''
8564 print('module_port_list_opt_4', list(p
))
8567 # { yyerror(@2, "Errors in port declarations.");
8574 def p_module_parameter_port_list_opt_1(p
):
8575 '''module_parameter_port_list_opt : '''
8576 if(parse_debug
> 2):
8577 print('module_parameter_port_list_opt_1', list(p
))
8583 def p_module_parameter_port_list_opt_2(p
):
8584 '''module_parameter_port_list_opt : '#' '(' module_parameter_port_list ')' '''
8586 print('module_parameter_port_list_opt_2', list(p
))
8593 def p_module_parameter_port_list_1(p
):
8594 '''module_parameter_port_list : K_parameter param_type parameter_assign '''
8596 print('module_parameter_port_list_1', list(p
))
8603 def p_module_parameter_port_list_2(p
):
8604 '''module_parameter_port_list : module_parameter_port_list ',' parameter_assign '''
8606 print('module_parameter_port_list_2', list(p
))
8607 p
[0] = p
[1].append(p
[3])
8613 def p_module_parameter_port_list_3(p
):
8614 '''module_parameter_port_list : module_parameter_port_list ',' K_parameter param_type parameter_assign '''
8616 print('module_parameter_port_list_3', list(p
))
8617 p
[1].append(Leaf(token
.COMMA
, ','))
8618 p
[1].append(Leaf(token
.NEWLINE
, '\n'))
8619 p
[5].prefix
= ' ' # add space after newline
8627 def p_module_item_1(p
):
8628 '''module_item : module '''
8630 print('module_item_1', list(p
))
8636 def p_module_item_2(p
):
8637 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' '''
8639 print('module_item_2', list(p
))
8641 p
[0] = absyn
.module_item_2(p
[2], p
[3], p
[5])
8642 #p[0] = ["module_item_2"]+list(p)
8645 # { data_type_t*data_type = p[3];
8646 # if (data_type == 0) {
8647 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8648 # FILE_NAME(data_type, @2);
8650 # pform_set_data_type(@2, data_type, p[5], p[2], p[1]);
8652 # yyerror(@2, "sorry: net delays not supported.");
8660 def p_module_item_3(p
):
8661 '''module_item : attribute_list_opt K_wreal delay3 net_variable_list ';' '''
8663 print('module_item_3', list(p
))
8666 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
8667 # pform_set_data_type(@2, tmpt, p[4], NetNet::WIRE, p[1]);
8669 # yyerror(@3, "sorry: net delays not supported.");
8677 def p_module_item_4(p
):
8678 '''module_item : attribute_list_opt K_wreal net_variable_list ';' '''
8680 print('module_item_4', list(p
))
8683 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
8684 # pform_set_data_type(@2, tmpt, p[3], NetNet::WIRE, p[1]);
8690 def p_module_item_5(p
):
8691 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_decl_assigns ';' '''
8693 print('module_item_5', list(p
))
8696 # { data_type_t*data_type = p[3];
8697 # if (data_type == 0) {
8698 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8699 # FILE_NAME(data_type, @2);
8701 # pform_makewire(@2, p[4], str_strength, p[5], p[2], data_type);
8703 # yywarn(@2, "Attributes are not supported on net declaration "
8704 # "assignments and will be discarded.");
8711 def p_module_item_6(p
):
8712 '''module_item : attribute_list_opt net_type data_type_or_implicit drive_strength net_decl_assigns ';' '''
8714 print('module_item_6', list(p
))
8717 # { data_type_t*data_type = p[3];
8718 # if (data_type == 0) {
8719 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8720 # FILE_NAME(data_type, @2);
8722 # pform_makewire(@2, 0, p[4], p[5], p[2], data_type);
8724 # yywarn(@2, "Attributes are not supported on net declaration "
8725 # "assignments and will be discarded.");
8732 def p_module_item_7(p
):
8733 '''module_item : attribute_list_opt K_wreal net_decl_assigns ';' '''
8735 print('module_item_7', list(p
))
8738 # { real_type_t*data_type = new real_type_t(real_type_t::REAL);
8739 # pform_makewire(@2, 0, str_strength, p[3], NetNet::WIRE, data_type);
8741 # yywarn(@2, "Attributes are not supported on net declaration "
8742 # "assignments and will be discarded.");
8749 def p_module_item_8(p
):
8750 '''module_item : K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' '''
8752 print('module_item_8', list(p
))
8755 # { yyerror(@1, "sorry: trireg nets not supported.");
8762 def p_module_item_9(p
):
8763 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit list_of_port_identifiers ';' '''
8765 print('module_item_9', list(p
))
8768 # { pform_module_define_port(@2, p[5], p[2], p[3], p[4], p[1]); }
8772 def p_module_item_10(p
):
8773 '''module_item : attribute_list_opt port_direction K_wreal list_of_port_identifiers ';' '''
8775 print('module_item_10', list(p
))
8778 # { real_type_t*real_type = new real_type_t(real_type_t::REAL);
8779 # pform_module_define_port(@2, p[4], p[2], NetNet::WIRE, real_type, p[1]);
8784 def p_module_item_11(p
):
8785 '''module_item : attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' '''
8787 print('module_item_11', list(p
))
8790 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8791 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8792 # if (dtype->implicit_flag)
8793 # use_type = NetNet::NONE;
8795 # if (use_type == NetNet::NONE)
8796 # pform_set_port_type(@2, p[4], NetNet::PINOUT, p[3], p[1]);
8798 # pform_module_define_port(@2, p[4], NetNet::PINOUT, use_type, p[3], p[1]);
8803 def p_module_item_12(p
):
8804 '''module_item : attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' '''
8806 print('module_item_12', list(p
))
8809 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8810 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8811 # if (dtype->implicit_flag)
8812 # use_type = NetNet::NONE;
8814 # if (use_type == NetNet::NONE)
8815 # pform_set_port_type(@2, p[4], NetNet::PINPUT, p[3], p[1]);
8817 # pform_module_define_port(@2, p[4], NetNet::PINPUT, use_type, p[3], p[1]);
8822 def p_module_item_13(p
):
8823 '''module_item : attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' '''
8825 print('module_item_13', list(p
))
8828 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8829 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8830 # if (dtype->implicit_flag)
8831 # use_type = NetNet::NONE;
8832 # else if (dtype->reg_flag)
8833 # use_type = NetNet::REG;
8835 # use_type = NetNet::IMPLICIT_REG;
8837 # // The SystemVerilog types that can show up as
8838 # // output ports are implicitly (on the inside)
8839 # // variables because "reg" is not valid syntax
8841 # } else if (dynamic_cast<atom2_type_t*> (p[3])) {
8842 # use_type = NetNet::IMPLICIT_REG;
8843 # } else if (dynamic_cast<struct_type_t*> (p[3])) {
8844 # use_type = NetNet::IMPLICIT_REG;
8845 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[3])) {
8846 # if(etype->base_type == IVL_VT_LOGIC)
8847 # use_type = NetNet::IMPLICIT_REG;
8849 # if (use_type == NetNet::NONE)
8850 # pform_set_port_type(@2, p[4], NetNet::POUTPUT, p[3], p[1]);
8852 # pform_module_define_port(@2, p[4], NetNet::POUTPUT, use_type, p[3], p[1]);
8857 def p_module_item_14(p
):
8858 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit error ';' '''
8860 print('module_item_14', list(p
))
8863 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8864 # if (p[1]) delete p[1];
8865 # if (p[4]) delete p[4];
8871 def p_module_item_15(p
):
8872 '''module_item : attribute_list_opt K_inout data_type_or_implicit error ';' '''
8874 print('module_item_15', list(p
))
8877 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8878 # if (p[1]) delete p[1];
8879 # if (p[3]) delete p[3];
8885 def p_module_item_16(p
):
8886 '''module_item : attribute_list_opt K_input data_type_or_implicit error ';' '''
8888 print('module_item_16', list(p
))
8891 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8892 # if (p[1]) delete p[1];
8893 # if (p[3]) delete p[3];
8899 def p_module_item_17(p
):
8900 '''module_item : attribute_list_opt K_output data_type_or_implicit error ';' '''
8902 print('module_item_17', list(p
))
8905 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8906 # if (p[1]) delete p[1];
8907 # if (p[3]) delete p[3];
8913 def p_module_item_18(p
):
8914 '''module_item : DISCIPLINE_IDENTIFIER list_of_identifiers ';' '''
8916 print('module_item_18', list(p
))
8919 # { pform_attach_discipline(@1, p[1], p[2]); }
8923 def p_module_item_19(p
):
8924 '''module_item : attribute_list_opt _embed0_module_item block_item_decl '''
8926 print('module_item_19', list(p
))
8929 # { delete attributes_in_context;
8930 # attributes_in_context = 0;
8935 def p_module_item_20(p
):
8936 '''module_item : K_defparam _embed1_module_item defparam_assign_list ';' '''
8938 print('module_item_20', list(p
))
8944 def p_module_item_21(p
):
8945 '''module_item : attribute_list_opt gatetype gate_instance_list ';' '''
8947 print('module_item_21', list(p
))
8950 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
8954 def p_module_item_22(p
):
8955 '''module_item : attribute_list_opt gatetype delay3 gate_instance_list ';' '''
8957 print('module_item_22', list(p
))
8960 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
8964 def p_module_item_23(p
):
8965 '''module_item : attribute_list_opt gatetype drive_strength gate_instance_list ';' '''
8967 print('module_item_23', list(p
))
8970 # { pform_makegates(@2, p[2], p[3], 0, p[4], p[1]); }
8974 def p_module_item_24(p
):
8975 '''module_item : attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';' '''
8977 print('module_item_24', list(p
))
8980 # { pform_makegates(@2, p[2], p[3], p[4], p[5], p[1]); }
8984 def p_module_item_25(p
):
8985 '''module_item : attribute_list_opt switchtype gate_instance_list ';' '''
8987 print('module_item_25', list(p
))
8990 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
8994 def p_module_item_26(p
):
8995 '''module_item : attribute_list_opt switchtype delay3 gate_instance_list ';' '''
8997 print('module_item_26', list(p
))
9000 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
9004 def p_module_item_27(p
):
9005 '''module_item : K_pullup gate_instance_list ';' '''
9007 print('module_item_27', list(p
))
9010 # { pform_makegates(@1, PGBuiltin::PULLUP, pull_strength, 0, p[2], 0); }
9014 def p_module_item_28(p
):
9015 '''module_item : K_pulldown gate_instance_list ';' '''
9017 print('module_item_28', list(p
))
9020 # { pform_makegates(@1, PGBuiltin::PULLDOWN, pull_strength, 0, p[2], 0); }
9024 def p_module_item_29(p
):
9025 '''module_item : K_pullup '(' dr_strength1 ')' gate_instance_list ';' '''
9027 print('module_item_29', list(p
))
9030 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[5], 0); }
9034 def p_module_item_30(p
):
9035 '''module_item : K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
9037 print('module_item_30', list(p
))
9040 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[7], 0); }
9044 def p_module_item_31(p
):
9045 '''module_item : K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
9047 print('module_item_31', list(p
))
9050 # { pform_makegates(@1, PGBuiltin::PULLUP, p[5], 0, p[7], 0); }
9054 def p_module_item_32(p
):
9055 '''module_item : K_pulldown '(' dr_strength0 ')' gate_instance_list ';' '''
9057 print('module_item_32', list(p
))
9060 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[5], 0); }
9064 def p_module_item_33(p
):
9065 '''module_item : K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
9067 print('module_item_33', list(p
))
9070 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[5], 0, p[7], 0); }
9074 def p_module_item_34(p
):
9075 '''module_item : K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
9077 print('module_item_34', list(p
))
9080 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[7], 0); }
9084 def p_module_item_35(p
):
9085 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' '''
9087 print('module_item_35', list(p
))
9090 # { perm_string tmp1 = lex_strings.make(p[2]);
9091 # pform_make_modgates(@2, tmp1, p[3], p[4], p[1]);
9097 def p_module_item_36(p
):
9098 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt error ';' '''
9100 print('module_item_36', list(p
))
9103 # { yyerror(@2, "error: Invalid module instantiation");
9105 # if (p[1]) delete p[1];
9110 def p_module_item_37(p
):
9111 '''module_item : K_assign drive_strength_opt delay3_opt cont_assign_list ';' '''
9112 if(parse_debug
> 2):
9113 print('module_item_37', list(p
))
9116 # { pform_make_pgassign_list(p[4], p[3], p[2], @1.text, @1.first_line); }
9120 def p_module_item_38(p
):
9121 '''module_item : attribute_list_opt K_always statement_item '''
9123 print('module_item_38', list(p
))
9126 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, p[3], p[1]);
9127 # FILE_NAME(tmp, @2);
9132 def p_module_item_39(p
):
9133 '''module_item : attribute_list_opt K_always_comb statement_item '''
9135 print('module_item_39', list(p
))
9137 absyn
.always_comb(p
[3], p
[1])
9140 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_COMB, p[3], p[1]);
9141 # FILE_NAME(tmp, @2);
9146 def p_module_item_40(p
):
9147 '''module_item : attribute_list_opt K_always_ff statement_item '''
9149 print('module_item_40', list(p
))
9152 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, p[3], p[1]);
9153 # FILE_NAME(tmp, @2);
9158 def p_module_item_41(p
):
9159 '''module_item : attribute_list_opt K_always_latch statement_item '''
9161 print('module_item_41', list(p
))
9164 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_LATCH, p[3], p[1]);
9165 # FILE_NAME(tmp, @2);
9170 def p_module_item_42(p
):
9171 '''module_item : attribute_list_opt K_initial statement_item '''
9173 print('module_item_42', list(p
))
9176 # { PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, p[3], p[1]);
9177 # FILE_NAME(tmp, @2);
9182 def p_module_item_43(p
):
9183 '''module_item : attribute_list_opt K_final statement_item '''
9185 print('module_item_43', list(p
))
9188 # { PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, p[3], p[1]);
9189 # FILE_NAME(tmp, @2);
9194 def p_module_item_44(p
):
9195 '''module_item : attribute_list_opt K_analog analog_statement '''
9197 print('module_item_44', list(p
))
9200 # { pform_make_analog_behavior(@2, IVL_PR_ALWAYS, p[3]); }
9204 def p_module_item_45(p
):
9205 '''module_item : attribute_list_opt assertion_item '''
9207 print('module_item_45', list(p
))
9213 def p_module_item_46(p
):
9214 '''module_item : timeunits_declaration '''
9216 print('module_item_46', list(p
))
9222 def p_module_item_47(p
):
9223 '''module_item : class_declaration '''
9225 print('module_item_47', list(p
))
9231 def p_module_item_48(p
):
9232 '''module_item : task_declaration '''
9234 print('module_item_48', list(p
))
9240 def p_module_item_49(p
):
9241 '''module_item : function_declaration '''
9243 print('module_item_49', list(p
))
9249 def p_module_item_50(p
):
9250 '''module_item : K_generate generate_item_list_opt K_endgenerate '''
9252 print('module_item_50', list(p
))
9255 # { // Test for bad nesting. I understand it, but it is illegal.
9256 # if (pform_parent_generate()) {
9257 # cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
9258 # cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
9259 # cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
9266 def p_module_item_51(p
):
9267 '''module_item : K_genvar list_of_identifiers ';' '''
9269 print('module_item_51', list(p
))
9272 # { pform_genvars(@1, p[2]); }
9276 def p_module_item_52(p
):
9277 '''module_item : K_for '(' IDENTIFIER '=' expression ';' expression ';' IDENTIFIER '=' expression ')' _embed2_module_item generate_block '''
9279 print('module_item_52', list(p
))
9282 # { pform_endgenerate(); }
9286 def p_module_item_53(p
):
9287 '''module_item : generate_if generate_block_opt K_else _embed3_module_item generate_block '''
9289 print('module_item_53', list(p
))
9292 # { pform_endgenerate(); }
9296 def p_module_item_54(p
):
9297 '''module_item : generate_if generate_block_opt %prec less_than_K_else '''
9299 print('module_item_54', list(p
))
9302 # { pform_endgenerate(); }
9306 def p_module_item_55(p
):
9307 '''module_item : K_case '(' expression ')' _embed4_module_item generate_case_items K_endcase '''
9309 print('module_item_55', list(p
))
9312 # { pform_endgenerate(); }
9316 def p_module_item_56(p
):
9317 '''module_item : modport_declaration '''
9319 print('module_item_56', list(p
))
9325 def p_module_item_57(p
):
9326 '''module_item : package_import_declaration '''
9328 print('module_item_57', list(p
))
9334 def p_module_item_58(p
):
9335 '''module_item : attribute_list_opt K_specparam _embed5_module_item specparam_decl ';' '''
9337 print('module_item_58', list(p
))
9343 def p_module_item_59(p
):
9344 '''module_item : K_specify _embed6_module_item specify_item_list_opt K_endspecify '''
9346 print('module_item_59', list(p
))
9352 def p_module_item_60(p
):
9353 '''module_item : K_specify error K_endspecify '''
9355 print('module_item_60', list(p
))
9358 # { yyerror(@1, "error: syntax error in specify block");
9364 def p_module_item_61(p
):
9365 '''module_item : error ';' '''
9367 print('module_item_61', list(p
))
9370 # { yyerror(@2, "error: invalid module item.");
9376 def p_module_item_62(p
):
9377 '''module_item : K_assign error '=' expression ';' '''
9379 print('module_item_62', list(p
))
9382 # { yyerror(@1, "error: syntax error in left side "
9383 # "of continuous assignment.");
9389 def p_module_item_63(p
):
9390 '''module_item : K_assign error ';' '''
9392 print('module_item_63', list(p
))
9395 # { yyerror(@1, "error: syntax error in "
9396 # "continuous assignment");
9402 def p_module_item_64(p
):
9403 '''module_item : K_function error K_endfunction endlabel_opt '''
9405 print('module_item_64', list(p
))
9408 # { yyerror(@1, "error: I give up on this "
9409 # "function definition.");
9411 # if (!gn_system_verilog()) {
9412 # yyerror(@4, "error: Function end names require "
9413 # "SystemVerilog.");
9422 def p_module_item_65(p
):
9423 '''module_item : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';' '''
9425 print('module_item_65', list(p
))
9428 # { perm_string tmp3 = lex_strings.make(p[3]);
9429 # perm_string tmp5 = lex_strings.make(p[5]);
9430 # pform_set_attrib(tmp3, tmp5, p[7]);
9437 def p_module_item_66(p
):
9438 '''module_item : KK_attribute '(' error ')' ';' '''
9440 print('module_item_66', list(p
))
9443 # { yyerror(@1, "error: Malformed $attribute parameter list."); }
9447 def p__embed0_module_item(p
):
9448 '''_embed0_module_item : '''
9451 # { attributes_in_context = p[1]; }
9455 def p__embed1_module_item(p
):
9456 '''_embed1_module_item : '''
9459 # { if (pform_in_interface())
9460 # yyerror(@1, "error: Parameter overrides are not allowed "
9461 # "in interfaces.");
9466 def p__embed2_module_item(p
):
9467 '''_embed2_module_item : '''
9470 # { pform_start_generate_for(@1, p[3], p[5], p[7], p[9], p[11]); }
9474 def p__embed3_module_item(p
):
9475 '''_embed3_module_item : '''
9478 # { pform_start_generate_else(@1); }
9482 def p__embed4_module_item(p
):
9483 '''_embed4_module_item : '''
9486 # { pform_start_generate_case(@1, p[3]); }
9490 def p__embed5_module_item(p
):
9491 '''_embed5_module_item : '''
9494 # { if (pform_in_interface())
9495 # yyerror(@1, "error: specparam declarations are not allowed "
9496 # "in interfaces.");
9501 def p__embed6_module_item(p
):
9502 '''_embed6_module_item : '''
9505 # { if (pform_in_interface())
9506 # yyerror(@1, "error: specify blocks are not allowed "
9507 # "in interfaces.");
9512 def p_module_item_list_1(p
):
9513 '''module_item_list : module_item_list module_item '''
9515 print('module_item_list_1', list(p
))
9521 def p_module_item_list_2(p
):
9522 '''module_item_list : module_item '''
9523 if(parse_debug
> 2):
9524 print('module_item_list_2', list(p
))
9530 def p_module_item_list_opt_1(p
):
9531 '''module_item_list_opt : module_item_list '''
9532 if(parse_debug
> 2):
9533 print('module_item_list_opt_1', list(p
))
9539 def p_module_item_list_opt_2(p
):
9540 '''module_item_list_opt : '''
9542 print('module_item_list_opt_2', list(p
))
9548 def p_generate_if_1(p
):
9549 '''generate_if : K_if '(' expression ')' '''
9551 print('generate_if_1', list(p
))
9554 # { pform_start_generate_if(@1, p[3]); }
9558 def p_generate_case_items_1(p
):
9559 '''generate_case_items : generate_case_items generate_case_item '''
9561 print('generate_case_items_1', list(p
))
9567 def p_generate_case_items_2(p
):
9568 '''generate_case_items : generate_case_item '''
9570 print('generate_case_items_2', list(p
))
9576 def p_generate_case_item_1(p
):
9577 '''generate_case_item : expression_list_proper ':' _embed0_generate_case_item generate_block_opt '''
9579 print('generate_case_item_1', list(p
))
9582 # { pform_endgenerate(); }
9586 def p_generate_case_item_2(p
):
9587 '''generate_case_item : K_default ':' _embed1_generate_case_item generate_block_opt '''
9589 print('generate_case_item_2', list(p
))
9592 # { pform_endgenerate(); }
9596 def p__embed0_generate_case_item(p
):
9597 '''_embed0_generate_case_item : '''
9600 # { pform_generate_case_item(@1, p[1]); }
9604 def p__embed1_generate_case_item(p
):
9605 '''_embed1_generate_case_item : '''
9608 # { pform_generate_case_item(@1, 0); }
9612 def p_generate_item_1(p
):
9613 '''generate_item : module_item '''
9615 print('generate_item_1', list(p
))
9621 def p_generate_item_2(p
):
9622 '''generate_item : K_begin generate_item_list_opt K_end '''
9624 print('generate_item_2', list(p
))
9627 # { /* Detect and warn about anachronistic begin/end use */
9628 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
9630 # cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
9636 def p_generate_item_3(p
):
9637 '''generate_item : K_begin ':' IDENTIFIER _embed0_generate_item generate_item_list_opt K_end '''
9639 print('generate_item_3', list(p
))
9642 # { /* Detect and warn about anachronistic named begin/end use */
9643 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
9645 # cerr << @1 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
9647 # pform_endgenerate();
9652 def p__embed0_generate_item(p
):
9653 '''_embed0_generate_item : '''
9657 # pform_start_generate_nblock(@1, p[3]);
9662 def p_generate_item_list_1(p
):
9663 '''generate_item_list : generate_item_list generate_item '''
9665 print('generate_item_list_1', list(p
))
9671 def p_generate_item_list_2(p
):
9672 '''generate_item_list : generate_item '''
9674 print('generate_item_list_2', list(p
))
9680 def p_generate_item_list_opt_1(p
):
9681 '''generate_item_list_opt : generate_item_list '''
9683 print('generate_item_list_opt_1', list(p
))
9689 def p_generate_item_list_opt_2(p
):
9690 '''generate_item_list_opt : '''
9692 print('generate_item_list_opt_2', list(p
))
9698 def p_generate_block_1(p
):
9699 '''generate_block : module_item '''
9701 print('generate_block_1', list(p
))
9707 def p_generate_block_2(p
):
9708 '''generate_block : K_begin generate_item_list_opt K_end '''
9710 print('generate_block_2', list(p
))
9716 def p_generate_block_3(p
):
9717 '''generate_block : K_begin ':' IDENTIFIER generate_item_list_opt K_end endlabel_opt '''
9719 print('generate_block_3', list(p
))
9722 # { pform_generate_block_name(p[3]);
9724 # if (strcmp(p[3],p[6]) != 0) {
9725 # yyerror(@6, "error: End label doesn't match "
9728 # if (! gn_system_verilog()) {
9729 # yyerror(@6, "error: Begin end labels require "
9730 # "SystemVerilog.");
9739 def p_generate_block_opt_1(p
):
9740 '''generate_block_opt : generate_block '''
9742 print('generate_block_opt_1', list(p
))
9748 def p_generate_block_opt_2(p
):
9749 '''generate_block_opt : ';' '''
9751 print('generate_block_opt_2', list(p
))
9757 def p_net_decl_assign_1(p
):
9758 '''net_decl_assign : IDENTIFIER '=' expression '''
9760 print('net_decl_assign_1', list(p
))
9763 # { net_decl_assign_t*tmp = new net_decl_assign_t;
9765 # tmp->name = lex_strings.make(p[1]);
9773 def p_net_decl_assigns_1(p
):
9774 '''net_decl_assigns : net_decl_assigns ',' net_decl_assign '''
9776 print('net_decl_assigns_1', list(p
))
9779 # { net_decl_assign_t*tmp = p[1];
9780 # p[3]->next = tmp->next;
9787 def p_net_decl_assigns_2(p
):
9788 '''net_decl_assigns : net_decl_assign '''
9790 print('net_decl_assigns_2', list(p
))
9798 def p_bit_logic_1(p
):
9799 '''bit_logic : K_logic '''
9801 print('bit_logic_1', list(p
))
9804 # { p[0] = IVL_VT_LOGIC; }
9808 def p_bit_logic_2(p
):
9809 '''bit_logic : K_bool '''
9811 print('bit_logic_2', list(p
))
9814 # { p[0] = IVL_VT_BOOL; /* Icarus misc */}
9818 def p_bit_logic_3(p
):
9819 '''bit_logic : K_bit '''
9821 print('bit_logic_3', list(p
))
9824 # { p[0] = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
9828 def p_bit_logic_opt_1(p
):
9829 '''bit_logic_opt : bit_logic '''
9831 print('bit_logic_opt_1', list(p
))
9837 def p_bit_logic_opt_2(p
):
9838 '''bit_logic_opt : '''
9840 print('bit_logic_opt_2', list(p
))
9843 # { p[0] = IVL_VT_NO_TYPE; }
9847 def p_net_type_1(p
):
9848 '''net_type : K_wire '''
9849 if(parse_debug
> 2):
9850 print('net_type_1', list(p
))
9858 def p_net_type_2(p
):
9859 '''net_type : K_tri '''
9861 print('net_type_2', list(p
))
9864 # { p[0] = NetNet::TRI; }
9868 def p_net_type_3(p
):
9869 '''net_type : K_tri1 '''
9871 print('net_type_3', list(p
))
9874 # { p[0] = NetNet::TRI1; }
9878 def p_net_type_4(p
):
9879 '''net_type : K_supply0 '''
9881 print('net_type_4', list(p
))
9884 # { p[0] = NetNet::SUPPLY0; }
9888 def p_net_type_5(p
):
9889 '''net_type : K_wand '''
9891 print('net_type_5', list(p
))
9894 # { p[0] = NetNet::WAND; }
9898 def p_net_type_6(p
):
9899 '''net_type : K_triand '''
9901 print('net_type_6', list(p
))
9904 # { p[0] = NetNet::TRIAND; }
9908 def p_net_type_7(p
):
9909 '''net_type : K_tri0 '''
9911 print('net_type_7', list(p
))
9914 # { p[0] = NetNet::TRI0; }
9918 def p_net_type_8(p
):
9919 '''net_type : K_supply1 '''
9921 print('net_type_8', list(p
))
9924 # { p[0] = NetNet::SUPPLY1; }
9928 def p_net_type_9(p
):
9929 '''net_type : K_wor '''
9931 print('net_type_9', list(p
))
9934 # { p[0] = NetNet::WOR; }
9938 def p_net_type_10(p
):
9939 '''net_type : K_trior '''
9941 print('net_type_10', list(p
))
9944 # { p[0] = NetNet::TRIOR; }
9948 def p_net_type_11(p
):
9949 '''net_type : K_wone '''
9951 print('net_type_11', list(p
))
9954 # { p[0] = NetNet::UNRESOLVED_WIRE;
9955 # cerr << @1.text << ":" << @1.first_line << ": warning: "
9956 # "'wone' is deprecated, please use 'uwire' "
9957 # "instead." << endl;
9962 def p_net_type_12(p
):
9963 '''net_type : K_uwire '''
9965 print('net_type_12', list(p
))
9968 # { p[0] = NetNet::UNRESOLVED_WIRE; }
9972 def p_param_type_1(p
):
9973 '''param_type : bit_logic_opt unsigned_signed_opt dimensions_opt '''
9975 print('param_type_1', list(p
))
9978 # { param_active_range = p[3];
9979 # param_active_signed = p[2];
9980 # if ((p[1] == IVL_VT_NO_TYPE) && (p[3] != 0))
9981 # param_active_type = IVL_VT_LOGIC;
9983 # param_active_type = p[1];
9988 def p_param_type_2(p
):
9989 '''param_type : K_integer '''
9991 print('param_type_2', list(p
))
9994 # { param_active_range = make_range_from_width(integer_width);
9995 # param_active_signed = true;
9996 # param_active_type = IVL_VT_LOGIC;
10001 def p_param_type_3(p
):
10002 '''param_type : K_time '''
10004 print('param_type_3', list(p
))
10007 # { param_active_range = make_range_from_width(64);
10008 # param_active_signed = false;
10009 # param_active_type = IVL_VT_LOGIC;
10014 def p_param_type_4(p
):
10015 '''param_type : real_or_realtime '''
10017 print('param_type_4', list(p
))
10020 # { param_active_range = 0;
10021 # param_active_signed = true;
10022 # param_active_type = IVL_VT_REAL;
10027 def p_param_type_5(p
):
10028 '''param_type : atom2_type '''
10030 print('param_type_5', list(p
))
10033 # { param_active_range = make_range_from_width(p[1]);
10034 # param_active_signed = true;
10035 # param_active_type = IVL_VT_BOOL;
10040 def p_param_type_6(p
):
10041 '''param_type : TYPE_IDENTIFIER '''
10043 print('param_type_6', list(p
))
10046 # { pform_set_param_from_type(@1, p[1].type, p[1].text, param_active_range,
10047 # param_active_signed, param_active_type);
10048 # delete[]p[1].text;
10053 def p_parameter_assign_list_1(p
):
10054 '''parameter_assign_list : parameter_assign '''
10056 print('parameter_assign_list_1', list(p
))
10062 def p_parameter_assign_list_2(p
):
10063 '''parameter_assign_list : parameter_assign_list ',' parameter_assign '''
10065 print('parameter_assign_list_2', list(p
))
10071 def p_localparam_assign_list_1(p
):
10072 '''localparam_assign_list : localparam_assign '''
10074 print('localparam_assign_list_1', list(p
))
10080 def p_localparam_assign_list_2(p
):
10081 '''localparam_assign_list : localparam_assign_list ',' localparam_assign '''
10083 print('localparam_assign_list_2', list(p
))
10089 def p_parameter_assign_1(p
):
10090 '''parameter_assign : IDENTIFIER '=' expression parameter_value_ranges_opt '''
10092 print('parameter_assign_1', list(p
))
10093 tpname
= Node(syms
.tname
, [Leaf(token
.NAME
, p
[1])])
10094 expr
= Node(syms
.tfpdef
, [tpname
, Leaf(token
.EQUAL
, p
[2]), p
[3]])
10098 # { PExpr*tmp = p[3];
10099 # pform_set_parameter(@1, lex_strings.make(p[1]), param_active_type,
10100 # param_active_signed, param_active_range, tmp, p[4]);
10106 def p_localparam_assign_1(p
):
10107 '''localparam_assign : IDENTIFIER '=' expression '''
10109 print('localparam_assign_1', list(p
))
10112 # { PExpr*tmp = p[3];
10113 # pform_set_localparam(@1, lex_strings.make(p[1]), param_active_type,
10114 # param_active_signed, param_active_range, tmp);
10120 def p_parameter_value_ranges_opt_1(p
):
10121 '''parameter_value_ranges_opt : parameter_value_ranges '''
10123 print('parameter_value_ranges_opt_1', list(p
))
10130 def p_parameter_value_ranges_opt_2(p
):
10131 '''parameter_value_ranges_opt : '''
10133 print('parameter_value_ranges_opt_2', list(p
))
10140 def p_parameter_value_ranges_1(p
):
10141 '''parameter_value_ranges : parameter_value_ranges parameter_value_range '''
10143 print('parameter_value_ranges_1', list(p
))
10146 # { p[0] = p[2]; p[0]->next = p[1]; }
10150 def p_parameter_value_ranges_2(p
):
10151 '''parameter_value_ranges : parameter_value_range '''
10153 print('parameter_value_ranges_2', list(p
))
10156 # { p[0] = p[1]; p[0]->next = 0; }
10160 def p_parameter_value_range_1(p
):
10161 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ']' '''
10163 print('parameter_value_range_1', list(p
))
10166 # { p[0] = pform_parameter_value_range(p[1], false, p[3], false, p[5]); }
10170 def p_parameter_value_range_2(p
):
10171 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ')' '''
10173 print('parameter_value_range_2', list(p
))
10176 # { p[0] = pform_parameter_value_range(p[1], false, p[3], true, p[5]); }
10180 def p_parameter_value_range_3(p
):
10181 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ']' '''
10183 print('parameter_value_range_3', list(p
))
10186 # { p[0] = pform_parameter_value_range(p[1], true, p[3], false, p[5]); }
10190 def p_parameter_value_range_4(p
):
10191 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ')' '''
10193 print('parameter_value_range_4', list(p
))
10196 # { p[0] = pform_parameter_value_range(p[1], true, p[3], true, p[5]); }
10200 def p_parameter_value_range_5(p
):
10201 '''parameter_value_range : K_exclude expression '''
10203 print('parameter_value_range_5', list(p
))
10206 # { p[0] = pform_parameter_value_range(true, false, p[2], false, p[2]); }
10210 def p_value_range_expression_1(p
):
10211 '''value_range_expression : expression '''
10213 print('value_range_expression_1', list(p
))
10220 def p_value_range_expression_2(p
):
10221 '''value_range_expression : K_inf '''
10223 print('value_range_expression_2', list(p
))
10230 def p_value_range_expression_3(p
):
10231 '''value_range_expression : '+' K_inf '''
10233 print('value_range_expression_3', list(p
))
10240 def p_value_range_expression_4(p
):
10241 '''value_range_expression : '-' K_inf '''
10243 print('value_range_expression_4', list(p
))
10250 def p_from_exclude_1(p
):
10251 '''from_exclude : K_from '''
10253 print('from_exclude_1', list(p
))
10260 def p_from_exclude_2(p
):
10261 '''from_exclude : K_exclude '''
10263 print('from_exclude_2', list(p
))
10270 def p_parameter_value_opt_1(p
):
10271 '''parameter_value_opt : '#' '(' expression_list_with_nuls ')' '''
10273 print('parameter_value_opt_1', list(p
))
10276 # { struct parmvalue_t*tmp = new struct parmvalue_t;
10277 # tmp->by_order = p[3];
10278 # tmp->by_name = 0;
10284 def p_parameter_value_opt_2(p
):
10285 '''parameter_value_opt : '#' '(' parameter_value_byname_list ')' '''
10287 print('parameter_value_opt_2', list(p
))
10290 # { struct parmvalue_t*tmp = new struct parmvalue_t;
10291 # tmp->by_order = 0;
10292 # tmp->by_name = p[3];
10298 def p_parameter_value_opt_3(p
):
10299 '''parameter_value_opt : '#' DEC_NUMBER '''
10301 print('parameter_value_opt_3', list(p
))
10305 # PENumber*tmp = new PENumber(p[2]);
10306 # FILE_NAME(tmp, @1);
10308 # struct parmvalue_t*lst = new struct parmvalue_t;
10309 # lst->by_order = new list<PExpr*>;
10310 # lst->by_order->push_back(tmp);
10311 # lst->by_name = 0;
10318 def p_parameter_value_opt_4(p
):
10319 '''parameter_value_opt : '#' REALTIME '''
10321 print('parameter_value_opt_4', list(p
))
10325 # PEFNumber*tmp = new PEFNumber(p[2]);
10326 # FILE_NAME(tmp, @1);
10328 # struct parmvalue_t*lst = new struct parmvalue_t;
10329 # lst->by_order = new list<PExpr*>;
10330 # lst->by_order->push_back(tmp);
10331 # lst->by_name = 0;
10337 def p_parameter_value_opt_5(p
):
10338 '''parameter_value_opt : '#' error '''
10340 print('parameter_value_opt_5', list(p
))
10343 # { yyerror(@1, "error: syntax error in parameter value "
10344 # "assignment list.");
10350 def p_parameter_value_opt_6(p
):
10351 '''parameter_value_opt : '''
10353 print('parameter_value_opt_6', list(p
))
10360 def p_parameter_value_byname_1(p
):
10361 '''parameter_value_byname : '.' IDENTIFIER '(' expression ')' '''
10363 print('parameter_value_byname_1', list(p
))
10366 # { named_pexpr_t*tmp = new named_pexpr_t;
10367 # tmp->name = lex_strings.make(p[2]);
10368 # tmp->parm = p[4];
10375 def p_parameter_value_byname_2(p
):
10376 '''parameter_value_byname : '.' IDENTIFIER '(' ')' '''
10378 print('parameter_value_byname_2', list(p
))
10381 # { named_pexpr_t*tmp = new named_pexpr_t;
10382 # tmp->name = lex_strings.make(p[2]);
10390 def p_parameter_value_byname_list_1(p
):
10391 '''parameter_value_byname_list : parameter_value_byname '''
10393 print('parameter_value_byname_list_1', list(p
))
10396 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
10397 # tmp->push_back(*p[1]);
10404 def p_parameter_value_byname_list_2(p
):
10405 '''parameter_value_byname_list : parameter_value_byname_list ',' parameter_value_byname '''
10407 print('parameter_value_byname_list_2', list(p
))
10410 # { list<named_pexpr_t>*tmp = p[1];
10411 # tmp->push_back(*p[3]);
10419 '''port : port_reference '''
10421 print('port_1', list(p
))
10429 '''port : '.' IDENTIFIER '(' port_reference ')' '''
10431 print('port_2', list(p
))
10434 # { Module::port_t*tmp = p[4];
10435 # tmp->name = lex_strings.make(p[2]);
10443 '''port : '{' port_reference_list '}' '''
10445 print('port_3', list(p
))
10448 # { Module::port_t*tmp = p[2];
10449 # tmp->name = perm_string();
10456 '''port : '.' IDENTIFIER '(' '{' port_reference_list '}' ')' '''
10458 print('port_4', list(p
))
10461 # { Module::port_t*tmp = p[5];
10462 # tmp->name = lex_strings.make(p[2]);
10469 def p_port_opt_1(p
):
10470 '''port_opt : port '''
10472 print('port_opt_1', list(p
))
10479 def p_port_opt_2(p
):
10482 print('port_opt_2', list(p
))
10489 def p_port_name_1(p
):
10490 '''port_name : '.' IDENTIFIER '(' expression ')' '''
10492 print('port_name_1', list(p
))
10495 # { named_pexpr_t*tmp = new named_pexpr_t;
10496 # tmp->name = lex_strings.make(p[2]);
10497 # tmp->parm = p[4];
10504 def p_port_name_2(p
):
10505 '''port_name : '.' IDENTIFIER '(' error ')' '''
10507 print('port_name_2', list(p
))
10510 # { yyerror(@3, "error: invalid port connection expression.");
10511 # named_pexpr_t*tmp = new named_pexpr_t;
10512 # tmp->name = lex_strings.make(p[2]);
10520 def p_port_name_3(p
):
10521 '''port_name : '.' IDENTIFIER '(' ')' '''
10523 print('port_name_3', list(p
))
10526 # { named_pexpr_t*tmp = new named_pexpr_t;
10527 # tmp->name = lex_strings.make(p[2]);
10535 def p_port_name_4(p
):
10536 '''port_name : '.' IDENTIFIER '''
10538 print('port_name_4', list(p
))
10541 # { named_pexpr_t*tmp = new named_pexpr_t;
10542 # tmp->name = lex_strings.make(p[2]);
10543 # tmp->parm = new PEIdent(lex_strings.make(p[2]), true);
10544 # FILE_NAME(tmp->parm, @1);
10551 def p_port_name_5(p
):
10552 '''port_name : K_DOTSTAR '''
10554 print('port_name_5', list(p
))
10557 # { named_pexpr_t*tmp = new named_pexpr_t;
10558 # tmp->name = lex_strings.make("*");
10565 def p_port_name_list_1(p
):
10566 '''port_name_list : port_name_list ',' port_name '''
10568 print('port_name_list_1', list(p
))
10571 # { list<named_pexpr_t>*tmp = p[1];
10572 # tmp->push_back(*p[3]);
10579 def p_port_name_list_2(p
):
10580 '''port_name_list : port_name '''
10582 print('port_name_list_2', list(p
))
10585 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
10586 # tmp->push_back(*p[1]);
10593 def p_port_reference_1(p
):
10594 '''port_reference : IDENTIFIER '''
10596 print('port_reference_1', list(p
))
10599 # { Module::port_t*ptmp;
10600 # perm_string name = lex_strings.make(p[1]);
10601 # ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
10608 def p_port_reference_2(p
):
10609 '''port_reference : IDENTIFIER '[' expression ':' expression ']' '''
10611 print('port_reference_2', list(p
))
10614 # { index_component_t itmp;
10615 # itmp.sel = index_component_t::SEL_PART;
10619 # name_component_t ntmp (lex_strings.make(p[1]));
10620 # ntmp.index.push_back(itmp);
10622 # pform_name_t pname;
10623 # pname.push_back(ntmp);
10625 # PEIdent*wtmp = new PEIdent(pname);
10626 # FILE_NAME(wtmp, @1);
10628 # Module::port_t*ptmp = new Module::port_t;
10629 # ptmp->name = perm_string();
10630 # ptmp->expr.push_back(wtmp);
10638 def p_port_reference_3(p
):
10639 '''port_reference : IDENTIFIER '[' expression ']' '''
10641 print('port_reference_3', list(p
))
10644 # { index_component_t itmp;
10645 # itmp.sel = index_component_t::SEL_BIT;
10649 # name_component_t ntmp (lex_strings.make(p[1]));
10650 # ntmp.index.push_back(itmp);
10652 # pform_name_t pname;
10653 # pname.push_back(ntmp);
10655 # PEIdent*tmp = new PEIdent(pname);
10656 # FILE_NAME(tmp, @1);
10658 # Module::port_t*ptmp = new Module::port_t;
10659 # ptmp->name = perm_string();
10660 # ptmp->expr.push_back(tmp);
10667 def p_port_reference_4(p
):
10668 '''port_reference : IDENTIFIER '[' error ']' '''
10670 print('port_reference_4', list(p
))
10673 # { yyerror(@1, "error: invalid port bit select");
10674 # Module::port_t*ptmp = new Module::port_t;
10675 # PEIdent*wtmp = new PEIdent(lex_strings.make(p[1]));
10676 # FILE_NAME(wtmp, @1);
10677 # ptmp->name = lex_strings.make(p[1]);
10678 # ptmp->expr.push_back(wtmp);
10685 def p_port_reference_list_1(p
):
10686 '''port_reference_list : port_reference '''
10688 print('port_reference_list_1', list(p
))
10695 def p_port_reference_list_2(p
):
10696 '''port_reference_list : port_reference_list ',' port_reference '''
10698 print('port_reference_list_2', list(p
))
10701 # { Module::port_t*tmp = p[1];
10702 # append(tmp->expr, p[3]->expr);
10709 def p_dimensions_opt_1(p
):
10710 '''dimensions_opt : '''
10711 if(parse_debug
> 2):
10712 print('dimensions_opt_1', list(p
))
10719 def p_dimensions_opt_2(p
):
10720 '''dimensions_opt : dimensions '''
10722 print('dimensions_opt_2', list(p
))
10729 def p_dimensions_1(p
):
10730 '''dimensions : variable_dimension '''
10732 print('dimensions_1', list(p
))
10739 def p_dimensions_2(p
):
10740 '''dimensions : dimensions variable_dimension '''
10742 print('dimensions_2', list(p
))
10745 # { list<pform_range_t> *tmp = p[1];
10747 # tmp->splice(tmp->end(), *p[2]);
10755 def p_register_variable_1(p
):
10756 '''register_variable : IDENTIFIER dimensions_opt '''
10758 print('register_variable_1', list(p
))
10761 # { perm_string name = lex_strings.make(p[1]);
10762 # pform_makewire(@1, name, NetNet::REG,
10763 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10764 # pform_set_reg_idx(name, p[2]);
10770 def p_register_variable_2(p
):
10771 '''register_variable : IDENTIFIER dimensions_opt '=' expression '''
10773 print('register_variable_2', list(p
))
10776 # { if (pform_peek_scope()->var_init_needs_explicit_lifetime()
10777 # && (var_lifetime == LexicalScope::INHERITED)) {
10778 # cerr << @3 << ": warning: Static variable initialization requires "
10779 # "explicit lifetime in this context." << endl;
10782 # perm_string name = lex_strings.make(p[1]);
10783 # pform_makewire(@1, name, NetNet::REG,
10784 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10785 # pform_set_reg_idx(name, p[2]);
10786 # pform_make_var_init(@1, name, p[4]);
10792 def p_register_variable_list_1(p
):
10793 '''register_variable_list : register_variable '''
10795 print('register_variable_list_1', list(p
))
10798 # { list<perm_string>*tmp = new list<perm_string>;
10799 # tmp->push_back(lex_strings.make(p[1]));
10806 def p_register_variable_list_2(p
):
10807 '''register_variable_list : register_variable_list ',' register_variable '''
10809 print('register_variable_list_2', list(p
))
10812 # { list<perm_string>*tmp = p[1];
10813 # tmp->push_back(lex_strings.make(p[3]));
10820 def p_net_variable_1(p
):
10821 '''net_variable : IDENTIFIER dimensions_opt '''
10822 if(parse_debug
> 2):
10823 print('net_variable_1', list(p
))
10825 #p[0]= ('net_variable_1', list(p))
10827 # { perm_string name = lex_strings.make(p[1]);
10828 # pform_makewire(@1, name, NetNet::IMPLICIT,
10829 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10830 # pform_set_reg_idx(name, p[2]);
10831 p
[0] = [p
[1], p
[2]]
10837 def p_net_variable_list_1(p
):
10838 '''net_variable_list : net_variable '''
10839 if(parse_debug
> 2):
10840 print('net_variable_list_1', list(p
))
10844 # { list<perm_string>*tmp = new list<perm_string>;
10845 # tmp->push_back(lex_strings.make(p[1]));
10852 def p_net_variable_list_2(p
):
10853 '''net_variable_list : net_variable_list ',' net_variable '''
10854 if(parse_debug
> 2):
10855 print('net_variable_list_2', list(p
))
10859 # { list<perm_string>*tmp = p[1];
10860 # tmp->push_back(lex_strings.make(p[3]));
10867 def p_event_variable_1(p
):
10868 '''event_variable : IDENTIFIER dimensions_opt '''
10870 print('event_variable_1', list(p
))
10874 # yyerror(@2, "sorry: event arrays are not supported.");
10882 def p_event_variable_list_1(p
):
10883 '''event_variable_list : event_variable '''
10885 print('event_variable_list_1', list(p
))
10888 # { p[0] = list_from_identifier(p[1]); }
10892 def p_event_variable_list_2(p
):
10893 '''event_variable_list : event_variable_list ',' event_variable '''
10895 print('event_variable_list_2', list(p
))
10898 # { p[0] = list_from_identifier(p[1], p[3]); }
10902 def p_specify_item_1(p
):
10903 '''specify_item : K_specparam specparam_decl ';' '''
10905 print('specify_item_1', list(p
))
10911 def p_specify_item_2(p
):
10912 '''specify_item : specify_simple_path_decl ';' '''
10914 print('specify_item_2', list(p
))
10917 # { pform_module_specify_path(p[1]);
10922 def p_specify_item_3(p
):
10923 '''specify_item : specify_edge_path_decl ';' '''
10925 print('specify_item_3', list(p
))
10928 # { pform_module_specify_path(p[1]);
10933 def p_specify_item_4(p
):
10934 '''specify_item : K_if '(' expression ')' specify_simple_path_decl ';' '''
10936 print('specify_item_4', list(p
))
10939 # { PSpecPath*tmp = p[5];
10941 # tmp->conditional = true;
10942 # tmp->condition = p[3];
10944 # pform_module_specify_path(tmp);
10949 def p_specify_item_5(p
):
10950 '''specify_item : K_if '(' expression ')' specify_edge_path_decl ';' '''
10952 print('specify_item_5', list(p
))
10955 # { PSpecPath*tmp = p[5];
10957 # tmp->conditional = true;
10958 # tmp->condition = p[3];
10960 # pform_module_specify_path(tmp);
10965 def p_specify_item_6(p
):
10966 '''specify_item : K_ifnone specify_simple_path_decl ';' '''
10968 print('specify_item_6', list(p
))
10971 # { PSpecPath*tmp = p[2];
10973 # tmp->conditional = true;
10974 # tmp->condition = 0;
10976 # pform_module_specify_path(tmp);
10981 def p_specify_item_7(p
):
10982 '''specify_item : K_ifnone specify_edge_path_decl ';' '''
10984 print('specify_item_7', list(p
))
10987 # { yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
10988 # "not supported.");
10994 def p_specify_item_8(p
):
10995 '''specify_item : K_Sfullskew '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10997 print('specify_item_8', list(p
))
11006 def p_specify_item_9(p
):
11007 '''specify_item : K_Shold '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
11009 print('specify_item_9', list(p
))
11017 def p_specify_item_10(p
):
11018 '''specify_item : K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
11020 print('specify_item_10', list(p
))
11029 def p_specify_item_11(p
):
11030 '''specify_item : K_Speriod '(' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
11032 print('specify_item_11', list(p
))
11040 def p_specify_item_12(p
):
11041 '''specify_item : K_Srecovery '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
11043 print('specify_item_12', list(p
))
11051 def p_specify_item_13(p
):
11052 '''specify_item : K_Srecrem '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
11054 print('specify_item_13', list(p
))
11063 def p_specify_item_14(p
):
11064 '''specify_item : K_Sremoval '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
11066 print('specify_item_14', list(p
))
11074 def p_specify_item_15(p
):
11075 '''specify_item : K_Ssetup '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
11077 print('specify_item_15', list(p
))
11085 def p_specify_item_16(p
):
11086 '''specify_item : K_Ssetuphold '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
11088 print('specify_item_16', list(p
))
11097 def p_specify_item_17(p
):
11098 '''specify_item : K_Sskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
11100 print('specify_item_17', list(p
))
11108 def p_specify_item_18(p
):
11109 '''specify_item : K_Stimeskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
11111 print('specify_item_18', list(p
))
11119 def p_specify_item_19(p
):
11120 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ',' expression spec_notifier_opt ')' ';' '''
11122 print('specify_item_19', list(p
))
11131 def p_specify_item_20(p
):
11132 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ')' ';' '''
11134 print('specify_item_20', list(p
))
11142 def p_specify_item_21(p
):
11143 '''specify_item : K_pulsestyle_onevent specify_path_identifiers ';' '''
11145 print('specify_item_21', list(p
))
11153 def p_specify_item_22(p
):
11154 '''specify_item : K_pulsestyle_ondetect specify_path_identifiers ';' '''
11156 print('specify_item_22', list(p
))
11164 def p_specify_item_23(p
):
11165 '''specify_item : K_showcancelled specify_path_identifiers ';' '''
11167 print('specify_item_23', list(p
))
11175 def p_specify_item_24(p
):
11176 '''specify_item : K_noshowcancelled specify_path_identifiers ';' '''
11178 print('specify_item_24', list(p
))
11186 def p_specify_item_list_1(p
):
11187 '''specify_item_list : specify_item '''
11189 print('specify_item_list_1', list(p
))
11195 def p_specify_item_list_2(p
):
11196 '''specify_item_list : specify_item_list specify_item '''
11198 print('specify_item_list_2', list(p
))
11204 def p_specify_item_list_opt_1(p
):
11205 '''specify_item_list_opt : '''
11207 print('specify_item_list_opt_1', list(p
))
11214 def p_specify_item_list_opt_2(p
):
11215 '''specify_item_list_opt : specify_item_list '''
11217 print('specify_item_list_opt_2', list(p
))
11224 def p_specify_edge_path_decl_1(p
):
11225 '''specify_edge_path_decl : specify_edge_path '=' '(' delay_value_list ')' '''
11227 print('specify_edge_path_decl_1', list(p
))
11230 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
11234 def p_specify_edge_path_decl_2(p
):
11235 '''specify_edge_path_decl : specify_edge_path '=' delay_value_simple '''
11237 print('specify_edge_path_decl_2', list(p
))
11240 # { list<PExpr*>*tmp = new list<PExpr*>;
11241 # tmp->push_back(p[3]);
11242 # p[0] = pform_assign_path_delay(p[1], tmp);
11247 def p_edge_operator_1(p
):
11248 '''edge_operator : K_posedge '''
11250 print('edge_operator_1', list(p
))
11257 def p_edge_operator_2(p
):
11258 '''edge_operator : K_negedge '''
11260 print('edge_operator_2', list(p
))
11267 def p_specify_edge_path_1(p
):
11268 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
11270 print('specify_edge_path_1', list(p
))
11273 # { int edge_flag = 0;
11274 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], false, p[6], p[8]); }
11278 def p_specify_edge_path_2(p
):
11279 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
11281 print('specify_edge_path_2', list(p
))
11284 # { int edge_flag = p[2]? 1 : -1;
11285 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], false, p[7], p[9]);}
11289 def p_specify_edge_path_3(p
):
11290 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
11292 print('specify_edge_path_3', list(p
))
11295 # { int edge_flag = 0;
11296 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], true, p[6], p[8]); }
11300 def p_specify_edge_path_4(p
):
11301 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
11303 print('specify_edge_path_4', list(p
))
11306 # { int edge_flag = p[2]? 1 : -1;
11307 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], true, p[7], p[9]); }
11311 def p_polarity_operator_1(p
):
11312 '''polarity_operator : K_PO_POS '''
11314 print('polarity_operator_1', list(p
))
11320 def p_polarity_operator_2(p
):
11321 '''polarity_operator : K_PO_NEG '''
11323 print('polarity_operator_2', list(p
))
11329 def p_polarity_operator_3(p
):
11330 '''polarity_operator : ':' '''
11332 print('polarity_operator_3', list(p
))
11338 def p_specify_simple_path_decl_1(p
):
11339 '''specify_simple_path_decl : specify_simple_path '=' '(' delay_value_list ')' '''
11341 print('specify_simple_path_decl_1', list(p
))
11344 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
11348 def p_specify_simple_path_decl_2(p
):
11349 '''specify_simple_path_decl : specify_simple_path '=' delay_value_simple '''
11351 print('specify_simple_path_decl_2', list(p
))
11354 # { list<PExpr*>*tmp = new list<PExpr*>;
11355 # tmp->push_back(p[3]);
11356 # p[0] = pform_assign_path_delay(p[1], tmp);
11361 def p_specify_simple_path_decl_3(p
):
11362 '''specify_simple_path_decl : specify_simple_path '=' '(' error ')' '''
11364 print('specify_simple_path_decl_3', list(p
))
11367 # { yyerror(@3, "Syntax error in delay value list.");
11374 def p_specify_simple_path_1(p
):
11375 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' '''
11377 print('specify_simple_path_1', list(p
))
11380 # { p[0] = pform_make_specify_path(@1, p[2], p[3], false, p[5]); }
11384 def p_specify_simple_path_2(p
):
11385 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' '''
11387 print('specify_simple_path_2', list(p
))
11390 # { p[0] = pform_make_specify_path(@1, p[2], p[3], true, p[5]); }
11394 def p_specify_simple_path_3(p
):
11395 '''specify_simple_path : '(' error ')' '''
11397 print('specify_simple_path_3', list(p
))
11400 # { yyerror(@1, "Invalid simple path");
11406 def p_specify_path_identifiers_1(p
):
11407 '''specify_path_identifiers : IDENTIFIER '''
11409 print('specify_path_identifiers_1', list(p
))
11412 # { list<perm_string>*tmp = new list<perm_string>;
11413 # tmp->push_back(lex_strings.make(p[1]));
11420 def p_specify_path_identifiers_2(p
):
11421 '''specify_path_identifiers : IDENTIFIER '[' expr_primary ']' '''
11423 print('specify_path_identifiers_2', list(p
))
11426 # { if (gn_specify_blocks_flag) {
11427 # yywarn(@4, "Bit selects are not currently supported "
11428 # "in path declarations. The declaration "
11429 # "will be applied to the whole vector.");
11431 # list<perm_string>*tmp = new list<perm_string>;
11432 # tmp->push_back(lex_strings.make(p[1]));
11439 def p_specify_path_identifiers_3(p
):
11440 '''specify_path_identifiers : IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
11442 print('specify_path_identifiers_3', list(p
))
11445 # { if (gn_specify_blocks_flag) {
11446 # yywarn(@4, "Part 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_4(p
):
11459 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '''
11461 print('specify_path_identifiers_4', list(p
))
11464 # { list<perm_string>*tmp = p[1];
11465 # tmp->push_back(lex_strings.make(p[3]));
11472 def p_specify_path_identifiers_5(p
):
11473 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' '''
11475 print('specify_path_identifiers_5', list(p
))
11478 # { if (gn_specify_blocks_flag) {
11479 # yywarn(@4, "Bit selects are not currently supported "
11480 # "in path declarations. The declaration "
11481 # "will be applied to the whole vector.");
11483 # list<perm_string>*tmp = p[1];
11484 # tmp->push_back(lex_strings.make(p[3]));
11491 def p_specify_path_identifiers_6(p
):
11492 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
11494 print('specify_path_identifiers_6', list(p
))
11497 # { if (gn_specify_blocks_flag) {
11498 # yywarn(@4, "Part 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_specparam_1(p
):
11511 '''specparam : IDENTIFIER '=' expression '''
11513 print('specparam_1', list(p
))
11516 # { PExpr*tmp = p[3];
11517 # pform_set_specparam(@1, lex_strings.make(p[1]),
11518 # param_active_range, tmp);
11524 def p_specparam_2(p
):
11525 '''specparam : IDENTIFIER '=' expression ':' expression ':' expression '''
11527 print('specparam_2', list(p
))
11531 # switch (min_typ_max_flag) {
11548 # if (min_typ_max_warn > 0) {
11549 # cerr << tmp->get_fileline() << ": warning: choosing ";
11550 # switch (min_typ_max_flag) {
11561 # cerr << " expression." << endl;
11562 # min_typ_max_warn -= 1;
11564 # pform_set_specparam(@1, lex_strings.make(p[1]),
11565 # param_active_range, tmp);
11571 def p_specparam_3(p
):
11572 '''specparam : PATHPULSE_IDENTIFIER '=' expression '''
11574 print('specparam_3', list(p
))
11583 def p_specparam_4(p
):
11584 '''specparam : PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' '''
11586 print('specparam_4', list(p
))
11596 def p_specparam_list_1(p
):
11597 '''specparam_list : specparam '''
11599 print('specparam_list_1', list(p
))
11605 def p_specparam_list_2(p
):
11606 '''specparam_list : specparam_list ',' specparam '''
11608 print('specparam_list_2', list(p
))
11614 def p_specparam_decl_1(p
):
11615 '''specparam_decl : specparam_list '''
11617 print('specparam_decl_1', list(p
))
11623 def p_specparam_decl_2(p
):
11624 '''specparam_decl : dimensions _embed0_specparam_decl specparam_list '''
11626 print('specparam_decl_2', list(p
))
11629 # { param_active_range = 0; }
11633 def p__embed0_specparam_decl(p
):
11634 '''_embed0_specparam_decl : '''
11637 # { param_active_range = p[1]; }
11641 def p_spec_polarity_1(p
):
11642 '''spec_polarity : '+' '''
11644 print('spec_polarity_1', list(p
))
11651 def p_spec_polarity_2(p
):
11652 '''spec_polarity : '-' '''
11654 print('spec_polarity_2', list(p
))
11661 def p_spec_polarity_3(p
):
11662 '''spec_polarity : '''
11664 print('spec_polarity_3', list(p
))
11671 def p_spec_reference_event_1(p
):
11672 '''spec_reference_event : K_posedge expression '''
11674 print('spec_reference_event_1', list(p
))
11681 def p_spec_reference_event_2(p
):
11682 '''spec_reference_event : K_negedge expression '''
11684 print('spec_reference_event_2', list(p
))
11691 def p_spec_reference_event_3(p
):
11692 '''spec_reference_event : K_posedge expr_primary K_TAND expression '''
11694 print('spec_reference_event_3', list(p
))
11703 def p_spec_reference_event_4(p
):
11704 '''spec_reference_event : K_negedge expr_primary K_TAND expression '''
11706 print('spec_reference_event_4', list(p
))
11715 def p_spec_reference_event_5(p
):
11716 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary '''
11718 print('spec_reference_event_5', list(p
))
11725 def p_spec_reference_event_6(p
):
11726 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression '''
11728 print('spec_reference_event_6', list(p
))
11737 def p_spec_reference_event_7(p
):
11738 '''spec_reference_event : expr_primary K_TAND expression '''
11740 print('spec_reference_event_7', list(p
))
11749 def p_spec_reference_event_8(p
):
11750 '''spec_reference_event : expr_primary '''
11752 print('spec_reference_event_8', list(p
))
11759 def p_edge_descriptor_list_1(p
):
11760 '''edge_descriptor_list : edge_descriptor_list ',' K_edge_descriptor '''
11762 print('edge_descriptor_list_1', list(p
))
11768 def p_edge_descriptor_list_2(p
):
11769 '''edge_descriptor_list : K_edge_descriptor '''
11771 print('edge_descriptor_list_2', list(p
))
11777 def p_spec_notifier_opt_1(p
):
11778 '''spec_notifier_opt : '''
11780 print('spec_notifier_opt_1', list(p
))
11787 def p_spec_notifier_opt_2(p
):
11788 '''spec_notifier_opt : spec_notifier '''
11790 print('spec_notifier_opt_2', list(p
))
11797 def p_spec_notifier_1(p
):
11798 '''spec_notifier : ',' '''
11800 print('spec_notifier_1', list(p
))
11803 # { args_after_notifier = 0; }
11807 def p_spec_notifier_2(p
):
11808 '''spec_notifier : ',' hierarchy_identifier '''
11810 print('spec_notifier_2', list(p
))
11813 # { args_after_notifier = 0; delete p[2]; }
11817 def p_spec_notifier_3(p
):
11818 '''spec_notifier : spec_notifier ',' '''
11820 print('spec_notifier_3', list(p
))
11823 # { args_after_notifier += 1; }
11827 def p_spec_notifier_4(p
):
11828 '''spec_notifier : spec_notifier ',' hierarchy_identifier '''
11830 print('spec_notifier_4', list(p
))
11833 # { args_after_notifier += 1;
11834 # if (args_after_notifier >= 3) {
11835 # cerr << @3 << ": warning: timing checks are not supported "
11836 # "and delayed signal \"" << *p[3]
11837 # << "\" will not be driven." << endl;
11843 def p_spec_notifier_5(p
):
11844 '''spec_notifier : IDENTIFIER '''
11846 print('spec_notifier_5', list(p
))
11849 # { args_after_notifier = 0; delete[]p[1]; }
11853 def p_statement_item_1(p
):
11854 '''statement_item : K_assign lpvalue '=' expression ';' '''
11856 print('statement_item_1', list(p
))
11859 # { PCAssign*tmp = new PCAssign(p[2], p[4]);
11860 # FILE_NAME(tmp, @1);
11865 # TODO: read all statement items
11868 def p_statement_item_2(p
):
11869 '''statement_item : K_deassign lpvalue ';' '''
11871 print('statement_item_2', list(p
))
11874 # { PDeassign*tmp = new PDeassign(p[2]);
11875 # FILE_NAME(tmp, @1);
11881 def p_statement_item_3(p
):
11882 '''statement_item : K_force lpvalue '=' expression ';' '''
11884 print('statement_item_3', list(p
))
11887 # { PForce*tmp = new PForce(p[2], p[4]);
11888 # FILE_NAME(tmp, @1);
11894 def p_statement_item_4(p
):
11895 '''statement_item : K_release lpvalue ';' '''
11897 print('statement_item_4', list(p
))
11900 # { PRelease*tmp = new PRelease(p[2]);
11901 # FILE_NAME(tmp, @1);
11907 def p_statement_item_5(p
):
11908 '''statement_item : K_begin K_end '''
11910 print('statement_item_5', list(p
))
11913 # { PBlock*tmp = new PBlock(PBlock::BL_SEQ);
11914 # FILE_NAME(tmp, @1);
11920 def p_statement_item_6(p
):
11921 '''statement_item : K_begin _embed0_statement_item block_item_decls_opt _embed1_statement_item statement_or_null_list K_end '''
11923 print('statement_item_6', list(p
))
11927 throw(Exception("assert(! current_block_stack.empty());"))
11936 # pform_pop_scope();
11937 # assert(! current_block_stack.empty());
11938 # tmp = current_block_stack.top();
11939 # current_block_stack.pop();
11941 # tmp = new PBlock(PBlock::BL_SEQ);
11942 # FILE_NAME(tmp, @1);
11944 # if (p[5]) tmp->set_statement(*p[5]);
11951 def p_statement_item_7(p
):
11952 '''statement_item : K_begin ':' IDENTIFIER _embed2_statement_item block_item_decls_opt statement_or_null_list_opt K_end endlabel_opt '''
11954 print('statement_item_7', list(p
))
11959 # { pform_pop_scope();
11960 # assert(! current_block_stack.empty());
11961 # PBlock*tmp = current_block_stack.top();
11962 # current_block_stack.pop();
11963 # if (p[6]) tmp->set_statement(*p[6]);
11966 # if (strcmp(p[3],p[8]) != 0) {
11967 # yyerror(@8, "error: End label doesn't match begin name");
11969 # if (! gn_system_verilog()) {
11970 # yyerror(@8, "error: Begin end labels require "
11971 # "SystemVerilog.");
11981 def p_statement_item_8(p
):
11982 '''statement_item : K_fork join_keyword '''
11984 print('statement_item_8', list(p
))
11987 # { PBlock*tmp = new PBlock(p[2]);
11988 # FILE_NAME(tmp, @1);
11994 def p_statement_item_9(p
):
11995 '''statement_item : K_fork _embed3_statement_item block_item_decls_opt _embed4_statement_item statement_or_null_list join_keyword '''
11997 print('statement_item_9', list(p
))
12002 # pform_pop_scope();
12003 # assert(! current_block_stack.empty());
12004 # tmp = current_block_stack.top();
12005 # current_block_stack.pop();
12006 # tmp->set_join_type(p[6]);
12008 # tmp = new PBlock(p[6]);
12009 # FILE_NAME(tmp, @1);
12011 # if (p[5]) tmp->set_statement(*p[5]);
12018 def p_statement_item_10(p
):
12019 '''statement_item : K_fork ':' IDENTIFIER _embed5_statement_item block_item_decls_opt statement_or_null_list_opt join_keyword endlabel_opt '''
12021 print('statement_item_10', list(p
))
12024 # { pform_pop_scope();
12025 # assert(! current_block_stack.empty());
12026 # PBlock*tmp = current_block_stack.top();
12027 # current_block_stack.pop();
12028 # tmp->set_join_type(p[7]);
12029 # if (p[6]) tmp->set_statement(*p[6]);
12032 # if (strcmp(p[3],p[8]) != 0) {
12033 # yyerror(@8, "error: End label doesn't match fork name");
12035 # if (! gn_system_verilog()) {
12036 # yyerror(@8, "error: Fork end labels require "
12037 # "SystemVerilog.");
12047 def p_statement_item_11(p
):
12048 '''statement_item : K_disable hierarchy_identifier ';' '''
12050 print('statement_item_11', list(p
))
12053 # { PDisable*tmp = new PDisable(*p[2]);
12054 # FILE_NAME(tmp, @1);
12061 def p_statement_item_12(p
):
12062 '''statement_item : K_disable K_fork ';' '''
12064 print('statement_item_12', list(p
))
12067 # { pform_name_t tmp_name;
12068 # PDisable*tmp = new PDisable(tmp_name);
12069 # FILE_NAME(tmp, @1);
12075 def p_statement_item_13(p
):
12076 '''statement_item : K_TRIGGER hierarchy_identifier ';' '''
12078 print('statement_item_13', list(p
))
12081 # { PTrigger*tmp = new PTrigger(*p[2]);
12082 # FILE_NAME(tmp, @1);
12089 def p_statement_item_14(p
):
12090 '''statement_item : procedural_assertion_statement '''
12092 print('statement_item_14', list(p
))
12099 def p_statement_item_15(p
):
12100 '''statement_item : loop_statement '''
12102 print('statement_item_15', list(p
))
12109 def p_statement_item_16(p
):
12110 '''statement_item : jump_statement '''
12112 print('statement_item_16', list(p
))
12119 def p_statement_item_17(p
):
12120 '''statement_item : K_case '(' expression ')' case_items K_endcase '''
12122 print('statement_item_17', list(p
))
12125 # { PCase*tmp = new PCase(NetCase::EQ, p[3], p[5]);
12126 # FILE_NAME(tmp, @1);
12132 def p_statement_item_18(p
):
12133 '''statement_item : K_casex '(' expression ')' case_items K_endcase '''
12135 print('statement_item_18', list(p
))
12138 # { PCase*tmp = new PCase(NetCase::EQX, p[3], p[5]);
12139 # FILE_NAME(tmp, @1);
12145 def p_statement_item_19(p
):
12146 '''statement_item : K_casez '(' expression ')' case_items K_endcase '''
12148 print('statement_item_19', list(p
))
12151 # { PCase*tmp = new PCase(NetCase::EQZ, p[3], p[5]);
12152 # FILE_NAME(tmp, @1);
12158 def p_statement_item_20(p
):
12159 '''statement_item : K_case '(' expression ')' error K_endcase '''
12161 print('statement_item_20', list(p
))
12168 def p_statement_item_21(p
):
12169 '''statement_item : K_casex '(' expression ')' error K_endcase '''
12171 print('statement_item_21', list(p
))
12178 def p_statement_item_22(p
):
12179 '''statement_item : K_casez '(' expression ')' error K_endcase '''
12181 print('statement_item_22', list(p
))
12188 def p_statement_item_23(p
):
12189 '''statement_item : K_if '(' expression ')' statement_or_null %prec less_than_K_else '''
12191 print('statement_item_23', list(p
))
12193 p
[0] = absyn
.cond_statement3(p
[3], p
[5], None)
12196 # { PCondit*tmp = new PCondit(p[3], p[5], 0);
12197 # FILE_NAME(tmp, @1);
12203 def p_statement_item_24(p
):
12204 '''statement_item : K_if '(' expression ')' statement_or_null K_else statement_or_null '''
12206 print('statement_item_24', list(p
))
12208 p
[0] = absyn
.cond_statement3(p
[3], p
[5], p
[7])
12210 # { PCondit*tmp = new PCondit(p[3], p[5], p[7]);
12211 # FILE_NAME(tmp, @1);
12217 def p_statement_item_25(p
):
12218 '''statement_item : K_if '(' error ')' statement_or_null %prec less_than_K_else '''
12220 print('statement_item_25', list(p
))
12223 # { yyerror(@1, "error: Malformed conditional expression.");
12229 def p_statement_item_26(p
):
12230 '''statement_item : K_if '(' error ')' statement_or_null K_else statement_or_null '''
12232 print('statement_item_26', list(p
))
12235 # { yyerror(@1, "error: Malformed conditional expression.");
12241 def p_statement_item_27(p
):
12242 '''statement_item : compressed_statement ';' '''
12244 print('statement_item_27', list(p
))
12251 def p_statement_item_28(p
):
12252 '''statement_item : inc_or_dec_expression ';' '''
12254 print('statement_item_28', list(p
))
12257 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
12261 def p_statement_item_29(p
):
12262 '''statement_item : delay1 statement_or_null '''
12264 print('statement_item_29', list(p
))
12267 # { PExpr*del = p[1]->front();
12268 # assert(p[1]->size() == 1);
12270 # PDelayStatement*tmp = new PDelayStatement(del, p[2]);
12271 # FILE_NAME(tmp, @1);
12277 def p_statement_item_30(p
):
12278 '''statement_item : event_control statement_or_null '''
12280 print('statement_item_30', list(p
))
12283 # { PEventStatement*tmp = p[1];
12285 # yyerror(@1, "error: Invalid event control.");
12288 # tmp->set_statement(p[2]);
12295 def p_statement_item_31(p
):
12296 '''statement_item : '@' '*' statement_or_null '''
12298 print('statement_item_31', list(p
))
12301 # { PEventStatement*tmp = new PEventStatement;
12302 # FILE_NAME(tmp, @1);
12303 # tmp->set_statement(p[3]);
12309 def p_statement_item_32(p
):
12310 '''statement_item : '@' '(' '*' ')' statement_or_null '''
12312 print('statement_item_32', list(p
))
12315 # { PEventStatement*tmp = new PEventStatement;
12316 # FILE_NAME(tmp, @1);
12317 # tmp->set_statement(p[5]);
12323 def p_statement_item_33(p
):
12324 '''statement_item : lpvalue '=' expression ';' '''
12327 print('statement_item33', list(p))
12329 expr = Node(syms.expr_stmt, [p[1], Leaf(token.EQUAL, p[2]), p[3]])
12331 print("expr TODO", repr(expr))
12333 expr = Node(syms.expr_stmt, [p[1], Leaf(token.EQUAL, p[2]), ])
12335 print("expr", repr(expr))
12337 print("expr (python):'%s'" % expr)
12340 p
[0] = absyn
.assign3(p
[1], p
[2], p
[3])
12343 # { PAssign*tmp = new PAssign(p[1],p[3]);
12344 # FILE_NAME(tmp, @1);
12350 def p_statement_item_34(p
):
12351 '''statement_item : error '=' expression ';' '''
12353 print('statement_item_34', list(p
))
12356 # { yyerror(@2, "Syntax in assignment statement l-value.");
12358 # p[0] = new PNoop;
12363 def p_statement_item_35(p
):
12364 '''statement_item : lpvalue K_LE expression ';' '''
12366 print('statement_item_35', list(p
))
12369 # { PAssignNB*tmp = new PAssignNB(p[1],p[3]);
12370 # FILE_NAME(tmp, @1);
12376 def p_statement_item_36(p
):
12377 '''statement_item : error K_LE expression ';' '''
12379 print('statement_item_36', list(p
))
12382 # { yyerror(@2, "Syntax in assignment statement l-value.");
12384 # p[0] = new PNoop;
12389 def p_statement_item_37(p
):
12390 '''statement_item : lpvalue '=' delay1 expression ';' '''
12392 print('statement_item_37', list(p
))
12395 # { PExpr*del = p[3]->front(); p[3]->pop_front();
12396 # assert(p[3]->empty());
12397 # PAssign*tmp = new PAssign(p[1],del,p[4]);
12398 # FILE_NAME(tmp, @1);
12404 def p_statement_item_38(p
):
12405 '''statement_item : lpvalue K_LE delay1 expression ';' '''
12407 print('statement_item_38', list(p
))
12410 # { PExpr*del = p[3]->front(); p[3]->pop_front();
12411 # assert(p[3]->empty());
12412 # PAssignNB*tmp = new PAssignNB(p[1],del,p[4]);
12413 # FILE_NAME(tmp, @1);
12419 def p_statement_item_39(p
):
12420 '''statement_item : lpvalue '=' event_control expression ';' '''
12422 print('statement_item_39', list(p
))
12425 # { PAssign*tmp = new PAssign(p[1],0,p[3],p[4]);
12426 # FILE_NAME(tmp, @1);
12432 def p_statement_item_40(p
):
12433 '''statement_item : lpvalue '=' K_repeat '(' expression ')' event_control expression ';' '''
12435 print('statement_item_40', list(p
))
12438 # { PAssign*tmp = new PAssign(p[1],p[5],p[7],p[8]);
12439 # FILE_NAME(tmp,@1);
12440 # tmp->set_lineno(@1.first_line);
12446 def p_statement_item_41(p
):
12447 '''statement_item : lpvalue K_LE event_control expression ';' '''
12449 print('statement_item_41', list(p
))
12452 # { PAssignNB*tmp = new PAssignNB(p[1],0,p[3],p[4]);
12453 # FILE_NAME(tmp, @1);
12459 def p_statement_item_42(p
):
12460 '''statement_item : lpvalue K_LE K_repeat '(' expression ')' event_control expression ';' '''
12462 print('statement_item_42', list(p
))
12465 # { PAssignNB*tmp = new PAssignNB(p[1],p[5],p[7],p[8]);
12466 # FILE_NAME(tmp, @1);
12472 def p_statement_item_43(p
):
12473 '''statement_item : lpvalue '=' dynamic_array_new ';' '''
12475 print('statement_item_43', list(p
))
12478 # { PAssign*tmp = new PAssign(p[1],p[3]);
12479 # FILE_NAME(tmp, @1);
12485 def p_statement_item_44(p
):
12486 '''statement_item : lpvalue '=' class_new ';' '''
12488 print('statement_item_44', list(p
))
12491 # { PAssign*tmp = new PAssign(p[1],p[3]);
12492 # FILE_NAME(tmp, @1);
12498 def p_statement_item_45(p
):
12499 '''statement_item : K_wait '(' expression ')' statement_or_null '''
12501 print('statement_item_45', list(p
))
12504 # { PEventStatement*tmp;
12505 # PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, p[3]);
12506 # tmp = new PEventStatement(etmp);
12507 # FILE_NAME(tmp,@1);
12508 # tmp->set_statement(p[5]);
12514 def p_statement_item_46(p
):
12515 '''statement_item : K_wait K_fork ';' '''
12517 print('statement_item_46', list(p
))
12520 # { PEventStatement*tmp = new PEventStatement((PEEvent*)0);
12521 # FILE_NAME(tmp,@1);
12527 def p_statement_item_47(p
):
12528 '''statement_item : SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';' '''
12530 print('statement_item_47', list(p
))
12533 # { PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), *p[3]);
12534 # FILE_NAME(tmp,@1);
12542 def p_statement_item_48(p
):
12543 '''statement_item : SYSTEM_IDENTIFIER ';' '''
12545 print('statement_item_48', list(p
))
12548 # { list<PExpr*>pt;
12549 # PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), pt);
12550 # FILE_NAME(tmp,@1);
12557 def p_statement_item_49(p
):
12558 '''statement_item : hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
12560 print('statement_item_49', list(p
))
12563 # { PCallTask*tmp = pform_make_call_task(@1, *p[1], *p[3]);
12571 def p_statement_item_50(p
):
12572 '''statement_item : hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';' '''
12574 print('statement_item_50', list(p
))
12577 # { /* ....randomize with { <constraints> } */
12578 # if (p[1] && peek_tail_name(*p[1]) == "randomize") {
12579 # if (!gn_system_verilog())
12580 # yyerror(@2, "error: Randomize with constraint requires SystemVerilog.");
12582 # yyerror(@2, "sorry: Randomize with constraint not supported.");
12584 # yyerror(@2, "error: Constraint block can only be applied to randomize method.");
12587 # PCallTask*tmp = new PCallTask(*p[1], pt);
12588 # FILE_NAME(tmp, @1);
12595 def p_statement_item_51(p
):
12596 '''statement_item : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
12598 print('statement_item_51', list(p
))
12601 # { pform_name_t*t_name = p[1];
12602 # while (! p[3]->empty()) {
12603 # t_name->push_back(p[3]->front());
12604 # p[3]->pop_front();
12606 # PCallTask*tmp = new PCallTask(*t_name, *p[5]);
12607 # FILE_NAME(tmp, @1);
12616 def p_statement_item_52(p
):
12617 '''statement_item : hierarchy_identifier ';' '''
12619 print('statement_item_52', list(p
))
12622 # { list<PExpr*>pt;
12623 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
12630 def p_statement_item_53(p
):
12631 '''statement_item : implicit_class_handle '.' K_new '(' expression_list_with_nuls ')' ';' '''
12633 print('statement_item_53', list(p
))
12636 # { PChainConstructor*tmp = new PChainConstructor(*p[5]);
12637 # FILE_NAME(tmp, @3);
12644 def p_statement_item_54(p
):
12645 '''statement_item : hierarchy_identifier '(' error ')' ';' '''
12647 print('statement_item_54', list(p
))
12650 # { yyerror(@3, "error: Syntax error in task arguments.");
12652 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
12659 def p_statement_item_55(p
):
12660 '''statement_item : error ';' '''
12662 print('statement_item_55', list(p
))
12665 # { yyerror(@2, "error: malformed statement");
12667 # p[0] = new PNoop;
12672 def p__embed0_statement_item(p
):
12673 '''_embed0_statement_item : '''
12676 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_SEQ);
12677 # FILE_NAME(tmp, @1);
12678 # current_block_stack.push(tmp);
12683 def p__embed1_statement_item(p
):
12684 '''_embed1_statement_item : '''
12688 # if (! gn_system_verilog()) {
12689 # yyerror("error: Variable declaration in unnamed block "
12690 # "requires SystemVerilog.");
12693 # /* If there are no declarations in the scope then just delete it. */
12694 # pform_pop_scope();
12695 # assert(! current_block_stack.empty());
12696 # PBlock*tmp = current_block_stack.top();
12697 # current_block_stack.pop();
12704 def p__embed2_statement_item(p
):
12705 '''_embed2_statement_item : '''
12708 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_SEQ);
12709 # FILE_NAME(tmp, @1);
12710 # current_block_stack.push(tmp);
12715 def p__embed3_statement_item(p
):
12716 '''_embed3_statement_item : '''
12719 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
12720 # FILE_NAME(tmp, @1);
12721 # current_block_stack.push(tmp);
12726 def p__embed4_statement_item(p
):
12727 '''_embed4_statement_item : '''
12731 # if (! gn_system_verilog()) {
12732 # yyerror("error: Variable declaration in unnamed block "
12733 # "requires SystemVerilog.");
12736 # /* If there are no declarations in the scope then just delete it. */
12737 # pform_pop_scope();
12738 # assert(! current_block_stack.empty());
12739 # PBlock*tmp = current_block_stack.top();
12740 # current_block_stack.pop();
12747 def p__embed5_statement_item(p
):
12748 '''_embed5_statement_item : '''
12751 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_PAR);
12752 # FILE_NAME(tmp, @1);
12753 # current_block_stack.push(tmp);
12758 def p_compressed_statement_1(p
):
12759 '''compressed_statement : lpvalue K_PLUS_EQ expression '''
12761 print('compressed_statement_1', list(p
))
12764 # { PAssign*tmp = new PAssign(p[1], '+', p[3]);
12765 # FILE_NAME(tmp, @1);
12771 def p_compressed_statement_2(p
):
12772 '''compressed_statement : lpvalue K_MINUS_EQ expression '''
12774 print('compressed_statement_2', list(p
))
12777 # { PAssign*tmp = new PAssign(p[1], '-', p[3]);
12778 # FILE_NAME(tmp, @1);
12784 def p_compressed_statement_3(p
):
12785 '''compressed_statement : lpvalue K_MUL_EQ expression '''
12787 print('compressed_statement_3', list(p
))
12790 # { PAssign*tmp = new PAssign(p[1], '*', p[3]);
12791 # FILE_NAME(tmp, @1);
12797 def p_compressed_statement_4(p
):
12798 '''compressed_statement : lpvalue K_DIV_EQ expression '''
12800 print('compressed_statement_4', list(p
))
12803 # { PAssign*tmp = new PAssign(p[1], '/', p[3]);
12804 # FILE_NAME(tmp, @1);
12810 def p_compressed_statement_5(p
):
12811 '''compressed_statement : lpvalue K_MOD_EQ expression '''
12813 print('compressed_statement_5', list(p
))
12816 # { PAssign*tmp = new PAssign(p[1], '%', p[3]);
12817 # FILE_NAME(tmp, @1);
12823 def p_compressed_statement_6(p
):
12824 '''compressed_statement : lpvalue K_AND_EQ expression '''
12826 print('compressed_statement_6', list(p
))
12829 # { PAssign*tmp = new PAssign(p[1], '&', p[3]);
12830 # FILE_NAME(tmp, @1);
12836 def p_compressed_statement_7(p
):
12837 '''compressed_statement : lpvalue K_OR_EQ expression '''
12839 print('compressed_statement_7', list(p
))
12842 # { PAssign*tmp = new PAssign(p[1], '|', p[3]);
12843 # FILE_NAME(tmp, @1);
12849 def p_compressed_statement_8(p
):
12850 '''compressed_statement : lpvalue K_XOR_EQ expression '''
12852 print('compressed_statement_8', list(p
))
12855 # { PAssign*tmp = new PAssign(p[1], '^', p[3]);
12856 # FILE_NAME(tmp, @1);
12862 def p_compressed_statement_9(p
):
12863 '''compressed_statement : lpvalue K_LS_EQ expression '''
12865 print('compressed_statement_9', list(p
))
12868 # { PAssign *tmp = new PAssign(p[1], 'l', p[3]);
12869 # FILE_NAME(tmp, @1);
12875 def p_compressed_statement_10(p
):
12876 '''compressed_statement : lpvalue K_RS_EQ expression '''
12878 print('compressed_statement_10', list(p
))
12881 # { PAssign*tmp = new PAssign(p[1], 'r', p[3]);
12882 # FILE_NAME(tmp, @1);
12888 def p_compressed_statement_11(p
):
12889 '''compressed_statement : lpvalue K_RSS_EQ expression '''
12891 print('compressed_statement_11', list(p
))
12894 # { PAssign *tmp = new PAssign(p[1], 'R', p[3]);
12895 # FILE_NAME(tmp, @1);
12901 def p_statement_or_null_list_opt_1(p
):
12902 '''statement_or_null_list_opt : statement_or_null_list '''
12904 print('statement_or_null_list_opt_1', list(p
))
12911 def p_statement_or_null_list_opt_2(p
):
12912 '''statement_or_null_list_opt : '''
12914 print('statement_or_null_list_opt_2', list(p
))
12921 def p_statement_or_null_list_1(p
):
12922 '''statement_or_null_list : statement_or_null_list statement_or_null '''
12924 print('statement_or_null_list_1', list(p
))
12929 tmp
= StatementList()
12931 tmp
.add_statement(p
[2])
12934 # { vector<Statement*>*tmp = p[1];
12935 # if (p[2]) tmp->push_back(p[2]);
12941 def p_statement_or_null_list_2(p
):
12942 '''statement_or_null_list : statement_or_null '''
12944 print('statement_or_null_list_2', list(p
))
12946 tmp
= StatementList()
12948 tmp
.add_statement(p
[1])
12952 # { vector<Statement*>*tmp = new vector<Statement*>(0);
12953 # if (p[1]) tmp->push_back(p[1]);
12959 def p_analog_statement_1(p
):
12960 '''analog_statement : branch_probe_expression K_CONTRIBUTE expression ';' '''
12962 print('analog_statement_1', list(p
))
12965 # { p[0] = pform_contribution_statement(@2, p[1], p[3]); }
12969 def p_task_item_1(p
):
12970 '''task_item : block_item_decl '''
12972 print('task_item_1', list(p
))
12975 # { p[0] = new vector<pform_tf_port_t>(0); }
12979 def p_task_item_2(p
):
12980 '''task_item : tf_port_declaration '''
12982 print('task_item_2', list(p
))
12989 def p_task_item_list_1(p
):
12990 '''task_item_list : task_item_list task_item '''
12992 print('task_item_list_1', list(p
))
12995 # { vector<pform_tf_port_t>*tmp = p[1];
12996 # size_t s1 = tmp->size();
12997 # tmp->resize(s1 + p[2]->size());
12998 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
12999 # tmp->at(s1 + idx) = p[2]->at(idx);
13006 def p_task_item_list_2(p
):
13007 '''task_item_list : task_item '''
13009 print('task_item_list_2', list(p
))
13016 def p_task_item_list_opt_1(p
):
13017 '''task_item_list_opt : task_item_list '''
13019 print('task_item_list_opt_1', list(p
))
13026 def p_task_item_list_opt_2(p
):
13027 '''task_item_list_opt : '''
13029 print('task_item_list_opt_2', list(p
))
13036 def p_tf_port_list_opt_1(p
):
13037 '''tf_port_list_opt : tf_port_list '''
13039 print('tf_port_list_opt_1', list(p
))
13046 def p_tf_port_list_opt_2(p
):
13047 '''tf_port_list_opt : '''
13049 print('tf_port_list_opt_2', list(p
))
13056 def p_udp_body_1(p
):
13057 '''udp_body : K_table udp_entry_list K_endtable '''
13059 print('udp_body_1', list(p
))
13062 # { lex_end_table();
13068 def p_udp_body_2(p
):
13069 '''udp_body : K_table K_endtable '''
13071 print('udp_body_2', list(p
))
13074 # { lex_end_table();
13075 # yyerror(@1, "error: Empty UDP table.");
13081 def p_udp_body_3(p
):
13082 '''udp_body : K_table error K_endtable '''
13084 print('udp_body_3', list(p
))
13087 # { lex_end_table();
13088 # yyerror(@2, "Errors in UDP table");
13095 def p_udp_entry_list_1(p
):
13096 '''udp_entry_list : udp_comb_entry_list '''
13098 print('udp_entry_list_1', list(p
))
13104 def p_udp_entry_list_2(p
):
13105 '''udp_entry_list : udp_sequ_entry_list '''
13107 print('udp_entry_list_2', list(p
))
13113 def p_udp_comb_entry_1(p
):
13114 '''udp_comb_entry : udp_input_list ':' udp_output_sym ';' '''
13116 print('udp_comb_entry_1', list(p
))
13119 # { char*tmp = new char[strlen(p[1])+3];
13120 # strcpy(tmp, p[1]);
13121 # char*tp = tmp+strlen(tmp);
13131 def p_udp_comb_entry_list_1(p
):
13132 '''udp_comb_entry_list : udp_comb_entry '''
13134 print('udp_comb_entry_list_1', list(p
))
13137 # { list<string>*tmp = new list<string>;
13138 # tmp->push_back(p[1]);
13145 def p_udp_comb_entry_list_2(p
):
13146 '''udp_comb_entry_list : udp_comb_entry_list udp_comb_entry '''
13148 print('udp_comb_entry_list_2', list(p
))
13151 # { list<string>*tmp = p[1];
13152 # tmp->push_back(p[2]);
13159 def p_udp_sequ_entry_list_1(p
):
13160 '''udp_sequ_entry_list : udp_sequ_entry '''
13162 print('udp_sequ_entry_list_1', list(p
))
13165 # { list<string>*tmp = new list<string>;
13166 # tmp->push_back(p[1]);
13173 def p_udp_sequ_entry_list_2(p
):
13174 '''udp_sequ_entry_list : udp_sequ_entry_list udp_sequ_entry '''
13176 print('udp_sequ_entry_list_2', list(p
))
13179 # { list<string>*tmp = p[1];
13180 # tmp->push_back(p[2]);
13187 def p_udp_sequ_entry_1(p
):
13188 '''udp_sequ_entry : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' '''
13190 print('udp_sequ_entry_1', list(p
))
13193 # { char*tmp = new char[strlen(p[1])+5];
13194 # strcpy(tmp, p[1]);
13195 # char*tp = tmp+strlen(tmp);
13206 def p_udp_initial_1(p
):
13207 '''udp_initial : K_initial IDENTIFIER '=' number ';' '''
13209 print('udp_initial_1', list(p
))
13212 # { PExpr*etmp = new PENumber(p[4]);
13213 # PEIdent*itmp = new PEIdent(lex_strings.make(p[2]));
13214 # PAssign*atmp = new PAssign(itmp, etmp);
13215 # FILE_NAME(atmp, @2);
13222 def p_udp_init_opt_1(p
):
13223 '''udp_init_opt : udp_initial '''
13225 print('udp_init_opt_1', list(p
))
13232 def p_udp_init_opt_2(p
):
13233 '''udp_init_opt : '''
13235 print('udp_init_opt_2', list(p
))
13242 def p_udp_input_list_1(p
):
13243 '''udp_input_list : udp_input_sym '''
13245 print('udp_input_list_1', list(p
))
13248 # { char*tmp = new char[2];
13256 def p_udp_input_list_2(p
):
13257 '''udp_input_list : udp_input_list udp_input_sym '''
13259 print('udp_input_list_2', list(p
))
13262 # { char*tmp = new char[strlen(p[1])+2];
13263 # strcpy(tmp, p[1]);
13264 # char*tp = tmp+strlen(tmp);
13273 def p_udp_input_sym_1(p
):
13274 '''udp_input_sym : '0' '''
13276 print('udp_input_sym_1', list(p
))
13283 def p_udp_input_sym_2(p
):
13284 '''udp_input_sym : '1' '''
13286 print('udp_input_sym_2', list(p
))
13293 def p_udp_input_sym_3(p
):
13294 '''udp_input_sym : 'x' '''
13296 print('udp_input_sym_3', list(p
))
13303 def p_udp_input_sym_4(p
):
13304 '''udp_input_sym : '?' '''
13306 print('udp_input_sym_4', list(p
))
13313 def p_udp_input_sym_5(p
):
13314 '''udp_input_sym : 'b' '''
13316 print('udp_input_sym_5', list(p
))
13323 def p_udp_input_sym_6(p
):
13324 '''udp_input_sym : '*' '''
13326 print('udp_input_sym_6', list(p
))
13333 def p_udp_input_sym_7(p
):
13334 '''udp_input_sym : '%' '''
13336 print('udp_input_sym_7', list(p
))
13343 def p_udp_input_sym_8(p
):
13344 '''udp_input_sym : 'f' '''
13346 print('udp_input_sym_8', list(p
))
13353 def p_udp_input_sym_9(p
):
13354 '''udp_input_sym : 'F' '''
13356 print('udp_input_sym_9', list(p
))
13363 def p_udp_input_sym_10(p
):
13364 '''udp_input_sym : 'l' '''
13366 print('udp_input_sym_10', list(p
))
13373 def p_udp_input_sym_11(p
):
13374 '''udp_input_sym : 'h' '''
13376 print('udp_input_sym_11', list(p
))
13383 def p_udp_input_sym_12(p
):
13384 '''udp_input_sym : 'B' '''
13386 print('udp_input_sym_12', list(p
))
13393 def p_udp_input_sym_13(p
):
13394 '''udp_input_sym : 'r' '''
13396 print('udp_input_sym_13', list(p
))
13403 def p_udp_input_sym_14(p
):
13404 '''udp_input_sym : 'R' '''
13406 print('udp_input_sym_14', list(p
))
13413 def p_udp_input_sym_15(p
):
13414 '''udp_input_sym : 'M' '''
13416 print('udp_input_sym_15', list(p
))
13423 def p_udp_input_sym_16(p
):
13424 '''udp_input_sym : 'n' '''
13426 print('udp_input_sym_16', list(p
))
13433 def p_udp_input_sym_17(p
):
13434 '''udp_input_sym : 'N' '''
13436 print('udp_input_sym_17', list(p
))
13443 def p_udp_input_sym_18(p
):
13444 '''udp_input_sym : 'p' '''
13446 print('udp_input_sym_18', list(p
))
13453 def p_udp_input_sym_19(p
):
13454 '''udp_input_sym : 'P' '''
13456 print('udp_input_sym_19', list(p
))
13463 def p_udp_input_sym_20(p
):
13464 '''udp_input_sym : 'Q' '''
13466 print('udp_input_sym_20', list(p
))
13473 def p_udp_input_sym_21(p
):
13474 '''udp_input_sym : 'q' '''
13476 print('udp_input_sym_21', list(p
))
13483 def p_udp_input_sym_22(p
):
13484 '''udp_input_sym : '_' '''
13486 print('udp_input_sym_22', list(p
))
13493 def p_udp_input_sym_23(p
):
13494 '''udp_input_sym : '+' '''
13496 print('udp_input_sym_23', list(p
))
13503 def p_udp_input_sym_24(p
):
13504 '''udp_input_sym : DEC_NUMBER '''
13506 print('udp_input_sym_24', list(p
))
13509 # { yyerror(@1, "internal error: Input digits parse as decimal number!"); p[0] = '0'; }
13513 def p_udp_output_sym_1(p
):
13514 '''udp_output_sym : '0' '''
13516 print('udp_output_sym_1', list(p
))
13523 def p_udp_output_sym_2(p
):
13524 '''udp_output_sym : '1' '''
13526 print('udp_output_sym_2', list(p
))
13533 def p_udp_output_sym_3(p
):
13534 '''udp_output_sym : 'x' '''
13536 print('udp_output_sym_3', list(p
))
13543 def p_udp_output_sym_4(p
):
13544 '''udp_output_sym : '-' '''
13546 print('udp_output_sym_4', list(p
))
13553 def p_udp_output_sym_5(p
):
13554 '''udp_output_sym : DEC_NUMBER '''
13556 print('udp_output_sym_5', list(p
))
13559 # { yyerror(@1, "internal error: Output digits parse as decimal number!"); p[0] = '0'; }
13563 def p_udp_port_decl_1(p
):
13564 '''udp_port_decl : K_input list_of_identifiers ';' '''
13566 print('udp_port_decl_1', list(p
))
13569 # { p[0] = pform_make_udp_input_ports(p[2]); }
13573 def p_udp_port_decl_2(p
):
13574 '''udp_port_decl : K_output IDENTIFIER ';' '''
13576 print('udp_port_decl_2', list(p
))
13579 # { perm_string pname = lex_strings.make(p[2]);
13580 # PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
13581 # vector<PWire*>*tmp = new vector<PWire*>(1);
13589 def p_udp_port_decl_3(p
):
13590 '''udp_port_decl : K_reg IDENTIFIER ';' '''
13592 print('udp_port_decl_3', list(p
))
13595 # { perm_string pname = lex_strings.make(p[2]);
13596 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
13597 # vector<PWire*>*tmp = new vector<PWire*>(1);
13605 def p_udp_port_decl_4(p
):
13606 '''udp_port_decl : K_reg K_output IDENTIFIER ';' '''
13608 print('udp_port_decl_4', list(p
))
13611 # { perm_string pname = lex_strings.make(p[3]);
13612 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
13613 # vector<PWire*>*tmp = new vector<PWire*>(1);
13621 def p_udp_port_decls_1(p
):
13622 '''udp_port_decls : udp_port_decl '''
13624 print('udp_port_decls_1', list(p
))
13631 def p_udp_port_decls_2(p
):
13632 '''udp_port_decls : udp_port_decls udp_port_decl '''
13634 print('udp_port_decls_2', list(p
))
13637 # { vector<PWire*>*tmp = p[1];
13638 # size_t s1 = p[1]->size();
13639 # tmp->resize(s1+p[2]->size());
13640 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
13641 # tmp->at(s1+idx) = p[2]->at(idx);
13648 def p_udp_port_list_1(p
):
13649 '''udp_port_list : IDENTIFIER '''
13651 print('udp_port_list_1', list(p
))
13654 # { list<perm_string>*tmp = new list<perm_string>;
13655 # tmp->push_back(lex_strings.make(p[1]));
13662 def p_udp_port_list_2(p
):
13663 '''udp_port_list : udp_port_list ',' IDENTIFIER '''
13665 print('udp_port_list_2', list(p
))
13668 # { list<perm_string>*tmp = p[1];
13669 # tmp->push_back(lex_strings.make(p[3]));
13676 def p_udp_reg_opt_1(p
):
13677 '''udp_reg_opt : K_reg '''
13679 print('udp_reg_opt_1', list(p
))
13686 def p_udp_reg_opt_2(p
):
13687 '''udp_reg_opt : '''
13689 print('udp_reg_opt_2', list(p
))
13696 def p_udp_initial_expr_opt_1(p
):
13697 '''udp_initial_expr_opt : '=' expression '''
13699 print('udp_initial_expr_opt_1', list(p
))
13706 def p_udp_initial_expr_opt_2(p
):
13707 '''udp_initial_expr_opt : '''
13709 print('udp_initial_expr_opt_2', list(p
))
13716 def p_udp_input_declaration_list_1(p
):
13717 '''udp_input_declaration_list : K_input IDENTIFIER '''
13719 print('udp_input_declaration_list_1', list(p
))
13722 # { list<perm_string>*tmp = new list<perm_string>;
13723 # tmp->push_back(lex_strings.make(p[2]));
13730 def p_udp_input_declaration_list_2(p
):
13731 '''udp_input_declaration_list : udp_input_declaration_list ',' K_input IDENTIFIER '''
13733 print('udp_input_declaration_list_2', list(p
))
13736 # { list<perm_string>*tmp = p[1];
13737 # tmp->push_back(lex_strings.make(p[4]));
13744 def p_udp_primitive_1(p
):
13745 '''udp_primitive : K_primitive IDENTIFIER '(' udp_port_list ')' ';' udp_port_decls udp_init_opt udp_body K_endprimitive endlabel_opt '''
13747 print('udp_primitive_1', list(p
))
13750 # { perm_string tmp2 = lex_strings.make(p[2]);
13751 # pform_make_udp(tmp2, p[4], p[7], p[9], p[8],
13752 # @2.text, @2.first_line);
13754 # if (strcmp(p[2],p[11]) != 0) {
13755 # yyerror(@11, "error: End label doesn't match "
13756 # "primitive name");
13758 # if (! gn_system_verilog()) {
13759 # yyerror(@11, "error: Primitive end labels "
13760 # "require SystemVerilog.");
13769 def p_udp_primitive_2(p
):
13770 '''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 '''
13772 print('udp_primitive_2', list(p
))
13775 # { perm_string tmp2 = lex_strings.make(p[2]);
13776 # perm_string tmp6 = lex_strings.make(p[6]);
13777 # pform_make_udp(tmp2, p[5], tmp6, p[7], p[9], p[12],
13778 # @2.text, @2.first_line);
13780 # if (strcmp(p[2],p[14]) != 0) {
13781 # yyerror(@14, "error: End label doesn't match "
13782 # "primitive name");
13784 # if (! gn_system_verilog()) {
13785 # yyerror(@14, "error: Primitive end labels "
13786 # "require SystemVerilog.");
13796 def p_K_packed_opt_1(p
):
13797 '''K_packed_opt : K_packed '''
13799 print('K_packed_opt', list(p
))
13806 def p_K_packed_opt_2(p
):
13807 '''K_packed_opt : '''
13809 print('K_packed_opt', list(p
))
13816 def p_K_reg_opt_1(p
):
13817 '''K_reg_opt : K_reg '''
13819 print('K_reg_opt', list(p
))
13826 def p_K_reg_opt_2(p
):
13829 print('K_reg_opt', list(p
))
13836 def p_K_static_opt_1(p
):
13837 '''K_static_opt : K_static '''
13839 print('K_static_opt', list(p
))
13846 def p_K_static_opt_2(p
):
13847 '''K_static_opt : '''
13849 print('K_static_opt', list(p
))
13856 def p_K_virtual_opt_1(p
):
13857 '''K_virtual_opt : K_virtual '''
13866 def p_K_virtual_opt_2(p
):
13867 '''K_virtual_opt : '''