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.
22 from lib2to3
.pytree
import Node
, Leaf
23 from lib2to3
.pgen2
import token
24 from lib2to3
.pygram
import python_symbols
as syms
26 from ply
import yacc
, lex
28 #from parse_tokens import tokens
30 tokens
= lexor
.tokens
# list(set(lexor.tokens).union(set(tokens)))
31 literals
= lexor
.literals
34 ('right', 'K_PLUS_EQ', 'K_MINUS_EQ', 'K_MUL_EQ', 'K_DIV_EQ',
35 'K_MOD_EQ', 'K_AND_EQ', 'K_OR_EQ'),
36 ('right', 'K_XOR_EQ', 'K_LS_EQ', 'K_RS_EQ', 'K_RSS_EQ'),
37 ('right', '?', ':', 'K_inside'),
41 ('left', '^', 'K_NXOR', 'K_NOR'),
42 ('left', '&', 'K_NAND'),
43 ('left', 'K_EQ', 'K_NE', 'K_CEQ', 'K_CNE', 'K_WEQ', 'K_WNE'),
44 ('left', 'K_GE', 'K_LE', '<', '>'),
45 ('left', 'K_LS', 'K_RS', 'K_RSS'),
47 ('left', '*', '/', '%'),
49 ('left', 'UNARY_PREC'),
50 ('nonassoc', 'less_than_K_else'),
51 ('nonassoc', 'K_else'),
53 ('nonassoc', 'K_exclude'),
54 ('nonassoc', 'no_timeunits_declaration'),
55 ('nonassoc', 'one_timeunits_declaration'),
56 ('nonassoc', 'K_timeunit', 'K_timeprecision')
59 # -------------- RULES ----------------
61 def p_source_text_1(p
):
62 '''source_text : timeunits_declaration_opt _embed0_source_text description_list '''
63 print('source_text', list(p
))
65 def p_source_text_2(p
):
67 print('source_text', list(p
))
69 def p__embed0_source_text(p
):
70 '''_embed0_source_text : '''
71 # { pform_set_scope_timescale(yyloc); }
73 def p_assertion_item_1(p
):
74 '''assertion_item : concurrent_assertion_item '''
75 print('assertion_item_1', list(p
))
77 def p_assignment_pattern_1(p
):
78 '''assignment_pattern : K_LP expression_list_proper '}' '''
79 print('assignment_pattern_1', list(p
))
80 # { PEAssignPattern*tmp = new PEAssignPattern(*$2);
86 def p_assignment_pattern_2(p
):
87 '''assignment_pattern : K_LP '}' '''
88 print('assignment_pattern_2', list(p
))
89 # { PEAssignPattern*tmp = new PEAssignPattern;
94 def p_block_identifier_opt_1(p
):
95 '''block_identifier_opt : IDENTIFIER ':' '''
96 print('block_identifier_opt_1', list(p
))
98 def p_block_identifier_opt_2(p
):
99 '''block_identifier_opt : '''
100 print('block_identifier_opt_2', list(p
))
102 def p_class_declaration_1(p
):
103 '''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 '''
104 print('class_declaration_1', list(p
))
105 # { // Wrap up the class.
106 # if ($11 && $4 && $4->name != $11) {
107 # yyerror(@11, "error: Class end label doesn't match class name.");
112 def p__embed0_class_declaration(p
):
113 '''_embed0_class_declaration : '''
114 # { pform_start_class_declaration(@2, $4, $5.type, $5.exprs, $3); }
116 def p__embed1_class_declaration(p
):
117 '''_embed1_class_declaration : '''
118 # { // Process a class.
119 # pform_end_class_declaration(@9);
122 def p_class_constraint_1(p
):
123 '''class_constraint : constraint_prototype '''
124 print('class_constraint_1', list(p
))
126 def p_class_constraint_2(p
):
127 '''class_constraint : constraint_declaration '''
128 print('class_constraint_2', list(p
))
130 def p_class_identifier_1(p
):
131 '''class_identifier : IDENTIFIER '''
132 print('class_identifier_1', list(p
))
133 # { // Create a synthetic typedef for the class name so that the
134 # // lexor detects the name as a type.
135 # perm_string name = lex_strings.make($1);
136 # class_type_t*tmp = new class_type_t(name);
137 # FILE_NAME(tmp, @1);
138 # pform_set_typedef(name, tmp, NULL);
143 def p_class_identifier_2(p
):
144 '''class_identifier : TYPE_IDENTIFIER '''
145 print('class_identifier_2', list(p
))
146 # { class_type_t*tmp = dynamic_cast<class_type_t*>($1.type);
148 # yyerror(@1, "Type name \"%s\"is not a predeclared class name.", $1.text);
154 def p_class_declaration_endlabel_opt_1(p
):
155 '''class_declaration_endlabel_opt : ':' TYPE_IDENTIFIER '''
156 print('class_declaration_endlabel_opt_1', list(p
))
157 # { class_type_t*tmp = dynamic_cast<class_type_t*> ($2.type);
159 # yyerror(@2, "error: class declaration endlabel \"%s\" is not a class name\n", $2.text);
162 # $$ = strdupnew(tmp->name.str());
167 def p_class_declaration_endlabel_opt_2(p
):
168 '''class_declaration_endlabel_opt : ':' IDENTIFIER '''
169 print('class_declaration_endlabel_opt_2', list(p
))
172 def p_class_declaration_endlabel_opt_3(p
):
173 '''class_declaration_endlabel_opt : '''
174 print('class_declaration_endlabel_opt_3', list(p
))
177 def p_class_declaration_extends_opt_1(p
):
178 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '''
179 print('class_declaration_extends_opt_1', list(p
))
180 # { $$.type = $2.type;
185 def p_class_declaration_extends_opt_2(p
):
186 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '(' expression_list_with_nuls ')' '''
187 print('class_declaration_extends_opt_2', list(p
))
188 # { $$.type = $2.type;
193 def p_class_declaration_extends_opt_3(p
):
194 '''class_declaration_extends_opt : '''
195 print('class_declaration_extends_opt_3', list(p
))
196 # { $$.type = 0; $$.exprs = 0; }
198 def p_class_items_opt_1(p
):
199 '''class_items_opt : class_items '''
200 print('class_items_opt_1', list(p
))
202 def p_class_items_opt_2(p
):
203 '''class_items_opt : '''
204 print('class_items_opt_2', list(p
))
206 def p_class_items_1(p
):
207 '''class_items : class_items class_item '''
208 print('class_items_1', list(p
))
210 def p_class_items_2(p
):
211 '''class_items : class_item '''
212 print('class_items_2', list(p
))
214 def p_class_item_1(p
):
215 '''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 '''
216 print('class_item_1', list(p
))
217 # { current_function->set_ports($6);
218 # pform_set_constructor_return(current_function);
219 # pform_set_this_class(@3, current_function);
220 # current_function_set_statement(@3, $10);
222 # current_function = 0;
225 def p_class_item_2(p
):
226 '''class_item : property_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
227 print('class_item_2', list(p
))
228 # { pform_class_property(@2, $1, $2, $3); }
230 def p_class_item_3(p
):
231 '''class_item : K_const class_item_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
232 print('class_item_3', list(p
))
233 # { pform_class_property(@1, $2 | property_qualifier_t::make_const(), $3, $4); }
235 def p_class_item_4(p
):
236 '''class_item : method_qualifier_opt task_declaration '''
237 print('class_item_4', list(p
))
238 # { /* The task_declaration rule puts this into the class */ }
240 def p_class_item_5(p
):
241 '''class_item : method_qualifier_opt function_declaration '''
242 print('class_item_5', list(p
))
243 # { /* The function_declaration rule puts this into the class */ }
245 def p_class_item_6(p
):
246 '''class_item : K_extern method_qualifier_opt K_function K_new ';' '''
247 print('class_item_6', list(p
))
248 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
250 def p_class_item_7(p
):
251 '''class_item : K_extern method_qualifier_opt K_function K_new '(' tf_port_list_opt ')' ';' '''
252 print('class_item_7', list(p
))
253 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
255 def p_class_item_8(p
):
256 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER ';' '''
257 print('class_item_8', list(p
))
258 # { yyerror(@1, "sorry: External methods are not yet supported.");
262 def p_class_item_9(p
):
263 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' ';' '''
264 print('class_item_9', list(p
))
265 # { yyerror(@1, "sorry: External methods are not yet supported.");
269 def p_class_item_10(p
):
270 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER ';' '''
271 print('class_item_10', list(p
))
272 # { yyerror(@1, "sorry: External methods are not yet supported.");
276 def p_class_item_11(p
):
277 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER '(' tf_port_list_opt ')' ';' '''
278 print('class_item_11', list(p
))
279 # { yyerror(@1, "sorry: External methods are not yet supported.");
283 def p_class_item_12(p
):
284 '''class_item : class_constraint '''
285 print('class_item_12', list(p
))
287 def p_class_item_13(p
):
288 '''class_item : property_qualifier_opt data_type error ';' '''
289 print('class_item_13', list(p
))
290 # { yyerror(@3, "error: Errors in variable names after data type.");
294 def p_class_item_14(p
):
295 '''class_item : property_qualifier_opt IDENTIFIER error ';' '''
296 print('class_item_14', list(p
))
297 # { yyerror(@3, "error: %s doesn't name a type.", $2);
301 def p_class_item_15(p
):
302 '''class_item : method_qualifier_opt K_function K_new error K_endfunction endnew_opt '''
303 print('class_item_15', list(p
))
304 # { yyerror(@1, "error: I give up on this class constructor declaration.");
308 def p_class_item_16(p
):
309 '''class_item : error ';' '''
310 print('class_item_16', list(p
))
311 # { yyerror(@2, "error: invalid class item.");
315 def p__embed0_class_item(p
):
316 '''_embed0_class_item : '''
317 # { assert(current_function==0);
318 # current_function = pform_push_constructor_scope(@3);
321 def p_class_item_qualifier_1(p
):
322 '''class_item_qualifier : K_static '''
323 print('class_item_qualifier_1', list(p
))
324 # { $$ = property_qualifier_t::make_static(); }
326 def p_class_item_qualifier_2(p
):
327 '''class_item_qualifier : K_protected '''
328 print('class_item_qualifier_2', list(p
))
329 # { $$ = property_qualifier_t::make_protected(); }
331 def p_class_item_qualifier_3(p
):
332 '''class_item_qualifier : K_local '''
333 print('class_item_qualifier_3', list(p
))
334 # { $$ = property_qualifier_t::make_local(); }
336 def p_class_item_qualifier_list_1(p
):
337 '''class_item_qualifier_list : class_item_qualifier_list class_item_qualifier '''
338 print('class_item_qualifier_list_1', list(p
))
341 def p_class_item_qualifier_list_2(p
):
342 '''class_item_qualifier_list : class_item_qualifier '''
343 print('class_item_qualifier_list_2', list(p
))
346 def p_class_item_qualifier_opt_1(p
):
347 '''class_item_qualifier_opt : class_item_qualifier_list '''
348 print('class_item_qualifier_opt_1', list(p
))
351 def p_class_item_qualifier_opt_2(p
):
352 '''class_item_qualifier_opt : '''
353 print('class_item_qualifier_opt_2', list(p
))
354 # { $$ = property_qualifier_t::make_none(); }
356 def p_class_new_1(p
):
357 '''class_new : K_new '(' expression_list_with_nuls ')' '''
358 print('class_new_1', list(p
))
359 # { list<PExpr*>*expr_list = $3;
360 # strip_tail_items(expr_list);
361 # PENewClass*tmp = new PENewClass(*expr_list);
362 # FILE_NAME(tmp, @1);
367 def p_class_new_2(p
):
368 '''class_new : K_new hierarchy_identifier '''
369 print('class_new_2', list(p
))
370 # { PEIdent*tmpi = new PEIdent(*$2);
371 # FILE_NAME(tmpi, @2);
372 # PENewCopy*tmp = new PENewCopy(tmpi);
373 # FILE_NAME(tmp, @1);
378 def p_class_new_3(p
):
379 '''class_new : K_new '''
380 print('class_new_3', list(p
))
381 # { PENewClass*tmp = new PENewClass;
382 # FILE_NAME(tmp, @1);
386 def p_concurrent_assertion_item_1(p
):
387 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' property_spec ')' statement_or_null '''
388 print('concurrent_assertion_item_1', list(p
))
390 # if (gn_assertions_flag) {
391 # yyerror(@2, "sorry: concurrent_assertion_item not supported."
392 # " Try -gno-assertion to turn this message off.");
396 def p_concurrent_assertion_item_2(p
):
397 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' error ')' statement_or_null '''
398 print('concurrent_assertion_item_2', list(p
))
400 # yyerror(@2, "error: Error in property_spec of concurrent assertion item.");
403 def p_constraint_block_item_1(p
):
404 '''constraint_block_item : constraint_expression '''
405 print('constraint_block_item_1', list(p
))
407 def p_constraint_block_item_list_1(p
):
408 '''constraint_block_item_list : constraint_block_item_list constraint_block_item '''
409 print('constraint_block_item_list_1', list(p
))
411 def p_constraint_block_item_list_2(p
):
412 '''constraint_block_item_list : constraint_block_item '''
413 print('constraint_block_item_list_2', list(p
))
415 def p_constraint_block_item_list_opt_1(p
):
416 '''constraint_block_item_list_opt : '''
417 print('constraint_block_item_list_opt_1', list(p
))
419 def p_constraint_block_item_list_opt_2(p
):
420 '''constraint_block_item_list_opt : constraint_block_item_list '''
421 print('constraint_block_item_list_opt_2', list(p
))
423 def p_constraint_declaration_1(p
):
424 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' constraint_block_item_list_opt '}' '''
425 print('constraint_declaration_1', list(p
))
426 # { yyerror(@2, "sorry: Constraint declarations not supported."); }
428 def p_constraint_declaration_2(p
):
429 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' error '}' '''
430 print('constraint_declaration_2', list(p
))
431 # { yyerror(@4, "error: Errors in the constraint block item list."); }
433 def p_constraint_expression_1(p
):
434 '''constraint_expression : expression ';' '''
435 print('constraint_expression_1', list(p
))
437 def p_constraint_expression_2(p
):
438 '''constraint_expression : expression K_dist '{' '}' ';' '''
439 print('constraint_expression_2', list(p
))
441 def p_constraint_expression_3(p
):
442 '''constraint_expression : expression K_TRIGGER constraint_set '''
443 print('constraint_expression_3', list(p
))
445 def p_constraint_expression_4(p
):
446 '''constraint_expression : K_if '(' expression ')' constraint_set %prec less_than_K_else '''
447 print('constraint_expression_4', list(p
))
449 def p_constraint_expression_5(p
):
450 '''constraint_expression : K_if '(' expression ')' constraint_set K_else constraint_set '''
451 print('constraint_expression_5', list(p
))
453 def p_constraint_expression_6(p
):
454 '''constraint_expression : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' constraint_set '''
455 print('constraint_expression_6', list(p
))
457 def p_constraint_expression_list_1(p
):
458 '''constraint_expression_list : constraint_expression_list constraint_expression '''
459 print('constraint_expression_list_1', list(p
))
461 def p_constraint_expression_list_2(p
):
462 '''constraint_expression_list : constraint_expression '''
463 print('constraint_expression_list_2', list(p
))
465 def p_constraint_prototype_1(p
):
466 '''constraint_prototype : K_static_opt K_constraint IDENTIFIER ';' '''
467 print('constraint_prototype_1', list(p
))
468 # { yyerror(@2, "sorry: Constraint prototypes not supported."); }
470 def p_constraint_set_1(p
):
471 '''constraint_set : constraint_expression '''
472 print('constraint_set_1', list(p
))
474 def p_constraint_set_2(p
):
475 '''constraint_set : '{' constraint_expression_list '}' '''
476 print('constraint_set_2', list(p
))
478 def p_data_declaration_1(p
):
479 '''data_declaration : attribute_list_opt data_type_or_implicit list_of_variable_decl_assignments ';' '''
480 print('data_declaration_1', list(p
))
481 # { data_type_t*data_type = $2;
482 # if (data_type == 0) {
483 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
484 # FILE_NAME(data_type, @2);
486 # pform_makewire(@2, 0, str_strength, $3, NetNet::IMPLICIT_REG, data_type);
489 def p_data_type_1(p
):
490 '''data_type : integer_vector_type unsigned_signed_opt dimensions_opt '''
491 print('data_type_1', list(p
))
492 # { ivl_variable_type_t use_vtype = $1;
493 # bool reg_flag = false;
494 # if (use_vtype == IVL_VT_NO_TYPE) {
495 # use_vtype = IVL_VT_LOGIC;
498 # vector_type_t*tmp = new vector_type_t(use_vtype, $2, $3);
499 # tmp->reg_flag = reg_flag;
500 # FILE_NAME(tmp, @1);
504 def p_data_type_2(p
):
505 '''data_type : non_integer_type '''
506 print('data_type_2', list(p
))
507 # { real_type_t*tmp = new real_type_t($1);
508 # FILE_NAME(tmp, @1);
512 def p_data_type_3(p
):
513 '''data_type : struct_data_type '''
514 print('data_type_3', list(p
))
515 # { if (!$1->packed_flag) {
516 # yyerror(@1, "sorry: Unpacked structs not supported.");
521 def p_data_type_4(p
):
522 '''data_type : enum_data_type '''
523 print('data_type_4', list(p
))
526 def p_data_type_5(p
):
527 '''data_type : atom2_type signed_unsigned_opt '''
528 print('data_type_5', list(p
))
529 # { atom2_type_t*tmp = new atom2_type_t($1, $2);
530 # FILE_NAME(tmp, @1);
534 def p_data_type_6(p
):
535 '''data_type : K_integer signed_unsigned_opt '''
536 print('data_type_6', list(p
))
537 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
538 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, $2, pd);
539 # tmp->reg_flag = true;
540 # tmp->integer_flag = true;
544 def p_data_type_7(p
):
545 '''data_type : K_time '''
546 print('data_type_7', list(p
))
547 # { list<pform_range_t>*pd = make_range_from_width(64);
548 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
549 # tmp->reg_flag = !gn_system_verilog();
553 def p_data_type_8(p
):
554 '''data_type : TYPE_IDENTIFIER dimensions_opt '''
555 print('data_type_8', list(p
))
557 # parray_type_t*tmp = new parray_type_t($1.type, $2);
558 # FILE_NAME(tmp, @1);
560 # } else $$ = $1.type;
564 def p_data_type_9(p
):
565 '''data_type : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_data_type TYPE_IDENTIFIER '''
566 print('data_type_9', list(p
))
567 # { lex_in_package_scope(0);
572 def p_data_type_10(p
):
573 '''data_type : K_string '''
574 print('data_type_10', list(p
))
575 # { string_type_t*tmp = new string_type_t;
576 # FILE_NAME(tmp, @1);
580 def p__embed0_data_type(p
):
581 '''_embed0_data_type : '''
582 # { lex_in_package_scope($1); }
584 def p_data_type_or_implicit_1(p
):
585 '''data_type_or_implicit : data_type '''
586 print('data_type_or_implicit_1', list(p
))
589 def p_data_type_or_implicit_2(p
):
590 '''data_type_or_implicit : signing dimensions_opt '''
591 print('data_type_or_implicit_2', list(p
))
592 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, $1, $2);
593 # tmp->implicit_flag = true;
594 # FILE_NAME(tmp, @1);
598 def p_data_type_or_implicit_3(p
):
599 '''data_type_or_implicit : dimensions '''
600 print('data_type_or_implicit_3', list(p
))
601 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, $1);
602 # tmp->implicit_flag = true;
603 # FILE_NAME(tmp, @1);
607 def p_data_type_or_implicit_4(p
):
608 '''data_type_or_implicit : '''
609 print('data_type_or_implicit_4', list(p
))
612 def p_data_type_or_implicit_or_void_1(p
):
613 '''data_type_or_implicit_or_void : data_type_or_implicit '''
614 print('data_type_or_implicit_or_void_1', list(p
))
617 def p_data_type_or_implicit_or_void_2(p
):
618 '''data_type_or_implicit_or_void : K_void '''
619 print('data_type_or_implicit_or_void_2', list(p
))
620 # { void_type_t*tmp = new void_type_t;
621 # FILE_NAME(tmp, @1);
625 def p_description_1(p
):
626 '''description : module '''
627 print('description_1', list(p
))
629 def p_description_2(p
):
630 '''description : udp_primitive '''
631 print('description_2', list(p
))
633 def p_description_3(p
):
634 '''description : config_declaration '''
635 print('description_3', list(p
))
637 def p_description_4(p
):
638 '''description : nature_declaration '''
639 print('description_4', list(p
))
641 def p_description_5(p
):
642 '''description : package_declaration '''
643 print('description_5', list(p
))
645 def p_description_6(p
):
646 '''description : discipline_declaration '''
647 print('description_6', list(p
))
649 def p_description_7(p
):
650 '''description : package_item '''
651 print('description_7', list(p
))
653 def p_description_8(p
):
654 '''description : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' '''
655 print('description_8', list(p
))
656 # { perm_string tmp3 = lex_strings.make($3);
657 # pform_set_type_attrib(tmp3, $5, $7);
662 def p_description_list_1(p
):
663 '''description_list : description '''
664 print('description_list_1', list(p
))
666 def p_description_list_2(p
):
667 '''description_list : description_list description '''
668 print('description_list_2', list(p
))
670 def p_endnew_opt_1(p
):
671 '''endnew_opt : ':' K_new '''
672 print('endnew_opt_1', list(p
))
674 def p_endnew_opt_2(p
):
676 print('endnew_opt_2', list(p
))
678 def p_dynamic_array_new_1(p
):
679 '''dynamic_array_new : K_new '[' expression ']' '''
680 print('dynamic_array_new_1', list(p
))
681 # { $$ = new PENewArray($3, 0);
685 def p_dynamic_array_new_2(p
):
686 '''dynamic_array_new : K_new '[' expression ']' '(' expression ')' '''
687 print('dynamic_array_new_2', list(p
))
688 # { $$ = new PENewArray($3, $6);
693 '''for_step : lpvalue '=' expression '''
694 print('for_step_1', list(p
))
695 # { PAssign*tmp = new PAssign($1,$3);
696 # FILE_NAME(tmp, @1);
701 '''for_step : inc_or_dec_expression '''
702 print('for_step_2', list(p
))
703 # { $$ = pform_compressed_assign_from_inc_dec(@1, $1); }
706 '''for_step : compressed_statement '''
707 print('for_step_3', list(p
))
710 def p_function_declaration_1(p
):
711 '''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 '''
712 print('function_declaration_1', list(p
))
713 # { // Last step: check any closing name.
715 # if (strcmp($4,$11) != 0) {
716 # yyerror(@11, "error: End label doesn't match "
719 # if (! gn_system_verilog()) {
720 # yyerror(@11, "error: Function end labels require "
728 def p_function_declaration_2(p
):
729 '''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 '''
730 print('function_declaration_2', list(p
))
731 # { // Last step: check any closing name.
733 # if (strcmp($4,$14) != 0) {
734 # yyerror(@14, "error: End label doesn't match "
737 # if (! gn_system_verilog()) {
738 # yyerror(@14, "error: Function end labels require "
746 def p_function_declaration_3(p
):
747 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER error K_endfunction _embed4_function_declaration endlabel_opt '''
748 print('function_declaration_3', list(p
))
749 # { // Last step: check any closing name.
751 # if (strcmp($4,$8) != 0) {
752 # yyerror(@8, "error: End label doesn't match function name");
754 # if (! gn_system_verilog()) {
755 # yyerror(@8, "error: Function end labels require "
763 def p__embed0_function_declaration(p
):
764 '''_embed0_function_declaration : '''
765 # { assert(current_function == 0);
766 # current_function = pform_push_function_scope(@1, $4, $2);
769 def p__embed1_function_declaration(p
):
770 '''_embed1_function_declaration : '''
771 # { current_function->set_ports($7);
772 # current_function->set_return($3);
773 # current_function_set_statement($8? @8 : @4, $8);
774 # pform_set_this_class(@4, current_function);
776 # current_function = 0;
779 def p__embed2_function_declaration(p
):
780 '''_embed2_function_declaration : '''
781 # { assert(current_function == 0);
782 # current_function = pform_push_function_scope(@1, $4, $2);
785 def p__embed3_function_declaration(p
):
786 '''_embed3_function_declaration : '''
787 # { current_function->set_ports($7);
788 # current_function->set_return($3);
789 # current_function_set_statement($11? @11 : @4, $11);
790 # pform_set_this_class(@4, current_function);
792 # current_function = 0;
793 # if ($7==0 && !gn_system_verilog()) {
794 # yyerror(@4, "error: Empty parenthesis syntax requires SystemVerilog.");
798 def p__embed4_function_declaration(p
):
799 '''_embed4_function_declaration : '''
801 # if (current_function) {
803 # current_function = 0;
805 # assert(current_function == 0);
806 # yyerror(@1, "error: Syntax error defining function.");
810 def p_import_export_1(p
):
811 '''import_export : K_import '''
812 print('import_export_1', list(p
))
815 def p_import_export_2(p
):
816 '''import_export : K_export '''
817 print('import_export_2', list(p
))
820 def p_implicit_class_handle_1(p
):
821 '''implicit_class_handle : K_this '''
822 print('implicit_class_handle_1', list(p
))
823 # { $$ = pform_create_this(); }
825 def p_implicit_class_handle_2(p
):
826 '''implicit_class_handle : K_super '''
827 print('implicit_class_handle_2', list(p
))
828 # { $$ = pform_create_super(); }
830 def p_inc_or_dec_expression_1(p
):
831 '''inc_or_dec_expression : K_INCR lpvalue %prec UNARY_PREC '''
832 print('inc_or_dec_expression_1', list(p
))
833 # { PEUnary*tmp = new PEUnary('I', $2);
834 # FILE_NAME(tmp, @2);
838 def p_inc_or_dec_expression_2(p
):
839 '''inc_or_dec_expression : lpvalue K_INCR %prec UNARY_PREC '''
840 print('inc_or_dec_expression_2', list(p
))
841 # { PEUnary*tmp = new PEUnary('i', $1);
842 # FILE_NAME(tmp, @1);
846 def p_inc_or_dec_expression_3(p
):
847 '''inc_or_dec_expression : K_DECR lpvalue %prec UNARY_PREC '''
848 print('inc_or_dec_expression_3', list(p
))
849 # { PEUnary*tmp = new PEUnary('D', $2);
850 # FILE_NAME(tmp, @2);
854 def p_inc_or_dec_expression_4(p
):
855 '''inc_or_dec_expression : lpvalue K_DECR %prec UNARY_PREC '''
856 print('inc_or_dec_expression_4', list(p
))
857 # { PEUnary*tmp = new PEUnary('d', $1);
858 # FILE_NAME(tmp, @1);
862 def p_inside_expression_1(p
):
863 '''inside_expression : expression K_inside '{' open_range_list '}' '''
864 print('inside_expression_1', list(p
))
865 # { yyerror(@2, "sorry: \"inside\" expressions not supported yet.");
869 def p_integer_vector_type_1(p
):
870 '''integer_vector_type : K_reg '''
871 print('integer_vector_type_1', list(p
))
872 # { $$ = IVL_VT_NO_TYPE; }
874 def p_integer_vector_type_2(p
):
875 '''integer_vector_type : K_bit '''
876 print('integer_vector_type_2', list(p
))
877 # { $$ = IVL_VT_BOOL; }
879 def p_integer_vector_type_3(p
):
880 '''integer_vector_type : K_logic '''
881 print('integer_vector_type_3', list(p
))
882 # { $$ = IVL_VT_LOGIC; }
884 def p_integer_vector_type_4(p
):
885 '''integer_vector_type : K_bool '''
886 print('integer_vector_type_4', list(p
))
887 # { $$ = IVL_VT_BOOL; }
889 def p_join_keyword_1(p
):
890 '''join_keyword : K_join '''
891 print('join_keyword_1', list(p
))
892 # { $$ = PBlock::BL_PAR; }
894 def p_join_keyword_2(p
):
895 '''join_keyword : K_join_none '''
896 print('join_keyword_2', list(p
))
897 # { $$ = PBlock::BL_JOIN_NONE; }
899 def p_join_keyword_3(p
):
900 '''join_keyword : K_join_any '''
901 print('join_keyword_3', list(p
))
902 # { $$ = PBlock::BL_JOIN_ANY; }
904 def p_jump_statement_1(p
):
905 '''jump_statement : K_break ';' '''
906 print('jump_statement_1', list(p
))
907 # { yyerror(@1, "sorry: break statements not supported.");
911 def p_jump_statement_2(p
):
912 '''jump_statement : K_return ';' '''
913 print('jump_statement_2', list(p
))
914 # { PReturn*tmp = new PReturn(0);
915 # FILE_NAME(tmp, @1);
919 def p_jump_statement_3(p
):
920 '''jump_statement : K_return expression ';' '''
921 print('jump_statement_3', list(p
))
922 # { PReturn*tmp = new PReturn($2);
923 # FILE_NAME(tmp, @1);
928 '''lifetime : K_automatic '''
929 print('lifetime_1', list(p
))
930 # { $$ = LexicalScope::AUTOMATIC; }
933 '''lifetime : K_static '''
934 print('lifetime_2', list(p
))
935 # { $$ = LexicalScope::STATIC; }
937 def p_lifetime_opt_1(p
):
938 '''lifetime_opt : lifetime '''
939 print('lifetime_opt_1', list(p
))
942 def p_lifetime_opt_2(p
):
943 '''lifetime_opt : '''
944 print('lifetime_opt_2', list(p
))
945 # { $$ = LexicalScope::INHERITED; }
947 def p_loop_statement_1(p
):
948 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' for_step ')' statement_or_null '''
949 print('loop_statement_1', list(p
))
950 # { PForStatement*tmp = new PForStatement($3, $5, $7, $9, $11);
951 # FILE_NAME(tmp, @1);
955 def p_loop_statement_2(p
):
956 '''loop_statement : K_for '(' data_type IDENTIFIER '=' expression ';' expression ';' for_step ')' _embed0_loop_statement statement_or_null '''
957 print('loop_statement_2', list(p
))
958 # { pform_name_t tmp_hident;
959 # tmp_hident.push_back(name_component_t(lex_strings.make($4)));
961 # PEIdent*tmp_ident = pform_new_ident(tmp_hident);
962 # FILE_NAME(tmp_ident, @4);
964 # PForStatement*tmp_for = new PForStatement(tmp_ident, $6, $8, $10, $13);
965 # FILE_NAME(tmp_for, @1);
968 # vector<Statement*>tmp_for_list (1);
969 # tmp_for_list[0] = tmp_for;
970 # PBlock*tmp_blk = current_block_stack.top();
971 # current_block_stack.pop();
972 # tmp_blk->set_statement(tmp_for_list);
977 def p_loop_statement_3(p
):
978 '''loop_statement : K_forever statement_or_null '''
979 print('loop_statement_3', list(p
))
980 # { PForever*tmp = new PForever($2);
981 # FILE_NAME(tmp, @1);
985 def p_loop_statement_4(p
):
986 '''loop_statement : K_repeat '(' expression ')' statement_or_null '''
987 print('loop_statement_4', list(p
))
988 # { PRepeat*tmp = new PRepeat($3, $5);
989 # FILE_NAME(tmp, @1);
993 def p_loop_statement_5(p
):
994 '''loop_statement : K_while '(' expression ')' statement_or_null '''
995 print('loop_statement_5', list(p
))
996 # { PWhile*tmp = new PWhile($3, $5);
997 # FILE_NAME(tmp, @1);
1001 def p_loop_statement_6(p
):
1002 '''loop_statement : K_do statement_or_null K_while '(' expression ')' ';' '''
1003 print('loop_statement_6', list(p
))
1004 # { PDoWhile*tmp = new PDoWhile($5, $2);
1005 # FILE_NAME(tmp, @1);
1009 def p_loop_statement_7(p
):
1010 '''loop_statement : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' _embed1_loop_statement statement_or_null '''
1011 print('loop_statement_7', list(p
))
1012 # { PForeach*tmp_for = pform_make_foreach(@1, $3, $5, $9);
1014 # pform_pop_scope();
1015 # vector<Statement*>tmp_for_list(1);
1016 # tmp_for_list[0] = tmp_for;
1017 # PBlock*tmp_blk = current_block_stack.top();
1018 # current_block_stack.pop();
1019 # tmp_blk->set_statement(tmp_for_list);
1023 def p_loop_statement_8(p
):
1024 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' error ')' statement_or_null '''
1025 print('loop_statement_8', list(p
))
1027 # yyerror(@1, "error: Error in for loop step assignment.");
1030 def p_loop_statement_9(p
):
1031 '''loop_statement : K_for '(' lpvalue '=' expression ';' error ';' for_step ')' statement_or_null '''
1032 print('loop_statement_9', list(p
))
1034 # yyerror(@1, "error: Error in for loop condition expression.");
1037 def p_loop_statement_10(p
):
1038 '''loop_statement : K_for '(' error ')' statement_or_null '''
1039 print('loop_statement_10', list(p
))
1041 # yyerror(@1, "error: Incomprehensible for loop.");
1044 def p_loop_statement_11(p
):
1045 '''loop_statement : K_while '(' error ')' statement_or_null '''
1046 print('loop_statement_11', list(p
))
1048 # yyerror(@1, "error: Error in while loop condition.");
1051 def p_loop_statement_12(p
):
1052 '''loop_statement : K_do statement_or_null K_while '(' error ')' ';' '''
1053 print('loop_statement_12', list(p
))
1055 # yyerror(@1, "error: Error in do/while loop condition.");
1058 def p_loop_statement_13(p
):
1059 '''loop_statement : K_foreach '(' IDENTIFIER '[' error ']' ')' statement_or_null '''
1060 print('loop_statement_13', list(p
))
1062 # yyerror(@4, "error: Errors in foreach loop variables list.");
1065 def p__embed0_loop_statement(p
):
1066 '''_embed0_loop_statement : '''
1067 # { static unsigned for_counter = 0;
1068 # char for_block_name [64];
1069 # snprintf(for_block_name, sizeof for_block_name, "$ivl_for_loop%u", for_counter);
1071 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1072 # FILE_NAME(tmp, @1);
1073 # current_block_stack.push(tmp);
1075 # list<decl_assignment_t*>assign_list;
1076 # decl_assignment_t*tmp_assign = new decl_assignment_t;
1077 # tmp_assign->name = lex_strings.make($4);
1078 # assign_list.push_back(tmp_assign);
1079 # pform_makewire(@4, 0, str_strength, &assign_list, NetNet::REG, $3);
1082 def p__embed1_loop_statement(p
):
1083 '''_embed1_loop_statement : '''
1084 # { static unsigned foreach_counter = 0;
1085 # char for_block_name[64];
1086 # snprintf(for_block_name, sizeof for_block_name, "$ivl_foreach%u", foreach_counter);
1087 # foreach_counter += 1;
1089 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1090 # FILE_NAME(tmp, @1);
1091 # current_block_stack.push(tmp);
1093 # pform_make_foreach_declarations(@1, $5);
1096 def p_list_of_variable_decl_assignments_1(p
):
1097 '''list_of_variable_decl_assignments : variable_decl_assignment '''
1098 print('list_of_variable_decl_assignments_1', list(p
))
1099 # { list<decl_assignment_t*>*tmp = new list<decl_assignment_t*>;
1100 # tmp->push_back($1);
1104 def p_list_of_variable_decl_assignments_2(p
):
1105 '''list_of_variable_decl_assignments : list_of_variable_decl_assignments ',' variable_decl_assignment '''
1106 print('list_of_variable_decl_assignments_2', list(p
))
1107 # { list<decl_assignment_t*>*tmp = $1;
1108 # tmp->push_back($3);
1112 def p_variable_decl_assignment_1(p
):
1113 '''variable_decl_assignment : IDENTIFIER dimensions_opt '''
1114 print('variable_decl_assignment_1', list(p
))
1115 # { decl_assignment_t*tmp = new decl_assignment_t;
1116 # tmp->name = lex_strings.make($1);
1125 def p_variable_decl_assignment_2(p
):
1126 '''variable_decl_assignment : IDENTIFIER '=' expression '''
1127 print('variable_decl_assignment_2', list(p
))
1128 # { decl_assignment_t*tmp = new decl_assignment_t;
1129 # tmp->name = lex_strings.make($1);
1130 # tmp->expr .reset($3);
1135 def p_variable_decl_assignment_3(p
):
1136 '''variable_decl_assignment : IDENTIFIER '=' K_new '(' ')' '''
1137 print('variable_decl_assignment_3', list(p
))
1138 # { decl_assignment_t*tmp = new decl_assignment_t;
1139 # tmp->name = lex_strings.make($1);
1140 # PENewClass*expr = new PENewClass;
1141 # FILE_NAME(expr, @3);
1142 # tmp->expr .reset(expr);
1147 def p_loop_variables_1(p
):
1148 '''loop_variables : loop_variables ',' IDENTIFIER '''
1149 print('loop_variables_1', list(p
))
1150 # { list<perm_string>*tmp = $1;
1151 # tmp->push_back(lex_strings.make($3));
1156 def p_loop_variables_2(p
):
1157 '''loop_variables : IDENTIFIER '''
1158 print('loop_variables_2', list(p
))
1159 # { list<perm_string>*tmp = new list<perm_string>;
1160 # tmp->push_back(lex_strings.make($1));
1165 def p_method_qualifier_1(p
):
1166 '''method_qualifier : K_virtual '''
1167 print('method_qualifier_1', list(p
))
1169 def p_method_qualifier_2(p
):
1170 '''method_qualifier : class_item_qualifier '''
1171 print('method_qualifier_2', list(p
))
1173 def p_method_qualifier_opt_1(p
):
1174 '''method_qualifier_opt : method_qualifier '''
1175 print('method_qualifier_opt_1', list(p
))
1177 def p_method_qualifier_opt_2(p
):
1178 '''method_qualifier_opt : '''
1179 print('method_qualifier_opt_2', list(p
))
1181 def p_modport_declaration_1(p
):
1182 '''modport_declaration : K_modport _embed0_modport_declaration modport_item_list ';' '''
1183 print('modport_declaration_1', list(p
))
1185 def p__embed0_modport_declaration(p
):
1186 '''_embed0_modport_declaration : '''
1187 # { if (!pform_in_interface())
1188 # yyerror(@1, "error: modport declarations are only allowed "
1189 # "in interfaces.");
1192 def p_modport_item_list_1(p
):
1193 '''modport_item_list : modport_item '''
1194 print('modport_item_list_1', list(p
))
1196 def p_modport_item_list_2(p
):
1197 '''modport_item_list : modport_item_list ',' modport_item '''
1198 print('modport_item_list_2', list(p
))
1200 def p_modport_item_1(p
):
1201 '''modport_item : IDENTIFIER _embed0_modport_item '(' modport_ports_list ')' '''
1202 print('modport_item_1', list(p
))
1203 # { pform_end_modport_item(@1); }
1205 def p__embed0_modport_item(p
):
1206 '''_embed0_modport_item : '''
1207 # { pform_start_modport_item(@1, $1); }
1209 def p_modport_ports_list_1(p
):
1210 '''modport_ports_list : modport_ports_declaration '''
1211 print('modport_ports_list_1', list(p
))
1213 def p_modport_ports_list_2(p
):
1214 '''modport_ports_list : modport_ports_list ',' modport_ports_declaration '''
1215 print('modport_ports_list_2', list(p
))
1217 def p_modport_ports_list_3(p
):
1218 '''modport_ports_list : modport_ports_list ',' modport_simple_port '''
1219 print('modport_ports_list_3', list(p
))
1220 # { if (last_modport_port.type == MP_SIMPLE) {
1221 # pform_add_modport_port(@3, last_modport_port.direction,
1222 # $3->name, $3->parm);
1224 # yyerror(@3, "error: modport expression not allowed here.");
1229 def p_modport_ports_list_4(p
):
1230 '''modport_ports_list : modport_ports_list ',' modport_tf_port '''
1231 print('modport_ports_list_4', list(p
))
1232 # { if (last_modport_port.type != MP_TF)
1233 # yyerror(@3, "error: task/function declaration not allowed here.");
1236 def p_modport_ports_list_5(p
):
1237 '''modport_ports_list : modport_ports_list ',' IDENTIFIER '''
1238 print('modport_ports_list_5', list(p
))
1239 # { if (last_modport_port.type == MP_SIMPLE) {
1240 # pform_add_modport_port(@3, last_modport_port.direction,
1241 # lex_strings.make($3), 0);
1242 # } else if (last_modport_port.type != MP_TF) {
1243 # yyerror(@3, "error: list of identifiers not allowed here.");
1248 def p_modport_ports_list_6(p
):
1249 '''modport_ports_list : modport_ports_list ',' '''
1250 print('modport_ports_list_6', list(p
))
1251 # { yyerror(@2, "error: NULL port declarations are not allowed"); }
1253 def p_modport_ports_declaration_1(p
):
1254 '''modport_ports_declaration : attribute_list_opt port_direction IDENTIFIER '''
1255 print('modport_ports_declaration_1', list(p
))
1256 # { last_modport_port.type = MP_SIMPLE;
1257 # last_modport_port.direction = $2;
1258 # pform_add_modport_port(@3, $2, lex_strings.make($3), 0);
1263 def p_modport_ports_declaration_2(p
):
1264 '''modport_ports_declaration : attribute_list_opt port_direction modport_simple_port '''
1265 print('modport_ports_declaration_2', list(p
))
1266 # { last_modport_port.type = MP_SIMPLE;
1267 # last_modport_port.direction = $2;
1268 # pform_add_modport_port(@3, $2, $3->name, $3->parm);
1273 def p_modport_ports_declaration_3(p
):
1274 '''modport_ports_declaration : attribute_list_opt import_export IDENTIFIER '''
1275 print('modport_ports_declaration_3', list(p
))
1276 # { last_modport_port.type = MP_TF;
1277 # last_modport_port.is_import = $2;
1278 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
1283 def p_modport_ports_declaration_4(p
):
1284 '''modport_ports_declaration : attribute_list_opt import_export modport_tf_port '''
1285 print('modport_ports_declaration_4', list(p
))
1286 # { last_modport_port.type = MP_TF;
1287 # last_modport_port.is_import = $2;
1288 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
1292 def p_modport_ports_declaration_5(p
):
1293 '''modport_ports_declaration : attribute_list_opt K_clocking IDENTIFIER '''
1294 print('modport_ports_declaration_5', list(p
))
1295 # { last_modport_port.type = MP_CLOCKING;
1296 # last_modport_port.direction = NetNet::NOT_A_PORT;
1297 # yyerror(@3, "sorry: modport clocking declaration is not yet supported.");
1302 def p_modport_simple_port_1(p
):
1303 '''modport_simple_port : '.' IDENTIFIER '(' expression ')' '''
1304 print('modport_simple_port_1', list(p
))
1305 # { named_pexpr_t*tmp = new named_pexpr_t;
1306 # tmp->name = lex_strings.make($2);
1312 def p_modport_tf_port_1(p
):
1313 '''modport_tf_port : K_task IDENTIFIER '''
1314 print('modport_tf_port_1', list(p
))
1316 def p_modport_tf_port_2(p
):
1317 '''modport_tf_port : K_task IDENTIFIER '(' tf_port_list_opt ')' '''
1318 print('modport_tf_port_2', list(p
))
1320 def p_modport_tf_port_3(p
):
1321 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '''
1322 print('modport_tf_port_3', list(p
))
1324 def p_modport_tf_port_4(p
):
1325 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' '''
1326 print('modport_tf_port_4', list(p
))
1328 def p_non_integer_type_1(p
):
1329 '''non_integer_type : K_real '''
1330 print('non_integer_type_1', list(p
))
1331 # { $$ = real_type_t::REAL; }
1333 def p_non_integer_type_2(p
):
1334 '''non_integer_type : K_realtime '''
1335 print('non_integer_type_2', list(p
))
1336 # { $$ = real_type_t::REAL; }
1338 def p_non_integer_type_3(p
):
1339 '''non_integer_type : K_shortreal '''
1340 print('non_integer_type_3', list(p
))
1341 # { $$ = real_type_t::SHORTREAL; }
1344 '''number : BASED_NUMBER '''
1345 print('number_1', list(p
))
1346 # { $$ = $1; based_size = 0;}
1349 '''number : DEC_NUMBER '''
1350 print('number_2', list(p
))
1351 # { $$ = $1; based_size = 0;}
1354 '''number : DEC_NUMBER BASED_NUMBER '''
1355 print('number_3', list(p
))
1356 num
= Leaf(token
.NUMBER
, "%s:%s" % (p
[1], p
[2]))
1358 # { $$ = pform_verinum_with_size($1,$2, @2.text, @2.first_line);
1362 '''number : UNBASED_NUMBER '''
1363 print('number_4', list(p
))
1364 # { $$ = $1; based_size = 0;}
1367 '''number : DEC_NUMBER UNBASED_NUMBER '''
1368 print('number_5', list(p
))
1369 # { yyerror(@1, "error: Unbased SystemVerilog literal cannot have "
1371 # $$ = $1; based_size = 0;}
1373 def p_open_range_list_1(p
):
1374 '''open_range_list : open_range_list ',' value_range '''
1375 print('open_range_list_1', list(p
))
1377 def p_open_range_list_2(p
):
1378 '''open_range_list : value_range '''
1379 print('open_range_list_2', list(p
))
1381 def p_package_declaration_1(p
):
1382 '''package_declaration : K_package lifetime_opt IDENTIFIER ';' _embed0_package_declaration timeunits_declaration_opt _embed1_package_declaration package_item_list_opt K_endpackage endlabel_opt '''
1383 print('package_declaration_1', list(p
))
1384 # { pform_end_package_declaration(@1);
1385 # // If an end label is present make sure it match the package name.
1387 # if (strcmp($3,$10) != 0) {
1388 # yyerror(@10, "error: End label doesn't match package name");
1395 def p__embed0_package_declaration(p
):
1396 '''_embed0_package_declaration : '''
1397 # { pform_start_package_declaration(@1, $3, $2); }
1399 def p__embed1_package_declaration(p
):
1400 '''_embed1_package_declaration : '''
1401 # { pform_set_scope_timescale(@1); }
1403 def p_module_package_import_list_opt_1(p
):
1404 '''module_package_import_list_opt : '''
1405 print('module_package_import_list_opt_1', list(p
))
1407 def p_module_package_import_list_opt_2(p
):
1408 '''module_package_import_list_opt : package_import_list '''
1409 print('module_package_import_list_opt_2', list(p
))
1411 def p_package_import_list_1(p
):
1412 '''package_import_list : package_import_declaration '''
1413 print('package_import_list_1', list(p
))
1415 def p_package_import_list_2(p
):
1416 '''package_import_list : package_import_list package_import_declaration '''
1417 print('package_import_list_2', list(p
))
1419 def p_package_import_declaration_1(p
):
1420 '''package_import_declaration : K_import package_import_item_list ';' '''
1421 print('package_import_declaration_1', list(p
))
1424 def p_package_import_item_1(p
):
1425 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '''
1426 print('package_import_item_1', list(p
))
1427 # { pform_package_import(@2, $1, $3);
1431 def p_package_import_item_2(p
):
1432 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES '*' '''
1433 print('package_import_item_2', list(p
))
1434 # { pform_package_import(@2, $1, 0);
1437 def p_package_import_item_list_1(p
):
1438 '''package_import_item_list : package_import_item_list ',' package_import_item '''
1439 print('package_import_item_list_1', list(p
))
1441 def p_package_import_item_list_2(p
):
1442 '''package_import_item_list : package_import_item '''
1443 print('package_import_item_list_2', list(p
))
1445 def p_package_item_1(p
):
1446 '''package_item : timeunits_declaration '''
1447 print('package_item_1', list(p
))
1449 def p_package_item_2(p
):
1450 '''package_item : K_parameter param_type parameter_assign_list ';' '''
1451 print('package_item_2', list(p
))
1453 def p_package_item_3(p
):
1454 '''package_item : K_localparam param_type localparam_assign_list ';' '''
1455 print('package_item_3', list(p
))
1457 def p_package_item_4(p
):
1458 '''package_item : type_declaration '''
1459 print('package_item_4', list(p
))
1461 def p_package_item_5(p
):
1462 '''package_item : function_declaration '''
1463 print('package_item_5', list(p
))
1465 def p_package_item_6(p
):
1466 '''package_item : task_declaration '''
1467 print('package_item_6', list(p
))
1469 def p_package_item_7(p
):
1470 '''package_item : data_declaration '''
1471 print('package_item_7', list(p
))
1473 def p_package_item_8(p
):
1474 '''package_item : class_declaration '''
1475 print('package_item_8', list(p
))
1477 def p_package_item_list_1(p
):
1478 '''package_item_list : package_item_list package_item '''
1479 print('package_item_list_1', list(p
))
1481 def p_package_item_list_2(p
):
1482 '''package_item_list : package_item '''
1483 print('package_item_list_2', list(p
))
1485 def p_package_item_list_opt_1(p
):
1486 '''package_item_list_opt : package_item_list '''
1487 print('package_item_list_opt_1', list(p
))
1489 def p_package_item_list_opt_2(p
):
1490 '''package_item_list_opt : '''
1491 print('package_item_list_opt_2', list(p
))
1493 def p_port_direction_1(p
):
1494 '''port_direction : K_input '''
1495 print('port_direction_1', list(p
))
1496 # { $$ = NetNet::PINPUT; }
1498 def p_port_direction_2(p
):
1499 '''port_direction : K_output '''
1500 print('port_direction_2', list(p
))
1501 # { $$ = NetNet::POUTPUT; }
1503 def p_port_direction_3(p
):
1504 '''port_direction : K_inout '''
1505 print('port_direction_3', list(p
))
1506 # { $$ = NetNet::PINOUT; }
1508 def p_port_direction_4(p
):
1509 '''port_direction : K_ref '''
1510 print('port_direction_4', list(p
))
1511 # { $$ = NetNet::PREF;
1512 # if (!gn_system_verilog()) {
1513 # yyerror(@1, "error: Reference ports (ref) require SystemVerilog.");
1514 # $$ = NetNet::PINPUT;
1518 def p_port_direction_opt_1(p
):
1519 '''port_direction_opt : port_direction '''
1520 print('port_direction_opt_1', list(p
))
1523 def p_port_direction_opt_2(p
):
1524 '''port_direction_opt : '''
1525 print('port_direction_opt_2', list(p
))
1526 # { $$ = NetNet::PIMPLICIT; }
1528 def p_property_expr_1(p
):
1529 '''property_expr : expression '''
1530 print('property_expr_1', list(p
))
1532 def p_procedural_assertion_statement_1(p
):
1533 '''procedural_assertion_statement : K_assert '(' expression ')' statement %prec less_than_K_else '''
1534 print('procedural_assertion_statement_1', list(p
))
1535 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1539 def p_procedural_assertion_statement_2(p
):
1540 '''procedural_assertion_statement : K_assert '(' expression ')' K_else statement '''
1541 print('procedural_assertion_statement_2', list(p
))
1542 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1546 def p_procedural_assertion_statement_3(p
):
1547 '''procedural_assertion_statement : K_assert '(' expression ')' statement K_else statement '''
1548 print('procedural_assertion_statement_3', list(p
))
1549 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1553 def p_property_qualifier_1(p
):
1554 '''property_qualifier : class_item_qualifier '''
1555 print('property_qualifier_1', list(p
))
1557 def p_property_qualifier_2(p
):
1558 '''property_qualifier : random_qualifier '''
1559 print('property_qualifier_2', list(p
))
1561 def p_property_qualifier_opt_1(p
):
1562 '''property_qualifier_opt : property_qualifier_list '''
1563 print('property_qualifier_opt_1', list(p
))
1566 def p_property_qualifier_opt_2(p
):
1567 '''property_qualifier_opt : '''
1568 print('property_qualifier_opt_2', list(p
))
1569 # { $$ = property_qualifier_t::make_none(); }
1571 def p_property_qualifier_list_1(p
):
1572 '''property_qualifier_list : property_qualifier_list property_qualifier '''
1573 print('property_qualifier_list_1', list(p
))
1576 def p_property_qualifier_list_2(p
):
1577 '''property_qualifier_list : property_qualifier '''
1578 print('property_qualifier_list_2', list(p
))
1581 def p_property_spec_1(p
):
1582 '''property_spec : clocking_event_opt property_spec_disable_iff_opt property_expr '''
1583 print('property_spec_1', list(p
))
1585 def p_property_spec_disable_iff_opt_1(p
):
1586 '''property_spec_disable_iff_opt : K_disable K_iff '(' expression ')' '''
1587 print('property_spec_disable_iff_opt_1', list(p
))
1589 def p_property_spec_disable_iff_opt_2(p
):
1590 '''property_spec_disable_iff_opt : '''
1591 print('property_spec_disable_iff_opt_2', list(p
))
1593 def p_random_qualifier_1(p
):
1594 '''random_qualifier : K_rand '''
1595 print('random_qualifier_1', list(p
))
1596 # { $$ = property_qualifier_t::make_rand(); }
1598 def p_random_qualifier_2(p
):
1599 '''random_qualifier : K_randc '''
1600 print('random_qualifier_2', list(p
))
1601 # { $$ = property_qualifier_t::make_randc(); }
1603 def p_real_or_realtime_1(p
):
1604 '''real_or_realtime : K_real '''
1605 print('real_or_realtime_1', list(p
))
1607 def p_real_or_realtime_2(p
):
1608 '''real_or_realtime : K_realtime '''
1609 print('real_or_realtime_2', list(p
))
1612 '''signing : K_signed '''
1613 print('signing_1', list(p
))
1617 '''signing : K_unsigned '''
1618 print('signing_2', list(p
))
1621 def p_simple_type_or_string_1(p
):
1622 '''simple_type_or_string : integer_vector_type '''
1623 print('simple_type_or_string_1', list(p
))
1624 # { ivl_variable_type_t use_vtype = $1;
1625 # bool reg_flag = false;
1626 # if (use_vtype == IVL_VT_NO_TYPE) {
1627 # use_vtype = IVL_VT_LOGIC;
1630 # vector_type_t*tmp = new vector_type_t(use_vtype, false, 0);
1631 # tmp->reg_flag = reg_flag;
1632 # FILE_NAME(tmp, @1);
1636 def p_simple_type_or_string_2(p
):
1637 '''simple_type_or_string : non_integer_type '''
1638 print('simple_type_or_string_2', list(p
))
1639 # { real_type_t*tmp = new real_type_t($1);
1640 # FILE_NAME(tmp, @1);
1644 def p_simple_type_or_string_3(p
):
1645 '''simple_type_or_string : atom2_type '''
1646 print('simple_type_or_string_3', list(p
))
1647 # { atom2_type_t*tmp = new atom2_type_t($1, true);
1648 # FILE_NAME(tmp, @1);
1652 def p_simple_type_or_string_4(p
):
1653 '''simple_type_or_string : K_integer '''
1654 print('simple_type_or_string_4', list(p
))
1655 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
1656 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd);
1657 # tmp->reg_flag = true;
1658 # tmp->integer_flag = true;
1662 def p_simple_type_or_string_5(p
):
1663 '''simple_type_or_string : K_time '''
1664 print('simple_type_or_string_5', list(p
))
1665 # { list<pform_range_t>*pd = make_range_from_width(64);
1666 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
1667 # tmp->reg_flag = !gn_system_verilog();
1671 def p_simple_type_or_string_6(p
):
1672 '''simple_type_or_string : TYPE_IDENTIFIER '''
1673 print('simple_type_or_string_6', list(p
))
1678 def p_simple_type_or_string_7(p
):
1679 '''simple_type_or_string : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_simple_type_or_string TYPE_IDENTIFIER '''
1680 print('simple_type_or_string_7', list(p
))
1681 # { lex_in_package_scope(0);
1686 def p_simple_type_or_string_8(p
):
1687 '''simple_type_or_string : K_string '''
1688 print('simple_type_or_string_8', list(p
))
1689 # { string_type_t*tmp = new string_type_t;
1690 # FILE_NAME(tmp, @1);
1694 def p__embed0_simple_type_or_string(p
):
1695 '''_embed0_simple_type_or_string : '''
1696 # { lex_in_package_scope($1); }
1698 def p_statement_1(p
):
1699 '''statement : attribute_list_opt statement_item '''
1700 print('statement_1', list(p
))
1701 # { pform_bind_attributes($2->attributes, $1);
1705 def p_statement_or_null_1(p
):
1706 '''statement_or_null : statement '''
1707 print('statement_or_null_1', list(p
))
1710 def p_statement_or_null_2(p
):
1711 '''statement_or_null : attribute_list_opt ';' '''
1712 print('statement_or_null_2', list(p
))
1715 def p_stream_expression_1(p
):
1716 '''stream_expression : expression '''
1717 print('stream_expression_1', list(p
))
1719 def p_stream_expression_list_1(p
):
1720 '''stream_expression_list : stream_expression_list ',' stream_expression '''
1721 print('stream_expression_list_1', list(p
))
1723 def p_stream_expression_list_2(p
):
1724 '''stream_expression_list : stream_expression '''
1725 print('stream_expression_list_2', list(p
))
1727 def p_stream_operator_1(p
):
1728 '''stream_operator : K_LS '''
1729 print('stream_operator_1', list(p
))
1731 def p_stream_operator_2(p
):
1732 '''stream_operator : K_RS '''
1733 print('stream_operator_2', list(p
))
1735 def p_streaming_concatenation_1(p
):
1736 '''streaming_concatenation : '{' stream_operator '{' stream_expression_list '}' '}' '''
1737 print('streaming_concatenation_1', list(p
))
1738 # { /* streaming concatenation is a SystemVerilog thing. */
1739 # if (gn_system_verilog()) {
1740 # yyerror(@2, "sorry: Streaming concatenation not supported.");
1743 # yyerror(@2, "error: Streaming concatenation requires SystemVerilog");
1748 def p_task_declaration_1(p
):
1749 '''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 '''
1750 print('task_declaration_1', list(p
))
1751 # { // Last step: check any closing name. This is done late so
1752 # // that the parser can look ahead to detect the present
1753 # // endlabel_opt but still have the pform_endmodule() called
1754 # // early enough that the lexor can know we are outside the
1757 # if (strcmp($3,$10) != 0) {
1758 # yyerror(@10, "error: End label doesn't match task name");
1760 # if (! gn_system_verilog()) {
1761 # yyerror(@10, "error: Task end labels require "
1762 # "SystemVerilog.");
1769 def p_task_declaration_2(p
):
1770 '''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 '''
1771 print('task_declaration_2', list(p
))
1772 # { // Last step: check any closing name. This is done late so
1773 # // that the parser can look ahead to detect the present
1774 # // endlabel_opt but still have the pform_endmodule() called
1775 # // early enough that the lexor can know we are outside the
1778 # if (strcmp($3,$13) != 0) {
1779 # yyerror(@13, "error: End label doesn't match task name");
1781 # if (! gn_system_verilog()) {
1782 # yyerror(@13, "error: Task end labels require "
1783 # "SystemVerilog.");
1790 def p_task_declaration_3(p
):
1791 '''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 '''
1792 print('task_declaration_3', list(p
))
1793 # { // Last step: check any closing name. This is done late so
1794 # // that the parser can look ahead to detect the present
1795 # // endlabel_opt but still have the pform_endmodule() called
1796 # // early enough that the lexor can know we are outside the
1799 # if (strcmp($3,$12) != 0) {
1800 # yyerror(@12, "error: End label doesn't match task name");
1802 # if (! gn_system_verilog()) {
1803 # yyerror(@12, "error: Task end labels require "
1804 # "SystemVerilog.");
1811 def p_task_declaration_4(p
):
1812 '''task_declaration : K_task lifetime_opt IDENTIFIER error K_endtask _embed6_task_declaration endlabel_opt '''
1813 print('task_declaration_4', list(p
))
1814 # { // Last step: check any closing name. This is done late so
1815 # // that the parser can look ahead to detect the present
1816 # // endlabel_opt but still have the pform_endmodule() called
1817 # // early enough that the lexor can know we are outside the
1820 # if (strcmp($3,$7) != 0) {
1821 # yyerror(@7, "error: End label doesn't match task name");
1823 # if (! gn_system_verilog()) {
1824 # yyerror(@7, "error: Task end labels require "
1825 # "SystemVerilog.");
1832 def p__embed0_task_declaration(p
):
1833 '''_embed0_task_declaration : '''
1834 # { assert(current_task == 0);
1835 # current_task = pform_push_task_scope(@1, $3, $2);
1838 def p__embed1_task_declaration(p
):
1839 '''_embed1_task_declaration : '''
1840 # { current_task->set_ports($6);
1841 # current_task_set_statement(@3, $7);
1842 # pform_set_this_class(@3, current_task);
1843 # pform_pop_scope();
1845 # if ($7 && $7->size() > 1 && !gn_system_verilog()) {
1846 # yyerror(@7, "error: Task body with multiple statements requires SystemVerilog.");
1851 def p__embed2_task_declaration(p
):
1852 '''_embed2_task_declaration : '''
1853 # { assert(current_task == 0);
1854 # current_task = pform_push_task_scope(@1, $3, $2);
1857 def p__embed3_task_declaration(p
):
1858 '''_embed3_task_declaration : '''
1859 # { current_task->set_ports($6);
1860 # current_task_set_statement(@3, $10);
1861 # pform_set_this_class(@3, current_task);
1862 # pform_pop_scope();
1864 # if ($10) delete $10;
1867 def p__embed4_task_declaration(p
):
1868 '''_embed4_task_declaration : '''
1869 # { assert(current_task == 0);
1870 # current_task = pform_push_task_scope(@1, $3, $2);
1873 def p__embed5_task_declaration(p
):
1874 '''_embed5_task_declaration : '''
1875 # { current_task->set_ports(0);
1876 # current_task_set_statement(@3, $9);
1877 # pform_set_this_class(@3, current_task);
1878 # if (! current_task->method_of()) {
1879 # cerr << @3 << ": warning: task definition for \"" << $3
1880 # << "\" has an empty port declaration list!" << endl;
1882 # pform_pop_scope();
1884 # if ($9->size() > 1 && !gn_system_verilog()) {
1885 # yyerror(@9, "error: Task body with multiple statements requires SystemVerilog.");
1890 def p__embed6_task_declaration(p
):
1891 '''_embed6_task_declaration : '''
1893 # if (current_task) {
1894 # pform_pop_scope();
1899 def p_tf_port_declaration_1(p
):
1900 '''tf_port_declaration : port_direction K_reg_opt unsigned_signed_opt dimensions_opt list_of_identifiers ';' '''
1901 print('tf_port_declaration_1', list(p
))
1902 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1,
1903 # $2 ? IVL_VT_LOGIC :
1909 def p_tf_port_declaration_2(p
):
1910 '''tf_port_declaration : port_direction K_integer list_of_identifiers ';' '''
1911 print('tf_port_declaration_2', list(p
))
1912 # { list<pform_range_t>*range_stub = make_range_from_width(integer_width);
1913 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_LOGIC, true,
1914 # range_stub, $3, true);
1918 def p_tf_port_declaration_3(p
):
1919 '''tf_port_declaration : port_direction K_time list_of_identifiers ';' '''
1920 print('tf_port_declaration_3', list(p
))
1921 # { list<pform_range_t>*range_stub = make_range_from_width(64);
1922 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_LOGIC, false,
1927 def p_tf_port_declaration_4(p
):
1928 '''tf_port_declaration : port_direction real_or_realtime list_of_identifiers ';' '''
1929 print('tf_port_declaration_4', list(p
))
1930 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_REAL, true,
1935 def p_tf_port_declaration_5(p
):
1936 '''tf_port_declaration : port_direction K_string list_of_identifiers ';' '''
1937 print('tf_port_declaration_5', list(p
))
1938 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_STRING, true,
1943 def p_tf_port_item_1(p
):
1944 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER dimensions_opt tf_port_item_expr_opt '''
1945 print('tf_port_item_1', list(p
))
1946 # { vector<pform_tf_port_t>*tmp;
1947 # NetNet::PortType use_port_type = $1;
1948 # if ((use_port_type == NetNet::PIMPLICIT) && (gn_system_verilog() || ($2 == 0)))
1949 # use_port_type = port_declaration_context.port_type;
1950 # perm_string name = lex_strings.make($3);
1951 # list<perm_string>* ilist = list_from_identifier($3);
1953 # if (use_port_type == NetNet::PIMPLICIT) {
1954 # yyerror(@1, "error: missing task/function port direction.");
1955 # use_port_type = NetNet::PINPUT; // for error recovery
1957 # if (($2 == 0) && ($1==NetNet::PIMPLICIT)) {
1958 # // Detect special case this is an undecorated
1959 # // identifier and we need to get the declaration from
1962 # yyerror(@4, "internal error: How can there be an unpacked range here?\n");
1964 # tmp = pform_make_task_ports(@3, use_port_type,
1965 # port_declaration_context.data_type,
1969 # // Otherwise, the decorations for this identifier
1970 # // indicate the type. Save the type for any right
1971 # // context that may come later.
1972 # port_declaration_context.port_type = use_port_type;
1974 # $2 = new vector_type_t(IVL_VT_LOGIC, false, 0);
1975 # FILE_NAME($2, @3);
1977 # port_declaration_context.data_type = $2;
1978 # tmp = pform_make_task_ports(@3, use_port_type, $2, ilist);
1981 # pform_set_reg_idx(name, $4);
1986 # assert(tmp->size()==1);
1987 # tmp->front().defe = $5;
1991 def p_tf_port_item_2(p
):
1992 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER error '''
1993 print('tf_port_item_2', list(p
))
1994 # { yyerror(@3, "error: Error in task/function port item after port name %s.", $3);
1999 def p_tf_port_item_expr_opt_1(p
):
2000 '''tf_port_item_expr_opt : '=' expression '''
2001 print('tf_port_item_expr_opt_1', list(p
))
2002 # { if (! gn_system_verilog()) {
2003 # yyerror(@1, "error: Task/function default arguments require "
2004 # "SystemVerilog.");
2009 def p_tf_port_item_expr_opt_2(p
):
2010 '''tf_port_item_expr_opt : '''
2011 print('tf_port_item_expr_opt_2', list(p
))
2014 def p_tf_port_list_1(p
):
2015 '''tf_port_list : _embed0_tf_port_list tf_port_item_list '''
2016 print('tf_port_list_1', list(p
))
2019 def p__embed0_tf_port_list(p
):
2020 '''_embed0_tf_port_list : '''
2021 # { port_declaration_context.port_type = gn_system_verilog() ? NetNet::PINPUT : NetNet::PIMPLICIT;
2022 # port_declaration_context.data_type = 0;
2025 def p_tf_port_item_list_1(p
):
2026 '''tf_port_item_list : tf_port_item_list ',' tf_port_item '''
2027 print('tf_port_item_list_1', list(p
))
2028 # { vector<pform_tf_port_t>*tmp;
2030 # size_t s1 = $1->size();
2032 # tmp->resize(tmp->size()+$3->size());
2033 # for (size_t idx = 0 ; idx < $3->size() ; idx += 1)
2034 # tmp->at(s1+idx) = $3->at(idx);
2044 def p_tf_port_item_list_2(p
):
2045 '''tf_port_item_list : tf_port_item '''
2046 print('tf_port_item_list_2', list(p
))
2049 def p_tf_port_item_list_3(p
):
2050 '''tf_port_item_list : error ',' tf_port_item '''
2051 print('tf_port_item_list_3', list(p
))
2052 # { yyerror(@2, "error: Syntax error in task/function port declaration.");
2056 def p_tf_port_item_list_4(p
):
2057 '''tf_port_item_list : tf_port_item_list ',' '''
2058 print('tf_port_item_list_4', list(p
))
2059 # { yyerror(@2, "error: NULL port declarations are not allowed.");
2063 def p_tf_port_item_list_5(p
):
2064 '''tf_port_item_list : tf_port_item_list ';' '''
2065 print('tf_port_item_list_5', list(p
))
2066 # { yyerror(@2, "error: ';' is an invalid port declaration separator.");
2070 def p_timeunits_declaration_1(p
):
2071 '''timeunits_declaration : K_timeunit TIME_LITERAL ';' '''
2072 print('timeunits_declaration_1', list(p
))
2073 # { pform_set_timeunit($2, allow_timeunit_decl); }
2075 def p_timeunits_declaration_2(p
):
2076 '''timeunits_declaration : K_timeunit TIME_LITERAL '/' TIME_LITERAL ';' '''
2077 print('timeunits_declaration_2', list(p
))
2078 # { bool initial_decl = allow_timeunit_decl && allow_timeprec_decl;
2079 # pform_set_timeunit($2, initial_decl);
2080 # pform_set_timeprec($4, initial_decl);
2083 def p_timeunits_declaration_3(p
):
2084 '''timeunits_declaration : K_timeprecision TIME_LITERAL ';' '''
2085 print('timeunits_declaration_3', list(p
))
2086 # { pform_set_timeprec($2, allow_timeprec_decl); }
2088 def p_timeunits_declaration_opt_1(p
):
2089 '''timeunits_declaration_opt : %prec no_timeunits_declaration '''
2090 print('timeunits_declaration_opt_1', list(p
))
2092 def p_timeunits_declaration_opt_2(p
):
2093 '''timeunits_declaration_opt : timeunits_declaration %prec one_timeunits_declaration '''
2094 print('timeunits_declaration_opt_2', list(p
))
2096 def p_timeunits_declaration_opt_3(p
):
2097 '''timeunits_declaration_opt : timeunits_declaration timeunits_declaration '''
2098 print('timeunits_declaration_opt_3', list(p
))
2100 def p_value_range_1(p
):
2101 '''value_range : expression '''
2102 print('value_range_1', list(p
))
2105 def p_value_range_2(p
):
2106 '''value_range : '[' expression ':' expression ']' '''
2107 print('value_range_2', list(p
))
2110 def p_variable_dimension_1(p
):
2111 '''variable_dimension : '[' expression ':' expression ']' '''
2112 print('variable_dimension_1', list(p
))
2113 # { list<pform_range_t> *tmp = new list<pform_range_t>;
2114 # pform_range_t index ($2,$4);
2115 # tmp->push_back(index);
2119 def p_variable_dimension_2(p
):
2120 '''variable_dimension : '[' expression ']' '''
2121 print('variable_dimension_2', list(p
))
2122 # { // SystemVerilog canonical range
2123 # if (!gn_system_verilog()) {
2125 # cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. "
2126 # << "Use at least -g2005-sv to remove this warning." << endl;
2128 # list<pform_range_t> *tmp = new list<pform_range_t>;
2129 # pform_range_t index;
2130 # index.first = new PENumber(new verinum((uint64_t)0, integer_width));
2131 # index.second = new PEBinary('-', $2, new PENumber(new verinum((uint64_t)1, integer_width)));
2132 # tmp->push_back(index);
2136 def p_variable_dimension_3(p
):
2137 '''variable_dimension : '[' ']' '''
2138 print('variable_dimension_3', list(p
))
2139 # { list<pform_range_t> *tmp = new list<pform_range_t>;
2140 # pform_range_t index (0,0);
2141 # tmp->push_back(index);
2145 def p_variable_dimension_4(p
):
2146 '''variable_dimension : '[' '$' ']' '''
2147 print('variable_dimension_4', list(p
))
2148 # { // SystemVerilog queue
2149 # list<pform_range_t> *tmp = new list<pform_range_t>;
2150 # pform_range_t index (new PENull,0);
2151 # if (!gn_system_verilog()) {
2152 # yyerror("error: Queue declarations require SystemVerilog.");
2154 # tmp->push_back(index);
2158 def p_variable_lifetime_1(p
):
2159 '''variable_lifetime : lifetime '''
2160 print('variable_lifetime_1', list(p
))
2161 # { if (!gn_system_verilog()) {
2162 # yyerror(@1, "error: overriding the default variable lifetime "
2163 # "requires SystemVerilog.");
2164 # } else if ($1 != pform_peek_scope()->default_lifetime) {
2165 # yyerror(@1, "sorry: overriding the default variable lifetime "
2166 # "is not yet supported.");
2168 # var_lifetime = $1;
2171 def p_attribute_list_opt_1(p
):
2172 '''attribute_list_opt : attribute_instance_list '''
2173 print('attribute_list_opt_1', list(p
))
2176 def p_attribute_list_opt_2(p
):
2177 '''attribute_list_opt : '''
2178 print('attribute_list_opt_2', list(p
))
2181 def p_attribute_instance_list_1(p
):
2182 '''attribute_instance_list : K_PSTAR K_STARP '''
2183 print('attribute_instance_list_1', list(p
))
2186 def p_attribute_instance_list_2(p
):
2187 '''attribute_instance_list : K_PSTAR attribute_list K_STARP '''
2188 print('attribute_instance_list_2', list(p
))
2191 def p_attribute_instance_list_3(p
):
2192 '''attribute_instance_list : attribute_instance_list K_PSTAR K_STARP '''
2193 print('attribute_instance_list_3', list(p
))
2196 def p_attribute_instance_list_4(p
):
2197 '''attribute_instance_list : attribute_instance_list K_PSTAR attribute_list K_STARP '''
2198 print('attribute_instance_list_4', list(p
))
2199 # { list<named_pexpr_t>*tmp = $1;
2201 # tmp->splice(tmp->end(), *$3);
2207 def p_attribute_list_1(p
):
2208 '''attribute_list : attribute_list ',' attribute '''
2209 print('attribute_list_1', list(p
))
2210 # { list<named_pexpr_t>*tmp = $1;
2211 # tmp->push_back(*$3);
2216 def p_attribute_list_2(p
):
2217 '''attribute_list : attribute '''
2218 print('attribute_list_2', list(p
))
2219 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
2220 # tmp->push_back(*$1);
2225 def p_attribute_1(p
):
2226 '''attribute : IDENTIFIER '''
2227 print('attribute_1', list(p
))
2228 # { named_pexpr_t*tmp = new named_pexpr_t;
2229 # tmp->name = lex_strings.make($1);
2235 def p_attribute_2(p
):
2236 '''attribute : IDENTIFIER '=' expression '''
2237 print('attribute_2', list(p
))
2239 # named_pexpr_t*tmp2 = new named_pexpr_t;
2240 # tmp2->name = lex_strings.make($1);
2246 def p_block_item_decl_1(p
):
2247 '''block_item_decl : data_type register_variable_list ';' '''
2248 print('block_item_decl_1', list(p
))
2249 # { if ($1) pform_set_data_type(@1, $1, $2, NetNet::REG, attributes_in_context);
2252 def p_block_item_decl_2(p
):
2253 '''block_item_decl : variable_lifetime data_type register_variable_list ';' '''
2254 print('block_item_decl_2', list(p
))
2255 # { if ($2) pform_set_data_type(@2, $2, $3, NetNet::REG, attributes_in_context);
2256 # var_lifetime = LexicalScope::INHERITED;
2259 def p_block_item_decl_3(p
):
2260 '''block_item_decl : K_reg data_type register_variable_list ';' '''
2261 print('block_item_decl_3', list(p
))
2262 # { if ($2) pform_set_data_type(@2, $2, $3, NetNet::REG, attributes_in_context);
2265 def p_block_item_decl_4(p
):
2266 '''block_item_decl : variable_lifetime K_reg data_type register_variable_list ';' '''
2267 print('block_item_decl_4', list(p
))
2268 # { if ($3) pform_set_data_type(@3, $3, $4, NetNet::REG, attributes_in_context);
2269 # var_lifetime = LexicalScope::INHERITED;
2272 def p_block_item_decl_5(p
):
2273 '''block_item_decl : K_event event_variable_list ';' '''
2274 print('block_item_decl_5', list(p
))
2275 # { if ($2) pform_make_events($2, @1.text, @1.first_line);
2278 def p_block_item_decl_6(p
):
2279 '''block_item_decl : K_parameter param_type parameter_assign_list ';' '''
2280 print('block_item_decl_6', list(p
))
2282 def p_block_item_decl_7(p
):
2283 '''block_item_decl : K_localparam param_type localparam_assign_list ';' '''
2284 print('block_item_decl_7', list(p
))
2286 def p_block_item_decl_8(p
):
2287 '''block_item_decl : type_declaration '''
2288 print('block_item_decl_8', list(p
))
2290 def p_block_item_decl_9(p
):
2291 '''block_item_decl : K_integer error ';' '''
2292 print('block_item_decl_9', list(p
))
2293 # { yyerror(@1, "error: syntax error in integer variable list.");
2297 def p_block_item_decl_10(p
):
2298 '''block_item_decl : K_time error ';' '''
2299 print('block_item_decl_10', list(p
))
2300 # { yyerror(@1, "error: syntax error in time variable list.");
2304 def p_block_item_decl_11(p
):
2305 '''block_item_decl : K_parameter error ';' '''
2306 print('block_item_decl_11', list(p
))
2307 # { yyerror(@1, "error: syntax error in parameter list.");
2311 def p_block_item_decl_12(p
):
2312 '''block_item_decl : K_localparam error ';' '''
2313 print('block_item_decl_12', list(p
))
2314 # { yyerror(@1, "error: syntax error localparam list.");
2318 def p_block_item_decls_1(p
):
2319 '''block_item_decls : block_item_decl '''
2320 print('block_item_decls_1', list(p
))
2322 def p_block_item_decls_2(p
):
2323 '''block_item_decls : block_item_decls block_item_decl '''
2324 print('block_item_decls_2', list(p
))
2326 def p_block_item_decls_opt_1(p
):
2327 '''block_item_decls_opt : block_item_decls '''
2328 print('block_item_decls_opt_1', list(p
))
2331 def p_block_item_decls_opt_2(p
):
2332 '''block_item_decls_opt : '''
2333 print('block_item_decls_opt_2', list(p
))
2336 def p_type_declaration_1(p
):
2337 '''type_declaration : K_typedef data_type IDENTIFIER dimensions_opt ';' '''
2338 print('type_declaration_1', list(p
))
2339 # { perm_string name = lex_strings.make($3);
2340 # pform_set_typedef(name, $2, $4);
2344 def p_type_declaration_2(p
):
2345 '''type_declaration : K_typedef data_type TYPE_IDENTIFIER ';' '''
2346 print('type_declaration_2', list(p
))
2347 # { perm_string name = lex_strings.make($3.text);
2348 # if (pform_test_type_identifier_local(name)) {
2349 # yyerror(@3, "error: Typedef identifier \"%s\" is already a type name.", $3.text);
2352 # pform_set_typedef(name, $2, NULL);
2357 def p_type_declaration_3(p
):
2358 '''type_declaration : K_typedef K_class IDENTIFIER ';' '''
2359 print('type_declaration_3', list(p
))
2360 # { // Create a synthetic typedef for the class name so that the
2361 # // lexor detects the name as a type.
2362 # perm_string name = lex_strings.make($3);
2363 # class_type_t*tmp = new class_type_t(name);
2364 # FILE_NAME(tmp, @3);
2365 # pform_set_typedef(name, tmp, NULL);
2369 def p_type_declaration_4(p
):
2370 '''type_declaration : K_typedef K_enum IDENTIFIER ';' '''
2371 print('type_declaration_4', list(p
))
2372 # { yyerror(@1, "sorry: Enum forward declarations not supported yet."); }
2374 def p_type_declaration_5(p
):
2375 '''type_declaration : K_typedef K_struct IDENTIFIER ';' '''
2376 print('type_declaration_5', list(p
))
2377 # { yyerror(@1, "sorry: Struct forward declarations not supported yet."); }
2379 def p_type_declaration_6(p
):
2380 '''type_declaration : K_typedef K_union IDENTIFIER ';' '''
2381 print('type_declaration_6', list(p
))
2382 # { yyerror(@1, "sorry: Union forward declarations not supported yet."); }
2384 def p_type_declaration_7(p
):
2385 '''type_declaration : K_typedef IDENTIFIER ';' '''
2386 print('type_declaration_7', list(p
))
2387 # { // Create a synthetic typedef for the class name so that the
2388 # // lexor detects the name as a type.
2389 # perm_string name = lex_strings.make($2);
2390 # class_type_t*tmp = new class_type_t(name);
2391 # FILE_NAME(tmp, @2);
2392 # pform_set_typedef(name, tmp, NULL);
2396 def p_type_declaration_8(p
):
2397 '''type_declaration : K_typedef error ';' '''
2398 print('type_declaration_8', list(p
))
2399 # { yyerror(@2, "error: Syntax error in typedef clause.");
2403 def p_enum_data_type_1(p
):
2404 '''enum_data_type : K_enum '{' enum_name_list '}' '''
2405 print('enum_data_type_1', list(p
))
2406 # { enum_type_t*enum_type = new enum_type_t;
2407 # FILE_NAME(enum_type, @1);
2408 # enum_type->names .reset($3);
2409 # enum_type->base_type = IVL_VT_BOOL;
2410 # enum_type->signed_flag = true;
2411 # enum_type->integer_flag = false;
2412 # enum_type->range.reset(make_range_from_width(32));
2416 def p_enum_data_type_2(p
):
2417 '''enum_data_type : K_enum atom2_type signed_unsigned_opt '{' enum_name_list '}' '''
2418 print('enum_data_type_2', list(p
))
2419 # { enum_type_t*enum_type = new enum_type_t;
2420 # FILE_NAME(enum_type, @1);
2421 # enum_type->names .reset($5);
2422 # enum_type->base_type = IVL_VT_BOOL;
2423 # enum_type->signed_flag = $3;
2424 # enum_type->integer_flag = false;
2425 # enum_type->range.reset(make_range_from_width($2));
2429 def p_enum_data_type_3(p
):
2430 '''enum_data_type : K_enum K_integer signed_unsigned_opt '{' enum_name_list '}' '''
2431 print('enum_data_type_3', list(p
))
2432 # { enum_type_t*enum_type = new enum_type_t;
2433 # FILE_NAME(enum_type, @1);
2434 # enum_type->names .reset($5);
2435 # enum_type->base_type = IVL_VT_LOGIC;
2436 # enum_type->signed_flag = $3;
2437 # enum_type->integer_flag = true;
2438 # enum_type->range.reset(make_range_from_width(integer_width));
2442 def p_enum_data_type_4(p
):
2443 '''enum_data_type : K_enum K_logic unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2444 print('enum_data_type_4', list(p
))
2445 # { enum_type_t*enum_type = new enum_type_t;
2446 # FILE_NAME(enum_type, @1);
2447 # enum_type->names .reset($6);
2448 # enum_type->base_type = IVL_VT_LOGIC;
2449 # enum_type->signed_flag = $3;
2450 # enum_type->integer_flag = false;
2451 # enum_type->range.reset($4 ? $4 : make_range_from_width(1));
2455 def p_enum_data_type_5(p
):
2456 '''enum_data_type : K_enum K_reg unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2457 print('enum_data_type_5', list(p
))
2458 # { enum_type_t*enum_type = new enum_type_t;
2459 # FILE_NAME(enum_type, @1);
2460 # enum_type->names .reset($6);
2461 # enum_type->base_type = IVL_VT_LOGIC;
2462 # enum_type->signed_flag = $3;
2463 # enum_type->integer_flag = false;
2464 # enum_type->range.reset($4 ? $4 : make_range_from_width(1));
2468 def p_enum_data_type_6(p
):
2469 '''enum_data_type : K_enum K_bit unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2470 print('enum_data_type_6', list(p
))
2471 # { enum_type_t*enum_type = new enum_type_t;
2472 # FILE_NAME(enum_type, @1);
2473 # enum_type->names .reset($6);
2474 # enum_type->base_type = IVL_VT_BOOL;
2475 # enum_type->signed_flag = $3;
2476 # enum_type->integer_flag = false;
2477 # enum_type->range.reset($4 ? $4 : make_range_from_width(1));
2481 def p_enum_name_list_1(p
):
2482 '''enum_name_list : enum_name '''
2483 print('enum_name_list_1', list(p
))
2487 def p_enum_name_list_2(p
):
2488 '''enum_name_list : enum_name_list ',' enum_name '''
2489 print('enum_name_list_2', list(p
))
2490 # { list<named_pexpr_t>*lst = $1;
2491 # lst->splice(lst->end(), *$3);
2496 def p_pos_neg_number_1(p
):
2497 '''pos_neg_number : number '''
2498 print('pos_neg_number_1', list(p
))
2502 def p_pos_neg_number_2(p
):
2503 '''pos_neg_number : '-' number '''
2504 print('pos_neg_number_2', list(p
))
2505 # { verinum tmp = -(*($2));
2510 def p_enum_name_1(p
):
2511 '''enum_name : IDENTIFIER '''
2512 print('enum_name_1', list(p
))
2513 # { perm_string name = lex_strings.make($1);
2515 # $$ = make_named_number(name);
2518 def p_enum_name_2(p
):
2519 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '''
2520 print('enum_name_2', list(p
))
2521 # { perm_string name = lex_strings.make($1);
2522 # long count = check_enum_seq_value(@1, $3, false);
2524 # $$ = make_named_numbers(name, 0, count-1);
2528 def p_enum_name_3(p
):
2529 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '''
2530 print('enum_name_3', list(p
))
2531 # { perm_string name = lex_strings.make($1);
2532 # $$ = make_named_numbers(name, check_enum_seq_value(@1, $3, true),
2533 # check_enum_seq_value(@1, $5, true));
2539 def p_enum_name_4(p
):
2540 '''enum_name : IDENTIFIER '=' expression '''
2541 print('enum_name_4', list(p
))
2542 # { perm_string name = lex_strings.make($1);
2544 # $$ = make_named_number(name, $3);
2547 def p_enum_name_5(p
):
2548 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '=' expression '''
2549 print('enum_name_5', list(p
))
2550 # { perm_string name = lex_strings.make($1);
2551 # long count = check_enum_seq_value(@1, $3, false);
2552 # $$ = make_named_numbers(name, 0, count-1, $6);
2557 def p_enum_name_6(p
):
2558 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '=' expression '''
2559 print('enum_name_6', list(p
))
2560 # { perm_string name = lex_strings.make($1);
2561 # $$ = make_named_numbers(name, check_enum_seq_value(@1, $3, true),
2562 # check_enum_seq_value(@1, $5, true), $8);
2568 def p_struct_data_type_1(p
):
2569 '''struct_data_type : K_struct K_packed_opt '{' struct_union_member_list '}' '''
2570 print('struct_data_type_1', list(p
))
2571 # { struct_type_t*tmp = new struct_type_t;
2572 # FILE_NAME(tmp, @1);
2573 # tmp->packed_flag = $2;
2574 # tmp->union_flag = false;
2575 # tmp->members .reset($4);
2579 def p_struct_data_type_2(p
):
2580 '''struct_data_type : K_union K_packed_opt '{' struct_union_member_list '}' '''
2581 print('struct_data_type_2', list(p
))
2582 # { struct_type_t*tmp = new struct_type_t;
2583 # FILE_NAME(tmp, @1);
2584 # tmp->packed_flag = $2;
2585 # tmp->union_flag = true;
2586 # tmp->members .reset($4);
2590 def p_struct_data_type_3(p
):
2591 '''struct_data_type : K_struct K_packed_opt '{' error '}' '''
2592 print('struct_data_type_3', list(p
))
2593 # { yyerror(@3, "error: Errors in struct member list.");
2595 # struct_type_t*tmp = new struct_type_t;
2596 # FILE_NAME(tmp, @1);
2597 # tmp->packed_flag = $2;
2598 # tmp->union_flag = false;
2602 def p_struct_data_type_4(p
):
2603 '''struct_data_type : K_union K_packed_opt '{' error '}' '''
2604 print('struct_data_type_4', list(p
))
2605 # { yyerror(@3, "error: Errors in union member list.");
2607 # struct_type_t*tmp = new struct_type_t;
2608 # FILE_NAME(tmp, @1);
2609 # tmp->packed_flag = $2;
2610 # tmp->union_flag = true;
2614 def p_struct_union_member_list_1(p
):
2615 '''struct_union_member_list : struct_union_member_list struct_union_member '''
2616 print('struct_union_member_list_1', list(p
))
2617 # { list<struct_member_t*>*tmp = $1;
2618 # tmp->push_back($2);
2622 def p_struct_union_member_list_2(p
):
2623 '''struct_union_member_list : struct_union_member '''
2624 print('struct_union_member_list_2', list(p
))
2625 # { list<struct_member_t*>*tmp = new list<struct_member_t*>;
2626 # tmp->push_back($1);
2630 def p_struct_union_member_1(p
):
2631 '''struct_union_member : attribute_list_opt data_type list_of_variable_decl_assignments ';' '''
2632 print('struct_union_member_1', list(p
))
2633 # { struct_member_t*tmp = new struct_member_t;
2634 # FILE_NAME(tmp, @2);
2635 # tmp->type .reset($2);
2636 # tmp->names .reset($3);
2640 def p_struct_union_member_2(p
):
2641 '''struct_union_member : error ';' '''
2642 print('struct_union_member_2', list(p
))
2643 # { yyerror(@2, "Error in struct/union member.");
2648 def p_case_item_1(p
):
2649 '''case_item : expression_list_proper ':' statement_or_null '''
2650 print('case_item_1', list(p
))
2651 # { PCase::Item*tmp = new PCase::Item;
2658 def p_case_item_2(p
):
2659 '''case_item : K_default ':' statement_or_null '''
2660 print('case_item_2', list(p
))
2661 # { PCase::Item*tmp = new PCase::Item;
2666 def p_case_item_3(p
):
2667 '''case_item : K_default statement_or_null '''
2668 print('case_item_3', list(p
))
2669 # { PCase::Item*tmp = new PCase::Item;
2674 def p_case_item_4(p
):
2675 '''case_item : error ':' statement_or_null '''
2676 print('case_item_4', list(p
))
2677 # { yyerror(@2, "error: Incomprehensible case expression.");
2681 def p_case_items_1(p
):
2682 '''case_items : case_items case_item '''
2683 print('case_items_1', list(p
))
2684 # { svector<PCase::Item*>*tmp;
2685 # tmp = new svector<PCase::Item*>(*$1, $2);
2690 def p_case_items_2(p
):
2691 '''case_items : case_item '''
2692 print('case_items_2', list(p
))
2693 # { svector<PCase::Item*>*tmp = new svector<PCase::Item*>(1);
2698 def p_charge_strength_1(p
):
2699 '''charge_strength : '(' K_small ')' '''
2700 print('charge_strength_1', list(p
))
2702 def p_charge_strength_2(p
):
2703 '''charge_strength : '(' K_medium ')' '''
2704 print('charge_strength_2', list(p
))
2706 def p_charge_strength_3(p
):
2707 '''charge_strength : '(' K_large ')' '''
2708 print('charge_strength_3', list(p
))
2710 def p_charge_strength_opt_1(p
):
2711 '''charge_strength_opt : charge_strength '''
2712 print('charge_strength_opt_1', list(p
))
2714 def p_charge_strength_opt_2(p
):
2715 '''charge_strength_opt : '''
2716 print('charge_strength_opt_2', list(p
))
2718 def p_defparam_assign_1(p
):
2719 '''defparam_assign : hierarchy_identifier '=' expression '''
2720 print('defparam_assign_1', list(p
))
2721 # { pform_set_defparam(*$1, $3);
2725 def p_defparam_assign_list_1(p
):
2726 '''defparam_assign_list : defparam_assign '''
2727 print('defparam_assign_list_1', list(p
))
2729 def p_defparam_assign_list_2(p
):
2730 '''defparam_assign_list : dimensions defparam_assign '''
2731 print('defparam_assign_list_2', list(p
))
2732 # { yyerror(@1, "error: defparam may not include a range.");
2736 def p_defparam_assign_list_3(p
):
2737 '''defparam_assign_list : defparam_assign_list ',' defparam_assign '''
2738 print('defparam_assign_list_3', list(p
))
2741 '''delay1 : '#' delay_value_simple '''
2742 print('delay1_1', list(p
))
2743 # { list<PExpr*>*tmp = new list<PExpr*>;
2744 # tmp->push_back($2);
2749 '''delay1 : '#' '(' delay_value ')' '''
2750 print('delay1_2', list(p
))
2751 # { list<PExpr*>*tmp = new list<PExpr*>;
2752 # tmp->push_back($3);
2757 '''delay3 : '#' delay_value_simple '''
2758 print('delay3_1', list(p
))
2759 # { list<PExpr*>*tmp = new list<PExpr*>;
2760 # tmp->push_back($2);
2765 '''delay3 : '#' '(' delay_value ')' '''
2766 print('delay3_2', list(p
))
2767 # { list<PExpr*>*tmp = new list<PExpr*>;
2768 # tmp->push_back($3);
2773 '''delay3 : '#' '(' delay_value ',' delay_value ')' '''
2774 print('delay3_3', list(p
))
2775 # { list<PExpr*>*tmp = new list<PExpr*>;
2776 # tmp->push_back($3);
2777 # tmp->push_back($5);
2782 '''delay3 : '#' '(' delay_value ',' delay_value ',' delay_value ')' '''
2783 print('delay3_4', list(p
))
2784 # { list<PExpr*>*tmp = new list<PExpr*>;
2785 # tmp->push_back($3);
2786 # tmp->push_back($5);
2787 # tmp->push_back($7);
2791 def p_delay3_opt_1(p
):
2792 '''delay3_opt : delay3 '''
2793 print('delay3_opt_1', list(p
))
2796 def p_delay3_opt_2(p
):
2798 print('delay3_opt_2', list(p
))
2801 def p_delay_value_list_1(p
):
2802 '''delay_value_list : delay_value '''
2803 print('delay_value_list_1', list(p
))
2804 # { list<PExpr*>*tmp = new list<PExpr*>;
2805 # tmp->push_back($1);
2809 def p_delay_value_list_2(p
):
2810 '''delay_value_list : delay_value_list ',' delay_value '''
2811 print('delay_value_list_2', list(p
))
2812 # { list<PExpr*>*tmp = $1;
2813 # tmp->push_back($3);
2817 def p_delay_value_1(p
):
2818 '''delay_value : expression '''
2819 print('delay_value_1', list(p
))
2824 def p_delay_value_2(p
):
2825 '''delay_value : expression ':' expression ':' expression '''
2826 print('delay_value_2', list(p
))
2827 # { $$ = pform_select_mtm_expr($1, $3, $5); }
2829 def p_delay_value_simple_1(p
):
2830 '''delay_value_simple : DEC_NUMBER '''
2831 print('delay_value_simple_1', list(p
))
2832 # { verinum*tmp = $1;
2834 # yyerror(@1, "internal error: delay.");
2837 # $$ = new PENumber(tmp);
2838 # FILE_NAME($$, @1);
2843 def p_delay_value_simple_2(p
):
2844 '''delay_value_simple : REALTIME '''
2845 print('delay_value_simple_2', list(p
))
2846 # { verireal*tmp = $1;
2848 # yyerror(@1, "internal error: delay.");
2851 # $$ = new PEFNumber(tmp);
2852 # FILE_NAME($$, @1);
2856 def p_delay_value_simple_3(p
):
2857 '''delay_value_simple : IDENTIFIER '''
2858 print('delay_value_simple_3', list(p
))
2859 # { PEIdent*tmp = new PEIdent(lex_strings.make($1));
2860 # FILE_NAME(tmp, @1);
2865 def p_delay_value_simple_4(p
):
2866 '''delay_value_simple : TIME_LITERAL '''
2867 print('delay_value_simple_4', list(p
))
2872 # if ($1 == 0 || !get_time_unit($1, unit))
2873 # yyerror(@1, "internal error: delay.");
2875 # double p = pow(10.0,
2876 # (double)(unit - pform_get_timeunit()));
2877 # double time = atof($1) * p;
2879 # verireal *v = new verireal(time);
2880 # $$ = new PEFNumber(v);
2881 # FILE_NAME($$, @1);
2885 def p_optional_semicolon_1(p
):
2886 '''optional_semicolon : ';' '''
2887 print('optional_semicolon_1', list(p
))
2889 def p_optional_semicolon_2(p
):
2890 '''optional_semicolon : '''
2891 print('optional_semicolon_2', list(p
))
2893 def p_discipline_declaration_1(p
):
2894 '''discipline_declaration : K_discipline IDENTIFIER optional_semicolon _embed0_discipline_declaration discipline_items K_enddiscipline '''
2895 print('discipline_declaration_1', list(p
))
2896 # { pform_end_discipline(@1); delete[] $2; }
2898 def p__embed0_discipline_declaration(p
):
2899 '''_embed0_discipline_declaration : '''
2900 # { pform_start_discipline($2); }
2902 def p_discipline_items_1(p
):
2903 '''discipline_items : discipline_items discipline_item '''
2904 print('discipline_items_1', list(p
))
2906 def p_discipline_items_2(p
):
2907 '''discipline_items : discipline_item '''
2908 print('discipline_items_2', list(p
))
2910 def p_discipline_item_1(p
):
2911 '''discipline_item : K_domain K_discrete ';' '''
2912 print('discipline_item_1', list(p
))
2913 # { pform_discipline_domain(@1, IVL_DIS_DISCRETE); }
2915 def p_discipline_item_2(p
):
2916 '''discipline_item : K_domain K_continuous ';' '''
2917 print('discipline_item_2', list(p
))
2918 # { pform_discipline_domain(@1, IVL_DIS_CONTINUOUS); }
2920 def p_discipline_item_3(p
):
2921 '''discipline_item : K_potential IDENTIFIER ';' '''
2922 print('discipline_item_3', list(p
))
2923 # { pform_discipline_potential(@1, $2); delete[] $2; }
2925 def p_discipline_item_4(p
):
2926 '''discipline_item : K_flow IDENTIFIER ';' '''
2927 print('discipline_item_4', list(p
))
2928 # { pform_discipline_flow(@1, $2); delete[] $2; }
2930 def p_nature_declaration_1(p
):
2931 '''nature_declaration : K_nature IDENTIFIER optional_semicolon _embed0_nature_declaration nature_items K_endnature '''
2932 print('nature_declaration_1', list(p
))
2933 # { pform_end_nature(@1); delete[] $2; }
2935 def p__embed0_nature_declaration(p
):
2936 '''_embed0_nature_declaration : '''
2937 # { pform_start_nature($2); }
2939 def p_nature_items_1(p
):
2940 '''nature_items : nature_items nature_item '''
2941 print('nature_items_1', list(p
))
2943 def p_nature_items_2(p
):
2944 '''nature_items : nature_item '''
2945 print('nature_items_2', list(p
))
2947 def p_nature_item_1(p
):
2948 '''nature_item : K_units '=' STRING ';' '''
2949 print('nature_item_1', list(p
))
2952 def p_nature_item_2(p
):
2953 '''nature_item : K_abstol '=' expression ';' '''
2954 print('nature_item_2', list(p
))
2956 def p_nature_item_3(p
):
2957 '''nature_item : K_access '=' IDENTIFIER ';' '''
2958 print('nature_item_3', list(p
))
2959 # { pform_nature_access(@1, $3); delete[] $3; }
2961 def p_nature_item_4(p
):
2962 '''nature_item : K_idt_nature '=' IDENTIFIER ';' '''
2963 print('nature_item_4', list(p
))
2966 def p_nature_item_5(p
):
2967 '''nature_item : K_ddt_nature '=' IDENTIFIER ';' '''
2968 print('nature_item_5', list(p
))
2971 def p_config_declaration_1(p
):
2972 '''config_declaration : K_config IDENTIFIER ';' K_design lib_cell_identifiers ';' list_of_config_rule_statements K_endconfig '''
2973 print('config_declaration_1', list(p
))
2974 # { cerr << @1 << ": sorry: config declarations are not supported and "
2975 # "will be skipped." << endl;
2979 def p_lib_cell_identifiers_1(p
):
2980 '''lib_cell_identifiers : '''
2981 print('lib_cell_identifiers_1', list(p
))
2983 def p_lib_cell_identifiers_2(p
):
2984 '''lib_cell_identifiers : lib_cell_identifiers lib_cell_id '''
2985 print('lib_cell_identifiers_2', list(p
))
2987 def p_list_of_config_rule_statements_1(p
):
2988 '''list_of_config_rule_statements : '''
2989 print('list_of_config_rule_statements_1', list(p
))
2991 def p_list_of_config_rule_statements_2(p
):
2992 '''list_of_config_rule_statements : list_of_config_rule_statements config_rule_statement '''
2993 print('list_of_config_rule_statements_2', list(p
))
2995 def p_config_rule_statement_1(p
):
2996 '''config_rule_statement : K_default K_liblist list_of_libraries ';' '''
2997 print('config_rule_statement_1', list(p
))
2999 def p_config_rule_statement_2(p
):
3000 '''config_rule_statement : K_instance hierarchy_identifier K_liblist list_of_libraries ';' '''
3001 print('config_rule_statement_2', list(p
))
3004 def p_config_rule_statement_3(p
):
3005 '''config_rule_statement : K_instance hierarchy_identifier K_use lib_cell_id opt_config ';' '''
3006 print('config_rule_statement_3', list(p
))
3009 def p_config_rule_statement_4(p
):
3010 '''config_rule_statement : K_cell lib_cell_id K_liblist list_of_libraries ';' '''
3011 print('config_rule_statement_4', list(p
))
3013 def p_config_rule_statement_5(p
):
3014 '''config_rule_statement : K_cell lib_cell_id K_use lib_cell_id opt_config ';' '''
3015 print('config_rule_statement_5', list(p
))
3017 def p_opt_config_1(p
):
3019 print('opt_config_1', list(p
))
3021 def p_opt_config_2(p
):
3022 '''opt_config : ':' K_config '''
3023 print('opt_config_2', list(p
))
3025 def p_lib_cell_id_1(p
):
3026 '''lib_cell_id : IDENTIFIER '''
3027 print('lib_cell_id_1', list(p
))
3030 def p_lib_cell_id_2(p
):
3031 '''lib_cell_id : IDENTIFIER '.' IDENTIFIER '''
3032 print('lib_cell_id_2', list(p
))
3033 # { delete[] $1; delete[] $3; }
3035 def p_list_of_libraries_1(p
):
3036 '''list_of_libraries : '''
3037 print('list_of_libraries_1', list(p
))
3039 def p_list_of_libraries_2(p
):
3040 '''list_of_libraries : list_of_libraries IDENTIFIER '''
3041 print('list_of_libraries_2', list(p
))
3044 def p_drive_strength_1(p
):
3045 '''drive_strength : '(' dr_strength0 ',' dr_strength1 ')' '''
3046 print('drive_strength_1', list(p
))
3047 # { $$.str0 = $2.str0;
3048 # $$.str1 = $4.str1;
3051 def p_drive_strength_2(p
):
3052 '''drive_strength : '(' dr_strength1 ',' dr_strength0 ')' '''
3053 print('drive_strength_2', list(p
))
3054 # { $$.str0 = $4.str0;
3055 # $$.str1 = $2.str1;
3058 def p_drive_strength_3(p
):
3059 '''drive_strength : '(' dr_strength0 ',' K_highz1 ')' '''
3060 print('drive_strength_3', list(p
))
3061 # { $$.str0 = $2.str0;
3062 # $$.str1 = IVL_DR_HiZ;
3065 def p_drive_strength_4(p
):
3066 '''drive_strength : '(' dr_strength1 ',' K_highz0 ')' '''
3067 print('drive_strength_4', list(p
))
3068 # { $$.str0 = IVL_DR_HiZ;
3069 # $$.str1 = $2.str1;
3072 def p_drive_strength_5(p
):
3073 '''drive_strength : '(' K_highz1 ',' dr_strength0 ')' '''
3074 print('drive_strength_5', list(p
))
3075 # { $$.str0 = $4.str0;
3076 # $$.str1 = IVL_DR_HiZ;
3079 def p_drive_strength_6(p
):
3080 '''drive_strength : '(' K_highz0 ',' dr_strength1 ')' '''
3081 print('drive_strength_6', list(p
))
3082 # { $$.str0 = IVL_DR_HiZ;
3083 # $$.str1 = $4.str1;
3086 def p_drive_strength_opt_1(p
):
3087 '''drive_strength_opt : drive_strength '''
3088 print('drive_strength_opt_1', list(p
))
3091 def p_drive_strength_opt_2(p
):
3092 '''drive_strength_opt : '''
3093 print('drive_strength_opt_2', list(p
))
3094 # { $$.str0 = IVL_DR_STRONG; $$.str1 = IVL_DR_STRONG; }
3096 def p_dr_strength0_1(p
):
3097 '''dr_strength0 : K_supply0 '''
3098 print('dr_strength0_1', list(p
))
3099 # { $$.str0 = IVL_DR_SUPPLY; }
3101 def p_dr_strength0_2(p
):
3102 '''dr_strength0 : K_strong0 '''
3103 print('dr_strength0_2', list(p
))
3104 # { $$.str0 = IVL_DR_STRONG; }
3106 def p_dr_strength0_3(p
):
3107 '''dr_strength0 : K_pull0 '''
3108 print('dr_strength0_3', list(p
))
3109 # { $$.str0 = IVL_DR_PULL; }
3111 def p_dr_strength0_4(p
):
3112 '''dr_strength0 : K_weak0 '''
3113 print('dr_strength0_4', list(p
))
3114 # { $$.str0 = IVL_DR_WEAK; }
3116 def p_dr_strength1_1(p
):
3117 '''dr_strength1 : K_supply1 '''
3118 print('dr_strength1_1', list(p
))
3119 # { $$.str1 = IVL_DR_SUPPLY; }
3121 def p_dr_strength1_2(p
):
3122 '''dr_strength1 : K_strong1 '''
3123 print('dr_strength1_2', list(p
))
3124 # { $$.str1 = IVL_DR_STRONG; }
3126 def p_dr_strength1_3(p
):
3127 '''dr_strength1 : K_pull1 '''
3128 print('dr_strength1_3', list(p
))
3129 # { $$.str1 = IVL_DR_PULL; }
3131 def p_dr_strength1_4(p
):
3132 '''dr_strength1 : K_weak1 '''
3133 print('dr_strength1_4', list(p
))
3134 # { $$.str1 = IVL_DR_WEAK; }
3136 def p_clocking_event_opt_1(p
):
3137 '''clocking_event_opt : event_control '''
3138 print('clocking_event_opt_1', list(p
))
3140 def p_clocking_event_opt_2(p
):
3141 '''clocking_event_opt : '''
3142 print('clocking_event_opt_2', list(p
))
3144 def p_event_control_1(p
):
3145 '''event_control : '@' hierarchy_identifier '''
3146 print('event_control_1', list(p
))
3147 # { PEIdent*tmpi = new PEIdent(*$2);
3148 # PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi);
3149 # PEventStatement*tmps = new PEventStatement(tmpe);
3150 # FILE_NAME(tmps, @1);
3155 def p_event_control_2(p
):
3156 '''event_control : '@' '(' event_expression_list ')' '''
3157 print('event_control_2', list(p
))
3158 # { PEventStatement*tmp = new PEventStatement(*$3);
3159 # FILE_NAME(tmp, @1);
3164 def p_event_control_3(p
):
3165 '''event_control : '@' '(' error ')' '''
3166 print('event_control_3', list(p
))
3167 # { yyerror(@1, "error: Malformed event control expression.");
3171 def p_event_expression_list_1(p
):
3172 '''event_expression_list : event_expression '''
3173 print('event_expression_list_1', list(p
))
3176 def p_event_expression_list_2(p
):
3177 '''event_expression_list : event_expression_list K_or event_expression '''
3178 print('event_expression_list_2', list(p
))
3179 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*$1, *$3);
3185 def p_event_expression_list_3(p
):
3186 '''event_expression_list : event_expression_list ',' event_expression '''
3187 print('event_expression_list_3', list(p
))
3188 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*$1, *$3);
3194 def p_event_expression_1(p
):
3195 '''event_expression : K_posedge expression '''
3196 print('event_expression_1', list(p
))
3197 # { PEEvent*tmp = new PEEvent(PEEvent::POSEDGE, $2);
3198 # FILE_NAME(tmp, @1);
3199 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3204 def p_event_expression_2(p
):
3205 '''event_expression : K_negedge expression '''
3206 print('event_expression_2', list(p
))
3207 # { PEEvent*tmp = new PEEvent(PEEvent::NEGEDGE, $2);
3208 # FILE_NAME(tmp, @1);
3209 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3214 def p_event_expression_3(p
):
3215 '''event_expression : expression '''
3216 print('event_expression_3', list(p
))
3217 # { PEEvent*tmp = new PEEvent(PEEvent::ANYEDGE, $1);
3218 # FILE_NAME(tmp, @1);
3219 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3224 def p_branch_probe_expression_1(p
):
3225 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ',' IDENTIFIER ')' '''
3226 print('branch_probe_expression_1', list(p
))
3227 # { $$ = pform_make_branch_probe_expression(@1, $1, $3, $5); }
3229 def p_branch_probe_expression_2(p
):
3230 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ')' '''
3231 print('branch_probe_expression_2', list(p
))
3232 # { $$ = pform_make_branch_probe_expression(@1, $1, $3); }
3234 def p_expression_1(p
):
3235 '''expression : expr_primary_or_typename '''
3236 print('expression_1', list(p
))
3240 def p_expression_2(p
):
3241 '''expression : inc_or_dec_expression '''
3242 print('expression_2', list(p
))
3245 def p_expression_3(p
):
3246 '''expression : inside_expression '''
3247 print('expression_3', list(p
))
3250 def p_expression_4(p
):
3251 '''expression : '+' attribute_list_opt expr_primary %prec UNARY_PREC '''
3252 print('expression_4', list(p
))
3255 def p_expression_5(p
):
3256 '''expression : '-' attribute_list_opt expr_primary %prec UNARY_PREC '''
3257 print('expression_5', list(p
))
3258 # { PEUnary*tmp = new PEUnary('-', $3);
3259 # FILE_NAME(tmp, @3);
3263 def p_expression_6(p
):
3264 '''expression : '~' attribute_list_opt expr_primary %prec UNARY_PREC '''
3265 print('expression_6', list(p
))
3266 # { PEUnary*tmp = new PEUnary('~', $3);
3267 # FILE_NAME(tmp, @3);
3271 def p_expression_7(p
):
3272 '''expression : '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3273 print('expression_7', list(p
))
3274 # { PEUnary*tmp = new PEUnary('&', $3);
3275 # FILE_NAME(tmp, @3);
3279 def p_expression_8(p
):
3280 '''expression : '!' attribute_list_opt expr_primary %prec UNARY_PREC '''
3281 print('expression_8', list(p
))
3282 # { PEUnary*tmp = new PEUnary('!', $3);
3283 # FILE_NAME(tmp, @3);
3287 def p_expression_9(p
):
3288 '''expression : '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3289 print('expression_9', list(p
))
3290 # { PEUnary*tmp = new PEUnary('|', $3);
3291 # FILE_NAME(tmp, @3);
3295 def p_expression_10(p
):
3296 '''expression : '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3297 print('expression_10', list(p
))
3298 # { PEUnary*tmp = new PEUnary('^', $3);
3299 # FILE_NAME(tmp, @3);
3303 def p_expression_11(p
):
3304 '''expression : '~' '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3305 print('expression_11', list(p
))
3306 # { yyerror(@1, "error: '~' '&' is not a valid expression. "
3307 # "Please use operator '~&' instead.");
3311 def p_expression_12(p
):
3312 '''expression : '~' '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3313 print('expression_12', list(p
))
3314 # { yyerror(@1, "error: '~' '|' is not a valid expression. "
3315 # "Please use operator '~|' instead.");
3319 def p_expression_13(p
):
3320 '''expression : '~' '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3321 print('expression_13', list(p
))
3322 # { yyerror(@1, "error: '~' '^' is not a valid expression. "
3323 # "Please use operator '~^' instead.");
3327 def p_expression_14(p
):
3328 '''expression : K_NAND attribute_list_opt expr_primary %prec UNARY_PREC '''
3329 print('expression_14', list(p
))
3330 # { PEUnary*tmp = new PEUnary('A', $3);
3331 # FILE_NAME(tmp, @3);
3335 def p_expression_15(p
):
3336 '''expression : K_NOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3337 print('expression_15', list(p
))
3338 # { PEUnary*tmp = new PEUnary('N', $3);
3339 # FILE_NAME(tmp, @3);
3343 def p_expression_16(p
):
3344 '''expression : K_NXOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3345 print('expression_16', list(p
))
3346 # { PEUnary*tmp = new PEUnary('X', $3);
3347 # FILE_NAME(tmp, @3);
3351 def p_expression_17(p
):
3352 '''expression : '!' error %prec UNARY_PREC '''
3353 print('expression_17', list(p
))
3354 # { yyerror(@1, "error: Operand of unary ! "
3355 # "is not a primary expression.");
3359 def p_expression_18(p
):
3360 '''expression : '^' error %prec UNARY_PREC '''
3361 print('expression_18', list(p
))
3362 # { yyerror(@1, "error: Operand of reduction ^ "
3363 # "is not a primary expression.");
3367 def p_expression_19(p
):
3368 '''expression : expression '^' attribute_list_opt expression '''
3369 print('expression_19', list(p
))
3370 # { PEBinary*tmp = new PEBinary('^', $1, $4);
3371 # FILE_NAME(tmp, @2);
3375 def p_expression_20(p
):
3376 '''expression : expression K_POW attribute_list_opt expression '''
3377 print('expression_20', list(p
))
3378 # { PEBinary*tmp = new PEBPower('p', $1, $4);
3379 # FILE_NAME(tmp, @2);
3383 def p_expression_21(p
):
3384 '''expression : expression '*' attribute_list_opt expression '''
3385 print('expression_21', list(p
))
3386 # { PEBinary*tmp = new PEBinary('*', $1, $4);
3387 # FILE_NAME(tmp, @2);
3391 def p_expression_22(p
):
3392 '''expression : expression '/' attribute_list_opt expression '''
3393 print('expression_22', list(p
))
3394 # { PEBinary*tmp = new PEBinary('/', $1, $4);
3395 # FILE_NAME(tmp, @2);
3399 def p_expression_23(p
):
3400 '''expression : expression '%' attribute_list_opt expression '''
3401 print('expression_23', list(p
))
3402 # { PEBinary*tmp = new PEBinary('%', $1, $4);
3403 # FILE_NAME(tmp, @2);
3407 def p_expression_24(p
):
3408 '''expression : expression '+' attribute_list_opt expression '''
3409 print('expression_24', list(p
))
3410 # { PEBinary*tmp = new PEBinary('+', $1, $4);
3411 # FILE_NAME(tmp, @2);
3415 def p_expression_25(p
):
3416 '''expression : expression '-' attribute_list_opt expression '''
3417 print('expression_25', list(p
))
3418 # { PEBinary*tmp = new PEBinary('-', $1, $4);
3419 # FILE_NAME(tmp, @2);
3423 def p_expression_26(p
):
3424 '''expression : expression '&' attribute_list_opt expression '''
3425 print('expression_26', list(p
))
3426 # { PEBinary*tmp = new PEBinary('&', $1, $4);
3427 # FILE_NAME(tmp, @2);
3431 def p_expression_27(p
):
3432 '''expression : expression '|' attribute_list_opt expression '''
3433 print('expression_27', list(p
))
3434 # { PEBinary*tmp = new PEBinary('|', $1, $4);
3435 # FILE_NAME(tmp, @2);
3439 def p_expression_28(p
):
3440 '''expression : expression K_NAND attribute_list_opt expression '''
3441 print('expression_28', list(p
))
3442 # { PEBinary*tmp = new PEBinary('A', $1, $4);
3443 # FILE_NAME(tmp, @2);
3447 def p_expression_29(p
):
3448 '''expression : expression K_NOR attribute_list_opt expression '''
3449 print('expression_29', list(p
))
3450 # { PEBinary*tmp = new PEBinary('O', $1, $4);
3451 # FILE_NAME(tmp, @2);
3455 def p_expression_30(p
):
3456 '''expression : expression K_NXOR attribute_list_opt expression '''
3457 print('expression_30', list(p
))
3458 # { PEBinary*tmp = new PEBinary('X', $1, $4);
3459 # FILE_NAME(tmp, @2);
3463 def p_expression_31(p
):
3464 '''expression : expression '<' attribute_list_opt expression '''
3465 print('expression_31', list(p
))
3466 # { PEBinary*tmp = new PEBComp('<', $1, $4);
3467 # FILE_NAME(tmp, @2);
3471 def p_expression_32(p
):
3472 '''expression : expression '>' attribute_list_opt expression '''
3473 print('expression_32', list(p
))
3474 # { PEBinary*tmp = new PEBComp('>', $1, $4);
3475 # FILE_NAME(tmp, @2);
3479 def p_expression_33(p
):
3480 '''expression : expression K_LS attribute_list_opt expression '''
3481 print('expression_33', list(p
))
3482 # { PEBinary*tmp = new PEBShift('l', $1, $4);
3483 # FILE_NAME(tmp, @2);
3487 def p_expression_34(p
):
3488 '''expression : expression K_RS attribute_list_opt expression '''
3489 print('expression_34', list(p
))
3490 # { PEBinary*tmp = new PEBShift('r', $1, $4);
3491 # FILE_NAME(tmp, @2);
3495 def p_expression_35(p
):
3496 '''expression : expression K_RSS attribute_list_opt expression '''
3497 print('expression_35', list(p
))
3498 # { PEBinary*tmp = new PEBShift('R', $1, $4);
3499 # FILE_NAME(tmp, @2);
3503 def p_expression_36(p
):
3504 '''expression : expression K_EQ attribute_list_opt expression '''
3505 print('expression_36', list(p
))
3506 # { PEBinary*tmp = new PEBComp('e', $1, $4);
3507 # FILE_NAME(tmp, @2);
3511 def p_expression_37(p
):
3512 '''expression : expression K_CEQ attribute_list_opt expression '''
3513 print('expression_37', list(p
))
3514 # { PEBinary*tmp = new PEBComp('E', $1, $4);
3515 # FILE_NAME(tmp, @2);
3519 def p_expression_38(p
):
3520 '''expression : expression K_WEQ attribute_list_opt expression '''
3521 print('expression_38', list(p
))
3522 # { PEBinary*tmp = new PEBComp('w', $1, $4);
3523 # FILE_NAME(tmp, @2);
3527 def p_expression_39(p
):
3528 '''expression : expression K_LE attribute_list_opt expression '''
3529 print('expression_39', list(p
))
3530 # { PEBinary*tmp = new PEBComp('L', $1, $4);
3531 # FILE_NAME(tmp, @2);
3535 def p_expression_40(p
):
3536 '''expression : expression K_GE attribute_list_opt expression '''
3537 print('expression_40', list(p
))
3538 # { PEBinary*tmp = new PEBComp('G', $1, $4);
3539 # FILE_NAME(tmp, @2);
3543 def p_expression_41(p
):
3544 '''expression : expression K_NE attribute_list_opt expression '''
3545 print('expression_41', list(p
))
3546 # { PEBinary*tmp = new PEBComp('n', $1, $4);
3547 # FILE_NAME(tmp, @2);
3551 def p_expression_42(p
):
3552 '''expression : expression K_CNE attribute_list_opt expression '''
3553 print('expression_42', list(p
))
3554 # { PEBinary*tmp = new PEBComp('N', $1, $4);
3555 # FILE_NAME(tmp, @2);
3559 def p_expression_43(p
):
3560 '''expression : expression K_WNE attribute_list_opt expression '''
3561 print('expression_43', list(p
))
3562 # { PEBinary*tmp = new PEBComp('W', $1, $4);
3563 # FILE_NAME(tmp, @2);
3567 def p_expression_44(p
):
3568 '''expression : expression K_LOR attribute_list_opt expression '''
3569 print('expression_44', list(p
))
3570 # { PEBinary*tmp = new PEBLogic('o', $1, $4);
3571 # FILE_NAME(tmp, @2);
3575 def p_expression_45(p
):
3576 '''expression : expression K_LAND attribute_list_opt expression '''
3577 print('expression_45', list(p
))
3578 # { PEBinary*tmp = new PEBLogic('a', $1, $4);
3579 # FILE_NAME(tmp, @2);
3583 def p_expression_46(p
):
3584 '''expression : expression '?' attribute_list_opt expression ':' expression '''
3585 print('expression_46', list(p
))
3586 # { PETernary*tmp = new PETernary($1, $4, $6);
3587 # FILE_NAME(tmp, @2);
3591 def p_expr_mintypmax_1(p
):
3592 '''expr_mintypmax : expression '''
3593 print('expr_mintypmax_1', list(p
))
3596 def p_expr_mintypmax_2(p
):
3597 '''expr_mintypmax : expression ':' expression ':' expression '''
3598 print('expr_mintypmax_2', list(p
))
3599 # { switch (min_typ_max_flag) {
3616 # if (min_typ_max_warn > 0) {
3617 # cerr << $$->get_fileline() << ": warning: choosing ";
3618 # switch (min_typ_max_flag) {
3629 # cerr << " expression." << endl;
3630 # min_typ_max_warn -= 1;
3634 def p_expression_list_with_nuls_1(p
):
3635 '''expression_list_with_nuls : expression_list_with_nuls ',' expression '''
3636 print('expression_list_with_nuls_1', list(p
))
3637 # { list<PExpr*>*tmp = $1;
3638 # tmp->push_back($3);
3642 def p_expression_list_with_nuls_2(p
):
3643 '''expression_list_with_nuls : expression '''
3644 print('expression_list_with_nuls_2', list(p
))
3645 # { list<PExpr*>*tmp = new list<PExpr*>;
3646 # tmp->push_back($1);
3650 def p_expression_list_with_nuls_3(p
):
3651 '''expression_list_with_nuls : '''
3652 print('expression_list_with_nuls_3', list(p
))
3653 # { list<PExpr*>*tmp = new list<PExpr*>;
3654 # tmp->push_back(0);
3658 def p_expression_list_with_nuls_4(p
):
3659 '''expression_list_with_nuls : expression_list_with_nuls ',' '''
3660 print('expression_list_with_nuls_4', list(p
))
3661 # { list<PExpr*>*tmp = $1;
3662 # tmp->push_back(0);
3666 def p_expression_list_proper_1(p
):
3667 '''expression_list_proper : expression_list_proper ',' expression '''
3668 print('expression_list_proper_1', list(p
))
3669 # { list<PExpr*>*tmp = $1;
3670 # tmp->push_back($3);
3674 def p_expression_list_proper_2(p
):
3675 '''expression_list_proper : expression '''
3676 print('expression_list_proper_2', list(p
))
3677 # { list<PExpr*>*tmp = new list<PExpr*>;
3678 # tmp->push_back($1);
3682 def p_expr_primary_or_typename_1(p
):
3683 '''expr_primary_or_typename : expr_primary '''
3684 print('expr_primary_or_typename_1', list(p
))
3687 def p_expr_primary_or_typename_2(p
):
3688 '''expr_primary_or_typename : TYPE_IDENTIFIER '''
3689 print('expr_primary_or_typename_2', list(p
))
3691 # { PETypename*tmp = new PETypename($1.type);
3692 # FILE_NAME(tmp,@1);
3697 def p_expr_primary_1(p
):
3698 '''expr_primary : number '''
3699 print('expr_primary_1', list(p
))
3702 # PENumber*tmp = new PENumber($1);
3703 # FILE_NAME(tmp, @1);
3707 def p_expr_primary_2(p
):
3708 '''expr_primary : REALTIME '''
3709 print('expr_primary_2', list(p
))
3710 # { PEFNumber*tmp = new PEFNumber($1);
3711 # FILE_NAME(tmp, @1);
3715 def p_expr_primary_3(p
):
3716 '''expr_primary : STRING '''
3717 print('expr_primary_3', list(p
))
3718 # { PEString*tmp = new PEString($1);
3719 # FILE_NAME(tmp, @1);
3723 def p_expr_primary_4(p
):
3724 '''expr_primary : TIME_LITERAL '''
3725 print('expr_primary_4', list(p
))
3730 # if ($1 == 0 || !get_time_unit($1, unit))
3731 # yyerror(@1, "internal error: delay.");
3733 # double p = pow(10.0, (double)(unit - pform_get_timeunit()));
3734 # double time = atof($1) * p;
3736 # verireal *v = new verireal(time);
3737 # $$ = new PEFNumber(v);
3738 # FILE_NAME($$, @1);
3742 def p_expr_primary_5(p
):
3743 '''expr_primary : SYSTEM_IDENTIFIER '''
3744 print('expr_primary_5', list(p
))
3745 # { perm_string tn = lex_strings.make($1);
3746 # PECallFunction*tmp = new PECallFunction(tn);
3747 # FILE_NAME(tmp, @1);
3752 def p_expr_primary_6(p
):
3753 '''expr_primary : hierarchy_identifier '''
3754 print('expr_primary_6', list(p
))
3756 # { PEIdent*tmp = pform_new_ident(*$1);
3757 # FILE_NAME(tmp, @1);
3762 def p_expr_primary_7(p
):
3763 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier '''
3764 print('expr_primary_7', list(p
))
3765 # { $$ = pform_package_ident(@2, $1, $3);
3769 def p_expr_primary_8(p
):
3770 '''expr_primary : hierarchy_identifier '(' expression_list_with_nuls ')' '''
3771 print('expr_primary_8', list(p
))
3772 # { list<PExpr*>*expr_list = $3;
3773 # strip_tail_items(expr_list);
3774 # PECallFunction*tmp = pform_make_call_function(@1, *$1, *expr_list);
3779 def p_expr_primary_9(p
):
3780 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' '''
3781 print('expr_primary_9', list(p
))
3782 # { pform_name_t*t_name = $1;
3783 # while (! $3->empty()) {
3784 # t_name->push_back($3->front());
3787 # list<PExpr*>*expr_list = $5;
3788 # strip_tail_items(expr_list);
3789 # PECallFunction*tmp = pform_make_call_function(@1, *t_name, *expr_list);
3795 def p_expr_primary_10(p
):
3796 '''expr_primary : SYSTEM_IDENTIFIER '(' expression_list_proper ')' '''
3797 print('expr_primary_10', list(p
))
3798 # { perm_string tn = lex_strings.make($1);
3799 # PECallFunction*tmp = new PECallFunction(tn, *$3);
3800 # FILE_NAME(tmp, @1);
3805 def p_expr_primary_11(p
):
3806 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')' '''
3807 print('expr_primary_11', list(p
))
3808 # { perm_string use_name = lex_strings.make($3);
3809 # PECallFunction*tmp = new PECallFunction($1, use_name, *$5);
3810 # FILE_NAME(tmp, @3);
3815 def p_expr_primary_12(p
):
3816 '''expr_primary : SYSTEM_IDENTIFIER '(' ')' '''
3817 print('expr_primary_12', list(p
))
3818 # { perm_string tn = lex_strings.make($1);
3819 # const vector<PExpr*>empty;
3820 # PECallFunction*tmp = new PECallFunction(tn, empty);
3821 # FILE_NAME(tmp, @1);
3824 # if (!gn_system_verilog()) {
3825 # yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
3829 def p_expr_primary_13(p
):
3830 '''expr_primary : implicit_class_handle '''
3831 print('expr_primary_13', list(p
))
3832 # { PEIdent*tmp = new PEIdent(*$1);
3833 # FILE_NAME(tmp,@1);
3838 def p_expr_primary_14(p
):
3839 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '''
3840 print('expr_primary_14', list(p
))
3841 # { pform_name_t*t_name = $1;
3842 # while (! $3->empty()) {
3843 # t_name->push_back($3->front());
3846 # PEIdent*tmp = new PEIdent(*t_name);
3847 # FILE_NAME(tmp,@1);
3853 def p_expr_primary_15(p
):
3854 '''expr_primary : K_acos '(' expression ')' '''
3855 print('expr_primary_15', list(p
))
3856 # { perm_string tn = perm_string::literal("$acos");
3857 # PECallFunction*tmp = make_call_function(tn, $3);
3858 # FILE_NAME(tmp,@1);
3862 def p_expr_primary_16(p
):
3863 '''expr_primary : K_acosh '(' expression ')' '''
3864 print('expr_primary_16', list(p
))
3865 # { perm_string tn = perm_string::literal("$acosh");
3866 # PECallFunction*tmp = make_call_function(tn, $3);
3867 # FILE_NAME(tmp,@1);
3871 def p_expr_primary_17(p
):
3872 '''expr_primary : K_asin '(' expression ')' '''
3873 print('expr_primary_17', list(p
))
3874 # { perm_string tn = perm_string::literal("$asin");
3875 # PECallFunction*tmp = make_call_function(tn, $3);
3876 # FILE_NAME(tmp,@1);
3880 def p_expr_primary_18(p
):
3881 '''expr_primary : K_asinh '(' expression ')' '''
3882 print('expr_primary_18', list(p
))
3883 # { perm_string tn = perm_string::literal("$asinh");
3884 # PECallFunction*tmp = make_call_function(tn, $3);
3885 # FILE_NAME(tmp,@1);
3889 def p_expr_primary_19(p
):
3890 '''expr_primary : K_atan '(' expression ')' '''
3891 print('expr_primary_19', list(p
))
3892 # { perm_string tn = perm_string::literal("$atan");
3893 # PECallFunction*tmp = make_call_function(tn, $3);
3894 # FILE_NAME(tmp,@1);
3898 def p_expr_primary_20(p
):
3899 '''expr_primary : K_atanh '(' expression ')' '''
3900 print('expr_primary_20', list(p
))
3901 # { perm_string tn = perm_string::literal("$atanh");
3902 # PECallFunction*tmp = make_call_function(tn, $3);
3903 # FILE_NAME(tmp,@1);
3907 def p_expr_primary_21(p
):
3908 '''expr_primary : K_atan2 '(' expression ',' expression ')' '''
3909 print('expr_primary_21', list(p
))
3910 # { perm_string tn = perm_string::literal("$atan2");
3911 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3912 # FILE_NAME(tmp,@1);
3916 def p_expr_primary_22(p
):
3917 '''expr_primary : K_ceil '(' expression ')' '''
3918 print('expr_primary_22', list(p
))
3919 # { perm_string tn = perm_string::literal("$ceil");
3920 # PECallFunction*tmp = make_call_function(tn, $3);
3921 # FILE_NAME(tmp,@1);
3925 def p_expr_primary_23(p
):
3926 '''expr_primary : K_cos '(' expression ')' '''
3927 print('expr_primary_23', list(p
))
3928 # { perm_string tn = perm_string::literal("$cos");
3929 # PECallFunction*tmp = make_call_function(tn, $3);
3930 # FILE_NAME(tmp,@1);
3934 def p_expr_primary_24(p
):
3935 '''expr_primary : K_cosh '(' expression ')' '''
3936 print('expr_primary_24', list(p
))
3937 # { perm_string tn = perm_string::literal("$cosh");
3938 # PECallFunction*tmp = make_call_function(tn, $3);
3939 # FILE_NAME(tmp,@1);
3943 def p_expr_primary_25(p
):
3944 '''expr_primary : K_exp '(' expression ')' '''
3945 print('expr_primary_25', list(p
))
3946 # { perm_string tn = perm_string::literal("$exp");
3947 # PECallFunction*tmp = make_call_function(tn, $3);
3948 # FILE_NAME(tmp,@1);
3952 def p_expr_primary_26(p
):
3953 '''expr_primary : K_floor '(' expression ')' '''
3954 print('expr_primary_26', list(p
))
3955 # { perm_string tn = perm_string::literal("$floor");
3956 # PECallFunction*tmp = make_call_function(tn, $3);
3957 # FILE_NAME(tmp,@1);
3961 def p_expr_primary_27(p
):
3962 '''expr_primary : K_hypot '(' expression ',' expression ')' '''
3963 print('expr_primary_27', list(p
))
3964 # { perm_string tn = perm_string::literal("$hypot");
3965 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3966 # FILE_NAME(tmp,@1);
3970 def p_expr_primary_28(p
):
3971 '''expr_primary : K_ln '(' expression ')' '''
3972 print('expr_primary_28', list(p
))
3973 # { perm_string tn = perm_string::literal("$ln");
3974 # PECallFunction*tmp = make_call_function(tn, $3);
3975 # FILE_NAME(tmp,@1);
3979 def p_expr_primary_29(p
):
3980 '''expr_primary : K_log '(' expression ')' '''
3981 print('expr_primary_29', list(p
))
3982 # { perm_string tn = perm_string::literal("$log10");
3983 # PECallFunction*tmp = make_call_function(tn, $3);
3984 # FILE_NAME(tmp,@1);
3988 def p_expr_primary_30(p
):
3989 '''expr_primary : K_pow '(' expression ',' expression ')' '''
3990 print('expr_primary_30', list(p
))
3991 # { perm_string tn = perm_string::literal("$pow");
3992 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3993 # FILE_NAME(tmp,@1);
3997 def p_expr_primary_31(p
):
3998 '''expr_primary : K_sin '(' expression ')' '''
3999 print('expr_primary_31', list(p
))
4000 # { perm_string tn = perm_string::literal("$sin");
4001 # PECallFunction*tmp = make_call_function(tn, $3);
4002 # FILE_NAME(tmp,@1);
4006 def p_expr_primary_32(p
):
4007 '''expr_primary : K_sinh '(' expression ')' '''
4008 print('expr_primary_32', list(p
))
4009 # { perm_string tn = perm_string::literal("$sinh");
4010 # PECallFunction*tmp = make_call_function(tn, $3);
4011 # FILE_NAME(tmp,@1);
4015 def p_expr_primary_33(p
):
4016 '''expr_primary : K_sqrt '(' expression ')' '''
4017 print('expr_primary_33', list(p
))
4018 # { perm_string tn = perm_string::literal("$sqrt");
4019 # PECallFunction*tmp = make_call_function(tn, $3);
4020 # FILE_NAME(tmp,@1);
4024 def p_expr_primary_34(p
):
4025 '''expr_primary : K_tan '(' expression ')' '''
4026 print('expr_primary_34', list(p
))
4027 # { perm_string tn = perm_string::literal("$tan");
4028 # PECallFunction*tmp = make_call_function(tn, $3);
4029 # FILE_NAME(tmp,@1);
4033 def p_expr_primary_35(p
):
4034 '''expr_primary : K_tanh '(' expression ')' '''
4035 print('expr_primary_35', list(p
))
4036 # { perm_string tn = perm_string::literal("$tanh");
4037 # PECallFunction*tmp = make_call_function(tn, $3);
4038 # FILE_NAME(tmp,@1);
4042 def p_expr_primary_36(p
):
4043 '''expr_primary : K_abs '(' expression ')' '''
4044 print('expr_primary_36', list(p
))
4045 # { PEUnary*tmp = new PEUnary('m', $3);
4046 # FILE_NAME(tmp,@1);
4050 def p_expr_primary_37(p
):
4051 '''expr_primary : K_max '(' expression ',' expression ')' '''
4052 print('expr_primary_37', list(p
))
4053 # { PEBinary*tmp = new PEBinary('M', $3, $5);
4054 # FILE_NAME(tmp,@1);
4058 def p_expr_primary_38(p
):
4059 '''expr_primary : K_min '(' expression ',' expression ')' '''
4060 print('expr_primary_38', list(p
))
4061 # { PEBinary*tmp = new PEBinary('m', $3, $5);
4062 # FILE_NAME(tmp,@1);
4066 def p_expr_primary_39(p
):
4067 '''expr_primary : '(' expr_mintypmax ')' '''
4068 print('expr_primary_39', list(p
))
4071 def p_expr_primary_40(p
):
4072 '''expr_primary : '{' expression_list_proper '}' '''
4073 print('expr_primary_40', list(p
))
4074 # { PEConcat*tmp = new PEConcat(*$2);
4075 # FILE_NAME(tmp, @1);
4080 def p_expr_primary_41(p
):
4081 '''expr_primary : '{' expression '{' expression_list_proper '}' '}' '''
4082 print('expr_primary_41', list(p
))
4084 # PEConcat*tmp = new PEConcat(*$4, rep);
4085 # FILE_NAME(tmp, @1);
4090 def p_expr_primary_42(p
):
4091 '''expr_primary : '{' expression '{' expression_list_proper '}' error '}' '''
4092 print('expr_primary_42', list(p
))
4094 # PEConcat*tmp = new PEConcat(*$4, rep);
4095 # FILE_NAME(tmp, @1);
4098 # yyerror(@5, "error: Syntax error between internal '}' "
4099 # "and closing '}' of repeat concatenation.");
4103 def p_expr_primary_43(p
):
4104 '''expr_primary : '{' '}' '''
4105 print('expr_primary_43', list(p
))
4106 # { // This is the empty queue syntax.
4107 # if (gn_system_verilog()) {
4108 # list<PExpr*> empty_list;
4109 # PEConcat*tmp = new PEConcat(empty_list);
4110 # FILE_NAME(tmp, @1);
4113 # yyerror(@1, "error: Concatenations are not allowed to be empty.");
4118 def p_expr_primary_44(p
):
4119 '''expr_primary : expr_primary "'" '(' expression ')' '''
4120 print('expr_primary_44', list(p
))
4121 # { PExpr*base = $4;
4122 # if (gn_system_verilog()) {
4123 # PECastSize*tmp = new PECastSize($1, base);
4124 # FILE_NAME(tmp, @1);
4127 # yyerror(@1, "error: Size cast requires SystemVerilog.");
4132 def p_expr_primary_45(p
):
4133 '''expr_primary : simple_type_or_string "'" '(' expression ')' '''
4134 print('expr_primary_45', list(p
))
4135 # { PExpr*base = $4;
4136 # if (gn_system_verilog()) {
4137 # PECastType*tmp = new PECastType($1, base);
4138 # FILE_NAME(tmp, @1);
4141 # yyerror(@1, "error: Type cast requires SystemVerilog.");
4146 def p_expr_primary_46(p
):
4147 '''expr_primary : assignment_pattern '''
4148 print('expr_primary_46', list(p
))
4151 def p_expr_primary_47(p
):
4152 '''expr_primary : streaming_concatenation '''
4153 print('expr_primary_47', list(p
))
4156 def p_expr_primary_48(p
):
4157 '''expr_primary : K_null '''
4158 print('expr_primary_48', list(p
))
4159 # { PENull*tmp = new PENull;
4160 # FILE_NAME(tmp, @1);
4164 def p_function_item_list_opt_1(p
):
4165 '''function_item_list_opt : function_item_list '''
4166 print('function_item_list_opt_1', list(p
))
4169 def p_function_item_list_opt_2(p
):
4170 '''function_item_list_opt : '''
4171 print('function_item_list_opt_2', list(p
))
4174 def p_function_item_list_1(p
):
4175 '''function_item_list : function_item '''
4176 print('function_item_list_1', list(p
))
4179 def p_function_item_list_2(p
):
4180 '''function_item_list : function_item_list function_item '''
4181 print('function_item_list_2', list(p
))
4184 # vector<pform_tf_port_t>*tmp = $1;
4185 # size_t s1 = tmp->size();
4186 # tmp->resize(s1 + $2->size());
4187 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
4188 # tmp->at(s1+idx) = $2->at(idx);
4198 def p_function_item_1(p
):
4199 '''function_item : tf_port_declaration '''
4200 print('function_item_1', list(p
))
4203 def p_function_item_2(p
):
4204 '''function_item : block_item_decl '''
4205 print('function_item_2', list(p
))
4208 def p_gate_instance_1(p
):
4209 '''gate_instance : IDENTIFIER '(' expression_list_with_nuls ')' '''
4210 print('gate_instance_1', list(p
))
4211 # { lgate*tmp = new lgate;
4214 # tmp->file = @1.text;
4215 # tmp->lineno = @1.first_line;
4220 def p_gate_instance_2(p
):
4221 '''gate_instance : IDENTIFIER dimensions '(' expression_list_with_nuls ')' '''
4222 print('gate_instance_2', list(p
))
4223 # { lgate*tmp = new lgate;
4224 # list<pform_range_t>*rng = $2;
4227 # tmp->range = rng->front();
4229 # assert(rng->empty());
4230 # tmp->file = @1.text;
4231 # tmp->lineno = @1.first_line;
4237 def p_gate_instance_3(p
):
4238 '''gate_instance : '(' expression_list_with_nuls ')' '''
4239 print('gate_instance_3', list(p
))
4240 # { lgate*tmp = new lgate;
4243 # tmp->file = @1.text;
4244 # tmp->lineno = @1.first_line;
4248 def p_gate_instance_4(p
):
4249 '''gate_instance : IDENTIFIER dimensions '''
4250 print('gate_instance_4', list(p
))
4251 # { lgate*tmp = new lgate;
4252 # list<pform_range_t>*rng = $2;
4255 # tmp->parms_by_name = 0;
4256 # tmp->range = rng->front();
4258 # assert(rng->empty());
4259 # tmp->file = @1.text;
4260 # tmp->lineno = @1.first_line;
4266 def p_gate_instance_5(p
):
4267 '''gate_instance : IDENTIFIER '(' port_name_list ')' '''
4268 print('gate_instance_5', list(p
))
4269 # { lgate*tmp = new lgate;
4272 # tmp->parms_by_name = $3;
4273 # tmp->file = @1.text;
4274 # tmp->lineno = @1.first_line;
4279 def p_gate_instance_6(p
):
4280 '''gate_instance : IDENTIFIER dimensions '(' port_name_list ')' '''
4281 print('gate_instance_6', list(p
))
4282 # { lgate*tmp = new lgate;
4283 # list<pform_range_t>*rng = $2;
4286 # tmp->parms_by_name = $4;
4287 # tmp->range = rng->front();
4289 # assert(rng->empty());
4290 # tmp->file = @1.text;
4291 # tmp->lineno = @1.first_line;
4297 def p_gate_instance_7(p
):
4298 '''gate_instance : IDENTIFIER '(' error ')' '''
4299 print('gate_instance_7', list(p
))
4300 # { lgate*tmp = new lgate;
4303 # tmp->parms_by_name = 0;
4304 # tmp->file = @1.text;
4305 # tmp->lineno = @1.first_line;
4306 # yyerror(@2, "error: Syntax error in instance port "
4307 # "expression(s).");
4312 def p_gate_instance_8(p
):
4313 '''gate_instance : IDENTIFIER dimensions '(' error ')' '''
4314 print('gate_instance_8', list(p
))
4315 # { lgate*tmp = new lgate;
4318 # tmp->parms_by_name = 0;
4319 # tmp->file = @1.text;
4320 # tmp->lineno = @1.first_line;
4321 # yyerror(@3, "error: Syntax error in instance port "
4322 # "expression(s).");
4327 def p_gate_instance_list_1(p
):
4328 '''gate_instance_list : gate_instance_list ',' gate_instance '''
4329 print('gate_instance_list_1', list(p
))
4330 # { svector<lgate>*tmp1 = $1;
4332 # svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
4338 def p_gate_instance_list_2(p
):
4339 '''gate_instance_list : gate_instance '''
4340 print('gate_instance_list_2', list(p
))
4341 # { svector<lgate>*tmp = new svector<lgate>(1);
4347 def p_gatetype_1(p
):
4348 '''gatetype : K_and '''
4349 print('gatetype_1', list(p
))
4350 # { $$ = PGBuiltin::AND; }
4352 def p_gatetype_2(p
):
4353 '''gatetype : K_nand '''
4354 print('gatetype_2', list(p
))
4355 # { $$ = PGBuiltin::NAND; }
4357 def p_gatetype_3(p
):
4358 '''gatetype : K_or '''
4359 print('gatetype_3', list(p
))
4360 # { $$ = PGBuiltin::OR; }
4362 def p_gatetype_4(p
):
4363 '''gatetype : K_nor '''
4364 print('gatetype_4', list(p
))
4365 # { $$ = PGBuiltin::NOR; }
4367 def p_gatetype_5(p
):
4368 '''gatetype : K_xor '''
4369 print('gatetype_5', list(p
))
4370 # { $$ = PGBuiltin::XOR; }
4372 def p_gatetype_6(p
):
4373 '''gatetype : K_xnor '''
4374 print('gatetype_6', list(p
))
4375 # { $$ = PGBuiltin::XNOR; }
4377 def p_gatetype_7(p
):
4378 '''gatetype : K_buf '''
4379 print('gatetype_7', list(p
))
4380 # { $$ = PGBuiltin::BUF; }
4382 def p_gatetype_8(p
):
4383 '''gatetype : K_bufif0 '''
4384 print('gatetype_8', list(p
))
4385 # { $$ = PGBuiltin::BUFIF0; }
4387 def p_gatetype_9(p
):
4388 '''gatetype : K_bufif1 '''
4389 print('gatetype_9', list(p
))
4390 # { $$ = PGBuiltin::BUFIF1; }
4392 def p_gatetype_10(p
):
4393 '''gatetype : K_not '''
4394 print('gatetype_10', list(p
))
4395 # { $$ = PGBuiltin::NOT; }
4397 def p_gatetype_11(p
):
4398 '''gatetype : K_notif0 '''
4399 print('gatetype_11', list(p
))
4400 # { $$ = PGBuiltin::NOTIF0; }
4402 def p_gatetype_12(p
):
4403 '''gatetype : K_notif1 '''
4404 print('gatetype_12', list(p
))
4405 # { $$ = PGBuiltin::NOTIF1; }
4407 def p_switchtype_1(p
):
4408 '''switchtype : K_nmos '''
4409 print('switchtype_1', list(p
))
4410 # { $$ = PGBuiltin::NMOS; }
4412 def p_switchtype_2(p
):
4413 '''switchtype : K_rnmos '''
4414 print('switchtype_2', list(p
))
4415 # { $$ = PGBuiltin::RNMOS; }
4417 def p_switchtype_3(p
):
4418 '''switchtype : K_pmos '''
4419 print('switchtype_3', list(p
))
4420 # { $$ = PGBuiltin::PMOS; }
4422 def p_switchtype_4(p
):
4423 '''switchtype : K_rpmos '''
4424 print('switchtype_4', list(p
))
4425 # { $$ = PGBuiltin::RPMOS; }
4427 def p_switchtype_5(p
):
4428 '''switchtype : K_cmos '''
4429 print('switchtype_5', list(p
))
4430 # { $$ = PGBuiltin::CMOS; }
4432 def p_switchtype_6(p
):
4433 '''switchtype : K_rcmos '''
4434 print('switchtype_6', list(p
))
4435 # { $$ = PGBuiltin::RCMOS; }
4437 def p_switchtype_7(p
):
4438 '''switchtype : K_tran '''
4439 print('switchtype_7', list(p
))
4440 # { $$ = PGBuiltin::TRAN; }
4442 def p_switchtype_8(p
):
4443 '''switchtype : K_rtran '''
4444 print('switchtype_8', list(p
))
4445 # { $$ = PGBuiltin::RTRAN; }
4447 def p_switchtype_9(p
):
4448 '''switchtype : K_tranif0 '''
4449 print('switchtype_9', list(p
))
4450 # { $$ = PGBuiltin::TRANIF0; }
4452 def p_switchtype_10(p
):
4453 '''switchtype : K_tranif1 '''
4454 print('switchtype_10', list(p
))
4455 # { $$ = PGBuiltin::TRANIF1; }
4457 def p_switchtype_11(p
):
4458 '''switchtype : K_rtranif0 '''
4459 print('switchtype_11', list(p
))
4460 # { $$ = PGBuiltin::RTRANIF0; }
4462 def p_switchtype_12(p
):
4463 '''switchtype : K_rtranif1 '''
4464 print('switchtype_12', list(p
))
4465 # { $$ = PGBuiltin::RTRANIF1; }
4467 def p_hierarchy_identifier_1(p
):
4468 '''hierarchy_identifier : IDENTIFIER '''
4469 print('hierarchy_identifier_1', list(p
))
4470 lpvalue
= Leaf(token
.NAME
, p
[1])
4472 # { $$ = new pform_name_t;
4473 # $$->push_back(name_component_t(lex_strings.make($1)));
4477 def p_hierarchy_identifier_2(p
):
4478 '''hierarchy_identifier : hierarchy_identifier '.' IDENTIFIER '''
4479 print('hierarchy_identifier_2', list(p
))
4480 # { pform_name_t * tmp = $1;
4481 # tmp->push_back(name_component_t(lex_strings.make($3)));
4486 def p_hierarchy_identifier_3(p
):
4487 '''hierarchy_identifier : hierarchy_identifier '[' expression ']' '''
4488 print('hierarchy_identifier_3', list(p
))
4489 # { pform_name_t * tmp = $1;
4490 # name_component_t&tail = tmp->back();
4491 # index_component_t itmp;
4492 # itmp.sel = index_component_t::SEL_BIT;
4494 # tail.index.push_back(itmp);
4498 def p_hierarchy_identifier_4(p
):
4499 '''hierarchy_identifier : hierarchy_identifier '[' '$' ']' '''
4500 print('hierarchy_identifier_4', list(p
))
4501 # { pform_name_t * tmp = $1;
4502 # name_component_t&tail = tmp->back();
4503 # if (! gn_system_verilog()) {
4504 # yyerror(@3, "error: Last element expression ($) "
4505 # "requires SystemVerilog. Try enabling SystemVerilog.");
4507 # index_component_t itmp;
4508 # itmp.sel = index_component_t::SEL_BIT_LAST;
4511 # tail.index.push_back(itmp);
4515 def p_hierarchy_identifier_5(p
):
4516 '''hierarchy_identifier : hierarchy_identifier '[' expression ':' expression ']' '''
4517 print('hierarchy_identifier_5', list(p
))
4518 # { pform_name_t * tmp = $1;
4519 # name_component_t&tail = tmp->back();
4520 # index_component_t itmp;
4521 # itmp.sel = index_component_t::SEL_PART;
4524 # tail.index.push_back(itmp);
4528 def p_hierarchy_identifier_6(p
):
4529 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_POS expression ']' '''
4530 print('hierarchy_identifier_6', list(p
))
4531 # { pform_name_t * tmp = $1;
4532 # name_component_t&tail = tmp->back();
4533 # index_component_t itmp;
4534 # itmp.sel = index_component_t::SEL_IDX_UP;
4537 # tail.index.push_back(itmp);
4541 def p_hierarchy_identifier_7(p
):
4542 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_NEG expression ']' '''
4543 print('hierarchy_identifier_7', list(p
))
4544 # { pform_name_t * tmp = $1;
4545 # name_component_t&tail = tmp->back();
4546 # index_component_t itmp;
4547 # itmp.sel = index_component_t::SEL_IDX_DO;
4550 # tail.index.push_back(itmp);
4554 def p_list_of_identifiers_1(p
):
4555 '''list_of_identifiers : IDENTIFIER '''
4556 print('list_of_identifiers_1', list(p
))
4557 # { $$ = list_from_identifier($1); }
4559 def p_list_of_identifiers_2(p
):
4560 '''list_of_identifiers : list_of_identifiers ',' IDENTIFIER '''
4561 print('list_of_identifiers_2', list(p
))
4562 # { $$ = list_from_identifier($1, $3); }
4564 def p_list_of_port_identifiers_1(p
):
4565 '''list_of_port_identifiers : IDENTIFIER dimensions_opt '''
4566 print('list_of_port_identifiers_1', list(p
))
4567 # { $$ = make_port_list($1, $2, 0); }
4569 def p_list_of_port_identifiers_2(p
):
4570 '''list_of_port_identifiers : list_of_port_identifiers ',' IDENTIFIER dimensions_opt '''
4571 print('list_of_port_identifiers_2', list(p
))
4572 # { $$ = make_port_list($1, $3, $4, 0); }
4574 def p_list_of_variable_port_identifiers_1(p
):
4575 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '''
4576 print('list_of_variable_port_identifiers_1', list(p
))
4577 # { $$ = make_port_list($1, $2, 0); }
4579 def p_list_of_variable_port_identifiers_2(p
):
4580 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '=' expression '''
4581 print('list_of_variable_port_identifiers_2', list(p
))
4582 # { $$ = make_port_list($1, $2, $4); }
4584 def p_list_of_variable_port_identifiers_3(p
):
4585 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '''
4586 print('list_of_variable_port_identifiers_3', list(p
))
4587 # { $$ = make_port_list($1, $3, $4, 0); }
4589 def p_list_of_variable_port_identifiers_4(p
):
4590 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '=' expression '''
4591 print('list_of_variable_port_identifiers_4', list(p
))
4592 # { $$ = make_port_list($1, $3, $4, $6); }
4594 def p_list_of_ports_1(p
):
4595 '''list_of_ports : port_opt '''
4596 print('list_of_ports_1', list(p
))
4597 # { vector<Module::port_t*>*tmp
4598 # = new vector<Module::port_t*>(1);
4603 def p_list_of_ports_2(p
):
4604 '''list_of_ports : list_of_ports ',' port_opt '''
4605 print('list_of_ports_2', list(p
))
4606 # { vector<Module::port_t*>*tmp = $1;
4607 # tmp->push_back($3);
4611 def p_list_of_port_declarations_1(p
):
4612 '''list_of_port_declarations : port_declaration '''
4613 print('list_of_port_declarations_1', list(p
))
4614 # { vector<Module::port_t*>*tmp
4615 # = new vector<Module::port_t*>(1);
4620 def p_list_of_port_declarations_2(p
):
4621 '''list_of_port_declarations : list_of_port_declarations ',' port_declaration '''
4622 print('list_of_port_declarations_2', list(p
))
4623 # { vector<Module::port_t*>*tmp = $1;
4624 # tmp->push_back($3);
4628 def p_list_of_port_declarations_3(p
):
4629 '''list_of_port_declarations : list_of_port_declarations ',' IDENTIFIER '''
4630 print('list_of_port_declarations_3', list(p
))
4631 # { Module::port_t*ptmp;
4632 # perm_string name = lex_strings.make($3);
4633 # ptmp = pform_module_port_reference(name, @3.text,
4635 # vector<Module::port_t*>*tmp = $1;
4636 # tmp->push_back(ptmp);
4638 # /* Get the port declaration details, the port type
4639 # and what not, from context data stored by the
4640 # last port_declaration rule. */
4641 # pform_module_define_port(@3, name,
4642 # port_declaration_context.port_type,
4643 # port_declaration_context.port_net_type,
4644 # port_declaration_context.data_type, 0);
4649 def p_list_of_port_declarations_4(p
):
4650 '''list_of_port_declarations : list_of_port_declarations ',' '''
4651 print('list_of_port_declarations_4', list(p
))
4653 # yyerror(@2, "error: NULL port declarations are not "
4657 def p_list_of_port_declarations_5(p
):
4658 '''list_of_port_declarations : list_of_port_declarations ';' '''
4659 print('list_of_port_declarations_5', list(p
))
4661 # yyerror(@2, "error: ';' is an invalid port declaration "
4665 def p_port_declaration_1(p
):
4666 '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4667 print('port_declaration_1', list(p
))
4668 # { Module::port_t*ptmp;
4669 # perm_string name = lex_strings.make($5);
4670 # data_type_t*use_type = $4;
4671 # if ($6) use_type = new uarray_type_t(use_type, $6);
4672 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4673 # pform_module_define_port(@2, name, NetNet::PINPUT, $3, use_type, $1);
4674 # port_declaration_context.port_type = NetNet::PINPUT;
4675 # port_declaration_context.port_net_type = $3;
4676 # port_declaration_context.data_type = $4;
4681 def p_port_declaration_2(p
):
4682 '''port_declaration : attribute_list_opt K_input K_wreal IDENTIFIER '''
4683 print('port_declaration_2', list(p
))
4684 # { Module::port_t*ptmp;
4685 # perm_string name = lex_strings.make($4);
4686 # ptmp = pform_module_port_reference(name, @2.text,
4688 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4689 # FILE_NAME(real_type, @3);
4690 # pform_module_define_port(@2, name, NetNet::PINPUT,
4691 # NetNet::WIRE, real_type, $1);
4692 # port_declaration_context.port_type = NetNet::PINPUT;
4693 # port_declaration_context.port_net_type = NetNet::WIRE;
4694 # port_declaration_context.data_type = real_type;
4699 def p_port_declaration_3(p
):
4700 '''port_declaration : attribute_list_opt K_inout net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4701 print('port_declaration_3', list(p
))
4702 # { Module::port_t*ptmp;
4703 # perm_string name = lex_strings.make($5);
4704 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4705 # pform_module_define_port(@2, name, NetNet::PINOUT, $3, $4, $1);
4706 # port_declaration_context.port_type = NetNet::PINOUT;
4707 # port_declaration_context.port_net_type = $3;
4708 # port_declaration_context.data_type = $4;
4711 # yyerror(@6, "sorry: Inout ports with unpacked dimensions not supported.");
4717 def p_port_declaration_4(p
):
4718 '''port_declaration : attribute_list_opt K_inout K_wreal IDENTIFIER '''
4719 print('port_declaration_4', list(p
))
4720 # { Module::port_t*ptmp;
4721 # perm_string name = lex_strings.make($4);
4722 # ptmp = pform_module_port_reference(name, @2.text,
4724 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4725 # FILE_NAME(real_type, @3);
4726 # pform_module_define_port(@2, name, NetNet::PINOUT,
4727 # NetNet::WIRE, real_type, $1);
4728 # port_declaration_context.port_type = NetNet::PINOUT;
4729 # port_declaration_context.port_net_type = NetNet::WIRE;
4730 # port_declaration_context.data_type = real_type;
4735 def p_port_declaration_5(p
):
4736 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4737 print('port_declaration_5', list(p
))
4738 # { Module::port_t*ptmp;
4739 # perm_string name = lex_strings.make($5);
4740 # data_type_t*use_dtype = $4;
4741 # if ($6) use_dtype = new uarray_type_t(use_dtype, $6);
4742 # NetNet::Type use_type = $3;
4743 # if (use_type == NetNet::IMPLICIT) {
4744 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($4)) {
4745 # if (dtype->reg_flag)
4746 # use_type = NetNet::REG;
4747 # else if (dtype->implicit_flag)
4748 # use_type = NetNet::IMPLICIT;
4750 # use_type = NetNet::IMPLICIT_REG;
4752 # // The SystemVerilog types that can show up as
4753 # // output ports are implicitly (on the inside)
4754 # // variables because "reg" is not valid syntax
4756 # } else if (dynamic_cast<atom2_type_t*> ($4)) {
4757 # use_type = NetNet::IMPLICIT_REG;
4758 # } else if (dynamic_cast<struct_type_t*> ($4)) {
4759 # use_type = NetNet::IMPLICIT_REG;
4760 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> ($4)) {
4761 # if(etype->base_type == IVL_VT_LOGIC)
4762 # use_type = NetNet::IMPLICIT_REG;
4765 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4766 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, use_dtype, $1);
4767 # port_declaration_context.port_type = NetNet::POUTPUT;
4768 # port_declaration_context.port_net_type = use_type;
4769 # port_declaration_context.data_type = $4;
4774 def p_port_declaration_6(p
):
4775 '''port_declaration : attribute_list_opt K_output K_wreal IDENTIFIER '''
4776 print('port_declaration_6', list(p
))
4777 # { Module::port_t*ptmp;
4778 # perm_string name = lex_strings.make($4);
4779 # ptmp = pform_module_port_reference(name, @2.text,
4781 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4782 # FILE_NAME(real_type, @3);
4783 # pform_module_define_port(@2, name, NetNet::POUTPUT,
4784 # NetNet::WIRE, real_type, $1);
4785 # port_declaration_context.port_type = NetNet::POUTPUT;
4786 # port_declaration_context.port_net_type = NetNet::WIRE;
4787 # port_declaration_context.data_type = real_type;
4792 def p_port_declaration_7(p
):
4793 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER '=' expression '''
4794 print('port_declaration_7', list(p
))
4795 # { Module::port_t*ptmp;
4796 # perm_string name = lex_strings.make($5);
4797 # NetNet::Type use_type = $3;
4798 # if (use_type == NetNet::IMPLICIT) {
4799 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($4)) {
4800 # if (dtype->reg_flag)
4801 # use_type = NetNet::REG;
4803 # use_type = NetNet::IMPLICIT_REG;
4805 # use_type = NetNet::IMPLICIT_REG;
4808 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4809 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, $4, $1);
4810 # port_declaration_context.port_type = NetNet::PINOUT;
4811 # port_declaration_context.port_net_type = use_type;
4812 # port_declaration_context.data_type = $4;
4814 # pform_make_var_init(@5, name, $7);
4820 def p_net_type_opt_1(p
):
4821 '''net_type_opt : net_type '''
4822 print('net_type_opt_1', list(p
))
4825 def p_net_type_opt_2(p
):
4826 '''net_type_opt : '''
4827 print('net_type_opt_2', list(p
))
4828 # { $$ = NetNet::IMPLICIT; }
4830 def p_unsigned_signed_opt_1(p
):
4831 '''unsigned_signed_opt : K_signed '''
4832 print('unsigned_signed_opt_1', list(p
))
4835 def p_unsigned_signed_opt_2(p
):
4836 '''unsigned_signed_opt : K_unsigned '''
4837 print('unsigned_signed_opt_2', list(p
))
4840 def p_unsigned_signed_opt_3(p
):
4841 '''unsigned_signed_opt : '''
4842 print('unsigned_signed_opt_3', list(p
))
4845 def p_signed_unsigned_opt_1(p
):
4846 '''signed_unsigned_opt : K_signed '''
4847 print('signed_unsigned_opt_1', list(p
))
4850 def p_signed_unsigned_opt_2(p
):
4851 '''signed_unsigned_opt : K_unsigned '''
4852 print('signed_unsigned_opt_2', list(p
))
4855 def p_signed_unsigned_opt_3(p
):
4856 '''signed_unsigned_opt : '''
4857 print('signed_unsigned_opt_3', list(p
))
4860 def p_atom2_type_1(p
):
4861 '''atom2_type : K_byte '''
4862 print('atom2_type_1', list(p
))
4865 def p_atom2_type_2(p
):
4866 '''atom2_type : K_shortint '''
4867 print('atom2_type_2', list(p
))
4870 def p_atom2_type_3(p
):
4871 '''atom2_type : K_int '''
4872 print('atom2_type_3', list(p
))
4875 def p_atom2_type_4(p
):
4876 '''atom2_type : K_longint '''
4877 print('atom2_type_4', list(p
))
4881 '''lpvalue : hierarchy_identifier '''
4882 print('lpvalue_1', list(p
))
4884 # { PEIdent*tmp = pform_new_ident(*$1);
4885 # FILE_NAME(tmp, @1);
4891 '''lpvalue : implicit_class_handle '.' hierarchy_identifier '''
4892 print('lpvalue_2', list(p
))
4893 # { pform_name_t*t_name = $1;
4894 # while (!$3->empty()) {
4895 # t_name->push_back($3->front());
4898 # PEIdent*tmp = new PEIdent(*t_name);
4899 # FILE_NAME(tmp, @1);
4906 '''lpvalue : '{' expression_list_proper '}' '''
4907 print('lpvalue_3', list(p
))
4908 # { PEConcat*tmp = new PEConcat(*$2);
4909 # FILE_NAME(tmp, @1);
4915 '''lpvalue : streaming_concatenation '''
4916 print('lpvalue_4', list(p
))
4917 # { yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
4921 def p_cont_assign_1(p
):
4922 '''cont_assign : lpvalue '=' expression '''
4923 print('cont_assign_1', list(p
))
4924 # { list<PExpr*>*tmp = new list<PExpr*>;
4925 # tmp->push_back($1);
4926 # tmp->push_back($3);
4930 def p_cont_assign_list_1(p
):
4931 '''cont_assign_list : cont_assign_list ',' cont_assign '''
4932 print('cont_assign_list_1', list(p
))
4933 # { list<PExpr*>*tmp = $1;
4934 # tmp->splice(tmp->end(), *$3);
4939 def p_cont_assign_list_2(p
):
4940 '''cont_assign_list : cont_assign '''
4941 print('cont_assign_list_2', list(p
))
4945 '''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 '''
4946 print('module_1', list(p
))
4947 clsname
= [Leaf(token
.NAME
, 'class'),
4948 Leaf(token
.NAME
, p
[4], prefix
=' '),
4949 Leaf(token
.COLON
, ':')]
4950 stmt
= Node(syms
.pass_stmt
, [Leaf(token
.NAME
, "pass"),])
4951 stmts
= Node(syms
.small_stmt
, [stmt
, Leaf(token
.NEWLINE
, '\n')])
4952 stmts
= Node(syms
.stmt
, [stmts
])
4953 suite
= Node(syms
.suite
, [Leaf(token
.NEWLINE
, '\n'),
4954 Leaf(token
.INDENT
, ' '),
4956 Leaf(token
.DEDENT
, '')
4958 clsdecl
= Node(syms
.classdef
, clsname
+ [suite
],
4959 prefix
='', fixers_applied
=[])
4960 clsdecl
= Node(syms
.compound_stmt
, [clsdecl
])
4961 print ("clsdecl", repr(clsdecl
))
4963 print (str(clsdecl
))
4965 # { // Last step: check any closing name. This is done late so
4966 # // that the parser can look ahead to detect the present
4967 # // endlabel_opt but still have the pform_endmodule() called
4968 # // early enough that the lexor can know we are outside the
4971 # if (strcmp($4,$17) != 0) {
4974 # yyerror(@17, "error: End label doesn't match "
4978 # yyerror(@17, "error: End label doesn't match "
4982 # yyerror(@17, "error: End label doesn't match "
4983 # "interface name.");
4989 # if (($2 == K_module) && (! gn_system_verilog())) {
4990 # yyerror(@8, "error: Module end labels require "
4991 # "SystemVerilog.");
4998 def p__embed0_module(p
):
4999 '''_embed0_module : '''
5000 # { pform_startmodule(@2, $4, $2==K_program, $2==K_interface, $3, $1); }
5002 def p__embed1_module(p
):
5003 '''_embed1_module : '''
5004 # { pform_module_set_ports($8); }
5006 def p__embed2_module(p
):
5007 '''_embed2_module : '''
5008 # { pform_set_scope_timescale(@2); }
5010 def p__embed3_module(p
):
5011 '''_embed3_module : '''
5012 # { Module::UCDriveType ucd;
5013 # // The lexor detected `unconnected_drive directives and
5014 # // marked what it found in the uc_drive variable. Use that
5015 # // to generate a UCD flag for the module.
5016 # switch (uc_drive) {
5019 # ucd = Module::UCD_NONE;
5022 # ucd = Module::UCD_PULL0;
5025 # ucd = Module::UCD_PULL1;
5028 # // Check that program/endprogram and module/endmodule
5029 # // keywords match.
5033 # yyerror(@15, "error: module not closed by endmodule.");
5036 # yyerror(@15, "error: program not closed by endprogram.");
5039 # yyerror(@15, "error: interface not closed by endinterface.");
5045 # pform_endmodule($4, in_celldefine, ucd);
5048 def p_module_start_1(p
):
5049 '''module_start : K_module '''
5050 print('module_start_1', list(p
))
5051 # { $$ = K_module; }
5053 def p_module_start_2(p
):
5054 '''module_start : K_macromodule '''
5055 print('module_start_2', list(p
))
5056 # { $$ = K_module; }
5058 def p_module_start_3(p
):
5059 '''module_start : K_program '''
5060 print('module_start_3', list(p
))
5061 # { $$ = K_program; }
5063 def p_module_start_4(p
):
5064 '''module_start : K_interface '''
5065 print('module_start_4', list(p
))
5066 # { $$ = K_interface; }
5068 def p_module_end_1(p
):
5069 '''module_end : K_endmodule '''
5070 print('module_end_1', list(p
))
5071 # { $$ = K_module; }
5073 def p_module_end_2(p
):
5074 '''module_end : K_endprogram '''
5075 print('module_end_2', list(p
))
5076 # { $$ = K_program; }
5078 def p_module_end_3(p
):
5079 '''module_end : K_endinterface '''
5080 print('module_end_3', list(p
))
5081 # { $$ = K_interface; }
5083 def p_endlabel_opt_1(p
):
5084 '''endlabel_opt : ':' IDENTIFIER '''
5085 print('endlabel_opt_1', list(p
))
5088 def p_endlabel_opt_2(p
):
5089 '''endlabel_opt : '''
5090 print('endlabel_opt_2', list(p
))
5093 def p_module_attribute_foreign_1(p
):
5094 '''module_attribute_foreign : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP '''
5095 print('module_attribute_foreign_1', list(p
))
5098 def p_module_attribute_foreign_2(p
):
5099 '''module_attribute_foreign : '''
5100 print('module_attribute_foreign_2', list(p
))
5103 def p_module_port_list_opt_1(p
):
5104 '''module_port_list_opt : '(' list_of_ports ')' '''
5105 print('module_port_list_opt_1', list(p
))
5108 def p_module_port_list_opt_2(p
):
5109 '''module_port_list_opt : '(' list_of_port_declarations ')' '''
5110 print('module_port_list_opt_2', list(p
))
5113 def p_module_port_list_opt_3(p
):
5114 '''module_port_list_opt : '''
5115 print('module_port_list_opt_3', list(p
))
5118 def p_module_port_list_opt_4(p
):
5119 '''module_port_list_opt : '(' error ')' '''
5120 print('module_port_list_opt_4', list(p
))
5121 # { yyerror(@2, "Errors in port declarations.");
5126 def p_module_parameter_port_list_opt_1(p
):
5127 '''module_parameter_port_list_opt : '''
5128 print('module_parameter_port_list_opt_1', list(p
))
5130 def p_module_parameter_port_list_opt_2(p
):
5131 '''module_parameter_port_list_opt : '#' '(' module_parameter_port_list ')' '''
5132 print('module_parameter_port_list_opt_2', list(p
))
5134 def p_module_parameter_port_list_1(p
):
5135 '''module_parameter_port_list : K_parameter param_type parameter_assign '''
5136 print('module_parameter_port_list_1', list(p
))
5138 def p_module_parameter_port_list_2(p
):
5139 '''module_parameter_port_list : module_parameter_port_list ',' parameter_assign '''
5140 print('module_parameter_port_list_2', list(p
))
5142 def p_module_parameter_port_list_3(p
):
5143 '''module_parameter_port_list : module_parameter_port_list ',' K_parameter param_type parameter_assign '''
5144 print('module_parameter_port_list_3', list(p
))
5146 def p_module_item_1(p
):
5147 '''module_item : module '''
5148 print('module_item_1', list(p
))
5150 def p_module_item_2(p
):
5151 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' '''
5152 print('module_item_2', list(p
))
5153 # { data_type_t*data_type = $3;
5154 # if (data_type == 0) {
5155 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5156 # FILE_NAME(data_type, @2);
5158 # pform_set_data_type(@2, data_type, $5, $2, $1);
5160 # yyerror(@2, "sorry: net delays not supported.");
5166 def p_module_item_3(p
):
5167 '''module_item : attribute_list_opt K_wreal delay3 net_variable_list ';' '''
5168 print('module_item_3', list(p
))
5169 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5170 # pform_set_data_type(@2, tmpt, $4, NetNet::WIRE, $1);
5172 # yyerror(@3, "sorry: net delays not supported.");
5178 def p_module_item_4(p
):
5179 '''module_item : attribute_list_opt K_wreal net_variable_list ';' '''
5180 print('module_item_4', list(p
))
5181 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5182 # pform_set_data_type(@2, tmpt, $3, NetNet::WIRE, $1);
5186 def p_module_item_5(p
):
5187 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_decl_assigns ';' '''
5188 print('module_item_5', list(p
))
5189 # { data_type_t*data_type = $3;
5190 # if (data_type == 0) {
5191 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5192 # FILE_NAME(data_type, @2);
5194 # pform_makewire(@2, $4, str_strength, $5, $2, data_type);
5196 # yywarn(@2, "Attributes are not supported on net declaration "
5197 # "assignments and will be discarded.");
5202 def p_module_item_6(p
):
5203 '''module_item : attribute_list_opt net_type data_type_or_implicit drive_strength net_decl_assigns ';' '''
5204 print('module_item_6', list(p
))
5205 # { data_type_t*data_type = $3;
5206 # if (data_type == 0) {
5207 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5208 # FILE_NAME(data_type, @2);
5210 # pform_makewire(@2, 0, $4, $5, $2, data_type);
5212 # yywarn(@2, "Attributes are not supported on net declaration "
5213 # "assignments and will be discarded.");
5218 def p_module_item_7(p
):
5219 '''module_item : attribute_list_opt K_wreal net_decl_assigns ';' '''
5220 print('module_item_7', list(p
))
5221 # { real_type_t*data_type = new real_type_t(real_type_t::REAL);
5222 # pform_makewire(@2, 0, str_strength, $3, NetNet::WIRE, data_type);
5224 # yywarn(@2, "Attributes are not supported on net declaration "
5225 # "assignments and will be discarded.");
5230 def p_module_item_8(p
):
5231 '''module_item : K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' '''
5232 print('module_item_8', list(p
))
5233 # { yyerror(@1, "sorry: trireg nets not supported.");
5238 def p_module_item_9(p
):
5239 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit list_of_port_identifiers ';' '''
5240 print('module_item_9', list(p
))
5241 # { pform_module_define_port(@2, $5, $2, $3, $4, $1); }
5243 def p_module_item_10(p
):
5244 '''module_item : attribute_list_opt port_direction K_wreal list_of_port_identifiers ';' '''
5245 print('module_item_10', list(p
))
5246 # { real_type_t*real_type = new real_type_t(real_type_t::REAL);
5247 # pform_module_define_port(@2, $4, $2, NetNet::WIRE, real_type, $1);
5250 def p_module_item_11(p
):
5251 '''module_item : attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' '''
5252 print('module_item_11', list(p
))
5253 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5254 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5255 # if (dtype->implicit_flag)
5256 # use_type = NetNet::NONE;
5258 # if (use_type == NetNet::NONE)
5259 # pform_set_port_type(@2, $4, NetNet::PINOUT, $3, $1);
5261 # pform_module_define_port(@2, $4, NetNet::PINOUT, use_type, $3, $1);
5264 def p_module_item_12(p
):
5265 '''module_item : attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' '''
5266 print('module_item_12', list(p
))
5267 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5268 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5269 # if (dtype->implicit_flag)
5270 # use_type = NetNet::NONE;
5272 # if (use_type == NetNet::NONE)
5273 # pform_set_port_type(@2, $4, NetNet::PINPUT, $3, $1);
5275 # pform_module_define_port(@2, $4, NetNet::PINPUT, use_type, $3, $1);
5278 def p_module_item_13(p
):
5279 '''module_item : attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' '''
5280 print('module_item_13', list(p
))
5281 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5282 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5283 # if (dtype->implicit_flag)
5284 # use_type = NetNet::NONE;
5285 # else if (dtype->reg_flag)
5286 # use_type = NetNet::REG;
5288 # use_type = NetNet::IMPLICIT_REG;
5290 # // The SystemVerilog types that can show up as
5291 # // output ports are implicitly (on the inside)
5292 # // variables because "reg" is not valid syntax
5294 # } else if (dynamic_cast<atom2_type_t*> ($3)) {
5295 # use_type = NetNet::IMPLICIT_REG;
5296 # } else if (dynamic_cast<struct_type_t*> ($3)) {
5297 # use_type = NetNet::IMPLICIT_REG;
5298 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> ($3)) {
5299 # if(etype->base_type == IVL_VT_LOGIC)
5300 # use_type = NetNet::IMPLICIT_REG;
5302 # if (use_type == NetNet::NONE)
5303 # pform_set_port_type(@2, $4, NetNet::POUTPUT, $3, $1);
5305 # pform_module_define_port(@2, $4, NetNet::POUTPUT, use_type, $3, $1);
5308 def p_module_item_14(p
):
5309 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit error ';' '''
5310 print('module_item_14', list(p
))
5311 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5312 # if ($1) delete $1;
5313 # if ($4) delete $4;
5317 def p_module_item_15(p
):
5318 '''module_item : attribute_list_opt K_inout data_type_or_implicit error ';' '''
5319 print('module_item_15', list(p
))
5320 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5321 # if ($1) delete $1;
5322 # if ($3) delete $3;
5326 def p_module_item_16(p
):
5327 '''module_item : attribute_list_opt K_input data_type_or_implicit error ';' '''
5328 print('module_item_16', list(p
))
5329 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5330 # if ($1) delete $1;
5331 # if ($3) delete $3;
5335 def p_module_item_17(p
):
5336 '''module_item : attribute_list_opt K_output data_type_or_implicit error ';' '''
5337 print('module_item_17', list(p
))
5338 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5339 # if ($1) delete $1;
5340 # if ($3) delete $3;
5344 def p_module_item_18(p
):
5345 '''module_item : DISCIPLINE_IDENTIFIER list_of_identifiers ';' '''
5346 print('module_item_18', list(p
))
5347 # { pform_attach_discipline(@1, $1, $2); }
5349 def p_module_item_19(p
):
5350 '''module_item : attribute_list_opt _embed0_module_item block_item_decl '''
5351 print('module_item_19', list(p
))
5352 # { delete attributes_in_context;
5353 # attributes_in_context = 0;
5356 def p_module_item_20(p
):
5357 '''module_item : K_defparam _embed1_module_item defparam_assign_list ';' '''
5358 print('module_item_20', list(p
))
5360 def p_module_item_21(p
):
5361 '''module_item : attribute_list_opt gatetype gate_instance_list ';' '''
5362 print('module_item_21', list(p
))
5363 # { pform_makegates(@2, $2, str_strength, 0, $3, $1); }
5365 def p_module_item_22(p
):
5366 '''module_item : attribute_list_opt gatetype delay3 gate_instance_list ';' '''
5367 print('module_item_22', list(p
))
5368 # { pform_makegates(@2, $2, str_strength, $3, $4, $1); }
5370 def p_module_item_23(p
):
5371 '''module_item : attribute_list_opt gatetype drive_strength gate_instance_list ';' '''
5372 print('module_item_23', list(p
))
5373 # { pform_makegates(@2, $2, $3, 0, $4, $1); }
5375 def p_module_item_24(p
):
5376 '''module_item : attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';' '''
5377 print('module_item_24', list(p
))
5378 # { pform_makegates(@2, $2, $3, $4, $5, $1); }
5380 def p_module_item_25(p
):
5381 '''module_item : attribute_list_opt switchtype gate_instance_list ';' '''
5382 print('module_item_25', list(p
))
5383 # { pform_makegates(@2, $2, str_strength, 0, $3, $1); }
5385 def p_module_item_26(p
):
5386 '''module_item : attribute_list_opt switchtype delay3 gate_instance_list ';' '''
5387 print('module_item_26', list(p
))
5388 # { pform_makegates(@2, $2, str_strength, $3, $4, $1); }
5390 def p_module_item_27(p
):
5391 '''module_item : K_pullup gate_instance_list ';' '''
5392 print('module_item_27', list(p
))
5393 # { pform_makegates(@1, PGBuiltin::PULLUP, pull_strength, 0, $2, 0); }
5395 def p_module_item_28(p
):
5396 '''module_item : K_pulldown gate_instance_list ';' '''
5397 print('module_item_28', list(p
))
5398 # { pform_makegates(@1, PGBuiltin::PULLDOWN, pull_strength, 0, $2, 0); }
5400 def p_module_item_29(p
):
5401 '''module_item : K_pullup '(' dr_strength1 ')' gate_instance_list ';' '''
5402 print('module_item_29', list(p
))
5403 # { pform_makegates(@1, PGBuiltin::PULLUP, $3, 0, $5, 0); }
5405 def p_module_item_30(p
):
5406 '''module_item : K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5407 print('module_item_30', list(p
))
5408 # { pform_makegates(@1, PGBuiltin::PULLUP, $3, 0, $7, 0); }
5410 def p_module_item_31(p
):
5411 '''module_item : K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5412 print('module_item_31', list(p
))
5413 # { pform_makegates(@1, PGBuiltin::PULLUP, $5, 0, $7, 0); }
5415 def p_module_item_32(p
):
5416 '''module_item : K_pulldown '(' dr_strength0 ')' gate_instance_list ';' '''
5417 print('module_item_32', list(p
))
5418 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $3, 0, $5, 0); }
5420 def p_module_item_33(p
):
5421 '''module_item : K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5422 print('module_item_33', list(p
))
5423 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $5, 0, $7, 0); }
5425 def p_module_item_34(p
):
5426 '''module_item : K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5427 print('module_item_34', list(p
))
5428 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $3, 0, $7, 0); }
5430 def p_module_item_35(p
):
5431 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' '''
5432 print('module_item_35', list(p
))
5433 # { perm_string tmp1 = lex_strings.make($2);
5434 # pform_make_modgates(@2, tmp1, $3, $4, $1);
5438 def p_module_item_36(p
):
5439 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt error ';' '''
5440 print('module_item_36', list(p
))
5441 # { yyerror(@2, "error: Invalid module instantiation");
5443 # if ($1) delete $1;
5446 def p_module_item_37(p
):
5447 '''module_item : K_assign drive_strength_opt delay3_opt cont_assign_list ';' '''
5448 print('module_item_37', list(p
))
5449 # { pform_make_pgassign_list($4, $3, $2, @1.text, @1.first_line); }
5451 def p_module_item_38(p
):
5452 '''module_item : attribute_list_opt K_always statement_item '''
5453 print('module_item_38', list(p
))
5454 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, $3, $1);
5455 # FILE_NAME(tmp, @2);
5458 def p_module_item_39(p
):
5459 '''module_item : attribute_list_opt K_always_comb statement_item '''
5460 print('module_item_39', list(p
))
5461 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_COMB, $3, $1);
5462 # FILE_NAME(tmp, @2);
5465 def p_module_item_40(p
):
5466 '''module_item : attribute_list_opt K_always_ff statement_item '''
5467 print('module_item_40', list(p
))
5468 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, $3, $1);
5469 # FILE_NAME(tmp, @2);
5472 def p_module_item_41(p
):
5473 '''module_item : attribute_list_opt K_always_latch statement_item '''
5474 print('module_item_41', list(p
))
5475 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_LATCH, $3, $1);
5476 # FILE_NAME(tmp, @2);
5479 def p_module_item_42(p
):
5480 '''module_item : attribute_list_opt K_initial statement_item '''
5481 print('module_item_42', list(p
))
5482 # { PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, $3, $1);
5483 # FILE_NAME(tmp, @2);
5486 def p_module_item_43(p
):
5487 '''module_item : attribute_list_opt K_final statement_item '''
5488 print('module_item_43', list(p
))
5489 # { PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, $3, $1);
5490 # FILE_NAME(tmp, @2);
5493 def p_module_item_44(p
):
5494 '''module_item : attribute_list_opt K_analog analog_statement '''
5495 print('module_item_44', list(p
))
5496 # { pform_make_analog_behavior(@2, IVL_PR_ALWAYS, $3); }
5498 def p_module_item_45(p
):
5499 '''module_item : attribute_list_opt assertion_item '''
5500 print('module_item_45', list(p
))
5502 def p_module_item_46(p
):
5503 '''module_item : timeunits_declaration '''
5504 print('module_item_46', list(p
))
5506 def p_module_item_47(p
):
5507 '''module_item : class_declaration '''
5508 print('module_item_47', list(p
))
5510 def p_module_item_48(p
):
5511 '''module_item : task_declaration '''
5512 print('module_item_48', list(p
))
5514 def p_module_item_49(p
):
5515 '''module_item : function_declaration '''
5516 print('module_item_49', list(p
))
5518 def p_module_item_50(p
):
5519 '''module_item : K_generate generate_item_list_opt K_endgenerate '''
5520 print('module_item_50', list(p
))
5521 # { // Test for bad nesting. I understand it, but it is illegal.
5522 # if (pform_parent_generate()) {
5523 # cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
5524 # cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
5525 # cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
5530 def p_module_item_51(p
):
5531 '''module_item : K_genvar list_of_identifiers ';' '''
5532 print('module_item_51', list(p
))
5533 # { pform_genvars(@1, $2); }
5535 def p_module_item_52(p
):
5536 '''module_item : K_for '(' IDENTIFIER '=' expression ';' expression ';' IDENTIFIER '=' expression ')' _embed2_module_item generate_block '''
5537 print('module_item_52', list(p
))
5538 # { pform_endgenerate(); }
5540 def p_module_item_53(p
):
5541 '''module_item : generate_if generate_block_opt K_else _embed3_module_item generate_block '''
5542 print('module_item_53', list(p
))
5543 # { pform_endgenerate(); }
5545 def p_module_item_54(p
):
5546 '''module_item : generate_if generate_block_opt %prec less_than_K_else '''
5547 print('module_item_54', list(p
))
5548 # { pform_endgenerate(); }
5550 def p_module_item_55(p
):
5551 '''module_item : K_case '(' expression ')' _embed4_module_item generate_case_items K_endcase '''
5552 print('module_item_55', list(p
))
5553 # { pform_endgenerate(); }
5555 def p_module_item_56(p
):
5556 '''module_item : modport_declaration '''
5557 print('module_item_56', list(p
))
5559 def p_module_item_57(p
):
5560 '''module_item : package_import_declaration '''
5561 print('module_item_57', list(p
))
5563 def p_module_item_58(p
):
5564 '''module_item : attribute_list_opt K_specparam _embed5_module_item specparam_decl ';' '''
5565 print('module_item_58', list(p
))
5567 def p_module_item_59(p
):
5568 '''module_item : K_specify _embed6_module_item specify_item_list_opt K_endspecify '''
5569 print('module_item_59', list(p
))
5571 def p_module_item_60(p
):
5572 '''module_item : K_specify error K_endspecify '''
5573 print('module_item_60', list(p
))
5574 # { yyerror(@1, "error: syntax error in specify block");
5578 def p_module_item_61(p
):
5579 '''module_item : error ';' '''
5580 print('module_item_61', list(p
))
5581 # { yyerror(@2, "error: invalid module item.");
5585 def p_module_item_62(p
):
5586 '''module_item : K_assign error '=' expression ';' '''
5587 print('module_item_62', list(p
))
5588 # { yyerror(@1, "error: syntax error in left side "
5589 # "of continuous assignment.");
5593 def p_module_item_63(p
):
5594 '''module_item : K_assign error ';' '''
5595 print('module_item_63', list(p
))
5596 # { yyerror(@1, "error: syntax error in "
5597 # "continuous assignment");
5601 def p_module_item_64(p
):
5602 '''module_item : K_function error K_endfunction endlabel_opt '''
5603 print('module_item_64', list(p
))
5604 # { yyerror(@1, "error: I give up on this "
5605 # "function definition.");
5607 # if (!gn_system_verilog()) {
5608 # yyerror(@4, "error: Function end names require "
5609 # "SystemVerilog.");
5616 def p_module_item_65(p
):
5617 '''module_item : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';' '''
5618 print('module_item_65', list(p
))
5619 # { perm_string tmp3 = lex_strings.make($3);
5620 # perm_string tmp5 = lex_strings.make($5);
5621 # pform_set_attrib(tmp3, tmp5, $7);
5626 def p_module_item_66(p
):
5627 '''module_item : KK_attribute '(' error ')' ';' '''
5628 print('module_item_66', list(p
))
5629 # { yyerror(@1, "error: Malformed $attribute parameter list."); }
5631 def p__embed0_module_item(p
):
5632 '''_embed0_module_item : '''
5633 # { attributes_in_context = $1; }
5635 def p__embed1_module_item(p
):
5636 '''_embed1_module_item : '''
5637 # { if (pform_in_interface())
5638 # yyerror(@1, "error: Parameter overrides are not allowed "
5639 # "in interfaces.");
5642 def p__embed2_module_item(p
):
5643 '''_embed2_module_item : '''
5644 # { pform_start_generate_for(@1, $3, $5, $7, $9, $11); }
5646 def p__embed3_module_item(p
):
5647 '''_embed3_module_item : '''
5648 # { pform_start_generate_else(@1); }
5650 def p__embed4_module_item(p
):
5651 '''_embed4_module_item : '''
5652 # { pform_start_generate_case(@1, $3); }
5654 def p__embed5_module_item(p
):
5655 '''_embed5_module_item : '''
5656 # { if (pform_in_interface())
5657 # yyerror(@1, "error: specparam declarations are not allowed "
5658 # "in interfaces.");
5661 def p__embed6_module_item(p
):
5662 '''_embed6_module_item : '''
5663 # { if (pform_in_interface())
5664 # yyerror(@1, "error: specify blocks are not allowed "
5665 # "in interfaces.");
5668 def p_module_item_list_1(p
):
5669 '''module_item_list : module_item_list module_item '''
5670 print('module_item_list_1', list(p
))
5672 def p_module_item_list_2(p
):
5673 '''module_item_list : module_item '''
5674 print('module_item_list_2', list(p
))
5676 def p_module_item_list_opt_1(p
):
5677 '''module_item_list_opt : module_item_list '''
5678 print('module_item_list_opt_1', list(p
))
5680 def p_module_item_list_opt_2(p
):
5681 '''module_item_list_opt : '''
5682 print('module_item_list_opt_2', list(p
))
5684 def p_generate_if_1(p
):
5685 '''generate_if : K_if '(' expression ')' '''
5686 print('generate_if_1', list(p
))
5687 # { pform_start_generate_if(@1, $3); }
5689 def p_generate_case_items_1(p
):
5690 '''generate_case_items : generate_case_items generate_case_item '''
5691 print('generate_case_items_1', list(p
))
5693 def p_generate_case_items_2(p
):
5694 '''generate_case_items : generate_case_item '''
5695 print('generate_case_items_2', list(p
))
5697 def p_generate_case_item_1(p
):
5698 '''generate_case_item : expression_list_proper ':' _embed0_generate_case_item generate_block_opt '''
5699 print('generate_case_item_1', list(p
))
5700 # { pform_endgenerate(); }
5702 def p_generate_case_item_2(p
):
5703 '''generate_case_item : K_default ':' _embed1_generate_case_item generate_block_opt '''
5704 print('generate_case_item_2', list(p
))
5705 # { pform_endgenerate(); }
5707 def p__embed0_generate_case_item(p
):
5708 '''_embed0_generate_case_item : '''
5709 # { pform_generate_case_item(@1, $1); }
5711 def p__embed1_generate_case_item(p
):
5712 '''_embed1_generate_case_item : '''
5713 # { pform_generate_case_item(@1, 0); }
5715 def p_generate_item_1(p
):
5716 '''generate_item : module_item '''
5717 print('generate_item_1', list(p
))
5719 def p_generate_item_2(p
):
5720 '''generate_item : K_begin generate_item_list_opt K_end '''
5721 print('generate_item_2', list(p
))
5722 # { /* Detect and warn about anachronistic begin/end use */
5723 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5725 # cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
5729 def p_generate_item_3(p
):
5730 '''generate_item : K_begin ':' IDENTIFIER _embed0_generate_item generate_item_list_opt K_end '''
5731 print('generate_item_3', list(p
))
5732 # { /* Detect and warn about anachronistic named begin/end use */
5733 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5735 # cerr << @1 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
5737 # pform_endgenerate();
5740 def p__embed0_generate_item(p
):
5741 '''_embed0_generate_item : '''
5743 # pform_start_generate_nblock(@1, $3);
5746 def p_generate_item_list_1(p
):
5747 '''generate_item_list : generate_item_list generate_item '''
5748 print('generate_item_list_1', list(p
))
5750 def p_generate_item_list_2(p
):
5751 '''generate_item_list : generate_item '''
5752 print('generate_item_list_2', list(p
))
5754 def p_generate_item_list_opt_1(p
):
5755 '''generate_item_list_opt : generate_item_list '''
5756 print('generate_item_list_opt_1', list(p
))
5758 def p_generate_item_list_opt_2(p
):
5759 '''generate_item_list_opt : '''
5760 print('generate_item_list_opt_2', list(p
))
5762 def p_generate_block_1(p
):
5763 '''generate_block : module_item '''
5764 print('generate_block_1', list(p
))
5766 def p_generate_block_2(p
):
5767 '''generate_block : K_begin generate_item_list_opt K_end '''
5768 print('generate_block_2', list(p
))
5770 def p_generate_block_3(p
):
5771 '''generate_block : K_begin ':' IDENTIFIER generate_item_list_opt K_end endlabel_opt '''
5772 print('generate_block_3', list(p
))
5773 # { pform_generate_block_name($3);
5775 # if (strcmp($3,$6) != 0) {
5776 # yyerror(@6, "error: End label doesn't match "
5779 # if (! gn_system_verilog()) {
5780 # yyerror(@6, "error: Begin end labels require "
5781 # "SystemVerilog.");
5788 def p_generate_block_opt_1(p
):
5789 '''generate_block_opt : generate_block '''
5790 print('generate_block_opt_1', list(p
))
5792 def p_generate_block_opt_2(p
):
5793 '''generate_block_opt : ';' '''
5794 print('generate_block_opt_2', list(p
))
5796 def p_net_decl_assign_1(p
):
5797 '''net_decl_assign : IDENTIFIER '=' expression '''
5798 print('net_decl_assign_1', list(p
))
5799 # { net_decl_assign_t*tmp = new net_decl_assign_t;
5801 # tmp->name = lex_strings.make($1);
5807 def p_net_decl_assigns_1(p
):
5808 '''net_decl_assigns : net_decl_assigns ',' net_decl_assign '''
5809 print('net_decl_assigns_1', list(p
))
5810 # { net_decl_assign_t*tmp = $1;
5811 # $3->next = tmp->next;
5816 def p_net_decl_assigns_2(p
):
5817 '''net_decl_assigns : net_decl_assign '''
5818 print('net_decl_assigns_2', list(p
))
5822 def p_bit_logic_1(p
):
5823 '''bit_logic : K_logic '''
5824 print('bit_logic_1', list(p
))
5825 # { $$ = IVL_VT_LOGIC; }
5827 def p_bit_logic_2(p
):
5828 '''bit_logic : K_bool '''
5829 print('bit_logic_2', list(p
))
5830 # { $$ = IVL_VT_BOOL; /* Icarus misc */}
5832 def p_bit_logic_3(p
):
5833 '''bit_logic : K_bit '''
5834 print('bit_logic_3', list(p
))
5835 # { $$ = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
5837 def p_bit_logic_opt_1(p
):
5838 '''bit_logic_opt : bit_logic '''
5839 print('bit_logic_opt_1', list(p
))
5841 def p_bit_logic_opt_2(p
):
5842 '''bit_logic_opt : '''
5843 print('bit_logic_opt_2', list(p
))
5844 # { $$ = IVL_VT_NO_TYPE; }
5846 def p_net_type_1(p
):
5847 '''net_type : K_wire '''
5848 print('net_type_1', list(p
))
5849 # { $$ = NetNet::WIRE; }
5851 def p_net_type_2(p
):
5852 '''net_type : K_tri '''
5853 print('net_type_2', list(p
))
5854 # { $$ = NetNet::TRI; }
5856 def p_net_type_3(p
):
5857 '''net_type : K_tri1 '''
5858 print('net_type_3', list(p
))
5859 # { $$ = NetNet::TRI1; }
5861 def p_net_type_4(p
):
5862 '''net_type : K_supply0 '''
5863 print('net_type_4', list(p
))
5864 # { $$ = NetNet::SUPPLY0; }
5866 def p_net_type_5(p
):
5867 '''net_type : K_wand '''
5868 print('net_type_5', list(p
))
5869 # { $$ = NetNet::WAND; }
5871 def p_net_type_6(p
):
5872 '''net_type : K_triand '''
5873 print('net_type_6', list(p
))
5874 # { $$ = NetNet::TRIAND; }
5876 def p_net_type_7(p
):
5877 '''net_type : K_tri0 '''
5878 print('net_type_7', list(p
))
5879 # { $$ = NetNet::TRI0; }
5881 def p_net_type_8(p
):
5882 '''net_type : K_supply1 '''
5883 print('net_type_8', list(p
))
5884 # { $$ = NetNet::SUPPLY1; }
5886 def p_net_type_9(p
):
5887 '''net_type : K_wor '''
5888 print('net_type_9', list(p
))
5889 # { $$ = NetNet::WOR; }
5891 def p_net_type_10(p
):
5892 '''net_type : K_trior '''
5893 print('net_type_10', list(p
))
5894 # { $$ = NetNet::TRIOR; }
5896 def p_net_type_11(p
):
5897 '''net_type : K_wone '''
5898 print('net_type_11', list(p
))
5899 # { $$ = NetNet::UNRESOLVED_WIRE;
5900 # cerr << @1.text << ":" << @1.first_line << ": warning: "
5901 # "'wone' is deprecated, please use 'uwire' "
5902 # "instead." << endl;
5905 def p_net_type_12(p
):
5906 '''net_type : K_uwire '''
5907 print('net_type_12', list(p
))
5908 # { $$ = NetNet::UNRESOLVED_WIRE; }
5910 def p_param_type_1(p
):
5911 '''param_type : bit_logic_opt unsigned_signed_opt dimensions_opt '''
5912 print('param_type_1', list(p
))
5913 # { param_active_range = $3;
5914 # param_active_signed = $2;
5915 # if (($1 == IVL_VT_NO_TYPE) && ($3 != 0))
5916 # param_active_type = IVL_VT_LOGIC;
5918 # param_active_type = $1;
5921 def p_param_type_2(p
):
5922 '''param_type : K_integer '''
5923 print('param_type_2', list(p
))
5924 # { param_active_range = make_range_from_width(integer_width);
5925 # param_active_signed = true;
5926 # param_active_type = IVL_VT_LOGIC;
5929 def p_param_type_3(p
):
5930 '''param_type : K_time '''
5931 print('param_type_3', list(p
))
5932 # { param_active_range = make_range_from_width(64);
5933 # param_active_signed = false;
5934 # param_active_type = IVL_VT_LOGIC;
5937 def p_param_type_4(p
):
5938 '''param_type : real_or_realtime '''
5939 print('param_type_4', list(p
))
5940 # { param_active_range = 0;
5941 # param_active_signed = true;
5942 # param_active_type = IVL_VT_REAL;
5945 def p_param_type_5(p
):
5946 '''param_type : atom2_type '''
5947 print('param_type_5', list(p
))
5948 # { param_active_range = make_range_from_width($1);
5949 # param_active_signed = true;
5950 # param_active_type = IVL_VT_BOOL;
5953 def p_param_type_6(p
):
5954 '''param_type : TYPE_IDENTIFIER '''
5955 print('param_type_6', list(p
))
5956 # { pform_set_param_from_type(@1, $1.type, $1.text, param_active_range,
5957 # param_active_signed, param_active_type);
5961 def p_parameter_assign_list_1(p
):
5962 '''parameter_assign_list : parameter_assign '''
5963 print('parameter_assign_list_1', list(p
))
5965 def p_parameter_assign_list_2(p
):
5966 '''parameter_assign_list : parameter_assign_list ',' parameter_assign '''
5967 print('parameter_assign_list_2', list(p
))
5969 def p_localparam_assign_list_1(p
):
5970 '''localparam_assign_list : localparam_assign '''
5971 print('localparam_assign_list_1', list(p
))
5973 def p_localparam_assign_list_2(p
):
5974 '''localparam_assign_list : localparam_assign_list ',' localparam_assign '''
5975 print('localparam_assign_list_2', list(p
))
5977 def p_parameter_assign_1(p
):
5978 '''parameter_assign : IDENTIFIER '=' expression parameter_value_ranges_opt '''
5979 print('parameter_assign_1', list(p
))
5981 # pform_set_parameter(@1, lex_strings.make($1), param_active_type,
5982 # param_active_signed, param_active_range, tmp, $4);
5986 def p_localparam_assign_1(p
):
5987 '''localparam_assign : IDENTIFIER '=' expression '''
5988 print('localparam_assign_1', list(p
))
5990 # pform_set_localparam(@1, lex_strings.make($1), param_active_type,
5991 # param_active_signed, param_active_range, tmp);
5995 def p_parameter_value_ranges_opt_1(p
):
5996 '''parameter_value_ranges_opt : parameter_value_ranges '''
5997 print('parameter_value_ranges_opt_1', list(p
))
6000 def p_parameter_value_ranges_opt_2(p
):
6001 '''parameter_value_ranges_opt : '''
6002 print('parameter_value_ranges_opt_2', list(p
))
6005 def p_parameter_value_ranges_1(p
):
6006 '''parameter_value_ranges : parameter_value_ranges parameter_value_range '''
6007 print('parameter_value_ranges_1', list(p
))
6008 # { $$ = $2; $$->next = $1; }
6010 def p_parameter_value_ranges_2(p
):
6011 '''parameter_value_ranges : parameter_value_range '''
6012 print('parameter_value_ranges_2', list(p
))
6013 # { $$ = $1; $$->next = 0; }
6015 def p_parameter_value_range_1(p
):
6016 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ']' '''
6017 print('parameter_value_range_1', list(p
))
6018 # { $$ = pform_parameter_value_range($1, false, $3, false, $5); }
6020 def p_parameter_value_range_2(p
):
6021 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ')' '''
6022 print('parameter_value_range_2', list(p
))
6023 # { $$ = pform_parameter_value_range($1, false, $3, true, $5); }
6025 def p_parameter_value_range_3(p
):
6026 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ']' '''
6027 print('parameter_value_range_3', list(p
))
6028 # { $$ = pform_parameter_value_range($1, true, $3, false, $5); }
6030 def p_parameter_value_range_4(p
):
6031 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ')' '''
6032 print('parameter_value_range_4', list(p
))
6033 # { $$ = pform_parameter_value_range($1, true, $3, true, $5); }
6035 def p_parameter_value_range_5(p
):
6036 '''parameter_value_range : K_exclude expression '''
6037 print('parameter_value_range_5', list(p
))
6038 # { $$ = pform_parameter_value_range(true, false, $2, false, $2); }
6040 def p_value_range_expression_1(p
):
6041 '''value_range_expression : expression '''
6042 print('value_range_expression_1', list(p
))
6045 def p_value_range_expression_2(p
):
6046 '''value_range_expression : K_inf '''
6047 print('value_range_expression_2', list(p
))
6050 def p_value_range_expression_3(p
):
6051 '''value_range_expression : '+' K_inf '''
6052 print('value_range_expression_3', list(p
))
6055 def p_value_range_expression_4(p
):
6056 '''value_range_expression : '-' K_inf '''
6057 print('value_range_expression_4', list(p
))
6060 def p_from_exclude_1(p
):
6061 '''from_exclude : K_from '''
6062 print('from_exclude_1', list(p
))
6065 def p_from_exclude_2(p
):
6066 '''from_exclude : K_exclude '''
6067 print('from_exclude_2', list(p
))
6070 def p_parameter_value_opt_1(p
):
6071 '''parameter_value_opt : '#' '(' expression_list_with_nuls ')' '''
6072 print('parameter_value_opt_1', list(p
))
6073 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6074 # tmp->by_order = $3;
6079 def p_parameter_value_opt_2(p
):
6080 '''parameter_value_opt : '#' '(' parameter_value_byname_list ')' '''
6081 print('parameter_value_opt_2', list(p
))
6082 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6083 # tmp->by_order = 0;
6084 # tmp->by_name = $3;
6088 def p_parameter_value_opt_3(p
):
6089 '''parameter_value_opt : '#' DEC_NUMBER '''
6090 print('parameter_value_opt_3', list(p
))
6092 # PENumber*tmp = new PENumber($2);
6093 # FILE_NAME(tmp, @1);
6095 # struct parmvalue_t*lst = new struct parmvalue_t;
6096 # lst->by_order = new list<PExpr*>;
6097 # lst->by_order->push_back(tmp);
6103 def p_parameter_value_opt_4(p
):
6104 '''parameter_value_opt : '#' REALTIME '''
6105 print('parameter_value_opt_4', list(p
))
6107 # PEFNumber*tmp = new PEFNumber($2);
6108 # FILE_NAME(tmp, @1);
6110 # struct parmvalue_t*lst = new struct parmvalue_t;
6111 # lst->by_order = new list<PExpr*>;
6112 # lst->by_order->push_back(tmp);
6117 def p_parameter_value_opt_5(p
):
6118 '''parameter_value_opt : '#' error '''
6119 print('parameter_value_opt_5', list(p
))
6120 # { yyerror(@1, "error: syntax error in parameter value "
6121 # "assignment list.");
6125 def p_parameter_value_opt_6(p
):
6126 '''parameter_value_opt : '''
6127 print('parameter_value_opt_6', list(p
))
6130 def p_parameter_value_byname_1(p
):
6131 '''parameter_value_byname : '.' IDENTIFIER '(' expression ')' '''
6132 print('parameter_value_byname_1', list(p
))
6133 # { named_pexpr_t*tmp = new named_pexpr_t;
6134 # tmp->name = lex_strings.make($2);
6140 def p_parameter_value_byname_2(p
):
6141 '''parameter_value_byname : '.' IDENTIFIER '(' ')' '''
6142 print('parameter_value_byname_2', list(p
))
6143 # { named_pexpr_t*tmp = new named_pexpr_t;
6144 # tmp->name = lex_strings.make($2);
6150 def p_parameter_value_byname_list_1(p
):
6151 '''parameter_value_byname_list : parameter_value_byname '''
6152 print('parameter_value_byname_list_1', list(p
))
6153 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6154 # tmp->push_back(*$1);
6159 def p_parameter_value_byname_list_2(p
):
6160 '''parameter_value_byname_list : parameter_value_byname_list ',' parameter_value_byname '''
6161 print('parameter_value_byname_list_2', list(p
))
6162 # { list<named_pexpr_t>*tmp = $1;
6163 # tmp->push_back(*$3);
6169 '''port : port_reference '''
6170 print('port_1', list(p
))
6174 '''port : '.' IDENTIFIER '(' port_reference ')' '''
6175 print('port_2', list(p
))
6176 # { Module::port_t*tmp = $4;
6177 # tmp->name = lex_strings.make($2);
6183 '''port : '{' port_reference_list '}' '''
6184 print('port_3', list(p
))
6185 # { Module::port_t*tmp = $2;
6186 # tmp->name = perm_string();
6191 '''port : '.' IDENTIFIER '(' '{' port_reference_list '}' ')' '''
6192 print('port_4', list(p
))
6193 # { Module::port_t*tmp = $5;
6194 # tmp->name = lex_strings.make($2);
6199 def p_port_opt_1(p
):
6200 '''port_opt : port '''
6201 print('port_opt_1', list(p
))
6204 def p_port_opt_2(p
):
6206 print('port_opt_2', list(p
))
6209 def p_port_name_1(p
):
6210 '''port_name : '.' IDENTIFIER '(' expression ')' '''
6211 print('port_name_1', list(p
))
6212 # { named_pexpr_t*tmp = new named_pexpr_t;
6213 # tmp->name = lex_strings.make($2);
6219 def p_port_name_2(p
):
6220 '''port_name : '.' IDENTIFIER '(' error ')' '''
6221 print('port_name_2', list(p
))
6222 # { yyerror(@3, "error: invalid port connection expression.");
6223 # named_pexpr_t*tmp = new named_pexpr_t;
6224 # tmp->name = lex_strings.make($2);
6230 def p_port_name_3(p
):
6231 '''port_name : '.' IDENTIFIER '(' ')' '''
6232 print('port_name_3', list(p
))
6233 # { named_pexpr_t*tmp = new named_pexpr_t;
6234 # tmp->name = lex_strings.make($2);
6240 def p_port_name_4(p
):
6241 '''port_name : '.' IDENTIFIER '''
6242 print('port_name_4', list(p
))
6243 # { named_pexpr_t*tmp = new named_pexpr_t;
6244 # tmp->name = lex_strings.make($2);
6245 # tmp->parm = new PEIdent(lex_strings.make($2), true);
6246 # FILE_NAME(tmp->parm, @1);
6251 def p_port_name_5(p
):
6252 '''port_name : K_DOTSTAR '''
6253 print('port_name_5', list(p
))
6254 # { named_pexpr_t*tmp = new named_pexpr_t;
6255 # tmp->name = lex_strings.make("*");
6260 def p_port_name_list_1(p
):
6261 '''port_name_list : port_name_list ',' port_name '''
6262 print('port_name_list_1', list(p
))
6263 # { list<named_pexpr_t>*tmp = $1;
6264 # tmp->push_back(*$3);
6269 def p_port_name_list_2(p
):
6270 '''port_name_list : port_name '''
6271 print('port_name_list_2', list(p
))
6272 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6273 # tmp->push_back(*$1);
6278 def p_port_reference_1(p
):
6279 '''port_reference : IDENTIFIER '''
6280 print('port_reference_1', list(p
))
6281 # { Module::port_t*ptmp;
6282 # perm_string name = lex_strings.make($1);
6283 # ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
6288 def p_port_reference_2(p
):
6289 '''port_reference : IDENTIFIER '[' expression ':' expression ']' '''
6290 print('port_reference_2', list(p
))
6291 # { index_component_t itmp;
6292 # itmp.sel = index_component_t::SEL_PART;
6296 # name_component_t ntmp (lex_strings.make($1));
6297 # ntmp.index.push_back(itmp);
6299 # pform_name_t pname;
6300 # pname.push_back(ntmp);
6302 # PEIdent*wtmp = new PEIdent(pname);
6303 # FILE_NAME(wtmp, @1);
6305 # Module::port_t*ptmp = new Module::port_t;
6306 # ptmp->name = perm_string();
6307 # ptmp->expr.push_back(wtmp);
6313 def p_port_reference_3(p
):
6314 '''port_reference : IDENTIFIER '[' expression ']' '''
6315 print('port_reference_3', list(p
))
6316 # { index_component_t itmp;
6317 # itmp.sel = index_component_t::SEL_BIT;
6321 # name_component_t ntmp (lex_strings.make($1));
6322 # ntmp.index.push_back(itmp);
6324 # pform_name_t pname;
6325 # pname.push_back(ntmp);
6327 # PEIdent*tmp = new PEIdent(pname);
6328 # FILE_NAME(tmp, @1);
6330 # Module::port_t*ptmp = new Module::port_t;
6331 # ptmp->name = perm_string();
6332 # ptmp->expr.push_back(tmp);
6337 def p_port_reference_4(p
):
6338 '''port_reference : IDENTIFIER '[' error ']' '''
6339 print('port_reference_4', list(p
))
6340 # { yyerror(@1, "error: invalid port bit select");
6341 # Module::port_t*ptmp = new Module::port_t;
6342 # PEIdent*wtmp = new PEIdent(lex_strings.make($1));
6343 # FILE_NAME(wtmp, @1);
6344 # ptmp->name = lex_strings.make($1);
6345 # ptmp->expr.push_back(wtmp);
6350 def p_port_reference_list_1(p
):
6351 '''port_reference_list : port_reference '''
6352 print('port_reference_list_1', list(p
))
6355 def p_port_reference_list_2(p
):
6356 '''port_reference_list : port_reference_list ',' port_reference '''
6357 print('port_reference_list_2', list(p
))
6358 # { Module::port_t*tmp = $1;
6359 # append(tmp->expr, $3->expr);
6364 def p_dimensions_opt_1(p
):
6365 '''dimensions_opt : '''
6366 print('dimensions_opt_1', list(p
))
6369 def p_dimensions_opt_2(p
):
6370 '''dimensions_opt : dimensions '''
6371 print('dimensions_opt_2', list(p
))
6374 def p_dimensions_1(p
):
6375 '''dimensions : variable_dimension '''
6376 print('dimensions_1', list(p
))
6379 def p_dimensions_2(p
):
6380 '''dimensions : dimensions variable_dimension '''
6381 print('dimensions_2', list(p
))
6382 # { list<pform_range_t> *tmp = $1;
6384 # tmp->splice(tmp->end(), *$2);
6390 def p_register_variable_1(p
):
6391 '''register_variable : IDENTIFIER dimensions_opt '''
6392 print('register_variable_1', list(p
))
6393 # { perm_string name = lex_strings.make($1);
6394 # pform_makewire(@1, name, NetNet::REG,
6395 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6396 # pform_set_reg_idx(name, $2);
6400 def p_register_variable_2(p
):
6401 '''register_variable : IDENTIFIER dimensions_opt '=' expression '''
6402 print('register_variable_2', list(p
))
6403 # { if (pform_peek_scope()->var_init_needs_explicit_lifetime()
6404 # && (var_lifetime == LexicalScope::INHERITED)) {
6405 # cerr << @3 << ": warning: Static variable initialization requires "
6406 # "explicit lifetime in this context." << endl;
6409 # perm_string name = lex_strings.make($1);
6410 # pform_makewire(@1, name, NetNet::REG,
6411 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6412 # pform_set_reg_idx(name, $2);
6413 # pform_make_var_init(@1, name, $4);
6417 def p_register_variable_list_1(p
):
6418 '''register_variable_list : register_variable '''
6419 print('register_variable_list_1', list(p
))
6420 # { list<perm_string>*tmp = new list<perm_string>;
6421 # tmp->push_back(lex_strings.make($1));
6426 def p_register_variable_list_2(p
):
6427 '''register_variable_list : register_variable_list ',' register_variable '''
6428 print('register_variable_list_2', list(p
))
6429 # { list<perm_string>*tmp = $1;
6430 # tmp->push_back(lex_strings.make($3));
6435 def p_net_variable_1(p
):
6436 '''net_variable : IDENTIFIER dimensions_opt '''
6437 print('net_variable_1', list(p
))
6438 # { perm_string name = lex_strings.make($1);
6439 # pform_makewire(@1, name, NetNet::IMPLICIT,
6440 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6441 # pform_set_reg_idx(name, $2);
6445 def p_net_variable_list_1(p
):
6446 '''net_variable_list : net_variable '''
6447 print('net_variable_list_1', list(p
))
6448 # { list<perm_string>*tmp = new list<perm_string>;
6449 # tmp->push_back(lex_strings.make($1));
6454 def p_net_variable_list_2(p
):
6455 '''net_variable_list : net_variable_list ',' net_variable '''
6456 print('net_variable_list_2', list(p
))
6457 # { list<perm_string>*tmp = $1;
6458 # tmp->push_back(lex_strings.make($3));
6463 def p_event_variable_1(p
):
6464 '''event_variable : IDENTIFIER dimensions_opt '''
6465 print('event_variable_1', list(p
))
6467 # yyerror(@2, "sorry: event arrays are not supported.");
6473 def p_event_variable_list_1(p
):
6474 '''event_variable_list : event_variable '''
6475 print('event_variable_list_1', list(p
))
6476 # { $$ = list_from_identifier($1); }
6478 def p_event_variable_list_2(p
):
6479 '''event_variable_list : event_variable_list ',' event_variable '''
6480 print('event_variable_list_2', list(p
))
6481 # { $$ = list_from_identifier($1, $3); }
6483 def p_specify_item_1(p
):
6484 '''specify_item : K_specparam specparam_decl ';' '''
6485 print('specify_item_1', list(p
))
6487 def p_specify_item_2(p
):
6488 '''specify_item : specify_simple_path_decl ';' '''
6489 print('specify_item_2', list(p
))
6490 # { pform_module_specify_path($1);
6493 def p_specify_item_3(p
):
6494 '''specify_item : specify_edge_path_decl ';' '''
6495 print('specify_item_3', list(p
))
6496 # { pform_module_specify_path($1);
6499 def p_specify_item_4(p
):
6500 '''specify_item : K_if '(' expression ')' specify_simple_path_decl ';' '''
6501 print('specify_item_4', list(p
))
6502 # { PSpecPath*tmp = $5;
6504 # tmp->conditional = true;
6505 # tmp->condition = $3;
6507 # pform_module_specify_path(tmp);
6510 def p_specify_item_5(p
):
6511 '''specify_item : K_if '(' expression ')' specify_edge_path_decl ';' '''
6512 print('specify_item_5', list(p
))
6513 # { PSpecPath*tmp = $5;
6515 # tmp->conditional = true;
6516 # tmp->condition = $3;
6518 # pform_module_specify_path(tmp);
6521 def p_specify_item_6(p
):
6522 '''specify_item : K_ifnone specify_simple_path_decl ';' '''
6523 print('specify_item_6', list(p
))
6524 # { PSpecPath*tmp = $2;
6526 # tmp->conditional = true;
6527 # tmp->condition = 0;
6529 # pform_module_specify_path(tmp);
6532 def p_specify_item_7(p
):
6533 '''specify_item : K_ifnone specify_edge_path_decl ';' '''
6534 print('specify_item_7', list(p
))
6535 # { yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
6536 # "not supported.");
6540 def p_specify_item_8(p
):
6541 '''specify_item : K_Sfullskew '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6542 print('specify_item_8', list(p
))
6547 def p_specify_item_9(p
):
6548 '''specify_item : K_Shold '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6549 print('specify_item_9', list(p
))
6553 def p_specify_item_10(p
):
6554 '''specify_item : K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6555 print('specify_item_10', list(p
))
6560 def p_specify_item_11(p
):
6561 '''specify_item : K_Speriod '(' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6562 print('specify_item_11', list(p
))
6566 def p_specify_item_12(p
):
6567 '''specify_item : K_Srecovery '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6568 print('specify_item_12', list(p
))
6572 def p_specify_item_13(p
):
6573 '''specify_item : K_Srecrem '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6574 print('specify_item_13', list(p
))
6579 def p_specify_item_14(p
):
6580 '''specify_item : K_Sremoval '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6581 print('specify_item_14', list(p
))
6585 def p_specify_item_15(p
):
6586 '''specify_item : K_Ssetup '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6587 print('specify_item_15', list(p
))
6591 def p_specify_item_16(p
):
6592 '''specify_item : K_Ssetuphold '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6593 print('specify_item_16', list(p
))
6598 def p_specify_item_17(p
):
6599 '''specify_item : K_Sskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6600 print('specify_item_17', list(p
))
6604 def p_specify_item_18(p
):
6605 '''specify_item : K_Stimeskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6606 print('specify_item_18', list(p
))
6610 def p_specify_item_19(p
):
6611 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ',' expression spec_notifier_opt ')' ';' '''
6612 print('specify_item_19', list(p
))
6617 def p_specify_item_20(p
):
6618 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ')' ';' '''
6619 print('specify_item_20', list(p
))
6623 def p_specify_item_21(p
):
6624 '''specify_item : K_pulsestyle_onevent specify_path_identifiers ';' '''
6625 print('specify_item_21', list(p
))
6629 def p_specify_item_22(p
):
6630 '''specify_item : K_pulsestyle_ondetect specify_path_identifiers ';' '''
6631 print('specify_item_22', list(p
))
6635 def p_specify_item_23(p
):
6636 '''specify_item : K_showcancelled specify_path_identifiers ';' '''
6637 print('specify_item_23', list(p
))
6641 def p_specify_item_24(p
):
6642 '''specify_item : K_noshowcancelled specify_path_identifiers ';' '''
6643 print('specify_item_24', list(p
))
6647 def p_specify_item_list_1(p
):
6648 '''specify_item_list : specify_item '''
6649 print('specify_item_list_1', list(p
))
6651 def p_specify_item_list_2(p
):
6652 '''specify_item_list : specify_item_list specify_item '''
6653 print('specify_item_list_2', list(p
))
6655 def p_specify_item_list_opt_1(p
):
6656 '''specify_item_list_opt : '''
6657 print('specify_item_list_opt_1', list(p
))
6660 def p_specify_item_list_opt_2(p
):
6661 '''specify_item_list_opt : specify_item_list '''
6662 print('specify_item_list_opt_2', list(p
))
6665 def p_specify_edge_path_decl_1(p
):
6666 '''specify_edge_path_decl : specify_edge_path '=' '(' delay_value_list ')' '''
6667 print('specify_edge_path_decl_1', list(p
))
6668 # { $$ = pform_assign_path_delay($1, $4); }
6670 def p_specify_edge_path_decl_2(p
):
6671 '''specify_edge_path_decl : specify_edge_path '=' delay_value_simple '''
6672 print('specify_edge_path_decl_2', list(p
))
6673 # { list<PExpr*>*tmp = new list<PExpr*>;
6674 # tmp->push_back($3);
6675 # $$ = pform_assign_path_delay($1, tmp);
6678 def p_edge_operator_1(p
):
6679 '''edge_operator : K_posedge '''
6680 print('edge_operator_1', list(p
))
6683 def p_edge_operator_2(p
):
6684 '''edge_operator : K_negedge '''
6685 print('edge_operator_2', list(p
))
6688 def p_specify_edge_path_1(p
):
6689 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6690 print('specify_edge_path_1', list(p
))
6691 # { int edge_flag = 0;
6692 # $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, false, $6, $8); }
6694 def p_specify_edge_path_2(p
):
6695 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6696 print('specify_edge_path_2', list(p
))
6697 # { int edge_flag = $2? 1 : -1;
6698 # $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, false, $7, $9);}
6700 def p_specify_edge_path_3(p
):
6701 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6702 print('specify_edge_path_3', list(p
))
6703 # { int edge_flag = 0;
6704 # $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, true, $6, $8); }
6706 def p_specify_edge_path_4(p
):
6707 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6708 print('specify_edge_path_4', list(p
))
6709 # { int edge_flag = $2? 1 : -1;
6710 # $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, true, $7, $9); }
6712 def p_polarity_operator_1(p
):
6713 '''polarity_operator : K_PO_POS '''
6714 print('polarity_operator_1', list(p
))
6716 def p_polarity_operator_2(p
):
6717 '''polarity_operator : K_PO_NEG '''
6718 print('polarity_operator_2', list(p
))
6720 def p_polarity_operator_3(p
):
6721 '''polarity_operator : ':' '''
6722 print('polarity_operator_3', list(p
))
6724 def p_specify_simple_path_decl_1(p
):
6725 '''specify_simple_path_decl : specify_simple_path '=' '(' delay_value_list ')' '''
6726 print('specify_simple_path_decl_1', list(p
))
6727 # { $$ = pform_assign_path_delay($1, $4); }
6729 def p_specify_simple_path_decl_2(p
):
6730 '''specify_simple_path_decl : specify_simple_path '=' delay_value_simple '''
6731 print('specify_simple_path_decl_2', list(p
))
6732 # { list<PExpr*>*tmp = new list<PExpr*>;
6733 # tmp->push_back($3);
6734 # $$ = pform_assign_path_delay($1, tmp);
6737 def p_specify_simple_path_decl_3(p
):
6738 '''specify_simple_path_decl : specify_simple_path '=' '(' error ')' '''
6739 print('specify_simple_path_decl_3', list(p
))
6740 # { yyerror(@3, "Syntax error in delay value list.");
6745 def p_specify_simple_path_1(p
):
6746 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' '''
6747 print('specify_simple_path_1', list(p
))
6748 # { $$ = pform_make_specify_path(@1, $2, $3, false, $5); }
6750 def p_specify_simple_path_2(p
):
6751 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' '''
6752 print('specify_simple_path_2', list(p
))
6753 # { $$ = pform_make_specify_path(@1, $2, $3, true, $5); }
6755 def p_specify_simple_path_3(p
):
6756 '''specify_simple_path : '(' error ')' '''
6757 print('specify_simple_path_3', list(p
))
6758 # { yyerror(@1, "Invalid simple path");
6762 def p_specify_path_identifiers_1(p
):
6763 '''specify_path_identifiers : IDENTIFIER '''
6764 print('specify_path_identifiers_1', list(p
))
6765 # { list<perm_string>*tmp = new list<perm_string>;
6766 # tmp->push_back(lex_strings.make($1));
6771 def p_specify_path_identifiers_2(p
):
6772 '''specify_path_identifiers : IDENTIFIER '[' expr_primary ']' '''
6773 print('specify_path_identifiers_2', list(p
))
6774 # { if (gn_specify_blocks_flag) {
6775 # yywarn(@4, "Bit selects are not currently supported "
6776 # "in path declarations. The declaration "
6777 # "will be applied to the whole vector.");
6779 # list<perm_string>*tmp = new list<perm_string>;
6780 # tmp->push_back(lex_strings.make($1));
6785 def p_specify_path_identifiers_3(p
):
6786 '''specify_path_identifiers : IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6787 print('specify_path_identifiers_3', list(p
))
6788 # { if (gn_specify_blocks_flag) {
6789 # yywarn(@4, "Part selects are not currently supported "
6790 # "in path declarations. The declaration "
6791 # "will be applied to the whole vector.");
6793 # list<perm_string>*tmp = new list<perm_string>;
6794 # tmp->push_back(lex_strings.make($1));
6799 def p_specify_path_identifiers_4(p
):
6800 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '''
6801 print('specify_path_identifiers_4', list(p
))
6802 # { list<perm_string>*tmp = $1;
6803 # tmp->push_back(lex_strings.make($3));
6808 def p_specify_path_identifiers_5(p
):
6809 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' '''
6810 print('specify_path_identifiers_5', list(p
))
6811 # { if (gn_specify_blocks_flag) {
6812 # yywarn(@4, "Bit selects are not currently supported "
6813 # "in path declarations. The declaration "
6814 # "will be applied to the whole vector.");
6816 # list<perm_string>*tmp = $1;
6817 # tmp->push_back(lex_strings.make($3));
6822 def p_specify_path_identifiers_6(p
):
6823 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6824 print('specify_path_identifiers_6', list(p
))
6825 # { if (gn_specify_blocks_flag) {
6826 # yywarn(@4, "Part selects are not currently supported "
6827 # "in path declarations. The declaration "
6828 # "will be applied to the whole vector.");
6830 # list<perm_string>*tmp = $1;
6831 # tmp->push_back(lex_strings.make($3));
6836 def p_specparam_1(p
):
6837 '''specparam : IDENTIFIER '=' expression '''
6838 print('specparam_1', list(p
))
6840 # pform_set_specparam(@1, lex_strings.make($1),
6841 # param_active_range, tmp);
6845 def p_specparam_2(p
):
6846 '''specparam : IDENTIFIER '=' expression ':' expression ':' expression '''
6847 print('specparam_2', list(p
))
6849 # switch (min_typ_max_flag) {
6866 # if (min_typ_max_warn > 0) {
6867 # cerr << tmp->get_fileline() << ": warning: choosing ";
6868 # switch (min_typ_max_flag) {
6879 # cerr << " expression." << endl;
6880 # min_typ_max_warn -= 1;
6882 # pform_set_specparam(@1, lex_strings.make($1),
6883 # param_active_range, tmp);
6887 def p_specparam_3(p
):
6888 '''specparam : PATHPULSE_IDENTIFIER '=' expression '''
6889 print('specparam_3', list(p
))
6894 def p_specparam_4(p
):
6895 '''specparam : PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' '''
6896 print('specparam_4', list(p
))
6902 def p_specparam_list_1(p
):
6903 '''specparam_list : specparam '''
6904 print('specparam_list_1', list(p
))
6906 def p_specparam_list_2(p
):
6907 '''specparam_list : specparam_list ',' specparam '''
6908 print('specparam_list_2', list(p
))
6910 def p_specparam_decl_1(p
):
6911 '''specparam_decl : specparam_list '''
6912 print('specparam_decl_1', list(p
))
6914 def p_specparam_decl_2(p
):
6915 '''specparam_decl : dimensions _embed0_specparam_decl specparam_list '''
6916 print('specparam_decl_2', list(p
))
6917 # { param_active_range = 0; }
6919 def p__embed0_specparam_decl(p
):
6920 '''_embed0_specparam_decl : '''
6921 # { param_active_range = $1; }
6923 def p_spec_polarity_1(p
):
6924 '''spec_polarity : '+' '''
6925 print('spec_polarity_1', list(p
))
6928 def p_spec_polarity_2(p
):
6929 '''spec_polarity : '-' '''
6930 print('spec_polarity_2', list(p
))
6933 def p_spec_polarity_3(p
):
6934 '''spec_polarity : '''
6935 print('spec_polarity_3', list(p
))
6938 def p_spec_reference_event_1(p
):
6939 '''spec_reference_event : K_posedge expression '''
6940 print('spec_reference_event_1', list(p
))
6943 def p_spec_reference_event_2(p
):
6944 '''spec_reference_event : K_negedge expression '''
6945 print('spec_reference_event_2', list(p
))
6948 def p_spec_reference_event_3(p
):
6949 '''spec_reference_event : K_posedge expr_primary K_TAND expression '''
6950 print('spec_reference_event_3', list(p
))
6955 def p_spec_reference_event_4(p
):
6956 '''spec_reference_event : K_negedge expr_primary K_TAND expression '''
6957 print('spec_reference_event_4', list(p
))
6962 def p_spec_reference_event_5(p
):
6963 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary '''
6964 print('spec_reference_event_5', list(p
))
6967 def p_spec_reference_event_6(p
):
6968 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression '''
6969 print('spec_reference_event_6', list(p
))
6974 def p_spec_reference_event_7(p
):
6975 '''spec_reference_event : expr_primary K_TAND expression '''
6976 print('spec_reference_event_7', list(p
))
6981 def p_spec_reference_event_8(p
):
6982 '''spec_reference_event : expr_primary '''
6983 print('spec_reference_event_8', list(p
))
6986 def p_edge_descriptor_list_1(p
):
6987 '''edge_descriptor_list : edge_descriptor_list ',' K_edge_descriptor '''
6988 print('edge_descriptor_list_1', list(p
))
6990 def p_edge_descriptor_list_2(p
):
6991 '''edge_descriptor_list : K_edge_descriptor '''
6992 print('edge_descriptor_list_2', list(p
))
6994 def p_spec_notifier_opt_1(p
):
6995 '''spec_notifier_opt : '''
6996 print('spec_notifier_opt_1', list(p
))
6999 def p_spec_notifier_opt_2(p
):
7000 '''spec_notifier_opt : spec_notifier '''
7001 print('spec_notifier_opt_2', list(p
))
7004 def p_spec_notifier_1(p
):
7005 '''spec_notifier : ',' '''
7006 print('spec_notifier_1', list(p
))
7007 # { args_after_notifier = 0; }
7009 def p_spec_notifier_2(p
):
7010 '''spec_notifier : ',' hierarchy_identifier '''
7011 print('spec_notifier_2', list(p
))
7012 # { args_after_notifier = 0; delete $2; }
7014 def p_spec_notifier_3(p
):
7015 '''spec_notifier : spec_notifier ',' '''
7016 print('spec_notifier_3', list(p
))
7017 # { args_after_notifier += 1; }
7019 def p_spec_notifier_4(p
):
7020 '''spec_notifier : spec_notifier ',' hierarchy_identifier '''
7021 print('spec_notifier_4', list(p
))
7022 # { args_after_notifier += 1;
7023 # if (args_after_notifier >= 3) {
7024 # cerr << @3 << ": warning: timing checks are not supported "
7025 # "and delayed signal \"" << *$3
7026 # << "\" will not be driven." << endl;
7030 def p_spec_notifier_5(p
):
7031 '''spec_notifier : IDENTIFIER '''
7032 print('spec_notifier_5', list(p
))
7033 # { args_after_notifier = 0; delete[]$1; }
7035 def p_statement_item_1(p
):
7036 '''statement_item : K_assign lpvalue '=' expression ';' '''
7037 print('statement_item_1', list(p
))
7038 # { PCAssign*tmp = new PCAssign($2, $4);
7039 # FILE_NAME(tmp, @1);
7043 def p_statement_item_2(p
):
7044 '''statement_item : K_deassign lpvalue ';' '''
7045 print('statement_item_2', list(p
))
7046 # { PDeassign*tmp = new PDeassign($2);
7047 # FILE_NAME(tmp, @1);
7051 def p_statement_item_3(p
):
7052 '''statement_item : K_force lpvalue '=' expression ';' '''
7053 print('statement_item_3', list(p
))
7054 # { PForce*tmp = new PForce($2, $4);
7055 # FILE_NAME(tmp, @1);
7059 def p_statement_item_4(p
):
7060 '''statement_item : K_release lpvalue ';' '''
7061 print('statement_item_4', list(p
))
7062 # { PRelease*tmp = new PRelease($2);
7063 # FILE_NAME(tmp, @1);
7067 def p_statement_item_5(p
):
7068 '''statement_item : K_begin K_end '''
7069 print('statement_item_5', list(p
))
7070 # { PBlock*tmp = new PBlock(PBlock::BL_SEQ);
7071 # FILE_NAME(tmp, @1);
7075 def p_statement_item_6(p
):
7076 '''statement_item : K_begin _embed0_statement_item block_item_decls_opt _embed1_statement_item statement_or_null_list K_end '''
7077 print('statement_item_6', list(p
))
7080 # pform_pop_scope();
7081 # assert(! current_block_stack.empty());
7082 # tmp = current_block_stack.top();
7083 # current_block_stack.pop();
7085 # tmp = new PBlock(PBlock::BL_SEQ);
7086 # FILE_NAME(tmp, @1);
7088 # if ($5) tmp->set_statement(*$5);
7093 def p_statement_item_7(p
):
7094 '''statement_item : K_begin ':' IDENTIFIER _embed2_statement_item block_item_decls_opt statement_or_null_list_opt K_end endlabel_opt '''
7095 print('statement_item_7', list(p
))
7096 # { pform_pop_scope();
7097 # assert(! current_block_stack.empty());
7098 # PBlock*tmp = current_block_stack.top();
7099 # current_block_stack.pop();
7100 # if ($6) tmp->set_statement(*$6);
7103 # if (strcmp($3,$8) != 0) {
7104 # yyerror(@8, "error: End label doesn't match begin name");
7106 # if (! gn_system_verilog()) {
7107 # yyerror(@8, "error: Begin end labels require "
7108 # "SystemVerilog.");
7116 def p_statement_item_8(p
):
7117 '''statement_item : K_fork join_keyword '''
7118 print('statement_item_8', list(p
))
7119 # { PBlock*tmp = new PBlock($2);
7120 # FILE_NAME(tmp, @1);
7124 def p_statement_item_9(p
):
7125 '''statement_item : K_fork _embed3_statement_item block_item_decls_opt _embed4_statement_item statement_or_null_list join_keyword '''
7126 print('statement_item_9', list(p
))
7129 # pform_pop_scope();
7130 # assert(! current_block_stack.empty());
7131 # tmp = current_block_stack.top();
7132 # current_block_stack.pop();
7133 # tmp->set_join_type($6);
7135 # tmp = new PBlock($6);
7136 # FILE_NAME(tmp, @1);
7138 # if ($5) tmp->set_statement(*$5);
7143 def p_statement_item_10(p
):
7144 '''statement_item : K_fork ':' IDENTIFIER _embed5_statement_item block_item_decls_opt statement_or_null_list_opt join_keyword endlabel_opt '''
7145 print('statement_item_10', list(p
))
7146 # { pform_pop_scope();
7147 # assert(! current_block_stack.empty());
7148 # PBlock*tmp = current_block_stack.top();
7149 # current_block_stack.pop();
7150 # tmp->set_join_type($7);
7151 # if ($6) tmp->set_statement(*$6);
7154 # if (strcmp($3,$8) != 0) {
7155 # yyerror(@8, "error: End label doesn't match fork name");
7157 # if (! gn_system_verilog()) {
7158 # yyerror(@8, "error: Fork end labels require "
7159 # "SystemVerilog.");
7167 def p_statement_item_11(p
):
7168 '''statement_item : K_disable hierarchy_identifier ';' '''
7169 print('statement_item_11', list(p
))
7170 # { PDisable*tmp = new PDisable(*$2);
7171 # FILE_NAME(tmp, @1);
7176 def p_statement_item_12(p
):
7177 '''statement_item : K_disable K_fork ';' '''
7178 print('statement_item_12', list(p
))
7179 # { pform_name_t tmp_name;
7180 # PDisable*tmp = new PDisable(tmp_name);
7181 # FILE_NAME(tmp, @1);
7185 def p_statement_item_13(p
):
7186 '''statement_item : K_TRIGGER hierarchy_identifier ';' '''
7187 print('statement_item_13', list(p
))
7188 # { PTrigger*tmp = new PTrigger(*$2);
7189 # FILE_NAME(tmp, @1);
7194 def p_statement_item_14(p
):
7195 '''statement_item : procedural_assertion_statement '''
7196 print('statement_item_14', list(p
))
7199 def p_statement_item_15(p
):
7200 '''statement_item : loop_statement '''
7201 print('statement_item_15', list(p
))
7204 def p_statement_item_16(p
):
7205 '''statement_item : jump_statement '''
7206 print('statement_item_16', list(p
))
7209 def p_statement_item_17(p
):
7210 '''statement_item : K_case '(' expression ')' case_items K_endcase '''
7211 print('statement_item_17', list(p
))
7212 # { PCase*tmp = new PCase(NetCase::EQ, $3, $5);
7213 # FILE_NAME(tmp, @1);
7217 def p_statement_item_18(p
):
7218 '''statement_item : K_casex '(' expression ')' case_items K_endcase '''
7219 print('statement_item_18', list(p
))
7220 # { PCase*tmp = new PCase(NetCase::EQX, $3, $5);
7221 # FILE_NAME(tmp, @1);
7225 def p_statement_item_19(p
):
7226 '''statement_item : K_casez '(' expression ')' case_items K_endcase '''
7227 print('statement_item_19', list(p
))
7228 # { PCase*tmp = new PCase(NetCase::EQZ, $3, $5);
7229 # FILE_NAME(tmp, @1);
7233 def p_statement_item_20(p
):
7234 '''statement_item : K_case '(' expression ')' error K_endcase '''
7235 print('statement_item_20', list(p
))
7238 def p_statement_item_21(p
):
7239 '''statement_item : K_casex '(' expression ')' error K_endcase '''
7240 print('statement_item_21', list(p
))
7243 def p_statement_item_22(p
):
7244 '''statement_item : K_casez '(' expression ')' error K_endcase '''
7245 print('statement_item_22', list(p
))
7248 def p_statement_item_23(p
):
7249 '''statement_item : K_if '(' expression ')' statement_or_null %prec less_than_K_else '''
7250 print('statement_item_23', list(p
))
7251 # { PCondit*tmp = new PCondit($3, $5, 0);
7252 # FILE_NAME(tmp, @1);
7256 def p_statement_item_24(p
):
7257 '''statement_item : K_if '(' expression ')' statement_or_null K_else statement_or_null '''
7258 print('statement_item_24', list(p
))
7259 # { PCondit*tmp = new PCondit($3, $5, $7);
7260 # FILE_NAME(tmp, @1);
7264 def p_statement_item_25(p
):
7265 '''statement_item : K_if '(' error ')' statement_or_null %prec less_than_K_else '''
7266 print('statement_item_25', list(p
))
7267 # { yyerror(@1, "error: Malformed conditional expression.");
7271 def p_statement_item_26(p
):
7272 '''statement_item : K_if '(' error ')' statement_or_null K_else statement_or_null '''
7273 print('statement_item_26', list(p
))
7274 # { yyerror(@1, "error: Malformed conditional expression.");
7278 def p_statement_item_27(p
):
7279 '''statement_item : compressed_statement ';' '''
7280 print('statement_item_27', list(p
))
7283 def p_statement_item_28(p
):
7284 '''statement_item : inc_or_dec_expression ';' '''
7285 print('statement_item_28', list(p
))
7286 # { $$ = pform_compressed_assign_from_inc_dec(@1, $1); }
7288 def p_statement_item_29(p
):
7289 '''statement_item : delay1 statement_or_null '''
7290 print('statement_item_29', list(p
))
7291 # { PExpr*del = $1->front();
7292 # assert($1->size() == 1);
7294 # PDelayStatement*tmp = new PDelayStatement(del, $2);
7295 # FILE_NAME(tmp, @1);
7299 def p_statement_item_30(p
):
7300 '''statement_item : event_control statement_or_null '''
7301 print('statement_item_30', list(p
))
7302 # { PEventStatement*tmp = $1;
7304 # yyerror(@1, "error: Invalid event control.");
7307 # tmp->set_statement($2);
7312 def p_statement_item_31(p
):
7313 '''statement_item : '@' '*' statement_or_null '''
7314 print('statement_item_31', list(p
))
7315 # { PEventStatement*tmp = new PEventStatement;
7316 # FILE_NAME(tmp, @1);
7317 # tmp->set_statement($3);
7321 def p_statement_item_32(p
):
7322 '''statement_item : '@' '(' '*' ')' statement_or_null '''
7323 print('statement_item_32', list(p
))
7324 # { PEventStatement*tmp = new PEventStatement;
7325 # FILE_NAME(tmp, @1);
7326 # tmp->set_statement($5);
7330 def p_statement_item_33(p
):
7331 '''statement_item : lpvalue '=' expression ';' '''
7332 print('statement_item33', list(p
))
7334 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), p
[3] ])
7335 print ("expr TODO", repr(expr
))
7337 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), ])
7338 print ("expr", repr(expr
))
7339 print ("expr (python):'%s'" % expr
)
7341 # { PAssign*tmp = new PAssign($1,$3);
7342 # FILE_NAME(tmp, @1);
7346 def p_statement_item_34(p
):
7347 '''statement_item : error '=' expression ';' '''
7348 print('statement_item_34', list(p
))
7349 # { yyerror(@2, "Syntax in assignment statement l-value.");
7354 def p_statement_item_35(p
):
7355 '''statement_item : lpvalue K_LE expression ';' '''
7356 print('statement_item_35', list(p
))
7357 # { PAssignNB*tmp = new PAssignNB($1,$3);
7358 # FILE_NAME(tmp, @1);
7362 def p_statement_item_36(p
):
7363 '''statement_item : error K_LE expression ';' '''
7364 print('statement_item_36', list(p
))
7365 # { yyerror(@2, "Syntax in assignment statement l-value.");
7370 def p_statement_item_37(p
):
7371 '''statement_item : lpvalue '=' delay1 expression ';' '''
7372 print('statement_item_37', list(p
))
7373 # { PExpr*del = $3->front(); $3->pop_front();
7374 # assert($3->empty());
7375 # PAssign*tmp = new PAssign($1,del,$4);
7376 # FILE_NAME(tmp, @1);
7380 def p_statement_item_38(p
):
7381 '''statement_item : lpvalue K_LE delay1 expression ';' '''
7382 print('statement_item_38', list(p
))
7383 # { PExpr*del = $3->front(); $3->pop_front();
7384 # assert($3->empty());
7385 # PAssignNB*tmp = new PAssignNB($1,del,$4);
7386 # FILE_NAME(tmp, @1);
7390 def p_statement_item_39(p
):
7391 '''statement_item : lpvalue '=' event_control expression ';' '''
7392 print('statement_item_39', list(p
))
7393 # { PAssign*tmp = new PAssign($1,0,$3,$4);
7394 # FILE_NAME(tmp, @1);
7398 def p_statement_item_40(p
):
7399 '''statement_item : lpvalue '=' K_repeat '(' expression ')' event_control expression ';' '''
7400 print('statement_item_40', list(p
))
7401 # { PAssign*tmp = new PAssign($1,$5,$7,$8);
7402 # FILE_NAME(tmp,@1);
7403 # tmp->set_lineno(@1.first_line);
7407 def p_statement_item_41(p
):
7408 '''statement_item : lpvalue K_LE event_control expression ';' '''
7409 print('statement_item_41', list(p
))
7410 # { PAssignNB*tmp = new PAssignNB($1,0,$3,$4);
7411 # FILE_NAME(tmp, @1);
7415 def p_statement_item_42(p
):
7416 '''statement_item : lpvalue K_LE K_repeat '(' expression ')' event_control expression ';' '''
7417 print('statement_item_42', list(p
))
7418 # { PAssignNB*tmp = new PAssignNB($1,$5,$7,$8);
7419 # FILE_NAME(tmp, @1);
7423 def p_statement_item_43(p
):
7424 '''statement_item : lpvalue '=' dynamic_array_new ';' '''
7425 print('statement_item_43', list(p
))
7426 # { PAssign*tmp = new PAssign($1,$3);
7427 # FILE_NAME(tmp, @1);
7431 def p_statement_item_44(p
):
7432 '''statement_item : lpvalue '=' class_new ';' '''
7433 print('statement_item_44', list(p
))
7434 # { PAssign*tmp = new PAssign($1,$3);
7435 # FILE_NAME(tmp, @1);
7439 def p_statement_item_45(p
):
7440 '''statement_item : K_wait '(' expression ')' statement_or_null '''
7441 print('statement_item_45', list(p
))
7442 # { PEventStatement*tmp;
7443 # PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, $3);
7444 # tmp = new PEventStatement(etmp);
7445 # FILE_NAME(tmp,@1);
7446 # tmp->set_statement($5);
7450 def p_statement_item_46(p
):
7451 '''statement_item : K_wait K_fork ';' '''
7452 print('statement_item_46', list(p
))
7453 # { PEventStatement*tmp = new PEventStatement((PEEvent*)0);
7454 # FILE_NAME(tmp,@1);
7458 def p_statement_item_47(p
):
7459 '''statement_item : SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';' '''
7460 print('statement_item_47', list(p
))
7461 # { PCallTask*tmp = new PCallTask(lex_strings.make($1), *$3);
7462 # FILE_NAME(tmp,@1);
7468 def p_statement_item_48(p
):
7469 '''statement_item : SYSTEM_IDENTIFIER ';' '''
7470 print('statement_item_48', list(p
))
7472 # PCallTask*tmp = new PCallTask(lex_strings.make($1), pt);
7473 # FILE_NAME(tmp,@1);
7478 def p_statement_item_49(p
):
7479 '''statement_item : hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7480 print('statement_item_49', list(p
))
7481 # { PCallTask*tmp = pform_make_call_task(@1, *$1, *$3);
7487 def p_statement_item_50(p
):
7488 '''statement_item : hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';' '''
7489 print('statement_item_50', list(p
))
7490 # { /* ....randomize with { <constraints> } */
7491 # if ($1 && peek_tail_name(*$1) == "randomize") {
7492 # if (!gn_system_verilog())
7493 # yyerror(@2, "error: Randomize with constraint requires SystemVerilog.");
7495 # yyerror(@2, "sorry: Randomize with constraint not supported.");
7497 # yyerror(@2, "error: Constraint block can only be applied to randomize method.");
7500 # PCallTask*tmp = new PCallTask(*$1, pt);
7501 # FILE_NAME(tmp, @1);
7506 def p_statement_item_51(p
):
7507 '''statement_item : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7508 print('statement_item_51', list(p
))
7509 # { pform_name_t*t_name = $1;
7510 # while (! $3->empty()) {
7511 # t_name->push_back($3->front());
7514 # PCallTask*tmp = new PCallTask(*t_name, *$5);
7515 # FILE_NAME(tmp, @1);
7522 def p_statement_item_52(p
):
7523 '''statement_item : hierarchy_identifier ';' '''
7524 print('statement_item_52', list(p
))
7526 # PCallTask*tmp = pform_make_call_task(@1, *$1, pt);
7531 def p_statement_item_53(p
):
7532 '''statement_item : implicit_class_handle '.' K_new '(' expression_list_with_nuls ')' ';' '''
7533 print('statement_item_53', list(p
))
7534 # { PChainConstructor*tmp = new PChainConstructor(*$5);
7535 # FILE_NAME(tmp, @3);
7540 def p_statement_item_54(p
):
7541 '''statement_item : hierarchy_identifier '(' error ')' ';' '''
7542 print('statement_item_54', list(p
))
7543 # { yyerror(@3, "error: Syntax error in task arguments.");
7545 # PCallTask*tmp = pform_make_call_task(@1, *$1, pt);
7550 def p_statement_item_55(p
):
7551 '''statement_item : error ';' '''
7552 print('statement_item_55', list(p
))
7553 # { yyerror(@2, "error: malformed statement");
7558 def p__embed0_statement_item(p
):
7559 '''_embed0_statement_item : '''
7560 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_SEQ);
7561 # FILE_NAME(tmp, @1);
7562 # current_block_stack.push(tmp);
7565 def p__embed1_statement_item(p
):
7566 '''_embed1_statement_item : '''
7568 # if (! gn_system_verilog()) {
7569 # yyerror("error: Variable declaration in unnamed block "
7570 # "requires SystemVerilog.");
7573 # /* If there are no declarations in the scope then just delete it. */
7574 # pform_pop_scope();
7575 # assert(! current_block_stack.empty());
7576 # PBlock*tmp = current_block_stack.top();
7577 # current_block_stack.pop();
7582 def p__embed2_statement_item(p
):
7583 '''_embed2_statement_item : '''
7584 # { PBlock*tmp = pform_push_block_scope($3, PBlock::BL_SEQ);
7585 # FILE_NAME(tmp, @1);
7586 # current_block_stack.push(tmp);
7589 def p__embed3_statement_item(p
):
7590 '''_embed3_statement_item : '''
7591 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
7592 # FILE_NAME(tmp, @1);
7593 # current_block_stack.push(tmp);
7596 def p__embed4_statement_item(p
):
7597 '''_embed4_statement_item : '''
7599 # if (! gn_system_verilog()) {
7600 # yyerror("error: Variable declaration in unnamed block "
7601 # "requires SystemVerilog.");
7604 # /* If there are no declarations in the scope then just delete it. */
7605 # pform_pop_scope();
7606 # assert(! current_block_stack.empty());
7607 # PBlock*tmp = current_block_stack.top();
7608 # current_block_stack.pop();
7613 def p__embed5_statement_item(p
):
7614 '''_embed5_statement_item : '''
7615 # { PBlock*tmp = pform_push_block_scope($3, PBlock::BL_PAR);
7616 # FILE_NAME(tmp, @1);
7617 # current_block_stack.push(tmp);
7620 def p_compressed_statement_1(p
):
7621 '''compressed_statement : lpvalue K_PLUS_EQ expression '''
7622 print('compressed_statement_1', list(p
))
7623 # { PAssign*tmp = new PAssign($1, '+', $3);
7624 # FILE_NAME(tmp, @1);
7628 def p_compressed_statement_2(p
):
7629 '''compressed_statement : lpvalue K_MINUS_EQ expression '''
7630 print('compressed_statement_2', list(p
))
7631 # { PAssign*tmp = new PAssign($1, '-', $3);
7632 # FILE_NAME(tmp, @1);
7636 def p_compressed_statement_3(p
):
7637 '''compressed_statement : lpvalue K_MUL_EQ expression '''
7638 print('compressed_statement_3', list(p
))
7639 # { PAssign*tmp = new PAssign($1, '*', $3);
7640 # FILE_NAME(tmp, @1);
7644 def p_compressed_statement_4(p
):
7645 '''compressed_statement : lpvalue K_DIV_EQ expression '''
7646 print('compressed_statement_4', list(p
))
7647 # { PAssign*tmp = new PAssign($1, '/', $3);
7648 # FILE_NAME(tmp, @1);
7652 def p_compressed_statement_5(p
):
7653 '''compressed_statement : lpvalue K_MOD_EQ expression '''
7654 print('compressed_statement_5', list(p
))
7655 # { PAssign*tmp = new PAssign($1, '%', $3);
7656 # FILE_NAME(tmp, @1);
7660 def p_compressed_statement_6(p
):
7661 '''compressed_statement : lpvalue K_AND_EQ expression '''
7662 print('compressed_statement_6', list(p
))
7663 # { PAssign*tmp = new PAssign($1, '&', $3);
7664 # FILE_NAME(tmp, @1);
7668 def p_compressed_statement_7(p
):
7669 '''compressed_statement : lpvalue K_OR_EQ expression '''
7670 print('compressed_statement_7', list(p
))
7671 # { PAssign*tmp = new PAssign($1, '|', $3);
7672 # FILE_NAME(tmp, @1);
7676 def p_compressed_statement_8(p
):
7677 '''compressed_statement : lpvalue K_XOR_EQ expression '''
7678 print('compressed_statement_8', list(p
))
7679 # { PAssign*tmp = new PAssign($1, '^', $3);
7680 # FILE_NAME(tmp, @1);
7684 def p_compressed_statement_9(p
):
7685 '''compressed_statement : lpvalue K_LS_EQ expression '''
7686 print('compressed_statement_9', list(p
))
7687 # { PAssign *tmp = new PAssign($1, 'l', $3);
7688 # FILE_NAME(tmp, @1);
7692 def p_compressed_statement_10(p
):
7693 '''compressed_statement : lpvalue K_RS_EQ expression '''
7694 print('compressed_statement_10', list(p
))
7695 # { PAssign*tmp = new PAssign($1, 'r', $3);
7696 # FILE_NAME(tmp, @1);
7700 def p_compressed_statement_11(p
):
7701 '''compressed_statement : lpvalue K_RSS_EQ expression '''
7702 print('compressed_statement_11', list(p
))
7703 # { PAssign *tmp = new PAssign($1, 'R', $3);
7704 # FILE_NAME(tmp, @1);
7708 def p_statement_or_null_list_opt_1(p
):
7709 '''statement_or_null_list_opt : statement_or_null_list '''
7710 print('statement_or_null_list_opt_1', list(p
))
7713 def p_statement_or_null_list_opt_2(p
):
7714 '''statement_or_null_list_opt : '''
7715 print('statement_or_null_list_opt_2', list(p
))
7718 def p_statement_or_null_list_1(p
):
7719 '''statement_or_null_list : statement_or_null_list statement_or_null '''
7720 print('statement_or_null_list_1', list(p
))
7721 # { vector<Statement*>*tmp = $1;
7722 # if ($2) tmp->push_back($2);
7726 def p_statement_or_null_list_2(p
):
7727 '''statement_or_null_list : statement_or_null '''
7728 print('statement_or_null_list_2', list(p
))
7729 # { vector<Statement*>*tmp = new vector<Statement*>(0);
7730 # if ($1) tmp->push_back($1);
7734 def p_analog_statement_1(p
):
7735 '''analog_statement : branch_probe_expression K_CONTRIBUTE expression ';' '''
7736 print('analog_statement_1', list(p
))
7737 # { $$ = pform_contribution_statement(@2, $1, $3); }
7739 def p_task_item_1(p
):
7740 '''task_item : block_item_decl '''
7741 print('task_item_1', list(p
))
7742 # { $$ = new vector<pform_tf_port_t>(0); }
7744 def p_task_item_2(p
):
7745 '''task_item : tf_port_declaration '''
7746 print('task_item_2', list(p
))
7749 def p_task_item_list_1(p
):
7750 '''task_item_list : task_item_list task_item '''
7751 print('task_item_list_1', list(p
))
7752 # { vector<pform_tf_port_t>*tmp = $1;
7753 # size_t s1 = tmp->size();
7754 # tmp->resize(s1 + $2->size());
7755 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
7756 # tmp->at(s1 + idx) = $2->at(idx);
7761 def p_task_item_list_2(p
):
7762 '''task_item_list : task_item '''
7763 print('task_item_list_2', list(p
))
7766 def p_task_item_list_opt_1(p
):
7767 '''task_item_list_opt : task_item_list '''
7768 print('task_item_list_opt_1', list(p
))
7771 def p_task_item_list_opt_2(p
):
7772 '''task_item_list_opt : '''
7773 print('task_item_list_opt_2', list(p
))
7776 def p_tf_port_list_opt_1(p
):
7777 '''tf_port_list_opt : tf_port_list '''
7778 print('tf_port_list_opt_1', list(p
))
7781 def p_tf_port_list_opt_2(p
):
7782 '''tf_port_list_opt : '''
7783 print('tf_port_list_opt_2', list(p
))
7786 def p_udp_body_1(p
):
7787 '''udp_body : K_table udp_entry_list K_endtable '''
7788 print('udp_body_1', list(p
))
7789 # { lex_end_table();
7793 def p_udp_body_2(p
):
7794 '''udp_body : K_table K_endtable '''
7795 print('udp_body_2', list(p
))
7796 # { lex_end_table();
7797 # yyerror(@1, "error: Empty UDP table.");
7801 def p_udp_body_3(p
):
7802 '''udp_body : K_table error K_endtable '''
7803 print('udp_body_3', list(p
))
7804 # { lex_end_table();
7805 # yyerror(@2, "Errors in UDP table");
7810 def p_udp_entry_list_1(p
):
7811 '''udp_entry_list : udp_comb_entry_list '''
7812 print('udp_entry_list_1', list(p
))
7814 def p_udp_entry_list_2(p
):
7815 '''udp_entry_list : udp_sequ_entry_list '''
7816 print('udp_entry_list_2', list(p
))
7818 def p_udp_comb_entry_1(p
):
7819 '''udp_comb_entry : udp_input_list ':' udp_output_sym ';' '''
7820 print('udp_comb_entry_1', list(p
))
7821 # { char*tmp = new char[strlen($1)+3];
7823 # char*tp = tmp+strlen(tmp);
7831 def p_udp_comb_entry_list_1(p
):
7832 '''udp_comb_entry_list : udp_comb_entry '''
7833 print('udp_comb_entry_list_1', list(p
))
7834 # { list<string>*tmp = new list<string>;
7835 # tmp->push_back($1);
7840 def p_udp_comb_entry_list_2(p
):
7841 '''udp_comb_entry_list : udp_comb_entry_list udp_comb_entry '''
7842 print('udp_comb_entry_list_2', list(p
))
7843 # { list<string>*tmp = $1;
7844 # tmp->push_back($2);
7849 def p_udp_sequ_entry_list_1(p
):
7850 '''udp_sequ_entry_list : udp_sequ_entry '''
7851 print('udp_sequ_entry_list_1', list(p
))
7852 # { list<string>*tmp = new list<string>;
7853 # tmp->push_back($1);
7858 def p_udp_sequ_entry_list_2(p
):
7859 '''udp_sequ_entry_list : udp_sequ_entry_list udp_sequ_entry '''
7860 print('udp_sequ_entry_list_2', list(p
))
7861 # { list<string>*tmp = $1;
7862 # tmp->push_back($2);
7867 def p_udp_sequ_entry_1(p
):
7868 '''udp_sequ_entry : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' '''
7869 print('udp_sequ_entry_1', list(p
))
7870 # { char*tmp = new char[strlen($1)+5];
7872 # char*tp = tmp+strlen(tmp);
7881 def p_udp_initial_1(p
):
7882 '''udp_initial : K_initial IDENTIFIER '=' number ';' '''
7883 print('udp_initial_1', list(p
))
7884 # { PExpr*etmp = new PENumber($4);
7885 # PEIdent*itmp = new PEIdent(lex_strings.make($2));
7886 # PAssign*atmp = new PAssign(itmp, etmp);
7887 # FILE_NAME(atmp, @2);
7892 def p_udp_init_opt_1(p
):
7893 '''udp_init_opt : udp_initial '''
7894 print('udp_init_opt_1', list(p
))
7897 def p_udp_init_opt_2(p
):
7898 '''udp_init_opt : '''
7899 print('udp_init_opt_2', list(p
))
7902 def p_udp_input_list_1(p
):
7903 '''udp_input_list : udp_input_sym '''
7904 print('udp_input_list_1', list(p
))
7905 # { char*tmp = new char[2];
7911 def p_udp_input_list_2(p
):
7912 '''udp_input_list : udp_input_list udp_input_sym '''
7913 print('udp_input_list_2', list(p
))
7914 # { char*tmp = new char[strlen($1)+2];
7916 # char*tp = tmp+strlen(tmp);
7923 def p_udp_input_sym_1(p
):
7924 '''udp_input_sym : '0' '''
7925 print('udp_input_sym_1', list(p
))
7928 def p_udp_input_sym_2(p
):
7929 '''udp_input_sym : '1' '''
7930 print('udp_input_sym_2', list(p
))
7933 def p_udp_input_sym_3(p
):
7934 '''udp_input_sym : 'x' '''
7935 print('udp_input_sym_3', list(p
))
7938 def p_udp_input_sym_4(p
):
7939 '''udp_input_sym : '?' '''
7940 print('udp_input_sym_4', list(p
))
7943 def p_udp_input_sym_5(p
):
7944 '''udp_input_sym : 'b' '''
7945 print('udp_input_sym_5', list(p
))
7948 def p_udp_input_sym_6(p
):
7949 '''udp_input_sym : '*' '''
7950 print('udp_input_sym_6', list(p
))
7953 def p_udp_input_sym_7(p
):
7954 '''udp_input_sym : '%' '''
7955 print('udp_input_sym_7', list(p
))
7958 def p_udp_input_sym_8(p
):
7959 '''udp_input_sym : 'f' '''
7960 print('udp_input_sym_8', list(p
))
7963 def p_udp_input_sym_9(p
):
7964 '''udp_input_sym : 'F' '''
7965 print('udp_input_sym_9', list(p
))
7968 def p_udp_input_sym_10(p
):
7969 '''udp_input_sym : 'l' '''
7970 print('udp_input_sym_10', list(p
))
7973 def p_udp_input_sym_11(p
):
7974 '''udp_input_sym : 'h' '''
7975 print('udp_input_sym_11', list(p
))
7978 def p_udp_input_sym_12(p
):
7979 '''udp_input_sym : 'B' '''
7980 print('udp_input_sym_12', list(p
))
7983 def p_udp_input_sym_13(p
):
7984 '''udp_input_sym : 'r' '''
7985 print('udp_input_sym_13', list(p
))
7988 def p_udp_input_sym_14(p
):
7989 '''udp_input_sym : 'R' '''
7990 print('udp_input_sym_14', list(p
))
7993 def p_udp_input_sym_15(p
):
7994 '''udp_input_sym : 'M' '''
7995 print('udp_input_sym_15', list(p
))
7998 def p_udp_input_sym_16(p
):
7999 '''udp_input_sym : 'n' '''
8000 print('udp_input_sym_16', list(p
))
8003 def p_udp_input_sym_17(p
):
8004 '''udp_input_sym : 'N' '''
8005 print('udp_input_sym_17', list(p
))
8008 def p_udp_input_sym_18(p
):
8009 '''udp_input_sym : 'p' '''
8010 print('udp_input_sym_18', list(p
))
8013 def p_udp_input_sym_19(p
):
8014 '''udp_input_sym : 'P' '''
8015 print('udp_input_sym_19', list(p
))
8018 def p_udp_input_sym_20(p
):
8019 '''udp_input_sym : 'Q' '''
8020 print('udp_input_sym_20', list(p
))
8023 def p_udp_input_sym_21(p
):
8024 '''udp_input_sym : 'q' '''
8025 print('udp_input_sym_21', list(p
))
8028 def p_udp_input_sym_22(p
):
8029 '''udp_input_sym : '_' '''
8030 print('udp_input_sym_22', list(p
))
8033 def p_udp_input_sym_23(p
):
8034 '''udp_input_sym : '+' '''
8035 print('udp_input_sym_23', list(p
))
8038 def p_udp_input_sym_24(p
):
8039 '''udp_input_sym : DEC_NUMBER '''
8040 print('udp_input_sym_24', list(p
))
8041 # { yyerror(@1, "internal error: Input digits parse as decimal number!"); $$ = '0'; }
8043 def p_udp_output_sym_1(p
):
8044 '''udp_output_sym : '0' '''
8045 print('udp_output_sym_1', list(p
))
8048 def p_udp_output_sym_2(p
):
8049 '''udp_output_sym : '1' '''
8050 print('udp_output_sym_2', list(p
))
8053 def p_udp_output_sym_3(p
):
8054 '''udp_output_sym : 'x' '''
8055 print('udp_output_sym_3', list(p
))
8058 def p_udp_output_sym_4(p
):
8059 '''udp_output_sym : '-' '''
8060 print('udp_output_sym_4', list(p
))
8063 def p_udp_output_sym_5(p
):
8064 '''udp_output_sym : DEC_NUMBER '''
8065 print('udp_output_sym_5', list(p
))
8066 # { yyerror(@1, "internal error: Output digits parse as decimal number!"); $$ = '0'; }
8068 def p_udp_port_decl_1(p
):
8069 '''udp_port_decl : K_input list_of_identifiers ';' '''
8070 print('udp_port_decl_1', list(p
))
8071 # { $$ = pform_make_udp_input_ports($2); }
8073 def p_udp_port_decl_2(p
):
8074 '''udp_port_decl : K_output IDENTIFIER ';' '''
8075 print('udp_port_decl_2', list(p
))
8076 # { perm_string pname = lex_strings.make($2);
8077 # PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
8078 # vector<PWire*>*tmp = new vector<PWire*>(1);
8084 def p_udp_port_decl_3(p
):
8085 '''udp_port_decl : K_reg IDENTIFIER ';' '''
8086 print('udp_port_decl_3', list(p
))
8087 # { perm_string pname = lex_strings.make($2);
8088 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
8089 # vector<PWire*>*tmp = new vector<PWire*>(1);
8095 def p_udp_port_decl_4(p
):
8096 '''udp_port_decl : K_reg K_output IDENTIFIER ';' '''
8097 print('udp_port_decl_4', list(p
))
8098 # { perm_string pname = lex_strings.make($3);
8099 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
8100 # vector<PWire*>*tmp = new vector<PWire*>(1);
8106 def p_udp_port_decls_1(p
):
8107 '''udp_port_decls : udp_port_decl '''
8108 print('udp_port_decls_1', list(p
))
8111 def p_udp_port_decls_2(p
):
8112 '''udp_port_decls : udp_port_decls udp_port_decl '''
8113 print('udp_port_decls_2', list(p
))
8114 # { vector<PWire*>*tmp = $1;
8115 # size_t s1 = $1->size();
8116 # tmp->resize(s1+$2->size());
8117 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
8118 # tmp->at(s1+idx) = $2->at(idx);
8123 def p_udp_port_list_1(p
):
8124 '''udp_port_list : IDENTIFIER '''
8125 print('udp_port_list_1', list(p
))
8126 # { list<perm_string>*tmp = new list<perm_string>;
8127 # tmp->push_back(lex_strings.make($1));
8132 def p_udp_port_list_2(p
):
8133 '''udp_port_list : udp_port_list ',' IDENTIFIER '''
8134 print('udp_port_list_2', list(p
))
8135 # { list<perm_string>*tmp = $1;
8136 # tmp->push_back(lex_strings.make($3));
8141 def p_udp_reg_opt_1(p
):
8142 '''udp_reg_opt : K_reg '''
8143 print('udp_reg_opt_1', list(p
))
8146 def p_udp_reg_opt_2(p
):
8147 '''udp_reg_opt : '''
8148 print('udp_reg_opt_2', list(p
))
8151 def p_udp_initial_expr_opt_1(p
):
8152 '''udp_initial_expr_opt : '=' expression '''
8153 print('udp_initial_expr_opt_1', list(p
))
8156 def p_udp_initial_expr_opt_2(p
):
8157 '''udp_initial_expr_opt : '''
8158 print('udp_initial_expr_opt_2', list(p
))
8161 def p_udp_input_declaration_list_1(p
):
8162 '''udp_input_declaration_list : K_input IDENTIFIER '''
8163 print('udp_input_declaration_list_1', list(p
))
8164 # { list<perm_string>*tmp = new list<perm_string>;
8165 # tmp->push_back(lex_strings.make($2));
8170 def p_udp_input_declaration_list_2(p
):
8171 '''udp_input_declaration_list : udp_input_declaration_list ',' K_input IDENTIFIER '''
8172 print('udp_input_declaration_list_2', list(p
))
8173 # { list<perm_string>*tmp = $1;
8174 # tmp->push_back(lex_strings.make($4));
8179 def p_udp_primitive_1(p
):
8180 '''udp_primitive : K_primitive IDENTIFIER '(' udp_port_list ')' ';' udp_port_decls udp_init_opt udp_body K_endprimitive endlabel_opt '''
8181 print('udp_primitive_1', list(p
))
8182 # { perm_string tmp2 = lex_strings.make($2);
8183 # pform_make_udp(tmp2, $4, $7, $9, $8,
8184 # @2.text, @2.first_line);
8186 # if (strcmp($2,$11) != 0) {
8187 # yyerror(@11, "error: End label doesn't match "
8188 # "primitive name");
8190 # if (! gn_system_verilog()) {
8191 # yyerror(@11, "error: Primitive end labels "
8192 # "require SystemVerilog.");
8199 def p_udp_primitive_2(p
):
8200 '''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 '''
8201 print('udp_primitive_2', list(p
))
8202 # { perm_string tmp2 = lex_strings.make($2);
8203 # perm_string tmp6 = lex_strings.make($6);
8204 # pform_make_udp(tmp2, $5, tmp6, $7, $9, $12,
8205 # @2.text, @2.first_line);
8207 # if (strcmp($2,$14) != 0) {
8208 # yyerror(@14, "error: End label doesn't match "
8209 # "primitive name");
8211 # if (! gn_system_verilog()) {
8212 # yyerror(@14, "error: Primitive end labels "
8213 # "require SystemVerilog.");
8221 def p_K_packed_opt_1(p
):
8222 '''K_packed_opt : K_packed '''
8223 print('K_packed_opt', list(p
))
8226 def p_K_packed_opt_2(p
):
8227 '''K_packed_opt : '''
8228 print('K_packed_opt', list(p
))
8231 def p_K_reg_opt_1(p
):
8232 '''K_reg_opt : K_reg '''
8233 print('K_reg_opt', list(p
))
8236 def p_K_reg_opt_2(p
):
8238 print('K_reg_opt', list(p
))
8241 def p_K_static_opt_1(p
):
8242 '''K_static_opt : K_static '''
8243 print('K_static_opt', list(p
))
8246 def p_K_static_opt_2(p
):
8247 '''K_static_opt : '''
8248 print('K_static_opt', list(p
))
8252 def p_K_virtual_opt_1(p
):
8253 '''K_virtual_opt : K_virtual '''
8257 def p_K_virtual_opt_2(p
):
8258 '''K_virtual_opt : '''