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
))
1040 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, p[1]);
1041 # tmp->implicit_flag = true;
1042 # FILE_NAME(tmp, @1);
1048 def p_data_type_or_implicit_4(p
):
1049 '''data_type_or_implicit : '''
1050 if(parse_debug
> 2):
1051 print('data_type_or_implicit_4', list(p
))
1057 def p_data_type_or_implicit_or_void_1(p
):
1058 '''data_type_or_implicit_or_void : data_type_or_implicit '''
1060 print('data_type_or_implicit_or_void_1', list(p
))
1067 def p_data_type_or_implicit_or_void_2(p
):
1068 '''data_type_or_implicit_or_void : K_void '''
1070 print('data_type_or_implicit_or_void_2', list(p
))
1072 # { void_type_t*tmp = new void_type_t;
1073 # FILE_NAME(tmp, @1);
1079 def p_description_1(p
):
1080 '''description : module '''
1081 if(parse_debug
> 2):
1082 print('description_1', list(p
))
1088 def p_description_2(p
):
1089 '''description : udp_primitive '''
1091 print('description_2', list(p
))
1097 def p_description_3(p
):
1098 '''description : config_declaration '''
1100 print('description_3', list(p
))
1106 def p_description_4(p
):
1107 '''description : nature_declaration '''
1109 print('description_4', list(p
))
1115 def p_description_5(p
):
1116 '''description : package_declaration '''
1118 print('description_5', list(p
))
1124 def p_description_6(p
):
1125 '''description : discipline_declaration '''
1127 print('description_6', list(p
))
1133 def p_description_7(p
):
1134 '''description : package_item '''
1136 print('description_7', list(p
))
1142 def p_description_8(p
):
1143 '''description : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' '''
1145 print('description_8', list(p
))
1147 # { perm_string tmp3 = lex_strings.make(p[3]);
1148 # pform_set_type_attrib(tmp3, p[5], p[7]);
1155 def p_description_list_1(p
):
1156 '''description_list : description '''
1157 if(parse_debug
> 2):
1158 print('description_list_1', list(p
))
1164 def p_description_list_2(p
):
1165 '''description_list : description_list description '''
1167 print('description_list_2', list(p
))
1173 def p_endnew_opt_1(p
):
1174 '''endnew_opt : ':' K_new '''
1176 print('endnew_opt_1', list(p
))
1182 def p_endnew_opt_2(p
):
1185 print('endnew_opt_2', list(p
))
1191 def p_dynamic_array_new_1(p
):
1192 '''dynamic_array_new : K_new '[' expression ']' '''
1194 print('dynamic_array_new_1', list(p
))
1196 # { p[0] = new PENewArray(p[3], 0);
1197 # FILE_NAME(p[0], @1);
1202 def p_dynamic_array_new_2(p
):
1203 '''dynamic_array_new : K_new '[' expression ']' '(' expression ')' '''
1205 print('dynamic_array_new_2', list(p
))
1207 # { p[0] = new PENewArray(p[3], p[6]);
1208 # FILE_NAME(p[0], @1);
1213 def p_for_step_1(p
):
1214 '''for_step : lpvalue '=' expression '''
1216 print('for_step_1', list(p
))
1218 # { PAssign*tmp = new PAssign(p[1],p[3]);
1219 # FILE_NAME(tmp, @1);
1225 def p_for_step_2(p
):
1226 '''for_step : inc_or_dec_expression '''
1228 print('for_step_2', list(p
))
1230 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
1234 def p_for_step_3(p
):
1235 '''for_step : compressed_statement '''
1237 print('for_step_3', list(p
))
1244 def p_function_declaration_1(p
):
1245 '''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 '''
1247 print('function_declaration_1', list(p
))
1249 # { // Last step: check any closing name.
1251 # if (strcmp(p[4],p[11]) != 0) {
1252 # yyerror(@11, "error: End label doesn't match "
1255 # if (! gn_system_verilog()) {
1256 # yyerror(@11, "error: Function end labels require "
1257 # "SystemVerilog.");
1266 def p_function_declaration_2(p
):
1267 '''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 '''
1269 print('function_declaration_2', list(p
))
1271 # { // Last step: check any closing name.
1273 # if (strcmp(p[4],p[14]) != 0) {
1274 # yyerror(@14, "error: End label doesn't match "
1277 # if (! gn_system_verilog()) {
1278 # yyerror(@14, "error: Function end labels require "
1279 # "SystemVerilog.");
1288 def p_function_declaration_3(p
):
1289 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER error K_endfunction _embed4_function_declaration endlabel_opt '''
1291 print('function_declaration_3', list(p
))
1293 # { // Last step: check any closing name.
1295 # if (strcmp(p[4],p[8]) != 0) {
1296 # yyerror(@8, "error: End label doesn't match function name");
1298 # if (! gn_system_verilog()) {
1299 # yyerror(@8, "error: Function end labels require "
1300 # "SystemVerilog.");
1309 def p__embed0_function_declaration(p
):
1310 '''_embed0_function_declaration : '''
1312 # { assert(current_function == 0);
1313 # current_function = pform_push_function_scope(@1, p[4], p[2]);
1318 def p__embed1_function_declaration(p
):
1319 '''_embed1_function_declaration : '''
1321 # { current_function->set_ports(p[7]);
1322 # current_function->set_return(p[3]);
1323 # current_function_set_statement(p[8]? @8 : @4, p[8]);
1324 # pform_set_this_class(@4, current_function);
1325 # pform_pop_scope();
1326 # current_function = 0;
1331 def p__embed2_function_declaration(p
):
1332 '''_embed2_function_declaration : '''
1334 # { assert(current_function == 0);
1335 # current_function = pform_push_function_scope(@1, p[4], p[2]);
1340 def p__embed3_function_declaration(p
):
1341 '''_embed3_function_declaration : '''
1343 # { current_function->set_ports(p[7]);
1344 # current_function->set_return(p[3]);
1345 # current_function_set_statement(p[11]? @11 : @4, p[11]);
1346 # pform_set_this_class(@4, current_function);
1347 # pform_pop_scope();
1348 # current_function = 0;
1349 # if (p[7]==0 && !gn_system_verilog()) {
1350 # yyerror(@4, "error: Empty parenthesis syntax requires SystemVerilog.");
1356 def p__embed4_function_declaration(p
):
1357 '''_embed4_function_declaration : '''
1360 # if (current_function) {
1361 # pform_pop_scope();
1362 # current_function = 0;
1364 # assert(current_function == 0);
1365 # yyerror(@1, "error: Syntax error defining function.");
1371 def p_import_export_1(p
):
1372 '''import_export : K_import '''
1374 print('import_export_1', list(p
))
1381 def p_import_export_2(p
):
1382 '''import_export : K_export '''
1384 print('import_export_2', list(p
))
1391 def p_implicit_class_handle_1(p
):
1392 '''implicit_class_handle : K_this '''
1394 print('implicit_class_handle_1', list(p
))
1396 # { p[0] = pform_create_this(); }
1400 def p_implicit_class_handle_2(p
):
1401 '''implicit_class_handle : K_super '''
1403 print('implicit_class_handle_2', list(p
))
1405 # { p[0] = pform_create_super(); }
1409 def p_inc_or_dec_expression_1(p
):
1410 '''inc_or_dec_expression : K_INCR lpvalue %prec UNARY_PREC '''
1412 print('inc_or_dec_expression_1', list(p
))
1414 # { PEUnary*tmp = new PEUnary('I', p[2]);
1415 # FILE_NAME(tmp, @2);
1421 def p_inc_or_dec_expression_2(p
):
1422 '''inc_or_dec_expression : lpvalue K_INCR %prec UNARY_PREC '''
1424 print('inc_or_dec_expression_2', list(p
))
1426 # { PEUnary*tmp = new PEUnary('i', p[1]);
1427 # FILE_NAME(tmp, @1);
1433 def p_inc_or_dec_expression_3(p
):
1434 '''inc_or_dec_expression : K_DECR lpvalue %prec UNARY_PREC '''
1436 print('inc_or_dec_expression_3', list(p
))
1438 # { PEUnary*tmp = new PEUnary('D', p[2]);
1439 # FILE_NAME(tmp, @2);
1445 def p_inc_or_dec_expression_4(p
):
1446 '''inc_or_dec_expression : lpvalue K_DECR %prec UNARY_PREC '''
1448 print('inc_or_dec_expression_4', list(p
))
1450 # { PEUnary*tmp = new PEUnary('d', p[1]);
1451 # FILE_NAME(tmp, @1);
1457 def p_inside_expression_1(p
):
1458 '''inside_expression : expression K_inside '{' open_range_list '}' '''
1460 print('inside_expression_1', list(p
))
1462 # { yyerror(@2, "sorry: \"inside\" expressions not supported yet.");
1468 def p_integer_vector_type_1(p
):
1469 '''integer_vector_type : K_reg '''
1471 print('integer_vector_type_1', list(p
))
1472 p
[0] = IVL_VT_NO_TYPE
1478 def p_integer_vector_type_2(p
):
1479 '''integer_vector_type : K_bit '''
1481 print('integer_vector_type_2', list(p
))
1488 def p_integer_vector_type_3(p
):
1489 '''integer_vector_type : K_logic '''
1491 print('integer_vector_type_3', list(p
))
1498 def p_integer_vector_type_4(p
):
1499 '''integer_vector_type : K_bool '''
1501 print('integer_vector_type_4', list(p
))
1503 # { p[0] = IVL_VT_BOOL; }
1507 def p_join_keyword_1(p
):
1508 '''join_keyword : K_join '''
1510 print('join_keyword_1', list(p
))
1512 # { p[0] = PBlock::BL_PAR; }
1516 def p_join_keyword_2(p
):
1517 '''join_keyword : K_join_none '''
1519 print('join_keyword_2', list(p
))
1521 # { p[0] = PBlock::BL_JOIN_NONE; }
1525 def p_join_keyword_3(p
):
1526 '''join_keyword : K_join_any '''
1528 print('join_keyword_3', list(p
))
1530 # { p[0] = PBlock::BL_JOIN_ANY; }
1534 def p_jump_statement_1(p
):
1535 '''jump_statement : K_break ';' '''
1537 print('jump_statement_1', list(p
))
1539 # { yyerror(@1, "sorry: break statements not supported.");
1545 def p_jump_statement_2(p
):
1546 '''jump_statement : K_return ';' '''
1548 print('jump_statement_2', list(p
))
1550 # { PReturn*tmp = new PReturn(0);
1551 # FILE_NAME(tmp, @1);
1557 def p_jump_statement_3(p
):
1558 '''jump_statement : K_return expression ';' '''
1560 print('jump_statement_3', list(p
))
1562 # { PReturn*tmp = new PReturn(p[2]);
1563 # FILE_NAME(tmp, @1);
1569 def p_lifetime_1(p
):
1570 '''lifetime : K_automatic '''
1572 print('lifetime_1', list(p
))
1574 # { p[0] = LexicalScope::AUTOMATIC; }
1578 def p_lifetime_2(p
):
1579 '''lifetime : K_static '''
1581 print('lifetime_2', list(p
))
1583 # { p[0] = LexicalScope::STATIC; }
1587 def p_lifetime_opt_1(p
):
1588 '''lifetime_opt : lifetime '''
1590 print('lifetime_opt_1', list(p
))
1597 def p_lifetime_opt_2(p
):
1598 '''lifetime_opt : '''
1599 if(parse_debug
> 2):
1600 print('lifetime_opt_2', list(p
))
1602 # { p[0] = LexicalScope::INHERITED; }
1606 def p_loop_statement_1(p
):
1607 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' for_step ')' statement_or_null '''
1609 print('loop_statement_1', list(p
))
1611 # { PForStatement*tmp = new PForStatement(p[3], p[5], p[7], p[9], p[11]);
1612 # FILE_NAME(tmp, @1);
1618 def p_loop_statement_2(p
):
1619 '''loop_statement : K_for '(' data_type IDENTIFIER '=' expression ';' expression ';' for_step ')' _embed0_loop_statement statement_or_null '''
1621 print('loop_statement_2', list(p
))
1623 # { pform_name_t tmp_hident;
1624 # tmp_hident.push_back(name_component_t(lex_strings.make(p[4])));
1626 # PEIdent*tmp_ident = pform_new_ident(tmp_hident);
1627 # FILE_NAME(tmp_ident, @4);
1629 # PForStatement*tmp_for = new PForStatement(tmp_ident, p[6], p[8], p[10], p[13]);
1630 # FILE_NAME(tmp_for, @1);
1632 # pform_pop_scope();
1633 # vector<Statement*>tmp_for_list (1);
1634 # tmp_for_list[0] = tmp_for;
1635 # PBlock*tmp_blk = current_block_stack.top();
1636 # current_block_stack.pop();
1637 # tmp_blk->set_statement(tmp_for_list);
1644 def p_loop_statement_3(p
):
1645 '''loop_statement : K_forever statement_or_null '''
1647 print('loop_statement_3', list(p
))
1649 # { PForever*tmp = new PForever(p[2]);
1650 # FILE_NAME(tmp, @1);
1656 def p_loop_statement_4(p
):
1657 '''loop_statement : K_repeat '(' expression ')' statement_or_null '''
1659 print('loop_statement_4', list(p
))
1661 # { PRepeat*tmp = new PRepeat(p[3], p[5]);
1662 # FILE_NAME(tmp, @1);
1668 def p_loop_statement_5(p
):
1669 '''loop_statement : K_while '(' expression ')' statement_or_null '''
1671 print('loop_statement_5', list(p
))
1673 # { PWhile*tmp = new PWhile(p[3], p[5]);
1674 # FILE_NAME(tmp, @1);
1680 def p_loop_statement_6(p
):
1681 '''loop_statement : K_do statement_or_null K_while '(' expression ')' ';' '''
1683 print('loop_statement_6', list(p
))
1685 # { PDoWhile*tmp = new PDoWhile(p[5], p[2]);
1686 # FILE_NAME(tmp, @1);
1692 def p_loop_statement_7(p
):
1693 '''loop_statement : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' _embed1_loop_statement statement_or_null '''
1695 print('loop_statement_7', list(p
))
1697 # { PForeach*tmp_for = pform_make_foreach(@1, p[3], p[5], p[9]);
1699 # pform_pop_scope();
1700 # vector<Statement*>tmp_for_list(1);
1701 # tmp_for_list[0] = tmp_for;
1702 # PBlock*tmp_blk = current_block_stack.top();
1703 # current_block_stack.pop();
1704 # tmp_blk->set_statement(tmp_for_list);
1710 def p_loop_statement_8(p
):
1711 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' error ')' statement_or_null '''
1713 print('loop_statement_8', list(p
))
1716 # yyerror(@1, "error: Error in for loop step assignment.");
1721 def p_loop_statement_9(p
):
1722 '''loop_statement : K_for '(' lpvalue '=' expression ';' error ';' for_step ')' statement_or_null '''
1724 print('loop_statement_9', list(p
))
1727 # yyerror(@1, "error: Error in for loop condition expression.");
1732 def p_loop_statement_10(p
):
1733 '''loop_statement : K_for '(' error ')' statement_or_null '''
1735 print('loop_statement_10', list(p
))
1738 # yyerror(@1, "error: Incomprehensible for loop.");
1743 def p_loop_statement_11(p
):
1744 '''loop_statement : K_while '(' error ')' statement_or_null '''
1746 print('loop_statement_11', list(p
))
1749 # yyerror(@1, "error: Error in while loop condition.");
1754 def p_loop_statement_12(p
):
1755 '''loop_statement : K_do statement_or_null K_while '(' error ')' ';' '''
1757 print('loop_statement_12', list(p
))
1760 # yyerror(@1, "error: Error in do/while loop condition.");
1765 def p_loop_statement_13(p
):
1766 '''loop_statement : K_foreach '(' IDENTIFIER '[' error ']' ')' statement_or_null '''
1768 print('loop_statement_13', list(p
))
1771 # yyerror(@4, "error: Errors in foreach loop variables list.");
1776 def p__embed0_loop_statement(p
):
1777 '''_embed0_loop_statement : '''
1779 # { static unsigned for_counter = 0;
1780 # char for_block_name [64];
1781 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_for_loop%u", for_counter);
1783 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1784 # FILE_NAME(tmp, @1);
1785 # current_block_stack.push(tmp);
1787 # list<decl_assignment_t*>assign_list;
1788 # decl_assignment_t*tmp_assign = new decl_assignment_t;
1789 # tmp_assign->name = lex_strings.make(p[4]);
1790 # assign_list.push_back(tmp_assign);
1791 # pform_makewire(@4, 0, str_strength, &assign_list, NetNet::REG, p[3]);
1796 def p__embed1_loop_statement(p
):
1797 '''_embed1_loop_statement : '''
1799 # { static unsigned foreach_counter = 0;
1800 # char for_block_name[64];
1801 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_foreach%u", foreach_counter);
1802 # foreach_counter += 1;
1804 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1805 # FILE_NAME(tmp, @1);
1806 # current_block_stack.push(tmp);
1808 # pform_make_foreach_declarations(@1, p[5]);
1813 def p_list_of_variable_decl_assignments_1(p
):
1814 '''list_of_variable_decl_assignments : variable_decl_assignment '''
1816 print('list_of_variable_decl_assignments_1', list(p
))
1818 # { list<decl_assignment_t*>*tmp = new list<decl_assignment_t*>;
1819 # tmp->push_back(p[1]);
1825 def p_list_of_variable_decl_assignments_2(p
):
1826 '''list_of_variable_decl_assignments : list_of_variable_decl_assignments ',' variable_decl_assignment '''
1828 print('list_of_variable_decl_assignments_2', list(p
))
1830 # { list<decl_assignment_t*>*tmp = p[1];
1831 # tmp->push_back(p[3]);
1837 def p_variable_decl_assignment_1(p
):
1838 '''variable_decl_assignment : IDENTIFIER dimensions_opt '''
1840 print('variable_decl_assignment_1', list(p
))
1842 # { decl_assignment_t*tmp = new decl_assignment_t;
1843 # tmp->name = lex_strings.make(p[1]);
1845 # tmp->index = *p[2];
1854 def p_variable_decl_assignment_2(p
):
1855 '''variable_decl_assignment : IDENTIFIER '=' expression '''
1857 print('variable_decl_assignment_2', list(p
))
1859 # { decl_assignment_t*tmp = new decl_assignment_t;
1860 # tmp->name = lex_strings.make(p[1]);
1861 # tmp->expr .reset(p[3]);
1868 def p_variable_decl_assignment_3(p
):
1869 '''variable_decl_assignment : IDENTIFIER '=' K_new '(' ')' '''
1871 print('variable_decl_assignment_3', list(p
))
1873 # { decl_assignment_t*tmp = new decl_assignment_t;
1874 # tmp->name = lex_strings.make(p[1]);
1875 # PENewClass*expr = new PENewClass;
1876 # FILE_NAME(expr, @3);
1877 # tmp->expr .reset(expr);
1884 def p_loop_variables_1(p
):
1885 '''loop_variables : loop_variables ',' IDENTIFIER '''
1887 print('loop_variables_1', list(p
))
1889 # { list<perm_string>*tmp = p[1];
1890 # tmp->push_back(lex_strings.make(p[3]));
1897 def p_loop_variables_2(p
):
1898 '''loop_variables : IDENTIFIER '''
1900 print('loop_variables_2', list(p
))
1902 # { list<perm_string>*tmp = new list<perm_string>;
1903 # tmp->push_back(lex_strings.make(p[1]));
1910 def p_method_qualifier_1(p
):
1911 '''method_qualifier : K_virtual '''
1913 print('method_qualifier_1', list(p
))
1919 def p_method_qualifier_2(p
):
1920 '''method_qualifier : class_item_qualifier '''
1922 print('method_qualifier_2', list(p
))
1928 def p_method_qualifier_opt_1(p
):
1929 '''method_qualifier_opt : method_qualifier '''
1931 print('method_qualifier_opt_1', list(p
))
1937 def p_method_qualifier_opt_2(p
):
1938 '''method_qualifier_opt : '''
1940 print('method_qualifier_opt_2', list(p
))
1946 def p_modport_declaration_1(p
):
1947 '''modport_declaration : K_modport _embed0_modport_declaration modport_item_list ';' '''
1949 print('modport_declaration_1', list(p
))
1955 def p__embed0_modport_declaration(p
):
1956 '''_embed0_modport_declaration : '''
1958 # { if (!pform_in_interface())
1959 # yyerror(@1, "error: modport declarations are only allowed "
1960 # "in interfaces.");
1965 def p_modport_item_list_1(p
):
1966 '''modport_item_list : modport_item '''
1968 print('modport_item_list_1', list(p
))
1974 def p_modport_item_list_2(p
):
1975 '''modport_item_list : modport_item_list ',' modport_item '''
1977 print('modport_item_list_2', list(p
))
1983 def p_modport_item_1(p
):
1984 '''modport_item : IDENTIFIER _embed0_modport_item '(' modport_ports_list ')' '''
1986 print('modport_item_1', list(p
))
1988 # { pform_end_modport_item(@1); }
1992 def p__embed0_modport_item(p
):
1993 '''_embed0_modport_item : '''
1995 # { pform_start_modport_item(@1, p[1]); }
1999 def p_modport_ports_list_1(p
):
2000 '''modport_ports_list : modport_ports_declaration '''
2002 print('modport_ports_list_1', list(p
))
2008 def p_modport_ports_list_2(p
):
2009 '''modport_ports_list : modport_ports_list ',' modport_ports_declaration '''
2011 print('modport_ports_list_2', list(p
))
2017 def p_modport_ports_list_3(p
):
2018 '''modport_ports_list : modport_ports_list ',' modport_simple_port '''
2020 print('modport_ports_list_3', list(p
))
2022 # { if (last_modport_port.type == MP_SIMPLE) {
2023 # pform_add_modport_port(@3, last_modport_port.direction,
2024 # p[3]->name, p[3]->parm);
2026 # yyerror(@3, "error: modport expression not allowed here.");
2033 def p_modport_ports_list_4(p
):
2034 '''modport_ports_list : modport_ports_list ',' modport_tf_port '''
2036 print('modport_ports_list_4', list(p
))
2038 # { if (last_modport_port.type != MP_TF)
2039 # yyerror(@3, "error: task/function declaration not allowed here.");
2044 def p_modport_ports_list_5(p
):
2045 '''modport_ports_list : modport_ports_list ',' IDENTIFIER '''
2047 print('modport_ports_list_5', list(p
))
2049 # { if (last_modport_port.type == MP_SIMPLE) {
2050 # pform_add_modport_port(@3, last_modport_port.direction,
2051 # lex_strings.make(p[3]), 0);
2052 # } else if (last_modport_port.type != MP_TF) {
2053 # yyerror(@3, "error: list of identifiers not allowed here.");
2060 def p_modport_ports_list_6(p
):
2061 '''modport_ports_list : modport_ports_list ',' '''
2063 print('modport_ports_list_6', list(p
))
2065 # { yyerror(@2, "error: NULL port declarations are not allowed"); }
2069 def p_modport_ports_declaration_1(p
):
2070 '''modport_ports_declaration : attribute_list_opt port_direction IDENTIFIER '''
2072 print('modport_ports_declaration_1', list(p
))
2074 # { last_modport_port.type = MP_SIMPLE;
2075 # last_modport_port.direction = p[2];
2076 # pform_add_modport_port(@3, p[2], lex_strings.make(p[3]), 0);
2083 def p_modport_ports_declaration_2(p
):
2084 '''modport_ports_declaration : attribute_list_opt port_direction modport_simple_port '''
2086 print('modport_ports_declaration_2', list(p
))
2088 # { last_modport_port.type = MP_SIMPLE;
2089 # last_modport_port.direction = p[2];
2090 # pform_add_modport_port(@3, p[2], p[3]->name, p[3]->parm);
2097 def p_modport_ports_declaration_3(p
):
2098 '''modport_ports_declaration : attribute_list_opt import_export IDENTIFIER '''
2100 print('modport_ports_declaration_3', list(p
))
2102 # { last_modport_port.type = MP_TF;
2103 # last_modport_port.is_import = p[2];
2104 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
2111 def p_modport_ports_declaration_4(p
):
2112 '''modport_ports_declaration : attribute_list_opt import_export modport_tf_port '''
2114 print('modport_ports_declaration_4', list(p
))
2116 # { last_modport_port.type = MP_TF;
2117 # last_modport_port.is_import = p[2];
2118 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
2124 def p_modport_ports_declaration_5(p
):
2125 '''modport_ports_declaration : attribute_list_opt K_clocking IDENTIFIER '''
2127 print('modport_ports_declaration_5', list(p
))
2129 # { last_modport_port.type = MP_CLOCKING;
2130 # last_modport_port.direction = NetNet::NOT_A_PORT;
2131 # yyerror(@3, "sorry: modport clocking declaration is not yet supported.");
2138 def p_modport_simple_port_1(p
):
2139 '''modport_simple_port : '.' IDENTIFIER '(' expression ')' '''
2141 print('modport_simple_port_1', list(p
))
2143 # { named_pexpr_t*tmp = new named_pexpr_t;
2144 # tmp->name = lex_strings.make(p[2]);
2152 def p_modport_tf_port_1(p
):
2153 '''modport_tf_port : K_task IDENTIFIER '''
2155 print('modport_tf_port_1', list(p
))
2161 def p_modport_tf_port_2(p
):
2162 '''modport_tf_port : K_task IDENTIFIER '(' tf_port_list_opt ')' '''
2164 print('modport_tf_port_2', list(p
))
2170 def p_modport_tf_port_3(p
):
2171 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '''
2173 print('modport_tf_port_3', list(p
))
2179 def p_modport_tf_port_4(p
):
2180 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' '''
2182 print('modport_tf_port_4', list(p
))
2188 def p_non_integer_type_1(p
):
2189 '''non_integer_type : K_real '''
2191 print('non_integer_type_1', list(p
))
2193 # { p[0] = real_type_t::REAL; }
2197 def p_non_integer_type_2(p
):
2198 '''non_integer_type : K_realtime '''
2200 print('non_integer_type_2', list(p
))
2202 # { p[0] = real_type_t::REAL; }
2206 def p_non_integer_type_3(p
):
2207 '''non_integer_type : K_shortreal '''
2209 print('non_integer_type_3', list(p
))
2211 # { p[0] = real_type_t::SHORTREAL; }
2216 '''number : BASED_NUMBER '''
2218 print('number_1', list(p
))
2220 # { p[0] = p[1]; based_size = 0;}
2225 '''number : DEC_NUMBER '''
2227 print('number_2', list(p
))
2228 num
= Leaf(token
.NUMBER
, "%s" % (p
[1]))
2231 # { p[0] = p[1]; based_size = 0;}
2236 '''number : DEC_NUMBER BASED_NUMBER '''
2238 print('number_3', list(p
))
2239 num
= Leaf(token
.NUMBER
, "%s:%s" % (p
[1], p
[2]))
2242 # { p[0] = pform_verinum_with_size(p[1],p[2], @2.text, @2.first_line);
2248 '''number : UNBASED_NUMBER '''
2250 print('number_4', list(p
))
2252 # { p[0] = p[1]; based_size = 0;}
2257 '''number : DEC_NUMBER UNBASED_NUMBER '''
2259 print('number_5', list(p
))
2261 # { yyerror(@1, "error: Unbased SystemVerilog literal cannot have "
2263 # p[0] = p[1]; based_size = 0;}
2267 def p_open_range_list_1(p
):
2268 '''open_range_list : open_range_list ',' value_range '''
2270 print('open_range_list_1', list(p
))
2276 def p_open_range_list_2(p
):
2277 '''open_range_list : value_range '''
2279 print('open_range_list_2', list(p
))
2285 def p_package_declaration_1(p
):
2286 '''package_declaration : K_package lifetime_opt IDENTIFIER ';' _embed0_package_declaration timeunits_declaration_opt _embed1_package_declaration package_item_list_opt K_endpackage endlabel_opt '''
2288 print('package_declaration_1', list(p
))
2290 # { pform_end_package_declaration(@1);
2291 # // If an end label is present make sure it match the package name.
2293 # if (strcmp(p[3],p[10]) != 0) {
2294 # yyerror(@10, "error: End label doesn't match package name");
2303 def p__embed0_package_declaration(p
):
2304 '''_embed0_package_declaration : '''
2306 # { pform_start_package_declaration(@1, p[3], p[2]); }
2310 def p__embed1_package_declaration(p
):
2311 '''_embed1_package_declaration : '''
2313 # { pform_set_scope_timescale(@1); }
2317 def p_module_package_import_list_opt_1(p
):
2318 '''module_package_import_list_opt : '''
2319 if(parse_debug
> 1):
2320 print('module_package_import_list_opt_1', list(p
))
2326 def p_module_package_import_list_opt_2(p
):
2327 '''module_package_import_list_opt : package_import_list '''
2329 print('module_package_import_list_opt_2', list(p
))
2335 def p_package_import_list_1(p
):
2336 '''package_import_list : package_import_declaration '''
2338 print('package_import_list_1', list(p
))
2344 def p_package_import_list_2(p
):
2345 '''package_import_list : package_import_list package_import_declaration '''
2347 print('package_import_list_2', list(p
))
2353 def p_package_import_declaration_1(p
):
2354 '''package_import_declaration : K_import package_import_item_list ';' '''
2356 print('package_import_declaration_1', list(p
))
2362 def p_package_import_item_1(p
):
2363 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '''
2365 print('package_import_item_1', list(p
))
2367 # { pform_package_import(@2, p[1], p[3]);
2373 def p_package_import_item_2(p
):
2374 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES '*' '''
2376 print('package_import_item_2', list(p
))
2378 # { pform_package_import(@2, p[1], 0);
2383 def p_package_import_item_list_1(p
):
2384 '''package_import_item_list : package_import_item_list ',' package_import_item '''
2386 print('package_import_item_list_1', list(p
))
2392 def p_package_import_item_list_2(p
):
2393 '''package_import_item_list : package_import_item '''
2395 print('package_import_item_list_2', list(p
))
2401 def p_package_item_1(p
):
2402 '''package_item : timeunits_declaration '''
2404 print('package_item_1', list(p
))
2410 def p_package_item_2(p
):
2411 '''package_item : K_parameter param_type parameter_assign_list ';' '''
2413 print('package_item_2', list(p
))
2419 def p_package_item_3(p
):
2420 '''package_item : K_localparam param_type localparam_assign_list ';' '''
2422 print('package_item_3', list(p
))
2428 def p_package_item_4(p
):
2429 '''package_item : type_declaration '''
2431 print('package_item_4', list(p
))
2437 def p_package_item_5(p
):
2438 '''package_item : function_declaration '''
2440 print('package_item_5', list(p
))
2446 def p_package_item_6(p
):
2447 '''package_item : task_declaration '''
2449 print('package_item_6', list(p
))
2455 def p_package_item_7(p
):
2456 '''package_item : data_declaration '''
2458 print('package_item_7', list(p
))
2464 def p_package_item_8(p
):
2465 '''package_item : class_declaration '''
2467 print('package_item_8', list(p
))
2473 def p_package_item_list_1(p
):
2474 '''package_item_list : package_item_list package_item '''
2476 print('package_item_list_1', list(p
))
2482 def p_package_item_list_2(p
):
2483 '''package_item_list : package_item '''
2485 print('package_item_list_2', list(p
))
2491 def p_package_item_list_opt_1(p
):
2492 '''package_item_list_opt : package_item_list '''
2494 print('package_item_list_opt_1', list(p
))
2500 def p_package_item_list_opt_2(p
):
2501 '''package_item_list_opt : '''
2503 print('package_item_list_opt_2', list(p
))
2509 def p_port_direction_1(p
):
2510 '''port_direction : K_input '''
2512 print('port_direction_1', list(p
))
2514 # { p[0] = NetNet::PINPUT; }
2518 def p_port_direction_2(p
):
2519 '''port_direction : K_output '''
2521 print('port_direction_2', list(p
))
2523 # { p[0] = NetNet::POUTPUT; }
2527 def p_port_direction_3(p
):
2528 '''port_direction : K_inout '''
2530 print('port_direction_3', list(p
))
2532 # { p[0] = NetNet::PINOUT; }
2536 def p_port_direction_4(p
):
2537 '''port_direction : K_ref '''
2539 print('port_direction_4', list(p
))
2541 # { p[0] = NetNet::PREF;
2542 # if (!gn_system_verilog()) {
2543 # yyerror(@1, "error: Reference ports (ref) require SystemVerilog.");
2544 # p[0] = NetNet::PINPUT;
2550 def p_port_direction_opt_1(p
):
2551 '''port_direction_opt : port_direction '''
2553 print('port_direction_opt_1', list(p
))
2560 def p_port_direction_opt_2(p
):
2561 '''port_direction_opt : '''
2563 print('port_direction_opt_2', list(p
))
2565 # { p[0] = NetNet::PIMPLICIT; }
2569 def p_property_expr_1(p
):
2570 '''property_expr : expression '''
2572 print('property_expr_1', list(p
))
2578 def p_procedural_assertion_statement_1(p
):
2579 '''procedural_assertion_statement : K_assert '(' expression ')' statement %prec less_than_K_else '''
2581 print('procedural_assertion_statement_1', list(p
))
2583 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2589 def p_procedural_assertion_statement_2(p
):
2590 '''procedural_assertion_statement : K_assert '(' expression ')' K_else statement '''
2592 print('procedural_assertion_statement_2', list(p
))
2594 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2600 def p_procedural_assertion_statement_3(p
):
2601 '''procedural_assertion_statement : K_assert '(' expression ')' statement K_else statement '''
2603 print('procedural_assertion_statement_3', list(p
))
2605 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2611 def p_property_qualifier_1(p
):
2612 '''property_qualifier : class_item_qualifier '''
2614 print('property_qualifier_1', list(p
))
2620 def p_property_qualifier_2(p
):
2621 '''property_qualifier : random_qualifier '''
2623 print('property_qualifier_2', list(p
))
2629 def p_property_qualifier_opt_1(p
):
2630 '''property_qualifier_opt : property_qualifier_list '''
2632 print('property_qualifier_opt_1', list(p
))
2639 def p_property_qualifier_opt_2(p
):
2640 '''property_qualifier_opt : '''
2642 print('property_qualifier_opt_2', list(p
))
2644 # { p[0] = property_qualifier_t::make_none(); }
2648 def p_property_qualifier_list_1(p
):
2649 '''property_qualifier_list : property_qualifier_list property_qualifier '''
2651 print('property_qualifier_list_1', list(p
))
2653 # { p[0] = p[1] | p[2]; }
2657 def p_property_qualifier_list_2(p
):
2658 '''property_qualifier_list : property_qualifier '''
2660 print('property_qualifier_list_2', list(p
))
2667 def p_property_spec_1(p
):
2668 '''property_spec : clocking_event_opt property_spec_disable_iff_opt property_expr '''
2670 print('property_spec_1', list(p
))
2676 def p_property_spec_disable_iff_opt_1(p
):
2677 '''property_spec_disable_iff_opt : K_disable K_iff '(' expression ')' '''
2679 print('property_spec_disable_iff_opt_1', list(p
))
2685 def p_property_spec_disable_iff_opt_2(p
):
2686 '''property_spec_disable_iff_opt : '''
2688 print('property_spec_disable_iff_opt_2', list(p
))
2694 def p_random_qualifier_1(p
):
2695 '''random_qualifier : K_rand '''
2697 print('random_qualifier_1', list(p
))
2699 # { p[0] = property_qualifier_t::make_rand(); }
2703 def p_random_qualifier_2(p
):
2704 '''random_qualifier : K_randc '''
2706 print('random_qualifier_2', list(p
))
2708 # { p[0] = property_qualifier_t::make_randc(); }
2712 def p_real_or_realtime_1(p
):
2713 '''real_or_realtime : K_real '''
2715 print('real_or_realtime_1', list(p
))
2721 def p_real_or_realtime_2(p
):
2722 '''real_or_realtime : K_realtime '''
2724 print('real_or_realtime_2', list(p
))
2731 '''signing : K_signed '''
2733 print('signing_1', list(p
))
2741 '''signing : K_unsigned '''
2743 print('signing_2', list(p
))
2750 def p_simple_type_or_string_1(p
):
2751 '''simple_type_or_string : integer_vector_type '''
2753 print('simple_type_or_string_1', list(p
))
2755 # { ivl_variable_type_t use_vtype = p[1];
2756 # bool reg_flag = false;
2757 # if (use_vtype == IVL_VT_NO_TYPE) {
2758 # use_vtype = IVL_VT_LOGIC;
2761 # vector_type_t*tmp = new vector_type_t(use_vtype, false, 0);
2762 # tmp->reg_flag = reg_flag;
2763 # FILE_NAME(tmp, @1);
2769 def p_simple_type_or_string_2(p
):
2770 '''simple_type_or_string : non_integer_type '''
2772 print('simple_type_or_string_2', list(p
))
2774 # { real_type_t*tmp = new real_type_t(p[1]);
2775 # FILE_NAME(tmp, @1);
2781 def p_simple_type_or_string_3(p
):
2782 '''simple_type_or_string : atom2_type '''
2784 print('simple_type_or_string_3', list(p
))
2786 # { atom2_type_t*tmp = new atom2_type_t(p[1], true);
2787 # FILE_NAME(tmp, @1);
2793 def p_simple_type_or_string_4(p
):
2794 '''simple_type_or_string : K_integer '''
2796 print('simple_type_or_string_4', list(p
))
2798 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
2799 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd);
2800 # tmp->reg_flag = true;
2801 # tmp->integer_flag = true;
2807 def p_simple_type_or_string_5(p
):
2808 '''simple_type_or_string : K_time '''
2810 print('simple_type_or_string_5', list(p
))
2812 # { list<pform_range_t>*pd = make_range_from_width(64);
2813 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
2814 # tmp->reg_flag = !gn_system_verilog();
2820 def p_simple_type_or_string_6(p
):
2821 '''simple_type_or_string : TYPE_IDENTIFIER '''
2823 print('simple_type_or_string_6', list(p
))
2825 # { p[0] = p[1].type;
2826 # delete[]p[1].text;
2831 def p_simple_type_or_string_7(p
):
2832 '''simple_type_or_string : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_simple_type_or_string TYPE_IDENTIFIER '''
2834 print('simple_type_or_string_7', list(p
))
2836 # { lex_in_package_scope(0);
2838 # delete[]p[4].text;
2843 def p_simple_type_or_string_8(p
):
2844 '''simple_type_or_string : K_string '''
2846 print('simple_type_or_string_8', list(p
))
2848 # { string_type_t*tmp = new string_type_t;
2849 # FILE_NAME(tmp, @1);
2855 def p__embed0_simple_type_or_string(p
):
2856 '''_embed0_simple_type_or_string : '''
2858 # { lex_in_package_scope(p[1]); }
2862 def p_statement_1(p
):
2863 '''statement : attribute_list_opt statement_item '''
2865 print('statement_1', list(p
))
2867 # { pform_bind_attributes(p[2]->attributes, p[1]);
2873 def p_statement_or_null_1(p
):
2874 '''statement_or_null : statement '''
2876 print('statement_or_null_1', list(p
))
2883 def p_statement_or_null_2(p
):
2884 '''statement_or_null : attribute_list_opt ';' '''
2886 print('statement_or_null_2', list(p
))
2892 def p_stream_expression_1(p
):
2893 '''stream_expression : expression '''
2895 print('stream_expression_1', list(p
))
2901 def p_stream_expression_list_1(p
):
2902 '''stream_expression_list : stream_expression_list ',' stream_expression '''
2904 print('stream_expression_list_1', list(p
))
2910 def p_stream_expression_list_2(p
):
2911 '''stream_expression_list : stream_expression '''
2913 print('stream_expression_list_2', list(p
))
2919 def p_stream_operator_1(p
):
2920 '''stream_operator : K_LS '''
2922 print('stream_operator_1', list(p
))
2928 def p_stream_operator_2(p
):
2929 '''stream_operator : K_RS '''
2931 print('stream_operator_2', list(p
))
2937 def p_streaming_concatenation_1(p
):
2938 '''streaming_concatenation : '{' stream_operator '{' stream_expression_list '}' '}' '''
2940 print('streaming_concatenation_1', list(p
))
2942 # { /* streaming concatenation is a SystemVerilog thing. */
2943 # if (gn_system_verilog()) {
2944 # yyerror(@2, "sorry: Streaming concatenation not supported.");
2947 # yyerror(@2, "error: Streaming concatenation requires SystemVerilog");
2954 def p_task_declaration_1(p
):
2955 '''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 '''
2957 print('task_declaration_1', list(p
))
2959 # { // Last step: check any closing name. This is done late so
2960 # // that the parser can look ahead to detect the present
2961 # // endlabel_opt but still have the pform_endmodule() called
2962 # // early enough that the lexor can know we are outside the
2965 # if (strcmp(p[3],p[10]) != 0) {
2966 # yyerror(@10, "error: End label doesn't match task name");
2968 # if (! gn_system_verilog()) {
2969 # yyerror(@10, "error: Task end labels require "
2970 # "SystemVerilog.");
2979 def p_task_declaration_2(p
):
2980 '''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 '''
2982 print('task_declaration_2', list(p
))
2984 # { // Last step: check any closing name. This is done late so
2985 # // that the parser can look ahead to detect the present
2986 # // endlabel_opt but still have the pform_endmodule() called
2987 # // early enough that the lexor can know we are outside the
2990 # if (strcmp(p[3],p[13]) != 0) {
2991 # yyerror(@13, "error: End label doesn't match task name");
2993 # if (! gn_system_verilog()) {
2994 # yyerror(@13, "error: Task end labels require "
2995 # "SystemVerilog.");
3004 def p_task_declaration_3(p
):
3005 '''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 '''
3007 print('task_declaration_3', list(p
))
3009 # { // Last step: check any closing name. This is done late so
3010 # // that the parser can look ahead to detect the present
3011 # // endlabel_opt but still have the pform_endmodule() called
3012 # // early enough that the lexor can know we are outside the
3015 # if (strcmp(p[3],p[12]) != 0) {
3016 # yyerror(@12, "error: End label doesn't match task name");
3018 # if (! gn_system_verilog()) {
3019 # yyerror(@12, "error: Task end labels require "
3020 # "SystemVerilog.");
3029 def p_task_declaration_4(p
):
3030 '''task_declaration : K_task lifetime_opt IDENTIFIER error K_endtask _embed6_task_declaration endlabel_opt '''
3032 print('task_declaration_4', list(p
))
3034 # { // Last step: check any closing name. This is done late so
3035 # // that the parser can look ahead to detect the present
3036 # // endlabel_opt but still have the pform_endmodule() called
3037 # // early enough that the lexor can know we are outside the
3040 # if (strcmp(p[3],p[7]) != 0) {
3041 # yyerror(@7, "error: End label doesn't match task name");
3043 # if (! gn_system_verilog()) {
3044 # yyerror(@7, "error: Task end labels require "
3045 # "SystemVerilog.");
3054 def p__embed0_task_declaration(p
):
3055 '''_embed0_task_declaration : '''
3057 # { assert(current_task == 0);
3058 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3063 def p__embed1_task_declaration(p
):
3064 '''_embed1_task_declaration : '''
3066 # { current_task->set_ports(p[6]);
3067 # current_task_set_statement(@3, p[7]);
3068 # pform_set_this_class(@3, current_task);
3069 # pform_pop_scope();
3071 # if (p[7] && p[7]->size() > 1 && !gn_system_verilog()) {
3072 # yyerror(@7, "error: Task body with multiple statements requires SystemVerilog.");
3079 def p__embed2_task_declaration(p
):
3080 '''_embed2_task_declaration : '''
3082 # { assert(current_task == 0);
3083 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3088 def p__embed3_task_declaration(p
):
3089 '''_embed3_task_declaration : '''
3091 # { current_task->set_ports(p[6]);
3092 # current_task_set_statement(@3, p[10]);
3093 # pform_set_this_class(@3, current_task);
3094 # pform_pop_scope();
3096 # if (p[10]) delete p[10];
3101 def p__embed4_task_declaration(p
):
3102 '''_embed4_task_declaration : '''
3104 # { assert(current_task == 0);
3105 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3110 def p__embed5_task_declaration(p
):
3111 '''_embed5_task_declaration : '''
3113 # { current_task->set_ports(0);
3114 # current_task_set_statement(@3, p[9]);
3115 # pform_set_this_class(@3, current_task);
3116 # if (! current_task->method_of()) {
3117 # cerr << @3 << ": warning: task definition for \"" << p[3]
3118 # << "\" has an empty port declaration list!" << endl;
3120 # pform_pop_scope();
3122 # if (p[9]->size() > 1 && !gn_system_verilog()) {
3123 # yyerror(@9, "error: Task body with multiple statements requires SystemVerilog.");
3130 def p__embed6_task_declaration(p
):
3131 '''_embed6_task_declaration : '''
3134 # if (current_task) {
3135 # pform_pop_scope();
3142 def p_tf_port_declaration_1(p
):
3143 '''tf_port_declaration : port_direction K_reg_opt unsigned_signed_opt dimensions_opt list_of_identifiers ';' '''
3145 print('tf_port_declaration_1', list(p
))
3147 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1],
3148 # p[2] ? IVL_VT_LOGIC :
3150 # p[3], p[4], p[5]);
3156 def p_tf_port_declaration_2(p
):
3157 '''tf_port_declaration : port_direction K_integer list_of_identifiers ';' '''
3159 print('tf_port_declaration_2', list(p
))
3161 # { list<pform_range_t>*range_stub = make_range_from_width(integer_width);
3162 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, true,
3163 # range_stub, p[3], true);
3169 def p_tf_port_declaration_3(p
):
3170 '''tf_port_declaration : port_direction K_time list_of_identifiers ';' '''
3172 print('tf_port_declaration_3', list(p
))
3174 # { list<pform_range_t>*range_stub = make_range_from_width(64);
3175 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, false,
3176 # range_stub, p[3]);
3182 def p_tf_port_declaration_4(p
):
3183 '''tf_port_declaration : port_direction real_or_realtime list_of_identifiers ';' '''
3185 print('tf_port_declaration_4', list(p
))
3187 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_REAL, true,
3194 def p_tf_port_declaration_5(p
):
3195 '''tf_port_declaration : port_direction K_string list_of_identifiers ';' '''
3197 print('tf_port_declaration_5', list(p
))
3199 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_STRING, true,
3206 def p_tf_port_item_1(p
):
3207 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER dimensions_opt tf_port_item_expr_opt '''
3209 print('tf_port_item_1', list(p
))
3211 # { vector<pform_tf_port_t>*tmp;
3212 # NetNet::PortType use_port_type = p[1];
3213 # if ((use_port_type == NetNet::PIMPLICIT) && (gn_system_verilog() || (p[2] == 0)))
3214 # use_port_type = port_declaration_context.port_type;
3215 # perm_string name = lex_strings.make(p[3]);
3216 # list<perm_string>* ilist = list_from_identifier(p[3]);
3218 # if (use_port_type == NetNet::PIMPLICIT) {
3219 # yyerror(@1, "error: missing task/function port direction.");
3220 # use_port_type = NetNet::PINPUT; // for error recovery
3222 # if ((p[2] == 0) && (p[1]==NetNet::PIMPLICIT)) {
3223 # // Detect special case this is an undecorated
3224 # // identifier and we need to get the declaration from
3227 # yyerror(@4, "internal error: How can there be an unpacked range here?\n");
3229 # tmp = pform_make_task_ports(@3, use_port_type,
3230 # port_declaration_context.data_type,
3234 # // Otherwise, the decorations for this identifier
3235 # // indicate the type. Save the type for any right
3236 # // context that may come later.
3237 # port_declaration_context.port_type = use_port_type;
3239 # p[2] = new vector_type_t(IVL_VT_LOGIC, false, 0);
3240 # FILE_NAME(p[2], @3);
3242 # port_declaration_context.data_type = p[2];
3243 # tmp = pform_make_task_ports(@3, use_port_type, p[2], ilist);
3246 # pform_set_reg_idx(name, p[4]);
3251 # assert(tmp->size()==1);
3252 # tmp->front().defe = p[5];
3258 def p_tf_port_item_2(p
):
3259 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER error '''
3261 print('tf_port_item_2', list(p
))
3263 # { yyerror(@3, "error: Error in task/function port item after port name %s.", p[3]);
3270 def p_tf_port_item_expr_opt_1(p
):
3271 '''tf_port_item_expr_opt : '=' expression '''
3273 print('tf_port_item_expr_opt_1', list(p
))
3275 # { if (! gn_system_verilog()) {
3276 # yyerror(@1, "error: Task/function default arguments require "
3277 # "SystemVerilog.");
3284 def p_tf_port_item_expr_opt_2(p
):
3285 '''tf_port_item_expr_opt : '''
3287 print('tf_port_item_expr_opt_2', list(p
))
3293 def p_tf_port_list_1(p
):
3294 '''tf_port_list : _embed0_tf_port_list tf_port_item_list '''
3296 print('tf_port_list_1', list(p
))
3303 def p__embed0_tf_port_list(p
):
3304 '''_embed0_tf_port_list : '''
3306 # { port_declaration_context.port_type = gn_system_verilog() ? NetNet::PINPUT : NetNet::PIMPLICIT;
3307 # port_declaration_context.data_type = 0;
3312 def p_tf_port_item_list_1(p
):
3313 '''tf_port_item_list : tf_port_item_list ',' tf_port_item '''
3315 print('tf_port_item_list_1', list(p
))
3317 # { vector<pform_tf_port_t>*tmp;
3318 # if (p[1] && p[3]) {
3319 # size_t s1 = p[1]->size();
3321 # tmp->resize(tmp->size()+p[3]->size());
3322 # for (size_t idx = 0 ; idx < p[3]->size() ; idx += 1)
3323 # tmp->at(s1+idx) = p[3]->at(idx);
3325 # } else if (p[1]) {
3335 def p_tf_port_item_list_2(p
):
3336 '''tf_port_item_list : tf_port_item '''
3338 print('tf_port_item_list_2', list(p
))
3345 def p_tf_port_item_list_3(p
):
3346 '''tf_port_item_list : error ',' tf_port_item '''
3348 print('tf_port_item_list_3', list(p
))
3350 # { yyerror(@2, "error: Syntax error in task/function port declaration.");
3356 def p_tf_port_item_list_4(p
):
3357 '''tf_port_item_list : tf_port_item_list ',' '''
3359 print('tf_port_item_list_4', list(p
))
3361 # { yyerror(@2, "error: NULL port declarations are not allowed.");
3367 def p_tf_port_item_list_5(p
):
3368 '''tf_port_item_list : tf_port_item_list ';' '''
3370 print('tf_port_item_list_5', list(p
))
3372 # { yyerror(@2, "error: ';' is an invalid port declaration separator.");
3378 def p_timeunits_declaration_1(p
):
3379 '''timeunits_declaration : K_timeunit TIME_LITERAL ';' '''
3381 print('timeunits_declaration_1', list(p
))
3383 # { pform_set_timeunit(p[2], allow_timeunit_decl); }
3387 def p_timeunits_declaration_2(p
):
3388 '''timeunits_declaration : K_timeunit TIME_LITERAL '/' TIME_LITERAL ';' '''
3390 print('timeunits_declaration_2', list(p
))
3392 # { bool initial_decl = allow_timeunit_decl && allow_timeprec_decl;
3393 # pform_set_timeunit(p[2], initial_decl);
3394 # pform_set_timeprec(p[4], initial_decl);
3399 def p_timeunits_declaration_3(p
):
3400 '''timeunits_declaration : K_timeprecision TIME_LITERAL ';' '''
3402 print('timeunits_declaration_3', list(p
))
3404 # { pform_set_timeprec(p[2], allow_timeprec_decl); }
3408 def p_timeunits_declaration_opt_1(p
):
3409 '''timeunits_declaration_opt : %prec no_timeunits_declaration '''
3410 if(parse_debug
> 2):
3411 print('timeunits_declaration_opt_1', list(p
))
3417 def p_timeunits_declaration_opt_2(p
):
3418 '''timeunits_declaration_opt : timeunits_declaration %prec one_timeunits_declaration '''
3420 print('timeunits_declaration_opt_2', list(p
))
3426 def p_timeunits_declaration_opt_3(p
):
3427 '''timeunits_declaration_opt : timeunits_declaration timeunits_declaration '''
3429 print('timeunits_declaration_opt_3', list(p
))
3435 def p_value_range_1(p
):
3436 '''value_range : expression '''
3438 print('value_range_1', list(p
))
3444 def p_value_range_2(p
):
3445 '''value_range : '[' expression ':' expression ']' '''
3447 print('value_range_2', list(p
))
3453 def p_variable_dimension_1(p
):
3454 '''variable_dimension : '[' expression ':' expression ']' '''
3456 print('variable_dimension_1', list(p
))
3457 # { list<pform_range_t> *tmp = new list<pform_range_t>;
3458 # pform_range_t index (p[2],p[4]);
3459 # tmp->push_back(index);
3462 # XXX TODO: subscriptlist
3465 if end
.endswith("-1"):
3468 end
= str(int(end
)+1)
3471 p
[0] = '[%s:%s]' % (start
, end
) # python slice is LO:HI+1
3477 def p_variable_dimension_2(p
):
3478 '''variable_dimension : '[' expression ']' '''
3480 print('variable_dimension_2', list(p
))
3482 # { // SystemVerilog canonical range
3483 # if (!gn_system_verilog()) {
3485 # cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. "
3486 # << "Use at least -g2005-sv to remove this warning." << endl;
3488 # list<pform_range_t> *tmp = new list<pform_range_t>;
3489 # pform_range_t index;
3490 # index.first = new PENumber(new verinum((uint64_t)0, integer_width));
3491 # index.second = new PEBinary('-', p[2], new PENumber(new verinum((uint64_t)1, integer_width)));
3492 # tmp->push_back(index);
3498 def p_variable_dimension_3(p
):
3499 '''variable_dimension : '[' ']' '''
3501 print('variable_dimension_3', list(p
))
3503 # { list<pform_range_t> *tmp = new list<pform_range_t>;
3504 # pform_range_t index (0,0);
3505 # tmp->push_back(index);
3511 def p_variable_dimension_4(p
):
3512 '''variable_dimension : '[' '$' ']' '''
3514 print('variable_dimension_4', list(p
))
3516 # { // SystemVerilog queue
3517 # list<pform_range_t> *tmp = new list<pform_range_t>;
3518 # pform_range_t index (new PENull,0);
3519 # if (!gn_system_verilog()) {
3520 # yyerror("error: Queue declarations require SystemVerilog.");
3522 # tmp->push_back(index);
3528 def p_variable_lifetime_1(p
):
3529 '''variable_lifetime : lifetime '''
3531 print('variable_lifetime_1', list(p
))
3533 # { if (!gn_system_verilog()) {
3534 # yyerror(@1, "error: overriding the default variable lifetime "
3535 # "requires SystemVerilog.");
3536 # } else if (p[1] != pform_peek_scope()->default_lifetime) {
3537 # yyerror(@1, "sorry: overriding the default variable lifetime "
3538 # "is not yet supported.");
3540 # var_lifetime = p[1];
3545 def p_attribute_list_opt_1(p
):
3546 '''attribute_list_opt : attribute_instance_list '''
3548 print('attribute_list_opt_1', list(p
))
3555 def p_attribute_list_opt_2(p
):
3556 '''attribute_list_opt : '''
3557 if(parse_debug
> 2):
3558 print('attribute_list_opt_2', list(p
))
3564 def p_attribute_instance_list_1(p
):
3565 '''attribute_instance_list : K_PSTAR K_STARP '''
3567 print('attribute_instance_list_1', list(p
))
3573 def p_attribute_instance_list_2(p
):
3574 '''attribute_instance_list : K_PSTAR attribute_list K_STARP '''
3576 print('attribute_instance_list_2', list(p
))
3583 def p_attribute_instance_list_3(p
):
3584 '''attribute_instance_list : attribute_instance_list K_PSTAR K_STARP '''
3586 print('attribute_instance_list_3', list(p
))
3593 def p_attribute_instance_list_4(p
):
3594 '''attribute_instance_list : attribute_instance_list K_PSTAR attribute_list K_STARP '''
3596 print('attribute_instance_list_4', list(p
))
3598 # { list<named_pexpr_t>*tmp = p[1];
3600 # tmp->splice(tmp->end(), *p[3]);
3603 # } else p[0] = p[3];
3608 def p_attribute_list_1(p
):
3609 '''attribute_list : attribute_list ',' attribute '''
3611 print('attribute_list_1', list(p
))
3613 # { list<named_pexpr_t>*tmp = p[1];
3614 # tmp->push_back(*p[3]);
3621 def p_attribute_list_2(p
):
3622 '''attribute_list : attribute '''
3624 print('attribute_list_2', list(p
))
3626 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
3627 # tmp->push_back(*p[1]);
3634 def p_attribute_1(p
):
3635 '''attribute : IDENTIFIER '''
3637 print('attribute_1', list(p
))
3639 # { named_pexpr_t*tmp = new named_pexpr_t;
3640 # tmp->name = lex_strings.make(p[1]);
3648 def p_attribute_2(p
):
3649 '''attribute : IDENTIFIER '=' expression '''
3651 print('attribute_2', list(p
))
3653 # { PExpr*tmp = p[3];
3654 # named_pexpr_t*tmp2 = new named_pexpr_t;
3655 # tmp2->name = lex_strings.make(p[1]);
3663 def p_block_item_decl_1(p
):
3664 '''block_item_decl : data_type register_variable_list ';' '''
3666 print('block_item_decl_1', list(p
))
3668 # { if (p[1]) pform_set_data_type(@1, p[1], p[2], NetNet::REG, attributes_in_context);
3673 def p_block_item_decl_2(p
):
3674 '''block_item_decl : variable_lifetime data_type register_variable_list ';' '''
3676 print('block_item_decl_2', list(p
))
3678 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
3679 # var_lifetime = LexicalScope::INHERITED;
3684 def p_block_item_decl_3(p
):
3685 '''block_item_decl : K_reg data_type register_variable_list ';' '''
3687 print('block_item_decl_3', list(p
))
3689 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
3694 def p_block_item_decl_4(p
):
3695 '''block_item_decl : variable_lifetime K_reg data_type register_variable_list ';' '''
3697 print('block_item_decl_4', list(p
))
3699 # { if (p[3]) pform_set_data_type(@3, p[3], p[4], NetNet::REG, attributes_in_context);
3700 # var_lifetime = LexicalScope::INHERITED;
3705 def p_block_item_decl_5(p
):
3706 '''block_item_decl : K_event event_variable_list ';' '''
3708 print('block_item_decl_5', list(p
))
3710 # { if (p[2]) pform_make_events(p[2], @1.text, @1.first_line);
3715 def p_block_item_decl_6(p
):
3716 '''block_item_decl : K_parameter param_type parameter_assign_list ';' '''
3718 print('block_item_decl_6', list(p
))
3724 def p_block_item_decl_7(p
):
3725 '''block_item_decl : K_localparam param_type localparam_assign_list ';' '''
3727 print('block_item_decl_7', list(p
))
3733 def p_block_item_decl_8(p
):
3734 '''block_item_decl : type_declaration '''
3736 print('block_item_decl_8', list(p
))
3742 def p_block_item_decl_9(p
):
3743 '''block_item_decl : K_integer error ';' '''
3745 print('block_item_decl_9', list(p
))
3747 # { yyerror(@1, "error: syntax error in integer variable list.");
3753 def p_block_item_decl_10(p
):
3754 '''block_item_decl : K_time error ';' '''
3756 print('block_item_decl_10', list(p
))
3758 # { yyerror(@1, "error: syntax error in time variable list.");
3764 def p_block_item_decl_11(p
):
3765 '''block_item_decl : K_parameter error ';' '''
3767 print('block_item_decl_11', list(p
))
3769 # { yyerror(@1, "error: syntax error in parameter list.");
3775 def p_block_item_decl_12(p
):
3776 '''block_item_decl : K_localparam error ';' '''
3778 print('block_item_decl_12', list(p
))
3780 # { yyerror(@1, "error: syntax error localparam list.");
3786 def p_block_item_decls_1(p
):
3787 '''block_item_decls : block_item_decl '''
3789 print('block_item_decls_1', list(p
))
3795 def p_block_item_decls_2(p
):
3796 '''block_item_decls : block_item_decls block_item_decl '''
3798 print('block_item_decls_2', list(p
))
3804 def p_block_item_decls_opt_1(p
):
3805 '''block_item_decls_opt : block_item_decls '''
3807 print('block_item_decls_opt_1', list(p
))
3814 def p_block_item_decls_opt_2(p
):
3815 '''block_item_decls_opt : '''
3817 print('block_item_decls_opt_2', list(p
))
3824 def p_type_declaration_1(p
):
3825 '''type_declaration : K_typedef data_type IDENTIFIER dimensions_opt ';' '''
3827 print('type_declaration_1', list(p
))
3829 # { perm_string name = lex_strings.make(p[3]);
3830 # pform_set_typedef(name, p[2], p[4]);
3836 def p_type_declaration_2(p
):
3837 '''type_declaration : K_typedef data_type TYPE_IDENTIFIER ';' '''
3839 print('type_declaration_2', list(p
))
3841 # { perm_string name = lex_strings.make(p[3].text);
3842 # if (pform_test_type_identifier_local(name)) {
3843 # yyerror(@3, "error: Typedef identifier \"%s\" is already a type name.", p[3].text);
3846 # pform_set_typedef(name, p[2], NULL);
3848 # delete[]p[3].text;
3853 def p_type_declaration_3(p
):
3854 '''type_declaration : K_typedef K_class IDENTIFIER ';' '''
3856 print('type_declaration_3', list(p
))
3858 # { // Create a synthetic typedef for the class name so that the
3859 # // lexor detects the name as a type.
3860 # perm_string name = lex_strings.make(p[3]);
3861 # class_type_t*tmp = new class_type_t(name);
3862 # FILE_NAME(tmp, @3);
3863 # pform_set_typedef(name, tmp, NULL);
3869 def p_type_declaration_4(p
):
3870 '''type_declaration : K_typedef K_enum IDENTIFIER ';' '''
3872 print('type_declaration_4', list(p
))
3874 # { yyerror(@1, "sorry: Enum forward declarations not supported yet."); }
3878 def p_type_declaration_5(p
):
3879 '''type_declaration : K_typedef K_struct IDENTIFIER ';' '''
3881 print('type_declaration_5', list(p
))
3883 # { yyerror(@1, "sorry: Struct forward declarations not supported yet."); }
3887 def p_type_declaration_6(p
):
3888 '''type_declaration : K_typedef K_union IDENTIFIER ';' '''
3890 print('type_declaration_6', list(p
))
3892 # { yyerror(@1, "sorry: Union forward declarations not supported yet."); }
3896 def p_type_declaration_7(p
):
3897 '''type_declaration : K_typedef IDENTIFIER ';' '''
3899 print('type_declaration_7', list(p
))
3901 # { // Create a synthetic typedef for the class name so that the
3902 # // lexor detects the name as a type.
3903 # perm_string name = lex_strings.make(p[2]);
3904 # class_type_t*tmp = new class_type_t(name);
3905 # FILE_NAME(tmp, @2);
3906 # pform_set_typedef(name, tmp, NULL);
3912 def p_type_declaration_8(p
):
3913 '''type_declaration : K_typedef error ';' '''
3915 print('type_declaration_8', list(p
))
3917 # { yyerror(@2, "error: Syntax error in typedef clause.");
3923 def p_enum_data_type_1(p
):
3924 '''enum_data_type : K_enum '{' enum_name_list '}' '''
3926 print('enum_data_type_1', list(p
))
3928 # { enum_type_t*enum_type = new enum_type_t;
3929 # FILE_NAME(enum_type, @1);
3930 # enum_type->names .reset(p[3]);
3931 # enum_type->base_type = IVL_VT_BOOL;
3932 # enum_type->signed_flag = true;
3933 # enum_type->integer_flag = false;
3934 # enum_type->range.reset(make_range_from_width(32));
3940 def p_enum_data_type_2(p
):
3941 '''enum_data_type : K_enum atom2_type signed_unsigned_opt '{' enum_name_list '}' '''
3943 print('enum_data_type_2', list(p
))
3945 # { enum_type_t*enum_type = new enum_type_t;
3946 # FILE_NAME(enum_type, @1);
3947 # enum_type->names .reset(p[5]);
3948 # enum_type->base_type = IVL_VT_BOOL;
3949 # enum_type->signed_flag = p[3];
3950 # enum_type->integer_flag = false;
3951 # enum_type->range.reset(make_range_from_width(p[2]));
3957 def p_enum_data_type_3(p
):
3958 '''enum_data_type : K_enum K_integer signed_unsigned_opt '{' enum_name_list '}' '''
3960 print('enum_data_type_3', list(p
))
3962 # { enum_type_t*enum_type = new enum_type_t;
3963 # FILE_NAME(enum_type, @1);
3964 # enum_type->names .reset(p[5]);
3965 # enum_type->base_type = IVL_VT_LOGIC;
3966 # enum_type->signed_flag = p[3];
3967 # enum_type->integer_flag = true;
3968 # enum_type->range.reset(make_range_from_width(integer_width));
3974 def p_enum_data_type_4(p
):
3975 '''enum_data_type : K_enum K_logic unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
3977 print('enum_data_type_4', list(p
))
3979 # { enum_type_t*enum_type = new enum_type_t;
3980 # FILE_NAME(enum_type, @1);
3981 # enum_type->names .reset(p[6]);
3982 # enum_type->base_type = IVL_VT_LOGIC;
3983 # enum_type->signed_flag = p[3];
3984 # enum_type->integer_flag = false;
3985 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
3991 def p_enum_data_type_5(p
):
3992 '''enum_data_type : K_enum K_reg unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
3994 print('enum_data_type_5', list(p
))
3996 # { enum_type_t*enum_type = new enum_type_t;
3997 # FILE_NAME(enum_type, @1);
3998 # enum_type->names .reset(p[6]);
3999 # enum_type->base_type = IVL_VT_LOGIC;
4000 # enum_type->signed_flag = p[3];
4001 # enum_type->integer_flag = false;
4002 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4008 def p_enum_data_type_6(p
):
4009 '''enum_data_type : K_enum K_bit unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
4011 print('enum_data_type_6', list(p
))
4013 # { enum_type_t*enum_type = new enum_type_t;
4014 # FILE_NAME(enum_type, @1);
4015 # enum_type->names .reset(p[6]);
4016 # enum_type->base_type = IVL_VT_BOOL;
4017 # enum_type->signed_flag = p[3];
4018 # enum_type->integer_flag = false;
4019 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4025 def p_enum_name_list_1(p
):
4026 '''enum_name_list : enum_name '''
4028 print('enum_name_list_1', list(p
))
4035 def p_enum_name_list_2(p
):
4036 '''enum_name_list : enum_name_list ',' enum_name '''
4038 print('enum_name_list_2', list(p
))
4040 # { list<named_pexpr_t>*lst = p[1];
4041 # lst->splice(lst->end(), *p[3]);
4048 def p_pos_neg_number_1(p
):
4049 '''pos_neg_number : number '''
4051 print('pos_neg_number_1', list(p
))
4058 def p_pos_neg_number_2(p
):
4059 '''pos_neg_number : '-' number '''
4061 print('pos_neg_number_2', list(p
))
4063 # { verinum tmp = -(*(p[2]));
4070 def p_enum_name_1(p
):
4071 '''enum_name : IDENTIFIER '''
4073 print('enum_name_1', list(p
))
4075 # { perm_string name = lex_strings.make(p[1]);
4077 # p[0] = make_named_number(name);
4082 def p_enum_name_2(p
):
4083 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '''
4085 print('enum_name_2', list(p
))
4087 # { perm_string name = lex_strings.make(p[1]);
4088 # long count = check_enum_seq_value(@1, p[3], false);
4090 # p[0] = make_named_numbers(name, 0, count-1);
4096 def p_enum_name_3(p
):
4097 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '''
4099 print('enum_name_3', list(p
))
4101 # { perm_string name = lex_strings.make(p[1]);
4102 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
4103 # check_enum_seq_value(@1, p[5], true));
4111 def p_enum_name_4(p
):
4112 '''enum_name : IDENTIFIER '=' expression '''
4114 print('enum_name_4', list(p
))
4116 # { perm_string name = lex_strings.make(p[1]);
4118 # p[0] = make_named_number(name, p[3]);
4123 def p_enum_name_5(p
):
4124 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '=' expression '''
4126 print('enum_name_5', list(p
))
4128 # { perm_string name = lex_strings.make(p[1]);
4129 # long count = check_enum_seq_value(@1, p[3], false);
4130 # p[0] = make_named_numbers(name, 0, count-1, p[6]);
4137 def p_enum_name_6(p
):
4138 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '=' expression '''
4140 print('enum_name_6', list(p
))
4142 # { perm_string name = lex_strings.make(p[1]);
4143 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
4144 # check_enum_seq_value(@1, p[5], true), p[8]);
4152 def p_struct_data_type_1(p
):
4153 '''struct_data_type : K_struct K_packed_opt '{' struct_union_member_list '}' '''
4155 print('struct_data_type_1', list(p
))
4157 # { struct_type_t*tmp = new struct_type_t;
4158 # FILE_NAME(tmp, @1);
4159 # tmp->packed_flag = p[2];
4160 # tmp->union_flag = false;
4161 # tmp->members .reset(p[4]);
4167 def p_struct_data_type_2(p
):
4168 '''struct_data_type : K_union K_packed_opt '{' struct_union_member_list '}' '''
4170 print('struct_data_type_2', list(p
))
4172 # { struct_type_t*tmp = new struct_type_t;
4173 # FILE_NAME(tmp, @1);
4174 # tmp->packed_flag = p[2];
4175 # tmp->union_flag = true;
4176 # tmp->members .reset(p[4]);
4182 def p_struct_data_type_3(p
):
4183 '''struct_data_type : K_struct K_packed_opt '{' error '}' '''
4185 print('struct_data_type_3', list(p
))
4187 # { yyerror(@3, "error: Errors in struct member list.");
4189 # struct_type_t*tmp = new struct_type_t;
4190 # FILE_NAME(tmp, @1);
4191 # tmp->packed_flag = p[2];
4192 # tmp->union_flag = false;
4198 def p_struct_data_type_4(p
):
4199 '''struct_data_type : K_union K_packed_opt '{' error '}' '''
4201 print('struct_data_type_4', list(p
))
4203 # { yyerror(@3, "error: Errors in union member list.");
4205 # struct_type_t*tmp = new struct_type_t;
4206 # FILE_NAME(tmp, @1);
4207 # tmp->packed_flag = p[2];
4208 # tmp->union_flag = true;
4214 def p_struct_union_member_list_1(p
):
4215 '''struct_union_member_list : struct_union_member_list struct_union_member '''
4217 print('struct_union_member_list_1', list(p
))
4219 # { list<struct_member_t*>*tmp = p[1];
4220 # tmp->push_back(p[2]);
4226 def p_struct_union_member_list_2(p
):
4227 '''struct_union_member_list : struct_union_member '''
4229 print('struct_union_member_list_2', list(p
))
4231 # { list<struct_member_t*>*tmp = new list<struct_member_t*>;
4232 # tmp->push_back(p[1]);
4238 def p_struct_union_member_1(p
):
4239 '''struct_union_member : attribute_list_opt data_type list_of_variable_decl_assignments ';' '''
4241 print('struct_union_member_1', list(p
))
4243 # { struct_member_t*tmp = new struct_member_t;
4244 # FILE_NAME(tmp, @2);
4245 # tmp->type .reset(p[2]);
4246 # tmp->names .reset(p[3]);
4252 def p_struct_union_member_2(p
):
4253 '''struct_union_member : error ';' '''
4255 print('struct_union_member_2', list(p
))
4257 # { yyerror(@2, "Error in struct/union member.");
4264 def p_case_item_1(p
):
4265 '''case_item : expression_list_proper ':' statement_or_null '''
4267 print('case_item_1', list(p
))
4269 # { PCase::Item*tmp = new PCase::Item;
4270 # tmp->expr = *p[1];
4278 def p_case_item_2(p
):
4279 '''case_item : K_default ':' statement_or_null '''
4281 print('case_item_2', list(p
))
4283 # { PCase::Item*tmp = new PCase::Item;
4290 def p_case_item_3(p
):
4291 '''case_item : K_default statement_or_null '''
4293 print('case_item_3', list(p
))
4295 # { PCase::Item*tmp = new PCase::Item;
4302 def p_case_item_4(p
):
4303 '''case_item : error ':' statement_or_null '''
4305 print('case_item_4', list(p
))
4307 # { yyerror(@2, "error: Incomprehensible case expression.");
4313 def p_case_items_1(p
):
4314 '''case_items : case_items case_item '''
4316 print('case_items_1', list(p
))
4318 # { svector<PCase::Item*>*tmp;
4319 # tmp = new svector<PCase::Item*>(*p[1], p[2]);
4326 def p_case_items_2(p
):
4327 '''case_items : case_item '''
4329 print('case_items_2', list(p
))
4331 # { svector<PCase::Item*>*tmp = new svector<PCase::Item*>(1);
4338 def p_charge_strength_1(p
):
4339 '''charge_strength : '(' K_small ')' '''
4341 print('charge_strength_1', list(p
))
4347 def p_charge_strength_2(p
):
4348 '''charge_strength : '(' K_medium ')' '''
4350 print('charge_strength_2', list(p
))
4356 def p_charge_strength_3(p
):
4357 '''charge_strength : '(' K_large ')' '''
4359 print('charge_strength_3', list(p
))
4365 def p_charge_strength_opt_1(p
):
4366 '''charge_strength_opt : charge_strength '''
4368 print('charge_strength_opt_1', list(p
))
4374 def p_charge_strength_opt_2(p
):
4375 '''charge_strength_opt : '''
4377 print('charge_strength_opt_2', list(p
))
4383 def p_defparam_assign_1(p
):
4384 '''defparam_assign : hierarchy_identifier '=' expression '''
4386 print('defparam_assign_1', list(p
))
4388 # { pform_set_defparam(*p[1], p[3]);
4394 def p_defparam_assign_list_1(p
):
4395 '''defparam_assign_list : defparam_assign '''
4397 print('defparam_assign_list_1', list(p
))
4403 def p_defparam_assign_list_2(p
):
4404 '''defparam_assign_list : dimensions defparam_assign '''
4406 print('defparam_assign_list_2', list(p
))
4408 # { yyerror(@1, "error: defparam may not include a range.");
4414 def p_defparam_assign_list_3(p
):
4415 '''defparam_assign_list : defparam_assign_list ',' defparam_assign '''
4417 print('defparam_assign_list_3', list(p
))
4424 '''delay1 : '#' delay_value_simple '''
4426 print('delay1_1', list(p
))
4428 # { list<PExpr*>*tmp = new list<PExpr*>;
4429 # tmp->push_back(p[2]);
4436 '''delay1 : '#' '(' delay_value ')' '''
4438 print('delay1_2', list(p
))
4440 # { list<PExpr*>*tmp = new list<PExpr*>;
4441 # tmp->push_back(p[3]);
4448 '''delay3 : '#' delay_value_simple '''
4450 print('delay3_1', list(p
))
4452 # { list<PExpr*>*tmp = new list<PExpr*>;
4453 # tmp->push_back(p[2]);
4460 '''delay3 : '#' '(' delay_value ')' '''
4462 print('delay3_2', list(p
))
4464 # { list<PExpr*>*tmp = new list<PExpr*>;
4465 # tmp->push_back(p[3]);
4472 '''delay3 : '#' '(' delay_value ',' delay_value ')' '''
4474 print('delay3_3', list(p
))
4476 # { list<PExpr*>*tmp = new list<PExpr*>;
4477 # tmp->push_back(p[3]);
4478 # tmp->push_back(p[5]);
4485 '''delay3 : '#' '(' delay_value ',' delay_value ',' delay_value ')' '''
4487 print('delay3_4', list(p
))
4489 # { list<PExpr*>*tmp = new list<PExpr*>;
4490 # tmp->push_back(p[3]);
4491 # tmp->push_back(p[5]);
4492 # tmp->push_back(p[7]);
4498 def p_delay3_opt_1(p
):
4499 '''delay3_opt : delay3 '''
4501 print('delay3_opt_1', list(p
))
4508 def p_delay3_opt_2(p
):
4510 if(parse_debug
> 2):
4511 print('delay3_opt_2', list(p
))
4517 def p_delay_value_list_1(p
):
4518 '''delay_value_list : delay_value '''
4520 print('delay_value_list_1', list(p
))
4522 # { list<PExpr*>*tmp = new list<PExpr*>;
4523 # tmp->push_back(p[1]);
4529 def p_delay_value_list_2(p
):
4530 '''delay_value_list : delay_value_list ',' delay_value '''
4532 print('delay_value_list_2', list(p
))
4534 # { list<PExpr*>*tmp = p[1];
4535 # tmp->push_back(p[3]);
4541 def p_delay_value_1(p
):
4542 '''delay_value : expression '''
4544 print('delay_value_1', list(p
))
4546 # { PExpr*tmp = p[1];
4552 def p_delay_value_2(p
):
4553 '''delay_value : expression ':' expression ':' expression '''
4555 print('delay_value_2', list(p
))
4557 # { p[0] = pform_select_mtm_expr(p[1], p[3], p[5]); }
4561 def p_delay_value_simple_1(p
):
4562 '''delay_value_simple : DEC_NUMBER '''
4564 print('delay_value_simple_1', list(p
))
4566 # { verinum*tmp = p[1];
4568 # yyerror(@1, "internal error: delay.");
4571 # p[0] = new PENumber(tmp);
4572 # FILE_NAME(p[0], @1);
4579 def p_delay_value_simple_2(p
):
4580 '''delay_value_simple : REALTIME '''
4582 print('delay_value_simple_2', list(p
))
4584 # { verireal*tmp = p[1];
4586 # yyerror(@1, "internal error: delay.");
4589 # p[0] = new PEFNumber(tmp);
4590 # FILE_NAME(p[0], @1);
4596 def p_delay_value_simple_3(p
):
4597 '''delay_value_simple : IDENTIFIER '''
4599 print('delay_value_simple_3', list(p
))
4601 # { PEIdent*tmp = new PEIdent(lex_strings.make(p[1]));
4602 # FILE_NAME(tmp, @1);
4609 def p_delay_value_simple_4(p
):
4610 '''delay_value_simple : TIME_LITERAL '''
4612 print('delay_value_simple_4', list(p
))
4618 # if (p[1] == 0 || !get_time_unit(p[1], unit))
4619 # yyerror(@1, "internal error: delay.");
4621 # double p = pow(10.0,
4622 # (double)(unit - pform_get_timeunit()));
4623 # double time = atof(p[1]) * p;
4625 # verireal *v = new verireal(time);
4626 # p[0] = new PEFNumber(v);
4627 # FILE_NAME(p[0], @1);
4633 def p_optional_semicolon_1(p
):
4634 '''optional_semicolon : ';' '''
4636 print('optional_semicolon_1', list(p
))
4642 def p_optional_semicolon_2(p
):
4643 '''optional_semicolon : '''
4645 print('optional_semicolon_2', list(p
))
4651 def p_discipline_declaration_1(p
):
4652 '''discipline_declaration : K_discipline IDENTIFIER optional_semicolon _embed0_discipline_declaration discipline_items K_enddiscipline '''
4654 print('discipline_declaration_1', list(p
))
4656 # { pform_end_discipline(@1); delete[] p[2]; }
4660 def p__embed0_discipline_declaration(p
):
4661 '''_embed0_discipline_declaration : '''
4663 # { pform_start_discipline(p[2]); }
4667 def p_discipline_items_1(p
):
4668 '''discipline_items : discipline_items discipline_item '''
4670 print('discipline_items_1', list(p
))
4676 def p_discipline_items_2(p
):
4677 '''discipline_items : discipline_item '''
4679 print('discipline_items_2', list(p
))
4685 def p_discipline_item_1(p
):
4686 '''discipline_item : K_domain K_discrete ';' '''
4688 print('discipline_item_1', list(p
))
4690 # { pform_discipline_domain(@1, IVL_DIS_DISCRETE); }
4694 def p_discipline_item_2(p
):
4695 '''discipline_item : K_domain K_continuous ';' '''
4697 print('discipline_item_2', list(p
))
4699 # { pform_discipline_domain(@1, IVL_DIS_CONTINUOUS); }
4703 def p_discipline_item_3(p
):
4704 '''discipline_item : K_potential IDENTIFIER ';' '''
4706 print('discipline_item_3', list(p
))
4708 # { pform_discipline_potential(@1, p[2]); delete[] p[2]; }
4712 def p_discipline_item_4(p
):
4713 '''discipline_item : K_flow IDENTIFIER ';' '''
4715 print('discipline_item_4', list(p
))
4717 # { pform_discipline_flow(@1, p[2]); delete[] p[2]; }
4721 def p_nature_declaration_1(p
):
4722 '''nature_declaration : K_nature IDENTIFIER optional_semicolon _embed0_nature_declaration nature_items K_endnature '''
4724 print('nature_declaration_1', list(p
))
4726 # { pform_end_nature(@1); delete[] p[2]; }
4730 def p__embed0_nature_declaration(p
):
4731 '''_embed0_nature_declaration : '''
4733 # { pform_start_nature(p[2]); }
4737 def p_nature_items_1(p
):
4738 '''nature_items : nature_items nature_item '''
4740 print('nature_items_1', list(p
))
4746 def p_nature_items_2(p
):
4747 '''nature_items : nature_item '''
4749 print('nature_items_2', list(p
))
4755 def p_nature_item_1(p
):
4756 '''nature_item : K_units '=' STRING ';' '''
4758 print('nature_item_1', list(p
))
4760 # { delete[] p[3]; }
4764 def p_nature_item_2(p
):
4765 '''nature_item : K_abstol '=' expression ';' '''
4767 print('nature_item_2', list(p
))
4773 def p_nature_item_3(p
):
4774 '''nature_item : K_access '=' IDENTIFIER ';' '''
4776 print('nature_item_3', list(p
))
4778 # { pform_nature_access(@1, p[3]); delete[] p[3]; }
4782 def p_nature_item_4(p
):
4783 '''nature_item : K_idt_nature '=' IDENTIFIER ';' '''
4785 print('nature_item_4', list(p
))
4787 # { delete[] p[3]; }
4791 def p_nature_item_5(p
):
4792 '''nature_item : K_ddt_nature '=' IDENTIFIER ';' '''
4794 print('nature_item_5', list(p
))
4796 # { delete[] p[3]; }
4800 def p_config_declaration_1(p
):
4801 '''config_declaration : K_config IDENTIFIER ';' K_design lib_cell_identifiers ';' list_of_config_rule_statements K_endconfig '''
4803 print('config_declaration_1', list(p
))
4805 # { cerr << @1 << ": sorry: config declarations are not supported and "
4806 # "will be skipped." << endl;
4812 def p_lib_cell_identifiers_1(p
):
4813 '''lib_cell_identifiers : '''
4815 print('lib_cell_identifiers_1', list(p
))
4821 def p_lib_cell_identifiers_2(p
):
4822 '''lib_cell_identifiers : lib_cell_identifiers lib_cell_id '''
4824 print('lib_cell_identifiers_2', list(p
))
4830 def p_list_of_config_rule_statements_1(p
):
4831 '''list_of_config_rule_statements : '''
4833 print('list_of_config_rule_statements_1', list(p
))
4839 def p_list_of_config_rule_statements_2(p
):
4840 '''list_of_config_rule_statements : list_of_config_rule_statements config_rule_statement '''
4842 print('list_of_config_rule_statements_2', list(p
))
4848 def p_config_rule_statement_1(p
):
4849 '''config_rule_statement : K_default K_liblist list_of_libraries ';' '''
4851 print('config_rule_statement_1', list(p
))
4857 def p_config_rule_statement_2(p
):
4858 '''config_rule_statement : K_instance hierarchy_identifier K_liblist list_of_libraries ';' '''
4860 print('config_rule_statement_2', list(p
))
4866 def p_config_rule_statement_3(p
):
4867 '''config_rule_statement : K_instance hierarchy_identifier K_use lib_cell_id opt_config ';' '''
4869 print('config_rule_statement_3', list(p
))
4875 def p_config_rule_statement_4(p
):
4876 '''config_rule_statement : K_cell lib_cell_id K_liblist list_of_libraries ';' '''
4878 print('config_rule_statement_4', list(p
))
4884 def p_config_rule_statement_5(p
):
4885 '''config_rule_statement : K_cell lib_cell_id K_use lib_cell_id opt_config ';' '''
4887 print('config_rule_statement_5', list(p
))
4893 def p_opt_config_1(p
):
4896 print('opt_config_1', list(p
))
4902 def p_opt_config_2(p
):
4903 '''opt_config : ':' K_config '''
4905 print('opt_config_2', list(p
))
4911 def p_lib_cell_id_1(p
):
4912 '''lib_cell_id : IDENTIFIER '''
4914 print('lib_cell_id_1', list(p
))
4916 # { delete[] p[1]; }
4920 def p_lib_cell_id_2(p
):
4921 '''lib_cell_id : IDENTIFIER '.' IDENTIFIER '''
4923 print('lib_cell_id_2', list(p
))
4925 # { delete[] p[1]; delete[] p[3]; }
4929 def p_list_of_libraries_1(p
):
4930 '''list_of_libraries : '''
4932 print('list_of_libraries_1', list(p
))
4938 def p_list_of_libraries_2(p
):
4939 '''list_of_libraries : list_of_libraries IDENTIFIER '''
4941 print('list_of_libraries_2', list(p
))
4943 # { delete[] p[2]; }
4947 def p_drive_strength_1(p
):
4948 '''drive_strength : '(' dr_strength0 ',' dr_strength1 ')' '''
4950 print('drive_strength_1', list(p
))
4952 # { p[0].str0 = p[2].str0;
4953 # p[0].str1 = p[4].str1;
4958 def p_drive_strength_2(p
):
4959 '''drive_strength : '(' dr_strength1 ',' dr_strength0 ')' '''
4961 print('drive_strength_2', list(p
))
4963 # { p[0].str0 = p[4].str0;
4964 # p[0].str1 = p[2].str1;
4969 def p_drive_strength_3(p
):
4970 '''drive_strength : '(' dr_strength0 ',' K_highz1 ')' '''
4972 print('drive_strength_3', list(p
))
4974 # { p[0].str0 = p[2].str0;
4975 # p[0].str1 = IVL_DR_HiZ;
4980 def p_drive_strength_4(p
):
4981 '''drive_strength : '(' dr_strength1 ',' K_highz0 ')' '''
4983 print('drive_strength_4', list(p
))
4985 # { p[0].str0 = IVL_DR_HiZ;
4986 # p[0].str1 = p[2].str1;
4991 def p_drive_strength_5(p
):
4992 '''drive_strength : '(' K_highz1 ',' dr_strength0 ')' '''
4994 print('drive_strength_5', list(p
))
4996 # { p[0].str0 = p[4].str0;
4997 # p[0].str1 = IVL_DR_HiZ;
5002 def p_drive_strength_6(p
):
5003 '''drive_strength : '(' K_highz0 ',' dr_strength1 ')' '''
5005 print('drive_strength_6', list(p
))
5007 # { p[0].str0 = IVL_DR_HiZ;
5008 # p[0].str1 = p[4].str1;
5013 def p_drive_strength_opt_1(p
):
5014 '''drive_strength_opt : drive_strength '''
5016 print('drive_strength_opt_1', list(p
))
5023 def p_drive_strength_opt_2(p
):
5024 '''drive_strength_opt : '''
5025 if(parse_debug
> 2):
5026 print('drive_strength_opt_2', list(p
))
5028 # { p[0].str0 = IVL_DR_STRONG; p[0].str1 = IVL_DR_STRONG; }
5032 def p_dr_strength0_1(p
):
5033 '''dr_strength0 : K_supply0 '''
5035 print('dr_strength0_1', list(p
))
5037 # { p[0].str0 = IVL_DR_SUPPLY; }
5041 def p_dr_strength0_2(p
):
5042 '''dr_strength0 : K_strong0 '''
5044 print('dr_strength0_2', list(p
))
5046 # { p[0].str0 = IVL_DR_STRONG; }
5050 def p_dr_strength0_3(p
):
5051 '''dr_strength0 : K_pull0 '''
5053 print('dr_strength0_3', list(p
))
5055 # { p[0].str0 = IVL_DR_PULL; }
5059 def p_dr_strength0_4(p
):
5060 '''dr_strength0 : K_weak0 '''
5062 print('dr_strength0_4', list(p
))
5064 # { p[0].str0 = IVL_DR_WEAK; }
5068 def p_dr_strength1_1(p
):
5069 '''dr_strength1 : K_supply1 '''
5071 print('dr_strength1_1', list(p
))
5073 # { p[0].str1 = IVL_DR_SUPPLY; }
5077 def p_dr_strength1_2(p
):
5078 '''dr_strength1 : K_strong1 '''
5080 print('dr_strength1_2', list(p
))
5082 # { p[0].str1 = IVL_DR_STRONG; }
5086 def p_dr_strength1_3(p
):
5087 '''dr_strength1 : K_pull1 '''
5089 print('dr_strength1_3', list(p
))
5091 # { p[0].str1 = IVL_DR_PULL; }
5095 def p_dr_strength1_4(p
):
5096 '''dr_strength1 : K_weak1 '''
5098 print('dr_strength1_4', list(p
))
5100 # { p[0].str1 = IVL_DR_WEAK; }
5104 def p_clocking_event_opt_1(p
):
5105 '''clocking_event_opt : event_control '''
5107 print('clocking_event_opt_1', list(p
))
5113 def p_clocking_event_opt_2(p
):
5114 '''clocking_event_opt : '''
5116 print('clocking_event_opt_2', list(p
))
5122 def p_event_control_1(p
):
5123 '''event_control : '@' hierarchy_identifier '''
5125 print('event_control_1', list(p
))
5127 # { PEIdent*tmpi = new PEIdent(*p[2]);
5128 # PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi);
5129 # PEventStatement*tmps = new PEventStatement(tmpe);
5130 # FILE_NAME(tmps, @1);
5137 def p_event_control_2(p
):
5138 '''event_control : '@' '(' event_expression_list ')' '''
5140 print('event_control_2', list(p
))
5142 # { PEventStatement*tmp = new PEventStatement(*p[3]);
5143 # FILE_NAME(tmp, @1);
5150 def p_event_control_3(p
):
5151 '''event_control : '@' '(' error ')' '''
5153 print('event_control_3', list(p
))
5155 # { yyerror(@1, "error: Malformed event control expression.");
5161 def p_event_expression_list_1(p
):
5162 '''event_expression_list : event_expression '''
5164 print('event_expression_list_1', list(p
))
5171 def p_event_expression_list_2(p
):
5172 '''event_expression_list : event_expression_list K_or event_expression '''
5174 print('event_expression_list_2', list(p
))
5176 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
5184 def p_event_expression_list_3(p
):
5185 '''event_expression_list : event_expression_list ',' event_expression '''
5187 print('event_expression_list_3', list(p
))
5189 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
5197 def p_event_expression_1(p
):
5198 '''event_expression : K_posedge expression '''
5200 print('event_expression_1', list(p
))
5202 # { PEEvent*tmp = new PEEvent(PEEvent::POSEDGE, p[2]);
5203 # FILE_NAME(tmp, @1);
5204 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5211 def p_event_expression_2(p
):
5212 '''event_expression : K_negedge expression '''
5214 print('event_expression_2', list(p
))
5216 # { PEEvent*tmp = new PEEvent(PEEvent::NEGEDGE, p[2]);
5217 # FILE_NAME(tmp, @1);
5218 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5225 def p_event_expression_3(p
):
5226 '''event_expression : expression '''
5228 print('event_expression_3', list(p
))
5230 # { PEEvent*tmp = new PEEvent(PEEvent::ANYEDGE, p[1]);
5231 # FILE_NAME(tmp, @1);
5232 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5239 def p_branch_probe_expression_1(p
):
5240 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ',' IDENTIFIER ')' '''
5242 print('branch_probe_expression_1', list(p
))
5244 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3], p[5]); }
5248 def p_branch_probe_expression_2(p
):
5249 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ')' '''
5251 print('branch_probe_expression_2', list(p
))
5253 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3]); }
5257 def p_expression_1(p
):
5258 '''expression : expr_primary_or_typename '''
5259 if(parse_debug
> 2):
5260 print('expression_1', list(p
))
5267 def p_expression_2(p
):
5268 '''expression : inc_or_dec_expression '''
5270 print('expression_2', list(p
))
5277 def p_expression_3(p
):
5278 '''expression : inside_expression '''
5280 print('expression_3', list(p
))
5287 def p_expression_4(p
):
5288 '''expression : '+' attribute_list_opt expr_primary %prec UNARY_PREC '''
5290 print('expression_4', list(p
))
5297 def p_expression_5(p
):
5298 '''expression : '-' attribute_list_opt expr_primary %prec UNARY_PREC '''
5300 print('expression_5', list(p
))
5302 # { PEUnary*tmp = new PEUnary('-', p[3]);
5303 # FILE_NAME(tmp, @3);
5309 def p_expression_6(p
):
5310 '''expression : '~' attribute_list_opt expr_primary %prec UNARY_PREC '''
5312 print('expression_6', list(p
))
5314 # { PEUnary*tmp = new PEUnary('~', p[3]);
5315 # FILE_NAME(tmp, @3);
5321 def p_expression_7(p
):
5322 '''expression : '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
5324 print('expression_7', list(p
))
5326 # { PEUnary*tmp = new PEUnary('&', p[3]);
5327 # FILE_NAME(tmp, @3);
5333 def p_expression_8(p
):
5334 '''expression : '!' attribute_list_opt expr_primary %prec UNARY_PREC '''
5336 print('expression_8', list(p
))
5338 # { PEUnary*tmp = new PEUnary('!', p[3]);
5339 # FILE_NAME(tmp, @3);
5345 def p_expression_9(p
):
5346 '''expression : '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
5348 print('expression_9', list(p
))
5350 # { PEUnary*tmp = new PEUnary('|', p[3]);
5351 # FILE_NAME(tmp, @3);
5357 def p_expression_10(p
):
5358 '''expression : '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
5360 print('expression_10', list(p
))
5362 # { PEUnary*tmp = new PEUnary('^', p[3]);
5363 # FILE_NAME(tmp, @3);
5369 def p_expression_11(p
):
5370 '''expression : '~' '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
5372 print('expression_11', list(p
))
5374 # { yyerror(@1, "error: '~' '&' is not a valid expression. "
5375 # "Please use operator '~&' instead.");
5381 def p_expression_12(p
):
5382 '''expression : '~' '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
5384 print('expression_12', list(p
))
5386 # { yyerror(@1, "error: '~' '|' is not a valid expression. "
5387 # "Please use operator '~|' instead.");
5393 def p_expression_13(p
):
5394 '''expression : '~' '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
5396 print('expression_13', list(p
))
5398 # { yyerror(@1, "error: '~' '^' is not a valid expression. "
5399 # "Please use operator '~^' instead.");
5405 def p_expression_14(p
):
5406 '''expression : K_NAND attribute_list_opt expr_primary %prec UNARY_PREC '''
5408 print('expression_14', list(p
))
5410 # { PEUnary*tmp = new PEUnary('A', p[3]);
5411 # FILE_NAME(tmp, @3);
5417 def p_expression_15(p
):
5418 '''expression : K_NOR attribute_list_opt expr_primary %prec UNARY_PREC '''
5420 print('expression_15', list(p
))
5422 # { PEUnary*tmp = new PEUnary('N', p[3]);
5423 # FILE_NAME(tmp, @3);
5429 def p_expression_16(p
):
5430 '''expression : K_NXOR attribute_list_opt expr_primary %prec UNARY_PREC '''
5432 print('expression_16', list(p
))
5434 # { PEUnary*tmp = new PEUnary('X', p[3]);
5435 # FILE_NAME(tmp, @3);
5441 def p_expression_17(p
):
5442 '''expression : '!' error %prec UNARY_PREC '''
5444 print('expression_17', list(p
))
5446 # { yyerror(@1, "error: Operand of unary ! "
5447 # "is not a primary expression.");
5453 def p_expression_18(p
):
5454 '''expression : '^' error %prec UNARY_PREC '''
5456 print('expression_18', list(p
))
5458 # { yyerror(@1, "error: Operand of reduction ^ "
5459 # "is not a primary expression.");
5465 def p_expression_19(p
):
5466 '''expression : expression '^' attribute_list_opt expression '''
5468 print('expression_19', list(p
))
5470 # { PEBinary*tmp = new PEBinary('^', p[1], p[4]);
5471 # FILE_NAME(tmp, @2);
5477 def p_expression_20(p
):
5478 '''expression : expression K_POW attribute_list_opt expression '''
5480 print('expression_20', list(p
))
5482 # { PEBinary*tmp = new PEBPower('p', p[1], p[4]);
5483 # FILE_NAME(tmp, @2);
5489 def p_expression_21(p
):
5490 '''expression : expression '*' attribute_list_opt expression '''
5492 print('expression_21', list(p
))
5494 # { PEBinary*tmp = new PEBinary('*', p[1], p[4]);
5495 # FILE_NAME(tmp, @2);
5501 def p_expression_22(p
):
5502 '''expression : expression '/' attribute_list_opt expression '''
5504 print('expression_22', list(p
))
5506 # { PEBinary*tmp = new PEBinary('/', p[1], p[4]);
5507 # FILE_NAME(tmp, @2);
5513 def p_expression_23(p
):
5514 '''expression : expression '%' attribute_list_opt expression '''
5516 print('expression_23', list(p
))
5518 # { PEBinary*tmp = new PEBinary('%', p[1], p[4]);
5519 # FILE_NAME(tmp, @2);
5525 def p_expression_24(p
):
5526 '''expression : expression '+' attribute_list_opt expression '''
5528 print('expression_24', list(p
))
5530 # { PEBinary*tmp = new PEBinary('+', p[1], p[4]);
5531 # FILE_NAME(tmp, @2);
5537 def p_expression_25(p
):
5538 '''expression : expression '-' attribute_list_opt expression '''
5540 print('expression_25', list(p
))
5541 # { PEBinary*tmp = new PEBinary('-', p[1], p[4]);
5542 # FILE_NAME(tmp, @2);
5546 p
[0] = Node(syms
.atom
, [p
[1], Leaf(token
.MINUS
, '-'), p
[4]])
5548 p
[0] = "bad input in p_expression_25"
5554 def p_expression_26(p
):
5555 '''expression : expression '&' attribute_list_opt expression '''
5557 print('expression_26', list(p
))
5559 # { PEBinary*tmp = new PEBinary('&', p[1], p[4]);
5560 # FILE_NAME(tmp, @2);
5566 def p_expression_27(p
):
5567 '''expression : expression '|' attribute_list_opt expression '''
5569 print('expression_27', list(p
))
5571 # { PEBinary*tmp = new PEBinary('|', p[1], p[4]);
5572 # FILE_NAME(tmp, @2);
5578 def p_expression_28(p
):
5579 '''expression : expression K_NAND attribute_list_opt expression '''
5581 print('expression_28', list(p
))
5583 # { PEBinary*tmp = new PEBinary('A', p[1], p[4]);
5584 # FILE_NAME(tmp, @2);
5590 def p_expression_29(p
):
5591 '''expression : expression K_NOR attribute_list_opt expression '''
5593 print('expression_29', list(p
))
5595 # { PEBinary*tmp = new PEBinary('O', p[1], p[4]);
5596 # FILE_NAME(tmp, @2);
5602 def p_expression_30(p
):
5603 '''expression : expression K_NXOR attribute_list_opt expression '''
5605 print('expression_30', list(p
))
5607 # { PEBinary*tmp = new PEBinary('X', p[1], p[4]);
5608 # FILE_NAME(tmp, @2);
5614 def p_expression_31(p
):
5615 '''expression : expression '<' attribute_list_opt expression '''
5617 print('expression_31', list(p
))
5619 # { PEBinary*tmp = new PEBComp('<', p[1], p[4]);
5620 # FILE_NAME(tmp, @2);
5626 def p_expression_32(p
):
5627 '''expression : expression '>' attribute_list_opt expression '''
5629 print('expression_32', list(p
))
5631 # { PEBinary*tmp = new PEBComp('>', p[1], p[4]);
5632 # FILE_NAME(tmp, @2);
5638 def p_expression_33(p
):
5639 '''expression : expression K_LS attribute_list_opt expression '''
5641 print('expression_33', list(p
))
5643 # { PEBinary*tmp = new PEBShift('l', p[1], p[4]);
5644 # FILE_NAME(tmp, @2);
5650 def p_expression_34(p
):
5651 '''expression : expression K_RS attribute_list_opt expression '''
5653 print('expression_34', list(p
))
5655 # { PEBinary*tmp = new PEBShift('r', p[1], p[4]);
5656 # FILE_NAME(tmp, @2);
5662 def p_expression_35(p
):
5663 '''expression : expression K_RSS attribute_list_opt expression '''
5665 print('expression_35', list(p
))
5667 # { PEBinary*tmp = new PEBShift('R', p[1], p[4]);
5668 # FILE_NAME(tmp, @2);
5674 def p_expression_36(p
):
5675 '''expression : expression K_EQ attribute_list_opt expression '''
5677 print('expression_36', list(p
))
5679 # { PEBinary*tmp = new PEBComp('e', p[1], p[4]);
5680 # FILE_NAME(tmp, @2);
5686 def p_expression_37(p
):
5687 '''expression : expression K_CEQ attribute_list_opt expression '''
5689 print('expression_37', list(p
))
5691 # { PEBinary*tmp = new PEBComp('E', p[1], p[4]);
5692 # FILE_NAME(tmp, @2);
5698 def p_expression_38(p
):
5699 '''expression : expression K_WEQ attribute_list_opt expression '''
5701 print('expression_38', list(p
))
5703 # { PEBinary*tmp = new PEBComp('w', p[1], p[4]);
5704 # FILE_NAME(tmp, @2);
5710 def p_expression_39(p
):
5711 '''expression : expression K_LE attribute_list_opt expression '''
5713 print('expression_39', list(p
))
5715 # { PEBinary*tmp = new PEBComp('L', p[1], p[4]);
5716 # FILE_NAME(tmp, @2);
5722 def p_expression_40(p
):
5723 '''expression : expression K_GE attribute_list_opt expression '''
5725 print('expression_40', list(p
))
5727 # { PEBinary*tmp = new PEBComp('G', p[1], p[4]);
5728 # FILE_NAME(tmp, @2);
5734 def p_expression_41(p
):
5735 '''expression : expression K_NE attribute_list_opt expression '''
5737 print('expression_41', list(p
))
5739 # { PEBinary*tmp = new PEBComp('n', p[1], p[4]);
5740 # FILE_NAME(tmp, @2);
5746 def p_expression_42(p
):
5747 '''expression : expression K_CNE attribute_list_opt expression '''
5749 print('expression_42', list(p
))
5751 # { PEBinary*tmp = new PEBComp('N', p[1], p[4]);
5752 # FILE_NAME(tmp, @2);
5758 def p_expression_43(p
):
5759 '''expression : expression K_WNE attribute_list_opt expression '''
5761 print('expression_43', list(p
))
5763 # { PEBinary*tmp = new PEBComp('W', p[1], p[4]);
5764 # FILE_NAME(tmp, @2);
5770 def p_expression_44(p
):
5771 '''expression : expression K_LOR attribute_list_opt expression '''
5773 print('expression_44', list(p
))
5775 # { PEBinary*tmp = new PEBLogic('o', p[1], p[4]);
5776 # FILE_NAME(tmp, @2);
5782 def p_expression_45(p
):
5783 '''expression : expression K_LAND attribute_list_opt expression '''
5785 print('expression_45', list(p
))
5787 # { PEBinary*tmp = new PEBLogic('a', p[1], p[4]);
5788 # FILE_NAME(tmp, @2);
5794 def p_expression_46(p
):
5795 '''expression : expression '?' attribute_list_opt expression ':' expression '''
5797 print('expression_46', list(p
))
5799 # { PETernary*tmp = new PETernary(p[1], p[4], p[6]);
5800 # FILE_NAME(tmp, @2);
5806 def p_expr_mintypmax_1(p
):
5807 '''expr_mintypmax : expression '''
5809 print('expr_mintypmax_1', list(p
))
5816 def p_expr_mintypmax_2(p
):
5817 '''expr_mintypmax : expression ':' expression ':' expression '''
5819 print('expr_mintypmax_2', list(p
))
5821 # { switch (min_typ_max_flag) {
5838 # if (min_typ_max_warn > 0) {
5839 # cerr << p[0]->get_fileline() << ": warning: choosing ";
5840 # switch (min_typ_max_flag) {
5851 # cerr << " expression." << endl;
5852 # min_typ_max_warn -= 1;
5858 def p_expression_list_with_nuls_1(p
):
5859 '''expression_list_with_nuls : expression_list_with_nuls ',' expression '''
5861 print('expression_list_with_nuls_1', list(p
))
5863 # { list<PExpr*>*tmp = p[1];
5864 # tmp->push_back(p[3]);
5870 def p_expression_list_with_nuls_2(p
):
5871 '''expression_list_with_nuls : expression '''
5873 print('expression_list_with_nuls_2', list(p
))
5875 # { list<PExpr*>*tmp = new list<PExpr*>;
5876 # tmp->push_back(p[1]);
5882 def p_expression_list_with_nuls_3(p
):
5883 '''expression_list_with_nuls : '''
5885 print('expression_list_with_nuls_3', list(p
))
5887 # { list<PExpr*>*tmp = new list<PExpr*>;
5888 # tmp->push_back(0);
5894 def p_expression_list_with_nuls_4(p
):
5895 '''expression_list_with_nuls : expression_list_with_nuls ',' '''
5897 print('expression_list_with_nuls_4', list(p
))
5899 # { list<PExpr*>*tmp = p[1];
5900 # tmp->push_back(0);
5906 def p_expression_list_proper_1(p
):
5907 '''expression_list_proper : expression_list_proper ',' expression '''
5909 print('expression_list_proper_1', list(p
))
5911 # { list<PExpr*>*tmp = p[1];
5912 # tmp->push_back(p[3]);
5918 def p_expression_list_proper_2(p
):
5919 '''expression_list_proper : expression '''
5921 print('expression_list_proper_2', list(p
))
5923 # { list<PExpr*>*tmp = new list<PExpr*>;
5924 # tmp->push_back(p[1]);
5930 def p_expr_primary_or_typename_1(p
):
5931 '''expr_primary_or_typename : expr_primary '''
5932 if(parse_debug
> 2):
5933 print('expr_primary_or_typename_1', list(p
))
5940 def p_expr_primary_or_typename_2(p
):
5941 '''expr_primary_or_typename : TYPE_IDENTIFIER '''
5943 print('expr_primary_or_typename_2', list(p
))
5946 # { PETypename*tmp = new PETypename(p[1].type);
5947 # FILE_NAME(tmp,@1);
5949 # delete[]p[1].text;
5954 def p_expr_primary_1(p
):
5955 '''expr_primary : number '''
5957 print('expr_primary_1', list(p
))
5961 # PENumber*tmp = new PENumber(p[1]);
5962 # FILE_NAME(tmp, @1);
5968 def p_expr_primary_2(p
):
5969 '''expr_primary : REALTIME '''
5971 print('expr_primary_2', list(p
))
5973 # { PEFNumber*tmp = new PEFNumber(p[1]);
5974 # FILE_NAME(tmp, @1);
5980 def p_expr_primary_3(p
):
5981 '''expr_primary : STRING '''
5983 print('expr_primary_3', list(p
))
5985 # { PEString*tmp = new PEString(p[1]);
5986 # FILE_NAME(tmp, @1);
5992 def p_expr_primary_4(p
):
5993 '''expr_primary : TIME_LITERAL '''
5995 print('expr_primary_4', list(p
))
6001 # if (p[1] == 0 || !get_time_unit(p[1], unit))
6002 # yyerror(@1, "internal error: delay.");
6004 # double p = pow(10.0, (double)(unit - pform_get_timeunit()));
6005 # double time = atof(p[1]) * p;
6007 # verireal *v = new verireal(time);
6008 # p[0] = new PEFNumber(v);
6009 # FILE_NAME(p[0], @1);
6015 def p_expr_primary_5(p
):
6016 '''expr_primary : SYSTEM_IDENTIFIER '''
6018 print('expr_primary_5', list(p
))
6020 # { perm_string tn = lex_strings.make(p[1]);
6021 # PECallFunction*tmp = new PECallFunction(tn);
6022 # FILE_NAME(tmp, @1);
6029 def p_expr_primary_6(p
):
6030 '''expr_primary : hierarchy_identifier '''
6031 if(parse_debug
> 2):
6032 print('expr_primary_6', list(p
))
6035 # { PEIdent*tmp = pform_new_ident(*p[1]);
6036 # FILE_NAME(tmp, @1);
6043 def p_expr_primary_7(p
):
6044 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier '''
6046 print('expr_primary_7', list(p
))
6048 # { p[0] = pform_package_ident(@2, p[1], p[3]);
6054 def p_expr_primary_8(p
):
6055 '''expr_primary : hierarchy_identifier '(' expression_list_with_nuls ')' '''
6057 print('expr_primary_8', list(p
))
6059 # { list<PExpr*>*expr_list = p[3];
6060 # strip_tail_items(expr_list);
6061 # PECallFunction*tmp = pform_make_call_function(@1, *p[1], *expr_list);
6068 def p_expr_primary_9(p
):
6069 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' '''
6071 print('expr_primary_9', list(p
))
6073 # { pform_name_t*t_name = p[1];
6074 # while (! p[3]->empty()) {
6075 # t_name->push_back(p[3]->front());
6076 # p[3]->pop_front();
6078 # list<PExpr*>*expr_list = p[5];
6079 # strip_tail_items(expr_list);
6080 # PECallFunction*tmp = pform_make_call_function(@1, *t_name, *expr_list);
6088 def p_expr_primary_10(p
):
6089 '''expr_primary : SYSTEM_IDENTIFIER '(' expression_list_proper ')' '''
6091 print('expr_primary_10', list(p
))
6093 # { perm_string tn = lex_strings.make(p[1]);
6094 # PECallFunction*tmp = new PECallFunction(tn, *p[3]);
6095 # FILE_NAME(tmp, @1);
6102 def p_expr_primary_11(p
):
6103 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')' '''
6105 print('expr_primary_11', list(p
))
6107 # { perm_string use_name = lex_strings.make(p[3]);
6108 # PECallFunction*tmp = new PECallFunction(p[1], use_name, *p[5]);
6109 # FILE_NAME(tmp, @3);
6116 def p_expr_primary_12(p
):
6117 '''expr_primary : SYSTEM_IDENTIFIER '(' ')' '''
6119 print('expr_primary_12', list(p
))
6121 # { perm_string tn = lex_strings.make(p[1]);
6122 # const vector<PExpr*>empty;
6123 # PECallFunction*tmp = new PECallFunction(tn, empty);
6124 # FILE_NAME(tmp, @1);
6127 # if (!gn_system_verilog()) {
6128 # yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
6134 def p_expr_primary_13(p
):
6135 '''expr_primary : implicit_class_handle '''
6137 print('expr_primary_13', list(p
))
6139 # { PEIdent*tmp = new PEIdent(*p[1]);
6140 # FILE_NAME(tmp,@1);
6147 def p_expr_primary_14(p
):
6148 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '''
6150 print('expr_primary_14', list(p
))
6152 # { pform_name_t*t_name = p[1];
6153 # while (! p[3]->empty()) {
6154 # t_name->push_back(p[3]->front());
6155 # p[3]->pop_front();
6157 # PEIdent*tmp = new PEIdent(*t_name);
6158 # FILE_NAME(tmp,@1);
6166 def p_expr_primary_15(p
):
6167 '''expr_primary : K_acos '(' expression ')' '''
6169 print('expr_primary_15', list(p
))
6171 # { perm_string tn = perm_string::literal("$acos");
6172 # PECallFunction*tmp = make_call_function(tn, p[3]);
6173 # FILE_NAME(tmp,@1);
6179 def p_expr_primary_16(p
):
6180 '''expr_primary : K_acosh '(' expression ')' '''
6182 print('expr_primary_16', list(p
))
6184 # { perm_string tn = perm_string::literal("$acosh");
6185 # PECallFunction*tmp = make_call_function(tn, p[3]);
6186 # FILE_NAME(tmp,@1);
6192 def p_expr_primary_17(p
):
6193 '''expr_primary : K_asin '(' expression ')' '''
6195 print('expr_primary_17', list(p
))
6197 # { perm_string tn = perm_string::literal("$asin");
6198 # PECallFunction*tmp = make_call_function(tn, p[3]);
6199 # FILE_NAME(tmp,@1);
6205 def p_expr_primary_18(p
):
6206 '''expr_primary : K_asinh '(' expression ')' '''
6208 print('expr_primary_18', list(p
))
6210 # { perm_string tn = perm_string::literal("$asinh");
6211 # PECallFunction*tmp = make_call_function(tn, p[3]);
6212 # FILE_NAME(tmp,@1);
6218 def p_expr_primary_19(p
):
6219 '''expr_primary : K_atan '(' expression ')' '''
6221 print('expr_primary_19', list(p
))
6223 # { perm_string tn = perm_string::literal("$atan");
6224 # PECallFunction*tmp = make_call_function(tn, p[3]);
6225 # FILE_NAME(tmp,@1);
6231 def p_expr_primary_20(p
):
6232 '''expr_primary : K_atanh '(' expression ')' '''
6234 print('expr_primary_20', list(p
))
6236 # { perm_string tn = perm_string::literal("$atanh");
6237 # PECallFunction*tmp = make_call_function(tn, p[3]);
6238 # FILE_NAME(tmp,@1);
6244 def p_expr_primary_21(p
):
6245 '''expr_primary : K_atan2 '(' expression ',' expression ')' '''
6247 print('expr_primary_21', list(p
))
6249 # { perm_string tn = perm_string::literal("$atan2");
6250 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6251 # FILE_NAME(tmp,@1);
6257 def p_expr_primary_22(p
):
6258 '''expr_primary : K_ceil '(' expression ')' '''
6260 print('expr_primary_22', list(p
))
6262 # { perm_string tn = perm_string::literal("$ceil");
6263 # PECallFunction*tmp = make_call_function(tn, p[3]);
6264 # FILE_NAME(tmp,@1);
6270 def p_expr_primary_23(p
):
6271 '''expr_primary : K_cos '(' expression ')' '''
6273 print('expr_primary_23', list(p
))
6275 # { perm_string tn = perm_string::literal("$cos");
6276 # PECallFunction*tmp = make_call_function(tn, p[3]);
6277 # FILE_NAME(tmp,@1);
6283 def p_expr_primary_24(p
):
6284 '''expr_primary : K_cosh '(' expression ')' '''
6286 print('expr_primary_24', list(p
))
6288 # { perm_string tn = perm_string::literal("$cosh");
6289 # PECallFunction*tmp = make_call_function(tn, p[3]);
6290 # FILE_NAME(tmp,@1);
6296 def p_expr_primary_25(p
):
6297 '''expr_primary : K_exp '(' expression ')' '''
6299 print('expr_primary_25', list(p
))
6301 # { perm_string tn = perm_string::literal("$exp");
6302 # PECallFunction*tmp = make_call_function(tn, p[3]);
6303 # FILE_NAME(tmp,@1);
6309 def p_expr_primary_26(p
):
6310 '''expr_primary : K_floor '(' expression ')' '''
6312 print('expr_primary_26', list(p
))
6314 # { perm_string tn = perm_string::literal("$floor");
6315 # PECallFunction*tmp = make_call_function(tn, p[3]);
6316 # FILE_NAME(tmp,@1);
6322 def p_expr_primary_27(p
):
6323 '''expr_primary : K_hypot '(' expression ',' expression ')' '''
6325 print('expr_primary_27', list(p
))
6327 # { perm_string tn = perm_string::literal("$hypot");
6328 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6329 # FILE_NAME(tmp,@1);
6335 def p_expr_primary_28(p
):
6336 '''expr_primary : K_ln '(' expression ')' '''
6338 print('expr_primary_28', list(p
))
6340 # { perm_string tn = perm_string::literal("$ln");
6341 # PECallFunction*tmp = make_call_function(tn, p[3]);
6342 # FILE_NAME(tmp,@1);
6348 def p_expr_primary_29(p
):
6349 '''expr_primary : K_log '(' expression ')' '''
6351 print('expr_primary_29', list(p
))
6353 # { perm_string tn = perm_string::literal("$log10");
6354 # PECallFunction*tmp = make_call_function(tn, p[3]);
6355 # FILE_NAME(tmp,@1);
6361 def p_expr_primary_30(p
):
6362 '''expr_primary : K_pow '(' expression ',' expression ')' '''
6364 print('expr_primary_30', list(p
))
6366 # { perm_string tn = perm_string::literal("$pow");
6367 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6368 # FILE_NAME(tmp,@1);
6374 def p_expr_primary_31(p
):
6375 '''expr_primary : K_sin '(' expression ')' '''
6377 print('expr_primary_31', list(p
))
6379 # { perm_string tn = perm_string::literal("$sin");
6380 # PECallFunction*tmp = make_call_function(tn, p[3]);
6381 # FILE_NAME(tmp,@1);
6387 def p_expr_primary_32(p
):
6388 '''expr_primary : K_sinh '(' expression ')' '''
6390 print('expr_primary_32', list(p
))
6392 # { perm_string tn = perm_string::literal("$sinh");
6393 # PECallFunction*tmp = make_call_function(tn, p[3]);
6394 # FILE_NAME(tmp,@1);
6400 def p_expr_primary_33(p
):
6401 '''expr_primary : K_sqrt '(' expression ')' '''
6403 print('expr_primary_33', list(p
))
6405 # { perm_string tn = perm_string::literal("$sqrt");
6406 # PECallFunction*tmp = make_call_function(tn, p[3]);
6407 # FILE_NAME(tmp,@1);
6413 def p_expr_primary_34(p
):
6414 '''expr_primary : K_tan '(' expression ')' '''
6416 print('expr_primary_34', list(p
))
6418 # { perm_string tn = perm_string::literal("$tan");
6419 # PECallFunction*tmp = make_call_function(tn, p[3]);
6420 # FILE_NAME(tmp,@1);
6426 def p_expr_primary_35(p
):
6427 '''expr_primary : K_tanh '(' expression ')' '''
6429 print('expr_primary_35', list(p
))
6431 # { perm_string tn = perm_string::literal("$tanh");
6432 # PECallFunction*tmp = make_call_function(tn, p[3]);
6433 # FILE_NAME(tmp,@1);
6439 def p_expr_primary_36(p
):
6440 '''expr_primary : K_abs '(' expression ')' '''
6442 print('expr_primary_36', list(p
))
6444 # { PEUnary*tmp = new PEUnary('m', p[3]);
6445 # FILE_NAME(tmp,@1);
6451 def p_expr_primary_37(p
):
6452 '''expr_primary : K_max '(' expression ',' expression ')' '''
6454 print('expr_primary_37', list(p
))
6456 # { PEBinary*tmp = new PEBinary('M', p[3], p[5]);
6457 # FILE_NAME(tmp,@1);
6463 def p_expr_primary_38(p
):
6464 '''expr_primary : K_min '(' expression ',' expression ')' '''
6466 print('expr_primary_38', list(p
))
6468 # { PEBinary*tmp = new PEBinary('m', p[3], p[5]);
6469 # FILE_NAME(tmp,@1);
6475 def p_expr_primary_39(p
):
6476 '''expr_primary : '(' expr_mintypmax ')' '''
6478 print('expr_primary_39', list(p
))
6485 def p_expr_primary_40(p
):
6486 '''expr_primary : '{' expression_list_proper '}' '''
6488 print('expr_primary_40', list(p
))
6490 # { PEConcat*tmp = new PEConcat(*p[2]);
6491 # FILE_NAME(tmp, @1);
6498 def p_expr_primary_41(p
):
6499 '''expr_primary : '{' expression '{' expression_list_proper '}' '}' '''
6501 print('expr_primary_41', list(p
))
6503 # { PExpr*rep = p[2];
6504 # PEConcat*tmp = new PEConcat(*p[4], rep);
6505 # FILE_NAME(tmp, @1);
6512 def p_expr_primary_42(p
):
6513 '''expr_primary : '{' expression '{' expression_list_proper '}' error '}' '''
6515 print('expr_primary_42', list(p
))
6517 # { PExpr*rep = p[2];
6518 # PEConcat*tmp = new PEConcat(*p[4], rep);
6519 # FILE_NAME(tmp, @1);
6522 # yyerror(@5, "error: Syntax error between internal '}' "
6523 # "and closing '}' of repeat concatenation.");
6529 def p_expr_primary_43(p
):
6530 '''expr_primary : '{' '}' '''
6532 print('expr_primary_43', list(p
))
6534 # { // This is the empty queue syntax.
6535 # if (gn_system_verilog()) {
6536 # list<PExpr*> empty_list;
6537 # PEConcat*tmp = new PEConcat(empty_list);
6538 # FILE_NAME(tmp, @1);
6541 # yyerror(@1, "error: Concatenations are not allowed to be empty.");
6548 def p_expr_primary_44(p
):
6549 '''expr_primary : expr_primary "'" '(' expression ')' '''
6551 print('expr_primary_44', list(p
))
6553 # { PExpr*base = p[4];
6554 # if (gn_system_verilog()) {
6555 # PECastSize*tmp = new PECastSize(p[1], base);
6556 # FILE_NAME(tmp, @1);
6559 # yyerror(@1, "error: Size cast requires SystemVerilog.");
6566 def p_expr_primary_45(p
):
6567 '''expr_primary : simple_type_or_string "'" '(' expression ')' '''
6569 print('expr_primary_45', list(p
))
6571 # { PExpr*base = p[4];
6572 # if (gn_system_verilog()) {
6573 # PECastType*tmp = new PECastType(p[1], base);
6574 # FILE_NAME(tmp, @1);
6577 # yyerror(@1, "error: Type cast requires SystemVerilog.");
6584 def p_expr_primary_46(p
):
6585 '''expr_primary : assignment_pattern '''
6587 print('expr_primary_46', list(p
))
6594 def p_expr_primary_47(p
):
6595 '''expr_primary : streaming_concatenation '''
6597 print('expr_primary_47', list(p
))
6604 def p_expr_primary_48(p
):
6605 '''expr_primary : K_null '''
6607 print('expr_primary_48', list(p
))
6609 # { PENull*tmp = new PENull;
6610 # FILE_NAME(tmp, @1);
6616 def p_function_item_list_opt_1(p
):
6617 '''function_item_list_opt : function_item_list '''
6619 print('function_item_list_opt_1', list(p
))
6626 def p_function_item_list_opt_2(p
):
6627 '''function_item_list_opt : '''
6629 print('function_item_list_opt_2', list(p
))
6635 def p_function_item_list_1(p
):
6636 '''function_item_list : function_item '''
6638 print('function_item_list_1', list(p
))
6645 def p_function_item_list_2(p
):
6646 '''function_item_list : function_item_list function_item '''
6648 print('function_item_list_2', list(p
))
6651 # if (p[1] && p[2]) {
6652 # vector<pform_tf_port_t>*tmp = p[1];
6653 # size_t s1 = tmp->size();
6654 # tmp->resize(s1 + p[2]->size());
6655 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
6656 # tmp->at(s1+idx) = p[2]->at(idx);
6659 # } else if (p[1]) {
6668 def p_function_item_1(p
):
6669 '''function_item : tf_port_declaration '''
6671 print('function_item_1', list(p
))
6678 def p_function_item_2(p
):
6679 '''function_item : block_item_decl '''
6681 print('function_item_2', list(p
))
6687 def p_gate_instance_1(p
):
6688 '''gate_instance : IDENTIFIER '(' expression_list_with_nuls ')' '''
6690 print('gate_instance_1', list(p
))
6692 # { lgate*tmp = new lgate;
6694 # tmp->parms = p[3];
6695 # tmp->file = @1.text;
6696 # tmp->lineno = @1.first_line;
6703 def p_gate_instance_2(p
):
6704 '''gate_instance : IDENTIFIER dimensions '(' expression_list_with_nuls ')' '''
6706 print('gate_instance_2', list(p
))
6708 # { lgate*tmp = new lgate;
6709 # list<pform_range_t>*rng = p[2];
6711 # tmp->parms = p[4];
6712 # tmp->range = rng->front();
6714 # assert(rng->empty());
6715 # tmp->file = @1.text;
6716 # tmp->lineno = @1.first_line;
6724 def p_gate_instance_3(p
):
6725 '''gate_instance : '(' expression_list_with_nuls ')' '''
6727 print('gate_instance_3', list(p
))
6729 # { lgate*tmp = new lgate;
6731 # tmp->parms = p[2];
6732 # tmp->file = @1.text;
6733 # tmp->lineno = @1.first_line;
6739 def p_gate_instance_4(p
):
6740 '''gate_instance : IDENTIFIER dimensions '''
6742 print('gate_instance_4', list(p
))
6744 # { lgate*tmp = new lgate;
6745 # list<pform_range_t>*rng = p[2];
6748 # tmp->parms_by_name = 0;
6749 # tmp->range = rng->front();
6751 # assert(rng->empty());
6752 # tmp->file = @1.text;
6753 # tmp->lineno = @1.first_line;
6761 def p_gate_instance_5(p
):
6762 '''gate_instance : IDENTIFIER '(' port_name_list ')' '''
6764 print('gate_instance_5', list(p
))
6766 # { lgate*tmp = new lgate;
6769 # tmp->parms_by_name = p[3];
6770 # tmp->file = @1.text;
6771 # tmp->lineno = @1.first_line;
6778 def p_gate_instance_6(p
):
6779 '''gate_instance : IDENTIFIER dimensions '(' port_name_list ')' '''
6781 print('gate_instance_6', list(p
))
6783 # { lgate*tmp = new lgate;
6784 # list<pform_range_t>*rng = p[2];
6787 # tmp->parms_by_name = p[4];
6788 # tmp->range = rng->front();
6790 # assert(rng->empty());
6791 # tmp->file = @1.text;
6792 # tmp->lineno = @1.first_line;
6800 def p_gate_instance_7(p
):
6801 '''gate_instance : IDENTIFIER '(' error ')' '''
6803 print('gate_instance_7', list(p
))
6805 # { lgate*tmp = new lgate;
6808 # tmp->parms_by_name = 0;
6809 # tmp->file = @1.text;
6810 # tmp->lineno = @1.first_line;
6811 # yyerror(@2, "error: Syntax error in instance port "
6812 # "expression(s).");
6819 def p_gate_instance_8(p
):
6820 '''gate_instance : IDENTIFIER dimensions '(' error ')' '''
6822 print('gate_instance_8', list(p
))
6824 # { lgate*tmp = new lgate;
6827 # tmp->parms_by_name = 0;
6828 # tmp->file = @1.text;
6829 # tmp->lineno = @1.first_line;
6830 # yyerror(@3, "error: Syntax error in instance port "
6831 # "expression(s).");
6838 def p_gate_instance_list_1(p
):
6839 '''gate_instance_list : gate_instance_list ',' gate_instance '''
6841 print('gate_instance_list_1', list(p
))
6843 # { svector<lgate>*tmp1 = p[1];
6844 # lgate*tmp2 = p[3];
6845 # svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
6853 def p_gate_instance_list_2(p
):
6854 '''gate_instance_list : gate_instance '''
6856 print('gate_instance_list_2', list(p
))
6858 # { svector<lgate>*tmp = new svector<lgate>(1);
6859 # (*tmp)[0] = *p[1];
6866 def p_gatetype_1(p
):
6867 '''gatetype : K_and '''
6869 print('gatetype_1', list(p
))
6871 # { p[0] = PGBuiltin::AND; }
6875 def p_gatetype_2(p
):
6876 '''gatetype : K_nand '''
6878 print('gatetype_2', list(p
))
6880 # { p[0] = PGBuiltin::NAND; }
6884 def p_gatetype_3(p
):
6885 '''gatetype : K_or '''
6887 print('gatetype_3', list(p
))
6889 # { p[0] = PGBuiltin::OR; }
6893 def p_gatetype_4(p
):
6894 '''gatetype : K_nor '''
6896 print('gatetype_4', list(p
))
6898 # { p[0] = PGBuiltin::NOR; }
6902 def p_gatetype_5(p
):
6903 '''gatetype : K_xor '''
6905 print('gatetype_5', list(p
))
6907 # { p[0] = PGBuiltin::XOR; }
6911 def p_gatetype_6(p
):
6912 '''gatetype : K_xnor '''
6914 print('gatetype_6', list(p
))
6916 # { p[0] = PGBuiltin::XNOR; }
6920 def p_gatetype_7(p
):
6921 '''gatetype : K_buf '''
6923 print('gatetype_7', list(p
))
6925 # { p[0] = PGBuiltin::BUF; }
6929 def p_gatetype_8(p
):
6930 '''gatetype : K_bufif0 '''
6932 print('gatetype_8', list(p
))
6934 # { p[0] = PGBuiltin::BUFIF0; }
6938 def p_gatetype_9(p
):
6939 '''gatetype : K_bufif1 '''
6941 print('gatetype_9', list(p
))
6943 # { p[0] = PGBuiltin::BUFIF1; }
6947 def p_gatetype_10(p
):
6948 '''gatetype : K_not '''
6950 print('gatetype_10', list(p
))
6952 # { p[0] = PGBuiltin::NOT; }
6956 def p_gatetype_11(p
):
6957 '''gatetype : K_notif0 '''
6959 print('gatetype_11', list(p
))
6961 # { p[0] = PGBuiltin::NOTIF0; }
6965 def p_gatetype_12(p
):
6966 '''gatetype : K_notif1 '''
6968 print('gatetype_12', list(p
))
6970 # { p[0] = PGBuiltin::NOTIF1; }
6974 def p_switchtype_1(p
):
6975 '''switchtype : K_nmos '''
6977 print('switchtype_1', list(p
))
6979 # { p[0] = PGBuiltin::NMOS; }
6983 def p_switchtype_2(p
):
6984 '''switchtype : K_rnmos '''
6986 print('switchtype_2', list(p
))
6988 # { p[0] = PGBuiltin::RNMOS; }
6992 def p_switchtype_3(p
):
6993 '''switchtype : K_pmos '''
6995 print('switchtype_3', list(p
))
6997 # { p[0] = PGBuiltin::PMOS; }
7001 def p_switchtype_4(p
):
7002 '''switchtype : K_rpmos '''
7004 print('switchtype_4', list(p
))
7006 # { p[0] = PGBuiltin::RPMOS; }
7010 def p_switchtype_5(p
):
7011 '''switchtype : K_cmos '''
7013 print('switchtype_5', list(p
))
7015 # { p[0] = PGBuiltin::CMOS; }
7019 def p_switchtype_6(p
):
7020 '''switchtype : K_rcmos '''
7022 print('switchtype_6', list(p
))
7024 # { p[0] = PGBuiltin::RCMOS; }
7028 def p_switchtype_7(p
):
7029 '''switchtype : K_tran '''
7031 print('switchtype_7', list(p
))
7033 # { p[0] = PGBuiltin::TRAN; }
7037 def p_switchtype_8(p
):
7038 '''switchtype : K_rtran '''
7040 print('switchtype_8', list(p
))
7042 # { p[0] = PGBuiltin::RTRAN; }
7046 def p_switchtype_9(p
):
7047 '''switchtype : K_tranif0 '''
7049 print('switchtype_9', list(p
))
7051 # { p[0] = PGBuiltin::TRANIF0; }
7055 def p_switchtype_10(p
):
7056 '''switchtype : K_tranif1 '''
7058 print('switchtype_10', list(p
))
7060 # { p[0] = PGBuiltin::TRANIF1; }
7064 def p_switchtype_11(p
):
7065 '''switchtype : K_rtranif0 '''
7067 print('switchtype_11', list(p
))
7069 # { p[0] = PGBuiltin::RTRANIF0; }
7073 def p_switchtype_12(p
):
7074 '''switchtype : K_rtranif1 '''
7076 print('switchtype_12', list(p
))
7078 # { p[0] = PGBuiltin::RTRANIF1; }
7082 def p_hierarchy_identifier_1(p
):
7083 '''hierarchy_identifier : IDENTIFIER '''
7085 print('hierarchy_identifier_1 FIXME', list(p
))
7086 lpvalue
= Leaf(token
.NAME
, p
[1])
7089 # { p[0] = new pform_name_t;
7090 # p[0]->push_back(name_component_t(lex_strings.make(p[1])));
7096 def p_hierarchy_identifier_2(p
):
7097 '''hierarchy_identifier : hierarchy_identifier '.' IDENTIFIER '''
7099 print('hierarchy_identifier_2', list(p
))
7101 # { pform_name_t * tmp = p[1];
7102 # tmp->push_back(name_component_t(lex_strings.make(p[3])));
7109 def p_hierarchy_identifier_3(p
):
7110 '''hierarchy_identifier : hierarchy_identifier '[' expression ']' '''
7112 print('hierarchy_identifier_3', list(p
))
7114 # { pform_name_t * tmp = p[1];
7115 # name_component_t&tail = tmp->back();
7116 # index_component_t itmp;
7117 # itmp.sel = index_component_t::SEL_BIT;
7119 # tail.index.push_back(itmp);
7125 def p_hierarchy_identifier_4(p
):
7126 '''hierarchy_identifier : hierarchy_identifier '[' '$' ']' '''
7128 print('hierarchy_identifier_4', list(p
))
7130 # { pform_name_t * tmp = p[1];
7131 # name_component_t&tail = tmp->back();
7132 # if (! gn_system_verilog()) {
7133 # yyerror(@3, "error: Last element expression ($) "
7134 # "requires SystemVerilog. Try enabling SystemVerilog.");
7136 # index_component_t itmp;
7137 # itmp.sel = index_component_t::SEL_BIT_LAST;
7140 # tail.index.push_back(itmp);
7146 def p_hierarchy_identifier_5(p
):
7147 '''hierarchy_identifier : hierarchy_identifier '[' expression ':' expression ']' '''
7149 print('hierarchy_identifier_5', list(p
))
7151 # { pform_name_t * tmp = p[1];
7152 # name_component_t&tail = tmp->back();
7153 # index_component_t itmp;
7154 # itmp.sel = index_component_t::SEL_PART;
7157 # tail.index.push_back(itmp);
7163 def p_hierarchy_identifier_6(p
):
7164 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_POS expression ']' '''
7166 print('hierarchy_identifier_6', list(p
))
7168 # { pform_name_t * tmp = p[1];
7169 # name_component_t&tail = tmp->back();
7170 # index_component_t itmp;
7171 # itmp.sel = index_component_t::SEL_IDX_UP;
7174 # tail.index.push_back(itmp);
7180 def p_hierarchy_identifier_7(p
):
7181 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_NEG expression ']' '''
7183 print('hierarchy_identifier_7', list(p
))
7185 # { pform_name_t * tmp = p[1];
7186 # name_component_t&tail = tmp->back();
7187 # index_component_t itmp;
7188 # itmp.sel = index_component_t::SEL_IDX_DO;
7191 # tail.index.push_back(itmp);
7197 def p_list_of_identifiers_1(p
):
7198 '''list_of_identifiers : IDENTIFIER '''
7200 print('list_of_identifiers_1', list(p
))
7202 # { p[0] = list_from_identifier(p[1]); }
7206 def p_list_of_identifiers_2(p
):
7207 '''list_of_identifiers : list_of_identifiers ',' IDENTIFIER '''
7209 print('list_of_identifiers_2', list(p
))
7211 # { p[0] = list_from_identifier(p[1], p[3]); }
7215 def p_list_of_port_identifiers_1(p
):
7216 '''list_of_port_identifiers : IDENTIFIER dimensions_opt '''
7218 print('list_of_port_identifiers_1', list(p
))
7220 # { p[0] = make_port_list(p[1], p[2], 0); }
7224 def p_list_of_port_identifiers_2(p
):
7225 '''list_of_port_identifiers : list_of_port_identifiers ',' IDENTIFIER dimensions_opt '''
7227 print('list_of_port_identifiers_2', list(p
))
7229 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
7233 def p_list_of_variable_port_identifiers_1(p
):
7234 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '''
7236 print('list_of_variable_port_identifiers_1', list(p
))
7238 # { p[0] = make_port_list(p[1], p[2], 0); }
7242 def p_list_of_variable_port_identifiers_2(p
):
7243 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '=' expression '''
7245 print('list_of_variable_port_identifiers_2', list(p
))
7247 # { p[0] = make_port_list(p[1], p[2], p[4]); }
7251 def p_list_of_variable_port_identifiers_3(p
):
7252 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '''
7254 print('list_of_variable_port_identifiers_3', list(p
))
7256 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
7260 def p_list_of_variable_port_identifiers_4(p
):
7261 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '=' expression '''
7263 print('list_of_variable_port_identifiers_4', list(p
))
7265 # { p[0] = make_port_list(p[1], p[3], p[4], p[6]); }
7269 def p_list_of_ports_1(p
):
7270 '''list_of_ports : port_opt '''
7272 print('list_of_ports_1', list(p
))
7274 # { vector<Module::port_t*>*tmp
7275 # = new vector<Module::port_t*>(1);
7282 def p_list_of_ports_2(p
):
7283 '''list_of_ports : list_of_ports ',' port_opt '''
7285 print('list_of_ports_2', list(p
))
7287 # { vector<Module::port_t*>*tmp = p[1];
7288 # tmp->push_back(p[3]);
7294 def p_list_of_port_declarations_1(p
):
7295 '''list_of_port_declarations : port_declaration '''
7296 if(parse_debug
> 1):
7297 print('list_of_port_declarations_1', list(p
))
7300 # { vector<Module::port_t*>*tmp
7301 # = new vector<Module::port_t*>(1);
7308 def p_list_of_port_declarations_2(p
):
7309 '''list_of_port_declarations : list_of_port_declarations ',' port_declaration '''
7311 print('list_of_port_declarations_2 FIXME', list(p
))
7312 # MOVE_TO absyn p[1].append(Leaf(token.NEWLINE, '\n')) # should be a comma
7313 # XXX p[3].prefix=' ' # add a space after the NL, must go in parameter
7317 # { vector<Module::port_t*>*tmp = p[1];
7318 # tmp->push_back(p[3]);
7324 def p_list_of_port_declarations_3(p
):
7325 '''list_of_port_declarations : list_of_port_declarations ',' IDENTIFIER '''
7327 print('list_of_port_declarations_3', list(p
))
7329 # { Module::port_t*ptmp;
7330 # perm_string name = lex_strings.make(p[3]);
7331 # ptmp = pform_module_port_reference(name, @3.text,
7333 # vector<Module::port_t*>*tmp = p[1];
7334 # tmp->push_back(ptmp);
7336 # /* Get the port declaration details, the port type
7337 # and what not, from context data stored by the
7338 # last port_declaration rule. */
7339 # pform_module_define_port(@3, name,
7340 # port_declaration_context.port_type,
7341 # port_declaration_context.port_net_type,
7342 # port_declaration_context.data_type, 0);
7349 def p_list_of_port_declarations_4(p
):
7350 '''list_of_port_declarations : list_of_port_declarations ',' '''
7352 print('list_of_port_declarations_4', list(p
))
7355 # yyerror(@2, "error: NULL port declarations are not "
7361 def p_list_of_port_declarations_5(p
):
7362 '''list_of_port_declarations : list_of_port_declarations ';' '''
7364 print('list_of_port_declarations_5', list(p
))
7367 # yyerror(@2, "error: ';' is an invalid port declaration "
7373 def p_port_declaration_1(p
):
7374 '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7376 print('port_declaration_1 FIXME', list(p
))
7377 comment
, dt
, name
= p
[2], p
[4], p
[5]
7378 p
[0] = absyn
.port_decl(comment
, dt
, name
)
7380 # { Module::port_t*ptmp;
7381 # perm_string name = lex_strings.make(p[5]);
7382 # data_type_t*use_type = p[4];
7383 # if (p[6]) use_type = new uarray_type_t(use_type, p[6]);
7384 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7385 # pform_module_define_port(@2, name, NetNet::PINPUT, p[3], use_type, p[1]);
7386 # port_declaration_context.port_type = NetNet::PINPUT;
7387 # port_declaration_context.port_net_type = p[3];
7388 # port_declaration_context.data_type = p[4];
7395 def p_port_declaration_2(p
):
7396 '''port_declaration : attribute_list_opt K_input K_wreal IDENTIFIER '''
7398 print('port_declaration_2', list(p
))
7400 # { Module::port_t*ptmp;
7401 # perm_string name = lex_strings.make(p[4]);
7402 # ptmp = pform_module_port_reference(name, @2.text,
7404 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7405 # FILE_NAME(real_type, @3);
7406 # pform_module_define_port(@2, name, NetNet::PINPUT,
7407 # NetNet::WIRE, real_type, p[1]);
7408 # port_declaration_context.port_type = NetNet::PINPUT;
7409 # port_declaration_context.port_net_type = NetNet::WIRE;
7410 # port_declaration_context.data_type = real_type;
7417 def p_port_declaration_3(p
):
7418 '''port_declaration : attribute_list_opt K_inout net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7420 print('port_declaration_3', list(p
))
7422 # { Module::port_t*ptmp;
7423 # perm_string name = lex_strings.make(p[5]);
7424 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7425 # pform_module_define_port(@2, name, NetNet::PINOUT, p[3], p[4], p[1]);
7426 # port_declaration_context.port_type = NetNet::PINOUT;
7427 # port_declaration_context.port_net_type = p[3];
7428 # port_declaration_context.data_type = p[4];
7431 # yyerror(@6, "sorry: Inout ports with unpacked dimensions not supported.");
7439 def p_port_declaration_4(p
):
7440 '''port_declaration : attribute_list_opt K_inout K_wreal IDENTIFIER '''
7442 print('port_declaration_4', list(p
))
7444 # { Module::port_t*ptmp;
7445 # perm_string name = lex_strings.make(p[4]);
7446 # ptmp = pform_module_port_reference(name, @2.text,
7448 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7449 # FILE_NAME(real_type, @3);
7450 # pform_module_define_port(@2, name, NetNet::PINOUT,
7451 # NetNet::WIRE, real_type, p[1]);
7452 # port_declaration_context.port_type = NetNet::PINOUT;
7453 # port_declaration_context.port_net_type = NetNet::WIRE;
7454 # port_declaration_context.data_type = real_type;
7461 def p_port_declaration_5(p
):
7462 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7464 print('port_declaration_5 FIXME', list(p
))
7465 comment
, dt
, name
= p
[2], p
[4], p
[5]
7466 p
[0] = absyn
.port_decl(comment
, dt
, name
)
7468 # { Module::port_t*ptmp;
7469 # perm_string name = lex_strings.make(p[5]);
7470 # data_type_t*use_dtype = p[4];
7471 # if (p[6]) use_dtype = new uarray_type_t(use_dtype, p[6]);
7472 # NetNet::Type use_type = p[3];
7473 # if (use_type == NetNet::IMPLICIT) {
7474 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
7475 # if (dtype->reg_flag)
7476 # use_type = NetNet::REG;
7477 # else if (dtype->implicit_flag)
7478 # use_type = NetNet::IMPLICIT;
7480 # use_type = NetNet::IMPLICIT_REG;
7482 # // The SystemVerilog types that can show up as
7483 # // output ports are implicitly (on the inside)
7484 # // variables because "reg" is not valid syntax
7486 # } else if (dynamic_cast<atom2_type_t*> (p[4])) {
7487 # use_type = NetNet::IMPLICIT_REG;
7488 # } else if (dynamic_cast<struct_type_t*> (p[4])) {
7489 # use_type = NetNet::IMPLICIT_REG;
7490 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[4])) {
7491 # if(etype->base_type == IVL_VT_LOGIC)
7492 # use_type = NetNet::IMPLICIT_REG;
7495 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7496 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, use_dtype, p[1]);
7497 # port_declaration_context.port_type = NetNet::POUTPUT;
7498 # port_declaration_context.port_net_type = use_type;
7499 # port_declaration_context.data_type = p[4];
7506 def p_port_declaration_6(p
):
7507 '''port_declaration : attribute_list_opt K_output K_wreal IDENTIFIER '''
7509 print('port_declaration_6', list(p
))
7511 # { Module::port_t*ptmp;
7512 # perm_string name = lex_strings.make(p[4]);
7513 # ptmp = pform_module_port_reference(name, @2.text,
7515 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7516 # FILE_NAME(real_type, @3);
7517 # pform_module_define_port(@2, name, NetNet::POUTPUT,
7518 # NetNet::WIRE, real_type, p[1]);
7519 # port_declaration_context.port_type = NetNet::POUTPUT;
7520 # port_declaration_context.port_net_type = NetNet::WIRE;
7521 # port_declaration_context.data_type = real_type;
7528 def p_port_declaration_7(p
):
7529 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER '=' expression '''
7531 print('port_declaration_7', list(p
))
7533 # { Module::port_t*ptmp;
7534 # perm_string name = lex_strings.make(p[5]);
7535 # NetNet::Type use_type = p[3];
7536 # if (use_type == NetNet::IMPLICIT) {
7537 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
7538 # if (dtype->reg_flag)
7539 # use_type = NetNet::REG;
7541 # use_type = NetNet::IMPLICIT_REG;
7543 # use_type = NetNet::IMPLICIT_REG;
7546 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7547 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, p[4], p[1]);
7548 # port_declaration_context.port_type = NetNet::PINOUT;
7549 # port_declaration_context.port_net_type = use_type;
7550 # port_declaration_context.data_type = p[4];
7552 # pform_make_var_init(@5, name, p[7]);
7560 def p_net_type_opt_1(p
):
7561 '''net_type_opt : net_type '''
7563 print('net_type_opt_1', list(p
))
7570 def p_net_type_opt_2(p
):
7571 '''net_type_opt : '''
7572 if(parse_debug
> 2):
7573 print('net_type_opt_2', list(p
))
7580 def p_unsigned_signed_opt_1(p
):
7581 '''unsigned_signed_opt : K_signed '''
7583 print('unsigned_signed_opt_1', list(p
))
7590 def p_unsigned_signed_opt_2(p
):
7591 '''unsigned_signed_opt : K_unsigned '''
7593 print('unsigned_signed_opt_2', list(p
))
7600 def p_unsigned_signed_opt_3(p
):
7601 '''unsigned_signed_opt : '''
7603 print('unsigned_signed_opt_3', list(p
))
7610 def p_signed_unsigned_opt_1(p
):
7611 '''signed_unsigned_opt : K_signed '''
7613 print('signed_unsigned_opt_1', list(p
))
7620 def p_signed_unsigned_opt_2(p
):
7621 '''signed_unsigned_opt : K_unsigned '''
7623 print('signed_unsigned_opt_2', list(p
))
7630 def p_signed_unsigned_opt_3(p
):
7631 '''signed_unsigned_opt : '''
7633 print('signed_unsigned_opt_3', list(p
))
7640 def p_atom2_type_1(p
):
7641 '''atom2_type : K_byte '''
7643 print('atom2_type_1', list(p
))
7649 def p_atom2_type_2(p
):
7650 '''atom2_type : K_shortint '''
7652 print('atom2_type_2', list(p
))
7658 def p_atom2_type_3(p
):
7659 '''atom2_type : K_int '''
7661 print('atom2_type_3', list(p
))
7667 def p_atom2_type_4(p
):
7668 '''atom2_type : K_longint '''
7670 print('atom2_type_4', list(p
))
7677 '''lpvalue : hierarchy_identifier '''
7678 if(parse_debug
> 2):
7679 print('lpvalue_1', list(p
))
7682 # { PEIdent*tmp = pform_new_ident(*p[1]);
7683 # FILE_NAME(tmp, @1);
7691 '''lpvalue : implicit_class_handle '.' hierarchy_identifier '''
7693 print('lpvalue_2', list(p
))
7695 # { pform_name_t*t_name = p[1];
7696 # while (!p[3]->empty()) {
7697 # t_name->push_back(p[3]->front());
7698 # p[3]->pop_front();
7700 # PEIdent*tmp = new PEIdent(*t_name);
7701 # FILE_NAME(tmp, @1);
7710 '''lpvalue : '{' expression_list_proper '}' '''
7712 print('lpvalue_3', list(p
))
7714 # { PEConcat*tmp = new PEConcat(*p[2]);
7715 # FILE_NAME(tmp, @1);
7723 '''lpvalue : streaming_concatenation '''
7725 print('lpvalue_4', list(p
))
7727 # { yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
7733 def p_cont_assign_1(p
):
7734 '''cont_assign : lpvalue '=' expression '''
7736 print('cont_assign_1', list(p
))
7737 absyn
.cont_assign_1(p
)
7739 # { list<PExpr*>*tmp = new list<PExpr*>;
7740 # tmp->push_back(p[1]);
7741 # tmp->push_back(p[3]);
7747 def p_cont_assign_list_1(p
):
7748 '''cont_assign_list : cont_assign_list ',' cont_assign '''
7750 print('cont_assign_list_1', list(p
))
7752 # { list<PExpr*>*tmp = p[1];
7753 # tmp->splice(tmp->end(), *p[3]);
7760 def p_cont_assign_list_2(p
):
7761 '''cont_assign_list : cont_assign '''
7762 if(parse_debug
> 2):
7763 print('cont_assign_list_2', list(p
))
7771 '''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 '''
7772 if(parse_debug
> 2):
7773 print('module_1', list(p
))
7774 clsdecl
= absyn
.module_1(p
)
7781 def p__embed0_module(p
):
7782 '''_embed0_module : '''
7784 # { pform_startmodule(@2, p[4], p[2]==K_program, p[2]==K_interface, p[3], p[1]); }
7788 def p__embed1_module(p
):
7789 '''_embed1_module : '''
7791 # { pform_module_set_ports(p[8]); }
7795 def p__embed2_module(p
):
7796 '''_embed2_module : '''
7798 # { pform_set_scope_timescale(@2); }
7802 def p__embed3_module(p
):
7803 '''_embed3_module : '''
7805 # { Module::UCDriveType ucd;
7806 # // The lexor detected `unconnected_drive directives and
7807 # // marked what it found in the uc_drive variable. Use that
7808 # // to generate a UCD flag for the module.
7809 # switch (uc_drive) {
7812 # ucd = Module::UCD_NONE;
7815 # ucd = Module::UCD_PULL0;
7818 # ucd = Module::UCD_PULL1;
7821 # // Check that program/endprogram and module/endmodule
7822 # // keywords match.
7823 # if (p[2] != p[15]) {
7826 # yyerror(@15, "error: module not closed by endmodule.");
7829 # yyerror(@15, "error: program not closed by endprogram.");
7832 # yyerror(@15, "error: interface not closed by endinterface.");
7838 # pform_endmodule(p[4], in_celldefine, ucd);
7843 def p_module_start_1(p
):
7844 '''module_start : K_module '''
7845 if(parse_debug
> 1):
7846 print('module_start_1', list(p
))
7848 # { p[0] = K_module; }
7852 def p_module_start_2(p
):
7853 '''module_start : K_macromodule '''
7855 print('module_start_2', list(p
))
7857 # { p[0] = K_module; }
7861 def p_module_start_3(p
):
7862 '''module_start : K_program '''
7864 print('module_start_3', list(p
))
7866 # { p[0] = K_program; }
7870 def p_module_start_4(p
):
7871 '''module_start : K_interface '''
7873 print('module_start_4', list(p
))
7875 # { p[0] = K_interface; }
7879 def p_module_end_1(p
):
7880 '''module_end : K_endmodule '''
7881 if(parse_debug
> 2):
7882 print('module_end_1', list(p
))
7884 # { p[0] = K_module; }
7888 def p_module_end_2(p
):
7889 '''module_end : K_endprogram '''
7891 print('module_end_2', list(p
))
7893 # { p[0] = K_program; }
7897 def p_module_end_3(p
):
7898 '''module_end : K_endinterface '''
7900 print('module_end_3', list(p
))
7902 # { p[0] = K_interface; }
7906 def p_endlabel_opt_1(p
):
7907 '''endlabel_opt : ':' IDENTIFIER '''
7909 print('endlabel_opt_1', list(p
))
7916 def p_endlabel_opt_2(p
):
7917 '''endlabel_opt : '''
7918 if(parse_debug
> 2):
7919 print('endlabel_opt_2', list(p
))
7925 def p_module_attribute_foreign_1(p
):
7926 '''module_attribute_foreign : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP '''
7928 print('module_attribute_foreign_1', list(p
))
7934 def p_module_attribute_foreign_2(p
):
7935 '''module_attribute_foreign : '''
7936 if(parse_debug
> 2):
7937 print('module_attribute_foreign_2', list(p
))
7943 def p_module_port_list_opt_1(p
):
7944 '''module_port_list_opt : '(' list_of_ports ')' '''
7946 print('module_port_list_opt_1', list(p
))
7953 def p_module_port_list_opt_2(p
):
7954 '''module_port_list_opt : '(' list_of_port_declarations ')' '''
7955 if(parse_debug
> 2):
7956 print('module_port_list_opt_2', list(p
))
7963 def p_module_port_list_opt_3(p
):
7964 '''module_port_list_opt : '''
7966 print('module_port_list_opt_3', list(p
))
7972 def p_module_port_list_opt_4(p
):
7973 '''module_port_list_opt : '(' error ')' '''
7975 print('module_port_list_opt_4', list(p
))
7977 # { yyerror(@2, "Errors in port declarations.");
7984 def p_module_parameter_port_list_opt_1(p
):
7985 '''module_parameter_port_list_opt : '''
7986 if(parse_debug
> 2):
7987 print('module_parameter_port_list_opt_1', list(p
))
7993 def p_module_parameter_port_list_opt_2(p
):
7994 '''module_parameter_port_list_opt : '#' '(' module_parameter_port_list ')' '''
7996 print('module_parameter_port_list_opt_2', list(p
))
8003 def p_module_parameter_port_list_1(p
):
8004 '''module_parameter_port_list : K_parameter param_type parameter_assign '''
8006 print('module_parameter_port_list_1', list(p
))
8013 def p_module_parameter_port_list_2(p
):
8014 '''module_parameter_port_list : module_parameter_port_list ',' parameter_assign '''
8016 print('module_parameter_port_list_2', list(p
))
8017 p
[0] = p
[1].append(p
[3])
8023 def p_module_parameter_port_list_3(p
):
8024 '''module_parameter_port_list : module_parameter_port_list ',' K_parameter param_type parameter_assign '''
8026 print('module_parameter_port_list_3', list(p
))
8027 p
[1].append(Leaf(token
.COMMA
, ','))
8028 p
[1].append(Leaf(token
.NEWLINE
, '\n'))
8029 p
[5].prefix
= ' ' # add space after newline
8037 def p_module_item_1(p
):
8038 '''module_item : module '''
8040 print('module_item_1', list(p
))
8046 def p_module_item_2(p
):
8047 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' '''
8049 print('module_item_2', list(p
))
8051 p
[0] = absyn
.module_item_2(p
[2], p
[3], p
[5])
8052 #p[0] = ["module_item_2"]+list(p)
8054 # { data_type_t*data_type = p[3];
8055 # if (data_type == 0) {
8056 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8057 # FILE_NAME(data_type, @2);
8059 # pform_set_data_type(@2, data_type, p[5], p[2], p[1]);
8061 # yyerror(@2, "sorry: net delays not supported.");
8069 def p_module_item_3(p
):
8070 '''module_item : attribute_list_opt K_wreal delay3 net_variable_list ';' '''
8072 print('module_item_3', list(p
))
8074 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
8075 # pform_set_data_type(@2, tmpt, p[4], NetNet::WIRE, p[1]);
8077 # yyerror(@3, "sorry: net delays not supported.");
8085 def p_module_item_4(p
):
8086 '''module_item : attribute_list_opt K_wreal net_variable_list ';' '''
8088 print('module_item_4', list(p
))
8090 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
8091 # pform_set_data_type(@2, tmpt, p[3], NetNet::WIRE, p[1]);
8097 def p_module_item_5(p
):
8098 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_decl_assigns ';' '''
8100 print('module_item_5', list(p
))
8102 # { data_type_t*data_type = p[3];
8103 # if (data_type == 0) {
8104 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8105 # FILE_NAME(data_type, @2);
8107 # pform_makewire(@2, p[4], str_strength, p[5], p[2], data_type);
8109 # yywarn(@2, "Attributes are not supported on net declaration "
8110 # "assignments and will be discarded.");
8117 def p_module_item_6(p
):
8118 '''module_item : attribute_list_opt net_type data_type_or_implicit drive_strength net_decl_assigns ';' '''
8120 print('module_item_6', list(p
))
8122 # { data_type_t*data_type = p[3];
8123 # if (data_type == 0) {
8124 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8125 # FILE_NAME(data_type, @2);
8127 # pform_makewire(@2, 0, p[4], p[5], p[2], data_type);
8129 # yywarn(@2, "Attributes are not supported on net declaration "
8130 # "assignments and will be discarded.");
8137 def p_module_item_7(p
):
8138 '''module_item : attribute_list_opt K_wreal net_decl_assigns ';' '''
8140 print('module_item_7', list(p
))
8142 # { real_type_t*data_type = new real_type_t(real_type_t::REAL);
8143 # pform_makewire(@2, 0, str_strength, p[3], NetNet::WIRE, data_type);
8145 # yywarn(@2, "Attributes are not supported on net declaration "
8146 # "assignments and will be discarded.");
8153 def p_module_item_8(p
):
8154 '''module_item : K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' '''
8156 print('module_item_8', list(p
))
8158 # { yyerror(@1, "sorry: trireg nets not supported.");
8165 def p_module_item_9(p
):
8166 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit list_of_port_identifiers ';' '''
8168 print('module_item_9', list(p
))
8170 # { pform_module_define_port(@2, p[5], p[2], p[3], p[4], p[1]); }
8174 def p_module_item_10(p
):
8175 '''module_item : attribute_list_opt port_direction K_wreal list_of_port_identifiers ';' '''
8177 print('module_item_10', list(p
))
8179 # { real_type_t*real_type = new real_type_t(real_type_t::REAL);
8180 # pform_module_define_port(@2, p[4], p[2], NetNet::WIRE, real_type, p[1]);
8185 def p_module_item_11(p
):
8186 '''module_item : attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' '''
8188 print('module_item_11', list(p
))
8190 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8191 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8192 # if (dtype->implicit_flag)
8193 # use_type = NetNet::NONE;
8195 # if (use_type == NetNet::NONE)
8196 # pform_set_port_type(@2, p[4], NetNet::PINOUT, p[3], p[1]);
8198 # pform_module_define_port(@2, p[4], NetNet::PINOUT, use_type, p[3], p[1]);
8203 def p_module_item_12(p
):
8204 '''module_item : attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' '''
8206 print('module_item_12', list(p
))
8208 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8209 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8210 # if (dtype->implicit_flag)
8211 # use_type = NetNet::NONE;
8213 # if (use_type == NetNet::NONE)
8214 # pform_set_port_type(@2, p[4], NetNet::PINPUT, p[3], p[1]);
8216 # pform_module_define_port(@2, p[4], NetNet::PINPUT, use_type, p[3], p[1]);
8221 def p_module_item_13(p
):
8222 '''module_item : attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' '''
8224 print('module_item_13', list(p
))
8226 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8227 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8228 # if (dtype->implicit_flag)
8229 # use_type = NetNet::NONE;
8230 # else if (dtype->reg_flag)
8231 # use_type = NetNet::REG;
8233 # use_type = NetNet::IMPLICIT_REG;
8235 # // The SystemVerilog types that can show up as
8236 # // output ports are implicitly (on the inside)
8237 # // variables because "reg" is not valid syntax
8239 # } else if (dynamic_cast<atom2_type_t*> (p[3])) {
8240 # use_type = NetNet::IMPLICIT_REG;
8241 # } else if (dynamic_cast<struct_type_t*> (p[3])) {
8242 # use_type = NetNet::IMPLICIT_REG;
8243 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[3])) {
8244 # if(etype->base_type == IVL_VT_LOGIC)
8245 # use_type = NetNet::IMPLICIT_REG;
8247 # if (use_type == NetNet::NONE)
8248 # pform_set_port_type(@2, p[4], NetNet::POUTPUT, p[3], p[1]);
8250 # pform_module_define_port(@2, p[4], NetNet::POUTPUT, use_type, p[3], p[1]);
8255 def p_module_item_14(p
):
8256 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit error ';' '''
8258 print('module_item_14', list(p
))
8260 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8261 # if (p[1]) delete p[1];
8262 # if (p[4]) delete p[4];
8268 def p_module_item_15(p
):
8269 '''module_item : attribute_list_opt K_inout data_type_or_implicit error ';' '''
8271 print('module_item_15', list(p
))
8273 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8274 # if (p[1]) delete p[1];
8275 # if (p[3]) delete p[3];
8281 def p_module_item_16(p
):
8282 '''module_item : attribute_list_opt K_input data_type_or_implicit error ';' '''
8284 print('module_item_16', list(p
))
8286 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8287 # if (p[1]) delete p[1];
8288 # if (p[3]) delete p[3];
8294 def p_module_item_17(p
):
8295 '''module_item : attribute_list_opt K_output data_type_or_implicit error ';' '''
8297 print('module_item_17', list(p
))
8299 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8300 # if (p[1]) delete p[1];
8301 # if (p[3]) delete p[3];
8307 def p_module_item_18(p
):
8308 '''module_item : DISCIPLINE_IDENTIFIER list_of_identifiers ';' '''
8310 print('module_item_18', list(p
))
8312 # { pform_attach_discipline(@1, p[1], p[2]); }
8316 def p_module_item_19(p
):
8317 '''module_item : attribute_list_opt _embed0_module_item block_item_decl '''
8319 print('module_item_19', list(p
))
8321 # { delete attributes_in_context;
8322 # attributes_in_context = 0;
8327 def p_module_item_20(p
):
8328 '''module_item : K_defparam _embed1_module_item defparam_assign_list ';' '''
8330 print('module_item_20', list(p
))
8336 def p_module_item_21(p
):
8337 '''module_item : attribute_list_opt gatetype gate_instance_list ';' '''
8339 print('module_item_21', list(p
))
8341 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
8345 def p_module_item_22(p
):
8346 '''module_item : attribute_list_opt gatetype delay3 gate_instance_list ';' '''
8348 print('module_item_22', list(p
))
8350 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
8354 def p_module_item_23(p
):
8355 '''module_item : attribute_list_opt gatetype drive_strength gate_instance_list ';' '''
8357 print('module_item_23', list(p
))
8359 # { pform_makegates(@2, p[2], p[3], 0, p[4], p[1]); }
8363 def p_module_item_24(p
):
8364 '''module_item : attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';' '''
8366 print('module_item_24', list(p
))
8368 # { pform_makegates(@2, p[2], p[3], p[4], p[5], p[1]); }
8372 def p_module_item_25(p
):
8373 '''module_item : attribute_list_opt switchtype gate_instance_list ';' '''
8375 print('module_item_25', list(p
))
8377 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
8381 def p_module_item_26(p
):
8382 '''module_item : attribute_list_opt switchtype delay3 gate_instance_list ';' '''
8384 print('module_item_26', list(p
))
8386 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
8390 def p_module_item_27(p
):
8391 '''module_item : K_pullup gate_instance_list ';' '''
8393 print('module_item_27', list(p
))
8395 # { pform_makegates(@1, PGBuiltin::PULLUP, pull_strength, 0, p[2], 0); }
8399 def p_module_item_28(p
):
8400 '''module_item : K_pulldown gate_instance_list ';' '''
8402 print('module_item_28', list(p
))
8404 # { pform_makegates(@1, PGBuiltin::PULLDOWN, pull_strength, 0, p[2], 0); }
8408 def p_module_item_29(p
):
8409 '''module_item : K_pullup '(' dr_strength1 ')' gate_instance_list ';' '''
8411 print('module_item_29', list(p
))
8413 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[5], 0); }
8417 def p_module_item_30(p
):
8418 '''module_item : K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
8420 print('module_item_30', list(p
))
8422 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[7], 0); }
8426 def p_module_item_31(p
):
8427 '''module_item : K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
8429 print('module_item_31', list(p
))
8431 # { pform_makegates(@1, PGBuiltin::PULLUP, p[5], 0, p[7], 0); }
8435 def p_module_item_32(p
):
8436 '''module_item : K_pulldown '(' dr_strength0 ')' gate_instance_list ';' '''
8438 print('module_item_32', list(p
))
8440 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[5], 0); }
8444 def p_module_item_33(p
):
8445 '''module_item : K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
8447 print('module_item_33', list(p
))
8449 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[5], 0, p[7], 0); }
8453 def p_module_item_34(p
):
8454 '''module_item : K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
8456 print('module_item_34', list(p
))
8458 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[7], 0); }
8462 def p_module_item_35(p
):
8463 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' '''
8465 print('module_item_35', list(p
))
8467 # { perm_string tmp1 = lex_strings.make(p[2]);
8468 # pform_make_modgates(@2, tmp1, p[3], p[4], p[1]);
8474 def p_module_item_36(p
):
8475 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt error ';' '''
8477 print('module_item_36', list(p
))
8479 # { yyerror(@2, "error: Invalid module instantiation");
8481 # if (p[1]) delete p[1];
8486 def p_module_item_37(p
):
8487 '''module_item : K_assign drive_strength_opt delay3_opt cont_assign_list ';' '''
8488 if(parse_debug
> 2):
8489 print('module_item_37', list(p
))
8491 # { pform_make_pgassign_list(p[4], p[3], p[2], @1.text, @1.first_line); }
8495 def p_module_item_38(p
):
8496 '''module_item : attribute_list_opt K_always statement_item '''
8498 print('module_item_38', list(p
))
8500 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, p[3], p[1]);
8501 # FILE_NAME(tmp, @2);
8506 def p_module_item_39(p
):
8507 '''module_item : attribute_list_opt K_always_comb statement_item '''
8509 print('module_item_39', list(p
))
8511 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_COMB, p[3], p[1]);
8512 # FILE_NAME(tmp, @2);
8517 def p_module_item_40(p
):
8518 '''module_item : attribute_list_opt K_always_ff statement_item '''
8520 print('module_item_40', list(p
))
8522 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, p[3], p[1]);
8523 # FILE_NAME(tmp, @2);
8528 def p_module_item_41(p
):
8529 '''module_item : attribute_list_opt K_always_latch statement_item '''
8531 print('module_item_41', list(p
))
8533 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_LATCH, p[3], p[1]);
8534 # FILE_NAME(tmp, @2);
8539 def p_module_item_42(p
):
8540 '''module_item : attribute_list_opt K_initial statement_item '''
8542 print('module_item_42', list(p
))
8544 # { PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, p[3], p[1]);
8545 # FILE_NAME(tmp, @2);
8550 def p_module_item_43(p
):
8551 '''module_item : attribute_list_opt K_final statement_item '''
8553 print('module_item_43', list(p
))
8555 # { PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, p[3], p[1]);
8556 # FILE_NAME(tmp, @2);
8561 def p_module_item_44(p
):
8562 '''module_item : attribute_list_opt K_analog analog_statement '''
8564 print('module_item_44', list(p
))
8566 # { pform_make_analog_behavior(@2, IVL_PR_ALWAYS, p[3]); }
8570 def p_module_item_45(p
):
8571 '''module_item : attribute_list_opt assertion_item '''
8573 print('module_item_45', list(p
))
8579 def p_module_item_46(p
):
8580 '''module_item : timeunits_declaration '''
8582 print('module_item_46', list(p
))
8588 def p_module_item_47(p
):
8589 '''module_item : class_declaration '''
8591 print('module_item_47', list(p
))
8597 def p_module_item_48(p
):
8598 '''module_item : task_declaration '''
8600 print('module_item_48', list(p
))
8606 def p_module_item_49(p
):
8607 '''module_item : function_declaration '''
8609 print('module_item_49', list(p
))
8615 def p_module_item_50(p
):
8616 '''module_item : K_generate generate_item_list_opt K_endgenerate '''
8618 print('module_item_50', list(p
))
8620 # { // Test for bad nesting. I understand it, but it is illegal.
8621 # if (pform_parent_generate()) {
8622 # cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
8623 # cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
8624 # cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
8631 def p_module_item_51(p
):
8632 '''module_item : K_genvar list_of_identifiers ';' '''
8634 print('module_item_51', list(p
))
8636 # { pform_genvars(@1, p[2]); }
8640 def p_module_item_52(p
):
8641 '''module_item : K_for '(' IDENTIFIER '=' expression ';' expression ';' IDENTIFIER '=' expression ')' _embed2_module_item generate_block '''
8643 print('module_item_52', list(p
))
8645 # { pform_endgenerate(); }
8649 def p_module_item_53(p
):
8650 '''module_item : generate_if generate_block_opt K_else _embed3_module_item generate_block '''
8652 print('module_item_53', list(p
))
8654 # { pform_endgenerate(); }
8658 def p_module_item_54(p
):
8659 '''module_item : generate_if generate_block_opt %prec less_than_K_else '''
8661 print('module_item_54', list(p
))
8663 # { pform_endgenerate(); }
8667 def p_module_item_55(p
):
8668 '''module_item : K_case '(' expression ')' _embed4_module_item generate_case_items K_endcase '''
8670 print('module_item_55', list(p
))
8672 # { pform_endgenerate(); }
8676 def p_module_item_56(p
):
8677 '''module_item : modport_declaration '''
8679 print('module_item_56', list(p
))
8685 def p_module_item_57(p
):
8686 '''module_item : package_import_declaration '''
8688 print('module_item_57', list(p
))
8694 def p_module_item_58(p
):
8695 '''module_item : attribute_list_opt K_specparam _embed5_module_item specparam_decl ';' '''
8697 print('module_item_58', list(p
))
8703 def p_module_item_59(p
):
8704 '''module_item : K_specify _embed6_module_item specify_item_list_opt K_endspecify '''
8706 print('module_item_59', list(p
))
8712 def p_module_item_60(p
):
8713 '''module_item : K_specify error K_endspecify '''
8715 print('module_item_60', list(p
))
8717 # { yyerror(@1, "error: syntax error in specify block");
8723 def p_module_item_61(p
):
8724 '''module_item : error ';' '''
8726 print('module_item_61', list(p
))
8728 # { yyerror(@2, "error: invalid module item.");
8734 def p_module_item_62(p
):
8735 '''module_item : K_assign error '=' expression ';' '''
8737 print('module_item_62', list(p
))
8739 # { yyerror(@1, "error: syntax error in left side "
8740 # "of continuous assignment.");
8746 def p_module_item_63(p
):
8747 '''module_item : K_assign error ';' '''
8749 print('module_item_63', list(p
))
8751 # { yyerror(@1, "error: syntax error in "
8752 # "continuous assignment");
8758 def p_module_item_64(p
):
8759 '''module_item : K_function error K_endfunction endlabel_opt '''
8761 print('module_item_64', list(p
))
8763 # { yyerror(@1, "error: I give up on this "
8764 # "function definition.");
8766 # if (!gn_system_verilog()) {
8767 # yyerror(@4, "error: Function end names require "
8768 # "SystemVerilog.");
8777 def p_module_item_65(p
):
8778 '''module_item : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';' '''
8780 print('module_item_65', list(p
))
8782 # { perm_string tmp3 = lex_strings.make(p[3]);
8783 # perm_string tmp5 = lex_strings.make(p[5]);
8784 # pform_set_attrib(tmp3, tmp5, p[7]);
8791 def p_module_item_66(p
):
8792 '''module_item : KK_attribute '(' error ')' ';' '''
8794 print('module_item_66', list(p
))
8796 # { yyerror(@1, "error: Malformed $attribute parameter list."); }
8800 def p__embed0_module_item(p
):
8801 '''_embed0_module_item : '''
8803 # { attributes_in_context = p[1]; }
8807 def p__embed1_module_item(p
):
8808 '''_embed1_module_item : '''
8810 # { if (pform_in_interface())
8811 # yyerror(@1, "error: Parameter overrides are not allowed "
8812 # "in interfaces.");
8817 def p__embed2_module_item(p
):
8818 '''_embed2_module_item : '''
8820 # { pform_start_generate_for(@1, p[3], p[5], p[7], p[9], p[11]); }
8824 def p__embed3_module_item(p
):
8825 '''_embed3_module_item : '''
8827 # { pform_start_generate_else(@1); }
8831 def p__embed4_module_item(p
):
8832 '''_embed4_module_item : '''
8834 # { pform_start_generate_case(@1, p[3]); }
8838 def p__embed5_module_item(p
):
8839 '''_embed5_module_item : '''
8841 # { if (pform_in_interface())
8842 # yyerror(@1, "error: specparam declarations are not allowed "
8843 # "in interfaces.");
8848 def p__embed6_module_item(p
):
8849 '''_embed6_module_item : '''
8851 # { if (pform_in_interface())
8852 # yyerror(@1, "error: specify blocks are not allowed "
8853 # "in interfaces.");
8858 def p_module_item_list_1(p
):
8859 '''module_item_list : module_item_list module_item '''
8861 print('module_item_list_1', list(p
))
8867 def p_module_item_list_2(p
):
8868 '''module_item_list : module_item '''
8869 if(parse_debug
> 2):
8870 print('module_item_list_2', list(p
))
8876 def p_module_item_list_opt_1(p
):
8877 '''module_item_list_opt : module_item_list '''
8878 if(parse_debug
> 2):
8879 print('module_item_list_opt_1', list(p
))
8885 def p_module_item_list_opt_2(p
):
8886 '''module_item_list_opt : '''
8888 print('module_item_list_opt_2', list(p
))
8894 def p_generate_if_1(p
):
8895 '''generate_if : K_if '(' expression ')' '''
8897 print('generate_if_1', list(p
))
8899 # { pform_start_generate_if(@1, p[3]); }
8903 def p_generate_case_items_1(p
):
8904 '''generate_case_items : generate_case_items generate_case_item '''
8906 print('generate_case_items_1', list(p
))
8912 def p_generate_case_items_2(p
):
8913 '''generate_case_items : generate_case_item '''
8915 print('generate_case_items_2', list(p
))
8921 def p_generate_case_item_1(p
):
8922 '''generate_case_item : expression_list_proper ':' _embed0_generate_case_item generate_block_opt '''
8924 print('generate_case_item_1', list(p
))
8926 # { pform_endgenerate(); }
8930 def p_generate_case_item_2(p
):
8931 '''generate_case_item : K_default ':' _embed1_generate_case_item generate_block_opt '''
8933 print('generate_case_item_2', list(p
))
8935 # { pform_endgenerate(); }
8939 def p__embed0_generate_case_item(p
):
8940 '''_embed0_generate_case_item : '''
8942 # { pform_generate_case_item(@1, p[1]); }
8946 def p__embed1_generate_case_item(p
):
8947 '''_embed1_generate_case_item : '''
8949 # { pform_generate_case_item(@1, 0); }
8953 def p_generate_item_1(p
):
8954 '''generate_item : module_item '''
8956 print('generate_item_1', list(p
))
8962 def p_generate_item_2(p
):
8963 '''generate_item : K_begin generate_item_list_opt K_end '''
8965 print('generate_item_2', list(p
))
8967 # { /* Detect and warn about anachronistic begin/end use */
8968 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
8970 # cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
8976 def p_generate_item_3(p
):
8977 '''generate_item : K_begin ':' IDENTIFIER _embed0_generate_item generate_item_list_opt K_end '''
8979 print('generate_item_3', list(p
))
8981 # { /* Detect and warn about anachronistic named begin/end use */
8982 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
8984 # cerr << @1 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
8986 # pform_endgenerate();
8991 def p__embed0_generate_item(p
):
8992 '''_embed0_generate_item : '''
8995 # pform_start_generate_nblock(@1, p[3]);
9000 def p_generate_item_list_1(p
):
9001 '''generate_item_list : generate_item_list generate_item '''
9003 print('generate_item_list_1', list(p
))
9009 def p_generate_item_list_2(p
):
9010 '''generate_item_list : generate_item '''
9012 print('generate_item_list_2', list(p
))
9018 def p_generate_item_list_opt_1(p
):
9019 '''generate_item_list_opt : generate_item_list '''
9021 print('generate_item_list_opt_1', list(p
))
9027 def p_generate_item_list_opt_2(p
):
9028 '''generate_item_list_opt : '''
9030 print('generate_item_list_opt_2', list(p
))
9036 def p_generate_block_1(p
):
9037 '''generate_block : module_item '''
9039 print('generate_block_1', list(p
))
9045 def p_generate_block_2(p
):
9046 '''generate_block : K_begin generate_item_list_opt K_end '''
9048 print('generate_block_2', list(p
))
9054 def p_generate_block_3(p
):
9055 '''generate_block : K_begin ':' IDENTIFIER generate_item_list_opt K_end endlabel_opt '''
9057 print('generate_block_3', list(p
))
9059 # { pform_generate_block_name(p[3]);
9061 # if (strcmp(p[3],p[6]) != 0) {
9062 # yyerror(@6, "error: End label doesn't match "
9065 # if (! gn_system_verilog()) {
9066 # yyerror(@6, "error: Begin end labels require "
9067 # "SystemVerilog.");
9076 def p_generate_block_opt_1(p
):
9077 '''generate_block_opt : generate_block '''
9079 print('generate_block_opt_1', list(p
))
9085 def p_generate_block_opt_2(p
):
9086 '''generate_block_opt : ';' '''
9088 print('generate_block_opt_2', list(p
))
9094 def p_net_decl_assign_1(p
):
9095 '''net_decl_assign : IDENTIFIER '=' expression '''
9097 print('net_decl_assign_1', list(p
))
9099 # { net_decl_assign_t*tmp = new net_decl_assign_t;
9101 # tmp->name = lex_strings.make(p[1]);
9109 def p_net_decl_assigns_1(p
):
9110 '''net_decl_assigns : net_decl_assigns ',' net_decl_assign '''
9112 print('net_decl_assigns_1', list(p
))
9114 # { net_decl_assign_t*tmp = p[1];
9115 # p[3]->next = tmp->next;
9122 def p_net_decl_assigns_2(p
):
9123 '''net_decl_assigns : net_decl_assign '''
9125 print('net_decl_assigns_2', list(p
))
9132 def p_bit_logic_1(p
):
9133 '''bit_logic : K_logic '''
9135 print('bit_logic_1', list(p
))
9137 # { p[0] = IVL_VT_LOGIC; }
9141 def p_bit_logic_2(p
):
9142 '''bit_logic : K_bool '''
9144 print('bit_logic_2', list(p
))
9146 # { p[0] = IVL_VT_BOOL; /* Icarus misc */}
9150 def p_bit_logic_3(p
):
9151 '''bit_logic : K_bit '''
9153 print('bit_logic_3', list(p
))
9155 # { p[0] = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
9159 def p_bit_logic_opt_1(p
):
9160 '''bit_logic_opt : bit_logic '''
9162 print('bit_logic_opt_1', list(p
))
9168 def p_bit_logic_opt_2(p
):
9169 '''bit_logic_opt : '''
9171 print('bit_logic_opt_2', list(p
))
9173 # { p[0] = IVL_VT_NO_TYPE; }
9177 def p_net_type_1(p
):
9178 '''net_type : K_wire '''
9179 if(parse_debug
> 2):
9180 print('net_type_1', list(p
))
9188 def p_net_type_2(p
):
9189 '''net_type : K_tri '''
9191 print('net_type_2', list(p
))
9193 # { p[0] = NetNet::TRI; }
9197 def p_net_type_3(p
):
9198 '''net_type : K_tri1 '''
9200 print('net_type_3', list(p
))
9202 # { p[0] = NetNet::TRI1; }
9206 def p_net_type_4(p
):
9207 '''net_type : K_supply0 '''
9209 print('net_type_4', list(p
))
9211 # { p[0] = NetNet::SUPPLY0; }
9215 def p_net_type_5(p
):
9216 '''net_type : K_wand '''
9218 print('net_type_5', list(p
))
9220 # { p[0] = NetNet::WAND; }
9224 def p_net_type_6(p
):
9225 '''net_type : K_triand '''
9227 print('net_type_6', list(p
))
9229 # { p[0] = NetNet::TRIAND; }
9233 def p_net_type_7(p
):
9234 '''net_type : K_tri0 '''
9236 print('net_type_7', list(p
))
9238 # { p[0] = NetNet::TRI0; }
9242 def p_net_type_8(p
):
9243 '''net_type : K_supply1 '''
9245 print('net_type_8', list(p
))
9247 # { p[0] = NetNet::SUPPLY1; }
9251 def p_net_type_9(p
):
9252 '''net_type : K_wor '''
9254 print('net_type_9', list(p
))
9256 # { p[0] = NetNet::WOR; }
9260 def p_net_type_10(p
):
9261 '''net_type : K_trior '''
9263 print('net_type_10', list(p
))
9265 # { p[0] = NetNet::TRIOR; }
9269 def p_net_type_11(p
):
9270 '''net_type : K_wone '''
9272 print('net_type_11', list(p
))
9274 # { p[0] = NetNet::UNRESOLVED_WIRE;
9275 # cerr << @1.text << ":" << @1.first_line << ": warning: "
9276 # "'wone' is deprecated, please use 'uwire' "
9277 # "instead." << endl;
9282 def p_net_type_12(p
):
9283 '''net_type : K_uwire '''
9285 print('net_type_12', list(p
))
9287 # { p[0] = NetNet::UNRESOLVED_WIRE; }
9291 def p_param_type_1(p
):
9292 '''param_type : bit_logic_opt unsigned_signed_opt dimensions_opt '''
9294 print('param_type_1', list(p
))
9296 # { param_active_range = p[3];
9297 # param_active_signed = p[2];
9298 # if ((p[1] == IVL_VT_NO_TYPE) && (p[3] != 0))
9299 # param_active_type = IVL_VT_LOGIC;
9301 # param_active_type = p[1];
9306 def p_param_type_2(p
):
9307 '''param_type : K_integer '''
9309 print('param_type_2', list(p
))
9311 # { param_active_range = make_range_from_width(integer_width);
9312 # param_active_signed = true;
9313 # param_active_type = IVL_VT_LOGIC;
9318 def p_param_type_3(p
):
9319 '''param_type : K_time '''
9321 print('param_type_3', list(p
))
9323 # { param_active_range = make_range_from_width(64);
9324 # param_active_signed = false;
9325 # param_active_type = IVL_VT_LOGIC;
9330 def p_param_type_4(p
):
9331 '''param_type : real_or_realtime '''
9333 print('param_type_4', list(p
))
9335 # { param_active_range = 0;
9336 # param_active_signed = true;
9337 # param_active_type = IVL_VT_REAL;
9342 def p_param_type_5(p
):
9343 '''param_type : atom2_type '''
9345 print('param_type_5', list(p
))
9347 # { param_active_range = make_range_from_width(p[1]);
9348 # param_active_signed = true;
9349 # param_active_type = IVL_VT_BOOL;
9354 def p_param_type_6(p
):
9355 '''param_type : TYPE_IDENTIFIER '''
9357 print('param_type_6', list(p
))
9359 # { pform_set_param_from_type(@1, p[1].type, p[1].text, param_active_range,
9360 # param_active_signed, param_active_type);
9361 # delete[]p[1].text;
9366 def p_parameter_assign_list_1(p
):
9367 '''parameter_assign_list : parameter_assign '''
9369 print('parameter_assign_list_1', list(p
))
9375 def p_parameter_assign_list_2(p
):
9376 '''parameter_assign_list : parameter_assign_list ',' parameter_assign '''
9378 print('parameter_assign_list_2', list(p
))
9384 def p_localparam_assign_list_1(p
):
9385 '''localparam_assign_list : localparam_assign '''
9387 print('localparam_assign_list_1', list(p
))
9393 def p_localparam_assign_list_2(p
):
9394 '''localparam_assign_list : localparam_assign_list ',' localparam_assign '''
9396 print('localparam_assign_list_2', list(p
))
9402 def p_parameter_assign_1(p
):
9403 '''parameter_assign : IDENTIFIER '=' expression parameter_value_ranges_opt '''
9405 print('parameter_assign_1', list(p
))
9406 tpname
= Node(syms
.tname
, [Leaf(token
.NAME
, p
[1])])
9407 expr
= Node(syms
.tfpdef
, [tpname
, Leaf(token
.EQUAL
, p
[2]), p
[3]])
9410 # { PExpr*tmp = p[3];
9411 # pform_set_parameter(@1, lex_strings.make(p[1]), param_active_type,
9412 # param_active_signed, param_active_range, tmp, p[4]);
9418 def p_localparam_assign_1(p
):
9419 '''localparam_assign : IDENTIFIER '=' expression '''
9421 print('localparam_assign_1', list(p
))
9423 # { PExpr*tmp = p[3];
9424 # pform_set_localparam(@1, lex_strings.make(p[1]), param_active_type,
9425 # param_active_signed, param_active_range, tmp);
9431 def p_parameter_value_ranges_opt_1(p
):
9432 '''parameter_value_ranges_opt : parameter_value_ranges '''
9434 print('parameter_value_ranges_opt_1', list(p
))
9441 def p_parameter_value_ranges_opt_2(p
):
9442 '''parameter_value_ranges_opt : '''
9444 print('parameter_value_ranges_opt_2', list(p
))
9450 def p_parameter_value_ranges_1(p
):
9451 '''parameter_value_ranges : parameter_value_ranges parameter_value_range '''
9453 print('parameter_value_ranges_1', list(p
))
9455 # { p[0] = p[2]; p[0]->next = p[1]; }
9459 def p_parameter_value_ranges_2(p
):
9460 '''parameter_value_ranges : parameter_value_range '''
9462 print('parameter_value_ranges_2', list(p
))
9464 # { p[0] = p[1]; p[0]->next = 0; }
9468 def p_parameter_value_range_1(p
):
9469 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ']' '''
9471 print('parameter_value_range_1', list(p
))
9473 # { p[0] = pform_parameter_value_range(p[1], false, p[3], false, p[5]); }
9477 def p_parameter_value_range_2(p
):
9478 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ')' '''
9480 print('parameter_value_range_2', list(p
))
9482 # { p[0] = pform_parameter_value_range(p[1], false, p[3], true, p[5]); }
9486 def p_parameter_value_range_3(p
):
9487 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ']' '''
9489 print('parameter_value_range_3', list(p
))
9491 # { p[0] = pform_parameter_value_range(p[1], true, p[3], false, p[5]); }
9495 def p_parameter_value_range_4(p
):
9496 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ')' '''
9498 print('parameter_value_range_4', list(p
))
9500 # { p[0] = pform_parameter_value_range(p[1], true, p[3], true, p[5]); }
9504 def p_parameter_value_range_5(p
):
9505 '''parameter_value_range : K_exclude expression '''
9507 print('parameter_value_range_5', list(p
))
9509 # { p[0] = pform_parameter_value_range(true, false, p[2], false, p[2]); }
9513 def p_value_range_expression_1(p
):
9514 '''value_range_expression : expression '''
9516 print('value_range_expression_1', list(p
))
9523 def p_value_range_expression_2(p
):
9524 '''value_range_expression : K_inf '''
9526 print('value_range_expression_2', list(p
))
9532 def p_value_range_expression_3(p
):
9533 '''value_range_expression : '+' K_inf '''
9535 print('value_range_expression_3', list(p
))
9541 def p_value_range_expression_4(p
):
9542 '''value_range_expression : '-' K_inf '''
9544 print('value_range_expression_4', list(p
))
9550 def p_from_exclude_1(p
):
9551 '''from_exclude : K_from '''
9553 print('from_exclude_1', list(p
))
9560 def p_from_exclude_2(p
):
9561 '''from_exclude : K_exclude '''
9563 print('from_exclude_2', list(p
))
9570 def p_parameter_value_opt_1(p
):
9571 '''parameter_value_opt : '#' '(' expression_list_with_nuls ')' '''
9573 print('parameter_value_opt_1', list(p
))
9575 # { struct parmvalue_t*tmp = new struct parmvalue_t;
9576 # tmp->by_order = p[3];
9583 def p_parameter_value_opt_2(p
):
9584 '''parameter_value_opt : '#' '(' parameter_value_byname_list ')' '''
9586 print('parameter_value_opt_2', list(p
))
9588 # { struct parmvalue_t*tmp = new struct parmvalue_t;
9589 # tmp->by_order = 0;
9590 # tmp->by_name = p[3];
9596 def p_parameter_value_opt_3(p
):
9597 '''parameter_value_opt : '#' DEC_NUMBER '''
9599 print('parameter_value_opt_3', list(p
))
9602 # PENumber*tmp = new PENumber(p[2]);
9603 # FILE_NAME(tmp, @1);
9605 # struct parmvalue_t*lst = new struct parmvalue_t;
9606 # lst->by_order = new list<PExpr*>;
9607 # lst->by_order->push_back(tmp);
9615 def p_parameter_value_opt_4(p
):
9616 '''parameter_value_opt : '#' REALTIME '''
9618 print('parameter_value_opt_4', list(p
))
9621 # PEFNumber*tmp = new PEFNumber(p[2]);
9622 # FILE_NAME(tmp, @1);
9624 # struct parmvalue_t*lst = new struct parmvalue_t;
9625 # lst->by_order = new list<PExpr*>;
9626 # lst->by_order->push_back(tmp);
9633 def p_parameter_value_opt_5(p
):
9634 '''parameter_value_opt : '#' error '''
9636 print('parameter_value_opt_5', list(p
))
9638 # { yyerror(@1, "error: syntax error in parameter value "
9639 # "assignment list.");
9645 def p_parameter_value_opt_6(p
):
9646 '''parameter_value_opt : '''
9648 print('parameter_value_opt_6', list(p
))
9654 def p_parameter_value_byname_1(p
):
9655 '''parameter_value_byname : '.' IDENTIFIER '(' expression ')' '''
9657 print('parameter_value_byname_1', list(p
))
9659 # { named_pexpr_t*tmp = new named_pexpr_t;
9660 # tmp->name = lex_strings.make(p[2]);
9668 def p_parameter_value_byname_2(p
):
9669 '''parameter_value_byname : '.' IDENTIFIER '(' ')' '''
9671 print('parameter_value_byname_2', list(p
))
9673 # { named_pexpr_t*tmp = new named_pexpr_t;
9674 # tmp->name = lex_strings.make(p[2]);
9682 def p_parameter_value_byname_list_1(p
):
9683 '''parameter_value_byname_list : parameter_value_byname '''
9685 print('parameter_value_byname_list_1', list(p
))
9687 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
9688 # tmp->push_back(*p[1]);
9695 def p_parameter_value_byname_list_2(p
):
9696 '''parameter_value_byname_list : parameter_value_byname_list ',' parameter_value_byname '''
9698 print('parameter_value_byname_list_2', list(p
))
9700 # { list<named_pexpr_t>*tmp = p[1];
9701 # tmp->push_back(*p[3]);
9709 '''port : port_reference '''
9711 print('port_1', list(p
))
9719 '''port : '.' IDENTIFIER '(' port_reference ')' '''
9721 print('port_2', list(p
))
9723 # { Module::port_t*tmp = p[4];
9724 # tmp->name = lex_strings.make(p[2]);
9732 '''port : '{' port_reference_list '}' '''
9734 print('port_3', list(p
))
9736 # { Module::port_t*tmp = p[2];
9737 # tmp->name = perm_string();
9744 '''port : '.' IDENTIFIER '(' '{' port_reference_list '}' ')' '''
9746 print('port_4', list(p
))
9748 # { Module::port_t*tmp = p[5];
9749 # tmp->name = lex_strings.make(p[2]);
9756 def p_port_opt_1(p
):
9757 '''port_opt : port '''
9759 print('port_opt_1', list(p
))
9766 def p_port_opt_2(p
):
9769 print('port_opt_2', list(p
))
9775 def p_port_name_1(p
):
9776 '''port_name : '.' IDENTIFIER '(' expression ')' '''
9778 print('port_name_1', list(p
))
9780 # { named_pexpr_t*tmp = new named_pexpr_t;
9781 # tmp->name = lex_strings.make(p[2]);
9789 def p_port_name_2(p
):
9790 '''port_name : '.' IDENTIFIER '(' error ')' '''
9792 print('port_name_2', list(p
))
9794 # { yyerror(@3, "error: invalid port connection expression.");
9795 # named_pexpr_t*tmp = new named_pexpr_t;
9796 # tmp->name = lex_strings.make(p[2]);
9804 def p_port_name_3(p
):
9805 '''port_name : '.' IDENTIFIER '(' ')' '''
9807 print('port_name_3', list(p
))
9809 # { named_pexpr_t*tmp = new named_pexpr_t;
9810 # tmp->name = lex_strings.make(p[2]);
9818 def p_port_name_4(p
):
9819 '''port_name : '.' IDENTIFIER '''
9821 print('port_name_4', list(p
))
9823 # { named_pexpr_t*tmp = new named_pexpr_t;
9824 # tmp->name = lex_strings.make(p[2]);
9825 # tmp->parm = new PEIdent(lex_strings.make(p[2]), true);
9826 # FILE_NAME(tmp->parm, @1);
9833 def p_port_name_5(p
):
9834 '''port_name : K_DOTSTAR '''
9836 print('port_name_5', list(p
))
9838 # { named_pexpr_t*tmp = new named_pexpr_t;
9839 # tmp->name = lex_strings.make("*");
9846 def p_port_name_list_1(p
):
9847 '''port_name_list : port_name_list ',' port_name '''
9849 print('port_name_list_1', list(p
))
9851 # { list<named_pexpr_t>*tmp = p[1];
9852 # tmp->push_back(*p[3]);
9859 def p_port_name_list_2(p
):
9860 '''port_name_list : port_name '''
9862 print('port_name_list_2', list(p
))
9864 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
9865 # tmp->push_back(*p[1]);
9872 def p_port_reference_1(p
):
9873 '''port_reference : IDENTIFIER '''
9875 print('port_reference_1', list(p
))
9877 # { Module::port_t*ptmp;
9878 # perm_string name = lex_strings.make(p[1]);
9879 # ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
9886 def p_port_reference_2(p
):
9887 '''port_reference : IDENTIFIER '[' expression ':' expression ']' '''
9889 print('port_reference_2', list(p
))
9891 # { index_component_t itmp;
9892 # itmp.sel = index_component_t::SEL_PART;
9896 # name_component_t ntmp (lex_strings.make(p[1]));
9897 # ntmp.index.push_back(itmp);
9899 # pform_name_t pname;
9900 # pname.push_back(ntmp);
9902 # PEIdent*wtmp = new PEIdent(pname);
9903 # FILE_NAME(wtmp, @1);
9905 # Module::port_t*ptmp = new Module::port_t;
9906 # ptmp->name = perm_string();
9907 # ptmp->expr.push_back(wtmp);
9915 def p_port_reference_3(p
):
9916 '''port_reference : IDENTIFIER '[' expression ']' '''
9918 print('port_reference_3', list(p
))
9920 # { index_component_t itmp;
9921 # itmp.sel = index_component_t::SEL_BIT;
9925 # name_component_t ntmp (lex_strings.make(p[1]));
9926 # ntmp.index.push_back(itmp);
9928 # pform_name_t pname;
9929 # pname.push_back(ntmp);
9931 # PEIdent*tmp = new PEIdent(pname);
9932 # FILE_NAME(tmp, @1);
9934 # Module::port_t*ptmp = new Module::port_t;
9935 # ptmp->name = perm_string();
9936 # ptmp->expr.push_back(tmp);
9943 def p_port_reference_4(p
):
9944 '''port_reference : IDENTIFIER '[' error ']' '''
9946 print('port_reference_4', list(p
))
9948 # { yyerror(@1, "error: invalid port bit select");
9949 # Module::port_t*ptmp = new Module::port_t;
9950 # PEIdent*wtmp = new PEIdent(lex_strings.make(p[1]));
9951 # FILE_NAME(wtmp, @1);
9952 # ptmp->name = lex_strings.make(p[1]);
9953 # ptmp->expr.push_back(wtmp);
9960 def p_port_reference_list_1(p
):
9961 '''port_reference_list : port_reference '''
9963 print('port_reference_list_1', list(p
))
9970 def p_port_reference_list_2(p
):
9971 '''port_reference_list : port_reference_list ',' port_reference '''
9973 print('port_reference_list_2', list(p
))
9975 # { Module::port_t*tmp = p[1];
9976 # append(tmp->expr, p[3]->expr);
9983 def p_dimensions_opt_1(p
):
9984 '''dimensions_opt : '''
9985 if(parse_debug
> 2):
9986 print('dimensions_opt_1', list(p
))
9992 def p_dimensions_opt_2(p
):
9993 '''dimensions_opt : dimensions '''
9995 print('dimensions_opt_2', list(p
))
10002 def p_dimensions_1(p
):
10003 '''dimensions : variable_dimension '''
10005 print('dimensions_1', list(p
))
10012 def p_dimensions_2(p
):
10013 '''dimensions : dimensions variable_dimension '''
10015 print('dimensions_2', list(p
))
10017 # { list<pform_range_t> *tmp = p[1];
10019 # tmp->splice(tmp->end(), *p[2]);
10027 def p_register_variable_1(p
):
10028 '''register_variable : IDENTIFIER dimensions_opt '''
10030 print('register_variable_1', list(p
))
10032 # { perm_string name = lex_strings.make(p[1]);
10033 # pform_makewire(@1, name, NetNet::REG,
10034 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10035 # pform_set_reg_idx(name, p[2]);
10041 def p_register_variable_2(p
):
10042 '''register_variable : IDENTIFIER dimensions_opt '=' expression '''
10044 print('register_variable_2', list(p
))
10046 # { if (pform_peek_scope()->var_init_needs_explicit_lifetime()
10047 # && (var_lifetime == LexicalScope::INHERITED)) {
10048 # cerr << @3 << ": warning: Static variable initialization requires "
10049 # "explicit lifetime in this context." << endl;
10052 # perm_string name = lex_strings.make(p[1]);
10053 # pform_makewire(@1, name, NetNet::REG,
10054 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10055 # pform_set_reg_idx(name, p[2]);
10056 # pform_make_var_init(@1, name, p[4]);
10062 def p_register_variable_list_1(p
):
10063 '''register_variable_list : register_variable '''
10065 print('register_variable_list_1', list(p
))
10067 # { list<perm_string>*tmp = new list<perm_string>;
10068 # tmp->push_back(lex_strings.make(p[1]));
10075 def p_register_variable_list_2(p
):
10076 '''register_variable_list : register_variable_list ',' register_variable '''
10078 print('register_variable_list_2', list(p
))
10080 # { list<perm_string>*tmp = p[1];
10081 # tmp->push_back(lex_strings.make(p[3]));
10088 def p_net_variable_1(p
):
10089 '''net_variable : IDENTIFIER dimensions_opt '''
10090 if(parse_debug
> 2):
10091 print('net_variable_1', list(p
))
10093 #p[0]= ('net_variable_1', list(p))
10095 # { perm_string name = lex_strings.make(p[1]);
10096 # pform_makewire(@1, name, NetNet::IMPLICIT,
10097 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10098 # pform_set_reg_idx(name, p[2]);
10099 p
[0] = [p
[1], p
[2]]
10106 def p_net_variable_list_1(p
):
10107 '''net_variable_list : net_variable '''
10108 if(parse_debug
> 2):
10109 print('net_variable_list_1', list(p
))
10112 # { list<perm_string>*tmp = new list<perm_string>;
10113 # tmp->push_back(lex_strings.make(p[1]));
10120 def p_net_variable_list_2(p
):
10121 '''net_variable_list : net_variable_list ',' net_variable '''
10122 if(parse_debug
> 2):
10123 print('net_variable_list_2', list(p
))
10126 # { list<perm_string>*tmp = p[1];
10127 # tmp->push_back(lex_strings.make(p[3]));
10134 def p_event_variable_1(p
):
10135 '''event_variable : IDENTIFIER dimensions_opt '''
10137 print('event_variable_1', list(p
))
10140 # yyerror(@2, "sorry: event arrays are not supported.");
10148 def p_event_variable_list_1(p
):
10149 '''event_variable_list : event_variable '''
10151 print('event_variable_list_1', list(p
))
10153 # { p[0] = list_from_identifier(p[1]); }
10157 def p_event_variable_list_2(p
):
10158 '''event_variable_list : event_variable_list ',' event_variable '''
10160 print('event_variable_list_2', list(p
))
10162 # { p[0] = list_from_identifier(p[1], p[3]); }
10166 def p_specify_item_1(p
):
10167 '''specify_item : K_specparam specparam_decl ';' '''
10169 print('specify_item_1', list(p
))
10175 def p_specify_item_2(p
):
10176 '''specify_item : specify_simple_path_decl ';' '''
10178 print('specify_item_2', list(p
))
10180 # { pform_module_specify_path(p[1]);
10185 def p_specify_item_3(p
):
10186 '''specify_item : specify_edge_path_decl ';' '''
10188 print('specify_item_3', list(p
))
10190 # { pform_module_specify_path(p[1]);
10195 def p_specify_item_4(p
):
10196 '''specify_item : K_if '(' expression ')' specify_simple_path_decl ';' '''
10198 print('specify_item_4', 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_5(p
):
10211 '''specify_item : K_if '(' expression ')' specify_edge_path_decl ';' '''
10213 print('specify_item_5', list(p
))
10215 # { PSpecPath*tmp = p[5];
10217 # tmp->conditional = true;
10218 # tmp->condition = p[3];
10220 # pform_module_specify_path(tmp);
10225 def p_specify_item_6(p
):
10226 '''specify_item : K_ifnone specify_simple_path_decl ';' '''
10228 print('specify_item_6', list(p
))
10230 # { PSpecPath*tmp = p[2];
10232 # tmp->conditional = true;
10233 # tmp->condition = 0;
10235 # pform_module_specify_path(tmp);
10240 def p_specify_item_7(p
):
10241 '''specify_item : K_ifnone specify_edge_path_decl ';' '''
10243 print('specify_item_7', list(p
))
10245 # { yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
10246 # "not supported.");
10252 def p_specify_item_8(p
):
10253 '''specify_item : K_Sfullskew '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10255 print('specify_item_8', list(p
))
10263 def p_specify_item_9(p
):
10264 '''specify_item : K_Shold '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10266 print('specify_item_9', list(p
))
10273 def p_specify_item_10(p
):
10274 '''specify_item : K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10276 print('specify_item_10', list(p
))
10284 def p_specify_item_11(p
):
10285 '''specify_item : K_Speriod '(' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10287 print('specify_item_11', list(p
))
10294 def p_specify_item_12(p
):
10295 '''specify_item : K_Srecovery '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10297 print('specify_item_12', list(p
))
10304 def p_specify_item_13(p
):
10305 '''specify_item : K_Srecrem '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10307 print('specify_item_13', list(p
))
10315 def p_specify_item_14(p
):
10316 '''specify_item : K_Sremoval '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10318 print('specify_item_14', list(p
))
10325 def p_specify_item_15(p
):
10326 '''specify_item : K_Ssetup '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10328 print('specify_item_15', list(p
))
10335 def p_specify_item_16(p
):
10336 '''specify_item : K_Ssetuphold '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10338 print('specify_item_16', list(p
))
10346 def p_specify_item_17(p
):
10347 '''specify_item : K_Sskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10349 print('specify_item_17', list(p
))
10356 def p_specify_item_18(p
):
10357 '''specify_item : K_Stimeskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10359 print('specify_item_18', list(p
))
10366 def p_specify_item_19(p
):
10367 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ',' expression spec_notifier_opt ')' ';' '''
10369 print('specify_item_19', list(p
))
10377 def p_specify_item_20(p
):
10378 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ')' ';' '''
10380 print('specify_item_20', list(p
))
10387 def p_specify_item_21(p
):
10388 '''specify_item : K_pulsestyle_onevent specify_path_identifiers ';' '''
10390 print('specify_item_21', list(p
))
10397 def p_specify_item_22(p
):
10398 '''specify_item : K_pulsestyle_ondetect specify_path_identifiers ';' '''
10400 print('specify_item_22', list(p
))
10407 def p_specify_item_23(p
):
10408 '''specify_item : K_showcancelled specify_path_identifiers ';' '''
10410 print('specify_item_23', list(p
))
10417 def p_specify_item_24(p
):
10418 '''specify_item : K_noshowcancelled specify_path_identifiers ';' '''
10420 print('specify_item_24', list(p
))
10427 def p_specify_item_list_1(p
):
10428 '''specify_item_list : specify_item '''
10430 print('specify_item_list_1', list(p
))
10436 def p_specify_item_list_2(p
):
10437 '''specify_item_list : specify_item_list specify_item '''
10439 print('specify_item_list_2', list(p
))
10445 def p_specify_item_list_opt_1(p
):
10446 '''specify_item_list_opt : '''
10448 print('specify_item_list_opt_1', list(p
))
10454 def p_specify_item_list_opt_2(p
):
10455 '''specify_item_list_opt : specify_item_list '''
10457 print('specify_item_list_opt_2', list(p
))
10463 def p_specify_edge_path_decl_1(p
):
10464 '''specify_edge_path_decl : specify_edge_path '=' '(' delay_value_list ')' '''
10466 print('specify_edge_path_decl_1', list(p
))
10468 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
10472 def p_specify_edge_path_decl_2(p
):
10473 '''specify_edge_path_decl : specify_edge_path '=' delay_value_simple '''
10475 print('specify_edge_path_decl_2', list(p
))
10477 # { list<PExpr*>*tmp = new list<PExpr*>;
10478 # tmp->push_back(p[3]);
10479 # p[0] = pform_assign_path_delay(p[1], tmp);
10484 def p_edge_operator_1(p
):
10485 '''edge_operator : K_posedge '''
10487 print('edge_operator_1', list(p
))
10494 def p_edge_operator_2(p
):
10495 '''edge_operator : K_negedge '''
10497 print('edge_operator_2', list(p
))
10504 def p_specify_edge_path_1(p
):
10505 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10507 print('specify_edge_path_1', list(p
))
10509 # { int edge_flag = 0;
10510 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], false, p[6], p[8]); }
10514 def p_specify_edge_path_2(p
):
10515 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10517 print('specify_edge_path_2', list(p
))
10519 # { int edge_flag = p[2]? 1 : -1;
10520 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], false, p[7], p[9]);}
10524 def p_specify_edge_path_3(p
):
10525 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10527 print('specify_edge_path_3', list(p
))
10529 # { int edge_flag = 0;
10530 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], true, p[6], p[8]); }
10534 def p_specify_edge_path_4(p
):
10535 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10537 print('specify_edge_path_4', list(p
))
10539 # { int edge_flag = p[2]? 1 : -1;
10540 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], true, p[7], p[9]); }
10544 def p_polarity_operator_1(p
):
10545 '''polarity_operator : K_PO_POS '''
10547 print('polarity_operator_1', list(p
))
10553 def p_polarity_operator_2(p
):
10554 '''polarity_operator : K_PO_NEG '''
10556 print('polarity_operator_2', list(p
))
10562 def p_polarity_operator_3(p
):
10563 '''polarity_operator : ':' '''
10565 print('polarity_operator_3', list(p
))
10571 def p_specify_simple_path_decl_1(p
):
10572 '''specify_simple_path_decl : specify_simple_path '=' '(' delay_value_list ')' '''
10574 print('specify_simple_path_decl_1', list(p
))
10576 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
10580 def p_specify_simple_path_decl_2(p
):
10581 '''specify_simple_path_decl : specify_simple_path '=' delay_value_simple '''
10583 print('specify_simple_path_decl_2', list(p
))
10585 # { list<PExpr*>*tmp = new list<PExpr*>;
10586 # tmp->push_back(p[3]);
10587 # p[0] = pform_assign_path_delay(p[1], tmp);
10592 def p_specify_simple_path_decl_3(p
):
10593 '''specify_simple_path_decl : specify_simple_path '=' '(' error ')' '''
10595 print('specify_simple_path_decl_3', list(p
))
10597 # { yyerror(@3, "Syntax error in delay value list.");
10604 def p_specify_simple_path_1(p
):
10605 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' '''
10607 print('specify_simple_path_1', list(p
))
10609 # { p[0] = pform_make_specify_path(@1, p[2], p[3], false, p[5]); }
10613 def p_specify_simple_path_2(p
):
10614 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' '''
10616 print('specify_simple_path_2', list(p
))
10618 # { p[0] = pform_make_specify_path(@1, p[2], p[3], true, p[5]); }
10622 def p_specify_simple_path_3(p
):
10623 '''specify_simple_path : '(' error ')' '''
10625 print('specify_simple_path_3', list(p
))
10627 # { yyerror(@1, "Invalid simple path");
10633 def p_specify_path_identifiers_1(p
):
10634 '''specify_path_identifiers : IDENTIFIER '''
10636 print('specify_path_identifiers_1', list(p
))
10638 # { list<perm_string>*tmp = new list<perm_string>;
10639 # tmp->push_back(lex_strings.make(p[1]));
10646 def p_specify_path_identifiers_2(p
):
10647 '''specify_path_identifiers : IDENTIFIER '[' expr_primary ']' '''
10649 print('specify_path_identifiers_2', list(p
))
10651 # { if (gn_specify_blocks_flag) {
10652 # yywarn(@4, "Bit selects are not currently supported "
10653 # "in path declarations. The declaration "
10654 # "will be applied to the whole vector.");
10656 # list<perm_string>*tmp = new list<perm_string>;
10657 # tmp->push_back(lex_strings.make(p[1]));
10664 def p_specify_path_identifiers_3(p
):
10665 '''specify_path_identifiers : IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
10667 print('specify_path_identifiers_3', list(p
))
10669 # { if (gn_specify_blocks_flag) {
10670 # yywarn(@4, "Part selects are not currently supported "
10671 # "in path declarations. The declaration "
10672 # "will be applied to the whole vector.");
10674 # list<perm_string>*tmp = new list<perm_string>;
10675 # tmp->push_back(lex_strings.make(p[1]));
10682 def p_specify_path_identifiers_4(p
):
10683 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '''
10685 print('specify_path_identifiers_4', list(p
))
10687 # { list<perm_string>*tmp = p[1];
10688 # tmp->push_back(lex_strings.make(p[3]));
10695 def p_specify_path_identifiers_5(p
):
10696 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' '''
10698 print('specify_path_identifiers_5', list(p
))
10700 # { if (gn_specify_blocks_flag) {
10701 # yywarn(@4, "Bit selects are not currently supported "
10702 # "in path declarations. The declaration "
10703 # "will be applied to the whole vector.");
10705 # list<perm_string>*tmp = p[1];
10706 # tmp->push_back(lex_strings.make(p[3]));
10713 def p_specify_path_identifiers_6(p
):
10714 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
10716 print('specify_path_identifiers_6', list(p
))
10718 # { if (gn_specify_blocks_flag) {
10719 # yywarn(@4, "Part selects are not currently supported "
10720 # "in path declarations. The declaration "
10721 # "will be applied to the whole vector.");
10723 # list<perm_string>*tmp = p[1];
10724 # tmp->push_back(lex_strings.make(p[3]));
10731 def p_specparam_1(p
):
10732 '''specparam : IDENTIFIER '=' expression '''
10734 print('specparam_1', list(p
))
10736 # { PExpr*tmp = p[3];
10737 # pform_set_specparam(@1, lex_strings.make(p[1]),
10738 # param_active_range, tmp);
10744 def p_specparam_2(p
):
10745 '''specparam : IDENTIFIER '=' expression ':' expression ':' expression '''
10747 print('specparam_2', list(p
))
10750 # switch (min_typ_max_flag) {
10767 # if (min_typ_max_warn > 0) {
10768 # cerr << tmp->get_fileline() << ": warning: choosing ";
10769 # switch (min_typ_max_flag) {
10780 # cerr << " expression." << endl;
10781 # min_typ_max_warn -= 1;
10783 # pform_set_specparam(@1, lex_strings.make(p[1]),
10784 # param_active_range, tmp);
10790 def p_specparam_3(p
):
10791 '''specparam : PATHPULSE_IDENTIFIER '=' expression '''
10793 print('specparam_3', list(p
))
10801 def p_specparam_4(p
):
10802 '''specparam : PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' '''
10804 print('specparam_4', list(p
))
10813 def p_specparam_list_1(p
):
10814 '''specparam_list : specparam '''
10816 print('specparam_list_1', list(p
))
10822 def p_specparam_list_2(p
):
10823 '''specparam_list : specparam_list ',' specparam '''
10825 print('specparam_list_2', list(p
))
10831 def p_specparam_decl_1(p
):
10832 '''specparam_decl : specparam_list '''
10834 print('specparam_decl_1', list(p
))
10840 def p_specparam_decl_2(p
):
10841 '''specparam_decl : dimensions _embed0_specparam_decl specparam_list '''
10843 print('specparam_decl_2', list(p
))
10845 # { param_active_range = 0; }
10849 def p__embed0_specparam_decl(p
):
10850 '''_embed0_specparam_decl : '''
10852 # { param_active_range = p[1]; }
10856 def p_spec_polarity_1(p
):
10857 '''spec_polarity : '+' '''
10859 print('spec_polarity_1', list(p
))
10865 def p_spec_polarity_2(p
):
10866 '''spec_polarity : '-' '''
10868 print('spec_polarity_2', list(p
))
10874 def p_spec_polarity_3(p
):
10875 '''spec_polarity : '''
10877 print('spec_polarity_3', list(p
))
10883 def p_spec_reference_event_1(p
):
10884 '''spec_reference_event : K_posedge expression '''
10886 print('spec_reference_event_1', list(p
))
10892 def p_spec_reference_event_2(p
):
10893 '''spec_reference_event : K_negedge expression '''
10895 print('spec_reference_event_2', list(p
))
10901 def p_spec_reference_event_3(p
):
10902 '''spec_reference_event : K_posedge expr_primary K_TAND expression '''
10904 print('spec_reference_event_3', list(p
))
10912 def p_spec_reference_event_4(p
):
10913 '''spec_reference_event : K_negedge expr_primary K_TAND expression '''
10915 print('spec_reference_event_4', list(p
))
10923 def p_spec_reference_event_5(p
):
10924 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary '''
10926 print('spec_reference_event_5', list(p
))
10932 def p_spec_reference_event_6(p
):
10933 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression '''
10935 print('spec_reference_event_6', list(p
))
10943 def p_spec_reference_event_7(p
):
10944 '''spec_reference_event : expr_primary K_TAND expression '''
10946 print('spec_reference_event_7', list(p
))
10954 def p_spec_reference_event_8(p
):
10955 '''spec_reference_event : expr_primary '''
10957 print('spec_reference_event_8', list(p
))
10963 def p_edge_descriptor_list_1(p
):
10964 '''edge_descriptor_list : edge_descriptor_list ',' K_edge_descriptor '''
10966 print('edge_descriptor_list_1', list(p
))
10972 def p_edge_descriptor_list_2(p
):
10973 '''edge_descriptor_list : K_edge_descriptor '''
10975 print('edge_descriptor_list_2', list(p
))
10981 def p_spec_notifier_opt_1(p
):
10982 '''spec_notifier_opt : '''
10984 print('spec_notifier_opt_1', list(p
))
10990 def p_spec_notifier_opt_2(p
):
10991 '''spec_notifier_opt : spec_notifier '''
10993 print('spec_notifier_opt_2', list(p
))
10999 def p_spec_notifier_1(p
):
11000 '''spec_notifier : ',' '''
11002 print('spec_notifier_1', list(p
))
11004 # { args_after_notifier = 0; }
11008 def p_spec_notifier_2(p
):
11009 '''spec_notifier : ',' hierarchy_identifier '''
11011 print('spec_notifier_2', list(p
))
11013 # { args_after_notifier = 0; delete p[2]; }
11017 def p_spec_notifier_3(p
):
11018 '''spec_notifier : spec_notifier ',' '''
11020 print('spec_notifier_3', list(p
))
11022 # { args_after_notifier += 1; }
11026 def p_spec_notifier_4(p
):
11027 '''spec_notifier : spec_notifier ',' hierarchy_identifier '''
11029 print('spec_notifier_4', list(p
))
11031 # { args_after_notifier += 1;
11032 # if (args_after_notifier >= 3) {
11033 # cerr << @3 << ": warning: timing checks are not supported "
11034 # "and delayed signal \"" << *p[3]
11035 # << "\" will not be driven." << endl;
11041 def p_spec_notifier_5(p
):
11042 '''spec_notifier : IDENTIFIER '''
11044 print('spec_notifier_5', list(p
))
11046 # { args_after_notifier = 0; delete[]p[1]; }
11050 def p_statement_item_1(p
):
11051 '''statement_item : K_assign lpvalue '=' expression ';' '''
11053 print('statement_item_1', list(p
))
11055 # { PCAssign*tmp = new PCAssign(p[2], p[4]);
11056 # FILE_NAME(tmp, @1);
11062 def p_statement_item_2(p
):
11063 '''statement_item : K_deassign lpvalue ';' '''
11065 print('statement_item_2', list(p
))
11067 # { PDeassign*tmp = new PDeassign(p[2]);
11068 # FILE_NAME(tmp, @1);
11074 def p_statement_item_3(p
):
11075 '''statement_item : K_force lpvalue '=' expression ';' '''
11077 print('statement_item_3', list(p
))
11079 # { PForce*tmp = new PForce(p[2], p[4]);
11080 # FILE_NAME(tmp, @1);
11086 def p_statement_item_4(p
):
11087 '''statement_item : K_release lpvalue ';' '''
11089 print('statement_item_4', list(p
))
11091 # { PRelease*tmp = new PRelease(p[2]);
11092 # FILE_NAME(tmp, @1);
11098 def p_statement_item_5(p
):
11099 '''statement_item : K_begin K_end '''
11101 print('statement_item_5', list(p
))
11103 # { PBlock*tmp = new PBlock(PBlock::BL_SEQ);
11104 # FILE_NAME(tmp, @1);
11110 def p_statement_item_6(p
):
11111 '''statement_item : K_begin _embed0_statement_item block_item_decls_opt _embed1_statement_item statement_or_null_list K_end '''
11113 print('statement_item_6', list(p
))
11117 # pform_pop_scope();
11118 # assert(! current_block_stack.empty());
11119 # tmp = current_block_stack.top();
11120 # current_block_stack.pop();
11122 # tmp = new PBlock(PBlock::BL_SEQ);
11123 # FILE_NAME(tmp, @1);
11125 # if (p[5]) tmp->set_statement(*p[5]);
11132 def p_statement_item_7(p
):
11133 '''statement_item : K_begin ':' IDENTIFIER _embed2_statement_item block_item_decls_opt statement_or_null_list_opt K_end endlabel_opt '''
11135 print('statement_item_7', list(p
))
11137 # { pform_pop_scope();
11138 # assert(! current_block_stack.empty());
11139 # PBlock*tmp = current_block_stack.top();
11140 # current_block_stack.pop();
11141 # if (p[6]) tmp->set_statement(*p[6]);
11144 # if (strcmp(p[3],p[8]) != 0) {
11145 # yyerror(@8, "error: End label doesn't match begin name");
11147 # if (! gn_system_verilog()) {
11148 # yyerror(@8, "error: Begin end labels require "
11149 # "SystemVerilog.");
11159 def p_statement_item_8(p
):
11160 '''statement_item : K_fork join_keyword '''
11162 print('statement_item_8', list(p
))
11164 # { PBlock*tmp = new PBlock(p[2]);
11165 # FILE_NAME(tmp, @1);
11171 def p_statement_item_9(p
):
11172 '''statement_item : K_fork _embed3_statement_item block_item_decls_opt _embed4_statement_item statement_or_null_list join_keyword '''
11174 print('statement_item_9', list(p
))
11178 # pform_pop_scope();
11179 # assert(! current_block_stack.empty());
11180 # tmp = current_block_stack.top();
11181 # current_block_stack.pop();
11182 # tmp->set_join_type(p[6]);
11184 # tmp = new PBlock(p[6]);
11185 # FILE_NAME(tmp, @1);
11187 # if (p[5]) tmp->set_statement(*p[5]);
11194 def p_statement_item_10(p
):
11195 '''statement_item : K_fork ':' IDENTIFIER _embed5_statement_item block_item_decls_opt statement_or_null_list_opt join_keyword endlabel_opt '''
11197 print('statement_item_10', list(p
))
11199 # { pform_pop_scope();
11200 # assert(! current_block_stack.empty());
11201 # PBlock*tmp = current_block_stack.top();
11202 # current_block_stack.pop();
11203 # tmp->set_join_type(p[7]);
11204 # if (p[6]) tmp->set_statement(*p[6]);
11207 # if (strcmp(p[3],p[8]) != 0) {
11208 # yyerror(@8, "error: End label doesn't match fork name");
11210 # if (! gn_system_verilog()) {
11211 # yyerror(@8, "error: Fork end labels require "
11212 # "SystemVerilog.");
11222 def p_statement_item_11(p
):
11223 '''statement_item : K_disable hierarchy_identifier ';' '''
11225 print('statement_item_11', list(p
))
11227 # { PDisable*tmp = new PDisable(*p[2]);
11228 # FILE_NAME(tmp, @1);
11235 def p_statement_item_12(p
):
11236 '''statement_item : K_disable K_fork ';' '''
11238 print('statement_item_12', list(p
))
11240 # { pform_name_t tmp_name;
11241 # PDisable*tmp = new PDisable(tmp_name);
11242 # FILE_NAME(tmp, @1);
11248 def p_statement_item_13(p
):
11249 '''statement_item : K_TRIGGER hierarchy_identifier ';' '''
11251 print('statement_item_13', list(p
))
11253 # { PTrigger*tmp = new PTrigger(*p[2]);
11254 # FILE_NAME(tmp, @1);
11261 def p_statement_item_14(p
):
11262 '''statement_item : procedural_assertion_statement '''
11264 print('statement_item_14', list(p
))
11271 def p_statement_item_15(p
):
11272 '''statement_item : loop_statement '''
11274 print('statement_item_15', list(p
))
11281 def p_statement_item_16(p
):
11282 '''statement_item : jump_statement '''
11284 print('statement_item_16', list(p
))
11291 def p_statement_item_17(p
):
11292 '''statement_item : K_case '(' expression ')' case_items K_endcase '''
11294 print('statement_item_17', list(p
))
11296 # { PCase*tmp = new PCase(NetCase::EQ, p[3], p[5]);
11297 # FILE_NAME(tmp, @1);
11303 def p_statement_item_18(p
):
11304 '''statement_item : K_casex '(' expression ')' case_items K_endcase '''
11306 print('statement_item_18', list(p
))
11308 # { PCase*tmp = new PCase(NetCase::EQX, p[3], p[5]);
11309 # FILE_NAME(tmp, @1);
11315 def p_statement_item_19(p
):
11316 '''statement_item : K_casez '(' expression ')' case_items K_endcase '''
11318 print('statement_item_19', list(p
))
11320 # { PCase*tmp = new PCase(NetCase::EQZ, p[3], p[5]);
11321 # FILE_NAME(tmp, @1);
11327 def p_statement_item_20(p
):
11328 '''statement_item : K_case '(' expression ')' error K_endcase '''
11330 print('statement_item_20', list(p
))
11336 def p_statement_item_21(p
):
11337 '''statement_item : K_casex '(' expression ')' error K_endcase '''
11339 print('statement_item_21', list(p
))
11345 def p_statement_item_22(p
):
11346 '''statement_item : K_casez '(' expression ')' error K_endcase '''
11348 print('statement_item_22', list(p
))
11354 def p_statement_item_23(p
):
11355 '''statement_item : K_if '(' expression ')' statement_or_null %prec less_than_K_else '''
11357 print('statement_item_23', list(p
))
11359 # { PCondit*tmp = new PCondit(p[3], p[5], 0);
11360 # FILE_NAME(tmp, @1);
11366 def p_statement_item_24(p
):
11367 '''statement_item : K_if '(' expression ')' statement_or_null K_else statement_or_null '''
11369 print('statement_item_24', list(p
))
11371 # { PCondit*tmp = new PCondit(p[3], p[5], p[7]);
11372 # FILE_NAME(tmp, @1);
11378 def p_statement_item_25(p
):
11379 '''statement_item : K_if '(' error ')' statement_or_null %prec less_than_K_else '''
11381 print('statement_item_25', list(p
))
11383 # { yyerror(@1, "error: Malformed conditional expression.");
11389 def p_statement_item_26(p
):
11390 '''statement_item : K_if '(' error ')' statement_or_null K_else statement_or_null '''
11392 print('statement_item_26', list(p
))
11394 # { yyerror(@1, "error: Malformed conditional expression.");
11400 def p_statement_item_27(p
):
11401 '''statement_item : compressed_statement ';' '''
11403 print('statement_item_27', list(p
))
11410 def p_statement_item_28(p
):
11411 '''statement_item : inc_or_dec_expression ';' '''
11413 print('statement_item_28', list(p
))
11415 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
11419 def p_statement_item_29(p
):
11420 '''statement_item : delay1 statement_or_null '''
11422 print('statement_item_29', list(p
))
11424 # { PExpr*del = p[1]->front();
11425 # assert(p[1]->size() == 1);
11427 # PDelayStatement*tmp = new PDelayStatement(del, p[2]);
11428 # FILE_NAME(tmp, @1);
11434 def p_statement_item_30(p
):
11435 '''statement_item : event_control statement_or_null '''
11437 print('statement_item_30', list(p
))
11439 # { PEventStatement*tmp = p[1];
11441 # yyerror(@1, "error: Invalid event control.");
11444 # tmp->set_statement(p[2]);
11451 def p_statement_item_31(p
):
11452 '''statement_item : '@' '*' statement_or_null '''
11454 print('statement_item_31', list(p
))
11456 # { PEventStatement*tmp = new PEventStatement;
11457 # FILE_NAME(tmp, @1);
11458 # tmp->set_statement(p[3]);
11464 def p_statement_item_32(p
):
11465 '''statement_item : '@' '(' '*' ')' statement_or_null '''
11467 print('statement_item_32', list(p
))
11469 # { PEventStatement*tmp = new PEventStatement;
11470 # FILE_NAME(tmp, @1);
11471 # tmp->set_statement(p[5]);
11477 def p_statement_item_33(p
):
11478 '''statement_item : lpvalue '=' expression ';' '''
11480 print('statement_item33', list(p
))
11482 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), p
[3]])
11484 print("expr TODO", repr(expr
))
11486 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), ])
11488 print("expr", repr(expr
))
11490 print("expr (python):'%s'" % expr
)
11493 # { PAssign*tmp = new PAssign(p[1],p[3]);
11494 # FILE_NAME(tmp, @1);
11500 def p_statement_item_34(p
):
11501 '''statement_item : error '=' expression ';' '''
11503 print('statement_item_34', list(p
))
11505 # { yyerror(@2, "Syntax in assignment statement l-value.");
11507 # p[0] = new PNoop;
11512 def p_statement_item_35(p
):
11513 '''statement_item : lpvalue K_LE expression ';' '''
11515 print('statement_item_35', list(p
))
11517 # { PAssignNB*tmp = new PAssignNB(p[1],p[3]);
11518 # FILE_NAME(tmp, @1);
11524 def p_statement_item_36(p
):
11525 '''statement_item : error K_LE expression ';' '''
11527 print('statement_item_36', list(p
))
11529 # { yyerror(@2, "Syntax in assignment statement l-value.");
11531 # p[0] = new PNoop;
11536 def p_statement_item_37(p
):
11537 '''statement_item : lpvalue '=' delay1 expression ';' '''
11539 print('statement_item_37', list(p
))
11541 # { PExpr*del = p[3]->front(); p[3]->pop_front();
11542 # assert(p[3]->empty());
11543 # PAssign*tmp = new PAssign(p[1],del,p[4]);
11544 # FILE_NAME(tmp, @1);
11550 def p_statement_item_38(p
):
11551 '''statement_item : lpvalue K_LE delay1 expression ';' '''
11553 print('statement_item_38', list(p
))
11555 # { PExpr*del = p[3]->front(); p[3]->pop_front();
11556 # assert(p[3]->empty());
11557 # PAssignNB*tmp = new PAssignNB(p[1],del,p[4]);
11558 # FILE_NAME(tmp, @1);
11564 def p_statement_item_39(p
):
11565 '''statement_item : lpvalue '=' event_control expression ';' '''
11567 print('statement_item_39', list(p
))
11569 # { PAssign*tmp = new PAssign(p[1],0,p[3],p[4]);
11570 # FILE_NAME(tmp, @1);
11576 def p_statement_item_40(p
):
11577 '''statement_item : lpvalue '=' K_repeat '(' expression ')' event_control expression ';' '''
11579 print('statement_item_40', list(p
))
11581 # { PAssign*tmp = new PAssign(p[1],p[5],p[7],p[8]);
11582 # FILE_NAME(tmp,@1);
11583 # tmp->set_lineno(@1.first_line);
11589 def p_statement_item_41(p
):
11590 '''statement_item : lpvalue K_LE event_control expression ';' '''
11592 print('statement_item_41', list(p
))
11594 # { PAssignNB*tmp = new PAssignNB(p[1],0,p[3],p[4]);
11595 # FILE_NAME(tmp, @1);
11601 def p_statement_item_42(p
):
11602 '''statement_item : lpvalue K_LE K_repeat '(' expression ')' event_control expression ';' '''
11604 print('statement_item_42', list(p
))
11606 # { PAssignNB*tmp = new PAssignNB(p[1],p[5],p[7],p[8]);
11607 # FILE_NAME(tmp, @1);
11613 def p_statement_item_43(p
):
11614 '''statement_item : lpvalue '=' dynamic_array_new ';' '''
11616 print('statement_item_43', list(p
))
11618 # { PAssign*tmp = new PAssign(p[1],p[3]);
11619 # FILE_NAME(tmp, @1);
11625 def p_statement_item_44(p
):
11626 '''statement_item : lpvalue '=' class_new ';' '''
11628 print('statement_item_44', list(p
))
11630 # { PAssign*tmp = new PAssign(p[1],p[3]);
11631 # FILE_NAME(tmp, @1);
11637 def p_statement_item_45(p
):
11638 '''statement_item : K_wait '(' expression ')' statement_or_null '''
11640 print('statement_item_45', list(p
))
11642 # { PEventStatement*tmp;
11643 # PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, p[3]);
11644 # tmp = new PEventStatement(etmp);
11645 # FILE_NAME(tmp,@1);
11646 # tmp->set_statement(p[5]);
11652 def p_statement_item_46(p
):
11653 '''statement_item : K_wait K_fork ';' '''
11655 print('statement_item_46', list(p
))
11657 # { PEventStatement*tmp = new PEventStatement((PEEvent*)0);
11658 # FILE_NAME(tmp,@1);
11664 def p_statement_item_47(p
):
11665 '''statement_item : SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';' '''
11667 print('statement_item_47', list(p
))
11669 # { PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), *p[3]);
11670 # FILE_NAME(tmp,@1);
11678 def p_statement_item_48(p
):
11679 '''statement_item : SYSTEM_IDENTIFIER ';' '''
11681 print('statement_item_48', list(p
))
11683 # { list<PExpr*>pt;
11684 # PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), pt);
11685 # FILE_NAME(tmp,@1);
11692 def p_statement_item_49(p
):
11693 '''statement_item : hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
11695 print('statement_item_49', list(p
))
11697 # { PCallTask*tmp = pform_make_call_task(@1, *p[1], *p[3]);
11705 def p_statement_item_50(p
):
11706 '''statement_item : hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';' '''
11708 print('statement_item_50', list(p
))
11710 # { /* ....randomize with { <constraints> } */
11711 # if (p[1] && peek_tail_name(*p[1]) == "randomize") {
11712 # if (!gn_system_verilog())
11713 # yyerror(@2, "error: Randomize with constraint requires SystemVerilog.");
11715 # yyerror(@2, "sorry: Randomize with constraint not supported.");
11717 # yyerror(@2, "error: Constraint block can only be applied to randomize method.");
11720 # PCallTask*tmp = new PCallTask(*p[1], pt);
11721 # FILE_NAME(tmp, @1);
11728 def p_statement_item_51(p
):
11729 '''statement_item : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
11731 print('statement_item_51', list(p
))
11733 # { pform_name_t*t_name = p[1];
11734 # while (! p[3]->empty()) {
11735 # t_name->push_back(p[3]->front());
11736 # p[3]->pop_front();
11738 # PCallTask*tmp = new PCallTask(*t_name, *p[5]);
11739 # FILE_NAME(tmp, @1);
11748 def p_statement_item_52(p
):
11749 '''statement_item : hierarchy_identifier ';' '''
11751 print('statement_item_52', list(p
))
11753 # { list<PExpr*>pt;
11754 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
11761 def p_statement_item_53(p
):
11762 '''statement_item : implicit_class_handle '.' K_new '(' expression_list_with_nuls ')' ';' '''
11764 print('statement_item_53', list(p
))
11766 # { PChainConstructor*tmp = new PChainConstructor(*p[5]);
11767 # FILE_NAME(tmp, @3);
11774 def p_statement_item_54(p
):
11775 '''statement_item : hierarchy_identifier '(' error ')' ';' '''
11777 print('statement_item_54', list(p
))
11779 # { yyerror(@3, "error: Syntax error in task arguments.");
11781 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
11788 def p_statement_item_55(p
):
11789 '''statement_item : error ';' '''
11791 print('statement_item_55', list(p
))
11793 # { yyerror(@2, "error: malformed statement");
11795 # p[0] = new PNoop;
11800 def p__embed0_statement_item(p
):
11801 '''_embed0_statement_item : '''
11803 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_SEQ);
11804 # FILE_NAME(tmp, @1);
11805 # current_block_stack.push(tmp);
11810 def p__embed1_statement_item(p
):
11811 '''_embed1_statement_item : '''
11814 # if (! gn_system_verilog()) {
11815 # yyerror("error: Variable declaration in unnamed block "
11816 # "requires SystemVerilog.");
11819 # /* If there are no declarations in the scope then just delete it. */
11820 # pform_pop_scope();
11821 # assert(! current_block_stack.empty());
11822 # PBlock*tmp = current_block_stack.top();
11823 # current_block_stack.pop();
11830 def p__embed2_statement_item(p
):
11831 '''_embed2_statement_item : '''
11833 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_SEQ);
11834 # FILE_NAME(tmp, @1);
11835 # current_block_stack.push(tmp);
11840 def p__embed3_statement_item(p
):
11841 '''_embed3_statement_item : '''
11843 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
11844 # FILE_NAME(tmp, @1);
11845 # current_block_stack.push(tmp);
11850 def p__embed4_statement_item(p
):
11851 '''_embed4_statement_item : '''
11854 # if (! gn_system_verilog()) {
11855 # yyerror("error: Variable declaration in unnamed block "
11856 # "requires SystemVerilog.");
11859 # /* If there are no declarations in the scope then just delete it. */
11860 # pform_pop_scope();
11861 # assert(! current_block_stack.empty());
11862 # PBlock*tmp = current_block_stack.top();
11863 # current_block_stack.pop();
11870 def p__embed5_statement_item(p
):
11871 '''_embed5_statement_item : '''
11873 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_PAR);
11874 # FILE_NAME(tmp, @1);
11875 # current_block_stack.push(tmp);
11880 def p_compressed_statement_1(p
):
11881 '''compressed_statement : lpvalue K_PLUS_EQ expression '''
11883 print('compressed_statement_1', list(p
))
11885 # { PAssign*tmp = new PAssign(p[1], '+', p[3]);
11886 # FILE_NAME(tmp, @1);
11892 def p_compressed_statement_2(p
):
11893 '''compressed_statement : lpvalue K_MINUS_EQ expression '''
11895 print('compressed_statement_2', list(p
))
11897 # { PAssign*tmp = new PAssign(p[1], '-', p[3]);
11898 # FILE_NAME(tmp, @1);
11904 def p_compressed_statement_3(p
):
11905 '''compressed_statement : lpvalue K_MUL_EQ expression '''
11907 print('compressed_statement_3', list(p
))
11909 # { PAssign*tmp = new PAssign(p[1], '*', p[3]);
11910 # FILE_NAME(tmp, @1);
11916 def p_compressed_statement_4(p
):
11917 '''compressed_statement : lpvalue K_DIV_EQ expression '''
11919 print('compressed_statement_4', list(p
))
11921 # { PAssign*tmp = new PAssign(p[1], '/', p[3]);
11922 # FILE_NAME(tmp, @1);
11928 def p_compressed_statement_5(p
):
11929 '''compressed_statement : lpvalue K_MOD_EQ expression '''
11931 print('compressed_statement_5', list(p
))
11933 # { PAssign*tmp = new PAssign(p[1], '%', p[3]);
11934 # FILE_NAME(tmp, @1);
11940 def p_compressed_statement_6(p
):
11941 '''compressed_statement : lpvalue K_AND_EQ expression '''
11943 print('compressed_statement_6', list(p
))
11945 # { PAssign*tmp = new PAssign(p[1], '&', p[3]);
11946 # FILE_NAME(tmp, @1);
11952 def p_compressed_statement_7(p
):
11953 '''compressed_statement : lpvalue K_OR_EQ expression '''
11955 print('compressed_statement_7', list(p
))
11957 # { PAssign*tmp = new PAssign(p[1], '|', p[3]);
11958 # FILE_NAME(tmp, @1);
11964 def p_compressed_statement_8(p
):
11965 '''compressed_statement : lpvalue K_XOR_EQ expression '''
11967 print('compressed_statement_8', list(p
))
11969 # { PAssign*tmp = new PAssign(p[1], '^', p[3]);
11970 # FILE_NAME(tmp, @1);
11976 def p_compressed_statement_9(p
):
11977 '''compressed_statement : lpvalue K_LS_EQ expression '''
11979 print('compressed_statement_9', list(p
))
11981 # { PAssign *tmp = new PAssign(p[1], 'l', p[3]);
11982 # FILE_NAME(tmp, @1);
11988 def p_compressed_statement_10(p
):
11989 '''compressed_statement : lpvalue K_RS_EQ expression '''
11991 print('compressed_statement_10', list(p
))
11993 # { PAssign*tmp = new PAssign(p[1], 'r', p[3]);
11994 # FILE_NAME(tmp, @1);
12000 def p_compressed_statement_11(p
):
12001 '''compressed_statement : lpvalue K_RSS_EQ expression '''
12003 print('compressed_statement_11', list(p
))
12005 # { PAssign *tmp = new PAssign(p[1], 'R', p[3]);
12006 # FILE_NAME(tmp, @1);
12012 def p_statement_or_null_list_opt_1(p
):
12013 '''statement_or_null_list_opt : statement_or_null_list '''
12015 print('statement_or_null_list_opt_1', list(p
))
12022 def p_statement_or_null_list_opt_2(p
):
12023 '''statement_or_null_list_opt : '''
12025 print('statement_or_null_list_opt_2', list(p
))
12031 def p_statement_or_null_list_1(p
):
12032 '''statement_or_null_list : statement_or_null_list statement_or_null '''
12034 print('statement_or_null_list_1', list(p
))
12036 # { vector<Statement*>*tmp = p[1];
12037 # if (p[2]) tmp->push_back(p[2]);
12043 def p_statement_or_null_list_2(p
):
12044 '''statement_or_null_list : statement_or_null '''
12046 print('statement_or_null_list_2', list(p
))
12048 # { vector<Statement*>*tmp = new vector<Statement*>(0);
12049 # if (p[1]) tmp->push_back(p[1]);
12055 def p_analog_statement_1(p
):
12056 '''analog_statement : branch_probe_expression K_CONTRIBUTE expression ';' '''
12058 print('analog_statement_1', list(p
))
12060 # { p[0] = pform_contribution_statement(@2, p[1], p[3]); }
12064 def p_task_item_1(p
):
12065 '''task_item : block_item_decl '''
12067 print('task_item_1', list(p
))
12069 # { p[0] = new vector<pform_tf_port_t>(0); }
12073 def p_task_item_2(p
):
12074 '''task_item : tf_port_declaration '''
12076 print('task_item_2', list(p
))
12083 def p_task_item_list_1(p
):
12084 '''task_item_list : task_item_list task_item '''
12086 print('task_item_list_1', list(p
))
12088 # { vector<pform_tf_port_t>*tmp = p[1];
12089 # size_t s1 = tmp->size();
12090 # tmp->resize(s1 + p[2]->size());
12091 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
12092 # tmp->at(s1 + idx) = p[2]->at(idx);
12099 def p_task_item_list_2(p
):
12100 '''task_item_list : task_item '''
12102 print('task_item_list_2', list(p
))
12109 def p_task_item_list_opt_1(p
):
12110 '''task_item_list_opt : task_item_list '''
12112 print('task_item_list_opt_1', list(p
))
12119 def p_task_item_list_opt_2(p
):
12120 '''task_item_list_opt : '''
12122 print('task_item_list_opt_2', list(p
))
12128 def p_tf_port_list_opt_1(p
):
12129 '''tf_port_list_opt : tf_port_list '''
12131 print('tf_port_list_opt_1', list(p
))
12138 def p_tf_port_list_opt_2(p
):
12139 '''tf_port_list_opt : '''
12141 print('tf_port_list_opt_2', list(p
))
12147 def p_udp_body_1(p
):
12148 '''udp_body : K_table udp_entry_list K_endtable '''
12150 print('udp_body_1', list(p
))
12152 # { lex_end_table();
12158 def p_udp_body_2(p
):
12159 '''udp_body : K_table K_endtable '''
12161 print('udp_body_2', list(p
))
12163 # { lex_end_table();
12164 # yyerror(@1, "error: Empty UDP table.");
12170 def p_udp_body_3(p
):
12171 '''udp_body : K_table error K_endtable '''
12173 print('udp_body_3', list(p
))
12175 # { lex_end_table();
12176 # yyerror(@2, "Errors in UDP table");
12183 def p_udp_entry_list_1(p
):
12184 '''udp_entry_list : udp_comb_entry_list '''
12186 print('udp_entry_list_1', list(p
))
12192 def p_udp_entry_list_2(p
):
12193 '''udp_entry_list : udp_sequ_entry_list '''
12195 print('udp_entry_list_2', list(p
))
12201 def p_udp_comb_entry_1(p
):
12202 '''udp_comb_entry : udp_input_list ':' udp_output_sym ';' '''
12204 print('udp_comb_entry_1', list(p
))
12206 # { char*tmp = new char[strlen(p[1])+3];
12207 # strcpy(tmp, p[1]);
12208 # char*tp = tmp+strlen(tmp);
12218 def p_udp_comb_entry_list_1(p
):
12219 '''udp_comb_entry_list : udp_comb_entry '''
12221 print('udp_comb_entry_list_1', list(p
))
12223 # { list<string>*tmp = new list<string>;
12224 # tmp->push_back(p[1]);
12231 def p_udp_comb_entry_list_2(p
):
12232 '''udp_comb_entry_list : udp_comb_entry_list udp_comb_entry '''
12234 print('udp_comb_entry_list_2', list(p
))
12236 # { list<string>*tmp = p[1];
12237 # tmp->push_back(p[2]);
12244 def p_udp_sequ_entry_list_1(p
):
12245 '''udp_sequ_entry_list : udp_sequ_entry '''
12247 print('udp_sequ_entry_list_1', list(p
))
12249 # { list<string>*tmp = new list<string>;
12250 # tmp->push_back(p[1]);
12257 def p_udp_sequ_entry_list_2(p
):
12258 '''udp_sequ_entry_list : udp_sequ_entry_list udp_sequ_entry '''
12260 print('udp_sequ_entry_list_2', list(p
))
12262 # { list<string>*tmp = p[1];
12263 # tmp->push_back(p[2]);
12270 def p_udp_sequ_entry_1(p
):
12271 '''udp_sequ_entry : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' '''
12273 print('udp_sequ_entry_1', list(p
))
12275 # { char*tmp = new char[strlen(p[1])+5];
12276 # strcpy(tmp, p[1]);
12277 # char*tp = tmp+strlen(tmp);
12288 def p_udp_initial_1(p
):
12289 '''udp_initial : K_initial IDENTIFIER '=' number ';' '''
12291 print('udp_initial_1', list(p
))
12293 # { PExpr*etmp = new PENumber(p[4]);
12294 # PEIdent*itmp = new PEIdent(lex_strings.make(p[2]));
12295 # PAssign*atmp = new PAssign(itmp, etmp);
12296 # FILE_NAME(atmp, @2);
12303 def p_udp_init_opt_1(p
):
12304 '''udp_init_opt : udp_initial '''
12306 print('udp_init_opt_1', list(p
))
12313 def p_udp_init_opt_2(p
):
12314 '''udp_init_opt : '''
12316 print('udp_init_opt_2', list(p
))
12322 def p_udp_input_list_1(p
):
12323 '''udp_input_list : udp_input_sym '''
12325 print('udp_input_list_1', list(p
))
12327 # { char*tmp = new char[2];
12335 def p_udp_input_list_2(p
):
12336 '''udp_input_list : udp_input_list udp_input_sym '''
12338 print('udp_input_list_2', list(p
))
12340 # { char*tmp = new char[strlen(p[1])+2];
12341 # strcpy(tmp, p[1]);
12342 # char*tp = tmp+strlen(tmp);
12351 def p_udp_input_sym_1(p
):
12352 '''udp_input_sym : '0' '''
12354 print('udp_input_sym_1', list(p
))
12360 def p_udp_input_sym_2(p
):
12361 '''udp_input_sym : '1' '''
12363 print('udp_input_sym_2', list(p
))
12369 def p_udp_input_sym_3(p
):
12370 '''udp_input_sym : 'x' '''
12372 print('udp_input_sym_3', list(p
))
12378 def p_udp_input_sym_4(p
):
12379 '''udp_input_sym : '?' '''
12381 print('udp_input_sym_4', list(p
))
12387 def p_udp_input_sym_5(p
):
12388 '''udp_input_sym : 'b' '''
12390 print('udp_input_sym_5', list(p
))
12396 def p_udp_input_sym_6(p
):
12397 '''udp_input_sym : '*' '''
12399 print('udp_input_sym_6', list(p
))
12405 def p_udp_input_sym_7(p
):
12406 '''udp_input_sym : '%' '''
12408 print('udp_input_sym_7', list(p
))
12414 def p_udp_input_sym_8(p
):
12415 '''udp_input_sym : 'f' '''
12417 print('udp_input_sym_8', list(p
))
12423 def p_udp_input_sym_9(p
):
12424 '''udp_input_sym : 'F' '''
12426 print('udp_input_sym_9', list(p
))
12432 def p_udp_input_sym_10(p
):
12433 '''udp_input_sym : 'l' '''
12435 print('udp_input_sym_10', list(p
))
12441 def p_udp_input_sym_11(p
):
12442 '''udp_input_sym : 'h' '''
12444 print('udp_input_sym_11', list(p
))
12450 def p_udp_input_sym_12(p
):
12451 '''udp_input_sym : 'B' '''
12453 print('udp_input_sym_12', list(p
))
12459 def p_udp_input_sym_13(p
):
12460 '''udp_input_sym : 'r' '''
12462 print('udp_input_sym_13', list(p
))
12468 def p_udp_input_sym_14(p
):
12469 '''udp_input_sym : 'R' '''
12471 print('udp_input_sym_14', list(p
))
12477 def p_udp_input_sym_15(p
):
12478 '''udp_input_sym : 'M' '''
12480 print('udp_input_sym_15', list(p
))
12486 def p_udp_input_sym_16(p
):
12487 '''udp_input_sym : 'n' '''
12489 print('udp_input_sym_16', list(p
))
12495 def p_udp_input_sym_17(p
):
12496 '''udp_input_sym : 'N' '''
12498 print('udp_input_sym_17', list(p
))
12504 def p_udp_input_sym_18(p
):
12505 '''udp_input_sym : 'p' '''
12507 print('udp_input_sym_18', list(p
))
12513 def p_udp_input_sym_19(p
):
12514 '''udp_input_sym : 'P' '''
12516 print('udp_input_sym_19', list(p
))
12522 def p_udp_input_sym_20(p
):
12523 '''udp_input_sym : 'Q' '''
12525 print('udp_input_sym_20', list(p
))
12531 def p_udp_input_sym_21(p
):
12532 '''udp_input_sym : 'q' '''
12534 print('udp_input_sym_21', list(p
))
12540 def p_udp_input_sym_22(p
):
12541 '''udp_input_sym : '_' '''
12543 print('udp_input_sym_22', list(p
))
12549 def p_udp_input_sym_23(p
):
12550 '''udp_input_sym : '+' '''
12552 print('udp_input_sym_23', list(p
))
12558 def p_udp_input_sym_24(p
):
12559 '''udp_input_sym : DEC_NUMBER '''
12561 print('udp_input_sym_24', list(p
))
12563 # { yyerror(@1, "internal error: Input digits parse as decimal number!"); p[0] = '0'; }
12567 def p_udp_output_sym_1(p
):
12568 '''udp_output_sym : '0' '''
12570 print('udp_output_sym_1', list(p
))
12576 def p_udp_output_sym_2(p
):
12577 '''udp_output_sym : '1' '''
12579 print('udp_output_sym_2', list(p
))
12585 def p_udp_output_sym_3(p
):
12586 '''udp_output_sym : 'x' '''
12588 print('udp_output_sym_3', list(p
))
12594 def p_udp_output_sym_4(p
):
12595 '''udp_output_sym : '-' '''
12597 print('udp_output_sym_4', list(p
))
12603 def p_udp_output_sym_5(p
):
12604 '''udp_output_sym : DEC_NUMBER '''
12606 print('udp_output_sym_5', list(p
))
12608 # { yyerror(@1, "internal error: Output digits parse as decimal number!"); p[0] = '0'; }
12612 def p_udp_port_decl_1(p
):
12613 '''udp_port_decl : K_input list_of_identifiers ';' '''
12615 print('udp_port_decl_1', list(p
))
12617 # { p[0] = pform_make_udp_input_ports(p[2]); }
12621 def p_udp_port_decl_2(p
):
12622 '''udp_port_decl : K_output IDENTIFIER ';' '''
12624 print('udp_port_decl_2', list(p
))
12626 # { perm_string pname = lex_strings.make(p[2]);
12627 # PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
12628 # vector<PWire*>*tmp = new vector<PWire*>(1);
12636 def p_udp_port_decl_3(p
):
12637 '''udp_port_decl : K_reg IDENTIFIER ';' '''
12639 print('udp_port_decl_3', list(p
))
12641 # { perm_string pname = lex_strings.make(p[2]);
12642 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
12643 # vector<PWire*>*tmp = new vector<PWire*>(1);
12651 def p_udp_port_decl_4(p
):
12652 '''udp_port_decl : K_reg K_output IDENTIFIER ';' '''
12654 print('udp_port_decl_4', list(p
))
12656 # { perm_string pname = lex_strings.make(p[3]);
12657 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
12658 # vector<PWire*>*tmp = new vector<PWire*>(1);
12666 def p_udp_port_decls_1(p
):
12667 '''udp_port_decls : udp_port_decl '''
12669 print('udp_port_decls_1', list(p
))
12676 def p_udp_port_decls_2(p
):
12677 '''udp_port_decls : udp_port_decls udp_port_decl '''
12679 print('udp_port_decls_2', list(p
))
12681 # { vector<PWire*>*tmp = p[1];
12682 # size_t s1 = p[1]->size();
12683 # tmp->resize(s1+p[2]->size());
12684 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
12685 # tmp->at(s1+idx) = p[2]->at(idx);
12692 def p_udp_port_list_1(p
):
12693 '''udp_port_list : IDENTIFIER '''
12695 print('udp_port_list_1', list(p
))
12697 # { list<perm_string>*tmp = new list<perm_string>;
12698 # tmp->push_back(lex_strings.make(p[1]));
12705 def p_udp_port_list_2(p
):
12706 '''udp_port_list : udp_port_list ',' IDENTIFIER '''
12708 print('udp_port_list_2', list(p
))
12710 # { list<perm_string>*tmp = p[1];
12711 # tmp->push_back(lex_strings.make(p[3]));
12718 def p_udp_reg_opt_1(p
):
12719 '''udp_reg_opt : K_reg '''
12721 print('udp_reg_opt_1', list(p
))
12728 def p_udp_reg_opt_2(p
):
12729 '''udp_reg_opt : '''
12731 print('udp_reg_opt_2', list(p
))
12738 def p_udp_initial_expr_opt_1(p
):
12739 '''udp_initial_expr_opt : '=' expression '''
12741 print('udp_initial_expr_opt_1', list(p
))
12748 def p_udp_initial_expr_opt_2(p
):
12749 '''udp_initial_expr_opt : '''
12751 print('udp_initial_expr_opt_2', list(p
))
12757 def p_udp_input_declaration_list_1(p
):
12758 '''udp_input_declaration_list : K_input IDENTIFIER '''
12760 print('udp_input_declaration_list_1', list(p
))
12762 # { list<perm_string>*tmp = new list<perm_string>;
12763 # tmp->push_back(lex_strings.make(p[2]));
12770 def p_udp_input_declaration_list_2(p
):
12771 '''udp_input_declaration_list : udp_input_declaration_list ',' K_input IDENTIFIER '''
12773 print('udp_input_declaration_list_2', list(p
))
12775 # { list<perm_string>*tmp = p[1];
12776 # tmp->push_back(lex_strings.make(p[4]));
12783 def p_udp_primitive_1(p
):
12784 '''udp_primitive : K_primitive IDENTIFIER '(' udp_port_list ')' ';' udp_port_decls udp_init_opt udp_body K_endprimitive endlabel_opt '''
12786 print('udp_primitive_1', list(p
))
12788 # { perm_string tmp2 = lex_strings.make(p[2]);
12789 # pform_make_udp(tmp2, p[4], p[7], p[9], p[8],
12790 # @2.text, @2.first_line);
12792 # if (strcmp(p[2],p[11]) != 0) {
12793 # yyerror(@11, "error: End label doesn't match "
12794 # "primitive name");
12796 # if (! gn_system_verilog()) {
12797 # yyerror(@11, "error: Primitive end labels "
12798 # "require SystemVerilog.");
12807 def p_udp_primitive_2(p
):
12808 '''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 '''
12810 print('udp_primitive_2', list(p
))
12812 # { perm_string tmp2 = lex_strings.make(p[2]);
12813 # perm_string tmp6 = lex_strings.make(p[6]);
12814 # pform_make_udp(tmp2, p[5], tmp6, p[7], p[9], p[12],
12815 # @2.text, @2.first_line);
12817 # if (strcmp(p[2],p[14]) != 0) {
12818 # yyerror(@14, "error: End label doesn't match "
12819 # "primitive name");
12821 # if (! gn_system_verilog()) {
12822 # yyerror(@14, "error: Primitive end labels "
12823 # "require SystemVerilog.");
12833 def p_K_packed_opt_1(p
):
12834 '''K_packed_opt : K_packed '''
12836 print('K_packed_opt', list(p
))
12843 def p_K_packed_opt_2(p
):
12844 '''K_packed_opt : '''
12846 print('K_packed_opt', list(p
))
12853 def p_K_reg_opt_1(p
):
12854 '''K_reg_opt : K_reg '''
12856 print('K_reg_opt', list(p
))
12863 def p_K_reg_opt_2(p
):
12866 print('K_reg_opt', list(p
))
12873 def p_K_static_opt_1(p
):
12874 '''K_static_opt : K_static '''
12876 print('K_static_opt', list(p
))
12883 def p_K_static_opt_2(p
):
12884 '''K_static_opt : '''
12886 print('K_static_opt', list(p
))
12893 def p_K_virtual_opt_1(p
):
12894 '''K_virtual_opt : K_virtual '''
12903 def p_K_virtual_opt_2(p
):
12904 '''K_virtual_opt : '''