3 # * Copyright (c) 1998-2017 Stephen Williams (steve@icarus.com)
4 # * Copyright CERN 2012-2013 / Stephen Williams (steve@icarus.com)
6 # * This source code is free software; you can redistribute it
7 # * and/or modify it in source code form under the terms of the GNU
8 # * General Public License as published by the Free Software
9 # * Foundation; either version 2 of the License, or (at your option)
10 # * any later version.
12 # * This program is distributed in the hope that it will be useful,
13 # * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # * GNU General Public License for more details.
17 # * You should have received a copy of the GNU General Public License
18 # * along with this program; if not, write to the Free Software
19 # * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 from ply
import yacc
, lex
24 from lib2to3
.pytree
import Node
, Leaf
25 from lib2to3
.pgen2
import token
26 from lib2to3
.pygram
import python_symbols
as syms
33 #from parse_tokens import tokens
34 tokens
= lexor
.tokens
# list(set(lexor.tokens).union(set(tokens)))
35 literals
= lexor
.literals
38 ('right', 'K_PLUS_EQ', 'K_MINUS_EQ', 'K_MUL_EQ', 'K_DIV_EQ',
39 'K_MOD_EQ', 'K_AND_EQ', 'K_OR_EQ'),
40 ('right', 'K_XOR_EQ', 'K_LS_EQ', 'K_RS_EQ', 'K_RSS_EQ'),
41 ('right', '?', ':', 'K_inside'),
45 ('left', '^', 'K_NXOR', 'K_NOR'),
46 ('left', '&', 'K_NAND'),
47 ('left', 'K_EQ', 'K_NE', 'K_CEQ', 'K_CNE', 'K_WEQ', 'K_WNE'),
48 ('left', 'K_GE', 'K_LE', '<', '>'),
49 ('left', 'K_LS', 'K_RS', 'K_RSS'),
51 ('left', '*', '/', '%'),
53 ('left', 'UNARY_PREC'),
54 ('nonassoc', 'less_than_K_else'),
55 ('nonassoc', 'K_else'),
57 ('nonassoc', 'K_exclude'),
58 ('nonassoc', 'no_timeunits_declaration'),
59 ('nonassoc', 'one_timeunits_declaration'),
60 ('nonassoc', 'K_timeunit', 'K_timeprecision')
64 IVL_VT_NO_TYPE
= 'VT_NO_TYPE'
65 IVL_VT_BOOL
= 'VT_BOOL'
66 IVL_VT_LOGIC
= 'VT_LOGIC'
68 IVL_VT_VOID = 0, /* Not used */
69 IVL_VT_NO_TYPE = 1, /* Place holder for missing/unknown type. */
74 IVL_VT_DARRAY = 6, /* Array (esp. dynamic array) */
75 IVL_VT_CLASS = 7, /* SystemVerilog class instances */
76 IVL_VT_QUEUE = 8, /* SystemVerilog queue instances */
77 IVL_VT_VECTOR = IVL_VT_LOGIC /* For compatibility */
81 NN_IMPLICIT
= 'IMPLICIT'
82 NN_IMPLICIT_REG
= 'IMPLICIT_REG'
83 NN_INTEGER
= 'INTEGER'
87 NN_SUPPLY0
= 'SUPPLY0'
88 NN_SUPPLY1
= 'SUPPLY1'
95 NN_UNRESOLVED_WIRE
= 'UNRESOLVED_WIRE'
97 NP_NOT_A_PORT
= 'NOT_A_PORT'
98 NP_PIMPLICIT
= 'PIMPLICIT'
100 NP_POUTPUT
= 'POUTPUT'
106 def __init__(self
, typ
, signed
):
111 # -------------- RULES ----------------
115 def p_source_text_1(p
):
116 '''source_text : timeunits_declaration_opt _embed0_source_text description_list '''
118 print('source_text', list(p
))
124 def p_source_text_2(p
):
127 print('source_text', list(p
))
133 def p__embed0_source_text(p
):
134 '''_embed0_source_text : '''
136 # { pform_set_scope_timescale(yyloc); }
140 def p_assertion_item_1(p
):
141 '''assertion_item : concurrent_assertion_item '''
143 print('assertion_item_1', list(p
))
149 def p_assignment_pattern_1(p
):
150 '''assignment_pattern : K_LP expression_list_proper '}' '''
152 print('assignment_pattern_1', list(p
))
154 # { PEAssignPattern*tmp = new PEAssignPattern(*p[2]);
155 # FILE_NAME(tmp, @1);
162 def p_assignment_pattern_2(p
):
163 '''assignment_pattern : K_LP '}' '''
165 print('assignment_pattern_2', list(p
))
167 # { PEAssignPattern*tmp = new PEAssignPattern;
168 # FILE_NAME(tmp, @1);
174 def p_block_identifier_opt_1(p
):
175 '''block_identifier_opt : IDENTIFIER ':' '''
177 print('block_identifier_opt_1', list(p
))
183 def p_block_identifier_opt_2(p
):
184 '''block_identifier_opt : '''
186 print('block_identifier_opt_2', list(p
))
192 def p_class_declaration_1(p
):
193 '''class_declaration : K_virtual_opt K_class lifetime_opt class_identifier class_declaration_extends_opt ';' _embed0_class_declaration class_items_opt K_endclass _embed1_class_declaration class_declaration_endlabel_opt '''
195 print('class_declaration_1', list(p
))
197 # { // Wrap up the class.
198 # if (p[11] && p[4] && p[4]->name != p[11]) {
199 # yyerror(@11, "error: Class end label doesn't match class name.");
206 def p__embed0_class_declaration(p
):
207 '''_embed0_class_declaration : '''
209 # { pform_start_class_declaration(@2, p[4], p[5].type, p[5].exprs, p[3]); }
213 def p__embed1_class_declaration(p
):
214 '''_embed1_class_declaration : '''
216 # { // Process a class.
217 # pform_end_class_declaration(@9);
222 def p_class_constraint_1(p
):
223 '''class_constraint : constraint_prototype '''
225 print('class_constraint_1', list(p
))
231 def p_class_constraint_2(p
):
232 '''class_constraint : constraint_declaration '''
234 print('class_constraint_2', list(p
))
240 def p_class_identifier_1(p
):
241 '''class_identifier : IDENTIFIER '''
243 print('class_identifier_1', list(p
))
245 # { // Create a synthetic typedef for the class name so that the
246 # // lexor detects the name as a type.
247 # perm_string name = lex_strings.make(p[1]);
248 # class_type_t*tmp = new class_type_t(name);
249 # FILE_NAME(tmp, @1);
250 # pform_set_typedef(name, tmp, NULL);
257 def p_class_identifier_2(p
):
258 '''class_identifier : TYPE_IDENTIFIER '''
260 print('class_identifier_2', list(p
))
262 # { class_type_t*tmp = dynamic_cast<class_type_t*>(p[1].type);
264 # yyerror(@1, "Type name \"%s\"is not a predeclared class name.", p[1].text);
272 def p_class_declaration_endlabel_opt_1(p
):
273 '''class_declaration_endlabel_opt : ':' TYPE_IDENTIFIER '''
275 print('class_declaration_endlabel_opt_1', list(p
))
277 # { class_type_t*tmp = dynamic_cast<class_type_t*> (p[2].type);
279 # yyerror(@2, "error: class declaration endlabel \"%s\" is not a class name\n", p[2].text);
282 # p[0] = strdupnew(tmp->name.str());
289 def p_class_declaration_endlabel_opt_2(p
):
290 '''class_declaration_endlabel_opt : ':' IDENTIFIER '''
292 print('class_declaration_endlabel_opt_2', list(p
))
299 def p_class_declaration_endlabel_opt_3(p
):
300 '''class_declaration_endlabel_opt : '''
302 print('class_declaration_endlabel_opt_3', list(p
))
308 def p_class_declaration_extends_opt_1(p
):
309 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '''
311 print('class_declaration_extends_opt_1', list(p
))
313 # { p[0].type = p[2].type;
320 def p_class_declaration_extends_opt_2(p
):
321 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '(' expression_list_with_nuls ')' '''
323 print('class_declaration_extends_opt_2', list(p
))
325 # { p[0].type = p[2].type;
332 def p_class_declaration_extends_opt_3(p
):
333 '''class_declaration_extends_opt : '''
335 print('class_declaration_extends_opt_3', list(p
))
337 # { p[0].type = 0; p[0].exprs = 0; }
341 def p_class_items_opt_1(p
):
342 '''class_items_opt : class_items '''
344 print('class_items_opt_1', list(p
))
350 def p_class_items_opt_2(p
):
351 '''class_items_opt : '''
353 print('class_items_opt_2', list(p
))
359 def p_class_items_1(p
):
360 '''class_items : class_items class_item '''
362 print('class_items_1', list(p
))
368 def p_class_items_2(p
):
369 '''class_items : class_item '''
371 print('class_items_2', list(p
))
377 def p_class_item_1(p
):
378 '''class_item : method_qualifier_opt K_function K_new _embed0_class_item '(' tf_port_list_opt ')' ';' function_item_list_opt statement_or_null_list_opt K_endfunction endnew_opt '''
380 print('class_item_1', list(p
))
382 # { current_function->set_ports(p[6]);
383 # pform_set_constructor_return(current_function);
384 # pform_set_this_class(@3, current_function);
385 # current_function_set_statement(@3, p[10]);
387 # current_function = 0;
392 def p_class_item_2(p
):
393 '''class_item : property_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
395 print('class_item_2', list(p
))
397 # { pform_class_property(@2, p[1], p[2], p[3]); }
401 def p_class_item_3(p
):
402 '''class_item : K_const class_item_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
404 print('class_item_3', list(p
))
406 # { pform_class_property(@1, p[2] | property_qualifier_t::make_const(), p[3], p[4]); }
410 def p_class_item_4(p
):
411 '''class_item : method_qualifier_opt task_declaration '''
413 print('class_item_4', list(p
))
415 # { /* The task_declaration rule puts this into the class */ }
419 def p_class_item_5(p
):
420 '''class_item : method_qualifier_opt function_declaration '''
422 print('class_item_5', list(p
))
424 # { /* The function_declaration rule puts this into the class */ }
428 def p_class_item_6(p
):
429 '''class_item : K_extern method_qualifier_opt K_function K_new ';' '''
431 print('class_item_6', list(p
))
433 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
437 def p_class_item_7(p
):
438 '''class_item : K_extern method_qualifier_opt K_function K_new '(' tf_port_list_opt ')' ';' '''
440 print('class_item_7', list(p
))
442 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
446 def p_class_item_8(p
):
447 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER ';' '''
449 print('class_item_8', list(p
))
451 # { yyerror(@1, "sorry: External methods are not yet supported.");
457 def p_class_item_9(p
):
458 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' ';' '''
460 print('class_item_9', list(p
))
462 # { yyerror(@1, "sorry: External methods are not yet supported.");
468 def p_class_item_10(p
):
469 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER ';' '''
471 print('class_item_10', list(p
))
473 # { yyerror(@1, "sorry: External methods are not yet supported.");
479 def p_class_item_11(p
):
480 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER '(' tf_port_list_opt ')' ';' '''
482 print('class_item_11', list(p
))
484 # { yyerror(@1, "sorry: External methods are not yet supported.");
490 def p_class_item_12(p
):
491 '''class_item : class_constraint '''
493 print('class_item_12', list(p
))
499 def p_class_item_13(p
):
500 '''class_item : property_qualifier_opt data_type error ';' '''
502 print('class_item_13', list(p
))
504 # { yyerror(@3, "error: Errors in variable names after data type.");
510 def p_class_item_14(p
):
511 '''class_item : property_qualifier_opt IDENTIFIER error ';' '''
513 print('class_item_14', list(p
))
515 # { yyerror(@3, "error: %s doesn't name a type.", p[2]);
521 def p_class_item_15(p
):
522 '''class_item : method_qualifier_opt K_function K_new error K_endfunction endnew_opt '''
524 print('class_item_15', list(p
))
526 # { yyerror(@1, "error: I give up on this class constructor declaration.");
532 def p_class_item_16(p
):
533 '''class_item : error ';' '''
535 print('class_item_16', list(p
))
537 # { yyerror(@2, "error: invalid class item.");
543 def p__embed0_class_item(p
):
544 '''_embed0_class_item : '''
546 # { assert(current_function==0);
547 # current_function = pform_push_constructor_scope(@3);
552 def p_class_item_qualifier_1(p
):
553 '''class_item_qualifier : K_static '''
555 print('class_item_qualifier_1', list(p
))
557 # { p[0] = property_qualifier_t::make_static(); }
561 def p_class_item_qualifier_2(p
):
562 '''class_item_qualifier : K_protected '''
564 print('class_item_qualifier_2', list(p
))
566 # { p[0] = property_qualifier_t::make_protected(); }
570 def p_class_item_qualifier_3(p
):
571 '''class_item_qualifier : K_local '''
573 print('class_item_qualifier_3', list(p
))
575 # { p[0] = property_qualifier_t::make_local(); }
579 def p_class_item_qualifier_list_1(p
):
580 '''class_item_qualifier_list : class_item_qualifier_list class_item_qualifier '''
582 print('class_item_qualifier_list_1', list(p
))
584 # { p[0] = p[1] | p[2]; }
588 def p_class_item_qualifier_list_2(p
):
589 '''class_item_qualifier_list : class_item_qualifier '''
591 print('class_item_qualifier_list_2', list(p
))
598 def p_class_item_qualifier_opt_1(p
):
599 '''class_item_qualifier_opt : class_item_qualifier_list '''
601 print('class_item_qualifier_opt_1', list(p
))
608 def p_class_item_qualifier_opt_2(p
):
609 '''class_item_qualifier_opt : '''
611 print('class_item_qualifier_opt_2', list(p
))
613 # { p[0] = property_qualifier_t::make_none(); }
617 def p_class_new_1(p
):
618 '''class_new : K_new '(' expression_list_with_nuls ')' '''
620 print('class_new_1', list(p
))
622 # { list<PExpr*>*expr_list = p[3];
623 # strip_tail_items(expr_list);
624 # PENewClass*tmp = new PENewClass(*expr_list);
625 # FILE_NAME(tmp, @1);
632 def p_class_new_2(p
):
633 '''class_new : K_new hierarchy_identifier '''
635 print('class_new_2', list(p
))
637 # { PEIdent*tmpi = new PEIdent(*p[2]);
638 # FILE_NAME(tmpi, @2);
639 # PENewCopy*tmp = new PENewCopy(tmpi);
640 # FILE_NAME(tmp, @1);
647 def p_class_new_3(p
):
648 '''class_new : K_new '''
650 print('class_new_3', list(p
))
652 # { PENewClass*tmp = new PENewClass;
653 # FILE_NAME(tmp, @1);
659 def p_concurrent_assertion_item_1(p
):
660 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' property_spec ')' statement_or_null '''
662 print('concurrent_assertion_item_1', list(p
))
665 # if (gn_assertions_flag) {
666 # yyerror(@2, "sorry: concurrent_assertion_item not supported."
667 # " Try -gno-assertion to turn this message off.");
673 def p_concurrent_assertion_item_2(p
):
674 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' error ')' statement_or_null '''
676 print('concurrent_assertion_item_2', list(p
))
679 # yyerror(@2, "error: Error in property_spec of concurrent assertion item.");
684 def p_constraint_block_item_1(p
):
685 '''constraint_block_item : constraint_expression '''
687 print('constraint_block_item_1', list(p
))
693 def p_constraint_block_item_list_1(p
):
694 '''constraint_block_item_list : constraint_block_item_list constraint_block_item '''
696 print('constraint_block_item_list_1', list(p
))
702 def p_constraint_block_item_list_2(p
):
703 '''constraint_block_item_list : constraint_block_item '''
705 print('constraint_block_item_list_2', list(p
))
711 def p_constraint_block_item_list_opt_1(p
):
712 '''constraint_block_item_list_opt : '''
714 print('constraint_block_item_list_opt_1', list(p
))
720 def p_constraint_block_item_list_opt_2(p
):
721 '''constraint_block_item_list_opt : constraint_block_item_list '''
723 print('constraint_block_item_list_opt_2', list(p
))
729 def p_constraint_declaration_1(p
):
730 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' constraint_block_item_list_opt '}' '''
732 print('constraint_declaration_1', list(p
))
734 # { yyerror(@2, "sorry: Constraint declarations not supported."); }
738 def p_constraint_declaration_2(p
):
739 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' error '}' '''
741 print('constraint_declaration_2', list(p
))
743 # { yyerror(@4, "error: Errors in the constraint block item list."); }
747 def p_constraint_expression_1(p
):
748 '''constraint_expression : expression ';' '''
750 print('constraint_expression_1', list(p
))
756 def p_constraint_expression_2(p
):
757 '''constraint_expression : expression K_dist '{' '}' ';' '''
759 print('constraint_expression_2', list(p
))
765 def p_constraint_expression_3(p
):
766 '''constraint_expression : expression K_TRIGGER constraint_set '''
768 print('constraint_expression_3', list(p
))
774 def p_constraint_expression_4(p
):
775 '''constraint_expression : K_if '(' expression ')' constraint_set %prec less_than_K_else '''
777 print('constraint_expression_4', list(p
))
783 def p_constraint_expression_5(p
):
784 '''constraint_expression : K_if '(' expression ')' constraint_set K_else constraint_set '''
786 print('constraint_expression_5', list(p
))
792 def p_constraint_expression_6(p
):
793 '''constraint_expression : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' constraint_set '''
795 print('constraint_expression_6', list(p
))
801 def p_constraint_expression_list_1(p
):
802 '''constraint_expression_list : constraint_expression_list constraint_expression '''
804 print('constraint_expression_list_1', list(p
))
810 def p_constraint_expression_list_2(p
):
811 '''constraint_expression_list : constraint_expression '''
813 print('constraint_expression_list_2', list(p
))
819 def p_constraint_prototype_1(p
):
820 '''constraint_prototype : K_static_opt K_constraint IDENTIFIER ';' '''
822 print('constraint_prototype_1', list(p
))
824 # { yyerror(@2, "sorry: Constraint prototypes not supported."); }
828 def p_constraint_set_1(p
):
829 '''constraint_set : constraint_expression '''
831 print('constraint_set_1', list(p
))
837 def p_constraint_set_2(p
):
838 '''constraint_set : '{' constraint_expression_list '}' '''
840 print('constraint_set_2', list(p
))
846 def p_data_declaration_1(p
):
847 '''data_declaration : attribute_list_opt data_type_or_implicit list_of_variable_decl_assignments ';' '''
849 print('data_declaration_1', list(p
))
851 # { data_type_t*data_type = p[2];
852 # if (data_type == 0) {
853 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
854 # FILE_NAME(data_type, @2);
856 # pform_makewire(@2, 0, str_strength, p[3], NetNet::IMPLICIT_REG, data_type);
861 def p_data_type_1(p
):
862 '''data_type : integer_vector_type unsigned_signed_opt dimensions_opt '''
864 print('data_type_1', list(p
))
867 if (use_vtype
== IVL_VT_NO_TYPE
):
868 use_vtype
= IVL_VT_LOGIC
870 dt
= DataType(use_vtype
, signed
=p
[2])
872 dt
.reg_flag
= reg_flag
875 # { ivl_variable_type_t use_vtype = p[1];
876 # bool reg_flag = false;
877 # if (use_vtype == IVL_VT_NO_TYPE) {
878 # use_vtype = IVL_VT_LOGIC;
881 # vector_type_t*tmp = new vector_type_t(use_vtype, p[2], p[3]);
882 # tmp->reg_flag = reg_flag;
883 # FILE_NAME(tmp, @1);
889 def p_data_type_2(p
):
890 '''data_type : non_integer_type '''
892 print('data_type_2', list(p
))
895 # { real_type_t*tmp = new real_type_t(p[1]);
896 # FILE_NAME(tmp, @1);
902 def p_data_type_3(p
):
903 '''data_type : struct_data_type '''
905 print('data_type_3', list(p
))
908 # { if (!p[1]->packed_flag) {
909 # yyerror(@1, "sorry: Unpacked structs not supported.");
916 def p_data_type_4(p
):
917 '''data_type : enum_data_type '''
919 print('data_type_4', list(p
))
926 def p_data_type_5(p
):
927 '''data_type : atom2_type signed_unsigned_opt '''
929 print('data_type_5', list(p
))
931 # { atom2_type_t*tmp = new atom2_type_t(p[1], p[2]);
932 # FILE_NAME(tmp, @1);
938 def p_data_type_6(p
):
939 '''data_type : K_integer signed_unsigned_opt '''
941 print('data_type_6', list(p
))
943 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
944 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, p[2], pd);
945 # tmp->reg_flag = true;
946 # tmp->integer_flag = true;
952 def p_data_type_7(p
):
953 '''data_type : K_time '''
955 print('data_type_7', list(p
))
957 # { list<pform_range_t>*pd = make_range_from_width(64);
958 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
959 # tmp->reg_flag = !gn_system_verilog();
965 def p_data_type_8(p
):
966 '''data_type : TYPE_IDENTIFIER dimensions_opt '''
968 print('data_type_8', list(p
))
971 # parray_type_t*tmp = new parray_type_t(p[1].type, p[2]);
972 # FILE_NAME(tmp, @1);
974 # } else p[0] = p[1].type;
980 def p_data_type_9(p
):
981 '''data_type : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_data_type TYPE_IDENTIFIER '''
983 print('data_type_9', list(p
))
985 # { lex_in_package_scope(0);
992 def p_data_type_10(p
):
993 '''data_type : K_string '''
995 print('data_type_10', list(p
))
997 # { string_type_t*tmp = new string_type_t;
998 # FILE_NAME(tmp, @1);
1004 def p__embed0_data_type(p
):
1005 '''_embed0_data_type : '''
1007 # { lex_in_package_scope(p[1]); }
1011 def p_data_type_or_implicit_1(p
):
1012 '''data_type_or_implicit : data_type '''
1014 print('data_type_or_implicit_1', list(p
))
1021 def p_data_type_or_implicit_2(p
):
1022 '''data_type_or_implicit : signing dimensions_opt '''
1024 print('data_type_or_implicit_2', list(p
))
1026 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, p[1], p[2]);
1027 # tmp->implicit_flag = true;
1028 # FILE_NAME(tmp, @1);
1034 def p_data_type_or_implicit_3(p
):
1035 '''data_type_or_implicit : dimensions '''
1037 print('data_type_or_implicit_3', list(p
))
1039 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, p[1]);
1040 # tmp->implicit_flag = true;
1041 # FILE_NAME(tmp, @1);
1047 def p_data_type_or_implicit_4(p
):
1048 '''data_type_or_implicit : '''
1049 if(parse_debug
> 2):
1050 print('data_type_or_implicit_4', list(p
))
1056 def p_data_type_or_implicit_or_void_1(p
):
1057 '''data_type_or_implicit_or_void : data_type_or_implicit '''
1059 print('data_type_or_implicit_or_void_1', list(p
))
1066 def p_data_type_or_implicit_or_void_2(p
):
1067 '''data_type_or_implicit_or_void : K_void '''
1069 print('data_type_or_implicit_or_void_2', list(p
))
1071 # { void_type_t*tmp = new void_type_t;
1072 # FILE_NAME(tmp, @1);
1078 def p_description_1(p
):
1079 '''description : module '''
1080 if(parse_debug
> 2):
1081 print('description_1', list(p
))
1087 def p_description_2(p
):
1088 '''description : udp_primitive '''
1090 print('description_2', list(p
))
1096 def p_description_3(p
):
1097 '''description : config_declaration '''
1099 print('description_3', list(p
))
1105 def p_description_4(p
):
1106 '''description : nature_declaration '''
1108 print('description_4', list(p
))
1114 def p_description_5(p
):
1115 '''description : package_declaration '''
1117 print('description_5', list(p
))
1123 def p_description_6(p
):
1124 '''description : discipline_declaration '''
1126 print('description_6', list(p
))
1132 def p_description_7(p
):
1133 '''description : package_item '''
1135 print('description_7', list(p
))
1141 def p_description_8(p
):
1142 '''description : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' '''
1144 print('description_8', list(p
))
1146 # { perm_string tmp3 = lex_strings.make(p[3]);
1147 # pform_set_type_attrib(tmp3, p[5], p[7]);
1154 def p_description_list_1(p
):
1155 '''description_list : description '''
1156 if(parse_debug
> 2):
1157 print('description_list_1', list(p
))
1163 def p_description_list_2(p
):
1164 '''description_list : description_list description '''
1166 print('description_list_2', list(p
))
1172 def p_endnew_opt_1(p
):
1173 '''endnew_opt : ':' K_new '''
1175 print('endnew_opt_1', list(p
))
1181 def p_endnew_opt_2(p
):
1184 print('endnew_opt_2', list(p
))
1190 def p_dynamic_array_new_1(p
):
1191 '''dynamic_array_new : K_new '[' expression ']' '''
1193 print('dynamic_array_new_1', list(p
))
1195 # { p[0] = new PENewArray(p[3], 0);
1196 # FILE_NAME(p[0], @1);
1201 def p_dynamic_array_new_2(p
):
1202 '''dynamic_array_new : K_new '[' expression ']' '(' expression ')' '''
1204 print('dynamic_array_new_2', list(p
))
1206 # { p[0] = new PENewArray(p[3], p[6]);
1207 # FILE_NAME(p[0], @1);
1212 def p_for_step_1(p
):
1213 '''for_step : lpvalue '=' expression '''
1215 print('for_step_1', list(p
))
1217 # { PAssign*tmp = new PAssign(p[1],p[3]);
1218 # FILE_NAME(tmp, @1);
1224 def p_for_step_2(p
):
1225 '''for_step : inc_or_dec_expression '''
1227 print('for_step_2', list(p
))
1229 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
1233 def p_for_step_3(p
):
1234 '''for_step : compressed_statement '''
1236 print('for_step_3', list(p
))
1243 def p_function_declaration_1(p
):
1244 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER ';' _embed0_function_declaration function_item_list statement_or_null_list_opt K_endfunction _embed1_function_declaration endlabel_opt '''
1246 print('function_declaration_1', list(p
))
1248 # { // Last step: check any closing name.
1250 # if (strcmp(p[4],p[11]) != 0) {
1251 # yyerror(@11, "error: End label doesn't match "
1254 # if (! gn_system_verilog()) {
1255 # yyerror(@11, "error: Function end labels require "
1256 # "SystemVerilog.");
1265 def p_function_declaration_2(p
):
1266 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER _embed2_function_declaration '(' tf_port_list_opt ')' ';' block_item_decls_opt statement_or_null_list_opt K_endfunction _embed3_function_declaration endlabel_opt '''
1268 print('function_declaration_2', list(p
))
1270 # { // Last step: check any closing name.
1272 # if (strcmp(p[4],p[14]) != 0) {
1273 # yyerror(@14, "error: End label doesn't match "
1276 # if (! gn_system_verilog()) {
1277 # yyerror(@14, "error: Function end labels require "
1278 # "SystemVerilog.");
1287 def p_function_declaration_3(p
):
1288 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER error K_endfunction _embed4_function_declaration endlabel_opt '''
1290 print('function_declaration_3', list(p
))
1292 # { // Last step: check any closing name.
1294 # if (strcmp(p[4],p[8]) != 0) {
1295 # yyerror(@8, "error: End label doesn't match function name");
1297 # if (! gn_system_verilog()) {
1298 # yyerror(@8, "error: Function end labels require "
1299 # "SystemVerilog.");
1308 def p__embed0_function_declaration(p
):
1309 '''_embed0_function_declaration : '''
1311 # { assert(current_function == 0);
1312 # current_function = pform_push_function_scope(@1, p[4], p[2]);
1317 def p__embed1_function_declaration(p
):
1318 '''_embed1_function_declaration : '''
1320 # { current_function->set_ports(p[7]);
1321 # current_function->set_return(p[3]);
1322 # current_function_set_statement(p[8]? @8 : @4, p[8]);
1323 # pform_set_this_class(@4, current_function);
1324 # pform_pop_scope();
1325 # current_function = 0;
1330 def p__embed2_function_declaration(p
):
1331 '''_embed2_function_declaration : '''
1333 # { assert(current_function == 0);
1334 # current_function = pform_push_function_scope(@1, p[4], p[2]);
1339 def p__embed3_function_declaration(p
):
1340 '''_embed3_function_declaration : '''
1342 # { current_function->set_ports(p[7]);
1343 # current_function->set_return(p[3]);
1344 # current_function_set_statement(p[11]? @11 : @4, p[11]);
1345 # pform_set_this_class(@4, current_function);
1346 # pform_pop_scope();
1347 # current_function = 0;
1348 # if (p[7]==0 && !gn_system_verilog()) {
1349 # yyerror(@4, "error: Empty parenthesis syntax requires SystemVerilog.");
1355 def p__embed4_function_declaration(p
):
1356 '''_embed4_function_declaration : '''
1359 # if (current_function) {
1360 # pform_pop_scope();
1361 # current_function = 0;
1363 # assert(current_function == 0);
1364 # yyerror(@1, "error: Syntax error defining function.");
1370 def p_import_export_1(p
):
1371 '''import_export : K_import '''
1373 print('import_export_1', list(p
))
1380 def p_import_export_2(p
):
1381 '''import_export : K_export '''
1383 print('import_export_2', list(p
))
1390 def p_implicit_class_handle_1(p
):
1391 '''implicit_class_handle : K_this '''
1393 print('implicit_class_handle_1', list(p
))
1395 # { p[0] = pform_create_this(); }
1399 def p_implicit_class_handle_2(p
):
1400 '''implicit_class_handle : K_super '''
1402 print('implicit_class_handle_2', list(p
))
1404 # { p[0] = pform_create_super(); }
1408 def p_inc_or_dec_expression_1(p
):
1409 '''inc_or_dec_expression : K_INCR lpvalue %prec UNARY_PREC '''
1411 print('inc_or_dec_expression_1', list(p
))
1413 # { PEUnary*tmp = new PEUnary('I', p[2]);
1414 # FILE_NAME(tmp, @2);
1420 def p_inc_or_dec_expression_2(p
):
1421 '''inc_or_dec_expression : lpvalue K_INCR %prec UNARY_PREC '''
1423 print('inc_or_dec_expression_2', list(p
))
1425 # { PEUnary*tmp = new PEUnary('i', p[1]);
1426 # FILE_NAME(tmp, @1);
1432 def p_inc_or_dec_expression_3(p
):
1433 '''inc_or_dec_expression : K_DECR lpvalue %prec UNARY_PREC '''
1435 print('inc_or_dec_expression_3', list(p
))
1437 # { PEUnary*tmp = new PEUnary('D', p[2]);
1438 # FILE_NAME(tmp, @2);
1444 def p_inc_or_dec_expression_4(p
):
1445 '''inc_or_dec_expression : lpvalue K_DECR %prec UNARY_PREC '''
1447 print('inc_or_dec_expression_4', list(p
))
1449 # { PEUnary*tmp = new PEUnary('d', p[1]);
1450 # FILE_NAME(tmp, @1);
1456 def p_inside_expression_1(p
):
1457 '''inside_expression : expression K_inside '{' open_range_list '}' '''
1459 print('inside_expression_1', list(p
))
1461 # { yyerror(@2, "sorry: \"inside\" expressions not supported yet.");
1467 def p_integer_vector_type_1(p
):
1468 '''integer_vector_type : K_reg '''
1470 print('integer_vector_type_1', list(p
))
1471 p
[0] = IVL_VT_NO_TYPE
1477 def p_integer_vector_type_2(p
):
1478 '''integer_vector_type : K_bit '''
1480 print('integer_vector_type_2', list(p
))
1487 def p_integer_vector_type_3(p
):
1488 '''integer_vector_type : K_logic '''
1490 print('integer_vector_type_3', list(p
))
1497 def p_integer_vector_type_4(p
):
1498 '''integer_vector_type : K_bool '''
1500 print('integer_vector_type_4', list(p
))
1502 # { p[0] = IVL_VT_BOOL; }
1506 def p_join_keyword_1(p
):
1507 '''join_keyword : K_join '''
1509 print('join_keyword_1', list(p
))
1511 # { p[0] = PBlock::BL_PAR; }
1515 def p_join_keyword_2(p
):
1516 '''join_keyword : K_join_none '''
1518 print('join_keyword_2', list(p
))
1520 # { p[0] = PBlock::BL_JOIN_NONE; }
1524 def p_join_keyword_3(p
):
1525 '''join_keyword : K_join_any '''
1527 print('join_keyword_3', list(p
))
1529 # { p[0] = PBlock::BL_JOIN_ANY; }
1533 def p_jump_statement_1(p
):
1534 '''jump_statement : K_break ';' '''
1536 print('jump_statement_1', list(p
))
1538 # { yyerror(@1, "sorry: break statements not supported.");
1544 def p_jump_statement_2(p
):
1545 '''jump_statement : K_return ';' '''
1547 print('jump_statement_2', list(p
))
1549 # { PReturn*tmp = new PReturn(0);
1550 # FILE_NAME(tmp, @1);
1556 def p_jump_statement_3(p
):
1557 '''jump_statement : K_return expression ';' '''
1559 print('jump_statement_3', list(p
))
1561 # { PReturn*tmp = new PReturn(p[2]);
1562 # FILE_NAME(tmp, @1);
1568 def p_lifetime_1(p
):
1569 '''lifetime : K_automatic '''
1571 print('lifetime_1', list(p
))
1573 # { p[0] = LexicalScope::AUTOMATIC; }
1577 def p_lifetime_2(p
):
1578 '''lifetime : K_static '''
1580 print('lifetime_2', list(p
))
1582 # { p[0] = LexicalScope::STATIC; }
1586 def p_lifetime_opt_1(p
):
1587 '''lifetime_opt : lifetime '''
1589 print('lifetime_opt_1', list(p
))
1596 def p_lifetime_opt_2(p
):
1597 '''lifetime_opt : '''
1598 if(parse_debug
> 2):
1599 print('lifetime_opt_2', list(p
))
1601 # { p[0] = LexicalScope::INHERITED; }
1605 def p_loop_statement_1(p
):
1606 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' for_step ')' statement_or_null '''
1608 print('loop_statement_1', list(p
))
1610 # { PForStatement*tmp = new PForStatement(p[3], p[5], p[7], p[9], p[11]);
1611 # FILE_NAME(tmp, @1);
1617 def p_loop_statement_2(p
):
1618 '''loop_statement : K_for '(' data_type IDENTIFIER '=' expression ';' expression ';' for_step ')' _embed0_loop_statement statement_or_null '''
1620 print('loop_statement_2', list(p
))
1622 # { pform_name_t tmp_hident;
1623 # tmp_hident.push_back(name_component_t(lex_strings.make(p[4])));
1625 # PEIdent*tmp_ident = pform_new_ident(tmp_hident);
1626 # FILE_NAME(tmp_ident, @4);
1628 # PForStatement*tmp_for = new PForStatement(tmp_ident, p[6], p[8], p[10], p[13]);
1629 # FILE_NAME(tmp_for, @1);
1631 # pform_pop_scope();
1632 # vector<Statement*>tmp_for_list (1);
1633 # tmp_for_list[0] = tmp_for;
1634 # PBlock*tmp_blk = current_block_stack.top();
1635 # current_block_stack.pop();
1636 # tmp_blk->set_statement(tmp_for_list);
1643 def p_loop_statement_3(p
):
1644 '''loop_statement : K_forever statement_or_null '''
1646 print('loop_statement_3', list(p
))
1648 # { PForever*tmp = new PForever(p[2]);
1649 # FILE_NAME(tmp, @1);
1655 def p_loop_statement_4(p
):
1656 '''loop_statement : K_repeat '(' expression ')' statement_or_null '''
1658 print('loop_statement_4', list(p
))
1660 # { PRepeat*tmp = new PRepeat(p[3], p[5]);
1661 # FILE_NAME(tmp, @1);
1667 def p_loop_statement_5(p
):
1668 '''loop_statement : K_while '(' expression ')' statement_or_null '''
1670 print('loop_statement_5', list(p
))
1672 # { PWhile*tmp = new PWhile(p[3], p[5]);
1673 # FILE_NAME(tmp, @1);
1679 def p_loop_statement_6(p
):
1680 '''loop_statement : K_do statement_or_null K_while '(' expression ')' ';' '''
1682 print('loop_statement_6', list(p
))
1684 # { PDoWhile*tmp = new PDoWhile(p[5], p[2]);
1685 # FILE_NAME(tmp, @1);
1691 def p_loop_statement_7(p
):
1692 '''loop_statement : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' _embed1_loop_statement statement_or_null '''
1694 print('loop_statement_7', list(p
))
1696 # { PForeach*tmp_for = pform_make_foreach(@1, p[3], p[5], p[9]);
1698 # pform_pop_scope();
1699 # vector<Statement*>tmp_for_list(1);
1700 # tmp_for_list[0] = tmp_for;
1701 # PBlock*tmp_blk = current_block_stack.top();
1702 # current_block_stack.pop();
1703 # tmp_blk->set_statement(tmp_for_list);
1709 def p_loop_statement_8(p
):
1710 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' error ')' statement_or_null '''
1712 print('loop_statement_8', list(p
))
1715 # yyerror(@1, "error: Error in for loop step assignment.");
1720 def p_loop_statement_9(p
):
1721 '''loop_statement : K_for '(' lpvalue '=' expression ';' error ';' for_step ')' statement_or_null '''
1723 print('loop_statement_9', list(p
))
1726 # yyerror(@1, "error: Error in for loop condition expression.");
1731 def p_loop_statement_10(p
):
1732 '''loop_statement : K_for '(' error ')' statement_or_null '''
1734 print('loop_statement_10', list(p
))
1737 # yyerror(@1, "error: Incomprehensible for loop.");
1742 def p_loop_statement_11(p
):
1743 '''loop_statement : K_while '(' error ')' statement_or_null '''
1745 print('loop_statement_11', list(p
))
1748 # yyerror(@1, "error: Error in while loop condition.");
1753 def p_loop_statement_12(p
):
1754 '''loop_statement : K_do statement_or_null K_while '(' error ')' ';' '''
1756 print('loop_statement_12', list(p
))
1759 # yyerror(@1, "error: Error in do/while loop condition.");
1764 def p_loop_statement_13(p
):
1765 '''loop_statement : K_foreach '(' IDENTIFIER '[' error ']' ')' statement_or_null '''
1767 print('loop_statement_13', list(p
))
1770 # yyerror(@4, "error: Errors in foreach loop variables list.");
1775 def p__embed0_loop_statement(p
):
1776 '''_embed0_loop_statement : '''
1778 # { static unsigned for_counter = 0;
1779 # char for_block_name [64];
1780 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_for_loop%u", for_counter);
1782 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1783 # FILE_NAME(tmp, @1);
1784 # current_block_stack.push(tmp);
1786 # list<decl_assignment_t*>assign_list;
1787 # decl_assignment_t*tmp_assign = new decl_assignment_t;
1788 # tmp_assign->name = lex_strings.make(p[4]);
1789 # assign_list.push_back(tmp_assign);
1790 # pform_makewire(@4, 0, str_strength, &assign_list, NetNet::REG, p[3]);
1795 def p__embed1_loop_statement(p
):
1796 '''_embed1_loop_statement : '''
1798 # { static unsigned foreach_counter = 0;
1799 # char for_block_name[64];
1800 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_foreach%u", foreach_counter);
1801 # foreach_counter += 1;
1803 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1804 # FILE_NAME(tmp, @1);
1805 # current_block_stack.push(tmp);
1807 # pform_make_foreach_declarations(@1, p[5]);
1812 def p_list_of_variable_decl_assignments_1(p
):
1813 '''list_of_variable_decl_assignments : variable_decl_assignment '''
1815 print('list_of_variable_decl_assignments_1', list(p
))
1817 # { list<decl_assignment_t*>*tmp = new list<decl_assignment_t*>;
1818 # tmp->push_back(p[1]);
1824 def p_list_of_variable_decl_assignments_2(p
):
1825 '''list_of_variable_decl_assignments : list_of_variable_decl_assignments ',' variable_decl_assignment '''
1827 print('list_of_variable_decl_assignments_2', list(p
))
1829 # { list<decl_assignment_t*>*tmp = p[1];
1830 # tmp->push_back(p[3]);
1836 def p_variable_decl_assignment_1(p
):
1837 '''variable_decl_assignment : IDENTIFIER dimensions_opt '''
1839 print('variable_decl_assignment_1', list(p
))
1841 # { decl_assignment_t*tmp = new decl_assignment_t;
1842 # tmp->name = lex_strings.make(p[1]);
1844 # tmp->index = *p[2];
1853 def p_variable_decl_assignment_2(p
):
1854 '''variable_decl_assignment : IDENTIFIER '=' expression '''
1856 print('variable_decl_assignment_2', list(p
))
1858 # { decl_assignment_t*tmp = new decl_assignment_t;
1859 # tmp->name = lex_strings.make(p[1]);
1860 # tmp->expr .reset(p[3]);
1867 def p_variable_decl_assignment_3(p
):
1868 '''variable_decl_assignment : IDENTIFIER '=' K_new '(' ')' '''
1870 print('variable_decl_assignment_3', list(p
))
1872 # { decl_assignment_t*tmp = new decl_assignment_t;
1873 # tmp->name = lex_strings.make(p[1]);
1874 # PENewClass*expr = new PENewClass;
1875 # FILE_NAME(expr, @3);
1876 # tmp->expr .reset(expr);
1883 def p_loop_variables_1(p
):
1884 '''loop_variables : loop_variables ',' IDENTIFIER '''
1886 print('loop_variables_1', list(p
))
1888 # { list<perm_string>*tmp = p[1];
1889 # tmp->push_back(lex_strings.make(p[3]));
1896 def p_loop_variables_2(p
):
1897 '''loop_variables : IDENTIFIER '''
1899 print('loop_variables_2', list(p
))
1901 # { list<perm_string>*tmp = new list<perm_string>;
1902 # tmp->push_back(lex_strings.make(p[1]));
1909 def p_method_qualifier_1(p
):
1910 '''method_qualifier : K_virtual '''
1912 print('method_qualifier_1', list(p
))
1918 def p_method_qualifier_2(p
):
1919 '''method_qualifier : class_item_qualifier '''
1921 print('method_qualifier_2', list(p
))
1927 def p_method_qualifier_opt_1(p
):
1928 '''method_qualifier_opt : method_qualifier '''
1930 print('method_qualifier_opt_1', list(p
))
1936 def p_method_qualifier_opt_2(p
):
1937 '''method_qualifier_opt : '''
1939 print('method_qualifier_opt_2', list(p
))
1945 def p_modport_declaration_1(p
):
1946 '''modport_declaration : K_modport _embed0_modport_declaration modport_item_list ';' '''
1948 print('modport_declaration_1', list(p
))
1954 def p__embed0_modport_declaration(p
):
1955 '''_embed0_modport_declaration : '''
1957 # { if (!pform_in_interface())
1958 # yyerror(@1, "error: modport declarations are only allowed "
1959 # "in interfaces.");
1964 def p_modport_item_list_1(p
):
1965 '''modport_item_list : modport_item '''
1967 print('modport_item_list_1', list(p
))
1973 def p_modport_item_list_2(p
):
1974 '''modport_item_list : modport_item_list ',' modport_item '''
1976 print('modport_item_list_2', list(p
))
1982 def p_modport_item_1(p
):
1983 '''modport_item : IDENTIFIER _embed0_modport_item '(' modport_ports_list ')' '''
1985 print('modport_item_1', list(p
))
1987 # { pform_end_modport_item(@1); }
1991 def p__embed0_modport_item(p
):
1992 '''_embed0_modport_item : '''
1994 # { pform_start_modport_item(@1, p[1]); }
1998 def p_modport_ports_list_1(p
):
1999 '''modport_ports_list : modport_ports_declaration '''
2001 print('modport_ports_list_1', list(p
))
2007 def p_modport_ports_list_2(p
):
2008 '''modport_ports_list : modport_ports_list ',' modport_ports_declaration '''
2010 print('modport_ports_list_2', list(p
))
2016 def p_modport_ports_list_3(p
):
2017 '''modport_ports_list : modport_ports_list ',' modport_simple_port '''
2019 print('modport_ports_list_3', list(p
))
2021 # { if (last_modport_port.type == MP_SIMPLE) {
2022 # pform_add_modport_port(@3, last_modport_port.direction,
2023 # p[3]->name, p[3]->parm);
2025 # yyerror(@3, "error: modport expression not allowed here.");
2032 def p_modport_ports_list_4(p
):
2033 '''modport_ports_list : modport_ports_list ',' modport_tf_port '''
2035 print('modport_ports_list_4', list(p
))
2037 # { if (last_modport_port.type != MP_TF)
2038 # yyerror(@3, "error: task/function declaration not allowed here.");
2043 def p_modport_ports_list_5(p
):
2044 '''modport_ports_list : modport_ports_list ',' IDENTIFIER '''
2046 print('modport_ports_list_5', list(p
))
2048 # { if (last_modport_port.type == MP_SIMPLE) {
2049 # pform_add_modport_port(@3, last_modport_port.direction,
2050 # lex_strings.make(p[3]), 0);
2051 # } else if (last_modport_port.type != MP_TF) {
2052 # yyerror(@3, "error: list of identifiers not allowed here.");
2059 def p_modport_ports_list_6(p
):
2060 '''modport_ports_list : modport_ports_list ',' '''
2062 print('modport_ports_list_6', list(p
))
2064 # { yyerror(@2, "error: NULL port declarations are not allowed"); }
2068 def p_modport_ports_declaration_1(p
):
2069 '''modport_ports_declaration : attribute_list_opt port_direction IDENTIFIER '''
2071 print('modport_ports_declaration_1', list(p
))
2073 # { last_modport_port.type = MP_SIMPLE;
2074 # last_modport_port.direction = p[2];
2075 # pform_add_modport_port(@3, p[2], lex_strings.make(p[3]), 0);
2082 def p_modport_ports_declaration_2(p
):
2083 '''modport_ports_declaration : attribute_list_opt port_direction modport_simple_port '''
2085 print('modport_ports_declaration_2', list(p
))
2087 # { last_modport_port.type = MP_SIMPLE;
2088 # last_modport_port.direction = p[2];
2089 # pform_add_modport_port(@3, p[2], p[3]->name, p[3]->parm);
2096 def p_modport_ports_declaration_3(p
):
2097 '''modport_ports_declaration : attribute_list_opt import_export IDENTIFIER '''
2099 print('modport_ports_declaration_3', list(p
))
2101 # { last_modport_port.type = MP_TF;
2102 # last_modport_port.is_import = p[2];
2103 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
2110 def p_modport_ports_declaration_4(p
):
2111 '''modport_ports_declaration : attribute_list_opt import_export modport_tf_port '''
2113 print('modport_ports_declaration_4', list(p
))
2115 # { last_modport_port.type = MP_TF;
2116 # last_modport_port.is_import = p[2];
2117 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
2123 def p_modport_ports_declaration_5(p
):
2124 '''modport_ports_declaration : attribute_list_opt K_clocking IDENTIFIER '''
2126 print('modport_ports_declaration_5', list(p
))
2128 # { last_modport_port.type = MP_CLOCKING;
2129 # last_modport_port.direction = NetNet::NOT_A_PORT;
2130 # yyerror(@3, "sorry: modport clocking declaration is not yet supported.");
2137 def p_modport_simple_port_1(p
):
2138 '''modport_simple_port : '.' IDENTIFIER '(' expression ')' '''
2140 print('modport_simple_port_1', list(p
))
2142 # { named_pexpr_t*tmp = new named_pexpr_t;
2143 # tmp->name = lex_strings.make(p[2]);
2151 def p_modport_tf_port_1(p
):
2152 '''modport_tf_port : K_task IDENTIFIER '''
2154 print('modport_tf_port_1', list(p
))
2160 def p_modport_tf_port_2(p
):
2161 '''modport_tf_port : K_task IDENTIFIER '(' tf_port_list_opt ')' '''
2163 print('modport_tf_port_2', list(p
))
2169 def p_modport_tf_port_3(p
):
2170 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '''
2172 print('modport_tf_port_3', list(p
))
2178 def p_modport_tf_port_4(p
):
2179 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' '''
2181 print('modport_tf_port_4', list(p
))
2187 def p_non_integer_type_1(p
):
2188 '''non_integer_type : K_real '''
2190 print('non_integer_type_1', list(p
))
2192 # { p[0] = real_type_t::REAL; }
2196 def p_non_integer_type_2(p
):
2197 '''non_integer_type : K_realtime '''
2199 print('non_integer_type_2', list(p
))
2201 # { p[0] = real_type_t::REAL; }
2205 def p_non_integer_type_3(p
):
2206 '''non_integer_type : K_shortreal '''
2208 print('non_integer_type_3', list(p
))
2210 # { p[0] = real_type_t::SHORTREAL; }
2215 '''number : BASED_NUMBER '''
2217 print('number_1', list(p
))
2219 # { p[0] = p[1]; based_size = 0;}
2224 '''number : DEC_NUMBER '''
2226 print('number_2', list(p
))
2227 num
= Leaf(token
.NUMBER
, "%s" % (p
[1]))
2230 # { p[0] = p[1]; based_size = 0;}
2235 '''number : DEC_NUMBER BASED_NUMBER '''
2237 print('number_3', list(p
))
2238 num
= Leaf(token
.NUMBER
, "%s:%s" % (p
[1], p
[2]))
2241 # { p[0] = pform_verinum_with_size(p[1],p[2], @2.text, @2.first_line);
2247 '''number : UNBASED_NUMBER '''
2249 print('number_4', list(p
))
2251 # { p[0] = p[1]; based_size = 0;}
2256 '''number : DEC_NUMBER UNBASED_NUMBER '''
2258 print('number_5', list(p
))
2260 # { yyerror(@1, "error: Unbased SystemVerilog literal cannot have "
2262 # p[0] = p[1]; based_size = 0;}
2266 def p_open_range_list_1(p
):
2267 '''open_range_list : open_range_list ',' value_range '''
2269 print('open_range_list_1', list(p
))
2275 def p_open_range_list_2(p
):
2276 '''open_range_list : value_range '''
2278 print('open_range_list_2', list(p
))
2284 def p_package_declaration_1(p
):
2285 '''package_declaration : K_package lifetime_opt IDENTIFIER ';' _embed0_package_declaration timeunits_declaration_opt _embed1_package_declaration package_item_list_opt K_endpackage endlabel_opt '''
2287 print('package_declaration_1', list(p
))
2289 # { pform_end_package_declaration(@1);
2290 # // If an end label is present make sure it match the package name.
2292 # if (strcmp(p[3],p[10]) != 0) {
2293 # yyerror(@10, "error: End label doesn't match package name");
2302 def p__embed0_package_declaration(p
):
2303 '''_embed0_package_declaration : '''
2305 # { pform_start_package_declaration(@1, p[3], p[2]); }
2309 def p__embed1_package_declaration(p
):
2310 '''_embed1_package_declaration : '''
2312 # { pform_set_scope_timescale(@1); }
2316 def p_module_package_import_list_opt_1(p
):
2317 '''module_package_import_list_opt : '''
2318 if(parse_debug
> 1):
2319 print('module_package_import_list_opt_1', list(p
))
2325 def p_module_package_import_list_opt_2(p
):
2326 '''module_package_import_list_opt : package_import_list '''
2328 print('module_package_import_list_opt_2', list(p
))
2334 def p_package_import_list_1(p
):
2335 '''package_import_list : package_import_declaration '''
2337 print('package_import_list_1', list(p
))
2343 def p_package_import_list_2(p
):
2344 '''package_import_list : package_import_list package_import_declaration '''
2346 print('package_import_list_2', list(p
))
2352 def p_package_import_declaration_1(p
):
2353 '''package_import_declaration : K_import package_import_item_list ';' '''
2355 print('package_import_declaration_1', list(p
))
2361 def p_package_import_item_1(p
):
2362 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '''
2364 print('package_import_item_1', list(p
))
2366 # { pform_package_import(@2, p[1], p[3]);
2372 def p_package_import_item_2(p
):
2373 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES '*' '''
2375 print('package_import_item_2', list(p
))
2377 # { pform_package_import(@2, p[1], 0);
2382 def p_package_import_item_list_1(p
):
2383 '''package_import_item_list : package_import_item_list ',' package_import_item '''
2385 print('package_import_item_list_1', list(p
))
2391 def p_package_import_item_list_2(p
):
2392 '''package_import_item_list : package_import_item '''
2394 print('package_import_item_list_2', list(p
))
2400 def p_package_item_1(p
):
2401 '''package_item : timeunits_declaration '''
2403 print('package_item_1', list(p
))
2409 def p_package_item_2(p
):
2410 '''package_item : K_parameter param_type parameter_assign_list ';' '''
2412 print('package_item_2', list(p
))
2418 def p_package_item_3(p
):
2419 '''package_item : K_localparam param_type localparam_assign_list ';' '''
2421 print('package_item_3', list(p
))
2427 def p_package_item_4(p
):
2428 '''package_item : type_declaration '''
2430 print('package_item_4', list(p
))
2436 def p_package_item_5(p
):
2437 '''package_item : function_declaration '''
2439 print('package_item_5', list(p
))
2445 def p_package_item_6(p
):
2446 '''package_item : task_declaration '''
2448 print('package_item_6', list(p
))
2454 def p_package_item_7(p
):
2455 '''package_item : data_declaration '''
2457 print('package_item_7', list(p
))
2463 def p_package_item_8(p
):
2464 '''package_item : class_declaration '''
2466 print('package_item_8', list(p
))
2472 def p_package_item_list_1(p
):
2473 '''package_item_list : package_item_list package_item '''
2475 print('package_item_list_1', list(p
))
2481 def p_package_item_list_2(p
):
2482 '''package_item_list : package_item '''
2484 print('package_item_list_2', list(p
))
2490 def p_package_item_list_opt_1(p
):
2491 '''package_item_list_opt : package_item_list '''
2493 print('package_item_list_opt_1', list(p
))
2499 def p_package_item_list_opt_2(p
):
2500 '''package_item_list_opt : '''
2502 print('package_item_list_opt_2', list(p
))
2508 def p_port_direction_1(p
):
2509 '''port_direction : K_input '''
2511 print('port_direction_1', list(p
))
2513 # { p[0] = NetNet::PINPUT; }
2517 def p_port_direction_2(p
):
2518 '''port_direction : K_output '''
2520 print('port_direction_2', list(p
))
2522 # { p[0] = NetNet::POUTPUT; }
2526 def p_port_direction_3(p
):
2527 '''port_direction : K_inout '''
2529 print('port_direction_3', list(p
))
2531 # { p[0] = NetNet::PINOUT; }
2535 def p_port_direction_4(p
):
2536 '''port_direction : K_ref '''
2538 print('port_direction_4', list(p
))
2540 # { p[0] = NetNet::PREF;
2541 # if (!gn_system_verilog()) {
2542 # yyerror(@1, "error: Reference ports (ref) require SystemVerilog.");
2543 # p[0] = NetNet::PINPUT;
2549 def p_port_direction_opt_1(p
):
2550 '''port_direction_opt : port_direction '''
2552 print('port_direction_opt_1', list(p
))
2559 def p_port_direction_opt_2(p
):
2560 '''port_direction_opt : '''
2562 print('port_direction_opt_2', list(p
))
2564 # { p[0] = NetNet::PIMPLICIT; }
2568 def p_property_expr_1(p
):
2569 '''property_expr : expression '''
2571 print('property_expr_1', list(p
))
2577 def p_procedural_assertion_statement_1(p
):
2578 '''procedural_assertion_statement : K_assert '(' expression ')' statement %prec less_than_K_else '''
2580 print('procedural_assertion_statement_1', list(p
))
2582 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2588 def p_procedural_assertion_statement_2(p
):
2589 '''procedural_assertion_statement : K_assert '(' expression ')' K_else statement '''
2591 print('procedural_assertion_statement_2', list(p
))
2593 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2599 def p_procedural_assertion_statement_3(p
):
2600 '''procedural_assertion_statement : K_assert '(' expression ')' statement K_else statement '''
2602 print('procedural_assertion_statement_3', list(p
))
2604 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2610 def p_property_qualifier_1(p
):
2611 '''property_qualifier : class_item_qualifier '''
2613 print('property_qualifier_1', list(p
))
2619 def p_property_qualifier_2(p
):
2620 '''property_qualifier : random_qualifier '''
2622 print('property_qualifier_2', list(p
))
2628 def p_property_qualifier_opt_1(p
):
2629 '''property_qualifier_opt : property_qualifier_list '''
2631 print('property_qualifier_opt_1', list(p
))
2638 def p_property_qualifier_opt_2(p
):
2639 '''property_qualifier_opt : '''
2641 print('property_qualifier_opt_2', list(p
))
2643 # { p[0] = property_qualifier_t::make_none(); }
2647 def p_property_qualifier_list_1(p
):
2648 '''property_qualifier_list : property_qualifier_list property_qualifier '''
2650 print('property_qualifier_list_1', list(p
))
2652 # { p[0] = p[1] | p[2]; }
2656 def p_property_qualifier_list_2(p
):
2657 '''property_qualifier_list : property_qualifier '''
2659 print('property_qualifier_list_2', list(p
))
2666 def p_property_spec_1(p
):
2667 '''property_spec : clocking_event_opt property_spec_disable_iff_opt property_expr '''
2669 print('property_spec_1', list(p
))
2675 def p_property_spec_disable_iff_opt_1(p
):
2676 '''property_spec_disable_iff_opt : K_disable K_iff '(' expression ')' '''
2678 print('property_spec_disable_iff_opt_1', list(p
))
2684 def p_property_spec_disable_iff_opt_2(p
):
2685 '''property_spec_disable_iff_opt : '''
2687 print('property_spec_disable_iff_opt_2', list(p
))
2693 def p_random_qualifier_1(p
):
2694 '''random_qualifier : K_rand '''
2696 print('random_qualifier_1', list(p
))
2698 # { p[0] = property_qualifier_t::make_rand(); }
2702 def p_random_qualifier_2(p
):
2703 '''random_qualifier : K_randc '''
2705 print('random_qualifier_2', list(p
))
2707 # { p[0] = property_qualifier_t::make_randc(); }
2711 def p_real_or_realtime_1(p
):
2712 '''real_or_realtime : K_real '''
2714 print('real_or_realtime_1', list(p
))
2720 def p_real_or_realtime_2(p
):
2721 '''real_or_realtime : K_realtime '''
2723 print('real_or_realtime_2', list(p
))
2730 '''signing : K_signed '''
2732 print('signing_1', list(p
))
2740 '''signing : K_unsigned '''
2742 print('signing_2', list(p
))
2749 def p_simple_type_or_string_1(p
):
2750 '''simple_type_or_string : integer_vector_type '''
2752 print('simple_type_or_string_1', list(p
))
2754 # { ivl_variable_type_t use_vtype = p[1];
2755 # bool reg_flag = false;
2756 # if (use_vtype == IVL_VT_NO_TYPE) {
2757 # use_vtype = IVL_VT_LOGIC;
2760 # vector_type_t*tmp = new vector_type_t(use_vtype, false, 0);
2761 # tmp->reg_flag = reg_flag;
2762 # FILE_NAME(tmp, @1);
2768 def p_simple_type_or_string_2(p
):
2769 '''simple_type_or_string : non_integer_type '''
2771 print('simple_type_or_string_2', list(p
))
2773 # { real_type_t*tmp = new real_type_t(p[1]);
2774 # FILE_NAME(tmp, @1);
2780 def p_simple_type_or_string_3(p
):
2781 '''simple_type_or_string : atom2_type '''
2783 print('simple_type_or_string_3', list(p
))
2785 # { atom2_type_t*tmp = new atom2_type_t(p[1], true);
2786 # FILE_NAME(tmp, @1);
2792 def p_simple_type_or_string_4(p
):
2793 '''simple_type_or_string : K_integer '''
2795 print('simple_type_or_string_4', list(p
))
2797 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
2798 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd);
2799 # tmp->reg_flag = true;
2800 # tmp->integer_flag = true;
2806 def p_simple_type_or_string_5(p
):
2807 '''simple_type_or_string : K_time '''
2809 print('simple_type_or_string_5', list(p
))
2811 # { list<pform_range_t>*pd = make_range_from_width(64);
2812 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
2813 # tmp->reg_flag = !gn_system_verilog();
2819 def p_simple_type_or_string_6(p
):
2820 '''simple_type_or_string : TYPE_IDENTIFIER '''
2822 print('simple_type_or_string_6', list(p
))
2824 # { p[0] = p[1].type;
2825 # delete[]p[1].text;
2830 def p_simple_type_or_string_7(p
):
2831 '''simple_type_or_string : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_simple_type_or_string TYPE_IDENTIFIER '''
2833 print('simple_type_or_string_7', list(p
))
2835 # { lex_in_package_scope(0);
2837 # delete[]p[4].text;
2842 def p_simple_type_or_string_8(p
):
2843 '''simple_type_or_string : K_string '''
2845 print('simple_type_or_string_8', list(p
))
2847 # { string_type_t*tmp = new string_type_t;
2848 # FILE_NAME(tmp, @1);
2854 def p__embed0_simple_type_or_string(p
):
2855 '''_embed0_simple_type_or_string : '''
2857 # { lex_in_package_scope(p[1]); }
2861 def p_statement_1(p
):
2862 '''statement : attribute_list_opt statement_item '''
2864 print('statement_1', list(p
))
2866 # { pform_bind_attributes(p[2]->attributes, p[1]);
2872 def p_statement_or_null_1(p
):
2873 '''statement_or_null : statement '''
2875 print('statement_or_null_1', list(p
))
2882 def p_statement_or_null_2(p
):
2883 '''statement_or_null : attribute_list_opt ';' '''
2885 print('statement_or_null_2', list(p
))
2891 def p_stream_expression_1(p
):
2892 '''stream_expression : expression '''
2894 print('stream_expression_1', list(p
))
2900 def p_stream_expression_list_1(p
):
2901 '''stream_expression_list : stream_expression_list ',' stream_expression '''
2903 print('stream_expression_list_1', list(p
))
2909 def p_stream_expression_list_2(p
):
2910 '''stream_expression_list : stream_expression '''
2912 print('stream_expression_list_2', list(p
))
2918 def p_stream_operator_1(p
):
2919 '''stream_operator : K_LS '''
2921 print('stream_operator_1', list(p
))
2927 def p_stream_operator_2(p
):
2928 '''stream_operator : K_RS '''
2930 print('stream_operator_2', list(p
))
2936 def p_streaming_concatenation_1(p
):
2937 '''streaming_concatenation : '{' stream_operator '{' stream_expression_list '}' '}' '''
2939 print('streaming_concatenation_1', list(p
))
2941 # { /* streaming concatenation is a SystemVerilog thing. */
2942 # if (gn_system_verilog()) {
2943 # yyerror(@2, "sorry: Streaming concatenation not supported.");
2946 # yyerror(@2, "error: Streaming concatenation requires SystemVerilog");
2953 def p_task_declaration_1(p
):
2954 '''task_declaration : K_task lifetime_opt IDENTIFIER ';' _embed0_task_declaration task_item_list_opt statement_or_null_list_opt K_endtask _embed1_task_declaration endlabel_opt '''
2956 print('task_declaration_1', list(p
))
2958 # { // Last step: check any closing name. This is done late so
2959 # // that the parser can look ahead to detect the present
2960 # // endlabel_opt but still have the pform_endmodule() called
2961 # // early enough that the lexor can know we are outside the
2964 # if (strcmp(p[3],p[10]) != 0) {
2965 # yyerror(@10, "error: End label doesn't match task name");
2967 # if (! gn_system_verilog()) {
2968 # yyerror(@10, "error: Task end labels require "
2969 # "SystemVerilog.");
2978 def p_task_declaration_2(p
):
2979 '''task_declaration : K_task lifetime_opt IDENTIFIER '(' _embed2_task_declaration tf_port_list ')' ';' block_item_decls_opt statement_or_null_list_opt K_endtask _embed3_task_declaration endlabel_opt '''
2981 print('task_declaration_2', list(p
))
2983 # { // Last step: check any closing name. This is done late so
2984 # // that the parser can look ahead to detect the present
2985 # // endlabel_opt but still have the pform_endmodule() called
2986 # // early enough that the lexor can know we are outside the
2989 # if (strcmp(p[3],p[13]) != 0) {
2990 # yyerror(@13, "error: End label doesn't match task name");
2992 # if (! gn_system_verilog()) {
2993 # yyerror(@13, "error: Task end labels require "
2994 # "SystemVerilog.");
3003 def p_task_declaration_3(p
):
3004 '''task_declaration : K_task lifetime_opt IDENTIFIER '(' ')' ';' _embed4_task_declaration block_item_decls_opt statement_or_null_list K_endtask _embed5_task_declaration endlabel_opt '''
3006 print('task_declaration_3', list(p
))
3008 # { // Last step: check any closing name. This is done late so
3009 # // that the parser can look ahead to detect the present
3010 # // endlabel_opt but still have the pform_endmodule() called
3011 # // early enough that the lexor can know we are outside the
3014 # if (strcmp(p[3],p[12]) != 0) {
3015 # yyerror(@12, "error: End label doesn't match task name");
3017 # if (! gn_system_verilog()) {
3018 # yyerror(@12, "error: Task end labels require "
3019 # "SystemVerilog.");
3028 def p_task_declaration_4(p
):
3029 '''task_declaration : K_task lifetime_opt IDENTIFIER error K_endtask _embed6_task_declaration endlabel_opt '''
3031 print('task_declaration_4', list(p
))
3033 # { // Last step: check any closing name. This is done late so
3034 # // that the parser can look ahead to detect the present
3035 # // endlabel_opt but still have the pform_endmodule() called
3036 # // early enough that the lexor can know we are outside the
3039 # if (strcmp(p[3],p[7]) != 0) {
3040 # yyerror(@7, "error: End label doesn't match task name");
3042 # if (! gn_system_verilog()) {
3043 # yyerror(@7, "error: Task end labels require "
3044 # "SystemVerilog.");
3053 def p__embed0_task_declaration(p
):
3054 '''_embed0_task_declaration : '''
3056 # { assert(current_task == 0);
3057 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3062 def p__embed1_task_declaration(p
):
3063 '''_embed1_task_declaration : '''
3065 # { current_task->set_ports(p[6]);
3066 # current_task_set_statement(@3, p[7]);
3067 # pform_set_this_class(@3, current_task);
3068 # pform_pop_scope();
3070 # if (p[7] && p[7]->size() > 1 && !gn_system_verilog()) {
3071 # yyerror(@7, "error: Task body with multiple statements requires SystemVerilog.");
3078 def p__embed2_task_declaration(p
):
3079 '''_embed2_task_declaration : '''
3081 # { assert(current_task == 0);
3082 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3087 def p__embed3_task_declaration(p
):
3088 '''_embed3_task_declaration : '''
3090 # { current_task->set_ports(p[6]);
3091 # current_task_set_statement(@3, p[10]);
3092 # pform_set_this_class(@3, current_task);
3093 # pform_pop_scope();
3095 # if (p[10]) delete p[10];
3100 def p__embed4_task_declaration(p
):
3101 '''_embed4_task_declaration : '''
3103 # { assert(current_task == 0);
3104 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3109 def p__embed5_task_declaration(p
):
3110 '''_embed5_task_declaration : '''
3112 # { current_task->set_ports(0);
3113 # current_task_set_statement(@3, p[9]);
3114 # pform_set_this_class(@3, current_task);
3115 # if (! current_task->method_of()) {
3116 # cerr << @3 << ": warning: task definition for \"" << p[3]
3117 # << "\" has an empty port declaration list!" << endl;
3119 # pform_pop_scope();
3121 # if (p[9]->size() > 1 && !gn_system_verilog()) {
3122 # yyerror(@9, "error: Task body with multiple statements requires SystemVerilog.");
3129 def p__embed6_task_declaration(p
):
3130 '''_embed6_task_declaration : '''
3133 # if (current_task) {
3134 # pform_pop_scope();
3141 def p_tf_port_declaration_1(p
):
3142 '''tf_port_declaration : port_direction K_reg_opt unsigned_signed_opt dimensions_opt list_of_identifiers ';' '''
3144 print('tf_port_declaration_1', list(p
))
3146 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1],
3147 # p[2] ? IVL_VT_LOGIC :
3149 # p[3], p[4], p[5]);
3155 def p_tf_port_declaration_2(p
):
3156 '''tf_port_declaration : port_direction K_integer list_of_identifiers ';' '''
3158 print('tf_port_declaration_2', list(p
))
3160 # { list<pform_range_t>*range_stub = make_range_from_width(integer_width);
3161 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, true,
3162 # range_stub, p[3], true);
3168 def p_tf_port_declaration_3(p
):
3169 '''tf_port_declaration : port_direction K_time list_of_identifiers ';' '''
3171 print('tf_port_declaration_3', list(p
))
3173 # { list<pform_range_t>*range_stub = make_range_from_width(64);
3174 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, false,
3175 # range_stub, p[3]);
3181 def p_tf_port_declaration_4(p
):
3182 '''tf_port_declaration : port_direction real_or_realtime list_of_identifiers ';' '''
3184 print('tf_port_declaration_4', list(p
))
3186 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_REAL, true,
3193 def p_tf_port_declaration_5(p
):
3194 '''tf_port_declaration : port_direction K_string list_of_identifiers ';' '''
3196 print('tf_port_declaration_5', list(p
))
3198 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_STRING, true,
3205 def p_tf_port_item_1(p
):
3206 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER dimensions_opt tf_port_item_expr_opt '''
3208 print('tf_port_item_1', list(p
))
3210 # { vector<pform_tf_port_t>*tmp;
3211 # NetNet::PortType use_port_type = p[1];
3212 # if ((use_port_type == NetNet::PIMPLICIT) && (gn_system_verilog() || (p[2] == 0)))
3213 # use_port_type = port_declaration_context.port_type;
3214 # perm_string name = lex_strings.make(p[3]);
3215 # list<perm_string>* ilist = list_from_identifier(p[3]);
3217 # if (use_port_type == NetNet::PIMPLICIT) {
3218 # yyerror(@1, "error: missing task/function port direction.");
3219 # use_port_type = NetNet::PINPUT; // for error recovery
3221 # if ((p[2] == 0) && (p[1]==NetNet::PIMPLICIT)) {
3222 # // Detect special case this is an undecorated
3223 # // identifier and we need to get the declaration from
3226 # yyerror(@4, "internal error: How can there be an unpacked range here?\n");
3228 # tmp = pform_make_task_ports(@3, use_port_type,
3229 # port_declaration_context.data_type,
3233 # // Otherwise, the decorations for this identifier
3234 # // indicate the type. Save the type for any right
3235 # // context that may come later.
3236 # port_declaration_context.port_type = use_port_type;
3238 # p[2] = new vector_type_t(IVL_VT_LOGIC, false, 0);
3239 # FILE_NAME(p[2], @3);
3241 # port_declaration_context.data_type = p[2];
3242 # tmp = pform_make_task_ports(@3, use_port_type, p[2], ilist);
3245 # pform_set_reg_idx(name, p[4]);
3250 # assert(tmp->size()==1);
3251 # tmp->front().defe = p[5];
3257 def p_tf_port_item_2(p
):
3258 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER error '''
3260 print('tf_port_item_2', list(p
))
3262 # { yyerror(@3, "error: Error in task/function port item after port name %s.", p[3]);
3269 def p_tf_port_item_expr_opt_1(p
):
3270 '''tf_port_item_expr_opt : '=' expression '''
3272 print('tf_port_item_expr_opt_1', list(p
))
3274 # { if (! gn_system_verilog()) {
3275 # yyerror(@1, "error: Task/function default arguments require "
3276 # "SystemVerilog.");
3283 def p_tf_port_item_expr_opt_2(p
):
3284 '''tf_port_item_expr_opt : '''
3286 print('tf_port_item_expr_opt_2', list(p
))
3292 def p_tf_port_list_1(p
):
3293 '''tf_port_list : _embed0_tf_port_list tf_port_item_list '''
3295 print('tf_port_list_1', list(p
))
3302 def p__embed0_tf_port_list(p
):
3303 '''_embed0_tf_port_list : '''
3305 # { port_declaration_context.port_type = gn_system_verilog() ? NetNet::PINPUT : NetNet::PIMPLICIT;
3306 # port_declaration_context.data_type = 0;
3311 def p_tf_port_item_list_1(p
):
3312 '''tf_port_item_list : tf_port_item_list ',' tf_port_item '''
3314 print('tf_port_item_list_1', list(p
))
3316 # { vector<pform_tf_port_t>*tmp;
3317 # if (p[1] && p[3]) {
3318 # size_t s1 = p[1]->size();
3320 # tmp->resize(tmp->size()+p[3]->size());
3321 # for (size_t idx = 0 ; idx < p[3]->size() ; idx += 1)
3322 # tmp->at(s1+idx) = p[3]->at(idx);
3324 # } else if (p[1]) {
3334 def p_tf_port_item_list_2(p
):
3335 '''tf_port_item_list : tf_port_item '''
3337 print('tf_port_item_list_2', list(p
))
3344 def p_tf_port_item_list_3(p
):
3345 '''tf_port_item_list : error ',' tf_port_item '''
3347 print('tf_port_item_list_3', list(p
))
3349 # { yyerror(@2, "error: Syntax error in task/function port declaration.");
3355 def p_tf_port_item_list_4(p
):
3356 '''tf_port_item_list : tf_port_item_list ',' '''
3358 print('tf_port_item_list_4', list(p
))
3360 # { yyerror(@2, "error: NULL port declarations are not allowed.");
3366 def p_tf_port_item_list_5(p
):
3367 '''tf_port_item_list : tf_port_item_list ';' '''
3369 print('tf_port_item_list_5', list(p
))
3371 # { yyerror(@2, "error: ';' is an invalid port declaration separator.");
3377 def p_timeunits_declaration_1(p
):
3378 '''timeunits_declaration : K_timeunit TIME_LITERAL ';' '''
3380 print('timeunits_declaration_1', list(p
))
3382 # { pform_set_timeunit(p[2], allow_timeunit_decl); }
3386 def p_timeunits_declaration_2(p
):
3387 '''timeunits_declaration : K_timeunit TIME_LITERAL '/' TIME_LITERAL ';' '''
3389 print('timeunits_declaration_2', list(p
))
3391 # { bool initial_decl = allow_timeunit_decl && allow_timeprec_decl;
3392 # pform_set_timeunit(p[2], initial_decl);
3393 # pform_set_timeprec(p[4], initial_decl);
3398 def p_timeunits_declaration_3(p
):
3399 '''timeunits_declaration : K_timeprecision TIME_LITERAL ';' '''
3401 print('timeunits_declaration_3', list(p
))
3403 # { pform_set_timeprec(p[2], allow_timeprec_decl); }
3407 def p_timeunits_declaration_opt_1(p
):
3408 '''timeunits_declaration_opt : %prec no_timeunits_declaration '''
3409 if(parse_debug
> 2):
3410 print('timeunits_declaration_opt_1', list(p
))
3416 def p_timeunits_declaration_opt_2(p
):
3417 '''timeunits_declaration_opt : timeunits_declaration %prec one_timeunits_declaration '''
3419 print('timeunits_declaration_opt_2', list(p
))
3425 def p_timeunits_declaration_opt_3(p
):
3426 '''timeunits_declaration_opt : timeunits_declaration timeunits_declaration '''
3428 print('timeunits_declaration_opt_3', list(p
))
3434 def p_value_range_1(p
):
3435 '''value_range : expression '''
3437 print('value_range_1', list(p
))
3443 def p_value_range_2(p
):
3444 '''value_range : '[' expression ':' expression ']' '''
3446 print('value_range_2', list(p
))
3452 def p_variable_dimension_1(p
):
3453 '''variable_dimension : '[' expression ':' expression ']' '''
3455 print('variable_dimension_1', list(p
))
3456 # { list<pform_range_t> *tmp = new list<pform_range_t>;
3457 # pform_range_t index (p[2],p[4]);
3458 # tmp->push_back(index);
3461 # XXX TODO: subscriptlist
3464 if end
.endswith("-1"):
3467 end
= str(int(end
)+1)
3470 p
[0] = '[%s:%s]' % (start
, end
) # python slice is LO:HI+1
3476 def p_variable_dimension_2(p
):
3477 '''variable_dimension : '[' expression ']' '''
3479 print('variable_dimension_2', list(p
))
3481 # { // SystemVerilog canonical range
3482 # if (!gn_system_verilog()) {
3484 # cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. "
3485 # << "Use at least -g2005-sv to remove this warning." << endl;
3487 # list<pform_range_t> *tmp = new list<pform_range_t>;
3488 # pform_range_t index;
3489 # index.first = new PENumber(new verinum((uint64_t)0, integer_width));
3490 # index.second = new PEBinary('-', p[2], new PENumber(new verinum((uint64_t)1, integer_width)));
3491 # tmp->push_back(index);
3497 def p_variable_dimension_3(p
):
3498 '''variable_dimension : '[' ']' '''
3500 print('variable_dimension_3', list(p
))
3502 # { list<pform_range_t> *tmp = new list<pform_range_t>;
3503 # pform_range_t index (0,0);
3504 # tmp->push_back(index);
3510 def p_variable_dimension_4(p
):
3511 '''variable_dimension : '[' '$' ']' '''
3513 print('variable_dimension_4', list(p
))
3515 # { // SystemVerilog queue
3516 # list<pform_range_t> *tmp = new list<pform_range_t>;
3517 # pform_range_t index (new PENull,0);
3518 # if (!gn_system_verilog()) {
3519 # yyerror("error: Queue declarations require SystemVerilog.");
3521 # tmp->push_back(index);
3527 def p_variable_lifetime_1(p
):
3528 '''variable_lifetime : lifetime '''
3530 print('variable_lifetime_1', list(p
))
3532 # { if (!gn_system_verilog()) {
3533 # yyerror(@1, "error: overriding the default variable lifetime "
3534 # "requires SystemVerilog.");
3535 # } else if (p[1] != pform_peek_scope()->default_lifetime) {
3536 # yyerror(@1, "sorry: overriding the default variable lifetime "
3537 # "is not yet supported.");
3539 # var_lifetime = p[1];
3544 def p_attribute_list_opt_1(p
):
3545 '''attribute_list_opt : attribute_instance_list '''
3547 print('attribute_list_opt_1', list(p
))
3554 def p_attribute_list_opt_2(p
):
3555 '''attribute_list_opt : '''
3556 if(parse_debug
> 2):
3557 print('attribute_list_opt_2', list(p
))
3563 def p_attribute_instance_list_1(p
):
3564 '''attribute_instance_list : K_PSTAR K_STARP '''
3566 print('attribute_instance_list_1', list(p
))
3572 def p_attribute_instance_list_2(p
):
3573 '''attribute_instance_list : K_PSTAR attribute_list K_STARP '''
3575 print('attribute_instance_list_2', list(p
))
3582 def p_attribute_instance_list_3(p
):
3583 '''attribute_instance_list : attribute_instance_list K_PSTAR K_STARP '''
3585 print('attribute_instance_list_3', list(p
))
3592 def p_attribute_instance_list_4(p
):
3593 '''attribute_instance_list : attribute_instance_list K_PSTAR attribute_list K_STARP '''
3595 print('attribute_instance_list_4', list(p
))
3597 # { list<named_pexpr_t>*tmp = p[1];
3599 # tmp->splice(tmp->end(), *p[3]);
3602 # } else p[0] = p[3];
3607 def p_attribute_list_1(p
):
3608 '''attribute_list : attribute_list ',' attribute '''
3610 print('attribute_list_1', list(p
))
3612 # { list<named_pexpr_t>*tmp = p[1];
3613 # tmp->push_back(*p[3]);
3620 def p_attribute_list_2(p
):
3621 '''attribute_list : attribute '''
3623 print('attribute_list_2', list(p
))
3625 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
3626 # tmp->push_back(*p[1]);
3633 def p_attribute_1(p
):
3634 '''attribute : IDENTIFIER '''
3636 print('attribute_1', list(p
))
3638 # { named_pexpr_t*tmp = new named_pexpr_t;
3639 # tmp->name = lex_strings.make(p[1]);
3647 def p_attribute_2(p
):
3648 '''attribute : IDENTIFIER '=' expression '''
3650 print('attribute_2', list(p
))
3652 # { PExpr*tmp = p[3];
3653 # named_pexpr_t*tmp2 = new named_pexpr_t;
3654 # tmp2->name = lex_strings.make(p[1]);
3662 def p_block_item_decl_1(p
):
3663 '''block_item_decl : data_type register_variable_list ';' '''
3665 print('block_item_decl_1', list(p
))
3667 # { if (p[1]) pform_set_data_type(@1, p[1], p[2], NetNet::REG, attributes_in_context);
3672 def p_block_item_decl_2(p
):
3673 '''block_item_decl : variable_lifetime data_type register_variable_list ';' '''
3675 print('block_item_decl_2', list(p
))
3677 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
3678 # var_lifetime = LexicalScope::INHERITED;
3683 def p_block_item_decl_3(p
):
3684 '''block_item_decl : K_reg data_type register_variable_list ';' '''
3686 print('block_item_decl_3', list(p
))
3688 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
3693 def p_block_item_decl_4(p
):
3694 '''block_item_decl : variable_lifetime K_reg data_type register_variable_list ';' '''
3696 print('block_item_decl_4', list(p
))
3698 # { if (p[3]) pform_set_data_type(@3, p[3], p[4], NetNet::REG, attributes_in_context);
3699 # var_lifetime = LexicalScope::INHERITED;
3704 def p_block_item_decl_5(p
):
3705 '''block_item_decl : K_event event_variable_list ';' '''
3707 print('block_item_decl_5', list(p
))
3709 # { if (p[2]) pform_make_events(p[2], @1.text, @1.first_line);
3714 def p_block_item_decl_6(p
):
3715 '''block_item_decl : K_parameter param_type parameter_assign_list ';' '''
3717 print('block_item_decl_6', list(p
))
3723 def p_block_item_decl_7(p
):
3724 '''block_item_decl : K_localparam param_type localparam_assign_list ';' '''
3726 print('block_item_decl_7', list(p
))
3732 def p_block_item_decl_8(p
):
3733 '''block_item_decl : type_declaration '''
3735 print('block_item_decl_8', list(p
))
3741 def p_block_item_decl_9(p
):
3742 '''block_item_decl : K_integer error ';' '''
3744 print('block_item_decl_9', list(p
))
3746 # { yyerror(@1, "error: syntax error in integer variable list.");
3752 def p_block_item_decl_10(p
):
3753 '''block_item_decl : K_time error ';' '''
3755 print('block_item_decl_10', list(p
))
3757 # { yyerror(@1, "error: syntax error in time variable list.");
3763 def p_block_item_decl_11(p
):
3764 '''block_item_decl : K_parameter error ';' '''
3766 print('block_item_decl_11', list(p
))
3768 # { yyerror(@1, "error: syntax error in parameter list.");
3774 def p_block_item_decl_12(p
):
3775 '''block_item_decl : K_localparam error ';' '''
3777 print('block_item_decl_12', list(p
))
3779 # { yyerror(@1, "error: syntax error localparam list.");
3785 def p_block_item_decls_1(p
):
3786 '''block_item_decls : block_item_decl '''
3788 print('block_item_decls_1', list(p
))
3794 def p_block_item_decls_2(p
):
3795 '''block_item_decls : block_item_decls block_item_decl '''
3797 print('block_item_decls_2', list(p
))
3803 def p_block_item_decls_opt_1(p
):
3804 '''block_item_decls_opt : block_item_decls '''
3806 print('block_item_decls_opt_1', list(p
))
3813 def p_block_item_decls_opt_2(p
):
3814 '''block_item_decls_opt : '''
3816 print('block_item_decls_opt_2', list(p
))
3823 def p_type_declaration_1(p
):
3824 '''type_declaration : K_typedef data_type IDENTIFIER dimensions_opt ';' '''
3826 print('type_declaration_1', list(p
))
3828 # { perm_string name = lex_strings.make(p[3]);
3829 # pform_set_typedef(name, p[2], p[4]);
3835 def p_type_declaration_2(p
):
3836 '''type_declaration : K_typedef data_type TYPE_IDENTIFIER ';' '''
3838 print('type_declaration_2', list(p
))
3840 # { perm_string name = lex_strings.make(p[3].text);
3841 # if (pform_test_type_identifier_local(name)) {
3842 # yyerror(@3, "error: Typedef identifier \"%s\" is already a type name.", p[3].text);
3845 # pform_set_typedef(name, p[2], NULL);
3847 # delete[]p[3].text;
3852 def p_type_declaration_3(p
):
3853 '''type_declaration : K_typedef K_class IDENTIFIER ';' '''
3855 print('type_declaration_3', list(p
))
3857 # { // Create a synthetic typedef for the class name so that the
3858 # // lexor detects the name as a type.
3859 # perm_string name = lex_strings.make(p[3]);
3860 # class_type_t*tmp = new class_type_t(name);
3861 # FILE_NAME(tmp, @3);
3862 # pform_set_typedef(name, tmp, NULL);
3868 def p_type_declaration_4(p
):
3869 '''type_declaration : K_typedef K_enum IDENTIFIER ';' '''
3871 print('type_declaration_4', list(p
))
3873 # { yyerror(@1, "sorry: Enum forward declarations not supported yet."); }
3877 def p_type_declaration_5(p
):
3878 '''type_declaration : K_typedef K_struct IDENTIFIER ';' '''
3880 print('type_declaration_5', list(p
))
3882 # { yyerror(@1, "sorry: Struct forward declarations not supported yet."); }
3886 def p_type_declaration_6(p
):
3887 '''type_declaration : K_typedef K_union IDENTIFIER ';' '''
3889 print('type_declaration_6', list(p
))
3891 # { yyerror(@1, "sorry: Union forward declarations not supported yet."); }
3895 def p_type_declaration_7(p
):
3896 '''type_declaration : K_typedef IDENTIFIER ';' '''
3898 print('type_declaration_7', list(p
))
3900 # { // Create a synthetic typedef for the class name so that the
3901 # // lexor detects the name as a type.
3902 # perm_string name = lex_strings.make(p[2]);
3903 # class_type_t*tmp = new class_type_t(name);
3904 # FILE_NAME(tmp, @2);
3905 # pform_set_typedef(name, tmp, NULL);
3911 def p_type_declaration_8(p
):
3912 '''type_declaration : K_typedef error ';' '''
3914 print('type_declaration_8', list(p
))
3916 # { yyerror(@2, "error: Syntax error in typedef clause.");
3922 def p_enum_data_type_1(p
):
3923 '''enum_data_type : K_enum '{' enum_name_list '}' '''
3925 print('enum_data_type_1', list(p
))
3927 # { enum_type_t*enum_type = new enum_type_t;
3928 # FILE_NAME(enum_type, @1);
3929 # enum_type->names .reset(p[3]);
3930 # enum_type->base_type = IVL_VT_BOOL;
3931 # enum_type->signed_flag = true;
3932 # enum_type->integer_flag = false;
3933 # enum_type->range.reset(make_range_from_width(32));
3939 def p_enum_data_type_2(p
):
3940 '''enum_data_type : K_enum atom2_type signed_unsigned_opt '{' enum_name_list '}' '''
3942 print('enum_data_type_2', list(p
))
3944 # { enum_type_t*enum_type = new enum_type_t;
3945 # FILE_NAME(enum_type, @1);
3946 # enum_type->names .reset(p[5]);
3947 # enum_type->base_type = IVL_VT_BOOL;
3948 # enum_type->signed_flag = p[3];
3949 # enum_type->integer_flag = false;
3950 # enum_type->range.reset(make_range_from_width(p[2]));
3956 def p_enum_data_type_3(p
):
3957 '''enum_data_type : K_enum K_integer signed_unsigned_opt '{' enum_name_list '}' '''
3959 print('enum_data_type_3', list(p
))
3961 # { enum_type_t*enum_type = new enum_type_t;
3962 # FILE_NAME(enum_type, @1);
3963 # enum_type->names .reset(p[5]);
3964 # enum_type->base_type = IVL_VT_LOGIC;
3965 # enum_type->signed_flag = p[3];
3966 # enum_type->integer_flag = true;
3967 # enum_type->range.reset(make_range_from_width(integer_width));
3973 def p_enum_data_type_4(p
):
3974 '''enum_data_type : K_enum K_logic unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
3976 print('enum_data_type_4', list(p
))
3978 # { enum_type_t*enum_type = new enum_type_t;
3979 # FILE_NAME(enum_type, @1);
3980 # enum_type->names .reset(p[6]);
3981 # enum_type->base_type = IVL_VT_LOGIC;
3982 # enum_type->signed_flag = p[3];
3983 # enum_type->integer_flag = false;
3984 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
3990 def p_enum_data_type_5(p
):
3991 '''enum_data_type : K_enum K_reg unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
3993 print('enum_data_type_5', list(p
))
3995 # { enum_type_t*enum_type = new enum_type_t;
3996 # FILE_NAME(enum_type, @1);
3997 # enum_type->names .reset(p[6]);
3998 # enum_type->base_type = IVL_VT_LOGIC;
3999 # enum_type->signed_flag = p[3];
4000 # enum_type->integer_flag = false;
4001 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4007 def p_enum_data_type_6(p
):
4008 '''enum_data_type : K_enum K_bit unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
4010 print('enum_data_type_6', list(p
))
4012 # { enum_type_t*enum_type = new enum_type_t;
4013 # FILE_NAME(enum_type, @1);
4014 # enum_type->names .reset(p[6]);
4015 # enum_type->base_type = IVL_VT_BOOL;
4016 # enum_type->signed_flag = p[3];
4017 # enum_type->integer_flag = false;
4018 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4024 def p_enum_name_list_1(p
):
4025 '''enum_name_list : enum_name '''
4027 print('enum_name_list_1', list(p
))
4034 def p_enum_name_list_2(p
):
4035 '''enum_name_list : enum_name_list ',' enum_name '''
4037 print('enum_name_list_2', list(p
))
4039 # { list<named_pexpr_t>*lst = p[1];
4040 # lst->splice(lst->end(), *p[3]);
4047 def p_pos_neg_number_1(p
):
4048 '''pos_neg_number : number '''
4050 print('pos_neg_number_1', list(p
))
4057 def p_pos_neg_number_2(p
):
4058 '''pos_neg_number : '-' number '''
4060 print('pos_neg_number_2', list(p
))
4062 # { verinum tmp = -(*(p[2]));
4069 def p_enum_name_1(p
):
4070 '''enum_name : IDENTIFIER '''
4072 print('enum_name_1', list(p
))
4074 # { perm_string name = lex_strings.make(p[1]);
4076 # p[0] = make_named_number(name);
4081 def p_enum_name_2(p
):
4082 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '''
4084 print('enum_name_2', list(p
))
4086 # { perm_string name = lex_strings.make(p[1]);
4087 # long count = check_enum_seq_value(@1, p[3], false);
4089 # p[0] = make_named_numbers(name, 0, count-1);
4095 def p_enum_name_3(p
):
4096 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '''
4098 print('enum_name_3', list(p
))
4100 # { perm_string name = lex_strings.make(p[1]);
4101 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
4102 # check_enum_seq_value(@1, p[5], true));
4110 def p_enum_name_4(p
):
4111 '''enum_name : IDENTIFIER '=' expression '''
4113 print('enum_name_4', list(p
))
4115 # { perm_string name = lex_strings.make(p[1]);
4117 # p[0] = make_named_number(name, p[3]);
4122 def p_enum_name_5(p
):
4123 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '=' expression '''
4125 print('enum_name_5', list(p
))
4127 # { perm_string name = lex_strings.make(p[1]);
4128 # long count = check_enum_seq_value(@1, p[3], false);
4129 # p[0] = make_named_numbers(name, 0, count-1, p[6]);
4136 def p_enum_name_6(p
):
4137 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '=' expression '''
4139 print('enum_name_6', list(p
))
4141 # { perm_string name = lex_strings.make(p[1]);
4142 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
4143 # check_enum_seq_value(@1, p[5], true), p[8]);
4151 def p_struct_data_type_1(p
):
4152 '''struct_data_type : K_struct K_packed_opt '{' struct_union_member_list '}' '''
4154 print('struct_data_type_1', list(p
))
4156 # { struct_type_t*tmp = new struct_type_t;
4157 # FILE_NAME(tmp, @1);
4158 # tmp->packed_flag = p[2];
4159 # tmp->union_flag = false;
4160 # tmp->members .reset(p[4]);
4166 def p_struct_data_type_2(p
):
4167 '''struct_data_type : K_union K_packed_opt '{' struct_union_member_list '}' '''
4169 print('struct_data_type_2', list(p
))
4171 # { struct_type_t*tmp = new struct_type_t;
4172 # FILE_NAME(tmp, @1);
4173 # tmp->packed_flag = p[2];
4174 # tmp->union_flag = true;
4175 # tmp->members .reset(p[4]);
4181 def p_struct_data_type_3(p
):
4182 '''struct_data_type : K_struct K_packed_opt '{' error '}' '''
4184 print('struct_data_type_3', list(p
))
4186 # { yyerror(@3, "error: Errors in struct member list.");
4188 # struct_type_t*tmp = new struct_type_t;
4189 # FILE_NAME(tmp, @1);
4190 # tmp->packed_flag = p[2];
4191 # tmp->union_flag = false;
4197 def p_struct_data_type_4(p
):
4198 '''struct_data_type : K_union K_packed_opt '{' error '}' '''
4200 print('struct_data_type_4', list(p
))
4202 # { yyerror(@3, "error: Errors in union member list.");
4204 # struct_type_t*tmp = new struct_type_t;
4205 # FILE_NAME(tmp, @1);
4206 # tmp->packed_flag = p[2];
4207 # tmp->union_flag = true;
4213 def p_struct_union_member_list_1(p
):
4214 '''struct_union_member_list : struct_union_member_list struct_union_member '''
4216 print('struct_union_member_list_1', list(p
))
4218 # { list<struct_member_t*>*tmp = p[1];
4219 # tmp->push_back(p[2]);
4225 def p_struct_union_member_list_2(p
):
4226 '''struct_union_member_list : struct_union_member '''
4228 print('struct_union_member_list_2', list(p
))
4230 # { list<struct_member_t*>*tmp = new list<struct_member_t*>;
4231 # tmp->push_back(p[1]);
4237 def p_struct_union_member_1(p
):
4238 '''struct_union_member : attribute_list_opt data_type list_of_variable_decl_assignments ';' '''
4240 print('struct_union_member_1', list(p
))
4242 # { struct_member_t*tmp = new struct_member_t;
4243 # FILE_NAME(tmp, @2);
4244 # tmp->type .reset(p[2]);
4245 # tmp->names .reset(p[3]);
4251 def p_struct_union_member_2(p
):
4252 '''struct_union_member : error ';' '''
4254 print('struct_union_member_2', list(p
))
4256 # { yyerror(@2, "Error in struct/union member.");
4263 def p_case_item_1(p
):
4264 '''case_item : expression_list_proper ':' statement_or_null '''
4266 print('case_item_1', list(p
))
4268 # { PCase::Item*tmp = new PCase::Item;
4269 # tmp->expr = *p[1];
4277 def p_case_item_2(p
):
4278 '''case_item : K_default ':' statement_or_null '''
4280 print('case_item_2', list(p
))
4282 # { PCase::Item*tmp = new PCase::Item;
4289 def p_case_item_3(p
):
4290 '''case_item : K_default statement_or_null '''
4292 print('case_item_3', list(p
))
4294 # { PCase::Item*tmp = new PCase::Item;
4301 def p_case_item_4(p
):
4302 '''case_item : error ':' statement_or_null '''
4304 print('case_item_4', list(p
))
4306 # { yyerror(@2, "error: Incomprehensible case expression.");
4312 def p_case_items_1(p
):
4313 '''case_items : case_items case_item '''
4315 print('case_items_1', list(p
))
4317 # { svector<PCase::Item*>*tmp;
4318 # tmp = new svector<PCase::Item*>(*p[1], p[2]);
4325 def p_case_items_2(p
):
4326 '''case_items : case_item '''
4328 print('case_items_2', list(p
))
4330 # { svector<PCase::Item*>*tmp = new svector<PCase::Item*>(1);
4337 def p_charge_strength_1(p
):
4338 '''charge_strength : '(' K_small ')' '''
4340 print('charge_strength_1', list(p
))
4346 def p_charge_strength_2(p
):
4347 '''charge_strength : '(' K_medium ')' '''
4349 print('charge_strength_2', list(p
))
4355 def p_charge_strength_3(p
):
4356 '''charge_strength : '(' K_large ')' '''
4358 print('charge_strength_3', list(p
))
4364 def p_charge_strength_opt_1(p
):
4365 '''charge_strength_opt : charge_strength '''
4367 print('charge_strength_opt_1', list(p
))
4373 def p_charge_strength_opt_2(p
):
4374 '''charge_strength_opt : '''
4376 print('charge_strength_opt_2', list(p
))
4382 def p_defparam_assign_1(p
):
4383 '''defparam_assign : hierarchy_identifier '=' expression '''
4385 print('defparam_assign_1', list(p
))
4387 # { pform_set_defparam(*p[1], p[3]);
4393 def p_defparam_assign_list_1(p
):
4394 '''defparam_assign_list : defparam_assign '''
4396 print('defparam_assign_list_1', list(p
))
4402 def p_defparam_assign_list_2(p
):
4403 '''defparam_assign_list : dimensions defparam_assign '''
4405 print('defparam_assign_list_2', list(p
))
4407 # { yyerror(@1, "error: defparam may not include a range.");
4413 def p_defparam_assign_list_3(p
):
4414 '''defparam_assign_list : defparam_assign_list ',' defparam_assign '''
4416 print('defparam_assign_list_3', list(p
))
4423 '''delay1 : '#' delay_value_simple '''
4425 print('delay1_1', list(p
))
4427 # { list<PExpr*>*tmp = new list<PExpr*>;
4428 # tmp->push_back(p[2]);
4435 '''delay1 : '#' '(' delay_value ')' '''
4437 print('delay1_2', list(p
))
4439 # { list<PExpr*>*tmp = new list<PExpr*>;
4440 # tmp->push_back(p[3]);
4447 '''delay3 : '#' delay_value_simple '''
4449 print('delay3_1', list(p
))
4451 # { list<PExpr*>*tmp = new list<PExpr*>;
4452 # tmp->push_back(p[2]);
4459 '''delay3 : '#' '(' delay_value ')' '''
4461 print('delay3_2', list(p
))
4463 # { list<PExpr*>*tmp = new list<PExpr*>;
4464 # tmp->push_back(p[3]);
4471 '''delay3 : '#' '(' delay_value ',' delay_value ')' '''
4473 print('delay3_3', list(p
))
4475 # { list<PExpr*>*tmp = new list<PExpr*>;
4476 # tmp->push_back(p[3]);
4477 # tmp->push_back(p[5]);
4484 '''delay3 : '#' '(' delay_value ',' delay_value ',' delay_value ')' '''
4486 print('delay3_4', list(p
))
4488 # { list<PExpr*>*tmp = new list<PExpr*>;
4489 # tmp->push_back(p[3]);
4490 # tmp->push_back(p[5]);
4491 # tmp->push_back(p[7]);
4497 def p_delay3_opt_1(p
):
4498 '''delay3_opt : delay3 '''
4500 print('delay3_opt_1', list(p
))
4507 def p_delay3_opt_2(p
):
4509 if(parse_debug
> 2):
4510 print('delay3_opt_2', list(p
))
4516 def p_delay_value_list_1(p
):
4517 '''delay_value_list : delay_value '''
4519 print('delay_value_list_1', list(p
))
4521 # { list<PExpr*>*tmp = new list<PExpr*>;
4522 # tmp->push_back(p[1]);
4528 def p_delay_value_list_2(p
):
4529 '''delay_value_list : delay_value_list ',' delay_value '''
4531 print('delay_value_list_2', list(p
))
4533 # { list<PExpr*>*tmp = p[1];
4534 # tmp->push_back(p[3]);
4540 def p_delay_value_1(p
):
4541 '''delay_value : expression '''
4543 print('delay_value_1', list(p
))
4545 # { PExpr*tmp = p[1];
4551 def p_delay_value_2(p
):
4552 '''delay_value : expression ':' expression ':' expression '''
4554 print('delay_value_2', list(p
))
4556 # { p[0] = pform_select_mtm_expr(p[1], p[3], p[5]); }
4560 def p_delay_value_simple_1(p
):
4561 '''delay_value_simple : DEC_NUMBER '''
4563 print('delay_value_simple_1', list(p
))
4565 # { verinum*tmp = p[1];
4567 # yyerror(@1, "internal error: delay.");
4570 # p[0] = new PENumber(tmp);
4571 # FILE_NAME(p[0], @1);
4578 def p_delay_value_simple_2(p
):
4579 '''delay_value_simple : REALTIME '''
4581 print('delay_value_simple_2', list(p
))
4583 # { verireal*tmp = p[1];
4585 # yyerror(@1, "internal error: delay.");
4588 # p[0] = new PEFNumber(tmp);
4589 # FILE_NAME(p[0], @1);
4595 def p_delay_value_simple_3(p
):
4596 '''delay_value_simple : IDENTIFIER '''
4598 print('delay_value_simple_3', list(p
))
4600 # { PEIdent*tmp = new PEIdent(lex_strings.make(p[1]));
4601 # FILE_NAME(tmp, @1);
4608 def p_delay_value_simple_4(p
):
4609 '''delay_value_simple : TIME_LITERAL '''
4611 print('delay_value_simple_4', list(p
))
4617 # if (p[1] == 0 || !get_time_unit(p[1], unit))
4618 # yyerror(@1, "internal error: delay.");
4620 # double p = pow(10.0,
4621 # (double)(unit - pform_get_timeunit()));
4622 # double time = atof(p[1]) * p;
4624 # verireal *v = new verireal(time);
4625 # p[0] = new PEFNumber(v);
4626 # FILE_NAME(p[0], @1);
4632 def p_optional_semicolon_1(p
):
4633 '''optional_semicolon : ';' '''
4635 print('optional_semicolon_1', list(p
))
4641 def p_optional_semicolon_2(p
):
4642 '''optional_semicolon : '''
4644 print('optional_semicolon_2', list(p
))
4650 def p_discipline_declaration_1(p
):
4651 '''discipline_declaration : K_discipline IDENTIFIER optional_semicolon _embed0_discipline_declaration discipline_items K_enddiscipline '''
4653 print('discipline_declaration_1', list(p
))
4655 # { pform_end_discipline(@1); delete[] p[2]; }
4659 def p__embed0_discipline_declaration(p
):
4660 '''_embed0_discipline_declaration : '''
4662 # { pform_start_discipline(p[2]); }
4666 def p_discipline_items_1(p
):
4667 '''discipline_items : discipline_items discipline_item '''
4669 print('discipline_items_1', list(p
))
4675 def p_discipline_items_2(p
):
4676 '''discipline_items : discipline_item '''
4678 print('discipline_items_2', list(p
))
4684 def p_discipline_item_1(p
):
4685 '''discipline_item : K_domain K_discrete ';' '''
4687 print('discipline_item_1', list(p
))
4689 # { pform_discipline_domain(@1, IVL_DIS_DISCRETE); }
4693 def p_discipline_item_2(p
):
4694 '''discipline_item : K_domain K_continuous ';' '''
4696 print('discipline_item_2', list(p
))
4698 # { pform_discipline_domain(@1, IVL_DIS_CONTINUOUS); }
4702 def p_discipline_item_3(p
):
4703 '''discipline_item : K_potential IDENTIFIER ';' '''
4705 print('discipline_item_3', list(p
))
4707 # { pform_discipline_potential(@1, p[2]); delete[] p[2]; }
4711 def p_discipline_item_4(p
):
4712 '''discipline_item : K_flow IDENTIFIER ';' '''
4714 print('discipline_item_4', list(p
))
4716 # { pform_discipline_flow(@1, p[2]); delete[] p[2]; }
4720 def p_nature_declaration_1(p
):
4721 '''nature_declaration : K_nature IDENTIFIER optional_semicolon _embed0_nature_declaration nature_items K_endnature '''
4723 print('nature_declaration_1', list(p
))
4725 # { pform_end_nature(@1); delete[] p[2]; }
4729 def p__embed0_nature_declaration(p
):
4730 '''_embed0_nature_declaration : '''
4732 # { pform_start_nature(p[2]); }
4736 def p_nature_items_1(p
):
4737 '''nature_items : nature_items nature_item '''
4739 print('nature_items_1', list(p
))
4745 def p_nature_items_2(p
):
4746 '''nature_items : nature_item '''
4748 print('nature_items_2', list(p
))
4754 def p_nature_item_1(p
):
4755 '''nature_item : K_units '=' STRING ';' '''
4757 print('nature_item_1', list(p
))
4759 # { delete[] p[3]; }
4763 def p_nature_item_2(p
):
4764 '''nature_item : K_abstol '=' expression ';' '''
4766 print('nature_item_2', list(p
))
4772 def p_nature_item_3(p
):
4773 '''nature_item : K_access '=' IDENTIFIER ';' '''
4775 print('nature_item_3', list(p
))
4777 # { pform_nature_access(@1, p[3]); delete[] p[3]; }
4781 def p_nature_item_4(p
):
4782 '''nature_item : K_idt_nature '=' IDENTIFIER ';' '''
4784 print('nature_item_4', list(p
))
4786 # { delete[] p[3]; }
4790 def p_nature_item_5(p
):
4791 '''nature_item : K_ddt_nature '=' IDENTIFIER ';' '''
4793 print('nature_item_5', list(p
))
4795 # { delete[] p[3]; }
4799 def p_config_declaration_1(p
):
4800 '''config_declaration : K_config IDENTIFIER ';' K_design lib_cell_identifiers ';' list_of_config_rule_statements K_endconfig '''
4802 print('config_declaration_1', list(p
))
4804 # { cerr << @1 << ": sorry: config declarations are not supported and "
4805 # "will be skipped." << endl;
4811 def p_lib_cell_identifiers_1(p
):
4812 '''lib_cell_identifiers : '''
4814 print('lib_cell_identifiers_1', list(p
))
4820 def p_lib_cell_identifiers_2(p
):
4821 '''lib_cell_identifiers : lib_cell_identifiers lib_cell_id '''
4823 print('lib_cell_identifiers_2', list(p
))
4829 def p_list_of_config_rule_statements_1(p
):
4830 '''list_of_config_rule_statements : '''
4832 print('list_of_config_rule_statements_1', list(p
))
4838 def p_list_of_config_rule_statements_2(p
):
4839 '''list_of_config_rule_statements : list_of_config_rule_statements config_rule_statement '''
4841 print('list_of_config_rule_statements_2', list(p
))
4847 def p_config_rule_statement_1(p
):
4848 '''config_rule_statement : K_default K_liblist list_of_libraries ';' '''
4850 print('config_rule_statement_1', list(p
))
4856 def p_config_rule_statement_2(p
):
4857 '''config_rule_statement : K_instance hierarchy_identifier K_liblist list_of_libraries ';' '''
4859 print('config_rule_statement_2', list(p
))
4865 def p_config_rule_statement_3(p
):
4866 '''config_rule_statement : K_instance hierarchy_identifier K_use lib_cell_id opt_config ';' '''
4868 print('config_rule_statement_3', list(p
))
4874 def p_config_rule_statement_4(p
):
4875 '''config_rule_statement : K_cell lib_cell_id K_liblist list_of_libraries ';' '''
4877 print('config_rule_statement_4', list(p
))
4883 def p_config_rule_statement_5(p
):
4884 '''config_rule_statement : K_cell lib_cell_id K_use lib_cell_id opt_config ';' '''
4886 print('config_rule_statement_5', list(p
))
4892 def p_opt_config_1(p
):
4895 print('opt_config_1', list(p
))
4901 def p_opt_config_2(p
):
4902 '''opt_config : ':' K_config '''
4904 print('opt_config_2', list(p
))
4910 def p_lib_cell_id_1(p
):
4911 '''lib_cell_id : IDENTIFIER '''
4913 print('lib_cell_id_1', list(p
))
4915 # { delete[] p[1]; }
4919 def p_lib_cell_id_2(p
):
4920 '''lib_cell_id : IDENTIFIER '.' IDENTIFIER '''
4922 print('lib_cell_id_2', list(p
))
4924 # { delete[] p[1]; delete[] p[3]; }
4928 def p_list_of_libraries_1(p
):
4929 '''list_of_libraries : '''
4931 print('list_of_libraries_1', list(p
))
4937 def p_list_of_libraries_2(p
):
4938 '''list_of_libraries : list_of_libraries IDENTIFIER '''
4940 print('list_of_libraries_2', list(p
))
4942 # { delete[] p[2]; }
4946 def p_drive_strength_1(p
):
4947 '''drive_strength : '(' dr_strength0 ',' dr_strength1 ')' '''
4949 print('drive_strength_1', list(p
))
4951 # { p[0].str0 = p[2].str0;
4952 # p[0].str1 = p[4].str1;
4957 def p_drive_strength_2(p
):
4958 '''drive_strength : '(' dr_strength1 ',' dr_strength0 ')' '''
4960 print('drive_strength_2', list(p
))
4962 # { p[0].str0 = p[4].str0;
4963 # p[0].str1 = p[2].str1;
4968 def p_drive_strength_3(p
):
4969 '''drive_strength : '(' dr_strength0 ',' K_highz1 ')' '''
4971 print('drive_strength_3', list(p
))
4973 # { p[0].str0 = p[2].str0;
4974 # p[0].str1 = IVL_DR_HiZ;
4979 def p_drive_strength_4(p
):
4980 '''drive_strength : '(' dr_strength1 ',' K_highz0 ')' '''
4982 print('drive_strength_4', list(p
))
4984 # { p[0].str0 = IVL_DR_HiZ;
4985 # p[0].str1 = p[2].str1;
4990 def p_drive_strength_5(p
):
4991 '''drive_strength : '(' K_highz1 ',' dr_strength0 ')' '''
4993 print('drive_strength_5', list(p
))
4995 # { p[0].str0 = p[4].str0;
4996 # p[0].str1 = IVL_DR_HiZ;
5001 def p_drive_strength_6(p
):
5002 '''drive_strength : '(' K_highz0 ',' dr_strength1 ')' '''
5004 print('drive_strength_6', list(p
))
5006 # { p[0].str0 = IVL_DR_HiZ;
5007 # p[0].str1 = p[4].str1;
5012 def p_drive_strength_opt_1(p
):
5013 '''drive_strength_opt : drive_strength '''
5015 print('drive_strength_opt_1', list(p
))
5022 def p_drive_strength_opt_2(p
):
5023 '''drive_strength_opt : '''
5024 if(parse_debug
> 2):
5025 print('drive_strength_opt_2', list(p
))
5027 # { p[0].str0 = IVL_DR_STRONG; p[0].str1 = IVL_DR_STRONG; }
5031 def p_dr_strength0_1(p
):
5032 '''dr_strength0 : K_supply0 '''
5034 print('dr_strength0_1', list(p
))
5036 # { p[0].str0 = IVL_DR_SUPPLY; }
5040 def p_dr_strength0_2(p
):
5041 '''dr_strength0 : K_strong0 '''
5043 print('dr_strength0_2', list(p
))
5045 # { p[0].str0 = IVL_DR_STRONG; }
5049 def p_dr_strength0_3(p
):
5050 '''dr_strength0 : K_pull0 '''
5052 print('dr_strength0_3', list(p
))
5054 # { p[0].str0 = IVL_DR_PULL; }
5058 def p_dr_strength0_4(p
):
5059 '''dr_strength0 : K_weak0 '''
5061 print('dr_strength0_4', list(p
))
5063 # { p[0].str0 = IVL_DR_WEAK; }
5067 def p_dr_strength1_1(p
):
5068 '''dr_strength1 : K_supply1 '''
5070 print('dr_strength1_1', list(p
))
5072 # { p[0].str1 = IVL_DR_SUPPLY; }
5076 def p_dr_strength1_2(p
):
5077 '''dr_strength1 : K_strong1 '''
5079 print('dr_strength1_2', list(p
))
5081 # { p[0].str1 = IVL_DR_STRONG; }
5085 def p_dr_strength1_3(p
):
5086 '''dr_strength1 : K_pull1 '''
5088 print('dr_strength1_3', list(p
))
5090 # { p[0].str1 = IVL_DR_PULL; }
5094 def p_dr_strength1_4(p
):
5095 '''dr_strength1 : K_weak1 '''
5097 print('dr_strength1_4', list(p
))
5099 # { p[0].str1 = IVL_DR_WEAK; }
5103 def p_clocking_event_opt_1(p
):
5104 '''clocking_event_opt : event_control '''
5106 print('clocking_event_opt_1', list(p
))
5112 def p_clocking_event_opt_2(p
):
5113 '''clocking_event_opt : '''
5115 print('clocking_event_opt_2', list(p
))
5121 def p_event_control_1(p
):
5122 '''event_control : '@' hierarchy_identifier '''
5124 print('event_control_1', list(p
))
5126 # { PEIdent*tmpi = new PEIdent(*p[2]);
5127 # PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi);
5128 # PEventStatement*tmps = new PEventStatement(tmpe);
5129 # FILE_NAME(tmps, @1);
5136 def p_event_control_2(p
):
5137 '''event_control : '@' '(' event_expression_list ')' '''
5139 print('event_control_2', list(p
))
5141 # { PEventStatement*tmp = new PEventStatement(*p[3]);
5142 # FILE_NAME(tmp, @1);
5149 def p_event_control_3(p
):
5150 '''event_control : '@' '(' error ')' '''
5152 print('event_control_3', list(p
))
5154 # { yyerror(@1, "error: Malformed event control expression.");
5160 def p_event_expression_list_1(p
):
5161 '''event_expression_list : event_expression '''
5163 print('event_expression_list_1', list(p
))
5170 def p_event_expression_list_2(p
):
5171 '''event_expression_list : event_expression_list K_or event_expression '''
5173 print('event_expression_list_2', list(p
))
5175 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
5183 def p_event_expression_list_3(p
):
5184 '''event_expression_list : event_expression_list ',' event_expression '''
5186 print('event_expression_list_3', list(p
))
5188 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
5196 def p_event_expression_1(p
):
5197 '''event_expression : K_posedge expression '''
5199 print('event_expression_1', list(p
))
5201 # { PEEvent*tmp = new PEEvent(PEEvent::POSEDGE, p[2]);
5202 # FILE_NAME(tmp, @1);
5203 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5210 def p_event_expression_2(p
):
5211 '''event_expression : K_negedge expression '''
5213 print('event_expression_2', list(p
))
5215 # { PEEvent*tmp = new PEEvent(PEEvent::NEGEDGE, p[2]);
5216 # FILE_NAME(tmp, @1);
5217 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5224 def p_event_expression_3(p
):
5225 '''event_expression : expression '''
5227 print('event_expression_3', list(p
))
5229 # { PEEvent*tmp = new PEEvent(PEEvent::ANYEDGE, p[1]);
5230 # FILE_NAME(tmp, @1);
5231 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5238 def p_branch_probe_expression_1(p
):
5239 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ',' IDENTIFIER ')' '''
5241 print('branch_probe_expression_1', list(p
))
5243 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3], p[5]); }
5247 def p_branch_probe_expression_2(p
):
5248 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ')' '''
5250 print('branch_probe_expression_2', list(p
))
5252 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3]); }
5256 def p_expression_1(p
):
5257 '''expression : expr_primary_or_typename '''
5258 if(parse_debug
> 2):
5259 print('expression_1', list(p
))
5266 def p_expression_2(p
):
5267 '''expression : inc_or_dec_expression '''
5269 print('expression_2', list(p
))
5276 def p_expression_3(p
):
5277 '''expression : inside_expression '''
5279 print('expression_3', list(p
))
5286 def p_expression_4(p
):
5287 '''expression : '+' attribute_list_opt expr_primary %prec UNARY_PREC '''
5289 print('expression_4', list(p
))
5296 def p_expression_5(p
):
5297 '''expression : '-' attribute_list_opt expr_primary %prec UNARY_PREC '''
5299 print('expression_5', list(p
))
5301 # { PEUnary*tmp = new PEUnary('-', p[3]);
5302 # FILE_NAME(tmp, @3);
5308 def p_expression_6(p
):
5309 '''expression : '~' attribute_list_opt expr_primary %prec UNARY_PREC '''
5311 print('expression_6', list(p
))
5313 # { PEUnary*tmp = new PEUnary('~', p[3]);
5314 # FILE_NAME(tmp, @3);
5320 def p_expression_7(p
):
5321 '''expression : '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
5323 print('expression_7', list(p
))
5325 # { PEUnary*tmp = new PEUnary('&', p[3]);
5326 # FILE_NAME(tmp, @3);
5332 def p_expression_8(p
):
5333 '''expression : '!' attribute_list_opt expr_primary %prec UNARY_PREC '''
5335 print('expression_8', list(p
))
5337 # { PEUnary*tmp = new PEUnary('!', p[3]);
5338 # FILE_NAME(tmp, @3);
5344 def p_expression_9(p
):
5345 '''expression : '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
5347 print('expression_9', list(p
))
5349 # { PEUnary*tmp = new PEUnary('|', p[3]);
5350 # FILE_NAME(tmp, @3);
5356 def p_expression_10(p
):
5357 '''expression : '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
5359 print('expression_10', list(p
))
5361 # { PEUnary*tmp = new PEUnary('^', p[3]);
5362 # FILE_NAME(tmp, @3);
5368 def p_expression_11(p
):
5369 '''expression : '~' '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
5371 print('expression_11', list(p
))
5373 # { yyerror(@1, "error: '~' '&' is not a valid expression. "
5374 # "Please use operator '~&' instead.");
5380 def p_expression_12(p
):
5381 '''expression : '~' '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
5383 print('expression_12', list(p
))
5385 # { yyerror(@1, "error: '~' '|' is not a valid expression. "
5386 # "Please use operator '~|' instead.");
5392 def p_expression_13(p
):
5393 '''expression : '~' '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
5395 print('expression_13', list(p
))
5397 # { yyerror(@1, "error: '~' '^' is not a valid expression. "
5398 # "Please use operator '~^' instead.");
5404 def p_expression_14(p
):
5405 '''expression : K_NAND attribute_list_opt expr_primary %prec UNARY_PREC '''
5407 print('expression_14', list(p
))
5409 # { PEUnary*tmp = new PEUnary('A', p[3]);
5410 # FILE_NAME(tmp, @3);
5416 def p_expression_15(p
):
5417 '''expression : K_NOR attribute_list_opt expr_primary %prec UNARY_PREC '''
5419 print('expression_15', list(p
))
5421 # { PEUnary*tmp = new PEUnary('N', p[3]);
5422 # FILE_NAME(tmp, @3);
5428 def p_expression_16(p
):
5429 '''expression : K_NXOR attribute_list_opt expr_primary %prec UNARY_PREC '''
5431 print('expression_16', list(p
))
5433 # { PEUnary*tmp = new PEUnary('X', p[3]);
5434 # FILE_NAME(tmp, @3);
5440 def p_expression_17(p
):
5441 '''expression : '!' error %prec UNARY_PREC '''
5443 print('expression_17', list(p
))
5445 # { yyerror(@1, "error: Operand of unary ! "
5446 # "is not a primary expression.");
5452 def p_expression_18(p
):
5453 '''expression : '^' error %prec UNARY_PREC '''
5455 print('expression_18', list(p
))
5457 # { yyerror(@1, "error: Operand of reduction ^ "
5458 # "is not a primary expression.");
5464 def p_expression_19(p
):
5465 '''expression : expression '^' attribute_list_opt expression '''
5467 print('expression_19', list(p
))
5469 # { PEBinary*tmp = new PEBinary('^', p[1], p[4]);
5470 # FILE_NAME(tmp, @2);
5476 def p_expression_20(p
):
5477 '''expression : expression K_POW attribute_list_opt expression '''
5479 print('expression_20', list(p
))
5481 # { PEBinary*tmp = new PEBPower('p', p[1], p[4]);
5482 # FILE_NAME(tmp, @2);
5488 def p_expression_21(p
):
5489 '''expression : expression '*' attribute_list_opt expression '''
5491 print('expression_21', list(p
))
5493 # { PEBinary*tmp = new PEBinary('*', p[1], p[4]);
5494 # FILE_NAME(tmp, @2);
5500 def p_expression_22(p
):
5501 '''expression : expression '/' attribute_list_opt expression '''
5503 print('expression_22', list(p
))
5505 # { PEBinary*tmp = new PEBinary('/', p[1], p[4]);
5506 # FILE_NAME(tmp, @2);
5512 def p_expression_23(p
):
5513 '''expression : expression '%' attribute_list_opt expression '''
5515 print('expression_23', list(p
))
5517 # { PEBinary*tmp = new PEBinary('%', p[1], p[4]);
5518 # FILE_NAME(tmp, @2);
5524 def p_expression_24(p
):
5525 '''expression : expression '+' attribute_list_opt expression '''
5527 print('expression_24', list(p
))
5529 # { PEBinary*tmp = new PEBinary('+', p[1], p[4]);
5530 # FILE_NAME(tmp, @2);
5536 def p_expression_25(p
):
5537 '''expression : expression '-' attribute_list_opt expression '''
5539 print('expression_25', list(p
))
5540 # { PEBinary*tmp = new PEBinary('-', p[1], p[4]);
5541 # FILE_NAME(tmp, @2);
5545 p
[0] = Node(syms
.atom
, [p
[1], Leaf(token
.MINUS
, '-'), p
[4]])
5547 p
[0] = "bad input in p_expression_25"
5553 def p_expression_26(p
):
5554 '''expression : expression '&' attribute_list_opt expression '''
5556 print('expression_26', list(p
))
5558 # { PEBinary*tmp = new PEBinary('&', p[1], p[4]);
5559 # FILE_NAME(tmp, @2);
5565 def p_expression_27(p
):
5566 '''expression : expression '|' attribute_list_opt expression '''
5568 print('expression_27', list(p
))
5570 # { PEBinary*tmp = new PEBinary('|', p[1], p[4]);
5571 # FILE_NAME(tmp, @2);
5577 def p_expression_28(p
):
5578 '''expression : expression K_NAND attribute_list_opt expression '''
5580 print('expression_28', list(p
))
5582 # { PEBinary*tmp = new PEBinary('A', p[1], p[4]);
5583 # FILE_NAME(tmp, @2);
5589 def p_expression_29(p
):
5590 '''expression : expression K_NOR attribute_list_opt expression '''
5592 print('expression_29', list(p
))
5594 # { PEBinary*tmp = new PEBinary('O', p[1], p[4]);
5595 # FILE_NAME(tmp, @2);
5601 def p_expression_30(p
):
5602 '''expression : expression K_NXOR attribute_list_opt expression '''
5604 print('expression_30', list(p
))
5606 # { PEBinary*tmp = new PEBinary('X', p[1], p[4]);
5607 # FILE_NAME(tmp, @2);
5613 def p_expression_31(p
):
5614 '''expression : expression '<' attribute_list_opt expression '''
5616 print('expression_31', list(p
))
5618 # { PEBinary*tmp = new PEBComp('<', p[1], p[4]);
5619 # FILE_NAME(tmp, @2);
5625 def p_expression_32(p
):
5626 '''expression : expression '>' attribute_list_opt expression '''
5628 print('expression_32', list(p
))
5630 # { PEBinary*tmp = new PEBComp('>', p[1], p[4]);
5631 # FILE_NAME(tmp, @2);
5637 def p_expression_33(p
):
5638 '''expression : expression K_LS attribute_list_opt expression '''
5640 print('expression_33', list(p
))
5642 # { PEBinary*tmp = new PEBShift('l', p[1], p[4]);
5643 # FILE_NAME(tmp, @2);
5649 def p_expression_34(p
):
5650 '''expression : expression K_RS attribute_list_opt expression '''
5652 print('expression_34', list(p
))
5654 # { PEBinary*tmp = new PEBShift('r', p[1], p[4]);
5655 # FILE_NAME(tmp, @2);
5661 def p_expression_35(p
):
5662 '''expression : expression K_RSS attribute_list_opt expression '''
5664 print('expression_35', list(p
))
5666 # { PEBinary*tmp = new PEBShift('R', p[1], p[4]);
5667 # FILE_NAME(tmp, @2);
5673 def p_expression_36(p
):
5674 '''expression : expression K_EQ attribute_list_opt expression '''
5676 print('expression_36', list(p
))
5678 # { PEBinary*tmp = new PEBComp('e', p[1], p[4]);
5679 # FILE_NAME(tmp, @2);
5685 def p_expression_37(p
):
5686 '''expression : expression K_CEQ attribute_list_opt expression '''
5688 print('expression_37', list(p
))
5690 # { PEBinary*tmp = new PEBComp('E', p[1], p[4]);
5691 # FILE_NAME(tmp, @2);
5697 def p_expression_38(p
):
5698 '''expression : expression K_WEQ attribute_list_opt expression '''
5700 print('expression_38', list(p
))
5702 # { PEBinary*tmp = new PEBComp('w', p[1], p[4]);
5703 # FILE_NAME(tmp, @2);
5709 def p_expression_39(p
):
5710 '''expression : expression K_LE attribute_list_opt expression '''
5712 print('expression_39', list(p
))
5714 # { PEBinary*tmp = new PEBComp('L', p[1], p[4]);
5715 # FILE_NAME(tmp, @2);
5721 def p_expression_40(p
):
5722 '''expression : expression K_GE attribute_list_opt expression '''
5724 print('expression_40', list(p
))
5726 # { PEBinary*tmp = new PEBComp('G', p[1], p[4]);
5727 # FILE_NAME(tmp, @2);
5733 def p_expression_41(p
):
5734 '''expression : expression K_NE attribute_list_opt expression '''
5736 print('expression_41', list(p
))
5738 # { PEBinary*tmp = new PEBComp('n', p[1], p[4]);
5739 # FILE_NAME(tmp, @2);
5745 def p_expression_42(p
):
5746 '''expression : expression K_CNE attribute_list_opt expression '''
5748 print('expression_42', list(p
))
5750 # { PEBinary*tmp = new PEBComp('N', p[1], p[4]);
5751 # FILE_NAME(tmp, @2);
5757 def p_expression_43(p
):
5758 '''expression : expression K_WNE attribute_list_opt expression '''
5760 print('expression_43', list(p
))
5762 # { PEBinary*tmp = new PEBComp('W', p[1], p[4]);
5763 # FILE_NAME(tmp, @2);
5769 def p_expression_44(p
):
5770 '''expression : expression K_LOR attribute_list_opt expression '''
5772 print('expression_44', list(p
))
5774 # { PEBinary*tmp = new PEBLogic('o', p[1], p[4]);
5775 # FILE_NAME(tmp, @2);
5781 def p_expression_45(p
):
5782 '''expression : expression K_LAND attribute_list_opt expression '''
5784 print('expression_45', list(p
))
5786 # { PEBinary*tmp = new PEBLogic('a', p[1], p[4]);
5787 # FILE_NAME(tmp, @2);
5793 def p_expression_46(p
):
5794 '''expression : expression '?' attribute_list_opt expression ':' expression '''
5796 print('expression_46', list(p
))
5798 # { PETernary*tmp = new PETernary(p[1], p[4], p[6]);
5799 # FILE_NAME(tmp, @2);
5805 def p_expr_mintypmax_1(p
):
5806 '''expr_mintypmax : expression '''
5808 print('expr_mintypmax_1', list(p
))
5815 def p_expr_mintypmax_2(p
):
5816 '''expr_mintypmax : expression ':' expression ':' expression '''
5818 print('expr_mintypmax_2', list(p
))
5820 # { switch (min_typ_max_flag) {
5837 # if (min_typ_max_warn > 0) {
5838 # cerr << p[0]->get_fileline() << ": warning: choosing ";
5839 # switch (min_typ_max_flag) {
5850 # cerr << " expression." << endl;
5851 # min_typ_max_warn -= 1;
5857 def p_expression_list_with_nuls_1(p
):
5858 '''expression_list_with_nuls : expression_list_with_nuls ',' expression '''
5860 print('expression_list_with_nuls_1', list(p
))
5862 # { list<PExpr*>*tmp = p[1];
5863 # tmp->push_back(p[3]);
5869 def p_expression_list_with_nuls_2(p
):
5870 '''expression_list_with_nuls : expression '''
5872 print('expression_list_with_nuls_2', list(p
))
5874 # { list<PExpr*>*tmp = new list<PExpr*>;
5875 # tmp->push_back(p[1]);
5881 def p_expression_list_with_nuls_3(p
):
5882 '''expression_list_with_nuls : '''
5884 print('expression_list_with_nuls_3', list(p
))
5886 # { list<PExpr*>*tmp = new list<PExpr*>;
5887 # tmp->push_back(0);
5893 def p_expression_list_with_nuls_4(p
):
5894 '''expression_list_with_nuls : expression_list_with_nuls ',' '''
5896 print('expression_list_with_nuls_4', list(p
))
5898 # { list<PExpr*>*tmp = p[1];
5899 # tmp->push_back(0);
5905 def p_expression_list_proper_1(p
):
5906 '''expression_list_proper : expression_list_proper ',' expression '''
5908 print('expression_list_proper_1', list(p
))
5910 # { list<PExpr*>*tmp = p[1];
5911 # tmp->push_back(p[3]);
5917 def p_expression_list_proper_2(p
):
5918 '''expression_list_proper : expression '''
5920 print('expression_list_proper_2', list(p
))
5922 # { list<PExpr*>*tmp = new list<PExpr*>;
5923 # tmp->push_back(p[1]);
5929 def p_expr_primary_or_typename_1(p
):
5930 '''expr_primary_or_typename : expr_primary '''
5931 if(parse_debug
> 2):
5932 print('expr_primary_or_typename_1', list(p
))
5939 def p_expr_primary_or_typename_2(p
):
5940 '''expr_primary_or_typename : TYPE_IDENTIFIER '''
5942 print('expr_primary_or_typename_2', list(p
))
5945 # { PETypename*tmp = new PETypename(p[1].type);
5946 # FILE_NAME(tmp,@1);
5948 # delete[]p[1].text;
5953 def p_expr_primary_1(p
):
5954 '''expr_primary : number '''
5956 print('expr_primary_1', list(p
))
5960 # PENumber*tmp = new PENumber(p[1]);
5961 # FILE_NAME(tmp, @1);
5967 def p_expr_primary_2(p
):
5968 '''expr_primary : REALTIME '''
5970 print('expr_primary_2', list(p
))
5972 # { PEFNumber*tmp = new PEFNumber(p[1]);
5973 # FILE_NAME(tmp, @1);
5979 def p_expr_primary_3(p
):
5980 '''expr_primary : STRING '''
5982 print('expr_primary_3', list(p
))
5984 # { PEString*tmp = new PEString(p[1]);
5985 # FILE_NAME(tmp, @1);
5991 def p_expr_primary_4(p
):
5992 '''expr_primary : TIME_LITERAL '''
5994 print('expr_primary_4', list(p
))
6000 # if (p[1] == 0 || !get_time_unit(p[1], unit))
6001 # yyerror(@1, "internal error: delay.");
6003 # double p = pow(10.0, (double)(unit - pform_get_timeunit()));
6004 # double time = atof(p[1]) * p;
6006 # verireal *v = new verireal(time);
6007 # p[0] = new PEFNumber(v);
6008 # FILE_NAME(p[0], @1);
6014 def p_expr_primary_5(p
):
6015 '''expr_primary : SYSTEM_IDENTIFIER '''
6017 print('expr_primary_5', list(p
))
6019 # { perm_string tn = lex_strings.make(p[1]);
6020 # PECallFunction*tmp = new PECallFunction(tn);
6021 # FILE_NAME(tmp, @1);
6028 def p_expr_primary_6(p
):
6029 '''expr_primary : hierarchy_identifier '''
6030 if(parse_debug
> 2):
6031 print('expr_primary_6', list(p
))
6034 # { PEIdent*tmp = pform_new_ident(*p[1]);
6035 # FILE_NAME(tmp, @1);
6042 def p_expr_primary_7(p
):
6043 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier '''
6045 print('expr_primary_7', list(p
))
6047 # { p[0] = pform_package_ident(@2, p[1], p[3]);
6053 def p_expr_primary_8(p
):
6054 '''expr_primary : hierarchy_identifier '(' expression_list_with_nuls ')' '''
6056 print('expr_primary_8', list(p
))
6058 # { list<PExpr*>*expr_list = p[3];
6059 # strip_tail_items(expr_list);
6060 # PECallFunction*tmp = pform_make_call_function(@1, *p[1], *expr_list);
6067 def p_expr_primary_9(p
):
6068 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' '''
6070 print('expr_primary_9', list(p
))
6072 # { pform_name_t*t_name = p[1];
6073 # while (! p[3]->empty()) {
6074 # t_name->push_back(p[3]->front());
6075 # p[3]->pop_front();
6077 # list<PExpr*>*expr_list = p[5];
6078 # strip_tail_items(expr_list);
6079 # PECallFunction*tmp = pform_make_call_function(@1, *t_name, *expr_list);
6087 def p_expr_primary_10(p
):
6088 '''expr_primary : SYSTEM_IDENTIFIER '(' expression_list_proper ')' '''
6090 print('expr_primary_10', list(p
))
6092 # { perm_string tn = lex_strings.make(p[1]);
6093 # PECallFunction*tmp = new PECallFunction(tn, *p[3]);
6094 # FILE_NAME(tmp, @1);
6101 def p_expr_primary_11(p
):
6102 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')' '''
6104 print('expr_primary_11', list(p
))
6106 # { perm_string use_name = lex_strings.make(p[3]);
6107 # PECallFunction*tmp = new PECallFunction(p[1], use_name, *p[5]);
6108 # FILE_NAME(tmp, @3);
6115 def p_expr_primary_12(p
):
6116 '''expr_primary : SYSTEM_IDENTIFIER '(' ')' '''
6118 print('expr_primary_12', list(p
))
6120 # { perm_string tn = lex_strings.make(p[1]);
6121 # const vector<PExpr*>empty;
6122 # PECallFunction*tmp = new PECallFunction(tn, empty);
6123 # FILE_NAME(tmp, @1);
6126 # if (!gn_system_verilog()) {
6127 # yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
6133 def p_expr_primary_13(p
):
6134 '''expr_primary : implicit_class_handle '''
6136 print('expr_primary_13', list(p
))
6138 # { PEIdent*tmp = new PEIdent(*p[1]);
6139 # FILE_NAME(tmp,@1);
6146 def p_expr_primary_14(p
):
6147 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '''
6149 print('expr_primary_14', list(p
))
6151 # { pform_name_t*t_name = p[1];
6152 # while (! p[3]->empty()) {
6153 # t_name->push_back(p[3]->front());
6154 # p[3]->pop_front();
6156 # PEIdent*tmp = new PEIdent(*t_name);
6157 # FILE_NAME(tmp,@1);
6165 def p_expr_primary_15(p
):
6166 '''expr_primary : K_acos '(' expression ')' '''
6168 print('expr_primary_15', list(p
))
6170 # { perm_string tn = perm_string::literal("$acos");
6171 # PECallFunction*tmp = make_call_function(tn, p[3]);
6172 # FILE_NAME(tmp,@1);
6178 def p_expr_primary_16(p
):
6179 '''expr_primary : K_acosh '(' expression ')' '''
6181 print('expr_primary_16', list(p
))
6183 # { perm_string tn = perm_string::literal("$acosh");
6184 # PECallFunction*tmp = make_call_function(tn, p[3]);
6185 # FILE_NAME(tmp,@1);
6191 def p_expr_primary_17(p
):
6192 '''expr_primary : K_asin '(' expression ')' '''
6194 print('expr_primary_17', list(p
))
6196 # { perm_string tn = perm_string::literal("$asin");
6197 # PECallFunction*tmp = make_call_function(tn, p[3]);
6198 # FILE_NAME(tmp,@1);
6204 def p_expr_primary_18(p
):
6205 '''expr_primary : K_asinh '(' expression ')' '''
6207 print('expr_primary_18', list(p
))
6209 # { perm_string tn = perm_string::literal("$asinh");
6210 # PECallFunction*tmp = make_call_function(tn, p[3]);
6211 # FILE_NAME(tmp,@1);
6217 def p_expr_primary_19(p
):
6218 '''expr_primary : K_atan '(' expression ')' '''
6220 print('expr_primary_19', list(p
))
6222 # { perm_string tn = perm_string::literal("$atan");
6223 # PECallFunction*tmp = make_call_function(tn, p[3]);
6224 # FILE_NAME(tmp,@1);
6230 def p_expr_primary_20(p
):
6231 '''expr_primary : K_atanh '(' expression ')' '''
6233 print('expr_primary_20', list(p
))
6235 # { perm_string tn = perm_string::literal("$atanh");
6236 # PECallFunction*tmp = make_call_function(tn, p[3]);
6237 # FILE_NAME(tmp,@1);
6243 def p_expr_primary_21(p
):
6244 '''expr_primary : K_atan2 '(' expression ',' expression ')' '''
6246 print('expr_primary_21', list(p
))
6248 # { perm_string tn = perm_string::literal("$atan2");
6249 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6250 # FILE_NAME(tmp,@1);
6256 def p_expr_primary_22(p
):
6257 '''expr_primary : K_ceil '(' expression ')' '''
6259 print('expr_primary_22', list(p
))
6261 # { perm_string tn = perm_string::literal("$ceil");
6262 # PECallFunction*tmp = make_call_function(tn, p[3]);
6263 # FILE_NAME(tmp,@1);
6269 def p_expr_primary_23(p
):
6270 '''expr_primary : K_cos '(' expression ')' '''
6272 print('expr_primary_23', list(p
))
6274 # { perm_string tn = perm_string::literal("$cos");
6275 # PECallFunction*tmp = make_call_function(tn, p[3]);
6276 # FILE_NAME(tmp,@1);
6282 def p_expr_primary_24(p
):
6283 '''expr_primary : K_cosh '(' expression ')' '''
6285 print('expr_primary_24', list(p
))
6287 # { perm_string tn = perm_string::literal("$cosh");
6288 # PECallFunction*tmp = make_call_function(tn, p[3]);
6289 # FILE_NAME(tmp,@1);
6295 def p_expr_primary_25(p
):
6296 '''expr_primary : K_exp '(' expression ')' '''
6298 print('expr_primary_25', list(p
))
6300 # { perm_string tn = perm_string::literal("$exp");
6301 # PECallFunction*tmp = make_call_function(tn, p[3]);
6302 # FILE_NAME(tmp,@1);
6308 def p_expr_primary_26(p
):
6309 '''expr_primary : K_floor '(' expression ')' '''
6311 print('expr_primary_26', list(p
))
6313 # { perm_string tn = perm_string::literal("$floor");
6314 # PECallFunction*tmp = make_call_function(tn, p[3]);
6315 # FILE_NAME(tmp,@1);
6321 def p_expr_primary_27(p
):
6322 '''expr_primary : K_hypot '(' expression ',' expression ')' '''
6324 print('expr_primary_27', list(p
))
6326 # { perm_string tn = perm_string::literal("$hypot");
6327 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6328 # FILE_NAME(tmp,@1);
6334 def p_expr_primary_28(p
):
6335 '''expr_primary : K_ln '(' expression ')' '''
6337 print('expr_primary_28', list(p
))
6339 # { perm_string tn = perm_string::literal("$ln");
6340 # PECallFunction*tmp = make_call_function(tn, p[3]);
6341 # FILE_NAME(tmp,@1);
6347 def p_expr_primary_29(p
):
6348 '''expr_primary : K_log '(' expression ')' '''
6350 print('expr_primary_29', list(p
))
6352 # { perm_string tn = perm_string::literal("$log10");
6353 # PECallFunction*tmp = make_call_function(tn, p[3]);
6354 # FILE_NAME(tmp,@1);
6360 def p_expr_primary_30(p
):
6361 '''expr_primary : K_pow '(' expression ',' expression ')' '''
6363 print('expr_primary_30', list(p
))
6365 # { perm_string tn = perm_string::literal("$pow");
6366 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6367 # FILE_NAME(tmp,@1);
6373 def p_expr_primary_31(p
):
6374 '''expr_primary : K_sin '(' expression ')' '''
6376 print('expr_primary_31', list(p
))
6378 # { perm_string tn = perm_string::literal("$sin");
6379 # PECallFunction*tmp = make_call_function(tn, p[3]);
6380 # FILE_NAME(tmp,@1);
6386 def p_expr_primary_32(p
):
6387 '''expr_primary : K_sinh '(' expression ')' '''
6389 print('expr_primary_32', list(p
))
6391 # { perm_string tn = perm_string::literal("$sinh");
6392 # PECallFunction*tmp = make_call_function(tn, p[3]);
6393 # FILE_NAME(tmp,@1);
6399 def p_expr_primary_33(p
):
6400 '''expr_primary : K_sqrt '(' expression ')' '''
6402 print('expr_primary_33', list(p
))
6404 # { perm_string tn = perm_string::literal("$sqrt");
6405 # PECallFunction*tmp = make_call_function(tn, p[3]);
6406 # FILE_NAME(tmp,@1);
6412 def p_expr_primary_34(p
):
6413 '''expr_primary : K_tan '(' expression ')' '''
6415 print('expr_primary_34', list(p
))
6417 # { perm_string tn = perm_string::literal("$tan");
6418 # PECallFunction*tmp = make_call_function(tn, p[3]);
6419 # FILE_NAME(tmp,@1);
6425 def p_expr_primary_35(p
):
6426 '''expr_primary : K_tanh '(' expression ')' '''
6428 print('expr_primary_35', list(p
))
6430 # { perm_string tn = perm_string::literal("$tanh");
6431 # PECallFunction*tmp = make_call_function(tn, p[3]);
6432 # FILE_NAME(tmp,@1);
6438 def p_expr_primary_36(p
):
6439 '''expr_primary : K_abs '(' expression ')' '''
6441 print('expr_primary_36', list(p
))
6443 # { PEUnary*tmp = new PEUnary('m', p[3]);
6444 # FILE_NAME(tmp,@1);
6450 def p_expr_primary_37(p
):
6451 '''expr_primary : K_max '(' expression ',' expression ')' '''
6453 print('expr_primary_37', list(p
))
6455 # { PEBinary*tmp = new PEBinary('M', p[3], p[5]);
6456 # FILE_NAME(tmp,@1);
6462 def p_expr_primary_38(p
):
6463 '''expr_primary : K_min '(' expression ',' expression ')' '''
6465 print('expr_primary_38', list(p
))
6467 # { PEBinary*tmp = new PEBinary('m', p[3], p[5]);
6468 # FILE_NAME(tmp,@1);
6474 def p_expr_primary_39(p
):
6475 '''expr_primary : '(' expr_mintypmax ')' '''
6477 print('expr_primary_39', list(p
))
6484 def p_expr_primary_40(p
):
6485 '''expr_primary : '{' expression_list_proper '}' '''
6487 print('expr_primary_40', list(p
))
6489 # { PEConcat*tmp = new PEConcat(*p[2]);
6490 # FILE_NAME(tmp, @1);
6497 def p_expr_primary_41(p
):
6498 '''expr_primary : '{' expression '{' expression_list_proper '}' '}' '''
6500 print('expr_primary_41', list(p
))
6502 # { PExpr*rep = p[2];
6503 # PEConcat*tmp = new PEConcat(*p[4], rep);
6504 # FILE_NAME(tmp, @1);
6511 def p_expr_primary_42(p
):
6512 '''expr_primary : '{' expression '{' expression_list_proper '}' error '}' '''
6514 print('expr_primary_42', list(p
))
6516 # { PExpr*rep = p[2];
6517 # PEConcat*tmp = new PEConcat(*p[4], rep);
6518 # FILE_NAME(tmp, @1);
6521 # yyerror(@5, "error: Syntax error between internal '}' "
6522 # "and closing '}' of repeat concatenation.");
6528 def p_expr_primary_43(p
):
6529 '''expr_primary : '{' '}' '''
6531 print('expr_primary_43', list(p
))
6533 # { // This is the empty queue syntax.
6534 # if (gn_system_verilog()) {
6535 # list<PExpr*> empty_list;
6536 # PEConcat*tmp = new PEConcat(empty_list);
6537 # FILE_NAME(tmp, @1);
6540 # yyerror(@1, "error: Concatenations are not allowed to be empty.");
6547 def p_expr_primary_44(p
):
6548 '''expr_primary : expr_primary "'" '(' expression ')' '''
6550 print('expr_primary_44', list(p
))
6552 # { PExpr*base = p[4];
6553 # if (gn_system_verilog()) {
6554 # PECastSize*tmp = new PECastSize(p[1], base);
6555 # FILE_NAME(tmp, @1);
6558 # yyerror(@1, "error: Size cast requires SystemVerilog.");
6565 def p_expr_primary_45(p
):
6566 '''expr_primary : simple_type_or_string "'" '(' expression ')' '''
6568 print('expr_primary_45', list(p
))
6570 # { PExpr*base = p[4];
6571 # if (gn_system_verilog()) {
6572 # PECastType*tmp = new PECastType(p[1], base);
6573 # FILE_NAME(tmp, @1);
6576 # yyerror(@1, "error: Type cast requires SystemVerilog.");
6583 def p_expr_primary_46(p
):
6584 '''expr_primary : assignment_pattern '''
6586 print('expr_primary_46', list(p
))
6593 def p_expr_primary_47(p
):
6594 '''expr_primary : streaming_concatenation '''
6596 print('expr_primary_47', list(p
))
6603 def p_expr_primary_48(p
):
6604 '''expr_primary : K_null '''
6606 print('expr_primary_48', list(p
))
6608 # { PENull*tmp = new PENull;
6609 # FILE_NAME(tmp, @1);
6615 def p_function_item_list_opt_1(p
):
6616 '''function_item_list_opt : function_item_list '''
6618 print('function_item_list_opt_1', list(p
))
6625 def p_function_item_list_opt_2(p
):
6626 '''function_item_list_opt : '''
6628 print('function_item_list_opt_2', list(p
))
6634 def p_function_item_list_1(p
):
6635 '''function_item_list : function_item '''
6637 print('function_item_list_1', list(p
))
6644 def p_function_item_list_2(p
):
6645 '''function_item_list : function_item_list function_item '''
6647 print('function_item_list_2', list(p
))
6650 # if (p[1] && p[2]) {
6651 # vector<pform_tf_port_t>*tmp = p[1];
6652 # size_t s1 = tmp->size();
6653 # tmp->resize(s1 + p[2]->size());
6654 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
6655 # tmp->at(s1+idx) = p[2]->at(idx);
6658 # } else if (p[1]) {
6667 def p_function_item_1(p
):
6668 '''function_item : tf_port_declaration '''
6670 print('function_item_1', list(p
))
6677 def p_function_item_2(p
):
6678 '''function_item : block_item_decl '''
6680 print('function_item_2', list(p
))
6686 def p_gate_instance_1(p
):
6687 '''gate_instance : IDENTIFIER '(' expression_list_with_nuls ')' '''
6689 print('gate_instance_1', list(p
))
6691 # { lgate*tmp = new lgate;
6693 # tmp->parms = p[3];
6694 # tmp->file = @1.text;
6695 # tmp->lineno = @1.first_line;
6702 def p_gate_instance_2(p
):
6703 '''gate_instance : IDENTIFIER dimensions '(' expression_list_with_nuls ')' '''
6705 print('gate_instance_2', list(p
))
6707 # { lgate*tmp = new lgate;
6708 # list<pform_range_t>*rng = p[2];
6710 # tmp->parms = p[4];
6711 # tmp->range = rng->front();
6713 # assert(rng->empty());
6714 # tmp->file = @1.text;
6715 # tmp->lineno = @1.first_line;
6723 def p_gate_instance_3(p
):
6724 '''gate_instance : '(' expression_list_with_nuls ')' '''
6726 print('gate_instance_3', list(p
))
6728 # { lgate*tmp = new lgate;
6730 # tmp->parms = p[2];
6731 # tmp->file = @1.text;
6732 # tmp->lineno = @1.first_line;
6738 def p_gate_instance_4(p
):
6739 '''gate_instance : IDENTIFIER dimensions '''
6741 print('gate_instance_4', list(p
))
6743 # { lgate*tmp = new lgate;
6744 # list<pform_range_t>*rng = p[2];
6747 # tmp->parms_by_name = 0;
6748 # tmp->range = rng->front();
6750 # assert(rng->empty());
6751 # tmp->file = @1.text;
6752 # tmp->lineno = @1.first_line;
6760 def p_gate_instance_5(p
):
6761 '''gate_instance : IDENTIFIER '(' port_name_list ')' '''
6763 print('gate_instance_5', list(p
))
6765 # { lgate*tmp = new lgate;
6768 # tmp->parms_by_name = p[3];
6769 # tmp->file = @1.text;
6770 # tmp->lineno = @1.first_line;
6777 def p_gate_instance_6(p
):
6778 '''gate_instance : IDENTIFIER dimensions '(' port_name_list ')' '''
6780 print('gate_instance_6', list(p
))
6782 # { lgate*tmp = new lgate;
6783 # list<pform_range_t>*rng = p[2];
6786 # tmp->parms_by_name = p[4];
6787 # tmp->range = rng->front();
6789 # assert(rng->empty());
6790 # tmp->file = @1.text;
6791 # tmp->lineno = @1.first_line;
6799 def p_gate_instance_7(p
):
6800 '''gate_instance : IDENTIFIER '(' error ')' '''
6802 print('gate_instance_7', list(p
))
6804 # { lgate*tmp = new lgate;
6807 # tmp->parms_by_name = 0;
6808 # tmp->file = @1.text;
6809 # tmp->lineno = @1.first_line;
6810 # yyerror(@2, "error: Syntax error in instance port "
6811 # "expression(s).");
6818 def p_gate_instance_8(p
):
6819 '''gate_instance : IDENTIFIER dimensions '(' error ')' '''
6821 print('gate_instance_8', list(p
))
6823 # { lgate*tmp = new lgate;
6826 # tmp->parms_by_name = 0;
6827 # tmp->file = @1.text;
6828 # tmp->lineno = @1.first_line;
6829 # yyerror(@3, "error: Syntax error in instance port "
6830 # "expression(s).");
6837 def p_gate_instance_list_1(p
):
6838 '''gate_instance_list : gate_instance_list ',' gate_instance '''
6840 print('gate_instance_list_1', list(p
))
6842 # { svector<lgate>*tmp1 = p[1];
6843 # lgate*tmp2 = p[3];
6844 # svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
6852 def p_gate_instance_list_2(p
):
6853 '''gate_instance_list : gate_instance '''
6855 print('gate_instance_list_2', list(p
))
6857 # { svector<lgate>*tmp = new svector<lgate>(1);
6858 # (*tmp)[0] = *p[1];
6865 def p_gatetype_1(p
):
6866 '''gatetype : K_and '''
6868 print('gatetype_1', list(p
))
6870 # { p[0] = PGBuiltin::AND; }
6874 def p_gatetype_2(p
):
6875 '''gatetype : K_nand '''
6877 print('gatetype_2', list(p
))
6879 # { p[0] = PGBuiltin::NAND; }
6883 def p_gatetype_3(p
):
6884 '''gatetype : K_or '''
6886 print('gatetype_3', list(p
))
6888 # { p[0] = PGBuiltin::OR; }
6892 def p_gatetype_4(p
):
6893 '''gatetype : K_nor '''
6895 print('gatetype_4', list(p
))
6897 # { p[0] = PGBuiltin::NOR; }
6901 def p_gatetype_5(p
):
6902 '''gatetype : K_xor '''
6904 print('gatetype_5', list(p
))
6906 # { p[0] = PGBuiltin::XOR; }
6910 def p_gatetype_6(p
):
6911 '''gatetype : K_xnor '''
6913 print('gatetype_6', list(p
))
6915 # { p[0] = PGBuiltin::XNOR; }
6919 def p_gatetype_7(p
):
6920 '''gatetype : K_buf '''
6922 print('gatetype_7', list(p
))
6924 # { p[0] = PGBuiltin::BUF; }
6928 def p_gatetype_8(p
):
6929 '''gatetype : K_bufif0 '''
6931 print('gatetype_8', list(p
))
6933 # { p[0] = PGBuiltin::BUFIF0; }
6937 def p_gatetype_9(p
):
6938 '''gatetype : K_bufif1 '''
6940 print('gatetype_9', list(p
))
6942 # { p[0] = PGBuiltin::BUFIF1; }
6946 def p_gatetype_10(p
):
6947 '''gatetype : K_not '''
6949 print('gatetype_10', list(p
))
6951 # { p[0] = PGBuiltin::NOT; }
6955 def p_gatetype_11(p
):
6956 '''gatetype : K_notif0 '''
6958 print('gatetype_11', list(p
))
6960 # { p[0] = PGBuiltin::NOTIF0; }
6964 def p_gatetype_12(p
):
6965 '''gatetype : K_notif1 '''
6967 print('gatetype_12', list(p
))
6969 # { p[0] = PGBuiltin::NOTIF1; }
6973 def p_switchtype_1(p
):
6974 '''switchtype : K_nmos '''
6976 print('switchtype_1', list(p
))
6978 # { p[0] = PGBuiltin::NMOS; }
6982 def p_switchtype_2(p
):
6983 '''switchtype : K_rnmos '''
6985 print('switchtype_2', list(p
))
6987 # { p[0] = PGBuiltin::RNMOS; }
6991 def p_switchtype_3(p
):
6992 '''switchtype : K_pmos '''
6994 print('switchtype_3', list(p
))
6996 # { p[0] = PGBuiltin::PMOS; }
7000 def p_switchtype_4(p
):
7001 '''switchtype : K_rpmos '''
7003 print('switchtype_4', list(p
))
7005 # { p[0] = PGBuiltin::RPMOS; }
7009 def p_switchtype_5(p
):
7010 '''switchtype : K_cmos '''
7012 print('switchtype_5', list(p
))
7014 # { p[0] = PGBuiltin::CMOS; }
7018 def p_switchtype_6(p
):
7019 '''switchtype : K_rcmos '''
7021 print('switchtype_6', list(p
))
7023 # { p[0] = PGBuiltin::RCMOS; }
7027 def p_switchtype_7(p
):
7028 '''switchtype : K_tran '''
7030 print('switchtype_7', list(p
))
7032 # { p[0] = PGBuiltin::TRAN; }
7036 def p_switchtype_8(p
):
7037 '''switchtype : K_rtran '''
7039 print('switchtype_8', list(p
))
7041 # { p[0] = PGBuiltin::RTRAN; }
7045 def p_switchtype_9(p
):
7046 '''switchtype : K_tranif0 '''
7048 print('switchtype_9', list(p
))
7050 # { p[0] = PGBuiltin::TRANIF0; }
7054 def p_switchtype_10(p
):
7055 '''switchtype : K_tranif1 '''
7057 print('switchtype_10', list(p
))
7059 # { p[0] = PGBuiltin::TRANIF1; }
7063 def p_switchtype_11(p
):
7064 '''switchtype : K_rtranif0 '''
7066 print('switchtype_11', list(p
))
7068 # { p[0] = PGBuiltin::RTRANIF0; }
7072 def p_switchtype_12(p
):
7073 '''switchtype : K_rtranif1 '''
7075 print('switchtype_12', list(p
))
7077 # { p[0] = PGBuiltin::RTRANIF1; }
7081 def p_hierarchy_identifier_1(p
):
7082 '''hierarchy_identifier : IDENTIFIER '''
7084 print('hierarchy_identifier_1 FIXME', list(p
))
7085 lpvalue
= Leaf(token
.NAME
, p
[1])
7088 # { p[0] = new pform_name_t;
7089 # p[0]->push_back(name_component_t(lex_strings.make(p[1])));
7095 def p_hierarchy_identifier_2(p
):
7096 '''hierarchy_identifier : hierarchy_identifier '.' IDENTIFIER '''
7098 print('hierarchy_identifier_2', list(p
))
7100 # { pform_name_t * tmp = p[1];
7101 # tmp->push_back(name_component_t(lex_strings.make(p[3])));
7108 def p_hierarchy_identifier_3(p
):
7109 '''hierarchy_identifier : hierarchy_identifier '[' expression ']' '''
7111 print('hierarchy_identifier_3', list(p
))
7113 # { pform_name_t * tmp = p[1];
7114 # name_component_t&tail = tmp->back();
7115 # index_component_t itmp;
7116 # itmp.sel = index_component_t::SEL_BIT;
7118 # tail.index.push_back(itmp);
7124 def p_hierarchy_identifier_4(p
):
7125 '''hierarchy_identifier : hierarchy_identifier '[' '$' ']' '''
7127 print('hierarchy_identifier_4', list(p
))
7129 # { pform_name_t * tmp = p[1];
7130 # name_component_t&tail = tmp->back();
7131 # if (! gn_system_verilog()) {
7132 # yyerror(@3, "error: Last element expression ($) "
7133 # "requires SystemVerilog. Try enabling SystemVerilog.");
7135 # index_component_t itmp;
7136 # itmp.sel = index_component_t::SEL_BIT_LAST;
7139 # tail.index.push_back(itmp);
7145 def p_hierarchy_identifier_5(p
):
7146 '''hierarchy_identifier : hierarchy_identifier '[' expression ':' expression ']' '''
7148 print('hierarchy_identifier_5', list(p
))
7150 # { pform_name_t * tmp = p[1];
7151 # name_component_t&tail = tmp->back();
7152 # index_component_t itmp;
7153 # itmp.sel = index_component_t::SEL_PART;
7156 # tail.index.push_back(itmp);
7162 def p_hierarchy_identifier_6(p
):
7163 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_POS expression ']' '''
7165 print('hierarchy_identifier_6', list(p
))
7167 # { pform_name_t * tmp = p[1];
7168 # name_component_t&tail = tmp->back();
7169 # index_component_t itmp;
7170 # itmp.sel = index_component_t::SEL_IDX_UP;
7173 # tail.index.push_back(itmp);
7179 def p_hierarchy_identifier_7(p
):
7180 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_NEG expression ']' '''
7182 print('hierarchy_identifier_7', list(p
))
7184 # { pform_name_t * tmp = p[1];
7185 # name_component_t&tail = tmp->back();
7186 # index_component_t itmp;
7187 # itmp.sel = index_component_t::SEL_IDX_DO;
7190 # tail.index.push_back(itmp);
7196 def p_list_of_identifiers_1(p
):
7197 '''list_of_identifiers : IDENTIFIER '''
7199 print('list_of_identifiers_1', list(p
))
7201 # { p[0] = list_from_identifier(p[1]); }
7205 def p_list_of_identifiers_2(p
):
7206 '''list_of_identifiers : list_of_identifiers ',' IDENTIFIER '''
7208 print('list_of_identifiers_2', list(p
))
7210 # { p[0] = list_from_identifier(p[1], p[3]); }
7214 def p_list_of_port_identifiers_1(p
):
7215 '''list_of_port_identifiers : IDENTIFIER dimensions_opt '''
7217 print('list_of_port_identifiers_1', list(p
))
7219 # { p[0] = make_port_list(p[1], p[2], 0); }
7223 def p_list_of_port_identifiers_2(p
):
7224 '''list_of_port_identifiers : list_of_port_identifiers ',' IDENTIFIER dimensions_opt '''
7226 print('list_of_port_identifiers_2', list(p
))
7228 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
7232 def p_list_of_variable_port_identifiers_1(p
):
7233 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '''
7235 print('list_of_variable_port_identifiers_1', list(p
))
7237 # { p[0] = make_port_list(p[1], p[2], 0); }
7241 def p_list_of_variable_port_identifiers_2(p
):
7242 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '=' expression '''
7244 print('list_of_variable_port_identifiers_2', list(p
))
7246 # { p[0] = make_port_list(p[1], p[2], p[4]); }
7250 def p_list_of_variable_port_identifiers_3(p
):
7251 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '''
7253 print('list_of_variable_port_identifiers_3', list(p
))
7255 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
7259 def p_list_of_variable_port_identifiers_4(p
):
7260 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '=' expression '''
7262 print('list_of_variable_port_identifiers_4', list(p
))
7264 # { p[0] = make_port_list(p[1], p[3], p[4], p[6]); }
7268 def p_list_of_ports_1(p
):
7269 '''list_of_ports : port_opt '''
7271 print('list_of_ports_1', list(p
))
7273 # { vector<Module::port_t*>*tmp
7274 # = new vector<Module::port_t*>(1);
7281 def p_list_of_ports_2(p
):
7282 '''list_of_ports : list_of_ports ',' port_opt '''
7284 print('list_of_ports_2', list(p
))
7286 # { vector<Module::port_t*>*tmp = p[1];
7287 # tmp->push_back(p[3]);
7293 def p_list_of_port_declarations_1(p
):
7294 '''list_of_port_declarations : port_declaration '''
7295 if(parse_debug
> 1):
7296 print('list_of_port_declarations_1', list(p
))
7299 # { vector<Module::port_t*>*tmp
7300 # = new vector<Module::port_t*>(1);
7307 def p_list_of_port_declarations_2(p
):
7308 '''list_of_port_declarations : list_of_port_declarations ',' port_declaration '''
7310 print('list_of_port_declarations_2 FIXME', list(p
))
7311 # MOVE_TO absyn p[1].append(Leaf(token.NEWLINE, '\n')) # should be a comma
7312 # XXX p[3].prefix=' ' # add a space after the NL, must go in parameter
7316 # { vector<Module::port_t*>*tmp = p[1];
7317 # tmp->push_back(p[3]);
7323 def p_list_of_port_declarations_3(p
):
7324 '''list_of_port_declarations : list_of_port_declarations ',' IDENTIFIER '''
7326 print('list_of_port_declarations_3', list(p
))
7328 # { Module::port_t*ptmp;
7329 # perm_string name = lex_strings.make(p[3]);
7330 # ptmp = pform_module_port_reference(name, @3.text,
7332 # vector<Module::port_t*>*tmp = p[1];
7333 # tmp->push_back(ptmp);
7335 # /* Get the port declaration details, the port type
7336 # and what not, from context data stored by the
7337 # last port_declaration rule. */
7338 # pform_module_define_port(@3, name,
7339 # port_declaration_context.port_type,
7340 # port_declaration_context.port_net_type,
7341 # port_declaration_context.data_type, 0);
7348 def p_list_of_port_declarations_4(p
):
7349 '''list_of_port_declarations : list_of_port_declarations ',' '''
7351 print('list_of_port_declarations_4', list(p
))
7354 # yyerror(@2, "error: NULL port declarations are not "
7360 def p_list_of_port_declarations_5(p
):
7361 '''list_of_port_declarations : list_of_port_declarations ';' '''
7363 print('list_of_port_declarations_5', list(p
))
7366 # yyerror(@2, "error: ';' is an invalid port declaration "
7372 def p_port_declaration_1(p
):
7373 '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7375 print('port_declaration_1 FIXME', list(p
))
7376 comment
, dt
, name
= p
[2], p
[4], p
[5]
7377 p
[0] = absyn
.port_decl(comment
, dt
, name
)
7379 # { Module::port_t*ptmp;
7380 # perm_string name = lex_strings.make(p[5]);
7381 # data_type_t*use_type = p[4];
7382 # if (p[6]) use_type = new uarray_type_t(use_type, p[6]);
7383 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7384 # pform_module_define_port(@2, name, NetNet::PINPUT, p[3], use_type, p[1]);
7385 # port_declaration_context.port_type = NetNet::PINPUT;
7386 # port_declaration_context.port_net_type = p[3];
7387 # port_declaration_context.data_type = p[4];
7394 def p_port_declaration_2(p
):
7395 '''port_declaration : attribute_list_opt K_input K_wreal IDENTIFIER '''
7397 print('port_declaration_2', list(p
))
7399 # { Module::port_t*ptmp;
7400 # perm_string name = lex_strings.make(p[4]);
7401 # ptmp = pform_module_port_reference(name, @2.text,
7403 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7404 # FILE_NAME(real_type, @3);
7405 # pform_module_define_port(@2, name, NetNet::PINPUT,
7406 # NetNet::WIRE, real_type, p[1]);
7407 # port_declaration_context.port_type = NetNet::PINPUT;
7408 # port_declaration_context.port_net_type = NetNet::WIRE;
7409 # port_declaration_context.data_type = real_type;
7416 def p_port_declaration_3(p
):
7417 '''port_declaration : attribute_list_opt K_inout net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7419 print('port_declaration_3', list(p
))
7421 # { Module::port_t*ptmp;
7422 # perm_string name = lex_strings.make(p[5]);
7423 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7424 # pform_module_define_port(@2, name, NetNet::PINOUT, p[3], p[4], p[1]);
7425 # port_declaration_context.port_type = NetNet::PINOUT;
7426 # port_declaration_context.port_net_type = p[3];
7427 # port_declaration_context.data_type = p[4];
7430 # yyerror(@6, "sorry: Inout ports with unpacked dimensions not supported.");
7438 def p_port_declaration_4(p
):
7439 '''port_declaration : attribute_list_opt K_inout K_wreal IDENTIFIER '''
7441 print('port_declaration_4', list(p
))
7443 # { Module::port_t*ptmp;
7444 # perm_string name = lex_strings.make(p[4]);
7445 # ptmp = pform_module_port_reference(name, @2.text,
7447 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7448 # FILE_NAME(real_type, @3);
7449 # pform_module_define_port(@2, name, NetNet::PINOUT,
7450 # NetNet::WIRE, real_type, p[1]);
7451 # port_declaration_context.port_type = NetNet::PINOUT;
7452 # port_declaration_context.port_net_type = NetNet::WIRE;
7453 # port_declaration_context.data_type = real_type;
7460 def p_port_declaration_5(p
):
7461 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7463 print('port_declaration_5 FIXME', list(p
))
7464 comment
, dt
, name
= p
[2], p
[4], p
[5]
7465 p
[0] = absyn
.port_decl(comment
, dt
, name
)
7467 # { Module::port_t*ptmp;
7468 # perm_string name = lex_strings.make(p[5]);
7469 # data_type_t*use_dtype = p[4];
7470 # if (p[6]) use_dtype = new uarray_type_t(use_dtype, p[6]);
7471 # NetNet::Type use_type = p[3];
7472 # if (use_type == NetNet::IMPLICIT) {
7473 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
7474 # if (dtype->reg_flag)
7475 # use_type = NetNet::REG;
7476 # else if (dtype->implicit_flag)
7477 # use_type = NetNet::IMPLICIT;
7479 # use_type = NetNet::IMPLICIT_REG;
7481 # // The SystemVerilog types that can show up as
7482 # // output ports are implicitly (on the inside)
7483 # // variables because "reg" is not valid syntax
7485 # } else if (dynamic_cast<atom2_type_t*> (p[4])) {
7486 # use_type = NetNet::IMPLICIT_REG;
7487 # } else if (dynamic_cast<struct_type_t*> (p[4])) {
7488 # use_type = NetNet::IMPLICIT_REG;
7489 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[4])) {
7490 # if(etype->base_type == IVL_VT_LOGIC)
7491 # use_type = NetNet::IMPLICIT_REG;
7494 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7495 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, use_dtype, p[1]);
7496 # port_declaration_context.port_type = NetNet::POUTPUT;
7497 # port_declaration_context.port_net_type = use_type;
7498 # port_declaration_context.data_type = p[4];
7505 def p_port_declaration_6(p
):
7506 '''port_declaration : attribute_list_opt K_output K_wreal IDENTIFIER '''
7508 print('port_declaration_6', list(p
))
7510 # { Module::port_t*ptmp;
7511 # perm_string name = lex_strings.make(p[4]);
7512 # ptmp = pform_module_port_reference(name, @2.text,
7514 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7515 # FILE_NAME(real_type, @3);
7516 # pform_module_define_port(@2, name, NetNet::POUTPUT,
7517 # NetNet::WIRE, real_type, p[1]);
7518 # port_declaration_context.port_type = NetNet::POUTPUT;
7519 # port_declaration_context.port_net_type = NetNet::WIRE;
7520 # port_declaration_context.data_type = real_type;
7527 def p_port_declaration_7(p
):
7528 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER '=' expression '''
7530 print('port_declaration_7', list(p
))
7532 # { Module::port_t*ptmp;
7533 # perm_string name = lex_strings.make(p[5]);
7534 # NetNet::Type use_type = p[3];
7535 # if (use_type == NetNet::IMPLICIT) {
7536 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
7537 # if (dtype->reg_flag)
7538 # use_type = NetNet::REG;
7540 # use_type = NetNet::IMPLICIT_REG;
7542 # use_type = NetNet::IMPLICIT_REG;
7545 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7546 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, p[4], p[1]);
7547 # port_declaration_context.port_type = NetNet::PINOUT;
7548 # port_declaration_context.port_net_type = use_type;
7549 # port_declaration_context.data_type = p[4];
7551 # pform_make_var_init(@5, name, p[7]);
7559 def p_net_type_opt_1(p
):
7560 '''net_type_opt : net_type '''
7562 print('net_type_opt_1', list(p
))
7569 def p_net_type_opt_2(p
):
7570 '''net_type_opt : '''
7571 if(parse_debug
> 2):
7572 print('net_type_opt_2', list(p
))
7579 def p_unsigned_signed_opt_1(p
):
7580 '''unsigned_signed_opt : K_signed '''
7582 print('unsigned_signed_opt_1', list(p
))
7589 def p_unsigned_signed_opt_2(p
):
7590 '''unsigned_signed_opt : K_unsigned '''
7592 print('unsigned_signed_opt_2', list(p
))
7599 def p_unsigned_signed_opt_3(p
):
7600 '''unsigned_signed_opt : '''
7602 print('unsigned_signed_opt_3', list(p
))
7609 def p_signed_unsigned_opt_1(p
):
7610 '''signed_unsigned_opt : K_signed '''
7612 print('signed_unsigned_opt_1', list(p
))
7619 def p_signed_unsigned_opt_2(p
):
7620 '''signed_unsigned_opt : K_unsigned '''
7622 print('signed_unsigned_opt_2', list(p
))
7629 def p_signed_unsigned_opt_3(p
):
7630 '''signed_unsigned_opt : '''
7632 print('signed_unsigned_opt_3', list(p
))
7639 def p_atom2_type_1(p
):
7640 '''atom2_type : K_byte '''
7642 print('atom2_type_1', list(p
))
7648 def p_atom2_type_2(p
):
7649 '''atom2_type : K_shortint '''
7651 print('atom2_type_2', list(p
))
7657 def p_atom2_type_3(p
):
7658 '''atom2_type : K_int '''
7660 print('atom2_type_3', list(p
))
7666 def p_atom2_type_4(p
):
7667 '''atom2_type : K_longint '''
7669 print('atom2_type_4', list(p
))
7676 '''lpvalue : hierarchy_identifier '''
7677 if(parse_debug
> 2):
7678 print('lpvalue_1', list(p
))
7681 # { PEIdent*tmp = pform_new_ident(*p[1]);
7682 # FILE_NAME(tmp, @1);
7690 '''lpvalue : implicit_class_handle '.' hierarchy_identifier '''
7692 print('lpvalue_2', list(p
))
7694 # { pform_name_t*t_name = p[1];
7695 # while (!p[3]->empty()) {
7696 # t_name->push_back(p[3]->front());
7697 # p[3]->pop_front();
7699 # PEIdent*tmp = new PEIdent(*t_name);
7700 # FILE_NAME(tmp, @1);
7709 '''lpvalue : '{' expression_list_proper '}' '''
7711 print('lpvalue_3', list(p
))
7713 # { PEConcat*tmp = new PEConcat(*p[2]);
7714 # FILE_NAME(tmp, @1);
7722 '''lpvalue : streaming_concatenation '''
7724 print('lpvalue_4', list(p
))
7726 # { yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
7732 def p_cont_assign_1(p
):
7733 '''cont_assign : lpvalue '=' expression '''
7735 print('cont_assign_1', list(p
))
7736 absyn
.cont_assign_1(p
)
7738 # { list<PExpr*>*tmp = new list<PExpr*>;
7739 # tmp->push_back(p[1]);
7740 # tmp->push_back(p[3]);
7746 def p_cont_assign_list_1(p
):
7747 '''cont_assign_list : cont_assign_list ',' cont_assign '''
7749 print('cont_assign_list_1', list(p
))
7751 # { list<PExpr*>*tmp = p[1];
7752 # tmp->splice(tmp->end(), *p[3]);
7759 def p_cont_assign_list_2(p
):
7760 '''cont_assign_list : cont_assign '''
7761 if(parse_debug
> 2):
7762 print('cont_assign_list_2', list(p
))
7770 '''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 '''
7771 if(parse_debug
> 2):
7772 print('module_1', list(p
))
7773 clsdecl
= absyn
.module_1(p
)
7780 def p__embed0_module(p
):
7781 '''_embed0_module : '''
7783 # { pform_startmodule(@2, p[4], p[2]==K_program, p[2]==K_interface, p[3], p[1]); }
7787 def p__embed1_module(p
):
7788 '''_embed1_module : '''
7790 # { pform_module_set_ports(p[8]); }
7794 def p__embed2_module(p
):
7795 '''_embed2_module : '''
7797 # { pform_set_scope_timescale(@2); }
7801 def p__embed3_module(p
):
7802 '''_embed3_module : '''
7804 # { Module::UCDriveType ucd;
7805 # // The lexor detected `unconnected_drive directives and
7806 # // marked what it found in the uc_drive variable. Use that
7807 # // to generate a UCD flag for the module.
7808 # switch (uc_drive) {
7811 # ucd = Module::UCD_NONE;
7814 # ucd = Module::UCD_PULL0;
7817 # ucd = Module::UCD_PULL1;
7820 # // Check that program/endprogram and module/endmodule
7821 # // keywords match.
7822 # if (p[2] != p[15]) {
7825 # yyerror(@15, "error: module not closed by endmodule.");
7828 # yyerror(@15, "error: program not closed by endprogram.");
7831 # yyerror(@15, "error: interface not closed by endinterface.");
7837 # pform_endmodule(p[4], in_celldefine, ucd);
7842 def p_module_start_1(p
):
7843 '''module_start : K_module '''
7844 if(parse_debug
> 1):
7845 print('module_start_1', list(p
))
7847 # { p[0] = K_module; }
7851 def p_module_start_2(p
):
7852 '''module_start : K_macromodule '''
7854 print('module_start_2', list(p
))
7856 # { p[0] = K_module; }
7860 def p_module_start_3(p
):
7861 '''module_start : K_program '''
7863 print('module_start_3', list(p
))
7865 # { p[0] = K_program; }
7869 def p_module_start_4(p
):
7870 '''module_start : K_interface '''
7872 print('module_start_4', list(p
))
7874 # { p[0] = K_interface; }
7878 def p_module_end_1(p
):
7879 '''module_end : K_endmodule '''
7880 if(parse_debug
> 2):
7881 print('module_end_1', list(p
))
7883 # { p[0] = K_module; }
7887 def p_module_end_2(p
):
7888 '''module_end : K_endprogram '''
7890 print('module_end_2', list(p
))
7892 # { p[0] = K_program; }
7896 def p_module_end_3(p
):
7897 '''module_end : K_endinterface '''
7899 print('module_end_3', list(p
))
7901 # { p[0] = K_interface; }
7905 def p_endlabel_opt_1(p
):
7906 '''endlabel_opt : ':' IDENTIFIER '''
7908 print('endlabel_opt_1', list(p
))
7915 def p_endlabel_opt_2(p
):
7916 '''endlabel_opt : '''
7917 if(parse_debug
> 2):
7918 print('endlabel_opt_2', list(p
))
7924 def p_module_attribute_foreign_1(p
):
7925 '''module_attribute_foreign : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP '''
7927 print('module_attribute_foreign_1', list(p
))
7933 def p_module_attribute_foreign_2(p
):
7934 '''module_attribute_foreign : '''
7935 if(parse_debug
> 2):
7936 print('module_attribute_foreign_2', list(p
))
7942 def p_module_port_list_opt_1(p
):
7943 '''module_port_list_opt : '(' list_of_ports ')' '''
7945 print('module_port_list_opt_1', list(p
))
7952 def p_module_port_list_opt_2(p
):
7953 '''module_port_list_opt : '(' list_of_port_declarations ')' '''
7954 if(parse_debug
> 2):
7955 print('module_port_list_opt_2', list(p
))
7962 def p_module_port_list_opt_3(p
):
7963 '''module_port_list_opt : '''
7965 print('module_port_list_opt_3', list(p
))
7971 def p_module_port_list_opt_4(p
):
7972 '''module_port_list_opt : '(' error ')' '''
7974 print('module_port_list_opt_4', list(p
))
7976 # { yyerror(@2, "Errors in port declarations.");
7983 def p_module_parameter_port_list_opt_1(p
):
7984 '''module_parameter_port_list_opt : '''
7985 if(parse_debug
> 2):
7986 print('module_parameter_port_list_opt_1', list(p
))
7992 def p_module_parameter_port_list_opt_2(p
):
7993 '''module_parameter_port_list_opt : '#' '(' module_parameter_port_list ')' '''
7995 print('module_parameter_port_list_opt_2', list(p
))
8002 def p_module_parameter_port_list_1(p
):
8003 '''module_parameter_port_list : K_parameter param_type parameter_assign '''
8005 print('module_parameter_port_list_1', list(p
))
8012 def p_module_parameter_port_list_2(p
):
8013 '''module_parameter_port_list : module_parameter_port_list ',' parameter_assign '''
8015 print('module_parameter_port_list_2', list(p
))
8016 p
[0] = p
[1].append(p
[3])
8022 def p_module_parameter_port_list_3(p
):
8023 '''module_parameter_port_list : module_parameter_port_list ',' K_parameter param_type parameter_assign '''
8025 print('module_parameter_port_list_3', list(p
))
8026 p
[1].append(Leaf(token
.COMMA
, ','))
8027 p
[1].append(Leaf(token
.NEWLINE
, '\n'))
8028 p
[5].prefix
= ' ' # add space after newline
8036 def p_module_item_1(p
):
8037 '''module_item : module '''
8039 print('module_item_1', list(p
))
8045 def p_module_item_2(p
):
8046 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' '''
8048 print('module_item_2', list(p
))
8050 p
[0] = ["module_item_2"]+list(p
)
8052 # { data_type_t*data_type = p[3];
8053 # if (data_type == 0) {
8054 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8055 # FILE_NAME(data_type, @2);
8057 # pform_set_data_type(@2, data_type, p[5], p[2], p[1]);
8059 # yyerror(@2, "sorry: net delays not supported.");
8067 def p_module_item_3(p
):
8068 '''module_item : attribute_list_opt K_wreal delay3 net_variable_list ';' '''
8070 print('module_item_3', list(p
))
8072 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
8073 # pform_set_data_type(@2, tmpt, p[4], NetNet::WIRE, p[1]);
8075 # yyerror(@3, "sorry: net delays not supported.");
8083 def p_module_item_4(p
):
8084 '''module_item : attribute_list_opt K_wreal net_variable_list ';' '''
8086 print('module_item_4', list(p
))
8088 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
8089 # pform_set_data_type(@2, tmpt, p[3], NetNet::WIRE, p[1]);
8095 def p_module_item_5(p
):
8096 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_decl_assigns ';' '''
8098 print('module_item_5', list(p
))
8100 # { data_type_t*data_type = p[3];
8101 # if (data_type == 0) {
8102 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8103 # FILE_NAME(data_type, @2);
8105 # pform_makewire(@2, p[4], str_strength, p[5], p[2], data_type);
8107 # yywarn(@2, "Attributes are not supported on net declaration "
8108 # "assignments and will be discarded.");
8115 def p_module_item_6(p
):
8116 '''module_item : attribute_list_opt net_type data_type_or_implicit drive_strength net_decl_assigns ';' '''
8118 print('module_item_6', list(p
))
8120 # { data_type_t*data_type = p[3];
8121 # if (data_type == 0) {
8122 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8123 # FILE_NAME(data_type, @2);
8125 # pform_makewire(@2, 0, p[4], p[5], p[2], data_type);
8127 # yywarn(@2, "Attributes are not supported on net declaration "
8128 # "assignments and will be discarded.");
8135 def p_module_item_7(p
):
8136 '''module_item : attribute_list_opt K_wreal net_decl_assigns ';' '''
8138 print('module_item_7', list(p
))
8140 # { real_type_t*data_type = new real_type_t(real_type_t::REAL);
8141 # pform_makewire(@2, 0, str_strength, p[3], NetNet::WIRE, data_type);
8143 # yywarn(@2, "Attributes are not supported on net declaration "
8144 # "assignments and will be discarded.");
8151 def p_module_item_8(p
):
8152 '''module_item : K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' '''
8154 print('module_item_8', list(p
))
8156 # { yyerror(@1, "sorry: trireg nets not supported.");
8163 def p_module_item_9(p
):
8164 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit list_of_port_identifiers ';' '''
8166 print('module_item_9', list(p
))
8168 # { pform_module_define_port(@2, p[5], p[2], p[3], p[4], p[1]); }
8172 def p_module_item_10(p
):
8173 '''module_item : attribute_list_opt port_direction K_wreal list_of_port_identifiers ';' '''
8175 print('module_item_10', list(p
))
8177 # { real_type_t*real_type = new real_type_t(real_type_t::REAL);
8178 # pform_module_define_port(@2, p[4], p[2], NetNet::WIRE, real_type, p[1]);
8183 def p_module_item_11(p
):
8184 '''module_item : attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' '''
8186 print('module_item_11', list(p
))
8188 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8189 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8190 # if (dtype->implicit_flag)
8191 # use_type = NetNet::NONE;
8193 # if (use_type == NetNet::NONE)
8194 # pform_set_port_type(@2, p[4], NetNet::PINOUT, p[3], p[1]);
8196 # pform_module_define_port(@2, p[4], NetNet::PINOUT, use_type, p[3], p[1]);
8201 def p_module_item_12(p
):
8202 '''module_item : attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' '''
8204 print('module_item_12', list(p
))
8206 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8207 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8208 # if (dtype->implicit_flag)
8209 # use_type = NetNet::NONE;
8211 # if (use_type == NetNet::NONE)
8212 # pform_set_port_type(@2, p[4], NetNet::PINPUT, p[3], p[1]);
8214 # pform_module_define_port(@2, p[4], NetNet::PINPUT, use_type, p[3], p[1]);
8219 def p_module_item_13(p
):
8220 '''module_item : attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' '''
8222 print('module_item_13', list(p
))
8224 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8225 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8226 # if (dtype->implicit_flag)
8227 # use_type = NetNet::NONE;
8228 # else if (dtype->reg_flag)
8229 # use_type = NetNet::REG;
8231 # use_type = NetNet::IMPLICIT_REG;
8233 # // The SystemVerilog types that can show up as
8234 # // output ports are implicitly (on the inside)
8235 # // variables because "reg" is not valid syntax
8237 # } else if (dynamic_cast<atom2_type_t*> (p[3])) {
8238 # use_type = NetNet::IMPLICIT_REG;
8239 # } else if (dynamic_cast<struct_type_t*> (p[3])) {
8240 # use_type = NetNet::IMPLICIT_REG;
8241 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[3])) {
8242 # if(etype->base_type == IVL_VT_LOGIC)
8243 # use_type = NetNet::IMPLICIT_REG;
8245 # if (use_type == NetNet::NONE)
8246 # pform_set_port_type(@2, p[4], NetNet::POUTPUT, p[3], p[1]);
8248 # pform_module_define_port(@2, p[4], NetNet::POUTPUT, use_type, p[3], p[1]);
8253 def p_module_item_14(p
):
8254 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit error ';' '''
8256 print('module_item_14', list(p
))
8258 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8259 # if (p[1]) delete p[1];
8260 # if (p[4]) delete p[4];
8266 def p_module_item_15(p
):
8267 '''module_item : attribute_list_opt K_inout data_type_or_implicit error ';' '''
8269 print('module_item_15', list(p
))
8271 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8272 # if (p[1]) delete p[1];
8273 # if (p[3]) delete p[3];
8279 def p_module_item_16(p
):
8280 '''module_item : attribute_list_opt K_input data_type_or_implicit error ';' '''
8282 print('module_item_16', list(p
))
8284 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8285 # if (p[1]) delete p[1];
8286 # if (p[3]) delete p[3];
8292 def p_module_item_17(p
):
8293 '''module_item : attribute_list_opt K_output data_type_or_implicit error ';' '''
8295 print('module_item_17', list(p
))
8297 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8298 # if (p[1]) delete p[1];
8299 # if (p[3]) delete p[3];
8305 def p_module_item_18(p
):
8306 '''module_item : DISCIPLINE_IDENTIFIER list_of_identifiers ';' '''
8308 print('module_item_18', list(p
))
8310 # { pform_attach_discipline(@1, p[1], p[2]); }
8314 def p_module_item_19(p
):
8315 '''module_item : attribute_list_opt _embed0_module_item block_item_decl '''
8317 print('module_item_19', list(p
))
8319 # { delete attributes_in_context;
8320 # attributes_in_context = 0;
8325 def p_module_item_20(p
):
8326 '''module_item : K_defparam _embed1_module_item defparam_assign_list ';' '''
8328 print('module_item_20', list(p
))
8334 def p_module_item_21(p
):
8335 '''module_item : attribute_list_opt gatetype gate_instance_list ';' '''
8337 print('module_item_21', list(p
))
8339 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
8343 def p_module_item_22(p
):
8344 '''module_item : attribute_list_opt gatetype delay3 gate_instance_list ';' '''
8346 print('module_item_22', list(p
))
8348 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
8352 def p_module_item_23(p
):
8353 '''module_item : attribute_list_opt gatetype drive_strength gate_instance_list ';' '''
8355 print('module_item_23', list(p
))
8357 # { pform_makegates(@2, p[2], p[3], 0, p[4], p[1]); }
8361 def p_module_item_24(p
):
8362 '''module_item : attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';' '''
8364 print('module_item_24', list(p
))
8366 # { pform_makegates(@2, p[2], p[3], p[4], p[5], p[1]); }
8370 def p_module_item_25(p
):
8371 '''module_item : attribute_list_opt switchtype gate_instance_list ';' '''
8373 print('module_item_25', list(p
))
8375 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
8379 def p_module_item_26(p
):
8380 '''module_item : attribute_list_opt switchtype delay3 gate_instance_list ';' '''
8382 print('module_item_26', list(p
))
8384 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
8388 def p_module_item_27(p
):
8389 '''module_item : K_pullup gate_instance_list ';' '''
8391 print('module_item_27', list(p
))
8393 # { pform_makegates(@1, PGBuiltin::PULLUP, pull_strength, 0, p[2], 0); }
8397 def p_module_item_28(p
):
8398 '''module_item : K_pulldown gate_instance_list ';' '''
8400 print('module_item_28', list(p
))
8402 # { pform_makegates(@1, PGBuiltin::PULLDOWN, pull_strength, 0, p[2], 0); }
8406 def p_module_item_29(p
):
8407 '''module_item : K_pullup '(' dr_strength1 ')' gate_instance_list ';' '''
8409 print('module_item_29', list(p
))
8411 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[5], 0); }
8415 def p_module_item_30(p
):
8416 '''module_item : K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
8418 print('module_item_30', list(p
))
8420 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[7], 0); }
8424 def p_module_item_31(p
):
8425 '''module_item : K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
8427 print('module_item_31', list(p
))
8429 # { pform_makegates(@1, PGBuiltin::PULLUP, p[5], 0, p[7], 0); }
8433 def p_module_item_32(p
):
8434 '''module_item : K_pulldown '(' dr_strength0 ')' gate_instance_list ';' '''
8436 print('module_item_32', list(p
))
8438 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[5], 0); }
8442 def p_module_item_33(p
):
8443 '''module_item : K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
8445 print('module_item_33', list(p
))
8447 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[5], 0, p[7], 0); }
8451 def p_module_item_34(p
):
8452 '''module_item : K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
8454 print('module_item_34', list(p
))
8456 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[7], 0); }
8460 def p_module_item_35(p
):
8461 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' '''
8463 print('module_item_35', list(p
))
8465 # { perm_string tmp1 = lex_strings.make(p[2]);
8466 # pform_make_modgates(@2, tmp1, p[3], p[4], p[1]);
8472 def p_module_item_36(p
):
8473 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt error ';' '''
8475 print('module_item_36', list(p
))
8477 # { yyerror(@2, "error: Invalid module instantiation");
8479 # if (p[1]) delete p[1];
8484 def p_module_item_37(p
):
8485 '''module_item : K_assign drive_strength_opt delay3_opt cont_assign_list ';' '''
8486 if(parse_debug
> 2):
8487 print('module_item_37', list(p
))
8489 # { pform_make_pgassign_list(p[4], p[3], p[2], @1.text, @1.first_line); }
8493 def p_module_item_38(p
):
8494 '''module_item : attribute_list_opt K_always statement_item '''
8496 print('module_item_38', list(p
))
8498 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, p[3], p[1]);
8499 # FILE_NAME(tmp, @2);
8504 def p_module_item_39(p
):
8505 '''module_item : attribute_list_opt K_always_comb statement_item '''
8507 print('module_item_39', list(p
))
8509 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_COMB, p[3], p[1]);
8510 # FILE_NAME(tmp, @2);
8515 def p_module_item_40(p
):
8516 '''module_item : attribute_list_opt K_always_ff statement_item '''
8518 print('module_item_40', list(p
))
8520 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, p[3], p[1]);
8521 # FILE_NAME(tmp, @2);
8526 def p_module_item_41(p
):
8527 '''module_item : attribute_list_opt K_always_latch statement_item '''
8529 print('module_item_41', list(p
))
8531 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_LATCH, p[3], p[1]);
8532 # FILE_NAME(tmp, @2);
8537 def p_module_item_42(p
):
8538 '''module_item : attribute_list_opt K_initial statement_item '''
8540 print('module_item_42', list(p
))
8542 # { PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, p[3], p[1]);
8543 # FILE_NAME(tmp, @2);
8548 def p_module_item_43(p
):
8549 '''module_item : attribute_list_opt K_final statement_item '''
8551 print('module_item_43', list(p
))
8553 # { PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, p[3], p[1]);
8554 # FILE_NAME(tmp, @2);
8559 def p_module_item_44(p
):
8560 '''module_item : attribute_list_opt K_analog analog_statement '''
8562 print('module_item_44', list(p
))
8564 # { pform_make_analog_behavior(@2, IVL_PR_ALWAYS, p[3]); }
8568 def p_module_item_45(p
):
8569 '''module_item : attribute_list_opt assertion_item '''
8571 print('module_item_45', list(p
))
8577 def p_module_item_46(p
):
8578 '''module_item : timeunits_declaration '''
8580 print('module_item_46', list(p
))
8586 def p_module_item_47(p
):
8587 '''module_item : class_declaration '''
8589 print('module_item_47', list(p
))
8595 def p_module_item_48(p
):
8596 '''module_item : task_declaration '''
8598 print('module_item_48', list(p
))
8604 def p_module_item_49(p
):
8605 '''module_item : function_declaration '''
8607 print('module_item_49', list(p
))
8613 def p_module_item_50(p
):
8614 '''module_item : K_generate generate_item_list_opt K_endgenerate '''
8616 print('module_item_50', list(p
))
8618 # { // Test for bad nesting. I understand it, but it is illegal.
8619 # if (pform_parent_generate()) {
8620 # cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
8621 # cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
8622 # cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
8629 def p_module_item_51(p
):
8630 '''module_item : K_genvar list_of_identifiers ';' '''
8632 print('module_item_51', list(p
))
8634 # { pform_genvars(@1, p[2]); }
8638 def p_module_item_52(p
):
8639 '''module_item : K_for '(' IDENTIFIER '=' expression ';' expression ';' IDENTIFIER '=' expression ')' _embed2_module_item generate_block '''
8641 print('module_item_52', list(p
))
8643 # { pform_endgenerate(); }
8647 def p_module_item_53(p
):
8648 '''module_item : generate_if generate_block_opt K_else _embed3_module_item generate_block '''
8650 print('module_item_53', list(p
))
8652 # { pform_endgenerate(); }
8656 def p_module_item_54(p
):
8657 '''module_item : generate_if generate_block_opt %prec less_than_K_else '''
8659 print('module_item_54', list(p
))
8661 # { pform_endgenerate(); }
8665 def p_module_item_55(p
):
8666 '''module_item : K_case '(' expression ')' _embed4_module_item generate_case_items K_endcase '''
8668 print('module_item_55', list(p
))
8670 # { pform_endgenerate(); }
8674 def p_module_item_56(p
):
8675 '''module_item : modport_declaration '''
8677 print('module_item_56', list(p
))
8683 def p_module_item_57(p
):
8684 '''module_item : package_import_declaration '''
8686 print('module_item_57', list(p
))
8692 def p_module_item_58(p
):
8693 '''module_item : attribute_list_opt K_specparam _embed5_module_item specparam_decl ';' '''
8695 print('module_item_58', list(p
))
8701 def p_module_item_59(p
):
8702 '''module_item : K_specify _embed6_module_item specify_item_list_opt K_endspecify '''
8704 print('module_item_59', list(p
))
8710 def p_module_item_60(p
):
8711 '''module_item : K_specify error K_endspecify '''
8713 print('module_item_60', list(p
))
8715 # { yyerror(@1, "error: syntax error in specify block");
8721 def p_module_item_61(p
):
8722 '''module_item : error ';' '''
8724 print('module_item_61', list(p
))
8726 # { yyerror(@2, "error: invalid module item.");
8732 def p_module_item_62(p
):
8733 '''module_item : K_assign error '=' expression ';' '''
8735 print('module_item_62', list(p
))
8737 # { yyerror(@1, "error: syntax error in left side "
8738 # "of continuous assignment.");
8744 def p_module_item_63(p
):
8745 '''module_item : K_assign error ';' '''
8747 print('module_item_63', list(p
))
8749 # { yyerror(@1, "error: syntax error in "
8750 # "continuous assignment");
8756 def p_module_item_64(p
):
8757 '''module_item : K_function error K_endfunction endlabel_opt '''
8759 print('module_item_64', list(p
))
8761 # { yyerror(@1, "error: I give up on this "
8762 # "function definition.");
8764 # if (!gn_system_verilog()) {
8765 # yyerror(@4, "error: Function end names require "
8766 # "SystemVerilog.");
8775 def p_module_item_65(p
):
8776 '''module_item : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';' '''
8778 print('module_item_65', list(p
))
8780 # { perm_string tmp3 = lex_strings.make(p[3]);
8781 # perm_string tmp5 = lex_strings.make(p[5]);
8782 # pform_set_attrib(tmp3, tmp5, p[7]);
8789 def p_module_item_66(p
):
8790 '''module_item : KK_attribute '(' error ')' ';' '''
8792 print('module_item_66', list(p
))
8794 # { yyerror(@1, "error: Malformed $attribute parameter list."); }
8798 def p__embed0_module_item(p
):
8799 '''_embed0_module_item : '''
8801 # { attributes_in_context = p[1]; }
8805 def p__embed1_module_item(p
):
8806 '''_embed1_module_item : '''
8808 # { if (pform_in_interface())
8809 # yyerror(@1, "error: Parameter overrides are not allowed "
8810 # "in interfaces.");
8815 def p__embed2_module_item(p
):
8816 '''_embed2_module_item : '''
8818 # { pform_start_generate_for(@1, p[3], p[5], p[7], p[9], p[11]); }
8822 def p__embed3_module_item(p
):
8823 '''_embed3_module_item : '''
8825 # { pform_start_generate_else(@1); }
8829 def p__embed4_module_item(p
):
8830 '''_embed4_module_item : '''
8832 # { pform_start_generate_case(@1, p[3]); }
8836 def p__embed5_module_item(p
):
8837 '''_embed5_module_item : '''
8839 # { if (pform_in_interface())
8840 # yyerror(@1, "error: specparam declarations are not allowed "
8841 # "in interfaces.");
8846 def p__embed6_module_item(p
):
8847 '''_embed6_module_item : '''
8849 # { if (pform_in_interface())
8850 # yyerror(@1, "error: specify blocks are not allowed "
8851 # "in interfaces.");
8856 def p_module_item_list_1(p
):
8857 '''module_item_list : module_item_list module_item '''
8859 print('module_item_list_1', list(p
))
8865 def p_module_item_list_2(p
):
8866 '''module_item_list : module_item '''
8867 if(parse_debug
> 2):
8868 print('module_item_list_2', list(p
))
8874 def p_module_item_list_opt_1(p
):
8875 '''module_item_list_opt : module_item_list '''
8876 if(parse_debug
> 2):
8877 print('module_item_list_opt_1', list(p
))
8883 def p_module_item_list_opt_2(p
):
8884 '''module_item_list_opt : '''
8886 print('module_item_list_opt_2', list(p
))
8892 def p_generate_if_1(p
):
8893 '''generate_if : K_if '(' expression ')' '''
8895 print('generate_if_1', list(p
))
8897 # { pform_start_generate_if(@1, p[3]); }
8901 def p_generate_case_items_1(p
):
8902 '''generate_case_items : generate_case_items generate_case_item '''
8904 print('generate_case_items_1', list(p
))
8910 def p_generate_case_items_2(p
):
8911 '''generate_case_items : generate_case_item '''
8913 print('generate_case_items_2', list(p
))
8919 def p_generate_case_item_1(p
):
8920 '''generate_case_item : expression_list_proper ':' _embed0_generate_case_item generate_block_opt '''
8922 print('generate_case_item_1', list(p
))
8924 # { pform_endgenerate(); }
8928 def p_generate_case_item_2(p
):
8929 '''generate_case_item : K_default ':' _embed1_generate_case_item generate_block_opt '''
8931 print('generate_case_item_2', list(p
))
8933 # { pform_endgenerate(); }
8937 def p__embed0_generate_case_item(p
):
8938 '''_embed0_generate_case_item : '''
8940 # { pform_generate_case_item(@1, p[1]); }
8944 def p__embed1_generate_case_item(p
):
8945 '''_embed1_generate_case_item : '''
8947 # { pform_generate_case_item(@1, 0); }
8951 def p_generate_item_1(p
):
8952 '''generate_item : module_item '''
8954 print('generate_item_1', list(p
))
8960 def p_generate_item_2(p
):
8961 '''generate_item : K_begin generate_item_list_opt K_end '''
8963 print('generate_item_2', list(p
))
8965 # { /* Detect and warn about anachronistic begin/end use */
8966 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
8968 # cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
8974 def p_generate_item_3(p
):
8975 '''generate_item : K_begin ':' IDENTIFIER _embed0_generate_item generate_item_list_opt K_end '''
8977 print('generate_item_3', list(p
))
8979 # { /* Detect and warn about anachronistic named begin/end use */
8980 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
8982 # cerr << @1 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
8984 # pform_endgenerate();
8989 def p__embed0_generate_item(p
):
8990 '''_embed0_generate_item : '''
8993 # pform_start_generate_nblock(@1, p[3]);
8998 def p_generate_item_list_1(p
):
8999 '''generate_item_list : generate_item_list generate_item '''
9001 print('generate_item_list_1', list(p
))
9007 def p_generate_item_list_2(p
):
9008 '''generate_item_list : generate_item '''
9010 print('generate_item_list_2', list(p
))
9016 def p_generate_item_list_opt_1(p
):
9017 '''generate_item_list_opt : generate_item_list '''
9019 print('generate_item_list_opt_1', list(p
))
9025 def p_generate_item_list_opt_2(p
):
9026 '''generate_item_list_opt : '''
9028 print('generate_item_list_opt_2', list(p
))
9034 def p_generate_block_1(p
):
9035 '''generate_block : module_item '''
9037 print('generate_block_1', list(p
))
9043 def p_generate_block_2(p
):
9044 '''generate_block : K_begin generate_item_list_opt K_end '''
9046 print('generate_block_2', list(p
))
9052 def p_generate_block_3(p
):
9053 '''generate_block : K_begin ':' IDENTIFIER generate_item_list_opt K_end endlabel_opt '''
9055 print('generate_block_3', list(p
))
9057 # { pform_generate_block_name(p[3]);
9059 # if (strcmp(p[3],p[6]) != 0) {
9060 # yyerror(@6, "error: End label doesn't match "
9063 # if (! gn_system_verilog()) {
9064 # yyerror(@6, "error: Begin end labels require "
9065 # "SystemVerilog.");
9074 def p_generate_block_opt_1(p
):
9075 '''generate_block_opt : generate_block '''
9077 print('generate_block_opt_1', list(p
))
9083 def p_generate_block_opt_2(p
):
9084 '''generate_block_opt : ';' '''
9086 print('generate_block_opt_2', list(p
))
9092 def p_net_decl_assign_1(p
):
9093 '''net_decl_assign : IDENTIFIER '=' expression '''
9095 print('net_decl_assign_1', list(p
))
9097 # { net_decl_assign_t*tmp = new net_decl_assign_t;
9099 # tmp->name = lex_strings.make(p[1]);
9107 def p_net_decl_assigns_1(p
):
9108 '''net_decl_assigns : net_decl_assigns ',' net_decl_assign '''
9110 print('net_decl_assigns_1', list(p
))
9112 # { net_decl_assign_t*tmp = p[1];
9113 # p[3]->next = tmp->next;
9120 def p_net_decl_assigns_2(p
):
9121 '''net_decl_assigns : net_decl_assign '''
9123 print('net_decl_assigns_2', list(p
))
9130 def p_bit_logic_1(p
):
9131 '''bit_logic : K_logic '''
9133 print('bit_logic_1', list(p
))
9135 # { p[0] = IVL_VT_LOGIC; }
9139 def p_bit_logic_2(p
):
9140 '''bit_logic : K_bool '''
9142 print('bit_logic_2', list(p
))
9144 # { p[0] = IVL_VT_BOOL; /* Icarus misc */}
9148 def p_bit_logic_3(p
):
9149 '''bit_logic : K_bit '''
9151 print('bit_logic_3', list(p
))
9153 # { p[0] = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
9157 def p_bit_logic_opt_1(p
):
9158 '''bit_logic_opt : bit_logic '''
9160 print('bit_logic_opt_1', list(p
))
9166 def p_bit_logic_opt_2(p
):
9167 '''bit_logic_opt : '''
9169 print('bit_logic_opt_2', list(p
))
9171 # { p[0] = IVL_VT_NO_TYPE; }
9175 def p_net_type_1(p
):
9176 '''net_type : K_wire '''
9178 print('net_type_1', list(p
))
9184 def p_net_type_2(p
):
9185 '''net_type : K_tri '''
9187 print('net_type_2', list(p
))
9189 # { p[0] = NetNet::TRI; }
9193 def p_net_type_3(p
):
9194 '''net_type : K_tri1 '''
9196 print('net_type_3', list(p
))
9198 # { p[0] = NetNet::TRI1; }
9202 def p_net_type_4(p
):
9203 '''net_type : K_supply0 '''
9205 print('net_type_4', list(p
))
9207 # { p[0] = NetNet::SUPPLY0; }
9211 def p_net_type_5(p
):
9212 '''net_type : K_wand '''
9214 print('net_type_5', list(p
))
9216 # { p[0] = NetNet::WAND; }
9220 def p_net_type_6(p
):
9221 '''net_type : K_triand '''
9223 print('net_type_6', list(p
))
9225 # { p[0] = NetNet::TRIAND; }
9229 def p_net_type_7(p
):
9230 '''net_type : K_tri0 '''
9232 print('net_type_7', list(p
))
9234 # { p[0] = NetNet::TRI0; }
9238 def p_net_type_8(p
):
9239 '''net_type : K_supply1 '''
9241 print('net_type_8', list(p
))
9243 # { p[0] = NetNet::SUPPLY1; }
9247 def p_net_type_9(p
):
9248 '''net_type : K_wor '''
9250 print('net_type_9', list(p
))
9252 # { p[0] = NetNet::WOR; }
9256 def p_net_type_10(p
):
9257 '''net_type : K_trior '''
9259 print('net_type_10', list(p
))
9261 # { p[0] = NetNet::TRIOR; }
9265 def p_net_type_11(p
):
9266 '''net_type : K_wone '''
9268 print('net_type_11', list(p
))
9270 # { p[0] = NetNet::UNRESOLVED_WIRE;
9271 # cerr << @1.text << ":" << @1.first_line << ": warning: "
9272 # "'wone' is deprecated, please use 'uwire' "
9273 # "instead." << endl;
9278 def p_net_type_12(p
):
9279 '''net_type : K_uwire '''
9281 print('net_type_12', list(p
))
9283 # { p[0] = NetNet::UNRESOLVED_WIRE; }
9287 def p_param_type_1(p
):
9288 '''param_type : bit_logic_opt unsigned_signed_opt dimensions_opt '''
9290 print('param_type_1', list(p
))
9292 # { param_active_range = p[3];
9293 # param_active_signed = p[2];
9294 # if ((p[1] == IVL_VT_NO_TYPE) && (p[3] != 0))
9295 # param_active_type = IVL_VT_LOGIC;
9297 # param_active_type = p[1];
9302 def p_param_type_2(p
):
9303 '''param_type : K_integer '''
9305 print('param_type_2', list(p
))
9307 # { param_active_range = make_range_from_width(integer_width);
9308 # param_active_signed = true;
9309 # param_active_type = IVL_VT_LOGIC;
9314 def p_param_type_3(p
):
9315 '''param_type : K_time '''
9317 print('param_type_3', list(p
))
9319 # { param_active_range = make_range_from_width(64);
9320 # param_active_signed = false;
9321 # param_active_type = IVL_VT_LOGIC;
9326 def p_param_type_4(p
):
9327 '''param_type : real_or_realtime '''
9329 print('param_type_4', list(p
))
9331 # { param_active_range = 0;
9332 # param_active_signed = true;
9333 # param_active_type = IVL_VT_REAL;
9338 def p_param_type_5(p
):
9339 '''param_type : atom2_type '''
9341 print('param_type_5', list(p
))
9343 # { param_active_range = make_range_from_width(p[1]);
9344 # param_active_signed = true;
9345 # param_active_type = IVL_VT_BOOL;
9350 def p_param_type_6(p
):
9351 '''param_type : TYPE_IDENTIFIER '''
9353 print('param_type_6', list(p
))
9355 # { pform_set_param_from_type(@1, p[1].type, p[1].text, param_active_range,
9356 # param_active_signed, param_active_type);
9357 # delete[]p[1].text;
9362 def p_parameter_assign_list_1(p
):
9363 '''parameter_assign_list : parameter_assign '''
9365 print('parameter_assign_list_1', list(p
))
9371 def p_parameter_assign_list_2(p
):
9372 '''parameter_assign_list : parameter_assign_list ',' parameter_assign '''
9374 print('parameter_assign_list_2', list(p
))
9380 def p_localparam_assign_list_1(p
):
9381 '''localparam_assign_list : localparam_assign '''
9383 print('localparam_assign_list_1', list(p
))
9389 def p_localparam_assign_list_2(p
):
9390 '''localparam_assign_list : localparam_assign_list ',' localparam_assign '''
9392 print('localparam_assign_list_2', list(p
))
9398 def p_parameter_assign_1(p
):
9399 '''parameter_assign : IDENTIFIER '=' expression parameter_value_ranges_opt '''
9401 print('parameter_assign_1', list(p
))
9402 tpname
= Node(syms
.tname
, [Leaf(token
.NAME
, p
[1])])
9403 expr
= Node(syms
.tfpdef
, [tpname
, Leaf(token
.EQUAL
, p
[2]), p
[3]])
9406 # { PExpr*tmp = p[3];
9407 # pform_set_parameter(@1, lex_strings.make(p[1]), param_active_type,
9408 # param_active_signed, param_active_range, tmp, p[4]);
9414 def p_localparam_assign_1(p
):
9415 '''localparam_assign : IDENTIFIER '=' expression '''
9417 print('localparam_assign_1', list(p
))
9419 # { PExpr*tmp = p[3];
9420 # pform_set_localparam(@1, lex_strings.make(p[1]), param_active_type,
9421 # param_active_signed, param_active_range, tmp);
9427 def p_parameter_value_ranges_opt_1(p
):
9428 '''parameter_value_ranges_opt : parameter_value_ranges '''
9430 print('parameter_value_ranges_opt_1', list(p
))
9437 def p_parameter_value_ranges_opt_2(p
):
9438 '''parameter_value_ranges_opt : '''
9440 print('parameter_value_ranges_opt_2', list(p
))
9446 def p_parameter_value_ranges_1(p
):
9447 '''parameter_value_ranges : parameter_value_ranges parameter_value_range '''
9449 print('parameter_value_ranges_1', list(p
))
9451 # { p[0] = p[2]; p[0]->next = p[1]; }
9455 def p_parameter_value_ranges_2(p
):
9456 '''parameter_value_ranges : parameter_value_range '''
9458 print('parameter_value_ranges_2', list(p
))
9460 # { p[0] = p[1]; p[0]->next = 0; }
9464 def p_parameter_value_range_1(p
):
9465 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ']' '''
9467 print('parameter_value_range_1', list(p
))
9469 # { p[0] = pform_parameter_value_range(p[1], false, p[3], false, p[5]); }
9473 def p_parameter_value_range_2(p
):
9474 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ')' '''
9476 print('parameter_value_range_2', list(p
))
9478 # { p[0] = pform_parameter_value_range(p[1], false, p[3], true, p[5]); }
9482 def p_parameter_value_range_3(p
):
9483 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ']' '''
9485 print('parameter_value_range_3', list(p
))
9487 # { p[0] = pform_parameter_value_range(p[1], true, p[3], false, p[5]); }
9491 def p_parameter_value_range_4(p
):
9492 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ')' '''
9494 print('parameter_value_range_4', list(p
))
9496 # { p[0] = pform_parameter_value_range(p[1], true, p[3], true, p[5]); }
9500 def p_parameter_value_range_5(p
):
9501 '''parameter_value_range : K_exclude expression '''
9503 print('parameter_value_range_5', list(p
))
9505 # { p[0] = pform_parameter_value_range(true, false, p[2], false, p[2]); }
9509 def p_value_range_expression_1(p
):
9510 '''value_range_expression : expression '''
9512 print('value_range_expression_1', list(p
))
9519 def p_value_range_expression_2(p
):
9520 '''value_range_expression : K_inf '''
9522 print('value_range_expression_2', list(p
))
9528 def p_value_range_expression_3(p
):
9529 '''value_range_expression : '+' K_inf '''
9531 print('value_range_expression_3', list(p
))
9537 def p_value_range_expression_4(p
):
9538 '''value_range_expression : '-' K_inf '''
9540 print('value_range_expression_4', list(p
))
9546 def p_from_exclude_1(p
):
9547 '''from_exclude : K_from '''
9549 print('from_exclude_1', list(p
))
9556 def p_from_exclude_2(p
):
9557 '''from_exclude : K_exclude '''
9559 print('from_exclude_2', list(p
))
9566 def p_parameter_value_opt_1(p
):
9567 '''parameter_value_opt : '#' '(' expression_list_with_nuls ')' '''
9569 print('parameter_value_opt_1', list(p
))
9571 # { struct parmvalue_t*tmp = new struct parmvalue_t;
9572 # tmp->by_order = p[3];
9579 def p_parameter_value_opt_2(p
):
9580 '''parameter_value_opt : '#' '(' parameter_value_byname_list ')' '''
9582 print('parameter_value_opt_2', list(p
))
9584 # { struct parmvalue_t*tmp = new struct parmvalue_t;
9585 # tmp->by_order = 0;
9586 # tmp->by_name = p[3];
9592 def p_parameter_value_opt_3(p
):
9593 '''parameter_value_opt : '#' DEC_NUMBER '''
9595 print('parameter_value_opt_3', list(p
))
9598 # PENumber*tmp = new PENumber(p[2]);
9599 # FILE_NAME(tmp, @1);
9601 # struct parmvalue_t*lst = new struct parmvalue_t;
9602 # lst->by_order = new list<PExpr*>;
9603 # lst->by_order->push_back(tmp);
9611 def p_parameter_value_opt_4(p
):
9612 '''parameter_value_opt : '#' REALTIME '''
9614 print('parameter_value_opt_4', list(p
))
9617 # PEFNumber*tmp = new PEFNumber(p[2]);
9618 # FILE_NAME(tmp, @1);
9620 # struct parmvalue_t*lst = new struct parmvalue_t;
9621 # lst->by_order = new list<PExpr*>;
9622 # lst->by_order->push_back(tmp);
9629 def p_parameter_value_opt_5(p
):
9630 '''parameter_value_opt : '#' error '''
9632 print('parameter_value_opt_5', list(p
))
9634 # { yyerror(@1, "error: syntax error in parameter value "
9635 # "assignment list.");
9641 def p_parameter_value_opt_6(p
):
9642 '''parameter_value_opt : '''
9644 print('parameter_value_opt_6', list(p
))
9650 def p_parameter_value_byname_1(p
):
9651 '''parameter_value_byname : '.' IDENTIFIER '(' expression ')' '''
9653 print('parameter_value_byname_1', list(p
))
9655 # { named_pexpr_t*tmp = new named_pexpr_t;
9656 # tmp->name = lex_strings.make(p[2]);
9664 def p_parameter_value_byname_2(p
):
9665 '''parameter_value_byname : '.' IDENTIFIER '(' ')' '''
9667 print('parameter_value_byname_2', list(p
))
9669 # { named_pexpr_t*tmp = new named_pexpr_t;
9670 # tmp->name = lex_strings.make(p[2]);
9678 def p_parameter_value_byname_list_1(p
):
9679 '''parameter_value_byname_list : parameter_value_byname '''
9681 print('parameter_value_byname_list_1', list(p
))
9683 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
9684 # tmp->push_back(*p[1]);
9691 def p_parameter_value_byname_list_2(p
):
9692 '''parameter_value_byname_list : parameter_value_byname_list ',' parameter_value_byname '''
9694 print('parameter_value_byname_list_2', list(p
))
9696 # { list<named_pexpr_t>*tmp = p[1];
9697 # tmp->push_back(*p[3]);
9705 '''port : port_reference '''
9707 print('port_1', list(p
))
9715 '''port : '.' IDENTIFIER '(' port_reference ')' '''
9717 print('port_2', list(p
))
9719 # { Module::port_t*tmp = p[4];
9720 # tmp->name = lex_strings.make(p[2]);
9728 '''port : '{' port_reference_list '}' '''
9730 print('port_3', list(p
))
9732 # { Module::port_t*tmp = p[2];
9733 # tmp->name = perm_string();
9740 '''port : '.' IDENTIFIER '(' '{' port_reference_list '}' ')' '''
9742 print('port_4', list(p
))
9744 # { Module::port_t*tmp = p[5];
9745 # tmp->name = lex_strings.make(p[2]);
9752 def p_port_opt_1(p
):
9753 '''port_opt : port '''
9755 print('port_opt_1', list(p
))
9762 def p_port_opt_2(p
):
9765 print('port_opt_2', list(p
))
9771 def p_port_name_1(p
):
9772 '''port_name : '.' IDENTIFIER '(' expression ')' '''
9774 print('port_name_1', list(p
))
9776 # { named_pexpr_t*tmp = new named_pexpr_t;
9777 # tmp->name = lex_strings.make(p[2]);
9785 def p_port_name_2(p
):
9786 '''port_name : '.' IDENTIFIER '(' error ')' '''
9788 print('port_name_2', list(p
))
9790 # { yyerror(@3, "error: invalid port connection expression.");
9791 # named_pexpr_t*tmp = new named_pexpr_t;
9792 # tmp->name = lex_strings.make(p[2]);
9800 def p_port_name_3(p
):
9801 '''port_name : '.' IDENTIFIER '(' ')' '''
9803 print('port_name_3', list(p
))
9805 # { named_pexpr_t*tmp = new named_pexpr_t;
9806 # tmp->name = lex_strings.make(p[2]);
9814 def p_port_name_4(p
):
9815 '''port_name : '.' IDENTIFIER '''
9817 print('port_name_4', list(p
))
9819 # { named_pexpr_t*tmp = new named_pexpr_t;
9820 # tmp->name = lex_strings.make(p[2]);
9821 # tmp->parm = new PEIdent(lex_strings.make(p[2]), true);
9822 # FILE_NAME(tmp->parm, @1);
9829 def p_port_name_5(p
):
9830 '''port_name : K_DOTSTAR '''
9832 print('port_name_5', list(p
))
9834 # { named_pexpr_t*tmp = new named_pexpr_t;
9835 # tmp->name = lex_strings.make("*");
9842 def p_port_name_list_1(p
):
9843 '''port_name_list : port_name_list ',' port_name '''
9845 print('port_name_list_1', list(p
))
9847 # { list<named_pexpr_t>*tmp = p[1];
9848 # tmp->push_back(*p[3]);
9855 def p_port_name_list_2(p
):
9856 '''port_name_list : port_name '''
9858 print('port_name_list_2', list(p
))
9860 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
9861 # tmp->push_back(*p[1]);
9868 def p_port_reference_1(p
):
9869 '''port_reference : IDENTIFIER '''
9871 print('port_reference_1', list(p
))
9873 # { Module::port_t*ptmp;
9874 # perm_string name = lex_strings.make(p[1]);
9875 # ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
9882 def p_port_reference_2(p
):
9883 '''port_reference : IDENTIFIER '[' expression ':' expression ']' '''
9885 print('port_reference_2', list(p
))
9887 # { index_component_t itmp;
9888 # itmp.sel = index_component_t::SEL_PART;
9892 # name_component_t ntmp (lex_strings.make(p[1]));
9893 # ntmp.index.push_back(itmp);
9895 # pform_name_t pname;
9896 # pname.push_back(ntmp);
9898 # PEIdent*wtmp = new PEIdent(pname);
9899 # FILE_NAME(wtmp, @1);
9901 # Module::port_t*ptmp = new Module::port_t;
9902 # ptmp->name = perm_string();
9903 # ptmp->expr.push_back(wtmp);
9911 def p_port_reference_3(p
):
9912 '''port_reference : IDENTIFIER '[' expression ']' '''
9914 print('port_reference_3', list(p
))
9916 # { index_component_t itmp;
9917 # itmp.sel = index_component_t::SEL_BIT;
9921 # name_component_t ntmp (lex_strings.make(p[1]));
9922 # ntmp.index.push_back(itmp);
9924 # pform_name_t pname;
9925 # pname.push_back(ntmp);
9927 # PEIdent*tmp = new PEIdent(pname);
9928 # FILE_NAME(tmp, @1);
9930 # Module::port_t*ptmp = new Module::port_t;
9931 # ptmp->name = perm_string();
9932 # ptmp->expr.push_back(tmp);
9939 def p_port_reference_4(p
):
9940 '''port_reference : IDENTIFIER '[' error ']' '''
9942 print('port_reference_4', list(p
))
9944 # { yyerror(@1, "error: invalid port bit select");
9945 # Module::port_t*ptmp = new Module::port_t;
9946 # PEIdent*wtmp = new PEIdent(lex_strings.make(p[1]));
9947 # FILE_NAME(wtmp, @1);
9948 # ptmp->name = lex_strings.make(p[1]);
9949 # ptmp->expr.push_back(wtmp);
9956 def p_port_reference_list_1(p
):
9957 '''port_reference_list : port_reference '''
9959 print('port_reference_list_1', list(p
))
9966 def p_port_reference_list_2(p
):
9967 '''port_reference_list : port_reference_list ',' port_reference '''
9969 print('port_reference_list_2', list(p
))
9971 # { Module::port_t*tmp = p[1];
9972 # append(tmp->expr, p[3]->expr);
9979 def p_dimensions_opt_1(p
):
9980 '''dimensions_opt : '''
9981 if(parse_debug
> 2):
9982 print('dimensions_opt_1', list(p
))
9988 def p_dimensions_opt_2(p
):
9989 '''dimensions_opt : dimensions '''
9991 print('dimensions_opt_2', list(p
))
9998 def p_dimensions_1(p
):
9999 '''dimensions : variable_dimension '''
10001 print('dimensions_1', list(p
))
10008 def p_dimensions_2(p
):
10009 '''dimensions : dimensions variable_dimension '''
10011 print('dimensions_2', list(p
))
10013 # { list<pform_range_t> *tmp = p[1];
10015 # tmp->splice(tmp->end(), *p[2]);
10023 def p_register_variable_1(p
):
10024 '''register_variable : IDENTIFIER dimensions_opt '''
10026 print('register_variable_1', list(p
))
10028 # { perm_string name = lex_strings.make(p[1]);
10029 # pform_makewire(@1, name, NetNet::REG,
10030 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10031 # pform_set_reg_idx(name, p[2]);
10037 def p_register_variable_2(p
):
10038 '''register_variable : IDENTIFIER dimensions_opt '=' expression '''
10040 print('register_variable_2', list(p
))
10042 # { if (pform_peek_scope()->var_init_needs_explicit_lifetime()
10043 # && (var_lifetime == LexicalScope::INHERITED)) {
10044 # cerr << @3 << ": warning: Static variable initialization requires "
10045 # "explicit lifetime in this context." << endl;
10048 # perm_string name = lex_strings.make(p[1]);
10049 # pform_makewire(@1, name, NetNet::REG,
10050 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10051 # pform_set_reg_idx(name, p[2]);
10052 # pform_make_var_init(@1, name, p[4]);
10058 def p_register_variable_list_1(p
):
10059 '''register_variable_list : register_variable '''
10061 print('register_variable_list_1', list(p
))
10063 # { list<perm_string>*tmp = new list<perm_string>;
10064 # tmp->push_back(lex_strings.make(p[1]));
10071 def p_register_variable_list_2(p
):
10072 '''register_variable_list : register_variable_list ',' register_variable '''
10074 print('register_variable_list_2', list(p
))
10076 # { list<perm_string>*tmp = p[1];
10077 # tmp->push_back(lex_strings.make(p[3]));
10084 def p_net_variable_1(p
):
10085 '''net_variable : IDENTIFIER dimensions_opt '''
10087 print('net_variable_1', list(p
))
10089 p
[0]= ('net_variable_1', list(p
))
10091 # { perm_string name = lex_strings.make(p[1]);
10092 # pform_makewire(@1, name, NetNet::IMPLICIT,
10093 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10094 # pform_set_reg_idx(name, p[2]);
10095 #p[0] = [p[1],p[2]]
10100 def p_net_variable_list_1(p
):
10101 '''net_variable_list : net_variable '''
10103 print('net_variable_list_1', list(p
))
10104 p
[0] = ('net_variable_list_1', list(p
))
10106 # { list<perm_string>*tmp = new list<perm_string>;
10107 # tmp->push_back(lex_strings.make(p[1]));
10114 def p_net_variable_list_2(p
):
10115 '''net_variable_list : net_variable_list ',' net_variable '''
10117 print('net_variable_list_2', list(p
))
10118 p
[0] = ('net_variable_list_2', list(p
))
10120 # { list<perm_string>*tmp = p[1];
10121 # tmp->push_back(lex_strings.make(p[3]));
10128 def p_event_variable_1(p
):
10129 '''event_variable : IDENTIFIER dimensions_opt '''
10131 print('event_variable_1', list(p
))
10134 # yyerror(@2, "sorry: event arrays are not supported.");
10142 def p_event_variable_list_1(p
):
10143 '''event_variable_list : event_variable '''
10145 print('event_variable_list_1', list(p
))
10147 # { p[0] = list_from_identifier(p[1]); }
10151 def p_event_variable_list_2(p
):
10152 '''event_variable_list : event_variable_list ',' event_variable '''
10154 print('event_variable_list_2', list(p
))
10156 # { p[0] = list_from_identifier(p[1], p[3]); }
10160 def p_specify_item_1(p
):
10161 '''specify_item : K_specparam specparam_decl ';' '''
10163 print('specify_item_1', list(p
))
10169 def p_specify_item_2(p
):
10170 '''specify_item : specify_simple_path_decl ';' '''
10172 print('specify_item_2', list(p
))
10174 # { pform_module_specify_path(p[1]);
10179 def p_specify_item_3(p
):
10180 '''specify_item : specify_edge_path_decl ';' '''
10182 print('specify_item_3', list(p
))
10184 # { pform_module_specify_path(p[1]);
10189 def p_specify_item_4(p
):
10190 '''specify_item : K_if '(' expression ')' specify_simple_path_decl ';' '''
10192 print('specify_item_4', list(p
))
10194 # { PSpecPath*tmp = p[5];
10196 # tmp->conditional = true;
10197 # tmp->condition = p[3];
10199 # pform_module_specify_path(tmp);
10204 def p_specify_item_5(p
):
10205 '''specify_item : K_if '(' expression ')' specify_edge_path_decl ';' '''
10207 print('specify_item_5', list(p
))
10209 # { PSpecPath*tmp = p[5];
10211 # tmp->conditional = true;
10212 # tmp->condition = p[3];
10214 # pform_module_specify_path(tmp);
10219 def p_specify_item_6(p
):
10220 '''specify_item : K_ifnone specify_simple_path_decl ';' '''
10222 print('specify_item_6', list(p
))
10224 # { PSpecPath*tmp = p[2];
10226 # tmp->conditional = true;
10227 # tmp->condition = 0;
10229 # pform_module_specify_path(tmp);
10234 def p_specify_item_7(p
):
10235 '''specify_item : K_ifnone specify_edge_path_decl ';' '''
10237 print('specify_item_7', list(p
))
10239 # { yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
10240 # "not supported.");
10246 def p_specify_item_8(p
):
10247 '''specify_item : K_Sfullskew '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10249 print('specify_item_8', list(p
))
10257 def p_specify_item_9(p
):
10258 '''specify_item : K_Shold '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10260 print('specify_item_9', list(p
))
10267 def p_specify_item_10(p
):
10268 '''specify_item : K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10270 print('specify_item_10', list(p
))
10278 def p_specify_item_11(p
):
10279 '''specify_item : K_Speriod '(' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10281 print('specify_item_11', list(p
))
10288 def p_specify_item_12(p
):
10289 '''specify_item : K_Srecovery '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10291 print('specify_item_12', list(p
))
10298 def p_specify_item_13(p
):
10299 '''specify_item : K_Srecrem '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10301 print('specify_item_13', list(p
))
10309 def p_specify_item_14(p
):
10310 '''specify_item : K_Sremoval '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10312 print('specify_item_14', list(p
))
10319 def p_specify_item_15(p
):
10320 '''specify_item : K_Ssetup '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10322 print('specify_item_15', list(p
))
10329 def p_specify_item_16(p
):
10330 '''specify_item : K_Ssetuphold '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10332 print('specify_item_16', list(p
))
10340 def p_specify_item_17(p
):
10341 '''specify_item : K_Sskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10343 print('specify_item_17', list(p
))
10350 def p_specify_item_18(p
):
10351 '''specify_item : K_Stimeskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10353 print('specify_item_18', list(p
))
10360 def p_specify_item_19(p
):
10361 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ',' expression spec_notifier_opt ')' ';' '''
10363 print('specify_item_19', list(p
))
10371 def p_specify_item_20(p
):
10372 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ')' ';' '''
10374 print('specify_item_20', list(p
))
10381 def p_specify_item_21(p
):
10382 '''specify_item : K_pulsestyle_onevent specify_path_identifiers ';' '''
10384 print('specify_item_21', list(p
))
10391 def p_specify_item_22(p
):
10392 '''specify_item : K_pulsestyle_ondetect specify_path_identifiers ';' '''
10394 print('specify_item_22', list(p
))
10401 def p_specify_item_23(p
):
10402 '''specify_item : K_showcancelled specify_path_identifiers ';' '''
10404 print('specify_item_23', list(p
))
10411 def p_specify_item_24(p
):
10412 '''specify_item : K_noshowcancelled specify_path_identifiers ';' '''
10414 print('specify_item_24', list(p
))
10421 def p_specify_item_list_1(p
):
10422 '''specify_item_list : specify_item '''
10424 print('specify_item_list_1', list(p
))
10430 def p_specify_item_list_2(p
):
10431 '''specify_item_list : specify_item_list specify_item '''
10433 print('specify_item_list_2', list(p
))
10439 def p_specify_item_list_opt_1(p
):
10440 '''specify_item_list_opt : '''
10442 print('specify_item_list_opt_1', list(p
))
10448 def p_specify_item_list_opt_2(p
):
10449 '''specify_item_list_opt : specify_item_list '''
10451 print('specify_item_list_opt_2', list(p
))
10457 def p_specify_edge_path_decl_1(p
):
10458 '''specify_edge_path_decl : specify_edge_path '=' '(' delay_value_list ')' '''
10460 print('specify_edge_path_decl_1', list(p
))
10462 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
10466 def p_specify_edge_path_decl_2(p
):
10467 '''specify_edge_path_decl : specify_edge_path '=' delay_value_simple '''
10469 print('specify_edge_path_decl_2', list(p
))
10471 # { list<PExpr*>*tmp = new list<PExpr*>;
10472 # tmp->push_back(p[3]);
10473 # p[0] = pform_assign_path_delay(p[1], tmp);
10478 def p_edge_operator_1(p
):
10479 '''edge_operator : K_posedge '''
10481 print('edge_operator_1', list(p
))
10488 def p_edge_operator_2(p
):
10489 '''edge_operator : K_negedge '''
10491 print('edge_operator_2', list(p
))
10498 def p_specify_edge_path_1(p
):
10499 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10501 print('specify_edge_path_1', list(p
))
10503 # { int edge_flag = 0;
10504 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], false, p[6], p[8]); }
10508 def p_specify_edge_path_2(p
):
10509 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10511 print('specify_edge_path_2', list(p
))
10513 # { int edge_flag = p[2]? 1 : -1;
10514 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], false, p[7], p[9]);}
10518 def p_specify_edge_path_3(p
):
10519 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10521 print('specify_edge_path_3', list(p
))
10523 # { int edge_flag = 0;
10524 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], true, p[6], p[8]); }
10528 def p_specify_edge_path_4(p
):
10529 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10531 print('specify_edge_path_4', list(p
))
10533 # { int edge_flag = p[2]? 1 : -1;
10534 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], true, p[7], p[9]); }
10538 def p_polarity_operator_1(p
):
10539 '''polarity_operator : K_PO_POS '''
10541 print('polarity_operator_1', list(p
))
10547 def p_polarity_operator_2(p
):
10548 '''polarity_operator : K_PO_NEG '''
10550 print('polarity_operator_2', list(p
))
10556 def p_polarity_operator_3(p
):
10557 '''polarity_operator : ':' '''
10559 print('polarity_operator_3', list(p
))
10565 def p_specify_simple_path_decl_1(p
):
10566 '''specify_simple_path_decl : specify_simple_path '=' '(' delay_value_list ')' '''
10568 print('specify_simple_path_decl_1', list(p
))
10570 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
10574 def p_specify_simple_path_decl_2(p
):
10575 '''specify_simple_path_decl : specify_simple_path '=' delay_value_simple '''
10577 print('specify_simple_path_decl_2', list(p
))
10579 # { list<PExpr*>*tmp = new list<PExpr*>;
10580 # tmp->push_back(p[3]);
10581 # p[0] = pform_assign_path_delay(p[1], tmp);
10586 def p_specify_simple_path_decl_3(p
):
10587 '''specify_simple_path_decl : specify_simple_path '=' '(' error ')' '''
10589 print('specify_simple_path_decl_3', list(p
))
10591 # { yyerror(@3, "Syntax error in delay value list.");
10598 def p_specify_simple_path_1(p
):
10599 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' '''
10601 print('specify_simple_path_1', list(p
))
10603 # { p[0] = pform_make_specify_path(@1, p[2], p[3], false, p[5]); }
10607 def p_specify_simple_path_2(p
):
10608 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' '''
10610 print('specify_simple_path_2', list(p
))
10612 # { p[0] = pform_make_specify_path(@1, p[2], p[3], true, p[5]); }
10616 def p_specify_simple_path_3(p
):
10617 '''specify_simple_path : '(' error ')' '''
10619 print('specify_simple_path_3', list(p
))
10621 # { yyerror(@1, "Invalid simple path");
10627 def p_specify_path_identifiers_1(p
):
10628 '''specify_path_identifiers : IDENTIFIER '''
10630 print('specify_path_identifiers_1', list(p
))
10632 # { list<perm_string>*tmp = new list<perm_string>;
10633 # tmp->push_back(lex_strings.make(p[1]));
10640 def p_specify_path_identifiers_2(p
):
10641 '''specify_path_identifiers : IDENTIFIER '[' expr_primary ']' '''
10643 print('specify_path_identifiers_2', list(p
))
10645 # { if (gn_specify_blocks_flag) {
10646 # yywarn(@4, "Bit selects are not currently supported "
10647 # "in path declarations. The declaration "
10648 # "will be applied to the whole vector.");
10650 # list<perm_string>*tmp = new list<perm_string>;
10651 # tmp->push_back(lex_strings.make(p[1]));
10658 def p_specify_path_identifiers_3(p
):
10659 '''specify_path_identifiers : IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
10661 print('specify_path_identifiers_3', list(p
))
10663 # { if (gn_specify_blocks_flag) {
10664 # yywarn(@4, "Part selects are not currently supported "
10665 # "in path declarations. The declaration "
10666 # "will be applied to the whole vector.");
10668 # list<perm_string>*tmp = new list<perm_string>;
10669 # tmp->push_back(lex_strings.make(p[1]));
10676 def p_specify_path_identifiers_4(p
):
10677 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '''
10679 print('specify_path_identifiers_4', list(p
))
10681 # { list<perm_string>*tmp = p[1];
10682 # tmp->push_back(lex_strings.make(p[3]));
10689 def p_specify_path_identifiers_5(p
):
10690 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' '''
10692 print('specify_path_identifiers_5', list(p
))
10694 # { if (gn_specify_blocks_flag) {
10695 # yywarn(@4, "Bit selects are not currently supported "
10696 # "in path declarations. The declaration "
10697 # "will be applied to the whole vector.");
10699 # list<perm_string>*tmp = p[1];
10700 # tmp->push_back(lex_strings.make(p[3]));
10707 def p_specify_path_identifiers_6(p
):
10708 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
10710 print('specify_path_identifiers_6', list(p
))
10712 # { if (gn_specify_blocks_flag) {
10713 # yywarn(@4, "Part selects are not currently supported "
10714 # "in path declarations. The declaration "
10715 # "will be applied to the whole vector.");
10717 # list<perm_string>*tmp = p[1];
10718 # tmp->push_back(lex_strings.make(p[3]));
10725 def p_specparam_1(p
):
10726 '''specparam : IDENTIFIER '=' expression '''
10728 print('specparam_1', list(p
))
10730 # { PExpr*tmp = p[3];
10731 # pform_set_specparam(@1, lex_strings.make(p[1]),
10732 # param_active_range, tmp);
10738 def p_specparam_2(p
):
10739 '''specparam : IDENTIFIER '=' expression ':' expression ':' expression '''
10741 print('specparam_2', list(p
))
10744 # switch (min_typ_max_flag) {
10761 # if (min_typ_max_warn > 0) {
10762 # cerr << tmp->get_fileline() << ": warning: choosing ";
10763 # switch (min_typ_max_flag) {
10774 # cerr << " expression." << endl;
10775 # min_typ_max_warn -= 1;
10777 # pform_set_specparam(@1, lex_strings.make(p[1]),
10778 # param_active_range, tmp);
10784 def p_specparam_3(p
):
10785 '''specparam : PATHPULSE_IDENTIFIER '=' expression '''
10787 print('specparam_3', list(p
))
10795 def p_specparam_4(p
):
10796 '''specparam : PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' '''
10798 print('specparam_4', list(p
))
10807 def p_specparam_list_1(p
):
10808 '''specparam_list : specparam '''
10810 print('specparam_list_1', list(p
))
10816 def p_specparam_list_2(p
):
10817 '''specparam_list : specparam_list ',' specparam '''
10819 print('specparam_list_2', list(p
))
10825 def p_specparam_decl_1(p
):
10826 '''specparam_decl : specparam_list '''
10828 print('specparam_decl_1', list(p
))
10834 def p_specparam_decl_2(p
):
10835 '''specparam_decl : dimensions _embed0_specparam_decl specparam_list '''
10837 print('specparam_decl_2', list(p
))
10839 # { param_active_range = 0; }
10843 def p__embed0_specparam_decl(p
):
10844 '''_embed0_specparam_decl : '''
10846 # { param_active_range = p[1]; }
10850 def p_spec_polarity_1(p
):
10851 '''spec_polarity : '+' '''
10853 print('spec_polarity_1', list(p
))
10859 def p_spec_polarity_2(p
):
10860 '''spec_polarity : '-' '''
10862 print('spec_polarity_2', list(p
))
10868 def p_spec_polarity_3(p
):
10869 '''spec_polarity : '''
10871 print('spec_polarity_3', list(p
))
10877 def p_spec_reference_event_1(p
):
10878 '''spec_reference_event : K_posedge expression '''
10880 print('spec_reference_event_1', list(p
))
10886 def p_spec_reference_event_2(p
):
10887 '''spec_reference_event : K_negedge expression '''
10889 print('spec_reference_event_2', list(p
))
10895 def p_spec_reference_event_3(p
):
10896 '''spec_reference_event : K_posedge expr_primary K_TAND expression '''
10898 print('spec_reference_event_3', list(p
))
10906 def p_spec_reference_event_4(p
):
10907 '''spec_reference_event : K_negedge expr_primary K_TAND expression '''
10909 print('spec_reference_event_4', list(p
))
10917 def p_spec_reference_event_5(p
):
10918 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary '''
10920 print('spec_reference_event_5', list(p
))
10926 def p_spec_reference_event_6(p
):
10927 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression '''
10929 print('spec_reference_event_6', list(p
))
10937 def p_spec_reference_event_7(p
):
10938 '''spec_reference_event : expr_primary K_TAND expression '''
10940 print('spec_reference_event_7', list(p
))
10948 def p_spec_reference_event_8(p
):
10949 '''spec_reference_event : expr_primary '''
10951 print('spec_reference_event_8', list(p
))
10957 def p_edge_descriptor_list_1(p
):
10958 '''edge_descriptor_list : edge_descriptor_list ',' K_edge_descriptor '''
10960 print('edge_descriptor_list_1', list(p
))
10966 def p_edge_descriptor_list_2(p
):
10967 '''edge_descriptor_list : K_edge_descriptor '''
10969 print('edge_descriptor_list_2', list(p
))
10975 def p_spec_notifier_opt_1(p
):
10976 '''spec_notifier_opt : '''
10978 print('spec_notifier_opt_1', list(p
))
10984 def p_spec_notifier_opt_2(p
):
10985 '''spec_notifier_opt : spec_notifier '''
10987 print('spec_notifier_opt_2', list(p
))
10993 def p_spec_notifier_1(p
):
10994 '''spec_notifier : ',' '''
10996 print('spec_notifier_1', list(p
))
10998 # { args_after_notifier = 0; }
11002 def p_spec_notifier_2(p
):
11003 '''spec_notifier : ',' hierarchy_identifier '''
11005 print('spec_notifier_2', list(p
))
11007 # { args_after_notifier = 0; delete p[2]; }
11011 def p_spec_notifier_3(p
):
11012 '''spec_notifier : spec_notifier ',' '''
11014 print('spec_notifier_3', list(p
))
11016 # { args_after_notifier += 1; }
11020 def p_spec_notifier_4(p
):
11021 '''spec_notifier : spec_notifier ',' hierarchy_identifier '''
11023 print('spec_notifier_4', list(p
))
11025 # { args_after_notifier += 1;
11026 # if (args_after_notifier >= 3) {
11027 # cerr << @3 << ": warning: timing checks are not supported "
11028 # "and delayed signal \"" << *p[3]
11029 # << "\" will not be driven." << endl;
11035 def p_spec_notifier_5(p
):
11036 '''spec_notifier : IDENTIFIER '''
11038 print('spec_notifier_5', list(p
))
11040 # { args_after_notifier = 0; delete[]p[1]; }
11044 def p_statement_item_1(p
):
11045 '''statement_item : K_assign lpvalue '=' expression ';' '''
11047 print('statement_item_1', list(p
))
11049 # { PCAssign*tmp = new PCAssign(p[2], p[4]);
11050 # FILE_NAME(tmp, @1);
11056 def p_statement_item_2(p
):
11057 '''statement_item : K_deassign lpvalue ';' '''
11059 print('statement_item_2', list(p
))
11061 # { PDeassign*tmp = new PDeassign(p[2]);
11062 # FILE_NAME(tmp, @1);
11068 def p_statement_item_3(p
):
11069 '''statement_item : K_force lpvalue '=' expression ';' '''
11071 print('statement_item_3', list(p
))
11073 # { PForce*tmp = new PForce(p[2], p[4]);
11074 # FILE_NAME(tmp, @1);
11080 def p_statement_item_4(p
):
11081 '''statement_item : K_release lpvalue ';' '''
11083 print('statement_item_4', list(p
))
11085 # { PRelease*tmp = new PRelease(p[2]);
11086 # FILE_NAME(tmp, @1);
11092 def p_statement_item_5(p
):
11093 '''statement_item : K_begin K_end '''
11095 print('statement_item_5', list(p
))
11097 # { PBlock*tmp = new PBlock(PBlock::BL_SEQ);
11098 # FILE_NAME(tmp, @1);
11104 def p_statement_item_6(p
):
11105 '''statement_item : K_begin _embed0_statement_item block_item_decls_opt _embed1_statement_item statement_or_null_list K_end '''
11107 print('statement_item_6', list(p
))
11111 # pform_pop_scope();
11112 # assert(! current_block_stack.empty());
11113 # tmp = current_block_stack.top();
11114 # current_block_stack.pop();
11116 # tmp = new PBlock(PBlock::BL_SEQ);
11117 # FILE_NAME(tmp, @1);
11119 # if (p[5]) tmp->set_statement(*p[5]);
11126 def p_statement_item_7(p
):
11127 '''statement_item : K_begin ':' IDENTIFIER _embed2_statement_item block_item_decls_opt statement_or_null_list_opt K_end endlabel_opt '''
11129 print('statement_item_7', list(p
))
11131 # { pform_pop_scope();
11132 # assert(! current_block_stack.empty());
11133 # PBlock*tmp = current_block_stack.top();
11134 # current_block_stack.pop();
11135 # if (p[6]) tmp->set_statement(*p[6]);
11138 # if (strcmp(p[3],p[8]) != 0) {
11139 # yyerror(@8, "error: End label doesn't match begin name");
11141 # if (! gn_system_verilog()) {
11142 # yyerror(@8, "error: Begin end labels require "
11143 # "SystemVerilog.");
11153 def p_statement_item_8(p
):
11154 '''statement_item : K_fork join_keyword '''
11156 print('statement_item_8', list(p
))
11158 # { PBlock*tmp = new PBlock(p[2]);
11159 # FILE_NAME(tmp, @1);
11165 def p_statement_item_9(p
):
11166 '''statement_item : K_fork _embed3_statement_item block_item_decls_opt _embed4_statement_item statement_or_null_list join_keyword '''
11168 print('statement_item_9', list(p
))
11172 # pform_pop_scope();
11173 # assert(! current_block_stack.empty());
11174 # tmp = current_block_stack.top();
11175 # current_block_stack.pop();
11176 # tmp->set_join_type(p[6]);
11178 # tmp = new PBlock(p[6]);
11179 # FILE_NAME(tmp, @1);
11181 # if (p[5]) tmp->set_statement(*p[5]);
11188 def p_statement_item_10(p
):
11189 '''statement_item : K_fork ':' IDENTIFIER _embed5_statement_item block_item_decls_opt statement_or_null_list_opt join_keyword endlabel_opt '''
11191 print('statement_item_10', list(p
))
11193 # { pform_pop_scope();
11194 # assert(! current_block_stack.empty());
11195 # PBlock*tmp = current_block_stack.top();
11196 # current_block_stack.pop();
11197 # tmp->set_join_type(p[7]);
11198 # if (p[6]) tmp->set_statement(*p[6]);
11201 # if (strcmp(p[3],p[8]) != 0) {
11202 # yyerror(@8, "error: End label doesn't match fork name");
11204 # if (! gn_system_verilog()) {
11205 # yyerror(@8, "error: Fork end labels require "
11206 # "SystemVerilog.");
11216 def p_statement_item_11(p
):
11217 '''statement_item : K_disable hierarchy_identifier ';' '''
11219 print('statement_item_11', list(p
))
11221 # { PDisable*tmp = new PDisable(*p[2]);
11222 # FILE_NAME(tmp, @1);
11229 def p_statement_item_12(p
):
11230 '''statement_item : K_disable K_fork ';' '''
11232 print('statement_item_12', list(p
))
11234 # { pform_name_t tmp_name;
11235 # PDisable*tmp = new PDisable(tmp_name);
11236 # FILE_NAME(tmp, @1);
11242 def p_statement_item_13(p
):
11243 '''statement_item : K_TRIGGER hierarchy_identifier ';' '''
11245 print('statement_item_13', list(p
))
11247 # { PTrigger*tmp = new PTrigger(*p[2]);
11248 # FILE_NAME(tmp, @1);
11255 def p_statement_item_14(p
):
11256 '''statement_item : procedural_assertion_statement '''
11258 print('statement_item_14', list(p
))
11265 def p_statement_item_15(p
):
11266 '''statement_item : loop_statement '''
11268 print('statement_item_15', list(p
))
11275 def p_statement_item_16(p
):
11276 '''statement_item : jump_statement '''
11278 print('statement_item_16', list(p
))
11285 def p_statement_item_17(p
):
11286 '''statement_item : K_case '(' expression ')' case_items K_endcase '''
11288 print('statement_item_17', list(p
))
11290 # { PCase*tmp = new PCase(NetCase::EQ, p[3], p[5]);
11291 # FILE_NAME(tmp, @1);
11297 def p_statement_item_18(p
):
11298 '''statement_item : K_casex '(' expression ')' case_items K_endcase '''
11300 print('statement_item_18', list(p
))
11302 # { PCase*tmp = new PCase(NetCase::EQX, p[3], p[5]);
11303 # FILE_NAME(tmp, @1);
11309 def p_statement_item_19(p
):
11310 '''statement_item : K_casez '(' expression ')' case_items K_endcase '''
11312 print('statement_item_19', list(p
))
11314 # { PCase*tmp = new PCase(NetCase::EQZ, p[3], p[5]);
11315 # FILE_NAME(tmp, @1);
11321 def p_statement_item_20(p
):
11322 '''statement_item : K_case '(' expression ')' error K_endcase '''
11324 print('statement_item_20', list(p
))
11330 def p_statement_item_21(p
):
11331 '''statement_item : K_casex '(' expression ')' error K_endcase '''
11333 print('statement_item_21', list(p
))
11339 def p_statement_item_22(p
):
11340 '''statement_item : K_casez '(' expression ')' error K_endcase '''
11342 print('statement_item_22', list(p
))
11348 def p_statement_item_23(p
):
11349 '''statement_item : K_if '(' expression ')' statement_or_null %prec less_than_K_else '''
11351 print('statement_item_23', list(p
))
11353 # { PCondit*tmp = new PCondit(p[3], p[5], 0);
11354 # FILE_NAME(tmp, @1);
11360 def p_statement_item_24(p
):
11361 '''statement_item : K_if '(' expression ')' statement_or_null K_else statement_or_null '''
11363 print('statement_item_24', list(p
))
11365 # { PCondit*tmp = new PCondit(p[3], p[5], p[7]);
11366 # FILE_NAME(tmp, @1);
11372 def p_statement_item_25(p
):
11373 '''statement_item : K_if '(' error ')' statement_or_null %prec less_than_K_else '''
11375 print('statement_item_25', list(p
))
11377 # { yyerror(@1, "error: Malformed conditional expression.");
11383 def p_statement_item_26(p
):
11384 '''statement_item : K_if '(' error ')' statement_or_null K_else statement_or_null '''
11386 print('statement_item_26', list(p
))
11388 # { yyerror(@1, "error: Malformed conditional expression.");
11394 def p_statement_item_27(p
):
11395 '''statement_item : compressed_statement ';' '''
11397 print('statement_item_27', list(p
))
11404 def p_statement_item_28(p
):
11405 '''statement_item : inc_or_dec_expression ';' '''
11407 print('statement_item_28', list(p
))
11409 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
11413 def p_statement_item_29(p
):
11414 '''statement_item : delay1 statement_or_null '''
11416 print('statement_item_29', list(p
))
11418 # { PExpr*del = p[1]->front();
11419 # assert(p[1]->size() == 1);
11421 # PDelayStatement*tmp = new PDelayStatement(del, p[2]);
11422 # FILE_NAME(tmp, @1);
11428 def p_statement_item_30(p
):
11429 '''statement_item : event_control statement_or_null '''
11431 print('statement_item_30', list(p
))
11433 # { PEventStatement*tmp = p[1];
11435 # yyerror(@1, "error: Invalid event control.");
11438 # tmp->set_statement(p[2]);
11445 def p_statement_item_31(p
):
11446 '''statement_item : '@' '*' statement_or_null '''
11448 print('statement_item_31', list(p
))
11450 # { PEventStatement*tmp = new PEventStatement;
11451 # FILE_NAME(tmp, @1);
11452 # tmp->set_statement(p[3]);
11458 def p_statement_item_32(p
):
11459 '''statement_item : '@' '(' '*' ')' statement_or_null '''
11461 print('statement_item_32', list(p
))
11463 # { PEventStatement*tmp = new PEventStatement;
11464 # FILE_NAME(tmp, @1);
11465 # tmp->set_statement(p[5]);
11471 def p_statement_item_33(p
):
11472 '''statement_item : lpvalue '=' expression ';' '''
11474 print('statement_item33', list(p
))
11476 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), p
[3]])
11478 print("expr TODO", repr(expr
))
11480 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), ])
11482 print("expr", repr(expr
))
11484 print("expr (python):'%s'" % expr
)
11487 # { PAssign*tmp = new PAssign(p[1],p[3]);
11488 # FILE_NAME(tmp, @1);
11494 def p_statement_item_34(p
):
11495 '''statement_item : error '=' expression ';' '''
11497 print('statement_item_34', list(p
))
11499 # { yyerror(@2, "Syntax in assignment statement l-value.");
11501 # p[0] = new PNoop;
11506 def p_statement_item_35(p
):
11507 '''statement_item : lpvalue K_LE expression ';' '''
11509 print('statement_item_35', list(p
))
11511 # { PAssignNB*tmp = new PAssignNB(p[1],p[3]);
11512 # FILE_NAME(tmp, @1);
11518 def p_statement_item_36(p
):
11519 '''statement_item : error K_LE expression ';' '''
11521 print('statement_item_36', list(p
))
11523 # { yyerror(@2, "Syntax in assignment statement l-value.");
11525 # p[0] = new PNoop;
11530 def p_statement_item_37(p
):
11531 '''statement_item : lpvalue '=' delay1 expression ';' '''
11533 print('statement_item_37', list(p
))
11535 # { PExpr*del = p[3]->front(); p[3]->pop_front();
11536 # assert(p[3]->empty());
11537 # PAssign*tmp = new PAssign(p[1],del,p[4]);
11538 # FILE_NAME(tmp, @1);
11544 def p_statement_item_38(p
):
11545 '''statement_item : lpvalue K_LE delay1 expression ';' '''
11547 print('statement_item_38', list(p
))
11549 # { PExpr*del = p[3]->front(); p[3]->pop_front();
11550 # assert(p[3]->empty());
11551 # PAssignNB*tmp = new PAssignNB(p[1],del,p[4]);
11552 # FILE_NAME(tmp, @1);
11558 def p_statement_item_39(p
):
11559 '''statement_item : lpvalue '=' event_control expression ';' '''
11561 print('statement_item_39', list(p
))
11563 # { PAssign*tmp = new PAssign(p[1],0,p[3],p[4]);
11564 # FILE_NAME(tmp, @1);
11570 def p_statement_item_40(p
):
11571 '''statement_item : lpvalue '=' K_repeat '(' expression ')' event_control expression ';' '''
11573 print('statement_item_40', list(p
))
11575 # { PAssign*tmp = new PAssign(p[1],p[5],p[7],p[8]);
11576 # FILE_NAME(tmp,@1);
11577 # tmp->set_lineno(@1.first_line);
11583 def p_statement_item_41(p
):
11584 '''statement_item : lpvalue K_LE event_control expression ';' '''
11586 print('statement_item_41', list(p
))
11588 # { PAssignNB*tmp = new PAssignNB(p[1],0,p[3],p[4]);
11589 # FILE_NAME(tmp, @1);
11595 def p_statement_item_42(p
):
11596 '''statement_item : lpvalue K_LE K_repeat '(' expression ')' event_control expression ';' '''
11598 print('statement_item_42', list(p
))
11600 # { PAssignNB*tmp = new PAssignNB(p[1],p[5],p[7],p[8]);
11601 # FILE_NAME(tmp, @1);
11607 def p_statement_item_43(p
):
11608 '''statement_item : lpvalue '=' dynamic_array_new ';' '''
11610 print('statement_item_43', list(p
))
11612 # { PAssign*tmp = new PAssign(p[1],p[3]);
11613 # FILE_NAME(tmp, @1);
11619 def p_statement_item_44(p
):
11620 '''statement_item : lpvalue '=' class_new ';' '''
11622 print('statement_item_44', list(p
))
11624 # { PAssign*tmp = new PAssign(p[1],p[3]);
11625 # FILE_NAME(tmp, @1);
11631 def p_statement_item_45(p
):
11632 '''statement_item : K_wait '(' expression ')' statement_or_null '''
11634 print('statement_item_45', list(p
))
11636 # { PEventStatement*tmp;
11637 # PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, p[3]);
11638 # tmp = new PEventStatement(etmp);
11639 # FILE_NAME(tmp,@1);
11640 # tmp->set_statement(p[5]);
11646 def p_statement_item_46(p
):
11647 '''statement_item : K_wait K_fork ';' '''
11649 print('statement_item_46', list(p
))
11651 # { PEventStatement*tmp = new PEventStatement((PEEvent*)0);
11652 # FILE_NAME(tmp,@1);
11658 def p_statement_item_47(p
):
11659 '''statement_item : SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';' '''
11661 print('statement_item_47', list(p
))
11663 # { PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), *p[3]);
11664 # FILE_NAME(tmp,@1);
11672 def p_statement_item_48(p
):
11673 '''statement_item : SYSTEM_IDENTIFIER ';' '''
11675 print('statement_item_48', list(p
))
11677 # { list<PExpr*>pt;
11678 # PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), pt);
11679 # FILE_NAME(tmp,@1);
11686 def p_statement_item_49(p
):
11687 '''statement_item : hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
11689 print('statement_item_49', list(p
))
11691 # { PCallTask*tmp = pform_make_call_task(@1, *p[1], *p[3]);
11699 def p_statement_item_50(p
):
11700 '''statement_item : hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';' '''
11702 print('statement_item_50', list(p
))
11704 # { /* ....randomize with { <constraints> } */
11705 # if (p[1] && peek_tail_name(*p[1]) == "randomize") {
11706 # if (!gn_system_verilog())
11707 # yyerror(@2, "error: Randomize with constraint requires SystemVerilog.");
11709 # yyerror(@2, "sorry: Randomize with constraint not supported.");
11711 # yyerror(@2, "error: Constraint block can only be applied to randomize method.");
11714 # PCallTask*tmp = new PCallTask(*p[1], pt);
11715 # FILE_NAME(tmp, @1);
11722 def p_statement_item_51(p
):
11723 '''statement_item : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
11725 print('statement_item_51', list(p
))
11727 # { pform_name_t*t_name = p[1];
11728 # while (! p[3]->empty()) {
11729 # t_name->push_back(p[3]->front());
11730 # p[3]->pop_front();
11732 # PCallTask*tmp = new PCallTask(*t_name, *p[5]);
11733 # FILE_NAME(tmp, @1);
11742 def p_statement_item_52(p
):
11743 '''statement_item : hierarchy_identifier ';' '''
11745 print('statement_item_52', list(p
))
11747 # { list<PExpr*>pt;
11748 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
11755 def p_statement_item_53(p
):
11756 '''statement_item : implicit_class_handle '.' K_new '(' expression_list_with_nuls ')' ';' '''
11758 print('statement_item_53', list(p
))
11760 # { PChainConstructor*tmp = new PChainConstructor(*p[5]);
11761 # FILE_NAME(tmp, @3);
11768 def p_statement_item_54(p
):
11769 '''statement_item : hierarchy_identifier '(' error ')' ';' '''
11771 print('statement_item_54', list(p
))
11773 # { yyerror(@3, "error: Syntax error in task arguments.");
11775 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
11782 def p_statement_item_55(p
):
11783 '''statement_item : error ';' '''
11785 print('statement_item_55', list(p
))
11787 # { yyerror(@2, "error: malformed statement");
11789 # p[0] = new PNoop;
11794 def p__embed0_statement_item(p
):
11795 '''_embed0_statement_item : '''
11797 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_SEQ);
11798 # FILE_NAME(tmp, @1);
11799 # current_block_stack.push(tmp);
11804 def p__embed1_statement_item(p
):
11805 '''_embed1_statement_item : '''
11808 # if (! gn_system_verilog()) {
11809 # yyerror("error: Variable declaration in unnamed block "
11810 # "requires SystemVerilog.");
11813 # /* If there are no declarations in the scope then just delete it. */
11814 # pform_pop_scope();
11815 # assert(! current_block_stack.empty());
11816 # PBlock*tmp = current_block_stack.top();
11817 # current_block_stack.pop();
11824 def p__embed2_statement_item(p
):
11825 '''_embed2_statement_item : '''
11827 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_SEQ);
11828 # FILE_NAME(tmp, @1);
11829 # current_block_stack.push(tmp);
11834 def p__embed3_statement_item(p
):
11835 '''_embed3_statement_item : '''
11837 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
11838 # FILE_NAME(tmp, @1);
11839 # current_block_stack.push(tmp);
11844 def p__embed4_statement_item(p
):
11845 '''_embed4_statement_item : '''
11848 # if (! gn_system_verilog()) {
11849 # yyerror("error: Variable declaration in unnamed block "
11850 # "requires SystemVerilog.");
11853 # /* If there are no declarations in the scope then just delete it. */
11854 # pform_pop_scope();
11855 # assert(! current_block_stack.empty());
11856 # PBlock*tmp = current_block_stack.top();
11857 # current_block_stack.pop();
11864 def p__embed5_statement_item(p
):
11865 '''_embed5_statement_item : '''
11867 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_PAR);
11868 # FILE_NAME(tmp, @1);
11869 # current_block_stack.push(tmp);
11874 def p_compressed_statement_1(p
):
11875 '''compressed_statement : lpvalue K_PLUS_EQ expression '''
11877 print('compressed_statement_1', list(p
))
11879 # { PAssign*tmp = new PAssign(p[1], '+', p[3]);
11880 # FILE_NAME(tmp, @1);
11886 def p_compressed_statement_2(p
):
11887 '''compressed_statement : lpvalue K_MINUS_EQ expression '''
11889 print('compressed_statement_2', list(p
))
11891 # { PAssign*tmp = new PAssign(p[1], '-', p[3]);
11892 # FILE_NAME(tmp, @1);
11898 def p_compressed_statement_3(p
):
11899 '''compressed_statement : lpvalue K_MUL_EQ expression '''
11901 print('compressed_statement_3', list(p
))
11903 # { PAssign*tmp = new PAssign(p[1], '*', p[3]);
11904 # FILE_NAME(tmp, @1);
11910 def p_compressed_statement_4(p
):
11911 '''compressed_statement : lpvalue K_DIV_EQ expression '''
11913 print('compressed_statement_4', list(p
))
11915 # { PAssign*tmp = new PAssign(p[1], '/', p[3]);
11916 # FILE_NAME(tmp, @1);
11922 def p_compressed_statement_5(p
):
11923 '''compressed_statement : lpvalue K_MOD_EQ expression '''
11925 print('compressed_statement_5', list(p
))
11927 # { PAssign*tmp = new PAssign(p[1], '%', p[3]);
11928 # FILE_NAME(tmp, @1);
11934 def p_compressed_statement_6(p
):
11935 '''compressed_statement : lpvalue K_AND_EQ expression '''
11937 print('compressed_statement_6', list(p
))
11939 # { PAssign*tmp = new PAssign(p[1], '&', p[3]);
11940 # FILE_NAME(tmp, @1);
11946 def p_compressed_statement_7(p
):
11947 '''compressed_statement : lpvalue K_OR_EQ expression '''
11949 print('compressed_statement_7', list(p
))
11951 # { PAssign*tmp = new PAssign(p[1], '|', p[3]);
11952 # FILE_NAME(tmp, @1);
11958 def p_compressed_statement_8(p
):
11959 '''compressed_statement : lpvalue K_XOR_EQ expression '''
11961 print('compressed_statement_8', list(p
))
11963 # { PAssign*tmp = new PAssign(p[1], '^', p[3]);
11964 # FILE_NAME(tmp, @1);
11970 def p_compressed_statement_9(p
):
11971 '''compressed_statement : lpvalue K_LS_EQ expression '''
11973 print('compressed_statement_9', list(p
))
11975 # { PAssign *tmp = new PAssign(p[1], 'l', p[3]);
11976 # FILE_NAME(tmp, @1);
11982 def p_compressed_statement_10(p
):
11983 '''compressed_statement : lpvalue K_RS_EQ expression '''
11985 print('compressed_statement_10', list(p
))
11987 # { PAssign*tmp = new PAssign(p[1], 'r', p[3]);
11988 # FILE_NAME(tmp, @1);
11994 def p_compressed_statement_11(p
):
11995 '''compressed_statement : lpvalue K_RSS_EQ expression '''
11997 print('compressed_statement_11', list(p
))
11999 # { PAssign *tmp = new PAssign(p[1], 'R', p[3]);
12000 # FILE_NAME(tmp, @1);
12006 def p_statement_or_null_list_opt_1(p
):
12007 '''statement_or_null_list_opt : statement_or_null_list '''
12009 print('statement_or_null_list_opt_1', list(p
))
12016 def p_statement_or_null_list_opt_2(p
):
12017 '''statement_or_null_list_opt : '''
12019 print('statement_or_null_list_opt_2', list(p
))
12025 def p_statement_or_null_list_1(p
):
12026 '''statement_or_null_list : statement_or_null_list statement_or_null '''
12028 print('statement_or_null_list_1', list(p
))
12030 # { vector<Statement*>*tmp = p[1];
12031 # if (p[2]) tmp->push_back(p[2]);
12037 def p_statement_or_null_list_2(p
):
12038 '''statement_or_null_list : statement_or_null '''
12040 print('statement_or_null_list_2', list(p
))
12042 # { vector<Statement*>*tmp = new vector<Statement*>(0);
12043 # if (p[1]) tmp->push_back(p[1]);
12049 def p_analog_statement_1(p
):
12050 '''analog_statement : branch_probe_expression K_CONTRIBUTE expression ';' '''
12052 print('analog_statement_1', list(p
))
12054 # { p[0] = pform_contribution_statement(@2, p[1], p[3]); }
12058 def p_task_item_1(p
):
12059 '''task_item : block_item_decl '''
12061 print('task_item_1', list(p
))
12063 # { p[0] = new vector<pform_tf_port_t>(0); }
12067 def p_task_item_2(p
):
12068 '''task_item : tf_port_declaration '''
12070 print('task_item_2', list(p
))
12077 def p_task_item_list_1(p
):
12078 '''task_item_list : task_item_list task_item '''
12080 print('task_item_list_1', list(p
))
12082 # { vector<pform_tf_port_t>*tmp = p[1];
12083 # size_t s1 = tmp->size();
12084 # tmp->resize(s1 + p[2]->size());
12085 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
12086 # tmp->at(s1 + idx) = p[2]->at(idx);
12093 def p_task_item_list_2(p
):
12094 '''task_item_list : task_item '''
12096 print('task_item_list_2', list(p
))
12103 def p_task_item_list_opt_1(p
):
12104 '''task_item_list_opt : task_item_list '''
12106 print('task_item_list_opt_1', list(p
))
12113 def p_task_item_list_opt_2(p
):
12114 '''task_item_list_opt : '''
12116 print('task_item_list_opt_2', list(p
))
12122 def p_tf_port_list_opt_1(p
):
12123 '''tf_port_list_opt : tf_port_list '''
12125 print('tf_port_list_opt_1', list(p
))
12132 def p_tf_port_list_opt_2(p
):
12133 '''tf_port_list_opt : '''
12135 print('tf_port_list_opt_2', list(p
))
12141 def p_udp_body_1(p
):
12142 '''udp_body : K_table udp_entry_list K_endtable '''
12144 print('udp_body_1', list(p
))
12146 # { lex_end_table();
12152 def p_udp_body_2(p
):
12153 '''udp_body : K_table K_endtable '''
12155 print('udp_body_2', list(p
))
12157 # { lex_end_table();
12158 # yyerror(@1, "error: Empty UDP table.");
12164 def p_udp_body_3(p
):
12165 '''udp_body : K_table error K_endtable '''
12167 print('udp_body_3', list(p
))
12169 # { lex_end_table();
12170 # yyerror(@2, "Errors in UDP table");
12177 def p_udp_entry_list_1(p
):
12178 '''udp_entry_list : udp_comb_entry_list '''
12180 print('udp_entry_list_1', list(p
))
12186 def p_udp_entry_list_2(p
):
12187 '''udp_entry_list : udp_sequ_entry_list '''
12189 print('udp_entry_list_2', list(p
))
12195 def p_udp_comb_entry_1(p
):
12196 '''udp_comb_entry : udp_input_list ':' udp_output_sym ';' '''
12198 print('udp_comb_entry_1', list(p
))
12200 # { char*tmp = new char[strlen(p[1])+3];
12201 # strcpy(tmp, p[1]);
12202 # char*tp = tmp+strlen(tmp);
12212 def p_udp_comb_entry_list_1(p
):
12213 '''udp_comb_entry_list : udp_comb_entry '''
12215 print('udp_comb_entry_list_1', list(p
))
12217 # { list<string>*tmp = new list<string>;
12218 # tmp->push_back(p[1]);
12225 def p_udp_comb_entry_list_2(p
):
12226 '''udp_comb_entry_list : udp_comb_entry_list udp_comb_entry '''
12228 print('udp_comb_entry_list_2', list(p
))
12230 # { list<string>*tmp = p[1];
12231 # tmp->push_back(p[2]);
12238 def p_udp_sequ_entry_list_1(p
):
12239 '''udp_sequ_entry_list : udp_sequ_entry '''
12241 print('udp_sequ_entry_list_1', list(p
))
12243 # { list<string>*tmp = new list<string>;
12244 # tmp->push_back(p[1]);
12251 def p_udp_sequ_entry_list_2(p
):
12252 '''udp_sequ_entry_list : udp_sequ_entry_list udp_sequ_entry '''
12254 print('udp_sequ_entry_list_2', list(p
))
12256 # { list<string>*tmp = p[1];
12257 # tmp->push_back(p[2]);
12264 def p_udp_sequ_entry_1(p
):
12265 '''udp_sequ_entry : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' '''
12267 print('udp_sequ_entry_1', list(p
))
12269 # { char*tmp = new char[strlen(p[1])+5];
12270 # strcpy(tmp, p[1]);
12271 # char*tp = tmp+strlen(tmp);
12282 def p_udp_initial_1(p
):
12283 '''udp_initial : K_initial IDENTIFIER '=' number ';' '''
12285 print('udp_initial_1', list(p
))
12287 # { PExpr*etmp = new PENumber(p[4]);
12288 # PEIdent*itmp = new PEIdent(lex_strings.make(p[2]));
12289 # PAssign*atmp = new PAssign(itmp, etmp);
12290 # FILE_NAME(atmp, @2);
12297 def p_udp_init_opt_1(p
):
12298 '''udp_init_opt : udp_initial '''
12300 print('udp_init_opt_1', list(p
))
12307 def p_udp_init_opt_2(p
):
12308 '''udp_init_opt : '''
12310 print('udp_init_opt_2', list(p
))
12316 def p_udp_input_list_1(p
):
12317 '''udp_input_list : udp_input_sym '''
12319 print('udp_input_list_1', list(p
))
12321 # { char*tmp = new char[2];
12329 def p_udp_input_list_2(p
):
12330 '''udp_input_list : udp_input_list udp_input_sym '''
12332 print('udp_input_list_2', list(p
))
12334 # { char*tmp = new char[strlen(p[1])+2];
12335 # strcpy(tmp, p[1]);
12336 # char*tp = tmp+strlen(tmp);
12345 def p_udp_input_sym_1(p
):
12346 '''udp_input_sym : '0' '''
12348 print('udp_input_sym_1', list(p
))
12354 def p_udp_input_sym_2(p
):
12355 '''udp_input_sym : '1' '''
12357 print('udp_input_sym_2', list(p
))
12363 def p_udp_input_sym_3(p
):
12364 '''udp_input_sym : 'x' '''
12366 print('udp_input_sym_3', list(p
))
12372 def p_udp_input_sym_4(p
):
12373 '''udp_input_sym : '?' '''
12375 print('udp_input_sym_4', list(p
))
12381 def p_udp_input_sym_5(p
):
12382 '''udp_input_sym : 'b' '''
12384 print('udp_input_sym_5', list(p
))
12390 def p_udp_input_sym_6(p
):
12391 '''udp_input_sym : '*' '''
12393 print('udp_input_sym_6', list(p
))
12399 def p_udp_input_sym_7(p
):
12400 '''udp_input_sym : '%' '''
12402 print('udp_input_sym_7', list(p
))
12408 def p_udp_input_sym_8(p
):
12409 '''udp_input_sym : 'f' '''
12411 print('udp_input_sym_8', list(p
))
12417 def p_udp_input_sym_9(p
):
12418 '''udp_input_sym : 'F' '''
12420 print('udp_input_sym_9', list(p
))
12426 def p_udp_input_sym_10(p
):
12427 '''udp_input_sym : 'l' '''
12429 print('udp_input_sym_10', list(p
))
12435 def p_udp_input_sym_11(p
):
12436 '''udp_input_sym : 'h' '''
12438 print('udp_input_sym_11', list(p
))
12444 def p_udp_input_sym_12(p
):
12445 '''udp_input_sym : 'B' '''
12447 print('udp_input_sym_12', list(p
))
12453 def p_udp_input_sym_13(p
):
12454 '''udp_input_sym : 'r' '''
12456 print('udp_input_sym_13', list(p
))
12462 def p_udp_input_sym_14(p
):
12463 '''udp_input_sym : 'R' '''
12465 print('udp_input_sym_14', list(p
))
12471 def p_udp_input_sym_15(p
):
12472 '''udp_input_sym : 'M' '''
12474 print('udp_input_sym_15', list(p
))
12480 def p_udp_input_sym_16(p
):
12481 '''udp_input_sym : 'n' '''
12483 print('udp_input_sym_16', list(p
))
12489 def p_udp_input_sym_17(p
):
12490 '''udp_input_sym : 'N' '''
12492 print('udp_input_sym_17', list(p
))
12498 def p_udp_input_sym_18(p
):
12499 '''udp_input_sym : 'p' '''
12501 print('udp_input_sym_18', list(p
))
12507 def p_udp_input_sym_19(p
):
12508 '''udp_input_sym : 'P' '''
12510 print('udp_input_sym_19', list(p
))
12516 def p_udp_input_sym_20(p
):
12517 '''udp_input_sym : 'Q' '''
12519 print('udp_input_sym_20', list(p
))
12525 def p_udp_input_sym_21(p
):
12526 '''udp_input_sym : 'q' '''
12528 print('udp_input_sym_21', list(p
))
12534 def p_udp_input_sym_22(p
):
12535 '''udp_input_sym : '_' '''
12537 print('udp_input_sym_22', list(p
))
12543 def p_udp_input_sym_23(p
):
12544 '''udp_input_sym : '+' '''
12546 print('udp_input_sym_23', list(p
))
12552 def p_udp_input_sym_24(p
):
12553 '''udp_input_sym : DEC_NUMBER '''
12555 print('udp_input_sym_24', list(p
))
12557 # { yyerror(@1, "internal error: Input digits parse as decimal number!"); p[0] = '0'; }
12561 def p_udp_output_sym_1(p
):
12562 '''udp_output_sym : '0' '''
12564 print('udp_output_sym_1', list(p
))
12570 def p_udp_output_sym_2(p
):
12571 '''udp_output_sym : '1' '''
12573 print('udp_output_sym_2', list(p
))
12579 def p_udp_output_sym_3(p
):
12580 '''udp_output_sym : 'x' '''
12582 print('udp_output_sym_3', list(p
))
12588 def p_udp_output_sym_4(p
):
12589 '''udp_output_sym : '-' '''
12591 print('udp_output_sym_4', list(p
))
12597 def p_udp_output_sym_5(p
):
12598 '''udp_output_sym : DEC_NUMBER '''
12600 print('udp_output_sym_5', list(p
))
12602 # { yyerror(@1, "internal error: Output digits parse as decimal number!"); p[0] = '0'; }
12606 def p_udp_port_decl_1(p
):
12607 '''udp_port_decl : K_input list_of_identifiers ';' '''
12609 print('udp_port_decl_1', list(p
))
12611 # { p[0] = pform_make_udp_input_ports(p[2]); }
12615 def p_udp_port_decl_2(p
):
12616 '''udp_port_decl : K_output IDENTIFIER ';' '''
12618 print('udp_port_decl_2', list(p
))
12620 # { perm_string pname = lex_strings.make(p[2]);
12621 # PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
12622 # vector<PWire*>*tmp = new vector<PWire*>(1);
12630 def p_udp_port_decl_3(p
):
12631 '''udp_port_decl : K_reg IDENTIFIER ';' '''
12633 print('udp_port_decl_3', list(p
))
12635 # { perm_string pname = lex_strings.make(p[2]);
12636 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
12637 # vector<PWire*>*tmp = new vector<PWire*>(1);
12645 def p_udp_port_decl_4(p
):
12646 '''udp_port_decl : K_reg K_output IDENTIFIER ';' '''
12648 print('udp_port_decl_4', list(p
))
12650 # { perm_string pname = lex_strings.make(p[3]);
12651 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
12652 # vector<PWire*>*tmp = new vector<PWire*>(1);
12660 def p_udp_port_decls_1(p
):
12661 '''udp_port_decls : udp_port_decl '''
12663 print('udp_port_decls_1', list(p
))
12670 def p_udp_port_decls_2(p
):
12671 '''udp_port_decls : udp_port_decls udp_port_decl '''
12673 print('udp_port_decls_2', list(p
))
12675 # { vector<PWire*>*tmp = p[1];
12676 # size_t s1 = p[1]->size();
12677 # tmp->resize(s1+p[2]->size());
12678 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
12679 # tmp->at(s1+idx) = p[2]->at(idx);
12686 def p_udp_port_list_1(p
):
12687 '''udp_port_list : IDENTIFIER '''
12689 print('udp_port_list_1', list(p
))
12691 # { list<perm_string>*tmp = new list<perm_string>;
12692 # tmp->push_back(lex_strings.make(p[1]));
12699 def p_udp_port_list_2(p
):
12700 '''udp_port_list : udp_port_list ',' IDENTIFIER '''
12702 print('udp_port_list_2', list(p
))
12704 # { list<perm_string>*tmp = p[1];
12705 # tmp->push_back(lex_strings.make(p[3]));
12712 def p_udp_reg_opt_1(p
):
12713 '''udp_reg_opt : K_reg '''
12715 print('udp_reg_opt_1', list(p
))
12722 def p_udp_reg_opt_2(p
):
12723 '''udp_reg_opt : '''
12725 print('udp_reg_opt_2', list(p
))
12732 def p_udp_initial_expr_opt_1(p
):
12733 '''udp_initial_expr_opt : '=' expression '''
12735 print('udp_initial_expr_opt_1', list(p
))
12742 def p_udp_initial_expr_opt_2(p
):
12743 '''udp_initial_expr_opt : '''
12745 print('udp_initial_expr_opt_2', list(p
))
12751 def p_udp_input_declaration_list_1(p
):
12752 '''udp_input_declaration_list : K_input IDENTIFIER '''
12754 print('udp_input_declaration_list_1', list(p
))
12756 # { list<perm_string>*tmp = new list<perm_string>;
12757 # tmp->push_back(lex_strings.make(p[2]));
12764 def p_udp_input_declaration_list_2(p
):
12765 '''udp_input_declaration_list : udp_input_declaration_list ',' K_input IDENTIFIER '''
12767 print('udp_input_declaration_list_2', list(p
))
12769 # { list<perm_string>*tmp = p[1];
12770 # tmp->push_back(lex_strings.make(p[4]));
12777 def p_udp_primitive_1(p
):
12778 '''udp_primitive : K_primitive IDENTIFIER '(' udp_port_list ')' ';' udp_port_decls udp_init_opt udp_body K_endprimitive endlabel_opt '''
12780 print('udp_primitive_1', list(p
))
12782 # { perm_string tmp2 = lex_strings.make(p[2]);
12783 # pform_make_udp(tmp2, p[4], p[7], p[9], p[8],
12784 # @2.text, @2.first_line);
12786 # if (strcmp(p[2],p[11]) != 0) {
12787 # yyerror(@11, "error: End label doesn't match "
12788 # "primitive name");
12790 # if (! gn_system_verilog()) {
12791 # yyerror(@11, "error: Primitive end labels "
12792 # "require SystemVerilog.");
12801 def p_udp_primitive_2(p
):
12802 '''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 '''
12804 print('udp_primitive_2', list(p
))
12806 # { perm_string tmp2 = lex_strings.make(p[2]);
12807 # perm_string tmp6 = lex_strings.make(p[6]);
12808 # pform_make_udp(tmp2, p[5], tmp6, p[7], p[9], p[12],
12809 # @2.text, @2.first_line);
12811 # if (strcmp(p[2],p[14]) != 0) {
12812 # yyerror(@14, "error: End label doesn't match "
12813 # "primitive name");
12815 # if (! gn_system_verilog()) {
12816 # yyerror(@14, "error: Primitive end labels "
12817 # "require SystemVerilog.");
12827 def p_K_packed_opt_1(p
):
12828 '''K_packed_opt : K_packed '''
12830 print('K_packed_opt', list(p
))
12837 def p_K_packed_opt_2(p
):
12838 '''K_packed_opt : '''
12840 print('K_packed_opt', list(p
))
12847 def p_K_reg_opt_1(p
):
12848 '''K_reg_opt : K_reg '''
12850 print('K_reg_opt', list(p
))
12857 def p_K_reg_opt_2(p
):
12860 print('K_reg_opt', list(p
))
12867 def p_K_static_opt_1(p
):
12868 '''K_static_opt : K_static '''
12870 print('K_static_opt', list(p
))
12877 def p_K_static_opt_2(p
):
12878 '''K_static_opt : '''
12880 print('K_static_opt', list(p
))
12887 def p_K_virtual_opt_1(p
):
12888 '''K_virtual_opt : K_virtual '''
12897 def p_K_virtual_opt_2(p
):
12898 '''K_virtual_opt : '''