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
):
111 # -------------- RULES ----------------
115 def p_source_text_1(p
):
116 '''source_text : timeunits_declaration_opt _embed0_source_text description_list '''
118 print('source_text', list(p
))
124 def p_source_text_2(p
):
127 print('source_text', list(p
))
133 def p__embed0_source_text(p
):
134 '''_embed0_source_text : '''
136 # { pform_set_scope_timescale(yyloc); }
140 def p_assertion_item_1(p
):
141 '''assertion_item : concurrent_assertion_item '''
143 print('assertion_item_1', list(p
))
149 def p_assignment_pattern_1(p
):
150 '''assignment_pattern : K_LP expression_list_proper '}' '''
152 print('assignment_pattern_1', list(p
))
154 # { PEAssignPattern*tmp = new PEAssignPattern(*p[2]);
155 # FILE_NAME(tmp, @1);
162 def p_assignment_pattern_2(p
):
163 '''assignment_pattern : K_LP '}' '''
165 print('assignment_pattern_2', list(p
))
167 # { PEAssignPattern*tmp = new PEAssignPattern;
168 # FILE_NAME(tmp, @1);
174 def p_block_identifier_opt_1(p
):
175 '''block_identifier_opt : IDENTIFIER ':' '''
177 print('block_identifier_opt_1', list(p
))
183 def p_block_identifier_opt_2(p
):
184 '''block_identifier_opt : '''
186 print('block_identifier_opt_2', list(p
))
192 def p_class_declaration_1(p
):
193 '''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 '''
195 print('class_declaration_1', list(p
))
197 # { // Wrap up the class.
198 # if (p[11] && p[4] && p[4]->name != p[11]) {
199 # yyerror(@11, "error: Class end label doesn't match class name.");
206 def p__embed0_class_declaration(p
):
207 '''_embed0_class_declaration : '''
209 # { pform_start_class_declaration(@2, p[4], p[5].type, p[5].exprs, p[3]); }
213 def p__embed1_class_declaration(p
):
214 '''_embed1_class_declaration : '''
216 # { // Process a class.
217 # pform_end_class_declaration(@9);
222 def p_class_constraint_1(p
):
223 '''class_constraint : constraint_prototype '''
225 print('class_constraint_1', list(p
))
231 def p_class_constraint_2(p
):
232 '''class_constraint : constraint_declaration '''
234 print('class_constraint_2', list(p
))
240 def p_class_identifier_1(p
):
241 '''class_identifier : IDENTIFIER '''
243 print('class_identifier_1', list(p
))
245 # { // Create a synthetic typedef for the class name so that the
246 # // lexor detects the name as a type.
247 # perm_string name = lex_strings.make(p[1]);
248 # class_type_t*tmp = new class_type_t(name);
249 # FILE_NAME(tmp, @1);
250 # pform_set_typedef(name, tmp, NULL);
257 def p_class_identifier_2(p
):
258 '''class_identifier : TYPE_IDENTIFIER '''
260 print('class_identifier_2', list(p
))
262 # { class_type_t*tmp = dynamic_cast<class_type_t*>(p[1].type);
264 # yyerror(@1, "Type name \"%s\"is not a predeclared class name.", p[1].text);
272 def p_class_declaration_endlabel_opt_1(p
):
273 '''class_declaration_endlabel_opt : ':' TYPE_IDENTIFIER '''
275 print('class_declaration_endlabel_opt_1', list(p
))
277 # { class_type_t*tmp = dynamic_cast<class_type_t*> (p[2].type);
279 # yyerror(@2, "error: class declaration endlabel \"%s\" is not a class name\n", p[2].text);
282 # p[0] = strdupnew(tmp->name.str());
289 def p_class_declaration_endlabel_opt_2(p
):
290 '''class_declaration_endlabel_opt : ':' IDENTIFIER '''
292 print('class_declaration_endlabel_opt_2', list(p
))
299 def p_class_declaration_endlabel_opt_3(p
):
300 '''class_declaration_endlabel_opt : '''
302 print('class_declaration_endlabel_opt_3', list(p
))
308 def p_class_declaration_extends_opt_1(p
):
309 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '''
311 print('class_declaration_extends_opt_1', list(p
))
313 # { p[0].type = p[2].type;
320 def p_class_declaration_extends_opt_2(p
):
321 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '(' expression_list_with_nuls ')' '''
323 print('class_declaration_extends_opt_2', list(p
))
325 # { p[0].type = p[2].type;
332 def p_class_declaration_extends_opt_3(p
):
333 '''class_declaration_extends_opt : '''
335 print('class_declaration_extends_opt_3', list(p
))
337 # { p[0].type = 0; p[0].exprs = 0; }
341 def p_class_items_opt_1(p
):
342 '''class_items_opt : class_items '''
344 print('class_items_opt_1', list(p
))
350 def p_class_items_opt_2(p
):
351 '''class_items_opt : '''
353 print('class_items_opt_2', list(p
))
359 def p_class_items_1(p
):
360 '''class_items : class_items class_item '''
362 print('class_items_1', list(p
))
368 def p_class_items_2(p
):
369 '''class_items : class_item '''
371 print('class_items_2', list(p
))
377 def p_class_item_1(p
):
378 '''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 '''
380 print('class_item_1', list(p
))
382 # { current_function->set_ports(p[6]);
383 # pform_set_constructor_return(current_function);
384 # pform_set_this_class(@3, current_function);
385 # current_function_set_statement(@3, p[10]);
387 # current_function = 0;
392 def p_class_item_2(p
):
393 '''class_item : property_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
395 print('class_item_2', list(p
))
397 # { pform_class_property(@2, p[1], p[2], p[3]); }
401 def p_class_item_3(p
):
402 '''class_item : K_const class_item_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
404 print('class_item_3', list(p
))
406 # { pform_class_property(@1, p[2] | property_qualifier_t::make_const(), p[3], p[4]); }
410 def p_class_item_4(p
):
411 '''class_item : method_qualifier_opt task_declaration '''
413 print('class_item_4', list(p
))
415 # { /* The task_declaration rule puts this into the class */ }
419 def p_class_item_5(p
):
420 '''class_item : method_qualifier_opt function_declaration '''
422 print('class_item_5', list(p
))
424 # { /* The function_declaration rule puts this into the class */ }
428 def p_class_item_6(p
):
429 '''class_item : K_extern method_qualifier_opt K_function K_new ';' '''
431 print('class_item_6', list(p
))
433 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
437 def p_class_item_7(p
):
438 '''class_item : K_extern method_qualifier_opt K_function K_new '(' tf_port_list_opt ')' ';' '''
440 print('class_item_7', list(p
))
442 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
446 def p_class_item_8(p
):
447 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER ';' '''
449 print('class_item_8', list(p
))
451 # { yyerror(@1, "sorry: External methods are not yet supported.");
457 def p_class_item_9(p
):
458 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' ';' '''
460 print('class_item_9', list(p
))
462 # { yyerror(@1, "sorry: External methods are not yet supported.");
468 def p_class_item_10(p
):
469 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER ';' '''
471 print('class_item_10', list(p
))
473 # { yyerror(@1, "sorry: External methods are not yet supported.");
479 def p_class_item_11(p
):
480 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER '(' tf_port_list_opt ')' ';' '''
482 print('class_item_11', list(p
))
484 # { yyerror(@1, "sorry: External methods are not yet supported.");
490 def p_class_item_12(p
):
491 '''class_item : class_constraint '''
493 print('class_item_12', list(p
))
499 def p_class_item_13(p
):
500 '''class_item : property_qualifier_opt data_type error ';' '''
502 print('class_item_13', list(p
))
504 # { yyerror(@3, "error: Errors in variable names after data type.");
510 def p_class_item_14(p
):
511 '''class_item : property_qualifier_opt IDENTIFIER error ';' '''
513 print('class_item_14', list(p
))
515 # { yyerror(@3, "error: %s doesn't name a type.", p[2]);
521 def p_class_item_15(p
):
522 '''class_item : method_qualifier_opt K_function K_new error K_endfunction endnew_opt '''
524 print('class_item_15', list(p
))
526 # { yyerror(@1, "error: I give up on this class constructor declaration.");
532 def p_class_item_16(p
):
533 '''class_item : error ';' '''
535 print('class_item_16', list(p
))
537 # { yyerror(@2, "error: invalid class item.");
543 def p__embed0_class_item(p
):
544 '''_embed0_class_item : '''
546 # { assert(current_function==0);
547 # current_function = pform_push_constructor_scope(@3);
552 def p_class_item_qualifier_1(p
):
553 '''class_item_qualifier : K_static '''
555 print('class_item_qualifier_1', list(p
))
557 # { p[0] = property_qualifier_t::make_static(); }
561 def p_class_item_qualifier_2(p
):
562 '''class_item_qualifier : K_protected '''
564 print('class_item_qualifier_2', list(p
))
566 # { p[0] = property_qualifier_t::make_protected(); }
570 def p_class_item_qualifier_3(p
):
571 '''class_item_qualifier : K_local '''
573 print('class_item_qualifier_3', list(p
))
575 # { p[0] = property_qualifier_t::make_local(); }
579 def p_class_item_qualifier_list_1(p
):
580 '''class_item_qualifier_list : class_item_qualifier_list class_item_qualifier '''
582 print('class_item_qualifier_list_1', list(p
))
584 # { p[0] = p[1] | p[2]; }
588 def p_class_item_qualifier_list_2(p
):
589 '''class_item_qualifier_list : class_item_qualifier '''
591 print('class_item_qualifier_list_2', list(p
))
598 def p_class_item_qualifier_opt_1(p
):
599 '''class_item_qualifier_opt : class_item_qualifier_list '''
601 print('class_item_qualifier_opt_1', list(p
))
608 def p_class_item_qualifier_opt_2(p
):
609 '''class_item_qualifier_opt : '''
611 print('class_item_qualifier_opt_2', list(p
))
613 # { p[0] = property_qualifier_t::make_none(); }
617 def p_class_new_1(p
):
618 '''class_new : K_new '(' expression_list_with_nuls ')' '''
620 print('class_new_1', list(p
))
622 # { list<PExpr*>*expr_list = p[3];
623 # strip_tail_items(expr_list);
624 # PENewClass*tmp = new PENewClass(*expr_list);
625 # FILE_NAME(tmp, @1);
632 def p_class_new_2(p
):
633 '''class_new : K_new hierarchy_identifier '''
635 print('class_new_2', list(p
))
637 # { PEIdent*tmpi = new PEIdent(*p[2]);
638 # FILE_NAME(tmpi, @2);
639 # PENewCopy*tmp = new PENewCopy(tmpi);
640 # FILE_NAME(tmp, @1);
647 def p_class_new_3(p
):
648 '''class_new : K_new '''
650 print('class_new_3', list(p
))
652 # { PENewClass*tmp = new PENewClass;
653 # FILE_NAME(tmp, @1);
659 def p_concurrent_assertion_item_1(p
):
660 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' property_spec ')' statement_or_null '''
662 print('concurrent_assertion_item_1', list(p
))
665 # if (gn_assertions_flag) {
666 # yyerror(@2, "sorry: concurrent_assertion_item not supported."
667 # " Try -gno-assertion to turn this message off.");
673 def p_concurrent_assertion_item_2(p
):
674 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' error ')' statement_or_null '''
676 print('concurrent_assertion_item_2', list(p
))
679 # yyerror(@2, "error: Error in property_spec of concurrent assertion item.");
684 def p_constraint_block_item_1(p
):
685 '''constraint_block_item : constraint_expression '''
687 print('constraint_block_item_1', list(p
))
693 def p_constraint_block_item_list_1(p
):
694 '''constraint_block_item_list : constraint_block_item_list constraint_block_item '''
696 print('constraint_block_item_list_1', list(p
))
702 def p_constraint_block_item_list_2(p
):
703 '''constraint_block_item_list : constraint_block_item '''
705 print('constraint_block_item_list_2', list(p
))
711 def p_constraint_block_item_list_opt_1(p
):
712 '''constraint_block_item_list_opt : '''
714 print('constraint_block_item_list_opt_1', list(p
))
720 def p_constraint_block_item_list_opt_2(p
):
721 '''constraint_block_item_list_opt : constraint_block_item_list '''
723 print('constraint_block_item_list_opt_2', list(p
))
729 def p_constraint_declaration_1(p
):
730 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' constraint_block_item_list_opt '}' '''
732 print('constraint_declaration_1', list(p
))
734 # { yyerror(@2, "sorry: Constraint declarations not supported."); }
738 def p_constraint_declaration_2(p
):
739 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' error '}' '''
741 print('constraint_declaration_2', list(p
))
743 # { yyerror(@4, "error: Errors in the constraint block item list."); }
747 def p_constraint_expression_1(p
):
748 '''constraint_expression : expression ';' '''
750 print('constraint_expression_1', list(p
))
756 def p_constraint_expression_2(p
):
757 '''constraint_expression : expression K_dist '{' '}' ';' '''
759 print('constraint_expression_2', list(p
))
765 def p_constraint_expression_3(p
):
766 '''constraint_expression : expression K_TRIGGER constraint_set '''
768 print('constraint_expression_3', list(p
))
774 def p_constraint_expression_4(p
):
775 '''constraint_expression : K_if '(' expression ')' constraint_set %prec less_than_K_else '''
777 print('constraint_expression_4', list(p
))
783 def p_constraint_expression_5(p
):
784 '''constraint_expression : K_if '(' expression ')' constraint_set K_else constraint_set '''
786 print('constraint_expression_5', list(p
))
792 def p_constraint_expression_6(p
):
793 '''constraint_expression : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' constraint_set '''
795 print('constraint_expression_6', list(p
))
801 def p_constraint_expression_list_1(p
):
802 '''constraint_expression_list : constraint_expression_list constraint_expression '''
804 print('constraint_expression_list_1', list(p
))
810 def p_constraint_expression_list_2(p
):
811 '''constraint_expression_list : constraint_expression '''
813 print('constraint_expression_list_2', list(p
))
819 def p_constraint_prototype_1(p
):
820 '''constraint_prototype : K_static_opt K_constraint IDENTIFIER ';' '''
822 print('constraint_prototype_1', list(p
))
824 # { yyerror(@2, "sorry: Constraint prototypes not supported."); }
828 def p_constraint_set_1(p
):
829 '''constraint_set : constraint_expression '''
831 print('constraint_set_1', list(p
))
837 def p_constraint_set_2(p
):
838 '''constraint_set : '{' constraint_expression_list '}' '''
840 print('constraint_set_2', list(p
))
846 def p_data_declaration_1(p
):
847 '''data_declaration : attribute_list_opt data_type_or_implicit list_of_variable_decl_assignments ';' '''
849 print('data_declaration_1', list(p
))
851 # { data_type_t*data_type = p[2];
852 # if (data_type == 0) {
853 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
854 # FILE_NAME(data_type, @2);
856 # pform_makewire(@2, 0, str_strength, p[3], NetNet::IMPLICIT_REG, data_type);
861 def p_data_type_1(p
):
862 '''data_type : integer_vector_type unsigned_signed_opt dimensions_opt '''
864 print('data_type_1', list(p
))
867 if (use_vtype
== IVL_VT_NO_TYPE
):
868 use_vtype
= IVL_VT_LOGIC
870 dt
= DataType(use_vtype
, signed
=p
[2])
872 dt
.reg_flag
= reg_flag
875 # { ivl_variable_type_t use_vtype = p[1];
876 # bool reg_flag = false;
877 # if (use_vtype == IVL_VT_NO_TYPE) {
878 # use_vtype = IVL_VT_LOGIC;
881 # vector_type_t*tmp = new vector_type_t(use_vtype, p[2], p[3]);
882 # tmp->reg_flag = reg_flag;
883 # FILE_NAME(tmp, @1);
889 def p_data_type_2(p
):
890 '''data_type : non_integer_type '''
892 print('data_type_2', list(p
))
895 # { real_type_t*tmp = new real_type_t(p[1]);
896 # FILE_NAME(tmp, @1);
902 def p_data_type_3(p
):
903 '''data_type : struct_data_type '''
905 print('data_type_3', list(p
))
908 # { if (!p[1]->packed_flag) {
909 # yyerror(@1, "sorry: Unpacked structs not supported.");
916 def p_data_type_4(p
):
917 '''data_type : enum_data_type '''
919 print('data_type_4', list(p
))
926 def p_data_type_5(p
):
927 '''data_type : atom2_type signed_unsigned_opt '''
929 print('data_type_5', list(p
))
931 # { atom2_type_t*tmp = new atom2_type_t(p[1], p[2]);
932 # FILE_NAME(tmp, @1);
938 def p_data_type_6(p
):
939 '''data_type : K_integer signed_unsigned_opt '''
941 print('data_type_6', list(p
))
943 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
944 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, p[2], pd);
945 # tmp->reg_flag = true;
946 # tmp->integer_flag = true;
952 def p_data_type_7(p
):
953 '''data_type : K_time '''
955 print('data_type_7', list(p
))
957 # { list<pform_range_t>*pd = make_range_from_width(64);
958 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
959 # tmp->reg_flag = !gn_system_verilog();
965 def p_data_type_8(p
):
966 '''data_type : TYPE_IDENTIFIER dimensions_opt '''
968 print('data_type_8', list(p
))
971 # parray_type_t*tmp = new parray_type_t(p[1].type, p[2]);
972 # FILE_NAME(tmp, @1);
974 # } else p[0] = p[1].type;
980 def p_data_type_9(p
):
981 '''data_type : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_data_type TYPE_IDENTIFIER '''
983 print('data_type_9', list(p
))
985 # { lex_in_package_scope(0);
992 def p_data_type_10(p
):
993 '''data_type : K_string '''
995 print('data_type_10', list(p
))
997 # { string_type_t*tmp = new string_type_t;
998 # FILE_NAME(tmp, @1);
1004 def p__embed0_data_type(p
):
1005 '''_embed0_data_type : '''
1007 # { lex_in_package_scope(p[1]); }
1011 def p_data_type_or_implicit_1(p
):
1012 '''data_type_or_implicit : data_type '''
1014 print('data_type_or_implicit_1', list(p
))
1021 def p_data_type_or_implicit_2(p
):
1022 '''data_type_or_implicit : signing dimensions_opt '''
1024 print('data_type_or_implicit_2', list(p
))
1026 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, p[1], p[2]);
1027 # tmp->implicit_flag = true;
1028 # FILE_NAME(tmp, @1);
1034 def p_data_type_or_implicit_3(p
):
1035 '''data_type_or_implicit : dimensions '''
1037 print('data_type_or_implicit_3', list(p
))
1039 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, p[1]);
1040 # tmp->implicit_flag = true;
1041 # FILE_NAME(tmp, @1);
1047 def p_data_type_or_implicit_4(p
):
1048 '''data_type_or_implicit : '''
1049 if(parse_debug
> 2):
1050 print('data_type_or_implicit_4', list(p
))
1056 def p_data_type_or_implicit_or_void_1(p
):
1057 '''data_type_or_implicit_or_void : data_type_or_implicit '''
1059 print('data_type_or_implicit_or_void_1', list(p
))
1066 def p_data_type_or_implicit_or_void_2(p
):
1067 '''data_type_or_implicit_or_void : K_void '''
1069 print('data_type_or_implicit_or_void_2', list(p
))
1071 # { void_type_t*tmp = new void_type_t;
1072 # FILE_NAME(tmp, @1);
1078 def p_description_1(p
):
1079 '''description : module '''
1080 if(parse_debug
> 2):
1081 print('description_1', list(p
))
1087 def p_description_2(p
):
1088 '''description : udp_primitive '''
1090 print('description_2', list(p
))
1096 def p_description_3(p
):
1097 '''description : config_declaration '''
1099 print('description_3', list(p
))
1105 def p_description_4(p
):
1106 '''description : nature_declaration '''
1108 print('description_4', list(p
))
1114 def p_description_5(p
):
1115 '''description : package_declaration '''
1117 print('description_5', list(p
))
1123 def p_description_6(p
):
1124 '''description : discipline_declaration '''
1126 print('description_6', list(p
))
1132 def p_description_7(p
):
1133 '''description : package_item '''
1135 print('description_7', list(p
))
1141 def p_description_8(p
):
1142 '''description : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' '''
1144 print('description_8', list(p
))
1146 # { perm_string tmp3 = lex_strings.make(p[3]);
1147 # pform_set_type_attrib(tmp3, p[5], p[7]);
1154 def p_description_list_1(p
):
1155 '''description_list : description '''
1156 if(parse_debug
> 2):
1157 print('description_list_1', list(p
))
1163 def p_description_list_2(p
):
1164 '''description_list : description_list description '''
1166 print('description_list_2', list(p
))
1172 def p_endnew_opt_1(p
):
1173 '''endnew_opt : ':' K_new '''
1175 print('endnew_opt_1', list(p
))
1181 def p_endnew_opt_2(p
):
1184 print('endnew_opt_2', list(p
))
1190 def p_dynamic_array_new_1(p
):
1191 '''dynamic_array_new : K_new '[' expression ']' '''
1193 print('dynamic_array_new_1', list(p
))
1195 # { p[0] = new PENewArray(p[3], 0);
1196 # FILE_NAME(p[0], @1);
1201 def p_dynamic_array_new_2(p
):
1202 '''dynamic_array_new : K_new '[' expression ']' '(' expression ')' '''
1204 print('dynamic_array_new_2', list(p
))
1206 # { p[0] = new PENewArray(p[3], p[6]);
1207 # FILE_NAME(p[0], @1);
1212 def p_for_step_1(p
):
1213 '''for_step : lpvalue '=' expression '''
1215 print('for_step_1', list(p
))
1217 # { PAssign*tmp = new PAssign(p[1],p[3]);
1218 # FILE_NAME(tmp, @1);
1224 def p_for_step_2(p
):
1225 '''for_step : inc_or_dec_expression '''
1227 print('for_step_2', list(p
))
1229 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
1233 def p_for_step_3(p
):
1234 '''for_step : compressed_statement '''
1236 print('for_step_3', list(p
))
1243 def p_function_declaration_1(p
):
1244 '''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 '''
1246 print('function_declaration_1', list(p
))
1248 # { // Last step: check any closing name.
1250 # if (strcmp(p[4],p[11]) != 0) {
1251 # yyerror(@11, "error: End label doesn't match "
1254 # if (! gn_system_verilog()) {
1255 # yyerror(@11, "error: Function end labels require "
1256 # "SystemVerilog.");
1265 def p_function_declaration_2(p
):
1266 '''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 '''
1268 print('function_declaration_2', list(p
))
1270 # { // Last step: check any closing name.
1272 # if (strcmp(p[4],p[14]) != 0) {
1273 # yyerror(@14, "error: End label doesn't match "
1276 # if (! gn_system_verilog()) {
1277 # yyerror(@14, "error: Function end labels require "
1278 # "SystemVerilog.");
1287 def p_function_declaration_3(p
):
1288 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER error K_endfunction _embed4_function_declaration endlabel_opt '''
1290 print('function_declaration_3', list(p
))
1292 # { // Last step: check any closing name.
1294 # if (strcmp(p[4],p[8]) != 0) {
1295 # yyerror(@8, "error: End label doesn't match function name");
1297 # if (! gn_system_verilog()) {
1298 # yyerror(@8, "error: Function end labels require "
1299 # "SystemVerilog.");
1308 def p__embed0_function_declaration(p
):
1309 '''_embed0_function_declaration : '''
1311 # { assert(current_function == 0);
1312 # current_function = pform_push_function_scope(@1, p[4], p[2]);
1317 def p__embed1_function_declaration(p
):
1318 '''_embed1_function_declaration : '''
1320 # { current_function->set_ports(p[7]);
1321 # current_function->set_return(p[3]);
1322 # current_function_set_statement(p[8]? @8 : @4, p[8]);
1323 # pform_set_this_class(@4, current_function);
1324 # pform_pop_scope();
1325 # current_function = 0;
1330 def p__embed2_function_declaration(p
):
1331 '''_embed2_function_declaration : '''
1333 # { assert(current_function == 0);
1334 # current_function = pform_push_function_scope(@1, p[4], p[2]);
1339 def p__embed3_function_declaration(p
):
1340 '''_embed3_function_declaration : '''
1342 # { current_function->set_ports(p[7]);
1343 # current_function->set_return(p[3]);
1344 # current_function_set_statement(p[11]? @11 : @4, p[11]);
1345 # pform_set_this_class(@4, current_function);
1346 # pform_pop_scope();
1347 # current_function = 0;
1348 # if (p[7]==0 && !gn_system_verilog()) {
1349 # yyerror(@4, "error: Empty parenthesis syntax requires SystemVerilog.");
1355 def p__embed4_function_declaration(p
):
1356 '''_embed4_function_declaration : '''
1359 # if (current_function) {
1360 # pform_pop_scope();
1361 # current_function = 0;
1363 # assert(current_function == 0);
1364 # yyerror(@1, "error: Syntax error defining function.");
1370 def p_import_export_1(p
):
1371 '''import_export : K_import '''
1373 print('import_export_1', list(p
))
1380 def p_import_export_2(p
):
1381 '''import_export : K_export '''
1383 print('import_export_2', list(p
))
1390 def p_implicit_class_handle_1(p
):
1391 '''implicit_class_handle : K_this '''
1393 print('implicit_class_handle_1', list(p
))
1395 # { p[0] = pform_create_this(); }
1399 def p_implicit_class_handle_2(p
):
1400 '''implicit_class_handle : K_super '''
1402 print('implicit_class_handle_2', list(p
))
1404 # { p[0] = pform_create_super(); }
1408 def p_inc_or_dec_expression_1(p
):
1409 '''inc_or_dec_expression : K_INCR lpvalue %prec UNARY_PREC '''
1411 print('inc_or_dec_expression_1', list(p
))
1413 # { PEUnary*tmp = new PEUnary('I', p[2]);
1414 # FILE_NAME(tmp, @2);
1420 def p_inc_or_dec_expression_2(p
):
1421 '''inc_or_dec_expression : lpvalue K_INCR %prec UNARY_PREC '''
1423 print('inc_or_dec_expression_2', list(p
))
1425 # { PEUnary*tmp = new PEUnary('i', p[1]);
1426 # FILE_NAME(tmp, @1);
1432 def p_inc_or_dec_expression_3(p
):
1433 '''inc_or_dec_expression : K_DECR lpvalue %prec UNARY_PREC '''
1435 print('inc_or_dec_expression_3', list(p
))
1437 # { PEUnary*tmp = new PEUnary('D', p[2]);
1438 # FILE_NAME(tmp, @2);
1444 def p_inc_or_dec_expression_4(p
):
1445 '''inc_or_dec_expression : lpvalue K_DECR %prec UNARY_PREC '''
1447 print('inc_or_dec_expression_4', list(p
))
1449 # { PEUnary*tmp = new PEUnary('d', p[1]);
1450 # FILE_NAME(tmp, @1);
1456 def p_inside_expression_1(p
):
1457 '''inside_expression : expression K_inside '{' open_range_list '}' '''
1459 print('inside_expression_1', list(p
))
1461 # { yyerror(@2, "sorry: \"inside\" expressions not supported yet.");
1467 def p_integer_vector_type_1(p
):
1468 '''integer_vector_type : K_reg '''
1470 print('integer_vector_type_1', list(p
))
1471 p
[0] = IVL_VT_NO_TYPE
1477 def p_integer_vector_type_2(p
):
1478 '''integer_vector_type : K_bit '''
1480 print('integer_vector_type_2', list(p
))
1487 def p_integer_vector_type_3(p
):
1488 '''integer_vector_type : K_logic '''
1490 print('integer_vector_type_3', list(p
))
1497 def p_integer_vector_type_4(p
):
1498 '''integer_vector_type : K_bool '''
1500 print('integer_vector_type_4', list(p
))
1502 # { p[0] = IVL_VT_BOOL; }
1506 def p_join_keyword_1(p
):
1507 '''join_keyword : K_join '''
1509 print('join_keyword_1', list(p
))
1511 # { p[0] = PBlock::BL_PAR; }
1515 def p_join_keyword_2(p
):
1516 '''join_keyword : K_join_none '''
1518 print('join_keyword_2', list(p
))
1520 # { p[0] = PBlock::BL_JOIN_NONE; }
1524 def p_join_keyword_3(p
):
1525 '''join_keyword : K_join_any '''
1527 print('join_keyword_3', list(p
))
1529 # { p[0] = PBlock::BL_JOIN_ANY; }
1533 def p_jump_statement_1(p
):
1534 '''jump_statement : K_break ';' '''
1536 print('jump_statement_1', list(p
))
1538 # { yyerror(@1, "sorry: break statements not supported.");
1544 def p_jump_statement_2(p
):
1545 '''jump_statement : K_return ';' '''
1547 print('jump_statement_2', list(p
))
1549 # { PReturn*tmp = new PReturn(0);
1550 # FILE_NAME(tmp, @1);
1556 def p_jump_statement_3(p
):
1557 '''jump_statement : K_return expression ';' '''
1559 print('jump_statement_3', list(p
))
1561 # { PReturn*tmp = new PReturn(p[2]);
1562 # FILE_NAME(tmp, @1);
1568 def p_lifetime_1(p
):
1569 '''lifetime : K_automatic '''
1571 print('lifetime_1', list(p
))
1573 # { p[0] = LexicalScope::AUTOMATIC; }
1577 def p_lifetime_2(p
):
1578 '''lifetime : K_static '''
1580 print('lifetime_2', list(p
))
1582 # { p[0] = LexicalScope::STATIC; }
1586 def p_lifetime_opt_1(p
):
1587 '''lifetime_opt : lifetime '''
1589 print('lifetime_opt_1', list(p
))
1596 def p_lifetime_opt_2(p
):
1597 '''lifetime_opt : '''
1598 if(parse_debug
> 2):
1599 print('lifetime_opt_2', list(p
))
1601 # { p[0] = LexicalScope::INHERITED; }
1605 def p_loop_statement_1(p
):
1606 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' for_step ')' statement_or_null '''
1608 print('loop_statement_1', list(p
))
1610 # { PForStatement*tmp = new PForStatement(p[3], p[5], p[7], p[9], p[11]);
1611 # FILE_NAME(tmp, @1);
1617 def p_loop_statement_2(p
):
1618 '''loop_statement : K_for '(' data_type IDENTIFIER '=' expression ';' expression ';' for_step ')' _embed0_loop_statement statement_or_null '''
1620 print('loop_statement_2', list(p
))
1622 # { pform_name_t tmp_hident;
1623 # tmp_hident.push_back(name_component_t(lex_strings.make(p[4])));
1625 # PEIdent*tmp_ident = pform_new_ident(tmp_hident);
1626 # FILE_NAME(tmp_ident, @4);
1628 # PForStatement*tmp_for = new PForStatement(tmp_ident, p[6], p[8], p[10], p[13]);
1629 # FILE_NAME(tmp_for, @1);
1631 # pform_pop_scope();
1632 # vector<Statement*>tmp_for_list (1);
1633 # tmp_for_list[0] = tmp_for;
1634 # PBlock*tmp_blk = current_block_stack.top();
1635 # current_block_stack.pop();
1636 # tmp_blk->set_statement(tmp_for_list);
1643 def p_loop_statement_3(p
):
1644 '''loop_statement : K_forever statement_or_null '''
1646 print('loop_statement_3', list(p
))
1648 # { PForever*tmp = new PForever(p[2]);
1649 # FILE_NAME(tmp, @1);
1655 def p_loop_statement_4(p
):
1656 '''loop_statement : K_repeat '(' expression ')' statement_or_null '''
1658 print('loop_statement_4', list(p
))
1660 # { PRepeat*tmp = new PRepeat(p[3], p[5]);
1661 # FILE_NAME(tmp, @1);
1667 def p_loop_statement_5(p
):
1668 '''loop_statement : K_while '(' expression ')' statement_or_null '''
1670 print('loop_statement_5', list(p
))
1672 # { PWhile*tmp = new PWhile(p[3], p[5]);
1673 # FILE_NAME(tmp, @1);
1679 def p_loop_statement_6(p
):
1680 '''loop_statement : K_do statement_or_null K_while '(' expression ')' ';' '''
1682 print('loop_statement_6', list(p
))
1684 # { PDoWhile*tmp = new PDoWhile(p[5], p[2]);
1685 # FILE_NAME(tmp, @1);
1691 def p_loop_statement_7(p
):
1692 '''loop_statement : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' _embed1_loop_statement statement_or_null '''
1694 print('loop_statement_7', list(p
))
1696 # { PForeach*tmp_for = pform_make_foreach(@1, p[3], p[5], p[9]);
1698 # pform_pop_scope();
1699 # vector<Statement*>tmp_for_list(1);
1700 # tmp_for_list[0] = tmp_for;
1701 # PBlock*tmp_blk = current_block_stack.top();
1702 # current_block_stack.pop();
1703 # tmp_blk->set_statement(tmp_for_list);
1709 def p_loop_statement_8(p
):
1710 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' error ')' statement_or_null '''
1712 print('loop_statement_8', list(p
))
1715 # yyerror(@1, "error: Error in for loop step assignment.");
1720 def p_loop_statement_9(p
):
1721 '''loop_statement : K_for '(' lpvalue '=' expression ';' error ';' for_step ')' statement_or_null '''
1723 print('loop_statement_9', list(p
))
1726 # yyerror(@1, "error: Error in for loop condition expression.");
1731 def p_loop_statement_10(p
):
1732 '''loop_statement : K_for '(' error ')' statement_or_null '''
1734 print('loop_statement_10', list(p
))
1737 # yyerror(@1, "error: Incomprehensible for loop.");
1742 def p_loop_statement_11(p
):
1743 '''loop_statement : K_while '(' error ')' statement_or_null '''
1745 print('loop_statement_11', list(p
))
1748 # yyerror(@1, "error: Error in while loop condition.");
1753 def p_loop_statement_12(p
):
1754 '''loop_statement : K_do statement_or_null K_while '(' error ')' ';' '''
1756 print('loop_statement_12', list(p
))
1759 # yyerror(@1, "error: Error in do/while loop condition.");
1764 def p_loop_statement_13(p
):
1765 '''loop_statement : K_foreach '(' IDENTIFIER '[' error ']' ')' statement_or_null '''
1767 print('loop_statement_13', list(p
))
1770 # yyerror(@4, "error: Errors in foreach loop variables list.");
1775 def p__embed0_loop_statement(p
):
1776 '''_embed0_loop_statement : '''
1778 # { static unsigned for_counter = 0;
1779 # char for_block_name [64];
1780 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_for_loop%u", for_counter);
1782 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1783 # FILE_NAME(tmp, @1);
1784 # current_block_stack.push(tmp);
1786 # list<decl_assignment_t*>assign_list;
1787 # decl_assignment_t*tmp_assign = new decl_assignment_t;
1788 # tmp_assign->name = lex_strings.make(p[4]);
1789 # assign_list.push_back(tmp_assign);
1790 # pform_makewire(@4, 0, str_strength, &assign_list, NetNet::REG, p[3]);
1795 def p__embed1_loop_statement(p
):
1796 '''_embed1_loop_statement : '''
1798 # { static unsigned foreach_counter = 0;
1799 # char for_block_name[64];
1800 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_foreach%u", foreach_counter);
1801 # foreach_counter += 1;
1803 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1804 # FILE_NAME(tmp, @1);
1805 # current_block_stack.push(tmp);
1807 # pform_make_foreach_declarations(@1, p[5]);
1812 def p_list_of_variable_decl_assignments_1(p
):
1813 '''list_of_variable_decl_assignments : variable_decl_assignment '''
1815 print('list_of_variable_decl_assignments_1', list(p
))
1817 # { list<decl_assignment_t*>*tmp = new list<decl_assignment_t*>;
1818 # tmp->push_back(p[1]);
1824 def p_list_of_variable_decl_assignments_2(p
):
1825 '''list_of_variable_decl_assignments : list_of_variable_decl_assignments ',' variable_decl_assignment '''
1827 print('list_of_variable_decl_assignments_2', list(p
))
1829 # { list<decl_assignment_t*>*tmp = p[1];
1830 # tmp->push_back(p[3]);
1836 def p_variable_decl_assignment_1(p
):
1837 '''variable_decl_assignment : IDENTIFIER dimensions_opt '''
1839 print('variable_decl_assignment_1', list(p
))
1841 # { decl_assignment_t*tmp = new decl_assignment_t;
1842 # tmp->name = lex_strings.make(p[1]);
1844 # tmp->index = *p[2];
1853 def p_variable_decl_assignment_2(p
):
1854 '''variable_decl_assignment : IDENTIFIER '=' expression '''
1856 print('variable_decl_assignment_2', list(p
))
1858 # { decl_assignment_t*tmp = new decl_assignment_t;
1859 # tmp->name = lex_strings.make(p[1]);
1860 # tmp->expr .reset(p[3]);
1867 def p_variable_decl_assignment_3(p
):
1868 '''variable_decl_assignment : IDENTIFIER '=' K_new '(' ')' '''
1870 print('variable_decl_assignment_3', list(p
))
1872 # { decl_assignment_t*tmp = new decl_assignment_t;
1873 # tmp->name = lex_strings.make(p[1]);
1874 # PENewClass*expr = new PENewClass;
1875 # FILE_NAME(expr, @3);
1876 # tmp->expr .reset(expr);
1883 def p_loop_variables_1(p
):
1884 '''loop_variables : loop_variables ',' IDENTIFIER '''
1886 print('loop_variables_1', list(p
))
1888 # { list<perm_string>*tmp = p[1];
1889 # tmp->push_back(lex_strings.make(p[3]));
1896 def p_loop_variables_2(p
):
1897 '''loop_variables : IDENTIFIER '''
1899 print('loop_variables_2', list(p
))
1901 # { list<perm_string>*tmp = new list<perm_string>;
1902 # tmp->push_back(lex_strings.make(p[1]));
1909 def p_method_qualifier_1(p
):
1910 '''method_qualifier : K_virtual '''
1912 print('method_qualifier_1', list(p
))
1918 def p_method_qualifier_2(p
):
1919 '''method_qualifier : class_item_qualifier '''
1921 print('method_qualifier_2', list(p
))
1927 def p_method_qualifier_opt_1(p
):
1928 '''method_qualifier_opt : method_qualifier '''
1930 print('method_qualifier_opt_1', list(p
))
1936 def p_method_qualifier_opt_2(p
):
1937 '''method_qualifier_opt : '''
1939 print('method_qualifier_opt_2', list(p
))
1945 def p_modport_declaration_1(p
):
1946 '''modport_declaration : K_modport _embed0_modport_declaration modport_item_list ';' '''
1948 print('modport_declaration_1', list(p
))
1954 def p__embed0_modport_declaration(p
):
1955 '''_embed0_modport_declaration : '''
1957 # { if (!pform_in_interface())
1958 # yyerror(@1, "error: modport declarations are only allowed "
1959 # "in interfaces.");
1964 def p_modport_item_list_1(p
):
1965 '''modport_item_list : modport_item '''
1967 print('modport_item_list_1', list(p
))
1973 def p_modport_item_list_2(p
):
1974 '''modport_item_list : modport_item_list ',' modport_item '''
1976 print('modport_item_list_2', list(p
))
1982 def p_modport_item_1(p
):
1983 '''modport_item : IDENTIFIER _embed0_modport_item '(' modport_ports_list ')' '''
1985 print('modport_item_1', list(p
))
1987 # { pform_end_modport_item(@1); }
1991 def p__embed0_modport_item(p
):
1992 '''_embed0_modport_item : '''
1994 # { pform_start_modport_item(@1, p[1]); }
1998 def p_modport_ports_list_1(p
):
1999 '''modport_ports_list : modport_ports_declaration '''
2001 print('modport_ports_list_1', list(p
))
2007 def p_modport_ports_list_2(p
):
2008 '''modport_ports_list : modport_ports_list ',' modport_ports_declaration '''
2010 print('modport_ports_list_2', list(p
))
2016 def p_modport_ports_list_3(p
):
2017 '''modport_ports_list : modport_ports_list ',' modport_simple_port '''
2019 print('modport_ports_list_3', list(p
))
2021 # { if (last_modport_port.type == MP_SIMPLE) {
2022 # pform_add_modport_port(@3, last_modport_port.direction,
2023 # p[3]->name, p[3]->parm);
2025 # yyerror(@3, "error: modport expression not allowed here.");
2032 def p_modport_ports_list_4(p
):
2033 '''modport_ports_list : modport_ports_list ',' modport_tf_port '''
2035 print('modport_ports_list_4', list(p
))
2037 # { if (last_modport_port.type != MP_TF)
2038 # yyerror(@3, "error: task/function declaration not allowed here.");
2043 def p_modport_ports_list_5(p
):
2044 '''modport_ports_list : modport_ports_list ',' IDENTIFIER '''
2046 print('modport_ports_list_5', list(p
))
2048 # { if (last_modport_port.type == MP_SIMPLE) {
2049 # pform_add_modport_port(@3, last_modport_port.direction,
2050 # lex_strings.make(p[3]), 0);
2051 # } else if (last_modport_port.type != MP_TF) {
2052 # yyerror(@3, "error: list of identifiers not allowed here.");
2059 def p_modport_ports_list_6(p
):
2060 '''modport_ports_list : modport_ports_list ',' '''
2062 print('modport_ports_list_6', list(p
))
2064 # { yyerror(@2, "error: NULL port declarations are not allowed"); }
2068 def p_modport_ports_declaration_1(p
):
2069 '''modport_ports_declaration : attribute_list_opt port_direction IDENTIFIER '''
2071 print('modport_ports_declaration_1', list(p
))
2073 # { last_modport_port.type = MP_SIMPLE;
2074 # last_modport_port.direction = p[2];
2075 # pform_add_modport_port(@3, p[2], lex_strings.make(p[3]), 0);
2082 def p_modport_ports_declaration_2(p
):
2083 '''modport_ports_declaration : attribute_list_opt port_direction modport_simple_port '''
2085 print('modport_ports_declaration_2', list(p
))
2087 # { last_modport_port.type = MP_SIMPLE;
2088 # last_modport_port.direction = p[2];
2089 # pform_add_modport_port(@3, p[2], p[3]->name, p[3]->parm);
2096 def p_modport_ports_declaration_3(p
):
2097 '''modport_ports_declaration : attribute_list_opt import_export IDENTIFIER '''
2099 print('modport_ports_declaration_3', list(p
))
2101 # { last_modport_port.type = MP_TF;
2102 # last_modport_port.is_import = p[2];
2103 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
2110 def p_modport_ports_declaration_4(p
):
2111 '''modport_ports_declaration : attribute_list_opt import_export modport_tf_port '''
2113 print('modport_ports_declaration_4', list(p
))
2115 # { last_modport_port.type = MP_TF;
2116 # last_modport_port.is_import = p[2];
2117 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
2123 def p_modport_ports_declaration_5(p
):
2124 '''modport_ports_declaration : attribute_list_opt K_clocking IDENTIFIER '''
2126 print('modport_ports_declaration_5', list(p
))
2128 # { last_modport_port.type = MP_CLOCKING;
2129 # last_modport_port.direction = NetNet::NOT_A_PORT;
2130 # yyerror(@3, "sorry: modport clocking declaration is not yet supported.");
2137 def p_modport_simple_port_1(p
):
2138 '''modport_simple_port : '.' IDENTIFIER '(' expression ')' '''
2140 print('modport_simple_port_1', list(p
))
2142 # { named_pexpr_t*tmp = new named_pexpr_t;
2143 # tmp->name = lex_strings.make(p[2]);
2151 def p_modport_tf_port_1(p
):
2152 '''modport_tf_port : K_task IDENTIFIER '''
2154 print('modport_tf_port_1', list(p
))
2160 def p_modport_tf_port_2(p
):
2161 '''modport_tf_port : K_task IDENTIFIER '(' tf_port_list_opt ')' '''
2163 print('modport_tf_port_2', list(p
))
2169 def p_modport_tf_port_3(p
):
2170 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '''
2172 print('modport_tf_port_3', list(p
))
2178 def p_modport_tf_port_4(p
):
2179 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' '''
2181 print('modport_tf_port_4', list(p
))
2187 def p_non_integer_type_1(p
):
2188 '''non_integer_type : K_real '''
2190 print('non_integer_type_1', list(p
))
2192 # { p[0] = real_type_t::REAL; }
2196 def p_non_integer_type_2(p
):
2197 '''non_integer_type : K_realtime '''
2199 print('non_integer_type_2', list(p
))
2201 # { p[0] = real_type_t::REAL; }
2205 def p_non_integer_type_3(p
):
2206 '''non_integer_type : K_shortreal '''
2208 print('non_integer_type_3', list(p
))
2210 # { p[0] = real_type_t::SHORTREAL; }
2215 '''number : BASED_NUMBER '''
2217 print('number_1', list(p
))
2219 # { p[0] = p[1]; based_size = 0;}
2224 '''number : DEC_NUMBER '''
2226 print('number_2', list(p
))
2227 num
= Leaf(token
.NUMBER
, "%s" % (p
[1]))
2230 # { p[0] = p[1]; based_size = 0;}
2235 '''number : DEC_NUMBER BASED_NUMBER '''
2237 print('number_3', list(p
))
2238 num
= Leaf(token
.NUMBER
, "%s:%s" % (p
[1], p
[2]))
2241 # { p[0] = pform_verinum_with_size(p[1],p[2], @2.text, @2.first_line);
2247 '''number : UNBASED_NUMBER '''
2249 print('number_4', list(p
))
2251 # { p[0] = p[1]; based_size = 0;}
2256 '''number : DEC_NUMBER UNBASED_NUMBER '''
2258 print('number_5', list(p
))
2260 # { yyerror(@1, "error: Unbased SystemVerilog literal cannot have "
2262 # p[0] = p[1]; based_size = 0;}
2266 def p_open_range_list_1(p
):
2267 '''open_range_list : open_range_list ',' value_range '''
2269 print('open_range_list_1', list(p
))
2275 def p_open_range_list_2(p
):
2276 '''open_range_list : value_range '''
2278 print('open_range_list_2', list(p
))
2284 def p_package_declaration_1(p
):
2285 '''package_declaration : K_package lifetime_opt IDENTIFIER ';' _embed0_package_declaration timeunits_declaration_opt _embed1_package_declaration package_item_list_opt K_endpackage endlabel_opt '''
2287 print('package_declaration_1', list(p
))
2289 # { pform_end_package_declaration(@1);
2290 # // If an end label is present make sure it match the package name.
2292 # if (strcmp(p[3],p[10]) != 0) {
2293 # yyerror(@10, "error: End label doesn't match package name");
2302 def p__embed0_package_declaration(p
):
2303 '''_embed0_package_declaration : '''
2305 # { pform_start_package_declaration(@1, p[3], p[2]); }
2309 def p__embed1_package_declaration(p
):
2310 '''_embed1_package_declaration : '''
2312 # { pform_set_scope_timescale(@1); }
2316 def p_module_package_import_list_opt_1(p
):
2317 '''module_package_import_list_opt : '''
2318 if(parse_debug
> 1):
2319 print('module_package_import_list_opt_1', list(p
))
2325 def p_module_package_import_list_opt_2(p
):
2326 '''module_package_import_list_opt : package_import_list '''
2328 print('module_package_import_list_opt_2', list(p
))
2334 def p_package_import_list_1(p
):
2335 '''package_import_list : package_import_declaration '''
2337 print('package_import_list_1', list(p
))
2343 def p_package_import_list_2(p
):
2344 '''package_import_list : package_import_list package_import_declaration '''
2346 print('package_import_list_2', list(p
))
2352 def p_package_import_declaration_1(p
):
2353 '''package_import_declaration : K_import package_import_item_list ';' '''
2355 print('package_import_declaration_1', list(p
))
2361 def p_package_import_item_1(p
):
2362 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '''
2364 print('package_import_item_1', list(p
))
2366 # { pform_package_import(@2, p[1], p[3]);
2372 def p_package_import_item_2(p
):
2373 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES '*' '''
2375 print('package_import_item_2', list(p
))
2377 # { pform_package_import(@2, p[1], 0);
2382 def p_package_import_item_list_1(p
):
2383 '''package_import_item_list : package_import_item_list ',' package_import_item '''
2385 print('package_import_item_list_1', list(p
))
2391 def p_package_import_item_list_2(p
):
2392 '''package_import_item_list : package_import_item '''
2394 print('package_import_item_list_2', list(p
))
2400 def p_package_item_1(p
):
2401 '''package_item : timeunits_declaration '''
2403 print('package_item_1', list(p
))
2409 def p_package_item_2(p
):
2410 '''package_item : K_parameter param_type parameter_assign_list ';' '''
2412 print('package_item_2', list(p
))
2418 def p_package_item_3(p
):
2419 '''package_item : K_localparam param_type localparam_assign_list ';' '''
2421 print('package_item_3', list(p
))
2427 def p_package_item_4(p
):
2428 '''package_item : type_declaration '''
2430 print('package_item_4', list(p
))
2436 def p_package_item_5(p
):
2437 '''package_item : function_declaration '''
2439 print('package_item_5', list(p
))
2445 def p_package_item_6(p
):
2446 '''package_item : task_declaration '''
2448 print('package_item_6', list(p
))
2454 def p_package_item_7(p
):
2455 '''package_item : data_declaration '''
2457 print('package_item_7', list(p
))
2463 def p_package_item_8(p
):
2464 '''package_item : class_declaration '''
2466 print('package_item_8', list(p
))
2472 def p_package_item_list_1(p
):
2473 '''package_item_list : package_item_list package_item '''
2475 print('package_item_list_1', list(p
))
2481 def p_package_item_list_2(p
):
2482 '''package_item_list : package_item '''
2484 print('package_item_list_2', list(p
))
2490 def p_package_item_list_opt_1(p
):
2491 '''package_item_list_opt : package_item_list '''
2493 print('package_item_list_opt_1', list(p
))
2499 def p_package_item_list_opt_2(p
):
2500 '''package_item_list_opt : '''
2502 print('package_item_list_opt_2', list(p
))
2508 def p_port_direction_1(p
):
2509 '''port_direction : K_input '''
2511 print('port_direction_1', list(p
))
2513 # { p[0] = NetNet::PINPUT; }
2517 def p_port_direction_2(p
):
2518 '''port_direction : K_output '''
2520 print('port_direction_2', list(p
))
2522 # { p[0] = NetNet::POUTPUT; }
2526 def p_port_direction_3(p
):
2527 '''port_direction : K_inout '''
2529 print('port_direction_3', list(p
))
2531 # { p[0] = NetNet::PINOUT; }
2535 def p_port_direction_4(p
):
2536 '''port_direction : K_ref '''
2538 print('port_direction_4', list(p
))
2540 # { p[0] = NetNet::PREF;
2541 # if (!gn_system_verilog()) {
2542 # yyerror(@1, "error: Reference ports (ref) require SystemVerilog.");
2543 # p[0] = NetNet::PINPUT;
2549 def p_port_direction_opt_1(p
):
2550 '''port_direction_opt : port_direction '''
2552 print('port_direction_opt_1', list(p
))
2559 def p_port_direction_opt_2(p
):
2560 '''port_direction_opt : '''
2562 print('port_direction_opt_2', list(p
))
2564 # { p[0] = NetNet::PIMPLICIT; }
2568 def p_property_expr_1(p
):
2569 '''property_expr : expression '''
2571 print('property_expr_1', list(p
))
2577 def p_procedural_assertion_statement_1(p
):
2578 '''procedural_assertion_statement : K_assert '(' expression ')' statement %prec less_than_K_else '''
2580 print('procedural_assertion_statement_1', list(p
))
2582 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2588 def p_procedural_assertion_statement_2(p
):
2589 '''procedural_assertion_statement : K_assert '(' expression ')' K_else statement '''
2591 print('procedural_assertion_statement_2', list(p
))
2593 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2599 def p_procedural_assertion_statement_3(p
):
2600 '''procedural_assertion_statement : K_assert '(' expression ')' statement K_else statement '''
2602 print('procedural_assertion_statement_3', list(p
))
2604 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2610 def p_property_qualifier_1(p
):
2611 '''property_qualifier : class_item_qualifier '''
2613 print('property_qualifier_1', list(p
))
2619 def p_property_qualifier_2(p
):
2620 '''property_qualifier : random_qualifier '''
2622 print('property_qualifier_2', list(p
))
2628 def p_property_qualifier_opt_1(p
):
2629 '''property_qualifier_opt : property_qualifier_list '''
2631 print('property_qualifier_opt_1', list(p
))
2638 def p_property_qualifier_opt_2(p
):
2639 '''property_qualifier_opt : '''
2641 print('property_qualifier_opt_2', list(p
))
2643 # { p[0] = property_qualifier_t::make_none(); }
2647 def p_property_qualifier_list_1(p
):
2648 '''property_qualifier_list : property_qualifier_list property_qualifier '''
2650 print('property_qualifier_list_1', list(p
))
2652 # { p[0] = p[1] | p[2]; }
2656 def p_property_qualifier_list_2(p
):
2657 '''property_qualifier_list : property_qualifier '''
2659 print('property_qualifier_list_2', list(p
))
2666 def p_property_spec_1(p
):
2667 '''property_spec : clocking_event_opt property_spec_disable_iff_opt property_expr '''
2669 print('property_spec_1', list(p
))
2675 def p_property_spec_disable_iff_opt_1(p
):
2676 '''property_spec_disable_iff_opt : K_disable K_iff '(' expression ')' '''
2678 print('property_spec_disable_iff_opt_1', list(p
))
2684 def p_property_spec_disable_iff_opt_2(p
):
2685 '''property_spec_disable_iff_opt : '''
2687 print('property_spec_disable_iff_opt_2', list(p
))
2693 def p_random_qualifier_1(p
):
2694 '''random_qualifier : K_rand '''
2696 print('random_qualifier_1', list(p
))
2698 # { p[0] = property_qualifier_t::make_rand(); }
2702 def p_random_qualifier_2(p
):
2703 '''random_qualifier : K_randc '''
2705 print('random_qualifier_2', list(p
))
2707 # { p[0] = property_qualifier_t::make_randc(); }
2711 def p_real_or_realtime_1(p
):
2712 '''real_or_realtime : K_real '''
2714 print('real_or_realtime_1', list(p
))
2720 def p_real_or_realtime_2(p
):
2721 '''real_or_realtime : K_realtime '''
2723 print('real_or_realtime_2', list(p
))
2730 '''signing : K_signed '''
2732 print('signing_1', list(p
))
2740 '''signing : K_unsigned '''
2742 print('signing_2', list(p
))
2749 def p_simple_type_or_string_1(p
):
2750 '''simple_type_or_string : integer_vector_type '''
2752 print('simple_type_or_string_1', list(p
))
2754 # { ivl_variable_type_t use_vtype = p[1];
2755 # bool reg_flag = false;
2756 # if (use_vtype == IVL_VT_NO_TYPE) {
2757 # use_vtype = IVL_VT_LOGIC;
2760 # vector_type_t*tmp = new vector_type_t(use_vtype, false, 0);
2761 # tmp->reg_flag = reg_flag;
2762 # FILE_NAME(tmp, @1);
2768 def p_simple_type_or_string_2(p
):
2769 '''simple_type_or_string : non_integer_type '''
2771 print('simple_type_or_string_2', list(p
))
2773 # { real_type_t*tmp = new real_type_t(p[1]);
2774 # FILE_NAME(tmp, @1);
2780 def p_simple_type_or_string_3(p
):
2781 '''simple_type_or_string : atom2_type '''
2783 print('simple_type_or_string_3', list(p
))
2785 # { atom2_type_t*tmp = new atom2_type_t(p[1], true);
2786 # FILE_NAME(tmp, @1);
2792 def p_simple_type_or_string_4(p
):
2793 '''simple_type_or_string : K_integer '''
2795 print('simple_type_or_string_4', list(p
))
2797 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
2798 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd);
2799 # tmp->reg_flag = true;
2800 # tmp->integer_flag = true;
2806 def p_simple_type_or_string_5(p
):
2807 '''simple_type_or_string : K_time '''
2809 print('simple_type_or_string_5', list(p
))
2811 # { list<pform_range_t>*pd = make_range_from_width(64);
2812 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
2813 # tmp->reg_flag = !gn_system_verilog();
2819 def p_simple_type_or_string_6(p
):
2820 '''simple_type_or_string : TYPE_IDENTIFIER '''
2822 print('simple_type_or_string_6', list(p
))
2824 # { p[0] = p[1].type;
2825 # delete[]p[1].text;
2830 def p_simple_type_or_string_7(p
):
2831 '''simple_type_or_string : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_simple_type_or_string TYPE_IDENTIFIER '''
2833 print('simple_type_or_string_7', list(p
))
2835 # { lex_in_package_scope(0);
2837 # delete[]p[4].text;
2842 def p_simple_type_or_string_8(p
):
2843 '''simple_type_or_string : K_string '''
2845 print('simple_type_or_string_8', list(p
))
2847 # { string_type_t*tmp = new string_type_t;
2848 # FILE_NAME(tmp, @1);
2854 def p__embed0_simple_type_or_string(p
):
2855 '''_embed0_simple_type_or_string : '''
2857 # { lex_in_package_scope(p[1]); }
2861 def p_statement_1(p
):
2862 '''statement : attribute_list_opt statement_item '''
2864 print('statement_1', list(p
))
2866 # { pform_bind_attributes(p[2]->attributes, p[1]);
2872 def p_statement_or_null_1(p
):
2873 '''statement_or_null : statement '''
2875 print('statement_or_null_1', list(p
))
2882 def p_statement_or_null_2(p
):
2883 '''statement_or_null : attribute_list_opt ';' '''
2885 print('statement_or_null_2', list(p
))
2891 def p_stream_expression_1(p
):
2892 '''stream_expression : expression '''
2894 print('stream_expression_1', list(p
))
2900 def p_stream_expression_list_1(p
):
2901 '''stream_expression_list : stream_expression_list ',' stream_expression '''
2903 print('stream_expression_list_1', list(p
))
2909 def p_stream_expression_list_2(p
):
2910 '''stream_expression_list : stream_expression '''
2912 print('stream_expression_list_2', list(p
))
2918 def p_stream_operator_1(p
):
2919 '''stream_operator : K_LS '''
2921 print('stream_operator_1', list(p
))
2927 def p_stream_operator_2(p
):
2928 '''stream_operator : K_RS '''
2930 print('stream_operator_2', list(p
))
2936 def p_streaming_concatenation_1(p
):
2937 '''streaming_concatenation : '{' stream_operator '{' stream_expression_list '}' '}' '''
2939 print('streaming_concatenation_1', list(p
))
2941 # { /* streaming concatenation is a SystemVerilog thing. */
2942 # if (gn_system_verilog()) {
2943 # yyerror(@2, "sorry: Streaming concatenation not supported.");
2946 # yyerror(@2, "error: Streaming concatenation requires SystemVerilog");
2953 def p_task_declaration_1(p
):
2954 '''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 '''
2956 print('task_declaration_1', list(p
))
2958 # { // Last step: check any closing name. This is done late so
2959 # // that the parser can look ahead to detect the present
2960 # // endlabel_opt but still have the pform_endmodule() called
2961 # // early enough that the lexor can know we are outside the
2964 # if (strcmp(p[3],p[10]) != 0) {
2965 # yyerror(@10, "error: End label doesn't match task name");
2967 # if (! gn_system_verilog()) {
2968 # yyerror(@10, "error: Task end labels require "
2969 # "SystemVerilog.");
2978 def p_task_declaration_2(p
):
2979 '''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 '''
2981 print('task_declaration_2', list(p
))
2983 # { // Last step: check any closing name. This is done late so
2984 # // that the parser can look ahead to detect the present
2985 # // endlabel_opt but still have the pform_endmodule() called
2986 # // early enough that the lexor can know we are outside the
2989 # if (strcmp(p[3],p[13]) != 0) {
2990 # yyerror(@13, "error: End label doesn't match task name");
2992 # if (! gn_system_verilog()) {
2993 # yyerror(@13, "error: Task end labels require "
2994 # "SystemVerilog.");
3003 def p_task_declaration_3(p
):
3004 '''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 '''
3006 print('task_declaration_3', list(p
))
3008 # { // Last step: check any closing name. This is done late so
3009 # // that the parser can look ahead to detect the present
3010 # // endlabel_opt but still have the pform_endmodule() called
3011 # // early enough that the lexor can know we are outside the
3014 # if (strcmp(p[3],p[12]) != 0) {
3015 # yyerror(@12, "error: End label doesn't match task name");
3017 # if (! gn_system_verilog()) {
3018 # yyerror(@12, "error: Task end labels require "
3019 # "SystemVerilog.");
3028 def p_task_declaration_4(p
):
3029 '''task_declaration : K_task lifetime_opt IDENTIFIER error K_endtask _embed6_task_declaration endlabel_opt '''
3031 print('task_declaration_4', list(p
))
3033 # { // Last step: check any closing name. This is done late so
3034 # // that the parser can look ahead to detect the present
3035 # // endlabel_opt but still have the pform_endmodule() called
3036 # // early enough that the lexor can know we are outside the
3039 # if (strcmp(p[3],p[7]) != 0) {
3040 # yyerror(@7, "error: End label doesn't match task name");
3042 # if (! gn_system_verilog()) {
3043 # yyerror(@7, "error: Task end labels require "
3044 # "SystemVerilog.");
3053 def p__embed0_task_declaration(p
):
3054 '''_embed0_task_declaration : '''
3056 # { assert(current_task == 0);
3057 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3062 def p__embed1_task_declaration(p
):
3063 '''_embed1_task_declaration : '''
3065 # { current_task->set_ports(p[6]);
3066 # current_task_set_statement(@3, p[7]);
3067 # pform_set_this_class(@3, current_task);
3068 # pform_pop_scope();
3070 # if (p[7] && p[7]->size() > 1 && !gn_system_verilog()) {
3071 # yyerror(@7, "error: Task body with multiple statements requires SystemVerilog.");
3078 def p__embed2_task_declaration(p
):
3079 '''_embed2_task_declaration : '''
3081 # { assert(current_task == 0);
3082 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3087 def p__embed3_task_declaration(p
):
3088 '''_embed3_task_declaration : '''
3090 # { current_task->set_ports(p[6]);
3091 # current_task_set_statement(@3, p[10]);
3092 # pform_set_this_class(@3, current_task);
3093 # pform_pop_scope();
3095 # if (p[10]) delete p[10];
3100 def p__embed4_task_declaration(p
):
3101 '''_embed4_task_declaration : '''
3103 # { assert(current_task == 0);
3104 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3109 def p__embed5_task_declaration(p
):
3110 '''_embed5_task_declaration : '''
3112 # { current_task->set_ports(0);
3113 # current_task_set_statement(@3, p[9]);
3114 # pform_set_this_class(@3, current_task);
3115 # if (! current_task->method_of()) {
3116 # cerr << @3 << ": warning: task definition for \"" << p[3]
3117 # << "\" has an empty port declaration list!" << endl;
3119 # pform_pop_scope();
3121 # if (p[9]->size() > 1 && !gn_system_verilog()) {
3122 # yyerror(@9, "error: Task body with multiple statements requires SystemVerilog.");
3129 def p__embed6_task_declaration(p
):
3130 '''_embed6_task_declaration : '''
3133 # if (current_task) {
3134 # pform_pop_scope();
3141 def p_tf_port_declaration_1(p
):
3142 '''tf_port_declaration : port_direction K_reg_opt unsigned_signed_opt dimensions_opt list_of_identifiers ';' '''
3144 print('tf_port_declaration_1', list(p
))
3146 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1],
3147 # p[2] ? IVL_VT_LOGIC :
3149 # p[3], p[4], p[5]);
3155 def p_tf_port_declaration_2(p
):
3156 '''tf_port_declaration : port_direction K_integer list_of_identifiers ';' '''
3158 print('tf_port_declaration_2', list(p
))
3160 # { list<pform_range_t>*range_stub = make_range_from_width(integer_width);
3161 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, true,
3162 # range_stub, p[3], true);
3168 def p_tf_port_declaration_3(p
):
3169 '''tf_port_declaration : port_direction K_time list_of_identifiers ';' '''
3171 print('tf_port_declaration_3', list(p
))
3173 # { list<pform_range_t>*range_stub = make_range_from_width(64);
3174 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, false,
3175 # range_stub, p[3]);
3181 def p_tf_port_declaration_4(p
):
3182 '''tf_port_declaration : port_direction real_or_realtime list_of_identifiers ';' '''
3184 print('tf_port_declaration_4', list(p
))
3186 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_REAL, true,
3193 def p_tf_port_declaration_5(p
):
3194 '''tf_port_declaration : port_direction K_string list_of_identifiers ';' '''
3196 print('tf_port_declaration_5', list(p
))
3198 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_STRING, true,
3205 def p_tf_port_item_1(p
):
3206 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER dimensions_opt tf_port_item_expr_opt '''
3208 print('tf_port_item_1', list(p
))
3210 # { vector<pform_tf_port_t>*tmp;
3211 # NetNet::PortType use_port_type = p[1];
3212 # if ((use_port_type == NetNet::PIMPLICIT) && (gn_system_verilog() || (p[2] == 0)))
3213 # use_port_type = port_declaration_context.port_type;
3214 # perm_string name = lex_strings.make(p[3]);
3215 # list<perm_string>* ilist = list_from_identifier(p[3]);
3217 # if (use_port_type == NetNet::PIMPLICIT) {
3218 # yyerror(@1, "error: missing task/function port direction.");
3219 # use_port_type = NetNet::PINPUT; // for error recovery
3221 # if ((p[2] == 0) && (p[1]==NetNet::PIMPLICIT)) {
3222 # // Detect special case this is an undecorated
3223 # // identifier and we need to get the declaration from
3226 # yyerror(@4, "internal error: How can there be an unpacked range here?\n");
3228 # tmp = pform_make_task_ports(@3, use_port_type,
3229 # port_declaration_context.data_type,
3233 # // Otherwise, the decorations for this identifier
3234 # // indicate the type. Save the type for any right
3235 # // context that may come later.
3236 # port_declaration_context.port_type = use_port_type;
3238 # p[2] = new vector_type_t(IVL_VT_LOGIC, false, 0);
3239 # FILE_NAME(p[2], @3);
3241 # port_declaration_context.data_type = p[2];
3242 # tmp = pform_make_task_ports(@3, use_port_type, p[2], ilist);
3245 # pform_set_reg_idx(name, p[4]);
3250 # assert(tmp->size()==1);
3251 # tmp->front().defe = p[5];
3257 def p_tf_port_item_2(p
):
3258 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER error '''
3260 print('tf_port_item_2', list(p
))
3262 # { yyerror(@3, "error: Error in task/function port item after port name %s.", p[3]);
3269 def p_tf_port_item_expr_opt_1(p
):
3270 '''tf_port_item_expr_opt : '=' expression '''
3272 print('tf_port_item_expr_opt_1', list(p
))
3274 # { if (! gn_system_verilog()) {
3275 # yyerror(@1, "error: Task/function default arguments require "
3276 # "SystemVerilog.");
3283 def p_tf_port_item_expr_opt_2(p
):
3284 '''tf_port_item_expr_opt : '''
3286 print('tf_port_item_expr_opt_2', list(p
))
3292 def p_tf_port_list_1(p
):
3293 '''tf_port_list : _embed0_tf_port_list tf_port_item_list '''
3295 print('tf_port_list_1', list(p
))
3302 def p__embed0_tf_port_list(p
):
3303 '''_embed0_tf_port_list : '''
3305 # { port_declaration_context.port_type = gn_system_verilog() ? NetNet::PINPUT : NetNet::PIMPLICIT;
3306 # port_declaration_context.data_type = 0;
3311 def p_tf_port_item_list_1(p
):
3312 '''tf_port_item_list : tf_port_item_list ',' tf_port_item '''
3314 print('tf_port_item_list_1', list(p
))
3316 # { vector<pform_tf_port_t>*tmp;
3317 # if (p[1] && p[3]) {
3318 # size_t s1 = p[1]->size();
3320 # tmp->resize(tmp->size()+p[3]->size());
3321 # for (size_t idx = 0 ; idx < p[3]->size() ; idx += 1)
3322 # tmp->at(s1+idx) = p[3]->at(idx);
3324 # } else if (p[1]) {
3334 def p_tf_port_item_list_2(p
):
3335 '''tf_port_item_list : tf_port_item '''
3337 print('tf_port_item_list_2', list(p
))
3344 def p_tf_port_item_list_3(p
):
3345 '''tf_port_item_list : error ',' tf_port_item '''
3347 print('tf_port_item_list_3', list(p
))
3349 # { yyerror(@2, "error: Syntax error in task/function port declaration.");
3355 def p_tf_port_item_list_4(p
):
3356 '''tf_port_item_list : tf_port_item_list ',' '''
3358 print('tf_port_item_list_4', list(p
))
3360 # { yyerror(@2, "error: NULL port declarations are not allowed.");
3366 def p_tf_port_item_list_5(p
):
3367 '''tf_port_item_list : tf_port_item_list ';' '''
3369 print('tf_port_item_list_5', list(p
))
3371 # { yyerror(@2, "error: ';' is an invalid port declaration separator.");
3377 def p_timeunits_declaration_1(p
):
3378 '''timeunits_declaration : K_timeunit TIME_LITERAL ';' '''
3380 print('timeunits_declaration_1', list(p
))
3382 # { pform_set_timeunit(p[2], allow_timeunit_decl); }
3386 def p_timeunits_declaration_2(p
):
3387 '''timeunits_declaration : K_timeunit TIME_LITERAL '/' TIME_LITERAL ';' '''
3389 print('timeunits_declaration_2', list(p
))
3391 # { bool initial_decl = allow_timeunit_decl && allow_timeprec_decl;
3392 # pform_set_timeunit(p[2], initial_decl);
3393 # pform_set_timeprec(p[4], initial_decl);
3398 def p_timeunits_declaration_3(p
):
3399 '''timeunits_declaration : K_timeprecision TIME_LITERAL ';' '''
3401 print('timeunits_declaration_3', list(p
))
3403 # { pform_set_timeprec(p[2], allow_timeprec_decl); }
3407 def p_timeunits_declaration_opt_1(p
):
3408 '''timeunits_declaration_opt : %prec no_timeunits_declaration '''
3409 if(parse_debug
> 2):
3410 print('timeunits_declaration_opt_1', list(p
))
3416 def p_timeunits_declaration_opt_2(p
):
3417 '''timeunits_declaration_opt : timeunits_declaration %prec one_timeunits_declaration '''
3419 print('timeunits_declaration_opt_2', list(p
))
3425 def p_timeunits_declaration_opt_3(p
):
3426 '''timeunits_declaration_opt : timeunits_declaration timeunits_declaration '''
3428 print('timeunits_declaration_opt_3', list(p
))
3434 def p_value_range_1(p
):
3435 '''value_range : expression '''
3437 print('value_range_1', list(p
))
3443 def p_value_range_2(p
):
3444 '''value_range : '[' expression ':' expression ']' '''
3446 print('value_range_2', list(p
))
3452 def p_variable_dimension_1(p
):
3453 '''variable_dimension : '[' expression ':' expression ']' '''
3455 print('variable_dimension_1', list(p
))
3456 # { list<pform_range_t> *tmp = new list<pform_range_t>;
3457 # pform_range_t index (p[2],p[4]);
3458 # tmp->push_back(index);
3461 # XXX TODO: subscriptlist
3464 if end
.endswith("-1"):
3467 end
= str(int(end
)+1)
3470 p
[0] = '[%s:%s]' % (start
, end
) # python slice is LO:HI+1
3476 def p_variable_dimension_2(p
):
3477 '''variable_dimension : '[' expression ']' '''
3479 print('variable_dimension_2', list(p
))
3481 # { // SystemVerilog canonical range
3482 # if (!gn_system_verilog()) {
3484 # cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. "
3485 # << "Use at least -g2005-sv to remove this warning." << endl;
3487 # list<pform_range_t> *tmp = new list<pform_range_t>;
3488 # pform_range_t index;
3489 # index.first = new PENumber(new verinum((uint64_t)0, integer_width));
3490 # index.second = new PEBinary('-', p[2], new PENumber(new verinum((uint64_t)1, integer_width)));
3491 # tmp->push_back(index);
3497 def p_variable_dimension_3(p
):
3498 '''variable_dimension : '[' ']' '''
3500 print('variable_dimension_3', list(p
))
3502 # { list<pform_range_t> *tmp = new list<pform_range_t>;
3503 # pform_range_t index (0,0);
3504 # tmp->push_back(index);
3510 def p_variable_dimension_4(p
):
3511 '''variable_dimension : '[' '$' ']' '''
3513 print('variable_dimension_4', list(p
))
3515 # { // SystemVerilog queue
3516 # list<pform_range_t> *tmp = new list<pform_range_t>;
3517 # pform_range_t index (new PENull,0);
3518 # if (!gn_system_verilog()) {
3519 # yyerror("error: Queue declarations require SystemVerilog.");
3521 # tmp->push_back(index);
3527 def p_variable_lifetime_1(p
):
3528 '''variable_lifetime : lifetime '''
3530 print('variable_lifetime_1', list(p
))
3532 # { if (!gn_system_verilog()) {
3533 # yyerror(@1, "error: overriding the default variable lifetime "
3534 # "requires SystemVerilog.");
3535 # } else if (p[1] != pform_peek_scope()->default_lifetime) {
3536 # yyerror(@1, "sorry: overriding the default variable lifetime "
3537 # "is not yet supported.");
3539 # var_lifetime = p[1];
3544 def p_attribute_list_opt_1(p
):
3545 '''attribute_list_opt : attribute_instance_list '''
3547 print('attribute_list_opt_1', list(p
))
3554 def p_attribute_list_opt_2(p
):
3555 '''attribute_list_opt : '''
3556 if(parse_debug
> 2):
3557 print('attribute_list_opt_2', list(p
))
3563 def p_attribute_instance_list_1(p
):
3564 '''attribute_instance_list : K_PSTAR K_STARP '''
3566 print('attribute_instance_list_1', list(p
))
3572 def p_attribute_instance_list_2(p
):
3573 '''attribute_instance_list : K_PSTAR attribute_list K_STARP '''
3575 print('attribute_instance_list_2', list(p
))
3582 def p_attribute_instance_list_3(p
):
3583 '''attribute_instance_list : attribute_instance_list K_PSTAR K_STARP '''
3585 print('attribute_instance_list_3', list(p
))
3592 def p_attribute_instance_list_4(p
):
3593 '''attribute_instance_list : attribute_instance_list K_PSTAR attribute_list K_STARP '''
3595 print('attribute_instance_list_4', list(p
))
3597 # { list<named_pexpr_t>*tmp = p[1];
3599 # tmp->splice(tmp->end(), *p[3]);
3602 # } else p[0] = p[3];
3607 def p_attribute_list_1(p
):
3608 '''attribute_list : attribute_list ',' attribute '''
3610 print('attribute_list_1', list(p
))
3612 # { list<named_pexpr_t>*tmp = p[1];
3613 # tmp->push_back(*p[3]);
3620 def p_attribute_list_2(p
):
3621 '''attribute_list : attribute '''
3623 print('attribute_list_2', list(p
))
3625 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
3626 # tmp->push_back(*p[1]);
3633 def p_attribute_1(p
):
3634 '''attribute : IDENTIFIER '''
3636 print('attribute_1', list(p
))
3638 # { named_pexpr_t*tmp = new named_pexpr_t;
3639 # tmp->name = lex_strings.make(p[1]);
3647 def p_attribute_2(p
):
3648 '''attribute : IDENTIFIER '=' expression '''
3650 print('attribute_2', list(p
))
3652 # { PExpr*tmp = p[3];
3653 # named_pexpr_t*tmp2 = new named_pexpr_t;
3654 # tmp2->name = lex_strings.make(p[1]);
3662 def p_block_item_decl_1(p
):
3663 '''block_item_decl : data_type register_variable_list ';' '''
3665 print('block_item_decl_1', list(p
))
3667 # { if (p[1]) pform_set_data_type(@1, p[1], p[2], NetNet::REG, attributes_in_context);
3672 def p_block_item_decl_2(p
):
3673 '''block_item_decl : variable_lifetime data_type register_variable_list ';' '''
3675 print('block_item_decl_2', list(p
))
3677 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
3678 # var_lifetime = LexicalScope::INHERITED;
3683 def p_block_item_decl_3(p
):
3684 '''block_item_decl : K_reg data_type register_variable_list ';' '''
3686 print('block_item_decl_3', list(p
))
3688 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
3693 def p_block_item_decl_4(p
):
3694 '''block_item_decl : variable_lifetime K_reg data_type register_variable_list ';' '''
3696 print('block_item_decl_4', list(p
))
3698 # { if (p[3]) pform_set_data_type(@3, p[3], p[4], NetNet::REG, attributes_in_context);
3699 # var_lifetime = LexicalScope::INHERITED;
3704 def p_block_item_decl_5(p
):
3705 '''block_item_decl : K_event event_variable_list ';' '''
3707 print('block_item_decl_5', list(p
))
3709 # { if (p[2]) pform_make_events(p[2], @1.text, @1.first_line);
3714 def p_block_item_decl_6(p
):
3715 '''block_item_decl : K_parameter param_type parameter_assign_list ';' '''
3717 print('block_item_decl_6', list(p
))
3723 def p_block_item_decl_7(p
):
3724 '''block_item_decl : K_localparam param_type localparam_assign_list ';' '''
3726 print('block_item_decl_7', list(p
))
3732 def p_block_item_decl_8(p
):
3733 '''block_item_decl : type_declaration '''
3735 print('block_item_decl_8', list(p
))
3741 def p_block_item_decl_9(p
):
3742 '''block_item_decl : K_integer error ';' '''
3744 print('block_item_decl_9', list(p
))
3746 # { yyerror(@1, "error: syntax error in integer variable list.");
3752 def p_block_item_decl_10(p
):
3753 '''block_item_decl : K_time error ';' '''
3755 print('block_item_decl_10', list(p
))
3757 # { yyerror(@1, "error: syntax error in time variable list.");
3763 def p_block_item_decl_11(p
):
3764 '''block_item_decl : K_parameter error ';' '''
3766 print('block_item_decl_11', list(p
))
3768 # { yyerror(@1, "error: syntax error in parameter list.");
3774 def p_block_item_decl_12(p
):
3775 '''block_item_decl : K_localparam error ';' '''
3777 print('block_item_decl_12', list(p
))
3779 # { yyerror(@1, "error: syntax error localparam list.");
3785 def p_block_item_decls_1(p
):
3786 '''block_item_decls : block_item_decl '''
3788 print('block_item_decls_1', list(p
))
3794 def p_block_item_decls_2(p
):
3795 '''block_item_decls : block_item_decls block_item_decl '''
3797 print('block_item_decls_2', list(p
))
3803 def p_block_item_decls_opt_1(p
):
3804 '''block_item_decls_opt : block_item_decls '''
3806 print('block_item_decls_opt_1', list(p
))
3813 def p_block_item_decls_opt_2(p
):
3814 '''block_item_decls_opt : '''
3816 print('block_item_decls_opt_2', list(p
))
3823 def p_type_declaration_1(p
):
3824 '''type_declaration : K_typedef data_type IDENTIFIER dimensions_opt ';' '''
3826 print('type_declaration_1', list(p
))
3828 # { perm_string name = lex_strings.make(p[3]);
3829 # pform_set_typedef(name, p[2], p[4]);
3835 def p_type_declaration_2(p
):
3836 '''type_declaration : K_typedef data_type TYPE_IDENTIFIER ';' '''
3838 print('type_declaration_2', list(p
))
3840 # { perm_string name = lex_strings.make(p[3].text);
3841 # if (pform_test_type_identifier_local(name)) {
3842 # yyerror(@3, "error: Typedef identifier \"%s\" is already a type name.", p[3].text);
3845 # pform_set_typedef(name, p[2], NULL);
3847 # delete[]p[3].text;
3852 def p_type_declaration_3(p
):
3853 '''type_declaration : K_typedef K_class IDENTIFIER ';' '''
3855 print('type_declaration_3', list(p
))
3857 # { // Create a synthetic typedef for the class name so that the
3858 # // lexor detects the name as a type.
3859 # perm_string name = lex_strings.make(p[3]);
3860 # class_type_t*tmp = new class_type_t(name);
3861 # FILE_NAME(tmp, @3);
3862 # pform_set_typedef(name, tmp, NULL);
3868 def p_type_declaration_4(p
):
3869 '''type_declaration : K_typedef K_enum IDENTIFIER ';' '''
3871 print('type_declaration_4', list(p
))
3873 # { yyerror(@1, "sorry: Enum forward declarations not supported yet."); }
3877 def p_type_declaration_5(p
):
3878 '''type_declaration : K_typedef K_struct IDENTIFIER ';' '''
3880 print('type_declaration_5', list(p
))
3882 # { yyerror(@1, "sorry: Struct forward declarations not supported yet."); }
3886 def p_type_declaration_6(p
):
3887 '''type_declaration : K_typedef K_union IDENTIFIER ';' '''
3889 print('type_declaration_6', list(p
))
3891 # { yyerror(@1, "sorry: Union forward declarations not supported yet."); }
3895 def p_type_declaration_7(p
):
3896 '''type_declaration : K_typedef IDENTIFIER ';' '''
3898 print('type_declaration_7', list(p
))
3900 # { // Create a synthetic typedef for the class name so that the
3901 # // lexor detects the name as a type.
3902 # perm_string name = lex_strings.make(p[2]);
3903 # class_type_t*tmp = new class_type_t(name);
3904 # FILE_NAME(tmp, @2);
3905 # pform_set_typedef(name, tmp, NULL);
3911 def p_type_declaration_8(p
):
3912 '''type_declaration : K_typedef error ';' '''
3914 print('type_declaration_8', list(p
))
3916 # { yyerror(@2, "error: Syntax error in typedef clause.");
3922 def p_enum_data_type_1(p
):
3923 '''enum_data_type : K_enum '{' enum_name_list '}' '''
3925 print('enum_data_type_1', list(p
))
3927 # { enum_type_t*enum_type = new enum_type_t;
3928 # FILE_NAME(enum_type, @1);
3929 # enum_type->names .reset(p[3]);
3930 # enum_type->base_type = IVL_VT_BOOL;
3931 # enum_type->signed_flag = true;
3932 # enum_type->integer_flag = false;
3933 # enum_type->range.reset(make_range_from_width(32));
3939 def p_enum_data_type_2(p
):
3940 '''enum_data_type : K_enum atom2_type signed_unsigned_opt '{' enum_name_list '}' '''
3942 print('enum_data_type_2', list(p
))
3944 # { enum_type_t*enum_type = new enum_type_t;
3945 # FILE_NAME(enum_type, @1);
3946 # enum_type->names .reset(p[5]);
3947 # enum_type->base_type = IVL_VT_BOOL;
3948 # enum_type->signed_flag = p[3];
3949 # enum_type->integer_flag = false;
3950 # enum_type->range.reset(make_range_from_width(p[2]));
3956 def p_enum_data_type_3(p
):
3957 '''enum_data_type : K_enum K_integer signed_unsigned_opt '{' enum_name_list '}' '''
3959 print('enum_data_type_3', list(p
))
3961 # { enum_type_t*enum_type = new enum_type_t;
3962 # FILE_NAME(enum_type, @1);
3963 # enum_type->names .reset(p[5]);
3964 # enum_type->base_type = IVL_VT_LOGIC;
3965 # enum_type->signed_flag = p[3];
3966 # enum_type->integer_flag = true;
3967 # enum_type->range.reset(make_range_from_width(integer_width));
3973 def p_enum_data_type_4(p
):
3974 '''enum_data_type : K_enum K_logic unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
3976 print('enum_data_type_4', list(p
))
3978 # { enum_type_t*enum_type = new enum_type_t;
3979 # FILE_NAME(enum_type, @1);
3980 # enum_type->names .reset(p[6]);
3981 # enum_type->base_type = IVL_VT_LOGIC;
3982 # enum_type->signed_flag = p[3];
3983 # enum_type->integer_flag = false;
3984 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
3990 def p_enum_data_type_5(p
):
3991 '''enum_data_type : K_enum K_reg unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
3993 print('enum_data_type_5', list(p
))
3995 # { enum_type_t*enum_type = new enum_type_t;
3996 # FILE_NAME(enum_type, @1);
3997 # enum_type->names .reset(p[6]);
3998 # enum_type->base_type = IVL_VT_LOGIC;
3999 # enum_type->signed_flag = p[3];
4000 # enum_type->integer_flag = false;
4001 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4007 def p_enum_data_type_6(p
):
4008 '''enum_data_type : K_enum K_bit unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
4010 print('enum_data_type_6', list(p
))
4012 # { enum_type_t*enum_type = new enum_type_t;
4013 # FILE_NAME(enum_type, @1);
4014 # enum_type->names .reset(p[6]);
4015 # enum_type->base_type = IVL_VT_BOOL;
4016 # enum_type->signed_flag = p[3];
4017 # enum_type->integer_flag = false;
4018 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4024 def p_enum_name_list_1(p
):
4025 '''enum_name_list : enum_name '''
4027 print('enum_name_list_1', list(p
))
4034 def p_enum_name_list_2(p
):
4035 '''enum_name_list : enum_name_list ',' enum_name '''
4037 print('enum_name_list_2', list(p
))
4039 # { list<named_pexpr_t>*lst = p[1];
4040 # lst->splice(lst->end(), *p[3]);
4047 def p_pos_neg_number_1(p
):
4048 '''pos_neg_number : number '''
4050 print('pos_neg_number_1', list(p
))
4057 def p_pos_neg_number_2(p
):
4058 '''pos_neg_number : '-' number '''
4060 print('pos_neg_number_2', list(p
))
4062 # { verinum tmp = -(*(p[2]));
4069 def p_enum_name_1(p
):
4070 '''enum_name : IDENTIFIER '''
4072 print('enum_name_1', list(p
))
4074 # { perm_string name = lex_strings.make(p[1]);
4076 # p[0] = make_named_number(name);
4081 def p_enum_name_2(p
):
4082 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '''
4084 print('enum_name_2', list(p
))
4086 # { perm_string name = lex_strings.make(p[1]);
4087 # long count = check_enum_seq_value(@1, p[3], false);
4089 # p[0] = make_named_numbers(name, 0, count-1);
4095 def p_enum_name_3(p
):
4096 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '''
4098 print('enum_name_3', list(p
))
4100 # { perm_string name = lex_strings.make(p[1]);
4101 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
4102 # check_enum_seq_value(@1, p[5], true));
4110 def p_enum_name_4(p
):
4111 '''enum_name : IDENTIFIER '=' expression '''
4113 print('enum_name_4', list(p
))
4115 # { perm_string name = lex_strings.make(p[1]);
4117 # p[0] = make_named_number(name, p[3]);
4122 def p_enum_name_5(p
):
4123 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '=' expression '''
4125 print('enum_name_5', list(p
))
4127 # { perm_string name = lex_strings.make(p[1]);
4128 # long count = check_enum_seq_value(@1, p[3], false);
4129 # p[0] = make_named_numbers(name, 0, count-1, p[6]);
4136 def p_enum_name_6(p
):
4137 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '=' expression '''
4139 print('enum_name_6', list(p
))
4141 # { perm_string name = lex_strings.make(p[1]);
4142 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
4143 # check_enum_seq_value(@1, p[5], true), p[8]);
4151 def p_struct_data_type_1(p
):
4152 '''struct_data_type : K_struct K_packed_opt '{' struct_union_member_list '}' '''
4154 print('struct_data_type_1', list(p
))
4156 # { struct_type_t*tmp = new struct_type_t;
4157 # FILE_NAME(tmp, @1);
4158 # tmp->packed_flag = p[2];
4159 # tmp->union_flag = false;
4160 # tmp->members .reset(p[4]);
4166 def p_struct_data_type_2(p
):
4167 '''struct_data_type : K_union K_packed_opt '{' struct_union_member_list '}' '''
4169 print('struct_data_type_2', list(p
))
4171 # { struct_type_t*tmp = new struct_type_t;
4172 # FILE_NAME(tmp, @1);
4173 # tmp->packed_flag = p[2];
4174 # tmp->union_flag = true;
4175 # tmp->members .reset(p[4]);
4181 def p_struct_data_type_3(p
):
4182 '''struct_data_type : K_struct K_packed_opt '{' error '}' '''
4184 print('struct_data_type_3', list(p
))
4186 # { yyerror(@3, "error: Errors in struct member list.");
4188 # struct_type_t*tmp = new struct_type_t;
4189 # FILE_NAME(tmp, @1);
4190 # tmp->packed_flag = p[2];
4191 # tmp->union_flag = false;
4197 def p_struct_data_type_4(p
):
4198 '''struct_data_type : K_union K_packed_opt '{' error '}' '''
4200 print('struct_data_type_4', list(p
))
4202 # { yyerror(@3, "error: Errors in union member list.");
4204 # struct_type_t*tmp = new struct_type_t;
4205 # FILE_NAME(tmp, @1);
4206 # tmp->packed_flag = p[2];
4207 # tmp->union_flag = true;
4213 def p_struct_union_member_list_1(p
):
4214 '''struct_union_member_list : struct_union_member_list struct_union_member '''
4216 print('struct_union_member_list_1', list(p
))
4218 # { list<struct_member_t*>*tmp = p[1];
4219 # tmp->push_back(p[2]);
4225 def p_struct_union_member_list_2(p
):
4226 '''struct_union_member_list : struct_union_member '''
4228 print('struct_union_member_list_2', list(p
))
4230 # { list<struct_member_t*>*tmp = new list<struct_member_t*>;
4231 # tmp->push_back(p[1]);
4237 def p_struct_union_member_1(p
):
4238 '''struct_union_member : attribute_list_opt data_type list_of_variable_decl_assignments ';' '''
4240 print('struct_union_member_1', list(p
))
4242 # { struct_member_t*tmp = new struct_member_t;
4243 # FILE_NAME(tmp, @2);
4244 # tmp->type .reset(p[2]);
4245 # tmp->names .reset(p[3]);
4251 def p_struct_union_member_2(p
):
4252 '''struct_union_member : error ';' '''
4254 print('struct_union_member_2', list(p
))
4256 # { yyerror(@2, "Error in struct/union member.");
4263 def p_case_item_1(p
):
4264 '''case_item : expression_list_proper ':' statement_or_null '''
4266 print('case_item_1', list(p
))
4268 # { PCase::Item*tmp = new PCase::Item;
4269 # tmp->expr = *p[1];
4277 def p_case_item_2(p
):
4278 '''case_item : K_default ':' statement_or_null '''
4280 print('case_item_2', list(p
))
4282 # { PCase::Item*tmp = new PCase::Item;
4289 def p_case_item_3(p
):
4290 '''case_item : K_default statement_or_null '''
4292 print('case_item_3', list(p
))
4294 # { PCase::Item*tmp = new PCase::Item;
4301 def p_case_item_4(p
):
4302 '''case_item : error ':' statement_or_null '''
4304 print('case_item_4', list(p
))
4306 # { yyerror(@2, "error: Incomprehensible case expression.");
4312 def p_case_items_1(p
):
4313 '''case_items : case_items case_item '''
4315 print('case_items_1', list(p
))
4317 # { svector<PCase::Item*>*tmp;
4318 # tmp = new svector<PCase::Item*>(*p[1], p[2]);
4325 def p_case_items_2(p
):
4326 '''case_items : case_item '''
4328 print('case_items_2', list(p
))
4330 # { svector<PCase::Item*>*tmp = new svector<PCase::Item*>(1);
4337 def p_charge_strength_1(p
):
4338 '''charge_strength : '(' K_small ')' '''
4340 print('charge_strength_1', list(p
))
4346 def p_charge_strength_2(p
):
4347 '''charge_strength : '(' K_medium ')' '''
4349 print('charge_strength_2', list(p
))
4355 def p_charge_strength_3(p
):
4356 '''charge_strength : '(' K_large ')' '''
4358 print('charge_strength_3', list(p
))
4364 def p_charge_strength_opt_1(p
):
4365 '''charge_strength_opt : charge_strength '''
4367 print('charge_strength_opt_1', list(p
))
4373 def p_charge_strength_opt_2(p
):
4374 '''charge_strength_opt : '''
4376 print('charge_strength_opt_2', list(p
))
4382 def p_defparam_assign_1(p
):
4383 '''defparam_assign : hierarchy_identifier '=' expression '''
4385 print('defparam_assign_1', list(p
))
4387 # { pform_set_defparam(*p[1], p[3]);
4393 def p_defparam_assign_list_1(p
):
4394 '''defparam_assign_list : defparam_assign '''
4396 print('defparam_assign_list_1', list(p
))
4402 def p_defparam_assign_list_2(p
):
4403 '''defparam_assign_list : dimensions defparam_assign '''
4405 print('defparam_assign_list_2', list(p
))
4407 # { yyerror(@1, "error: defparam may not include a range.");
4413 def p_defparam_assign_list_3(p
):
4414 '''defparam_assign_list : defparam_assign_list ',' defparam_assign '''
4416 print('defparam_assign_list_3', list(p
))
4423 '''delay1 : '#' delay_value_simple '''
4425 print('delay1_1', list(p
))
4427 # { list<PExpr*>*tmp = new list<PExpr*>;
4428 # tmp->push_back(p[2]);
4435 '''delay1 : '#' '(' delay_value ')' '''
4437 print('delay1_2', list(p
))
4439 # { list<PExpr*>*tmp = new list<PExpr*>;
4440 # tmp->push_back(p[3]);
4447 '''delay3 : '#' delay_value_simple '''
4449 print('delay3_1', list(p
))
4451 # { list<PExpr*>*tmp = new list<PExpr*>;
4452 # tmp->push_back(p[2]);
4459 '''delay3 : '#' '(' delay_value ')' '''
4461 print('delay3_2', list(p
))
4463 # { list<PExpr*>*tmp = new list<PExpr*>;
4464 # tmp->push_back(p[3]);
4471 '''delay3 : '#' '(' delay_value ',' delay_value ')' '''
4473 print('delay3_3', list(p
))
4475 # { list<PExpr*>*tmp = new list<PExpr*>;
4476 # tmp->push_back(p[3]);
4477 # tmp->push_back(p[5]);
4484 '''delay3 : '#' '(' delay_value ',' delay_value ',' delay_value ')' '''
4486 print('delay3_4', list(p
))
4488 # { list<PExpr*>*tmp = new list<PExpr*>;
4489 # tmp->push_back(p[3]);
4490 # tmp->push_back(p[5]);
4491 # tmp->push_back(p[7]);
4497 def p_delay3_opt_1(p
):
4498 '''delay3_opt : delay3 '''
4500 print('delay3_opt_1', list(p
))
4507 def p_delay3_opt_2(p
):
4509 if(parse_debug
> 2):
4510 print('delay3_opt_2', list(p
))
4516 def p_delay_value_list_1(p
):
4517 '''delay_value_list : delay_value '''
4519 print('delay_value_list_1', list(p
))
4521 # { list<PExpr*>*tmp = new list<PExpr*>;
4522 # tmp->push_back(p[1]);
4528 def p_delay_value_list_2(p
):
4529 '''delay_value_list : delay_value_list ',' delay_value '''
4531 print('delay_value_list_2', list(p
))
4533 # { list<PExpr*>*tmp = p[1];
4534 # tmp->push_back(p[3]);
4540 def p_delay_value_1(p
):
4541 '''delay_value : expression '''
4543 print('delay_value_1', list(p
))
4545 # { PExpr*tmp = p[1];
4551 def p_delay_value_2(p
):
4552 '''delay_value : expression ':' expression ':' expression '''
4554 print('delay_value_2', list(p
))
4556 # { p[0] = pform_select_mtm_expr(p[1], p[3], p[5]); }
4560 def p_delay_value_simple_1(p
):
4561 '''delay_value_simple : DEC_NUMBER '''
4563 print('delay_value_simple_1', list(p
))
4565 # { verinum*tmp = p[1];
4567 # yyerror(@1, "internal error: delay.");
4570 # p[0] = new PENumber(tmp);
4571 # FILE_NAME(p[0], @1);
4578 def p_delay_value_simple_2(p
):
4579 '''delay_value_simple : REALTIME '''
4581 print('delay_value_simple_2', list(p
))
4583 # { verireal*tmp = p[1];
4585 # yyerror(@1, "internal error: delay.");
4588 # p[0] = new PEFNumber(tmp);
4589 # FILE_NAME(p[0], @1);
4595 def p_delay_value_simple_3(p
):
4596 '''delay_value_simple : IDENTIFIER '''
4598 print('delay_value_simple_3', list(p
))
4600 # { PEIdent*tmp = new PEIdent(lex_strings.make(p[1]));
4601 # FILE_NAME(tmp, @1);
4608 def p_delay_value_simple_4(p
):
4609 '''delay_value_simple : TIME_LITERAL '''
4611 print('delay_value_simple_4', list(p
))
4617 # if (p[1] == 0 || !get_time_unit(p[1], unit))
4618 # yyerror(@1, "internal error: delay.");
4620 # double p = pow(10.0,
4621 # (double)(unit - pform_get_timeunit()));
4622 # double time = atof(p[1]) * p;
4624 # verireal *v = new verireal(time);
4625 # p[0] = new PEFNumber(v);
4626 # FILE_NAME(p[0], @1);
4632 def p_optional_semicolon_1(p
):
4633 '''optional_semicolon : ';' '''
4635 print('optional_semicolon_1', list(p
))
4641 def p_optional_semicolon_2(p
):
4642 '''optional_semicolon : '''
4644 print('optional_semicolon_2', list(p
))
4650 def p_discipline_declaration_1(p
):
4651 '''discipline_declaration : K_discipline IDENTIFIER optional_semicolon _embed0_discipline_declaration discipline_items K_enddiscipline '''
4653 print('discipline_declaration_1', list(p
))
4655 # { pform_end_discipline(@1); delete[] p[2]; }
4659 def p__embed0_discipline_declaration(p
):
4660 '''_embed0_discipline_declaration : '''
4662 # { pform_start_discipline(p[2]); }
4666 def p_discipline_items_1(p
):
4667 '''discipline_items : discipline_items discipline_item '''
4669 print('discipline_items_1', list(p
))
4675 def p_discipline_items_2(p
):
4676 '''discipline_items : discipline_item '''
4678 print('discipline_items_2', list(p
))
4684 def p_discipline_item_1(p
):
4685 '''discipline_item : K_domain K_discrete ';' '''
4687 print('discipline_item_1', list(p
))
4689 # { pform_discipline_domain(@1, IVL_DIS_DISCRETE); }
4693 def p_discipline_item_2(p
):
4694 '''discipline_item : K_domain K_continuous ';' '''
4696 print('discipline_item_2', list(p
))
4698 # { pform_discipline_domain(@1, IVL_DIS_CONTINUOUS); }
4702 def p_discipline_item_3(p
):
4703 '''discipline_item : K_potential IDENTIFIER ';' '''
4705 print('discipline_item_3', list(p
))
4707 # { pform_discipline_potential(@1, p[2]); delete[] p[2]; }
4711 def p_discipline_item_4(p
):
4712 '''discipline_item : K_flow IDENTIFIER ';' '''
4714 print('discipline_item_4', list(p
))
4716 # { pform_discipline_flow(@1, p[2]); delete[] p[2]; }
4720 def p_nature_declaration_1(p
):
4721 '''nature_declaration : K_nature IDENTIFIER optional_semicolon _embed0_nature_declaration nature_items K_endnature '''
4723 print('nature_declaration_1', list(p
))
4725 # { pform_end_nature(@1); delete[] p[2]; }
4729 def p__embed0_nature_declaration(p
):
4730 '''_embed0_nature_declaration : '''
4732 # { pform_start_nature(p[2]); }
4736 def p_nature_items_1(p
):
4737 '''nature_items : nature_items nature_item '''
4739 print('nature_items_1', list(p
))
4745 def p_nature_items_2(p
):
4746 '''nature_items : nature_item '''
4748 print('nature_items_2', list(p
))
4754 def p_nature_item_1(p
):
4755 '''nature_item : K_units '=' STRING ';' '''
4757 print('nature_item_1', list(p
))
4759 # { delete[] p[3]; }
4763 def p_nature_item_2(p
):
4764 '''nature_item : K_abstol '=' expression ';' '''
4766 print('nature_item_2', list(p
))
4772 def p_nature_item_3(p
):
4773 '''nature_item : K_access '=' IDENTIFIER ';' '''
4775 print('nature_item_3', list(p
))
4777 # { pform_nature_access(@1, p[3]); delete[] p[3]; }
4781 def p_nature_item_4(p
):
4782 '''nature_item : K_idt_nature '=' IDENTIFIER ';' '''
4784 print('nature_item_4', list(p
))
4786 # { delete[] p[3]; }
4790 def p_nature_item_5(p
):
4791 '''nature_item : K_ddt_nature '=' IDENTIFIER ';' '''
4793 print('nature_item_5', list(p
))
4795 # { delete[] p[3]; }
4799 def p_config_declaration_1(p
):
4800 '''config_declaration : K_config IDENTIFIER ';' K_design lib_cell_identifiers ';' list_of_config_rule_statements K_endconfig '''
4802 print('config_declaration_1', list(p
))
4804 # { cerr << @1 << ": sorry: config declarations are not supported and "
4805 # "will be skipped." << endl;
4811 def p_lib_cell_identifiers_1(p
):
4812 '''lib_cell_identifiers : '''
4814 print('lib_cell_identifiers_1', list(p
))
4820 def p_lib_cell_identifiers_2(p
):
4821 '''lib_cell_identifiers : lib_cell_identifiers lib_cell_id '''
4823 print('lib_cell_identifiers_2', list(p
))
4829 def p_list_of_config_rule_statements_1(p
):
4830 '''list_of_config_rule_statements : '''
4832 print('list_of_config_rule_statements_1', list(p
))
4838 def p_list_of_config_rule_statements_2(p
):
4839 '''list_of_config_rule_statements : list_of_config_rule_statements config_rule_statement '''
4841 print('list_of_config_rule_statements_2', list(p
))
4847 def p_config_rule_statement_1(p
):
4848 '''config_rule_statement : K_default K_liblist list_of_libraries ';' '''
4850 print('config_rule_statement_1', list(p
))
4856 def p_config_rule_statement_2(p
):
4857 '''config_rule_statement : K_instance hierarchy_identifier K_liblist list_of_libraries ';' '''
4859 print('config_rule_statement_2', list(p
))
4865 def p_config_rule_statement_3(p
):
4866 '''config_rule_statement : K_instance hierarchy_identifier K_use lib_cell_id opt_config ';' '''
4868 print('config_rule_statement_3', list(p
))
4874 def p_config_rule_statement_4(p
):
4875 '''config_rule_statement : K_cell lib_cell_id K_liblist list_of_libraries ';' '''
4877 print('config_rule_statement_4', list(p
))
4883 def p_config_rule_statement_5(p
):
4884 '''config_rule_statement : K_cell lib_cell_id K_use lib_cell_id opt_config ';' '''
4886 print('config_rule_statement_5', list(p
))
4892 def p_opt_config_1(p
):
4895 print('opt_config_1', list(p
))
4901 def p_opt_config_2(p
):
4902 '''opt_config : ':' K_config '''
4904 print('opt_config_2', list(p
))
4910 def p_lib_cell_id_1(p
):
4911 '''lib_cell_id : IDENTIFIER '''
4913 print('lib_cell_id_1', list(p
))
4915 # { delete[] p[1]; }
4919 def p_lib_cell_id_2(p
):
4920 '''lib_cell_id : IDENTIFIER '.' IDENTIFIER '''
4922 print('lib_cell_id_2', list(p
))
4924 # { delete[] p[1]; delete[] p[3]; }
4928 def p_list_of_libraries_1(p
):
4929 '''list_of_libraries : '''
4931 print('list_of_libraries_1', list(p
))
4937 def p_list_of_libraries_2(p
):
4938 '''list_of_libraries : list_of_libraries IDENTIFIER '''
4940 print('list_of_libraries_2', list(p
))
4942 # { delete[] p[2]; }
4946 def p_drive_strength_1(p
):
4947 '''drive_strength : '(' dr_strength0 ',' dr_strength1 ')' '''
4949 print('drive_strength_1', list(p
))
4951 # { p[0].str0 = p[2].str0;
4952 # p[0].str1 = p[4].str1;
4957 def p_drive_strength_2(p
):
4958 '''drive_strength : '(' dr_strength1 ',' dr_strength0 ')' '''
4960 print('drive_strength_2', list(p
))
4962 # { p[0].str0 = p[4].str0;
4963 # p[0].str1 = p[2].str1;
4968 def p_drive_strength_3(p
):
4969 '''drive_strength : '(' dr_strength0 ',' K_highz1 ')' '''
4971 print('drive_strength_3', list(p
))
4973 # { p[0].str0 = p[2].str0;
4974 # p[0].str1 = IVL_DR_HiZ;
4979 def p_drive_strength_4(p
):
4980 '''drive_strength : '(' dr_strength1 ',' K_highz0 ')' '''
4982 print('drive_strength_4', list(p
))
4984 # { p[0].str0 = IVL_DR_HiZ;
4985 # p[0].str1 = p[2].str1;
4990 def p_drive_strength_5(p
):
4991 '''drive_strength : '(' K_highz1 ',' dr_strength0 ')' '''
4993 print('drive_strength_5', list(p
))
4995 # { p[0].str0 = p[4].str0;
4996 # p[0].str1 = IVL_DR_HiZ;
5001 def p_drive_strength_6(p
):
5002 '''drive_strength : '(' K_highz0 ',' dr_strength1 ')' '''
5004 print('drive_strength_6', list(p
))
5006 # { p[0].str0 = IVL_DR_HiZ;
5007 # p[0].str1 = p[4].str1;
5012 def p_drive_strength_opt_1(p
):
5013 '''drive_strength_opt : drive_strength '''
5015 print('drive_strength_opt_1', list(p
))
5022 def p_drive_strength_opt_2(p
):
5023 '''drive_strength_opt : '''
5024 if(parse_debug
> 2):
5025 print('drive_strength_opt_2', list(p
))
5027 # { p[0].str0 = IVL_DR_STRONG; p[0].str1 = IVL_DR_STRONG; }
5031 def p_dr_strength0_1(p
):
5032 '''dr_strength0 : K_supply0 '''
5034 print('dr_strength0_1', list(p
))
5036 # { p[0].str0 = IVL_DR_SUPPLY; }
5040 def p_dr_strength0_2(p
):
5041 '''dr_strength0 : K_strong0 '''
5043 print('dr_strength0_2', list(p
))
5045 # { p[0].str0 = IVL_DR_STRONG; }
5049 def p_dr_strength0_3(p
):
5050 '''dr_strength0 : K_pull0 '''
5052 print('dr_strength0_3', list(p
))
5054 # { p[0].str0 = IVL_DR_PULL; }
5058 def p_dr_strength0_4(p
):
5059 '''dr_strength0 : K_weak0 '''
5061 print('dr_strength0_4', list(p
))
5063 # { p[0].str0 = IVL_DR_WEAK; }
5067 def p_dr_strength1_1(p
):
5068 '''dr_strength1 : K_supply1 '''
5070 print('dr_strength1_1', list(p
))
5072 # { p[0].str1 = IVL_DR_SUPPLY; }
5076 def p_dr_strength1_2(p
):
5077 '''dr_strength1 : K_strong1 '''
5079 print('dr_strength1_2', list(p
))
5081 # { p[0].str1 = IVL_DR_STRONG; }
5085 def p_dr_strength1_3(p
):
5086 '''dr_strength1 : K_pull1 '''
5088 print('dr_strength1_3', list(p
))
5090 # { p[0].str1 = IVL_DR_PULL; }
5094 def p_dr_strength1_4(p
):
5095 '''dr_strength1 : K_weak1 '''
5097 print('dr_strength1_4', list(p
))
5099 # { p[0].str1 = IVL_DR_WEAK; }
5103 def p_clocking_event_opt_1(p
):
5104 '''clocking_event_opt : event_control '''
5106 print('clocking_event_opt_1', list(p
))
5112 def p_clocking_event_opt_2(p
):
5113 '''clocking_event_opt : '''
5115 print('clocking_event_opt_2', list(p
))
5121 def p_event_control_1(p
):
5122 '''event_control : '@' hierarchy_identifier '''
5124 print('event_control_1', list(p
))
5126 # { PEIdent*tmpi = new PEIdent(*p[2]);
5127 # PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi);
5128 # PEventStatement*tmps = new PEventStatement(tmpe);
5129 # FILE_NAME(tmps, @1);
5136 def p_event_control_2(p
):
5137 '''event_control : '@' '(' event_expression_list ')' '''
5139 print('event_control_2', list(p
))
5141 # { PEventStatement*tmp = new PEventStatement(*p[3]);
5142 # FILE_NAME(tmp, @1);
5149 def p_event_control_3(p
):
5150 '''event_control : '@' '(' error ')' '''
5152 print('event_control_3', list(p
))
5154 # { yyerror(@1, "error: Malformed event control expression.");
5160 def p_event_expression_list_1(p
):
5161 '''event_expression_list : event_expression '''
5163 print('event_expression_list_1', list(p
))
5170 def p_event_expression_list_2(p
):
5171 '''event_expression_list : event_expression_list K_or event_expression '''
5173 print('event_expression_list_2', list(p
))
5175 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
5183 def p_event_expression_list_3(p
):
5184 '''event_expression_list : event_expression_list ',' event_expression '''
5186 print('event_expression_list_3', list(p
))
5188 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
5196 def p_event_expression_1(p
):
5197 '''event_expression : K_posedge expression '''
5199 print('event_expression_1', list(p
))
5201 # { PEEvent*tmp = new PEEvent(PEEvent::POSEDGE, p[2]);
5202 # FILE_NAME(tmp, @1);
5203 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5210 def p_event_expression_2(p
):
5211 '''event_expression : K_negedge expression '''
5213 print('event_expression_2', list(p
))
5215 # { PEEvent*tmp = new PEEvent(PEEvent::NEGEDGE, p[2]);
5216 # FILE_NAME(tmp, @1);
5217 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5224 def p_event_expression_3(p
):
5225 '''event_expression : expression '''
5227 print('event_expression_3', list(p
))
5229 # { PEEvent*tmp = new PEEvent(PEEvent::ANYEDGE, p[1]);
5230 # FILE_NAME(tmp, @1);
5231 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5238 def p_branch_probe_expression_1(p
):
5239 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ',' IDENTIFIER ')' '''
5241 print('branch_probe_expression_1', list(p
))
5243 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3], p[5]); }
5247 def p_branch_probe_expression_2(p
):
5248 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ')' '''
5250 print('branch_probe_expression_2', list(p
))
5252 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3]); }
5256 def p_expression_1(p
):
5257 '''expression : expr_primary_or_typename '''
5258 if(parse_debug
> 2):
5259 print('expression_1', list(p
))
5266 def p_expression_2(p
):
5267 '''expression : inc_or_dec_expression '''
5269 print('expression_2', list(p
))
5276 def p_expression_3(p
):
5277 '''expression : inside_expression '''
5279 print('expression_3', list(p
))
5286 def p_expression_4(p
):
5287 '''expression : '+' attribute_list_opt expr_primary %prec UNARY_PREC '''
5289 print('expression_4', list(p
))
5296 def p_expression_5(p
):
5297 '''expression : '-' attribute_list_opt expr_primary %prec UNARY_PREC '''
5299 print('expression_5', list(p
))
5301 # { PEUnary*tmp = new PEUnary('-', p[3]);
5302 # FILE_NAME(tmp, @3);
5308 def p_expression_6(p
):
5309 '''expression : '~' attribute_list_opt expr_primary %prec UNARY_PREC '''
5311 print('expression_6', list(p
))
5313 # { PEUnary*tmp = new PEUnary('~', p[3]);
5314 # FILE_NAME(tmp, @3);
5320 def p_expression_7(p
):
5321 '''expression : '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
5323 print('expression_7', list(p
))
5325 # { PEUnary*tmp = new PEUnary('&', p[3]);
5326 # FILE_NAME(tmp, @3);
5332 def p_expression_8(p
):
5333 '''expression : '!' attribute_list_opt expr_primary %prec UNARY_PREC '''
5335 print('expression_8', list(p
))
5337 # { PEUnary*tmp = new PEUnary('!', p[3]);
5338 # FILE_NAME(tmp, @3);
5344 def p_expression_9(p
):
5345 '''expression : '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
5347 print('expression_9', list(p
))
5349 # { PEUnary*tmp = new PEUnary('|', p[3]);
5350 # FILE_NAME(tmp, @3);
5356 def p_expression_10(p
):
5357 '''expression : '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
5359 print('expression_10', list(p
))
5361 # { PEUnary*tmp = new PEUnary('^', p[3]);
5362 # FILE_NAME(tmp, @3);
5368 def p_expression_11(p
):
5369 '''expression : '~' '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
5371 print('expression_11', list(p
))
5373 # { yyerror(@1, "error: '~' '&' is not a valid expression. "
5374 # "Please use operator '~&' instead.");
5380 def p_expression_12(p
):
5381 '''expression : '~' '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
5383 print('expression_12', list(p
))
5385 # { yyerror(@1, "error: '~' '|' is not a valid expression. "
5386 # "Please use operator '~|' instead.");
5392 def p_expression_13(p
):
5393 '''expression : '~' '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
5395 print('expression_13', list(p
))
5397 # { yyerror(@1, "error: '~' '^' is not a valid expression. "
5398 # "Please use operator '~^' instead.");
5404 def p_expression_14(p
):
5405 '''expression : K_NAND attribute_list_opt expr_primary %prec UNARY_PREC '''
5407 print('expression_14', list(p
))
5409 # { PEUnary*tmp = new PEUnary('A', p[3]);
5410 # FILE_NAME(tmp, @3);
5416 def p_expression_15(p
):
5417 '''expression : K_NOR attribute_list_opt expr_primary %prec UNARY_PREC '''
5419 print('expression_15', list(p
))
5421 # { PEUnary*tmp = new PEUnary('N', p[3]);
5422 # FILE_NAME(tmp, @3);
5428 def p_expression_16(p
):
5429 '''expression : K_NXOR attribute_list_opt expr_primary %prec UNARY_PREC '''
5431 print('expression_16', list(p
))
5433 # { PEUnary*tmp = new PEUnary('X', p[3]);
5434 # FILE_NAME(tmp, @3);
5440 def p_expression_17(p
):
5441 '''expression : '!' error %prec UNARY_PREC '''
5443 print('expression_17', list(p
))
5445 # { yyerror(@1, "error: Operand of unary ! "
5446 # "is not a primary expression.");
5452 def p_expression_18(p
):
5453 '''expression : '^' error %prec UNARY_PREC '''
5455 print('expression_18', list(p
))
5457 # { yyerror(@1, "error: Operand of reduction ^ "
5458 # "is not a primary expression.");
5464 def p_expression_19(p
):
5465 '''expression : expression '^' attribute_list_opt expression '''
5467 print('expression_19', list(p
))
5469 # { PEBinary*tmp = new PEBinary('^', p[1], p[4]);
5470 # FILE_NAME(tmp, @2);
5476 def p_expression_20(p
):
5477 '''expression : expression K_POW attribute_list_opt expression '''
5479 print('expression_20', list(p
))
5481 # { PEBinary*tmp = new PEBPower('p', p[1], p[4]);
5482 # FILE_NAME(tmp, @2);
5488 def p_expression_21(p
):
5489 '''expression : expression '*' attribute_list_opt expression '''
5491 print('expression_21', list(p
))
5493 # { PEBinary*tmp = new PEBinary('*', p[1], p[4]);
5494 # FILE_NAME(tmp, @2);
5500 def p_expression_22(p
):
5501 '''expression : expression '/' attribute_list_opt expression '''
5503 print('expression_22', list(p
))
5505 # { PEBinary*tmp = new PEBinary('/', p[1], p[4]);
5506 # FILE_NAME(tmp, @2);
5512 def p_expression_23(p
):
5513 '''expression : expression '%' attribute_list_opt expression '''
5515 print('expression_23', list(p
))
5517 # { PEBinary*tmp = new PEBinary('%', p[1], p[4]);
5518 # FILE_NAME(tmp, @2);
5524 def p_expression_24(p
):
5525 '''expression : expression '+' attribute_list_opt expression '''
5527 print('expression_24', list(p
))
5529 # { PEBinary*tmp = new PEBinary('+', p[1], p[4]);
5530 # FILE_NAME(tmp, @2);
5536 def p_expression_25(p
):
5537 '''expression : expression '-' attribute_list_opt expression '''
5539 print('expression_25', list(p
))
5540 # { PEBinary*tmp = new PEBinary('-', p[1], p[4]);
5541 # FILE_NAME(tmp, @2);
5544 p
[0] = Node(syms
.atom
, [p
[1], Leaf(token
.MINUS
, '-'), p
[4]])
5550 def p_expression_26(p
):
5551 '''expression : expression '&' attribute_list_opt expression '''
5553 print('expression_26', list(p
))
5555 # { PEBinary*tmp = new PEBinary('&', p[1], p[4]);
5556 # FILE_NAME(tmp, @2);
5562 def p_expression_27(p
):
5563 '''expression : expression '|' attribute_list_opt expression '''
5565 print('expression_27', list(p
))
5567 # { PEBinary*tmp = new PEBinary('|', p[1], p[4]);
5568 # FILE_NAME(tmp, @2);
5574 def p_expression_28(p
):
5575 '''expression : expression K_NAND attribute_list_opt expression '''
5577 print('expression_28', list(p
))
5579 # { PEBinary*tmp = new PEBinary('A', p[1], p[4]);
5580 # FILE_NAME(tmp, @2);
5586 def p_expression_29(p
):
5587 '''expression : expression K_NOR attribute_list_opt expression '''
5589 print('expression_29', list(p
))
5591 # { PEBinary*tmp = new PEBinary('O', p[1], p[4]);
5592 # FILE_NAME(tmp, @2);
5598 def p_expression_30(p
):
5599 '''expression : expression K_NXOR attribute_list_opt expression '''
5601 print('expression_30', list(p
))
5603 # { PEBinary*tmp = new PEBinary('X', p[1], p[4]);
5604 # FILE_NAME(tmp, @2);
5610 def p_expression_31(p
):
5611 '''expression : expression '<' attribute_list_opt expression '''
5613 print('expression_31', list(p
))
5615 # { PEBinary*tmp = new PEBComp('<', p[1], p[4]);
5616 # FILE_NAME(tmp, @2);
5622 def p_expression_32(p
):
5623 '''expression : expression '>' attribute_list_opt expression '''
5625 print('expression_32', list(p
))
5627 # { PEBinary*tmp = new PEBComp('>', p[1], p[4]);
5628 # FILE_NAME(tmp, @2);
5634 def p_expression_33(p
):
5635 '''expression : expression K_LS attribute_list_opt expression '''
5637 print('expression_33', list(p
))
5639 # { PEBinary*tmp = new PEBShift('l', p[1], p[4]);
5640 # FILE_NAME(tmp, @2);
5646 def p_expression_34(p
):
5647 '''expression : expression K_RS attribute_list_opt expression '''
5649 print('expression_34', list(p
))
5651 # { PEBinary*tmp = new PEBShift('r', p[1], p[4]);
5652 # FILE_NAME(tmp, @2);
5658 def p_expression_35(p
):
5659 '''expression : expression K_RSS attribute_list_opt expression '''
5661 print('expression_35', list(p
))
5663 # { PEBinary*tmp = new PEBShift('R', p[1], p[4]);
5664 # FILE_NAME(tmp, @2);
5670 def p_expression_36(p
):
5671 '''expression : expression K_EQ attribute_list_opt expression '''
5673 print('expression_36', list(p
))
5675 # { PEBinary*tmp = new PEBComp('e', p[1], p[4]);
5676 # FILE_NAME(tmp, @2);
5682 def p_expression_37(p
):
5683 '''expression : expression K_CEQ attribute_list_opt expression '''
5685 print('expression_37', list(p
))
5687 # { PEBinary*tmp = new PEBComp('E', p[1], p[4]);
5688 # FILE_NAME(tmp, @2);
5694 def p_expression_38(p
):
5695 '''expression : expression K_WEQ attribute_list_opt expression '''
5697 print('expression_38', list(p
))
5699 # { PEBinary*tmp = new PEBComp('w', p[1], p[4]);
5700 # FILE_NAME(tmp, @2);
5706 def p_expression_39(p
):
5707 '''expression : expression K_LE attribute_list_opt expression '''
5709 print('expression_39', list(p
))
5711 # { PEBinary*tmp = new PEBComp('L', p[1], p[4]);
5712 # FILE_NAME(tmp, @2);
5718 def p_expression_40(p
):
5719 '''expression : expression K_GE attribute_list_opt expression '''
5721 print('expression_40', list(p
))
5723 # { PEBinary*tmp = new PEBComp('G', p[1], p[4]);
5724 # FILE_NAME(tmp, @2);
5730 def p_expression_41(p
):
5731 '''expression : expression K_NE attribute_list_opt expression '''
5733 print('expression_41', list(p
))
5735 # { PEBinary*tmp = new PEBComp('n', p[1], p[4]);
5736 # FILE_NAME(tmp, @2);
5742 def p_expression_42(p
):
5743 '''expression : expression K_CNE attribute_list_opt expression '''
5745 print('expression_42', list(p
))
5747 # { PEBinary*tmp = new PEBComp('N', p[1], p[4]);
5748 # FILE_NAME(tmp, @2);
5754 def p_expression_43(p
):
5755 '''expression : expression K_WNE attribute_list_opt expression '''
5757 print('expression_43', list(p
))
5759 # { PEBinary*tmp = new PEBComp('W', p[1], p[4]);
5760 # FILE_NAME(tmp, @2);
5766 def p_expression_44(p
):
5767 '''expression : expression K_LOR attribute_list_opt expression '''
5769 print('expression_44', list(p
))
5771 # { PEBinary*tmp = new PEBLogic('o', p[1], p[4]);
5772 # FILE_NAME(tmp, @2);
5778 def p_expression_45(p
):
5779 '''expression : expression K_LAND attribute_list_opt expression '''
5781 print('expression_45', list(p
))
5783 # { PEBinary*tmp = new PEBLogic('a', p[1], p[4]);
5784 # FILE_NAME(tmp, @2);
5790 def p_expression_46(p
):
5791 '''expression : expression '?' attribute_list_opt expression ':' expression '''
5793 print('expression_46', list(p
))
5795 # { PETernary*tmp = new PETernary(p[1], p[4], p[6]);
5796 # FILE_NAME(tmp, @2);
5802 def p_expr_mintypmax_1(p
):
5803 '''expr_mintypmax : expression '''
5805 print('expr_mintypmax_1', list(p
))
5812 def p_expr_mintypmax_2(p
):
5813 '''expr_mintypmax : expression ':' expression ':' expression '''
5815 print('expr_mintypmax_2', list(p
))
5817 # { switch (min_typ_max_flag) {
5834 # if (min_typ_max_warn > 0) {
5835 # cerr << p[0]->get_fileline() << ": warning: choosing ";
5836 # switch (min_typ_max_flag) {
5847 # cerr << " expression." << endl;
5848 # min_typ_max_warn -= 1;
5854 def p_expression_list_with_nuls_1(p
):
5855 '''expression_list_with_nuls : expression_list_with_nuls ',' expression '''
5857 print('expression_list_with_nuls_1', list(p
))
5859 # { list<PExpr*>*tmp = p[1];
5860 # tmp->push_back(p[3]);
5866 def p_expression_list_with_nuls_2(p
):
5867 '''expression_list_with_nuls : expression '''
5869 print('expression_list_with_nuls_2', list(p
))
5871 # { list<PExpr*>*tmp = new list<PExpr*>;
5872 # tmp->push_back(p[1]);
5878 def p_expression_list_with_nuls_3(p
):
5879 '''expression_list_with_nuls : '''
5881 print('expression_list_with_nuls_3', list(p
))
5883 # { list<PExpr*>*tmp = new list<PExpr*>;
5884 # tmp->push_back(0);
5890 def p_expression_list_with_nuls_4(p
):
5891 '''expression_list_with_nuls : expression_list_with_nuls ',' '''
5893 print('expression_list_with_nuls_4', list(p
))
5895 # { list<PExpr*>*tmp = p[1];
5896 # tmp->push_back(0);
5902 def p_expression_list_proper_1(p
):
5903 '''expression_list_proper : expression_list_proper ',' expression '''
5905 print('expression_list_proper_1', list(p
))
5907 # { list<PExpr*>*tmp = p[1];
5908 # tmp->push_back(p[3]);
5914 def p_expression_list_proper_2(p
):
5915 '''expression_list_proper : expression '''
5917 print('expression_list_proper_2', list(p
))
5919 # { list<PExpr*>*tmp = new list<PExpr*>;
5920 # tmp->push_back(p[1]);
5926 def p_expr_primary_or_typename_1(p
):
5927 '''expr_primary_or_typename : expr_primary '''
5928 if(parse_debug
> 2):
5929 print('expr_primary_or_typename_1', list(p
))
5936 def p_expr_primary_or_typename_2(p
):
5937 '''expr_primary_or_typename : TYPE_IDENTIFIER '''
5939 print('expr_primary_or_typename_2', list(p
))
5942 # { PETypename*tmp = new PETypename(p[1].type);
5943 # FILE_NAME(tmp,@1);
5945 # delete[]p[1].text;
5950 def p_expr_primary_1(p
):
5951 '''expr_primary : number '''
5953 print('expr_primary_1', list(p
))
5957 # PENumber*tmp = new PENumber(p[1]);
5958 # FILE_NAME(tmp, @1);
5964 def p_expr_primary_2(p
):
5965 '''expr_primary : REALTIME '''
5967 print('expr_primary_2', list(p
))
5969 # { PEFNumber*tmp = new PEFNumber(p[1]);
5970 # FILE_NAME(tmp, @1);
5976 def p_expr_primary_3(p
):
5977 '''expr_primary : STRING '''
5979 print('expr_primary_3', list(p
))
5981 # { PEString*tmp = new PEString(p[1]);
5982 # FILE_NAME(tmp, @1);
5988 def p_expr_primary_4(p
):
5989 '''expr_primary : TIME_LITERAL '''
5991 print('expr_primary_4', list(p
))
5997 # if (p[1] == 0 || !get_time_unit(p[1], unit))
5998 # yyerror(@1, "internal error: delay.");
6000 # double p = pow(10.0, (double)(unit - pform_get_timeunit()));
6001 # double time = atof(p[1]) * p;
6003 # verireal *v = new verireal(time);
6004 # p[0] = new PEFNumber(v);
6005 # FILE_NAME(p[0], @1);
6011 def p_expr_primary_5(p
):
6012 '''expr_primary : SYSTEM_IDENTIFIER '''
6014 print('expr_primary_5', list(p
))
6016 # { perm_string tn = lex_strings.make(p[1]);
6017 # PECallFunction*tmp = new PECallFunction(tn);
6018 # FILE_NAME(tmp, @1);
6025 def p_expr_primary_6(p
):
6026 '''expr_primary : hierarchy_identifier '''
6027 if(parse_debug
> 2):
6028 print('expr_primary_6', list(p
))
6031 # { PEIdent*tmp = pform_new_ident(*p[1]);
6032 # FILE_NAME(tmp, @1);
6039 def p_expr_primary_7(p
):
6040 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier '''
6042 print('expr_primary_7', list(p
))
6044 # { p[0] = pform_package_ident(@2, p[1], p[3]);
6050 def p_expr_primary_8(p
):
6051 '''expr_primary : hierarchy_identifier '(' expression_list_with_nuls ')' '''
6053 print('expr_primary_8', list(p
))
6055 # { list<PExpr*>*expr_list = p[3];
6056 # strip_tail_items(expr_list);
6057 # PECallFunction*tmp = pform_make_call_function(@1, *p[1], *expr_list);
6064 def p_expr_primary_9(p
):
6065 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' '''
6067 print('expr_primary_9', list(p
))
6069 # { pform_name_t*t_name = p[1];
6070 # while (! p[3]->empty()) {
6071 # t_name->push_back(p[3]->front());
6072 # p[3]->pop_front();
6074 # list<PExpr*>*expr_list = p[5];
6075 # strip_tail_items(expr_list);
6076 # PECallFunction*tmp = pform_make_call_function(@1, *t_name, *expr_list);
6084 def p_expr_primary_10(p
):
6085 '''expr_primary : SYSTEM_IDENTIFIER '(' expression_list_proper ')' '''
6087 print('expr_primary_10', list(p
))
6089 # { perm_string tn = lex_strings.make(p[1]);
6090 # PECallFunction*tmp = new PECallFunction(tn, *p[3]);
6091 # FILE_NAME(tmp, @1);
6098 def p_expr_primary_11(p
):
6099 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')' '''
6101 print('expr_primary_11', list(p
))
6103 # { perm_string use_name = lex_strings.make(p[3]);
6104 # PECallFunction*tmp = new PECallFunction(p[1], use_name, *p[5]);
6105 # FILE_NAME(tmp, @3);
6112 def p_expr_primary_12(p
):
6113 '''expr_primary : SYSTEM_IDENTIFIER '(' ')' '''
6115 print('expr_primary_12', list(p
))
6117 # { perm_string tn = lex_strings.make(p[1]);
6118 # const vector<PExpr*>empty;
6119 # PECallFunction*tmp = new PECallFunction(tn, empty);
6120 # FILE_NAME(tmp, @1);
6123 # if (!gn_system_verilog()) {
6124 # yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
6130 def p_expr_primary_13(p
):
6131 '''expr_primary : implicit_class_handle '''
6133 print('expr_primary_13', list(p
))
6135 # { PEIdent*tmp = new PEIdent(*p[1]);
6136 # FILE_NAME(tmp,@1);
6143 def p_expr_primary_14(p
):
6144 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '''
6146 print('expr_primary_14', list(p
))
6148 # { pform_name_t*t_name = p[1];
6149 # while (! p[3]->empty()) {
6150 # t_name->push_back(p[3]->front());
6151 # p[3]->pop_front();
6153 # PEIdent*tmp = new PEIdent(*t_name);
6154 # FILE_NAME(tmp,@1);
6162 def p_expr_primary_15(p
):
6163 '''expr_primary : K_acos '(' expression ')' '''
6165 print('expr_primary_15', list(p
))
6167 # { perm_string tn = perm_string::literal("$acos");
6168 # PECallFunction*tmp = make_call_function(tn, p[3]);
6169 # FILE_NAME(tmp,@1);
6175 def p_expr_primary_16(p
):
6176 '''expr_primary : K_acosh '(' expression ')' '''
6178 print('expr_primary_16', list(p
))
6180 # { perm_string tn = perm_string::literal("$acosh");
6181 # PECallFunction*tmp = make_call_function(tn, p[3]);
6182 # FILE_NAME(tmp,@1);
6188 def p_expr_primary_17(p
):
6189 '''expr_primary : K_asin '(' expression ')' '''
6191 print('expr_primary_17', list(p
))
6193 # { perm_string tn = perm_string::literal("$asin");
6194 # PECallFunction*tmp = make_call_function(tn, p[3]);
6195 # FILE_NAME(tmp,@1);
6201 def p_expr_primary_18(p
):
6202 '''expr_primary : K_asinh '(' expression ')' '''
6204 print('expr_primary_18', list(p
))
6206 # { perm_string tn = perm_string::literal("$asinh");
6207 # PECallFunction*tmp = make_call_function(tn, p[3]);
6208 # FILE_NAME(tmp,@1);
6214 def p_expr_primary_19(p
):
6215 '''expr_primary : K_atan '(' expression ')' '''
6217 print('expr_primary_19', list(p
))
6219 # { perm_string tn = perm_string::literal("$atan");
6220 # PECallFunction*tmp = make_call_function(tn, p[3]);
6221 # FILE_NAME(tmp,@1);
6227 def p_expr_primary_20(p
):
6228 '''expr_primary : K_atanh '(' expression ')' '''
6230 print('expr_primary_20', list(p
))
6232 # { perm_string tn = perm_string::literal("$atanh");
6233 # PECallFunction*tmp = make_call_function(tn, p[3]);
6234 # FILE_NAME(tmp,@1);
6240 def p_expr_primary_21(p
):
6241 '''expr_primary : K_atan2 '(' expression ',' expression ')' '''
6243 print('expr_primary_21', list(p
))
6245 # { perm_string tn = perm_string::literal("$atan2");
6246 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6247 # FILE_NAME(tmp,@1);
6253 def p_expr_primary_22(p
):
6254 '''expr_primary : K_ceil '(' expression ')' '''
6256 print('expr_primary_22', list(p
))
6258 # { perm_string tn = perm_string::literal("$ceil");
6259 # PECallFunction*tmp = make_call_function(tn, p[3]);
6260 # FILE_NAME(tmp,@1);
6266 def p_expr_primary_23(p
):
6267 '''expr_primary : K_cos '(' expression ')' '''
6269 print('expr_primary_23', list(p
))
6271 # { perm_string tn = perm_string::literal("$cos");
6272 # PECallFunction*tmp = make_call_function(tn, p[3]);
6273 # FILE_NAME(tmp,@1);
6279 def p_expr_primary_24(p
):
6280 '''expr_primary : K_cosh '(' expression ')' '''
6282 print('expr_primary_24', list(p
))
6284 # { perm_string tn = perm_string::literal("$cosh");
6285 # PECallFunction*tmp = make_call_function(tn, p[3]);
6286 # FILE_NAME(tmp,@1);
6292 def p_expr_primary_25(p
):
6293 '''expr_primary : K_exp '(' expression ')' '''
6295 print('expr_primary_25', list(p
))
6297 # { perm_string tn = perm_string::literal("$exp");
6298 # PECallFunction*tmp = make_call_function(tn, p[3]);
6299 # FILE_NAME(tmp,@1);
6305 def p_expr_primary_26(p
):
6306 '''expr_primary : K_floor '(' expression ')' '''
6308 print('expr_primary_26', list(p
))
6310 # { perm_string tn = perm_string::literal("$floor");
6311 # PECallFunction*tmp = make_call_function(tn, p[3]);
6312 # FILE_NAME(tmp,@1);
6318 def p_expr_primary_27(p
):
6319 '''expr_primary : K_hypot '(' expression ',' expression ')' '''
6321 print('expr_primary_27', list(p
))
6323 # { perm_string tn = perm_string::literal("$hypot");
6324 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6325 # FILE_NAME(tmp,@1);
6331 def p_expr_primary_28(p
):
6332 '''expr_primary : K_ln '(' expression ')' '''
6334 print('expr_primary_28', list(p
))
6336 # { perm_string tn = perm_string::literal("$ln");
6337 # PECallFunction*tmp = make_call_function(tn, p[3]);
6338 # FILE_NAME(tmp,@1);
6344 def p_expr_primary_29(p
):
6345 '''expr_primary : K_log '(' expression ')' '''
6347 print('expr_primary_29', list(p
))
6349 # { perm_string tn = perm_string::literal("$log10");
6350 # PECallFunction*tmp = make_call_function(tn, p[3]);
6351 # FILE_NAME(tmp,@1);
6357 def p_expr_primary_30(p
):
6358 '''expr_primary : K_pow '(' expression ',' expression ')' '''
6360 print('expr_primary_30', list(p
))
6362 # { perm_string tn = perm_string::literal("$pow");
6363 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6364 # FILE_NAME(tmp,@1);
6370 def p_expr_primary_31(p
):
6371 '''expr_primary : K_sin '(' expression ')' '''
6373 print('expr_primary_31', list(p
))
6375 # { perm_string tn = perm_string::literal("$sin");
6376 # PECallFunction*tmp = make_call_function(tn, p[3]);
6377 # FILE_NAME(tmp,@1);
6383 def p_expr_primary_32(p
):
6384 '''expr_primary : K_sinh '(' expression ')' '''
6386 print('expr_primary_32', list(p
))
6388 # { perm_string tn = perm_string::literal("$sinh");
6389 # PECallFunction*tmp = make_call_function(tn, p[3]);
6390 # FILE_NAME(tmp,@1);
6396 def p_expr_primary_33(p
):
6397 '''expr_primary : K_sqrt '(' expression ')' '''
6399 print('expr_primary_33', list(p
))
6401 # { perm_string tn = perm_string::literal("$sqrt");
6402 # PECallFunction*tmp = make_call_function(tn, p[3]);
6403 # FILE_NAME(tmp,@1);
6409 def p_expr_primary_34(p
):
6410 '''expr_primary : K_tan '(' expression ')' '''
6412 print('expr_primary_34', list(p
))
6414 # { perm_string tn = perm_string::literal("$tan");
6415 # PECallFunction*tmp = make_call_function(tn, p[3]);
6416 # FILE_NAME(tmp,@1);
6422 def p_expr_primary_35(p
):
6423 '''expr_primary : K_tanh '(' expression ')' '''
6425 print('expr_primary_35', list(p
))
6427 # { perm_string tn = perm_string::literal("$tanh");
6428 # PECallFunction*tmp = make_call_function(tn, p[3]);
6429 # FILE_NAME(tmp,@1);
6435 def p_expr_primary_36(p
):
6436 '''expr_primary : K_abs '(' expression ')' '''
6438 print('expr_primary_36', list(p
))
6440 # { PEUnary*tmp = new PEUnary('m', p[3]);
6441 # FILE_NAME(tmp,@1);
6447 def p_expr_primary_37(p
):
6448 '''expr_primary : K_max '(' expression ',' expression ')' '''
6450 print('expr_primary_37', list(p
))
6452 # { PEBinary*tmp = new PEBinary('M', p[3], p[5]);
6453 # FILE_NAME(tmp,@1);
6459 def p_expr_primary_38(p
):
6460 '''expr_primary : K_min '(' expression ',' expression ')' '''
6462 print('expr_primary_38', list(p
))
6464 # { PEBinary*tmp = new PEBinary('m', p[3], p[5]);
6465 # FILE_NAME(tmp,@1);
6471 def p_expr_primary_39(p
):
6472 '''expr_primary : '(' expr_mintypmax ')' '''
6474 print('expr_primary_39', list(p
))
6481 def p_expr_primary_40(p
):
6482 '''expr_primary : '{' expression_list_proper '}' '''
6484 print('expr_primary_40', list(p
))
6486 # { PEConcat*tmp = new PEConcat(*p[2]);
6487 # FILE_NAME(tmp, @1);
6494 def p_expr_primary_41(p
):
6495 '''expr_primary : '{' expression '{' expression_list_proper '}' '}' '''
6497 print('expr_primary_41', list(p
))
6499 # { PExpr*rep = p[2];
6500 # PEConcat*tmp = new PEConcat(*p[4], rep);
6501 # FILE_NAME(tmp, @1);
6508 def p_expr_primary_42(p
):
6509 '''expr_primary : '{' expression '{' expression_list_proper '}' error '}' '''
6511 print('expr_primary_42', list(p
))
6513 # { PExpr*rep = p[2];
6514 # PEConcat*tmp = new PEConcat(*p[4], rep);
6515 # FILE_NAME(tmp, @1);
6518 # yyerror(@5, "error: Syntax error between internal '}' "
6519 # "and closing '}' of repeat concatenation.");
6525 def p_expr_primary_43(p
):
6526 '''expr_primary : '{' '}' '''
6528 print('expr_primary_43', list(p
))
6530 # { // This is the empty queue syntax.
6531 # if (gn_system_verilog()) {
6532 # list<PExpr*> empty_list;
6533 # PEConcat*tmp = new PEConcat(empty_list);
6534 # FILE_NAME(tmp, @1);
6537 # yyerror(@1, "error: Concatenations are not allowed to be empty.");
6544 def p_expr_primary_44(p
):
6545 '''expr_primary : expr_primary "'" '(' expression ')' '''
6547 print('expr_primary_44', list(p
))
6549 # { PExpr*base = p[4];
6550 # if (gn_system_verilog()) {
6551 # PECastSize*tmp = new PECastSize(p[1], base);
6552 # FILE_NAME(tmp, @1);
6555 # yyerror(@1, "error: Size cast requires SystemVerilog.");
6562 def p_expr_primary_45(p
):
6563 '''expr_primary : simple_type_or_string "'" '(' expression ')' '''
6565 print('expr_primary_45', list(p
))
6567 # { PExpr*base = p[4];
6568 # if (gn_system_verilog()) {
6569 # PECastType*tmp = new PECastType(p[1], base);
6570 # FILE_NAME(tmp, @1);
6573 # yyerror(@1, "error: Type cast requires SystemVerilog.");
6580 def p_expr_primary_46(p
):
6581 '''expr_primary : assignment_pattern '''
6583 print('expr_primary_46', list(p
))
6590 def p_expr_primary_47(p
):
6591 '''expr_primary : streaming_concatenation '''
6593 print('expr_primary_47', list(p
))
6600 def p_expr_primary_48(p
):
6601 '''expr_primary : K_null '''
6603 print('expr_primary_48', list(p
))
6605 # { PENull*tmp = new PENull;
6606 # FILE_NAME(tmp, @1);
6612 def p_function_item_list_opt_1(p
):
6613 '''function_item_list_opt : function_item_list '''
6615 print('function_item_list_opt_1', list(p
))
6622 def p_function_item_list_opt_2(p
):
6623 '''function_item_list_opt : '''
6625 print('function_item_list_opt_2', list(p
))
6631 def p_function_item_list_1(p
):
6632 '''function_item_list : function_item '''
6634 print('function_item_list_1', list(p
))
6641 def p_function_item_list_2(p
):
6642 '''function_item_list : function_item_list function_item '''
6644 print('function_item_list_2', list(p
))
6647 # if (p[1] && p[2]) {
6648 # vector<pform_tf_port_t>*tmp = p[1];
6649 # size_t s1 = tmp->size();
6650 # tmp->resize(s1 + p[2]->size());
6651 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
6652 # tmp->at(s1+idx) = p[2]->at(idx);
6655 # } else if (p[1]) {
6664 def p_function_item_1(p
):
6665 '''function_item : tf_port_declaration '''
6667 print('function_item_1', list(p
))
6674 def p_function_item_2(p
):
6675 '''function_item : block_item_decl '''
6677 print('function_item_2', list(p
))
6683 def p_gate_instance_1(p
):
6684 '''gate_instance : IDENTIFIER '(' expression_list_with_nuls ')' '''
6686 print('gate_instance_1', list(p
))
6688 # { lgate*tmp = new lgate;
6690 # tmp->parms = p[3];
6691 # tmp->file = @1.text;
6692 # tmp->lineno = @1.first_line;
6699 def p_gate_instance_2(p
):
6700 '''gate_instance : IDENTIFIER dimensions '(' expression_list_with_nuls ')' '''
6702 print('gate_instance_2', list(p
))
6704 # { lgate*tmp = new lgate;
6705 # list<pform_range_t>*rng = p[2];
6707 # tmp->parms = p[4];
6708 # tmp->range = rng->front();
6710 # assert(rng->empty());
6711 # tmp->file = @1.text;
6712 # tmp->lineno = @1.first_line;
6720 def p_gate_instance_3(p
):
6721 '''gate_instance : '(' expression_list_with_nuls ')' '''
6723 print('gate_instance_3', list(p
))
6725 # { lgate*tmp = new lgate;
6727 # tmp->parms = p[2];
6728 # tmp->file = @1.text;
6729 # tmp->lineno = @1.first_line;
6735 def p_gate_instance_4(p
):
6736 '''gate_instance : IDENTIFIER dimensions '''
6738 print('gate_instance_4', list(p
))
6740 # { lgate*tmp = new lgate;
6741 # list<pform_range_t>*rng = p[2];
6744 # tmp->parms_by_name = 0;
6745 # tmp->range = rng->front();
6747 # assert(rng->empty());
6748 # tmp->file = @1.text;
6749 # tmp->lineno = @1.first_line;
6757 def p_gate_instance_5(p
):
6758 '''gate_instance : IDENTIFIER '(' port_name_list ')' '''
6760 print('gate_instance_5', list(p
))
6762 # { lgate*tmp = new lgate;
6765 # tmp->parms_by_name = p[3];
6766 # tmp->file = @1.text;
6767 # tmp->lineno = @1.first_line;
6774 def p_gate_instance_6(p
):
6775 '''gate_instance : IDENTIFIER dimensions '(' port_name_list ')' '''
6777 print('gate_instance_6', list(p
))
6779 # { lgate*tmp = new lgate;
6780 # list<pform_range_t>*rng = p[2];
6783 # tmp->parms_by_name = p[4];
6784 # tmp->range = rng->front();
6786 # assert(rng->empty());
6787 # tmp->file = @1.text;
6788 # tmp->lineno = @1.first_line;
6796 def p_gate_instance_7(p
):
6797 '''gate_instance : IDENTIFIER '(' error ')' '''
6799 print('gate_instance_7', list(p
))
6801 # { lgate*tmp = new lgate;
6804 # tmp->parms_by_name = 0;
6805 # tmp->file = @1.text;
6806 # tmp->lineno = @1.first_line;
6807 # yyerror(@2, "error: Syntax error in instance port "
6808 # "expression(s).");
6815 def p_gate_instance_8(p
):
6816 '''gate_instance : IDENTIFIER dimensions '(' error ')' '''
6818 print('gate_instance_8', list(p
))
6820 # { lgate*tmp = new lgate;
6823 # tmp->parms_by_name = 0;
6824 # tmp->file = @1.text;
6825 # tmp->lineno = @1.first_line;
6826 # yyerror(@3, "error: Syntax error in instance port "
6827 # "expression(s).");
6834 def p_gate_instance_list_1(p
):
6835 '''gate_instance_list : gate_instance_list ',' gate_instance '''
6837 print('gate_instance_list_1', list(p
))
6839 # { svector<lgate>*tmp1 = p[1];
6840 # lgate*tmp2 = p[3];
6841 # svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
6849 def p_gate_instance_list_2(p
):
6850 '''gate_instance_list : gate_instance '''
6852 print('gate_instance_list_2', list(p
))
6854 # { svector<lgate>*tmp = new svector<lgate>(1);
6855 # (*tmp)[0] = *p[1];
6862 def p_gatetype_1(p
):
6863 '''gatetype : K_and '''
6865 print('gatetype_1', list(p
))
6867 # { p[0] = PGBuiltin::AND; }
6871 def p_gatetype_2(p
):
6872 '''gatetype : K_nand '''
6874 print('gatetype_2', list(p
))
6876 # { p[0] = PGBuiltin::NAND; }
6880 def p_gatetype_3(p
):
6881 '''gatetype : K_or '''
6883 print('gatetype_3', list(p
))
6885 # { p[0] = PGBuiltin::OR; }
6889 def p_gatetype_4(p
):
6890 '''gatetype : K_nor '''
6892 print('gatetype_4', list(p
))
6894 # { p[0] = PGBuiltin::NOR; }
6898 def p_gatetype_5(p
):
6899 '''gatetype : K_xor '''
6901 print('gatetype_5', list(p
))
6903 # { p[0] = PGBuiltin::XOR; }
6907 def p_gatetype_6(p
):
6908 '''gatetype : K_xnor '''
6910 print('gatetype_6', list(p
))
6912 # { p[0] = PGBuiltin::XNOR; }
6916 def p_gatetype_7(p
):
6917 '''gatetype : K_buf '''
6919 print('gatetype_7', list(p
))
6921 # { p[0] = PGBuiltin::BUF; }
6925 def p_gatetype_8(p
):
6926 '''gatetype : K_bufif0 '''
6928 print('gatetype_8', list(p
))
6930 # { p[0] = PGBuiltin::BUFIF0; }
6934 def p_gatetype_9(p
):
6935 '''gatetype : K_bufif1 '''
6937 print('gatetype_9', list(p
))
6939 # { p[0] = PGBuiltin::BUFIF1; }
6943 def p_gatetype_10(p
):
6944 '''gatetype : K_not '''
6946 print('gatetype_10', list(p
))
6948 # { p[0] = PGBuiltin::NOT; }
6952 def p_gatetype_11(p
):
6953 '''gatetype : K_notif0 '''
6955 print('gatetype_11', list(p
))
6957 # { p[0] = PGBuiltin::NOTIF0; }
6961 def p_gatetype_12(p
):
6962 '''gatetype : K_notif1 '''
6964 print('gatetype_12', list(p
))
6966 # { p[0] = PGBuiltin::NOTIF1; }
6970 def p_switchtype_1(p
):
6971 '''switchtype : K_nmos '''
6973 print('switchtype_1', list(p
))
6975 # { p[0] = PGBuiltin::NMOS; }
6979 def p_switchtype_2(p
):
6980 '''switchtype : K_rnmos '''
6982 print('switchtype_2', list(p
))
6984 # { p[0] = PGBuiltin::RNMOS; }
6988 def p_switchtype_3(p
):
6989 '''switchtype : K_pmos '''
6991 print('switchtype_3', list(p
))
6993 # { p[0] = PGBuiltin::PMOS; }
6997 def p_switchtype_4(p
):
6998 '''switchtype : K_rpmos '''
7000 print('switchtype_4', list(p
))
7002 # { p[0] = PGBuiltin::RPMOS; }
7006 def p_switchtype_5(p
):
7007 '''switchtype : K_cmos '''
7009 print('switchtype_5', list(p
))
7011 # { p[0] = PGBuiltin::CMOS; }
7015 def p_switchtype_6(p
):
7016 '''switchtype : K_rcmos '''
7018 print('switchtype_6', list(p
))
7020 # { p[0] = PGBuiltin::RCMOS; }
7024 def p_switchtype_7(p
):
7025 '''switchtype : K_tran '''
7027 print('switchtype_7', list(p
))
7029 # { p[0] = PGBuiltin::TRAN; }
7033 def p_switchtype_8(p
):
7034 '''switchtype : K_rtran '''
7036 print('switchtype_8', list(p
))
7038 # { p[0] = PGBuiltin::RTRAN; }
7042 def p_switchtype_9(p
):
7043 '''switchtype : K_tranif0 '''
7045 print('switchtype_9', list(p
))
7047 # { p[0] = PGBuiltin::TRANIF0; }
7051 def p_switchtype_10(p
):
7052 '''switchtype : K_tranif1 '''
7054 print('switchtype_10', list(p
))
7056 # { p[0] = PGBuiltin::TRANIF1; }
7060 def p_switchtype_11(p
):
7061 '''switchtype : K_rtranif0 '''
7063 print('switchtype_11', list(p
))
7065 # { p[0] = PGBuiltin::RTRANIF0; }
7069 def p_switchtype_12(p
):
7070 '''switchtype : K_rtranif1 '''
7072 print('switchtype_12', list(p
))
7074 # { p[0] = PGBuiltin::RTRANIF1; }
7078 def p_hierarchy_identifier_1(p
):
7079 '''hierarchy_identifier : IDENTIFIER '''
7081 print('hierarchy_identifier_1 FIXME', list(p
))
7082 lpvalue
= Leaf(token
.NAME
, p
[1])
7085 # { p[0] = new pform_name_t;
7086 # p[0]->push_back(name_component_t(lex_strings.make(p[1])));
7092 def p_hierarchy_identifier_2(p
):
7093 '''hierarchy_identifier : hierarchy_identifier '.' IDENTIFIER '''
7095 print('hierarchy_identifier_2', list(p
))
7097 # { pform_name_t * tmp = p[1];
7098 # tmp->push_back(name_component_t(lex_strings.make(p[3])));
7105 def p_hierarchy_identifier_3(p
):
7106 '''hierarchy_identifier : hierarchy_identifier '[' expression ']' '''
7108 print('hierarchy_identifier_3', list(p
))
7110 # { pform_name_t * tmp = p[1];
7111 # name_component_t&tail = tmp->back();
7112 # index_component_t itmp;
7113 # itmp.sel = index_component_t::SEL_BIT;
7115 # tail.index.push_back(itmp);
7121 def p_hierarchy_identifier_4(p
):
7122 '''hierarchy_identifier : hierarchy_identifier '[' '$' ']' '''
7124 print('hierarchy_identifier_4', list(p
))
7126 # { pform_name_t * tmp = p[1];
7127 # name_component_t&tail = tmp->back();
7128 # if (! gn_system_verilog()) {
7129 # yyerror(@3, "error: Last element expression ($) "
7130 # "requires SystemVerilog. Try enabling SystemVerilog.");
7132 # index_component_t itmp;
7133 # itmp.sel = index_component_t::SEL_BIT_LAST;
7136 # tail.index.push_back(itmp);
7142 def p_hierarchy_identifier_5(p
):
7143 '''hierarchy_identifier : hierarchy_identifier '[' expression ':' expression ']' '''
7145 print('hierarchy_identifier_5', list(p
))
7147 # { pform_name_t * tmp = p[1];
7148 # name_component_t&tail = tmp->back();
7149 # index_component_t itmp;
7150 # itmp.sel = index_component_t::SEL_PART;
7153 # tail.index.push_back(itmp);
7159 def p_hierarchy_identifier_6(p
):
7160 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_POS expression ']' '''
7162 print('hierarchy_identifier_6', list(p
))
7164 # { pform_name_t * tmp = p[1];
7165 # name_component_t&tail = tmp->back();
7166 # index_component_t itmp;
7167 # itmp.sel = index_component_t::SEL_IDX_UP;
7170 # tail.index.push_back(itmp);
7176 def p_hierarchy_identifier_7(p
):
7177 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_NEG expression ']' '''
7179 print('hierarchy_identifier_7', list(p
))
7181 # { pform_name_t * tmp = p[1];
7182 # name_component_t&tail = tmp->back();
7183 # index_component_t itmp;
7184 # itmp.sel = index_component_t::SEL_IDX_DO;
7187 # tail.index.push_back(itmp);
7193 def p_list_of_identifiers_1(p
):
7194 '''list_of_identifiers : IDENTIFIER '''
7196 print('list_of_identifiers_1', list(p
))
7198 # { p[0] = list_from_identifier(p[1]); }
7202 def p_list_of_identifiers_2(p
):
7203 '''list_of_identifiers : list_of_identifiers ',' IDENTIFIER '''
7205 print('list_of_identifiers_2', list(p
))
7207 # { p[0] = list_from_identifier(p[1], p[3]); }
7211 def p_list_of_port_identifiers_1(p
):
7212 '''list_of_port_identifiers : IDENTIFIER dimensions_opt '''
7214 print('list_of_port_identifiers_1', list(p
))
7216 # { p[0] = make_port_list(p[1], p[2], 0); }
7220 def p_list_of_port_identifiers_2(p
):
7221 '''list_of_port_identifiers : list_of_port_identifiers ',' IDENTIFIER dimensions_opt '''
7223 print('list_of_port_identifiers_2', list(p
))
7225 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
7229 def p_list_of_variable_port_identifiers_1(p
):
7230 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '''
7232 print('list_of_variable_port_identifiers_1', list(p
))
7234 # { p[0] = make_port_list(p[1], p[2], 0); }
7238 def p_list_of_variable_port_identifiers_2(p
):
7239 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '=' expression '''
7241 print('list_of_variable_port_identifiers_2', list(p
))
7243 # { p[0] = make_port_list(p[1], p[2], p[4]); }
7247 def p_list_of_variable_port_identifiers_3(p
):
7248 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '''
7250 print('list_of_variable_port_identifiers_3', list(p
))
7252 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
7256 def p_list_of_variable_port_identifiers_4(p
):
7257 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '=' expression '''
7259 print('list_of_variable_port_identifiers_4', list(p
))
7261 # { p[0] = make_port_list(p[1], p[3], p[4], p[6]); }
7265 def p_list_of_ports_1(p
):
7266 '''list_of_ports : port_opt '''
7268 print('list_of_ports_1', list(p
))
7270 # { vector<Module::port_t*>*tmp
7271 # = new vector<Module::port_t*>(1);
7278 def p_list_of_ports_2(p
):
7279 '''list_of_ports : list_of_ports ',' port_opt '''
7281 print('list_of_ports_2', list(p
))
7283 # { vector<Module::port_t*>*tmp = p[1];
7284 # tmp->push_back(p[3]);
7290 def p_list_of_port_declarations_1(p
):
7291 '''list_of_port_declarations : port_declaration '''
7292 if(parse_debug
> 1):
7293 print('list_of_port_declarations_1', list(p
))
7296 # { vector<Module::port_t*>*tmp
7297 # = new vector<Module::port_t*>(1);
7304 def p_list_of_port_declarations_2(p
):
7305 '''list_of_port_declarations : list_of_port_declarations ',' port_declaration '''
7307 print('list_of_port_declarations_2 FIXME', list(p
))
7308 # MOVE_TO absyn p[1].append(Leaf(token.NEWLINE, '\n')) # should be a comma
7309 # XXX p[3].prefix=' ' # add a space after the NL, must go in parameter
7313 # { vector<Module::port_t*>*tmp = p[1];
7314 # tmp->push_back(p[3]);
7320 def p_list_of_port_declarations_3(p
):
7321 '''list_of_port_declarations : list_of_port_declarations ',' IDENTIFIER '''
7323 print('list_of_port_declarations_3', list(p
))
7325 # { Module::port_t*ptmp;
7326 # perm_string name = lex_strings.make(p[3]);
7327 # ptmp = pform_module_port_reference(name, @3.text,
7329 # vector<Module::port_t*>*tmp = p[1];
7330 # tmp->push_back(ptmp);
7332 # /* Get the port declaration details, the port type
7333 # and what not, from context data stored by the
7334 # last port_declaration rule. */
7335 # pform_module_define_port(@3, name,
7336 # port_declaration_context.port_type,
7337 # port_declaration_context.port_net_type,
7338 # port_declaration_context.data_type, 0);
7345 def p_list_of_port_declarations_4(p
):
7346 '''list_of_port_declarations : list_of_port_declarations ',' '''
7348 print('list_of_port_declarations_4', list(p
))
7351 # yyerror(@2, "error: NULL port declarations are not "
7357 def p_list_of_port_declarations_5(p
):
7358 '''list_of_port_declarations : list_of_port_declarations ';' '''
7360 print('list_of_port_declarations_5', list(p
))
7363 # yyerror(@2, "error: ';' is an invalid port declaration "
7369 def p_port_declaration_1(p
):
7370 '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7372 print('port_declaration_1 FIXME', list(p
))
7373 comment
, dt
, name
= p
[2], p
[4], p
[5]
7374 p
[0] = absyn
.port_decl(comment
, dt
, name
)
7376 # { Module::port_t*ptmp;
7377 # perm_string name = lex_strings.make(p[5]);
7378 # data_type_t*use_type = p[4];
7379 # if (p[6]) use_type = new uarray_type_t(use_type, p[6]);
7380 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7381 # pform_module_define_port(@2, name, NetNet::PINPUT, p[3], use_type, p[1]);
7382 # port_declaration_context.port_type = NetNet::PINPUT;
7383 # port_declaration_context.port_net_type = p[3];
7384 # port_declaration_context.data_type = p[4];
7391 def p_port_declaration_2(p
):
7392 '''port_declaration : attribute_list_opt K_input K_wreal IDENTIFIER '''
7394 print('port_declaration_2', list(p
))
7396 # { Module::port_t*ptmp;
7397 # perm_string name = lex_strings.make(p[4]);
7398 # ptmp = pform_module_port_reference(name, @2.text,
7400 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7401 # FILE_NAME(real_type, @3);
7402 # pform_module_define_port(@2, name, NetNet::PINPUT,
7403 # NetNet::WIRE, real_type, p[1]);
7404 # port_declaration_context.port_type = NetNet::PINPUT;
7405 # port_declaration_context.port_net_type = NetNet::WIRE;
7406 # port_declaration_context.data_type = real_type;
7413 def p_port_declaration_3(p
):
7414 '''port_declaration : attribute_list_opt K_inout net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7416 print('port_declaration_3', list(p
))
7418 # { Module::port_t*ptmp;
7419 # perm_string name = lex_strings.make(p[5]);
7420 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7421 # pform_module_define_port(@2, name, NetNet::PINOUT, p[3], p[4], p[1]);
7422 # port_declaration_context.port_type = NetNet::PINOUT;
7423 # port_declaration_context.port_net_type = p[3];
7424 # port_declaration_context.data_type = p[4];
7427 # yyerror(@6, "sorry: Inout ports with unpacked dimensions not supported.");
7435 def p_port_declaration_4(p
):
7436 '''port_declaration : attribute_list_opt K_inout K_wreal IDENTIFIER '''
7438 print('port_declaration_4', list(p
))
7440 # { Module::port_t*ptmp;
7441 # perm_string name = lex_strings.make(p[4]);
7442 # ptmp = pform_module_port_reference(name, @2.text,
7444 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7445 # FILE_NAME(real_type, @3);
7446 # pform_module_define_port(@2, name, NetNet::PINOUT,
7447 # NetNet::WIRE, real_type, p[1]);
7448 # port_declaration_context.port_type = NetNet::PINOUT;
7449 # port_declaration_context.port_net_type = NetNet::WIRE;
7450 # port_declaration_context.data_type = real_type;
7457 def p_port_declaration_5(p
):
7458 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7460 print('port_declaration_5 FIXME', list(p
))
7461 comment
, dt
, name
= p
[2], p
[4], p
[5]
7462 p
[0] = absyn
.port_decl(comment
, dt
, name
)
7464 # { Module::port_t*ptmp;
7465 # perm_string name = lex_strings.make(p[5]);
7466 # data_type_t*use_dtype = p[4];
7467 # if (p[6]) use_dtype = new uarray_type_t(use_dtype, p[6]);
7468 # NetNet::Type use_type = p[3];
7469 # if (use_type == NetNet::IMPLICIT) {
7470 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
7471 # if (dtype->reg_flag)
7472 # use_type = NetNet::REG;
7473 # else if (dtype->implicit_flag)
7474 # use_type = NetNet::IMPLICIT;
7476 # use_type = NetNet::IMPLICIT_REG;
7478 # // The SystemVerilog types that can show up as
7479 # // output ports are implicitly (on the inside)
7480 # // variables because "reg" is not valid syntax
7482 # } else if (dynamic_cast<atom2_type_t*> (p[4])) {
7483 # use_type = NetNet::IMPLICIT_REG;
7484 # } else if (dynamic_cast<struct_type_t*> (p[4])) {
7485 # use_type = NetNet::IMPLICIT_REG;
7486 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[4])) {
7487 # if(etype->base_type == IVL_VT_LOGIC)
7488 # use_type = NetNet::IMPLICIT_REG;
7491 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7492 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, use_dtype, p[1]);
7493 # port_declaration_context.port_type = NetNet::POUTPUT;
7494 # port_declaration_context.port_net_type = use_type;
7495 # port_declaration_context.data_type = p[4];
7502 def p_port_declaration_6(p
):
7503 '''port_declaration : attribute_list_opt K_output K_wreal IDENTIFIER '''
7505 print('port_declaration_6', list(p
))
7507 # { Module::port_t*ptmp;
7508 # perm_string name = lex_strings.make(p[4]);
7509 # ptmp = pform_module_port_reference(name, @2.text,
7511 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7512 # FILE_NAME(real_type, @3);
7513 # pform_module_define_port(@2, name, NetNet::POUTPUT,
7514 # NetNet::WIRE, real_type, p[1]);
7515 # port_declaration_context.port_type = NetNet::POUTPUT;
7516 # port_declaration_context.port_net_type = NetNet::WIRE;
7517 # port_declaration_context.data_type = real_type;
7524 def p_port_declaration_7(p
):
7525 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER '=' expression '''
7527 print('port_declaration_7', list(p
))
7529 # { Module::port_t*ptmp;
7530 # perm_string name = lex_strings.make(p[5]);
7531 # NetNet::Type use_type = p[3];
7532 # if (use_type == NetNet::IMPLICIT) {
7533 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
7534 # if (dtype->reg_flag)
7535 # use_type = NetNet::REG;
7537 # use_type = NetNet::IMPLICIT_REG;
7539 # use_type = NetNet::IMPLICIT_REG;
7542 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7543 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, p[4], p[1]);
7544 # port_declaration_context.port_type = NetNet::PINOUT;
7545 # port_declaration_context.port_net_type = use_type;
7546 # port_declaration_context.data_type = p[4];
7548 # pform_make_var_init(@5, name, p[7]);
7556 def p_net_type_opt_1(p
):
7557 '''net_type_opt : net_type '''
7559 print('net_type_opt_1', list(p
))
7566 def p_net_type_opt_2(p
):
7567 '''net_type_opt : '''
7568 if(parse_debug
> 2):
7569 print('net_type_opt_2', list(p
))
7576 def p_unsigned_signed_opt_1(p
):
7577 '''unsigned_signed_opt : K_signed '''
7579 print('unsigned_signed_opt_1', list(p
))
7586 def p_unsigned_signed_opt_2(p
):
7587 '''unsigned_signed_opt : K_unsigned '''
7589 print('unsigned_signed_opt_2', list(p
))
7596 def p_unsigned_signed_opt_3(p
):
7597 '''unsigned_signed_opt : '''
7599 print('unsigned_signed_opt_3', list(p
))
7606 def p_signed_unsigned_opt_1(p
):
7607 '''signed_unsigned_opt : K_signed '''
7609 print('signed_unsigned_opt_1', list(p
))
7616 def p_signed_unsigned_opt_2(p
):
7617 '''signed_unsigned_opt : K_unsigned '''
7619 print('signed_unsigned_opt_2', list(p
))
7626 def p_signed_unsigned_opt_3(p
):
7627 '''signed_unsigned_opt : '''
7629 print('signed_unsigned_opt_3', list(p
))
7636 def p_atom2_type_1(p
):
7637 '''atom2_type : K_byte '''
7639 print('atom2_type_1', list(p
))
7645 def p_atom2_type_2(p
):
7646 '''atom2_type : K_shortint '''
7648 print('atom2_type_2', list(p
))
7654 def p_atom2_type_3(p
):
7655 '''atom2_type : K_int '''
7657 print('atom2_type_3', list(p
))
7663 def p_atom2_type_4(p
):
7664 '''atom2_type : K_longint '''
7666 print('atom2_type_4', list(p
))
7673 '''lpvalue : hierarchy_identifier '''
7674 if(parse_debug
> 2):
7675 print('lpvalue_1', list(p
))
7678 # { PEIdent*tmp = pform_new_ident(*p[1]);
7679 # FILE_NAME(tmp, @1);
7687 '''lpvalue : implicit_class_handle '.' hierarchy_identifier '''
7689 print('lpvalue_2', list(p
))
7691 # { pform_name_t*t_name = p[1];
7692 # while (!p[3]->empty()) {
7693 # t_name->push_back(p[3]->front());
7694 # p[3]->pop_front();
7696 # PEIdent*tmp = new PEIdent(*t_name);
7697 # FILE_NAME(tmp, @1);
7706 '''lpvalue : '{' expression_list_proper '}' '''
7708 print('lpvalue_3', list(p
))
7710 # { PEConcat*tmp = new PEConcat(*p[2]);
7711 # FILE_NAME(tmp, @1);
7719 '''lpvalue : streaming_concatenation '''
7721 print('lpvalue_4', list(p
))
7723 # { yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
7729 def p_cont_assign_1(p
):
7730 '''cont_assign : lpvalue '=' expression '''
7732 print('cont_assign_1', list(p
))
7733 absyn
.cont_assign_1(p
)
7735 # { list<PExpr*>*tmp = new list<PExpr*>;
7736 # tmp->push_back(p[1]);
7737 # tmp->push_back(p[3]);
7743 def p_cont_assign_list_1(p
):
7744 '''cont_assign_list : cont_assign_list ',' cont_assign '''
7746 print('cont_assign_list_1', list(p
))
7748 # { list<PExpr*>*tmp = p[1];
7749 # tmp->splice(tmp->end(), *p[3]);
7756 def p_cont_assign_list_2(p
):
7757 '''cont_assign_list : cont_assign '''
7758 if(parse_debug
> 2):
7759 print('cont_assign_list_2', list(p
))
7767 '''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 '''
7768 if(parse_debug
> 2):
7769 print('module_1', list(p
))
7770 clsdecl
= absyn
.module_1(p
)
7777 def p__embed0_module(p
):
7778 '''_embed0_module : '''
7780 # { pform_startmodule(@2, p[4], p[2]==K_program, p[2]==K_interface, p[3], p[1]); }
7784 def p__embed1_module(p
):
7785 '''_embed1_module : '''
7787 # { pform_module_set_ports(p[8]); }
7791 def p__embed2_module(p
):
7792 '''_embed2_module : '''
7794 # { pform_set_scope_timescale(@2); }
7798 def p__embed3_module(p
):
7799 '''_embed3_module : '''
7801 # { Module::UCDriveType ucd;
7802 # // The lexor detected `unconnected_drive directives and
7803 # // marked what it found in the uc_drive variable. Use that
7804 # // to generate a UCD flag for the module.
7805 # switch (uc_drive) {
7808 # ucd = Module::UCD_NONE;
7811 # ucd = Module::UCD_PULL0;
7814 # ucd = Module::UCD_PULL1;
7817 # // Check that program/endprogram and module/endmodule
7818 # // keywords match.
7819 # if (p[2] != p[15]) {
7822 # yyerror(@15, "error: module not closed by endmodule.");
7825 # yyerror(@15, "error: program not closed by endprogram.");
7828 # yyerror(@15, "error: interface not closed by endinterface.");
7834 # pform_endmodule(p[4], in_celldefine, ucd);
7839 def p_module_start_1(p
):
7840 '''module_start : K_module '''
7841 if(parse_debug
> 1):
7842 print('module_start_1', list(p
))
7844 # { p[0] = K_module; }
7848 def p_module_start_2(p
):
7849 '''module_start : K_macromodule '''
7851 print('module_start_2', list(p
))
7853 # { p[0] = K_module; }
7857 def p_module_start_3(p
):
7858 '''module_start : K_program '''
7860 print('module_start_3', list(p
))
7862 # { p[0] = K_program; }
7866 def p_module_start_4(p
):
7867 '''module_start : K_interface '''
7869 print('module_start_4', list(p
))
7871 # { p[0] = K_interface; }
7875 def p_module_end_1(p
):
7876 '''module_end : K_endmodule '''
7877 if(parse_debug
> 2):
7878 print('module_end_1', list(p
))
7880 # { p[0] = K_module; }
7884 def p_module_end_2(p
):
7885 '''module_end : K_endprogram '''
7887 print('module_end_2', list(p
))
7889 # { p[0] = K_program; }
7893 def p_module_end_3(p
):
7894 '''module_end : K_endinterface '''
7896 print('module_end_3', list(p
))
7898 # { p[0] = K_interface; }
7902 def p_endlabel_opt_1(p
):
7903 '''endlabel_opt : ':' IDENTIFIER '''
7905 print('endlabel_opt_1', list(p
))
7912 def p_endlabel_opt_2(p
):
7913 '''endlabel_opt : '''
7914 if(parse_debug
> 2):
7915 print('endlabel_opt_2', list(p
))
7921 def p_module_attribute_foreign_1(p
):
7922 '''module_attribute_foreign : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP '''
7924 print('module_attribute_foreign_1', list(p
))
7930 def p_module_attribute_foreign_2(p
):
7931 '''module_attribute_foreign : '''
7932 if(parse_debug
> 2):
7933 print('module_attribute_foreign_2', list(p
))
7939 def p_module_port_list_opt_1(p
):
7940 '''module_port_list_opt : '(' list_of_ports ')' '''
7942 print('module_port_list_opt_1', list(p
))
7949 def p_module_port_list_opt_2(p
):
7950 '''module_port_list_opt : '(' list_of_port_declarations ')' '''
7951 if(parse_debug
> 2):
7952 print('module_port_list_opt_2', list(p
))
7959 def p_module_port_list_opt_3(p
):
7960 '''module_port_list_opt : '''
7962 print('module_port_list_opt_3', list(p
))
7968 def p_module_port_list_opt_4(p
):
7969 '''module_port_list_opt : '(' error ')' '''
7971 print('module_port_list_opt_4', list(p
))
7973 # { yyerror(@2, "Errors in port declarations.");
7980 def p_module_parameter_port_list_opt_1(p
):
7981 '''module_parameter_port_list_opt : '''
7982 if(parse_debug
> 2):
7983 print('module_parameter_port_list_opt_1', list(p
))
7989 def p_module_parameter_port_list_opt_2(p
):
7990 '''module_parameter_port_list_opt : '#' '(' module_parameter_port_list ')' '''
7992 print('module_parameter_port_list_opt_2', list(p
))
7999 def p_module_parameter_port_list_1(p
):
8000 '''module_parameter_port_list : K_parameter param_type parameter_assign '''
8002 print('module_parameter_port_list_1', list(p
))
8009 def p_module_parameter_port_list_2(p
):
8010 '''module_parameter_port_list : module_parameter_port_list ',' parameter_assign '''
8012 print('module_parameter_port_list_2', list(p
))
8013 p
[0] = p
[1].append(p
[3])
8019 def p_module_parameter_port_list_3(p
):
8020 '''module_parameter_port_list : module_parameter_port_list ',' K_parameter param_type parameter_assign '''
8022 print('module_parameter_port_list_3', list(p
))
8023 p
[1].append(Leaf(token
.COMMA
, ','))
8024 p
[1].append(Leaf(token
.NEWLINE
, '\n'))
8025 p
[5].prefix
= ' ' # add space after newline
8033 def p_module_item_1(p
):
8034 '''module_item : module '''
8036 print('module_item_1', list(p
))
8042 def p_module_item_2(p
):
8043 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' '''
8045 print('module_item_2', list(p
))
8047 # { data_type_t*data_type = p[3];
8048 # if (data_type == 0) {
8049 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8050 # FILE_NAME(data_type, @2);
8052 # pform_set_data_type(@2, data_type, p[5], p[2], p[1]);
8054 # yyerror(@2, "sorry: net delays not supported.");
8062 def p_module_item_3(p
):
8063 '''module_item : attribute_list_opt K_wreal delay3 net_variable_list ';' '''
8065 print('module_item_3', list(p
))
8067 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
8068 # pform_set_data_type(@2, tmpt, p[4], NetNet::WIRE, p[1]);
8070 # yyerror(@3, "sorry: net delays not supported.");
8078 def p_module_item_4(p
):
8079 '''module_item : attribute_list_opt K_wreal net_variable_list ';' '''
8081 print('module_item_4', list(p
))
8083 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
8084 # pform_set_data_type(@2, tmpt, p[3], NetNet::WIRE, p[1]);
8090 def p_module_item_5(p
):
8091 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_decl_assigns ';' '''
8093 print('module_item_5', list(p
))
8095 # { data_type_t*data_type = p[3];
8096 # if (data_type == 0) {
8097 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8098 # FILE_NAME(data_type, @2);
8100 # pform_makewire(@2, p[4], str_strength, p[5], p[2], data_type);
8102 # yywarn(@2, "Attributes are not supported on net declaration "
8103 # "assignments and will be discarded.");
8110 def p_module_item_6(p
):
8111 '''module_item : attribute_list_opt net_type data_type_or_implicit drive_strength net_decl_assigns ';' '''
8113 print('module_item_6', list(p
))
8115 # { data_type_t*data_type = p[3];
8116 # if (data_type == 0) {
8117 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8118 # FILE_NAME(data_type, @2);
8120 # pform_makewire(@2, 0, p[4], p[5], p[2], data_type);
8122 # yywarn(@2, "Attributes are not supported on net declaration "
8123 # "assignments and will be discarded.");
8130 def p_module_item_7(p
):
8131 '''module_item : attribute_list_opt K_wreal net_decl_assigns ';' '''
8133 print('module_item_7', list(p
))
8135 # { real_type_t*data_type = new real_type_t(real_type_t::REAL);
8136 # pform_makewire(@2, 0, str_strength, p[3], NetNet::WIRE, data_type);
8138 # yywarn(@2, "Attributes are not supported on net declaration "
8139 # "assignments and will be discarded.");
8146 def p_module_item_8(p
):
8147 '''module_item : K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' '''
8149 print('module_item_8', list(p
))
8151 # { yyerror(@1, "sorry: trireg nets not supported.");
8158 def p_module_item_9(p
):
8159 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit list_of_port_identifiers ';' '''
8161 print('module_item_9', list(p
))
8163 # { pform_module_define_port(@2, p[5], p[2], p[3], p[4], p[1]); }
8167 def p_module_item_10(p
):
8168 '''module_item : attribute_list_opt port_direction K_wreal list_of_port_identifiers ';' '''
8170 print('module_item_10', list(p
))
8172 # { real_type_t*real_type = new real_type_t(real_type_t::REAL);
8173 # pform_module_define_port(@2, p[4], p[2], NetNet::WIRE, real_type, p[1]);
8178 def p_module_item_11(p
):
8179 '''module_item : attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' '''
8181 print('module_item_11', list(p
))
8183 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8184 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8185 # if (dtype->implicit_flag)
8186 # use_type = NetNet::NONE;
8188 # if (use_type == NetNet::NONE)
8189 # pform_set_port_type(@2, p[4], NetNet::PINOUT, p[3], p[1]);
8191 # pform_module_define_port(@2, p[4], NetNet::PINOUT, use_type, p[3], p[1]);
8196 def p_module_item_12(p
):
8197 '''module_item : attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' '''
8199 print('module_item_12', list(p
))
8201 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8202 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8203 # if (dtype->implicit_flag)
8204 # use_type = NetNet::NONE;
8206 # if (use_type == NetNet::NONE)
8207 # pform_set_port_type(@2, p[4], NetNet::PINPUT, p[3], p[1]);
8209 # pform_module_define_port(@2, p[4], NetNet::PINPUT, use_type, p[3], p[1]);
8214 def p_module_item_13(p
):
8215 '''module_item : attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' '''
8217 print('module_item_13', list(p
))
8219 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8220 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8221 # if (dtype->implicit_flag)
8222 # use_type = NetNet::NONE;
8223 # else if (dtype->reg_flag)
8224 # use_type = NetNet::REG;
8226 # use_type = NetNet::IMPLICIT_REG;
8228 # // The SystemVerilog types that can show up as
8229 # // output ports are implicitly (on the inside)
8230 # // variables because "reg" is not valid syntax
8232 # } else if (dynamic_cast<atom2_type_t*> (p[3])) {
8233 # use_type = NetNet::IMPLICIT_REG;
8234 # } else if (dynamic_cast<struct_type_t*> (p[3])) {
8235 # use_type = NetNet::IMPLICIT_REG;
8236 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[3])) {
8237 # if(etype->base_type == IVL_VT_LOGIC)
8238 # use_type = NetNet::IMPLICIT_REG;
8240 # if (use_type == NetNet::NONE)
8241 # pform_set_port_type(@2, p[4], NetNet::POUTPUT, p[3], p[1]);
8243 # pform_module_define_port(@2, p[4], NetNet::POUTPUT, use_type, p[3], p[1]);
8248 def p_module_item_14(p
):
8249 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit error ';' '''
8251 print('module_item_14', list(p
))
8253 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8254 # if (p[1]) delete p[1];
8255 # if (p[4]) delete p[4];
8261 def p_module_item_15(p
):
8262 '''module_item : attribute_list_opt K_inout data_type_or_implicit error ';' '''
8264 print('module_item_15', list(p
))
8266 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8267 # if (p[1]) delete p[1];
8268 # if (p[3]) delete p[3];
8274 def p_module_item_16(p
):
8275 '''module_item : attribute_list_opt K_input data_type_or_implicit error ';' '''
8277 print('module_item_16', list(p
))
8279 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8280 # if (p[1]) delete p[1];
8281 # if (p[3]) delete p[3];
8287 def p_module_item_17(p
):
8288 '''module_item : attribute_list_opt K_output data_type_or_implicit error ';' '''
8290 print('module_item_17', list(p
))
8292 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8293 # if (p[1]) delete p[1];
8294 # if (p[3]) delete p[3];
8300 def p_module_item_18(p
):
8301 '''module_item : DISCIPLINE_IDENTIFIER list_of_identifiers ';' '''
8303 print('module_item_18', list(p
))
8305 # { pform_attach_discipline(@1, p[1], p[2]); }
8309 def p_module_item_19(p
):
8310 '''module_item : attribute_list_opt _embed0_module_item block_item_decl '''
8312 print('module_item_19', list(p
))
8314 # { delete attributes_in_context;
8315 # attributes_in_context = 0;
8320 def p_module_item_20(p
):
8321 '''module_item : K_defparam _embed1_module_item defparam_assign_list ';' '''
8323 print('module_item_20', list(p
))
8329 def p_module_item_21(p
):
8330 '''module_item : attribute_list_opt gatetype gate_instance_list ';' '''
8332 print('module_item_21', list(p
))
8334 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
8338 def p_module_item_22(p
):
8339 '''module_item : attribute_list_opt gatetype delay3 gate_instance_list ';' '''
8341 print('module_item_22', list(p
))
8343 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
8347 def p_module_item_23(p
):
8348 '''module_item : attribute_list_opt gatetype drive_strength gate_instance_list ';' '''
8350 print('module_item_23', list(p
))
8352 # { pform_makegates(@2, p[2], p[3], 0, p[4], p[1]); }
8356 def p_module_item_24(p
):
8357 '''module_item : attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';' '''
8359 print('module_item_24', list(p
))
8361 # { pform_makegates(@2, p[2], p[3], p[4], p[5], p[1]); }
8365 def p_module_item_25(p
):
8366 '''module_item : attribute_list_opt switchtype gate_instance_list ';' '''
8368 print('module_item_25', list(p
))
8370 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
8374 def p_module_item_26(p
):
8375 '''module_item : attribute_list_opt switchtype delay3 gate_instance_list ';' '''
8377 print('module_item_26', list(p
))
8379 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
8383 def p_module_item_27(p
):
8384 '''module_item : K_pullup gate_instance_list ';' '''
8386 print('module_item_27', list(p
))
8388 # { pform_makegates(@1, PGBuiltin::PULLUP, pull_strength, 0, p[2], 0); }
8392 def p_module_item_28(p
):
8393 '''module_item : K_pulldown gate_instance_list ';' '''
8395 print('module_item_28', list(p
))
8397 # { pform_makegates(@1, PGBuiltin::PULLDOWN, pull_strength, 0, p[2], 0); }
8401 def p_module_item_29(p
):
8402 '''module_item : K_pullup '(' dr_strength1 ')' gate_instance_list ';' '''
8404 print('module_item_29', list(p
))
8406 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[5], 0); }
8410 def p_module_item_30(p
):
8411 '''module_item : K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
8413 print('module_item_30', list(p
))
8415 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[7], 0); }
8419 def p_module_item_31(p
):
8420 '''module_item : K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
8422 print('module_item_31', list(p
))
8424 # { pform_makegates(@1, PGBuiltin::PULLUP, p[5], 0, p[7], 0); }
8428 def p_module_item_32(p
):
8429 '''module_item : K_pulldown '(' dr_strength0 ')' gate_instance_list ';' '''
8431 print('module_item_32', list(p
))
8433 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[5], 0); }
8437 def p_module_item_33(p
):
8438 '''module_item : K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
8440 print('module_item_33', list(p
))
8442 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[5], 0, p[7], 0); }
8446 def p_module_item_34(p
):
8447 '''module_item : K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
8449 print('module_item_34', list(p
))
8451 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[7], 0); }
8455 def p_module_item_35(p
):
8456 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' '''
8458 print('module_item_35', list(p
))
8460 # { perm_string tmp1 = lex_strings.make(p[2]);
8461 # pform_make_modgates(@2, tmp1, p[3], p[4], p[1]);
8467 def p_module_item_36(p
):
8468 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt error ';' '''
8470 print('module_item_36', list(p
))
8472 # { yyerror(@2, "error: Invalid module instantiation");
8474 # if (p[1]) delete p[1];
8479 def p_module_item_37(p
):
8480 '''module_item : K_assign drive_strength_opt delay3_opt cont_assign_list ';' '''
8481 if(parse_debug
> 2):
8482 print('module_item_37', list(p
))
8484 # { pform_make_pgassign_list(p[4], p[3], p[2], @1.text, @1.first_line); }
8488 def p_module_item_38(p
):
8489 '''module_item : attribute_list_opt K_always statement_item '''
8491 print('module_item_38', list(p
))
8493 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, p[3], p[1]);
8494 # FILE_NAME(tmp, @2);
8499 def p_module_item_39(p
):
8500 '''module_item : attribute_list_opt K_always_comb statement_item '''
8502 print('module_item_39', list(p
))
8504 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_COMB, p[3], p[1]);
8505 # FILE_NAME(tmp, @2);
8510 def p_module_item_40(p
):
8511 '''module_item : attribute_list_opt K_always_ff statement_item '''
8513 print('module_item_40', list(p
))
8515 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, p[3], p[1]);
8516 # FILE_NAME(tmp, @2);
8521 def p_module_item_41(p
):
8522 '''module_item : attribute_list_opt K_always_latch statement_item '''
8524 print('module_item_41', list(p
))
8526 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_LATCH, p[3], p[1]);
8527 # FILE_NAME(tmp, @2);
8532 def p_module_item_42(p
):
8533 '''module_item : attribute_list_opt K_initial statement_item '''
8535 print('module_item_42', list(p
))
8537 # { PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, p[3], p[1]);
8538 # FILE_NAME(tmp, @2);
8543 def p_module_item_43(p
):
8544 '''module_item : attribute_list_opt K_final statement_item '''
8546 print('module_item_43', list(p
))
8548 # { PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, p[3], p[1]);
8549 # FILE_NAME(tmp, @2);
8554 def p_module_item_44(p
):
8555 '''module_item : attribute_list_opt K_analog analog_statement '''
8557 print('module_item_44', list(p
))
8559 # { pform_make_analog_behavior(@2, IVL_PR_ALWAYS, p[3]); }
8563 def p_module_item_45(p
):
8564 '''module_item : attribute_list_opt assertion_item '''
8566 print('module_item_45', list(p
))
8572 def p_module_item_46(p
):
8573 '''module_item : timeunits_declaration '''
8575 print('module_item_46', list(p
))
8581 def p_module_item_47(p
):
8582 '''module_item : class_declaration '''
8584 print('module_item_47', list(p
))
8590 def p_module_item_48(p
):
8591 '''module_item : task_declaration '''
8593 print('module_item_48', list(p
))
8599 def p_module_item_49(p
):
8600 '''module_item : function_declaration '''
8602 print('module_item_49', list(p
))
8608 def p_module_item_50(p
):
8609 '''module_item : K_generate generate_item_list_opt K_endgenerate '''
8611 print('module_item_50', list(p
))
8613 # { // Test for bad nesting. I understand it, but it is illegal.
8614 # if (pform_parent_generate()) {
8615 # cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
8616 # cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
8617 # cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
8624 def p_module_item_51(p
):
8625 '''module_item : K_genvar list_of_identifiers ';' '''
8627 print('module_item_51', list(p
))
8629 # { pform_genvars(@1, p[2]); }
8633 def p_module_item_52(p
):
8634 '''module_item : K_for '(' IDENTIFIER '=' expression ';' expression ';' IDENTIFIER '=' expression ')' _embed2_module_item generate_block '''
8636 print('module_item_52', list(p
))
8638 # { pform_endgenerate(); }
8642 def p_module_item_53(p
):
8643 '''module_item : generate_if generate_block_opt K_else _embed3_module_item generate_block '''
8645 print('module_item_53', list(p
))
8647 # { pform_endgenerate(); }
8651 def p_module_item_54(p
):
8652 '''module_item : generate_if generate_block_opt %prec less_than_K_else '''
8654 print('module_item_54', list(p
))
8656 # { pform_endgenerate(); }
8660 def p_module_item_55(p
):
8661 '''module_item : K_case '(' expression ')' _embed4_module_item generate_case_items K_endcase '''
8663 print('module_item_55', list(p
))
8665 # { pform_endgenerate(); }
8669 def p_module_item_56(p
):
8670 '''module_item : modport_declaration '''
8672 print('module_item_56', list(p
))
8678 def p_module_item_57(p
):
8679 '''module_item : package_import_declaration '''
8681 print('module_item_57', list(p
))
8687 def p_module_item_58(p
):
8688 '''module_item : attribute_list_opt K_specparam _embed5_module_item specparam_decl ';' '''
8690 print('module_item_58', list(p
))
8696 def p_module_item_59(p
):
8697 '''module_item : K_specify _embed6_module_item specify_item_list_opt K_endspecify '''
8699 print('module_item_59', list(p
))
8705 def p_module_item_60(p
):
8706 '''module_item : K_specify error K_endspecify '''
8708 print('module_item_60', list(p
))
8710 # { yyerror(@1, "error: syntax error in specify block");
8716 def p_module_item_61(p
):
8717 '''module_item : error ';' '''
8719 print('module_item_61', list(p
))
8721 # { yyerror(@2, "error: invalid module item.");
8727 def p_module_item_62(p
):
8728 '''module_item : K_assign error '=' expression ';' '''
8730 print('module_item_62', list(p
))
8732 # { yyerror(@1, "error: syntax error in left side "
8733 # "of continuous assignment.");
8739 def p_module_item_63(p
):
8740 '''module_item : K_assign error ';' '''
8742 print('module_item_63', list(p
))
8744 # { yyerror(@1, "error: syntax error in "
8745 # "continuous assignment");
8751 def p_module_item_64(p
):
8752 '''module_item : K_function error K_endfunction endlabel_opt '''
8754 print('module_item_64', list(p
))
8756 # { yyerror(@1, "error: I give up on this "
8757 # "function definition.");
8759 # if (!gn_system_verilog()) {
8760 # yyerror(@4, "error: Function end names require "
8761 # "SystemVerilog.");
8770 def p_module_item_65(p
):
8771 '''module_item : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';' '''
8773 print('module_item_65', list(p
))
8775 # { perm_string tmp3 = lex_strings.make(p[3]);
8776 # perm_string tmp5 = lex_strings.make(p[5]);
8777 # pform_set_attrib(tmp3, tmp5, p[7]);
8784 def p_module_item_66(p
):
8785 '''module_item : KK_attribute '(' error ')' ';' '''
8787 print('module_item_66', list(p
))
8789 # { yyerror(@1, "error: Malformed $attribute parameter list."); }
8793 def p__embed0_module_item(p
):
8794 '''_embed0_module_item : '''
8796 # { attributes_in_context = p[1]; }
8800 def p__embed1_module_item(p
):
8801 '''_embed1_module_item : '''
8803 # { if (pform_in_interface())
8804 # yyerror(@1, "error: Parameter overrides are not allowed "
8805 # "in interfaces.");
8810 def p__embed2_module_item(p
):
8811 '''_embed2_module_item : '''
8813 # { pform_start_generate_for(@1, p[3], p[5], p[7], p[9], p[11]); }
8817 def p__embed3_module_item(p
):
8818 '''_embed3_module_item : '''
8820 # { pform_start_generate_else(@1); }
8824 def p__embed4_module_item(p
):
8825 '''_embed4_module_item : '''
8827 # { pform_start_generate_case(@1, p[3]); }
8831 def p__embed5_module_item(p
):
8832 '''_embed5_module_item : '''
8834 # { if (pform_in_interface())
8835 # yyerror(@1, "error: specparam declarations are not allowed "
8836 # "in interfaces.");
8841 def p__embed6_module_item(p
):
8842 '''_embed6_module_item : '''
8844 # { if (pform_in_interface())
8845 # yyerror(@1, "error: specify blocks are not allowed "
8846 # "in interfaces.");
8851 def p_module_item_list_1(p
):
8852 '''module_item_list : module_item_list module_item '''
8854 print('module_item_list_1', list(p
))
8860 def p_module_item_list_2(p
):
8861 '''module_item_list : module_item '''
8862 if(parse_debug
> 2):
8863 print('module_item_list_2', list(p
))
8869 def p_module_item_list_opt_1(p
):
8870 '''module_item_list_opt : module_item_list '''
8871 if(parse_debug
> 2):
8872 print('module_item_list_opt_1', list(p
))
8878 def p_module_item_list_opt_2(p
):
8879 '''module_item_list_opt : '''
8881 print('module_item_list_opt_2', list(p
))
8887 def p_generate_if_1(p
):
8888 '''generate_if : K_if '(' expression ')' '''
8890 print('generate_if_1', list(p
))
8892 # { pform_start_generate_if(@1, p[3]); }
8896 def p_generate_case_items_1(p
):
8897 '''generate_case_items : generate_case_items generate_case_item '''
8899 print('generate_case_items_1', list(p
))
8905 def p_generate_case_items_2(p
):
8906 '''generate_case_items : generate_case_item '''
8908 print('generate_case_items_2', list(p
))
8914 def p_generate_case_item_1(p
):
8915 '''generate_case_item : expression_list_proper ':' _embed0_generate_case_item generate_block_opt '''
8917 print('generate_case_item_1', list(p
))
8919 # { pform_endgenerate(); }
8923 def p_generate_case_item_2(p
):
8924 '''generate_case_item : K_default ':' _embed1_generate_case_item generate_block_opt '''
8926 print('generate_case_item_2', list(p
))
8928 # { pform_endgenerate(); }
8932 def p__embed0_generate_case_item(p
):
8933 '''_embed0_generate_case_item : '''
8935 # { pform_generate_case_item(@1, p[1]); }
8939 def p__embed1_generate_case_item(p
):
8940 '''_embed1_generate_case_item : '''
8942 # { pform_generate_case_item(@1, 0); }
8946 def p_generate_item_1(p
):
8947 '''generate_item : module_item '''
8949 print('generate_item_1', list(p
))
8955 def p_generate_item_2(p
):
8956 '''generate_item : K_begin generate_item_list_opt K_end '''
8958 print('generate_item_2', list(p
))
8960 # { /* Detect and warn about anachronistic begin/end use */
8961 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
8963 # cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
8969 def p_generate_item_3(p
):
8970 '''generate_item : K_begin ':' IDENTIFIER _embed0_generate_item generate_item_list_opt K_end '''
8972 print('generate_item_3', list(p
))
8974 # { /* Detect and warn about anachronistic named begin/end use */
8975 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
8977 # cerr << @1 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
8979 # pform_endgenerate();
8984 def p__embed0_generate_item(p
):
8985 '''_embed0_generate_item : '''
8988 # pform_start_generate_nblock(@1, p[3]);
8993 def p_generate_item_list_1(p
):
8994 '''generate_item_list : generate_item_list generate_item '''
8996 print('generate_item_list_1', list(p
))
9002 def p_generate_item_list_2(p
):
9003 '''generate_item_list : generate_item '''
9005 print('generate_item_list_2', list(p
))
9011 def p_generate_item_list_opt_1(p
):
9012 '''generate_item_list_opt : generate_item_list '''
9014 print('generate_item_list_opt_1', list(p
))
9020 def p_generate_item_list_opt_2(p
):
9021 '''generate_item_list_opt : '''
9023 print('generate_item_list_opt_2', list(p
))
9029 def p_generate_block_1(p
):
9030 '''generate_block : module_item '''
9032 print('generate_block_1', list(p
))
9038 def p_generate_block_2(p
):
9039 '''generate_block : K_begin generate_item_list_opt K_end '''
9041 print('generate_block_2', list(p
))
9047 def p_generate_block_3(p
):
9048 '''generate_block : K_begin ':' IDENTIFIER generate_item_list_opt K_end endlabel_opt '''
9050 print('generate_block_3', list(p
))
9052 # { pform_generate_block_name(p[3]);
9054 # if (strcmp(p[3],p[6]) != 0) {
9055 # yyerror(@6, "error: End label doesn't match "
9058 # if (! gn_system_verilog()) {
9059 # yyerror(@6, "error: Begin end labels require "
9060 # "SystemVerilog.");
9069 def p_generate_block_opt_1(p
):
9070 '''generate_block_opt : generate_block '''
9072 print('generate_block_opt_1', list(p
))
9078 def p_generate_block_opt_2(p
):
9079 '''generate_block_opt : ';' '''
9081 print('generate_block_opt_2', list(p
))
9087 def p_net_decl_assign_1(p
):
9088 '''net_decl_assign : IDENTIFIER '=' expression '''
9090 print('net_decl_assign_1', list(p
))
9092 # { net_decl_assign_t*tmp = new net_decl_assign_t;
9094 # tmp->name = lex_strings.make(p[1]);
9102 def p_net_decl_assigns_1(p
):
9103 '''net_decl_assigns : net_decl_assigns ',' net_decl_assign '''
9105 print('net_decl_assigns_1', list(p
))
9107 # { net_decl_assign_t*tmp = p[1];
9108 # p[3]->next = tmp->next;
9115 def p_net_decl_assigns_2(p
):
9116 '''net_decl_assigns : net_decl_assign '''
9118 print('net_decl_assigns_2', list(p
))
9125 def p_bit_logic_1(p
):
9126 '''bit_logic : K_logic '''
9128 print('bit_logic_1', list(p
))
9130 # { p[0] = IVL_VT_LOGIC; }
9134 def p_bit_logic_2(p
):
9135 '''bit_logic : K_bool '''
9137 print('bit_logic_2', list(p
))
9139 # { p[0] = IVL_VT_BOOL; /* Icarus misc */}
9143 def p_bit_logic_3(p
):
9144 '''bit_logic : K_bit '''
9146 print('bit_logic_3', list(p
))
9148 # { p[0] = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
9152 def p_bit_logic_opt_1(p
):
9153 '''bit_logic_opt : bit_logic '''
9155 print('bit_logic_opt_1', list(p
))
9161 def p_bit_logic_opt_2(p
):
9162 '''bit_logic_opt : '''
9164 print('bit_logic_opt_2', list(p
))
9166 # { p[0] = IVL_VT_NO_TYPE; }
9170 def p_net_type_1(p
):
9171 '''net_type : K_wire '''
9173 print('net_type_1', list(p
))
9175 # { p[0] = NetNet::WIRE; }
9179 def p_net_type_2(p
):
9180 '''net_type : K_tri '''
9182 print('net_type_2', list(p
))
9184 # { p[0] = NetNet::TRI; }
9188 def p_net_type_3(p
):
9189 '''net_type : K_tri1 '''
9191 print('net_type_3', list(p
))
9193 # { p[0] = NetNet::TRI1; }
9197 def p_net_type_4(p
):
9198 '''net_type : K_supply0 '''
9200 print('net_type_4', list(p
))
9202 # { p[0] = NetNet::SUPPLY0; }
9206 def p_net_type_5(p
):
9207 '''net_type : K_wand '''
9209 print('net_type_5', list(p
))
9211 # { p[0] = NetNet::WAND; }
9215 def p_net_type_6(p
):
9216 '''net_type : K_triand '''
9218 print('net_type_6', list(p
))
9220 # { p[0] = NetNet::TRIAND; }
9224 def p_net_type_7(p
):
9225 '''net_type : K_tri0 '''
9227 print('net_type_7', list(p
))
9229 # { p[0] = NetNet::TRI0; }
9233 def p_net_type_8(p
):
9234 '''net_type : K_supply1 '''
9236 print('net_type_8', list(p
))
9238 # { p[0] = NetNet::SUPPLY1; }
9242 def p_net_type_9(p
):
9243 '''net_type : K_wor '''
9245 print('net_type_9', list(p
))
9247 # { p[0] = NetNet::WOR; }
9251 def p_net_type_10(p
):
9252 '''net_type : K_trior '''
9254 print('net_type_10', list(p
))
9256 # { p[0] = NetNet::TRIOR; }
9260 def p_net_type_11(p
):
9261 '''net_type : K_wone '''
9263 print('net_type_11', list(p
))
9265 # { p[0] = NetNet::UNRESOLVED_WIRE;
9266 # cerr << @1.text << ":" << @1.first_line << ": warning: "
9267 # "'wone' is deprecated, please use 'uwire' "
9268 # "instead." << endl;
9273 def p_net_type_12(p
):
9274 '''net_type : K_uwire '''
9276 print('net_type_12', list(p
))
9278 # { p[0] = NetNet::UNRESOLVED_WIRE; }
9282 def p_param_type_1(p
):
9283 '''param_type : bit_logic_opt unsigned_signed_opt dimensions_opt '''
9285 print('param_type_1', list(p
))
9287 # { param_active_range = p[3];
9288 # param_active_signed = p[2];
9289 # if ((p[1] == IVL_VT_NO_TYPE) && (p[3] != 0))
9290 # param_active_type = IVL_VT_LOGIC;
9292 # param_active_type = p[1];
9297 def p_param_type_2(p
):
9298 '''param_type : K_integer '''
9300 print('param_type_2', list(p
))
9302 # { param_active_range = make_range_from_width(integer_width);
9303 # param_active_signed = true;
9304 # param_active_type = IVL_VT_LOGIC;
9309 def p_param_type_3(p
):
9310 '''param_type : K_time '''
9312 print('param_type_3', list(p
))
9314 # { param_active_range = make_range_from_width(64);
9315 # param_active_signed = false;
9316 # param_active_type = IVL_VT_LOGIC;
9321 def p_param_type_4(p
):
9322 '''param_type : real_or_realtime '''
9324 print('param_type_4', list(p
))
9326 # { param_active_range = 0;
9327 # param_active_signed = true;
9328 # param_active_type = IVL_VT_REAL;
9333 def p_param_type_5(p
):
9334 '''param_type : atom2_type '''
9336 print('param_type_5', list(p
))
9338 # { param_active_range = make_range_from_width(p[1]);
9339 # param_active_signed = true;
9340 # param_active_type = IVL_VT_BOOL;
9345 def p_param_type_6(p
):
9346 '''param_type : TYPE_IDENTIFIER '''
9348 print('param_type_6', list(p
))
9350 # { pform_set_param_from_type(@1, p[1].type, p[1].text, param_active_range,
9351 # param_active_signed, param_active_type);
9352 # delete[]p[1].text;
9357 def p_parameter_assign_list_1(p
):
9358 '''parameter_assign_list : parameter_assign '''
9360 print('parameter_assign_list_1', list(p
))
9366 def p_parameter_assign_list_2(p
):
9367 '''parameter_assign_list : parameter_assign_list ',' parameter_assign '''
9369 print('parameter_assign_list_2', list(p
))
9375 def p_localparam_assign_list_1(p
):
9376 '''localparam_assign_list : localparam_assign '''
9378 print('localparam_assign_list_1', list(p
))
9384 def p_localparam_assign_list_2(p
):
9385 '''localparam_assign_list : localparam_assign_list ',' localparam_assign '''
9387 print('localparam_assign_list_2', list(p
))
9393 def p_parameter_assign_1(p
):
9394 '''parameter_assign : IDENTIFIER '=' expression parameter_value_ranges_opt '''
9396 print('parameter_assign_1', list(p
))
9397 tpname
= Node(syms
.tname
, [Leaf(token
.NAME
, p
[1])])
9398 expr
= Node(syms
.tfpdef
, [tpname
, Leaf(token
.EQUAL
, p
[2]), p
[3]])
9401 # { PExpr*tmp = p[3];
9402 # pform_set_parameter(@1, lex_strings.make(p[1]), param_active_type,
9403 # param_active_signed, param_active_range, tmp, p[4]);
9409 def p_localparam_assign_1(p
):
9410 '''localparam_assign : IDENTIFIER '=' expression '''
9412 print('localparam_assign_1', list(p
))
9414 # { PExpr*tmp = p[3];
9415 # pform_set_localparam(@1, lex_strings.make(p[1]), param_active_type,
9416 # param_active_signed, param_active_range, tmp);
9422 def p_parameter_value_ranges_opt_1(p
):
9423 '''parameter_value_ranges_opt : parameter_value_ranges '''
9425 print('parameter_value_ranges_opt_1', list(p
))
9432 def p_parameter_value_ranges_opt_2(p
):
9433 '''parameter_value_ranges_opt : '''
9435 print('parameter_value_ranges_opt_2', list(p
))
9441 def p_parameter_value_ranges_1(p
):
9442 '''parameter_value_ranges : parameter_value_ranges parameter_value_range '''
9444 print('parameter_value_ranges_1', list(p
))
9446 # { p[0] = p[2]; p[0]->next = p[1]; }
9450 def p_parameter_value_ranges_2(p
):
9451 '''parameter_value_ranges : parameter_value_range '''
9453 print('parameter_value_ranges_2', list(p
))
9455 # { p[0] = p[1]; p[0]->next = 0; }
9459 def p_parameter_value_range_1(p
):
9460 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ']' '''
9462 print('parameter_value_range_1', list(p
))
9464 # { p[0] = pform_parameter_value_range(p[1], false, p[3], false, p[5]); }
9468 def p_parameter_value_range_2(p
):
9469 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ')' '''
9471 print('parameter_value_range_2', list(p
))
9473 # { p[0] = pform_parameter_value_range(p[1], false, p[3], true, p[5]); }
9477 def p_parameter_value_range_3(p
):
9478 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ']' '''
9480 print('parameter_value_range_3', list(p
))
9482 # { p[0] = pform_parameter_value_range(p[1], true, p[3], false, p[5]); }
9486 def p_parameter_value_range_4(p
):
9487 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ')' '''
9489 print('parameter_value_range_4', list(p
))
9491 # { p[0] = pform_parameter_value_range(p[1], true, p[3], true, p[5]); }
9495 def p_parameter_value_range_5(p
):
9496 '''parameter_value_range : K_exclude expression '''
9498 print('parameter_value_range_5', list(p
))
9500 # { p[0] = pform_parameter_value_range(true, false, p[2], false, p[2]); }
9504 def p_value_range_expression_1(p
):
9505 '''value_range_expression : expression '''
9507 print('value_range_expression_1', list(p
))
9514 def p_value_range_expression_2(p
):
9515 '''value_range_expression : K_inf '''
9517 print('value_range_expression_2', list(p
))
9523 def p_value_range_expression_3(p
):
9524 '''value_range_expression : '+' K_inf '''
9526 print('value_range_expression_3', list(p
))
9532 def p_value_range_expression_4(p
):
9533 '''value_range_expression : '-' K_inf '''
9535 print('value_range_expression_4', list(p
))
9541 def p_from_exclude_1(p
):
9542 '''from_exclude : K_from '''
9544 print('from_exclude_1', list(p
))
9551 def p_from_exclude_2(p
):
9552 '''from_exclude : K_exclude '''
9554 print('from_exclude_2', list(p
))
9561 def p_parameter_value_opt_1(p
):
9562 '''parameter_value_opt : '#' '(' expression_list_with_nuls ')' '''
9564 print('parameter_value_opt_1', list(p
))
9566 # { struct parmvalue_t*tmp = new struct parmvalue_t;
9567 # tmp->by_order = p[3];
9574 def p_parameter_value_opt_2(p
):
9575 '''parameter_value_opt : '#' '(' parameter_value_byname_list ')' '''
9577 print('parameter_value_opt_2', list(p
))
9579 # { struct parmvalue_t*tmp = new struct parmvalue_t;
9580 # tmp->by_order = 0;
9581 # tmp->by_name = p[3];
9587 def p_parameter_value_opt_3(p
):
9588 '''parameter_value_opt : '#' DEC_NUMBER '''
9590 print('parameter_value_opt_3', list(p
))
9593 # PENumber*tmp = new PENumber(p[2]);
9594 # FILE_NAME(tmp, @1);
9596 # struct parmvalue_t*lst = new struct parmvalue_t;
9597 # lst->by_order = new list<PExpr*>;
9598 # lst->by_order->push_back(tmp);
9606 def p_parameter_value_opt_4(p
):
9607 '''parameter_value_opt : '#' REALTIME '''
9609 print('parameter_value_opt_4', list(p
))
9612 # PEFNumber*tmp = new PEFNumber(p[2]);
9613 # FILE_NAME(tmp, @1);
9615 # struct parmvalue_t*lst = new struct parmvalue_t;
9616 # lst->by_order = new list<PExpr*>;
9617 # lst->by_order->push_back(tmp);
9624 def p_parameter_value_opt_5(p
):
9625 '''parameter_value_opt : '#' error '''
9627 print('parameter_value_opt_5', list(p
))
9629 # { yyerror(@1, "error: syntax error in parameter value "
9630 # "assignment list.");
9636 def p_parameter_value_opt_6(p
):
9637 '''parameter_value_opt : '''
9639 print('parameter_value_opt_6', list(p
))
9645 def p_parameter_value_byname_1(p
):
9646 '''parameter_value_byname : '.' IDENTIFIER '(' expression ')' '''
9648 print('parameter_value_byname_1', list(p
))
9650 # { named_pexpr_t*tmp = new named_pexpr_t;
9651 # tmp->name = lex_strings.make(p[2]);
9659 def p_parameter_value_byname_2(p
):
9660 '''parameter_value_byname : '.' IDENTIFIER '(' ')' '''
9662 print('parameter_value_byname_2', list(p
))
9664 # { named_pexpr_t*tmp = new named_pexpr_t;
9665 # tmp->name = lex_strings.make(p[2]);
9673 def p_parameter_value_byname_list_1(p
):
9674 '''parameter_value_byname_list : parameter_value_byname '''
9676 print('parameter_value_byname_list_1', list(p
))
9678 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
9679 # tmp->push_back(*p[1]);
9686 def p_parameter_value_byname_list_2(p
):
9687 '''parameter_value_byname_list : parameter_value_byname_list ',' parameter_value_byname '''
9689 print('parameter_value_byname_list_2', list(p
))
9691 # { list<named_pexpr_t>*tmp = p[1];
9692 # tmp->push_back(*p[3]);
9700 '''port : port_reference '''
9702 print('port_1', list(p
))
9710 '''port : '.' IDENTIFIER '(' port_reference ')' '''
9712 print('port_2', list(p
))
9714 # { Module::port_t*tmp = p[4];
9715 # tmp->name = lex_strings.make(p[2]);
9723 '''port : '{' port_reference_list '}' '''
9725 print('port_3', list(p
))
9727 # { Module::port_t*tmp = p[2];
9728 # tmp->name = perm_string();
9735 '''port : '.' IDENTIFIER '(' '{' port_reference_list '}' ')' '''
9737 print('port_4', list(p
))
9739 # { Module::port_t*tmp = p[5];
9740 # tmp->name = lex_strings.make(p[2]);
9747 def p_port_opt_1(p
):
9748 '''port_opt : port '''
9750 print('port_opt_1', list(p
))
9757 def p_port_opt_2(p
):
9760 print('port_opt_2', list(p
))
9766 def p_port_name_1(p
):
9767 '''port_name : '.' IDENTIFIER '(' expression ')' '''
9769 print('port_name_1', list(p
))
9771 # { named_pexpr_t*tmp = new named_pexpr_t;
9772 # tmp->name = lex_strings.make(p[2]);
9780 def p_port_name_2(p
):
9781 '''port_name : '.' IDENTIFIER '(' error ')' '''
9783 print('port_name_2', list(p
))
9785 # { yyerror(@3, "error: invalid port connection expression.");
9786 # named_pexpr_t*tmp = new named_pexpr_t;
9787 # tmp->name = lex_strings.make(p[2]);
9795 def p_port_name_3(p
):
9796 '''port_name : '.' IDENTIFIER '(' ')' '''
9798 print('port_name_3', list(p
))
9800 # { named_pexpr_t*tmp = new named_pexpr_t;
9801 # tmp->name = lex_strings.make(p[2]);
9809 def p_port_name_4(p
):
9810 '''port_name : '.' IDENTIFIER '''
9812 print('port_name_4', list(p
))
9814 # { named_pexpr_t*tmp = new named_pexpr_t;
9815 # tmp->name = lex_strings.make(p[2]);
9816 # tmp->parm = new PEIdent(lex_strings.make(p[2]), true);
9817 # FILE_NAME(tmp->parm, @1);
9824 def p_port_name_5(p
):
9825 '''port_name : K_DOTSTAR '''
9827 print('port_name_5', list(p
))
9829 # { named_pexpr_t*tmp = new named_pexpr_t;
9830 # tmp->name = lex_strings.make("*");
9837 def p_port_name_list_1(p
):
9838 '''port_name_list : port_name_list ',' port_name '''
9840 print('port_name_list_1', list(p
))
9842 # { list<named_pexpr_t>*tmp = p[1];
9843 # tmp->push_back(*p[3]);
9850 def p_port_name_list_2(p
):
9851 '''port_name_list : port_name '''
9853 print('port_name_list_2', list(p
))
9855 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
9856 # tmp->push_back(*p[1]);
9863 def p_port_reference_1(p
):
9864 '''port_reference : IDENTIFIER '''
9866 print('port_reference_1', list(p
))
9868 # { Module::port_t*ptmp;
9869 # perm_string name = lex_strings.make(p[1]);
9870 # ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
9877 def p_port_reference_2(p
):
9878 '''port_reference : IDENTIFIER '[' expression ':' expression ']' '''
9880 print('port_reference_2', list(p
))
9882 # { index_component_t itmp;
9883 # itmp.sel = index_component_t::SEL_PART;
9887 # name_component_t ntmp (lex_strings.make(p[1]));
9888 # ntmp.index.push_back(itmp);
9890 # pform_name_t pname;
9891 # pname.push_back(ntmp);
9893 # PEIdent*wtmp = new PEIdent(pname);
9894 # FILE_NAME(wtmp, @1);
9896 # Module::port_t*ptmp = new Module::port_t;
9897 # ptmp->name = perm_string();
9898 # ptmp->expr.push_back(wtmp);
9906 def p_port_reference_3(p
):
9907 '''port_reference : IDENTIFIER '[' expression ']' '''
9909 print('port_reference_3', list(p
))
9911 # { index_component_t itmp;
9912 # itmp.sel = index_component_t::SEL_BIT;
9916 # name_component_t ntmp (lex_strings.make(p[1]));
9917 # ntmp.index.push_back(itmp);
9919 # pform_name_t pname;
9920 # pname.push_back(ntmp);
9922 # PEIdent*tmp = new PEIdent(pname);
9923 # FILE_NAME(tmp, @1);
9925 # Module::port_t*ptmp = new Module::port_t;
9926 # ptmp->name = perm_string();
9927 # ptmp->expr.push_back(tmp);
9934 def p_port_reference_4(p
):
9935 '''port_reference : IDENTIFIER '[' error ']' '''
9937 print('port_reference_4', list(p
))
9939 # { yyerror(@1, "error: invalid port bit select");
9940 # Module::port_t*ptmp = new Module::port_t;
9941 # PEIdent*wtmp = new PEIdent(lex_strings.make(p[1]));
9942 # FILE_NAME(wtmp, @1);
9943 # ptmp->name = lex_strings.make(p[1]);
9944 # ptmp->expr.push_back(wtmp);
9951 def p_port_reference_list_1(p
):
9952 '''port_reference_list : port_reference '''
9954 print('port_reference_list_1', list(p
))
9961 def p_port_reference_list_2(p
):
9962 '''port_reference_list : port_reference_list ',' port_reference '''
9964 print('port_reference_list_2', list(p
))
9966 # { Module::port_t*tmp = p[1];
9967 # append(tmp->expr, p[3]->expr);
9974 def p_dimensions_opt_1(p
):
9975 '''dimensions_opt : '''
9976 if(parse_debug
> 2):
9977 print('dimensions_opt_1', list(p
))
9983 def p_dimensions_opt_2(p
):
9984 '''dimensions_opt : dimensions '''
9986 print('dimensions_opt_2', list(p
))
9993 def p_dimensions_1(p
):
9994 '''dimensions : variable_dimension '''
9996 print('dimensions_1', list(p
))
10003 def p_dimensions_2(p
):
10004 '''dimensions : dimensions variable_dimension '''
10006 print('dimensions_2', list(p
))
10008 # { list<pform_range_t> *tmp = p[1];
10010 # tmp->splice(tmp->end(), *p[2]);
10018 def p_register_variable_1(p
):
10019 '''register_variable : IDENTIFIER dimensions_opt '''
10021 print('register_variable_1', list(p
))
10023 # { perm_string name = lex_strings.make(p[1]);
10024 # pform_makewire(@1, name, NetNet::REG,
10025 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10026 # pform_set_reg_idx(name, p[2]);
10032 def p_register_variable_2(p
):
10033 '''register_variable : IDENTIFIER dimensions_opt '=' expression '''
10035 print('register_variable_2', list(p
))
10037 # { if (pform_peek_scope()->var_init_needs_explicit_lifetime()
10038 # && (var_lifetime == LexicalScope::INHERITED)) {
10039 # cerr << @3 << ": warning: Static variable initialization requires "
10040 # "explicit lifetime in this context." << endl;
10043 # perm_string name = lex_strings.make(p[1]);
10044 # pform_makewire(@1, name, NetNet::REG,
10045 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10046 # pform_set_reg_idx(name, p[2]);
10047 # pform_make_var_init(@1, name, p[4]);
10053 def p_register_variable_list_1(p
):
10054 '''register_variable_list : register_variable '''
10056 print('register_variable_list_1', list(p
))
10058 # { list<perm_string>*tmp = new list<perm_string>;
10059 # tmp->push_back(lex_strings.make(p[1]));
10066 def p_register_variable_list_2(p
):
10067 '''register_variable_list : register_variable_list ',' register_variable '''
10069 print('register_variable_list_2', list(p
))
10071 # { list<perm_string>*tmp = p[1];
10072 # tmp->push_back(lex_strings.make(p[3]));
10079 def p_net_variable_1(p
):
10080 '''net_variable : IDENTIFIER dimensions_opt '''
10082 print('net_variable_1', list(p
))
10084 # { perm_string name = lex_strings.make(p[1]);
10085 # pform_makewire(@1, name, NetNet::IMPLICIT,
10086 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10087 # pform_set_reg_idx(name, p[2]);
10093 def p_net_variable_list_1(p
):
10094 '''net_variable_list : net_variable '''
10096 print('net_variable_list_1', list(p
))
10098 # { list<perm_string>*tmp = new list<perm_string>;
10099 # tmp->push_back(lex_strings.make(p[1]));
10106 def p_net_variable_list_2(p
):
10107 '''net_variable_list : net_variable_list ',' net_variable '''
10109 print('net_variable_list_2', list(p
))
10111 # { list<perm_string>*tmp = p[1];
10112 # tmp->push_back(lex_strings.make(p[3]));
10119 def p_event_variable_1(p
):
10120 '''event_variable : IDENTIFIER dimensions_opt '''
10122 print('event_variable_1', list(p
))
10125 # yyerror(@2, "sorry: event arrays are not supported.");
10133 def p_event_variable_list_1(p
):
10134 '''event_variable_list : event_variable '''
10136 print('event_variable_list_1', list(p
))
10138 # { p[0] = list_from_identifier(p[1]); }
10142 def p_event_variable_list_2(p
):
10143 '''event_variable_list : event_variable_list ',' event_variable '''
10145 print('event_variable_list_2', list(p
))
10147 # { p[0] = list_from_identifier(p[1], p[3]); }
10151 def p_specify_item_1(p
):
10152 '''specify_item : K_specparam specparam_decl ';' '''
10154 print('specify_item_1', list(p
))
10160 def p_specify_item_2(p
):
10161 '''specify_item : specify_simple_path_decl ';' '''
10163 print('specify_item_2', list(p
))
10165 # { pform_module_specify_path(p[1]);
10170 def p_specify_item_3(p
):
10171 '''specify_item : specify_edge_path_decl ';' '''
10173 print('specify_item_3', list(p
))
10175 # { pform_module_specify_path(p[1]);
10180 def p_specify_item_4(p
):
10181 '''specify_item : K_if '(' expression ')' specify_simple_path_decl ';' '''
10183 print('specify_item_4', list(p
))
10185 # { PSpecPath*tmp = p[5];
10187 # tmp->conditional = true;
10188 # tmp->condition = p[3];
10190 # pform_module_specify_path(tmp);
10195 def p_specify_item_5(p
):
10196 '''specify_item : K_if '(' expression ')' specify_edge_path_decl ';' '''
10198 print('specify_item_5', list(p
))
10200 # { PSpecPath*tmp = p[5];
10202 # tmp->conditional = true;
10203 # tmp->condition = p[3];
10205 # pform_module_specify_path(tmp);
10210 def p_specify_item_6(p
):
10211 '''specify_item : K_ifnone specify_simple_path_decl ';' '''
10213 print('specify_item_6', list(p
))
10215 # { PSpecPath*tmp = p[2];
10217 # tmp->conditional = true;
10218 # tmp->condition = 0;
10220 # pform_module_specify_path(tmp);
10225 def p_specify_item_7(p
):
10226 '''specify_item : K_ifnone specify_edge_path_decl ';' '''
10228 print('specify_item_7', list(p
))
10230 # { yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
10231 # "not supported.");
10237 def p_specify_item_8(p
):
10238 '''specify_item : K_Sfullskew '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10240 print('specify_item_8', list(p
))
10248 def p_specify_item_9(p
):
10249 '''specify_item : K_Shold '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10251 print('specify_item_9', list(p
))
10258 def p_specify_item_10(p
):
10259 '''specify_item : K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10261 print('specify_item_10', list(p
))
10269 def p_specify_item_11(p
):
10270 '''specify_item : K_Speriod '(' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10272 print('specify_item_11', list(p
))
10279 def p_specify_item_12(p
):
10280 '''specify_item : K_Srecovery '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10282 print('specify_item_12', list(p
))
10289 def p_specify_item_13(p
):
10290 '''specify_item : K_Srecrem '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10292 print('specify_item_13', list(p
))
10300 def p_specify_item_14(p
):
10301 '''specify_item : K_Sremoval '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10303 print('specify_item_14', list(p
))
10310 def p_specify_item_15(p
):
10311 '''specify_item : K_Ssetup '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10313 print('specify_item_15', list(p
))
10320 def p_specify_item_16(p
):
10321 '''specify_item : K_Ssetuphold '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10323 print('specify_item_16', list(p
))
10331 def p_specify_item_17(p
):
10332 '''specify_item : K_Sskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10334 print('specify_item_17', list(p
))
10341 def p_specify_item_18(p
):
10342 '''specify_item : K_Stimeskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10344 print('specify_item_18', list(p
))
10351 def p_specify_item_19(p
):
10352 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ',' expression spec_notifier_opt ')' ';' '''
10354 print('specify_item_19', list(p
))
10362 def p_specify_item_20(p
):
10363 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ')' ';' '''
10365 print('specify_item_20', list(p
))
10372 def p_specify_item_21(p
):
10373 '''specify_item : K_pulsestyle_onevent specify_path_identifiers ';' '''
10375 print('specify_item_21', list(p
))
10382 def p_specify_item_22(p
):
10383 '''specify_item : K_pulsestyle_ondetect specify_path_identifiers ';' '''
10385 print('specify_item_22', list(p
))
10392 def p_specify_item_23(p
):
10393 '''specify_item : K_showcancelled specify_path_identifiers ';' '''
10395 print('specify_item_23', list(p
))
10402 def p_specify_item_24(p
):
10403 '''specify_item : K_noshowcancelled specify_path_identifiers ';' '''
10405 print('specify_item_24', list(p
))
10412 def p_specify_item_list_1(p
):
10413 '''specify_item_list : specify_item '''
10415 print('specify_item_list_1', list(p
))
10421 def p_specify_item_list_2(p
):
10422 '''specify_item_list : specify_item_list specify_item '''
10424 print('specify_item_list_2', list(p
))
10430 def p_specify_item_list_opt_1(p
):
10431 '''specify_item_list_opt : '''
10433 print('specify_item_list_opt_1', list(p
))
10439 def p_specify_item_list_opt_2(p
):
10440 '''specify_item_list_opt : specify_item_list '''
10442 print('specify_item_list_opt_2', list(p
))
10448 def p_specify_edge_path_decl_1(p
):
10449 '''specify_edge_path_decl : specify_edge_path '=' '(' delay_value_list ')' '''
10451 print('specify_edge_path_decl_1', list(p
))
10453 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
10457 def p_specify_edge_path_decl_2(p
):
10458 '''specify_edge_path_decl : specify_edge_path '=' delay_value_simple '''
10460 print('specify_edge_path_decl_2', list(p
))
10462 # { list<PExpr*>*tmp = new list<PExpr*>;
10463 # tmp->push_back(p[3]);
10464 # p[0] = pform_assign_path_delay(p[1], tmp);
10469 def p_edge_operator_1(p
):
10470 '''edge_operator : K_posedge '''
10472 print('edge_operator_1', list(p
))
10479 def p_edge_operator_2(p
):
10480 '''edge_operator : K_negedge '''
10482 print('edge_operator_2', list(p
))
10489 def p_specify_edge_path_1(p
):
10490 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10492 print('specify_edge_path_1', list(p
))
10494 # { int edge_flag = 0;
10495 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], false, p[6], p[8]); }
10499 def p_specify_edge_path_2(p
):
10500 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10502 print('specify_edge_path_2', list(p
))
10504 # { int edge_flag = p[2]? 1 : -1;
10505 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], false, p[7], p[9]);}
10509 def p_specify_edge_path_3(p
):
10510 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10512 print('specify_edge_path_3', list(p
))
10514 # { int edge_flag = 0;
10515 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], true, p[6], p[8]); }
10519 def p_specify_edge_path_4(p
):
10520 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10522 print('specify_edge_path_4', list(p
))
10524 # { int edge_flag = p[2]? 1 : -1;
10525 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], true, p[7], p[9]); }
10529 def p_polarity_operator_1(p
):
10530 '''polarity_operator : K_PO_POS '''
10532 print('polarity_operator_1', list(p
))
10538 def p_polarity_operator_2(p
):
10539 '''polarity_operator : K_PO_NEG '''
10541 print('polarity_operator_2', list(p
))
10547 def p_polarity_operator_3(p
):
10548 '''polarity_operator : ':' '''
10550 print('polarity_operator_3', list(p
))
10556 def p_specify_simple_path_decl_1(p
):
10557 '''specify_simple_path_decl : specify_simple_path '=' '(' delay_value_list ')' '''
10559 print('specify_simple_path_decl_1', list(p
))
10561 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
10565 def p_specify_simple_path_decl_2(p
):
10566 '''specify_simple_path_decl : specify_simple_path '=' delay_value_simple '''
10568 print('specify_simple_path_decl_2', list(p
))
10570 # { list<PExpr*>*tmp = new list<PExpr*>;
10571 # tmp->push_back(p[3]);
10572 # p[0] = pform_assign_path_delay(p[1], tmp);
10577 def p_specify_simple_path_decl_3(p
):
10578 '''specify_simple_path_decl : specify_simple_path '=' '(' error ')' '''
10580 print('specify_simple_path_decl_3', list(p
))
10582 # { yyerror(@3, "Syntax error in delay value list.");
10589 def p_specify_simple_path_1(p
):
10590 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' '''
10592 print('specify_simple_path_1', list(p
))
10594 # { p[0] = pform_make_specify_path(@1, p[2], p[3], false, p[5]); }
10598 def p_specify_simple_path_2(p
):
10599 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' '''
10601 print('specify_simple_path_2', list(p
))
10603 # { p[0] = pform_make_specify_path(@1, p[2], p[3], true, p[5]); }
10607 def p_specify_simple_path_3(p
):
10608 '''specify_simple_path : '(' error ')' '''
10610 print('specify_simple_path_3', list(p
))
10612 # { yyerror(@1, "Invalid simple path");
10618 def p_specify_path_identifiers_1(p
):
10619 '''specify_path_identifiers : IDENTIFIER '''
10621 print('specify_path_identifiers_1', list(p
))
10623 # { list<perm_string>*tmp = new list<perm_string>;
10624 # tmp->push_back(lex_strings.make(p[1]));
10631 def p_specify_path_identifiers_2(p
):
10632 '''specify_path_identifiers : IDENTIFIER '[' expr_primary ']' '''
10634 print('specify_path_identifiers_2', list(p
))
10636 # { if (gn_specify_blocks_flag) {
10637 # yywarn(@4, "Bit selects are not currently supported "
10638 # "in path declarations. The declaration "
10639 # "will be applied to the whole vector.");
10641 # list<perm_string>*tmp = new list<perm_string>;
10642 # tmp->push_back(lex_strings.make(p[1]));
10649 def p_specify_path_identifiers_3(p
):
10650 '''specify_path_identifiers : IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
10652 print('specify_path_identifiers_3', list(p
))
10654 # { if (gn_specify_blocks_flag) {
10655 # yywarn(@4, "Part selects are not currently supported "
10656 # "in path declarations. The declaration "
10657 # "will be applied to the whole vector.");
10659 # list<perm_string>*tmp = new list<perm_string>;
10660 # tmp->push_back(lex_strings.make(p[1]));
10667 def p_specify_path_identifiers_4(p
):
10668 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '''
10670 print('specify_path_identifiers_4', list(p
))
10672 # { list<perm_string>*tmp = p[1];
10673 # tmp->push_back(lex_strings.make(p[3]));
10680 def p_specify_path_identifiers_5(p
):
10681 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' '''
10683 print('specify_path_identifiers_5', list(p
))
10685 # { if (gn_specify_blocks_flag) {
10686 # yywarn(@4, "Bit selects are not currently supported "
10687 # "in path declarations. The declaration "
10688 # "will be applied to the whole vector.");
10690 # list<perm_string>*tmp = p[1];
10691 # tmp->push_back(lex_strings.make(p[3]));
10698 def p_specify_path_identifiers_6(p
):
10699 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
10701 print('specify_path_identifiers_6', list(p
))
10703 # { if (gn_specify_blocks_flag) {
10704 # yywarn(@4, "Part selects are not currently supported "
10705 # "in path declarations. The declaration "
10706 # "will be applied to the whole vector.");
10708 # list<perm_string>*tmp = p[1];
10709 # tmp->push_back(lex_strings.make(p[3]));
10716 def p_specparam_1(p
):
10717 '''specparam : IDENTIFIER '=' expression '''
10719 print('specparam_1', list(p
))
10721 # { PExpr*tmp = p[3];
10722 # pform_set_specparam(@1, lex_strings.make(p[1]),
10723 # param_active_range, tmp);
10729 def p_specparam_2(p
):
10730 '''specparam : IDENTIFIER '=' expression ':' expression ':' expression '''
10732 print('specparam_2', list(p
))
10735 # switch (min_typ_max_flag) {
10752 # if (min_typ_max_warn > 0) {
10753 # cerr << tmp->get_fileline() << ": warning: choosing ";
10754 # switch (min_typ_max_flag) {
10765 # cerr << " expression." << endl;
10766 # min_typ_max_warn -= 1;
10768 # pform_set_specparam(@1, lex_strings.make(p[1]),
10769 # param_active_range, tmp);
10775 def p_specparam_3(p
):
10776 '''specparam : PATHPULSE_IDENTIFIER '=' expression '''
10778 print('specparam_3', list(p
))
10786 def p_specparam_4(p
):
10787 '''specparam : PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' '''
10789 print('specparam_4', list(p
))
10798 def p_specparam_list_1(p
):
10799 '''specparam_list : specparam '''
10801 print('specparam_list_1', list(p
))
10807 def p_specparam_list_2(p
):
10808 '''specparam_list : specparam_list ',' specparam '''
10810 print('specparam_list_2', list(p
))
10816 def p_specparam_decl_1(p
):
10817 '''specparam_decl : specparam_list '''
10819 print('specparam_decl_1', list(p
))
10825 def p_specparam_decl_2(p
):
10826 '''specparam_decl : dimensions _embed0_specparam_decl specparam_list '''
10828 print('specparam_decl_2', list(p
))
10830 # { param_active_range = 0; }
10834 def p__embed0_specparam_decl(p
):
10835 '''_embed0_specparam_decl : '''
10837 # { param_active_range = p[1]; }
10841 def p_spec_polarity_1(p
):
10842 '''spec_polarity : '+' '''
10844 print('spec_polarity_1', list(p
))
10850 def p_spec_polarity_2(p
):
10851 '''spec_polarity : '-' '''
10853 print('spec_polarity_2', list(p
))
10859 def p_spec_polarity_3(p
):
10860 '''spec_polarity : '''
10862 print('spec_polarity_3', list(p
))
10868 def p_spec_reference_event_1(p
):
10869 '''spec_reference_event : K_posedge expression '''
10871 print('spec_reference_event_1', list(p
))
10877 def p_spec_reference_event_2(p
):
10878 '''spec_reference_event : K_negedge expression '''
10880 print('spec_reference_event_2', list(p
))
10886 def p_spec_reference_event_3(p
):
10887 '''spec_reference_event : K_posedge expr_primary K_TAND expression '''
10889 print('spec_reference_event_3', list(p
))
10897 def p_spec_reference_event_4(p
):
10898 '''spec_reference_event : K_negedge expr_primary K_TAND expression '''
10900 print('spec_reference_event_4', list(p
))
10908 def p_spec_reference_event_5(p
):
10909 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary '''
10911 print('spec_reference_event_5', list(p
))
10917 def p_spec_reference_event_6(p
):
10918 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression '''
10920 print('spec_reference_event_6', list(p
))
10928 def p_spec_reference_event_7(p
):
10929 '''spec_reference_event : expr_primary K_TAND expression '''
10931 print('spec_reference_event_7', list(p
))
10939 def p_spec_reference_event_8(p
):
10940 '''spec_reference_event : expr_primary '''
10942 print('spec_reference_event_8', list(p
))
10948 def p_edge_descriptor_list_1(p
):
10949 '''edge_descriptor_list : edge_descriptor_list ',' K_edge_descriptor '''
10951 print('edge_descriptor_list_1', list(p
))
10957 def p_edge_descriptor_list_2(p
):
10958 '''edge_descriptor_list : K_edge_descriptor '''
10960 print('edge_descriptor_list_2', list(p
))
10966 def p_spec_notifier_opt_1(p
):
10967 '''spec_notifier_opt : '''
10969 print('spec_notifier_opt_1', list(p
))
10975 def p_spec_notifier_opt_2(p
):
10976 '''spec_notifier_opt : spec_notifier '''
10978 print('spec_notifier_opt_2', list(p
))
10984 def p_spec_notifier_1(p
):
10985 '''spec_notifier : ',' '''
10987 print('spec_notifier_1', list(p
))
10989 # { args_after_notifier = 0; }
10993 def p_spec_notifier_2(p
):
10994 '''spec_notifier : ',' hierarchy_identifier '''
10996 print('spec_notifier_2', list(p
))
10998 # { args_after_notifier = 0; delete p[2]; }
11002 def p_spec_notifier_3(p
):
11003 '''spec_notifier : spec_notifier ',' '''
11005 print('spec_notifier_3', list(p
))
11007 # { args_after_notifier += 1; }
11011 def p_spec_notifier_4(p
):
11012 '''spec_notifier : spec_notifier ',' hierarchy_identifier '''
11014 print('spec_notifier_4', list(p
))
11016 # { args_after_notifier += 1;
11017 # if (args_after_notifier >= 3) {
11018 # cerr << @3 << ": warning: timing checks are not supported "
11019 # "and delayed signal \"" << *p[3]
11020 # << "\" will not be driven." << endl;
11026 def p_spec_notifier_5(p
):
11027 '''spec_notifier : IDENTIFIER '''
11029 print('spec_notifier_5', list(p
))
11031 # { args_after_notifier = 0; delete[]p[1]; }
11035 def p_statement_item_1(p
):
11036 '''statement_item : K_assign lpvalue '=' expression ';' '''
11038 print('statement_item_1', list(p
))
11040 # { PCAssign*tmp = new PCAssign(p[2], p[4]);
11041 # FILE_NAME(tmp, @1);
11047 def p_statement_item_2(p
):
11048 '''statement_item : K_deassign lpvalue ';' '''
11050 print('statement_item_2', list(p
))
11052 # { PDeassign*tmp = new PDeassign(p[2]);
11053 # FILE_NAME(tmp, @1);
11059 def p_statement_item_3(p
):
11060 '''statement_item : K_force lpvalue '=' expression ';' '''
11062 print('statement_item_3', list(p
))
11064 # { PForce*tmp = new PForce(p[2], p[4]);
11065 # FILE_NAME(tmp, @1);
11071 def p_statement_item_4(p
):
11072 '''statement_item : K_release lpvalue ';' '''
11074 print('statement_item_4', list(p
))
11076 # { PRelease*tmp = new PRelease(p[2]);
11077 # FILE_NAME(tmp, @1);
11083 def p_statement_item_5(p
):
11084 '''statement_item : K_begin K_end '''
11086 print('statement_item_5', list(p
))
11088 # { PBlock*tmp = new PBlock(PBlock::BL_SEQ);
11089 # FILE_NAME(tmp, @1);
11095 def p_statement_item_6(p
):
11096 '''statement_item : K_begin _embed0_statement_item block_item_decls_opt _embed1_statement_item statement_or_null_list K_end '''
11098 print('statement_item_6', list(p
))
11102 # pform_pop_scope();
11103 # assert(! current_block_stack.empty());
11104 # tmp = current_block_stack.top();
11105 # current_block_stack.pop();
11107 # tmp = new PBlock(PBlock::BL_SEQ);
11108 # FILE_NAME(tmp, @1);
11110 # if (p[5]) tmp->set_statement(*p[5]);
11117 def p_statement_item_7(p
):
11118 '''statement_item : K_begin ':' IDENTIFIER _embed2_statement_item block_item_decls_opt statement_or_null_list_opt K_end endlabel_opt '''
11120 print('statement_item_7', list(p
))
11122 # { pform_pop_scope();
11123 # assert(! current_block_stack.empty());
11124 # PBlock*tmp = current_block_stack.top();
11125 # current_block_stack.pop();
11126 # if (p[6]) tmp->set_statement(*p[6]);
11129 # if (strcmp(p[3],p[8]) != 0) {
11130 # yyerror(@8, "error: End label doesn't match begin name");
11132 # if (! gn_system_verilog()) {
11133 # yyerror(@8, "error: Begin end labels require "
11134 # "SystemVerilog.");
11144 def p_statement_item_8(p
):
11145 '''statement_item : K_fork join_keyword '''
11147 print('statement_item_8', list(p
))
11149 # { PBlock*tmp = new PBlock(p[2]);
11150 # FILE_NAME(tmp, @1);
11156 def p_statement_item_9(p
):
11157 '''statement_item : K_fork _embed3_statement_item block_item_decls_opt _embed4_statement_item statement_or_null_list join_keyword '''
11159 print('statement_item_9', list(p
))
11163 # pform_pop_scope();
11164 # assert(! current_block_stack.empty());
11165 # tmp = current_block_stack.top();
11166 # current_block_stack.pop();
11167 # tmp->set_join_type(p[6]);
11169 # tmp = new PBlock(p[6]);
11170 # FILE_NAME(tmp, @1);
11172 # if (p[5]) tmp->set_statement(*p[5]);
11179 def p_statement_item_10(p
):
11180 '''statement_item : K_fork ':' IDENTIFIER _embed5_statement_item block_item_decls_opt statement_or_null_list_opt join_keyword endlabel_opt '''
11182 print('statement_item_10', list(p
))
11184 # { pform_pop_scope();
11185 # assert(! current_block_stack.empty());
11186 # PBlock*tmp = current_block_stack.top();
11187 # current_block_stack.pop();
11188 # tmp->set_join_type(p[7]);
11189 # if (p[6]) tmp->set_statement(*p[6]);
11192 # if (strcmp(p[3],p[8]) != 0) {
11193 # yyerror(@8, "error: End label doesn't match fork name");
11195 # if (! gn_system_verilog()) {
11196 # yyerror(@8, "error: Fork end labels require "
11197 # "SystemVerilog.");
11207 def p_statement_item_11(p
):
11208 '''statement_item : K_disable hierarchy_identifier ';' '''
11210 print('statement_item_11', list(p
))
11212 # { PDisable*tmp = new PDisable(*p[2]);
11213 # FILE_NAME(tmp, @1);
11220 def p_statement_item_12(p
):
11221 '''statement_item : K_disable K_fork ';' '''
11223 print('statement_item_12', list(p
))
11225 # { pform_name_t tmp_name;
11226 # PDisable*tmp = new PDisable(tmp_name);
11227 # FILE_NAME(tmp, @1);
11233 def p_statement_item_13(p
):
11234 '''statement_item : K_TRIGGER hierarchy_identifier ';' '''
11236 print('statement_item_13', list(p
))
11238 # { PTrigger*tmp = new PTrigger(*p[2]);
11239 # FILE_NAME(tmp, @1);
11246 def p_statement_item_14(p
):
11247 '''statement_item : procedural_assertion_statement '''
11249 print('statement_item_14', list(p
))
11256 def p_statement_item_15(p
):
11257 '''statement_item : loop_statement '''
11259 print('statement_item_15', list(p
))
11266 def p_statement_item_16(p
):
11267 '''statement_item : jump_statement '''
11269 print('statement_item_16', list(p
))
11276 def p_statement_item_17(p
):
11277 '''statement_item : K_case '(' expression ')' case_items K_endcase '''
11279 print('statement_item_17', list(p
))
11281 # { PCase*tmp = new PCase(NetCase::EQ, p[3], p[5]);
11282 # FILE_NAME(tmp, @1);
11288 def p_statement_item_18(p
):
11289 '''statement_item : K_casex '(' expression ')' case_items K_endcase '''
11291 print('statement_item_18', list(p
))
11293 # { PCase*tmp = new PCase(NetCase::EQX, p[3], p[5]);
11294 # FILE_NAME(tmp, @1);
11300 def p_statement_item_19(p
):
11301 '''statement_item : K_casez '(' expression ')' case_items K_endcase '''
11303 print('statement_item_19', list(p
))
11305 # { PCase*tmp = new PCase(NetCase::EQZ, p[3], p[5]);
11306 # FILE_NAME(tmp, @1);
11312 def p_statement_item_20(p
):
11313 '''statement_item : K_case '(' expression ')' error K_endcase '''
11315 print('statement_item_20', list(p
))
11321 def p_statement_item_21(p
):
11322 '''statement_item : K_casex '(' expression ')' error K_endcase '''
11324 print('statement_item_21', list(p
))
11330 def p_statement_item_22(p
):
11331 '''statement_item : K_casez '(' expression ')' error K_endcase '''
11333 print('statement_item_22', list(p
))
11339 def p_statement_item_23(p
):
11340 '''statement_item : K_if '(' expression ')' statement_or_null %prec less_than_K_else '''
11342 print('statement_item_23', list(p
))
11344 # { PCondit*tmp = new PCondit(p[3], p[5], 0);
11345 # FILE_NAME(tmp, @1);
11351 def p_statement_item_24(p
):
11352 '''statement_item : K_if '(' expression ')' statement_or_null K_else statement_or_null '''
11354 print('statement_item_24', list(p
))
11356 # { PCondit*tmp = new PCondit(p[3], p[5], p[7]);
11357 # FILE_NAME(tmp, @1);
11363 def p_statement_item_25(p
):
11364 '''statement_item : K_if '(' error ')' statement_or_null %prec less_than_K_else '''
11366 print('statement_item_25', list(p
))
11368 # { yyerror(@1, "error: Malformed conditional expression.");
11374 def p_statement_item_26(p
):
11375 '''statement_item : K_if '(' error ')' statement_or_null K_else statement_or_null '''
11377 print('statement_item_26', list(p
))
11379 # { yyerror(@1, "error: Malformed conditional expression.");
11385 def p_statement_item_27(p
):
11386 '''statement_item : compressed_statement ';' '''
11388 print('statement_item_27', list(p
))
11395 def p_statement_item_28(p
):
11396 '''statement_item : inc_or_dec_expression ';' '''
11398 print('statement_item_28', list(p
))
11400 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
11404 def p_statement_item_29(p
):
11405 '''statement_item : delay1 statement_or_null '''
11407 print('statement_item_29', list(p
))
11409 # { PExpr*del = p[1]->front();
11410 # assert(p[1]->size() == 1);
11412 # PDelayStatement*tmp = new PDelayStatement(del, p[2]);
11413 # FILE_NAME(tmp, @1);
11419 def p_statement_item_30(p
):
11420 '''statement_item : event_control statement_or_null '''
11422 print('statement_item_30', list(p
))
11424 # { PEventStatement*tmp = p[1];
11426 # yyerror(@1, "error: Invalid event control.");
11429 # tmp->set_statement(p[2]);
11436 def p_statement_item_31(p
):
11437 '''statement_item : '@' '*' statement_or_null '''
11439 print('statement_item_31', list(p
))
11441 # { PEventStatement*tmp = new PEventStatement;
11442 # FILE_NAME(tmp, @1);
11443 # tmp->set_statement(p[3]);
11449 def p_statement_item_32(p
):
11450 '''statement_item : '@' '(' '*' ')' statement_or_null '''
11452 print('statement_item_32', list(p
))
11454 # { PEventStatement*tmp = new PEventStatement;
11455 # FILE_NAME(tmp, @1);
11456 # tmp->set_statement(p[5]);
11462 def p_statement_item_33(p
):
11463 '''statement_item : lpvalue '=' expression ';' '''
11465 print('statement_item33', list(p
))
11467 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), p
[3]])
11469 print("expr TODO", repr(expr
))
11471 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), ])
11473 print("expr", repr(expr
))
11475 print("expr (python):'%s'" % expr
)
11478 # { PAssign*tmp = new PAssign(p[1],p[3]);
11479 # FILE_NAME(tmp, @1);
11485 def p_statement_item_34(p
):
11486 '''statement_item : error '=' expression ';' '''
11488 print('statement_item_34', list(p
))
11490 # { yyerror(@2, "Syntax in assignment statement l-value.");
11492 # p[0] = new PNoop;
11497 def p_statement_item_35(p
):
11498 '''statement_item : lpvalue K_LE expression ';' '''
11500 print('statement_item_35', list(p
))
11502 # { PAssignNB*tmp = new PAssignNB(p[1],p[3]);
11503 # FILE_NAME(tmp, @1);
11509 def p_statement_item_36(p
):
11510 '''statement_item : error K_LE expression ';' '''
11512 print('statement_item_36', list(p
))
11514 # { yyerror(@2, "Syntax in assignment statement l-value.");
11516 # p[0] = new PNoop;
11521 def p_statement_item_37(p
):
11522 '''statement_item : lpvalue '=' delay1 expression ';' '''
11524 print('statement_item_37', list(p
))
11526 # { PExpr*del = p[3]->front(); p[3]->pop_front();
11527 # assert(p[3]->empty());
11528 # PAssign*tmp = new PAssign(p[1],del,p[4]);
11529 # FILE_NAME(tmp, @1);
11535 def p_statement_item_38(p
):
11536 '''statement_item : lpvalue K_LE delay1 expression ';' '''
11538 print('statement_item_38', list(p
))
11540 # { PExpr*del = p[3]->front(); p[3]->pop_front();
11541 # assert(p[3]->empty());
11542 # PAssignNB*tmp = new PAssignNB(p[1],del,p[4]);
11543 # FILE_NAME(tmp, @1);
11549 def p_statement_item_39(p
):
11550 '''statement_item : lpvalue '=' event_control expression ';' '''
11552 print('statement_item_39', list(p
))
11554 # { PAssign*tmp = new PAssign(p[1],0,p[3],p[4]);
11555 # FILE_NAME(tmp, @1);
11561 def p_statement_item_40(p
):
11562 '''statement_item : lpvalue '=' K_repeat '(' expression ')' event_control expression ';' '''
11564 print('statement_item_40', list(p
))
11566 # { PAssign*tmp = new PAssign(p[1],p[5],p[7],p[8]);
11567 # FILE_NAME(tmp,@1);
11568 # tmp->set_lineno(@1.first_line);
11574 def p_statement_item_41(p
):
11575 '''statement_item : lpvalue K_LE event_control expression ';' '''
11577 print('statement_item_41', list(p
))
11579 # { PAssignNB*tmp = new PAssignNB(p[1],0,p[3],p[4]);
11580 # FILE_NAME(tmp, @1);
11586 def p_statement_item_42(p
):
11587 '''statement_item : lpvalue K_LE K_repeat '(' expression ')' event_control expression ';' '''
11589 print('statement_item_42', list(p
))
11591 # { PAssignNB*tmp = new PAssignNB(p[1],p[5],p[7],p[8]);
11592 # FILE_NAME(tmp, @1);
11598 def p_statement_item_43(p
):
11599 '''statement_item : lpvalue '=' dynamic_array_new ';' '''
11601 print('statement_item_43', list(p
))
11603 # { PAssign*tmp = new PAssign(p[1],p[3]);
11604 # FILE_NAME(tmp, @1);
11610 def p_statement_item_44(p
):
11611 '''statement_item : lpvalue '=' class_new ';' '''
11613 print('statement_item_44', list(p
))
11615 # { PAssign*tmp = new PAssign(p[1],p[3]);
11616 # FILE_NAME(tmp, @1);
11622 def p_statement_item_45(p
):
11623 '''statement_item : K_wait '(' expression ')' statement_or_null '''
11625 print('statement_item_45', list(p
))
11627 # { PEventStatement*tmp;
11628 # PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, p[3]);
11629 # tmp = new PEventStatement(etmp);
11630 # FILE_NAME(tmp,@1);
11631 # tmp->set_statement(p[5]);
11637 def p_statement_item_46(p
):
11638 '''statement_item : K_wait K_fork ';' '''
11640 print('statement_item_46', list(p
))
11642 # { PEventStatement*tmp = new PEventStatement((PEEvent*)0);
11643 # FILE_NAME(tmp,@1);
11649 def p_statement_item_47(p
):
11650 '''statement_item : SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';' '''
11652 print('statement_item_47', list(p
))
11654 # { PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), *p[3]);
11655 # FILE_NAME(tmp,@1);
11663 def p_statement_item_48(p
):
11664 '''statement_item : SYSTEM_IDENTIFIER ';' '''
11666 print('statement_item_48', list(p
))
11668 # { list<PExpr*>pt;
11669 # PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), pt);
11670 # FILE_NAME(tmp,@1);
11677 def p_statement_item_49(p
):
11678 '''statement_item : hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
11680 print('statement_item_49', list(p
))
11682 # { PCallTask*tmp = pform_make_call_task(@1, *p[1], *p[3]);
11690 def p_statement_item_50(p
):
11691 '''statement_item : hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';' '''
11693 print('statement_item_50', list(p
))
11695 # { /* ....randomize with { <constraints> } */
11696 # if (p[1] && peek_tail_name(*p[1]) == "randomize") {
11697 # if (!gn_system_verilog())
11698 # yyerror(@2, "error: Randomize with constraint requires SystemVerilog.");
11700 # yyerror(@2, "sorry: Randomize with constraint not supported.");
11702 # yyerror(@2, "error: Constraint block can only be applied to randomize method.");
11705 # PCallTask*tmp = new PCallTask(*p[1], pt);
11706 # FILE_NAME(tmp, @1);
11713 def p_statement_item_51(p
):
11714 '''statement_item : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
11716 print('statement_item_51', list(p
))
11718 # { pform_name_t*t_name = p[1];
11719 # while (! p[3]->empty()) {
11720 # t_name->push_back(p[3]->front());
11721 # p[3]->pop_front();
11723 # PCallTask*tmp = new PCallTask(*t_name, *p[5]);
11724 # FILE_NAME(tmp, @1);
11733 def p_statement_item_52(p
):
11734 '''statement_item : hierarchy_identifier ';' '''
11736 print('statement_item_52', list(p
))
11738 # { list<PExpr*>pt;
11739 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
11746 def p_statement_item_53(p
):
11747 '''statement_item : implicit_class_handle '.' K_new '(' expression_list_with_nuls ')' ';' '''
11749 print('statement_item_53', list(p
))
11751 # { PChainConstructor*tmp = new PChainConstructor(*p[5]);
11752 # FILE_NAME(tmp, @3);
11759 def p_statement_item_54(p
):
11760 '''statement_item : hierarchy_identifier '(' error ')' ';' '''
11762 print('statement_item_54', list(p
))
11764 # { yyerror(@3, "error: Syntax error in task arguments.");
11766 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
11773 def p_statement_item_55(p
):
11774 '''statement_item : error ';' '''
11776 print('statement_item_55', list(p
))
11778 # { yyerror(@2, "error: malformed statement");
11780 # p[0] = new PNoop;
11785 def p__embed0_statement_item(p
):
11786 '''_embed0_statement_item : '''
11788 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_SEQ);
11789 # FILE_NAME(tmp, @1);
11790 # current_block_stack.push(tmp);
11795 def p__embed1_statement_item(p
):
11796 '''_embed1_statement_item : '''
11799 # if (! gn_system_verilog()) {
11800 # yyerror("error: Variable declaration in unnamed block "
11801 # "requires SystemVerilog.");
11804 # /* If there are no declarations in the scope then just delete it. */
11805 # pform_pop_scope();
11806 # assert(! current_block_stack.empty());
11807 # PBlock*tmp = current_block_stack.top();
11808 # current_block_stack.pop();
11815 def p__embed2_statement_item(p
):
11816 '''_embed2_statement_item : '''
11818 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_SEQ);
11819 # FILE_NAME(tmp, @1);
11820 # current_block_stack.push(tmp);
11825 def p__embed3_statement_item(p
):
11826 '''_embed3_statement_item : '''
11828 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
11829 # FILE_NAME(tmp, @1);
11830 # current_block_stack.push(tmp);
11835 def p__embed4_statement_item(p
):
11836 '''_embed4_statement_item : '''
11839 # if (! gn_system_verilog()) {
11840 # yyerror("error: Variable declaration in unnamed block "
11841 # "requires SystemVerilog.");
11844 # /* If there are no declarations in the scope then just delete it. */
11845 # pform_pop_scope();
11846 # assert(! current_block_stack.empty());
11847 # PBlock*tmp = current_block_stack.top();
11848 # current_block_stack.pop();
11855 def p__embed5_statement_item(p
):
11856 '''_embed5_statement_item : '''
11858 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_PAR);
11859 # FILE_NAME(tmp, @1);
11860 # current_block_stack.push(tmp);
11865 def p_compressed_statement_1(p
):
11866 '''compressed_statement : lpvalue K_PLUS_EQ expression '''
11868 print('compressed_statement_1', list(p
))
11870 # { PAssign*tmp = new PAssign(p[1], '+', p[3]);
11871 # FILE_NAME(tmp, @1);
11877 def p_compressed_statement_2(p
):
11878 '''compressed_statement : lpvalue K_MINUS_EQ expression '''
11880 print('compressed_statement_2', list(p
))
11882 # { PAssign*tmp = new PAssign(p[1], '-', p[3]);
11883 # FILE_NAME(tmp, @1);
11889 def p_compressed_statement_3(p
):
11890 '''compressed_statement : lpvalue K_MUL_EQ expression '''
11892 print('compressed_statement_3', list(p
))
11894 # { PAssign*tmp = new PAssign(p[1], '*', p[3]);
11895 # FILE_NAME(tmp, @1);
11901 def p_compressed_statement_4(p
):
11902 '''compressed_statement : lpvalue K_DIV_EQ expression '''
11904 print('compressed_statement_4', list(p
))
11906 # { PAssign*tmp = new PAssign(p[1], '/', p[3]);
11907 # FILE_NAME(tmp, @1);
11913 def p_compressed_statement_5(p
):
11914 '''compressed_statement : lpvalue K_MOD_EQ expression '''
11916 print('compressed_statement_5', list(p
))
11918 # { PAssign*tmp = new PAssign(p[1], '%', p[3]);
11919 # FILE_NAME(tmp, @1);
11925 def p_compressed_statement_6(p
):
11926 '''compressed_statement : lpvalue K_AND_EQ expression '''
11928 print('compressed_statement_6', list(p
))
11930 # { PAssign*tmp = new PAssign(p[1], '&', p[3]);
11931 # FILE_NAME(tmp, @1);
11937 def p_compressed_statement_7(p
):
11938 '''compressed_statement : lpvalue K_OR_EQ expression '''
11940 print('compressed_statement_7', list(p
))
11942 # { PAssign*tmp = new PAssign(p[1], '|', p[3]);
11943 # FILE_NAME(tmp, @1);
11949 def p_compressed_statement_8(p
):
11950 '''compressed_statement : lpvalue K_XOR_EQ expression '''
11952 print('compressed_statement_8', list(p
))
11954 # { PAssign*tmp = new PAssign(p[1], '^', p[3]);
11955 # FILE_NAME(tmp, @1);
11961 def p_compressed_statement_9(p
):
11962 '''compressed_statement : lpvalue K_LS_EQ expression '''
11964 print('compressed_statement_9', list(p
))
11966 # { PAssign *tmp = new PAssign(p[1], 'l', p[3]);
11967 # FILE_NAME(tmp, @1);
11973 def p_compressed_statement_10(p
):
11974 '''compressed_statement : lpvalue K_RS_EQ expression '''
11976 print('compressed_statement_10', list(p
))
11978 # { PAssign*tmp = new PAssign(p[1], 'r', p[3]);
11979 # FILE_NAME(tmp, @1);
11985 def p_compressed_statement_11(p
):
11986 '''compressed_statement : lpvalue K_RSS_EQ expression '''
11988 print('compressed_statement_11', list(p
))
11990 # { PAssign *tmp = new PAssign(p[1], 'R', p[3]);
11991 # FILE_NAME(tmp, @1);
11997 def p_statement_or_null_list_opt_1(p
):
11998 '''statement_or_null_list_opt : statement_or_null_list '''
12000 print('statement_or_null_list_opt_1', list(p
))
12007 def p_statement_or_null_list_opt_2(p
):
12008 '''statement_or_null_list_opt : '''
12010 print('statement_or_null_list_opt_2', list(p
))
12016 def p_statement_or_null_list_1(p
):
12017 '''statement_or_null_list : statement_or_null_list statement_or_null '''
12019 print('statement_or_null_list_1', list(p
))
12021 # { vector<Statement*>*tmp = p[1];
12022 # if (p[2]) tmp->push_back(p[2]);
12028 def p_statement_or_null_list_2(p
):
12029 '''statement_or_null_list : statement_or_null '''
12031 print('statement_or_null_list_2', list(p
))
12033 # { vector<Statement*>*tmp = new vector<Statement*>(0);
12034 # if (p[1]) tmp->push_back(p[1]);
12040 def p_analog_statement_1(p
):
12041 '''analog_statement : branch_probe_expression K_CONTRIBUTE expression ';' '''
12043 print('analog_statement_1', list(p
))
12045 # { p[0] = pform_contribution_statement(@2, p[1], p[3]); }
12049 def p_task_item_1(p
):
12050 '''task_item : block_item_decl '''
12052 print('task_item_1', list(p
))
12054 # { p[0] = new vector<pform_tf_port_t>(0); }
12058 def p_task_item_2(p
):
12059 '''task_item : tf_port_declaration '''
12061 print('task_item_2', list(p
))
12068 def p_task_item_list_1(p
):
12069 '''task_item_list : task_item_list task_item '''
12071 print('task_item_list_1', list(p
))
12073 # { vector<pform_tf_port_t>*tmp = p[1];
12074 # size_t s1 = tmp->size();
12075 # tmp->resize(s1 + p[2]->size());
12076 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
12077 # tmp->at(s1 + idx) = p[2]->at(idx);
12084 def p_task_item_list_2(p
):
12085 '''task_item_list : task_item '''
12087 print('task_item_list_2', list(p
))
12094 def p_task_item_list_opt_1(p
):
12095 '''task_item_list_opt : task_item_list '''
12097 print('task_item_list_opt_1', list(p
))
12104 def p_task_item_list_opt_2(p
):
12105 '''task_item_list_opt : '''
12107 print('task_item_list_opt_2', list(p
))
12113 def p_tf_port_list_opt_1(p
):
12114 '''tf_port_list_opt : tf_port_list '''
12116 print('tf_port_list_opt_1', list(p
))
12123 def p_tf_port_list_opt_2(p
):
12124 '''tf_port_list_opt : '''
12126 print('tf_port_list_opt_2', list(p
))
12132 def p_udp_body_1(p
):
12133 '''udp_body : K_table udp_entry_list K_endtable '''
12135 print('udp_body_1', list(p
))
12137 # { lex_end_table();
12143 def p_udp_body_2(p
):
12144 '''udp_body : K_table K_endtable '''
12146 print('udp_body_2', list(p
))
12148 # { lex_end_table();
12149 # yyerror(@1, "error: Empty UDP table.");
12155 def p_udp_body_3(p
):
12156 '''udp_body : K_table error K_endtable '''
12158 print('udp_body_3', list(p
))
12160 # { lex_end_table();
12161 # yyerror(@2, "Errors in UDP table");
12168 def p_udp_entry_list_1(p
):
12169 '''udp_entry_list : udp_comb_entry_list '''
12171 print('udp_entry_list_1', list(p
))
12177 def p_udp_entry_list_2(p
):
12178 '''udp_entry_list : udp_sequ_entry_list '''
12180 print('udp_entry_list_2', list(p
))
12186 def p_udp_comb_entry_1(p
):
12187 '''udp_comb_entry : udp_input_list ':' udp_output_sym ';' '''
12189 print('udp_comb_entry_1', list(p
))
12191 # { char*tmp = new char[strlen(p[1])+3];
12192 # strcpy(tmp, p[1]);
12193 # char*tp = tmp+strlen(tmp);
12203 def p_udp_comb_entry_list_1(p
):
12204 '''udp_comb_entry_list : udp_comb_entry '''
12206 print('udp_comb_entry_list_1', list(p
))
12208 # { list<string>*tmp = new list<string>;
12209 # tmp->push_back(p[1]);
12216 def p_udp_comb_entry_list_2(p
):
12217 '''udp_comb_entry_list : udp_comb_entry_list udp_comb_entry '''
12219 print('udp_comb_entry_list_2', list(p
))
12221 # { list<string>*tmp = p[1];
12222 # tmp->push_back(p[2]);
12229 def p_udp_sequ_entry_list_1(p
):
12230 '''udp_sequ_entry_list : udp_sequ_entry '''
12232 print('udp_sequ_entry_list_1', list(p
))
12234 # { list<string>*tmp = new list<string>;
12235 # tmp->push_back(p[1]);
12242 def p_udp_sequ_entry_list_2(p
):
12243 '''udp_sequ_entry_list : udp_sequ_entry_list udp_sequ_entry '''
12245 print('udp_sequ_entry_list_2', list(p
))
12247 # { list<string>*tmp = p[1];
12248 # tmp->push_back(p[2]);
12255 def p_udp_sequ_entry_1(p
):
12256 '''udp_sequ_entry : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' '''
12258 print('udp_sequ_entry_1', list(p
))
12260 # { char*tmp = new char[strlen(p[1])+5];
12261 # strcpy(tmp, p[1]);
12262 # char*tp = tmp+strlen(tmp);
12273 def p_udp_initial_1(p
):
12274 '''udp_initial : K_initial IDENTIFIER '=' number ';' '''
12276 print('udp_initial_1', list(p
))
12278 # { PExpr*etmp = new PENumber(p[4]);
12279 # PEIdent*itmp = new PEIdent(lex_strings.make(p[2]));
12280 # PAssign*atmp = new PAssign(itmp, etmp);
12281 # FILE_NAME(atmp, @2);
12288 def p_udp_init_opt_1(p
):
12289 '''udp_init_opt : udp_initial '''
12291 print('udp_init_opt_1', list(p
))
12298 def p_udp_init_opt_2(p
):
12299 '''udp_init_opt : '''
12301 print('udp_init_opt_2', list(p
))
12307 def p_udp_input_list_1(p
):
12308 '''udp_input_list : udp_input_sym '''
12310 print('udp_input_list_1', list(p
))
12312 # { char*tmp = new char[2];
12320 def p_udp_input_list_2(p
):
12321 '''udp_input_list : udp_input_list udp_input_sym '''
12323 print('udp_input_list_2', list(p
))
12325 # { char*tmp = new char[strlen(p[1])+2];
12326 # strcpy(tmp, p[1]);
12327 # char*tp = tmp+strlen(tmp);
12336 def p_udp_input_sym_1(p
):
12337 '''udp_input_sym : '0' '''
12339 print('udp_input_sym_1', list(p
))
12345 def p_udp_input_sym_2(p
):
12346 '''udp_input_sym : '1' '''
12348 print('udp_input_sym_2', list(p
))
12354 def p_udp_input_sym_3(p
):
12355 '''udp_input_sym : 'x' '''
12357 print('udp_input_sym_3', list(p
))
12363 def p_udp_input_sym_4(p
):
12364 '''udp_input_sym : '?' '''
12366 print('udp_input_sym_4', list(p
))
12372 def p_udp_input_sym_5(p
):
12373 '''udp_input_sym : 'b' '''
12375 print('udp_input_sym_5', list(p
))
12381 def p_udp_input_sym_6(p
):
12382 '''udp_input_sym : '*' '''
12384 print('udp_input_sym_6', list(p
))
12390 def p_udp_input_sym_7(p
):
12391 '''udp_input_sym : '%' '''
12393 print('udp_input_sym_7', list(p
))
12399 def p_udp_input_sym_8(p
):
12400 '''udp_input_sym : 'f' '''
12402 print('udp_input_sym_8', list(p
))
12408 def p_udp_input_sym_9(p
):
12409 '''udp_input_sym : 'F' '''
12411 print('udp_input_sym_9', list(p
))
12417 def p_udp_input_sym_10(p
):
12418 '''udp_input_sym : 'l' '''
12420 print('udp_input_sym_10', list(p
))
12426 def p_udp_input_sym_11(p
):
12427 '''udp_input_sym : 'h' '''
12429 print('udp_input_sym_11', list(p
))
12435 def p_udp_input_sym_12(p
):
12436 '''udp_input_sym : 'B' '''
12438 print('udp_input_sym_12', list(p
))
12444 def p_udp_input_sym_13(p
):
12445 '''udp_input_sym : 'r' '''
12447 print('udp_input_sym_13', list(p
))
12453 def p_udp_input_sym_14(p
):
12454 '''udp_input_sym : 'R' '''
12456 print('udp_input_sym_14', list(p
))
12462 def p_udp_input_sym_15(p
):
12463 '''udp_input_sym : 'M' '''
12465 print('udp_input_sym_15', list(p
))
12471 def p_udp_input_sym_16(p
):
12472 '''udp_input_sym : 'n' '''
12474 print('udp_input_sym_16', list(p
))
12480 def p_udp_input_sym_17(p
):
12481 '''udp_input_sym : 'N' '''
12483 print('udp_input_sym_17', list(p
))
12489 def p_udp_input_sym_18(p
):
12490 '''udp_input_sym : 'p' '''
12492 print('udp_input_sym_18', list(p
))
12498 def p_udp_input_sym_19(p
):
12499 '''udp_input_sym : 'P' '''
12501 print('udp_input_sym_19', list(p
))
12507 def p_udp_input_sym_20(p
):
12508 '''udp_input_sym : 'Q' '''
12510 print('udp_input_sym_20', list(p
))
12516 def p_udp_input_sym_21(p
):
12517 '''udp_input_sym : 'q' '''
12519 print('udp_input_sym_21', list(p
))
12525 def p_udp_input_sym_22(p
):
12526 '''udp_input_sym : '_' '''
12528 print('udp_input_sym_22', list(p
))
12534 def p_udp_input_sym_23(p
):
12535 '''udp_input_sym : '+' '''
12537 print('udp_input_sym_23', list(p
))
12543 def p_udp_input_sym_24(p
):
12544 '''udp_input_sym : DEC_NUMBER '''
12546 print('udp_input_sym_24', list(p
))
12548 # { yyerror(@1, "internal error: Input digits parse as decimal number!"); p[0] = '0'; }
12552 def p_udp_output_sym_1(p
):
12553 '''udp_output_sym : '0' '''
12555 print('udp_output_sym_1', list(p
))
12561 def p_udp_output_sym_2(p
):
12562 '''udp_output_sym : '1' '''
12564 print('udp_output_sym_2', list(p
))
12570 def p_udp_output_sym_3(p
):
12571 '''udp_output_sym : 'x' '''
12573 print('udp_output_sym_3', list(p
))
12579 def p_udp_output_sym_4(p
):
12580 '''udp_output_sym : '-' '''
12582 print('udp_output_sym_4', list(p
))
12588 def p_udp_output_sym_5(p
):
12589 '''udp_output_sym : DEC_NUMBER '''
12591 print('udp_output_sym_5', list(p
))
12593 # { yyerror(@1, "internal error: Output digits parse as decimal number!"); p[0] = '0'; }
12597 def p_udp_port_decl_1(p
):
12598 '''udp_port_decl : K_input list_of_identifiers ';' '''
12600 print('udp_port_decl_1', list(p
))
12602 # { p[0] = pform_make_udp_input_ports(p[2]); }
12606 def p_udp_port_decl_2(p
):
12607 '''udp_port_decl : K_output IDENTIFIER ';' '''
12609 print('udp_port_decl_2', list(p
))
12611 # { perm_string pname = lex_strings.make(p[2]);
12612 # PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
12613 # vector<PWire*>*tmp = new vector<PWire*>(1);
12621 def p_udp_port_decl_3(p
):
12622 '''udp_port_decl : K_reg IDENTIFIER ';' '''
12624 print('udp_port_decl_3', list(p
))
12626 # { perm_string pname = lex_strings.make(p[2]);
12627 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
12628 # vector<PWire*>*tmp = new vector<PWire*>(1);
12636 def p_udp_port_decl_4(p
):
12637 '''udp_port_decl : K_reg K_output IDENTIFIER ';' '''
12639 print('udp_port_decl_4', list(p
))
12641 # { perm_string pname = lex_strings.make(p[3]);
12642 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
12643 # vector<PWire*>*tmp = new vector<PWire*>(1);
12651 def p_udp_port_decls_1(p
):
12652 '''udp_port_decls : udp_port_decl '''
12654 print('udp_port_decls_1', list(p
))
12661 def p_udp_port_decls_2(p
):
12662 '''udp_port_decls : udp_port_decls udp_port_decl '''
12664 print('udp_port_decls_2', list(p
))
12666 # { vector<PWire*>*tmp = p[1];
12667 # size_t s1 = p[1]->size();
12668 # tmp->resize(s1+p[2]->size());
12669 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
12670 # tmp->at(s1+idx) = p[2]->at(idx);
12677 def p_udp_port_list_1(p
):
12678 '''udp_port_list : IDENTIFIER '''
12680 print('udp_port_list_1', list(p
))
12682 # { list<perm_string>*tmp = new list<perm_string>;
12683 # tmp->push_back(lex_strings.make(p[1]));
12690 def p_udp_port_list_2(p
):
12691 '''udp_port_list : udp_port_list ',' IDENTIFIER '''
12693 print('udp_port_list_2', list(p
))
12695 # { list<perm_string>*tmp = p[1];
12696 # tmp->push_back(lex_strings.make(p[3]));
12703 def p_udp_reg_opt_1(p
):
12704 '''udp_reg_opt : K_reg '''
12706 print('udp_reg_opt_1', list(p
))
12713 def p_udp_reg_opt_2(p
):
12714 '''udp_reg_opt : '''
12716 print('udp_reg_opt_2', list(p
))
12723 def p_udp_initial_expr_opt_1(p
):
12724 '''udp_initial_expr_opt : '=' expression '''
12726 print('udp_initial_expr_opt_1', list(p
))
12733 def p_udp_initial_expr_opt_2(p
):
12734 '''udp_initial_expr_opt : '''
12736 print('udp_initial_expr_opt_2', list(p
))
12742 def p_udp_input_declaration_list_1(p
):
12743 '''udp_input_declaration_list : K_input IDENTIFIER '''
12745 print('udp_input_declaration_list_1', list(p
))
12747 # { list<perm_string>*tmp = new list<perm_string>;
12748 # tmp->push_back(lex_strings.make(p[2]));
12755 def p_udp_input_declaration_list_2(p
):
12756 '''udp_input_declaration_list : udp_input_declaration_list ',' K_input IDENTIFIER '''
12758 print('udp_input_declaration_list_2', list(p
))
12760 # { list<perm_string>*tmp = p[1];
12761 # tmp->push_back(lex_strings.make(p[4]));
12768 def p_udp_primitive_1(p
):
12769 '''udp_primitive : K_primitive IDENTIFIER '(' udp_port_list ')' ';' udp_port_decls udp_init_opt udp_body K_endprimitive endlabel_opt '''
12771 print('udp_primitive_1', list(p
))
12773 # { perm_string tmp2 = lex_strings.make(p[2]);
12774 # pform_make_udp(tmp2, p[4], p[7], p[9], p[8],
12775 # @2.text, @2.first_line);
12777 # if (strcmp(p[2],p[11]) != 0) {
12778 # yyerror(@11, "error: End label doesn't match "
12779 # "primitive name");
12781 # if (! gn_system_verilog()) {
12782 # yyerror(@11, "error: Primitive end labels "
12783 # "require SystemVerilog.");
12792 def p_udp_primitive_2(p
):
12793 '''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 '''
12795 print('udp_primitive_2', list(p
))
12797 # { perm_string tmp2 = lex_strings.make(p[2]);
12798 # perm_string tmp6 = lex_strings.make(p[6]);
12799 # pform_make_udp(tmp2, p[5], tmp6, p[7], p[9], p[12],
12800 # @2.text, @2.first_line);
12802 # if (strcmp(p[2],p[14]) != 0) {
12803 # yyerror(@14, "error: End label doesn't match "
12804 # "primitive name");
12806 # if (! gn_system_verilog()) {
12807 # yyerror(@14, "error: Primitive end labels "
12808 # "require SystemVerilog.");
12818 def p_K_packed_opt_1(p
):
12819 '''K_packed_opt : K_packed '''
12821 print('K_packed_opt', list(p
))
12828 def p_K_packed_opt_2(p
):
12829 '''K_packed_opt : '''
12831 print('K_packed_opt', list(p
))
12838 def p_K_reg_opt_1(p
):
12839 '''K_reg_opt : K_reg '''
12841 print('K_reg_opt', list(p
))
12848 def p_K_reg_opt_2(p
):
12851 print('K_reg_opt', list(p
))
12858 def p_K_static_opt_1(p
):
12859 '''K_static_opt : K_static '''
12861 print('K_static_opt', list(p
))
12868 def p_K_static_opt_2(p
):
12869 '''K_static_opt : '''
12871 print('K_static_opt', list(p
))
12878 def p_K_virtual_opt_1(p
):
12879 '''K_virtual_opt : K_virtual '''
12888 def p_K_virtual_opt_2(p
):
12889 '''K_virtual_opt : '''