3 # * Copyright (c) 1998-2017 Stephen Williams (steve@icarus.com)
4 # * Copyright CERN 2012-2013 / Stephen Williams (steve@icarus.com)
6 # * This source code is free software; you can redistribute it
7 # * and/or modify it in source code form under the terms of the GNU
8 # * General Public License as published by the Free Software
9 # * Foundation; either version 2 of the License, or (at your option)
10 # * any later version.
12 # * This program is distributed in the hope that it will be useful,
13 # * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # * GNU General Public License for more details.
17 # * You should have received a copy of the GNU General Public License
18 # * along with this program; if not, write to the Free Software
19 # * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 from ply
import yacc
, lex
24 from lib2to3
.pytree
import Node
, Leaf
25 from lib2to3
.pgen2
import token
26 from lib2to3
.pygram
import python_symbols
as syms
33 #from parse_tokens import tokens
34 tokens
= lexor
.tokens
# list(set(lexor.tokens).union(set(tokens)))
35 literals
= lexor
.literals
38 ('right', 'K_PLUS_EQ', 'K_MINUS_EQ', 'K_MUL_EQ', 'K_DIV_EQ',
39 'K_MOD_EQ', 'K_AND_EQ', 'K_OR_EQ'),
40 ('right', 'K_XOR_EQ', 'K_LS_EQ', 'K_RS_EQ', 'K_RSS_EQ'),
41 ('right', '?', ':', 'K_inside'),
45 ('left', '^', 'K_NXOR', 'K_NOR'),
46 ('left', '&', 'K_NAND'),
47 ('left', 'K_EQ', 'K_NE', 'K_CEQ', 'K_CNE', 'K_WEQ', 'K_WNE'),
48 ('left', 'K_GE', 'K_LE', '<', '>'),
49 ('left', 'K_LS', 'K_RS', 'K_RSS'),
51 ('left', '*', '/', '%'),
53 ('left', 'UNARY_PREC'),
54 ('nonassoc', 'less_than_K_else'),
55 ('nonassoc', 'K_else'),
57 ('nonassoc', 'K_exclude'),
58 ('nonassoc', 'no_timeunits_declaration'),
59 ('nonassoc', 'one_timeunits_declaration'),
60 ('nonassoc', 'K_timeunit', 'K_timeprecision')
64 IVL_VT_NO_TYPE
= 'VT_NO_TYPE'
65 IVL_VT_BOOL
= 'VT_BOOL'
66 IVL_VT_LOGIC
= 'VT_LOGIC'
68 IVL_VT_VOID = 0, /* Not used */
69 IVL_VT_NO_TYPE = 1, /* Place holder for missing/unknown type. */
74 IVL_VT_DARRAY = 6, /* Array (esp. dynamic array) */
75 IVL_VT_CLASS = 7, /* SystemVerilog class instances */
76 IVL_VT_QUEUE = 8, /* SystemVerilog queue instances */
77 IVL_VT_VECTOR = IVL_VT_LOGIC /* For compatibility */
81 NN_IMPLICIT
= 'IMPLICIT'
82 NN_IMPLICIT_REG
= 'IMPLICIT_REG'
83 NN_INTEGER
= 'INTEGER'
87 NN_SUPPLY0
= 'SUPPLY0'
88 NN_SUPPLY1
= 'SUPPLY1'
95 NN_UNRESOLVED_WIRE
= 'UNRESOLVED_WIRE'
97 NP_NOT_A_PORT
= 'NOT_A_PORT'
98 NP_PIMPLICIT
= 'PIMPLICIT'
100 NP_POUTPUT
= 'POUTPUT'
106 def __init__(self
, typ
, signed
):
111 # -------------- RULES ----------------
115 def p_source_text_1(p
):
116 '''source_text : timeunits_declaration_opt _embed0_source_text description_list '''
118 print('source_text', list(p
))
124 def p_source_text_2(p
):
127 print('source_text', list(p
))
133 def p__embed0_source_text(p
):
134 '''_embed0_source_text : '''
136 # { pform_set_scope_timescale(yyloc); }
140 def p_assertion_item_1(p
):
141 '''assertion_item : concurrent_assertion_item '''
143 print('assertion_item_1', list(p
))
149 def p_assignment_pattern_1(p
):
150 '''assignment_pattern : K_LP expression_list_proper '}' '''
152 print('assignment_pattern_1', list(p
))
154 # { PEAssignPattern*tmp = new PEAssignPattern(*p[2]);
155 # FILE_NAME(tmp, @1);
162 def p_assignment_pattern_2(p
):
163 '''assignment_pattern : K_LP '}' '''
165 print('assignment_pattern_2', list(p
))
167 # { PEAssignPattern*tmp = new PEAssignPattern;
168 # FILE_NAME(tmp, @1);
174 def p_block_identifier_opt_1(p
):
175 '''block_identifier_opt : IDENTIFIER ':' '''
177 print('block_identifier_opt_1', list(p
))
183 def p_block_identifier_opt_2(p
):
184 '''block_identifier_opt : '''
186 print('block_identifier_opt_2', list(p
))
192 def p_class_declaration_1(p
):
193 '''class_declaration : K_virtual_opt K_class lifetime_opt class_identifier class_declaration_extends_opt ';' _embed0_class_declaration class_items_opt K_endclass _embed1_class_declaration class_declaration_endlabel_opt '''
195 print('class_declaration_1', list(p
))
197 # { // Wrap up the class.
198 # if (p[11] && p[4] && p[4]->name != p[11]) {
199 # yyerror(@11, "error: Class end label doesn't match class name.");
206 def p__embed0_class_declaration(p
):
207 '''_embed0_class_declaration : '''
209 # { pform_start_class_declaration(@2, p[4], p[5].type, p[5].exprs, p[3]); }
213 def p__embed1_class_declaration(p
):
214 '''_embed1_class_declaration : '''
216 # { // Process a class.
217 # pform_end_class_declaration(@9);
222 def p_class_constraint_1(p
):
223 '''class_constraint : constraint_prototype '''
225 print('class_constraint_1', list(p
))
231 def p_class_constraint_2(p
):
232 '''class_constraint : constraint_declaration '''
234 print('class_constraint_2', list(p
))
240 def p_class_identifier_1(p
):
241 '''class_identifier : IDENTIFIER '''
243 print('class_identifier_1', list(p
))
245 # { // Create a synthetic typedef for the class name so that the
246 # // lexor detects the name as a type.
247 # perm_string name = lex_strings.make(p[1]);
248 # class_type_t*tmp = new class_type_t(name);
249 # FILE_NAME(tmp, @1);
250 # pform_set_typedef(name, tmp, NULL);
257 def p_class_identifier_2(p
):
258 '''class_identifier : TYPE_IDENTIFIER '''
260 print('class_identifier_2', list(p
))
262 # { class_type_t*tmp = dynamic_cast<class_type_t*>(p[1].type);
264 # yyerror(@1, "Type name \"%s\"is not a predeclared class name.", p[1].text);
272 def p_class_declaration_endlabel_opt_1(p
):
273 '''class_declaration_endlabel_opt : ':' TYPE_IDENTIFIER '''
275 print('class_declaration_endlabel_opt_1', list(p
))
277 # { class_type_t*tmp = dynamic_cast<class_type_t*> (p[2].type);
279 # yyerror(@2, "error: class declaration endlabel \"%s\" is not a class name\n", p[2].text);
282 # p[0] = strdupnew(tmp->name.str());
289 def p_class_declaration_endlabel_opt_2(p
):
290 '''class_declaration_endlabel_opt : ':' IDENTIFIER '''
292 print('class_declaration_endlabel_opt_2', list(p
))
299 def p_class_declaration_endlabel_opt_3(p
):
300 '''class_declaration_endlabel_opt : '''
302 print('class_declaration_endlabel_opt_3', list(p
))
308 def p_class_declaration_extends_opt_1(p
):
309 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '''
311 print('class_declaration_extends_opt_1', list(p
))
313 # { p[0].type = p[2].type;
320 def p_class_declaration_extends_opt_2(p
):
321 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '(' expression_list_with_nuls ')' '''
323 print('class_declaration_extends_opt_2', list(p
))
325 # { p[0].type = p[2].type;
332 def p_class_declaration_extends_opt_3(p
):
333 '''class_declaration_extends_opt : '''
335 print('class_declaration_extends_opt_3', list(p
))
337 # { p[0].type = 0; p[0].exprs = 0; }
341 def p_class_items_opt_1(p
):
342 '''class_items_opt : class_items '''
344 print('class_items_opt_1', list(p
))
350 def p_class_items_opt_2(p
):
351 '''class_items_opt : '''
353 print('class_items_opt_2', list(p
))
359 def p_class_items_1(p
):
360 '''class_items : class_items class_item '''
362 print('class_items_1', list(p
))
368 def p_class_items_2(p
):
369 '''class_items : class_item '''
371 print('class_items_2', list(p
))
377 def p_class_item_1(p
):
378 '''class_item : method_qualifier_opt K_function K_new _embed0_class_item '(' tf_port_list_opt ')' ';' function_item_list_opt statement_or_null_list_opt K_endfunction endnew_opt '''
380 print('class_item_1', list(p
))
382 # { current_function->set_ports(p[6]);
383 # pform_set_constructor_return(current_function);
384 # pform_set_this_class(@3, current_function);
385 # current_function_set_statement(@3, p[10]);
387 # current_function = 0;
392 def p_class_item_2(p
):
393 '''class_item : property_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
395 print('class_item_2', list(p
))
397 # { pform_class_property(@2, p[1], p[2], p[3]); }
401 def p_class_item_3(p
):
402 '''class_item : K_const class_item_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
404 print('class_item_3', list(p
))
406 # { pform_class_property(@1, p[2] | property_qualifier_t::make_const(), p[3], p[4]); }
410 def p_class_item_4(p
):
411 '''class_item : method_qualifier_opt task_declaration '''
413 print('class_item_4', list(p
))
415 # { /* The task_declaration rule puts this into the class */ }
419 def p_class_item_5(p
):
420 '''class_item : method_qualifier_opt function_declaration '''
422 print('class_item_5', list(p
))
424 # { /* The function_declaration rule puts this into the class */ }
428 def p_class_item_6(p
):
429 '''class_item : K_extern method_qualifier_opt K_function K_new ';' '''
431 print('class_item_6', list(p
))
433 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
437 def p_class_item_7(p
):
438 '''class_item : K_extern method_qualifier_opt K_function K_new '(' tf_port_list_opt ')' ';' '''
440 print('class_item_7', list(p
))
442 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
446 def p_class_item_8(p
):
447 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER ';' '''
449 print('class_item_8', list(p
))
451 # { yyerror(@1, "sorry: External methods are not yet supported.");
457 def p_class_item_9(p
):
458 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' ';' '''
460 print('class_item_9', list(p
))
462 # { yyerror(@1, "sorry: External methods are not yet supported.");
468 def p_class_item_10(p
):
469 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER ';' '''
471 print('class_item_10', list(p
))
473 # { yyerror(@1, "sorry: External methods are not yet supported.");
479 def p_class_item_11(p
):
480 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER '(' tf_port_list_opt ')' ';' '''
482 print('class_item_11', list(p
))
484 # { yyerror(@1, "sorry: External methods are not yet supported.");
490 def p_class_item_12(p
):
491 '''class_item : class_constraint '''
493 print('class_item_12', list(p
))
499 def p_class_item_13(p
):
500 '''class_item : property_qualifier_opt data_type error ';' '''
502 print('class_item_13', list(p
))
504 # { yyerror(@3, "error: Errors in variable names after data type.");
510 def p_class_item_14(p
):
511 '''class_item : property_qualifier_opt IDENTIFIER error ';' '''
513 print('class_item_14', list(p
))
515 # { yyerror(@3, "error: %s doesn't name a type.", p[2]);
521 def p_class_item_15(p
):
522 '''class_item : method_qualifier_opt K_function K_new error K_endfunction endnew_opt '''
524 print('class_item_15', list(p
))
526 # { yyerror(@1, "error: I give up on this class constructor declaration.");
532 def p_class_item_16(p
):
533 '''class_item : error ';' '''
535 print('class_item_16', list(p
))
537 # { yyerror(@2, "error: invalid class item.");
543 def p__embed0_class_item(p
):
544 '''_embed0_class_item : '''
546 # { assert(current_function==0);
547 # current_function = pform_push_constructor_scope(@3);
552 def p_class_item_qualifier_1(p
):
553 '''class_item_qualifier : K_static '''
555 print('class_item_qualifier_1', list(p
))
557 # { p[0] = property_qualifier_t::make_static(); }
561 def p_class_item_qualifier_2(p
):
562 '''class_item_qualifier : K_protected '''
564 print('class_item_qualifier_2', list(p
))
566 # { p[0] = property_qualifier_t::make_protected(); }
570 def p_class_item_qualifier_3(p
):
571 '''class_item_qualifier : K_local '''
573 print('class_item_qualifier_3', list(p
))
575 # { p[0] = property_qualifier_t::make_local(); }
579 def p_class_item_qualifier_list_1(p
):
580 '''class_item_qualifier_list : class_item_qualifier_list class_item_qualifier '''
582 print('class_item_qualifier_list_1', list(p
))
584 # { p[0] = p[1] | p[2]; }
588 def p_class_item_qualifier_list_2(p
):
589 '''class_item_qualifier_list : class_item_qualifier '''
591 print('class_item_qualifier_list_2', list(p
))
598 def p_class_item_qualifier_opt_1(p
):
599 '''class_item_qualifier_opt : class_item_qualifier_list '''
601 print('class_item_qualifier_opt_1', list(p
))
608 def p_class_item_qualifier_opt_2(p
):
609 '''class_item_qualifier_opt : '''
611 print('class_item_qualifier_opt_2', list(p
))
613 # { p[0] = property_qualifier_t::make_none(); }
617 def p_class_new_1(p
):
618 '''class_new : K_new '(' expression_list_with_nuls ')' '''
620 print('class_new_1', list(p
))
622 # { list<PExpr*>*expr_list = p[3];
623 # strip_tail_items(expr_list);
624 # PENewClass*tmp = new PENewClass(*expr_list);
625 # FILE_NAME(tmp, @1);
632 def p_class_new_2(p
):
633 '''class_new : K_new hierarchy_identifier '''
635 print('class_new_2', list(p
))
637 # { PEIdent*tmpi = new PEIdent(*p[2]);
638 # FILE_NAME(tmpi, @2);
639 # PENewCopy*tmp = new PENewCopy(tmpi);
640 # FILE_NAME(tmp, @1);
647 def p_class_new_3(p
):
648 '''class_new : K_new '''
650 print('class_new_3', list(p
))
652 # { PENewClass*tmp = new PENewClass;
653 # FILE_NAME(tmp, @1);
659 def p_concurrent_assertion_item_1(p
):
660 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' property_spec ')' statement_or_null '''
662 print('concurrent_assertion_item_1', list(p
))
665 # if (gn_assertions_flag) {
666 # yyerror(@2, "sorry: concurrent_assertion_item not supported."
667 # " Try -gno-assertion to turn this message off.");
673 def p_concurrent_assertion_item_2(p
):
674 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' error ')' statement_or_null '''
676 print('concurrent_assertion_item_2', list(p
))
679 # yyerror(@2, "error: Error in property_spec of concurrent assertion item.");
684 def p_constraint_block_item_1(p
):
685 '''constraint_block_item : constraint_expression '''
687 print('constraint_block_item_1', list(p
))
693 def p_constraint_block_item_list_1(p
):
694 '''constraint_block_item_list : constraint_block_item_list constraint_block_item '''
696 print('constraint_block_item_list_1', list(p
))
702 def p_constraint_block_item_list_2(p
):
703 '''constraint_block_item_list : constraint_block_item '''
705 print('constraint_block_item_list_2', list(p
))
711 def p_constraint_block_item_list_opt_1(p
):
712 '''constraint_block_item_list_opt : '''
714 print('constraint_block_item_list_opt_1', list(p
))
720 def p_constraint_block_item_list_opt_2(p
):
721 '''constraint_block_item_list_opt : constraint_block_item_list '''
723 print('constraint_block_item_list_opt_2', list(p
))
729 def p_constraint_declaration_1(p
):
730 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' constraint_block_item_list_opt '}' '''
732 print('constraint_declaration_1', list(p
))
734 # { yyerror(@2, "sorry: Constraint declarations not supported."); }
738 def p_constraint_declaration_2(p
):
739 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' error '}' '''
741 print('constraint_declaration_2', list(p
))
743 # { yyerror(@4, "error: Errors in the constraint block item list."); }
747 def p_constraint_expression_1(p
):
748 '''constraint_expression : expression ';' '''
750 print('constraint_expression_1', list(p
))
756 def p_constraint_expression_2(p
):
757 '''constraint_expression : expression K_dist '{' '}' ';' '''
759 print('constraint_expression_2', list(p
))
765 def p_constraint_expression_3(p
):
766 '''constraint_expression : expression K_TRIGGER constraint_set '''
768 print('constraint_expression_3', list(p
))
774 def p_constraint_expression_4(p
):
775 '''constraint_expression : K_if '(' expression ')' constraint_set %prec less_than_K_else '''
777 print('constraint_expression_4', list(p
))
783 def p_constraint_expression_5(p
):
784 '''constraint_expression : K_if '(' expression ')' constraint_set K_else constraint_set '''
786 print('constraint_expression_5', list(p
))
792 def p_constraint_expression_6(p
):
793 '''constraint_expression : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' constraint_set '''
795 print('constraint_expression_6', list(p
))
801 def p_constraint_expression_list_1(p
):
802 '''constraint_expression_list : constraint_expression_list constraint_expression '''
804 print('constraint_expression_list_1', list(p
))
810 def p_constraint_expression_list_2(p
):
811 '''constraint_expression_list : constraint_expression '''
813 print('constraint_expression_list_2', list(p
))
819 def p_constraint_prototype_1(p
):
820 '''constraint_prototype : K_static_opt K_constraint IDENTIFIER ';' '''
822 print('constraint_prototype_1', list(p
))
824 # { yyerror(@2, "sorry: Constraint prototypes not supported."); }
828 def p_constraint_set_1(p
):
829 '''constraint_set : constraint_expression '''
831 print('constraint_set_1', list(p
))
837 def p_constraint_set_2(p
):
838 '''constraint_set : '{' constraint_expression_list '}' '''
840 print('constraint_set_2', list(p
))
846 def p_data_declaration_1(p
):
847 '''data_declaration : attribute_list_opt data_type_or_implicit list_of_variable_decl_assignments ';' '''
849 print('data_declaration_1', list(p
))
851 # { data_type_t*data_type = p[2];
852 # if (data_type == 0) {
853 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
854 # FILE_NAME(data_type, @2);
856 # pform_makewire(@2, 0, str_strength, p[3], NetNet::IMPLICIT_REG, data_type);
861 def p_data_type_1(p
):
862 '''data_type : integer_vector_type unsigned_signed_opt dimensions_opt '''
864 print('data_type_1', list(p
))
867 if (use_vtype
== IVL_VT_NO_TYPE
):
868 use_vtype
= IVL_VT_LOGIC
870 dt
= DataType(use_vtype
, signed
=p
[2])
872 dt
.reg_flag
= reg_flag
875 # { ivl_variable_type_t use_vtype = p[1];
876 # bool reg_flag = false;
877 # if (use_vtype == IVL_VT_NO_TYPE) {
878 # use_vtype = IVL_VT_LOGIC;
881 # vector_type_t*tmp = new vector_type_t(use_vtype, p[2], p[3]);
882 # tmp->reg_flag = reg_flag;
883 # FILE_NAME(tmp, @1);
889 def p_data_type_2(p
):
890 '''data_type : non_integer_type '''
892 print('data_type_2', list(p
))
895 # { real_type_t*tmp = new real_type_t(p[1]);
896 # FILE_NAME(tmp, @1);
902 def p_data_type_3(p
):
903 '''data_type : struct_data_type '''
905 print('data_type_3', list(p
))
908 # { if (!p[1]->packed_flag) {
909 # yyerror(@1, "sorry: Unpacked structs not supported.");
916 def p_data_type_4(p
):
917 '''data_type : enum_data_type '''
919 print('data_type_4', list(p
))
926 def p_data_type_5(p
):
927 '''data_type : atom2_type signed_unsigned_opt '''
929 print('data_type_5', list(p
))
931 # { atom2_type_t*tmp = new atom2_type_t(p[1], p[2]);
932 # FILE_NAME(tmp, @1);
938 def p_data_type_6(p
):
939 '''data_type : K_integer signed_unsigned_opt '''
941 print('data_type_6', list(p
))
943 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
944 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, p[2], pd);
945 # tmp->reg_flag = true;
946 # tmp->integer_flag = true;
952 def p_data_type_7(p
):
953 '''data_type : K_time '''
955 print('data_type_7', list(p
))
957 # { list<pform_range_t>*pd = make_range_from_width(64);
958 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
959 # tmp->reg_flag = !gn_system_verilog();
965 def p_data_type_8(p
):
966 '''data_type : TYPE_IDENTIFIER dimensions_opt '''
968 print('data_type_8', list(p
))
971 # parray_type_t*tmp = new parray_type_t(p[1].type, p[2]);
972 # FILE_NAME(tmp, @1);
974 # } else p[0] = p[1].type;
980 def p_data_type_9(p
):
981 '''data_type : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_data_type TYPE_IDENTIFIER '''
983 print('data_type_9', list(p
))
985 # { lex_in_package_scope(0);
992 def p_data_type_10(p
):
993 '''data_type : K_string '''
995 print('data_type_10', list(p
))
997 # { string_type_t*tmp = new string_type_t;
998 # FILE_NAME(tmp, @1);
1004 def p__embed0_data_type(p
):
1005 '''_embed0_data_type : '''
1007 # { lex_in_package_scope(p[1]); }
1011 def p_data_type_or_implicit_1(p
):
1012 '''data_type_or_implicit : data_type '''
1014 print('data_type_or_implicit_1', list(p
))
1021 def p_data_type_or_implicit_2(p
):
1022 '''data_type_or_implicit : signing dimensions_opt '''
1024 print('data_type_or_implicit_2', list(p
))
1026 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, p[1], p[2]);
1027 # tmp->implicit_flag = true;
1028 # FILE_NAME(tmp, @1);
1034 def p_data_type_or_implicit_3(p
):
1035 '''data_type_or_implicit : dimensions '''
1037 print('data_type_or_implicit_3', list(p
))
1040 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, p[1]);
1041 # tmp->implicit_flag = true;
1042 # FILE_NAME(tmp, @1);
1048 def p_data_type_or_implicit_4(p
):
1049 '''data_type_or_implicit : '''
1050 if(parse_debug
> 2):
1051 print('data_type_or_implicit_4', list(p
))
1057 def p_data_type_or_implicit_or_void_1(p
):
1058 '''data_type_or_implicit_or_void : data_type_or_implicit '''
1060 print('data_type_or_implicit_or_void_1', list(p
))
1067 def p_data_type_or_implicit_or_void_2(p
):
1068 '''data_type_or_implicit_or_void : K_void '''
1070 print('data_type_or_implicit_or_void_2', list(p
))
1072 # { void_type_t*tmp = new void_type_t;
1073 # FILE_NAME(tmp, @1);
1079 def p_description_1(p
):
1080 '''description : module '''
1081 if(parse_debug
> 2):
1082 print('description_1', list(p
))
1088 def p_description_2(p
):
1089 '''description : udp_primitive '''
1091 print('description_2', list(p
))
1097 def p_description_3(p
):
1098 '''description : config_declaration '''
1100 print('description_3', list(p
))
1106 def p_description_4(p
):
1107 '''description : nature_declaration '''
1109 print('description_4', list(p
))
1115 def p_description_5(p
):
1116 '''description : package_declaration '''
1118 print('description_5', list(p
))
1124 def p_description_6(p
):
1125 '''description : discipline_declaration '''
1127 print('description_6', list(p
))
1133 def p_description_7(p
):
1134 '''description : package_item '''
1136 print('description_7', list(p
))
1142 def p_description_8(p
):
1143 '''description : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' '''
1145 print('description_8', list(p
))
1147 # { perm_string tmp3 = lex_strings.make(p[3]);
1148 # pform_set_type_attrib(tmp3, p[5], p[7]);
1155 def p_description_list_1(p
):
1156 '''description_list : description '''
1157 if(parse_debug
> 2):
1158 print('description_list_1', list(p
))
1164 def p_description_list_2(p
):
1165 '''description_list : description_list description '''
1167 print('description_list_2', list(p
))
1173 def p_endnew_opt_1(p
):
1174 '''endnew_opt : ':' K_new '''
1176 print('endnew_opt_1', list(p
))
1182 def p_endnew_opt_2(p
):
1185 print('endnew_opt_2', list(p
))
1191 def p_dynamic_array_new_1(p
):
1192 '''dynamic_array_new : K_new '[' expression ']' '''
1194 print('dynamic_array_new_1', list(p
))
1196 # { p[0] = new PENewArray(p[3], 0);
1197 # FILE_NAME(p[0], @1);
1202 def p_dynamic_array_new_2(p
):
1203 '''dynamic_array_new : K_new '[' expression ']' '(' expression ')' '''
1205 print('dynamic_array_new_2', list(p
))
1207 # { p[0] = new PENewArray(p[3], p[6]);
1208 # FILE_NAME(p[0], @1);
1213 def p_for_step_1(p
):
1214 '''for_step : lpvalue '=' expression '''
1216 print('for_step_1', list(p
))
1218 # { PAssign*tmp = new PAssign(p[1],p[3]);
1219 # FILE_NAME(tmp, @1);
1225 def p_for_step_2(p
):
1226 '''for_step : inc_or_dec_expression '''
1228 print('for_step_2', list(p
))
1230 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
1234 def p_for_step_3(p
):
1235 '''for_step : compressed_statement '''
1237 print('for_step_3', list(p
))
1244 def p_function_declaration_1(p
):
1245 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER ';' _embed0_function_declaration function_item_list statement_or_null_list_opt K_endfunction _embed1_function_declaration endlabel_opt '''
1247 print('function_declaration_1', list(p
))
1249 # { // Last step: check any closing name.
1251 # if (strcmp(p[4],p[11]) != 0) {
1252 # yyerror(@11, "error: End label doesn't match "
1255 # if (! gn_system_verilog()) {
1256 # yyerror(@11, "error: Function end labels require "
1257 # "SystemVerilog.");
1266 def p_function_declaration_2(p
):
1267 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER _embed2_function_declaration '(' tf_port_list_opt ')' ';' block_item_decls_opt statement_or_null_list_opt K_endfunction _embed3_function_declaration endlabel_opt '''
1269 print('function_declaration_2', list(p
))
1271 # { // Last step: check any closing name.
1273 # if (strcmp(p[4],p[14]) != 0) {
1274 # yyerror(@14, "error: End label doesn't match "
1277 # if (! gn_system_verilog()) {
1278 # yyerror(@14, "error: Function end labels require "
1279 # "SystemVerilog.");
1288 def p_function_declaration_3(p
):
1289 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER error K_endfunction _embed4_function_declaration endlabel_opt '''
1291 print('function_declaration_3', list(p
))
1293 # { // Last step: check any closing name.
1295 # if (strcmp(p[4],p[8]) != 0) {
1296 # yyerror(@8, "error: End label doesn't match function name");
1298 # if (! gn_system_verilog()) {
1299 # yyerror(@8, "error: Function end labels require "
1300 # "SystemVerilog.");
1309 def p__embed0_function_declaration(p
):
1310 '''_embed0_function_declaration : '''
1312 # { assert(current_function == 0);
1313 # current_function = pform_push_function_scope(@1, p[4], p[2]);
1318 def p__embed1_function_declaration(p
):
1319 '''_embed1_function_declaration : '''
1321 # { current_function->set_ports(p[7]);
1322 # current_function->set_return(p[3]);
1323 # current_function_set_statement(p[8]? @8 : @4, p[8]);
1324 # pform_set_this_class(@4, current_function);
1325 # pform_pop_scope();
1326 # current_function = 0;
1331 def p__embed2_function_declaration(p
):
1332 '''_embed2_function_declaration : '''
1334 # { assert(current_function == 0);
1335 # current_function = pform_push_function_scope(@1, p[4], p[2]);
1340 def p__embed3_function_declaration(p
):
1341 '''_embed3_function_declaration : '''
1343 # { current_function->set_ports(p[7]);
1344 # current_function->set_return(p[3]);
1345 # current_function_set_statement(p[11]? @11 : @4, p[11]);
1346 # pform_set_this_class(@4, current_function);
1347 # pform_pop_scope();
1348 # current_function = 0;
1349 # if (p[7]==0 && !gn_system_verilog()) {
1350 # yyerror(@4, "error: Empty parenthesis syntax requires SystemVerilog.");
1356 def p__embed4_function_declaration(p
):
1357 '''_embed4_function_declaration : '''
1360 # if (current_function) {
1361 # pform_pop_scope();
1362 # current_function = 0;
1364 # assert(current_function == 0);
1365 # yyerror(@1, "error: Syntax error defining function.");
1371 def p_import_export_1(p
):
1372 '''import_export : K_import '''
1374 print('import_export_1', list(p
))
1381 def p_import_export_2(p
):
1382 '''import_export : K_export '''
1384 print('import_export_2', list(p
))
1391 def p_implicit_class_handle_1(p
):
1392 '''implicit_class_handle : K_this '''
1394 print('implicit_class_handle_1', list(p
))
1396 # { p[0] = pform_create_this(); }
1400 def p_implicit_class_handle_2(p
):
1401 '''implicit_class_handle : K_super '''
1403 print('implicit_class_handle_2', list(p
))
1405 # { p[0] = pform_create_super(); }
1409 def p_inc_or_dec_expression_1(p
):
1410 '''inc_or_dec_expression : K_INCR lpvalue %prec UNARY_PREC '''
1412 print('inc_or_dec_expression_1', list(p
))
1414 # { PEUnary*tmp = new PEUnary('I', p[2]);
1415 # FILE_NAME(tmp, @2);
1421 def p_inc_or_dec_expression_2(p
):
1422 '''inc_or_dec_expression : lpvalue K_INCR %prec UNARY_PREC '''
1424 print('inc_or_dec_expression_2', list(p
))
1426 # { PEUnary*tmp = new PEUnary('i', p[1]);
1427 # FILE_NAME(tmp, @1);
1433 def p_inc_or_dec_expression_3(p
):
1434 '''inc_or_dec_expression : K_DECR lpvalue %prec UNARY_PREC '''
1436 print('inc_or_dec_expression_3', list(p
))
1438 # { PEUnary*tmp = new PEUnary('D', p[2]);
1439 # FILE_NAME(tmp, @2);
1445 def p_inc_or_dec_expression_4(p
):
1446 '''inc_or_dec_expression : lpvalue K_DECR %prec UNARY_PREC '''
1448 print('inc_or_dec_expression_4', list(p
))
1450 # { PEUnary*tmp = new PEUnary('d', p[1]);
1451 # FILE_NAME(tmp, @1);
1457 def p_inside_expression_1(p
):
1458 '''inside_expression : expression K_inside '{' open_range_list '}' '''
1460 print('inside_expression_1', list(p
))
1462 # { yyerror(@2, "sorry: \"inside\" expressions not supported yet.");
1468 def p_integer_vector_type_1(p
):
1469 '''integer_vector_type : K_reg '''
1471 print('integer_vector_type_1', list(p
))
1472 p
[0] = IVL_VT_NO_TYPE
1478 def p_integer_vector_type_2(p
):
1479 '''integer_vector_type : K_bit '''
1481 print('integer_vector_type_2', list(p
))
1488 def p_integer_vector_type_3(p
):
1489 '''integer_vector_type : K_logic '''
1491 print('integer_vector_type_3', list(p
))
1498 def p_integer_vector_type_4(p
):
1499 '''integer_vector_type : K_bool '''
1501 print('integer_vector_type_4', list(p
))
1503 # { p[0] = IVL_VT_BOOL; }
1507 def p_join_keyword_1(p
):
1508 '''join_keyword : K_join '''
1510 print('join_keyword_1', list(p
))
1512 # { p[0] = PBlock::BL_PAR; }
1516 def p_join_keyword_2(p
):
1517 '''join_keyword : K_join_none '''
1519 print('join_keyword_2', list(p
))
1521 # { p[0] = PBlock::BL_JOIN_NONE; }
1525 def p_join_keyword_3(p
):
1526 '''join_keyword : K_join_any '''
1528 print('join_keyword_3', list(p
))
1530 # { p[0] = PBlock::BL_JOIN_ANY; }
1534 def p_jump_statement_1(p
):
1535 '''jump_statement : K_break ';' '''
1537 print('jump_statement_1', list(p
))
1539 # { yyerror(@1, "sorry: break statements not supported.");
1545 def p_jump_statement_2(p
):
1546 '''jump_statement : K_return ';' '''
1548 print('jump_statement_2', list(p
))
1550 # { PReturn*tmp = new PReturn(0);
1551 # FILE_NAME(tmp, @1);
1557 def p_jump_statement_3(p
):
1558 '''jump_statement : K_return expression ';' '''
1560 print('jump_statement_3', list(p
))
1562 # { PReturn*tmp = new PReturn(p[2]);
1563 # FILE_NAME(tmp, @1);
1569 def p_lifetime_1(p
):
1570 '''lifetime : K_automatic '''
1572 print('lifetime_1', list(p
))
1574 # { p[0] = LexicalScope::AUTOMATIC; }
1578 def p_lifetime_2(p
):
1579 '''lifetime : K_static '''
1581 print('lifetime_2', list(p
))
1583 # { p[0] = LexicalScope::STATIC; }
1587 def p_lifetime_opt_1(p
):
1588 '''lifetime_opt : lifetime '''
1590 print('lifetime_opt_1', list(p
))
1597 def p_lifetime_opt_2(p
):
1598 '''lifetime_opt : '''
1599 if(parse_debug
> 2):
1600 print('lifetime_opt_2', list(p
))
1602 # { p[0] = LexicalScope::INHERITED; }
1606 def p_loop_statement_1(p
):
1607 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' for_step ')' statement_or_null '''
1609 print('loop_statement_1', list(p
))
1611 # { PForStatement*tmp = new PForStatement(p[3], p[5], p[7], p[9], p[11]);
1612 # FILE_NAME(tmp, @1);
1618 def p_loop_statement_2(p
):
1619 '''loop_statement : K_for '(' data_type IDENTIFIER '=' expression ';' expression ';' for_step ')' _embed0_loop_statement statement_or_null '''
1621 print('loop_statement_2', list(p
))
1623 # { pform_name_t tmp_hident;
1624 # tmp_hident.push_back(name_component_t(lex_strings.make(p[4])));
1626 # PEIdent*tmp_ident = pform_new_ident(tmp_hident);
1627 # FILE_NAME(tmp_ident, @4);
1629 # PForStatement*tmp_for = new PForStatement(tmp_ident, p[6], p[8], p[10], p[13]);
1630 # FILE_NAME(tmp_for, @1);
1632 # pform_pop_scope();
1633 # vector<Statement*>tmp_for_list (1);
1634 # tmp_for_list[0] = tmp_for;
1635 # PBlock*tmp_blk = current_block_stack.top();
1636 # current_block_stack.pop();
1637 # tmp_blk->set_statement(tmp_for_list);
1644 def p_loop_statement_3(p
):
1645 '''loop_statement : K_forever statement_or_null '''
1647 print('loop_statement_3', list(p
))
1649 # { PForever*tmp = new PForever(p[2]);
1650 # FILE_NAME(tmp, @1);
1656 def p_loop_statement_4(p
):
1657 '''loop_statement : K_repeat '(' expression ')' statement_or_null '''
1659 print('loop_statement_4', list(p
))
1661 # { PRepeat*tmp = new PRepeat(p[3], p[5]);
1662 # FILE_NAME(tmp, @1);
1668 def p_loop_statement_5(p
):
1669 '''loop_statement : K_while '(' expression ')' statement_or_null '''
1671 print('loop_statement_5', list(p
))
1673 # { PWhile*tmp = new PWhile(p[3], p[5]);
1674 # FILE_NAME(tmp, @1);
1680 def p_loop_statement_6(p
):
1681 '''loop_statement : K_do statement_or_null K_while '(' expression ')' ';' '''
1683 print('loop_statement_6', list(p
))
1685 # { PDoWhile*tmp = new PDoWhile(p[5], p[2]);
1686 # FILE_NAME(tmp, @1);
1692 def p_loop_statement_7(p
):
1693 '''loop_statement : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' _embed1_loop_statement statement_or_null '''
1695 print('loop_statement_7', list(p
))
1697 # { PForeach*tmp_for = pform_make_foreach(@1, p[3], p[5], p[9]);
1699 # pform_pop_scope();
1700 # vector<Statement*>tmp_for_list(1);
1701 # tmp_for_list[0] = tmp_for;
1702 # PBlock*tmp_blk = current_block_stack.top();
1703 # current_block_stack.pop();
1704 # tmp_blk->set_statement(tmp_for_list);
1710 def p_loop_statement_8(p
):
1711 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' error ')' statement_or_null '''
1713 print('loop_statement_8', list(p
))
1716 # yyerror(@1, "error: Error in for loop step assignment.");
1721 def p_loop_statement_9(p
):
1722 '''loop_statement : K_for '(' lpvalue '=' expression ';' error ';' for_step ')' statement_or_null '''
1724 print('loop_statement_9', list(p
))
1727 # yyerror(@1, "error: Error in for loop condition expression.");
1732 def p_loop_statement_10(p
):
1733 '''loop_statement : K_for '(' error ')' statement_or_null '''
1735 print('loop_statement_10', list(p
))
1738 # yyerror(@1, "error: Incomprehensible for loop.");
1743 def p_loop_statement_11(p
):
1744 '''loop_statement : K_while '(' error ')' statement_or_null '''
1746 print('loop_statement_11', list(p
))
1749 # yyerror(@1, "error: Error in while loop condition.");
1754 def p_loop_statement_12(p
):
1755 '''loop_statement : K_do statement_or_null K_while '(' error ')' ';' '''
1757 print('loop_statement_12', list(p
))
1760 # yyerror(@1, "error: Error in do/while loop condition.");
1765 def p_loop_statement_13(p
):
1766 '''loop_statement : K_foreach '(' IDENTIFIER '[' error ']' ')' statement_or_null '''
1768 print('loop_statement_13', list(p
))
1771 # yyerror(@4, "error: Errors in foreach loop variables list.");
1776 def p__embed0_loop_statement(p
):
1777 '''_embed0_loop_statement : '''
1779 # { static unsigned for_counter = 0;
1780 # char for_block_name [64];
1781 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_for_loop%u", for_counter);
1783 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1784 # FILE_NAME(tmp, @1);
1785 # current_block_stack.push(tmp);
1787 # list<decl_assignment_t*>assign_list;
1788 # decl_assignment_t*tmp_assign = new decl_assignment_t;
1789 # tmp_assign->name = lex_strings.make(p[4]);
1790 # assign_list.push_back(tmp_assign);
1791 # pform_makewire(@4, 0, str_strength, &assign_list, NetNet::REG, p[3]);
1796 def p__embed1_loop_statement(p
):
1797 '''_embed1_loop_statement : '''
1799 # { static unsigned foreach_counter = 0;
1800 # char for_block_name[64];
1801 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_foreach%u", foreach_counter);
1802 # foreach_counter += 1;
1804 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1805 # FILE_NAME(tmp, @1);
1806 # current_block_stack.push(tmp);
1808 # pform_make_foreach_declarations(@1, p[5]);
1813 def p_list_of_variable_decl_assignments_1(p
):
1814 '''list_of_variable_decl_assignments : variable_decl_assignment '''
1816 print('list_of_variable_decl_assignments_1', list(p
))
1818 # { list<decl_assignment_t*>*tmp = new list<decl_assignment_t*>;
1819 # tmp->push_back(p[1]);
1825 def p_list_of_variable_decl_assignments_2(p
):
1826 '''list_of_variable_decl_assignments : list_of_variable_decl_assignments ',' variable_decl_assignment '''
1828 print('list_of_variable_decl_assignments_2', list(p
))
1830 # { list<decl_assignment_t*>*tmp = p[1];
1831 # tmp->push_back(p[3]);
1837 def p_variable_decl_assignment_1(p
):
1838 '''variable_decl_assignment : IDENTIFIER dimensions_opt '''
1840 print('variable_decl_assignment_1', list(p
))
1842 # { decl_assignment_t*tmp = new decl_assignment_t;
1843 # tmp->name = lex_strings.make(p[1]);
1845 # tmp->index = *p[2];
1854 def p_variable_decl_assignment_2(p
):
1855 '''variable_decl_assignment : IDENTIFIER '=' expression '''
1857 print('variable_decl_assignment_2', list(p
))
1859 # { decl_assignment_t*tmp = new decl_assignment_t;
1860 # tmp->name = lex_strings.make(p[1]);
1861 # tmp->expr .reset(p[3]);
1868 def p_variable_decl_assignment_3(p
):
1869 '''variable_decl_assignment : IDENTIFIER '=' K_new '(' ')' '''
1871 print('variable_decl_assignment_3', list(p
))
1873 # { decl_assignment_t*tmp = new decl_assignment_t;
1874 # tmp->name = lex_strings.make(p[1]);
1875 # PENewClass*expr = new PENewClass;
1876 # FILE_NAME(expr, @3);
1877 # tmp->expr .reset(expr);
1884 def p_loop_variables_1(p
):
1885 '''loop_variables : loop_variables ',' IDENTIFIER '''
1887 print('loop_variables_1', list(p
))
1889 # { list<perm_string>*tmp = p[1];
1890 # tmp->push_back(lex_strings.make(p[3]));
1897 def p_loop_variables_2(p
):
1898 '''loop_variables : IDENTIFIER '''
1900 print('loop_variables_2', list(p
))
1902 # { list<perm_string>*tmp = new list<perm_string>;
1903 # tmp->push_back(lex_strings.make(p[1]));
1910 def p_method_qualifier_1(p
):
1911 '''method_qualifier : K_virtual '''
1913 print('method_qualifier_1', list(p
))
1919 def p_method_qualifier_2(p
):
1920 '''method_qualifier : class_item_qualifier '''
1922 print('method_qualifier_2', list(p
))
1928 def p_method_qualifier_opt_1(p
):
1929 '''method_qualifier_opt : method_qualifier '''
1931 print('method_qualifier_opt_1', list(p
))
1937 def p_method_qualifier_opt_2(p
):
1938 '''method_qualifier_opt : '''
1940 print('method_qualifier_opt_2', list(p
))
1946 def p_modport_declaration_1(p
):
1947 '''modport_declaration : K_modport _embed0_modport_declaration modport_item_list ';' '''
1949 print('modport_declaration_1', list(p
))
1955 def p__embed0_modport_declaration(p
):
1956 '''_embed0_modport_declaration : '''
1958 # { if (!pform_in_interface())
1959 # yyerror(@1, "error: modport declarations are only allowed "
1960 # "in interfaces.");
1965 def p_modport_item_list_1(p
):
1966 '''modport_item_list : modport_item '''
1968 print('modport_item_list_1', list(p
))
1974 def p_modport_item_list_2(p
):
1975 '''modport_item_list : modport_item_list ',' modport_item '''
1977 print('modport_item_list_2', list(p
))
1983 def p_modport_item_1(p
):
1984 '''modport_item : IDENTIFIER _embed0_modport_item '(' modport_ports_list ')' '''
1986 print('modport_item_1', list(p
))
1988 # { pform_end_modport_item(@1); }
1992 def p__embed0_modport_item(p
):
1993 '''_embed0_modport_item : '''
1995 # { pform_start_modport_item(@1, p[1]); }
1999 def p_modport_ports_list_1(p
):
2000 '''modport_ports_list : modport_ports_declaration '''
2002 print('modport_ports_list_1', list(p
))
2008 def p_modport_ports_list_2(p
):
2009 '''modport_ports_list : modport_ports_list ',' modport_ports_declaration '''
2011 print('modport_ports_list_2', list(p
))
2017 def p_modport_ports_list_3(p
):
2018 '''modport_ports_list : modport_ports_list ',' modport_simple_port '''
2020 print('modport_ports_list_3', list(p
))
2022 # { if (last_modport_port.type == MP_SIMPLE) {
2023 # pform_add_modport_port(@3, last_modport_port.direction,
2024 # p[3]->name, p[3]->parm);
2026 # yyerror(@3, "error: modport expression not allowed here.");
2033 def p_modport_ports_list_4(p
):
2034 '''modport_ports_list : modport_ports_list ',' modport_tf_port '''
2036 print('modport_ports_list_4', list(p
))
2038 # { if (last_modport_port.type != MP_TF)
2039 # yyerror(@3, "error: task/function declaration not allowed here.");
2044 def p_modport_ports_list_5(p
):
2045 '''modport_ports_list : modport_ports_list ',' IDENTIFIER '''
2047 print('modport_ports_list_5', list(p
))
2049 # { if (last_modport_port.type == MP_SIMPLE) {
2050 # pform_add_modport_port(@3, last_modport_port.direction,
2051 # lex_strings.make(p[3]), 0);
2052 # } else if (last_modport_port.type != MP_TF) {
2053 # yyerror(@3, "error: list of identifiers not allowed here.");
2060 def p_modport_ports_list_6(p
):
2061 '''modport_ports_list : modport_ports_list ',' '''
2063 print('modport_ports_list_6', list(p
))
2065 # { yyerror(@2, "error: NULL port declarations are not allowed"); }
2069 def p_modport_ports_declaration_1(p
):
2070 '''modport_ports_declaration : attribute_list_opt port_direction IDENTIFIER '''
2072 print('modport_ports_declaration_1', list(p
))
2074 # { last_modport_port.type = MP_SIMPLE;
2075 # last_modport_port.direction = p[2];
2076 # pform_add_modport_port(@3, p[2], lex_strings.make(p[3]), 0);
2083 def p_modport_ports_declaration_2(p
):
2084 '''modport_ports_declaration : attribute_list_opt port_direction modport_simple_port '''
2086 print('modport_ports_declaration_2', list(p
))
2088 # { last_modport_port.type = MP_SIMPLE;
2089 # last_modport_port.direction = p[2];
2090 # pform_add_modport_port(@3, p[2], p[3]->name, p[3]->parm);
2097 def p_modport_ports_declaration_3(p
):
2098 '''modport_ports_declaration : attribute_list_opt import_export IDENTIFIER '''
2100 print('modport_ports_declaration_3', list(p
))
2102 # { last_modport_port.type = MP_TF;
2103 # last_modport_port.is_import = p[2];
2104 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
2111 def p_modport_ports_declaration_4(p
):
2112 '''modport_ports_declaration : attribute_list_opt import_export modport_tf_port '''
2114 print('modport_ports_declaration_4', list(p
))
2116 # { last_modport_port.type = MP_TF;
2117 # last_modport_port.is_import = p[2];
2118 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
2124 def p_modport_ports_declaration_5(p
):
2125 '''modport_ports_declaration : attribute_list_opt K_clocking IDENTIFIER '''
2127 print('modport_ports_declaration_5', list(p
))
2129 # { last_modport_port.type = MP_CLOCKING;
2130 # last_modport_port.direction = NetNet::NOT_A_PORT;
2131 # yyerror(@3, "sorry: modport clocking declaration is not yet supported.");
2138 def p_modport_simple_port_1(p
):
2139 '''modport_simple_port : '.' IDENTIFIER '(' expression ')' '''
2141 print('modport_simple_port_1', list(p
))
2143 # { named_pexpr_t*tmp = new named_pexpr_t;
2144 # tmp->name = lex_strings.make(p[2]);
2152 def p_modport_tf_port_1(p
):
2153 '''modport_tf_port : K_task IDENTIFIER '''
2155 print('modport_tf_port_1', list(p
))
2161 def p_modport_tf_port_2(p
):
2162 '''modport_tf_port : K_task IDENTIFIER '(' tf_port_list_opt ')' '''
2164 print('modport_tf_port_2', list(p
))
2170 def p_modport_tf_port_3(p
):
2171 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '''
2173 print('modport_tf_port_3', list(p
))
2179 def p_modport_tf_port_4(p
):
2180 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' '''
2182 print('modport_tf_port_4', list(p
))
2188 def p_non_integer_type_1(p
):
2189 '''non_integer_type : K_real '''
2191 print('non_integer_type_1', list(p
))
2193 # { p[0] = real_type_t::REAL; }
2197 def p_non_integer_type_2(p
):
2198 '''non_integer_type : K_realtime '''
2200 print('non_integer_type_2', list(p
))
2202 # { p[0] = real_type_t::REAL; }
2206 def p_non_integer_type_3(p
):
2207 '''non_integer_type : K_shortreal '''
2209 print('non_integer_type_3', list(p
))
2211 # { p[0] = real_type_t::SHORTREAL; }
2216 '''number : BASED_NUMBER '''
2218 print('number_1', list(p
))
2220 # { p[0] = p[1]; based_size = 0;}
2225 '''number : DEC_NUMBER '''
2227 print('number_2', list(p
))
2228 num
= Leaf(token
.NUMBER
, "%s" % (p
[1]))
2231 # { p[0] = p[1]; based_size = 0;}
2236 '''number : DEC_NUMBER BASED_NUMBER '''
2238 print('number_3', list(p
))
2239 num
= Leaf(token
.NUMBER
, "%s:%s" % (p
[1], p
[2]))
2242 # { p[0] = pform_verinum_with_size(p[1],p[2], @2.text, @2.first_line);
2248 '''number : UNBASED_NUMBER '''
2250 print('number_4', list(p
))
2252 # { p[0] = p[1]; based_size = 0;}
2257 '''number : DEC_NUMBER UNBASED_NUMBER '''
2259 print('number_5', list(p
))
2261 # { yyerror(@1, "error: Unbased SystemVerilog literal cannot have "
2263 # p[0] = p[1]; based_size = 0;}
2267 def p_open_range_list_1(p
):
2268 '''open_range_list : open_range_list ',' value_range '''
2270 print('open_range_list_1', list(p
))
2276 def p_open_range_list_2(p
):
2277 '''open_range_list : value_range '''
2279 print('open_range_list_2', list(p
))
2285 def p_package_declaration_1(p
):
2286 '''package_declaration : K_package lifetime_opt IDENTIFIER ';' _embed0_package_declaration timeunits_declaration_opt _embed1_package_declaration package_item_list_opt K_endpackage endlabel_opt '''
2288 print('package_declaration_1', list(p
))
2290 # { pform_end_package_declaration(@1);
2291 # // If an end label is present make sure it match the package name.
2293 # if (strcmp(p[3],p[10]) != 0) {
2294 # yyerror(@10, "error: End label doesn't match package name");
2303 def p__embed0_package_declaration(p
):
2304 '''_embed0_package_declaration : '''
2306 # { pform_start_package_declaration(@1, p[3], p[2]); }
2310 def p__embed1_package_declaration(p
):
2311 '''_embed1_package_declaration : '''
2313 # { pform_set_scope_timescale(@1); }
2317 def p_module_package_import_list_opt_1(p
):
2318 '''module_package_import_list_opt : '''
2319 if(parse_debug
> 1):
2320 print('module_package_import_list_opt_1', list(p
))
2326 def p_module_package_import_list_opt_2(p
):
2327 '''module_package_import_list_opt : package_import_list '''
2329 print('module_package_import_list_opt_2', list(p
))
2335 def p_package_import_list_1(p
):
2336 '''package_import_list : package_import_declaration '''
2338 print('package_import_list_1', list(p
))
2344 def p_package_import_list_2(p
):
2345 '''package_import_list : package_import_list package_import_declaration '''
2347 print('package_import_list_2', list(p
))
2353 def p_package_import_declaration_1(p
):
2354 '''package_import_declaration : K_import package_import_item_list ';' '''
2356 print('package_import_declaration_1', list(p
))
2362 def p_package_import_item_1(p
):
2363 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '''
2365 print('package_import_item_1', list(p
))
2367 # { pform_package_import(@2, p[1], p[3]);
2373 def p_package_import_item_2(p
):
2374 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES '*' '''
2376 print('package_import_item_2', list(p
))
2378 # { pform_package_import(@2, p[1], 0);
2383 def p_package_import_item_list_1(p
):
2384 '''package_import_item_list : package_import_item_list ',' package_import_item '''
2386 print('package_import_item_list_1', list(p
))
2392 def p_package_import_item_list_2(p
):
2393 '''package_import_item_list : package_import_item '''
2395 print('package_import_item_list_2', list(p
))
2401 def p_package_item_1(p
):
2402 '''package_item : timeunits_declaration '''
2404 print('package_item_1', list(p
))
2410 def p_package_item_2(p
):
2411 '''package_item : K_parameter param_type parameter_assign_list ';' '''
2413 print('package_item_2', list(p
))
2419 def p_package_item_3(p
):
2420 '''package_item : K_localparam param_type localparam_assign_list ';' '''
2422 print('package_item_3', list(p
))
2428 def p_package_item_4(p
):
2429 '''package_item : type_declaration '''
2431 print('package_item_4', list(p
))
2437 def p_package_item_5(p
):
2438 '''package_item : function_declaration '''
2440 print('package_item_5', list(p
))
2446 def p_package_item_6(p
):
2447 '''package_item : task_declaration '''
2449 print('package_item_6', list(p
))
2455 def p_package_item_7(p
):
2456 '''package_item : data_declaration '''
2458 print('package_item_7', list(p
))
2464 def p_package_item_8(p
):
2465 '''package_item : class_declaration '''
2467 print('package_item_8', list(p
))
2473 def p_package_item_list_1(p
):
2474 '''package_item_list : package_item_list package_item '''
2476 print('package_item_list_1', list(p
))
2482 def p_package_item_list_2(p
):
2483 '''package_item_list : package_item '''
2485 print('package_item_list_2', list(p
))
2491 def p_package_item_list_opt_1(p
):
2492 '''package_item_list_opt : package_item_list '''
2494 print('package_item_list_opt_1', list(p
))
2500 def p_package_item_list_opt_2(p
):
2501 '''package_item_list_opt : '''
2503 print('package_item_list_opt_2', list(p
))
2509 def p_port_direction_1(p
):
2510 '''port_direction : K_input '''
2512 print('port_direction_1', list(p
))
2514 # { p[0] = NetNet::PINPUT; }
2518 def p_port_direction_2(p
):
2519 '''port_direction : K_output '''
2521 print('port_direction_2', list(p
))
2523 # { p[0] = NetNet::POUTPUT; }
2527 def p_port_direction_3(p
):
2528 '''port_direction : K_inout '''
2530 print('port_direction_3', list(p
))
2532 # { p[0] = NetNet::PINOUT; }
2536 def p_port_direction_4(p
):
2537 '''port_direction : K_ref '''
2539 print('port_direction_4', list(p
))
2541 # { p[0] = NetNet::PREF;
2542 # if (!gn_system_verilog()) {
2543 # yyerror(@1, "error: Reference ports (ref) require SystemVerilog.");
2544 # p[0] = NetNet::PINPUT;
2550 def p_port_direction_opt_1(p
):
2551 '''port_direction_opt : port_direction '''
2553 print('port_direction_opt_1', list(p
))
2560 def p_port_direction_opt_2(p
):
2561 '''port_direction_opt : '''
2563 print('port_direction_opt_2', list(p
))
2565 # { p[0] = NetNet::PIMPLICIT; }
2569 def p_property_expr_1(p
):
2570 '''property_expr : expression '''
2572 print('property_expr_1', list(p
))
2578 def p_procedural_assertion_statement_1(p
):
2579 '''procedural_assertion_statement : K_assert '(' expression ')' statement %prec less_than_K_else '''
2581 print('procedural_assertion_statement_1', list(p
))
2583 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2589 def p_procedural_assertion_statement_2(p
):
2590 '''procedural_assertion_statement : K_assert '(' expression ')' K_else statement '''
2592 print('procedural_assertion_statement_2', list(p
))
2594 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2600 def p_procedural_assertion_statement_3(p
):
2601 '''procedural_assertion_statement : K_assert '(' expression ')' statement K_else statement '''
2603 print('procedural_assertion_statement_3', list(p
))
2605 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2611 def p_property_qualifier_1(p
):
2612 '''property_qualifier : class_item_qualifier '''
2614 print('property_qualifier_1', list(p
))
2620 def p_property_qualifier_2(p
):
2621 '''property_qualifier : random_qualifier '''
2623 print('property_qualifier_2', list(p
))
2629 def p_property_qualifier_opt_1(p
):
2630 '''property_qualifier_opt : property_qualifier_list '''
2632 print('property_qualifier_opt_1', list(p
))
2639 def p_property_qualifier_opt_2(p
):
2640 '''property_qualifier_opt : '''
2642 print('property_qualifier_opt_2', list(p
))
2644 # { p[0] = property_qualifier_t::make_none(); }
2648 def p_property_qualifier_list_1(p
):
2649 '''property_qualifier_list : property_qualifier_list property_qualifier '''
2651 print('property_qualifier_list_1', list(p
))
2653 # { p[0] = p[1] | p[2]; }
2657 def p_property_qualifier_list_2(p
):
2658 '''property_qualifier_list : property_qualifier '''
2660 print('property_qualifier_list_2', list(p
))
2667 def p_property_spec_1(p
):
2668 '''property_spec : clocking_event_opt property_spec_disable_iff_opt property_expr '''
2670 print('property_spec_1', list(p
))
2676 def p_property_spec_disable_iff_opt_1(p
):
2677 '''property_spec_disable_iff_opt : K_disable K_iff '(' expression ')' '''
2679 print('property_spec_disable_iff_opt_1', list(p
))
2685 def p_property_spec_disable_iff_opt_2(p
):
2686 '''property_spec_disable_iff_opt : '''
2688 print('property_spec_disable_iff_opt_2', list(p
))
2694 def p_random_qualifier_1(p
):
2695 '''random_qualifier : K_rand '''
2697 print('random_qualifier_1', list(p
))
2699 # { p[0] = property_qualifier_t::make_rand(); }
2703 def p_random_qualifier_2(p
):
2704 '''random_qualifier : K_randc '''
2706 print('random_qualifier_2', list(p
))
2708 # { p[0] = property_qualifier_t::make_randc(); }
2712 def p_real_or_realtime_1(p
):
2713 '''real_or_realtime : K_real '''
2715 print('real_or_realtime_1', list(p
))
2721 def p_real_or_realtime_2(p
):
2722 '''real_or_realtime : K_realtime '''
2724 print('real_or_realtime_2', list(p
))
2731 '''signing : K_signed '''
2733 print('signing_1', list(p
))
2741 '''signing : K_unsigned '''
2743 print('signing_2', list(p
))
2750 def p_simple_type_or_string_1(p
):
2751 '''simple_type_or_string : integer_vector_type '''
2753 print('simple_type_or_string_1', list(p
))
2755 # { ivl_variable_type_t use_vtype = p[1];
2756 # bool reg_flag = false;
2757 # if (use_vtype == IVL_VT_NO_TYPE) {
2758 # use_vtype = IVL_VT_LOGIC;
2761 # vector_type_t*tmp = new vector_type_t(use_vtype, false, 0);
2762 # tmp->reg_flag = reg_flag;
2763 # FILE_NAME(tmp, @1);
2769 def p_simple_type_or_string_2(p
):
2770 '''simple_type_or_string : non_integer_type '''
2772 print('simple_type_or_string_2', list(p
))
2774 # { real_type_t*tmp = new real_type_t(p[1]);
2775 # FILE_NAME(tmp, @1);
2781 def p_simple_type_or_string_3(p
):
2782 '''simple_type_or_string : atom2_type '''
2784 print('simple_type_or_string_3', list(p
))
2786 # { atom2_type_t*tmp = new atom2_type_t(p[1], true);
2787 # FILE_NAME(tmp, @1);
2793 def p_simple_type_or_string_4(p
):
2794 '''simple_type_or_string : K_integer '''
2796 print('simple_type_or_string_4', list(p
))
2798 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
2799 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd);
2800 # tmp->reg_flag = true;
2801 # tmp->integer_flag = true;
2807 def p_simple_type_or_string_5(p
):
2808 '''simple_type_or_string : K_time '''
2810 print('simple_type_or_string_5', list(p
))
2812 # { list<pform_range_t>*pd = make_range_from_width(64);
2813 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
2814 # tmp->reg_flag = !gn_system_verilog();
2820 def p_simple_type_or_string_6(p
):
2821 '''simple_type_or_string : TYPE_IDENTIFIER '''
2823 print('simple_type_or_string_6', list(p
))
2825 # { p[0] = p[1].type;
2826 # delete[]p[1].text;
2831 def p_simple_type_or_string_7(p
):
2832 '''simple_type_or_string : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_simple_type_or_string TYPE_IDENTIFIER '''
2834 print('simple_type_or_string_7', list(p
))
2836 # { lex_in_package_scope(0);
2838 # delete[]p[4].text;
2843 def p_simple_type_or_string_8(p
):
2844 '''simple_type_or_string : K_string '''
2846 print('simple_type_or_string_8', list(p
))
2848 # { string_type_t*tmp = new string_type_t;
2849 # FILE_NAME(tmp, @1);
2855 def p__embed0_simple_type_or_string(p
):
2856 '''_embed0_simple_type_or_string : '''
2858 # { lex_in_package_scope(p[1]); }
2862 def p_statement_1(p
):
2863 '''statement : attribute_list_opt statement_item '''
2865 print('statement_1', list(p
))
2867 # { pform_bind_attributes(p[2]->attributes, p[1]);
2873 def p_statement_or_null_1(p
):
2874 '''statement_or_null : statement '''
2876 print('statement_or_null_1', list(p
))
2883 def p_statement_or_null_2(p
):
2884 '''statement_or_null : attribute_list_opt ';' '''
2886 print('statement_or_null_2', list(p
))
2892 def p_stream_expression_1(p
):
2893 '''stream_expression : expression '''
2895 print('stream_expression_1', list(p
))
2901 def p_stream_expression_list_1(p
):
2902 '''stream_expression_list : stream_expression_list ',' stream_expression '''
2904 print('stream_expression_list_1', list(p
))
2910 def p_stream_expression_list_2(p
):
2911 '''stream_expression_list : stream_expression '''
2913 print('stream_expression_list_2', list(p
))
2919 def p_stream_operator_1(p
):
2920 '''stream_operator : K_LS '''
2922 print('stream_operator_1', list(p
))
2928 def p_stream_operator_2(p
):
2929 '''stream_operator : K_RS '''
2931 print('stream_operator_2', list(p
))
2937 def p_streaming_concatenation_1(p
):
2938 '''streaming_concatenation : '{' stream_operator '{' stream_expression_list '}' '}' '''
2940 print('streaming_concatenation_1', list(p
))
2942 # { /* streaming concatenation is a SystemVerilog thing. */
2943 # if (gn_system_verilog()) {
2944 # yyerror(@2, "sorry: Streaming concatenation not supported.");
2947 # yyerror(@2, "error: Streaming concatenation requires SystemVerilog");
2954 def p_task_declaration_1(p
):
2955 '''task_declaration : K_task lifetime_opt IDENTIFIER ';' _embed0_task_declaration task_item_list_opt statement_or_null_list_opt K_endtask _embed1_task_declaration endlabel_opt '''
2957 print('task_declaration_1', list(p
))
2959 # { // Last step: check any closing name. This is done late so
2960 # // that the parser can look ahead to detect the present
2961 # // endlabel_opt but still have the pform_endmodule() called
2962 # // early enough that the lexor can know we are outside the
2965 # if (strcmp(p[3],p[10]) != 0) {
2966 # yyerror(@10, "error: End label doesn't match task name");
2968 # if (! gn_system_verilog()) {
2969 # yyerror(@10, "error: Task end labels require "
2970 # "SystemVerilog.");
2979 def p_task_declaration_2(p
):
2980 '''task_declaration : K_task lifetime_opt IDENTIFIER '(' _embed2_task_declaration tf_port_list ')' ';' block_item_decls_opt statement_or_null_list_opt K_endtask _embed3_task_declaration endlabel_opt '''
2982 print('task_declaration_2', list(p
))
2984 # { // Last step: check any closing name. This is done late so
2985 # // that the parser can look ahead to detect the present
2986 # // endlabel_opt but still have the pform_endmodule() called
2987 # // early enough that the lexor can know we are outside the
2990 # if (strcmp(p[3],p[13]) != 0) {
2991 # yyerror(@13, "error: End label doesn't match task name");
2993 # if (! gn_system_verilog()) {
2994 # yyerror(@13, "error: Task end labels require "
2995 # "SystemVerilog.");
3004 def p_task_declaration_3(p
):
3005 '''task_declaration : K_task lifetime_opt IDENTIFIER '(' ')' ';' _embed4_task_declaration block_item_decls_opt statement_or_null_list K_endtask _embed5_task_declaration endlabel_opt '''
3007 print('task_declaration_3', list(p
))
3009 # { // Last step: check any closing name. This is done late so
3010 # // that the parser can look ahead to detect the present
3011 # // endlabel_opt but still have the pform_endmodule() called
3012 # // early enough that the lexor can know we are outside the
3015 # if (strcmp(p[3],p[12]) != 0) {
3016 # yyerror(@12, "error: End label doesn't match task name");
3018 # if (! gn_system_verilog()) {
3019 # yyerror(@12, "error: Task end labels require "
3020 # "SystemVerilog.");
3029 def p_task_declaration_4(p
):
3030 '''task_declaration : K_task lifetime_opt IDENTIFIER error K_endtask _embed6_task_declaration endlabel_opt '''
3032 print('task_declaration_4', list(p
))
3034 # { // Last step: check any closing name. This is done late so
3035 # // that the parser can look ahead to detect the present
3036 # // endlabel_opt but still have the pform_endmodule() called
3037 # // early enough that the lexor can know we are outside the
3040 # if (strcmp(p[3],p[7]) != 0) {
3041 # yyerror(@7, "error: End label doesn't match task name");
3043 # if (! gn_system_verilog()) {
3044 # yyerror(@7, "error: Task end labels require "
3045 # "SystemVerilog.");
3054 def p__embed0_task_declaration(p
):
3055 '''_embed0_task_declaration : '''
3057 # { assert(current_task == 0);
3058 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3063 def p__embed1_task_declaration(p
):
3064 '''_embed1_task_declaration : '''
3066 # { current_task->set_ports(p[6]);
3067 # current_task_set_statement(@3, p[7]);
3068 # pform_set_this_class(@3, current_task);
3069 # pform_pop_scope();
3071 # if (p[7] && p[7]->size() > 1 && !gn_system_verilog()) {
3072 # yyerror(@7, "error: Task body with multiple statements requires SystemVerilog.");
3079 def p__embed2_task_declaration(p
):
3080 '''_embed2_task_declaration : '''
3082 # { assert(current_task == 0);
3083 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3088 def p__embed3_task_declaration(p
):
3089 '''_embed3_task_declaration : '''
3091 # { current_task->set_ports(p[6]);
3092 # current_task_set_statement(@3, p[10]);
3093 # pform_set_this_class(@3, current_task);
3094 # pform_pop_scope();
3096 # if (p[10]) delete p[10];
3101 def p__embed4_task_declaration(p
):
3102 '''_embed4_task_declaration : '''
3104 # { assert(current_task == 0);
3105 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3110 def p__embed5_task_declaration(p
):
3111 '''_embed5_task_declaration : '''
3113 # { current_task->set_ports(0);
3114 # current_task_set_statement(@3, p[9]);
3115 # pform_set_this_class(@3, current_task);
3116 # if (! current_task->method_of()) {
3117 # cerr << @3 << ": warning: task definition for \"" << p[3]
3118 # << "\" has an empty port declaration list!" << endl;
3120 # pform_pop_scope();
3122 # if (p[9]->size() > 1 && !gn_system_verilog()) {
3123 # yyerror(@9, "error: Task body with multiple statements requires SystemVerilog.");
3130 def p__embed6_task_declaration(p
):
3131 '''_embed6_task_declaration : '''
3134 # if (current_task) {
3135 # pform_pop_scope();
3142 def p_tf_port_declaration_1(p
):
3143 '''tf_port_declaration : port_direction K_reg_opt unsigned_signed_opt dimensions_opt list_of_identifiers ';' '''
3145 print('tf_port_declaration_1', list(p
))
3147 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1],
3148 # p[2] ? IVL_VT_LOGIC :
3150 # p[3], p[4], p[5]);
3156 def p_tf_port_declaration_2(p
):
3157 '''tf_port_declaration : port_direction K_integer list_of_identifiers ';' '''
3159 print('tf_port_declaration_2', list(p
))
3161 # { list<pform_range_t>*range_stub = make_range_from_width(integer_width);
3162 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, true,
3163 # range_stub, p[3], true);
3169 def p_tf_port_declaration_3(p
):
3170 '''tf_port_declaration : port_direction K_time list_of_identifiers ';' '''
3172 print('tf_port_declaration_3', list(p
))
3174 # { list<pform_range_t>*range_stub = make_range_from_width(64);
3175 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, false,
3176 # range_stub, p[3]);
3182 def p_tf_port_declaration_4(p
):
3183 '''tf_port_declaration : port_direction real_or_realtime list_of_identifiers ';' '''
3185 print('tf_port_declaration_4', list(p
))
3187 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_REAL, true,
3194 def p_tf_port_declaration_5(p
):
3195 '''tf_port_declaration : port_direction K_string list_of_identifiers ';' '''
3197 print('tf_port_declaration_5', list(p
))
3199 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_STRING, true,
3206 def p_tf_port_item_1(p
):
3207 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER dimensions_opt tf_port_item_expr_opt '''
3209 print('tf_port_item_1', list(p
))
3211 # { vector<pform_tf_port_t>*tmp;
3212 # NetNet::PortType use_port_type = p[1];
3213 # if ((use_port_type == NetNet::PIMPLICIT) && (gn_system_verilog() || (p[2] == 0)))
3214 # use_port_type = port_declaration_context.port_type;
3215 # perm_string name = lex_strings.make(p[3]);
3216 # list<perm_string>* ilist = list_from_identifier(p[3]);
3218 # if (use_port_type == NetNet::PIMPLICIT) {
3219 # yyerror(@1, "error: missing task/function port direction.");
3220 # use_port_type = NetNet::PINPUT; // for error recovery
3222 # if ((p[2] == 0) && (p[1]==NetNet::PIMPLICIT)) {
3223 # // Detect special case this is an undecorated
3224 # // identifier and we need to get the declaration from
3227 # yyerror(@4, "internal error: How can there be an unpacked range here?\n");
3229 # tmp = pform_make_task_ports(@3, use_port_type,
3230 # port_declaration_context.data_type,
3234 # // Otherwise, the decorations for this identifier
3235 # // indicate the type. Save the type for any right
3236 # // context that may come later.
3237 # port_declaration_context.port_type = use_port_type;
3239 # p[2] = new vector_type_t(IVL_VT_LOGIC, false, 0);
3240 # FILE_NAME(p[2], @3);
3242 # port_declaration_context.data_type = p[2];
3243 # tmp = pform_make_task_ports(@3, use_port_type, p[2], ilist);
3246 # pform_set_reg_idx(name, p[4]);
3251 # assert(tmp->size()==1);
3252 # tmp->front().defe = p[5];
3258 def p_tf_port_item_2(p
):
3259 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER error '''
3261 print('tf_port_item_2', list(p
))
3263 # { yyerror(@3, "error: Error in task/function port item after port name %s.", p[3]);
3270 def p_tf_port_item_expr_opt_1(p
):
3271 '''tf_port_item_expr_opt : '=' expression '''
3273 print('tf_port_item_expr_opt_1', list(p
))
3275 # { if (! gn_system_verilog()) {
3276 # yyerror(@1, "error: Task/function default arguments require "
3277 # "SystemVerilog.");
3284 def p_tf_port_item_expr_opt_2(p
):
3285 '''tf_port_item_expr_opt : '''
3287 print('tf_port_item_expr_opt_2', list(p
))
3293 def p_tf_port_list_1(p
):
3294 '''tf_port_list : _embed0_tf_port_list tf_port_item_list '''
3296 print('tf_port_list_1', list(p
))
3303 def p__embed0_tf_port_list(p
):
3304 '''_embed0_tf_port_list : '''
3306 # { port_declaration_context.port_type = gn_system_verilog() ? NetNet::PINPUT : NetNet::PIMPLICIT;
3307 # port_declaration_context.data_type = 0;
3312 def p_tf_port_item_list_1(p
):
3313 '''tf_port_item_list : tf_port_item_list ',' tf_port_item '''
3315 print('tf_port_item_list_1', list(p
))
3317 # { vector<pform_tf_port_t>*tmp;
3318 # if (p[1] && p[3]) {
3319 # size_t s1 = p[1]->size();
3321 # tmp->resize(tmp->size()+p[3]->size());
3322 # for (size_t idx = 0 ; idx < p[3]->size() ; idx += 1)
3323 # tmp->at(s1+idx) = p[3]->at(idx);
3325 # } else if (p[1]) {
3335 def p_tf_port_item_list_2(p
):
3336 '''tf_port_item_list : tf_port_item '''
3338 print('tf_port_item_list_2', list(p
))
3345 def p_tf_port_item_list_3(p
):
3346 '''tf_port_item_list : error ',' tf_port_item '''
3348 print('tf_port_item_list_3', list(p
))
3350 # { yyerror(@2, "error: Syntax error in task/function port declaration.");
3356 def p_tf_port_item_list_4(p
):
3357 '''tf_port_item_list : tf_port_item_list ',' '''
3359 print('tf_port_item_list_4', list(p
))
3361 # { yyerror(@2, "error: NULL port declarations are not allowed.");
3367 def p_tf_port_item_list_5(p
):
3368 '''tf_port_item_list : tf_port_item_list ';' '''
3370 print('tf_port_item_list_5', list(p
))
3372 # { yyerror(@2, "error: ';' is an invalid port declaration separator.");
3378 def p_timeunits_declaration_1(p
):
3379 '''timeunits_declaration : K_timeunit TIME_LITERAL ';' '''
3381 print('timeunits_declaration_1', list(p
))
3383 # { pform_set_timeunit(p[2], allow_timeunit_decl); }
3387 def p_timeunits_declaration_2(p
):
3388 '''timeunits_declaration : K_timeunit TIME_LITERAL '/' TIME_LITERAL ';' '''
3390 print('timeunits_declaration_2', list(p
))
3392 # { bool initial_decl = allow_timeunit_decl && allow_timeprec_decl;
3393 # pform_set_timeunit(p[2], initial_decl);
3394 # pform_set_timeprec(p[4], initial_decl);
3399 def p_timeunits_declaration_3(p
):
3400 '''timeunits_declaration : K_timeprecision TIME_LITERAL ';' '''
3402 print('timeunits_declaration_3', list(p
))
3404 # { pform_set_timeprec(p[2], allow_timeprec_decl); }
3408 def p_timeunits_declaration_opt_1(p
):
3409 '''timeunits_declaration_opt : %prec no_timeunits_declaration '''
3410 if(parse_debug
> 2):
3411 print('timeunits_declaration_opt_1', list(p
))
3417 def p_timeunits_declaration_opt_2(p
):
3418 '''timeunits_declaration_opt : timeunits_declaration %prec one_timeunits_declaration '''
3420 print('timeunits_declaration_opt_2', list(p
))
3426 def p_timeunits_declaration_opt_3(p
):
3427 '''timeunits_declaration_opt : timeunits_declaration timeunits_declaration '''
3429 print('timeunits_declaration_opt_3', list(p
))
3435 def p_value_range_1(p
):
3436 '''value_range : expression '''
3438 print('value_range_1', list(p
))
3444 def p_value_range_2(p
):
3445 '''value_range : '[' expression ':' expression ']' '''
3447 print('value_range_2', list(p
))
3453 def p_variable_dimension_1(p
):
3454 '''variable_dimension : '[' expression ':' expression ']' '''
3456 print('variable_dimension_1', list(p
))
3457 # { list<pform_range_t> *tmp = new list<pform_range_t>;
3458 # pform_range_t index (p[2],p[4]);
3459 # tmp->push_back(index);
3462 # XXX TODO: subscriptlist
3465 if end
.endswith("-1"):
3468 end
= str(int(end
)+1)
3471 p
[0] = '[%s:%s]' % (start
, end
) # python slice is LO:HI+1
3477 def p_variable_dimension_2(p
):
3478 '''variable_dimension : '[' expression ']' '''
3480 print('variable_dimension_2', list(p
))
3482 # { // SystemVerilog canonical range
3483 # if (!gn_system_verilog()) {
3485 # cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. "
3486 # << "Use at least -g2005-sv to remove this warning." << endl;
3488 # list<pform_range_t> *tmp = new list<pform_range_t>;
3489 # pform_range_t index;
3490 # index.first = new PENumber(new verinum((uint64_t)0, integer_width));
3491 # index.second = new PEBinary('-', p[2], new PENumber(new verinum((uint64_t)1, integer_width)));
3492 # tmp->push_back(index);
3498 def p_variable_dimension_3(p
):
3499 '''variable_dimension : '[' ']' '''
3501 print('variable_dimension_3', list(p
))
3503 # { list<pform_range_t> *tmp = new list<pform_range_t>;
3504 # pform_range_t index (0,0);
3505 # tmp->push_back(index);
3511 def p_variable_dimension_4(p
):
3512 '''variable_dimension : '[' '$' ']' '''
3514 print('variable_dimension_4', list(p
))
3516 # { // SystemVerilog queue
3517 # list<pform_range_t> *tmp = new list<pform_range_t>;
3518 # pform_range_t index (new PENull,0);
3519 # if (!gn_system_verilog()) {
3520 # yyerror("error: Queue declarations require SystemVerilog.");
3522 # tmp->push_back(index);
3528 def p_variable_lifetime_1(p
):
3529 '''variable_lifetime : lifetime '''
3531 print('variable_lifetime_1', list(p
))
3533 # { if (!gn_system_verilog()) {
3534 # yyerror(@1, "error: overriding the default variable lifetime "
3535 # "requires SystemVerilog.");
3536 # } else if (p[1] != pform_peek_scope()->default_lifetime) {
3537 # yyerror(@1, "sorry: overriding the default variable lifetime "
3538 # "is not yet supported.");
3540 # var_lifetime = p[1];
3545 def p_attribute_list_opt_1(p
):
3546 '''attribute_list_opt : attribute_instance_list '''
3548 print('attribute_list_opt_1', list(p
))
3555 def p_attribute_list_opt_2(p
):
3556 '''attribute_list_opt : '''
3557 if(parse_debug
> 2):
3558 print('attribute_list_opt_2', list(p
))
3564 def p_attribute_instance_list_1(p
):
3565 '''attribute_instance_list : K_PSTAR K_STARP '''
3567 print('attribute_instance_list_1', list(p
))
3573 def p_attribute_instance_list_2(p
):
3574 '''attribute_instance_list : K_PSTAR attribute_list K_STARP '''
3576 print('attribute_instance_list_2', list(p
))
3583 def p_attribute_instance_list_3(p
):
3584 '''attribute_instance_list : attribute_instance_list K_PSTAR K_STARP '''
3586 print('attribute_instance_list_3', list(p
))
3593 def p_attribute_instance_list_4(p
):
3594 '''attribute_instance_list : attribute_instance_list K_PSTAR attribute_list K_STARP '''
3596 print('attribute_instance_list_4', list(p
))
3598 # { list<named_pexpr_t>*tmp = p[1];
3600 # tmp->splice(tmp->end(), *p[3]);
3603 # } else p[0] = p[3];
3608 def p_attribute_list_1(p
):
3609 '''attribute_list : attribute_list ',' attribute '''
3611 print('attribute_list_1', list(p
))
3613 # { list<named_pexpr_t>*tmp = p[1];
3614 # tmp->push_back(*p[3]);
3621 def p_attribute_list_2(p
):
3622 '''attribute_list : attribute '''
3624 print('attribute_list_2', list(p
))
3626 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
3627 # tmp->push_back(*p[1]);
3634 def p_attribute_1(p
):
3635 '''attribute : IDENTIFIER '''
3637 print('attribute_1', list(p
))
3639 # { named_pexpr_t*tmp = new named_pexpr_t;
3640 # tmp->name = lex_strings.make(p[1]);
3648 def p_attribute_2(p
):
3649 '''attribute : IDENTIFIER '=' expression '''
3651 print('attribute_2', list(p
))
3653 # { PExpr*tmp = p[3];
3654 # named_pexpr_t*tmp2 = new named_pexpr_t;
3655 # tmp2->name = lex_strings.make(p[1]);
3663 def p_block_item_decl_1(p
):
3664 '''block_item_decl : data_type register_variable_list ';' '''
3666 print('block_item_decl_1', list(p
))
3668 # { if (p[1]) pform_set_data_type(@1, p[1], p[2], NetNet::REG, attributes_in_context);
3673 def p_block_item_decl_2(p
):
3674 '''block_item_decl : variable_lifetime data_type register_variable_list ';' '''
3676 print('block_item_decl_2', list(p
))
3678 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
3679 # var_lifetime = LexicalScope::INHERITED;
3684 def p_block_item_decl_3(p
):
3685 '''block_item_decl : K_reg data_type register_variable_list ';' '''
3687 print('block_item_decl_3', list(p
))
3689 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
3694 def p_block_item_decl_4(p
):
3695 '''block_item_decl : variable_lifetime K_reg data_type register_variable_list ';' '''
3697 print('block_item_decl_4', list(p
))
3699 # { if (p[3]) pform_set_data_type(@3, p[3], p[4], NetNet::REG, attributes_in_context);
3700 # var_lifetime = LexicalScope::INHERITED;
3705 def p_block_item_decl_5(p
):
3706 '''block_item_decl : K_event event_variable_list ';' '''
3708 print('block_item_decl_5', list(p
))
3710 # { if (p[2]) pform_make_events(p[2], @1.text, @1.first_line);
3715 def p_block_item_decl_6(p
):
3716 '''block_item_decl : K_parameter param_type parameter_assign_list ';' '''
3718 print('block_item_decl_6', list(p
))
3724 def p_block_item_decl_7(p
):
3725 '''block_item_decl : K_localparam param_type localparam_assign_list ';' '''
3727 print('block_item_decl_7', list(p
))
3733 def p_block_item_decl_8(p
):
3734 '''block_item_decl : type_declaration '''
3736 print('block_item_decl_8', list(p
))
3742 def p_block_item_decl_9(p
):
3743 '''block_item_decl : K_integer error ';' '''
3745 print('block_item_decl_9', list(p
))
3747 # { yyerror(@1, "error: syntax error in integer variable list.");
3753 def p_block_item_decl_10(p
):
3754 '''block_item_decl : K_time error ';' '''
3756 print('block_item_decl_10', list(p
))
3758 # { yyerror(@1, "error: syntax error in time variable list.");
3764 def p_block_item_decl_11(p
):
3765 '''block_item_decl : K_parameter error ';' '''
3767 print('block_item_decl_11', list(p
))
3769 # { yyerror(@1, "error: syntax error in parameter list.");
3775 def p_block_item_decl_12(p
):
3776 '''block_item_decl : K_localparam error ';' '''
3778 print('block_item_decl_12', list(p
))
3780 # { yyerror(@1, "error: syntax error localparam list.");
3786 def p_block_item_decls_1(p
):
3787 '''block_item_decls : block_item_decl '''
3789 print('block_item_decls_1', list(p
))
3795 def p_block_item_decls_2(p
):
3796 '''block_item_decls : block_item_decls block_item_decl '''
3798 print('block_item_decls_2', list(p
))
3804 def p_block_item_decls_opt_1(p
):
3805 '''block_item_decls_opt : block_item_decls '''
3807 print('block_item_decls_opt_1', list(p
))
3814 def p_block_item_decls_opt_2(p
):
3815 '''block_item_decls_opt : '''
3817 print('block_item_decls_opt_2', list(p
))
3824 def p_type_declaration_1(p
):
3825 '''type_declaration : K_typedef data_type IDENTIFIER dimensions_opt ';' '''
3827 print('type_declaration_1', list(p
))
3829 # { perm_string name = lex_strings.make(p[3]);
3830 # pform_set_typedef(name, p[2], p[4]);
3836 def p_type_declaration_2(p
):
3837 '''type_declaration : K_typedef data_type TYPE_IDENTIFIER ';' '''
3839 print('type_declaration_2', list(p
))
3841 # { perm_string name = lex_strings.make(p[3].text);
3842 # if (pform_test_type_identifier_local(name)) {
3843 # yyerror(@3, "error: Typedef identifier \"%s\" is already a type name.", p[3].text);
3846 # pform_set_typedef(name, p[2], NULL);
3848 # delete[]p[3].text;
3853 def p_type_declaration_3(p
):
3854 '''type_declaration : K_typedef K_class IDENTIFIER ';' '''
3856 print('type_declaration_3', list(p
))
3858 # { // Create a synthetic typedef for the class name so that the
3859 # // lexor detects the name as a type.
3860 # perm_string name = lex_strings.make(p[3]);
3861 # class_type_t*tmp = new class_type_t(name);
3862 # FILE_NAME(tmp, @3);
3863 # pform_set_typedef(name, tmp, NULL);
3869 def p_type_declaration_4(p
):
3870 '''type_declaration : K_typedef K_enum IDENTIFIER ';' '''
3872 print('type_declaration_4', list(p
))
3874 # { yyerror(@1, "sorry: Enum forward declarations not supported yet."); }
3878 def p_type_declaration_5(p
):
3879 '''type_declaration : K_typedef K_struct IDENTIFIER ';' '''
3881 print('type_declaration_5', list(p
))
3883 # { yyerror(@1, "sorry: Struct forward declarations not supported yet."); }
3887 def p_type_declaration_6(p
):
3888 '''type_declaration : K_typedef K_union IDENTIFIER ';' '''
3890 print('type_declaration_6', list(p
))
3892 # { yyerror(@1, "sorry: Union forward declarations not supported yet."); }
3896 def p_type_declaration_7(p
):
3897 '''type_declaration : K_typedef IDENTIFIER ';' '''
3899 print('type_declaration_7', list(p
))
3901 # { // Create a synthetic typedef for the class name so that the
3902 # // lexor detects the name as a type.
3903 # perm_string name = lex_strings.make(p[2]);
3904 # class_type_t*tmp = new class_type_t(name);
3905 # FILE_NAME(tmp, @2);
3906 # pform_set_typedef(name, tmp, NULL);
3912 def p_type_declaration_8(p
):
3913 '''type_declaration : K_typedef error ';' '''
3915 print('type_declaration_8', list(p
))
3917 # { yyerror(@2, "error: Syntax error in typedef clause.");
3923 def p_enum_data_type_1(p
):
3924 '''enum_data_type : K_enum '{' enum_name_list '}' '''
3926 print('enum_data_type_1', list(p
))
3928 # { enum_type_t*enum_type = new enum_type_t;
3929 # FILE_NAME(enum_type, @1);
3930 # enum_type->names .reset(p[3]);
3931 # enum_type->base_type = IVL_VT_BOOL;
3932 # enum_type->signed_flag = true;
3933 # enum_type->integer_flag = false;
3934 # enum_type->range.reset(make_range_from_width(32));
3940 def p_enum_data_type_2(p
):
3941 '''enum_data_type : K_enum atom2_type signed_unsigned_opt '{' enum_name_list '}' '''
3943 print('enum_data_type_2', list(p
))
3945 # { enum_type_t*enum_type = new enum_type_t;
3946 # FILE_NAME(enum_type, @1);
3947 # enum_type->names .reset(p[5]);
3948 # enum_type->base_type = IVL_VT_BOOL;
3949 # enum_type->signed_flag = p[3];
3950 # enum_type->integer_flag = false;
3951 # enum_type->range.reset(make_range_from_width(p[2]));
3957 def p_enum_data_type_3(p
):
3958 '''enum_data_type : K_enum K_integer signed_unsigned_opt '{' enum_name_list '}' '''
3960 print('enum_data_type_3', list(p
))
3962 # { enum_type_t*enum_type = new enum_type_t;
3963 # FILE_NAME(enum_type, @1);
3964 # enum_type->names .reset(p[5]);
3965 # enum_type->base_type = IVL_VT_LOGIC;
3966 # enum_type->signed_flag = p[3];
3967 # enum_type->integer_flag = true;
3968 # enum_type->range.reset(make_range_from_width(integer_width));
3974 def p_enum_data_type_4(p
):
3975 '''enum_data_type : K_enum K_logic unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
3977 print('enum_data_type_4', list(p
))
3979 # { enum_type_t*enum_type = new enum_type_t;
3980 # FILE_NAME(enum_type, @1);
3981 # enum_type->names .reset(p[6]);
3982 # enum_type->base_type = IVL_VT_LOGIC;
3983 # enum_type->signed_flag = p[3];
3984 # enum_type->integer_flag = false;
3985 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
3991 def p_enum_data_type_5(p
):
3992 '''enum_data_type : K_enum K_reg unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
3994 print('enum_data_type_5', list(p
))
3996 # { enum_type_t*enum_type = new enum_type_t;
3997 # FILE_NAME(enum_type, @1);
3998 # enum_type->names .reset(p[6]);
3999 # enum_type->base_type = IVL_VT_LOGIC;
4000 # enum_type->signed_flag = p[3];
4001 # enum_type->integer_flag = false;
4002 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4008 def p_enum_data_type_6(p
):
4009 '''enum_data_type : K_enum K_bit unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
4011 print('enum_data_type_6', list(p
))
4013 # { enum_type_t*enum_type = new enum_type_t;
4014 # FILE_NAME(enum_type, @1);
4015 # enum_type->names .reset(p[6]);
4016 # enum_type->base_type = IVL_VT_BOOL;
4017 # enum_type->signed_flag = p[3];
4018 # enum_type->integer_flag = false;
4019 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4025 def p_enum_name_list_1(p
):
4026 '''enum_name_list : enum_name '''
4028 print('enum_name_list_1', list(p
))
4035 def p_enum_name_list_2(p
):
4036 '''enum_name_list : enum_name_list ',' enum_name '''
4038 print('enum_name_list_2', list(p
))
4040 # { list<named_pexpr_t>*lst = p[1];
4041 # lst->splice(lst->end(), *p[3]);
4048 def p_pos_neg_number_1(p
):
4049 '''pos_neg_number : number '''
4051 print('pos_neg_number_1', list(p
))
4058 def p_pos_neg_number_2(p
):
4059 '''pos_neg_number : '-' number '''
4061 print('pos_neg_number_2', list(p
))
4063 # { verinum tmp = -(*(p[2]));
4070 def p_enum_name_1(p
):
4071 '''enum_name : IDENTIFIER '''
4073 print('enum_name_1', list(p
))
4075 # { perm_string name = lex_strings.make(p[1]);
4077 # p[0] = make_named_number(name);
4082 def p_enum_name_2(p
):
4083 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '''
4085 print('enum_name_2', list(p
))
4087 # { perm_string name = lex_strings.make(p[1]);
4088 # long count = check_enum_seq_value(@1, p[3], false);
4090 # p[0] = make_named_numbers(name, 0, count-1);
4096 def p_enum_name_3(p
):
4097 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '''
4099 print('enum_name_3', list(p
))
4101 # { perm_string name = lex_strings.make(p[1]);
4102 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
4103 # check_enum_seq_value(@1, p[5], true));
4111 def p_enum_name_4(p
):
4112 '''enum_name : IDENTIFIER '=' expression '''
4114 print('enum_name_4', list(p
))
4116 # { perm_string name = lex_strings.make(p[1]);
4118 # p[0] = make_named_number(name, p[3]);
4123 def p_enum_name_5(p
):
4124 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '=' expression '''
4126 print('enum_name_5', list(p
))
4128 # { perm_string name = lex_strings.make(p[1]);
4129 # long count = check_enum_seq_value(@1, p[3], false);
4130 # p[0] = make_named_numbers(name, 0, count-1, p[6]);
4137 def p_enum_name_6(p
):
4138 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '=' expression '''
4140 print('enum_name_6', list(p
))
4142 # { perm_string name = lex_strings.make(p[1]);
4143 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
4144 # check_enum_seq_value(@1, p[5], true), p[8]);
4152 def p_struct_data_type_1(p
):
4153 '''struct_data_type : K_struct K_packed_opt '{' struct_union_member_list '}' '''
4155 print('struct_data_type_1', list(p
))
4157 # { struct_type_t*tmp = new struct_type_t;
4158 # FILE_NAME(tmp, @1);
4159 # tmp->packed_flag = p[2];
4160 # tmp->union_flag = false;
4161 # tmp->members .reset(p[4]);
4167 def p_struct_data_type_2(p
):
4168 '''struct_data_type : K_union K_packed_opt '{' struct_union_member_list '}' '''
4170 print('struct_data_type_2', list(p
))
4172 # { struct_type_t*tmp = new struct_type_t;
4173 # FILE_NAME(tmp, @1);
4174 # tmp->packed_flag = p[2];
4175 # tmp->union_flag = true;
4176 # tmp->members .reset(p[4]);
4182 def p_struct_data_type_3(p
):
4183 '''struct_data_type : K_struct K_packed_opt '{' error '}' '''
4185 print('struct_data_type_3', list(p
))
4187 # { yyerror(@3, "error: Errors in struct member list.");
4189 # struct_type_t*tmp = new struct_type_t;
4190 # FILE_NAME(tmp, @1);
4191 # tmp->packed_flag = p[2];
4192 # tmp->union_flag = false;
4198 def p_struct_data_type_4(p
):
4199 '''struct_data_type : K_union K_packed_opt '{' error '}' '''
4201 print('struct_data_type_4', list(p
))
4203 # { yyerror(@3, "error: Errors in union member list.");
4205 # struct_type_t*tmp = new struct_type_t;
4206 # FILE_NAME(tmp, @1);
4207 # tmp->packed_flag = p[2];
4208 # tmp->union_flag = true;
4214 def p_struct_union_member_list_1(p
):
4215 '''struct_union_member_list : struct_union_member_list struct_union_member '''
4217 print('struct_union_member_list_1', list(p
))
4219 # { list<struct_member_t*>*tmp = p[1];
4220 # tmp->push_back(p[2]);
4226 def p_struct_union_member_list_2(p
):
4227 '''struct_union_member_list : struct_union_member '''
4229 print('struct_union_member_list_2', list(p
))
4231 # { list<struct_member_t*>*tmp = new list<struct_member_t*>;
4232 # tmp->push_back(p[1]);
4238 def p_struct_union_member_1(p
):
4239 '''struct_union_member : attribute_list_opt data_type list_of_variable_decl_assignments ';' '''
4241 print('struct_union_member_1', list(p
))
4243 # { struct_member_t*tmp = new struct_member_t;
4244 # FILE_NAME(tmp, @2);
4245 # tmp->type .reset(p[2]);
4246 # tmp->names .reset(p[3]);
4252 def p_struct_union_member_2(p
):
4253 '''struct_union_member : error ';' '''
4255 print('struct_union_member_2', list(p
))
4257 # { yyerror(@2, "Error in struct/union member.");
4264 def p_case_item_1(p
):
4265 '''case_item : expression_list_proper ':' statement_or_null '''
4267 print('case_item_1', list(p
))
4269 # { PCase::Item*tmp = new PCase::Item;
4270 # tmp->expr = *p[1];
4278 def p_case_item_2(p
):
4279 '''case_item : K_default ':' statement_or_null '''
4281 print('case_item_2', list(p
))
4283 # { PCase::Item*tmp = new PCase::Item;
4290 def p_case_item_3(p
):
4291 '''case_item : K_default statement_or_null '''
4293 print('case_item_3', list(p
))
4295 # { PCase::Item*tmp = new PCase::Item;
4302 def p_case_item_4(p
):
4303 '''case_item : error ':' statement_or_null '''
4305 print('case_item_4', list(p
))
4307 # { yyerror(@2, "error: Incomprehensible case expression.");
4313 def p_case_items_1(p
):
4314 '''case_items : case_items case_item '''
4316 print('case_items_1', list(p
))
4318 # { svector<PCase::Item*>*tmp;
4319 # tmp = new svector<PCase::Item*>(*p[1], p[2]);
4326 def p_case_items_2(p
):
4327 '''case_items : case_item '''
4329 print('case_items_2', list(p
))
4331 # { svector<PCase::Item*>*tmp = new svector<PCase::Item*>(1);
4338 def p_charge_strength_1(p
):
4339 '''charge_strength : '(' K_small ')' '''
4341 print('charge_strength_1', list(p
))
4347 def p_charge_strength_2(p
):
4348 '''charge_strength : '(' K_medium ')' '''
4350 print('charge_strength_2', list(p
))
4356 def p_charge_strength_3(p
):
4357 '''charge_strength : '(' K_large ')' '''
4359 print('charge_strength_3', list(p
))
4365 def p_charge_strength_opt_1(p
):
4366 '''charge_strength_opt : charge_strength '''
4368 print('charge_strength_opt_1', list(p
))
4374 def p_charge_strength_opt_2(p
):
4375 '''charge_strength_opt : '''
4377 print('charge_strength_opt_2', list(p
))
4383 def p_defparam_assign_1(p
):
4384 '''defparam_assign : hierarchy_identifier '=' expression '''
4386 print('defparam_assign_1', list(p
))
4388 # { pform_set_defparam(*p[1], p[3]);
4394 def p_defparam_assign_list_1(p
):
4395 '''defparam_assign_list : defparam_assign '''
4397 print('defparam_assign_list_1', list(p
))
4403 def p_defparam_assign_list_2(p
):
4404 '''defparam_assign_list : dimensions defparam_assign '''
4406 print('defparam_assign_list_2', list(p
))
4408 # { yyerror(@1, "error: defparam may not include a range.");
4414 def p_defparam_assign_list_3(p
):
4415 '''defparam_assign_list : defparam_assign_list ',' defparam_assign '''
4417 print('defparam_assign_list_3', list(p
))
4424 '''delay1 : '#' delay_value_simple '''
4426 print('delay1_1', list(p
))
4428 # { list<PExpr*>*tmp = new list<PExpr*>;
4429 # tmp->push_back(p[2]);
4436 '''delay1 : '#' '(' delay_value ')' '''
4438 print('delay1_2', list(p
))
4440 # { list<PExpr*>*tmp = new list<PExpr*>;
4441 # tmp->push_back(p[3]);
4448 '''delay3 : '#' delay_value_simple '''
4450 print('delay3_1', list(p
))
4452 # { list<PExpr*>*tmp = new list<PExpr*>;
4453 # tmp->push_back(p[2]);
4460 '''delay3 : '#' '(' delay_value ')' '''
4462 print('delay3_2', list(p
))
4464 # { list<PExpr*>*tmp = new list<PExpr*>;
4465 # tmp->push_back(p[3]);
4472 '''delay3 : '#' '(' delay_value ',' delay_value ')' '''
4474 print('delay3_3', list(p
))
4476 # { list<PExpr*>*tmp = new list<PExpr*>;
4477 # tmp->push_back(p[3]);
4478 # tmp->push_back(p[5]);
4485 '''delay3 : '#' '(' delay_value ',' delay_value ',' delay_value ')' '''
4487 print('delay3_4', list(p
))
4489 # { list<PExpr*>*tmp = new list<PExpr*>;
4490 # tmp->push_back(p[3]);
4491 # tmp->push_back(p[5]);
4492 # tmp->push_back(p[7]);
4498 def p_delay3_opt_1(p
):
4499 '''delay3_opt : delay3 '''
4501 print('delay3_opt_1', list(p
))
4508 def p_delay3_opt_2(p
):
4510 if(parse_debug
> 2):
4511 print('delay3_opt_2', list(p
))
4517 def p_delay_value_list_1(p
):
4518 '''delay_value_list : delay_value '''
4520 print('delay_value_list_1', list(p
))
4522 # { list<PExpr*>*tmp = new list<PExpr*>;
4523 # tmp->push_back(p[1]);
4529 def p_delay_value_list_2(p
):
4530 '''delay_value_list : delay_value_list ',' delay_value '''
4532 print('delay_value_list_2', list(p
))
4534 # { list<PExpr*>*tmp = p[1];
4535 # tmp->push_back(p[3]);
4541 def p_delay_value_1(p
):
4542 '''delay_value : expression '''
4544 print('delay_value_1', list(p
))
4546 # { PExpr*tmp = p[1];
4552 def p_delay_value_2(p
):
4553 '''delay_value : expression ':' expression ':' expression '''
4555 print('delay_value_2', list(p
))
4557 # { p[0] = pform_select_mtm_expr(p[1], p[3], p[5]); }
4561 def p_delay_value_simple_1(p
):
4562 '''delay_value_simple : DEC_NUMBER '''
4564 print('delay_value_simple_1', list(p
))
4566 # { verinum*tmp = p[1];
4568 # yyerror(@1, "internal error: delay.");
4571 # p[0] = new PENumber(tmp);
4572 # FILE_NAME(p[0], @1);
4579 def p_delay_value_simple_2(p
):
4580 '''delay_value_simple : REALTIME '''
4582 print('delay_value_simple_2', list(p
))
4584 # { verireal*tmp = p[1];
4586 # yyerror(@1, "internal error: delay.");
4589 # p[0] = new PEFNumber(tmp);
4590 # FILE_NAME(p[0], @1);
4596 def p_delay_value_simple_3(p
):
4597 '''delay_value_simple : IDENTIFIER '''
4599 print('delay_value_simple_3', list(p
))
4601 # { PEIdent*tmp = new PEIdent(lex_strings.make(p[1]));
4602 # FILE_NAME(tmp, @1);
4609 def p_delay_value_simple_4(p
):
4610 '''delay_value_simple : TIME_LITERAL '''
4612 print('delay_value_simple_4', list(p
))
4618 # if (p[1] == 0 || !get_time_unit(p[1], unit))
4619 # yyerror(@1, "internal error: delay.");
4621 # double p = pow(10.0,
4622 # (double)(unit - pform_get_timeunit()));
4623 # double time = atof(p[1]) * p;
4625 # verireal *v = new verireal(time);
4626 # p[0] = new PEFNumber(v);
4627 # FILE_NAME(p[0], @1);
4633 def p_optional_semicolon_1(p
):
4634 '''optional_semicolon : ';' '''
4636 print('optional_semicolon_1', list(p
))
4642 def p_optional_semicolon_2(p
):
4643 '''optional_semicolon : '''
4645 print('optional_semicolon_2', list(p
))
4651 def p_discipline_declaration_1(p
):
4652 '''discipline_declaration : K_discipline IDENTIFIER optional_semicolon _embed0_discipline_declaration discipline_items K_enddiscipline '''
4654 print('discipline_declaration_1', list(p
))
4656 # { pform_end_discipline(@1); delete[] p[2]; }
4660 def p__embed0_discipline_declaration(p
):
4661 '''_embed0_discipline_declaration : '''
4663 # { pform_start_discipline(p[2]); }
4667 def p_discipline_items_1(p
):
4668 '''discipline_items : discipline_items discipline_item '''
4670 print('discipline_items_1', list(p
))
4676 def p_discipline_items_2(p
):
4677 '''discipline_items : discipline_item '''
4679 print('discipline_items_2', list(p
))
4685 def p_discipline_item_1(p
):
4686 '''discipline_item : K_domain K_discrete ';' '''
4688 print('discipline_item_1', list(p
))
4690 # { pform_discipline_domain(@1, IVL_DIS_DISCRETE); }
4694 def p_discipline_item_2(p
):
4695 '''discipline_item : K_domain K_continuous ';' '''
4697 print('discipline_item_2', list(p
))
4699 # { pform_discipline_domain(@1, IVL_DIS_CONTINUOUS); }
4703 def p_discipline_item_3(p
):
4704 '''discipline_item : K_potential IDENTIFIER ';' '''
4706 print('discipline_item_3', list(p
))
4708 # { pform_discipline_potential(@1, p[2]); delete[] p[2]; }
4712 def p_discipline_item_4(p
):
4713 '''discipline_item : K_flow IDENTIFIER ';' '''
4715 print('discipline_item_4', list(p
))
4717 # { pform_discipline_flow(@1, p[2]); delete[] p[2]; }
4721 def p_nature_declaration_1(p
):
4722 '''nature_declaration : K_nature IDENTIFIER optional_semicolon _embed0_nature_declaration nature_items K_endnature '''
4724 print('nature_declaration_1', list(p
))
4726 # { pform_end_nature(@1); delete[] p[2]; }
4730 def p__embed0_nature_declaration(p
):
4731 '''_embed0_nature_declaration : '''
4733 # { pform_start_nature(p[2]); }
4737 def p_nature_items_1(p
):
4738 '''nature_items : nature_items nature_item '''
4740 print('nature_items_1', list(p
))
4746 def p_nature_items_2(p
):
4747 '''nature_items : nature_item '''
4749 print('nature_items_2', list(p
))
4755 def p_nature_item_1(p
):
4756 '''nature_item : K_units '=' STRING ';' '''
4758 print('nature_item_1', list(p
))
4760 # { delete[] p[3]; }
4764 def p_nature_item_2(p
):
4765 '''nature_item : K_abstol '=' expression ';' '''
4767 print('nature_item_2', list(p
))
4773 def p_nature_item_3(p
):
4774 '''nature_item : K_access '=' IDENTIFIER ';' '''
4776 print('nature_item_3', list(p
))
4778 # { pform_nature_access(@1, p[3]); delete[] p[3]; }
4782 def p_nature_item_4(p
):
4783 '''nature_item : K_idt_nature '=' IDENTIFIER ';' '''
4785 print('nature_item_4', list(p
))
4787 # { delete[] p[3]; }
4791 def p_nature_item_5(p
):
4792 '''nature_item : K_ddt_nature '=' IDENTIFIER ';' '''
4794 print('nature_item_5', list(p
))
4796 # { delete[] p[3]; }
4800 def p_config_declaration_1(p
):
4801 '''config_declaration : K_config IDENTIFIER ';' K_design lib_cell_identifiers ';' list_of_config_rule_statements K_endconfig '''
4803 print('config_declaration_1', list(p
))
4805 # { cerr << @1 << ": sorry: config declarations are not supported and "
4806 # "will be skipped." << endl;
4812 def p_lib_cell_identifiers_1(p
):
4813 '''lib_cell_identifiers : '''
4815 print('lib_cell_identifiers_1', list(p
))
4821 def p_lib_cell_identifiers_2(p
):
4822 '''lib_cell_identifiers : lib_cell_identifiers lib_cell_id '''
4824 print('lib_cell_identifiers_2', list(p
))
4830 def p_list_of_config_rule_statements_1(p
):
4831 '''list_of_config_rule_statements : '''
4833 print('list_of_config_rule_statements_1', list(p
))
4839 def p_list_of_config_rule_statements_2(p
):
4840 '''list_of_config_rule_statements : list_of_config_rule_statements config_rule_statement '''
4842 print('list_of_config_rule_statements_2', list(p
))
4848 def p_config_rule_statement_1(p
):
4849 '''config_rule_statement : K_default K_liblist list_of_libraries ';' '''
4851 print('config_rule_statement_1', list(p
))
4857 def p_config_rule_statement_2(p
):
4858 '''config_rule_statement : K_instance hierarchy_identifier K_liblist list_of_libraries ';' '''
4860 print('config_rule_statement_2', list(p
))
4866 def p_config_rule_statement_3(p
):
4867 '''config_rule_statement : K_instance hierarchy_identifier K_use lib_cell_id opt_config ';' '''
4869 print('config_rule_statement_3', list(p
))
4875 def p_config_rule_statement_4(p
):
4876 '''config_rule_statement : K_cell lib_cell_id K_liblist list_of_libraries ';' '''
4878 print('config_rule_statement_4', list(p
))
4884 def p_config_rule_statement_5(p
):
4885 '''config_rule_statement : K_cell lib_cell_id K_use lib_cell_id opt_config ';' '''
4887 print('config_rule_statement_5', list(p
))
4893 def p_opt_config_1(p
):
4896 print('opt_config_1', list(p
))
4902 def p_opt_config_2(p
):
4903 '''opt_config : ':' K_config '''
4905 print('opt_config_2', list(p
))
4911 def p_lib_cell_id_1(p
):
4912 '''lib_cell_id : IDENTIFIER '''
4914 print('lib_cell_id_1', list(p
))
4916 # { delete[] p[1]; }
4920 def p_lib_cell_id_2(p
):
4921 '''lib_cell_id : IDENTIFIER '.' IDENTIFIER '''
4923 print('lib_cell_id_2', list(p
))
4925 # { delete[] p[1]; delete[] p[3]; }
4929 def p_list_of_libraries_1(p
):
4930 '''list_of_libraries : '''
4932 print('list_of_libraries_1', list(p
))
4938 def p_list_of_libraries_2(p
):
4939 '''list_of_libraries : list_of_libraries IDENTIFIER '''
4941 print('list_of_libraries_2', list(p
))
4943 # { delete[] p[2]; }
4947 def p_drive_strength_1(p
):
4948 '''drive_strength : '(' dr_strength0 ',' dr_strength1 ')' '''
4950 print('drive_strength_1', list(p
))
4952 # { p[0].str0 = p[2].str0;
4953 # p[0].str1 = p[4].str1;
4958 def p_drive_strength_2(p
):
4959 '''drive_strength : '(' dr_strength1 ',' dr_strength0 ')' '''
4961 print('drive_strength_2', list(p
))
4963 # { p[0].str0 = p[4].str0;
4964 # p[0].str1 = p[2].str1;
4969 def p_drive_strength_3(p
):
4970 '''drive_strength : '(' dr_strength0 ',' K_highz1 ')' '''
4972 print('drive_strength_3', list(p
))
4974 # { p[0].str0 = p[2].str0;
4975 # p[0].str1 = IVL_DR_HiZ;
4980 def p_drive_strength_4(p
):
4981 '''drive_strength : '(' dr_strength1 ',' K_highz0 ')' '''
4983 print('drive_strength_4', list(p
))
4985 # { p[0].str0 = IVL_DR_HiZ;
4986 # p[0].str1 = p[2].str1;
4991 def p_drive_strength_5(p
):
4992 '''drive_strength : '(' K_highz1 ',' dr_strength0 ')' '''
4994 print('drive_strength_5', list(p
))
4996 # { p[0].str0 = p[4].str0;
4997 # p[0].str1 = IVL_DR_HiZ;
5002 def p_drive_strength_6(p
):
5003 '''drive_strength : '(' K_highz0 ',' dr_strength1 ')' '''
5005 print('drive_strength_6', list(p
))
5007 # { p[0].str0 = IVL_DR_HiZ;
5008 # p[0].str1 = p[4].str1;
5013 def p_drive_strength_opt_1(p
):
5014 '''drive_strength_opt : drive_strength '''
5016 print('drive_strength_opt_1', list(p
))
5023 def p_drive_strength_opt_2(p
):
5024 '''drive_strength_opt : '''
5025 if(parse_debug
> 2):
5026 print('drive_strength_opt_2', list(p
))
5028 # { p[0].str0 = IVL_DR_STRONG; p[0].str1 = IVL_DR_STRONG; }
5032 def p_dr_strength0_1(p
):
5033 '''dr_strength0 : K_supply0 '''
5035 print('dr_strength0_1', list(p
))
5037 # { p[0].str0 = IVL_DR_SUPPLY; }
5041 def p_dr_strength0_2(p
):
5042 '''dr_strength0 : K_strong0 '''
5044 print('dr_strength0_2', list(p
))
5046 # { p[0].str0 = IVL_DR_STRONG; }
5050 def p_dr_strength0_3(p
):
5051 '''dr_strength0 : K_pull0 '''
5053 print('dr_strength0_3', list(p
))
5055 # { p[0].str0 = IVL_DR_PULL; }
5059 def p_dr_strength0_4(p
):
5060 '''dr_strength0 : K_weak0 '''
5062 print('dr_strength0_4', list(p
))
5064 # { p[0].str0 = IVL_DR_WEAK; }
5068 def p_dr_strength1_1(p
):
5069 '''dr_strength1 : K_supply1 '''
5071 print('dr_strength1_1', list(p
))
5073 # { p[0].str1 = IVL_DR_SUPPLY; }
5077 def p_dr_strength1_2(p
):
5078 '''dr_strength1 : K_strong1 '''
5080 print('dr_strength1_2', list(p
))
5082 # { p[0].str1 = IVL_DR_STRONG; }
5086 def p_dr_strength1_3(p
):
5087 '''dr_strength1 : K_pull1 '''
5089 print('dr_strength1_3', list(p
))
5091 # { p[0].str1 = IVL_DR_PULL; }
5095 def p_dr_strength1_4(p
):
5096 '''dr_strength1 : K_weak1 '''
5098 print('dr_strength1_4', list(p
))
5100 # { p[0].str1 = IVL_DR_WEAK; }
5104 def p_clocking_event_opt_1(p
):
5105 '''clocking_event_opt : event_control '''
5107 print('clocking_event_opt_1', list(p
))
5113 def p_clocking_event_opt_2(p
):
5114 '''clocking_event_opt : '''
5116 print('clocking_event_opt_2', list(p
))
5122 def p_event_control_1(p
):
5123 '''event_control : '@' hierarchy_identifier '''
5125 print('event_control_1', list(p
))
5127 # { PEIdent*tmpi = new PEIdent(*p[2]);
5128 # PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi);
5129 # PEventStatement*tmps = new PEventStatement(tmpe);
5130 # FILE_NAME(tmps, @1);
5137 def p_event_control_2(p
):
5138 '''event_control : '@' '(' event_expression_list ')' '''
5140 print('event_control_2', list(p
))
5142 # { PEventStatement*tmp = new PEventStatement(*p[3]);
5143 # FILE_NAME(tmp, @1);
5150 def p_event_control_3(p
):
5151 '''event_control : '@' '(' error ')' '''
5153 print('event_control_3', list(p
))
5155 # { yyerror(@1, "error: Malformed event control expression.");
5161 def p_event_expression_list_1(p
):
5162 '''event_expression_list : event_expression '''
5164 print('event_expression_list_1', list(p
))
5171 def p_event_expression_list_2(p
):
5172 '''event_expression_list : event_expression_list K_or event_expression '''
5174 print('event_expression_list_2', list(p
))
5176 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
5184 def p_event_expression_list_3(p
):
5185 '''event_expression_list : event_expression_list ',' event_expression '''
5187 print('event_expression_list_3', list(p
))
5189 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
5197 def p_event_expression_1(p
):
5198 '''event_expression : K_posedge expression '''
5200 print('event_expression_1', list(p
))
5202 # { PEEvent*tmp = new PEEvent(PEEvent::POSEDGE, p[2]);
5203 # FILE_NAME(tmp, @1);
5204 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5211 def p_event_expression_2(p
):
5212 '''event_expression : K_negedge expression '''
5214 print('event_expression_2', list(p
))
5216 # { PEEvent*tmp = new PEEvent(PEEvent::NEGEDGE, p[2]);
5217 # FILE_NAME(tmp, @1);
5218 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5225 def p_event_expression_3(p
):
5226 '''event_expression : expression '''
5228 print('event_expression_3', list(p
))
5230 # { PEEvent*tmp = new PEEvent(PEEvent::ANYEDGE, p[1]);
5231 # FILE_NAME(tmp, @1);
5232 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5239 def p_branch_probe_expression_1(p
):
5240 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ',' IDENTIFIER ')' '''
5242 print('branch_probe_expression_1', list(p
))
5244 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3], p[5]); }
5248 def p_branch_probe_expression_2(p
):
5249 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ')' '''
5251 print('branch_probe_expression_2', list(p
))
5253 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3]); }
5257 def p_expression_1(p
):
5258 '''expression : expr_primary_or_typename '''
5259 if(parse_debug
> 2):
5260 print('expression_1', list(p
))
5267 def p_expression_2(p
):
5268 '''expression : inc_or_dec_expression '''
5270 print('expression_2', list(p
))
5277 def p_expression_3(p
):
5278 '''expression : inside_expression '''
5280 print('expression_3', list(p
))
5287 def p_expression_4(p
):
5288 '''expression : '+' attribute_list_opt expr_primary %prec UNARY_PREC '''
5290 print('expression_4', list(p
))
5297 def PEUnary(op
, o1
):
5298 #Leaf(token.STRING, ' ')
5300 return Node(syms
.atom
, [op
, o1
])
5302 return "error in PEUnary: "+str(op
)+","+str(o1
)
5305 def PEBinary(op
, o1
, o2
):
5307 return Node(syms
.atom
, [o1
, Leaf(token
.STRING
, ' '), op
, Leaf(token
.STRING
, ' '), o2
])
5309 return "error in PEBinary: "+str(op
)+","+str(o1
)+","+str(o2
)
5314 def p_expression_5(p
):
5315 '''expression : '-' attribute_list_opt expr_primary %prec UNARY_PREC '''
5317 print('expression_5', list(p
))
5319 p
[0] = PEUnary(Leaf(token
.MINUS
, '-'), p
[3])
5321 # { PEUnary*tmp = new PEUnary('-', p[3]);
5322 # FILE_NAME(tmp, @3);
5328 def p_expression_6(p
):
5329 '''expression : '~' attribute_list_opt expr_primary %prec UNARY_PREC '''
5331 print('expression_6', list(p
))
5333 p
[0] = PEUnary(Leaf(token
.TILDE
, '~'), p
[3])
5335 # { PEUnary*tmp = new PEUnary('~', p[3]);
5336 # FILE_NAME(tmp, @3);
5342 def p_expression_7(p
):
5343 '''expression : '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
5345 print('expression_7', list(p
))
5347 p
[0] = PEUnary(Leaf(token
.AMPER
, '&'), p
[3])
5349 # { PEUnary*tmp = new PEUnary('&', p[3]);
5350 # FILE_NAME(tmp, @3);
5356 def p_expression_8(p
):
5357 '''expression : '!' attribute_list_opt expr_primary %prec UNARY_PREC '''
5359 print('expression_8', list(p
))
5361 p
[0] = PEUnary(Leaf(token
.STRING
, '!'), p
[3])
5363 # { PEUnary*tmp = new PEUnary('!', p[3]);
5364 # FILE_NAME(tmp, @3);
5370 def p_expression_9(p
):
5371 '''expression : '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
5373 print('expression_9', list(p
))
5375 p
[0] = PEUnary(Leaf(token
.STRING
, '|'), p
[3])
5377 # { PEUnary*tmp = new PEUnary('|', p[3]);
5378 # FILE_NAME(tmp, @3);
5384 def p_expression_10(p
):
5385 '''expression : '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
5387 print('expression_10', list(p
))
5389 p
[0] = PEUnary(Leaf(token
.STRING
, '^'), p
[3])
5391 # { PEUnary*tmp = new PEUnary('^', p[3]);
5392 # FILE_NAME(tmp, @3);
5398 def p_expression_11(p
):
5399 '''expression : '~' '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
5401 print('expression_11', list(p
))
5403 # { yyerror(@1, "error: '~' '&' is not a valid expression. "
5404 # "Please use operator '~&' instead.");
5410 def p_expression_12(p
):
5411 '''expression : '~' '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
5413 print('expression_12', list(p
))
5415 # { yyerror(@1, "error: '~' '|' is not a valid expression. "
5416 # "Please use operator '~|' instead.");
5422 def p_expression_13(p
):
5423 '''expression : '~' '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
5425 print('expression_13', list(p
))
5427 # { yyerror(@1, "error: '~' '^' is not a valid expression. "
5428 # "Please use operator '~^' instead.");
5434 def p_expression_14(p
):
5435 '''expression : K_NAND attribute_list_opt expr_primary %prec UNARY_PREC '''
5437 print('expression_14', list(p
))
5439 p
[0] = PEUnary(Leaf(token
.STRING
, 'K_NAND'), p
[3])
5441 # { PEUnary*tmp = new PEUnary('A', p[3]);
5442 # FILE_NAME(tmp, @3);
5448 def p_expression_15(p
):
5449 '''expression : K_NOR attribute_list_opt expr_primary %prec UNARY_PREC '''
5451 print('expression_15', list(p
))
5453 p
[0] = PEUnary(Leaf(token
.STRING
, 'K_NOR'), p
[3])
5455 # { PEUnary*tmp = new PEUnary('N', p[3]);
5456 # FILE_NAME(tmp, @3);
5462 def p_expression_16(p
):
5463 '''expression : K_NXOR attribute_list_opt expr_primary %prec UNARY_PREC '''
5465 print('expression_16', list(p
))
5467 p
[0] = PEUnary(Leaf(token
.STRING
, 'K_NXOR'), p
[3])
5469 # { PEUnary*tmp = new PEUnary('X', p[3]);
5470 # FILE_NAME(tmp, @3);
5476 def p_expression_17(p
):
5477 '''expression : '!' error %prec UNARY_PREC '''
5479 print('expression_17', list(p
))
5481 # { yyerror(@1, "error: Operand of unary ! "
5482 # "is not a primary expression.");
5488 def p_expression_18(p
):
5489 '''expression : '^' error %prec UNARY_PREC '''
5491 print('expression_18', list(p
))
5493 # { yyerror(@1, "error: Operand of reduction ^ "
5494 # "is not a primary expression.");
5500 def p_expression_19(p
):
5501 '''expression : expression '^' attribute_list_opt expression '''
5503 print('expression_19', list(p
))
5505 p
[0] = PEBinary(Leaf(token
.STRING
, '^'), p
[1], p
[4])
5507 # { PEBinary*tmp = new PEBinary('^', p[1], p[4]);
5508 # FILE_NAME(tmp, @2);
5514 def p_expression_20(p
):
5515 '''expression : expression K_POW attribute_list_opt expression '''
5517 print('expression_20', list(p
))
5519 p
[0] = PEBinary(Leaf(token
.STRING
, '**'), p
[1], p
[4])
5521 # { PEBinary*tmp = new PEBPower('p', p[1], p[4]);
5522 # FILE_NAME(tmp, @2);
5528 def p_expression_21(p
):
5529 '''expression : expression '*' attribute_list_opt expression '''
5531 print('expression_21', list(p
))
5533 p
[0] = PEBinary(Leaf(token
.STRING
, '*'), p
[1], p
[4])
5535 # { PEBinary*tmp = new PEBinary('*', p[1], p[4]);
5536 # FILE_NAME(tmp, @2);
5542 def p_expression_22(p
):
5543 '''expression : expression '/' attribute_list_opt expression '''
5545 print('expression_22', list(p
))
5547 p
[0] = PEBinary(Leaf(token
.STRING
, '/'), p
[1], p
[4])
5549 # { PEBinary*tmp = new PEBinary('/', p[1], p[4]);
5550 # FILE_NAME(tmp, @2);
5556 def p_expression_23(p
):
5557 '''expression : expression '%' attribute_list_opt expression '''
5559 print('expression_23', list(p
))
5561 p
[0] = PEBinary(Leaf(token
.STRING
, '%'), p
[1], p
[4])
5563 # { PEBinary*tmp = new PEBinary('%', p[1], p[4]);
5564 # FILE_NAME(tmp, @2);
5570 def p_expression_24(p
):
5571 '''expression : expression '+' attribute_list_opt expression '''
5573 print('expression_24', list(p
))
5575 # { PEBinary*tmp = new PEBinary('+', p[1], p[4]);
5576 # FILE_NAME(tmp, @2);
5579 p
[0] = PEBinary(Leaf(token
.PLUS
, '+'), p
[1], p
[4])
5585 def p_expression_25(p
):
5586 '''expression : expression '-' attribute_list_opt expression '''
5587 if(parse_debug
> 2):
5588 print('expression_25', list(p
))
5589 # { PEBinary*tmp = new PEBinary('-', p[1], p[4]);
5590 # FILE_NAME(tmp, @2);
5593 p
[0] = PEBinary(Leaf(token
.MINUS
, '-'), p
[1], p
[4])
5599 def p_expression_26(p
):
5600 '''expression : expression '&' attribute_list_opt expression '''
5601 if(parse_debug
> 2):
5602 print('expression_26', list(p
))
5604 p
[0] = PEBinary(Leaf(token
.AMPER
, '&'), p
[1], p
[4])
5606 # { PEBinary*tmp = new PEBinary('&', p[1], p[4]);
5607 # FILE_NAME(tmp, @2);
5613 def p_expression_27(p
):
5614 '''expression : expression '|' attribute_list_opt expression '''
5615 if(parse_debug
> 2):
5616 print('expression_27', list(p
))
5618 p
[0] = PEBinary(Leaf(token
.VBAR
, '|'), p
[1], p
[4])
5621 # { PEBinary*tmp = new PEBinary('|', p[1], p[4]);
5622 # FILE_NAME(tmp, @2);
5628 def p_expression_28(p
):
5629 '''expression : expression K_NAND attribute_list_opt expression '''
5631 print('expression_28', list(p
))
5633 p
[0] = PEBinary(Leaf(token
.STRING
, '~&'), p
[1], p
[4])
5635 # { PEBinary*tmp = new PEBinary('A', p[1], p[4]);
5636 # FILE_NAME(tmp, @2);
5642 def p_expression_29(p
):
5643 '''expression : expression K_NOR attribute_list_opt expression '''
5645 print('expression_29', list(p
))
5647 p
[0] = PEBinary(Leaf(token
.STRING
, '~|'), p
[1], p
[4])
5649 # { PEBinary*tmp = new PEBinary('O', p[1], p[4]);
5650 # FILE_NAME(tmp, @2);
5656 def p_expression_30(p
):
5657 '''expression : expression K_NXOR attribute_list_opt expression '''
5659 print('expression_30', list(p
))
5661 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_XNOR'), p
[1], p
[4])
5663 # { PEBinary*tmp = new PEBinary('X', p[1], p[4]);
5664 # FILE_NAME(tmp, @2);
5670 def p_expression_31(p
):
5671 '''expression : expression '<' attribute_list_opt expression '''
5673 print('expression_31', list(p
))
5675 p
[0] = PEBinary(Leaf(token
.STRING
, '<'), p
[1], p
[4])
5677 # { PEBinary*tmp = new PEBComp('<', p[1], p[4]);
5678 # FILE_NAME(tmp, @2);
5684 def p_expression_32(p
):
5685 '''expression : expression '>' attribute_list_opt expression '''
5687 print('expression_32', list(p
))
5689 p
[0] = PEBinary(Leaf(token
.STRING
, '>'), p
[1], p
[4])
5691 # { PEBinary*tmp = new PEBComp('>', p[1], p[4]);
5692 # FILE_NAME(tmp, @2);
5698 def p_expression_33(p
):
5699 '''expression : expression K_LS attribute_list_opt expression '''
5701 print('expression_33', list(p
))
5703 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_LS'), p
[1], p
[4])
5705 # { PEBinary*tmp = new PEBShift('l', p[1], p[4]);
5706 # FILE_NAME(tmp, @2);
5712 def p_expression_34(p
):
5713 '''expression : expression K_RS attribute_list_opt expression '''
5715 print('expression_34', list(p
))
5717 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_RS'), p
[1], p
[4])
5719 # { PEBinary*tmp = new PEBShift('r', p[1], p[4]);
5720 # FILE_NAME(tmp, @2);
5726 def p_expression_35(p
):
5727 '''expression : expression K_RSS attribute_list_opt expression '''
5729 print('expression_35', list(p
))
5731 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_RSS'), p
[1], p
[4])
5733 # { PEBinary*tmp = new PEBShift('R', p[1], p[4]);
5734 # FILE_NAME(tmp, @2);
5740 def p_expression_36(p
):
5741 '''expression : expression K_EQ attribute_list_opt expression '''
5743 print('expression_36', list(p
))
5745 p
[0] = PEBinary(Leaf(token
.STRING
, '=='), p
[1], p
[4])
5747 # { PEBinary*tmp = new PEBComp('e', p[1], p[4]);
5748 # FILE_NAME(tmp, @2);
5754 def p_expression_37(p
):
5755 '''expression : expression K_CEQ attribute_list_opt expression '''
5757 print('expression_37', list(p
))
5759 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_CEQ'), p
[1], p
[4])
5761 # { PEBinary*tmp = new PEBComp('E', p[1], p[4]);
5762 # FILE_NAME(tmp, @2);
5768 def p_expression_38(p
):
5769 '''expression : expression K_WEQ attribute_list_opt expression '''
5771 print('expression_38', list(p
))
5773 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_WEQ'), p
[1], p
[4])
5775 # { PEBinary*tmp = new PEBComp('w', p[1], p[4]);
5776 # FILE_NAME(tmp, @2);
5782 def p_expression_39(p
):
5783 '''expression : expression K_LE attribute_list_opt expression '''
5785 print('expression_39', list(p
))
5787 p
[0] = PEBinary(Leaf(token
.STRING
, '<='), p
[1], p
[4])
5789 # { PEBinary*tmp = new PEBComp('L', p[1], p[4]);
5790 # FILE_NAME(tmp, @2);
5796 def p_expression_40(p
):
5797 '''expression : expression K_GE attribute_list_opt expression '''
5799 print('expression_40', list(p
))
5801 p
[0] = PEBinary(Leaf(token
.STRING
, '>='), p
[1], p
[4])
5803 # { PEBinary*tmp = new PEBComp('G', p[1], p[4]);
5804 # FILE_NAME(tmp, @2);
5810 def p_expression_41(p
):
5811 '''expression : expression K_NE attribute_list_opt expression '''
5813 print('expression_41', list(p
))
5815 p
[0] = PEBinary(Leaf(token
.STRING
, '!='), p
[1], p
[4])
5817 # { PEBinary*tmp = new PEBComp('n', p[1], p[4]);
5818 # FILE_NAME(tmp, @2);
5824 def p_expression_42(p
):
5825 '''expression : expression K_CNE attribute_list_opt expression '''
5827 print('expression_42', list(p
))
5829 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_CNE'), p
[1], p
[4])
5831 # { PEBinary*tmp = new PEBComp('N', p[1], p[4]);
5832 # FILE_NAME(tmp, @2);
5838 def p_expression_43(p
):
5839 '''expression : expression K_WNE attribute_list_opt expression '''
5841 print('expression_43', list(p
))
5843 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_WNE'), p
[1], p
[4])
5845 # { PEBinary*tmp = new PEBComp('W', p[1], p[4]);
5846 # FILE_NAME(tmp, @2);
5852 def p_expression_44(p
):
5853 '''expression : expression K_LOR attribute_list_opt expression '''
5855 print('expression_44', list(p
))
5857 p
[0] = PEBinary(Leaf(token
.STRING
, '||'), p
[1], p
[4])
5859 # { PEBinary*tmp = new PEBLogic('o', p[1], p[4]);
5860 # FILE_NAME(tmp, @2);
5866 def p_expression_45(p
):
5867 '''expression : expression K_LAND attribute_list_opt expression '''
5869 print('expression_45', list(p
))
5871 p
[0] = PEBinary(Leaf(token
.STRING
, '&&'), p
[1], p
[4])
5873 # { PEBinary*tmp = new PEBLogic('a', p[1], p[4]);
5874 # FILE_NAME(tmp, @2);
5880 def p_expression_46(p
):
5881 '''expression : expression '?' attribute_list_opt expression ':' expression '''
5883 print('expression_46', list(p
))
5885 p
[0] = Node(syms
.atom
, [p
[1], Leaf(token
.STRING
, ' ? '),
5886 p
[4], Leaf(token
.STRING
, ' : '), p
[6]])
5888 # { PETernary*tmp = new PETernary(p[1], p[4], p[6]);
5889 # FILE_NAME(tmp, @2);
5895 def p_expr_mintypmax_1(p
):
5896 '''expr_mintypmax : expression '''
5898 print('expr_mintypmax_1', list(p
))
5905 def p_expr_mintypmax_2(p
):
5906 '''expr_mintypmax : expression ':' expression ':' expression '''
5908 print('expr_mintypmax_2', list(p
))
5910 # { switch (min_typ_max_flag) {
5927 # if (min_typ_max_warn > 0) {
5928 # cerr << p[0]->get_fileline() << ": warning: choosing ";
5929 # switch (min_typ_max_flag) {
5940 # cerr << " expression." << endl;
5941 # min_typ_max_warn -= 1;
5947 def p_expression_list_with_nuls_1(p
):
5948 '''expression_list_with_nuls : expression_list_with_nuls ',' expression '''
5950 print('expression_list_with_nuls_1', list(p
))
5952 # { list<PExpr*>*tmp = p[1];
5953 # tmp->push_back(p[3]);
5959 def p_expression_list_with_nuls_2(p
):
5960 '''expression_list_with_nuls : expression '''
5962 print('expression_list_with_nuls_2', list(p
))
5964 # { list<PExpr*>*tmp = new list<PExpr*>;
5965 # tmp->push_back(p[1]);
5971 def p_expression_list_with_nuls_3(p
):
5972 '''expression_list_with_nuls : '''
5974 print('expression_list_with_nuls_3', list(p
))
5976 # { list<PExpr*>*tmp = new list<PExpr*>;
5977 # tmp->push_back(0);
5983 def p_expression_list_with_nuls_4(p
):
5984 '''expression_list_with_nuls : expression_list_with_nuls ',' '''
5986 print('expression_list_with_nuls_4', list(p
))
5988 # { list<PExpr*>*tmp = p[1];
5989 # tmp->push_back(0);
5995 def p_expression_list_proper_1(p
):
5996 '''expression_list_proper : expression_list_proper ',' expression '''
5998 print('expression_list_proper_1', list(p
))
6000 # { list<PExpr*>*tmp = p[1];
6001 # tmp->push_back(p[3]);
6007 def p_expression_list_proper_2(p
):
6008 '''expression_list_proper : expression '''
6010 print('expression_list_proper_2', list(p
))
6012 # { list<PExpr*>*tmp = new list<PExpr*>;
6013 # tmp->push_back(p[1]);
6019 def p_expr_primary_or_typename_1(p
):
6020 '''expr_primary_or_typename : expr_primary '''
6021 if(parse_debug
> 2):
6022 print('expr_primary_or_typename_1', list(p
))
6029 def p_expr_primary_or_typename_2(p
):
6030 '''expr_primary_or_typename : TYPE_IDENTIFIER '''
6032 print('expr_primary_or_typename_2', list(p
))
6035 # { PETypename*tmp = new PETypename(p[1].type);
6036 # FILE_NAME(tmp,@1);
6038 # delete[]p[1].text;
6043 def p_expr_primary_1(p
):
6044 '''expr_primary : number '''
6046 print('expr_primary_1', list(p
))
6050 # PENumber*tmp = new PENumber(p[1]);
6051 # FILE_NAME(tmp, @1);
6057 def p_expr_primary_2(p
):
6058 '''expr_primary : REALTIME '''
6060 print('expr_primary_2', list(p
))
6062 # { PEFNumber*tmp = new PEFNumber(p[1]);
6063 # FILE_NAME(tmp, @1);
6069 def p_expr_primary_3(p
):
6070 '''expr_primary : STRING '''
6072 print('expr_primary_3', list(p
))
6074 # { PEString*tmp = new PEString(p[1]);
6075 # FILE_NAME(tmp, @1);
6081 def p_expr_primary_4(p
):
6082 '''expr_primary : TIME_LITERAL '''
6084 print('expr_primary_4', list(p
))
6090 # if (p[1] == 0 || !get_time_unit(p[1], unit))
6091 # yyerror(@1, "internal error: delay.");
6093 # double p = pow(10.0, (double)(unit - pform_get_timeunit()));
6094 # double time = atof(p[1]) * p;
6096 # verireal *v = new verireal(time);
6097 # p[0] = new PEFNumber(v);
6098 # FILE_NAME(p[0], @1);
6104 def p_expr_primary_5(p
):
6105 '''expr_primary : SYSTEM_IDENTIFIER '''
6107 print('expr_primary_5', list(p
))
6109 # { perm_string tn = lex_strings.make(p[1]);
6110 # PECallFunction*tmp = new PECallFunction(tn);
6111 # FILE_NAME(tmp, @1);
6118 def p_expr_primary_6(p
):
6119 '''expr_primary : hierarchy_identifier '''
6120 if(parse_debug
> 2):
6121 print('expr_primary_6', list(p
))
6124 # { PEIdent*tmp = pform_new_ident(*p[1]);
6125 # FILE_NAME(tmp, @1);
6132 def p_expr_primary_7(p
):
6133 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier '''
6135 print('expr_primary_7', list(p
))
6137 # { p[0] = pform_package_ident(@2, p[1], p[3]);
6143 def p_expr_primary_8(p
):
6144 '''expr_primary : hierarchy_identifier '(' expression_list_with_nuls ')' '''
6146 print('expr_primary_8', list(p
))
6148 # { list<PExpr*>*expr_list = p[3];
6149 # strip_tail_items(expr_list);
6150 # PECallFunction*tmp = pform_make_call_function(@1, *p[1], *expr_list);
6157 def p_expr_primary_9(p
):
6158 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' '''
6160 print('expr_primary_9', list(p
))
6162 # { pform_name_t*t_name = p[1];
6163 # while (! p[3]->empty()) {
6164 # t_name->push_back(p[3]->front());
6165 # p[3]->pop_front();
6167 # list<PExpr*>*expr_list = p[5];
6168 # strip_tail_items(expr_list);
6169 # PECallFunction*tmp = pform_make_call_function(@1, *t_name, *expr_list);
6177 def p_expr_primary_10(p
):
6178 '''expr_primary : SYSTEM_IDENTIFIER '(' expression_list_proper ')' '''
6180 print('expr_primary_10', list(p
))
6182 # { perm_string tn = lex_strings.make(p[1]);
6183 # PECallFunction*tmp = new PECallFunction(tn, *p[3]);
6184 # FILE_NAME(tmp, @1);
6191 def p_expr_primary_11(p
):
6192 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')' '''
6194 print('expr_primary_11', list(p
))
6196 # { perm_string use_name = lex_strings.make(p[3]);
6197 # PECallFunction*tmp = new PECallFunction(p[1], use_name, *p[5]);
6198 # FILE_NAME(tmp, @3);
6205 def p_expr_primary_12(p
):
6206 '''expr_primary : SYSTEM_IDENTIFIER '(' ')' '''
6208 print('expr_primary_12', list(p
))
6210 # { perm_string tn = lex_strings.make(p[1]);
6211 # const vector<PExpr*>empty;
6212 # PECallFunction*tmp = new PECallFunction(tn, empty);
6213 # FILE_NAME(tmp, @1);
6216 # if (!gn_system_verilog()) {
6217 # yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
6223 def p_expr_primary_13(p
):
6224 '''expr_primary : implicit_class_handle '''
6226 print('expr_primary_13', list(p
))
6228 # { PEIdent*tmp = new PEIdent(*p[1]);
6229 # FILE_NAME(tmp,@1);
6236 def p_expr_primary_14(p
):
6237 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '''
6239 print('expr_primary_14', list(p
))
6241 # { pform_name_t*t_name = p[1];
6242 # while (! p[3]->empty()) {
6243 # t_name->push_back(p[3]->front());
6244 # p[3]->pop_front();
6246 # PEIdent*tmp = new PEIdent(*t_name);
6247 # FILE_NAME(tmp,@1);
6255 def p_expr_primary_15(p
):
6256 '''expr_primary : K_acos '(' expression ')' '''
6258 print('expr_primary_15', list(p
))
6260 # { perm_string tn = perm_string::literal("$acos");
6261 # PECallFunction*tmp = make_call_function(tn, p[3]);
6262 # FILE_NAME(tmp,@1);
6268 def p_expr_primary_16(p
):
6269 '''expr_primary : K_acosh '(' expression ')' '''
6271 print('expr_primary_16', list(p
))
6273 # { perm_string tn = perm_string::literal("$acosh");
6274 # PECallFunction*tmp = make_call_function(tn, p[3]);
6275 # FILE_NAME(tmp,@1);
6281 def p_expr_primary_17(p
):
6282 '''expr_primary : K_asin '(' expression ')' '''
6284 print('expr_primary_17', list(p
))
6286 # { perm_string tn = perm_string::literal("$asin");
6287 # PECallFunction*tmp = make_call_function(tn, p[3]);
6288 # FILE_NAME(tmp,@1);
6294 def p_expr_primary_18(p
):
6295 '''expr_primary : K_asinh '(' expression ')' '''
6297 print('expr_primary_18', list(p
))
6299 # { perm_string tn = perm_string::literal("$asinh");
6300 # PECallFunction*tmp = make_call_function(tn, p[3]);
6301 # FILE_NAME(tmp,@1);
6307 def p_expr_primary_19(p
):
6308 '''expr_primary : K_atan '(' expression ')' '''
6310 print('expr_primary_19', list(p
))
6312 # { perm_string tn = perm_string::literal("$atan");
6313 # PECallFunction*tmp = make_call_function(tn, p[3]);
6314 # FILE_NAME(tmp,@1);
6320 def p_expr_primary_20(p
):
6321 '''expr_primary : K_atanh '(' expression ')' '''
6323 print('expr_primary_20', list(p
))
6325 # { perm_string tn = perm_string::literal("$atanh");
6326 # PECallFunction*tmp = make_call_function(tn, p[3]);
6327 # FILE_NAME(tmp,@1);
6333 def p_expr_primary_21(p
):
6334 '''expr_primary : K_atan2 '(' expression ',' expression ')' '''
6336 print('expr_primary_21', list(p
))
6338 # { perm_string tn = perm_string::literal("$atan2");
6339 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6340 # FILE_NAME(tmp,@1);
6346 def p_expr_primary_22(p
):
6347 '''expr_primary : K_ceil '(' expression ')' '''
6349 print('expr_primary_22', list(p
))
6351 # { perm_string tn = perm_string::literal("$ceil");
6352 # PECallFunction*tmp = make_call_function(tn, p[3]);
6353 # FILE_NAME(tmp,@1);
6359 def p_expr_primary_23(p
):
6360 '''expr_primary : K_cos '(' expression ')' '''
6362 print('expr_primary_23', list(p
))
6364 # { perm_string tn = perm_string::literal("$cos");
6365 # PECallFunction*tmp = make_call_function(tn, p[3]);
6366 # FILE_NAME(tmp,@1);
6372 def p_expr_primary_24(p
):
6373 '''expr_primary : K_cosh '(' expression ')' '''
6375 print('expr_primary_24', list(p
))
6377 # { perm_string tn = perm_string::literal("$cosh");
6378 # PECallFunction*tmp = make_call_function(tn, p[3]);
6379 # FILE_NAME(tmp,@1);
6385 def p_expr_primary_25(p
):
6386 '''expr_primary : K_exp '(' expression ')' '''
6388 print('expr_primary_25', list(p
))
6390 # { perm_string tn = perm_string::literal("$exp");
6391 # PECallFunction*tmp = make_call_function(tn, p[3]);
6392 # FILE_NAME(tmp,@1);
6398 def p_expr_primary_26(p
):
6399 '''expr_primary : K_floor '(' expression ')' '''
6401 print('expr_primary_26', list(p
))
6403 # { perm_string tn = perm_string::literal("$floor");
6404 # PECallFunction*tmp = make_call_function(tn, p[3]);
6405 # FILE_NAME(tmp,@1);
6411 def p_expr_primary_27(p
):
6412 '''expr_primary : K_hypot '(' expression ',' expression ')' '''
6414 print('expr_primary_27', list(p
))
6416 # { perm_string tn = perm_string::literal("$hypot");
6417 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6418 # FILE_NAME(tmp,@1);
6424 def p_expr_primary_28(p
):
6425 '''expr_primary : K_ln '(' expression ')' '''
6427 print('expr_primary_28', list(p
))
6429 # { perm_string tn = perm_string::literal("$ln");
6430 # PECallFunction*tmp = make_call_function(tn, p[3]);
6431 # FILE_NAME(tmp,@1);
6437 def p_expr_primary_29(p
):
6438 '''expr_primary : K_log '(' expression ')' '''
6440 print('expr_primary_29', list(p
))
6442 # { perm_string tn = perm_string::literal("$log10");
6443 # PECallFunction*tmp = make_call_function(tn, p[3]);
6444 # FILE_NAME(tmp,@1);
6450 def p_expr_primary_30(p
):
6451 '''expr_primary : K_pow '(' expression ',' expression ')' '''
6453 print('expr_primary_30', list(p
))
6455 # { perm_string tn = perm_string::literal("$pow");
6456 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6457 # FILE_NAME(tmp,@1);
6463 def p_expr_primary_31(p
):
6464 '''expr_primary : K_sin '(' expression ')' '''
6466 print('expr_primary_31', list(p
))
6468 # { perm_string tn = perm_string::literal("$sin");
6469 # PECallFunction*tmp = make_call_function(tn, p[3]);
6470 # FILE_NAME(tmp,@1);
6476 def p_expr_primary_32(p
):
6477 '''expr_primary : K_sinh '(' expression ')' '''
6479 print('expr_primary_32', list(p
))
6481 # { perm_string tn = perm_string::literal("$sinh");
6482 # PECallFunction*tmp = make_call_function(tn, p[3]);
6483 # FILE_NAME(tmp,@1);
6489 def p_expr_primary_33(p
):
6490 '''expr_primary : K_sqrt '(' expression ')' '''
6492 print('expr_primary_33', list(p
))
6494 # { perm_string tn = perm_string::literal("$sqrt");
6495 # PECallFunction*tmp = make_call_function(tn, p[3]);
6496 # FILE_NAME(tmp,@1);
6502 def p_expr_primary_34(p
):
6503 '''expr_primary : K_tan '(' expression ')' '''
6505 print('expr_primary_34', list(p
))
6507 # { perm_string tn = perm_string::literal("$tan");
6508 # PECallFunction*tmp = make_call_function(tn, p[3]);
6509 # FILE_NAME(tmp,@1);
6515 def p_expr_primary_35(p
):
6516 '''expr_primary : K_tanh '(' expression ')' '''
6518 print('expr_primary_35', list(p
))
6520 # { perm_string tn = perm_string::literal("$tanh");
6521 # PECallFunction*tmp = make_call_function(tn, p[3]);
6522 # FILE_NAME(tmp,@1);
6528 def p_expr_primary_36(p
):
6529 '''expr_primary : K_abs '(' expression ')' '''
6531 print('expr_primary_36', list(p
))
6533 # { PEUnary*tmp = new PEUnary('m', p[3]);
6534 # FILE_NAME(tmp,@1);
6540 def p_expr_primary_37(p
):
6541 '''expr_primary : K_max '(' expression ',' expression ')' '''
6543 print('expr_primary_37', list(p
))
6545 # { PEBinary*tmp = new PEBinary('M', p[3], p[5]);
6546 # FILE_NAME(tmp,@1);
6552 def p_expr_primary_38(p
):
6553 '''expr_primary : K_min '(' expression ',' expression ')' '''
6555 print('expr_primary_38', list(p
))
6557 # { PEBinary*tmp = new PEBinary('m', p[3], p[5]);
6558 # FILE_NAME(tmp,@1);
6564 def p_expr_primary_39(p
):
6565 '''expr_primary : '(' expr_mintypmax ')' '''
6567 print('expr_primary_39', list(p
))
6574 def p_expr_primary_40(p
):
6575 '''expr_primary : '{' expression_list_proper '}' '''
6577 print('expr_primary_40', list(p
))
6579 # { PEConcat*tmp = new PEConcat(*p[2]);
6580 # FILE_NAME(tmp, @1);
6587 def p_expr_primary_41(p
):
6588 '''expr_primary : '{' expression '{' expression_list_proper '}' '}' '''
6590 print('expr_primary_41', list(p
))
6592 # { PExpr*rep = p[2];
6593 # PEConcat*tmp = new PEConcat(*p[4], rep);
6594 # FILE_NAME(tmp, @1);
6601 def p_expr_primary_42(p
):
6602 '''expr_primary : '{' expression '{' expression_list_proper '}' error '}' '''
6604 print('expr_primary_42', list(p
))
6606 # { PExpr*rep = p[2];
6607 # PEConcat*tmp = new PEConcat(*p[4], rep);
6608 # FILE_NAME(tmp, @1);
6611 # yyerror(@5, "error: Syntax error between internal '}' "
6612 # "and closing '}' of repeat concatenation.");
6618 def p_expr_primary_43(p
):
6619 '''expr_primary : '{' '}' '''
6621 print('expr_primary_43', list(p
))
6623 # { // This is the empty queue syntax.
6624 # if (gn_system_verilog()) {
6625 # list<PExpr*> empty_list;
6626 # PEConcat*tmp = new PEConcat(empty_list);
6627 # FILE_NAME(tmp, @1);
6630 # yyerror(@1, "error: Concatenations are not allowed to be empty.");
6637 def p_expr_primary_44(p
):
6638 '''expr_primary : expr_primary "'" '(' expression ')' '''
6640 print('expr_primary_44', list(p
))
6642 # { PExpr*base = p[4];
6643 # if (gn_system_verilog()) {
6644 # PECastSize*tmp = new PECastSize(p[1], base);
6645 # FILE_NAME(tmp, @1);
6648 # yyerror(@1, "error: Size cast requires SystemVerilog.");
6655 def p_expr_primary_45(p
):
6656 '''expr_primary : simple_type_or_string "'" '(' expression ')' '''
6658 print('expr_primary_45', list(p
))
6660 # { PExpr*base = p[4];
6661 # if (gn_system_verilog()) {
6662 # PECastType*tmp = new PECastType(p[1], base);
6663 # FILE_NAME(tmp, @1);
6666 # yyerror(@1, "error: Type cast requires SystemVerilog.");
6673 def p_expr_primary_46(p
):
6674 '''expr_primary : assignment_pattern '''
6676 print('expr_primary_46', list(p
))
6683 def p_expr_primary_47(p
):
6684 '''expr_primary : streaming_concatenation '''
6686 print('expr_primary_47', list(p
))
6693 def p_expr_primary_48(p
):
6694 '''expr_primary : K_null '''
6696 print('expr_primary_48', list(p
))
6698 # { PENull*tmp = new PENull;
6699 # FILE_NAME(tmp, @1);
6705 def p_function_item_list_opt_1(p
):
6706 '''function_item_list_opt : function_item_list '''
6708 print('function_item_list_opt_1', list(p
))
6715 def p_function_item_list_opt_2(p
):
6716 '''function_item_list_opt : '''
6718 print('function_item_list_opt_2', list(p
))
6724 def p_function_item_list_1(p
):
6725 '''function_item_list : function_item '''
6727 print('function_item_list_1', list(p
))
6734 def p_function_item_list_2(p
):
6735 '''function_item_list : function_item_list function_item '''
6737 print('function_item_list_2', list(p
))
6740 # if (p[1] && p[2]) {
6741 # vector<pform_tf_port_t>*tmp = p[1];
6742 # size_t s1 = tmp->size();
6743 # tmp->resize(s1 + p[2]->size());
6744 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
6745 # tmp->at(s1+idx) = p[2]->at(idx);
6748 # } else if (p[1]) {
6757 def p_function_item_1(p
):
6758 '''function_item : tf_port_declaration '''
6760 print('function_item_1', list(p
))
6767 def p_function_item_2(p
):
6768 '''function_item : block_item_decl '''
6770 print('function_item_2', list(p
))
6776 def p_gate_instance_1(p
):
6777 '''gate_instance : IDENTIFIER '(' expression_list_with_nuls ')' '''
6779 print('gate_instance_1', list(p
))
6781 # { lgate*tmp = new lgate;
6783 # tmp->parms = p[3];
6784 # tmp->file = @1.text;
6785 # tmp->lineno = @1.first_line;
6792 def p_gate_instance_2(p
):
6793 '''gate_instance : IDENTIFIER dimensions '(' expression_list_with_nuls ')' '''
6795 print('gate_instance_2', list(p
))
6797 # { lgate*tmp = new lgate;
6798 # list<pform_range_t>*rng = p[2];
6800 # tmp->parms = p[4];
6801 # tmp->range = rng->front();
6803 # assert(rng->empty());
6804 # tmp->file = @1.text;
6805 # tmp->lineno = @1.first_line;
6813 def p_gate_instance_3(p
):
6814 '''gate_instance : '(' expression_list_with_nuls ')' '''
6816 print('gate_instance_3', list(p
))
6818 # { lgate*tmp = new lgate;
6820 # tmp->parms = p[2];
6821 # tmp->file = @1.text;
6822 # tmp->lineno = @1.first_line;
6828 def p_gate_instance_4(p
):
6829 '''gate_instance : IDENTIFIER dimensions '''
6831 print('gate_instance_4', list(p
))
6833 # { lgate*tmp = new lgate;
6834 # list<pform_range_t>*rng = p[2];
6837 # tmp->parms_by_name = 0;
6838 # tmp->range = rng->front();
6840 # assert(rng->empty());
6841 # tmp->file = @1.text;
6842 # tmp->lineno = @1.first_line;
6850 def p_gate_instance_5(p
):
6851 '''gate_instance : IDENTIFIER '(' port_name_list ')' '''
6853 print('gate_instance_5', list(p
))
6855 # { lgate*tmp = new lgate;
6858 # tmp->parms_by_name = p[3];
6859 # tmp->file = @1.text;
6860 # tmp->lineno = @1.first_line;
6867 def p_gate_instance_6(p
):
6868 '''gate_instance : IDENTIFIER dimensions '(' port_name_list ')' '''
6870 print('gate_instance_6', list(p
))
6872 # { lgate*tmp = new lgate;
6873 # list<pform_range_t>*rng = p[2];
6876 # tmp->parms_by_name = p[4];
6877 # tmp->range = rng->front();
6879 # assert(rng->empty());
6880 # tmp->file = @1.text;
6881 # tmp->lineno = @1.first_line;
6889 def p_gate_instance_7(p
):
6890 '''gate_instance : IDENTIFIER '(' error ')' '''
6892 print('gate_instance_7', list(p
))
6894 # { lgate*tmp = new lgate;
6897 # tmp->parms_by_name = 0;
6898 # tmp->file = @1.text;
6899 # tmp->lineno = @1.first_line;
6900 # yyerror(@2, "error: Syntax error in instance port "
6901 # "expression(s).");
6908 def p_gate_instance_8(p
):
6909 '''gate_instance : IDENTIFIER dimensions '(' error ')' '''
6911 print('gate_instance_8', list(p
))
6913 # { lgate*tmp = new lgate;
6916 # tmp->parms_by_name = 0;
6917 # tmp->file = @1.text;
6918 # tmp->lineno = @1.first_line;
6919 # yyerror(@3, "error: Syntax error in instance port "
6920 # "expression(s).");
6927 def p_gate_instance_list_1(p
):
6928 '''gate_instance_list : gate_instance_list ',' gate_instance '''
6930 print('gate_instance_list_1', list(p
))
6932 # { svector<lgate>*tmp1 = p[1];
6933 # lgate*tmp2 = p[3];
6934 # svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
6942 def p_gate_instance_list_2(p
):
6943 '''gate_instance_list : gate_instance '''
6945 print('gate_instance_list_2', list(p
))
6947 # { svector<lgate>*tmp = new svector<lgate>(1);
6948 # (*tmp)[0] = *p[1];
6955 def p_gatetype_1(p
):
6956 '''gatetype : K_and '''
6958 print('gatetype_1', list(p
))
6960 # { p[0] = PGBuiltin::AND; }
6964 def p_gatetype_2(p
):
6965 '''gatetype : K_nand '''
6967 print('gatetype_2', list(p
))
6969 # { p[0] = PGBuiltin::NAND; }
6973 def p_gatetype_3(p
):
6974 '''gatetype : K_or '''
6976 print('gatetype_3', list(p
))
6978 # { p[0] = PGBuiltin::OR; }
6982 def p_gatetype_4(p
):
6983 '''gatetype : K_nor '''
6985 print('gatetype_4', list(p
))
6987 # { p[0] = PGBuiltin::NOR; }
6991 def p_gatetype_5(p
):
6992 '''gatetype : K_xor '''
6994 print('gatetype_5', list(p
))
6996 # { p[0] = PGBuiltin::XOR; }
7000 def p_gatetype_6(p
):
7001 '''gatetype : K_xnor '''
7003 print('gatetype_6', list(p
))
7005 # { p[0] = PGBuiltin::XNOR; }
7009 def p_gatetype_7(p
):
7010 '''gatetype : K_buf '''
7012 print('gatetype_7', list(p
))
7014 # { p[0] = PGBuiltin::BUF; }
7018 def p_gatetype_8(p
):
7019 '''gatetype : K_bufif0 '''
7021 print('gatetype_8', list(p
))
7023 # { p[0] = PGBuiltin::BUFIF0; }
7027 def p_gatetype_9(p
):
7028 '''gatetype : K_bufif1 '''
7030 print('gatetype_9', list(p
))
7032 # { p[0] = PGBuiltin::BUFIF1; }
7036 def p_gatetype_10(p
):
7037 '''gatetype : K_not '''
7039 print('gatetype_10', list(p
))
7041 # { p[0] = PGBuiltin::NOT; }
7045 def p_gatetype_11(p
):
7046 '''gatetype : K_notif0 '''
7048 print('gatetype_11', list(p
))
7050 # { p[0] = PGBuiltin::NOTIF0; }
7054 def p_gatetype_12(p
):
7055 '''gatetype : K_notif1 '''
7057 print('gatetype_12', list(p
))
7059 # { p[0] = PGBuiltin::NOTIF1; }
7063 def p_switchtype_1(p
):
7064 '''switchtype : K_nmos '''
7066 print('switchtype_1', list(p
))
7068 # { p[0] = PGBuiltin::NMOS; }
7072 def p_switchtype_2(p
):
7073 '''switchtype : K_rnmos '''
7075 print('switchtype_2', list(p
))
7077 # { p[0] = PGBuiltin::RNMOS; }
7081 def p_switchtype_3(p
):
7082 '''switchtype : K_pmos '''
7084 print('switchtype_3', list(p
))
7086 # { p[0] = PGBuiltin::PMOS; }
7090 def p_switchtype_4(p
):
7091 '''switchtype : K_rpmos '''
7093 print('switchtype_4', list(p
))
7095 # { p[0] = PGBuiltin::RPMOS; }
7099 def p_switchtype_5(p
):
7100 '''switchtype : K_cmos '''
7102 print('switchtype_5', list(p
))
7104 # { p[0] = PGBuiltin::CMOS; }
7108 def p_switchtype_6(p
):
7109 '''switchtype : K_rcmos '''
7111 print('switchtype_6', list(p
))
7113 # { p[0] = PGBuiltin::RCMOS; }
7117 def p_switchtype_7(p
):
7118 '''switchtype : K_tran '''
7120 print('switchtype_7', list(p
))
7122 # { p[0] = PGBuiltin::TRAN; }
7126 def p_switchtype_8(p
):
7127 '''switchtype : K_rtran '''
7129 print('switchtype_8', list(p
))
7131 # { p[0] = PGBuiltin::RTRAN; }
7135 def p_switchtype_9(p
):
7136 '''switchtype : K_tranif0 '''
7138 print('switchtype_9', list(p
))
7140 # { p[0] = PGBuiltin::TRANIF0; }
7144 def p_switchtype_10(p
):
7145 '''switchtype : K_tranif1 '''
7147 print('switchtype_10', list(p
))
7149 # { p[0] = PGBuiltin::TRANIF1; }
7153 def p_switchtype_11(p
):
7154 '''switchtype : K_rtranif0 '''
7156 print('switchtype_11', list(p
))
7158 # { p[0] = PGBuiltin::RTRANIF0; }
7162 def p_switchtype_12(p
):
7163 '''switchtype : K_rtranif1 '''
7165 print('switchtype_12', list(p
))
7167 # { p[0] = PGBuiltin::RTRANIF1; }
7171 def p_hierarchy_identifier_1(p
):
7172 '''hierarchy_identifier : IDENTIFIER '''
7174 print('hierarchy_identifier_1 FIXME', list(p
))
7175 lpvalue
= Leaf(token
.NAME
, p
[1])
7178 # { p[0] = new pform_name_t;
7179 # p[0]->push_back(name_component_t(lex_strings.make(p[1])));
7185 def p_hierarchy_identifier_2(p
):
7186 '''hierarchy_identifier : hierarchy_identifier '.' IDENTIFIER '''
7188 print('hierarchy_identifier_2', list(p
))
7190 # { pform_name_t * tmp = p[1];
7191 # tmp->push_back(name_component_t(lex_strings.make(p[3])));
7198 def p_hierarchy_identifier_3(p
):
7199 '''hierarchy_identifier : hierarchy_identifier '[' expression ']' '''
7201 print('hierarchy_identifier_3', list(p
))
7203 # { pform_name_t * tmp = p[1];
7204 # name_component_t&tail = tmp->back();
7205 # index_component_t itmp;
7206 # itmp.sel = index_component_t::SEL_BIT;
7208 # tail.index.push_back(itmp);
7214 def p_hierarchy_identifier_4(p
):
7215 '''hierarchy_identifier : hierarchy_identifier '[' '$' ']' '''
7217 print('hierarchy_identifier_4', list(p
))
7219 # { pform_name_t * tmp = p[1];
7220 # name_component_t&tail = tmp->back();
7221 # if (! gn_system_verilog()) {
7222 # yyerror(@3, "error: Last element expression ($) "
7223 # "requires SystemVerilog. Try enabling SystemVerilog.");
7225 # index_component_t itmp;
7226 # itmp.sel = index_component_t::SEL_BIT_LAST;
7229 # tail.index.push_back(itmp);
7235 def p_hierarchy_identifier_5(p
):
7236 '''hierarchy_identifier : hierarchy_identifier '[' expression ':' expression ']' '''
7238 print('hierarchy_identifier_5', list(p
))
7240 # { pform_name_t * tmp = p[1];
7241 # name_component_t&tail = tmp->back();
7242 # index_component_t itmp;
7243 # itmp.sel = index_component_t::SEL_PART;
7246 # tail.index.push_back(itmp);
7252 def p_hierarchy_identifier_6(p
):
7253 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_POS expression ']' '''
7255 print('hierarchy_identifier_6', list(p
))
7257 # { pform_name_t * tmp = p[1];
7258 # name_component_t&tail = tmp->back();
7259 # index_component_t itmp;
7260 # itmp.sel = index_component_t::SEL_IDX_UP;
7263 # tail.index.push_back(itmp);
7269 def p_hierarchy_identifier_7(p
):
7270 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_NEG expression ']' '''
7272 print('hierarchy_identifier_7', list(p
))
7274 # { pform_name_t * tmp = p[1];
7275 # name_component_t&tail = tmp->back();
7276 # index_component_t itmp;
7277 # itmp.sel = index_component_t::SEL_IDX_DO;
7280 # tail.index.push_back(itmp);
7286 def p_list_of_identifiers_1(p
):
7287 '''list_of_identifiers : IDENTIFIER '''
7289 print('list_of_identifiers_1', list(p
))
7291 # { p[0] = list_from_identifier(p[1]); }
7295 def p_list_of_identifiers_2(p
):
7296 '''list_of_identifiers : list_of_identifiers ',' IDENTIFIER '''
7298 print('list_of_identifiers_2', list(p
))
7300 # { p[0] = list_from_identifier(p[1], p[3]); }
7304 def p_list_of_port_identifiers_1(p
):
7305 '''list_of_port_identifiers : IDENTIFIER dimensions_opt '''
7307 print('list_of_port_identifiers_1', list(p
))
7309 # { p[0] = make_port_list(p[1], p[2], 0); }
7313 def p_list_of_port_identifiers_2(p
):
7314 '''list_of_port_identifiers : list_of_port_identifiers ',' IDENTIFIER dimensions_opt '''
7316 print('list_of_port_identifiers_2', list(p
))
7318 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
7322 def p_list_of_variable_port_identifiers_1(p
):
7323 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '''
7325 print('list_of_variable_port_identifiers_1', list(p
))
7327 # { p[0] = make_port_list(p[1], p[2], 0); }
7331 def p_list_of_variable_port_identifiers_2(p
):
7332 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '=' expression '''
7334 print('list_of_variable_port_identifiers_2', list(p
))
7336 # { p[0] = make_port_list(p[1], p[2], p[4]); }
7340 def p_list_of_variable_port_identifiers_3(p
):
7341 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '''
7343 print('list_of_variable_port_identifiers_3', list(p
))
7345 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
7349 def p_list_of_variable_port_identifiers_4(p
):
7350 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '=' expression '''
7352 print('list_of_variable_port_identifiers_4', list(p
))
7354 # { p[0] = make_port_list(p[1], p[3], p[4], p[6]); }
7358 def p_list_of_ports_1(p
):
7359 '''list_of_ports : port_opt '''
7361 print('list_of_ports_1', list(p
))
7363 # { vector<Module::port_t*>*tmp
7364 # = new vector<Module::port_t*>(1);
7371 def p_list_of_ports_2(p
):
7372 '''list_of_ports : list_of_ports ',' port_opt '''
7374 print('list_of_ports_2', list(p
))
7376 # { vector<Module::port_t*>*tmp = p[1];
7377 # tmp->push_back(p[3]);
7383 def p_list_of_port_declarations_1(p
):
7384 '''list_of_port_declarations : port_declaration '''
7385 if(parse_debug
> 1):
7386 print('list_of_port_declarations_1', list(p
))
7389 # { vector<Module::port_t*>*tmp
7390 # = new vector<Module::port_t*>(1);
7397 def p_list_of_port_declarations_2(p
):
7398 '''list_of_port_declarations : list_of_port_declarations ',' port_declaration '''
7400 print('list_of_port_declarations_2 FIXME', list(p
))
7401 # MOVE_TO absyn p[1].append(Leaf(token.NEWLINE, '\n')) # should be a comma
7402 # XXX p[3].prefix=' ' # add a space after the NL, must go in parameter
7406 # { vector<Module::port_t*>*tmp = p[1];
7407 # tmp->push_back(p[3]);
7413 def p_list_of_port_declarations_3(p
):
7414 '''list_of_port_declarations : list_of_port_declarations ',' IDENTIFIER '''
7416 print('list_of_port_declarations_3', list(p
))
7418 # { Module::port_t*ptmp;
7419 # perm_string name = lex_strings.make(p[3]);
7420 # ptmp = pform_module_port_reference(name, @3.text,
7422 # vector<Module::port_t*>*tmp = p[1];
7423 # tmp->push_back(ptmp);
7425 # /* Get the port declaration details, the port type
7426 # and what not, from context data stored by the
7427 # last port_declaration rule. */
7428 # pform_module_define_port(@3, name,
7429 # port_declaration_context.port_type,
7430 # port_declaration_context.port_net_type,
7431 # port_declaration_context.data_type, 0);
7438 def p_list_of_port_declarations_4(p
):
7439 '''list_of_port_declarations : list_of_port_declarations ',' '''
7441 print('list_of_port_declarations_4', list(p
))
7444 # yyerror(@2, "error: NULL port declarations are not "
7450 def p_list_of_port_declarations_5(p
):
7451 '''list_of_port_declarations : list_of_port_declarations ';' '''
7453 print('list_of_port_declarations_5', list(p
))
7456 # yyerror(@2, "error: ';' is an invalid port declaration "
7462 def p_port_declaration_1(p
):
7463 '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7465 print('port_declaration_1 FIXME', list(p
))
7466 comment
, dt
, name
= p
[2], p
[4], p
[5]
7467 p
[0] = absyn
.port_decl(comment
, dt
, name
)
7469 # { Module::port_t*ptmp;
7470 # perm_string name = lex_strings.make(p[5]);
7471 # data_type_t*use_type = p[4];
7472 # if (p[6]) use_type = new uarray_type_t(use_type, p[6]);
7473 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7474 # pform_module_define_port(@2, name, NetNet::PINPUT, p[3], use_type, p[1]);
7475 # port_declaration_context.port_type = NetNet::PINPUT;
7476 # port_declaration_context.port_net_type = p[3];
7477 # port_declaration_context.data_type = p[4];
7484 def p_port_declaration_2(p
):
7485 '''port_declaration : attribute_list_opt K_input K_wreal IDENTIFIER '''
7487 print('port_declaration_2', list(p
))
7489 # { Module::port_t*ptmp;
7490 # perm_string name = lex_strings.make(p[4]);
7491 # ptmp = pform_module_port_reference(name, @2.text,
7493 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7494 # FILE_NAME(real_type, @3);
7495 # pform_module_define_port(@2, name, NetNet::PINPUT,
7496 # NetNet::WIRE, real_type, p[1]);
7497 # port_declaration_context.port_type = NetNet::PINPUT;
7498 # port_declaration_context.port_net_type = NetNet::WIRE;
7499 # port_declaration_context.data_type = real_type;
7506 def p_port_declaration_3(p
):
7507 '''port_declaration : attribute_list_opt K_inout net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7509 print('port_declaration_3', list(p
))
7511 # { Module::port_t*ptmp;
7512 # perm_string name = lex_strings.make(p[5]);
7513 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7514 # pform_module_define_port(@2, name, NetNet::PINOUT, p[3], p[4], p[1]);
7515 # port_declaration_context.port_type = NetNet::PINOUT;
7516 # port_declaration_context.port_net_type = p[3];
7517 # port_declaration_context.data_type = p[4];
7520 # yyerror(@6, "sorry: Inout ports with unpacked dimensions not supported.");
7528 def p_port_declaration_4(p
):
7529 '''port_declaration : attribute_list_opt K_inout K_wreal IDENTIFIER '''
7531 print('port_declaration_4', list(p
))
7533 # { Module::port_t*ptmp;
7534 # perm_string name = lex_strings.make(p[4]);
7535 # ptmp = pform_module_port_reference(name, @2.text,
7537 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7538 # FILE_NAME(real_type, @3);
7539 # pform_module_define_port(@2, name, NetNet::PINOUT,
7540 # NetNet::WIRE, real_type, p[1]);
7541 # port_declaration_context.port_type = NetNet::PINOUT;
7542 # port_declaration_context.port_net_type = NetNet::WIRE;
7543 # port_declaration_context.data_type = real_type;
7550 def p_port_declaration_5(p
):
7551 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7553 print('port_declaration_5 FIXME', list(p
))
7554 comment
, dt
, name
= p
[2], p
[4], p
[5]
7555 p
[0] = absyn
.port_decl(comment
, dt
, name
)
7557 # { Module::port_t*ptmp;
7558 # perm_string name = lex_strings.make(p[5]);
7559 # data_type_t*use_dtype = p[4];
7560 # if (p[6]) use_dtype = new uarray_type_t(use_dtype, p[6]);
7561 # NetNet::Type use_type = p[3];
7562 # if (use_type == NetNet::IMPLICIT) {
7563 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
7564 # if (dtype->reg_flag)
7565 # use_type = NetNet::REG;
7566 # else if (dtype->implicit_flag)
7567 # use_type = NetNet::IMPLICIT;
7569 # use_type = NetNet::IMPLICIT_REG;
7571 # // The SystemVerilog types that can show up as
7572 # // output ports are implicitly (on the inside)
7573 # // variables because "reg" is not valid syntax
7575 # } else if (dynamic_cast<atom2_type_t*> (p[4])) {
7576 # use_type = NetNet::IMPLICIT_REG;
7577 # } else if (dynamic_cast<struct_type_t*> (p[4])) {
7578 # use_type = NetNet::IMPLICIT_REG;
7579 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[4])) {
7580 # if(etype->base_type == IVL_VT_LOGIC)
7581 # use_type = NetNet::IMPLICIT_REG;
7584 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7585 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, use_dtype, p[1]);
7586 # port_declaration_context.port_type = NetNet::POUTPUT;
7587 # port_declaration_context.port_net_type = use_type;
7588 # port_declaration_context.data_type = p[4];
7595 def p_port_declaration_6(p
):
7596 '''port_declaration : attribute_list_opt K_output K_wreal IDENTIFIER '''
7598 print('port_declaration_6', list(p
))
7600 # { Module::port_t*ptmp;
7601 # perm_string name = lex_strings.make(p[4]);
7602 # ptmp = pform_module_port_reference(name, @2.text,
7604 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7605 # FILE_NAME(real_type, @3);
7606 # pform_module_define_port(@2, name, NetNet::POUTPUT,
7607 # NetNet::WIRE, real_type, p[1]);
7608 # port_declaration_context.port_type = NetNet::POUTPUT;
7609 # port_declaration_context.port_net_type = NetNet::WIRE;
7610 # port_declaration_context.data_type = real_type;
7617 def p_port_declaration_7(p
):
7618 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER '=' expression '''
7620 print('port_declaration_7', list(p
))
7622 # { Module::port_t*ptmp;
7623 # perm_string name = lex_strings.make(p[5]);
7624 # NetNet::Type use_type = p[3];
7625 # if (use_type == NetNet::IMPLICIT) {
7626 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
7627 # if (dtype->reg_flag)
7628 # use_type = NetNet::REG;
7630 # use_type = NetNet::IMPLICIT_REG;
7632 # use_type = NetNet::IMPLICIT_REG;
7635 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7636 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, p[4], p[1]);
7637 # port_declaration_context.port_type = NetNet::PINOUT;
7638 # port_declaration_context.port_net_type = use_type;
7639 # port_declaration_context.data_type = p[4];
7641 # pform_make_var_init(@5, name, p[7]);
7649 def p_net_type_opt_1(p
):
7650 '''net_type_opt : net_type '''
7652 print('net_type_opt_1', list(p
))
7659 def p_net_type_opt_2(p
):
7660 '''net_type_opt : '''
7661 if(parse_debug
> 2):
7662 print('net_type_opt_2', list(p
))
7669 def p_unsigned_signed_opt_1(p
):
7670 '''unsigned_signed_opt : K_signed '''
7672 print('unsigned_signed_opt_1', list(p
))
7679 def p_unsigned_signed_opt_2(p
):
7680 '''unsigned_signed_opt : K_unsigned '''
7682 print('unsigned_signed_opt_2', list(p
))
7689 def p_unsigned_signed_opt_3(p
):
7690 '''unsigned_signed_opt : '''
7692 print('unsigned_signed_opt_3', list(p
))
7699 def p_signed_unsigned_opt_1(p
):
7700 '''signed_unsigned_opt : K_signed '''
7702 print('signed_unsigned_opt_1', list(p
))
7709 def p_signed_unsigned_opt_2(p
):
7710 '''signed_unsigned_opt : K_unsigned '''
7712 print('signed_unsigned_opt_2', list(p
))
7719 def p_signed_unsigned_opt_3(p
):
7720 '''signed_unsigned_opt : '''
7722 print('signed_unsigned_opt_3', list(p
))
7729 def p_atom2_type_1(p
):
7730 '''atom2_type : K_byte '''
7732 print('atom2_type_1', list(p
))
7738 def p_atom2_type_2(p
):
7739 '''atom2_type : K_shortint '''
7741 print('atom2_type_2', list(p
))
7747 def p_atom2_type_3(p
):
7748 '''atom2_type : K_int '''
7750 print('atom2_type_3', list(p
))
7756 def p_atom2_type_4(p
):
7757 '''atom2_type : K_longint '''
7759 print('atom2_type_4', list(p
))
7766 '''lpvalue : hierarchy_identifier '''
7767 if(parse_debug
> 2):
7768 print('lpvalue_1', list(p
))
7771 # { PEIdent*tmp = pform_new_ident(*p[1]);
7772 # FILE_NAME(tmp, @1);
7780 '''lpvalue : implicit_class_handle '.' hierarchy_identifier '''
7782 print('lpvalue_2', list(p
))
7784 # { pform_name_t*t_name = p[1];
7785 # while (!p[3]->empty()) {
7786 # t_name->push_back(p[3]->front());
7787 # p[3]->pop_front();
7789 # PEIdent*tmp = new PEIdent(*t_name);
7790 # FILE_NAME(tmp, @1);
7799 '''lpvalue : '{' expression_list_proper '}' '''
7801 print('lpvalue_3', list(p
))
7803 # { PEConcat*tmp = new PEConcat(*p[2]);
7804 # FILE_NAME(tmp, @1);
7812 '''lpvalue : streaming_concatenation '''
7814 print('lpvalue_4', list(p
))
7816 # { yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
7822 def p_cont_assign_1(p
):
7823 '''cont_assign : lpvalue '=' expression '''
7825 print('cont_assign_1', list(p
))
7826 absyn
.cont_assign_1(p
)
7828 # { list<PExpr*>*tmp = new list<PExpr*>;
7829 # tmp->push_back(p[1]);
7830 # tmp->push_back(p[3]);
7836 def p_cont_assign_list_1(p
):
7837 '''cont_assign_list : cont_assign_list ',' cont_assign '''
7839 print('cont_assign_list_1', list(p
))
7841 # { list<PExpr*>*tmp = p[1];
7842 # tmp->splice(tmp->end(), *p[3]);
7849 def p_cont_assign_list_2(p
):
7850 '''cont_assign_list : cont_assign '''
7851 if(parse_debug
> 2):
7852 print('cont_assign_list_2', list(p
))
7860 '''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 '''
7861 if(parse_debug
> 2):
7862 print('module_1', list(p
))
7863 clsdecl
= absyn
.module_1(p
)
7870 def p__embed0_module(p
):
7871 '''_embed0_module : '''
7873 # { pform_startmodule(@2, p[4], p[2]==K_program, p[2]==K_interface, p[3], p[1]); }
7877 def p__embed1_module(p
):
7878 '''_embed1_module : '''
7880 # { pform_module_set_ports(p[8]); }
7884 def p__embed2_module(p
):
7885 '''_embed2_module : '''
7887 # { pform_set_scope_timescale(@2); }
7891 def p__embed3_module(p
):
7892 '''_embed3_module : '''
7894 # { Module::UCDriveType ucd;
7895 # // The lexor detected `unconnected_drive directives and
7896 # // marked what it found in the uc_drive variable. Use that
7897 # // to generate a UCD flag for the module.
7898 # switch (uc_drive) {
7901 # ucd = Module::UCD_NONE;
7904 # ucd = Module::UCD_PULL0;
7907 # ucd = Module::UCD_PULL1;
7910 # // Check that program/endprogram and module/endmodule
7911 # // keywords match.
7912 # if (p[2] != p[15]) {
7915 # yyerror(@15, "error: module not closed by endmodule.");
7918 # yyerror(@15, "error: program not closed by endprogram.");
7921 # yyerror(@15, "error: interface not closed by endinterface.");
7927 # pform_endmodule(p[4], in_celldefine, ucd);
7932 def p_module_start_1(p
):
7933 '''module_start : K_module '''
7934 if(parse_debug
> 1):
7935 print('module_start_1', list(p
))
7937 # { p[0] = K_module; }
7941 def p_module_start_2(p
):
7942 '''module_start : K_macromodule '''
7944 print('module_start_2', list(p
))
7946 # { p[0] = K_module; }
7950 def p_module_start_3(p
):
7951 '''module_start : K_program '''
7953 print('module_start_3', list(p
))
7955 # { p[0] = K_program; }
7959 def p_module_start_4(p
):
7960 '''module_start : K_interface '''
7962 print('module_start_4', list(p
))
7964 # { p[0] = K_interface; }
7968 def p_module_end_1(p
):
7969 '''module_end : K_endmodule '''
7970 if(parse_debug
> 2):
7971 print('module_end_1', list(p
))
7973 # { p[0] = K_module; }
7977 def p_module_end_2(p
):
7978 '''module_end : K_endprogram '''
7980 print('module_end_2', list(p
))
7982 # { p[0] = K_program; }
7986 def p_module_end_3(p
):
7987 '''module_end : K_endinterface '''
7989 print('module_end_3', list(p
))
7991 # { p[0] = K_interface; }
7995 def p_endlabel_opt_1(p
):
7996 '''endlabel_opt : ':' IDENTIFIER '''
7998 print('endlabel_opt_1', list(p
))
8005 def p_endlabel_opt_2(p
):
8006 '''endlabel_opt : '''
8007 if(parse_debug
> 2):
8008 print('endlabel_opt_2', list(p
))
8014 def p_module_attribute_foreign_1(p
):
8015 '''module_attribute_foreign : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP '''
8017 print('module_attribute_foreign_1', list(p
))
8023 def p_module_attribute_foreign_2(p
):
8024 '''module_attribute_foreign : '''
8025 if(parse_debug
> 2):
8026 print('module_attribute_foreign_2', list(p
))
8032 def p_module_port_list_opt_1(p
):
8033 '''module_port_list_opt : '(' list_of_ports ')' '''
8035 print('module_port_list_opt_1', list(p
))
8042 def p_module_port_list_opt_2(p
):
8043 '''module_port_list_opt : '(' list_of_port_declarations ')' '''
8044 if(parse_debug
> 2):
8045 print('module_port_list_opt_2', list(p
))
8052 def p_module_port_list_opt_3(p
):
8053 '''module_port_list_opt : '''
8055 print('module_port_list_opt_3', list(p
))
8061 def p_module_port_list_opt_4(p
):
8062 '''module_port_list_opt : '(' error ')' '''
8064 print('module_port_list_opt_4', list(p
))
8066 # { yyerror(@2, "Errors in port declarations.");
8073 def p_module_parameter_port_list_opt_1(p
):
8074 '''module_parameter_port_list_opt : '''
8075 if(parse_debug
> 2):
8076 print('module_parameter_port_list_opt_1', list(p
))
8082 def p_module_parameter_port_list_opt_2(p
):
8083 '''module_parameter_port_list_opt : '#' '(' module_parameter_port_list ')' '''
8085 print('module_parameter_port_list_opt_2', list(p
))
8092 def p_module_parameter_port_list_1(p
):
8093 '''module_parameter_port_list : K_parameter param_type parameter_assign '''
8095 print('module_parameter_port_list_1', list(p
))
8102 def p_module_parameter_port_list_2(p
):
8103 '''module_parameter_port_list : module_parameter_port_list ',' parameter_assign '''
8105 print('module_parameter_port_list_2', list(p
))
8106 p
[0] = p
[1].append(p
[3])
8112 def p_module_parameter_port_list_3(p
):
8113 '''module_parameter_port_list : module_parameter_port_list ',' K_parameter param_type parameter_assign '''
8115 print('module_parameter_port_list_3', list(p
))
8116 p
[1].append(Leaf(token
.COMMA
, ','))
8117 p
[1].append(Leaf(token
.NEWLINE
, '\n'))
8118 p
[5].prefix
= ' ' # add space after newline
8126 def p_module_item_1(p
):
8127 '''module_item : module '''
8129 print('module_item_1', list(p
))
8135 def p_module_item_2(p
):
8136 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' '''
8138 print('module_item_2', list(p
))
8140 p
[0] = absyn
.module_item_2(p
[2], p
[3], p
[5])
8141 #p[0] = ["module_item_2"]+list(p)
8143 # { data_type_t*data_type = p[3];
8144 # if (data_type == 0) {
8145 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8146 # FILE_NAME(data_type, @2);
8148 # pform_set_data_type(@2, data_type, p[5], p[2], p[1]);
8150 # yyerror(@2, "sorry: net delays not supported.");
8158 def p_module_item_3(p
):
8159 '''module_item : attribute_list_opt K_wreal delay3 net_variable_list ';' '''
8161 print('module_item_3', list(p
))
8163 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
8164 # pform_set_data_type(@2, tmpt, p[4], NetNet::WIRE, p[1]);
8166 # yyerror(@3, "sorry: net delays not supported.");
8174 def p_module_item_4(p
):
8175 '''module_item : attribute_list_opt K_wreal net_variable_list ';' '''
8177 print('module_item_4', list(p
))
8179 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
8180 # pform_set_data_type(@2, tmpt, p[3], NetNet::WIRE, p[1]);
8186 def p_module_item_5(p
):
8187 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_decl_assigns ';' '''
8189 print('module_item_5', list(p
))
8191 # { data_type_t*data_type = p[3];
8192 # if (data_type == 0) {
8193 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8194 # FILE_NAME(data_type, @2);
8196 # pform_makewire(@2, p[4], str_strength, p[5], p[2], data_type);
8198 # yywarn(@2, "Attributes are not supported on net declaration "
8199 # "assignments and will be discarded.");
8206 def p_module_item_6(p
):
8207 '''module_item : attribute_list_opt net_type data_type_or_implicit drive_strength net_decl_assigns ';' '''
8209 print('module_item_6', list(p
))
8211 # { data_type_t*data_type = p[3];
8212 # if (data_type == 0) {
8213 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8214 # FILE_NAME(data_type, @2);
8216 # pform_makewire(@2, 0, p[4], p[5], p[2], data_type);
8218 # yywarn(@2, "Attributes are not supported on net declaration "
8219 # "assignments and will be discarded.");
8226 def p_module_item_7(p
):
8227 '''module_item : attribute_list_opt K_wreal net_decl_assigns ';' '''
8229 print('module_item_7', list(p
))
8231 # { real_type_t*data_type = new real_type_t(real_type_t::REAL);
8232 # pform_makewire(@2, 0, str_strength, p[3], NetNet::WIRE, data_type);
8234 # yywarn(@2, "Attributes are not supported on net declaration "
8235 # "assignments and will be discarded.");
8242 def p_module_item_8(p
):
8243 '''module_item : K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' '''
8245 print('module_item_8', list(p
))
8247 # { yyerror(@1, "sorry: trireg nets not supported.");
8254 def p_module_item_9(p
):
8255 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit list_of_port_identifiers ';' '''
8257 print('module_item_9', list(p
))
8259 # { pform_module_define_port(@2, p[5], p[2], p[3], p[4], p[1]); }
8263 def p_module_item_10(p
):
8264 '''module_item : attribute_list_opt port_direction K_wreal list_of_port_identifiers ';' '''
8266 print('module_item_10', list(p
))
8268 # { real_type_t*real_type = new real_type_t(real_type_t::REAL);
8269 # pform_module_define_port(@2, p[4], p[2], NetNet::WIRE, real_type, p[1]);
8274 def p_module_item_11(p
):
8275 '''module_item : attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' '''
8277 print('module_item_11', list(p
))
8279 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8280 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8281 # if (dtype->implicit_flag)
8282 # use_type = NetNet::NONE;
8284 # if (use_type == NetNet::NONE)
8285 # pform_set_port_type(@2, p[4], NetNet::PINOUT, p[3], p[1]);
8287 # pform_module_define_port(@2, p[4], NetNet::PINOUT, use_type, p[3], p[1]);
8292 def p_module_item_12(p
):
8293 '''module_item : attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' '''
8295 print('module_item_12', list(p
))
8297 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8298 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8299 # if (dtype->implicit_flag)
8300 # use_type = NetNet::NONE;
8302 # if (use_type == NetNet::NONE)
8303 # pform_set_port_type(@2, p[4], NetNet::PINPUT, p[3], p[1]);
8305 # pform_module_define_port(@2, p[4], NetNet::PINPUT, use_type, p[3], p[1]);
8310 def p_module_item_13(p
):
8311 '''module_item : attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' '''
8313 print('module_item_13', list(p
))
8315 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8316 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8317 # if (dtype->implicit_flag)
8318 # use_type = NetNet::NONE;
8319 # else if (dtype->reg_flag)
8320 # use_type = NetNet::REG;
8322 # use_type = NetNet::IMPLICIT_REG;
8324 # // The SystemVerilog types that can show up as
8325 # // output ports are implicitly (on the inside)
8326 # // variables because "reg" is not valid syntax
8328 # } else if (dynamic_cast<atom2_type_t*> (p[3])) {
8329 # use_type = NetNet::IMPLICIT_REG;
8330 # } else if (dynamic_cast<struct_type_t*> (p[3])) {
8331 # use_type = NetNet::IMPLICIT_REG;
8332 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[3])) {
8333 # if(etype->base_type == IVL_VT_LOGIC)
8334 # use_type = NetNet::IMPLICIT_REG;
8336 # if (use_type == NetNet::NONE)
8337 # pform_set_port_type(@2, p[4], NetNet::POUTPUT, p[3], p[1]);
8339 # pform_module_define_port(@2, p[4], NetNet::POUTPUT, use_type, p[3], p[1]);
8344 def p_module_item_14(p
):
8345 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit error ';' '''
8347 print('module_item_14', list(p
))
8349 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8350 # if (p[1]) delete p[1];
8351 # if (p[4]) delete p[4];
8357 def p_module_item_15(p
):
8358 '''module_item : attribute_list_opt K_inout data_type_or_implicit error ';' '''
8360 print('module_item_15', list(p
))
8362 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8363 # if (p[1]) delete p[1];
8364 # if (p[3]) delete p[3];
8370 def p_module_item_16(p
):
8371 '''module_item : attribute_list_opt K_input data_type_or_implicit error ';' '''
8373 print('module_item_16', list(p
))
8375 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8376 # if (p[1]) delete p[1];
8377 # if (p[3]) delete p[3];
8383 def p_module_item_17(p
):
8384 '''module_item : attribute_list_opt K_output data_type_or_implicit error ';' '''
8386 print('module_item_17', list(p
))
8388 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8389 # if (p[1]) delete p[1];
8390 # if (p[3]) delete p[3];
8396 def p_module_item_18(p
):
8397 '''module_item : DISCIPLINE_IDENTIFIER list_of_identifiers ';' '''
8399 print('module_item_18', list(p
))
8401 # { pform_attach_discipline(@1, p[1], p[2]); }
8405 def p_module_item_19(p
):
8406 '''module_item : attribute_list_opt _embed0_module_item block_item_decl '''
8408 print('module_item_19', list(p
))
8410 # { delete attributes_in_context;
8411 # attributes_in_context = 0;
8416 def p_module_item_20(p
):
8417 '''module_item : K_defparam _embed1_module_item defparam_assign_list ';' '''
8419 print('module_item_20', list(p
))
8425 def p_module_item_21(p
):
8426 '''module_item : attribute_list_opt gatetype gate_instance_list ';' '''
8428 print('module_item_21', list(p
))
8430 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
8434 def p_module_item_22(p
):
8435 '''module_item : attribute_list_opt gatetype delay3 gate_instance_list ';' '''
8437 print('module_item_22', list(p
))
8439 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
8443 def p_module_item_23(p
):
8444 '''module_item : attribute_list_opt gatetype drive_strength gate_instance_list ';' '''
8446 print('module_item_23', list(p
))
8448 # { pform_makegates(@2, p[2], p[3], 0, p[4], p[1]); }
8452 def p_module_item_24(p
):
8453 '''module_item : attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';' '''
8455 print('module_item_24', list(p
))
8457 # { pform_makegates(@2, p[2], p[3], p[4], p[5], p[1]); }
8461 def p_module_item_25(p
):
8462 '''module_item : attribute_list_opt switchtype gate_instance_list ';' '''
8464 print('module_item_25', list(p
))
8466 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
8470 def p_module_item_26(p
):
8471 '''module_item : attribute_list_opt switchtype delay3 gate_instance_list ';' '''
8473 print('module_item_26', list(p
))
8475 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
8479 def p_module_item_27(p
):
8480 '''module_item : K_pullup gate_instance_list ';' '''
8482 print('module_item_27', list(p
))
8484 # { pform_makegates(@1, PGBuiltin::PULLUP, pull_strength, 0, p[2], 0); }
8488 def p_module_item_28(p
):
8489 '''module_item : K_pulldown gate_instance_list ';' '''
8491 print('module_item_28', list(p
))
8493 # { pform_makegates(@1, PGBuiltin::PULLDOWN, pull_strength, 0, p[2], 0); }
8497 def p_module_item_29(p
):
8498 '''module_item : K_pullup '(' dr_strength1 ')' gate_instance_list ';' '''
8500 print('module_item_29', list(p
))
8502 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[5], 0); }
8506 def p_module_item_30(p
):
8507 '''module_item : K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
8509 print('module_item_30', list(p
))
8511 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[7], 0); }
8515 def p_module_item_31(p
):
8516 '''module_item : K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
8518 print('module_item_31', list(p
))
8520 # { pform_makegates(@1, PGBuiltin::PULLUP, p[5], 0, p[7], 0); }
8524 def p_module_item_32(p
):
8525 '''module_item : K_pulldown '(' dr_strength0 ')' gate_instance_list ';' '''
8527 print('module_item_32', list(p
))
8529 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[5], 0); }
8533 def p_module_item_33(p
):
8534 '''module_item : K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
8536 print('module_item_33', list(p
))
8538 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[5], 0, p[7], 0); }
8542 def p_module_item_34(p
):
8543 '''module_item : K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
8545 print('module_item_34', list(p
))
8547 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[7], 0); }
8551 def p_module_item_35(p
):
8552 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' '''
8554 print('module_item_35', list(p
))
8556 # { perm_string tmp1 = lex_strings.make(p[2]);
8557 # pform_make_modgates(@2, tmp1, p[3], p[4], p[1]);
8563 def p_module_item_36(p
):
8564 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt error ';' '''
8566 print('module_item_36', list(p
))
8568 # { yyerror(@2, "error: Invalid module instantiation");
8570 # if (p[1]) delete p[1];
8575 def p_module_item_37(p
):
8576 '''module_item : K_assign drive_strength_opt delay3_opt cont_assign_list ';' '''
8577 if(parse_debug
> 2):
8578 print('module_item_37', list(p
))
8580 # { pform_make_pgassign_list(p[4], p[3], p[2], @1.text, @1.first_line); }
8584 def p_module_item_38(p
):
8585 '''module_item : attribute_list_opt K_always statement_item '''
8587 print('module_item_38', list(p
))
8589 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, p[3], p[1]);
8590 # FILE_NAME(tmp, @2);
8595 def p_module_item_39(p
):
8596 '''module_item : attribute_list_opt K_always_comb statement_item '''
8598 print('module_item_39', list(p
))
8600 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_COMB, p[3], p[1]);
8601 # FILE_NAME(tmp, @2);
8606 def p_module_item_40(p
):
8607 '''module_item : attribute_list_opt K_always_ff statement_item '''
8609 print('module_item_40', list(p
))
8611 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, p[3], p[1]);
8612 # FILE_NAME(tmp, @2);
8617 def p_module_item_41(p
):
8618 '''module_item : attribute_list_opt K_always_latch statement_item '''
8620 print('module_item_41', list(p
))
8622 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_LATCH, p[3], p[1]);
8623 # FILE_NAME(tmp, @2);
8628 def p_module_item_42(p
):
8629 '''module_item : attribute_list_opt K_initial statement_item '''
8631 print('module_item_42', list(p
))
8633 # { PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, p[3], p[1]);
8634 # FILE_NAME(tmp, @2);
8639 def p_module_item_43(p
):
8640 '''module_item : attribute_list_opt K_final statement_item '''
8642 print('module_item_43', list(p
))
8644 # { PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, p[3], p[1]);
8645 # FILE_NAME(tmp, @2);
8650 def p_module_item_44(p
):
8651 '''module_item : attribute_list_opt K_analog analog_statement '''
8653 print('module_item_44', list(p
))
8655 # { pform_make_analog_behavior(@2, IVL_PR_ALWAYS, p[3]); }
8659 def p_module_item_45(p
):
8660 '''module_item : attribute_list_opt assertion_item '''
8662 print('module_item_45', list(p
))
8668 def p_module_item_46(p
):
8669 '''module_item : timeunits_declaration '''
8671 print('module_item_46', list(p
))
8677 def p_module_item_47(p
):
8678 '''module_item : class_declaration '''
8680 print('module_item_47', list(p
))
8686 def p_module_item_48(p
):
8687 '''module_item : task_declaration '''
8689 print('module_item_48', list(p
))
8695 def p_module_item_49(p
):
8696 '''module_item : function_declaration '''
8698 print('module_item_49', list(p
))
8704 def p_module_item_50(p
):
8705 '''module_item : K_generate generate_item_list_opt K_endgenerate '''
8707 print('module_item_50', list(p
))
8709 # { // Test for bad nesting. I understand it, but it is illegal.
8710 # if (pform_parent_generate()) {
8711 # cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
8712 # cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
8713 # cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
8720 def p_module_item_51(p
):
8721 '''module_item : K_genvar list_of_identifiers ';' '''
8723 print('module_item_51', list(p
))
8725 # { pform_genvars(@1, p[2]); }
8729 def p_module_item_52(p
):
8730 '''module_item : K_for '(' IDENTIFIER '=' expression ';' expression ';' IDENTIFIER '=' expression ')' _embed2_module_item generate_block '''
8732 print('module_item_52', list(p
))
8734 # { pform_endgenerate(); }
8738 def p_module_item_53(p
):
8739 '''module_item : generate_if generate_block_opt K_else _embed3_module_item generate_block '''
8741 print('module_item_53', list(p
))
8743 # { pform_endgenerate(); }
8747 def p_module_item_54(p
):
8748 '''module_item : generate_if generate_block_opt %prec less_than_K_else '''
8750 print('module_item_54', list(p
))
8752 # { pform_endgenerate(); }
8756 def p_module_item_55(p
):
8757 '''module_item : K_case '(' expression ')' _embed4_module_item generate_case_items K_endcase '''
8759 print('module_item_55', list(p
))
8761 # { pform_endgenerate(); }
8765 def p_module_item_56(p
):
8766 '''module_item : modport_declaration '''
8768 print('module_item_56', list(p
))
8774 def p_module_item_57(p
):
8775 '''module_item : package_import_declaration '''
8777 print('module_item_57', list(p
))
8783 def p_module_item_58(p
):
8784 '''module_item : attribute_list_opt K_specparam _embed5_module_item specparam_decl ';' '''
8786 print('module_item_58', list(p
))
8792 def p_module_item_59(p
):
8793 '''module_item : K_specify _embed6_module_item specify_item_list_opt K_endspecify '''
8795 print('module_item_59', list(p
))
8801 def p_module_item_60(p
):
8802 '''module_item : K_specify error K_endspecify '''
8804 print('module_item_60', list(p
))
8806 # { yyerror(@1, "error: syntax error in specify block");
8812 def p_module_item_61(p
):
8813 '''module_item : error ';' '''
8815 print('module_item_61', list(p
))
8817 # { yyerror(@2, "error: invalid module item.");
8823 def p_module_item_62(p
):
8824 '''module_item : K_assign error '=' expression ';' '''
8826 print('module_item_62', list(p
))
8828 # { yyerror(@1, "error: syntax error in left side "
8829 # "of continuous assignment.");
8835 def p_module_item_63(p
):
8836 '''module_item : K_assign error ';' '''
8838 print('module_item_63', list(p
))
8840 # { yyerror(@1, "error: syntax error in "
8841 # "continuous assignment");
8847 def p_module_item_64(p
):
8848 '''module_item : K_function error K_endfunction endlabel_opt '''
8850 print('module_item_64', list(p
))
8852 # { yyerror(@1, "error: I give up on this "
8853 # "function definition.");
8855 # if (!gn_system_verilog()) {
8856 # yyerror(@4, "error: Function end names require "
8857 # "SystemVerilog.");
8866 def p_module_item_65(p
):
8867 '''module_item : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';' '''
8869 print('module_item_65', list(p
))
8871 # { perm_string tmp3 = lex_strings.make(p[3]);
8872 # perm_string tmp5 = lex_strings.make(p[5]);
8873 # pform_set_attrib(tmp3, tmp5, p[7]);
8880 def p_module_item_66(p
):
8881 '''module_item : KK_attribute '(' error ')' ';' '''
8883 print('module_item_66', list(p
))
8885 # { yyerror(@1, "error: Malformed $attribute parameter list."); }
8889 def p__embed0_module_item(p
):
8890 '''_embed0_module_item : '''
8892 # { attributes_in_context = p[1]; }
8896 def p__embed1_module_item(p
):
8897 '''_embed1_module_item : '''
8899 # { if (pform_in_interface())
8900 # yyerror(@1, "error: Parameter overrides are not allowed "
8901 # "in interfaces.");
8906 def p__embed2_module_item(p
):
8907 '''_embed2_module_item : '''
8909 # { pform_start_generate_for(@1, p[3], p[5], p[7], p[9], p[11]); }
8913 def p__embed3_module_item(p
):
8914 '''_embed3_module_item : '''
8916 # { pform_start_generate_else(@1); }
8920 def p__embed4_module_item(p
):
8921 '''_embed4_module_item : '''
8923 # { pform_start_generate_case(@1, p[3]); }
8927 def p__embed5_module_item(p
):
8928 '''_embed5_module_item : '''
8930 # { if (pform_in_interface())
8931 # yyerror(@1, "error: specparam declarations are not allowed "
8932 # "in interfaces.");
8937 def p__embed6_module_item(p
):
8938 '''_embed6_module_item : '''
8940 # { if (pform_in_interface())
8941 # yyerror(@1, "error: specify blocks are not allowed "
8942 # "in interfaces.");
8947 def p_module_item_list_1(p
):
8948 '''module_item_list : module_item_list module_item '''
8950 print('module_item_list_1', list(p
))
8956 def p_module_item_list_2(p
):
8957 '''module_item_list : module_item '''
8958 if(parse_debug
> 2):
8959 print('module_item_list_2', list(p
))
8965 def p_module_item_list_opt_1(p
):
8966 '''module_item_list_opt : module_item_list '''
8967 if(parse_debug
> 2):
8968 print('module_item_list_opt_1', list(p
))
8974 def p_module_item_list_opt_2(p
):
8975 '''module_item_list_opt : '''
8977 print('module_item_list_opt_2', list(p
))
8983 def p_generate_if_1(p
):
8984 '''generate_if : K_if '(' expression ')' '''
8986 print('generate_if_1', list(p
))
8988 # { pform_start_generate_if(@1, p[3]); }
8992 def p_generate_case_items_1(p
):
8993 '''generate_case_items : generate_case_items generate_case_item '''
8995 print('generate_case_items_1', list(p
))
9001 def p_generate_case_items_2(p
):
9002 '''generate_case_items : generate_case_item '''
9004 print('generate_case_items_2', list(p
))
9010 def p_generate_case_item_1(p
):
9011 '''generate_case_item : expression_list_proper ':' _embed0_generate_case_item generate_block_opt '''
9013 print('generate_case_item_1', list(p
))
9015 # { pform_endgenerate(); }
9019 def p_generate_case_item_2(p
):
9020 '''generate_case_item : K_default ':' _embed1_generate_case_item generate_block_opt '''
9022 print('generate_case_item_2', list(p
))
9024 # { pform_endgenerate(); }
9028 def p__embed0_generate_case_item(p
):
9029 '''_embed0_generate_case_item : '''
9031 # { pform_generate_case_item(@1, p[1]); }
9035 def p__embed1_generate_case_item(p
):
9036 '''_embed1_generate_case_item : '''
9038 # { pform_generate_case_item(@1, 0); }
9042 def p_generate_item_1(p
):
9043 '''generate_item : module_item '''
9045 print('generate_item_1', list(p
))
9051 def p_generate_item_2(p
):
9052 '''generate_item : K_begin generate_item_list_opt K_end '''
9054 print('generate_item_2', list(p
))
9056 # { /* Detect and warn about anachronistic begin/end use */
9057 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
9059 # cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
9065 def p_generate_item_3(p
):
9066 '''generate_item : K_begin ':' IDENTIFIER _embed0_generate_item generate_item_list_opt K_end '''
9068 print('generate_item_3', list(p
))
9070 # { /* Detect and warn about anachronistic named begin/end use */
9071 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
9073 # cerr << @1 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
9075 # pform_endgenerate();
9080 def p__embed0_generate_item(p
):
9081 '''_embed0_generate_item : '''
9084 # pform_start_generate_nblock(@1, p[3]);
9089 def p_generate_item_list_1(p
):
9090 '''generate_item_list : generate_item_list generate_item '''
9092 print('generate_item_list_1', list(p
))
9098 def p_generate_item_list_2(p
):
9099 '''generate_item_list : generate_item '''
9101 print('generate_item_list_2', list(p
))
9107 def p_generate_item_list_opt_1(p
):
9108 '''generate_item_list_opt : generate_item_list '''
9110 print('generate_item_list_opt_1', list(p
))
9116 def p_generate_item_list_opt_2(p
):
9117 '''generate_item_list_opt : '''
9119 print('generate_item_list_opt_2', list(p
))
9125 def p_generate_block_1(p
):
9126 '''generate_block : module_item '''
9128 print('generate_block_1', list(p
))
9134 def p_generate_block_2(p
):
9135 '''generate_block : K_begin generate_item_list_opt K_end '''
9137 print('generate_block_2', list(p
))
9143 def p_generate_block_3(p
):
9144 '''generate_block : K_begin ':' IDENTIFIER generate_item_list_opt K_end endlabel_opt '''
9146 print('generate_block_3', list(p
))
9148 # { pform_generate_block_name(p[3]);
9150 # if (strcmp(p[3],p[6]) != 0) {
9151 # yyerror(@6, "error: End label doesn't match "
9154 # if (! gn_system_verilog()) {
9155 # yyerror(@6, "error: Begin end labels require "
9156 # "SystemVerilog.");
9165 def p_generate_block_opt_1(p
):
9166 '''generate_block_opt : generate_block '''
9168 print('generate_block_opt_1', list(p
))
9174 def p_generate_block_opt_2(p
):
9175 '''generate_block_opt : ';' '''
9177 print('generate_block_opt_2', list(p
))
9183 def p_net_decl_assign_1(p
):
9184 '''net_decl_assign : IDENTIFIER '=' expression '''
9186 print('net_decl_assign_1', list(p
))
9188 # { net_decl_assign_t*tmp = new net_decl_assign_t;
9190 # tmp->name = lex_strings.make(p[1]);
9198 def p_net_decl_assigns_1(p
):
9199 '''net_decl_assigns : net_decl_assigns ',' net_decl_assign '''
9201 print('net_decl_assigns_1', list(p
))
9203 # { net_decl_assign_t*tmp = p[1];
9204 # p[3]->next = tmp->next;
9211 def p_net_decl_assigns_2(p
):
9212 '''net_decl_assigns : net_decl_assign '''
9214 print('net_decl_assigns_2', list(p
))
9221 def p_bit_logic_1(p
):
9222 '''bit_logic : K_logic '''
9224 print('bit_logic_1', list(p
))
9226 # { p[0] = IVL_VT_LOGIC; }
9230 def p_bit_logic_2(p
):
9231 '''bit_logic : K_bool '''
9233 print('bit_logic_2', list(p
))
9235 # { p[0] = IVL_VT_BOOL; /* Icarus misc */}
9239 def p_bit_logic_3(p
):
9240 '''bit_logic : K_bit '''
9242 print('bit_logic_3', list(p
))
9244 # { p[0] = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
9248 def p_bit_logic_opt_1(p
):
9249 '''bit_logic_opt : bit_logic '''
9251 print('bit_logic_opt_1', list(p
))
9257 def p_bit_logic_opt_2(p
):
9258 '''bit_logic_opt : '''
9260 print('bit_logic_opt_2', list(p
))
9262 # { p[0] = IVL_VT_NO_TYPE; }
9266 def p_net_type_1(p
):
9267 '''net_type : K_wire '''
9268 if(parse_debug
> 2):
9269 print('net_type_1', list(p
))
9277 def p_net_type_2(p
):
9278 '''net_type : K_tri '''
9280 print('net_type_2', list(p
))
9282 # { p[0] = NetNet::TRI; }
9286 def p_net_type_3(p
):
9287 '''net_type : K_tri1 '''
9289 print('net_type_3', list(p
))
9291 # { p[0] = NetNet::TRI1; }
9295 def p_net_type_4(p
):
9296 '''net_type : K_supply0 '''
9298 print('net_type_4', list(p
))
9300 # { p[0] = NetNet::SUPPLY0; }
9304 def p_net_type_5(p
):
9305 '''net_type : K_wand '''
9307 print('net_type_5', list(p
))
9309 # { p[0] = NetNet::WAND; }
9313 def p_net_type_6(p
):
9314 '''net_type : K_triand '''
9316 print('net_type_6', list(p
))
9318 # { p[0] = NetNet::TRIAND; }
9322 def p_net_type_7(p
):
9323 '''net_type : K_tri0 '''
9325 print('net_type_7', list(p
))
9327 # { p[0] = NetNet::TRI0; }
9331 def p_net_type_8(p
):
9332 '''net_type : K_supply1 '''
9334 print('net_type_8', list(p
))
9336 # { p[0] = NetNet::SUPPLY1; }
9340 def p_net_type_9(p
):
9341 '''net_type : K_wor '''
9343 print('net_type_9', list(p
))
9345 # { p[0] = NetNet::WOR; }
9349 def p_net_type_10(p
):
9350 '''net_type : K_trior '''
9352 print('net_type_10', list(p
))
9354 # { p[0] = NetNet::TRIOR; }
9358 def p_net_type_11(p
):
9359 '''net_type : K_wone '''
9361 print('net_type_11', list(p
))
9363 # { p[0] = NetNet::UNRESOLVED_WIRE;
9364 # cerr << @1.text << ":" << @1.first_line << ": warning: "
9365 # "'wone' is deprecated, please use 'uwire' "
9366 # "instead." << endl;
9371 def p_net_type_12(p
):
9372 '''net_type : K_uwire '''
9374 print('net_type_12', list(p
))
9376 # { p[0] = NetNet::UNRESOLVED_WIRE; }
9380 def p_param_type_1(p
):
9381 '''param_type : bit_logic_opt unsigned_signed_opt dimensions_opt '''
9383 print('param_type_1', list(p
))
9385 # { param_active_range = p[3];
9386 # param_active_signed = p[2];
9387 # if ((p[1] == IVL_VT_NO_TYPE) && (p[3] != 0))
9388 # param_active_type = IVL_VT_LOGIC;
9390 # param_active_type = p[1];
9395 def p_param_type_2(p
):
9396 '''param_type : K_integer '''
9398 print('param_type_2', list(p
))
9400 # { param_active_range = make_range_from_width(integer_width);
9401 # param_active_signed = true;
9402 # param_active_type = IVL_VT_LOGIC;
9407 def p_param_type_3(p
):
9408 '''param_type : K_time '''
9410 print('param_type_3', list(p
))
9412 # { param_active_range = make_range_from_width(64);
9413 # param_active_signed = false;
9414 # param_active_type = IVL_VT_LOGIC;
9419 def p_param_type_4(p
):
9420 '''param_type : real_or_realtime '''
9422 print('param_type_4', list(p
))
9424 # { param_active_range = 0;
9425 # param_active_signed = true;
9426 # param_active_type = IVL_VT_REAL;
9431 def p_param_type_5(p
):
9432 '''param_type : atom2_type '''
9434 print('param_type_5', list(p
))
9436 # { param_active_range = make_range_from_width(p[1]);
9437 # param_active_signed = true;
9438 # param_active_type = IVL_VT_BOOL;
9443 def p_param_type_6(p
):
9444 '''param_type : TYPE_IDENTIFIER '''
9446 print('param_type_6', list(p
))
9448 # { pform_set_param_from_type(@1, p[1].type, p[1].text, param_active_range,
9449 # param_active_signed, param_active_type);
9450 # delete[]p[1].text;
9455 def p_parameter_assign_list_1(p
):
9456 '''parameter_assign_list : parameter_assign '''
9458 print('parameter_assign_list_1', list(p
))
9464 def p_parameter_assign_list_2(p
):
9465 '''parameter_assign_list : parameter_assign_list ',' parameter_assign '''
9467 print('parameter_assign_list_2', list(p
))
9473 def p_localparam_assign_list_1(p
):
9474 '''localparam_assign_list : localparam_assign '''
9476 print('localparam_assign_list_1', list(p
))
9482 def p_localparam_assign_list_2(p
):
9483 '''localparam_assign_list : localparam_assign_list ',' localparam_assign '''
9485 print('localparam_assign_list_2', list(p
))
9491 def p_parameter_assign_1(p
):
9492 '''parameter_assign : IDENTIFIER '=' expression parameter_value_ranges_opt '''
9494 print('parameter_assign_1', list(p
))
9495 tpname
= Node(syms
.tname
, [Leaf(token
.NAME
, p
[1])])
9496 expr
= Node(syms
.tfpdef
, [tpname
, Leaf(token
.EQUAL
, p
[2]), p
[3]])
9499 # { PExpr*tmp = p[3];
9500 # pform_set_parameter(@1, lex_strings.make(p[1]), param_active_type,
9501 # param_active_signed, param_active_range, tmp, p[4]);
9507 def p_localparam_assign_1(p
):
9508 '''localparam_assign : IDENTIFIER '=' expression '''
9510 print('localparam_assign_1', list(p
))
9512 # { PExpr*tmp = p[3];
9513 # pform_set_localparam(@1, lex_strings.make(p[1]), param_active_type,
9514 # param_active_signed, param_active_range, tmp);
9520 def p_parameter_value_ranges_opt_1(p
):
9521 '''parameter_value_ranges_opt : parameter_value_ranges '''
9523 print('parameter_value_ranges_opt_1', list(p
))
9530 def p_parameter_value_ranges_opt_2(p
):
9531 '''parameter_value_ranges_opt : '''
9533 print('parameter_value_ranges_opt_2', list(p
))
9539 def p_parameter_value_ranges_1(p
):
9540 '''parameter_value_ranges : parameter_value_ranges parameter_value_range '''
9542 print('parameter_value_ranges_1', list(p
))
9544 # { p[0] = p[2]; p[0]->next = p[1]; }
9548 def p_parameter_value_ranges_2(p
):
9549 '''parameter_value_ranges : parameter_value_range '''
9551 print('parameter_value_ranges_2', list(p
))
9553 # { p[0] = p[1]; p[0]->next = 0; }
9557 def p_parameter_value_range_1(p
):
9558 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ']' '''
9560 print('parameter_value_range_1', list(p
))
9562 # { p[0] = pform_parameter_value_range(p[1], false, p[3], false, p[5]); }
9566 def p_parameter_value_range_2(p
):
9567 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ')' '''
9569 print('parameter_value_range_2', list(p
))
9571 # { p[0] = pform_parameter_value_range(p[1], false, p[3], true, p[5]); }
9575 def p_parameter_value_range_3(p
):
9576 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ']' '''
9578 print('parameter_value_range_3', list(p
))
9580 # { p[0] = pform_parameter_value_range(p[1], true, p[3], false, p[5]); }
9584 def p_parameter_value_range_4(p
):
9585 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ')' '''
9587 print('parameter_value_range_4', list(p
))
9589 # { p[0] = pform_parameter_value_range(p[1], true, p[3], true, p[5]); }
9593 def p_parameter_value_range_5(p
):
9594 '''parameter_value_range : K_exclude expression '''
9596 print('parameter_value_range_5', list(p
))
9598 # { p[0] = pform_parameter_value_range(true, false, p[2], false, p[2]); }
9602 def p_value_range_expression_1(p
):
9603 '''value_range_expression : expression '''
9605 print('value_range_expression_1', list(p
))
9612 def p_value_range_expression_2(p
):
9613 '''value_range_expression : K_inf '''
9615 print('value_range_expression_2', list(p
))
9621 def p_value_range_expression_3(p
):
9622 '''value_range_expression : '+' K_inf '''
9624 print('value_range_expression_3', list(p
))
9630 def p_value_range_expression_4(p
):
9631 '''value_range_expression : '-' K_inf '''
9633 print('value_range_expression_4', list(p
))
9639 def p_from_exclude_1(p
):
9640 '''from_exclude : K_from '''
9642 print('from_exclude_1', list(p
))
9649 def p_from_exclude_2(p
):
9650 '''from_exclude : K_exclude '''
9652 print('from_exclude_2', list(p
))
9659 def p_parameter_value_opt_1(p
):
9660 '''parameter_value_opt : '#' '(' expression_list_with_nuls ')' '''
9662 print('parameter_value_opt_1', list(p
))
9664 # { struct parmvalue_t*tmp = new struct parmvalue_t;
9665 # tmp->by_order = p[3];
9672 def p_parameter_value_opt_2(p
):
9673 '''parameter_value_opt : '#' '(' parameter_value_byname_list ')' '''
9675 print('parameter_value_opt_2', list(p
))
9677 # { struct parmvalue_t*tmp = new struct parmvalue_t;
9678 # tmp->by_order = 0;
9679 # tmp->by_name = p[3];
9685 def p_parameter_value_opt_3(p
):
9686 '''parameter_value_opt : '#' DEC_NUMBER '''
9688 print('parameter_value_opt_3', list(p
))
9691 # PENumber*tmp = new PENumber(p[2]);
9692 # FILE_NAME(tmp, @1);
9694 # struct parmvalue_t*lst = new struct parmvalue_t;
9695 # lst->by_order = new list<PExpr*>;
9696 # lst->by_order->push_back(tmp);
9704 def p_parameter_value_opt_4(p
):
9705 '''parameter_value_opt : '#' REALTIME '''
9707 print('parameter_value_opt_4', list(p
))
9710 # PEFNumber*tmp = new PEFNumber(p[2]);
9711 # FILE_NAME(tmp, @1);
9713 # struct parmvalue_t*lst = new struct parmvalue_t;
9714 # lst->by_order = new list<PExpr*>;
9715 # lst->by_order->push_back(tmp);
9722 def p_parameter_value_opt_5(p
):
9723 '''parameter_value_opt : '#' error '''
9725 print('parameter_value_opt_5', list(p
))
9727 # { yyerror(@1, "error: syntax error in parameter value "
9728 # "assignment list.");
9734 def p_parameter_value_opt_6(p
):
9735 '''parameter_value_opt : '''
9737 print('parameter_value_opt_6', list(p
))
9743 def p_parameter_value_byname_1(p
):
9744 '''parameter_value_byname : '.' IDENTIFIER '(' expression ')' '''
9746 print('parameter_value_byname_1', list(p
))
9748 # { named_pexpr_t*tmp = new named_pexpr_t;
9749 # tmp->name = lex_strings.make(p[2]);
9757 def p_parameter_value_byname_2(p
):
9758 '''parameter_value_byname : '.' IDENTIFIER '(' ')' '''
9760 print('parameter_value_byname_2', list(p
))
9762 # { named_pexpr_t*tmp = new named_pexpr_t;
9763 # tmp->name = lex_strings.make(p[2]);
9771 def p_parameter_value_byname_list_1(p
):
9772 '''parameter_value_byname_list : parameter_value_byname '''
9774 print('parameter_value_byname_list_1', list(p
))
9776 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
9777 # tmp->push_back(*p[1]);
9784 def p_parameter_value_byname_list_2(p
):
9785 '''parameter_value_byname_list : parameter_value_byname_list ',' parameter_value_byname '''
9787 print('parameter_value_byname_list_2', list(p
))
9789 # { list<named_pexpr_t>*tmp = p[1];
9790 # tmp->push_back(*p[3]);
9798 '''port : port_reference '''
9800 print('port_1', list(p
))
9808 '''port : '.' IDENTIFIER '(' port_reference ')' '''
9810 print('port_2', list(p
))
9812 # { Module::port_t*tmp = p[4];
9813 # tmp->name = lex_strings.make(p[2]);
9821 '''port : '{' port_reference_list '}' '''
9823 print('port_3', list(p
))
9825 # { Module::port_t*tmp = p[2];
9826 # tmp->name = perm_string();
9833 '''port : '.' IDENTIFIER '(' '{' port_reference_list '}' ')' '''
9835 print('port_4', list(p
))
9837 # { Module::port_t*tmp = p[5];
9838 # tmp->name = lex_strings.make(p[2]);
9845 def p_port_opt_1(p
):
9846 '''port_opt : port '''
9848 print('port_opt_1', list(p
))
9855 def p_port_opt_2(p
):
9858 print('port_opt_2', list(p
))
9864 def p_port_name_1(p
):
9865 '''port_name : '.' IDENTIFIER '(' expression ')' '''
9867 print('port_name_1', list(p
))
9869 # { named_pexpr_t*tmp = new named_pexpr_t;
9870 # tmp->name = lex_strings.make(p[2]);
9878 def p_port_name_2(p
):
9879 '''port_name : '.' IDENTIFIER '(' error ')' '''
9881 print('port_name_2', list(p
))
9883 # { yyerror(@3, "error: invalid port connection expression.");
9884 # named_pexpr_t*tmp = new named_pexpr_t;
9885 # tmp->name = lex_strings.make(p[2]);
9893 def p_port_name_3(p
):
9894 '''port_name : '.' IDENTIFIER '(' ')' '''
9896 print('port_name_3', list(p
))
9898 # { named_pexpr_t*tmp = new named_pexpr_t;
9899 # tmp->name = lex_strings.make(p[2]);
9907 def p_port_name_4(p
):
9908 '''port_name : '.' IDENTIFIER '''
9910 print('port_name_4', list(p
))
9912 # { named_pexpr_t*tmp = new named_pexpr_t;
9913 # tmp->name = lex_strings.make(p[2]);
9914 # tmp->parm = new PEIdent(lex_strings.make(p[2]), true);
9915 # FILE_NAME(tmp->parm, @1);
9922 def p_port_name_5(p
):
9923 '''port_name : K_DOTSTAR '''
9925 print('port_name_5', list(p
))
9927 # { named_pexpr_t*tmp = new named_pexpr_t;
9928 # tmp->name = lex_strings.make("*");
9935 def p_port_name_list_1(p
):
9936 '''port_name_list : port_name_list ',' port_name '''
9938 print('port_name_list_1', list(p
))
9940 # { list<named_pexpr_t>*tmp = p[1];
9941 # tmp->push_back(*p[3]);
9948 def p_port_name_list_2(p
):
9949 '''port_name_list : port_name '''
9951 print('port_name_list_2', list(p
))
9953 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
9954 # tmp->push_back(*p[1]);
9961 def p_port_reference_1(p
):
9962 '''port_reference : IDENTIFIER '''
9964 print('port_reference_1', list(p
))
9966 # { Module::port_t*ptmp;
9967 # perm_string name = lex_strings.make(p[1]);
9968 # ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
9975 def p_port_reference_2(p
):
9976 '''port_reference : IDENTIFIER '[' expression ':' expression ']' '''
9978 print('port_reference_2', list(p
))
9980 # { index_component_t itmp;
9981 # itmp.sel = index_component_t::SEL_PART;
9985 # name_component_t ntmp (lex_strings.make(p[1]));
9986 # ntmp.index.push_back(itmp);
9988 # pform_name_t pname;
9989 # pname.push_back(ntmp);
9991 # PEIdent*wtmp = new PEIdent(pname);
9992 # FILE_NAME(wtmp, @1);
9994 # Module::port_t*ptmp = new Module::port_t;
9995 # ptmp->name = perm_string();
9996 # ptmp->expr.push_back(wtmp);
10004 def p_port_reference_3(p
):
10005 '''port_reference : IDENTIFIER '[' expression ']' '''
10007 print('port_reference_3', list(p
))
10009 # { index_component_t itmp;
10010 # itmp.sel = index_component_t::SEL_BIT;
10014 # name_component_t ntmp (lex_strings.make(p[1]));
10015 # ntmp.index.push_back(itmp);
10017 # pform_name_t pname;
10018 # pname.push_back(ntmp);
10020 # PEIdent*tmp = new PEIdent(pname);
10021 # FILE_NAME(tmp, @1);
10023 # Module::port_t*ptmp = new Module::port_t;
10024 # ptmp->name = perm_string();
10025 # ptmp->expr.push_back(tmp);
10032 def p_port_reference_4(p
):
10033 '''port_reference : IDENTIFIER '[' error ']' '''
10035 print('port_reference_4', list(p
))
10037 # { yyerror(@1, "error: invalid port bit select");
10038 # Module::port_t*ptmp = new Module::port_t;
10039 # PEIdent*wtmp = new PEIdent(lex_strings.make(p[1]));
10040 # FILE_NAME(wtmp, @1);
10041 # ptmp->name = lex_strings.make(p[1]);
10042 # ptmp->expr.push_back(wtmp);
10049 def p_port_reference_list_1(p
):
10050 '''port_reference_list : port_reference '''
10052 print('port_reference_list_1', list(p
))
10059 def p_port_reference_list_2(p
):
10060 '''port_reference_list : port_reference_list ',' port_reference '''
10062 print('port_reference_list_2', list(p
))
10064 # { Module::port_t*tmp = p[1];
10065 # append(tmp->expr, p[3]->expr);
10072 def p_dimensions_opt_1(p
):
10073 '''dimensions_opt : '''
10074 if(parse_debug
> 2):
10075 print('dimensions_opt_1', list(p
))
10081 def p_dimensions_opt_2(p
):
10082 '''dimensions_opt : dimensions '''
10084 print('dimensions_opt_2', list(p
))
10091 def p_dimensions_1(p
):
10092 '''dimensions : variable_dimension '''
10094 print('dimensions_1', list(p
))
10101 def p_dimensions_2(p
):
10102 '''dimensions : dimensions variable_dimension '''
10104 print('dimensions_2', list(p
))
10106 # { list<pform_range_t> *tmp = p[1];
10108 # tmp->splice(tmp->end(), *p[2]);
10116 def p_register_variable_1(p
):
10117 '''register_variable : IDENTIFIER dimensions_opt '''
10119 print('register_variable_1', list(p
))
10121 # { perm_string name = lex_strings.make(p[1]);
10122 # pform_makewire(@1, name, NetNet::REG,
10123 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10124 # pform_set_reg_idx(name, p[2]);
10130 def p_register_variable_2(p
):
10131 '''register_variable : IDENTIFIER dimensions_opt '=' expression '''
10133 print('register_variable_2', list(p
))
10135 # { if (pform_peek_scope()->var_init_needs_explicit_lifetime()
10136 # && (var_lifetime == LexicalScope::INHERITED)) {
10137 # cerr << @3 << ": warning: Static variable initialization requires "
10138 # "explicit lifetime in this context." << endl;
10141 # perm_string name = lex_strings.make(p[1]);
10142 # pform_makewire(@1, name, NetNet::REG,
10143 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10144 # pform_set_reg_idx(name, p[2]);
10145 # pform_make_var_init(@1, name, p[4]);
10151 def p_register_variable_list_1(p
):
10152 '''register_variable_list : register_variable '''
10154 print('register_variable_list_1', list(p
))
10156 # { list<perm_string>*tmp = new list<perm_string>;
10157 # tmp->push_back(lex_strings.make(p[1]));
10164 def p_register_variable_list_2(p
):
10165 '''register_variable_list : register_variable_list ',' register_variable '''
10167 print('register_variable_list_2', list(p
))
10169 # { list<perm_string>*tmp = p[1];
10170 # tmp->push_back(lex_strings.make(p[3]));
10177 def p_net_variable_1(p
):
10178 '''net_variable : IDENTIFIER dimensions_opt '''
10179 if(parse_debug
> 2):
10180 print('net_variable_1', list(p
))
10182 #p[0]= ('net_variable_1', list(p))
10184 # { perm_string name = lex_strings.make(p[1]);
10185 # pform_makewire(@1, name, NetNet::IMPLICIT,
10186 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10187 # pform_set_reg_idx(name, p[2]);
10188 p
[0] = [p
[1], p
[2]]
10195 def p_net_variable_list_1(p
):
10196 '''net_variable_list : net_variable '''
10197 if(parse_debug
> 2):
10198 print('net_variable_list_1', list(p
))
10201 # { list<perm_string>*tmp = new list<perm_string>;
10202 # tmp->push_back(lex_strings.make(p[1]));
10209 def p_net_variable_list_2(p
):
10210 '''net_variable_list : net_variable_list ',' net_variable '''
10211 if(parse_debug
> 2):
10212 print('net_variable_list_2', list(p
))
10215 # { list<perm_string>*tmp = p[1];
10216 # tmp->push_back(lex_strings.make(p[3]));
10223 def p_event_variable_1(p
):
10224 '''event_variable : IDENTIFIER dimensions_opt '''
10226 print('event_variable_1', list(p
))
10229 # yyerror(@2, "sorry: event arrays are not supported.");
10237 def p_event_variable_list_1(p
):
10238 '''event_variable_list : event_variable '''
10240 print('event_variable_list_1', list(p
))
10242 # { p[0] = list_from_identifier(p[1]); }
10246 def p_event_variable_list_2(p
):
10247 '''event_variable_list : event_variable_list ',' event_variable '''
10249 print('event_variable_list_2', list(p
))
10251 # { p[0] = list_from_identifier(p[1], p[3]); }
10255 def p_specify_item_1(p
):
10256 '''specify_item : K_specparam specparam_decl ';' '''
10258 print('specify_item_1', list(p
))
10264 def p_specify_item_2(p
):
10265 '''specify_item : specify_simple_path_decl ';' '''
10267 print('specify_item_2', list(p
))
10269 # { pform_module_specify_path(p[1]);
10274 def p_specify_item_3(p
):
10275 '''specify_item : specify_edge_path_decl ';' '''
10277 print('specify_item_3', list(p
))
10279 # { pform_module_specify_path(p[1]);
10284 def p_specify_item_4(p
):
10285 '''specify_item : K_if '(' expression ')' specify_simple_path_decl ';' '''
10287 print('specify_item_4', list(p
))
10289 # { PSpecPath*tmp = p[5];
10291 # tmp->conditional = true;
10292 # tmp->condition = p[3];
10294 # pform_module_specify_path(tmp);
10299 def p_specify_item_5(p
):
10300 '''specify_item : K_if '(' expression ')' specify_edge_path_decl ';' '''
10302 print('specify_item_5', list(p
))
10304 # { PSpecPath*tmp = p[5];
10306 # tmp->conditional = true;
10307 # tmp->condition = p[3];
10309 # pform_module_specify_path(tmp);
10314 def p_specify_item_6(p
):
10315 '''specify_item : K_ifnone specify_simple_path_decl ';' '''
10317 print('specify_item_6', list(p
))
10319 # { PSpecPath*tmp = p[2];
10321 # tmp->conditional = true;
10322 # tmp->condition = 0;
10324 # pform_module_specify_path(tmp);
10329 def p_specify_item_7(p
):
10330 '''specify_item : K_ifnone specify_edge_path_decl ';' '''
10332 print('specify_item_7', list(p
))
10334 # { yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
10335 # "not supported.");
10341 def p_specify_item_8(p
):
10342 '''specify_item : K_Sfullskew '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10344 print('specify_item_8', list(p
))
10352 def p_specify_item_9(p
):
10353 '''specify_item : K_Shold '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10355 print('specify_item_9', list(p
))
10362 def p_specify_item_10(p
):
10363 '''specify_item : K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10365 print('specify_item_10', list(p
))
10373 def p_specify_item_11(p
):
10374 '''specify_item : K_Speriod '(' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10376 print('specify_item_11', list(p
))
10383 def p_specify_item_12(p
):
10384 '''specify_item : K_Srecovery '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10386 print('specify_item_12', list(p
))
10393 def p_specify_item_13(p
):
10394 '''specify_item : K_Srecrem '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10396 print('specify_item_13', list(p
))
10404 def p_specify_item_14(p
):
10405 '''specify_item : K_Sremoval '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10407 print('specify_item_14', list(p
))
10414 def p_specify_item_15(p
):
10415 '''specify_item : K_Ssetup '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10417 print('specify_item_15', list(p
))
10424 def p_specify_item_16(p
):
10425 '''specify_item : K_Ssetuphold '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10427 print('specify_item_16', list(p
))
10435 def p_specify_item_17(p
):
10436 '''specify_item : K_Sskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10438 print('specify_item_17', list(p
))
10445 def p_specify_item_18(p
):
10446 '''specify_item : K_Stimeskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10448 print('specify_item_18', list(p
))
10455 def p_specify_item_19(p
):
10456 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ',' expression spec_notifier_opt ')' ';' '''
10458 print('specify_item_19', list(p
))
10466 def p_specify_item_20(p
):
10467 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ')' ';' '''
10469 print('specify_item_20', list(p
))
10476 def p_specify_item_21(p
):
10477 '''specify_item : K_pulsestyle_onevent specify_path_identifiers ';' '''
10479 print('specify_item_21', list(p
))
10486 def p_specify_item_22(p
):
10487 '''specify_item : K_pulsestyle_ondetect specify_path_identifiers ';' '''
10489 print('specify_item_22', list(p
))
10496 def p_specify_item_23(p
):
10497 '''specify_item : K_showcancelled specify_path_identifiers ';' '''
10499 print('specify_item_23', list(p
))
10506 def p_specify_item_24(p
):
10507 '''specify_item : K_noshowcancelled specify_path_identifiers ';' '''
10509 print('specify_item_24', list(p
))
10516 def p_specify_item_list_1(p
):
10517 '''specify_item_list : specify_item '''
10519 print('specify_item_list_1', list(p
))
10525 def p_specify_item_list_2(p
):
10526 '''specify_item_list : specify_item_list specify_item '''
10528 print('specify_item_list_2', list(p
))
10534 def p_specify_item_list_opt_1(p
):
10535 '''specify_item_list_opt : '''
10537 print('specify_item_list_opt_1', list(p
))
10543 def p_specify_item_list_opt_2(p
):
10544 '''specify_item_list_opt : specify_item_list '''
10546 print('specify_item_list_opt_2', list(p
))
10552 def p_specify_edge_path_decl_1(p
):
10553 '''specify_edge_path_decl : specify_edge_path '=' '(' delay_value_list ')' '''
10555 print('specify_edge_path_decl_1', list(p
))
10557 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
10561 def p_specify_edge_path_decl_2(p
):
10562 '''specify_edge_path_decl : specify_edge_path '=' delay_value_simple '''
10564 print('specify_edge_path_decl_2', list(p
))
10566 # { list<PExpr*>*tmp = new list<PExpr*>;
10567 # tmp->push_back(p[3]);
10568 # p[0] = pform_assign_path_delay(p[1], tmp);
10573 def p_edge_operator_1(p
):
10574 '''edge_operator : K_posedge '''
10576 print('edge_operator_1', list(p
))
10583 def p_edge_operator_2(p
):
10584 '''edge_operator : K_negedge '''
10586 print('edge_operator_2', list(p
))
10593 def p_specify_edge_path_1(p
):
10594 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10596 print('specify_edge_path_1', list(p
))
10598 # { int edge_flag = 0;
10599 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], false, p[6], p[8]); }
10603 def p_specify_edge_path_2(p
):
10604 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10606 print('specify_edge_path_2', list(p
))
10608 # { int edge_flag = p[2]? 1 : -1;
10609 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], false, p[7], p[9]);}
10613 def p_specify_edge_path_3(p
):
10614 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10616 print('specify_edge_path_3', list(p
))
10618 # { int edge_flag = 0;
10619 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], true, p[6], p[8]); }
10623 def p_specify_edge_path_4(p
):
10624 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10626 print('specify_edge_path_4', list(p
))
10628 # { int edge_flag = p[2]? 1 : -1;
10629 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], true, p[7], p[9]); }
10633 def p_polarity_operator_1(p
):
10634 '''polarity_operator : K_PO_POS '''
10636 print('polarity_operator_1', list(p
))
10642 def p_polarity_operator_2(p
):
10643 '''polarity_operator : K_PO_NEG '''
10645 print('polarity_operator_2', list(p
))
10651 def p_polarity_operator_3(p
):
10652 '''polarity_operator : ':' '''
10654 print('polarity_operator_3', list(p
))
10660 def p_specify_simple_path_decl_1(p
):
10661 '''specify_simple_path_decl : specify_simple_path '=' '(' delay_value_list ')' '''
10663 print('specify_simple_path_decl_1', list(p
))
10665 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
10669 def p_specify_simple_path_decl_2(p
):
10670 '''specify_simple_path_decl : specify_simple_path '=' delay_value_simple '''
10672 print('specify_simple_path_decl_2', list(p
))
10674 # { list<PExpr*>*tmp = new list<PExpr*>;
10675 # tmp->push_back(p[3]);
10676 # p[0] = pform_assign_path_delay(p[1], tmp);
10681 def p_specify_simple_path_decl_3(p
):
10682 '''specify_simple_path_decl : specify_simple_path '=' '(' error ')' '''
10684 print('specify_simple_path_decl_3', list(p
))
10686 # { yyerror(@3, "Syntax error in delay value list.");
10693 def p_specify_simple_path_1(p
):
10694 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' '''
10696 print('specify_simple_path_1', list(p
))
10698 # { p[0] = pform_make_specify_path(@1, p[2], p[3], false, p[5]); }
10702 def p_specify_simple_path_2(p
):
10703 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' '''
10705 print('specify_simple_path_2', list(p
))
10707 # { p[0] = pform_make_specify_path(@1, p[2], p[3], true, p[5]); }
10711 def p_specify_simple_path_3(p
):
10712 '''specify_simple_path : '(' error ')' '''
10714 print('specify_simple_path_3', list(p
))
10716 # { yyerror(@1, "Invalid simple path");
10722 def p_specify_path_identifiers_1(p
):
10723 '''specify_path_identifiers : IDENTIFIER '''
10725 print('specify_path_identifiers_1', list(p
))
10727 # { list<perm_string>*tmp = new list<perm_string>;
10728 # tmp->push_back(lex_strings.make(p[1]));
10735 def p_specify_path_identifiers_2(p
):
10736 '''specify_path_identifiers : IDENTIFIER '[' expr_primary ']' '''
10738 print('specify_path_identifiers_2', list(p
))
10740 # { if (gn_specify_blocks_flag) {
10741 # yywarn(@4, "Bit selects are not currently supported "
10742 # "in path declarations. The declaration "
10743 # "will be applied to the whole vector.");
10745 # list<perm_string>*tmp = new list<perm_string>;
10746 # tmp->push_back(lex_strings.make(p[1]));
10753 def p_specify_path_identifiers_3(p
):
10754 '''specify_path_identifiers : IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
10756 print('specify_path_identifiers_3', list(p
))
10758 # { if (gn_specify_blocks_flag) {
10759 # yywarn(@4, "Part selects are not currently supported "
10760 # "in path declarations. The declaration "
10761 # "will be applied to the whole vector.");
10763 # list<perm_string>*tmp = new list<perm_string>;
10764 # tmp->push_back(lex_strings.make(p[1]));
10771 def p_specify_path_identifiers_4(p
):
10772 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '''
10774 print('specify_path_identifiers_4', list(p
))
10776 # { list<perm_string>*tmp = p[1];
10777 # tmp->push_back(lex_strings.make(p[3]));
10784 def p_specify_path_identifiers_5(p
):
10785 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' '''
10787 print('specify_path_identifiers_5', list(p
))
10789 # { if (gn_specify_blocks_flag) {
10790 # yywarn(@4, "Bit selects are not currently supported "
10791 # "in path declarations. The declaration "
10792 # "will be applied to the whole vector.");
10794 # list<perm_string>*tmp = p[1];
10795 # tmp->push_back(lex_strings.make(p[3]));
10802 def p_specify_path_identifiers_6(p
):
10803 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
10805 print('specify_path_identifiers_6', list(p
))
10807 # { if (gn_specify_blocks_flag) {
10808 # yywarn(@4, "Part selects are not currently supported "
10809 # "in path declarations. The declaration "
10810 # "will be applied to the whole vector.");
10812 # list<perm_string>*tmp = p[1];
10813 # tmp->push_back(lex_strings.make(p[3]));
10820 def p_specparam_1(p
):
10821 '''specparam : IDENTIFIER '=' expression '''
10823 print('specparam_1', list(p
))
10825 # { PExpr*tmp = p[3];
10826 # pform_set_specparam(@1, lex_strings.make(p[1]),
10827 # param_active_range, tmp);
10833 def p_specparam_2(p
):
10834 '''specparam : IDENTIFIER '=' expression ':' expression ':' expression '''
10836 print('specparam_2', list(p
))
10839 # switch (min_typ_max_flag) {
10856 # if (min_typ_max_warn > 0) {
10857 # cerr << tmp->get_fileline() << ": warning: choosing ";
10858 # switch (min_typ_max_flag) {
10869 # cerr << " expression." << endl;
10870 # min_typ_max_warn -= 1;
10872 # pform_set_specparam(@1, lex_strings.make(p[1]),
10873 # param_active_range, tmp);
10879 def p_specparam_3(p
):
10880 '''specparam : PATHPULSE_IDENTIFIER '=' expression '''
10882 print('specparam_3', list(p
))
10890 def p_specparam_4(p
):
10891 '''specparam : PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' '''
10893 print('specparam_4', list(p
))
10902 def p_specparam_list_1(p
):
10903 '''specparam_list : specparam '''
10905 print('specparam_list_1', list(p
))
10911 def p_specparam_list_2(p
):
10912 '''specparam_list : specparam_list ',' specparam '''
10914 print('specparam_list_2', list(p
))
10920 def p_specparam_decl_1(p
):
10921 '''specparam_decl : specparam_list '''
10923 print('specparam_decl_1', list(p
))
10929 def p_specparam_decl_2(p
):
10930 '''specparam_decl : dimensions _embed0_specparam_decl specparam_list '''
10932 print('specparam_decl_2', list(p
))
10934 # { param_active_range = 0; }
10938 def p__embed0_specparam_decl(p
):
10939 '''_embed0_specparam_decl : '''
10941 # { param_active_range = p[1]; }
10945 def p_spec_polarity_1(p
):
10946 '''spec_polarity : '+' '''
10948 print('spec_polarity_1', list(p
))
10954 def p_spec_polarity_2(p
):
10955 '''spec_polarity : '-' '''
10957 print('spec_polarity_2', list(p
))
10963 def p_spec_polarity_3(p
):
10964 '''spec_polarity : '''
10966 print('spec_polarity_3', list(p
))
10972 def p_spec_reference_event_1(p
):
10973 '''spec_reference_event : K_posedge expression '''
10975 print('spec_reference_event_1', list(p
))
10981 def p_spec_reference_event_2(p
):
10982 '''spec_reference_event : K_negedge expression '''
10984 print('spec_reference_event_2', list(p
))
10990 def p_spec_reference_event_3(p
):
10991 '''spec_reference_event : K_posedge expr_primary K_TAND expression '''
10993 print('spec_reference_event_3', list(p
))
11001 def p_spec_reference_event_4(p
):
11002 '''spec_reference_event : K_negedge expr_primary K_TAND expression '''
11004 print('spec_reference_event_4', list(p
))
11012 def p_spec_reference_event_5(p
):
11013 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary '''
11015 print('spec_reference_event_5', list(p
))
11021 def p_spec_reference_event_6(p
):
11022 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression '''
11024 print('spec_reference_event_6', list(p
))
11032 def p_spec_reference_event_7(p
):
11033 '''spec_reference_event : expr_primary K_TAND expression '''
11035 print('spec_reference_event_7', list(p
))
11043 def p_spec_reference_event_8(p
):
11044 '''spec_reference_event : expr_primary '''
11046 print('spec_reference_event_8', list(p
))
11052 def p_edge_descriptor_list_1(p
):
11053 '''edge_descriptor_list : edge_descriptor_list ',' K_edge_descriptor '''
11055 print('edge_descriptor_list_1', list(p
))
11061 def p_edge_descriptor_list_2(p
):
11062 '''edge_descriptor_list : K_edge_descriptor '''
11064 print('edge_descriptor_list_2', list(p
))
11070 def p_spec_notifier_opt_1(p
):
11071 '''spec_notifier_opt : '''
11073 print('spec_notifier_opt_1', list(p
))
11079 def p_spec_notifier_opt_2(p
):
11080 '''spec_notifier_opt : spec_notifier '''
11082 print('spec_notifier_opt_2', list(p
))
11088 def p_spec_notifier_1(p
):
11089 '''spec_notifier : ',' '''
11091 print('spec_notifier_1', list(p
))
11093 # { args_after_notifier = 0; }
11097 def p_spec_notifier_2(p
):
11098 '''spec_notifier : ',' hierarchy_identifier '''
11100 print('spec_notifier_2', list(p
))
11102 # { args_after_notifier = 0; delete p[2]; }
11106 def p_spec_notifier_3(p
):
11107 '''spec_notifier : spec_notifier ',' '''
11109 print('spec_notifier_3', list(p
))
11111 # { args_after_notifier += 1; }
11115 def p_spec_notifier_4(p
):
11116 '''spec_notifier : spec_notifier ',' hierarchy_identifier '''
11118 print('spec_notifier_4', list(p
))
11120 # { args_after_notifier += 1;
11121 # if (args_after_notifier >= 3) {
11122 # cerr << @3 << ": warning: timing checks are not supported "
11123 # "and delayed signal \"" << *p[3]
11124 # << "\" will not be driven." << endl;
11130 def p_spec_notifier_5(p
):
11131 '''spec_notifier : IDENTIFIER '''
11133 print('spec_notifier_5', list(p
))
11135 # { args_after_notifier = 0; delete[]p[1]; }
11139 def p_statement_item_1(p
):
11140 '''statement_item : K_assign lpvalue '=' expression ';' '''
11142 print('statement_item_1', list(p
))
11144 # { PCAssign*tmp = new PCAssign(p[2], p[4]);
11145 # FILE_NAME(tmp, @1);
11151 def p_statement_item_2(p
):
11152 '''statement_item : K_deassign lpvalue ';' '''
11154 print('statement_item_2', list(p
))
11156 # { PDeassign*tmp = new PDeassign(p[2]);
11157 # FILE_NAME(tmp, @1);
11163 def p_statement_item_3(p
):
11164 '''statement_item : K_force lpvalue '=' expression ';' '''
11166 print('statement_item_3', list(p
))
11168 # { PForce*tmp = new PForce(p[2], p[4]);
11169 # FILE_NAME(tmp, @1);
11175 def p_statement_item_4(p
):
11176 '''statement_item : K_release lpvalue ';' '''
11178 print('statement_item_4', list(p
))
11180 # { PRelease*tmp = new PRelease(p[2]);
11181 # FILE_NAME(tmp, @1);
11187 def p_statement_item_5(p
):
11188 '''statement_item : K_begin K_end '''
11190 print('statement_item_5', list(p
))
11192 # { PBlock*tmp = new PBlock(PBlock::BL_SEQ);
11193 # FILE_NAME(tmp, @1);
11199 def p_statement_item_6(p
):
11200 '''statement_item : K_begin _embed0_statement_item block_item_decls_opt _embed1_statement_item statement_or_null_list K_end '''
11202 print('statement_item_6', list(p
))
11206 # pform_pop_scope();
11207 # assert(! current_block_stack.empty());
11208 # tmp = current_block_stack.top();
11209 # current_block_stack.pop();
11211 # tmp = new PBlock(PBlock::BL_SEQ);
11212 # FILE_NAME(tmp, @1);
11214 # if (p[5]) tmp->set_statement(*p[5]);
11221 def p_statement_item_7(p
):
11222 '''statement_item : K_begin ':' IDENTIFIER _embed2_statement_item block_item_decls_opt statement_or_null_list_opt K_end endlabel_opt '''
11224 print('statement_item_7', list(p
))
11226 # { pform_pop_scope();
11227 # assert(! current_block_stack.empty());
11228 # PBlock*tmp = current_block_stack.top();
11229 # current_block_stack.pop();
11230 # if (p[6]) tmp->set_statement(*p[6]);
11233 # if (strcmp(p[3],p[8]) != 0) {
11234 # yyerror(@8, "error: End label doesn't match begin name");
11236 # if (! gn_system_verilog()) {
11237 # yyerror(@8, "error: Begin end labels require "
11238 # "SystemVerilog.");
11248 def p_statement_item_8(p
):
11249 '''statement_item : K_fork join_keyword '''
11251 print('statement_item_8', list(p
))
11253 # { PBlock*tmp = new PBlock(p[2]);
11254 # FILE_NAME(tmp, @1);
11260 def p_statement_item_9(p
):
11261 '''statement_item : K_fork _embed3_statement_item block_item_decls_opt _embed4_statement_item statement_or_null_list join_keyword '''
11263 print('statement_item_9', list(p
))
11267 # pform_pop_scope();
11268 # assert(! current_block_stack.empty());
11269 # tmp = current_block_stack.top();
11270 # current_block_stack.pop();
11271 # tmp->set_join_type(p[6]);
11273 # tmp = new PBlock(p[6]);
11274 # FILE_NAME(tmp, @1);
11276 # if (p[5]) tmp->set_statement(*p[5]);
11283 def p_statement_item_10(p
):
11284 '''statement_item : K_fork ':' IDENTIFIER _embed5_statement_item block_item_decls_opt statement_or_null_list_opt join_keyword endlabel_opt '''
11286 print('statement_item_10', list(p
))
11288 # { pform_pop_scope();
11289 # assert(! current_block_stack.empty());
11290 # PBlock*tmp = current_block_stack.top();
11291 # current_block_stack.pop();
11292 # tmp->set_join_type(p[7]);
11293 # if (p[6]) tmp->set_statement(*p[6]);
11296 # if (strcmp(p[3],p[8]) != 0) {
11297 # yyerror(@8, "error: End label doesn't match fork name");
11299 # if (! gn_system_verilog()) {
11300 # yyerror(@8, "error: Fork end labels require "
11301 # "SystemVerilog.");
11311 def p_statement_item_11(p
):
11312 '''statement_item : K_disable hierarchy_identifier ';' '''
11314 print('statement_item_11', list(p
))
11316 # { PDisable*tmp = new PDisable(*p[2]);
11317 # FILE_NAME(tmp, @1);
11324 def p_statement_item_12(p
):
11325 '''statement_item : K_disable K_fork ';' '''
11327 print('statement_item_12', list(p
))
11329 # { pform_name_t tmp_name;
11330 # PDisable*tmp = new PDisable(tmp_name);
11331 # FILE_NAME(tmp, @1);
11337 def p_statement_item_13(p
):
11338 '''statement_item : K_TRIGGER hierarchy_identifier ';' '''
11340 print('statement_item_13', list(p
))
11342 # { PTrigger*tmp = new PTrigger(*p[2]);
11343 # FILE_NAME(tmp, @1);
11350 def p_statement_item_14(p
):
11351 '''statement_item : procedural_assertion_statement '''
11353 print('statement_item_14', list(p
))
11360 def p_statement_item_15(p
):
11361 '''statement_item : loop_statement '''
11363 print('statement_item_15', list(p
))
11370 def p_statement_item_16(p
):
11371 '''statement_item : jump_statement '''
11373 print('statement_item_16', list(p
))
11380 def p_statement_item_17(p
):
11381 '''statement_item : K_case '(' expression ')' case_items K_endcase '''
11383 print('statement_item_17', list(p
))
11385 # { PCase*tmp = new PCase(NetCase::EQ, p[3], p[5]);
11386 # FILE_NAME(tmp, @1);
11392 def p_statement_item_18(p
):
11393 '''statement_item : K_casex '(' expression ')' case_items K_endcase '''
11395 print('statement_item_18', list(p
))
11397 # { PCase*tmp = new PCase(NetCase::EQX, p[3], p[5]);
11398 # FILE_NAME(tmp, @1);
11404 def p_statement_item_19(p
):
11405 '''statement_item : K_casez '(' expression ')' case_items K_endcase '''
11407 print('statement_item_19', list(p
))
11409 # { PCase*tmp = new PCase(NetCase::EQZ, p[3], p[5]);
11410 # FILE_NAME(tmp, @1);
11416 def p_statement_item_20(p
):
11417 '''statement_item : K_case '(' expression ')' error K_endcase '''
11419 print('statement_item_20', list(p
))
11425 def p_statement_item_21(p
):
11426 '''statement_item : K_casex '(' expression ')' error K_endcase '''
11428 print('statement_item_21', list(p
))
11434 def p_statement_item_22(p
):
11435 '''statement_item : K_casez '(' expression ')' error K_endcase '''
11437 print('statement_item_22', list(p
))
11443 def p_statement_item_23(p
):
11444 '''statement_item : K_if '(' expression ')' statement_or_null %prec less_than_K_else '''
11446 print('statement_item_23', list(p
))
11448 # { PCondit*tmp = new PCondit(p[3], p[5], 0);
11449 # FILE_NAME(tmp, @1);
11455 def p_statement_item_24(p
):
11456 '''statement_item : K_if '(' expression ')' statement_or_null K_else statement_or_null '''
11458 print('statement_item_24', list(p
))
11460 # { PCondit*tmp = new PCondit(p[3], p[5], p[7]);
11461 # FILE_NAME(tmp, @1);
11467 def p_statement_item_25(p
):
11468 '''statement_item : K_if '(' error ')' statement_or_null %prec less_than_K_else '''
11470 print('statement_item_25', list(p
))
11472 # { yyerror(@1, "error: Malformed conditional expression.");
11478 def p_statement_item_26(p
):
11479 '''statement_item : K_if '(' error ')' statement_or_null K_else statement_or_null '''
11481 print('statement_item_26', list(p
))
11483 # { yyerror(@1, "error: Malformed conditional expression.");
11489 def p_statement_item_27(p
):
11490 '''statement_item : compressed_statement ';' '''
11492 print('statement_item_27', list(p
))
11499 def p_statement_item_28(p
):
11500 '''statement_item : inc_or_dec_expression ';' '''
11502 print('statement_item_28', list(p
))
11504 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
11508 def p_statement_item_29(p
):
11509 '''statement_item : delay1 statement_or_null '''
11511 print('statement_item_29', list(p
))
11513 # { PExpr*del = p[1]->front();
11514 # assert(p[1]->size() == 1);
11516 # PDelayStatement*tmp = new PDelayStatement(del, p[2]);
11517 # FILE_NAME(tmp, @1);
11523 def p_statement_item_30(p
):
11524 '''statement_item : event_control statement_or_null '''
11526 print('statement_item_30', list(p
))
11528 # { PEventStatement*tmp = p[1];
11530 # yyerror(@1, "error: Invalid event control.");
11533 # tmp->set_statement(p[2]);
11540 def p_statement_item_31(p
):
11541 '''statement_item : '@' '*' statement_or_null '''
11543 print('statement_item_31', list(p
))
11545 # { PEventStatement*tmp = new PEventStatement;
11546 # FILE_NAME(tmp, @1);
11547 # tmp->set_statement(p[3]);
11553 def p_statement_item_32(p
):
11554 '''statement_item : '@' '(' '*' ')' statement_or_null '''
11556 print('statement_item_32', list(p
))
11558 # { PEventStatement*tmp = new PEventStatement;
11559 # FILE_NAME(tmp, @1);
11560 # tmp->set_statement(p[5]);
11566 def p_statement_item_33(p
):
11567 '''statement_item : lpvalue '=' expression ';' '''
11569 print('statement_item33', list(p
))
11571 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), p
[3]])
11573 print("expr TODO", repr(expr
))
11575 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), ])
11577 print("expr", repr(expr
))
11579 print("expr (python):'%s'" % expr
)
11582 # { PAssign*tmp = new PAssign(p[1],p[3]);
11583 # FILE_NAME(tmp, @1);
11589 def p_statement_item_34(p
):
11590 '''statement_item : error '=' expression ';' '''
11592 print('statement_item_34', list(p
))
11594 # { yyerror(@2, "Syntax in assignment statement l-value.");
11596 # p[0] = new PNoop;
11601 def p_statement_item_35(p
):
11602 '''statement_item : lpvalue K_LE expression ';' '''
11604 print('statement_item_35', list(p
))
11606 # { PAssignNB*tmp = new PAssignNB(p[1],p[3]);
11607 # FILE_NAME(tmp, @1);
11613 def p_statement_item_36(p
):
11614 '''statement_item : error K_LE expression ';' '''
11616 print('statement_item_36', list(p
))
11618 # { yyerror(@2, "Syntax in assignment statement l-value.");
11620 # p[0] = new PNoop;
11625 def p_statement_item_37(p
):
11626 '''statement_item : lpvalue '=' delay1 expression ';' '''
11628 print('statement_item_37', list(p
))
11630 # { PExpr*del = p[3]->front(); p[3]->pop_front();
11631 # assert(p[3]->empty());
11632 # PAssign*tmp = new PAssign(p[1],del,p[4]);
11633 # FILE_NAME(tmp, @1);
11639 def p_statement_item_38(p
):
11640 '''statement_item : lpvalue K_LE delay1 expression ';' '''
11642 print('statement_item_38', list(p
))
11644 # { PExpr*del = p[3]->front(); p[3]->pop_front();
11645 # assert(p[3]->empty());
11646 # PAssignNB*tmp = new PAssignNB(p[1],del,p[4]);
11647 # FILE_NAME(tmp, @1);
11653 def p_statement_item_39(p
):
11654 '''statement_item : lpvalue '=' event_control expression ';' '''
11656 print('statement_item_39', list(p
))
11658 # { PAssign*tmp = new PAssign(p[1],0,p[3],p[4]);
11659 # FILE_NAME(tmp, @1);
11665 def p_statement_item_40(p
):
11666 '''statement_item : lpvalue '=' K_repeat '(' expression ')' event_control expression ';' '''
11668 print('statement_item_40', list(p
))
11670 # { PAssign*tmp = new PAssign(p[1],p[5],p[7],p[8]);
11671 # FILE_NAME(tmp,@1);
11672 # tmp->set_lineno(@1.first_line);
11678 def p_statement_item_41(p
):
11679 '''statement_item : lpvalue K_LE event_control expression ';' '''
11681 print('statement_item_41', list(p
))
11683 # { PAssignNB*tmp = new PAssignNB(p[1],0,p[3],p[4]);
11684 # FILE_NAME(tmp, @1);
11690 def p_statement_item_42(p
):
11691 '''statement_item : lpvalue K_LE K_repeat '(' expression ')' event_control expression ';' '''
11693 print('statement_item_42', list(p
))
11695 # { PAssignNB*tmp = new PAssignNB(p[1],p[5],p[7],p[8]);
11696 # FILE_NAME(tmp, @1);
11702 def p_statement_item_43(p
):
11703 '''statement_item : lpvalue '=' dynamic_array_new ';' '''
11705 print('statement_item_43', list(p
))
11707 # { PAssign*tmp = new PAssign(p[1],p[3]);
11708 # FILE_NAME(tmp, @1);
11714 def p_statement_item_44(p
):
11715 '''statement_item : lpvalue '=' class_new ';' '''
11717 print('statement_item_44', list(p
))
11719 # { PAssign*tmp = new PAssign(p[1],p[3]);
11720 # FILE_NAME(tmp, @1);
11726 def p_statement_item_45(p
):
11727 '''statement_item : K_wait '(' expression ')' statement_or_null '''
11729 print('statement_item_45', list(p
))
11731 # { PEventStatement*tmp;
11732 # PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, p[3]);
11733 # tmp = new PEventStatement(etmp);
11734 # FILE_NAME(tmp,@1);
11735 # tmp->set_statement(p[5]);
11741 def p_statement_item_46(p
):
11742 '''statement_item : K_wait K_fork ';' '''
11744 print('statement_item_46', list(p
))
11746 # { PEventStatement*tmp = new PEventStatement((PEEvent*)0);
11747 # FILE_NAME(tmp,@1);
11753 def p_statement_item_47(p
):
11754 '''statement_item : SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';' '''
11756 print('statement_item_47', list(p
))
11758 # { PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), *p[3]);
11759 # FILE_NAME(tmp,@1);
11767 def p_statement_item_48(p
):
11768 '''statement_item : SYSTEM_IDENTIFIER ';' '''
11770 print('statement_item_48', list(p
))
11772 # { list<PExpr*>pt;
11773 # PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), pt);
11774 # FILE_NAME(tmp,@1);
11781 def p_statement_item_49(p
):
11782 '''statement_item : hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
11784 print('statement_item_49', list(p
))
11786 # { PCallTask*tmp = pform_make_call_task(@1, *p[1], *p[3]);
11794 def p_statement_item_50(p
):
11795 '''statement_item : hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';' '''
11797 print('statement_item_50', list(p
))
11799 # { /* ....randomize with { <constraints> } */
11800 # if (p[1] && peek_tail_name(*p[1]) == "randomize") {
11801 # if (!gn_system_verilog())
11802 # yyerror(@2, "error: Randomize with constraint requires SystemVerilog.");
11804 # yyerror(@2, "sorry: Randomize with constraint not supported.");
11806 # yyerror(@2, "error: Constraint block can only be applied to randomize method.");
11809 # PCallTask*tmp = new PCallTask(*p[1], pt);
11810 # FILE_NAME(tmp, @1);
11817 def p_statement_item_51(p
):
11818 '''statement_item : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
11820 print('statement_item_51', list(p
))
11822 # { pform_name_t*t_name = p[1];
11823 # while (! p[3]->empty()) {
11824 # t_name->push_back(p[3]->front());
11825 # p[3]->pop_front();
11827 # PCallTask*tmp = new PCallTask(*t_name, *p[5]);
11828 # FILE_NAME(tmp, @1);
11837 def p_statement_item_52(p
):
11838 '''statement_item : hierarchy_identifier ';' '''
11840 print('statement_item_52', list(p
))
11842 # { list<PExpr*>pt;
11843 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
11850 def p_statement_item_53(p
):
11851 '''statement_item : implicit_class_handle '.' K_new '(' expression_list_with_nuls ')' ';' '''
11853 print('statement_item_53', list(p
))
11855 # { PChainConstructor*tmp = new PChainConstructor(*p[5]);
11856 # FILE_NAME(tmp, @3);
11863 def p_statement_item_54(p
):
11864 '''statement_item : hierarchy_identifier '(' error ')' ';' '''
11866 print('statement_item_54', list(p
))
11868 # { yyerror(@3, "error: Syntax error in task arguments.");
11870 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
11877 def p_statement_item_55(p
):
11878 '''statement_item : error ';' '''
11880 print('statement_item_55', list(p
))
11882 # { yyerror(@2, "error: malformed statement");
11884 # p[0] = new PNoop;
11889 def p__embed0_statement_item(p
):
11890 '''_embed0_statement_item : '''
11892 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_SEQ);
11893 # FILE_NAME(tmp, @1);
11894 # current_block_stack.push(tmp);
11899 def p__embed1_statement_item(p
):
11900 '''_embed1_statement_item : '''
11903 # if (! gn_system_verilog()) {
11904 # yyerror("error: Variable declaration in unnamed block "
11905 # "requires SystemVerilog.");
11908 # /* If there are no declarations in the scope then just delete it. */
11909 # pform_pop_scope();
11910 # assert(! current_block_stack.empty());
11911 # PBlock*tmp = current_block_stack.top();
11912 # current_block_stack.pop();
11919 def p__embed2_statement_item(p
):
11920 '''_embed2_statement_item : '''
11922 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_SEQ);
11923 # FILE_NAME(tmp, @1);
11924 # current_block_stack.push(tmp);
11929 def p__embed3_statement_item(p
):
11930 '''_embed3_statement_item : '''
11932 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
11933 # FILE_NAME(tmp, @1);
11934 # current_block_stack.push(tmp);
11939 def p__embed4_statement_item(p
):
11940 '''_embed4_statement_item : '''
11943 # if (! gn_system_verilog()) {
11944 # yyerror("error: Variable declaration in unnamed block "
11945 # "requires SystemVerilog.");
11948 # /* If there are no declarations in the scope then just delete it. */
11949 # pform_pop_scope();
11950 # assert(! current_block_stack.empty());
11951 # PBlock*tmp = current_block_stack.top();
11952 # current_block_stack.pop();
11959 def p__embed5_statement_item(p
):
11960 '''_embed5_statement_item : '''
11962 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_PAR);
11963 # FILE_NAME(tmp, @1);
11964 # current_block_stack.push(tmp);
11969 def p_compressed_statement_1(p
):
11970 '''compressed_statement : lpvalue K_PLUS_EQ expression '''
11972 print('compressed_statement_1', list(p
))
11974 # { PAssign*tmp = new PAssign(p[1], '+', p[3]);
11975 # FILE_NAME(tmp, @1);
11981 def p_compressed_statement_2(p
):
11982 '''compressed_statement : lpvalue K_MINUS_EQ expression '''
11984 print('compressed_statement_2', list(p
))
11986 # { PAssign*tmp = new PAssign(p[1], '-', p[3]);
11987 # FILE_NAME(tmp, @1);
11993 def p_compressed_statement_3(p
):
11994 '''compressed_statement : lpvalue K_MUL_EQ expression '''
11996 print('compressed_statement_3', list(p
))
11998 # { PAssign*tmp = new PAssign(p[1], '*', p[3]);
11999 # FILE_NAME(tmp, @1);
12005 def p_compressed_statement_4(p
):
12006 '''compressed_statement : lpvalue K_DIV_EQ expression '''
12008 print('compressed_statement_4', list(p
))
12010 # { PAssign*tmp = new PAssign(p[1], '/', p[3]);
12011 # FILE_NAME(tmp, @1);
12017 def p_compressed_statement_5(p
):
12018 '''compressed_statement : lpvalue K_MOD_EQ expression '''
12020 print('compressed_statement_5', list(p
))
12022 # { PAssign*tmp = new PAssign(p[1], '%', p[3]);
12023 # FILE_NAME(tmp, @1);
12029 def p_compressed_statement_6(p
):
12030 '''compressed_statement : lpvalue K_AND_EQ expression '''
12032 print('compressed_statement_6', list(p
))
12034 # { PAssign*tmp = new PAssign(p[1], '&', p[3]);
12035 # FILE_NAME(tmp, @1);
12041 def p_compressed_statement_7(p
):
12042 '''compressed_statement : lpvalue K_OR_EQ expression '''
12044 print('compressed_statement_7', list(p
))
12046 # { PAssign*tmp = new PAssign(p[1], '|', p[3]);
12047 # FILE_NAME(tmp, @1);
12053 def p_compressed_statement_8(p
):
12054 '''compressed_statement : lpvalue K_XOR_EQ expression '''
12056 print('compressed_statement_8', list(p
))
12058 # { PAssign*tmp = new PAssign(p[1], '^', p[3]);
12059 # FILE_NAME(tmp, @1);
12065 def p_compressed_statement_9(p
):
12066 '''compressed_statement : lpvalue K_LS_EQ expression '''
12068 print('compressed_statement_9', list(p
))
12070 # { PAssign *tmp = new PAssign(p[1], 'l', p[3]);
12071 # FILE_NAME(tmp, @1);
12077 def p_compressed_statement_10(p
):
12078 '''compressed_statement : lpvalue K_RS_EQ expression '''
12080 print('compressed_statement_10', list(p
))
12082 # { PAssign*tmp = new PAssign(p[1], 'r', p[3]);
12083 # FILE_NAME(tmp, @1);
12089 def p_compressed_statement_11(p
):
12090 '''compressed_statement : lpvalue K_RSS_EQ expression '''
12092 print('compressed_statement_11', list(p
))
12094 # { PAssign *tmp = new PAssign(p[1], 'R', p[3]);
12095 # FILE_NAME(tmp, @1);
12101 def p_statement_or_null_list_opt_1(p
):
12102 '''statement_or_null_list_opt : statement_or_null_list '''
12104 print('statement_or_null_list_opt_1', list(p
))
12111 def p_statement_or_null_list_opt_2(p
):
12112 '''statement_or_null_list_opt : '''
12114 print('statement_or_null_list_opt_2', list(p
))
12120 def p_statement_or_null_list_1(p
):
12121 '''statement_or_null_list : statement_or_null_list statement_or_null '''
12123 print('statement_or_null_list_1', list(p
))
12125 # { vector<Statement*>*tmp = p[1];
12126 # if (p[2]) tmp->push_back(p[2]);
12132 def p_statement_or_null_list_2(p
):
12133 '''statement_or_null_list : statement_or_null '''
12135 print('statement_or_null_list_2', list(p
))
12137 # { vector<Statement*>*tmp = new vector<Statement*>(0);
12138 # if (p[1]) tmp->push_back(p[1]);
12144 def p_analog_statement_1(p
):
12145 '''analog_statement : branch_probe_expression K_CONTRIBUTE expression ';' '''
12147 print('analog_statement_1', list(p
))
12149 # { p[0] = pform_contribution_statement(@2, p[1], p[3]); }
12153 def p_task_item_1(p
):
12154 '''task_item : block_item_decl '''
12156 print('task_item_1', list(p
))
12158 # { p[0] = new vector<pform_tf_port_t>(0); }
12162 def p_task_item_2(p
):
12163 '''task_item : tf_port_declaration '''
12165 print('task_item_2', list(p
))
12172 def p_task_item_list_1(p
):
12173 '''task_item_list : task_item_list task_item '''
12175 print('task_item_list_1', list(p
))
12177 # { vector<pform_tf_port_t>*tmp = p[1];
12178 # size_t s1 = tmp->size();
12179 # tmp->resize(s1 + p[2]->size());
12180 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
12181 # tmp->at(s1 + idx) = p[2]->at(idx);
12188 def p_task_item_list_2(p
):
12189 '''task_item_list : task_item '''
12191 print('task_item_list_2', list(p
))
12198 def p_task_item_list_opt_1(p
):
12199 '''task_item_list_opt : task_item_list '''
12201 print('task_item_list_opt_1', list(p
))
12208 def p_task_item_list_opt_2(p
):
12209 '''task_item_list_opt : '''
12211 print('task_item_list_opt_2', list(p
))
12217 def p_tf_port_list_opt_1(p
):
12218 '''tf_port_list_opt : tf_port_list '''
12220 print('tf_port_list_opt_1', list(p
))
12227 def p_tf_port_list_opt_2(p
):
12228 '''tf_port_list_opt : '''
12230 print('tf_port_list_opt_2', list(p
))
12236 def p_udp_body_1(p
):
12237 '''udp_body : K_table udp_entry_list K_endtable '''
12239 print('udp_body_1', list(p
))
12241 # { lex_end_table();
12247 def p_udp_body_2(p
):
12248 '''udp_body : K_table K_endtable '''
12250 print('udp_body_2', list(p
))
12252 # { lex_end_table();
12253 # yyerror(@1, "error: Empty UDP table.");
12259 def p_udp_body_3(p
):
12260 '''udp_body : K_table error K_endtable '''
12262 print('udp_body_3', list(p
))
12264 # { lex_end_table();
12265 # yyerror(@2, "Errors in UDP table");
12272 def p_udp_entry_list_1(p
):
12273 '''udp_entry_list : udp_comb_entry_list '''
12275 print('udp_entry_list_1', list(p
))
12281 def p_udp_entry_list_2(p
):
12282 '''udp_entry_list : udp_sequ_entry_list '''
12284 print('udp_entry_list_2', list(p
))
12290 def p_udp_comb_entry_1(p
):
12291 '''udp_comb_entry : udp_input_list ':' udp_output_sym ';' '''
12293 print('udp_comb_entry_1', list(p
))
12295 # { char*tmp = new char[strlen(p[1])+3];
12296 # strcpy(tmp, p[1]);
12297 # char*tp = tmp+strlen(tmp);
12307 def p_udp_comb_entry_list_1(p
):
12308 '''udp_comb_entry_list : udp_comb_entry '''
12310 print('udp_comb_entry_list_1', list(p
))
12312 # { list<string>*tmp = new list<string>;
12313 # tmp->push_back(p[1]);
12320 def p_udp_comb_entry_list_2(p
):
12321 '''udp_comb_entry_list : udp_comb_entry_list udp_comb_entry '''
12323 print('udp_comb_entry_list_2', list(p
))
12325 # { list<string>*tmp = p[1];
12326 # tmp->push_back(p[2]);
12333 def p_udp_sequ_entry_list_1(p
):
12334 '''udp_sequ_entry_list : udp_sequ_entry '''
12336 print('udp_sequ_entry_list_1', list(p
))
12338 # { list<string>*tmp = new list<string>;
12339 # tmp->push_back(p[1]);
12346 def p_udp_sequ_entry_list_2(p
):
12347 '''udp_sequ_entry_list : udp_sequ_entry_list udp_sequ_entry '''
12349 print('udp_sequ_entry_list_2', list(p
))
12351 # { list<string>*tmp = p[1];
12352 # tmp->push_back(p[2]);
12359 def p_udp_sequ_entry_1(p
):
12360 '''udp_sequ_entry : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' '''
12362 print('udp_sequ_entry_1', list(p
))
12364 # { char*tmp = new char[strlen(p[1])+5];
12365 # strcpy(tmp, p[1]);
12366 # char*tp = tmp+strlen(tmp);
12377 def p_udp_initial_1(p
):
12378 '''udp_initial : K_initial IDENTIFIER '=' number ';' '''
12380 print('udp_initial_1', list(p
))
12382 # { PExpr*etmp = new PENumber(p[4]);
12383 # PEIdent*itmp = new PEIdent(lex_strings.make(p[2]));
12384 # PAssign*atmp = new PAssign(itmp, etmp);
12385 # FILE_NAME(atmp, @2);
12392 def p_udp_init_opt_1(p
):
12393 '''udp_init_opt : udp_initial '''
12395 print('udp_init_opt_1', list(p
))
12402 def p_udp_init_opt_2(p
):
12403 '''udp_init_opt : '''
12405 print('udp_init_opt_2', list(p
))
12411 def p_udp_input_list_1(p
):
12412 '''udp_input_list : udp_input_sym '''
12414 print('udp_input_list_1', list(p
))
12416 # { char*tmp = new char[2];
12424 def p_udp_input_list_2(p
):
12425 '''udp_input_list : udp_input_list udp_input_sym '''
12427 print('udp_input_list_2', list(p
))
12429 # { char*tmp = new char[strlen(p[1])+2];
12430 # strcpy(tmp, p[1]);
12431 # char*tp = tmp+strlen(tmp);
12440 def p_udp_input_sym_1(p
):
12441 '''udp_input_sym : '0' '''
12443 print('udp_input_sym_1', list(p
))
12449 def p_udp_input_sym_2(p
):
12450 '''udp_input_sym : '1' '''
12452 print('udp_input_sym_2', list(p
))
12458 def p_udp_input_sym_3(p
):
12459 '''udp_input_sym : 'x' '''
12461 print('udp_input_sym_3', list(p
))
12467 def p_udp_input_sym_4(p
):
12468 '''udp_input_sym : '?' '''
12470 print('udp_input_sym_4', list(p
))
12476 def p_udp_input_sym_5(p
):
12477 '''udp_input_sym : 'b' '''
12479 print('udp_input_sym_5', list(p
))
12485 def p_udp_input_sym_6(p
):
12486 '''udp_input_sym : '*' '''
12488 print('udp_input_sym_6', list(p
))
12494 def p_udp_input_sym_7(p
):
12495 '''udp_input_sym : '%' '''
12497 print('udp_input_sym_7', list(p
))
12503 def p_udp_input_sym_8(p
):
12504 '''udp_input_sym : 'f' '''
12506 print('udp_input_sym_8', list(p
))
12512 def p_udp_input_sym_9(p
):
12513 '''udp_input_sym : 'F' '''
12515 print('udp_input_sym_9', list(p
))
12521 def p_udp_input_sym_10(p
):
12522 '''udp_input_sym : 'l' '''
12524 print('udp_input_sym_10', list(p
))
12530 def p_udp_input_sym_11(p
):
12531 '''udp_input_sym : 'h' '''
12533 print('udp_input_sym_11', list(p
))
12539 def p_udp_input_sym_12(p
):
12540 '''udp_input_sym : 'B' '''
12542 print('udp_input_sym_12', list(p
))
12548 def p_udp_input_sym_13(p
):
12549 '''udp_input_sym : 'r' '''
12551 print('udp_input_sym_13', list(p
))
12557 def p_udp_input_sym_14(p
):
12558 '''udp_input_sym : 'R' '''
12560 print('udp_input_sym_14', list(p
))
12566 def p_udp_input_sym_15(p
):
12567 '''udp_input_sym : 'M' '''
12569 print('udp_input_sym_15', list(p
))
12575 def p_udp_input_sym_16(p
):
12576 '''udp_input_sym : 'n' '''
12578 print('udp_input_sym_16', list(p
))
12584 def p_udp_input_sym_17(p
):
12585 '''udp_input_sym : 'N' '''
12587 print('udp_input_sym_17', list(p
))
12593 def p_udp_input_sym_18(p
):
12594 '''udp_input_sym : 'p' '''
12596 print('udp_input_sym_18', list(p
))
12602 def p_udp_input_sym_19(p
):
12603 '''udp_input_sym : 'P' '''
12605 print('udp_input_sym_19', list(p
))
12611 def p_udp_input_sym_20(p
):
12612 '''udp_input_sym : 'Q' '''
12614 print('udp_input_sym_20', list(p
))
12620 def p_udp_input_sym_21(p
):
12621 '''udp_input_sym : 'q' '''
12623 print('udp_input_sym_21', list(p
))
12629 def p_udp_input_sym_22(p
):
12630 '''udp_input_sym : '_' '''
12632 print('udp_input_sym_22', list(p
))
12638 def p_udp_input_sym_23(p
):
12639 '''udp_input_sym : '+' '''
12641 print('udp_input_sym_23', list(p
))
12647 def p_udp_input_sym_24(p
):
12648 '''udp_input_sym : DEC_NUMBER '''
12650 print('udp_input_sym_24', list(p
))
12652 # { yyerror(@1, "internal error: Input digits parse as decimal number!"); p[0] = '0'; }
12656 def p_udp_output_sym_1(p
):
12657 '''udp_output_sym : '0' '''
12659 print('udp_output_sym_1', list(p
))
12665 def p_udp_output_sym_2(p
):
12666 '''udp_output_sym : '1' '''
12668 print('udp_output_sym_2', list(p
))
12674 def p_udp_output_sym_3(p
):
12675 '''udp_output_sym : 'x' '''
12677 print('udp_output_sym_3', list(p
))
12683 def p_udp_output_sym_4(p
):
12684 '''udp_output_sym : '-' '''
12686 print('udp_output_sym_4', list(p
))
12692 def p_udp_output_sym_5(p
):
12693 '''udp_output_sym : DEC_NUMBER '''
12695 print('udp_output_sym_5', list(p
))
12697 # { yyerror(@1, "internal error: Output digits parse as decimal number!"); p[0] = '0'; }
12701 def p_udp_port_decl_1(p
):
12702 '''udp_port_decl : K_input list_of_identifiers ';' '''
12704 print('udp_port_decl_1', list(p
))
12706 # { p[0] = pform_make_udp_input_ports(p[2]); }
12710 def p_udp_port_decl_2(p
):
12711 '''udp_port_decl : K_output IDENTIFIER ';' '''
12713 print('udp_port_decl_2', list(p
))
12715 # { perm_string pname = lex_strings.make(p[2]);
12716 # PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
12717 # vector<PWire*>*tmp = new vector<PWire*>(1);
12725 def p_udp_port_decl_3(p
):
12726 '''udp_port_decl : K_reg IDENTIFIER ';' '''
12728 print('udp_port_decl_3', list(p
))
12730 # { perm_string pname = lex_strings.make(p[2]);
12731 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
12732 # vector<PWire*>*tmp = new vector<PWire*>(1);
12740 def p_udp_port_decl_4(p
):
12741 '''udp_port_decl : K_reg K_output IDENTIFIER ';' '''
12743 print('udp_port_decl_4', list(p
))
12745 # { perm_string pname = lex_strings.make(p[3]);
12746 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
12747 # vector<PWire*>*tmp = new vector<PWire*>(1);
12755 def p_udp_port_decls_1(p
):
12756 '''udp_port_decls : udp_port_decl '''
12758 print('udp_port_decls_1', list(p
))
12765 def p_udp_port_decls_2(p
):
12766 '''udp_port_decls : udp_port_decls udp_port_decl '''
12768 print('udp_port_decls_2', list(p
))
12770 # { vector<PWire*>*tmp = p[1];
12771 # size_t s1 = p[1]->size();
12772 # tmp->resize(s1+p[2]->size());
12773 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
12774 # tmp->at(s1+idx) = p[2]->at(idx);
12781 def p_udp_port_list_1(p
):
12782 '''udp_port_list : IDENTIFIER '''
12784 print('udp_port_list_1', list(p
))
12786 # { list<perm_string>*tmp = new list<perm_string>;
12787 # tmp->push_back(lex_strings.make(p[1]));
12794 def p_udp_port_list_2(p
):
12795 '''udp_port_list : udp_port_list ',' IDENTIFIER '''
12797 print('udp_port_list_2', list(p
))
12799 # { list<perm_string>*tmp = p[1];
12800 # tmp->push_back(lex_strings.make(p[3]));
12807 def p_udp_reg_opt_1(p
):
12808 '''udp_reg_opt : K_reg '''
12810 print('udp_reg_opt_1', list(p
))
12817 def p_udp_reg_opt_2(p
):
12818 '''udp_reg_opt : '''
12820 print('udp_reg_opt_2', list(p
))
12827 def p_udp_initial_expr_opt_1(p
):
12828 '''udp_initial_expr_opt : '=' expression '''
12830 print('udp_initial_expr_opt_1', list(p
))
12837 def p_udp_initial_expr_opt_2(p
):
12838 '''udp_initial_expr_opt : '''
12840 print('udp_initial_expr_opt_2', list(p
))
12846 def p_udp_input_declaration_list_1(p
):
12847 '''udp_input_declaration_list : K_input IDENTIFIER '''
12849 print('udp_input_declaration_list_1', list(p
))
12851 # { list<perm_string>*tmp = new list<perm_string>;
12852 # tmp->push_back(lex_strings.make(p[2]));
12859 def p_udp_input_declaration_list_2(p
):
12860 '''udp_input_declaration_list : udp_input_declaration_list ',' K_input IDENTIFIER '''
12862 print('udp_input_declaration_list_2', list(p
))
12864 # { list<perm_string>*tmp = p[1];
12865 # tmp->push_back(lex_strings.make(p[4]));
12872 def p_udp_primitive_1(p
):
12873 '''udp_primitive : K_primitive IDENTIFIER '(' udp_port_list ')' ';' udp_port_decls udp_init_opt udp_body K_endprimitive endlabel_opt '''
12875 print('udp_primitive_1', list(p
))
12877 # { perm_string tmp2 = lex_strings.make(p[2]);
12878 # pform_make_udp(tmp2, p[4], p[7], p[9], p[8],
12879 # @2.text, @2.first_line);
12881 # if (strcmp(p[2],p[11]) != 0) {
12882 # yyerror(@11, "error: End label doesn't match "
12883 # "primitive name");
12885 # if (! gn_system_verilog()) {
12886 # yyerror(@11, "error: Primitive end labels "
12887 # "require SystemVerilog.");
12896 def p_udp_primitive_2(p
):
12897 '''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 '''
12899 print('udp_primitive_2', list(p
))
12901 # { perm_string tmp2 = lex_strings.make(p[2]);
12902 # perm_string tmp6 = lex_strings.make(p[6]);
12903 # pform_make_udp(tmp2, p[5], tmp6, p[7], p[9], p[12],
12904 # @2.text, @2.first_line);
12906 # if (strcmp(p[2],p[14]) != 0) {
12907 # yyerror(@14, "error: End label doesn't match "
12908 # "primitive name");
12910 # if (! gn_system_verilog()) {
12911 # yyerror(@14, "error: Primitive end labels "
12912 # "require SystemVerilog.");
12922 def p_K_packed_opt_1(p
):
12923 '''K_packed_opt : K_packed '''
12925 print('K_packed_opt', list(p
))
12932 def p_K_packed_opt_2(p
):
12933 '''K_packed_opt : '''
12935 print('K_packed_opt', list(p
))
12942 def p_K_reg_opt_1(p
):
12943 '''K_reg_opt : K_reg '''
12945 print('K_reg_opt', list(p
))
12952 def p_K_reg_opt_2(p
):
12955 print('K_reg_opt', list(p
))
12962 def p_K_static_opt_1(p
):
12963 '''K_static_opt : K_static '''
12965 print('K_static_opt', list(p
))
12972 def p_K_static_opt_2(p
):
12973 '''K_static_opt : '''
12975 print('K_static_opt', list(p
))
12982 def p_K_virtual_opt_1(p
):
12983 '''K_virtual_opt : K_virtual '''
12992 def p_K_virtual_opt_2(p
):
12993 '''K_virtual_opt : '''