2591398add2dc8109d7ac85c201f3b497c21b2bd
3 # * Copyright (c) 1998-2017 Stephen Williams (steve@icarus.com)
4 # * Copyright CERN 2012-2013 / Stephen Williams (steve@icarus.com)
6 # * This source code is free software; you can redistribute it
7 # * and/or modify it in source code form under the terms of the GNU
8 # * General Public License as published by the Free Software
9 # * Foundation; either version 2 of the License, or (at your option)
10 # * any later version.
12 # * This program is distributed in the hope that it will be useful,
13 # * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # * GNU General Public License for more details.
17 # * You should have received a copy of the GNU General Public License
18 # * along with this program; if not, write to the Free Software
19 # * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 from ply
import yacc
, lex
24 from lib2to3
.pytree
import Node
, Leaf
25 from lib2to3
.pgen2
import token
26 from lib2to3
.pygram
import python_symbols
as syms
33 #from parse_tokens import tokens
34 tokens
= lexor
.tokens
# list(set(lexor.tokens).union(set(tokens)))
35 literals
= lexor
.literals
38 ('right', 'K_PLUS_EQ', 'K_MINUS_EQ', 'K_MUL_EQ', 'K_DIV_EQ',
39 'K_MOD_EQ', 'K_AND_EQ', 'K_OR_EQ'),
40 ('right', 'K_XOR_EQ', 'K_LS_EQ', 'K_RS_EQ', 'K_RSS_EQ'),
41 ('right', '?', ':', 'K_inside'),
45 ('left', '^', 'K_NXOR', 'K_NOR'),
46 ('left', '&', 'K_NAND'),
47 ('left', 'K_EQ', 'K_NE', 'K_CEQ', 'K_CNE', 'K_WEQ', 'K_WNE'),
48 ('left', 'K_GE', 'K_LE', '<', '>'),
49 ('left', 'K_LS', 'K_RS', 'K_RSS'),
51 ('left', '*', '/', '%'),
53 ('left', 'UNARY_PREC'),
54 ('nonassoc', 'less_than_K_else'),
55 ('nonassoc', 'K_else'),
57 ('nonassoc', 'K_exclude'),
58 ('nonassoc', 'no_timeunits_declaration'),
59 ('nonassoc', 'one_timeunits_declaration'),
60 ('nonassoc', 'K_timeunit', 'K_timeprecision')
64 IVL_VT_NO_TYPE
= 'VT_NO_TYPE'
65 IVL_VT_BOOL
= 'VT_BOOL'
66 IVL_VT_LOGIC
= 'VT_LOGIC'
68 IVL_VT_VOID = 0, /* Not used */
69 IVL_VT_NO_TYPE = 1, /* Place holder for missing/unknown type. */
74 IVL_VT_DARRAY = 6, /* Array (esp. dynamic array) */
75 IVL_VT_CLASS = 7, /* SystemVerilog class instances */
76 IVL_VT_QUEUE = 8, /* SystemVerilog queue instances */
77 IVL_VT_VECTOR = IVL_VT_LOGIC /* For compatibility */
81 NN_IMPLICIT
= 'IMPLICIT'
82 NN_IMPLICIT_REG
= 'IMPLICIT_REG'
83 NN_INTEGER
= 'INTEGER'
87 NN_SUPPLY0
= 'SUPPLY0'
88 NN_SUPPLY1
= 'SUPPLY1'
95 NN_UNRESOLVED_WIRE
= 'UNRESOLVED_WIRE'
97 NP_NOT_A_PORT
= 'NOT_A_PORT'
98 NP_PIMPLICIT
= 'PIMPLICIT'
100 NP_POUTPUT
= 'POUTPUT'
106 def __init__(self
, typ
, signed
):
115 def add_statement(self
, s
):
116 self
.statements
+= [s
]
119 # -------------- RULES ----------------
123 def p_source_text_1(p
):
124 '''source_text : timeunits_declaration_opt _embed0_source_text description_list '''
126 print('source_text', list(p
))
132 def p_source_text_2(p
):
135 print('source_text', list(p
))
141 def p__embed0_source_text(p
):
142 '''_embed0_source_text : '''
144 # { pform_set_scope_timescale(yyloc); }
148 def p_assertion_item_1(p
):
149 '''assertion_item : concurrent_assertion_item '''
151 print('assertion_item_1', list(p
))
157 def p_assignment_pattern_1(p
):
158 '''assignment_pattern : K_LP expression_list_proper '}' '''
160 print('assignment_pattern_1', list(p
))
162 # { PEAssignPattern*tmp = new PEAssignPattern(*p[2]);
163 # FILE_NAME(tmp, @1);
170 def p_assignment_pattern_2(p
):
171 '''assignment_pattern : K_LP '}' '''
173 print('assignment_pattern_2', list(p
))
175 # { PEAssignPattern*tmp = new PEAssignPattern;
176 # FILE_NAME(tmp, @1);
182 def p_block_identifier_opt_1(p
):
183 '''block_identifier_opt : IDENTIFIER ':' '''
185 print('block_identifier_opt_1', list(p
))
191 def p_block_identifier_opt_2(p
):
192 '''block_identifier_opt : '''
194 print('block_identifier_opt_2', list(p
))
200 def p_class_declaration_1(p
):
201 '''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 '''
203 print('class_declaration_1', list(p
))
205 # { // Wrap up the class.
206 # if (p[11] && p[4] && p[4]->name != p[11]) {
207 # yyerror(@11, "error: Class end label doesn't match class name.");
214 def p__embed0_class_declaration(p
):
215 '''_embed0_class_declaration : '''
217 # { pform_start_class_declaration(@2, p[4], p[5].type, p[5].exprs, p[3]); }
221 def p__embed1_class_declaration(p
):
222 '''_embed1_class_declaration : '''
224 # { // Process a class.
225 # pform_end_class_declaration(@9);
230 def p_class_constraint_1(p
):
231 '''class_constraint : constraint_prototype '''
233 print('class_constraint_1', list(p
))
239 def p_class_constraint_2(p
):
240 '''class_constraint : constraint_declaration '''
242 print('class_constraint_2', list(p
))
248 def p_class_identifier_1(p
):
249 '''class_identifier : IDENTIFIER '''
251 print('class_identifier_1', list(p
))
253 # { // Create a synthetic typedef for the class name so that the
254 # // lexor detects the name as a type.
255 # perm_string name = lex_strings.make(p[1]);
256 # class_type_t*tmp = new class_type_t(name);
257 # FILE_NAME(tmp, @1);
258 # pform_set_typedef(name, tmp, NULL);
265 def p_class_identifier_2(p
):
266 '''class_identifier : TYPE_IDENTIFIER '''
268 print('class_identifier_2', list(p
))
270 # { class_type_t*tmp = dynamic_cast<class_type_t*>(p[1].type);
272 # yyerror(@1, "Type name \"%s\"is not a predeclared class name.", p[1].text);
280 def p_class_declaration_endlabel_opt_1(p
):
281 '''class_declaration_endlabel_opt : ':' TYPE_IDENTIFIER '''
283 print('class_declaration_endlabel_opt_1', list(p
))
285 # { class_type_t*tmp = dynamic_cast<class_type_t*> (p[2].type);
287 # yyerror(@2, "error: class declaration endlabel \"%s\" is not a class name\n", p[2].text);
290 # p[0] = strdupnew(tmp->name.str());
297 def p_class_declaration_endlabel_opt_2(p
):
298 '''class_declaration_endlabel_opt : ':' IDENTIFIER '''
300 print('class_declaration_endlabel_opt_2', list(p
))
307 def p_class_declaration_endlabel_opt_3(p
):
308 '''class_declaration_endlabel_opt : '''
310 print('class_declaration_endlabel_opt_3', list(p
))
316 def p_class_declaration_extends_opt_1(p
):
317 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '''
319 print('class_declaration_extends_opt_1', list(p
))
321 # { p[0].type = p[2].type;
328 def p_class_declaration_extends_opt_2(p
):
329 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '(' expression_list_with_nuls ')' '''
331 print('class_declaration_extends_opt_2', list(p
))
333 # { p[0].type = p[2].type;
340 def p_class_declaration_extends_opt_3(p
):
341 '''class_declaration_extends_opt : '''
343 print('class_declaration_extends_opt_3', list(p
))
345 # { p[0].type = 0; p[0].exprs = 0; }
349 def p_class_items_opt_1(p
):
350 '''class_items_opt : class_items '''
352 print('class_items_opt_1', list(p
))
358 def p_class_items_opt_2(p
):
359 '''class_items_opt : '''
361 print('class_items_opt_2', list(p
))
367 def p_class_items_1(p
):
368 '''class_items : class_items class_item '''
370 print('class_items_1', list(p
))
376 def p_class_items_2(p
):
377 '''class_items : class_item '''
379 print('class_items_2', list(p
))
385 def p_class_item_1(p
):
386 '''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 '''
388 print('class_item_1', list(p
))
390 # { current_function->set_ports(p[6]);
391 # pform_set_constructor_return(current_function);
392 # pform_set_this_class(@3, current_function);
393 # current_function_set_statement(@3, p[10]);
395 # current_function = 0;
400 def p_class_item_2(p
):
401 '''class_item : property_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
403 print('class_item_2', list(p
))
405 # { pform_class_property(@2, p[1], p[2], p[3]); }
409 def p_class_item_3(p
):
410 '''class_item : K_const class_item_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
412 print('class_item_3', list(p
))
414 # { pform_class_property(@1, p[2] | property_qualifier_t::make_const(), p[3], p[4]); }
418 def p_class_item_4(p
):
419 '''class_item : method_qualifier_opt task_declaration '''
421 print('class_item_4', list(p
))
423 # { /* The task_declaration rule puts this into the class */ }
427 def p_class_item_5(p
):
428 '''class_item : method_qualifier_opt function_declaration '''
430 print('class_item_5', list(p
))
432 # { /* The function_declaration rule puts this into the class */ }
436 def p_class_item_6(p
):
437 '''class_item : K_extern method_qualifier_opt K_function K_new ';' '''
439 print('class_item_6', list(p
))
441 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
445 def p_class_item_7(p
):
446 '''class_item : K_extern method_qualifier_opt K_function K_new '(' tf_port_list_opt ')' ';' '''
448 print('class_item_7', list(p
))
450 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
454 def p_class_item_8(p
):
455 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER ';' '''
457 print('class_item_8', list(p
))
459 # { yyerror(@1, "sorry: External methods are not yet supported.");
465 def p_class_item_9(p
):
466 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' ';' '''
468 print('class_item_9', list(p
))
470 # { yyerror(@1, "sorry: External methods are not yet supported.");
476 def p_class_item_10(p
):
477 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER ';' '''
479 print('class_item_10', list(p
))
481 # { yyerror(@1, "sorry: External methods are not yet supported.");
487 def p_class_item_11(p
):
488 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER '(' tf_port_list_opt ')' ';' '''
490 print('class_item_11', list(p
))
492 # { yyerror(@1, "sorry: External methods are not yet supported.");
498 def p_class_item_12(p
):
499 '''class_item : class_constraint '''
501 print('class_item_12', list(p
))
507 def p_class_item_13(p
):
508 '''class_item : property_qualifier_opt data_type error ';' '''
510 print('class_item_13', list(p
))
512 # { yyerror(@3, "error: Errors in variable names after data type.");
518 def p_class_item_14(p
):
519 '''class_item : property_qualifier_opt IDENTIFIER error ';' '''
521 print('class_item_14', list(p
))
523 # { yyerror(@3, "error: %s doesn't name a type.", p[2]);
529 def p_class_item_15(p
):
530 '''class_item : method_qualifier_opt K_function K_new error K_endfunction endnew_opt '''
532 print('class_item_15', list(p
))
534 # { yyerror(@1, "error: I give up on this class constructor declaration.");
540 def p_class_item_16(p
):
541 '''class_item : error ';' '''
543 print('class_item_16', list(p
))
545 # { yyerror(@2, "error: invalid class item.");
551 def p__embed0_class_item(p
):
552 '''_embed0_class_item : '''
554 # { assert(current_function==0);
555 # current_function = pform_push_constructor_scope(@3);
560 def p_class_item_qualifier_1(p
):
561 '''class_item_qualifier : K_static '''
563 print('class_item_qualifier_1', list(p
))
565 # { p[0] = property_qualifier_t::make_static(); }
569 def p_class_item_qualifier_2(p
):
570 '''class_item_qualifier : K_protected '''
572 print('class_item_qualifier_2', list(p
))
574 # { p[0] = property_qualifier_t::make_protected(); }
578 def p_class_item_qualifier_3(p
):
579 '''class_item_qualifier : K_local '''
581 print('class_item_qualifier_3', list(p
))
583 # { p[0] = property_qualifier_t::make_local(); }
587 def p_class_item_qualifier_list_1(p
):
588 '''class_item_qualifier_list : class_item_qualifier_list class_item_qualifier '''
590 print('class_item_qualifier_list_1', list(p
))
592 # { p[0] = p[1] | p[2]; }
596 def p_class_item_qualifier_list_2(p
):
597 '''class_item_qualifier_list : class_item_qualifier '''
599 print('class_item_qualifier_list_2', list(p
))
606 def p_class_item_qualifier_opt_1(p
):
607 '''class_item_qualifier_opt : class_item_qualifier_list '''
609 print('class_item_qualifier_opt_1', list(p
))
616 def p_class_item_qualifier_opt_2(p
):
617 '''class_item_qualifier_opt : '''
619 print('class_item_qualifier_opt_2', list(p
))
621 # { p[0] = property_qualifier_t::make_none(); }
625 def p_class_new_1(p
):
626 '''class_new : K_new '(' expression_list_with_nuls ')' '''
628 print('class_new_1', list(p
))
630 # { list<PExpr*>*expr_list = p[3];
631 # strip_tail_items(expr_list);
632 # PENewClass*tmp = new PENewClass(*expr_list);
633 # FILE_NAME(tmp, @1);
640 def p_class_new_2(p
):
641 '''class_new : K_new hierarchy_identifier '''
643 print('class_new_2', list(p
))
645 # { PEIdent*tmpi = new PEIdent(*p[2]);
646 # FILE_NAME(tmpi, @2);
647 # PENewCopy*tmp = new PENewCopy(tmpi);
648 # FILE_NAME(tmp, @1);
655 def p_class_new_3(p
):
656 '''class_new : K_new '''
658 print('class_new_3', list(p
))
660 # { PENewClass*tmp = new PENewClass;
661 # FILE_NAME(tmp, @1);
667 def p_concurrent_assertion_item_1(p
):
668 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' property_spec ')' statement_or_null '''
670 print('concurrent_assertion_item_1', list(p
))
673 # if (gn_assertions_flag) {
674 # yyerror(@2, "sorry: concurrent_assertion_item not supported."
675 # " Try -gno-assertion to turn this message off.");
681 def p_concurrent_assertion_item_2(p
):
682 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' error ')' statement_or_null '''
684 print('concurrent_assertion_item_2', list(p
))
687 # yyerror(@2, "error: Error in property_spec of concurrent assertion item.");
692 def p_constraint_block_item_1(p
):
693 '''constraint_block_item : constraint_expression '''
695 print('constraint_block_item_1', list(p
))
701 def p_constraint_block_item_list_1(p
):
702 '''constraint_block_item_list : constraint_block_item_list constraint_block_item '''
704 print('constraint_block_item_list_1', list(p
))
710 def p_constraint_block_item_list_2(p
):
711 '''constraint_block_item_list : constraint_block_item '''
713 print('constraint_block_item_list_2', list(p
))
719 def p_constraint_block_item_list_opt_1(p
):
720 '''constraint_block_item_list_opt : '''
722 print('constraint_block_item_list_opt_1', list(p
))
728 def p_constraint_block_item_list_opt_2(p
):
729 '''constraint_block_item_list_opt : constraint_block_item_list '''
731 print('constraint_block_item_list_opt_2', list(p
))
737 def p_constraint_declaration_1(p
):
738 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' constraint_block_item_list_opt '}' '''
740 print('constraint_declaration_1', list(p
))
742 # { yyerror(@2, "sorry: Constraint declarations not supported."); }
746 def p_constraint_declaration_2(p
):
747 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' error '}' '''
749 print('constraint_declaration_2', list(p
))
751 # { yyerror(@4, "error: Errors in the constraint block item list."); }
755 def p_constraint_expression_1(p
):
756 '''constraint_expression : expression ';' '''
758 print('constraint_expression_1', list(p
))
764 def p_constraint_expression_2(p
):
765 '''constraint_expression : expression K_dist '{' '}' ';' '''
767 print('constraint_expression_2', list(p
))
773 def p_constraint_expression_3(p
):
774 '''constraint_expression : expression K_TRIGGER constraint_set '''
776 print('constraint_expression_3', list(p
))
782 def p_constraint_expression_4(p
):
783 '''constraint_expression : K_if '(' expression ')' constraint_set %prec less_than_K_else '''
785 print('constraint_expression_4', list(p
))
791 def p_constraint_expression_5(p
):
792 '''constraint_expression : K_if '(' expression ')' constraint_set K_else constraint_set '''
794 print('constraint_expression_5', list(p
))
800 def p_constraint_expression_6(p
):
801 '''constraint_expression : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' constraint_set '''
803 print('constraint_expression_6', list(p
))
809 def p_constraint_expression_list_1(p
):
810 '''constraint_expression_list : constraint_expression_list constraint_expression '''
812 print('constraint_expression_list_1', list(p
))
818 def p_constraint_expression_list_2(p
):
819 '''constraint_expression_list : constraint_expression '''
821 print('constraint_expression_list_2', list(p
))
827 def p_constraint_prototype_1(p
):
828 '''constraint_prototype : K_static_opt K_constraint IDENTIFIER ';' '''
830 print('constraint_prototype_1', list(p
))
832 # { yyerror(@2, "sorry: Constraint prototypes not supported."); }
836 def p_constraint_set_1(p
):
837 '''constraint_set : constraint_expression '''
839 print('constraint_set_1', list(p
))
845 def p_constraint_set_2(p
):
846 '''constraint_set : '{' constraint_expression_list '}' '''
848 print('constraint_set_2', list(p
))
854 def p_data_declaration_1(p
):
855 '''data_declaration : attribute_list_opt data_type_or_implicit list_of_variable_decl_assignments ';' '''
857 print('data_declaration_1', list(p
))
859 # { data_type_t*data_type = p[2];
860 # if (data_type == 0) {
861 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
862 # FILE_NAME(data_type, @2);
864 # pform_makewire(@2, 0, str_strength, p[3], NetNet::IMPLICIT_REG, data_type);
869 def p_data_type_1(p
):
870 '''data_type : integer_vector_type unsigned_signed_opt dimensions_opt '''
872 print('data_type_1', list(p
))
875 if (use_vtype
== IVL_VT_NO_TYPE
):
876 use_vtype
= IVL_VT_LOGIC
878 dt
= DataType(use_vtype
, signed
=p
[2])
880 dt
.reg_flag
= reg_flag
883 # { ivl_variable_type_t use_vtype = p[1];
884 # bool reg_flag = false;
885 # if (use_vtype == IVL_VT_NO_TYPE) {
886 # use_vtype = IVL_VT_LOGIC;
889 # vector_type_t*tmp = new vector_type_t(use_vtype, p[2], p[3]);
890 # tmp->reg_flag = reg_flag;
891 # FILE_NAME(tmp, @1);
897 def p_data_type_2(p
):
898 '''data_type : non_integer_type '''
900 print('data_type_2', list(p
))
903 # { real_type_t*tmp = new real_type_t(p[1]);
904 # FILE_NAME(tmp, @1);
910 def p_data_type_3(p
):
911 '''data_type : struct_data_type '''
913 print('data_type_3', list(p
))
916 # { if (!p[1]->packed_flag) {
917 # yyerror(@1, "sorry: Unpacked structs not supported.");
924 def p_data_type_4(p
):
925 '''data_type : enum_data_type '''
927 print('data_type_4', list(p
))
934 def p_data_type_5(p
):
935 '''data_type : atom2_type signed_unsigned_opt '''
937 print('data_type_5', list(p
))
939 # { atom2_type_t*tmp = new atom2_type_t(p[1], p[2]);
940 # FILE_NAME(tmp, @1);
946 def p_data_type_6(p
):
947 '''data_type : K_integer signed_unsigned_opt '''
949 print('data_type_6', list(p
))
951 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
952 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, p[2], pd);
953 # tmp->reg_flag = true;
954 # tmp->integer_flag = true;
960 def p_data_type_7(p
):
961 '''data_type : K_time '''
963 print('data_type_7', list(p
))
965 # { list<pform_range_t>*pd = make_range_from_width(64);
966 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
967 # tmp->reg_flag = !gn_system_verilog();
973 def p_data_type_8(p
):
974 '''data_type : TYPE_IDENTIFIER dimensions_opt '''
976 print('data_type_8', list(p
))
979 # parray_type_t*tmp = new parray_type_t(p[1].type, p[2]);
980 # FILE_NAME(tmp, @1);
982 # } else p[0] = p[1].type;
988 def p_data_type_9(p
):
989 '''data_type : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_data_type TYPE_IDENTIFIER '''
991 print('data_type_9', list(p
))
993 # { lex_in_package_scope(0);
1000 def p_data_type_10(p
):
1001 '''data_type : K_string '''
1003 print('data_type_10', list(p
))
1005 # { string_type_t*tmp = new string_type_t;
1006 # FILE_NAME(tmp, @1);
1012 def p__embed0_data_type(p
):
1013 '''_embed0_data_type : '''
1015 # { lex_in_package_scope(p[1]); }
1019 def p_data_type_or_implicit_1(p
):
1020 '''data_type_or_implicit : data_type '''
1022 print('data_type_or_implicit_1', list(p
))
1029 def p_data_type_or_implicit_2(p
):
1030 '''data_type_or_implicit : signing dimensions_opt '''
1032 print('data_type_or_implicit_2', list(p
))
1034 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, p[1], p[2]);
1035 # tmp->implicit_flag = true;
1036 # FILE_NAME(tmp, @1);
1042 def p_data_type_or_implicit_3(p
):
1043 '''data_type_or_implicit : dimensions '''
1045 print('data_type_or_implicit_3', list(p
))
1048 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, p[1]);
1049 # tmp->implicit_flag = true;
1050 # FILE_NAME(tmp, @1);
1056 def p_data_type_or_implicit_4(p
):
1057 '''data_type_or_implicit : '''
1058 if(parse_debug
> 2):
1059 print('data_type_or_implicit_4', list(p
))
1065 def p_data_type_or_implicit_or_void_1(p
):
1066 '''data_type_or_implicit_or_void : data_type_or_implicit '''
1068 print('data_type_or_implicit_or_void_1', list(p
))
1075 def p_data_type_or_implicit_or_void_2(p
):
1076 '''data_type_or_implicit_or_void : K_void '''
1078 print('data_type_or_implicit_or_void_2', list(p
))
1080 # { void_type_t*tmp = new void_type_t;
1081 # FILE_NAME(tmp, @1);
1087 def p_description_1(p
):
1088 '''description : module '''
1089 if(parse_debug
> 2):
1090 print('description_1', list(p
))
1096 def p_description_2(p
):
1097 '''description : udp_primitive '''
1099 print('description_2', list(p
))
1105 def p_description_3(p
):
1106 '''description : config_declaration '''
1108 print('description_3', list(p
))
1114 def p_description_4(p
):
1115 '''description : nature_declaration '''
1117 print('description_4', list(p
))
1123 def p_description_5(p
):
1124 '''description : package_declaration '''
1126 print('description_5', list(p
))
1132 def p_description_6(p
):
1133 '''description : discipline_declaration '''
1135 print('description_6', list(p
))
1141 def p_description_7(p
):
1142 '''description : package_item '''
1144 print('description_7', list(p
))
1150 def p_description_8(p
):
1151 '''description : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' '''
1153 print('description_8', list(p
))
1155 # { perm_string tmp3 = lex_strings.make(p[3]);
1156 # pform_set_type_attrib(tmp3, p[5], p[7]);
1163 def p_description_list_1(p
):
1164 '''description_list : description '''
1165 if(parse_debug
> 2):
1166 print('description_list_1', list(p
))
1172 def p_description_list_2(p
):
1173 '''description_list : description_list description '''
1175 print('description_list_2', list(p
))
1181 def p_endnew_opt_1(p
):
1182 '''endnew_opt : ':' K_new '''
1184 print('endnew_opt_1', list(p
))
1190 def p_endnew_opt_2(p
):
1193 print('endnew_opt_2', list(p
))
1199 def p_dynamic_array_new_1(p
):
1200 '''dynamic_array_new : K_new '[' expression ']' '''
1202 print('dynamic_array_new_1', list(p
))
1204 # { p[0] = new PENewArray(p[3], 0);
1205 # FILE_NAME(p[0], @1);
1210 def p_dynamic_array_new_2(p
):
1211 '''dynamic_array_new : K_new '[' expression ']' '(' expression ')' '''
1213 print('dynamic_array_new_2', list(p
))
1215 # { p[0] = new PENewArray(p[3], p[6]);
1216 # FILE_NAME(p[0], @1);
1221 def p_for_step_1(p
):
1222 '''for_step : lpvalue '=' expression '''
1224 print('for_step_1', list(p
))
1226 # { PAssign*tmp = new PAssign(p[1],p[3]);
1227 # FILE_NAME(tmp, @1);
1233 def p_for_step_2(p
):
1234 '''for_step : inc_or_dec_expression '''
1236 print('for_step_2', list(p
))
1238 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
1242 def p_for_step_3(p
):
1243 '''for_step : compressed_statement '''
1245 print('for_step_3', list(p
))
1252 def p_function_declaration_1(p
):
1253 '''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 '''
1255 print('function_declaration_1', list(p
))
1257 # { // Last step: check any closing name.
1259 # if (strcmp(p[4],p[11]) != 0) {
1260 # yyerror(@11, "error: End label doesn't match "
1263 # if (! gn_system_verilog()) {
1264 # yyerror(@11, "error: Function end labels require "
1265 # "SystemVerilog.");
1274 def p_function_declaration_2(p
):
1275 '''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 '''
1277 print('function_declaration_2', list(p
))
1279 # { // Last step: check any closing name.
1281 # if (strcmp(p[4],p[14]) != 0) {
1282 # yyerror(@14, "error: End label doesn't match "
1285 # if (! gn_system_verilog()) {
1286 # yyerror(@14, "error: Function end labels require "
1287 # "SystemVerilog.");
1296 def p_function_declaration_3(p
):
1297 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER error K_endfunction _embed4_function_declaration endlabel_opt '''
1299 print('function_declaration_3', list(p
))
1301 # { // Last step: check any closing name.
1303 # if (strcmp(p[4],p[8]) != 0) {
1304 # yyerror(@8, "error: End label doesn't match function name");
1306 # if (! gn_system_verilog()) {
1307 # yyerror(@8, "error: Function end labels require "
1308 # "SystemVerilog.");
1317 def p__embed0_function_declaration(p
):
1318 '''_embed0_function_declaration : '''
1320 # { assert(current_function == 0);
1321 # current_function = pform_push_function_scope(@1, p[4], p[2]);
1326 def p__embed1_function_declaration(p
):
1327 '''_embed1_function_declaration : '''
1329 # { current_function->set_ports(p[7]);
1330 # current_function->set_return(p[3]);
1331 # current_function_set_statement(p[8]? @8 : @4, p[8]);
1332 # pform_set_this_class(@4, current_function);
1333 # pform_pop_scope();
1334 # current_function = 0;
1339 def p__embed2_function_declaration(p
):
1340 '''_embed2_function_declaration : '''
1342 # { assert(current_function == 0);
1343 # current_function = pform_push_function_scope(@1, p[4], p[2]);
1348 def p__embed3_function_declaration(p
):
1349 '''_embed3_function_declaration : '''
1351 # { current_function->set_ports(p[7]);
1352 # current_function->set_return(p[3]);
1353 # current_function_set_statement(p[11]? @11 : @4, p[11]);
1354 # pform_set_this_class(@4, current_function);
1355 # pform_pop_scope();
1356 # current_function = 0;
1357 # if (p[7]==0 && !gn_system_verilog()) {
1358 # yyerror(@4, "error: Empty parenthesis syntax requires SystemVerilog.");
1364 def p__embed4_function_declaration(p
):
1365 '''_embed4_function_declaration : '''
1368 # if (current_function) {
1369 # pform_pop_scope();
1370 # current_function = 0;
1372 # assert(current_function == 0);
1373 # yyerror(@1, "error: Syntax error defining function.");
1379 def p_import_export_1(p
):
1380 '''import_export : K_import '''
1382 print('import_export_1', list(p
))
1389 def p_import_export_2(p
):
1390 '''import_export : K_export '''
1392 print('import_export_2', list(p
))
1399 def p_implicit_class_handle_1(p
):
1400 '''implicit_class_handle : K_this '''
1402 print('implicit_class_handle_1', list(p
))
1404 # { p[0] = pform_create_this(); }
1408 def p_implicit_class_handle_2(p
):
1409 '''implicit_class_handle : K_super '''
1411 print('implicit_class_handle_2', list(p
))
1413 # { p[0] = pform_create_super(); }
1417 def p_inc_or_dec_expression_1(p
):
1418 '''inc_or_dec_expression : K_INCR lpvalue %prec UNARY_PREC '''
1420 print('inc_or_dec_expression_1', list(p
))
1422 # { PEUnary*tmp = new PEUnary('I', p[2]);
1423 # FILE_NAME(tmp, @2);
1429 def p_inc_or_dec_expression_2(p
):
1430 '''inc_or_dec_expression : lpvalue K_INCR %prec UNARY_PREC '''
1432 print('inc_or_dec_expression_2', list(p
))
1434 # { PEUnary*tmp = new PEUnary('i', p[1]);
1435 # FILE_NAME(tmp, @1);
1441 def p_inc_or_dec_expression_3(p
):
1442 '''inc_or_dec_expression : K_DECR lpvalue %prec UNARY_PREC '''
1444 print('inc_or_dec_expression_3', list(p
))
1446 # { PEUnary*tmp = new PEUnary('D', p[2]);
1447 # FILE_NAME(tmp, @2);
1453 def p_inc_or_dec_expression_4(p
):
1454 '''inc_or_dec_expression : lpvalue K_DECR %prec UNARY_PREC '''
1456 print('inc_or_dec_expression_4', list(p
))
1458 # { PEUnary*tmp = new PEUnary('d', p[1]);
1459 # FILE_NAME(tmp, @1);
1465 def p_inside_expression_1(p
):
1466 '''inside_expression : expression K_inside '{' open_range_list '}' '''
1468 print('inside_expression_1', list(p
))
1470 # { yyerror(@2, "sorry: \"inside\" expressions not supported yet.");
1476 def p_integer_vector_type_1(p
):
1477 '''integer_vector_type : K_reg '''
1479 print('integer_vector_type_1', list(p
))
1480 p
[0] = IVL_VT_NO_TYPE
1486 def p_integer_vector_type_2(p
):
1487 '''integer_vector_type : K_bit '''
1489 print('integer_vector_type_2', list(p
))
1496 def p_integer_vector_type_3(p
):
1497 '''integer_vector_type : K_logic '''
1499 print('integer_vector_type_3', list(p
))
1506 def p_integer_vector_type_4(p
):
1507 '''integer_vector_type : K_bool '''
1509 print('integer_vector_type_4', list(p
))
1511 # { p[0] = IVL_VT_BOOL; }
1515 def p_join_keyword_1(p
):
1516 '''join_keyword : K_join '''
1518 print('join_keyword_1', list(p
))
1520 # { p[0] = PBlock::BL_PAR; }
1524 def p_join_keyword_2(p
):
1525 '''join_keyword : K_join_none '''
1527 print('join_keyword_2', list(p
))
1529 # { p[0] = PBlock::BL_JOIN_NONE; }
1533 def p_join_keyword_3(p
):
1534 '''join_keyword : K_join_any '''
1536 print('join_keyword_3', list(p
))
1538 # { p[0] = PBlock::BL_JOIN_ANY; }
1542 def p_jump_statement_1(p
):
1543 '''jump_statement : K_break ';' '''
1545 print('jump_statement_1', list(p
))
1547 # { yyerror(@1, "sorry: break statements not supported.");
1553 def p_jump_statement_2(p
):
1554 '''jump_statement : K_return ';' '''
1556 print('jump_statement_2', list(p
))
1558 # { PReturn*tmp = new PReturn(0);
1559 # FILE_NAME(tmp, @1);
1565 def p_jump_statement_3(p
):
1566 '''jump_statement : K_return expression ';' '''
1568 print('jump_statement_3', list(p
))
1570 # { PReturn*tmp = new PReturn(p[2]);
1571 # FILE_NAME(tmp, @1);
1577 def p_lifetime_1(p
):
1578 '''lifetime : K_automatic '''
1580 print('lifetime_1', list(p
))
1582 # { p[0] = LexicalScope::AUTOMATIC; }
1586 def p_lifetime_2(p
):
1587 '''lifetime : K_static '''
1589 print('lifetime_2', list(p
))
1591 # { p[0] = LexicalScope::STATIC; }
1595 def p_lifetime_opt_1(p
):
1596 '''lifetime_opt : lifetime '''
1598 print('lifetime_opt_1', list(p
))
1605 def p_lifetime_opt_2(p
):
1606 '''lifetime_opt : '''
1607 if(parse_debug
> 2):
1608 print('lifetime_opt_2', list(p
))
1610 # { p[0] = LexicalScope::INHERITED; }
1614 def p_loop_statement_1(p
):
1615 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' for_step ')' statement_or_null '''
1617 print('loop_statement_1', list(p
))
1619 # { PForStatement*tmp = new PForStatement(p[3], p[5], p[7], p[9], p[11]);
1620 # FILE_NAME(tmp, @1);
1626 def p_loop_statement_2(p
):
1627 '''loop_statement : K_for '(' data_type IDENTIFIER '=' expression ';' expression ';' for_step ')' _embed0_loop_statement statement_or_null '''
1629 print('loop_statement_2', list(p
))
1631 # { pform_name_t tmp_hident;
1632 # tmp_hident.push_back(name_component_t(lex_strings.make(p[4])));
1634 # PEIdent*tmp_ident = pform_new_ident(tmp_hident);
1635 # FILE_NAME(tmp_ident, @4);
1637 # PForStatement*tmp_for = new PForStatement(tmp_ident, p[6], p[8], p[10], p[13]);
1638 # FILE_NAME(tmp_for, @1);
1640 # pform_pop_scope();
1641 # vector<Statement*>tmp_for_list (1);
1642 # tmp_for_list[0] = tmp_for;
1643 # PBlock*tmp_blk = current_block_stack.top();
1644 # current_block_stack.pop();
1645 # tmp_blk->set_statement(tmp_for_list);
1652 def p_loop_statement_3(p
):
1653 '''loop_statement : K_forever statement_or_null '''
1655 print('loop_statement_3', list(p
))
1657 # { PForever*tmp = new PForever(p[2]);
1658 # FILE_NAME(tmp, @1);
1664 def p_loop_statement_4(p
):
1665 '''loop_statement : K_repeat '(' expression ')' statement_or_null '''
1667 print('loop_statement_4', list(p
))
1669 # { PRepeat*tmp = new PRepeat(p[3], p[5]);
1670 # FILE_NAME(tmp, @1);
1676 def p_loop_statement_5(p
):
1677 '''loop_statement : K_while '(' expression ')' statement_or_null '''
1679 print('loop_statement_5', list(p
))
1681 # { PWhile*tmp = new PWhile(p[3], p[5]);
1682 # FILE_NAME(tmp, @1);
1688 def p_loop_statement_6(p
):
1689 '''loop_statement : K_do statement_or_null K_while '(' expression ')' ';' '''
1691 print('loop_statement_6', list(p
))
1693 # { PDoWhile*tmp = new PDoWhile(p[5], p[2]);
1694 # FILE_NAME(tmp, @1);
1700 def p_loop_statement_7(p
):
1701 '''loop_statement : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' _embed1_loop_statement statement_or_null '''
1703 print('loop_statement_7', list(p
))
1705 # { PForeach*tmp_for = pform_make_foreach(@1, p[3], p[5], p[9]);
1707 # pform_pop_scope();
1708 # vector<Statement*>tmp_for_list(1);
1709 # tmp_for_list[0] = tmp_for;
1710 # PBlock*tmp_blk = current_block_stack.top();
1711 # current_block_stack.pop();
1712 # tmp_blk->set_statement(tmp_for_list);
1718 def p_loop_statement_8(p
):
1719 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' error ')' statement_or_null '''
1721 print('loop_statement_8', list(p
))
1724 # yyerror(@1, "error: Error in for loop step assignment.");
1729 def p_loop_statement_9(p
):
1730 '''loop_statement : K_for '(' lpvalue '=' expression ';' error ';' for_step ')' statement_or_null '''
1732 print('loop_statement_9', list(p
))
1735 # yyerror(@1, "error: Error in for loop condition expression.");
1740 def p_loop_statement_10(p
):
1741 '''loop_statement : K_for '(' error ')' statement_or_null '''
1743 print('loop_statement_10', list(p
))
1746 # yyerror(@1, "error: Incomprehensible for loop.");
1751 def p_loop_statement_11(p
):
1752 '''loop_statement : K_while '(' error ')' statement_or_null '''
1754 print('loop_statement_11', list(p
))
1757 # yyerror(@1, "error: Error in while loop condition.");
1762 def p_loop_statement_12(p
):
1763 '''loop_statement : K_do statement_or_null K_while '(' error ')' ';' '''
1765 print('loop_statement_12', list(p
))
1768 # yyerror(@1, "error: Error in do/while loop condition.");
1773 def p_loop_statement_13(p
):
1774 '''loop_statement : K_foreach '(' IDENTIFIER '[' error ']' ')' statement_or_null '''
1776 print('loop_statement_13', list(p
))
1779 # yyerror(@4, "error: Errors in foreach loop variables list.");
1784 def p__embed0_loop_statement(p
):
1785 '''_embed0_loop_statement : '''
1787 # { static unsigned for_counter = 0;
1788 # char for_block_name [64];
1789 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_for_loop%u", for_counter);
1791 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1792 # FILE_NAME(tmp, @1);
1793 # current_block_stack.push(tmp);
1795 # list<decl_assignment_t*>assign_list;
1796 # decl_assignment_t*tmp_assign = new decl_assignment_t;
1797 # tmp_assign->name = lex_strings.make(p[4]);
1798 # assign_list.push_back(tmp_assign);
1799 # pform_makewire(@4, 0, str_strength, &assign_list, NetNet::REG, p[3]);
1804 def p__embed1_loop_statement(p
):
1805 '''_embed1_loop_statement : '''
1807 # { static unsigned foreach_counter = 0;
1808 # char for_block_name[64];
1809 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_foreach%u", foreach_counter);
1810 # foreach_counter += 1;
1812 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1813 # FILE_NAME(tmp, @1);
1814 # current_block_stack.push(tmp);
1816 # pform_make_foreach_declarations(@1, p[5]);
1821 def p_list_of_variable_decl_assignments_1(p
):
1822 '''list_of_variable_decl_assignments : variable_decl_assignment '''
1824 print('list_of_variable_decl_assignments_1', list(p
))
1826 # { list<decl_assignment_t*>*tmp = new list<decl_assignment_t*>;
1827 # tmp->push_back(p[1]);
1833 def p_list_of_variable_decl_assignments_2(p
):
1834 '''list_of_variable_decl_assignments : list_of_variable_decl_assignments ',' variable_decl_assignment '''
1836 print('list_of_variable_decl_assignments_2', list(p
))
1838 # { list<decl_assignment_t*>*tmp = p[1];
1839 # tmp->push_back(p[3]);
1845 def p_variable_decl_assignment_1(p
):
1846 '''variable_decl_assignment : IDENTIFIER dimensions_opt '''
1848 print('variable_decl_assignment_1', list(p
))
1850 # { decl_assignment_t*tmp = new decl_assignment_t;
1851 # tmp->name = lex_strings.make(p[1]);
1853 # tmp->index = *p[2];
1862 def p_variable_decl_assignment_2(p
):
1863 '''variable_decl_assignment : IDENTIFIER '=' expression '''
1865 print('variable_decl_assignment_2', list(p
))
1867 # { decl_assignment_t*tmp = new decl_assignment_t;
1868 # tmp->name = lex_strings.make(p[1]);
1869 # tmp->expr .reset(p[3]);
1876 def p_variable_decl_assignment_3(p
):
1877 '''variable_decl_assignment : IDENTIFIER '=' K_new '(' ')' '''
1879 print('variable_decl_assignment_3', list(p
))
1881 # { decl_assignment_t*tmp = new decl_assignment_t;
1882 # tmp->name = lex_strings.make(p[1]);
1883 # PENewClass*expr = new PENewClass;
1884 # FILE_NAME(expr, @3);
1885 # tmp->expr .reset(expr);
1892 def p_loop_variables_1(p
):
1893 '''loop_variables : loop_variables ',' IDENTIFIER '''
1895 print('loop_variables_1', list(p
))
1897 # { list<perm_string>*tmp = p[1];
1898 # tmp->push_back(lex_strings.make(p[3]));
1905 def p_loop_variables_2(p
):
1906 '''loop_variables : IDENTIFIER '''
1908 print('loop_variables_2', list(p
))
1910 # { list<perm_string>*tmp = new list<perm_string>;
1911 # tmp->push_back(lex_strings.make(p[1]));
1918 def p_method_qualifier_1(p
):
1919 '''method_qualifier : K_virtual '''
1921 print('method_qualifier_1', list(p
))
1927 def p_method_qualifier_2(p
):
1928 '''method_qualifier : class_item_qualifier '''
1930 print('method_qualifier_2', list(p
))
1936 def p_method_qualifier_opt_1(p
):
1937 '''method_qualifier_opt : method_qualifier '''
1939 print('method_qualifier_opt_1', list(p
))
1945 def p_method_qualifier_opt_2(p
):
1946 '''method_qualifier_opt : '''
1948 print('method_qualifier_opt_2', list(p
))
1954 def p_modport_declaration_1(p
):
1955 '''modport_declaration : K_modport _embed0_modport_declaration modport_item_list ';' '''
1957 print('modport_declaration_1', list(p
))
1963 def p__embed0_modport_declaration(p
):
1964 '''_embed0_modport_declaration : '''
1966 # { if (!pform_in_interface())
1967 # yyerror(@1, "error: modport declarations are only allowed "
1968 # "in interfaces.");
1973 def p_modport_item_list_1(p
):
1974 '''modport_item_list : modport_item '''
1976 print('modport_item_list_1', list(p
))
1982 def p_modport_item_list_2(p
):
1983 '''modport_item_list : modport_item_list ',' modport_item '''
1985 print('modport_item_list_2', list(p
))
1991 def p_modport_item_1(p
):
1992 '''modport_item : IDENTIFIER _embed0_modport_item '(' modport_ports_list ')' '''
1994 print('modport_item_1', list(p
))
1996 # { pform_end_modport_item(@1); }
2000 def p__embed0_modport_item(p
):
2001 '''_embed0_modport_item : '''
2003 # { pform_start_modport_item(@1, p[1]); }
2007 def p_modport_ports_list_1(p
):
2008 '''modport_ports_list : modport_ports_declaration '''
2010 print('modport_ports_list_1', list(p
))
2016 def p_modport_ports_list_2(p
):
2017 '''modport_ports_list : modport_ports_list ',' modport_ports_declaration '''
2019 print('modport_ports_list_2', list(p
))
2025 def p_modport_ports_list_3(p
):
2026 '''modport_ports_list : modport_ports_list ',' modport_simple_port '''
2028 print('modport_ports_list_3', list(p
))
2030 # { if (last_modport_port.type == MP_SIMPLE) {
2031 # pform_add_modport_port(@3, last_modport_port.direction,
2032 # p[3]->name, p[3]->parm);
2034 # yyerror(@3, "error: modport expression not allowed here.");
2041 def p_modport_ports_list_4(p
):
2042 '''modport_ports_list : modport_ports_list ',' modport_tf_port '''
2044 print('modport_ports_list_4', list(p
))
2046 # { if (last_modport_port.type != MP_TF)
2047 # yyerror(@3, "error: task/function declaration not allowed here.");
2052 def p_modport_ports_list_5(p
):
2053 '''modport_ports_list : modport_ports_list ',' IDENTIFIER '''
2055 print('modport_ports_list_5', list(p
))
2057 # { if (last_modport_port.type == MP_SIMPLE) {
2058 # pform_add_modport_port(@3, last_modport_port.direction,
2059 # lex_strings.make(p[3]), 0);
2060 # } else if (last_modport_port.type != MP_TF) {
2061 # yyerror(@3, "error: list of identifiers not allowed here.");
2068 def p_modport_ports_list_6(p
):
2069 '''modport_ports_list : modport_ports_list ',' '''
2071 print('modport_ports_list_6', list(p
))
2073 # { yyerror(@2, "error: NULL port declarations are not allowed"); }
2077 def p_modport_ports_declaration_1(p
):
2078 '''modport_ports_declaration : attribute_list_opt port_direction IDENTIFIER '''
2080 print('modport_ports_declaration_1', list(p
))
2082 # { last_modport_port.type = MP_SIMPLE;
2083 # last_modport_port.direction = p[2];
2084 # pform_add_modport_port(@3, p[2], lex_strings.make(p[3]), 0);
2091 def p_modport_ports_declaration_2(p
):
2092 '''modport_ports_declaration : attribute_list_opt port_direction modport_simple_port '''
2094 print('modport_ports_declaration_2', list(p
))
2096 # { last_modport_port.type = MP_SIMPLE;
2097 # last_modport_port.direction = p[2];
2098 # pform_add_modport_port(@3, p[2], p[3]->name, p[3]->parm);
2105 def p_modport_ports_declaration_3(p
):
2106 '''modport_ports_declaration : attribute_list_opt import_export IDENTIFIER '''
2108 print('modport_ports_declaration_3', list(p
))
2110 # { last_modport_port.type = MP_TF;
2111 # last_modport_port.is_import = p[2];
2112 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
2119 def p_modport_ports_declaration_4(p
):
2120 '''modport_ports_declaration : attribute_list_opt import_export modport_tf_port '''
2122 print('modport_ports_declaration_4', list(p
))
2124 # { last_modport_port.type = MP_TF;
2125 # last_modport_port.is_import = p[2];
2126 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
2132 def p_modport_ports_declaration_5(p
):
2133 '''modport_ports_declaration : attribute_list_opt K_clocking IDENTIFIER '''
2135 print('modport_ports_declaration_5', list(p
))
2137 # { last_modport_port.type = MP_CLOCKING;
2138 # last_modport_port.direction = NetNet::NOT_A_PORT;
2139 # yyerror(@3, "sorry: modport clocking declaration is not yet supported.");
2146 def p_modport_simple_port_1(p
):
2147 '''modport_simple_port : '.' IDENTIFIER '(' expression ')' '''
2149 print('modport_simple_port_1', list(p
))
2151 # { named_pexpr_t*tmp = new named_pexpr_t;
2152 # tmp->name = lex_strings.make(p[2]);
2160 def p_modport_tf_port_1(p
):
2161 '''modport_tf_port : K_task IDENTIFIER '''
2163 print('modport_tf_port_1', list(p
))
2169 def p_modport_tf_port_2(p
):
2170 '''modport_tf_port : K_task IDENTIFIER '(' tf_port_list_opt ')' '''
2172 print('modport_tf_port_2', list(p
))
2178 def p_modport_tf_port_3(p
):
2179 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '''
2181 print('modport_tf_port_3', list(p
))
2187 def p_modport_tf_port_4(p
):
2188 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' '''
2190 print('modport_tf_port_4', list(p
))
2196 def p_non_integer_type_1(p
):
2197 '''non_integer_type : K_real '''
2199 print('non_integer_type_1', list(p
))
2201 # { p[0] = real_type_t::REAL; }
2205 def p_non_integer_type_2(p
):
2206 '''non_integer_type : K_realtime '''
2208 print('non_integer_type_2', list(p
))
2210 # { p[0] = real_type_t::REAL; }
2214 def p_non_integer_type_3(p
):
2215 '''non_integer_type : K_shortreal '''
2217 print('non_integer_type_3', list(p
))
2219 # { p[0] = real_type_t::SHORTREAL; }
2224 '''number : BASED_NUMBER '''
2226 print('number_1', list(p
))
2228 # { p[0] = p[1]; based_size = 0;}
2233 '''number : DEC_NUMBER '''
2235 print('number_2', list(p
))
2236 num
= Leaf(token
.NUMBER
, "%s" % (p
[1]))
2239 # { p[0] = p[1]; based_size = 0;}
2244 '''number : DEC_NUMBER BASED_NUMBER '''
2246 print('number_3', list(p
))
2247 num
= Leaf(token
.NUMBER
, "%s:%s" % (p
[1], p
[2]))
2250 # { p[0] = pform_verinum_with_size(p[1],p[2], @2.text, @2.first_line);
2256 '''number : UNBASED_NUMBER '''
2258 print('number_4', list(p
))
2260 # { p[0] = p[1]; based_size = 0;}
2265 '''number : DEC_NUMBER UNBASED_NUMBER '''
2267 print('number_5', list(p
))
2269 # { yyerror(@1, "error: Unbased SystemVerilog literal cannot have "
2271 # p[0] = p[1]; based_size = 0;}
2275 def p_open_range_list_1(p
):
2276 '''open_range_list : open_range_list ',' value_range '''
2278 print('open_range_list_1', list(p
))
2284 def p_open_range_list_2(p
):
2285 '''open_range_list : value_range '''
2287 print('open_range_list_2', list(p
))
2293 def p_package_declaration_1(p
):
2294 '''package_declaration : K_package lifetime_opt IDENTIFIER ';' _embed0_package_declaration timeunits_declaration_opt _embed1_package_declaration package_item_list_opt K_endpackage endlabel_opt '''
2296 print('package_declaration_1', list(p
))
2298 # { pform_end_package_declaration(@1);
2299 # // If an end label is present make sure it match the package name.
2301 # if (strcmp(p[3],p[10]) != 0) {
2302 # yyerror(@10, "error: End label doesn't match package name");
2311 def p__embed0_package_declaration(p
):
2312 '''_embed0_package_declaration : '''
2314 # { pform_start_package_declaration(@1, p[3], p[2]); }
2318 def p__embed1_package_declaration(p
):
2319 '''_embed1_package_declaration : '''
2321 # { pform_set_scope_timescale(@1); }
2325 def p_module_package_import_list_opt_1(p
):
2326 '''module_package_import_list_opt : '''
2327 if(parse_debug
> 1):
2328 print('module_package_import_list_opt_1', list(p
))
2334 def p_module_package_import_list_opt_2(p
):
2335 '''module_package_import_list_opt : package_import_list '''
2337 print('module_package_import_list_opt_2', list(p
))
2343 def p_package_import_list_1(p
):
2344 '''package_import_list : package_import_declaration '''
2346 print('package_import_list_1', list(p
))
2352 def p_package_import_list_2(p
):
2353 '''package_import_list : package_import_list package_import_declaration '''
2355 print('package_import_list_2', list(p
))
2361 def p_package_import_declaration_1(p
):
2362 '''package_import_declaration : K_import package_import_item_list ';' '''
2364 print('package_import_declaration_1', list(p
))
2370 def p_package_import_item_1(p
):
2371 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '''
2373 print('package_import_item_1', list(p
))
2375 # { pform_package_import(@2, p[1], p[3]);
2381 def p_package_import_item_2(p
):
2382 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES '*' '''
2384 print('package_import_item_2', list(p
))
2386 # { pform_package_import(@2, p[1], 0);
2391 def p_package_import_item_list_1(p
):
2392 '''package_import_item_list : package_import_item_list ',' package_import_item '''
2394 print('package_import_item_list_1', list(p
))
2400 def p_package_import_item_list_2(p
):
2401 '''package_import_item_list : package_import_item '''
2403 print('package_import_item_list_2', list(p
))
2409 def p_package_item_1(p
):
2410 '''package_item : timeunits_declaration '''
2412 print('package_item_1', list(p
))
2418 def p_package_item_2(p
):
2419 '''package_item : K_parameter param_type parameter_assign_list ';' '''
2421 print('package_item_2', list(p
))
2427 def p_package_item_3(p
):
2428 '''package_item : K_localparam param_type localparam_assign_list ';' '''
2430 print('package_item_3', list(p
))
2436 def p_package_item_4(p
):
2437 '''package_item : type_declaration '''
2439 print('package_item_4', list(p
))
2445 def p_package_item_5(p
):
2446 '''package_item : function_declaration '''
2448 print('package_item_5', list(p
))
2454 def p_package_item_6(p
):
2455 '''package_item : task_declaration '''
2457 print('package_item_6', list(p
))
2463 def p_package_item_7(p
):
2464 '''package_item : data_declaration '''
2466 print('package_item_7', list(p
))
2472 def p_package_item_8(p
):
2473 '''package_item : class_declaration '''
2475 print('package_item_8', list(p
))
2481 def p_package_item_list_1(p
):
2482 '''package_item_list : package_item_list package_item '''
2484 print('package_item_list_1', list(p
))
2490 def p_package_item_list_2(p
):
2491 '''package_item_list : package_item '''
2493 print('package_item_list_2', list(p
))
2499 def p_package_item_list_opt_1(p
):
2500 '''package_item_list_opt : package_item_list '''
2502 print('package_item_list_opt_1', list(p
))
2508 def p_package_item_list_opt_2(p
):
2509 '''package_item_list_opt : '''
2511 print('package_item_list_opt_2', list(p
))
2517 def p_port_direction_1(p
):
2518 '''port_direction : K_input '''
2520 print('port_direction_1', list(p
))
2522 # { p[0] = NetNet::PINPUT; }
2526 def p_port_direction_2(p
):
2527 '''port_direction : K_output '''
2529 print('port_direction_2', list(p
))
2531 # { p[0] = NetNet::POUTPUT; }
2535 def p_port_direction_3(p
):
2536 '''port_direction : K_inout '''
2538 print('port_direction_3', list(p
))
2540 # { p[0] = NetNet::PINOUT; }
2544 def p_port_direction_4(p
):
2545 '''port_direction : K_ref '''
2547 print('port_direction_4', list(p
))
2549 # { p[0] = NetNet::PREF;
2550 # if (!gn_system_verilog()) {
2551 # yyerror(@1, "error: Reference ports (ref) require SystemVerilog.");
2552 # p[0] = NetNet::PINPUT;
2558 def p_port_direction_opt_1(p
):
2559 '''port_direction_opt : port_direction '''
2561 print('port_direction_opt_1', list(p
))
2568 def p_port_direction_opt_2(p
):
2569 '''port_direction_opt : '''
2571 print('port_direction_opt_2', list(p
))
2573 # { p[0] = NetNet::PIMPLICIT; }
2577 def p_property_expr_1(p
):
2578 '''property_expr : expression '''
2580 print('property_expr_1', list(p
))
2586 def p_procedural_assertion_statement_1(p
):
2587 '''procedural_assertion_statement : K_assert '(' expression ')' statement %prec less_than_K_else '''
2589 print('procedural_assertion_statement_1', list(p
))
2591 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2597 def p_procedural_assertion_statement_2(p
):
2598 '''procedural_assertion_statement : K_assert '(' expression ')' K_else statement '''
2600 print('procedural_assertion_statement_2', list(p
))
2602 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2608 def p_procedural_assertion_statement_3(p
):
2609 '''procedural_assertion_statement : K_assert '(' expression ')' statement K_else statement '''
2611 print('procedural_assertion_statement_3', list(p
))
2613 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2619 def p_property_qualifier_1(p
):
2620 '''property_qualifier : class_item_qualifier '''
2622 print('property_qualifier_1', list(p
))
2628 def p_property_qualifier_2(p
):
2629 '''property_qualifier : random_qualifier '''
2631 print('property_qualifier_2', list(p
))
2637 def p_property_qualifier_opt_1(p
):
2638 '''property_qualifier_opt : property_qualifier_list '''
2640 print('property_qualifier_opt_1', list(p
))
2647 def p_property_qualifier_opt_2(p
):
2648 '''property_qualifier_opt : '''
2650 print('property_qualifier_opt_2', list(p
))
2652 # { p[0] = property_qualifier_t::make_none(); }
2656 def p_property_qualifier_list_1(p
):
2657 '''property_qualifier_list : property_qualifier_list property_qualifier '''
2659 print('property_qualifier_list_1', list(p
))
2661 # { p[0] = p[1] | p[2]; }
2665 def p_property_qualifier_list_2(p
):
2666 '''property_qualifier_list : property_qualifier '''
2668 print('property_qualifier_list_2', list(p
))
2675 def p_property_spec_1(p
):
2676 '''property_spec : clocking_event_opt property_spec_disable_iff_opt property_expr '''
2678 print('property_spec_1', list(p
))
2684 def p_property_spec_disable_iff_opt_1(p
):
2685 '''property_spec_disable_iff_opt : K_disable K_iff '(' expression ')' '''
2687 print('property_spec_disable_iff_opt_1', list(p
))
2693 def p_property_spec_disable_iff_opt_2(p
):
2694 '''property_spec_disable_iff_opt : '''
2696 print('property_spec_disable_iff_opt_2', list(p
))
2702 def p_random_qualifier_1(p
):
2703 '''random_qualifier : K_rand '''
2705 print('random_qualifier_1', list(p
))
2707 # { p[0] = property_qualifier_t::make_rand(); }
2711 def p_random_qualifier_2(p
):
2712 '''random_qualifier : K_randc '''
2714 print('random_qualifier_2', list(p
))
2716 # { p[0] = property_qualifier_t::make_randc(); }
2720 def p_real_or_realtime_1(p
):
2721 '''real_or_realtime : K_real '''
2723 print('real_or_realtime_1', list(p
))
2729 def p_real_or_realtime_2(p
):
2730 '''real_or_realtime : K_realtime '''
2732 print('real_or_realtime_2', list(p
))
2739 '''signing : K_signed '''
2741 print('signing_1', list(p
))
2749 '''signing : K_unsigned '''
2751 print('signing_2', list(p
))
2758 def p_simple_type_or_string_1(p
):
2759 '''simple_type_or_string : integer_vector_type '''
2761 print('simple_type_or_string_1', list(p
))
2763 # { ivl_variable_type_t use_vtype = p[1];
2764 # bool reg_flag = false;
2765 # if (use_vtype == IVL_VT_NO_TYPE) {
2766 # use_vtype = IVL_VT_LOGIC;
2769 # vector_type_t*tmp = new vector_type_t(use_vtype, false, 0);
2770 # tmp->reg_flag = reg_flag;
2771 # FILE_NAME(tmp, @1);
2777 def p_simple_type_or_string_2(p
):
2778 '''simple_type_or_string : non_integer_type '''
2780 print('simple_type_or_string_2', list(p
))
2782 # { real_type_t*tmp = new real_type_t(p[1]);
2783 # FILE_NAME(tmp, @1);
2789 def p_simple_type_or_string_3(p
):
2790 '''simple_type_or_string : atom2_type '''
2792 print('simple_type_or_string_3', list(p
))
2794 # { atom2_type_t*tmp = new atom2_type_t(p[1], true);
2795 # FILE_NAME(tmp, @1);
2801 def p_simple_type_or_string_4(p
):
2802 '''simple_type_or_string : K_integer '''
2804 print('simple_type_or_string_4', list(p
))
2806 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
2807 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd);
2808 # tmp->reg_flag = true;
2809 # tmp->integer_flag = true;
2815 def p_simple_type_or_string_5(p
):
2816 '''simple_type_or_string : K_time '''
2818 print('simple_type_or_string_5', list(p
))
2820 # { list<pform_range_t>*pd = make_range_from_width(64);
2821 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
2822 # tmp->reg_flag = !gn_system_verilog();
2828 def p_simple_type_or_string_6(p
):
2829 '''simple_type_or_string : TYPE_IDENTIFIER '''
2831 print('simple_type_or_string_6', list(p
))
2833 # { p[0] = p[1].type;
2834 # delete[]p[1].text;
2839 def p_simple_type_or_string_7(p
):
2840 '''simple_type_or_string : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_simple_type_or_string TYPE_IDENTIFIER '''
2842 print('simple_type_or_string_7', list(p
))
2844 # { lex_in_package_scope(0);
2846 # delete[]p[4].text;
2851 def p_simple_type_or_string_8(p
):
2852 '''simple_type_or_string : K_string '''
2854 print('simple_type_or_string_8', list(p
))
2856 # { string_type_t*tmp = new string_type_t;
2857 # FILE_NAME(tmp, @1);
2863 def p__embed0_simple_type_or_string(p
):
2864 '''_embed0_simple_type_or_string : '''
2866 # { lex_in_package_scope(p[1]); }
2870 def p_statement_1(p
):
2871 '''statement : attribute_list_opt statement_item '''
2873 print('statement_1', list(p
))
2875 # { pform_bind_attributes(p[2]->attributes, p[1]);
2883 def p_statement_or_null_1(p
):
2884 '''statement_or_null : statement '''
2886 print('statement_or_null_1', list(p
))
2893 def p_statement_or_null_2(p
):
2894 '''statement_or_null : attribute_list_opt ';' '''
2896 print('statement_or_null_2', list(p
))
2898 raise(Exception("p_statement_or_null_2"))
2904 def p_stream_expression_1(p
):
2905 '''stream_expression : expression '''
2907 print('stream_expression_1', list(p
))
2913 def p_stream_expression_list_1(p
):
2914 '''stream_expression_list : stream_expression_list ',' stream_expression '''
2916 print('stream_expression_list_1', list(p
))
2922 def p_stream_expression_list_2(p
):
2923 '''stream_expression_list : stream_expression '''
2925 print('stream_expression_list_2', list(p
))
2931 def p_stream_operator_1(p
):
2932 '''stream_operator : K_LS '''
2934 print('stream_operator_1', list(p
))
2940 def p_stream_operator_2(p
):
2941 '''stream_operator : K_RS '''
2943 print('stream_operator_2', list(p
))
2949 def p_streaming_concatenation_1(p
):
2950 '''streaming_concatenation : '{' stream_operator '{' stream_expression_list '}' '}' '''
2952 print('streaming_concatenation_1', list(p
))
2954 # { /* streaming concatenation is a SystemVerilog thing. */
2955 # if (gn_system_verilog()) {
2956 # yyerror(@2, "sorry: Streaming concatenation not supported.");
2959 # yyerror(@2, "error: Streaming concatenation requires SystemVerilog");
2966 def p_task_declaration_1(p
):
2967 '''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 '''
2969 print('task_declaration_1', list(p
))
2971 # { // Last step: check any closing name. This is done late so
2972 # // that the parser can look ahead to detect the present
2973 # // endlabel_opt but still have the pform_endmodule() called
2974 # // early enough that the lexor can know we are outside the
2977 # if (strcmp(p[3],p[10]) != 0) {
2978 # yyerror(@10, "error: End label doesn't match task name");
2980 # if (! gn_system_verilog()) {
2981 # yyerror(@10, "error: Task end labels require "
2982 # "SystemVerilog.");
2991 def p_task_declaration_2(p
):
2992 '''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 '''
2994 print('task_declaration_2', list(p
))
2996 # { // Last step: check any closing name. This is done late so
2997 # // that the parser can look ahead to detect the present
2998 # // endlabel_opt but still have the pform_endmodule() called
2999 # // early enough that the lexor can know we are outside the
3002 # if (strcmp(p[3],p[13]) != 0) {
3003 # yyerror(@13, "error: End label doesn't match task name");
3005 # if (! gn_system_verilog()) {
3006 # yyerror(@13, "error: Task end labels require "
3007 # "SystemVerilog.");
3016 def p_task_declaration_3(p
):
3017 '''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 '''
3019 print('task_declaration_3', list(p
))
3021 # { // Last step: check any closing name. This is done late so
3022 # // that the parser can look ahead to detect the present
3023 # // endlabel_opt but still have the pform_endmodule() called
3024 # // early enough that the lexor can know we are outside the
3027 # if (strcmp(p[3],p[12]) != 0) {
3028 # yyerror(@12, "error: End label doesn't match task name");
3030 # if (! gn_system_verilog()) {
3031 # yyerror(@12, "error: Task end labels require "
3032 # "SystemVerilog.");
3041 def p_task_declaration_4(p
):
3042 '''task_declaration : K_task lifetime_opt IDENTIFIER error K_endtask _embed6_task_declaration endlabel_opt '''
3044 print('task_declaration_4', list(p
))
3046 # { // Last step: check any closing name. This is done late so
3047 # // that the parser can look ahead to detect the present
3048 # // endlabel_opt but still have the pform_endmodule() called
3049 # // early enough that the lexor can know we are outside the
3052 # if (strcmp(p[3],p[7]) != 0) {
3053 # yyerror(@7, "error: End label doesn't match task name");
3055 # if (! gn_system_verilog()) {
3056 # yyerror(@7, "error: Task end labels require "
3057 # "SystemVerilog.");
3066 def p__embed0_task_declaration(p
):
3067 '''_embed0_task_declaration : '''
3069 # { assert(current_task == 0);
3070 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3075 def p__embed1_task_declaration(p
):
3076 '''_embed1_task_declaration : '''
3078 # { current_task->set_ports(p[6]);
3079 # current_task_set_statement(@3, p[7]);
3080 # pform_set_this_class(@3, current_task);
3081 # pform_pop_scope();
3083 # if (p[7] && p[7]->size() > 1 && !gn_system_verilog()) {
3084 # yyerror(@7, "error: Task body with multiple statements requires SystemVerilog.");
3091 def p__embed2_task_declaration(p
):
3092 '''_embed2_task_declaration : '''
3094 # { assert(current_task == 0);
3095 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3100 def p__embed3_task_declaration(p
):
3101 '''_embed3_task_declaration : '''
3103 # { current_task->set_ports(p[6]);
3104 # current_task_set_statement(@3, p[10]);
3105 # pform_set_this_class(@3, current_task);
3106 # pform_pop_scope();
3108 # if (p[10]) delete p[10];
3113 def p__embed4_task_declaration(p
):
3114 '''_embed4_task_declaration : '''
3116 # { assert(current_task == 0);
3117 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3122 def p__embed5_task_declaration(p
):
3123 '''_embed5_task_declaration : '''
3125 # { current_task->set_ports(0);
3126 # current_task_set_statement(@3, p[9]);
3127 # pform_set_this_class(@3, current_task);
3128 # if (! current_task->method_of()) {
3129 # cerr << @3 << ": warning: task definition for \"" << p[3]
3130 # << "\" has an empty port declaration list!" << endl;
3132 # pform_pop_scope();
3134 # if (p[9]->size() > 1 && !gn_system_verilog()) {
3135 # yyerror(@9, "error: Task body with multiple statements requires SystemVerilog.");
3142 def p__embed6_task_declaration(p
):
3143 '''_embed6_task_declaration : '''
3146 # if (current_task) {
3147 # pform_pop_scope();
3154 def p_tf_port_declaration_1(p
):
3155 '''tf_port_declaration : port_direction K_reg_opt unsigned_signed_opt dimensions_opt list_of_identifiers ';' '''
3157 print('tf_port_declaration_1', list(p
))
3159 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1],
3160 # p[2] ? IVL_VT_LOGIC :
3162 # p[3], p[4], p[5]);
3168 def p_tf_port_declaration_2(p
):
3169 '''tf_port_declaration : port_direction K_integer list_of_identifiers ';' '''
3171 print('tf_port_declaration_2', list(p
))
3173 # { list<pform_range_t>*range_stub = make_range_from_width(integer_width);
3174 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, true,
3175 # range_stub, p[3], true);
3181 def p_tf_port_declaration_3(p
):
3182 '''tf_port_declaration : port_direction K_time list_of_identifiers ';' '''
3184 print('tf_port_declaration_3', list(p
))
3186 # { list<pform_range_t>*range_stub = make_range_from_width(64);
3187 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, false,
3188 # range_stub, p[3]);
3194 def p_tf_port_declaration_4(p
):
3195 '''tf_port_declaration : port_direction real_or_realtime list_of_identifiers ';' '''
3197 print('tf_port_declaration_4', list(p
))
3199 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_REAL, true,
3206 def p_tf_port_declaration_5(p
):
3207 '''tf_port_declaration : port_direction K_string list_of_identifiers ';' '''
3209 print('tf_port_declaration_5', list(p
))
3211 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_STRING, true,
3218 def p_tf_port_item_1(p
):
3219 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER dimensions_opt tf_port_item_expr_opt '''
3221 print('tf_port_item_1', list(p
))
3223 # { vector<pform_tf_port_t>*tmp;
3224 # NetNet::PortType use_port_type = p[1];
3225 # if ((use_port_type == NetNet::PIMPLICIT) && (gn_system_verilog() || (p[2] == 0)))
3226 # use_port_type = port_declaration_context.port_type;
3227 # perm_string name = lex_strings.make(p[3]);
3228 # list<perm_string>* ilist = list_from_identifier(p[3]);
3230 # if (use_port_type == NetNet::PIMPLICIT) {
3231 # yyerror(@1, "error: missing task/function port direction.");
3232 # use_port_type = NetNet::PINPUT; // for error recovery
3234 # if ((p[2] == 0) && (p[1]==NetNet::PIMPLICIT)) {
3235 # // Detect special case this is an undecorated
3236 # // identifier and we need to get the declaration from
3239 # yyerror(@4, "internal error: How can there be an unpacked range here?\n");
3241 # tmp = pform_make_task_ports(@3, use_port_type,
3242 # port_declaration_context.data_type,
3246 # // Otherwise, the decorations for this identifier
3247 # // indicate the type. Save the type for any right
3248 # // context that may come later.
3249 # port_declaration_context.port_type = use_port_type;
3251 # p[2] = new vector_type_t(IVL_VT_LOGIC, false, 0);
3252 # FILE_NAME(p[2], @3);
3254 # port_declaration_context.data_type = p[2];
3255 # tmp = pform_make_task_ports(@3, use_port_type, p[2], ilist);
3258 # pform_set_reg_idx(name, p[4]);
3263 # assert(tmp->size()==1);
3264 # tmp->front().defe = p[5];
3270 def p_tf_port_item_2(p
):
3271 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER error '''
3273 print('tf_port_item_2', list(p
))
3275 # { yyerror(@3, "error: Error in task/function port item after port name %s.", p[3]);
3282 def p_tf_port_item_expr_opt_1(p
):
3283 '''tf_port_item_expr_opt : '=' expression '''
3285 print('tf_port_item_expr_opt_1', list(p
))
3287 # { if (! gn_system_verilog()) {
3288 # yyerror(@1, "error: Task/function default arguments require "
3289 # "SystemVerilog.");
3296 def p_tf_port_item_expr_opt_2(p
):
3297 '''tf_port_item_expr_opt : '''
3299 print('tf_port_item_expr_opt_2', list(p
))
3305 def p_tf_port_list_1(p
):
3306 '''tf_port_list : _embed0_tf_port_list tf_port_item_list '''
3308 print('tf_port_list_1', list(p
))
3315 def p__embed0_tf_port_list(p
):
3316 '''_embed0_tf_port_list : '''
3318 # { port_declaration_context.port_type = gn_system_verilog() ? NetNet::PINPUT : NetNet::PIMPLICIT;
3319 # port_declaration_context.data_type = 0;
3324 def p_tf_port_item_list_1(p
):
3325 '''tf_port_item_list : tf_port_item_list ',' tf_port_item '''
3327 print('tf_port_item_list_1', list(p
))
3329 # { vector<pform_tf_port_t>*tmp;
3330 # if (p[1] && p[3]) {
3331 # size_t s1 = p[1]->size();
3333 # tmp->resize(tmp->size()+p[3]->size());
3334 # for (size_t idx = 0 ; idx < p[3]->size() ; idx += 1)
3335 # tmp->at(s1+idx) = p[3]->at(idx);
3337 # } else if (p[1]) {
3347 def p_tf_port_item_list_2(p
):
3348 '''tf_port_item_list : tf_port_item '''
3350 print('tf_port_item_list_2', list(p
))
3357 def p_tf_port_item_list_3(p
):
3358 '''tf_port_item_list : error ',' tf_port_item '''
3360 print('tf_port_item_list_3', list(p
))
3362 # { yyerror(@2, "error: Syntax error in task/function port declaration.");
3368 def p_tf_port_item_list_4(p
):
3369 '''tf_port_item_list : tf_port_item_list ',' '''
3371 print('tf_port_item_list_4', list(p
))
3373 # { yyerror(@2, "error: NULL port declarations are not allowed.");
3379 def p_tf_port_item_list_5(p
):
3380 '''tf_port_item_list : tf_port_item_list ';' '''
3382 print('tf_port_item_list_5', list(p
))
3384 # { yyerror(@2, "error: ';' is an invalid port declaration separator.");
3390 def p_timeunits_declaration_1(p
):
3391 '''timeunits_declaration : K_timeunit TIME_LITERAL ';' '''
3393 print('timeunits_declaration_1', list(p
))
3395 # { pform_set_timeunit(p[2], allow_timeunit_decl); }
3399 def p_timeunits_declaration_2(p
):
3400 '''timeunits_declaration : K_timeunit TIME_LITERAL '/' TIME_LITERAL ';' '''
3402 print('timeunits_declaration_2', list(p
))
3404 # { bool initial_decl = allow_timeunit_decl && allow_timeprec_decl;
3405 # pform_set_timeunit(p[2], initial_decl);
3406 # pform_set_timeprec(p[4], initial_decl);
3411 def p_timeunits_declaration_3(p
):
3412 '''timeunits_declaration : K_timeprecision TIME_LITERAL ';' '''
3414 print('timeunits_declaration_3', list(p
))
3416 # { pform_set_timeprec(p[2], allow_timeprec_decl); }
3420 def p_timeunits_declaration_opt_1(p
):
3421 '''timeunits_declaration_opt : %prec no_timeunits_declaration '''
3422 if(parse_debug
> 2):
3423 print('timeunits_declaration_opt_1', list(p
))
3429 def p_timeunits_declaration_opt_2(p
):
3430 '''timeunits_declaration_opt : timeunits_declaration %prec one_timeunits_declaration '''
3432 print('timeunits_declaration_opt_2', list(p
))
3438 def p_timeunits_declaration_opt_3(p
):
3439 '''timeunits_declaration_opt : timeunits_declaration timeunits_declaration '''
3441 print('timeunits_declaration_opt_3', list(p
))
3447 def p_value_range_1(p
):
3448 '''value_range : expression '''
3450 print('value_range_1', list(p
))
3456 def p_value_range_2(p
):
3457 '''value_range : '[' expression ':' expression ']' '''
3459 print('value_range_2', list(p
))
3465 def p_variable_dimension_1(p
):
3466 '''variable_dimension : '[' expression ':' expression ']' '''
3468 print('variable_dimension_1', list(p
))
3469 # { list<pform_range_t> *tmp = new list<pform_range_t>;
3470 # pform_range_t index (p[2],p[4]);
3471 # tmp->push_back(index);
3474 # XXX TODO: subscriptlist
3477 if end
.endswith("-1"):
3480 end
= str(int(end
)+1)
3483 p
[0] = '[%s:%s]' % (start
, end
) # python slice is LO:HI+1
3489 def p_variable_dimension_2(p
):
3490 '''variable_dimension : '[' expression ']' '''
3492 print('variable_dimension_2', list(p
))
3494 # { // SystemVerilog canonical range
3495 # if (!gn_system_verilog()) {
3497 # cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. "
3498 # << "Use at least -g2005-sv to remove this warning." << endl;
3500 # list<pform_range_t> *tmp = new list<pform_range_t>;
3501 # pform_range_t index;
3502 # index.first = new PENumber(new verinum((uint64_t)0, integer_width));
3503 # index.second = new PEBinary('-', p[2], new PENumber(new verinum((uint64_t)1, integer_width)));
3504 # tmp->push_back(index);
3510 def p_variable_dimension_3(p
):
3511 '''variable_dimension : '[' ']' '''
3513 print('variable_dimension_3', list(p
))
3515 # { list<pform_range_t> *tmp = new list<pform_range_t>;
3516 # pform_range_t index (0,0);
3517 # tmp->push_back(index);
3523 def p_variable_dimension_4(p
):
3524 '''variable_dimension : '[' '$' ']' '''
3526 print('variable_dimension_4', list(p
))
3528 # { // SystemVerilog queue
3529 # list<pform_range_t> *tmp = new list<pform_range_t>;
3530 # pform_range_t index (new PENull,0);
3531 # if (!gn_system_verilog()) {
3532 # yyerror("error: Queue declarations require SystemVerilog.");
3534 # tmp->push_back(index);
3540 def p_variable_lifetime_1(p
):
3541 '''variable_lifetime : lifetime '''
3543 print('variable_lifetime_1', list(p
))
3545 # { if (!gn_system_verilog()) {
3546 # yyerror(@1, "error: overriding the default variable lifetime "
3547 # "requires SystemVerilog.");
3548 # } else if (p[1] != pform_peek_scope()->default_lifetime) {
3549 # yyerror(@1, "sorry: overriding the default variable lifetime "
3550 # "is not yet supported.");
3552 # var_lifetime = p[1];
3557 def p_attribute_list_opt_1(p
):
3558 '''attribute_list_opt : attribute_instance_list '''
3560 print('attribute_list_opt_1', list(p
))
3567 def p_attribute_list_opt_2(p
):
3568 '''attribute_list_opt : '''
3569 if(parse_debug
> 2):
3570 print('attribute_list_opt_2', list(p
))
3576 def p_attribute_instance_list_1(p
):
3577 '''attribute_instance_list : K_PSTAR K_STARP '''
3579 print('attribute_instance_list_1', list(p
))
3585 def p_attribute_instance_list_2(p
):
3586 '''attribute_instance_list : K_PSTAR attribute_list K_STARP '''
3588 print('attribute_instance_list_2', list(p
))
3595 def p_attribute_instance_list_3(p
):
3596 '''attribute_instance_list : attribute_instance_list K_PSTAR K_STARP '''
3598 print('attribute_instance_list_3', list(p
))
3605 def p_attribute_instance_list_4(p
):
3606 '''attribute_instance_list : attribute_instance_list K_PSTAR attribute_list K_STARP '''
3608 print('attribute_instance_list_4', list(p
))
3610 # { list<named_pexpr_t>*tmp = p[1];
3612 # tmp->splice(tmp->end(), *p[3]);
3615 # } else p[0] = p[3];
3620 def p_attribute_list_1(p
):
3621 '''attribute_list : attribute_list ',' attribute '''
3623 print('attribute_list_1', list(p
))
3625 # { list<named_pexpr_t>*tmp = p[1];
3626 # tmp->push_back(*p[3]);
3633 def p_attribute_list_2(p
):
3634 '''attribute_list : attribute '''
3636 print('attribute_list_2', list(p
))
3638 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
3639 # tmp->push_back(*p[1]);
3646 def p_attribute_1(p
):
3647 '''attribute : IDENTIFIER '''
3649 print('attribute_1', list(p
))
3651 # { named_pexpr_t*tmp = new named_pexpr_t;
3652 # tmp->name = lex_strings.make(p[1]);
3660 def p_attribute_2(p
):
3661 '''attribute : IDENTIFIER '=' expression '''
3663 print('attribute_2', list(p
))
3665 # { PExpr*tmp = p[3];
3666 # named_pexpr_t*tmp2 = new named_pexpr_t;
3667 # tmp2->name = lex_strings.make(p[1]);
3675 def p_block_item_decl_1(p
):
3676 '''block_item_decl : data_type register_variable_list ';' '''
3678 print('block_item_decl_1', list(p
))
3680 # { if (p[1]) pform_set_data_type(@1, p[1], p[2], NetNet::REG, attributes_in_context);
3685 def p_block_item_decl_2(p
):
3686 '''block_item_decl : variable_lifetime data_type register_variable_list ';' '''
3688 print('block_item_decl_2', list(p
))
3690 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
3691 # var_lifetime = LexicalScope::INHERITED;
3696 def p_block_item_decl_3(p
):
3697 '''block_item_decl : K_reg data_type register_variable_list ';' '''
3699 print('block_item_decl_3', list(p
))
3701 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
3706 def p_block_item_decl_4(p
):
3707 '''block_item_decl : variable_lifetime K_reg data_type register_variable_list ';' '''
3709 print('block_item_decl_4', list(p
))
3711 # { if (p[3]) pform_set_data_type(@3, p[3], p[4], NetNet::REG, attributes_in_context);
3712 # var_lifetime = LexicalScope::INHERITED;
3717 def p_block_item_decl_5(p
):
3718 '''block_item_decl : K_event event_variable_list ';' '''
3720 print('block_item_decl_5', list(p
))
3722 # { if (p[2]) pform_make_events(p[2], @1.text, @1.first_line);
3727 def p_block_item_decl_6(p
):
3728 '''block_item_decl : K_parameter param_type parameter_assign_list ';' '''
3730 print('block_item_decl_6', list(p
))
3736 def p_block_item_decl_7(p
):
3737 '''block_item_decl : K_localparam param_type localparam_assign_list ';' '''
3739 print('block_item_decl_7', list(p
))
3745 def p_block_item_decl_8(p
):
3746 '''block_item_decl : type_declaration '''
3748 print('block_item_decl_8', list(p
))
3754 def p_block_item_decl_9(p
):
3755 '''block_item_decl : K_integer error ';' '''
3757 print('block_item_decl_9', list(p
))
3759 # { yyerror(@1, "error: syntax error in integer variable list.");
3765 def p_block_item_decl_10(p
):
3766 '''block_item_decl : K_time error ';' '''
3768 print('block_item_decl_10', list(p
))
3770 # { yyerror(@1, "error: syntax error in time variable list.");
3776 def p_block_item_decl_11(p
):
3777 '''block_item_decl : K_parameter error ';' '''
3779 print('block_item_decl_11', list(p
))
3781 # { yyerror(@1, "error: syntax error in parameter list.");
3787 def p_block_item_decl_12(p
):
3788 '''block_item_decl : K_localparam error ';' '''
3790 print('block_item_decl_12', list(p
))
3792 # { yyerror(@1, "error: syntax error localparam list.");
3798 def p_block_item_decls_1(p
):
3799 '''block_item_decls : block_item_decl '''
3801 print('block_item_decls_1', list(p
))
3807 def p_block_item_decls_2(p
):
3808 '''block_item_decls : block_item_decls block_item_decl '''
3810 print('block_item_decls_2', list(p
))
3816 def p_block_item_decls_opt_1(p
):
3817 '''block_item_decls_opt : block_item_decls '''
3819 print('block_item_decls_opt_1', list(p
))
3826 def p_block_item_decls_opt_2(p
):
3827 '''block_item_decls_opt : '''
3829 print('block_item_decls_opt_2', list(p
))
3836 def p_type_declaration_1(p
):
3837 '''type_declaration : K_typedef data_type IDENTIFIER dimensions_opt ';' '''
3839 print('type_declaration_1', list(p
))
3841 # { perm_string name = lex_strings.make(p[3]);
3842 # pform_set_typedef(name, p[2], p[4]);
3848 def p_type_declaration_2(p
):
3849 '''type_declaration : K_typedef data_type TYPE_IDENTIFIER ';' '''
3851 print('type_declaration_2', list(p
))
3853 # { perm_string name = lex_strings.make(p[3].text);
3854 # if (pform_test_type_identifier_local(name)) {
3855 # yyerror(@3, "error: Typedef identifier \"%s\" is already a type name.", p[3].text);
3858 # pform_set_typedef(name, p[2], NULL);
3860 # delete[]p[3].text;
3865 def p_type_declaration_3(p
):
3866 '''type_declaration : K_typedef K_class IDENTIFIER ';' '''
3868 print('type_declaration_3', list(p
))
3870 # { // Create a synthetic typedef for the class name so that the
3871 # // lexor detects the name as a type.
3872 # perm_string name = lex_strings.make(p[3]);
3873 # class_type_t*tmp = new class_type_t(name);
3874 # FILE_NAME(tmp, @3);
3875 # pform_set_typedef(name, tmp, NULL);
3881 def p_type_declaration_4(p
):
3882 '''type_declaration : K_typedef K_enum IDENTIFIER ';' '''
3884 print('type_declaration_4', list(p
))
3886 # { yyerror(@1, "sorry: Enum forward declarations not supported yet."); }
3890 def p_type_declaration_5(p
):
3891 '''type_declaration : K_typedef K_struct IDENTIFIER ';' '''
3893 print('type_declaration_5', list(p
))
3895 # { yyerror(@1, "sorry: Struct forward declarations not supported yet."); }
3899 def p_type_declaration_6(p
):
3900 '''type_declaration : K_typedef K_union IDENTIFIER ';' '''
3902 print('type_declaration_6', list(p
))
3904 # { yyerror(@1, "sorry: Union forward declarations not supported yet."); }
3908 def p_type_declaration_7(p
):
3909 '''type_declaration : K_typedef IDENTIFIER ';' '''
3911 print('type_declaration_7', list(p
))
3913 # { // Create a synthetic typedef for the class name so that the
3914 # // lexor detects the name as a type.
3915 # perm_string name = lex_strings.make(p[2]);
3916 # class_type_t*tmp = new class_type_t(name);
3917 # FILE_NAME(tmp, @2);
3918 # pform_set_typedef(name, tmp, NULL);
3924 def p_type_declaration_8(p
):
3925 '''type_declaration : K_typedef error ';' '''
3927 print('type_declaration_8', list(p
))
3929 # { yyerror(@2, "error: Syntax error in typedef clause.");
3935 def p_enum_data_type_1(p
):
3936 '''enum_data_type : K_enum '{' enum_name_list '}' '''
3938 print('enum_data_type_1', list(p
))
3940 # { enum_type_t*enum_type = new enum_type_t;
3941 # FILE_NAME(enum_type, @1);
3942 # enum_type->names .reset(p[3]);
3943 # enum_type->base_type = IVL_VT_BOOL;
3944 # enum_type->signed_flag = true;
3945 # enum_type->integer_flag = false;
3946 # enum_type->range.reset(make_range_from_width(32));
3952 def p_enum_data_type_2(p
):
3953 '''enum_data_type : K_enum atom2_type signed_unsigned_opt '{' enum_name_list '}' '''
3955 print('enum_data_type_2', list(p
))
3957 # { enum_type_t*enum_type = new enum_type_t;
3958 # FILE_NAME(enum_type, @1);
3959 # enum_type->names .reset(p[5]);
3960 # enum_type->base_type = IVL_VT_BOOL;
3961 # enum_type->signed_flag = p[3];
3962 # enum_type->integer_flag = false;
3963 # enum_type->range.reset(make_range_from_width(p[2]));
3969 def p_enum_data_type_3(p
):
3970 '''enum_data_type : K_enum K_integer signed_unsigned_opt '{' enum_name_list '}' '''
3972 print('enum_data_type_3', list(p
))
3974 # { enum_type_t*enum_type = new enum_type_t;
3975 # FILE_NAME(enum_type, @1);
3976 # enum_type->names .reset(p[5]);
3977 # enum_type->base_type = IVL_VT_LOGIC;
3978 # enum_type->signed_flag = p[3];
3979 # enum_type->integer_flag = true;
3980 # enum_type->range.reset(make_range_from_width(integer_width));
3986 def p_enum_data_type_4(p
):
3987 '''enum_data_type : K_enum K_logic unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
3989 print('enum_data_type_4', list(p
))
3991 # { enum_type_t*enum_type = new enum_type_t;
3992 # FILE_NAME(enum_type, @1);
3993 # enum_type->names .reset(p[6]);
3994 # enum_type->base_type = IVL_VT_LOGIC;
3995 # enum_type->signed_flag = p[3];
3996 # enum_type->integer_flag = false;
3997 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4003 def p_enum_data_type_5(p
):
4004 '''enum_data_type : K_enum K_reg unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
4006 print('enum_data_type_5', list(p
))
4008 # { enum_type_t*enum_type = new enum_type_t;
4009 # FILE_NAME(enum_type, @1);
4010 # enum_type->names .reset(p[6]);
4011 # enum_type->base_type = IVL_VT_LOGIC;
4012 # enum_type->signed_flag = p[3];
4013 # enum_type->integer_flag = false;
4014 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4020 def p_enum_data_type_6(p
):
4021 '''enum_data_type : K_enum K_bit unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
4023 print('enum_data_type_6', list(p
))
4025 # { enum_type_t*enum_type = new enum_type_t;
4026 # FILE_NAME(enum_type, @1);
4027 # enum_type->names .reset(p[6]);
4028 # enum_type->base_type = IVL_VT_BOOL;
4029 # enum_type->signed_flag = p[3];
4030 # enum_type->integer_flag = false;
4031 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4037 def p_enum_name_list_1(p
):
4038 '''enum_name_list : enum_name '''
4040 print('enum_name_list_1', list(p
))
4047 def p_enum_name_list_2(p
):
4048 '''enum_name_list : enum_name_list ',' enum_name '''
4050 print('enum_name_list_2', list(p
))
4052 # { list<named_pexpr_t>*lst = p[1];
4053 # lst->splice(lst->end(), *p[3]);
4060 def p_pos_neg_number_1(p
):
4061 '''pos_neg_number : number '''
4063 print('pos_neg_number_1', list(p
))
4070 def p_pos_neg_number_2(p
):
4071 '''pos_neg_number : '-' number '''
4073 print('pos_neg_number_2', list(p
))
4075 # { verinum tmp = -(*(p[2]));
4082 def p_enum_name_1(p
):
4083 '''enum_name : IDENTIFIER '''
4085 print('enum_name_1', list(p
))
4087 # { perm_string name = lex_strings.make(p[1]);
4089 # p[0] = make_named_number(name);
4094 def p_enum_name_2(p
):
4095 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '''
4097 print('enum_name_2', list(p
))
4099 # { perm_string name = lex_strings.make(p[1]);
4100 # long count = check_enum_seq_value(@1, p[3], false);
4102 # p[0] = make_named_numbers(name, 0, count-1);
4108 def p_enum_name_3(p
):
4109 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '''
4111 print('enum_name_3', list(p
))
4113 # { perm_string name = lex_strings.make(p[1]);
4114 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
4115 # check_enum_seq_value(@1, p[5], true));
4123 def p_enum_name_4(p
):
4124 '''enum_name : IDENTIFIER '=' expression '''
4126 print('enum_name_4', list(p
))
4128 # { perm_string name = lex_strings.make(p[1]);
4130 # p[0] = make_named_number(name, p[3]);
4135 def p_enum_name_5(p
):
4136 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '=' expression '''
4138 print('enum_name_5', list(p
))
4140 # { perm_string name = lex_strings.make(p[1]);
4141 # long count = check_enum_seq_value(@1, p[3], false);
4142 # p[0] = make_named_numbers(name, 0, count-1, p[6]);
4149 def p_enum_name_6(p
):
4150 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '=' expression '''
4152 print('enum_name_6', list(p
))
4154 # { perm_string name = lex_strings.make(p[1]);
4155 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
4156 # check_enum_seq_value(@1, p[5], true), p[8]);
4164 def p_struct_data_type_1(p
):
4165 '''struct_data_type : K_struct K_packed_opt '{' struct_union_member_list '}' '''
4167 print('struct_data_type_1', list(p
))
4169 # { struct_type_t*tmp = new struct_type_t;
4170 # FILE_NAME(tmp, @1);
4171 # tmp->packed_flag = p[2];
4172 # tmp->union_flag = false;
4173 # tmp->members .reset(p[4]);
4179 def p_struct_data_type_2(p
):
4180 '''struct_data_type : K_union K_packed_opt '{' struct_union_member_list '}' '''
4182 print('struct_data_type_2', list(p
))
4184 # { struct_type_t*tmp = new struct_type_t;
4185 # FILE_NAME(tmp, @1);
4186 # tmp->packed_flag = p[2];
4187 # tmp->union_flag = true;
4188 # tmp->members .reset(p[4]);
4194 def p_struct_data_type_3(p
):
4195 '''struct_data_type : K_struct K_packed_opt '{' error '}' '''
4197 print('struct_data_type_3', list(p
))
4199 # { yyerror(@3, "error: Errors in struct member list.");
4201 # struct_type_t*tmp = new struct_type_t;
4202 # FILE_NAME(tmp, @1);
4203 # tmp->packed_flag = p[2];
4204 # tmp->union_flag = false;
4210 def p_struct_data_type_4(p
):
4211 '''struct_data_type : K_union K_packed_opt '{' error '}' '''
4213 print('struct_data_type_4', list(p
))
4215 # { yyerror(@3, "error: Errors in union member list.");
4217 # struct_type_t*tmp = new struct_type_t;
4218 # FILE_NAME(tmp, @1);
4219 # tmp->packed_flag = p[2];
4220 # tmp->union_flag = true;
4226 def p_struct_union_member_list_1(p
):
4227 '''struct_union_member_list : struct_union_member_list struct_union_member '''
4229 print('struct_union_member_list_1', list(p
))
4231 # { list<struct_member_t*>*tmp = p[1];
4232 # tmp->push_back(p[2]);
4238 def p_struct_union_member_list_2(p
):
4239 '''struct_union_member_list : struct_union_member '''
4241 print('struct_union_member_list_2', list(p
))
4243 # { list<struct_member_t*>*tmp = new list<struct_member_t*>;
4244 # tmp->push_back(p[1]);
4250 def p_struct_union_member_1(p
):
4251 '''struct_union_member : attribute_list_opt data_type list_of_variable_decl_assignments ';' '''
4253 print('struct_union_member_1', list(p
))
4255 # { struct_member_t*tmp = new struct_member_t;
4256 # FILE_NAME(tmp, @2);
4257 # tmp->type .reset(p[2]);
4258 # tmp->names .reset(p[3]);
4264 def p_struct_union_member_2(p
):
4265 '''struct_union_member : error ';' '''
4267 print('struct_union_member_2', list(p
))
4269 # { yyerror(@2, "Error in struct/union member.");
4276 def p_case_item_1(p
):
4277 '''case_item : expression_list_proper ':' statement_or_null '''
4279 print('case_item_1', list(p
))
4281 # { PCase::Item*tmp = new PCase::Item;
4282 # tmp->expr = *p[1];
4290 def p_case_item_2(p
):
4291 '''case_item : K_default ':' statement_or_null '''
4293 print('case_item_2', list(p
))
4295 # { PCase::Item*tmp = new PCase::Item;
4302 def p_case_item_3(p
):
4303 '''case_item : K_default statement_or_null '''
4305 print('case_item_3', list(p
))
4307 # { PCase::Item*tmp = new PCase::Item;
4314 def p_case_item_4(p
):
4315 '''case_item : error ':' statement_or_null '''
4317 print('case_item_4', list(p
))
4319 # { yyerror(@2, "error: Incomprehensible case expression.");
4325 def p_case_items_1(p
):
4326 '''case_items : case_items case_item '''
4328 print('case_items_1', list(p
))
4330 # { svector<PCase::Item*>*tmp;
4331 # tmp = new svector<PCase::Item*>(*p[1], p[2]);
4338 def p_case_items_2(p
):
4339 '''case_items : case_item '''
4341 print('case_items_2', list(p
))
4343 # { svector<PCase::Item*>*tmp = new svector<PCase::Item*>(1);
4350 def p_charge_strength_1(p
):
4351 '''charge_strength : '(' K_small ')' '''
4353 print('charge_strength_1', list(p
))
4359 def p_charge_strength_2(p
):
4360 '''charge_strength : '(' K_medium ')' '''
4362 print('charge_strength_2', list(p
))
4368 def p_charge_strength_3(p
):
4369 '''charge_strength : '(' K_large ')' '''
4371 print('charge_strength_3', list(p
))
4377 def p_charge_strength_opt_1(p
):
4378 '''charge_strength_opt : charge_strength '''
4380 print('charge_strength_opt_1', list(p
))
4386 def p_charge_strength_opt_2(p
):
4387 '''charge_strength_opt : '''
4389 print('charge_strength_opt_2', list(p
))
4395 def p_defparam_assign_1(p
):
4396 '''defparam_assign : hierarchy_identifier '=' expression '''
4398 print('defparam_assign_1', list(p
))
4400 # { pform_set_defparam(*p[1], p[3]);
4406 def p_defparam_assign_list_1(p
):
4407 '''defparam_assign_list : defparam_assign '''
4409 print('defparam_assign_list_1', list(p
))
4415 def p_defparam_assign_list_2(p
):
4416 '''defparam_assign_list : dimensions defparam_assign '''
4418 print('defparam_assign_list_2', list(p
))
4420 # { yyerror(@1, "error: defparam may not include a range.");
4426 def p_defparam_assign_list_3(p
):
4427 '''defparam_assign_list : defparam_assign_list ',' defparam_assign '''
4429 print('defparam_assign_list_3', list(p
))
4436 '''delay1 : '#' delay_value_simple '''
4438 print('delay1_1', list(p
))
4440 # { list<PExpr*>*tmp = new list<PExpr*>;
4441 # tmp->push_back(p[2]);
4448 '''delay1 : '#' '(' delay_value ')' '''
4450 print('delay1_2', list(p
))
4452 # { list<PExpr*>*tmp = new list<PExpr*>;
4453 # tmp->push_back(p[3]);
4460 '''delay3 : '#' delay_value_simple '''
4462 print('delay3_1', list(p
))
4464 # { list<PExpr*>*tmp = new list<PExpr*>;
4465 # tmp->push_back(p[2]);
4472 '''delay3 : '#' '(' delay_value ')' '''
4474 print('delay3_2', list(p
))
4476 # { list<PExpr*>*tmp = new list<PExpr*>;
4477 # tmp->push_back(p[3]);
4484 '''delay3 : '#' '(' delay_value ',' delay_value ')' '''
4486 print('delay3_3', list(p
))
4488 # { list<PExpr*>*tmp = new list<PExpr*>;
4489 # tmp->push_back(p[3]);
4490 # tmp->push_back(p[5]);
4497 '''delay3 : '#' '(' delay_value ',' delay_value ',' delay_value ')' '''
4499 print('delay3_4', list(p
))
4501 # { list<PExpr*>*tmp = new list<PExpr*>;
4502 # tmp->push_back(p[3]);
4503 # tmp->push_back(p[5]);
4504 # tmp->push_back(p[7]);
4510 def p_delay3_opt_1(p
):
4511 '''delay3_opt : delay3 '''
4513 print('delay3_opt_1', list(p
))
4520 def p_delay3_opt_2(p
):
4522 if(parse_debug
> 2):
4523 print('delay3_opt_2', list(p
))
4529 def p_delay_value_list_1(p
):
4530 '''delay_value_list : delay_value '''
4532 print('delay_value_list_1', list(p
))
4534 # { list<PExpr*>*tmp = new list<PExpr*>;
4535 # tmp->push_back(p[1]);
4541 def p_delay_value_list_2(p
):
4542 '''delay_value_list : delay_value_list ',' delay_value '''
4544 print('delay_value_list_2', list(p
))
4546 # { list<PExpr*>*tmp = p[1];
4547 # tmp->push_back(p[3]);
4553 def p_delay_value_1(p
):
4554 '''delay_value : expression '''
4556 print('delay_value_1', list(p
))
4558 # { PExpr*tmp = p[1];
4564 def p_delay_value_2(p
):
4565 '''delay_value : expression ':' expression ':' expression '''
4567 print('delay_value_2', list(p
))
4569 # { p[0] = pform_select_mtm_expr(p[1], p[3], p[5]); }
4573 def p_delay_value_simple_1(p
):
4574 '''delay_value_simple : DEC_NUMBER '''
4576 print('delay_value_simple_1', list(p
))
4578 # { verinum*tmp = p[1];
4580 # yyerror(@1, "internal error: delay.");
4583 # p[0] = new PENumber(tmp);
4584 # FILE_NAME(p[0], @1);
4591 def p_delay_value_simple_2(p
):
4592 '''delay_value_simple : REALTIME '''
4594 print('delay_value_simple_2', list(p
))
4596 # { verireal*tmp = p[1];
4598 # yyerror(@1, "internal error: delay.");
4601 # p[0] = new PEFNumber(tmp);
4602 # FILE_NAME(p[0], @1);
4608 def p_delay_value_simple_3(p
):
4609 '''delay_value_simple : IDENTIFIER '''
4611 print('delay_value_simple_3', list(p
))
4613 # { PEIdent*tmp = new PEIdent(lex_strings.make(p[1]));
4614 # FILE_NAME(tmp, @1);
4621 def p_delay_value_simple_4(p
):
4622 '''delay_value_simple : TIME_LITERAL '''
4624 print('delay_value_simple_4', list(p
))
4630 # if (p[1] == 0 || !get_time_unit(p[1], unit))
4631 # yyerror(@1, "internal error: delay.");
4633 # double p = pow(10.0,
4634 # (double)(unit - pform_get_timeunit()));
4635 # double time = atof(p[1]) * p;
4637 # verireal *v = new verireal(time);
4638 # p[0] = new PEFNumber(v);
4639 # FILE_NAME(p[0], @1);
4645 def p_optional_semicolon_1(p
):
4646 '''optional_semicolon : ';' '''
4648 print('optional_semicolon_1', list(p
))
4654 def p_optional_semicolon_2(p
):
4655 '''optional_semicolon : '''
4657 print('optional_semicolon_2', list(p
))
4663 def p_discipline_declaration_1(p
):
4664 '''discipline_declaration : K_discipline IDENTIFIER optional_semicolon _embed0_discipline_declaration discipline_items K_enddiscipline '''
4666 print('discipline_declaration_1', list(p
))
4668 # { pform_end_discipline(@1); delete[] p[2]; }
4672 def p__embed0_discipline_declaration(p
):
4673 '''_embed0_discipline_declaration : '''
4675 # { pform_start_discipline(p[2]); }
4679 def p_discipline_items_1(p
):
4680 '''discipline_items : discipline_items discipline_item '''
4682 print('discipline_items_1', list(p
))
4688 def p_discipline_items_2(p
):
4689 '''discipline_items : discipline_item '''
4691 print('discipline_items_2', list(p
))
4697 def p_discipline_item_1(p
):
4698 '''discipline_item : K_domain K_discrete ';' '''
4700 print('discipline_item_1', list(p
))
4702 # { pform_discipline_domain(@1, IVL_DIS_DISCRETE); }
4706 def p_discipline_item_2(p
):
4707 '''discipline_item : K_domain K_continuous ';' '''
4709 print('discipline_item_2', list(p
))
4711 # { pform_discipline_domain(@1, IVL_DIS_CONTINUOUS); }
4715 def p_discipline_item_3(p
):
4716 '''discipline_item : K_potential IDENTIFIER ';' '''
4718 print('discipline_item_3', list(p
))
4720 # { pform_discipline_potential(@1, p[2]); delete[] p[2]; }
4724 def p_discipline_item_4(p
):
4725 '''discipline_item : K_flow IDENTIFIER ';' '''
4727 print('discipline_item_4', list(p
))
4729 # { pform_discipline_flow(@1, p[2]); delete[] p[2]; }
4733 def p_nature_declaration_1(p
):
4734 '''nature_declaration : K_nature IDENTIFIER optional_semicolon _embed0_nature_declaration nature_items K_endnature '''
4736 print('nature_declaration_1', list(p
))
4738 # { pform_end_nature(@1); delete[] p[2]; }
4742 def p__embed0_nature_declaration(p
):
4743 '''_embed0_nature_declaration : '''
4745 # { pform_start_nature(p[2]); }
4749 def p_nature_items_1(p
):
4750 '''nature_items : nature_items nature_item '''
4752 print('nature_items_1', list(p
))
4758 def p_nature_items_2(p
):
4759 '''nature_items : nature_item '''
4761 print('nature_items_2', list(p
))
4767 def p_nature_item_1(p
):
4768 '''nature_item : K_units '=' STRING ';' '''
4770 print('nature_item_1', list(p
))
4772 # { delete[] p[3]; }
4776 def p_nature_item_2(p
):
4777 '''nature_item : K_abstol '=' expression ';' '''
4779 print('nature_item_2', list(p
))
4785 def p_nature_item_3(p
):
4786 '''nature_item : K_access '=' IDENTIFIER ';' '''
4788 print('nature_item_3', list(p
))
4790 # { pform_nature_access(@1, p[3]); delete[] p[3]; }
4794 def p_nature_item_4(p
):
4795 '''nature_item : K_idt_nature '=' IDENTIFIER ';' '''
4797 print('nature_item_4', list(p
))
4799 # { delete[] p[3]; }
4803 def p_nature_item_5(p
):
4804 '''nature_item : K_ddt_nature '=' IDENTIFIER ';' '''
4806 print('nature_item_5', list(p
))
4808 # { delete[] p[3]; }
4812 def p_config_declaration_1(p
):
4813 '''config_declaration : K_config IDENTIFIER ';' K_design lib_cell_identifiers ';' list_of_config_rule_statements K_endconfig '''
4815 print('config_declaration_1', list(p
))
4817 # { cerr << @1 << ": sorry: config declarations are not supported and "
4818 # "will be skipped." << endl;
4824 def p_lib_cell_identifiers_1(p
):
4825 '''lib_cell_identifiers : '''
4827 print('lib_cell_identifiers_1', list(p
))
4833 def p_lib_cell_identifiers_2(p
):
4834 '''lib_cell_identifiers : lib_cell_identifiers lib_cell_id '''
4836 print('lib_cell_identifiers_2', list(p
))
4842 def p_list_of_config_rule_statements_1(p
):
4843 '''list_of_config_rule_statements : '''
4845 print('list_of_config_rule_statements_1', list(p
))
4851 def p_list_of_config_rule_statements_2(p
):
4852 '''list_of_config_rule_statements : list_of_config_rule_statements config_rule_statement '''
4854 print('list_of_config_rule_statements_2', list(p
))
4860 def p_config_rule_statement_1(p
):
4861 '''config_rule_statement : K_default K_liblist list_of_libraries ';' '''
4863 print('config_rule_statement_1', list(p
))
4869 def p_config_rule_statement_2(p
):
4870 '''config_rule_statement : K_instance hierarchy_identifier K_liblist list_of_libraries ';' '''
4872 print('config_rule_statement_2', list(p
))
4878 def p_config_rule_statement_3(p
):
4879 '''config_rule_statement : K_instance hierarchy_identifier K_use lib_cell_id opt_config ';' '''
4881 print('config_rule_statement_3', list(p
))
4887 def p_config_rule_statement_4(p
):
4888 '''config_rule_statement : K_cell lib_cell_id K_liblist list_of_libraries ';' '''
4890 print('config_rule_statement_4', list(p
))
4896 def p_config_rule_statement_5(p
):
4897 '''config_rule_statement : K_cell lib_cell_id K_use lib_cell_id opt_config ';' '''
4899 print('config_rule_statement_5', list(p
))
4905 def p_opt_config_1(p
):
4908 print('opt_config_1', list(p
))
4914 def p_opt_config_2(p
):
4915 '''opt_config : ':' K_config '''
4917 print('opt_config_2', list(p
))
4923 def p_lib_cell_id_1(p
):
4924 '''lib_cell_id : IDENTIFIER '''
4926 print('lib_cell_id_1', list(p
))
4928 # { delete[] p[1]; }
4932 def p_lib_cell_id_2(p
):
4933 '''lib_cell_id : IDENTIFIER '.' IDENTIFIER '''
4935 print('lib_cell_id_2', list(p
))
4937 # { delete[] p[1]; delete[] p[3]; }
4941 def p_list_of_libraries_1(p
):
4942 '''list_of_libraries : '''
4944 print('list_of_libraries_1', list(p
))
4950 def p_list_of_libraries_2(p
):
4951 '''list_of_libraries : list_of_libraries IDENTIFIER '''
4953 print('list_of_libraries_2', list(p
))
4955 # { delete[] p[2]; }
4959 def p_drive_strength_1(p
):
4960 '''drive_strength : '(' dr_strength0 ',' dr_strength1 ')' '''
4962 print('drive_strength_1', list(p
))
4964 # { p[0].str0 = p[2].str0;
4965 # p[0].str1 = p[4].str1;
4970 def p_drive_strength_2(p
):
4971 '''drive_strength : '(' dr_strength1 ',' dr_strength0 ')' '''
4973 print('drive_strength_2', list(p
))
4975 # { p[0].str0 = p[4].str0;
4976 # p[0].str1 = p[2].str1;
4981 def p_drive_strength_3(p
):
4982 '''drive_strength : '(' dr_strength0 ',' K_highz1 ')' '''
4984 print('drive_strength_3', list(p
))
4986 # { p[0].str0 = p[2].str0;
4987 # p[0].str1 = IVL_DR_HiZ;
4992 def p_drive_strength_4(p
):
4993 '''drive_strength : '(' dr_strength1 ',' K_highz0 ')' '''
4995 print('drive_strength_4', list(p
))
4997 # { p[0].str0 = IVL_DR_HiZ;
4998 # p[0].str1 = p[2].str1;
5003 def p_drive_strength_5(p
):
5004 '''drive_strength : '(' K_highz1 ',' dr_strength0 ')' '''
5006 print('drive_strength_5', list(p
))
5008 # { p[0].str0 = p[4].str0;
5009 # p[0].str1 = IVL_DR_HiZ;
5014 def p_drive_strength_6(p
):
5015 '''drive_strength : '(' K_highz0 ',' dr_strength1 ')' '''
5017 print('drive_strength_6', list(p
))
5019 # { p[0].str0 = IVL_DR_HiZ;
5020 # p[0].str1 = p[4].str1;
5025 def p_drive_strength_opt_1(p
):
5026 '''drive_strength_opt : drive_strength '''
5028 print('drive_strength_opt_1', list(p
))
5035 def p_drive_strength_opt_2(p
):
5036 '''drive_strength_opt : '''
5037 if(parse_debug
> 2):
5038 print('drive_strength_opt_2', list(p
))
5040 # { p[0].str0 = IVL_DR_STRONG; p[0].str1 = IVL_DR_STRONG; }
5044 def p_dr_strength0_1(p
):
5045 '''dr_strength0 : K_supply0 '''
5047 print('dr_strength0_1', list(p
))
5049 # { p[0].str0 = IVL_DR_SUPPLY; }
5053 def p_dr_strength0_2(p
):
5054 '''dr_strength0 : K_strong0 '''
5056 print('dr_strength0_2', list(p
))
5058 # { p[0].str0 = IVL_DR_STRONG; }
5062 def p_dr_strength0_3(p
):
5063 '''dr_strength0 : K_pull0 '''
5065 print('dr_strength0_3', list(p
))
5067 # { p[0].str0 = IVL_DR_PULL; }
5071 def p_dr_strength0_4(p
):
5072 '''dr_strength0 : K_weak0 '''
5074 print('dr_strength0_4', list(p
))
5076 # { p[0].str0 = IVL_DR_WEAK; }
5080 def p_dr_strength1_1(p
):
5081 '''dr_strength1 : K_supply1 '''
5083 print('dr_strength1_1', list(p
))
5085 # { p[0].str1 = IVL_DR_SUPPLY; }
5089 def p_dr_strength1_2(p
):
5090 '''dr_strength1 : K_strong1 '''
5092 print('dr_strength1_2', list(p
))
5094 # { p[0].str1 = IVL_DR_STRONG; }
5098 def p_dr_strength1_3(p
):
5099 '''dr_strength1 : K_pull1 '''
5101 print('dr_strength1_3', list(p
))
5103 # { p[0].str1 = IVL_DR_PULL; }
5107 def p_dr_strength1_4(p
):
5108 '''dr_strength1 : K_weak1 '''
5110 print('dr_strength1_4', list(p
))
5112 # { p[0].str1 = IVL_DR_WEAK; }
5116 def p_clocking_event_opt_1(p
):
5117 '''clocking_event_opt : event_control '''
5119 print('clocking_event_opt_1', list(p
))
5125 def p_clocking_event_opt_2(p
):
5126 '''clocking_event_opt : '''
5128 print('clocking_event_opt_2', list(p
))
5134 def p_event_control_1(p
):
5135 '''event_control : '@' hierarchy_identifier '''
5137 print('event_control_1', list(p
))
5139 # { PEIdent*tmpi = new PEIdent(*p[2]);
5140 # PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi);
5141 # PEventStatement*tmps = new PEventStatement(tmpe);
5142 # FILE_NAME(tmps, @1);
5149 def p_event_control_2(p
):
5150 '''event_control : '@' '(' event_expression_list ')' '''
5152 print('event_control_2', list(p
))
5154 # { PEventStatement*tmp = new PEventStatement(*p[3]);
5155 # FILE_NAME(tmp, @1);
5162 def p_event_control_3(p
):
5163 '''event_control : '@' '(' error ')' '''
5165 print('event_control_3', list(p
))
5167 # { yyerror(@1, "error: Malformed event control expression.");
5173 def p_event_expression_list_1(p
):
5174 '''event_expression_list : event_expression '''
5176 print('event_expression_list_1', list(p
))
5183 def p_event_expression_list_2(p
):
5184 '''event_expression_list : event_expression_list K_or event_expression '''
5186 print('event_expression_list_2', list(p
))
5188 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
5196 def p_event_expression_list_3(p
):
5197 '''event_expression_list : event_expression_list ',' event_expression '''
5199 print('event_expression_list_3', list(p
))
5201 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
5209 def p_event_expression_1(p
):
5210 '''event_expression : K_posedge expression '''
5212 print('event_expression_1', list(p
))
5214 # { PEEvent*tmp = new PEEvent(PEEvent::POSEDGE, p[2]);
5215 # FILE_NAME(tmp, @1);
5216 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5223 def p_event_expression_2(p
):
5224 '''event_expression : K_negedge expression '''
5226 print('event_expression_2', list(p
))
5228 # { PEEvent*tmp = new PEEvent(PEEvent::NEGEDGE, p[2]);
5229 # FILE_NAME(tmp, @1);
5230 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5237 def p_event_expression_3(p
):
5238 '''event_expression : expression '''
5240 print('event_expression_3', list(p
))
5242 # { PEEvent*tmp = new PEEvent(PEEvent::ANYEDGE, p[1]);
5243 # FILE_NAME(tmp, @1);
5244 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5251 def p_branch_probe_expression_1(p
):
5252 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ',' IDENTIFIER ')' '''
5254 print('branch_probe_expression_1', list(p
))
5256 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3], p[5]); }
5260 def p_branch_probe_expression_2(p
):
5261 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ')' '''
5263 print('branch_probe_expression_2', list(p
))
5265 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3]); }
5269 def p_expression_1(p
):
5270 '''expression : expr_primary_or_typename '''
5271 if(parse_debug
> 2):
5272 print('expression_1', list(p
))
5279 def p_expression_2(p
):
5280 '''expression : inc_or_dec_expression '''
5282 print('expression_2', list(p
))
5289 def p_expression_3(p
):
5290 '''expression : inside_expression '''
5292 print('expression_3', list(p
))
5299 def p_expression_4(p
):
5300 '''expression : '+' attribute_list_opt expr_primary %prec UNARY_PREC '''
5302 print('expression_4', list(p
))
5309 def PEUnary(op
, o1
):
5310 #Leaf(token.STRING, ' ')
5312 return Node(syms
.atom
, [op
, o1
])
5314 return "error in PEUnary: "+str(op
)+","+str(o1
)
5317 def PEBinary(op
, o1
, o2
):
5319 return Node(syms
.atom
, [o1
, Leaf(token
.STRING
, ' '), op
, Leaf(token
.STRING
, ' '), o2
])
5321 return "error in PEBinary: "+str(op
)+","+str(o1
)+","+str(o2
)
5326 def p_expression_5(p
):
5327 '''expression : '-' attribute_list_opt expr_primary %prec UNARY_PREC '''
5329 print('expression_5', list(p
))
5331 p
[0] = PEUnary(Leaf(token
.MINUS
, '-'), p
[3])
5333 # { PEUnary*tmp = new PEUnary('-', p[3]);
5334 # FILE_NAME(tmp, @3);
5340 def p_expression_6(p
):
5341 '''expression : '~' attribute_list_opt expr_primary %prec UNARY_PREC '''
5343 print('expression_6', list(p
))
5345 p
[0] = PEUnary(Leaf(token
.TILDE
, '~'), p
[3])
5347 # { PEUnary*tmp = new PEUnary('~', p[3]);
5348 # FILE_NAME(tmp, @3);
5354 def p_expression_7(p
):
5355 '''expression : '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
5357 print('expression_7', list(p
))
5359 p
[0] = PEUnary(Leaf(token
.AMPER
, '&'), p
[3])
5361 # { PEUnary*tmp = new PEUnary('&', p[3]);
5362 # FILE_NAME(tmp, @3);
5368 def p_expression_8(p
):
5369 '''expression : '!' attribute_list_opt expr_primary %prec UNARY_PREC '''
5371 print('expression_8', list(p
))
5373 p
[0] = PEUnary(Leaf(token
.STRING
, '!'), p
[3])
5375 # { PEUnary*tmp = new PEUnary('!', p[3]);
5376 # FILE_NAME(tmp, @3);
5382 def p_expression_9(p
):
5383 '''expression : '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
5385 print('expression_9', list(p
))
5387 p
[0] = PEUnary(Leaf(token
.STRING
, '|'), p
[3])
5389 # { PEUnary*tmp = new PEUnary('|', p[3]);
5390 # FILE_NAME(tmp, @3);
5396 def p_expression_10(p
):
5397 '''expression : '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
5399 print('expression_10', list(p
))
5401 p
[0] = PEUnary(Leaf(token
.STRING
, '^'), p
[3])
5403 # { PEUnary*tmp = new PEUnary('^', p[3]);
5404 # FILE_NAME(tmp, @3);
5410 def p_expression_11(p
):
5411 '''expression : '~' '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
5413 print('expression_11', list(p
))
5415 # { yyerror(@1, "error: '~' '&' is not a valid expression. "
5416 # "Please use operator '~&' instead.");
5422 def p_expression_12(p
):
5423 '''expression : '~' '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
5425 print('expression_12', list(p
))
5427 # { yyerror(@1, "error: '~' '|' is not a valid expression. "
5428 # "Please use operator '~|' instead.");
5434 def p_expression_13(p
):
5435 '''expression : '~' '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
5437 print('expression_13', list(p
))
5439 # { yyerror(@1, "error: '~' '^' is not a valid expression. "
5440 # "Please use operator '~^' instead.");
5446 def p_expression_14(p
):
5447 '''expression : K_NAND attribute_list_opt expr_primary %prec UNARY_PREC '''
5449 print('expression_14', list(p
))
5451 p
[0] = PEUnary(Leaf(token
.STRING
, 'K_NAND'), p
[3])
5453 # { PEUnary*tmp = new PEUnary('A', p[3]);
5454 # FILE_NAME(tmp, @3);
5460 def p_expression_15(p
):
5461 '''expression : K_NOR attribute_list_opt expr_primary %prec UNARY_PREC '''
5463 print('expression_15', list(p
))
5465 p
[0] = PEUnary(Leaf(token
.STRING
, 'K_NOR'), p
[3])
5467 # { PEUnary*tmp = new PEUnary('N', p[3]);
5468 # FILE_NAME(tmp, @3);
5474 def p_expression_16(p
):
5475 '''expression : K_NXOR attribute_list_opt expr_primary %prec UNARY_PREC '''
5477 print('expression_16', list(p
))
5479 p
[0] = PEUnary(Leaf(token
.STRING
, 'K_NXOR'), p
[3])
5481 # { PEUnary*tmp = new PEUnary('X', p[3]);
5482 # FILE_NAME(tmp, @3);
5488 def p_expression_17(p
):
5489 '''expression : '!' error %prec UNARY_PREC '''
5491 print('expression_17', list(p
))
5493 # { yyerror(@1, "error: Operand of unary ! "
5494 # "is not a primary expression.");
5500 def p_expression_18(p
):
5501 '''expression : '^' error %prec UNARY_PREC '''
5503 print('expression_18', list(p
))
5505 # { yyerror(@1, "error: Operand of reduction ^ "
5506 # "is not a primary expression.");
5512 def p_expression_19(p
):
5513 '''expression : expression '^' attribute_list_opt expression '''
5515 print('expression_19', list(p
))
5517 p
[0] = PEBinary(Leaf(token
.STRING
, '^'), p
[1], p
[4])
5519 # { PEBinary*tmp = new PEBinary('^', p[1], p[4]);
5520 # FILE_NAME(tmp, @2);
5526 def p_expression_20(p
):
5527 '''expression : expression K_POW attribute_list_opt expression '''
5529 print('expression_20', list(p
))
5531 p
[0] = PEBinary(Leaf(token
.STRING
, '**'), p
[1], p
[4])
5533 # { PEBinary*tmp = new PEBPower('p', p[1], p[4]);
5534 # FILE_NAME(tmp, @2);
5540 def p_expression_21(p
):
5541 '''expression : expression '*' attribute_list_opt expression '''
5543 print('expression_21', list(p
))
5545 p
[0] = PEBinary(Leaf(token
.STRING
, '*'), p
[1], p
[4])
5547 # { PEBinary*tmp = new PEBinary('*', p[1], p[4]);
5548 # FILE_NAME(tmp, @2);
5554 def p_expression_22(p
):
5555 '''expression : expression '/' attribute_list_opt expression '''
5557 print('expression_22', list(p
))
5559 p
[0] = PEBinary(Leaf(token
.STRING
, '/'), p
[1], p
[4])
5561 # { PEBinary*tmp = new PEBinary('/', p[1], p[4]);
5562 # FILE_NAME(tmp, @2);
5568 def p_expression_23(p
):
5569 '''expression : expression '%' attribute_list_opt expression '''
5571 print('expression_23', list(p
))
5573 p
[0] = PEBinary(Leaf(token
.STRING
, '%'), p
[1], p
[4])
5575 # { PEBinary*tmp = new PEBinary('%', p[1], p[4]);
5576 # FILE_NAME(tmp, @2);
5582 def p_expression_24(p
):
5583 '''expression : expression '+' attribute_list_opt expression '''
5585 print('expression_24', list(p
))
5587 # { PEBinary*tmp = new PEBinary('+', p[1], p[4]);
5588 # FILE_NAME(tmp, @2);
5591 p
[0] = PEBinary(Leaf(token
.PLUS
, '+'), p
[1], p
[4])
5597 def p_expression_25(p
):
5598 '''expression : expression '-' attribute_list_opt expression '''
5599 if(parse_debug
> 2):
5600 print('expression_25', list(p
))
5601 # { PEBinary*tmp = new PEBinary('-', p[1], p[4]);
5602 # FILE_NAME(tmp, @2);
5605 p
[0] = PEBinary(Leaf(token
.MINUS
, '-'), p
[1], p
[4])
5611 def p_expression_26(p
):
5612 '''expression : expression '&' attribute_list_opt expression '''
5613 if(parse_debug
> 2):
5614 print('expression_26', list(p
))
5616 p
[0] = PEBinary(Leaf(token
.AMPER
, '&'), p
[1], p
[4])
5618 # { PEBinary*tmp = new PEBinary('&', p[1], p[4]);
5619 # FILE_NAME(tmp, @2);
5625 def p_expression_27(p
):
5626 '''expression : expression '|' attribute_list_opt expression '''
5627 if(parse_debug
> 2):
5628 print('expression_27', list(p
))
5630 p
[0] = PEBinary(Leaf(token
.VBAR
, '|'), p
[1], p
[4])
5633 # { PEBinary*tmp = new PEBinary('|', p[1], p[4]);
5634 # FILE_NAME(tmp, @2);
5640 def p_expression_28(p
):
5641 '''expression : expression K_NAND attribute_list_opt expression '''
5643 print('expression_28', list(p
))
5645 p
[0] = PEBinary(Leaf(token
.STRING
, '~&'), p
[1], p
[4])
5647 # { PEBinary*tmp = new PEBinary('A', p[1], p[4]);
5648 # FILE_NAME(tmp, @2);
5654 def p_expression_29(p
):
5655 '''expression : expression K_NOR attribute_list_opt expression '''
5657 print('expression_29', list(p
))
5659 p
[0] = PEBinary(Leaf(token
.STRING
, '~|'), p
[1], p
[4])
5661 # { PEBinary*tmp = new PEBinary('O', p[1], p[4]);
5662 # FILE_NAME(tmp, @2);
5668 def p_expression_30(p
):
5669 '''expression : expression K_NXOR attribute_list_opt expression '''
5671 print('expression_30', list(p
))
5673 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_XNOR'), p
[1], p
[4])
5675 # { PEBinary*tmp = new PEBinary('X', p[1], p[4]);
5676 # FILE_NAME(tmp, @2);
5682 def p_expression_31(p
):
5683 '''expression : expression '<' attribute_list_opt expression '''
5685 print('expression_31', list(p
))
5687 p
[0] = PEBinary(Leaf(token
.STRING
, '<'), p
[1], p
[4])
5689 # { PEBinary*tmp = new PEBComp('<', p[1], p[4]);
5690 # FILE_NAME(tmp, @2);
5696 def p_expression_32(p
):
5697 '''expression : expression '>' attribute_list_opt expression '''
5699 print('expression_32', list(p
))
5701 p
[0] = PEBinary(Leaf(token
.STRING
, '>'), p
[1], p
[4])
5703 # { PEBinary*tmp = new PEBComp('>', p[1], p[4]);
5704 # FILE_NAME(tmp, @2);
5710 def p_expression_33(p
):
5711 '''expression : expression K_LS attribute_list_opt expression '''
5713 print('expression_33', list(p
))
5715 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_LS'), p
[1], p
[4])
5717 # { PEBinary*tmp = new PEBShift('l', p[1], p[4]);
5718 # FILE_NAME(tmp, @2);
5724 def p_expression_34(p
):
5725 '''expression : expression K_RS attribute_list_opt expression '''
5727 print('expression_34', list(p
))
5729 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_RS'), p
[1], p
[4])
5731 # { PEBinary*tmp = new PEBShift('r', p[1], p[4]);
5732 # FILE_NAME(tmp, @2);
5738 def p_expression_35(p
):
5739 '''expression : expression K_RSS attribute_list_opt expression '''
5741 print('expression_35', list(p
))
5743 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_RSS'), p
[1], p
[4])
5745 # { PEBinary*tmp = new PEBShift('R', p[1], p[4]);
5746 # FILE_NAME(tmp, @2);
5752 def p_expression_36(p
):
5753 '''expression : expression K_EQ attribute_list_opt expression '''
5755 print('expression_36', list(p
))
5757 p
[0] = PEBinary(Leaf(token
.STRING
, '=='), p
[1], p
[4])
5759 # { PEBinary*tmp = new PEBComp('e', p[1], p[4]);
5760 # FILE_NAME(tmp, @2);
5766 def p_expression_37(p
):
5767 '''expression : expression K_CEQ attribute_list_opt expression '''
5769 print('expression_37', list(p
))
5771 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_CEQ'), p
[1], p
[4])
5773 # { PEBinary*tmp = new PEBComp('E', p[1], p[4]);
5774 # FILE_NAME(tmp, @2);
5780 def p_expression_38(p
):
5781 '''expression : expression K_WEQ attribute_list_opt expression '''
5783 print('expression_38', list(p
))
5785 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_WEQ'), p
[1], p
[4])
5787 # { PEBinary*tmp = new PEBComp('w', p[1], p[4]);
5788 # FILE_NAME(tmp, @2);
5794 def p_expression_39(p
):
5795 '''expression : expression K_LE attribute_list_opt expression '''
5797 print('expression_39', list(p
))
5799 p
[0] = PEBinary(Leaf(token
.STRING
, '<='), p
[1], p
[4])
5801 # { PEBinary*tmp = new PEBComp('L', p[1], p[4]);
5802 # FILE_NAME(tmp, @2);
5808 def p_expression_40(p
):
5809 '''expression : expression K_GE attribute_list_opt expression '''
5811 print('expression_40', list(p
))
5813 p
[0] = PEBinary(Leaf(token
.STRING
, '>='), p
[1], p
[4])
5815 # { PEBinary*tmp = new PEBComp('G', p[1], p[4]);
5816 # FILE_NAME(tmp, @2);
5822 def p_expression_41(p
):
5823 '''expression : expression K_NE attribute_list_opt expression '''
5825 print('expression_41', list(p
))
5827 p
[0] = PEBinary(Leaf(token
.STRING
, '!='), p
[1], p
[4])
5829 # { PEBinary*tmp = new PEBComp('n', p[1], p[4]);
5830 # FILE_NAME(tmp, @2);
5836 def p_expression_42(p
):
5837 '''expression : expression K_CNE attribute_list_opt expression '''
5839 print('expression_42', list(p
))
5841 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_CNE'), p
[1], p
[4])
5843 # { PEBinary*tmp = new PEBComp('N', p[1], p[4]);
5844 # FILE_NAME(tmp, @2);
5850 def p_expression_43(p
):
5851 '''expression : expression K_WNE attribute_list_opt expression '''
5853 print('expression_43', list(p
))
5855 p
[0] = PEBinary(Leaf(token
.STRING
, 'K_WNE'), p
[1], p
[4])
5857 # { PEBinary*tmp = new PEBComp('W', p[1], p[4]);
5858 # FILE_NAME(tmp, @2);
5864 def p_expression_44(p
):
5865 '''expression : expression K_LOR attribute_list_opt expression '''
5867 print('expression_44', list(p
))
5869 p
[0] = PEBinary(Leaf(token
.STRING
, '||'), p
[1], p
[4])
5871 # { PEBinary*tmp = new PEBLogic('o', p[1], p[4]);
5872 # FILE_NAME(tmp, @2);
5878 def p_expression_45(p
):
5879 '''expression : expression K_LAND attribute_list_opt expression '''
5881 print('expression_45', list(p
))
5883 p
[0] = PEBinary(Leaf(token
.STRING
, '&&'), p
[1], p
[4])
5885 # { PEBinary*tmp = new PEBLogic('a', p[1], p[4]);
5886 # FILE_NAME(tmp, @2);
5892 def p_expression_46(p
):
5893 '''expression : expression '?' attribute_list_opt expression ':' expression '''
5895 print('expression_46', list(p
))
5897 p
[0] = Node(syms
.atom
, [p
[1], Leaf(token
.STRING
, ' ? '),
5898 p
[4], Leaf(token
.STRING
, ' : '), p
[6]])
5900 # { PETernary*tmp = new PETernary(p[1], p[4], p[6]);
5901 # FILE_NAME(tmp, @2);
5907 def p_expr_mintypmax_1(p
):
5908 '''expr_mintypmax : expression '''
5910 print('expr_mintypmax_1', list(p
))
5917 def p_expr_mintypmax_2(p
):
5918 '''expr_mintypmax : expression ':' expression ':' expression '''
5920 print('expr_mintypmax_2', list(p
))
5922 # { switch (min_typ_max_flag) {
5939 # if (min_typ_max_warn > 0) {
5940 # cerr << p[0]->get_fileline() << ": warning: choosing ";
5941 # switch (min_typ_max_flag) {
5952 # cerr << " expression." << endl;
5953 # min_typ_max_warn -= 1;
5959 def p_expression_list_with_nuls_1(p
):
5960 '''expression_list_with_nuls : expression_list_with_nuls ',' expression '''
5962 print('expression_list_with_nuls_1', list(p
))
5964 # { list<PExpr*>*tmp = p[1];
5965 # tmp->push_back(p[3]);
5971 def p_expression_list_with_nuls_2(p
):
5972 '''expression_list_with_nuls : expression '''
5974 print('expression_list_with_nuls_2', list(p
))
5976 # { list<PExpr*>*tmp = new list<PExpr*>;
5977 # tmp->push_back(p[1]);
5983 def p_expression_list_with_nuls_3(p
):
5984 '''expression_list_with_nuls : '''
5986 print('expression_list_with_nuls_3', list(p
))
5988 # { list<PExpr*>*tmp = new list<PExpr*>;
5989 # tmp->push_back(0);
5995 def p_expression_list_with_nuls_4(p
):
5996 '''expression_list_with_nuls : expression_list_with_nuls ',' '''
5998 print('expression_list_with_nuls_4', list(p
))
6000 # { list<PExpr*>*tmp = p[1];
6001 # tmp->push_back(0);
6007 def p_expression_list_proper_1(p
):
6008 '''expression_list_proper : expression_list_proper ',' expression '''
6010 print('expression_list_proper_1', list(p
))
6012 # { list<PExpr*>*tmp = p[1];
6013 # tmp->push_back(p[3]);
6019 def p_expression_list_proper_2(p
):
6020 '''expression_list_proper : expression '''
6022 print('expression_list_proper_2', list(p
))
6024 # { list<PExpr*>*tmp = new list<PExpr*>;
6025 # tmp->push_back(p[1]);
6031 def p_expr_primary_or_typename_1(p
):
6032 '''expr_primary_or_typename : expr_primary '''
6033 if(parse_debug
> 2):
6034 print('expr_primary_or_typename_1', list(p
))
6041 def p_expr_primary_or_typename_2(p
):
6042 '''expr_primary_or_typename : TYPE_IDENTIFIER '''
6044 print('expr_primary_or_typename_2', list(p
))
6047 # { PETypename*tmp = new PETypename(p[1].type);
6048 # FILE_NAME(tmp,@1);
6050 # delete[]p[1].text;
6055 def p_expr_primary_1(p
):
6056 '''expr_primary : number '''
6058 print('expr_primary_1', list(p
))
6062 # PENumber*tmp = new PENumber(p[1]);
6063 # FILE_NAME(tmp, @1);
6069 def p_expr_primary_2(p
):
6070 '''expr_primary : REALTIME '''
6072 print('expr_primary_2', list(p
))
6074 # { PEFNumber*tmp = new PEFNumber(p[1]);
6075 # FILE_NAME(tmp, @1);
6081 def p_expr_primary_3(p
):
6082 '''expr_primary : STRING '''
6084 print('expr_primary_3', list(p
))
6086 # { PEString*tmp = new PEString(p[1]);
6087 # FILE_NAME(tmp, @1);
6093 def p_expr_primary_4(p
):
6094 '''expr_primary : TIME_LITERAL '''
6096 print('expr_primary_4', list(p
))
6102 # if (p[1] == 0 || !get_time_unit(p[1], unit))
6103 # yyerror(@1, "internal error: delay.");
6105 # double p = pow(10.0, (double)(unit - pform_get_timeunit()));
6106 # double time = atof(p[1]) * p;
6108 # verireal *v = new verireal(time);
6109 # p[0] = new PEFNumber(v);
6110 # FILE_NAME(p[0], @1);
6116 def p_expr_primary_5(p
):
6117 '''expr_primary : SYSTEM_IDENTIFIER '''
6119 print('expr_primary_5', list(p
))
6121 # { perm_string tn = lex_strings.make(p[1]);
6122 # PECallFunction*tmp = new PECallFunction(tn);
6123 # FILE_NAME(tmp, @1);
6130 def p_expr_primary_6(p
):
6131 '''expr_primary : hierarchy_identifier '''
6132 if(parse_debug
> 2):
6133 print('expr_primary_6', list(p
))
6136 # { PEIdent*tmp = pform_new_ident(*p[1]);
6137 # FILE_NAME(tmp, @1);
6144 def p_expr_primary_7(p
):
6145 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier '''
6147 print('expr_primary_7', list(p
))
6149 # { p[0] = pform_package_ident(@2, p[1], p[3]);
6155 def p_expr_primary_8(p
):
6156 '''expr_primary : hierarchy_identifier '(' expression_list_with_nuls ')' '''
6158 print('expr_primary_8', list(p
))
6160 # { list<PExpr*>*expr_list = p[3];
6161 # strip_tail_items(expr_list);
6162 # PECallFunction*tmp = pform_make_call_function(@1, *p[1], *expr_list);
6169 def p_expr_primary_9(p
):
6170 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' '''
6172 print('expr_primary_9', list(p
))
6174 # { pform_name_t*t_name = p[1];
6175 # while (! p[3]->empty()) {
6176 # t_name->push_back(p[3]->front());
6177 # p[3]->pop_front();
6179 # list<PExpr*>*expr_list = p[5];
6180 # strip_tail_items(expr_list);
6181 # PECallFunction*tmp = pform_make_call_function(@1, *t_name, *expr_list);
6189 def p_expr_primary_10(p
):
6190 '''expr_primary : SYSTEM_IDENTIFIER '(' expression_list_proper ')' '''
6192 print('expr_primary_10', list(p
))
6194 # { perm_string tn = lex_strings.make(p[1]);
6195 # PECallFunction*tmp = new PECallFunction(tn, *p[3]);
6196 # FILE_NAME(tmp, @1);
6203 def p_expr_primary_11(p
):
6204 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')' '''
6206 print('expr_primary_11', list(p
))
6208 # { perm_string use_name = lex_strings.make(p[3]);
6209 # PECallFunction*tmp = new PECallFunction(p[1], use_name, *p[5]);
6210 # FILE_NAME(tmp, @3);
6217 def p_expr_primary_12(p
):
6218 '''expr_primary : SYSTEM_IDENTIFIER '(' ')' '''
6220 print('expr_primary_12', list(p
))
6222 # { perm_string tn = lex_strings.make(p[1]);
6223 # const vector<PExpr*>empty;
6224 # PECallFunction*tmp = new PECallFunction(tn, empty);
6225 # FILE_NAME(tmp, @1);
6228 # if (!gn_system_verilog()) {
6229 # yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
6235 def p_expr_primary_13(p
):
6236 '''expr_primary : implicit_class_handle '''
6238 print('expr_primary_13', list(p
))
6240 # { PEIdent*tmp = new PEIdent(*p[1]);
6241 # FILE_NAME(tmp,@1);
6248 def p_expr_primary_14(p
):
6249 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '''
6251 print('expr_primary_14', list(p
))
6253 # { pform_name_t*t_name = p[1];
6254 # while (! p[3]->empty()) {
6255 # t_name->push_back(p[3]->front());
6256 # p[3]->pop_front();
6258 # PEIdent*tmp = new PEIdent(*t_name);
6259 # FILE_NAME(tmp,@1);
6267 def p_expr_primary_15(p
):
6268 '''expr_primary : K_acos '(' expression ')' '''
6270 print('expr_primary_15', list(p
))
6272 # { perm_string tn = perm_string::literal("$acos");
6273 # PECallFunction*tmp = make_call_function(tn, p[3]);
6274 # FILE_NAME(tmp,@1);
6280 def p_expr_primary_16(p
):
6281 '''expr_primary : K_acosh '(' expression ')' '''
6283 print('expr_primary_16', list(p
))
6285 # { perm_string tn = perm_string::literal("$acosh");
6286 # PECallFunction*tmp = make_call_function(tn, p[3]);
6287 # FILE_NAME(tmp,@1);
6293 def p_expr_primary_17(p
):
6294 '''expr_primary : K_asin '(' expression ')' '''
6296 print('expr_primary_17', list(p
))
6298 # { perm_string tn = perm_string::literal("$asin");
6299 # PECallFunction*tmp = make_call_function(tn, p[3]);
6300 # FILE_NAME(tmp,@1);
6306 def p_expr_primary_18(p
):
6307 '''expr_primary : K_asinh '(' expression ')' '''
6309 print('expr_primary_18', list(p
))
6311 # { perm_string tn = perm_string::literal("$asinh");
6312 # PECallFunction*tmp = make_call_function(tn, p[3]);
6313 # FILE_NAME(tmp,@1);
6319 def p_expr_primary_19(p
):
6320 '''expr_primary : K_atan '(' expression ')' '''
6322 print('expr_primary_19', list(p
))
6324 # { perm_string tn = perm_string::literal("$atan");
6325 # PECallFunction*tmp = make_call_function(tn, p[3]);
6326 # FILE_NAME(tmp,@1);
6332 def p_expr_primary_20(p
):
6333 '''expr_primary : K_atanh '(' expression ')' '''
6335 print('expr_primary_20', list(p
))
6337 # { perm_string tn = perm_string::literal("$atanh");
6338 # PECallFunction*tmp = make_call_function(tn, p[3]);
6339 # FILE_NAME(tmp,@1);
6345 def p_expr_primary_21(p
):
6346 '''expr_primary : K_atan2 '(' expression ',' expression ')' '''
6348 print('expr_primary_21', list(p
))
6350 # { perm_string tn = perm_string::literal("$atan2");
6351 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6352 # FILE_NAME(tmp,@1);
6358 def p_expr_primary_22(p
):
6359 '''expr_primary : K_ceil '(' expression ')' '''
6361 print('expr_primary_22', list(p
))
6363 # { perm_string tn = perm_string::literal("$ceil");
6364 # PECallFunction*tmp = make_call_function(tn, p[3]);
6365 # FILE_NAME(tmp,@1);
6371 def p_expr_primary_23(p
):
6372 '''expr_primary : K_cos '(' expression ')' '''
6374 print('expr_primary_23', list(p
))
6376 # { perm_string tn = perm_string::literal("$cos");
6377 # PECallFunction*tmp = make_call_function(tn, p[3]);
6378 # FILE_NAME(tmp,@1);
6384 def p_expr_primary_24(p
):
6385 '''expr_primary : K_cosh '(' expression ')' '''
6387 print('expr_primary_24', list(p
))
6389 # { perm_string tn = perm_string::literal("$cosh");
6390 # PECallFunction*tmp = make_call_function(tn, p[3]);
6391 # FILE_NAME(tmp,@1);
6397 def p_expr_primary_25(p
):
6398 '''expr_primary : K_exp '(' expression ')' '''
6400 print('expr_primary_25', list(p
))
6402 # { perm_string tn = perm_string::literal("$exp");
6403 # PECallFunction*tmp = make_call_function(tn, p[3]);
6404 # FILE_NAME(tmp,@1);
6410 def p_expr_primary_26(p
):
6411 '''expr_primary : K_floor '(' expression ')' '''
6413 print('expr_primary_26', list(p
))
6415 # { perm_string tn = perm_string::literal("$floor");
6416 # PECallFunction*tmp = make_call_function(tn, p[3]);
6417 # FILE_NAME(tmp,@1);
6423 def p_expr_primary_27(p
):
6424 '''expr_primary : K_hypot '(' expression ',' expression ')' '''
6426 print('expr_primary_27', list(p
))
6428 # { perm_string tn = perm_string::literal("$hypot");
6429 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6430 # FILE_NAME(tmp,@1);
6436 def p_expr_primary_28(p
):
6437 '''expr_primary : K_ln '(' expression ')' '''
6439 print('expr_primary_28', list(p
))
6441 # { perm_string tn = perm_string::literal("$ln");
6442 # PECallFunction*tmp = make_call_function(tn, p[3]);
6443 # FILE_NAME(tmp,@1);
6449 def p_expr_primary_29(p
):
6450 '''expr_primary : K_log '(' expression ')' '''
6452 print('expr_primary_29', list(p
))
6454 # { perm_string tn = perm_string::literal("$log10");
6455 # PECallFunction*tmp = make_call_function(tn, p[3]);
6456 # FILE_NAME(tmp,@1);
6462 def p_expr_primary_30(p
):
6463 '''expr_primary : K_pow '(' expression ',' expression ')' '''
6465 print('expr_primary_30', list(p
))
6467 # { perm_string tn = perm_string::literal("$pow");
6468 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6469 # FILE_NAME(tmp,@1);
6475 def p_expr_primary_31(p
):
6476 '''expr_primary : K_sin '(' expression ')' '''
6478 print('expr_primary_31', list(p
))
6480 # { perm_string tn = perm_string::literal("$sin");
6481 # PECallFunction*tmp = make_call_function(tn, p[3]);
6482 # FILE_NAME(tmp,@1);
6488 def p_expr_primary_32(p
):
6489 '''expr_primary : K_sinh '(' expression ')' '''
6491 print('expr_primary_32', list(p
))
6493 # { perm_string tn = perm_string::literal("$sinh");
6494 # PECallFunction*tmp = make_call_function(tn, p[3]);
6495 # FILE_NAME(tmp,@1);
6501 def p_expr_primary_33(p
):
6502 '''expr_primary : K_sqrt '(' expression ')' '''
6504 print('expr_primary_33', list(p
))
6506 # { perm_string tn = perm_string::literal("$sqrt");
6507 # PECallFunction*tmp = make_call_function(tn, p[3]);
6508 # FILE_NAME(tmp,@1);
6514 def p_expr_primary_34(p
):
6515 '''expr_primary : K_tan '(' expression ')' '''
6517 print('expr_primary_34', list(p
))
6519 # { perm_string tn = perm_string::literal("$tan");
6520 # PECallFunction*tmp = make_call_function(tn, p[3]);
6521 # FILE_NAME(tmp,@1);
6527 def p_expr_primary_35(p
):
6528 '''expr_primary : K_tanh '(' expression ')' '''
6530 print('expr_primary_35', list(p
))
6532 # { perm_string tn = perm_string::literal("$tanh");
6533 # PECallFunction*tmp = make_call_function(tn, p[3]);
6534 # FILE_NAME(tmp,@1);
6540 def p_expr_primary_36(p
):
6541 '''expr_primary : K_abs '(' expression ')' '''
6543 print('expr_primary_36', list(p
))
6545 # { PEUnary*tmp = new PEUnary('m', p[3]);
6546 # FILE_NAME(tmp,@1);
6552 def p_expr_primary_37(p
):
6553 '''expr_primary : K_max '(' expression ',' expression ')' '''
6555 print('expr_primary_37', list(p
))
6557 # { PEBinary*tmp = new PEBinary('M', p[3], p[5]);
6558 # FILE_NAME(tmp,@1);
6564 def p_expr_primary_38(p
):
6565 '''expr_primary : K_min '(' expression ',' expression ')' '''
6567 print('expr_primary_38', list(p
))
6569 # { PEBinary*tmp = new PEBinary('m', p[3], p[5]);
6570 # FILE_NAME(tmp,@1);
6576 def p_expr_primary_39(p
):
6577 '''expr_primary : '(' expr_mintypmax ')' '''
6579 print('expr_primary_39', list(p
))
6586 def p_expr_primary_40(p
):
6587 '''expr_primary : '{' expression_list_proper '}' '''
6589 print('expr_primary_40', list(p
))
6591 # { PEConcat*tmp = new PEConcat(*p[2]);
6592 # FILE_NAME(tmp, @1);
6599 def p_expr_primary_41(p
):
6600 '''expr_primary : '{' expression '{' expression_list_proper '}' '}' '''
6602 print('expr_primary_41', list(p
))
6604 # { PExpr*rep = p[2];
6605 # PEConcat*tmp = new PEConcat(*p[4], rep);
6606 # FILE_NAME(tmp, @1);
6613 def p_expr_primary_42(p
):
6614 '''expr_primary : '{' expression '{' expression_list_proper '}' error '}' '''
6616 print('expr_primary_42', list(p
))
6618 # { PExpr*rep = p[2];
6619 # PEConcat*tmp = new PEConcat(*p[4], rep);
6620 # FILE_NAME(tmp, @1);
6623 # yyerror(@5, "error: Syntax error between internal '}' "
6624 # "and closing '}' of repeat concatenation.");
6630 def p_expr_primary_43(p
):
6631 '''expr_primary : '{' '}' '''
6633 print('expr_primary_43', list(p
))
6635 # { // This is the empty queue syntax.
6636 # if (gn_system_verilog()) {
6637 # list<PExpr*> empty_list;
6638 # PEConcat*tmp = new PEConcat(empty_list);
6639 # FILE_NAME(tmp, @1);
6642 # yyerror(@1, "error: Concatenations are not allowed to be empty.");
6649 def p_expr_primary_44(p
):
6650 '''expr_primary : expr_primary "'" '(' expression ')' '''
6652 print('expr_primary_44', list(p
))
6654 # { PExpr*base = p[4];
6655 # if (gn_system_verilog()) {
6656 # PECastSize*tmp = new PECastSize(p[1], base);
6657 # FILE_NAME(tmp, @1);
6660 # yyerror(@1, "error: Size cast requires SystemVerilog.");
6667 def p_expr_primary_45(p
):
6668 '''expr_primary : simple_type_or_string "'" '(' expression ')' '''
6670 print('expr_primary_45', list(p
))
6672 # { PExpr*base = p[4];
6673 # if (gn_system_verilog()) {
6674 # PECastType*tmp = new PECastType(p[1], base);
6675 # FILE_NAME(tmp, @1);
6678 # yyerror(@1, "error: Type cast requires SystemVerilog.");
6685 def p_expr_primary_46(p
):
6686 '''expr_primary : assignment_pattern '''
6688 print('expr_primary_46', list(p
))
6695 def p_expr_primary_47(p
):
6696 '''expr_primary : streaming_concatenation '''
6698 print('expr_primary_47', list(p
))
6705 def p_expr_primary_48(p
):
6706 '''expr_primary : K_null '''
6708 print('expr_primary_48', list(p
))
6710 # { PENull*tmp = new PENull;
6711 # FILE_NAME(tmp, @1);
6717 def p_function_item_list_opt_1(p
):
6718 '''function_item_list_opt : function_item_list '''
6720 print('function_item_list_opt_1', list(p
))
6727 def p_function_item_list_opt_2(p
):
6728 '''function_item_list_opt : '''
6730 print('function_item_list_opt_2', list(p
))
6736 def p_function_item_list_1(p
):
6737 '''function_item_list : function_item '''
6739 print('function_item_list_1', list(p
))
6746 def p_function_item_list_2(p
):
6747 '''function_item_list : function_item_list function_item '''
6749 print('function_item_list_2', list(p
))
6752 # if (p[1] && p[2]) {
6753 # vector<pform_tf_port_t>*tmp = p[1];
6754 # size_t s1 = tmp->size();
6755 # tmp->resize(s1 + p[2]->size());
6756 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
6757 # tmp->at(s1+idx) = p[2]->at(idx);
6760 # } else if (p[1]) {
6769 def p_function_item_1(p
):
6770 '''function_item : tf_port_declaration '''
6772 print('function_item_1', list(p
))
6779 def p_function_item_2(p
):
6780 '''function_item : block_item_decl '''
6782 print('function_item_2', list(p
))
6788 def p_gate_instance_1(p
):
6789 '''gate_instance : IDENTIFIER '(' expression_list_with_nuls ')' '''
6791 print('gate_instance_1', list(p
))
6793 # { lgate*tmp = new lgate;
6795 # tmp->parms = p[3];
6796 # tmp->file = @1.text;
6797 # tmp->lineno = @1.first_line;
6804 def p_gate_instance_2(p
):
6805 '''gate_instance : IDENTIFIER dimensions '(' expression_list_with_nuls ')' '''
6807 print('gate_instance_2', list(p
))
6809 # { lgate*tmp = new lgate;
6810 # list<pform_range_t>*rng = p[2];
6812 # tmp->parms = p[4];
6813 # tmp->range = rng->front();
6815 # assert(rng->empty());
6816 # tmp->file = @1.text;
6817 # tmp->lineno = @1.first_line;
6825 def p_gate_instance_3(p
):
6826 '''gate_instance : '(' expression_list_with_nuls ')' '''
6828 print('gate_instance_3', list(p
))
6830 # { lgate*tmp = new lgate;
6832 # tmp->parms = p[2];
6833 # tmp->file = @1.text;
6834 # tmp->lineno = @1.first_line;
6840 def p_gate_instance_4(p
):
6841 '''gate_instance : IDENTIFIER dimensions '''
6843 print('gate_instance_4', list(p
))
6845 # { lgate*tmp = new lgate;
6846 # list<pform_range_t>*rng = p[2];
6849 # tmp->parms_by_name = 0;
6850 # tmp->range = rng->front();
6852 # assert(rng->empty());
6853 # tmp->file = @1.text;
6854 # tmp->lineno = @1.first_line;
6862 def p_gate_instance_5(p
):
6863 '''gate_instance : IDENTIFIER '(' port_name_list ')' '''
6865 print('gate_instance_5', list(p
))
6867 # { lgate*tmp = new lgate;
6870 # tmp->parms_by_name = p[3];
6871 # tmp->file = @1.text;
6872 # tmp->lineno = @1.first_line;
6879 def p_gate_instance_6(p
):
6880 '''gate_instance : IDENTIFIER dimensions '(' port_name_list ')' '''
6882 print('gate_instance_6', list(p
))
6884 # { lgate*tmp = new lgate;
6885 # list<pform_range_t>*rng = p[2];
6888 # tmp->parms_by_name = p[4];
6889 # tmp->range = rng->front();
6891 # assert(rng->empty());
6892 # tmp->file = @1.text;
6893 # tmp->lineno = @1.first_line;
6901 def p_gate_instance_7(p
):
6902 '''gate_instance : IDENTIFIER '(' error ')' '''
6904 print('gate_instance_7', list(p
))
6906 # { lgate*tmp = new lgate;
6909 # tmp->parms_by_name = 0;
6910 # tmp->file = @1.text;
6911 # tmp->lineno = @1.first_line;
6912 # yyerror(@2, "error: Syntax error in instance port "
6913 # "expression(s).");
6920 def p_gate_instance_8(p
):
6921 '''gate_instance : IDENTIFIER dimensions '(' error ')' '''
6923 print('gate_instance_8', list(p
))
6925 # { lgate*tmp = new lgate;
6928 # tmp->parms_by_name = 0;
6929 # tmp->file = @1.text;
6930 # tmp->lineno = @1.first_line;
6931 # yyerror(@3, "error: Syntax error in instance port "
6932 # "expression(s).");
6939 def p_gate_instance_list_1(p
):
6940 '''gate_instance_list : gate_instance_list ',' gate_instance '''
6942 print('gate_instance_list_1', list(p
))
6944 # { svector<lgate>*tmp1 = p[1];
6945 # lgate*tmp2 = p[3];
6946 # svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
6954 def p_gate_instance_list_2(p
):
6955 '''gate_instance_list : gate_instance '''
6957 print('gate_instance_list_2', list(p
))
6959 # { svector<lgate>*tmp = new svector<lgate>(1);
6960 # (*tmp)[0] = *p[1];
6967 def p_gatetype_1(p
):
6968 '''gatetype : K_and '''
6970 print('gatetype_1', list(p
))
6972 # { p[0] = PGBuiltin::AND; }
6976 def p_gatetype_2(p
):
6977 '''gatetype : K_nand '''
6979 print('gatetype_2', list(p
))
6981 # { p[0] = PGBuiltin::NAND; }
6985 def p_gatetype_3(p
):
6986 '''gatetype : K_or '''
6988 print('gatetype_3', list(p
))
6990 # { p[0] = PGBuiltin::OR; }
6994 def p_gatetype_4(p
):
6995 '''gatetype : K_nor '''
6997 print('gatetype_4', list(p
))
6999 # { p[0] = PGBuiltin::NOR; }
7003 def p_gatetype_5(p
):
7004 '''gatetype : K_xor '''
7006 print('gatetype_5', list(p
))
7008 # { p[0] = PGBuiltin::XOR; }
7012 def p_gatetype_6(p
):
7013 '''gatetype : K_xnor '''
7015 print('gatetype_6', list(p
))
7017 # { p[0] = PGBuiltin::XNOR; }
7021 def p_gatetype_7(p
):
7022 '''gatetype : K_buf '''
7024 print('gatetype_7', list(p
))
7026 # { p[0] = PGBuiltin::BUF; }
7030 def p_gatetype_8(p
):
7031 '''gatetype : K_bufif0 '''
7033 print('gatetype_8', list(p
))
7035 # { p[0] = PGBuiltin::BUFIF0; }
7039 def p_gatetype_9(p
):
7040 '''gatetype : K_bufif1 '''
7042 print('gatetype_9', list(p
))
7044 # { p[0] = PGBuiltin::BUFIF1; }
7048 def p_gatetype_10(p
):
7049 '''gatetype : K_not '''
7051 print('gatetype_10', list(p
))
7053 # { p[0] = PGBuiltin::NOT; }
7057 def p_gatetype_11(p
):
7058 '''gatetype : K_notif0 '''
7060 print('gatetype_11', list(p
))
7062 # { p[0] = PGBuiltin::NOTIF0; }
7066 def p_gatetype_12(p
):
7067 '''gatetype : K_notif1 '''
7069 print('gatetype_12', list(p
))
7071 # { p[0] = PGBuiltin::NOTIF1; }
7075 def p_switchtype_1(p
):
7076 '''switchtype : K_nmos '''
7078 print('switchtype_1', list(p
))
7080 # { p[0] = PGBuiltin::NMOS; }
7084 def p_switchtype_2(p
):
7085 '''switchtype : K_rnmos '''
7087 print('switchtype_2', list(p
))
7089 # { p[0] = PGBuiltin::RNMOS; }
7093 def p_switchtype_3(p
):
7094 '''switchtype : K_pmos '''
7096 print('switchtype_3', list(p
))
7098 # { p[0] = PGBuiltin::PMOS; }
7102 def p_switchtype_4(p
):
7103 '''switchtype : K_rpmos '''
7105 print('switchtype_4', list(p
))
7107 # { p[0] = PGBuiltin::RPMOS; }
7111 def p_switchtype_5(p
):
7112 '''switchtype : K_cmos '''
7114 print('switchtype_5', list(p
))
7116 # { p[0] = PGBuiltin::CMOS; }
7120 def p_switchtype_6(p
):
7121 '''switchtype : K_rcmos '''
7123 print('switchtype_6', list(p
))
7125 # { p[0] = PGBuiltin::RCMOS; }
7129 def p_switchtype_7(p
):
7130 '''switchtype : K_tran '''
7132 print('switchtype_7', list(p
))
7134 # { p[0] = PGBuiltin::TRAN; }
7138 def p_switchtype_8(p
):
7139 '''switchtype : K_rtran '''
7141 print('switchtype_8', list(p
))
7143 # { p[0] = PGBuiltin::RTRAN; }
7147 def p_switchtype_9(p
):
7148 '''switchtype : K_tranif0 '''
7150 print('switchtype_9', list(p
))
7152 # { p[0] = PGBuiltin::TRANIF0; }
7156 def p_switchtype_10(p
):
7157 '''switchtype : K_tranif1 '''
7159 print('switchtype_10', list(p
))
7161 # { p[0] = PGBuiltin::TRANIF1; }
7165 def p_switchtype_11(p
):
7166 '''switchtype : K_rtranif0 '''
7168 print('switchtype_11', list(p
))
7170 # { p[0] = PGBuiltin::RTRANIF0; }
7174 def p_switchtype_12(p
):
7175 '''switchtype : K_rtranif1 '''
7177 print('switchtype_12', list(p
))
7179 # { p[0] = PGBuiltin::RTRANIF1; }
7183 def p_hierarchy_identifier_1(p
):
7184 '''hierarchy_identifier : IDENTIFIER '''
7186 print('hierarchy_identifier_1 FIXME', list(p
))
7187 lpvalue
= Leaf(token
.NAME
, p
[1])
7190 # { p[0] = new pform_name_t;
7191 # p[0]->push_back(name_component_t(lex_strings.make(p[1])));
7197 def p_hierarchy_identifier_2(p
):
7198 '''hierarchy_identifier : hierarchy_identifier '.' IDENTIFIER '''
7200 print('hierarchy_identifier_2', list(p
))
7202 # { pform_name_t * tmp = p[1];
7203 # tmp->push_back(name_component_t(lex_strings.make(p[3])));
7210 def p_hierarchy_identifier_3(p
):
7211 '''hierarchy_identifier : hierarchy_identifier '[' expression ']' '''
7213 print('hierarchy_identifier_3', list(p
))
7215 # { pform_name_t * tmp = p[1];
7216 # name_component_t&tail = tmp->back();
7217 # index_component_t itmp;
7218 # itmp.sel = index_component_t::SEL_BIT;
7220 # tail.index.push_back(itmp);
7226 def p_hierarchy_identifier_4(p
):
7227 '''hierarchy_identifier : hierarchy_identifier '[' '$' ']' '''
7229 print('hierarchy_identifier_4', list(p
))
7231 # { pform_name_t * tmp = p[1];
7232 # name_component_t&tail = tmp->back();
7233 # if (! gn_system_verilog()) {
7234 # yyerror(@3, "error: Last element expression ($) "
7235 # "requires SystemVerilog. Try enabling SystemVerilog.");
7237 # index_component_t itmp;
7238 # itmp.sel = index_component_t::SEL_BIT_LAST;
7241 # tail.index.push_back(itmp);
7247 def p_hierarchy_identifier_5(p
):
7248 '''hierarchy_identifier : hierarchy_identifier '[' expression ':' expression ']' '''
7250 print('hierarchy_identifier_5', list(p
))
7252 # { pform_name_t * tmp = p[1];
7253 # name_component_t&tail = tmp->back();
7254 # index_component_t itmp;
7255 # itmp.sel = index_component_t::SEL_PART;
7258 # tail.index.push_back(itmp);
7264 def p_hierarchy_identifier_6(p
):
7265 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_POS expression ']' '''
7267 print('hierarchy_identifier_6', list(p
))
7269 # { pform_name_t * tmp = p[1];
7270 # name_component_t&tail = tmp->back();
7271 # index_component_t itmp;
7272 # itmp.sel = index_component_t::SEL_IDX_UP;
7275 # tail.index.push_back(itmp);
7281 def p_hierarchy_identifier_7(p
):
7282 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_NEG expression ']' '''
7284 print('hierarchy_identifier_7', list(p
))
7286 # { pform_name_t * tmp = p[1];
7287 # name_component_t&tail = tmp->back();
7288 # index_component_t itmp;
7289 # itmp.sel = index_component_t::SEL_IDX_DO;
7292 # tail.index.push_back(itmp);
7298 def p_list_of_identifiers_1(p
):
7299 '''list_of_identifiers : IDENTIFIER '''
7301 print('list_of_identifiers_1', list(p
))
7303 # { p[0] = list_from_identifier(p[1]); }
7307 def p_list_of_identifiers_2(p
):
7308 '''list_of_identifiers : list_of_identifiers ',' IDENTIFIER '''
7310 print('list_of_identifiers_2', list(p
))
7312 # { p[0] = list_from_identifier(p[1], p[3]); }
7316 def p_list_of_port_identifiers_1(p
):
7317 '''list_of_port_identifiers : IDENTIFIER dimensions_opt '''
7319 print('list_of_port_identifiers_1', list(p
))
7321 # { p[0] = make_port_list(p[1], p[2], 0); }
7325 def p_list_of_port_identifiers_2(p
):
7326 '''list_of_port_identifiers : list_of_port_identifiers ',' IDENTIFIER dimensions_opt '''
7328 print('list_of_port_identifiers_2', list(p
))
7330 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
7334 def p_list_of_variable_port_identifiers_1(p
):
7335 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '''
7337 print('list_of_variable_port_identifiers_1', list(p
))
7339 # { p[0] = make_port_list(p[1], p[2], 0); }
7343 def p_list_of_variable_port_identifiers_2(p
):
7344 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '=' expression '''
7346 print('list_of_variable_port_identifiers_2', list(p
))
7348 # { p[0] = make_port_list(p[1], p[2], p[4]); }
7352 def p_list_of_variable_port_identifiers_3(p
):
7353 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '''
7355 print('list_of_variable_port_identifiers_3', list(p
))
7357 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
7361 def p_list_of_variable_port_identifiers_4(p
):
7362 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '=' expression '''
7364 print('list_of_variable_port_identifiers_4', list(p
))
7366 # { p[0] = make_port_list(p[1], p[3], p[4], p[6]); }
7370 def p_list_of_ports_1(p
):
7371 '''list_of_ports : port_opt '''
7373 print('list_of_ports_1', list(p
))
7375 # { vector<Module::port_t*>*tmp
7376 # = new vector<Module::port_t*>(1);
7383 def p_list_of_ports_2(p
):
7384 '''list_of_ports : list_of_ports ',' port_opt '''
7386 print('list_of_ports_2', list(p
))
7388 # { vector<Module::port_t*>*tmp = p[1];
7389 # tmp->push_back(p[3]);
7395 def p_list_of_port_declarations_1(p
):
7396 '''list_of_port_declarations : port_declaration '''
7397 if(parse_debug
> 1):
7398 print('list_of_port_declarations_1', list(p
))
7401 # { vector<Module::port_t*>*tmp
7402 # = new vector<Module::port_t*>(1);
7409 def p_list_of_port_declarations_2(p
):
7410 '''list_of_port_declarations : list_of_port_declarations ',' port_declaration '''
7412 print('list_of_port_declarations_2 FIXME', list(p
))
7413 # MOVE_TO absyn p[1].append(Leaf(token.NEWLINE, '\n')) # should be a comma
7414 # XXX p[3].prefix=' ' # add a space after the NL, must go in parameter
7418 # { vector<Module::port_t*>*tmp = p[1];
7419 # tmp->push_back(p[3]);
7425 def p_list_of_port_declarations_3(p
):
7426 '''list_of_port_declarations : list_of_port_declarations ',' IDENTIFIER '''
7428 print('list_of_port_declarations_3', list(p
))
7430 # { Module::port_t*ptmp;
7431 # perm_string name = lex_strings.make(p[3]);
7432 # ptmp = pform_module_port_reference(name, @3.text,
7434 # vector<Module::port_t*>*tmp = p[1];
7435 # tmp->push_back(ptmp);
7437 # /* Get the port declaration details, the port type
7438 # and what not, from context data stored by the
7439 # last port_declaration rule. */
7440 # pform_module_define_port(@3, name,
7441 # port_declaration_context.port_type,
7442 # port_declaration_context.port_net_type,
7443 # port_declaration_context.data_type, 0);
7450 def p_list_of_port_declarations_4(p
):
7451 '''list_of_port_declarations : list_of_port_declarations ',' '''
7453 print('list_of_port_declarations_4', list(p
))
7456 # yyerror(@2, "error: NULL port declarations are not "
7462 def p_list_of_port_declarations_5(p
):
7463 '''list_of_port_declarations : list_of_port_declarations ';' '''
7465 print('list_of_port_declarations_5', list(p
))
7468 # yyerror(@2, "error: ';' is an invalid port declaration "
7474 def p_port_declaration_1(p
):
7475 '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7477 print('port_declaration_1 FIXME', list(p
))
7478 comment
, dt
, name
= p
[2], p
[4], p
[5]
7479 p
[0] = absyn
.port_decl(comment
, dt
, name
)
7481 # { Module::port_t*ptmp;
7482 # perm_string name = lex_strings.make(p[5]);
7483 # data_type_t*use_type = p[4];
7484 # if (p[6]) use_type = new uarray_type_t(use_type, p[6]);
7485 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7486 # pform_module_define_port(@2, name, NetNet::PINPUT, p[3], use_type, p[1]);
7487 # port_declaration_context.port_type = NetNet::PINPUT;
7488 # port_declaration_context.port_net_type = p[3];
7489 # port_declaration_context.data_type = p[4];
7496 def p_port_declaration_2(p
):
7497 '''port_declaration : attribute_list_opt K_input K_wreal IDENTIFIER '''
7499 print('port_declaration_2', list(p
))
7501 # { Module::port_t*ptmp;
7502 # perm_string name = lex_strings.make(p[4]);
7503 # ptmp = pform_module_port_reference(name, @2.text,
7505 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7506 # FILE_NAME(real_type, @3);
7507 # pform_module_define_port(@2, name, NetNet::PINPUT,
7508 # NetNet::WIRE, real_type, p[1]);
7509 # port_declaration_context.port_type = NetNet::PINPUT;
7510 # port_declaration_context.port_net_type = NetNet::WIRE;
7511 # port_declaration_context.data_type = real_type;
7518 def p_port_declaration_3(p
):
7519 '''port_declaration : attribute_list_opt K_inout net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7521 print('port_declaration_3', list(p
))
7523 # { Module::port_t*ptmp;
7524 # perm_string name = lex_strings.make(p[5]);
7525 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7526 # pform_module_define_port(@2, name, NetNet::PINOUT, p[3], p[4], p[1]);
7527 # port_declaration_context.port_type = NetNet::PINOUT;
7528 # port_declaration_context.port_net_type = p[3];
7529 # port_declaration_context.data_type = p[4];
7532 # yyerror(@6, "sorry: Inout ports with unpacked dimensions not supported.");
7540 def p_port_declaration_4(p
):
7541 '''port_declaration : attribute_list_opt K_inout K_wreal IDENTIFIER '''
7543 print('port_declaration_4', list(p
))
7545 # { Module::port_t*ptmp;
7546 # perm_string name = lex_strings.make(p[4]);
7547 # ptmp = pform_module_port_reference(name, @2.text,
7549 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7550 # FILE_NAME(real_type, @3);
7551 # pform_module_define_port(@2, name, NetNet::PINOUT,
7552 # NetNet::WIRE, real_type, p[1]);
7553 # port_declaration_context.port_type = NetNet::PINOUT;
7554 # port_declaration_context.port_net_type = NetNet::WIRE;
7555 # port_declaration_context.data_type = real_type;
7562 def p_port_declaration_5(p
):
7563 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7565 print('port_declaration_5 FIXME', list(p
))
7566 comment
, dt
, name
= p
[2], p
[4], p
[5]
7567 p
[0] = absyn
.port_decl(comment
, dt
, name
)
7569 # { Module::port_t*ptmp;
7570 # perm_string name = lex_strings.make(p[5]);
7571 # data_type_t*use_dtype = p[4];
7572 # if (p[6]) use_dtype = new uarray_type_t(use_dtype, p[6]);
7573 # NetNet::Type use_type = p[3];
7574 # if (use_type == NetNet::IMPLICIT) {
7575 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
7576 # if (dtype->reg_flag)
7577 # use_type = NetNet::REG;
7578 # else if (dtype->implicit_flag)
7579 # use_type = NetNet::IMPLICIT;
7581 # use_type = NetNet::IMPLICIT_REG;
7583 # // The SystemVerilog types that can show up as
7584 # // output ports are implicitly (on the inside)
7585 # // variables because "reg" is not valid syntax
7587 # } else if (dynamic_cast<atom2_type_t*> (p[4])) {
7588 # use_type = NetNet::IMPLICIT_REG;
7589 # } else if (dynamic_cast<struct_type_t*> (p[4])) {
7590 # use_type = NetNet::IMPLICIT_REG;
7591 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[4])) {
7592 # if(etype->base_type == IVL_VT_LOGIC)
7593 # use_type = NetNet::IMPLICIT_REG;
7596 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7597 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, use_dtype, p[1]);
7598 # port_declaration_context.port_type = NetNet::POUTPUT;
7599 # port_declaration_context.port_net_type = use_type;
7600 # port_declaration_context.data_type = p[4];
7607 def p_port_declaration_6(p
):
7608 '''port_declaration : attribute_list_opt K_output K_wreal IDENTIFIER '''
7610 print('port_declaration_6', list(p
))
7612 # { Module::port_t*ptmp;
7613 # perm_string name = lex_strings.make(p[4]);
7614 # ptmp = pform_module_port_reference(name, @2.text,
7616 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7617 # FILE_NAME(real_type, @3);
7618 # pform_module_define_port(@2, name, NetNet::POUTPUT,
7619 # NetNet::WIRE, real_type, p[1]);
7620 # port_declaration_context.port_type = NetNet::POUTPUT;
7621 # port_declaration_context.port_net_type = NetNet::WIRE;
7622 # port_declaration_context.data_type = real_type;
7629 def p_port_declaration_7(p
):
7630 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER '=' expression '''
7632 print('port_declaration_7', list(p
))
7634 # { Module::port_t*ptmp;
7635 # perm_string name = lex_strings.make(p[5]);
7636 # NetNet::Type use_type = p[3];
7637 # if (use_type == NetNet::IMPLICIT) {
7638 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
7639 # if (dtype->reg_flag)
7640 # use_type = NetNet::REG;
7642 # use_type = NetNet::IMPLICIT_REG;
7644 # use_type = NetNet::IMPLICIT_REG;
7647 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7648 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, p[4], p[1]);
7649 # port_declaration_context.port_type = NetNet::PINOUT;
7650 # port_declaration_context.port_net_type = use_type;
7651 # port_declaration_context.data_type = p[4];
7653 # pform_make_var_init(@5, name, p[7]);
7661 def p_net_type_opt_1(p
):
7662 '''net_type_opt : net_type '''
7664 print('net_type_opt_1', list(p
))
7671 def p_net_type_opt_2(p
):
7672 '''net_type_opt : '''
7673 if(parse_debug
> 2):
7674 print('net_type_opt_2', list(p
))
7681 def p_unsigned_signed_opt_1(p
):
7682 '''unsigned_signed_opt : K_signed '''
7684 print('unsigned_signed_opt_1', list(p
))
7691 def p_unsigned_signed_opt_2(p
):
7692 '''unsigned_signed_opt : K_unsigned '''
7694 print('unsigned_signed_opt_2', list(p
))
7701 def p_unsigned_signed_opt_3(p
):
7702 '''unsigned_signed_opt : '''
7704 print('unsigned_signed_opt_3', list(p
))
7711 def p_signed_unsigned_opt_1(p
):
7712 '''signed_unsigned_opt : K_signed '''
7714 print('signed_unsigned_opt_1', list(p
))
7721 def p_signed_unsigned_opt_2(p
):
7722 '''signed_unsigned_opt : K_unsigned '''
7724 print('signed_unsigned_opt_2', list(p
))
7731 def p_signed_unsigned_opt_3(p
):
7732 '''signed_unsigned_opt : '''
7734 print('signed_unsigned_opt_3', list(p
))
7741 def p_atom2_type_1(p
):
7742 '''atom2_type : K_byte '''
7744 print('atom2_type_1', list(p
))
7750 def p_atom2_type_2(p
):
7751 '''atom2_type : K_shortint '''
7753 print('atom2_type_2', list(p
))
7759 def p_atom2_type_3(p
):
7760 '''atom2_type : K_int '''
7762 print('atom2_type_3', list(p
))
7768 def p_atom2_type_4(p
):
7769 '''atom2_type : K_longint '''
7771 print('atom2_type_4', list(p
))
7778 '''lpvalue : hierarchy_identifier '''
7779 if(parse_debug
> 2):
7780 print('lpvalue_1', list(p
))
7783 # { PEIdent*tmp = pform_new_ident(*p[1]);
7784 # FILE_NAME(tmp, @1);
7792 '''lpvalue : implicit_class_handle '.' hierarchy_identifier '''
7794 print('lpvalue_2', list(p
))
7796 # { pform_name_t*t_name = p[1];
7797 # while (!p[3]->empty()) {
7798 # t_name->push_back(p[3]->front());
7799 # p[3]->pop_front();
7801 # PEIdent*tmp = new PEIdent(*t_name);
7802 # FILE_NAME(tmp, @1);
7811 '''lpvalue : '{' expression_list_proper '}' '''
7813 print('lpvalue_3', list(p
))
7815 # { PEConcat*tmp = new PEConcat(*p[2]);
7816 # FILE_NAME(tmp, @1);
7824 '''lpvalue : streaming_concatenation '''
7826 print('lpvalue_4', list(p
))
7828 # { yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
7834 def p_cont_assign_1(p
):
7835 '''cont_assign : lpvalue '=' expression '''
7837 print('cont_assign_1', list(p
))
7838 absyn
.cont_assign_1(p
)
7840 # { list<PExpr*>*tmp = new list<PExpr*>;
7841 # tmp->push_back(p[1]);
7842 # tmp->push_back(p[3]);
7848 def p_cont_assign_list_1(p
):
7849 '''cont_assign_list : cont_assign_list ',' cont_assign '''
7851 print('cont_assign_list_1', list(p
))
7853 # { list<PExpr*>*tmp = p[1];
7854 # tmp->splice(tmp->end(), *p[3]);
7861 def p_cont_assign_list_2(p
):
7862 '''cont_assign_list : cont_assign '''
7863 if(parse_debug
> 2):
7864 print('cont_assign_list_2', list(p
))
7872 '''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 '''
7873 if(parse_debug
> 2):
7874 print('module_1', list(p
))
7875 clsdecl
= absyn
.module_1(p
)
7882 def p__embed0_module(p
):
7883 '''_embed0_module : '''
7885 # { pform_startmodule(@2, p[4], p[2]==K_program, p[2]==K_interface, p[3], p[1]); }
7889 def p__embed1_module(p
):
7890 '''_embed1_module : '''
7892 # { pform_module_set_ports(p[8]); }
7896 def p__embed2_module(p
):
7897 '''_embed2_module : '''
7899 # { pform_set_scope_timescale(@2); }
7903 def p__embed3_module(p
):
7904 '''_embed3_module : '''
7906 # { Module::UCDriveType ucd;
7907 # // The lexor detected `unconnected_drive directives and
7908 # // marked what it found in the uc_drive variable. Use that
7909 # // to generate a UCD flag for the module.
7910 # switch (uc_drive) {
7913 # ucd = Module::UCD_NONE;
7916 # ucd = Module::UCD_PULL0;
7919 # ucd = Module::UCD_PULL1;
7922 # // Check that program/endprogram and module/endmodule
7923 # // keywords match.
7924 # if (p[2] != p[15]) {
7927 # yyerror(@15, "error: module not closed by endmodule.");
7930 # yyerror(@15, "error: program not closed by endprogram.");
7933 # yyerror(@15, "error: interface not closed by endinterface.");
7939 # pform_endmodule(p[4], in_celldefine, ucd);
7944 def p_module_start_1(p
):
7945 '''module_start : K_module '''
7946 if(parse_debug
> 1):
7947 print('module_start_1', list(p
))
7949 # { p[0] = K_module; }
7953 def p_module_start_2(p
):
7954 '''module_start : K_macromodule '''
7956 print('module_start_2', list(p
))
7958 # { p[0] = K_module; }
7962 def p_module_start_3(p
):
7963 '''module_start : K_program '''
7965 print('module_start_3', list(p
))
7967 # { p[0] = K_program; }
7971 def p_module_start_4(p
):
7972 '''module_start : K_interface '''
7974 print('module_start_4', list(p
))
7976 # { p[0] = K_interface; }
7980 def p_module_end_1(p
):
7981 '''module_end : K_endmodule '''
7982 if(parse_debug
> 2):
7983 print('module_end_1', list(p
))
7985 # { p[0] = K_module; }
7989 def p_module_end_2(p
):
7990 '''module_end : K_endprogram '''
7992 print('module_end_2', list(p
))
7994 # { p[0] = K_program; }
7998 def p_module_end_3(p
):
7999 '''module_end : K_endinterface '''
8001 print('module_end_3', list(p
))
8003 # { p[0] = K_interface; }
8007 def p_endlabel_opt_1(p
):
8008 '''endlabel_opt : ':' IDENTIFIER '''
8010 print('endlabel_opt_1', list(p
))
8017 def p_endlabel_opt_2(p
):
8018 '''endlabel_opt : '''
8019 if(parse_debug
> 2):
8020 print('endlabel_opt_2', list(p
))
8026 def p_module_attribute_foreign_1(p
):
8027 '''module_attribute_foreign : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP '''
8029 print('module_attribute_foreign_1', list(p
))
8035 def p_module_attribute_foreign_2(p
):
8036 '''module_attribute_foreign : '''
8037 if(parse_debug
> 2):
8038 print('module_attribute_foreign_2', list(p
))
8044 def p_module_port_list_opt_1(p
):
8045 '''module_port_list_opt : '(' list_of_ports ')' '''
8047 print('module_port_list_opt_1', list(p
))
8054 def p_module_port_list_opt_2(p
):
8055 '''module_port_list_opt : '(' list_of_port_declarations ')' '''
8056 if(parse_debug
> 2):
8057 print('module_port_list_opt_2', list(p
))
8064 def p_module_port_list_opt_3(p
):
8065 '''module_port_list_opt : '''
8067 print('module_port_list_opt_3', list(p
))
8073 def p_module_port_list_opt_4(p
):
8074 '''module_port_list_opt : '(' error ')' '''
8076 print('module_port_list_opt_4', list(p
))
8078 # { yyerror(@2, "Errors in port declarations.");
8085 def p_module_parameter_port_list_opt_1(p
):
8086 '''module_parameter_port_list_opt : '''
8087 if(parse_debug
> 2):
8088 print('module_parameter_port_list_opt_1', list(p
))
8094 def p_module_parameter_port_list_opt_2(p
):
8095 '''module_parameter_port_list_opt : '#' '(' module_parameter_port_list ')' '''
8097 print('module_parameter_port_list_opt_2', list(p
))
8104 def p_module_parameter_port_list_1(p
):
8105 '''module_parameter_port_list : K_parameter param_type parameter_assign '''
8107 print('module_parameter_port_list_1', list(p
))
8114 def p_module_parameter_port_list_2(p
):
8115 '''module_parameter_port_list : module_parameter_port_list ',' parameter_assign '''
8117 print('module_parameter_port_list_2', list(p
))
8118 p
[0] = p
[1].append(p
[3])
8124 def p_module_parameter_port_list_3(p
):
8125 '''module_parameter_port_list : module_parameter_port_list ',' K_parameter param_type parameter_assign '''
8127 print('module_parameter_port_list_3', list(p
))
8128 p
[1].append(Leaf(token
.COMMA
, ','))
8129 p
[1].append(Leaf(token
.NEWLINE
, '\n'))
8130 p
[5].prefix
= ' ' # add space after newline
8138 def p_module_item_1(p
):
8139 '''module_item : module '''
8141 print('module_item_1', list(p
))
8147 def p_module_item_2(p
):
8148 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' '''
8150 print('module_item_2', list(p
))
8152 p
[0] = absyn
.module_item_2(p
[2], p
[3], p
[5])
8153 #p[0] = ["module_item_2"]+list(p)
8155 # { data_type_t*data_type = p[3];
8156 # if (data_type == 0) {
8157 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8158 # FILE_NAME(data_type, @2);
8160 # pform_set_data_type(@2, data_type, p[5], p[2], p[1]);
8162 # yyerror(@2, "sorry: net delays not supported.");
8170 def p_module_item_3(p
):
8171 '''module_item : attribute_list_opt K_wreal delay3 net_variable_list ';' '''
8173 print('module_item_3', list(p
))
8175 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
8176 # pform_set_data_type(@2, tmpt, p[4], NetNet::WIRE, p[1]);
8178 # yyerror(@3, "sorry: net delays not supported.");
8186 def p_module_item_4(p
):
8187 '''module_item : attribute_list_opt K_wreal net_variable_list ';' '''
8189 print('module_item_4', list(p
))
8191 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
8192 # pform_set_data_type(@2, tmpt, p[3], NetNet::WIRE, p[1]);
8198 def p_module_item_5(p
):
8199 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_decl_assigns ';' '''
8201 print('module_item_5', list(p
))
8203 # { data_type_t*data_type = p[3];
8204 # if (data_type == 0) {
8205 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8206 # FILE_NAME(data_type, @2);
8208 # pform_makewire(@2, p[4], str_strength, p[5], p[2], data_type);
8210 # yywarn(@2, "Attributes are not supported on net declaration "
8211 # "assignments and will be discarded.");
8218 def p_module_item_6(p
):
8219 '''module_item : attribute_list_opt net_type data_type_or_implicit drive_strength net_decl_assigns ';' '''
8221 print('module_item_6', list(p
))
8223 # { data_type_t*data_type = p[3];
8224 # if (data_type == 0) {
8225 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8226 # FILE_NAME(data_type, @2);
8228 # pform_makewire(@2, 0, p[4], p[5], p[2], data_type);
8230 # yywarn(@2, "Attributes are not supported on net declaration "
8231 # "assignments and will be discarded.");
8238 def p_module_item_7(p
):
8239 '''module_item : attribute_list_opt K_wreal net_decl_assigns ';' '''
8241 print('module_item_7', list(p
))
8243 # { real_type_t*data_type = new real_type_t(real_type_t::REAL);
8244 # pform_makewire(@2, 0, str_strength, p[3], NetNet::WIRE, data_type);
8246 # yywarn(@2, "Attributes are not supported on net declaration "
8247 # "assignments and will be discarded.");
8254 def p_module_item_8(p
):
8255 '''module_item : K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' '''
8257 print('module_item_8', list(p
))
8259 # { yyerror(@1, "sorry: trireg nets not supported.");
8266 def p_module_item_9(p
):
8267 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit list_of_port_identifiers ';' '''
8269 print('module_item_9', list(p
))
8271 # { pform_module_define_port(@2, p[5], p[2], p[3], p[4], p[1]); }
8275 def p_module_item_10(p
):
8276 '''module_item : attribute_list_opt port_direction K_wreal list_of_port_identifiers ';' '''
8278 print('module_item_10', list(p
))
8280 # { real_type_t*real_type = new real_type_t(real_type_t::REAL);
8281 # pform_module_define_port(@2, p[4], p[2], NetNet::WIRE, real_type, p[1]);
8286 def p_module_item_11(p
):
8287 '''module_item : attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' '''
8289 print('module_item_11', list(p
))
8291 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8292 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8293 # if (dtype->implicit_flag)
8294 # use_type = NetNet::NONE;
8296 # if (use_type == NetNet::NONE)
8297 # pform_set_port_type(@2, p[4], NetNet::PINOUT, p[3], p[1]);
8299 # pform_module_define_port(@2, p[4], NetNet::PINOUT, use_type, p[3], p[1]);
8304 def p_module_item_12(p
):
8305 '''module_item : attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' '''
8307 print('module_item_12', list(p
))
8309 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8310 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8311 # if (dtype->implicit_flag)
8312 # use_type = NetNet::NONE;
8314 # if (use_type == NetNet::NONE)
8315 # pform_set_port_type(@2, p[4], NetNet::PINPUT, p[3], p[1]);
8317 # pform_module_define_port(@2, p[4], NetNet::PINPUT, use_type, p[3], p[1]);
8322 def p_module_item_13(p
):
8323 '''module_item : attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' '''
8325 print('module_item_13', list(p
))
8327 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8328 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8329 # if (dtype->implicit_flag)
8330 # use_type = NetNet::NONE;
8331 # else if (dtype->reg_flag)
8332 # use_type = NetNet::REG;
8334 # use_type = NetNet::IMPLICIT_REG;
8336 # // The SystemVerilog types that can show up as
8337 # // output ports are implicitly (on the inside)
8338 # // variables because "reg" is not valid syntax
8340 # } else if (dynamic_cast<atom2_type_t*> (p[3])) {
8341 # use_type = NetNet::IMPLICIT_REG;
8342 # } else if (dynamic_cast<struct_type_t*> (p[3])) {
8343 # use_type = NetNet::IMPLICIT_REG;
8344 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[3])) {
8345 # if(etype->base_type == IVL_VT_LOGIC)
8346 # use_type = NetNet::IMPLICIT_REG;
8348 # if (use_type == NetNet::NONE)
8349 # pform_set_port_type(@2, p[4], NetNet::POUTPUT, p[3], p[1]);
8351 # pform_module_define_port(@2, p[4], NetNet::POUTPUT, use_type, p[3], p[1]);
8356 def p_module_item_14(p
):
8357 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit error ';' '''
8359 print('module_item_14', list(p
))
8361 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8362 # if (p[1]) delete p[1];
8363 # if (p[4]) delete p[4];
8369 def p_module_item_15(p
):
8370 '''module_item : attribute_list_opt K_inout data_type_or_implicit error ';' '''
8372 print('module_item_15', list(p
))
8374 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8375 # if (p[1]) delete p[1];
8376 # if (p[3]) delete p[3];
8382 def p_module_item_16(p
):
8383 '''module_item : attribute_list_opt K_input data_type_or_implicit error ';' '''
8385 print('module_item_16', list(p
))
8387 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8388 # if (p[1]) delete p[1];
8389 # if (p[3]) delete p[3];
8395 def p_module_item_17(p
):
8396 '''module_item : attribute_list_opt K_output data_type_or_implicit error ';' '''
8398 print('module_item_17', list(p
))
8400 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8401 # if (p[1]) delete p[1];
8402 # if (p[3]) delete p[3];
8408 def p_module_item_18(p
):
8409 '''module_item : DISCIPLINE_IDENTIFIER list_of_identifiers ';' '''
8411 print('module_item_18', list(p
))
8413 # { pform_attach_discipline(@1, p[1], p[2]); }
8417 def p_module_item_19(p
):
8418 '''module_item : attribute_list_opt _embed0_module_item block_item_decl '''
8420 print('module_item_19', list(p
))
8422 # { delete attributes_in_context;
8423 # attributes_in_context = 0;
8428 def p_module_item_20(p
):
8429 '''module_item : K_defparam _embed1_module_item defparam_assign_list ';' '''
8431 print('module_item_20', list(p
))
8437 def p_module_item_21(p
):
8438 '''module_item : attribute_list_opt gatetype gate_instance_list ';' '''
8440 print('module_item_21', list(p
))
8442 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
8446 def p_module_item_22(p
):
8447 '''module_item : attribute_list_opt gatetype delay3 gate_instance_list ';' '''
8449 print('module_item_22', list(p
))
8451 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
8455 def p_module_item_23(p
):
8456 '''module_item : attribute_list_opt gatetype drive_strength gate_instance_list ';' '''
8458 print('module_item_23', list(p
))
8460 # { pform_makegates(@2, p[2], p[3], 0, p[4], p[1]); }
8464 def p_module_item_24(p
):
8465 '''module_item : attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';' '''
8467 print('module_item_24', list(p
))
8469 # { pform_makegates(@2, p[2], p[3], p[4], p[5], p[1]); }
8473 def p_module_item_25(p
):
8474 '''module_item : attribute_list_opt switchtype gate_instance_list ';' '''
8476 print('module_item_25', list(p
))
8478 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
8482 def p_module_item_26(p
):
8483 '''module_item : attribute_list_opt switchtype delay3 gate_instance_list ';' '''
8485 print('module_item_26', list(p
))
8487 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
8491 def p_module_item_27(p
):
8492 '''module_item : K_pullup gate_instance_list ';' '''
8494 print('module_item_27', list(p
))
8496 # { pform_makegates(@1, PGBuiltin::PULLUP, pull_strength, 0, p[2], 0); }
8500 def p_module_item_28(p
):
8501 '''module_item : K_pulldown gate_instance_list ';' '''
8503 print('module_item_28', list(p
))
8505 # { pform_makegates(@1, PGBuiltin::PULLDOWN, pull_strength, 0, p[2], 0); }
8509 def p_module_item_29(p
):
8510 '''module_item : K_pullup '(' dr_strength1 ')' gate_instance_list ';' '''
8512 print('module_item_29', list(p
))
8514 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[5], 0); }
8518 def p_module_item_30(p
):
8519 '''module_item : K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
8521 print('module_item_30', list(p
))
8523 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[7], 0); }
8527 def p_module_item_31(p
):
8528 '''module_item : K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
8530 print('module_item_31', list(p
))
8532 # { pform_makegates(@1, PGBuiltin::PULLUP, p[5], 0, p[7], 0); }
8536 def p_module_item_32(p
):
8537 '''module_item : K_pulldown '(' dr_strength0 ')' gate_instance_list ';' '''
8539 print('module_item_32', list(p
))
8541 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[5], 0); }
8545 def p_module_item_33(p
):
8546 '''module_item : K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
8548 print('module_item_33', list(p
))
8550 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[5], 0, p[7], 0); }
8554 def p_module_item_34(p
):
8555 '''module_item : K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
8557 print('module_item_34', list(p
))
8559 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[7], 0); }
8563 def p_module_item_35(p
):
8564 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' '''
8566 print('module_item_35', list(p
))
8568 # { perm_string tmp1 = lex_strings.make(p[2]);
8569 # pform_make_modgates(@2, tmp1, p[3], p[4], p[1]);
8575 def p_module_item_36(p
):
8576 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt error ';' '''
8578 print('module_item_36', list(p
))
8580 # { yyerror(@2, "error: Invalid module instantiation");
8582 # if (p[1]) delete p[1];
8587 def p_module_item_37(p
):
8588 '''module_item : K_assign drive_strength_opt delay3_opt cont_assign_list ';' '''
8589 if(parse_debug
> 2):
8590 print('module_item_37', list(p
))
8592 # { pform_make_pgassign_list(p[4], p[3], p[2], @1.text, @1.first_line); }
8596 def p_module_item_38(p
):
8597 '''module_item : attribute_list_opt K_always statement_item '''
8599 print('module_item_38', list(p
))
8601 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, p[3], p[1]);
8602 # FILE_NAME(tmp, @2);
8607 def p_module_item_39(p
):
8608 '''module_item : attribute_list_opt K_always_comb statement_item '''
8610 print('module_item_39', list(p
))
8612 absyn
.always_comb(p
[3], p
[1])
8614 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_COMB, p[3], p[1]);
8615 # FILE_NAME(tmp, @2);
8620 def p_module_item_40(p
):
8621 '''module_item : attribute_list_opt K_always_ff statement_item '''
8623 print('module_item_40', list(p
))
8625 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, p[3], p[1]);
8626 # FILE_NAME(tmp, @2);
8631 def p_module_item_41(p
):
8632 '''module_item : attribute_list_opt K_always_latch statement_item '''
8634 print('module_item_41', list(p
))
8636 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_LATCH, p[3], p[1]);
8637 # FILE_NAME(tmp, @2);
8642 def p_module_item_42(p
):
8643 '''module_item : attribute_list_opt K_initial statement_item '''
8645 print('module_item_42', list(p
))
8647 # { PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, p[3], p[1]);
8648 # FILE_NAME(tmp, @2);
8653 def p_module_item_43(p
):
8654 '''module_item : attribute_list_opt K_final statement_item '''
8656 print('module_item_43', list(p
))
8658 # { PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, p[3], p[1]);
8659 # FILE_NAME(tmp, @2);
8664 def p_module_item_44(p
):
8665 '''module_item : attribute_list_opt K_analog analog_statement '''
8667 print('module_item_44', list(p
))
8669 # { pform_make_analog_behavior(@2, IVL_PR_ALWAYS, p[3]); }
8673 def p_module_item_45(p
):
8674 '''module_item : attribute_list_opt assertion_item '''
8676 print('module_item_45', list(p
))
8682 def p_module_item_46(p
):
8683 '''module_item : timeunits_declaration '''
8685 print('module_item_46', list(p
))
8691 def p_module_item_47(p
):
8692 '''module_item : class_declaration '''
8694 print('module_item_47', list(p
))
8700 def p_module_item_48(p
):
8701 '''module_item : task_declaration '''
8703 print('module_item_48', list(p
))
8709 def p_module_item_49(p
):
8710 '''module_item : function_declaration '''
8712 print('module_item_49', list(p
))
8718 def p_module_item_50(p
):
8719 '''module_item : K_generate generate_item_list_opt K_endgenerate '''
8721 print('module_item_50', list(p
))
8723 # { // Test for bad nesting. I understand it, but it is illegal.
8724 # if (pform_parent_generate()) {
8725 # cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
8726 # cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
8727 # cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
8734 def p_module_item_51(p
):
8735 '''module_item : K_genvar list_of_identifiers ';' '''
8737 print('module_item_51', list(p
))
8739 # { pform_genvars(@1, p[2]); }
8743 def p_module_item_52(p
):
8744 '''module_item : K_for '(' IDENTIFIER '=' expression ';' expression ';' IDENTIFIER '=' expression ')' _embed2_module_item generate_block '''
8746 print('module_item_52', list(p
))
8748 # { pform_endgenerate(); }
8752 def p_module_item_53(p
):
8753 '''module_item : generate_if generate_block_opt K_else _embed3_module_item generate_block '''
8755 print('module_item_53', list(p
))
8757 # { pform_endgenerate(); }
8761 def p_module_item_54(p
):
8762 '''module_item : generate_if generate_block_opt %prec less_than_K_else '''
8764 print('module_item_54', list(p
))
8766 # { pform_endgenerate(); }
8770 def p_module_item_55(p
):
8771 '''module_item : K_case '(' expression ')' _embed4_module_item generate_case_items K_endcase '''
8773 print('module_item_55', list(p
))
8775 # { pform_endgenerate(); }
8779 def p_module_item_56(p
):
8780 '''module_item : modport_declaration '''
8782 print('module_item_56', list(p
))
8788 def p_module_item_57(p
):
8789 '''module_item : package_import_declaration '''
8791 print('module_item_57', list(p
))
8797 def p_module_item_58(p
):
8798 '''module_item : attribute_list_opt K_specparam _embed5_module_item specparam_decl ';' '''
8800 print('module_item_58', list(p
))
8806 def p_module_item_59(p
):
8807 '''module_item : K_specify _embed6_module_item specify_item_list_opt K_endspecify '''
8809 print('module_item_59', list(p
))
8815 def p_module_item_60(p
):
8816 '''module_item : K_specify error K_endspecify '''
8818 print('module_item_60', list(p
))
8820 # { yyerror(@1, "error: syntax error in specify block");
8826 def p_module_item_61(p
):
8827 '''module_item : error ';' '''
8829 print('module_item_61', list(p
))
8831 # { yyerror(@2, "error: invalid module item.");
8837 def p_module_item_62(p
):
8838 '''module_item : K_assign error '=' expression ';' '''
8840 print('module_item_62', list(p
))
8842 # { yyerror(@1, "error: syntax error in left side "
8843 # "of continuous assignment.");
8849 def p_module_item_63(p
):
8850 '''module_item : K_assign error ';' '''
8852 print('module_item_63', list(p
))
8854 # { yyerror(@1, "error: syntax error in "
8855 # "continuous assignment");
8861 def p_module_item_64(p
):
8862 '''module_item : K_function error K_endfunction endlabel_opt '''
8864 print('module_item_64', list(p
))
8866 # { yyerror(@1, "error: I give up on this "
8867 # "function definition.");
8869 # if (!gn_system_verilog()) {
8870 # yyerror(@4, "error: Function end names require "
8871 # "SystemVerilog.");
8880 def p_module_item_65(p
):
8881 '''module_item : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';' '''
8883 print('module_item_65', list(p
))
8885 # { perm_string tmp3 = lex_strings.make(p[3]);
8886 # perm_string tmp5 = lex_strings.make(p[5]);
8887 # pform_set_attrib(tmp3, tmp5, p[7]);
8894 def p_module_item_66(p
):
8895 '''module_item : KK_attribute '(' error ')' ';' '''
8897 print('module_item_66', list(p
))
8899 # { yyerror(@1, "error: Malformed $attribute parameter list."); }
8903 def p__embed0_module_item(p
):
8904 '''_embed0_module_item : '''
8906 # { attributes_in_context = p[1]; }
8910 def p__embed1_module_item(p
):
8911 '''_embed1_module_item : '''
8913 # { if (pform_in_interface())
8914 # yyerror(@1, "error: Parameter overrides are not allowed "
8915 # "in interfaces.");
8920 def p__embed2_module_item(p
):
8921 '''_embed2_module_item : '''
8923 # { pform_start_generate_for(@1, p[3], p[5], p[7], p[9], p[11]); }
8927 def p__embed3_module_item(p
):
8928 '''_embed3_module_item : '''
8930 # { pform_start_generate_else(@1); }
8934 def p__embed4_module_item(p
):
8935 '''_embed4_module_item : '''
8937 # { pform_start_generate_case(@1, p[3]); }
8941 def p__embed5_module_item(p
):
8942 '''_embed5_module_item : '''
8944 # { if (pform_in_interface())
8945 # yyerror(@1, "error: specparam declarations are not allowed "
8946 # "in interfaces.");
8951 def p__embed6_module_item(p
):
8952 '''_embed6_module_item : '''
8954 # { if (pform_in_interface())
8955 # yyerror(@1, "error: specify blocks are not allowed "
8956 # "in interfaces.");
8961 def p_module_item_list_1(p
):
8962 '''module_item_list : module_item_list module_item '''
8964 print('module_item_list_1', list(p
))
8970 def p_module_item_list_2(p
):
8971 '''module_item_list : module_item '''
8972 if(parse_debug
> 2):
8973 print('module_item_list_2', list(p
))
8979 def p_module_item_list_opt_1(p
):
8980 '''module_item_list_opt : module_item_list '''
8981 if(parse_debug
> 2):
8982 print('module_item_list_opt_1', list(p
))
8988 def p_module_item_list_opt_2(p
):
8989 '''module_item_list_opt : '''
8991 print('module_item_list_opt_2', list(p
))
8997 def p_generate_if_1(p
):
8998 '''generate_if : K_if '(' expression ')' '''
9000 print('generate_if_1', list(p
))
9002 # { pform_start_generate_if(@1, p[3]); }
9006 def p_generate_case_items_1(p
):
9007 '''generate_case_items : generate_case_items generate_case_item '''
9009 print('generate_case_items_1', list(p
))
9015 def p_generate_case_items_2(p
):
9016 '''generate_case_items : generate_case_item '''
9018 print('generate_case_items_2', list(p
))
9024 def p_generate_case_item_1(p
):
9025 '''generate_case_item : expression_list_proper ':' _embed0_generate_case_item generate_block_opt '''
9027 print('generate_case_item_1', list(p
))
9029 # { pform_endgenerate(); }
9033 def p_generate_case_item_2(p
):
9034 '''generate_case_item : K_default ':' _embed1_generate_case_item generate_block_opt '''
9036 print('generate_case_item_2', list(p
))
9038 # { pform_endgenerate(); }
9042 def p__embed0_generate_case_item(p
):
9043 '''_embed0_generate_case_item : '''
9045 # { pform_generate_case_item(@1, p[1]); }
9049 def p__embed1_generate_case_item(p
):
9050 '''_embed1_generate_case_item : '''
9052 # { pform_generate_case_item(@1, 0); }
9056 def p_generate_item_1(p
):
9057 '''generate_item : module_item '''
9059 print('generate_item_1', list(p
))
9065 def p_generate_item_2(p
):
9066 '''generate_item : K_begin generate_item_list_opt K_end '''
9068 print('generate_item_2', list(p
))
9070 # { /* Detect and warn about anachronistic begin/end use */
9071 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
9073 # cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
9079 def p_generate_item_3(p
):
9080 '''generate_item : K_begin ':' IDENTIFIER _embed0_generate_item generate_item_list_opt K_end '''
9082 print('generate_item_3', list(p
))
9084 # { /* Detect and warn about anachronistic named begin/end use */
9085 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
9087 # cerr << @1 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
9089 # pform_endgenerate();
9094 def p__embed0_generate_item(p
):
9095 '''_embed0_generate_item : '''
9098 # pform_start_generate_nblock(@1, p[3]);
9103 def p_generate_item_list_1(p
):
9104 '''generate_item_list : generate_item_list generate_item '''
9106 print('generate_item_list_1', list(p
))
9112 def p_generate_item_list_2(p
):
9113 '''generate_item_list : generate_item '''
9115 print('generate_item_list_2', list(p
))
9121 def p_generate_item_list_opt_1(p
):
9122 '''generate_item_list_opt : generate_item_list '''
9124 print('generate_item_list_opt_1', list(p
))
9130 def p_generate_item_list_opt_2(p
):
9131 '''generate_item_list_opt : '''
9133 print('generate_item_list_opt_2', list(p
))
9139 def p_generate_block_1(p
):
9140 '''generate_block : module_item '''
9142 print('generate_block_1', list(p
))
9148 def p_generate_block_2(p
):
9149 '''generate_block : K_begin generate_item_list_opt K_end '''
9151 print('generate_block_2', list(p
))
9157 def p_generate_block_3(p
):
9158 '''generate_block : K_begin ':' IDENTIFIER generate_item_list_opt K_end endlabel_opt '''
9160 print('generate_block_3', list(p
))
9162 # { pform_generate_block_name(p[3]);
9164 # if (strcmp(p[3],p[6]) != 0) {
9165 # yyerror(@6, "error: End label doesn't match "
9168 # if (! gn_system_verilog()) {
9169 # yyerror(@6, "error: Begin end labels require "
9170 # "SystemVerilog.");
9179 def p_generate_block_opt_1(p
):
9180 '''generate_block_opt : generate_block '''
9182 print('generate_block_opt_1', list(p
))
9188 def p_generate_block_opt_2(p
):
9189 '''generate_block_opt : ';' '''
9191 print('generate_block_opt_2', list(p
))
9197 def p_net_decl_assign_1(p
):
9198 '''net_decl_assign : IDENTIFIER '=' expression '''
9200 print('net_decl_assign_1', list(p
))
9202 # { net_decl_assign_t*tmp = new net_decl_assign_t;
9204 # tmp->name = lex_strings.make(p[1]);
9212 def p_net_decl_assigns_1(p
):
9213 '''net_decl_assigns : net_decl_assigns ',' net_decl_assign '''
9215 print('net_decl_assigns_1', list(p
))
9217 # { net_decl_assign_t*tmp = p[1];
9218 # p[3]->next = tmp->next;
9225 def p_net_decl_assigns_2(p
):
9226 '''net_decl_assigns : net_decl_assign '''
9228 print('net_decl_assigns_2', list(p
))
9235 def p_bit_logic_1(p
):
9236 '''bit_logic : K_logic '''
9238 print('bit_logic_1', list(p
))
9240 # { p[0] = IVL_VT_LOGIC; }
9244 def p_bit_logic_2(p
):
9245 '''bit_logic : K_bool '''
9247 print('bit_logic_2', list(p
))
9249 # { p[0] = IVL_VT_BOOL; /* Icarus misc */}
9253 def p_bit_logic_3(p
):
9254 '''bit_logic : K_bit '''
9256 print('bit_logic_3', list(p
))
9258 # { p[0] = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
9262 def p_bit_logic_opt_1(p
):
9263 '''bit_logic_opt : bit_logic '''
9265 print('bit_logic_opt_1', list(p
))
9271 def p_bit_logic_opt_2(p
):
9272 '''bit_logic_opt : '''
9274 print('bit_logic_opt_2', list(p
))
9276 # { p[0] = IVL_VT_NO_TYPE; }
9280 def p_net_type_1(p
):
9281 '''net_type : K_wire '''
9282 if(parse_debug
> 2):
9283 print('net_type_1', list(p
))
9291 def p_net_type_2(p
):
9292 '''net_type : K_tri '''
9294 print('net_type_2', list(p
))
9296 # { p[0] = NetNet::TRI; }
9300 def p_net_type_3(p
):
9301 '''net_type : K_tri1 '''
9303 print('net_type_3', list(p
))
9305 # { p[0] = NetNet::TRI1; }
9309 def p_net_type_4(p
):
9310 '''net_type : K_supply0 '''
9312 print('net_type_4', list(p
))
9314 # { p[0] = NetNet::SUPPLY0; }
9318 def p_net_type_5(p
):
9319 '''net_type : K_wand '''
9321 print('net_type_5', list(p
))
9323 # { p[0] = NetNet::WAND; }
9327 def p_net_type_6(p
):
9328 '''net_type : K_triand '''
9330 print('net_type_6', list(p
))
9332 # { p[0] = NetNet::TRIAND; }
9336 def p_net_type_7(p
):
9337 '''net_type : K_tri0 '''
9339 print('net_type_7', list(p
))
9341 # { p[0] = NetNet::TRI0; }
9345 def p_net_type_8(p
):
9346 '''net_type : K_supply1 '''
9348 print('net_type_8', list(p
))
9350 # { p[0] = NetNet::SUPPLY1; }
9354 def p_net_type_9(p
):
9355 '''net_type : K_wor '''
9357 print('net_type_9', list(p
))
9359 # { p[0] = NetNet::WOR; }
9363 def p_net_type_10(p
):
9364 '''net_type : K_trior '''
9366 print('net_type_10', list(p
))
9368 # { p[0] = NetNet::TRIOR; }
9372 def p_net_type_11(p
):
9373 '''net_type : K_wone '''
9375 print('net_type_11', list(p
))
9377 # { p[0] = NetNet::UNRESOLVED_WIRE;
9378 # cerr << @1.text << ":" << @1.first_line << ": warning: "
9379 # "'wone' is deprecated, please use 'uwire' "
9380 # "instead." << endl;
9385 def p_net_type_12(p
):
9386 '''net_type : K_uwire '''
9388 print('net_type_12', list(p
))
9390 # { p[0] = NetNet::UNRESOLVED_WIRE; }
9394 def p_param_type_1(p
):
9395 '''param_type : bit_logic_opt unsigned_signed_opt dimensions_opt '''
9397 print('param_type_1', list(p
))
9399 # { param_active_range = p[3];
9400 # param_active_signed = p[2];
9401 # if ((p[1] == IVL_VT_NO_TYPE) && (p[3] != 0))
9402 # param_active_type = IVL_VT_LOGIC;
9404 # param_active_type = p[1];
9409 def p_param_type_2(p
):
9410 '''param_type : K_integer '''
9412 print('param_type_2', list(p
))
9414 # { param_active_range = make_range_from_width(integer_width);
9415 # param_active_signed = true;
9416 # param_active_type = IVL_VT_LOGIC;
9421 def p_param_type_3(p
):
9422 '''param_type : K_time '''
9424 print('param_type_3', list(p
))
9426 # { param_active_range = make_range_from_width(64);
9427 # param_active_signed = false;
9428 # param_active_type = IVL_VT_LOGIC;
9433 def p_param_type_4(p
):
9434 '''param_type : real_or_realtime '''
9436 print('param_type_4', list(p
))
9438 # { param_active_range = 0;
9439 # param_active_signed = true;
9440 # param_active_type = IVL_VT_REAL;
9445 def p_param_type_5(p
):
9446 '''param_type : atom2_type '''
9448 print('param_type_5', list(p
))
9450 # { param_active_range = make_range_from_width(p[1]);
9451 # param_active_signed = true;
9452 # param_active_type = IVL_VT_BOOL;
9457 def p_param_type_6(p
):
9458 '''param_type : TYPE_IDENTIFIER '''
9460 print('param_type_6', list(p
))
9462 # { pform_set_param_from_type(@1, p[1].type, p[1].text, param_active_range,
9463 # param_active_signed, param_active_type);
9464 # delete[]p[1].text;
9469 def p_parameter_assign_list_1(p
):
9470 '''parameter_assign_list : parameter_assign '''
9472 print('parameter_assign_list_1', list(p
))
9478 def p_parameter_assign_list_2(p
):
9479 '''parameter_assign_list : parameter_assign_list ',' parameter_assign '''
9481 print('parameter_assign_list_2', list(p
))
9487 def p_localparam_assign_list_1(p
):
9488 '''localparam_assign_list : localparam_assign '''
9490 print('localparam_assign_list_1', list(p
))
9496 def p_localparam_assign_list_2(p
):
9497 '''localparam_assign_list : localparam_assign_list ',' localparam_assign '''
9499 print('localparam_assign_list_2', list(p
))
9505 def p_parameter_assign_1(p
):
9506 '''parameter_assign : IDENTIFIER '=' expression parameter_value_ranges_opt '''
9508 print('parameter_assign_1', list(p
))
9509 tpname
= Node(syms
.tname
, [Leaf(token
.NAME
, p
[1])])
9510 expr
= Node(syms
.tfpdef
, [tpname
, Leaf(token
.EQUAL
, p
[2]), p
[3]])
9513 # { PExpr*tmp = p[3];
9514 # pform_set_parameter(@1, lex_strings.make(p[1]), param_active_type,
9515 # param_active_signed, param_active_range, tmp, p[4]);
9521 def p_localparam_assign_1(p
):
9522 '''localparam_assign : IDENTIFIER '=' expression '''
9524 print('localparam_assign_1', list(p
))
9526 # { PExpr*tmp = p[3];
9527 # pform_set_localparam(@1, lex_strings.make(p[1]), param_active_type,
9528 # param_active_signed, param_active_range, tmp);
9534 def p_parameter_value_ranges_opt_1(p
):
9535 '''parameter_value_ranges_opt : parameter_value_ranges '''
9537 print('parameter_value_ranges_opt_1', list(p
))
9544 def p_parameter_value_ranges_opt_2(p
):
9545 '''parameter_value_ranges_opt : '''
9547 print('parameter_value_ranges_opt_2', list(p
))
9553 def p_parameter_value_ranges_1(p
):
9554 '''parameter_value_ranges : parameter_value_ranges parameter_value_range '''
9556 print('parameter_value_ranges_1', list(p
))
9558 # { p[0] = p[2]; p[0]->next = p[1]; }
9562 def p_parameter_value_ranges_2(p
):
9563 '''parameter_value_ranges : parameter_value_range '''
9565 print('parameter_value_ranges_2', list(p
))
9567 # { p[0] = p[1]; p[0]->next = 0; }
9571 def p_parameter_value_range_1(p
):
9572 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ']' '''
9574 print('parameter_value_range_1', list(p
))
9576 # { p[0] = pform_parameter_value_range(p[1], false, p[3], false, p[5]); }
9580 def p_parameter_value_range_2(p
):
9581 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ')' '''
9583 print('parameter_value_range_2', list(p
))
9585 # { p[0] = pform_parameter_value_range(p[1], false, p[3], true, p[5]); }
9589 def p_parameter_value_range_3(p
):
9590 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ']' '''
9592 print('parameter_value_range_3', list(p
))
9594 # { p[0] = pform_parameter_value_range(p[1], true, p[3], false, p[5]); }
9598 def p_parameter_value_range_4(p
):
9599 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ')' '''
9601 print('parameter_value_range_4', list(p
))
9603 # { p[0] = pform_parameter_value_range(p[1], true, p[3], true, p[5]); }
9607 def p_parameter_value_range_5(p
):
9608 '''parameter_value_range : K_exclude expression '''
9610 print('parameter_value_range_5', list(p
))
9612 # { p[0] = pform_parameter_value_range(true, false, p[2], false, p[2]); }
9616 def p_value_range_expression_1(p
):
9617 '''value_range_expression : expression '''
9619 print('value_range_expression_1', list(p
))
9626 def p_value_range_expression_2(p
):
9627 '''value_range_expression : K_inf '''
9629 print('value_range_expression_2', list(p
))
9635 def p_value_range_expression_3(p
):
9636 '''value_range_expression : '+' K_inf '''
9638 print('value_range_expression_3', list(p
))
9644 def p_value_range_expression_4(p
):
9645 '''value_range_expression : '-' K_inf '''
9647 print('value_range_expression_4', list(p
))
9653 def p_from_exclude_1(p
):
9654 '''from_exclude : K_from '''
9656 print('from_exclude_1', list(p
))
9663 def p_from_exclude_2(p
):
9664 '''from_exclude : K_exclude '''
9666 print('from_exclude_2', list(p
))
9673 def p_parameter_value_opt_1(p
):
9674 '''parameter_value_opt : '#' '(' expression_list_with_nuls ')' '''
9676 print('parameter_value_opt_1', list(p
))
9678 # { struct parmvalue_t*tmp = new struct parmvalue_t;
9679 # tmp->by_order = p[3];
9686 def p_parameter_value_opt_2(p
):
9687 '''parameter_value_opt : '#' '(' parameter_value_byname_list ')' '''
9689 print('parameter_value_opt_2', list(p
))
9691 # { struct parmvalue_t*tmp = new struct parmvalue_t;
9692 # tmp->by_order = 0;
9693 # tmp->by_name = p[3];
9699 def p_parameter_value_opt_3(p
):
9700 '''parameter_value_opt : '#' DEC_NUMBER '''
9702 print('parameter_value_opt_3', list(p
))
9705 # PENumber*tmp = new PENumber(p[2]);
9706 # FILE_NAME(tmp, @1);
9708 # struct parmvalue_t*lst = new struct parmvalue_t;
9709 # lst->by_order = new list<PExpr*>;
9710 # lst->by_order->push_back(tmp);
9718 def p_parameter_value_opt_4(p
):
9719 '''parameter_value_opt : '#' REALTIME '''
9721 print('parameter_value_opt_4', list(p
))
9724 # PEFNumber*tmp = new PEFNumber(p[2]);
9725 # FILE_NAME(tmp, @1);
9727 # struct parmvalue_t*lst = new struct parmvalue_t;
9728 # lst->by_order = new list<PExpr*>;
9729 # lst->by_order->push_back(tmp);
9736 def p_parameter_value_opt_5(p
):
9737 '''parameter_value_opt : '#' error '''
9739 print('parameter_value_opt_5', list(p
))
9741 # { yyerror(@1, "error: syntax error in parameter value "
9742 # "assignment list.");
9748 def p_parameter_value_opt_6(p
):
9749 '''parameter_value_opt : '''
9751 print('parameter_value_opt_6', list(p
))
9757 def p_parameter_value_byname_1(p
):
9758 '''parameter_value_byname : '.' IDENTIFIER '(' expression ')' '''
9760 print('parameter_value_byname_1', 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_2(p
):
9772 '''parameter_value_byname : '.' IDENTIFIER '(' ')' '''
9774 print('parameter_value_byname_2', list(p
))
9776 # { named_pexpr_t*tmp = new named_pexpr_t;
9777 # tmp->name = lex_strings.make(p[2]);
9785 def p_parameter_value_byname_list_1(p
):
9786 '''parameter_value_byname_list : parameter_value_byname '''
9788 print('parameter_value_byname_list_1', list(p
))
9790 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
9791 # tmp->push_back(*p[1]);
9798 def p_parameter_value_byname_list_2(p
):
9799 '''parameter_value_byname_list : parameter_value_byname_list ',' parameter_value_byname '''
9801 print('parameter_value_byname_list_2', list(p
))
9803 # { list<named_pexpr_t>*tmp = p[1];
9804 # tmp->push_back(*p[3]);
9812 '''port : port_reference '''
9814 print('port_1', list(p
))
9822 '''port : '.' IDENTIFIER '(' port_reference ')' '''
9824 print('port_2', list(p
))
9826 # { Module::port_t*tmp = p[4];
9827 # tmp->name = lex_strings.make(p[2]);
9835 '''port : '{' port_reference_list '}' '''
9837 print('port_3', list(p
))
9839 # { Module::port_t*tmp = p[2];
9840 # tmp->name = perm_string();
9847 '''port : '.' IDENTIFIER '(' '{' port_reference_list '}' ')' '''
9849 print('port_4', list(p
))
9851 # { Module::port_t*tmp = p[5];
9852 # tmp->name = lex_strings.make(p[2]);
9859 def p_port_opt_1(p
):
9860 '''port_opt : port '''
9862 print('port_opt_1', list(p
))
9869 def p_port_opt_2(p
):
9872 print('port_opt_2', list(p
))
9878 def p_port_name_1(p
):
9879 '''port_name : '.' IDENTIFIER '(' expression ')' '''
9881 print('port_name_1', list(p
))
9883 # { named_pexpr_t*tmp = new named_pexpr_t;
9884 # tmp->name = lex_strings.make(p[2]);
9892 def p_port_name_2(p
):
9893 '''port_name : '.' IDENTIFIER '(' error ')' '''
9895 print('port_name_2', list(p
))
9897 # { yyerror(@3, "error: invalid port connection expression.");
9898 # named_pexpr_t*tmp = new named_pexpr_t;
9899 # tmp->name = lex_strings.make(p[2]);
9907 def p_port_name_3(p
):
9908 '''port_name : '.' IDENTIFIER '(' ')' '''
9910 print('port_name_3', list(p
))
9912 # { named_pexpr_t*tmp = new named_pexpr_t;
9913 # tmp->name = lex_strings.make(p[2]);
9921 def p_port_name_4(p
):
9922 '''port_name : '.' IDENTIFIER '''
9924 print('port_name_4', list(p
))
9926 # { named_pexpr_t*tmp = new named_pexpr_t;
9927 # tmp->name = lex_strings.make(p[2]);
9928 # tmp->parm = new PEIdent(lex_strings.make(p[2]), true);
9929 # FILE_NAME(tmp->parm, @1);
9936 def p_port_name_5(p
):
9937 '''port_name : K_DOTSTAR '''
9939 print('port_name_5', list(p
))
9941 # { named_pexpr_t*tmp = new named_pexpr_t;
9942 # tmp->name = lex_strings.make("*");
9949 def p_port_name_list_1(p
):
9950 '''port_name_list : port_name_list ',' port_name '''
9952 print('port_name_list_1', list(p
))
9954 # { list<named_pexpr_t>*tmp = p[1];
9955 # tmp->push_back(*p[3]);
9962 def p_port_name_list_2(p
):
9963 '''port_name_list : port_name '''
9965 print('port_name_list_2', list(p
))
9967 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
9968 # tmp->push_back(*p[1]);
9975 def p_port_reference_1(p
):
9976 '''port_reference : IDENTIFIER '''
9978 print('port_reference_1', list(p
))
9980 # { Module::port_t*ptmp;
9981 # perm_string name = lex_strings.make(p[1]);
9982 # ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
9989 def p_port_reference_2(p
):
9990 '''port_reference : IDENTIFIER '[' expression ':' expression ']' '''
9992 print('port_reference_2', list(p
))
9994 # { index_component_t itmp;
9995 # itmp.sel = index_component_t::SEL_PART;
9999 # name_component_t ntmp (lex_strings.make(p[1]));
10000 # ntmp.index.push_back(itmp);
10002 # pform_name_t pname;
10003 # pname.push_back(ntmp);
10005 # PEIdent*wtmp = new PEIdent(pname);
10006 # FILE_NAME(wtmp, @1);
10008 # Module::port_t*ptmp = new Module::port_t;
10009 # ptmp->name = perm_string();
10010 # ptmp->expr.push_back(wtmp);
10018 def p_port_reference_3(p
):
10019 '''port_reference : IDENTIFIER '[' expression ']' '''
10021 print('port_reference_3', list(p
))
10023 # { index_component_t itmp;
10024 # itmp.sel = index_component_t::SEL_BIT;
10028 # name_component_t ntmp (lex_strings.make(p[1]));
10029 # ntmp.index.push_back(itmp);
10031 # pform_name_t pname;
10032 # pname.push_back(ntmp);
10034 # PEIdent*tmp = new PEIdent(pname);
10035 # FILE_NAME(tmp, @1);
10037 # Module::port_t*ptmp = new Module::port_t;
10038 # ptmp->name = perm_string();
10039 # ptmp->expr.push_back(tmp);
10046 def p_port_reference_4(p
):
10047 '''port_reference : IDENTIFIER '[' error ']' '''
10049 print('port_reference_4', list(p
))
10051 # { yyerror(@1, "error: invalid port bit select");
10052 # Module::port_t*ptmp = new Module::port_t;
10053 # PEIdent*wtmp = new PEIdent(lex_strings.make(p[1]));
10054 # FILE_NAME(wtmp, @1);
10055 # ptmp->name = lex_strings.make(p[1]);
10056 # ptmp->expr.push_back(wtmp);
10063 def p_port_reference_list_1(p
):
10064 '''port_reference_list : port_reference '''
10066 print('port_reference_list_1', list(p
))
10073 def p_port_reference_list_2(p
):
10074 '''port_reference_list : port_reference_list ',' port_reference '''
10076 print('port_reference_list_2', list(p
))
10078 # { Module::port_t*tmp = p[1];
10079 # append(tmp->expr, p[3]->expr);
10086 def p_dimensions_opt_1(p
):
10087 '''dimensions_opt : '''
10088 if(parse_debug
> 2):
10089 print('dimensions_opt_1', list(p
))
10095 def p_dimensions_opt_2(p
):
10096 '''dimensions_opt : dimensions '''
10098 print('dimensions_opt_2', list(p
))
10105 def p_dimensions_1(p
):
10106 '''dimensions : variable_dimension '''
10108 print('dimensions_1', list(p
))
10115 def p_dimensions_2(p
):
10116 '''dimensions : dimensions variable_dimension '''
10118 print('dimensions_2', list(p
))
10120 # { list<pform_range_t> *tmp = p[1];
10122 # tmp->splice(tmp->end(), *p[2]);
10130 def p_register_variable_1(p
):
10131 '''register_variable : IDENTIFIER dimensions_opt '''
10133 print('register_variable_1', list(p
))
10135 # { perm_string name = lex_strings.make(p[1]);
10136 # pform_makewire(@1, name, NetNet::REG,
10137 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10138 # pform_set_reg_idx(name, p[2]);
10144 def p_register_variable_2(p
):
10145 '''register_variable : IDENTIFIER dimensions_opt '=' expression '''
10147 print('register_variable_2', list(p
))
10149 # { if (pform_peek_scope()->var_init_needs_explicit_lifetime()
10150 # && (var_lifetime == LexicalScope::INHERITED)) {
10151 # cerr << @3 << ": warning: Static variable initialization requires "
10152 # "explicit lifetime in this context." << endl;
10155 # perm_string name = lex_strings.make(p[1]);
10156 # pform_makewire(@1, name, NetNet::REG,
10157 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10158 # pform_set_reg_idx(name, p[2]);
10159 # pform_make_var_init(@1, name, p[4]);
10165 def p_register_variable_list_1(p
):
10166 '''register_variable_list : register_variable '''
10168 print('register_variable_list_1', list(p
))
10170 # { list<perm_string>*tmp = new list<perm_string>;
10171 # tmp->push_back(lex_strings.make(p[1]));
10178 def p_register_variable_list_2(p
):
10179 '''register_variable_list : register_variable_list ',' register_variable '''
10181 print('register_variable_list_2', list(p
))
10183 # { list<perm_string>*tmp = p[1];
10184 # tmp->push_back(lex_strings.make(p[3]));
10191 def p_net_variable_1(p
):
10192 '''net_variable : IDENTIFIER dimensions_opt '''
10193 if(parse_debug
> 2):
10194 print('net_variable_1', list(p
))
10196 #p[0]= ('net_variable_1', list(p))
10198 # { perm_string name = lex_strings.make(p[1]);
10199 # pform_makewire(@1, name, NetNet::IMPLICIT,
10200 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10201 # pform_set_reg_idx(name, p[2]);
10202 p
[0] = [p
[1], p
[2]]
10209 def p_net_variable_list_1(p
):
10210 '''net_variable_list : net_variable '''
10211 if(parse_debug
> 2):
10212 print('net_variable_list_1', list(p
))
10215 # { list<perm_string>*tmp = new list<perm_string>;
10216 # tmp->push_back(lex_strings.make(p[1]));
10223 def p_net_variable_list_2(p
):
10224 '''net_variable_list : net_variable_list ',' net_variable '''
10225 if(parse_debug
> 2):
10226 print('net_variable_list_2', list(p
))
10229 # { list<perm_string>*tmp = p[1];
10230 # tmp->push_back(lex_strings.make(p[3]));
10237 def p_event_variable_1(p
):
10238 '''event_variable : IDENTIFIER dimensions_opt '''
10240 print('event_variable_1', list(p
))
10243 # yyerror(@2, "sorry: event arrays are not supported.");
10251 def p_event_variable_list_1(p
):
10252 '''event_variable_list : event_variable '''
10254 print('event_variable_list_1', list(p
))
10256 # { p[0] = list_from_identifier(p[1]); }
10260 def p_event_variable_list_2(p
):
10261 '''event_variable_list : event_variable_list ',' event_variable '''
10263 print('event_variable_list_2', list(p
))
10265 # { p[0] = list_from_identifier(p[1], p[3]); }
10269 def p_specify_item_1(p
):
10270 '''specify_item : K_specparam specparam_decl ';' '''
10272 print('specify_item_1', list(p
))
10278 def p_specify_item_2(p
):
10279 '''specify_item : specify_simple_path_decl ';' '''
10281 print('specify_item_2', list(p
))
10283 # { pform_module_specify_path(p[1]);
10288 def p_specify_item_3(p
):
10289 '''specify_item : specify_edge_path_decl ';' '''
10291 print('specify_item_3', list(p
))
10293 # { pform_module_specify_path(p[1]);
10298 def p_specify_item_4(p
):
10299 '''specify_item : K_if '(' expression ')' specify_simple_path_decl ';' '''
10301 print('specify_item_4', list(p
))
10303 # { PSpecPath*tmp = p[5];
10305 # tmp->conditional = true;
10306 # tmp->condition = p[3];
10308 # pform_module_specify_path(tmp);
10313 def p_specify_item_5(p
):
10314 '''specify_item : K_if '(' expression ')' specify_edge_path_decl ';' '''
10316 print('specify_item_5', list(p
))
10318 # { PSpecPath*tmp = p[5];
10320 # tmp->conditional = true;
10321 # tmp->condition = p[3];
10323 # pform_module_specify_path(tmp);
10328 def p_specify_item_6(p
):
10329 '''specify_item : K_ifnone specify_simple_path_decl ';' '''
10331 print('specify_item_6', list(p
))
10333 # { PSpecPath*tmp = p[2];
10335 # tmp->conditional = true;
10336 # tmp->condition = 0;
10338 # pform_module_specify_path(tmp);
10343 def p_specify_item_7(p
):
10344 '''specify_item : K_ifnone specify_edge_path_decl ';' '''
10346 print('specify_item_7', list(p
))
10348 # { yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
10349 # "not supported.");
10355 def p_specify_item_8(p
):
10356 '''specify_item : K_Sfullskew '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10358 print('specify_item_8', list(p
))
10366 def p_specify_item_9(p
):
10367 '''specify_item : K_Shold '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10369 print('specify_item_9', list(p
))
10376 def p_specify_item_10(p
):
10377 '''specify_item : K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10379 print('specify_item_10', list(p
))
10387 def p_specify_item_11(p
):
10388 '''specify_item : K_Speriod '(' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10390 print('specify_item_11', list(p
))
10397 def p_specify_item_12(p
):
10398 '''specify_item : K_Srecovery '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10400 print('specify_item_12', list(p
))
10407 def p_specify_item_13(p
):
10408 '''specify_item : K_Srecrem '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10410 print('specify_item_13', list(p
))
10418 def p_specify_item_14(p
):
10419 '''specify_item : K_Sremoval '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10421 print('specify_item_14', list(p
))
10428 def p_specify_item_15(p
):
10429 '''specify_item : K_Ssetup '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10431 print('specify_item_15', list(p
))
10438 def p_specify_item_16(p
):
10439 '''specify_item : K_Ssetuphold '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10441 print('specify_item_16', list(p
))
10449 def p_specify_item_17(p
):
10450 '''specify_item : K_Sskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10452 print('specify_item_17', list(p
))
10459 def p_specify_item_18(p
):
10460 '''specify_item : K_Stimeskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10462 print('specify_item_18', list(p
))
10469 def p_specify_item_19(p
):
10470 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ',' expression spec_notifier_opt ')' ';' '''
10472 print('specify_item_19', list(p
))
10480 def p_specify_item_20(p
):
10481 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ')' ';' '''
10483 print('specify_item_20', list(p
))
10490 def p_specify_item_21(p
):
10491 '''specify_item : K_pulsestyle_onevent specify_path_identifiers ';' '''
10493 print('specify_item_21', list(p
))
10500 def p_specify_item_22(p
):
10501 '''specify_item : K_pulsestyle_ondetect specify_path_identifiers ';' '''
10503 print('specify_item_22', list(p
))
10510 def p_specify_item_23(p
):
10511 '''specify_item : K_showcancelled specify_path_identifiers ';' '''
10513 print('specify_item_23', list(p
))
10520 def p_specify_item_24(p
):
10521 '''specify_item : K_noshowcancelled specify_path_identifiers ';' '''
10523 print('specify_item_24', list(p
))
10530 def p_specify_item_list_1(p
):
10531 '''specify_item_list : specify_item '''
10533 print('specify_item_list_1', list(p
))
10539 def p_specify_item_list_2(p
):
10540 '''specify_item_list : specify_item_list specify_item '''
10542 print('specify_item_list_2', list(p
))
10548 def p_specify_item_list_opt_1(p
):
10549 '''specify_item_list_opt : '''
10551 print('specify_item_list_opt_1', list(p
))
10557 def p_specify_item_list_opt_2(p
):
10558 '''specify_item_list_opt : specify_item_list '''
10560 print('specify_item_list_opt_2', list(p
))
10566 def p_specify_edge_path_decl_1(p
):
10567 '''specify_edge_path_decl : specify_edge_path '=' '(' delay_value_list ')' '''
10569 print('specify_edge_path_decl_1', list(p
))
10571 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
10575 def p_specify_edge_path_decl_2(p
):
10576 '''specify_edge_path_decl : specify_edge_path '=' delay_value_simple '''
10578 print('specify_edge_path_decl_2', list(p
))
10580 # { list<PExpr*>*tmp = new list<PExpr*>;
10581 # tmp->push_back(p[3]);
10582 # p[0] = pform_assign_path_delay(p[1], tmp);
10587 def p_edge_operator_1(p
):
10588 '''edge_operator : K_posedge '''
10590 print('edge_operator_1', list(p
))
10597 def p_edge_operator_2(p
):
10598 '''edge_operator : K_negedge '''
10600 print('edge_operator_2', list(p
))
10607 def p_specify_edge_path_1(p
):
10608 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10610 print('specify_edge_path_1', list(p
))
10612 # { int edge_flag = 0;
10613 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], false, p[6], p[8]); }
10617 def p_specify_edge_path_2(p
):
10618 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10620 print('specify_edge_path_2', list(p
))
10622 # { int edge_flag = p[2]? 1 : -1;
10623 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], false, p[7], p[9]);}
10627 def p_specify_edge_path_3(p
):
10628 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10630 print('specify_edge_path_3', list(p
))
10632 # { int edge_flag = 0;
10633 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], true, p[6], p[8]); }
10637 def p_specify_edge_path_4(p
):
10638 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10640 print('specify_edge_path_4', list(p
))
10642 # { int edge_flag = p[2]? 1 : -1;
10643 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], true, p[7], p[9]); }
10647 def p_polarity_operator_1(p
):
10648 '''polarity_operator : K_PO_POS '''
10650 print('polarity_operator_1', list(p
))
10656 def p_polarity_operator_2(p
):
10657 '''polarity_operator : K_PO_NEG '''
10659 print('polarity_operator_2', list(p
))
10665 def p_polarity_operator_3(p
):
10666 '''polarity_operator : ':' '''
10668 print('polarity_operator_3', list(p
))
10674 def p_specify_simple_path_decl_1(p
):
10675 '''specify_simple_path_decl : specify_simple_path '=' '(' delay_value_list ')' '''
10677 print('specify_simple_path_decl_1', list(p
))
10679 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
10683 def p_specify_simple_path_decl_2(p
):
10684 '''specify_simple_path_decl : specify_simple_path '=' delay_value_simple '''
10686 print('specify_simple_path_decl_2', list(p
))
10688 # { list<PExpr*>*tmp = new list<PExpr*>;
10689 # tmp->push_back(p[3]);
10690 # p[0] = pform_assign_path_delay(p[1], tmp);
10695 def p_specify_simple_path_decl_3(p
):
10696 '''specify_simple_path_decl : specify_simple_path '=' '(' error ')' '''
10698 print('specify_simple_path_decl_3', list(p
))
10700 # { yyerror(@3, "Syntax error in delay value list.");
10707 def p_specify_simple_path_1(p
):
10708 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' '''
10710 print('specify_simple_path_1', list(p
))
10712 # { p[0] = pform_make_specify_path(@1, p[2], p[3], false, p[5]); }
10716 def p_specify_simple_path_2(p
):
10717 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' '''
10719 print('specify_simple_path_2', list(p
))
10721 # { p[0] = pform_make_specify_path(@1, p[2], p[3], true, p[5]); }
10725 def p_specify_simple_path_3(p
):
10726 '''specify_simple_path : '(' error ')' '''
10728 print('specify_simple_path_3', list(p
))
10730 # { yyerror(@1, "Invalid simple path");
10736 def p_specify_path_identifiers_1(p
):
10737 '''specify_path_identifiers : IDENTIFIER '''
10739 print('specify_path_identifiers_1', list(p
))
10741 # { list<perm_string>*tmp = new list<perm_string>;
10742 # tmp->push_back(lex_strings.make(p[1]));
10749 def p_specify_path_identifiers_2(p
):
10750 '''specify_path_identifiers : IDENTIFIER '[' expr_primary ']' '''
10752 print('specify_path_identifiers_2', list(p
))
10754 # { if (gn_specify_blocks_flag) {
10755 # yywarn(@4, "Bit selects are not currently supported "
10756 # "in path declarations. The declaration "
10757 # "will be applied to the whole vector.");
10759 # list<perm_string>*tmp = new list<perm_string>;
10760 # tmp->push_back(lex_strings.make(p[1]));
10767 def p_specify_path_identifiers_3(p
):
10768 '''specify_path_identifiers : IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
10770 print('specify_path_identifiers_3', list(p
))
10772 # { if (gn_specify_blocks_flag) {
10773 # yywarn(@4, "Part selects are not currently supported "
10774 # "in path declarations. The declaration "
10775 # "will be applied to the whole vector.");
10777 # list<perm_string>*tmp = new list<perm_string>;
10778 # tmp->push_back(lex_strings.make(p[1]));
10785 def p_specify_path_identifiers_4(p
):
10786 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '''
10788 print('specify_path_identifiers_4', list(p
))
10790 # { list<perm_string>*tmp = p[1];
10791 # tmp->push_back(lex_strings.make(p[3]));
10798 def p_specify_path_identifiers_5(p
):
10799 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' '''
10801 print('specify_path_identifiers_5', list(p
))
10803 # { if (gn_specify_blocks_flag) {
10804 # yywarn(@4, "Bit selects are not currently supported "
10805 # "in path declarations. The declaration "
10806 # "will be applied to the whole vector.");
10808 # list<perm_string>*tmp = p[1];
10809 # tmp->push_back(lex_strings.make(p[3]));
10816 def p_specify_path_identifiers_6(p
):
10817 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
10819 print('specify_path_identifiers_6', list(p
))
10821 # { if (gn_specify_blocks_flag) {
10822 # yywarn(@4, "Part selects are not currently supported "
10823 # "in path declarations. The declaration "
10824 # "will be applied to the whole vector.");
10826 # list<perm_string>*tmp = p[1];
10827 # tmp->push_back(lex_strings.make(p[3]));
10834 def p_specparam_1(p
):
10835 '''specparam : IDENTIFIER '=' expression '''
10837 print('specparam_1', list(p
))
10839 # { PExpr*tmp = p[3];
10840 # pform_set_specparam(@1, lex_strings.make(p[1]),
10841 # param_active_range, tmp);
10847 def p_specparam_2(p
):
10848 '''specparam : IDENTIFIER '=' expression ':' expression ':' expression '''
10850 print('specparam_2', list(p
))
10853 # switch (min_typ_max_flag) {
10870 # if (min_typ_max_warn > 0) {
10871 # cerr << tmp->get_fileline() << ": warning: choosing ";
10872 # switch (min_typ_max_flag) {
10883 # cerr << " expression." << endl;
10884 # min_typ_max_warn -= 1;
10886 # pform_set_specparam(@1, lex_strings.make(p[1]),
10887 # param_active_range, tmp);
10893 def p_specparam_3(p
):
10894 '''specparam : PATHPULSE_IDENTIFIER '=' expression '''
10896 print('specparam_3', list(p
))
10904 def p_specparam_4(p
):
10905 '''specparam : PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' '''
10907 print('specparam_4', list(p
))
10916 def p_specparam_list_1(p
):
10917 '''specparam_list : specparam '''
10919 print('specparam_list_1', list(p
))
10925 def p_specparam_list_2(p
):
10926 '''specparam_list : specparam_list ',' specparam '''
10928 print('specparam_list_2', list(p
))
10934 def p_specparam_decl_1(p
):
10935 '''specparam_decl : specparam_list '''
10937 print('specparam_decl_1', list(p
))
10943 def p_specparam_decl_2(p
):
10944 '''specparam_decl : dimensions _embed0_specparam_decl specparam_list '''
10946 print('specparam_decl_2', list(p
))
10948 # { param_active_range = 0; }
10952 def p__embed0_specparam_decl(p
):
10953 '''_embed0_specparam_decl : '''
10955 # { param_active_range = p[1]; }
10959 def p_spec_polarity_1(p
):
10960 '''spec_polarity : '+' '''
10962 print('spec_polarity_1', list(p
))
10968 def p_spec_polarity_2(p
):
10969 '''spec_polarity : '-' '''
10971 print('spec_polarity_2', list(p
))
10977 def p_spec_polarity_3(p
):
10978 '''spec_polarity : '''
10980 print('spec_polarity_3', list(p
))
10986 def p_spec_reference_event_1(p
):
10987 '''spec_reference_event : K_posedge expression '''
10989 print('spec_reference_event_1', list(p
))
10995 def p_spec_reference_event_2(p
):
10996 '''spec_reference_event : K_negedge expression '''
10998 print('spec_reference_event_2', list(p
))
11004 def p_spec_reference_event_3(p
):
11005 '''spec_reference_event : K_posedge expr_primary K_TAND expression '''
11007 print('spec_reference_event_3', list(p
))
11015 def p_spec_reference_event_4(p
):
11016 '''spec_reference_event : K_negedge expr_primary K_TAND expression '''
11018 print('spec_reference_event_4', list(p
))
11026 def p_spec_reference_event_5(p
):
11027 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary '''
11029 print('spec_reference_event_5', list(p
))
11035 def p_spec_reference_event_6(p
):
11036 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression '''
11038 print('spec_reference_event_6', list(p
))
11046 def p_spec_reference_event_7(p
):
11047 '''spec_reference_event : expr_primary K_TAND expression '''
11049 print('spec_reference_event_7', list(p
))
11057 def p_spec_reference_event_8(p
):
11058 '''spec_reference_event : expr_primary '''
11060 print('spec_reference_event_8', list(p
))
11066 def p_edge_descriptor_list_1(p
):
11067 '''edge_descriptor_list : edge_descriptor_list ',' K_edge_descriptor '''
11069 print('edge_descriptor_list_1', list(p
))
11075 def p_edge_descriptor_list_2(p
):
11076 '''edge_descriptor_list : K_edge_descriptor '''
11078 print('edge_descriptor_list_2', list(p
))
11084 def p_spec_notifier_opt_1(p
):
11085 '''spec_notifier_opt : '''
11087 print('spec_notifier_opt_1', list(p
))
11093 def p_spec_notifier_opt_2(p
):
11094 '''spec_notifier_opt : spec_notifier '''
11096 print('spec_notifier_opt_2', list(p
))
11102 def p_spec_notifier_1(p
):
11103 '''spec_notifier : ',' '''
11105 print('spec_notifier_1', list(p
))
11107 # { args_after_notifier = 0; }
11111 def p_spec_notifier_2(p
):
11112 '''spec_notifier : ',' hierarchy_identifier '''
11114 print('spec_notifier_2', list(p
))
11116 # { args_after_notifier = 0; delete p[2]; }
11120 def p_spec_notifier_3(p
):
11121 '''spec_notifier : spec_notifier ',' '''
11123 print('spec_notifier_3', list(p
))
11125 # { args_after_notifier += 1; }
11129 def p_spec_notifier_4(p
):
11130 '''spec_notifier : spec_notifier ',' hierarchy_identifier '''
11132 print('spec_notifier_4', list(p
))
11134 # { args_after_notifier += 1;
11135 # if (args_after_notifier >= 3) {
11136 # cerr << @3 << ": warning: timing checks are not supported "
11137 # "and delayed signal \"" << *p[3]
11138 # << "\" will not be driven." << endl;
11144 def p_spec_notifier_5(p
):
11145 '''spec_notifier : IDENTIFIER '''
11147 print('spec_notifier_5', list(p
))
11149 # { args_after_notifier = 0; delete[]p[1]; }
11153 def p_statement_item_1(p
):
11154 '''statement_item : K_assign lpvalue '=' expression ';' '''
11156 print('statement_item_1', list(p
))
11158 # { PCAssign*tmp = new PCAssign(p[2], p[4]);
11159 # FILE_NAME(tmp, @1);
11165 def p_statement_item_2(p
):
11166 '''statement_item : K_deassign lpvalue ';' '''
11168 print('statement_item_2', list(p
))
11170 # { PDeassign*tmp = new PDeassign(p[2]);
11171 # FILE_NAME(tmp, @1);
11177 def p_statement_item_3(p
):
11178 '''statement_item : K_force lpvalue '=' expression ';' '''
11180 print('statement_item_3', list(p
))
11182 # { PForce*tmp = new PForce(p[2], p[4]);
11183 # FILE_NAME(tmp, @1);
11189 def p_statement_item_4(p
):
11190 '''statement_item : K_release lpvalue ';' '''
11192 print('statement_item_4', list(p
))
11194 # { PRelease*tmp = new PRelease(p[2]);
11195 # FILE_NAME(tmp, @1);
11201 def p_statement_item_5(p
):
11202 '''statement_item : K_begin K_end '''
11204 print('statement_item_5', list(p
))
11206 # { PBlock*tmp = new PBlock(PBlock::BL_SEQ);
11207 # FILE_NAME(tmp, @1);
11213 def p_statement_item_6(p
):
11214 '''statement_item : K_begin _embed0_statement_item block_item_decls_opt _embed1_statement_item statement_or_null_list K_end '''
11216 print('statement_item_6', list(p
))
11220 throw(Exception("assert(! current_block_stack.empty());"))
11228 # pform_pop_scope();
11229 # assert(! current_block_stack.empty());
11230 # tmp = current_block_stack.top();
11231 # current_block_stack.pop();
11233 # tmp = new PBlock(PBlock::BL_SEQ);
11234 # FILE_NAME(tmp, @1);
11236 # if (p[5]) tmp->set_statement(*p[5]);
11243 def p_statement_item_7(p
):
11244 '''statement_item : K_begin ':' IDENTIFIER _embed2_statement_item block_item_decls_opt statement_or_null_list_opt K_end endlabel_opt '''
11246 print('statement_item_7', list(p
))
11250 # { pform_pop_scope();
11251 # assert(! current_block_stack.empty());
11252 # PBlock*tmp = current_block_stack.top();
11253 # current_block_stack.pop();
11254 # if (p[6]) tmp->set_statement(*p[6]);
11257 # if (strcmp(p[3],p[8]) != 0) {
11258 # yyerror(@8, "error: End label doesn't match begin name");
11260 # if (! gn_system_verilog()) {
11261 # yyerror(@8, "error: Begin end labels require "
11262 # "SystemVerilog.");
11272 def p_statement_item_8(p
):
11273 '''statement_item : K_fork join_keyword '''
11275 print('statement_item_8', list(p
))
11277 # { PBlock*tmp = new PBlock(p[2]);
11278 # FILE_NAME(tmp, @1);
11284 def p_statement_item_9(p
):
11285 '''statement_item : K_fork _embed3_statement_item block_item_decls_opt _embed4_statement_item statement_or_null_list join_keyword '''
11287 print('statement_item_9', list(p
))
11291 # pform_pop_scope();
11292 # assert(! current_block_stack.empty());
11293 # tmp = current_block_stack.top();
11294 # current_block_stack.pop();
11295 # tmp->set_join_type(p[6]);
11297 # tmp = new PBlock(p[6]);
11298 # FILE_NAME(tmp, @1);
11300 # if (p[5]) tmp->set_statement(*p[5]);
11307 def p_statement_item_10(p
):
11308 '''statement_item : K_fork ':' IDENTIFIER _embed5_statement_item block_item_decls_opt statement_or_null_list_opt join_keyword endlabel_opt '''
11310 print('statement_item_10', list(p
))
11312 # { pform_pop_scope();
11313 # assert(! current_block_stack.empty());
11314 # PBlock*tmp = current_block_stack.top();
11315 # current_block_stack.pop();
11316 # tmp->set_join_type(p[7]);
11317 # if (p[6]) tmp->set_statement(*p[6]);
11320 # if (strcmp(p[3],p[8]) != 0) {
11321 # yyerror(@8, "error: End label doesn't match fork name");
11323 # if (! gn_system_verilog()) {
11324 # yyerror(@8, "error: Fork end labels require "
11325 # "SystemVerilog.");
11335 def p_statement_item_11(p
):
11336 '''statement_item : K_disable hierarchy_identifier ';' '''
11338 print('statement_item_11', list(p
))
11340 # { PDisable*tmp = new PDisable(*p[2]);
11341 # FILE_NAME(tmp, @1);
11348 def p_statement_item_12(p
):
11349 '''statement_item : K_disable K_fork ';' '''
11351 print('statement_item_12', list(p
))
11353 # { pform_name_t tmp_name;
11354 # PDisable*tmp = new PDisable(tmp_name);
11355 # FILE_NAME(tmp, @1);
11361 def p_statement_item_13(p
):
11362 '''statement_item : K_TRIGGER hierarchy_identifier ';' '''
11364 print('statement_item_13', list(p
))
11366 # { PTrigger*tmp = new PTrigger(*p[2]);
11367 # FILE_NAME(tmp, @1);
11374 def p_statement_item_14(p
):
11375 '''statement_item : procedural_assertion_statement '''
11377 print('statement_item_14', list(p
))
11384 def p_statement_item_15(p
):
11385 '''statement_item : loop_statement '''
11387 print('statement_item_15', list(p
))
11394 def p_statement_item_16(p
):
11395 '''statement_item : jump_statement '''
11397 print('statement_item_16', list(p
))
11404 def p_statement_item_17(p
):
11405 '''statement_item : K_case '(' expression ')' case_items K_endcase '''
11407 print('statement_item_17', list(p
))
11409 # { PCase*tmp = new PCase(NetCase::EQ, p[3], p[5]);
11410 # FILE_NAME(tmp, @1);
11416 def p_statement_item_18(p
):
11417 '''statement_item : K_casex '(' expression ')' case_items K_endcase '''
11419 print('statement_item_18', list(p
))
11421 # { PCase*tmp = new PCase(NetCase::EQX, p[3], p[5]);
11422 # FILE_NAME(tmp, @1);
11428 def p_statement_item_19(p
):
11429 '''statement_item : K_casez '(' expression ')' case_items K_endcase '''
11431 print('statement_item_19', list(p
))
11433 # { PCase*tmp = new PCase(NetCase::EQZ, p[3], p[5]);
11434 # FILE_NAME(tmp, @1);
11440 def p_statement_item_20(p
):
11441 '''statement_item : K_case '(' expression ')' error K_endcase '''
11443 print('statement_item_20', list(p
))
11449 def p_statement_item_21(p
):
11450 '''statement_item : K_casex '(' expression ')' error K_endcase '''
11452 print('statement_item_21', list(p
))
11458 def p_statement_item_22(p
):
11459 '''statement_item : K_casez '(' expression ')' error K_endcase '''
11461 print('statement_item_22', list(p
))
11467 def p_statement_item_23(p
):
11468 '''statement_item : K_if '(' expression ')' statement_or_null %prec less_than_K_else '''
11470 print('statement_item_23', list(p
))
11472 # { PCondit*tmp = new PCondit(p[3], p[5], 0);
11473 # FILE_NAME(tmp, @1);
11479 def p_statement_item_24(p
):
11480 '''statement_item : K_if '(' expression ')' statement_or_null K_else statement_or_null '''
11482 print('statement_item_24', list(p
))
11484 p
[0] = absyn
.cond_statement3(p
[3], p
[5], p
[7])
11487 # { PCondit*tmp = new PCondit(p[3], p[5], p[7]);
11488 # FILE_NAME(tmp, @1);
11494 def p_statement_item_25(p
):
11495 '''statement_item : K_if '(' error ')' statement_or_null %prec less_than_K_else '''
11497 print('statement_item_25', list(p
))
11499 # { yyerror(@1, "error: Malformed conditional expression.");
11505 def p_statement_item_26(p
):
11506 '''statement_item : K_if '(' error ')' statement_or_null K_else statement_or_null '''
11508 print('statement_item_26', list(p
))
11510 # { yyerror(@1, "error: Malformed conditional expression.");
11516 def p_statement_item_27(p
):
11517 '''statement_item : compressed_statement ';' '''
11519 print('statement_item_27', list(p
))
11526 def p_statement_item_28(p
):
11527 '''statement_item : inc_or_dec_expression ';' '''
11529 print('statement_item_28', list(p
))
11531 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
11535 def p_statement_item_29(p
):
11536 '''statement_item : delay1 statement_or_null '''
11538 print('statement_item_29', list(p
))
11540 # { PExpr*del = p[1]->front();
11541 # assert(p[1]->size() == 1);
11543 # PDelayStatement*tmp = new PDelayStatement(del, p[2]);
11544 # FILE_NAME(tmp, @1);
11550 def p_statement_item_30(p
):
11551 '''statement_item : event_control statement_or_null '''
11553 print('statement_item_30', list(p
))
11555 # { PEventStatement*tmp = p[1];
11557 # yyerror(@1, "error: Invalid event control.");
11560 # tmp->set_statement(p[2]);
11567 def p_statement_item_31(p
):
11568 '''statement_item : '@' '*' statement_or_null '''
11570 print('statement_item_31', list(p
))
11572 # { PEventStatement*tmp = new PEventStatement;
11573 # FILE_NAME(tmp, @1);
11574 # tmp->set_statement(p[3]);
11580 def p_statement_item_32(p
):
11581 '''statement_item : '@' '(' '*' ')' statement_or_null '''
11583 print('statement_item_32', list(p
))
11585 # { PEventStatement*tmp = new PEventStatement;
11586 # FILE_NAME(tmp, @1);
11587 # tmp->set_statement(p[5]);
11593 def p_statement_item_33(p
):
11594 '''statement_item : lpvalue '=' expression ';' '''
11597 print('statement_item33', list(p))
11599 expr = Node(syms.expr_stmt, [p[1], Leaf(token.EQUAL, p[2]), p[3]])
11601 print("expr TODO", repr(expr))
11603 expr = Node(syms.expr_stmt, [p[1], Leaf(token.EQUAL, p[2]), ])
11605 print("expr", repr(expr))
11607 print("expr (python):'%s'" % expr)
11610 p
[0] = absyn
.assign3(p
[1], p
[2], p
[3])
11612 # { PAssign*tmp = new PAssign(p[1],p[3]);
11613 # FILE_NAME(tmp, @1);
11619 def p_statement_item_34(p
):
11620 '''statement_item : error '=' expression ';' '''
11622 print('statement_item_34', list(p
))
11624 # { yyerror(@2, "Syntax in assignment statement l-value.");
11626 # p[0] = new PNoop;
11631 def p_statement_item_35(p
):
11632 '''statement_item : lpvalue K_LE expression ';' '''
11634 print('statement_item_35', list(p
))
11636 # { PAssignNB*tmp = new PAssignNB(p[1],p[3]);
11637 # FILE_NAME(tmp, @1);
11643 def p_statement_item_36(p
):
11644 '''statement_item : error K_LE expression ';' '''
11646 print('statement_item_36', list(p
))
11648 # { yyerror(@2, "Syntax in assignment statement l-value.");
11650 # p[0] = new PNoop;
11655 def p_statement_item_37(p
):
11656 '''statement_item : lpvalue '=' delay1 expression ';' '''
11658 print('statement_item_37', list(p
))
11660 # { PExpr*del = p[3]->front(); p[3]->pop_front();
11661 # assert(p[3]->empty());
11662 # PAssign*tmp = new PAssign(p[1],del,p[4]);
11663 # FILE_NAME(tmp, @1);
11669 def p_statement_item_38(p
):
11670 '''statement_item : lpvalue K_LE delay1 expression ';' '''
11672 print('statement_item_38', list(p
))
11674 # { PExpr*del = p[3]->front(); p[3]->pop_front();
11675 # assert(p[3]->empty());
11676 # PAssignNB*tmp = new PAssignNB(p[1],del,p[4]);
11677 # FILE_NAME(tmp, @1);
11683 def p_statement_item_39(p
):
11684 '''statement_item : lpvalue '=' event_control expression ';' '''
11686 print('statement_item_39', list(p
))
11688 # { PAssign*tmp = new PAssign(p[1],0,p[3],p[4]);
11689 # FILE_NAME(tmp, @1);
11695 def p_statement_item_40(p
):
11696 '''statement_item : lpvalue '=' K_repeat '(' expression ')' event_control expression ';' '''
11698 print('statement_item_40', list(p
))
11700 # { PAssign*tmp = new PAssign(p[1],p[5],p[7],p[8]);
11701 # FILE_NAME(tmp,@1);
11702 # tmp->set_lineno(@1.first_line);
11708 def p_statement_item_41(p
):
11709 '''statement_item : lpvalue K_LE event_control expression ';' '''
11711 print('statement_item_41', list(p
))
11713 # { PAssignNB*tmp = new PAssignNB(p[1],0,p[3],p[4]);
11714 # FILE_NAME(tmp, @1);
11720 def p_statement_item_42(p
):
11721 '''statement_item : lpvalue K_LE K_repeat '(' expression ')' event_control expression ';' '''
11723 print('statement_item_42', list(p
))
11725 # { PAssignNB*tmp = new PAssignNB(p[1],p[5],p[7],p[8]);
11726 # FILE_NAME(tmp, @1);
11732 def p_statement_item_43(p
):
11733 '''statement_item : lpvalue '=' dynamic_array_new ';' '''
11735 print('statement_item_43', list(p
))
11737 # { PAssign*tmp = new PAssign(p[1],p[3]);
11738 # FILE_NAME(tmp, @1);
11744 def p_statement_item_44(p
):
11745 '''statement_item : lpvalue '=' class_new ';' '''
11747 print('statement_item_44', list(p
))
11749 # { PAssign*tmp = new PAssign(p[1],p[3]);
11750 # FILE_NAME(tmp, @1);
11756 def p_statement_item_45(p
):
11757 '''statement_item : K_wait '(' expression ')' statement_or_null '''
11759 print('statement_item_45', list(p
))
11761 # { PEventStatement*tmp;
11762 # PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, p[3]);
11763 # tmp = new PEventStatement(etmp);
11764 # FILE_NAME(tmp,@1);
11765 # tmp->set_statement(p[5]);
11771 def p_statement_item_46(p
):
11772 '''statement_item : K_wait K_fork ';' '''
11774 print('statement_item_46', list(p
))
11776 # { PEventStatement*tmp = new PEventStatement((PEEvent*)0);
11777 # FILE_NAME(tmp,@1);
11783 def p_statement_item_47(p
):
11784 '''statement_item : SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';' '''
11786 print('statement_item_47', list(p
))
11788 # { PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), *p[3]);
11789 # FILE_NAME(tmp,@1);
11797 def p_statement_item_48(p
):
11798 '''statement_item : SYSTEM_IDENTIFIER ';' '''
11800 print('statement_item_48', list(p
))
11802 # { list<PExpr*>pt;
11803 # PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), pt);
11804 # FILE_NAME(tmp,@1);
11811 def p_statement_item_49(p
):
11812 '''statement_item : hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
11814 print('statement_item_49', list(p
))
11816 # { PCallTask*tmp = pform_make_call_task(@1, *p[1], *p[3]);
11824 def p_statement_item_50(p
):
11825 '''statement_item : hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';' '''
11827 print('statement_item_50', list(p
))
11829 # { /* ....randomize with { <constraints> } */
11830 # if (p[1] && peek_tail_name(*p[1]) == "randomize") {
11831 # if (!gn_system_verilog())
11832 # yyerror(@2, "error: Randomize with constraint requires SystemVerilog.");
11834 # yyerror(@2, "sorry: Randomize with constraint not supported.");
11836 # yyerror(@2, "error: Constraint block can only be applied to randomize method.");
11839 # PCallTask*tmp = new PCallTask(*p[1], pt);
11840 # FILE_NAME(tmp, @1);
11847 def p_statement_item_51(p
):
11848 '''statement_item : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
11850 print('statement_item_51', list(p
))
11852 # { pform_name_t*t_name = p[1];
11853 # while (! p[3]->empty()) {
11854 # t_name->push_back(p[3]->front());
11855 # p[3]->pop_front();
11857 # PCallTask*tmp = new PCallTask(*t_name, *p[5]);
11858 # FILE_NAME(tmp, @1);
11867 def p_statement_item_52(p
):
11868 '''statement_item : hierarchy_identifier ';' '''
11870 print('statement_item_52', list(p
))
11872 # { list<PExpr*>pt;
11873 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
11880 def p_statement_item_53(p
):
11881 '''statement_item : implicit_class_handle '.' K_new '(' expression_list_with_nuls ')' ';' '''
11883 print('statement_item_53', list(p
))
11885 # { PChainConstructor*tmp = new PChainConstructor(*p[5]);
11886 # FILE_NAME(tmp, @3);
11893 def p_statement_item_54(p
):
11894 '''statement_item : hierarchy_identifier '(' error ')' ';' '''
11896 print('statement_item_54', list(p
))
11898 # { yyerror(@3, "error: Syntax error in task arguments.");
11900 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
11907 def p_statement_item_55(p
):
11908 '''statement_item : error ';' '''
11910 print('statement_item_55', list(p
))
11912 # { yyerror(@2, "error: malformed statement");
11914 # p[0] = new PNoop;
11919 def p__embed0_statement_item(p
):
11920 '''_embed0_statement_item : '''
11922 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_SEQ);
11923 # FILE_NAME(tmp, @1);
11924 # current_block_stack.push(tmp);
11929 def p__embed1_statement_item(p
):
11930 '''_embed1_statement_item : '''
11933 # if (! gn_system_verilog()) {
11934 # yyerror("error: Variable declaration in unnamed block "
11935 # "requires SystemVerilog.");
11938 # /* If there are no declarations in the scope then just delete it. */
11939 # pform_pop_scope();
11940 # assert(! current_block_stack.empty());
11941 # PBlock*tmp = current_block_stack.top();
11942 # current_block_stack.pop();
11949 def p__embed2_statement_item(p
):
11950 '''_embed2_statement_item : '''
11952 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_SEQ);
11953 # FILE_NAME(tmp, @1);
11954 # current_block_stack.push(tmp);
11959 def p__embed3_statement_item(p
):
11960 '''_embed3_statement_item : '''
11962 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
11963 # FILE_NAME(tmp, @1);
11964 # current_block_stack.push(tmp);
11969 def p__embed4_statement_item(p
):
11970 '''_embed4_statement_item : '''
11973 # if (! gn_system_verilog()) {
11974 # yyerror("error: Variable declaration in unnamed block "
11975 # "requires SystemVerilog.");
11978 # /* If there are no declarations in the scope then just delete it. */
11979 # pform_pop_scope();
11980 # assert(! current_block_stack.empty());
11981 # PBlock*tmp = current_block_stack.top();
11982 # current_block_stack.pop();
11989 def p__embed5_statement_item(p
):
11990 '''_embed5_statement_item : '''
11992 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_PAR);
11993 # FILE_NAME(tmp, @1);
11994 # current_block_stack.push(tmp);
11999 def p_compressed_statement_1(p
):
12000 '''compressed_statement : lpvalue K_PLUS_EQ expression '''
12002 print('compressed_statement_1', list(p
))
12004 # { PAssign*tmp = new PAssign(p[1], '+', p[3]);
12005 # FILE_NAME(tmp, @1);
12011 def p_compressed_statement_2(p
):
12012 '''compressed_statement : lpvalue K_MINUS_EQ expression '''
12014 print('compressed_statement_2', list(p
))
12016 # { PAssign*tmp = new PAssign(p[1], '-', p[3]);
12017 # FILE_NAME(tmp, @1);
12023 def p_compressed_statement_3(p
):
12024 '''compressed_statement : lpvalue K_MUL_EQ expression '''
12026 print('compressed_statement_3', list(p
))
12028 # { PAssign*tmp = new PAssign(p[1], '*', p[3]);
12029 # FILE_NAME(tmp, @1);
12035 def p_compressed_statement_4(p
):
12036 '''compressed_statement : lpvalue K_DIV_EQ expression '''
12038 print('compressed_statement_4', list(p
))
12040 # { PAssign*tmp = new PAssign(p[1], '/', p[3]);
12041 # FILE_NAME(tmp, @1);
12047 def p_compressed_statement_5(p
):
12048 '''compressed_statement : lpvalue K_MOD_EQ expression '''
12050 print('compressed_statement_5', list(p
))
12052 # { PAssign*tmp = new PAssign(p[1], '%', p[3]);
12053 # FILE_NAME(tmp, @1);
12059 def p_compressed_statement_6(p
):
12060 '''compressed_statement : lpvalue K_AND_EQ expression '''
12062 print('compressed_statement_6', list(p
))
12064 # { PAssign*tmp = new PAssign(p[1], '&', p[3]);
12065 # FILE_NAME(tmp, @1);
12071 def p_compressed_statement_7(p
):
12072 '''compressed_statement : lpvalue K_OR_EQ expression '''
12074 print('compressed_statement_7', list(p
))
12076 # { PAssign*tmp = new PAssign(p[1], '|', p[3]);
12077 # FILE_NAME(tmp, @1);
12083 def p_compressed_statement_8(p
):
12084 '''compressed_statement : lpvalue K_XOR_EQ expression '''
12086 print('compressed_statement_8', list(p
))
12088 # { PAssign*tmp = new PAssign(p[1], '^', p[3]);
12089 # FILE_NAME(tmp, @1);
12095 def p_compressed_statement_9(p
):
12096 '''compressed_statement : lpvalue K_LS_EQ expression '''
12098 print('compressed_statement_9', list(p
))
12100 # { PAssign *tmp = new PAssign(p[1], 'l', p[3]);
12101 # FILE_NAME(tmp, @1);
12107 def p_compressed_statement_10(p
):
12108 '''compressed_statement : lpvalue K_RS_EQ expression '''
12110 print('compressed_statement_10', list(p
))
12112 # { PAssign*tmp = new PAssign(p[1], 'r', p[3]);
12113 # FILE_NAME(tmp, @1);
12119 def p_compressed_statement_11(p
):
12120 '''compressed_statement : lpvalue K_RSS_EQ expression '''
12122 print('compressed_statement_11', list(p
))
12124 # { PAssign *tmp = new PAssign(p[1], 'R', p[3]);
12125 # FILE_NAME(tmp, @1);
12131 def p_statement_or_null_list_opt_1(p
):
12132 '''statement_or_null_list_opt : statement_or_null_list '''
12134 print('statement_or_null_list_opt_1', list(p
))
12141 def p_statement_or_null_list_opt_2(p
):
12142 '''statement_or_null_list_opt : '''
12144 print('statement_or_null_list_opt_2', list(p
))
12150 def p_statement_or_null_list_1(p
):
12151 '''statement_or_null_list : statement_or_null_list statement_or_null '''
12153 print('statement_or_null_list_1', list(p
))
12158 tmp
= StatementList()
12160 tmp
.add_statement(p
[2])
12164 # { vector<Statement*>*tmp = p[1];
12165 # if (p[2]) tmp->push_back(p[2]);
12171 def p_statement_or_null_list_2(p
):
12172 '''statement_or_null_list : statement_or_null '''
12174 print('statement_or_null_list_2', list(p
))
12176 tmp
= StatementList()
12178 tmp
.add_statement(p
[1])
12181 # { vector<Statement*>*tmp = new vector<Statement*>(0);
12182 # if (p[1]) tmp->push_back(p[1]);
12188 def p_analog_statement_1(p
):
12189 '''analog_statement : branch_probe_expression K_CONTRIBUTE expression ';' '''
12191 print('analog_statement_1', list(p
))
12193 # { p[0] = pform_contribution_statement(@2, p[1], p[3]); }
12197 def p_task_item_1(p
):
12198 '''task_item : block_item_decl '''
12200 print('task_item_1', list(p
))
12202 # { p[0] = new vector<pform_tf_port_t>(0); }
12206 def p_task_item_2(p
):
12207 '''task_item : tf_port_declaration '''
12209 print('task_item_2', list(p
))
12216 def p_task_item_list_1(p
):
12217 '''task_item_list : task_item_list task_item '''
12219 print('task_item_list_1', list(p
))
12221 # { vector<pform_tf_port_t>*tmp = p[1];
12222 # size_t s1 = tmp->size();
12223 # tmp->resize(s1 + p[2]->size());
12224 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
12225 # tmp->at(s1 + idx) = p[2]->at(idx);
12232 def p_task_item_list_2(p
):
12233 '''task_item_list : task_item '''
12235 print('task_item_list_2', list(p
))
12242 def p_task_item_list_opt_1(p
):
12243 '''task_item_list_opt : task_item_list '''
12245 print('task_item_list_opt_1', list(p
))
12252 def p_task_item_list_opt_2(p
):
12253 '''task_item_list_opt : '''
12255 print('task_item_list_opt_2', list(p
))
12261 def p_tf_port_list_opt_1(p
):
12262 '''tf_port_list_opt : tf_port_list '''
12264 print('tf_port_list_opt_1', list(p
))
12271 def p_tf_port_list_opt_2(p
):
12272 '''tf_port_list_opt : '''
12274 print('tf_port_list_opt_2', list(p
))
12280 def p_udp_body_1(p
):
12281 '''udp_body : K_table udp_entry_list K_endtable '''
12283 print('udp_body_1', list(p
))
12285 # { lex_end_table();
12291 def p_udp_body_2(p
):
12292 '''udp_body : K_table K_endtable '''
12294 print('udp_body_2', list(p
))
12296 # { lex_end_table();
12297 # yyerror(@1, "error: Empty UDP table.");
12303 def p_udp_body_3(p
):
12304 '''udp_body : K_table error K_endtable '''
12306 print('udp_body_3', list(p
))
12308 # { lex_end_table();
12309 # yyerror(@2, "Errors in UDP table");
12316 def p_udp_entry_list_1(p
):
12317 '''udp_entry_list : udp_comb_entry_list '''
12319 print('udp_entry_list_1', list(p
))
12325 def p_udp_entry_list_2(p
):
12326 '''udp_entry_list : udp_sequ_entry_list '''
12328 print('udp_entry_list_2', list(p
))
12334 def p_udp_comb_entry_1(p
):
12335 '''udp_comb_entry : udp_input_list ':' udp_output_sym ';' '''
12337 print('udp_comb_entry_1', list(p
))
12339 # { char*tmp = new char[strlen(p[1])+3];
12340 # strcpy(tmp, p[1]);
12341 # char*tp = tmp+strlen(tmp);
12351 def p_udp_comb_entry_list_1(p
):
12352 '''udp_comb_entry_list : udp_comb_entry '''
12354 print('udp_comb_entry_list_1', list(p
))
12356 # { list<string>*tmp = new list<string>;
12357 # tmp->push_back(p[1]);
12364 def p_udp_comb_entry_list_2(p
):
12365 '''udp_comb_entry_list : udp_comb_entry_list udp_comb_entry '''
12367 print('udp_comb_entry_list_2', list(p
))
12369 # { list<string>*tmp = p[1];
12370 # tmp->push_back(p[2]);
12377 def p_udp_sequ_entry_list_1(p
):
12378 '''udp_sequ_entry_list : udp_sequ_entry '''
12380 print('udp_sequ_entry_list_1', list(p
))
12382 # { list<string>*tmp = new list<string>;
12383 # tmp->push_back(p[1]);
12390 def p_udp_sequ_entry_list_2(p
):
12391 '''udp_sequ_entry_list : udp_sequ_entry_list udp_sequ_entry '''
12393 print('udp_sequ_entry_list_2', list(p
))
12395 # { list<string>*tmp = p[1];
12396 # tmp->push_back(p[2]);
12403 def p_udp_sequ_entry_1(p
):
12404 '''udp_sequ_entry : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' '''
12406 print('udp_sequ_entry_1', list(p
))
12408 # { char*tmp = new char[strlen(p[1])+5];
12409 # strcpy(tmp, p[1]);
12410 # char*tp = tmp+strlen(tmp);
12421 def p_udp_initial_1(p
):
12422 '''udp_initial : K_initial IDENTIFIER '=' number ';' '''
12424 print('udp_initial_1', list(p
))
12426 # { PExpr*etmp = new PENumber(p[4]);
12427 # PEIdent*itmp = new PEIdent(lex_strings.make(p[2]));
12428 # PAssign*atmp = new PAssign(itmp, etmp);
12429 # FILE_NAME(atmp, @2);
12436 def p_udp_init_opt_1(p
):
12437 '''udp_init_opt : udp_initial '''
12439 print('udp_init_opt_1', list(p
))
12446 def p_udp_init_opt_2(p
):
12447 '''udp_init_opt : '''
12449 print('udp_init_opt_2', list(p
))
12455 def p_udp_input_list_1(p
):
12456 '''udp_input_list : udp_input_sym '''
12458 print('udp_input_list_1', list(p
))
12460 # { char*tmp = new char[2];
12468 def p_udp_input_list_2(p
):
12469 '''udp_input_list : udp_input_list udp_input_sym '''
12471 print('udp_input_list_2', list(p
))
12473 # { char*tmp = new char[strlen(p[1])+2];
12474 # strcpy(tmp, p[1]);
12475 # char*tp = tmp+strlen(tmp);
12484 def p_udp_input_sym_1(p
):
12485 '''udp_input_sym : '0' '''
12487 print('udp_input_sym_1', list(p
))
12493 def p_udp_input_sym_2(p
):
12494 '''udp_input_sym : '1' '''
12496 print('udp_input_sym_2', list(p
))
12502 def p_udp_input_sym_3(p
):
12503 '''udp_input_sym : 'x' '''
12505 print('udp_input_sym_3', list(p
))
12511 def p_udp_input_sym_4(p
):
12512 '''udp_input_sym : '?' '''
12514 print('udp_input_sym_4', list(p
))
12520 def p_udp_input_sym_5(p
):
12521 '''udp_input_sym : 'b' '''
12523 print('udp_input_sym_5', list(p
))
12529 def p_udp_input_sym_6(p
):
12530 '''udp_input_sym : '*' '''
12532 print('udp_input_sym_6', list(p
))
12538 def p_udp_input_sym_7(p
):
12539 '''udp_input_sym : '%' '''
12541 print('udp_input_sym_7', list(p
))
12547 def p_udp_input_sym_8(p
):
12548 '''udp_input_sym : 'f' '''
12550 print('udp_input_sym_8', list(p
))
12556 def p_udp_input_sym_9(p
):
12557 '''udp_input_sym : 'F' '''
12559 print('udp_input_sym_9', list(p
))
12565 def p_udp_input_sym_10(p
):
12566 '''udp_input_sym : 'l' '''
12568 print('udp_input_sym_10', list(p
))
12574 def p_udp_input_sym_11(p
):
12575 '''udp_input_sym : 'h' '''
12577 print('udp_input_sym_11', list(p
))
12583 def p_udp_input_sym_12(p
):
12584 '''udp_input_sym : 'B' '''
12586 print('udp_input_sym_12', list(p
))
12592 def p_udp_input_sym_13(p
):
12593 '''udp_input_sym : 'r' '''
12595 print('udp_input_sym_13', list(p
))
12601 def p_udp_input_sym_14(p
):
12602 '''udp_input_sym : 'R' '''
12604 print('udp_input_sym_14', list(p
))
12610 def p_udp_input_sym_15(p
):
12611 '''udp_input_sym : 'M' '''
12613 print('udp_input_sym_15', list(p
))
12619 def p_udp_input_sym_16(p
):
12620 '''udp_input_sym : 'n' '''
12622 print('udp_input_sym_16', list(p
))
12628 def p_udp_input_sym_17(p
):
12629 '''udp_input_sym : 'N' '''
12631 print('udp_input_sym_17', list(p
))
12637 def p_udp_input_sym_18(p
):
12638 '''udp_input_sym : 'p' '''
12640 print('udp_input_sym_18', list(p
))
12646 def p_udp_input_sym_19(p
):
12647 '''udp_input_sym : 'P' '''
12649 print('udp_input_sym_19', list(p
))
12655 def p_udp_input_sym_20(p
):
12656 '''udp_input_sym : 'Q' '''
12658 print('udp_input_sym_20', list(p
))
12664 def p_udp_input_sym_21(p
):
12665 '''udp_input_sym : 'q' '''
12667 print('udp_input_sym_21', list(p
))
12673 def p_udp_input_sym_22(p
):
12674 '''udp_input_sym : '_' '''
12676 print('udp_input_sym_22', list(p
))
12682 def p_udp_input_sym_23(p
):
12683 '''udp_input_sym : '+' '''
12685 print('udp_input_sym_23', list(p
))
12691 def p_udp_input_sym_24(p
):
12692 '''udp_input_sym : DEC_NUMBER '''
12694 print('udp_input_sym_24', list(p
))
12696 # { yyerror(@1, "internal error: Input digits parse as decimal number!"); p[0] = '0'; }
12700 def p_udp_output_sym_1(p
):
12701 '''udp_output_sym : '0' '''
12703 print('udp_output_sym_1', list(p
))
12709 def p_udp_output_sym_2(p
):
12710 '''udp_output_sym : '1' '''
12712 print('udp_output_sym_2', list(p
))
12718 def p_udp_output_sym_3(p
):
12719 '''udp_output_sym : 'x' '''
12721 print('udp_output_sym_3', list(p
))
12727 def p_udp_output_sym_4(p
):
12728 '''udp_output_sym : '-' '''
12730 print('udp_output_sym_4', list(p
))
12736 def p_udp_output_sym_5(p
):
12737 '''udp_output_sym : DEC_NUMBER '''
12739 print('udp_output_sym_5', list(p
))
12741 # { yyerror(@1, "internal error: Output digits parse as decimal number!"); p[0] = '0'; }
12745 def p_udp_port_decl_1(p
):
12746 '''udp_port_decl : K_input list_of_identifiers ';' '''
12748 print('udp_port_decl_1', list(p
))
12750 # { p[0] = pform_make_udp_input_ports(p[2]); }
12754 def p_udp_port_decl_2(p
):
12755 '''udp_port_decl : K_output IDENTIFIER ';' '''
12757 print('udp_port_decl_2', list(p
))
12759 # { perm_string pname = lex_strings.make(p[2]);
12760 # PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
12761 # vector<PWire*>*tmp = new vector<PWire*>(1);
12769 def p_udp_port_decl_3(p
):
12770 '''udp_port_decl : K_reg IDENTIFIER ';' '''
12772 print('udp_port_decl_3', list(p
))
12774 # { perm_string pname = lex_strings.make(p[2]);
12775 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
12776 # vector<PWire*>*tmp = new vector<PWire*>(1);
12784 def p_udp_port_decl_4(p
):
12785 '''udp_port_decl : K_reg K_output IDENTIFIER ';' '''
12787 print('udp_port_decl_4', list(p
))
12789 # { perm_string pname = lex_strings.make(p[3]);
12790 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
12791 # vector<PWire*>*tmp = new vector<PWire*>(1);
12799 def p_udp_port_decls_1(p
):
12800 '''udp_port_decls : udp_port_decl '''
12802 print('udp_port_decls_1', list(p
))
12809 def p_udp_port_decls_2(p
):
12810 '''udp_port_decls : udp_port_decls udp_port_decl '''
12812 print('udp_port_decls_2', list(p
))
12814 # { vector<PWire*>*tmp = p[1];
12815 # size_t s1 = p[1]->size();
12816 # tmp->resize(s1+p[2]->size());
12817 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
12818 # tmp->at(s1+idx) = p[2]->at(idx);
12825 def p_udp_port_list_1(p
):
12826 '''udp_port_list : IDENTIFIER '''
12828 print('udp_port_list_1', list(p
))
12830 # { list<perm_string>*tmp = new list<perm_string>;
12831 # tmp->push_back(lex_strings.make(p[1]));
12838 def p_udp_port_list_2(p
):
12839 '''udp_port_list : udp_port_list ',' IDENTIFIER '''
12841 print('udp_port_list_2', list(p
))
12843 # { list<perm_string>*tmp = p[1];
12844 # tmp->push_back(lex_strings.make(p[3]));
12851 def p_udp_reg_opt_1(p
):
12852 '''udp_reg_opt : K_reg '''
12854 print('udp_reg_opt_1', list(p
))
12861 def p_udp_reg_opt_2(p
):
12862 '''udp_reg_opt : '''
12864 print('udp_reg_opt_2', list(p
))
12871 def p_udp_initial_expr_opt_1(p
):
12872 '''udp_initial_expr_opt : '=' expression '''
12874 print('udp_initial_expr_opt_1', list(p
))
12881 def p_udp_initial_expr_opt_2(p
):
12882 '''udp_initial_expr_opt : '''
12884 print('udp_initial_expr_opt_2', list(p
))
12890 def p_udp_input_declaration_list_1(p
):
12891 '''udp_input_declaration_list : K_input IDENTIFIER '''
12893 print('udp_input_declaration_list_1', list(p
))
12895 # { list<perm_string>*tmp = new list<perm_string>;
12896 # tmp->push_back(lex_strings.make(p[2]));
12903 def p_udp_input_declaration_list_2(p
):
12904 '''udp_input_declaration_list : udp_input_declaration_list ',' K_input IDENTIFIER '''
12906 print('udp_input_declaration_list_2', list(p
))
12908 # { list<perm_string>*tmp = p[1];
12909 # tmp->push_back(lex_strings.make(p[4]));
12916 def p_udp_primitive_1(p
):
12917 '''udp_primitive : K_primitive IDENTIFIER '(' udp_port_list ')' ';' udp_port_decls udp_init_opt udp_body K_endprimitive endlabel_opt '''
12919 print('udp_primitive_1', list(p
))
12921 # { perm_string tmp2 = lex_strings.make(p[2]);
12922 # pform_make_udp(tmp2, p[4], p[7], p[9], p[8],
12923 # @2.text, @2.first_line);
12925 # if (strcmp(p[2],p[11]) != 0) {
12926 # yyerror(@11, "error: End label doesn't match "
12927 # "primitive name");
12929 # if (! gn_system_verilog()) {
12930 # yyerror(@11, "error: Primitive end labels "
12931 # "require SystemVerilog.");
12940 def p_udp_primitive_2(p
):
12941 '''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 '''
12943 print('udp_primitive_2', list(p
))
12945 # { perm_string tmp2 = lex_strings.make(p[2]);
12946 # perm_string tmp6 = lex_strings.make(p[6]);
12947 # pform_make_udp(tmp2, p[5], tmp6, p[7], p[9], p[12],
12948 # @2.text, @2.first_line);
12950 # if (strcmp(p[2],p[14]) != 0) {
12951 # yyerror(@14, "error: End label doesn't match "
12952 # "primitive name");
12954 # if (! gn_system_verilog()) {
12955 # yyerror(@14, "error: Primitive end labels "
12956 # "require SystemVerilog.");
12966 def p_K_packed_opt_1(p
):
12967 '''K_packed_opt : K_packed '''
12969 print('K_packed_opt', list(p
))
12976 def p_K_packed_opt_2(p
):
12977 '''K_packed_opt : '''
12979 print('K_packed_opt', list(p
))
12986 def p_K_reg_opt_1(p
):
12987 '''K_reg_opt : K_reg '''
12989 print('K_reg_opt', list(p
))
12996 def p_K_reg_opt_2(p
):
12999 print('K_reg_opt', list(p
))
13006 def p_K_static_opt_1(p
):
13007 '''K_static_opt : K_static '''
13009 print('K_static_opt', list(p
))
13016 def p_K_static_opt_2(p
):
13017 '''K_static_opt : '''
13019 print('K_static_opt', list(p
))
13026 def p_K_virtual_opt_1(p
):
13027 '''K_virtual_opt : K_virtual '''
13036 def p_K_virtual_opt_2(p
):
13037 '''K_virtual_opt : '''