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 num
= Leaf(token
.NUMBER
, "%s" % (p
[1]))
1353 # { $$ = $1; based_size = 0;}
1356 '''number : DEC_NUMBER BASED_NUMBER '''
1357 print('number_3', list(p
))
1358 num
= Leaf(token
.NUMBER
, "%s:%s" % (p
[1], p
[2]))
1360 # { $$ = pform_verinum_with_size($1,$2, @2.text, @2.first_line);
1364 '''number : UNBASED_NUMBER '''
1365 print('number_4', list(p
))
1366 # { $$ = $1; based_size = 0;}
1369 '''number : DEC_NUMBER UNBASED_NUMBER '''
1370 print('number_5', list(p
))
1371 # { yyerror(@1, "error: Unbased SystemVerilog literal cannot have "
1373 # $$ = $1; based_size = 0;}
1375 def p_open_range_list_1(p
):
1376 '''open_range_list : open_range_list ',' value_range '''
1377 print('open_range_list_1', list(p
))
1379 def p_open_range_list_2(p
):
1380 '''open_range_list : value_range '''
1381 print('open_range_list_2', list(p
))
1383 def p_package_declaration_1(p
):
1384 '''package_declaration : K_package lifetime_opt IDENTIFIER ';' _embed0_package_declaration timeunits_declaration_opt _embed1_package_declaration package_item_list_opt K_endpackage endlabel_opt '''
1385 print('package_declaration_1', list(p
))
1386 # { pform_end_package_declaration(@1);
1387 # // If an end label is present make sure it match the package name.
1389 # if (strcmp($3,$10) != 0) {
1390 # yyerror(@10, "error: End label doesn't match package name");
1397 def p__embed0_package_declaration(p
):
1398 '''_embed0_package_declaration : '''
1399 # { pform_start_package_declaration(@1, $3, $2); }
1401 def p__embed1_package_declaration(p
):
1402 '''_embed1_package_declaration : '''
1403 # { pform_set_scope_timescale(@1); }
1405 def p_module_package_import_list_opt_1(p
):
1406 '''module_package_import_list_opt : '''
1407 print('module_package_import_list_opt_1', list(p
))
1409 def p_module_package_import_list_opt_2(p
):
1410 '''module_package_import_list_opt : package_import_list '''
1411 print('module_package_import_list_opt_2', list(p
))
1413 def p_package_import_list_1(p
):
1414 '''package_import_list : package_import_declaration '''
1415 print('package_import_list_1', list(p
))
1417 def p_package_import_list_2(p
):
1418 '''package_import_list : package_import_list package_import_declaration '''
1419 print('package_import_list_2', list(p
))
1421 def p_package_import_declaration_1(p
):
1422 '''package_import_declaration : K_import package_import_item_list ';' '''
1423 print('package_import_declaration_1', list(p
))
1426 def p_package_import_item_1(p
):
1427 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '''
1428 print('package_import_item_1', list(p
))
1429 # { pform_package_import(@2, $1, $3);
1433 def p_package_import_item_2(p
):
1434 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES '*' '''
1435 print('package_import_item_2', list(p
))
1436 # { pform_package_import(@2, $1, 0);
1439 def p_package_import_item_list_1(p
):
1440 '''package_import_item_list : package_import_item_list ',' package_import_item '''
1441 print('package_import_item_list_1', list(p
))
1443 def p_package_import_item_list_2(p
):
1444 '''package_import_item_list : package_import_item '''
1445 print('package_import_item_list_2', list(p
))
1447 def p_package_item_1(p
):
1448 '''package_item : timeunits_declaration '''
1449 print('package_item_1', list(p
))
1451 def p_package_item_2(p
):
1452 '''package_item : K_parameter param_type parameter_assign_list ';' '''
1453 print('package_item_2', list(p
))
1455 def p_package_item_3(p
):
1456 '''package_item : K_localparam param_type localparam_assign_list ';' '''
1457 print('package_item_3', list(p
))
1459 def p_package_item_4(p
):
1460 '''package_item : type_declaration '''
1461 print('package_item_4', list(p
))
1463 def p_package_item_5(p
):
1464 '''package_item : function_declaration '''
1465 print('package_item_5', list(p
))
1467 def p_package_item_6(p
):
1468 '''package_item : task_declaration '''
1469 print('package_item_6', list(p
))
1471 def p_package_item_7(p
):
1472 '''package_item : data_declaration '''
1473 print('package_item_7', list(p
))
1475 def p_package_item_8(p
):
1476 '''package_item : class_declaration '''
1477 print('package_item_8', list(p
))
1479 def p_package_item_list_1(p
):
1480 '''package_item_list : package_item_list package_item '''
1481 print('package_item_list_1', list(p
))
1483 def p_package_item_list_2(p
):
1484 '''package_item_list : package_item '''
1485 print('package_item_list_2', list(p
))
1487 def p_package_item_list_opt_1(p
):
1488 '''package_item_list_opt : package_item_list '''
1489 print('package_item_list_opt_1', list(p
))
1491 def p_package_item_list_opt_2(p
):
1492 '''package_item_list_opt : '''
1493 print('package_item_list_opt_2', list(p
))
1495 def p_port_direction_1(p
):
1496 '''port_direction : K_input '''
1497 print('port_direction_1', list(p
))
1498 # { $$ = NetNet::PINPUT; }
1500 def p_port_direction_2(p
):
1501 '''port_direction : K_output '''
1502 print('port_direction_2', list(p
))
1503 # { $$ = NetNet::POUTPUT; }
1505 def p_port_direction_3(p
):
1506 '''port_direction : K_inout '''
1507 print('port_direction_3', list(p
))
1508 # { $$ = NetNet::PINOUT; }
1510 def p_port_direction_4(p
):
1511 '''port_direction : K_ref '''
1512 print('port_direction_4', list(p
))
1513 # { $$ = NetNet::PREF;
1514 # if (!gn_system_verilog()) {
1515 # yyerror(@1, "error: Reference ports (ref) require SystemVerilog.");
1516 # $$ = NetNet::PINPUT;
1520 def p_port_direction_opt_1(p
):
1521 '''port_direction_opt : port_direction '''
1522 print('port_direction_opt_1', list(p
))
1525 def p_port_direction_opt_2(p
):
1526 '''port_direction_opt : '''
1527 print('port_direction_opt_2', list(p
))
1528 # { $$ = NetNet::PIMPLICIT; }
1530 def p_property_expr_1(p
):
1531 '''property_expr : expression '''
1532 print('property_expr_1', list(p
))
1534 def p_procedural_assertion_statement_1(p
):
1535 '''procedural_assertion_statement : K_assert '(' expression ')' statement %prec less_than_K_else '''
1536 print('procedural_assertion_statement_1', list(p
))
1537 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1541 def p_procedural_assertion_statement_2(p
):
1542 '''procedural_assertion_statement : K_assert '(' expression ')' K_else statement '''
1543 print('procedural_assertion_statement_2', list(p
))
1544 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1548 def p_procedural_assertion_statement_3(p
):
1549 '''procedural_assertion_statement : K_assert '(' expression ')' statement K_else statement '''
1550 print('procedural_assertion_statement_3', list(p
))
1551 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1555 def p_property_qualifier_1(p
):
1556 '''property_qualifier : class_item_qualifier '''
1557 print('property_qualifier_1', list(p
))
1559 def p_property_qualifier_2(p
):
1560 '''property_qualifier : random_qualifier '''
1561 print('property_qualifier_2', list(p
))
1563 def p_property_qualifier_opt_1(p
):
1564 '''property_qualifier_opt : property_qualifier_list '''
1565 print('property_qualifier_opt_1', list(p
))
1568 def p_property_qualifier_opt_2(p
):
1569 '''property_qualifier_opt : '''
1570 print('property_qualifier_opt_2', list(p
))
1571 # { $$ = property_qualifier_t::make_none(); }
1573 def p_property_qualifier_list_1(p
):
1574 '''property_qualifier_list : property_qualifier_list property_qualifier '''
1575 print('property_qualifier_list_1', list(p
))
1578 def p_property_qualifier_list_2(p
):
1579 '''property_qualifier_list : property_qualifier '''
1580 print('property_qualifier_list_2', list(p
))
1583 def p_property_spec_1(p
):
1584 '''property_spec : clocking_event_opt property_spec_disable_iff_opt property_expr '''
1585 print('property_spec_1', list(p
))
1587 def p_property_spec_disable_iff_opt_1(p
):
1588 '''property_spec_disable_iff_opt : K_disable K_iff '(' expression ')' '''
1589 print('property_spec_disable_iff_opt_1', list(p
))
1591 def p_property_spec_disable_iff_opt_2(p
):
1592 '''property_spec_disable_iff_opt : '''
1593 print('property_spec_disable_iff_opt_2', list(p
))
1595 def p_random_qualifier_1(p
):
1596 '''random_qualifier : K_rand '''
1597 print('random_qualifier_1', list(p
))
1598 # { $$ = property_qualifier_t::make_rand(); }
1600 def p_random_qualifier_2(p
):
1601 '''random_qualifier : K_randc '''
1602 print('random_qualifier_2', list(p
))
1603 # { $$ = property_qualifier_t::make_randc(); }
1605 def p_real_or_realtime_1(p
):
1606 '''real_or_realtime : K_real '''
1607 print('real_or_realtime_1', list(p
))
1609 def p_real_or_realtime_2(p
):
1610 '''real_or_realtime : K_realtime '''
1611 print('real_or_realtime_2', list(p
))
1614 '''signing : K_signed '''
1615 print('signing_1', list(p
))
1619 '''signing : K_unsigned '''
1620 print('signing_2', list(p
))
1623 def p_simple_type_or_string_1(p
):
1624 '''simple_type_or_string : integer_vector_type '''
1625 print('simple_type_or_string_1', list(p
))
1626 # { ivl_variable_type_t use_vtype = $1;
1627 # bool reg_flag = false;
1628 # if (use_vtype == IVL_VT_NO_TYPE) {
1629 # use_vtype = IVL_VT_LOGIC;
1632 # vector_type_t*tmp = new vector_type_t(use_vtype, false, 0);
1633 # tmp->reg_flag = reg_flag;
1634 # FILE_NAME(tmp, @1);
1638 def p_simple_type_or_string_2(p
):
1639 '''simple_type_or_string : non_integer_type '''
1640 print('simple_type_or_string_2', list(p
))
1641 # { real_type_t*tmp = new real_type_t($1);
1642 # FILE_NAME(tmp, @1);
1646 def p_simple_type_or_string_3(p
):
1647 '''simple_type_or_string : atom2_type '''
1648 print('simple_type_or_string_3', list(p
))
1649 # { atom2_type_t*tmp = new atom2_type_t($1, true);
1650 # FILE_NAME(tmp, @1);
1654 def p_simple_type_or_string_4(p
):
1655 '''simple_type_or_string : K_integer '''
1656 print('simple_type_or_string_4', list(p
))
1657 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
1658 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd);
1659 # tmp->reg_flag = true;
1660 # tmp->integer_flag = true;
1664 def p_simple_type_or_string_5(p
):
1665 '''simple_type_or_string : K_time '''
1666 print('simple_type_or_string_5', list(p
))
1667 # { list<pform_range_t>*pd = make_range_from_width(64);
1668 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
1669 # tmp->reg_flag = !gn_system_verilog();
1673 def p_simple_type_or_string_6(p
):
1674 '''simple_type_or_string : TYPE_IDENTIFIER '''
1675 print('simple_type_or_string_6', list(p
))
1680 def p_simple_type_or_string_7(p
):
1681 '''simple_type_or_string : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_simple_type_or_string TYPE_IDENTIFIER '''
1682 print('simple_type_or_string_7', list(p
))
1683 # { lex_in_package_scope(0);
1688 def p_simple_type_or_string_8(p
):
1689 '''simple_type_or_string : K_string '''
1690 print('simple_type_or_string_8', list(p
))
1691 # { string_type_t*tmp = new string_type_t;
1692 # FILE_NAME(tmp, @1);
1696 def p__embed0_simple_type_or_string(p
):
1697 '''_embed0_simple_type_or_string : '''
1698 # { lex_in_package_scope($1); }
1700 def p_statement_1(p
):
1701 '''statement : attribute_list_opt statement_item '''
1702 print('statement_1', list(p
))
1703 # { pform_bind_attributes($2->attributes, $1);
1707 def p_statement_or_null_1(p
):
1708 '''statement_or_null : statement '''
1709 print('statement_or_null_1', list(p
))
1712 def p_statement_or_null_2(p
):
1713 '''statement_or_null : attribute_list_opt ';' '''
1714 print('statement_or_null_2', list(p
))
1717 def p_stream_expression_1(p
):
1718 '''stream_expression : expression '''
1719 print('stream_expression_1', list(p
))
1721 def p_stream_expression_list_1(p
):
1722 '''stream_expression_list : stream_expression_list ',' stream_expression '''
1723 print('stream_expression_list_1', list(p
))
1725 def p_stream_expression_list_2(p
):
1726 '''stream_expression_list : stream_expression '''
1727 print('stream_expression_list_2', list(p
))
1729 def p_stream_operator_1(p
):
1730 '''stream_operator : K_LS '''
1731 print('stream_operator_1', list(p
))
1733 def p_stream_operator_2(p
):
1734 '''stream_operator : K_RS '''
1735 print('stream_operator_2', list(p
))
1737 def p_streaming_concatenation_1(p
):
1738 '''streaming_concatenation : '{' stream_operator '{' stream_expression_list '}' '}' '''
1739 print('streaming_concatenation_1', list(p
))
1740 # { /* streaming concatenation is a SystemVerilog thing. */
1741 # if (gn_system_verilog()) {
1742 # yyerror(@2, "sorry: Streaming concatenation not supported.");
1745 # yyerror(@2, "error: Streaming concatenation requires SystemVerilog");
1750 def p_task_declaration_1(p
):
1751 '''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 '''
1752 print('task_declaration_1', list(p
))
1753 # { // Last step: check any closing name. This is done late so
1754 # // that the parser can look ahead to detect the present
1755 # // endlabel_opt but still have the pform_endmodule() called
1756 # // early enough that the lexor can know we are outside the
1759 # if (strcmp($3,$10) != 0) {
1760 # yyerror(@10, "error: End label doesn't match task name");
1762 # if (! gn_system_verilog()) {
1763 # yyerror(@10, "error: Task end labels require "
1764 # "SystemVerilog.");
1771 def p_task_declaration_2(p
):
1772 '''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 '''
1773 print('task_declaration_2', list(p
))
1774 # { // Last step: check any closing name. This is done late so
1775 # // that the parser can look ahead to detect the present
1776 # // endlabel_opt but still have the pform_endmodule() called
1777 # // early enough that the lexor can know we are outside the
1780 # if (strcmp($3,$13) != 0) {
1781 # yyerror(@13, "error: End label doesn't match task name");
1783 # if (! gn_system_verilog()) {
1784 # yyerror(@13, "error: Task end labels require "
1785 # "SystemVerilog.");
1792 def p_task_declaration_3(p
):
1793 '''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 '''
1794 print('task_declaration_3', list(p
))
1795 # { // Last step: check any closing name. This is done late so
1796 # // that the parser can look ahead to detect the present
1797 # // endlabel_opt but still have the pform_endmodule() called
1798 # // early enough that the lexor can know we are outside the
1801 # if (strcmp($3,$12) != 0) {
1802 # yyerror(@12, "error: End label doesn't match task name");
1804 # if (! gn_system_verilog()) {
1805 # yyerror(@12, "error: Task end labels require "
1806 # "SystemVerilog.");
1813 def p_task_declaration_4(p
):
1814 '''task_declaration : K_task lifetime_opt IDENTIFIER error K_endtask _embed6_task_declaration endlabel_opt '''
1815 print('task_declaration_4', list(p
))
1816 # { // Last step: check any closing name. This is done late so
1817 # // that the parser can look ahead to detect the present
1818 # // endlabel_opt but still have the pform_endmodule() called
1819 # // early enough that the lexor can know we are outside the
1822 # if (strcmp($3,$7) != 0) {
1823 # yyerror(@7, "error: End label doesn't match task name");
1825 # if (! gn_system_verilog()) {
1826 # yyerror(@7, "error: Task end labels require "
1827 # "SystemVerilog.");
1834 def p__embed0_task_declaration(p
):
1835 '''_embed0_task_declaration : '''
1836 # { assert(current_task == 0);
1837 # current_task = pform_push_task_scope(@1, $3, $2);
1840 def p__embed1_task_declaration(p
):
1841 '''_embed1_task_declaration : '''
1842 # { current_task->set_ports($6);
1843 # current_task_set_statement(@3, $7);
1844 # pform_set_this_class(@3, current_task);
1845 # pform_pop_scope();
1847 # if ($7 && $7->size() > 1 && !gn_system_verilog()) {
1848 # yyerror(@7, "error: Task body with multiple statements requires SystemVerilog.");
1853 def p__embed2_task_declaration(p
):
1854 '''_embed2_task_declaration : '''
1855 # { assert(current_task == 0);
1856 # current_task = pform_push_task_scope(@1, $3, $2);
1859 def p__embed3_task_declaration(p
):
1860 '''_embed3_task_declaration : '''
1861 # { current_task->set_ports($6);
1862 # current_task_set_statement(@3, $10);
1863 # pform_set_this_class(@3, current_task);
1864 # pform_pop_scope();
1866 # if ($10) delete $10;
1869 def p__embed4_task_declaration(p
):
1870 '''_embed4_task_declaration : '''
1871 # { assert(current_task == 0);
1872 # current_task = pform_push_task_scope(@1, $3, $2);
1875 def p__embed5_task_declaration(p
):
1876 '''_embed5_task_declaration : '''
1877 # { current_task->set_ports(0);
1878 # current_task_set_statement(@3, $9);
1879 # pform_set_this_class(@3, current_task);
1880 # if (! current_task->method_of()) {
1881 # cerr << @3 << ": warning: task definition for \"" << $3
1882 # << "\" has an empty port declaration list!" << endl;
1884 # pform_pop_scope();
1886 # if ($9->size() > 1 && !gn_system_verilog()) {
1887 # yyerror(@9, "error: Task body with multiple statements requires SystemVerilog.");
1892 def p__embed6_task_declaration(p
):
1893 '''_embed6_task_declaration : '''
1895 # if (current_task) {
1896 # pform_pop_scope();
1901 def p_tf_port_declaration_1(p
):
1902 '''tf_port_declaration : port_direction K_reg_opt unsigned_signed_opt dimensions_opt list_of_identifiers ';' '''
1903 print('tf_port_declaration_1', list(p
))
1904 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1,
1905 # $2 ? IVL_VT_LOGIC :
1911 def p_tf_port_declaration_2(p
):
1912 '''tf_port_declaration : port_direction K_integer list_of_identifiers ';' '''
1913 print('tf_port_declaration_2', list(p
))
1914 # { list<pform_range_t>*range_stub = make_range_from_width(integer_width);
1915 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_LOGIC, true,
1916 # range_stub, $3, true);
1920 def p_tf_port_declaration_3(p
):
1921 '''tf_port_declaration : port_direction K_time list_of_identifiers ';' '''
1922 print('tf_port_declaration_3', list(p
))
1923 # { list<pform_range_t>*range_stub = make_range_from_width(64);
1924 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_LOGIC, false,
1929 def p_tf_port_declaration_4(p
):
1930 '''tf_port_declaration : port_direction real_or_realtime list_of_identifiers ';' '''
1931 print('tf_port_declaration_4', list(p
))
1932 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_REAL, true,
1937 def p_tf_port_declaration_5(p
):
1938 '''tf_port_declaration : port_direction K_string list_of_identifiers ';' '''
1939 print('tf_port_declaration_5', list(p
))
1940 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_STRING, true,
1945 def p_tf_port_item_1(p
):
1946 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER dimensions_opt tf_port_item_expr_opt '''
1947 print('tf_port_item_1', list(p
))
1948 # { vector<pform_tf_port_t>*tmp;
1949 # NetNet::PortType use_port_type = $1;
1950 # if ((use_port_type == NetNet::PIMPLICIT) && (gn_system_verilog() || ($2 == 0)))
1951 # use_port_type = port_declaration_context.port_type;
1952 # perm_string name = lex_strings.make($3);
1953 # list<perm_string>* ilist = list_from_identifier($3);
1955 # if (use_port_type == NetNet::PIMPLICIT) {
1956 # yyerror(@1, "error: missing task/function port direction.");
1957 # use_port_type = NetNet::PINPUT; // for error recovery
1959 # if (($2 == 0) && ($1==NetNet::PIMPLICIT)) {
1960 # // Detect special case this is an undecorated
1961 # // identifier and we need to get the declaration from
1964 # yyerror(@4, "internal error: How can there be an unpacked range here?\n");
1966 # tmp = pform_make_task_ports(@3, use_port_type,
1967 # port_declaration_context.data_type,
1971 # // Otherwise, the decorations for this identifier
1972 # // indicate the type. Save the type for any right
1973 # // context that may come later.
1974 # port_declaration_context.port_type = use_port_type;
1976 # $2 = new vector_type_t(IVL_VT_LOGIC, false, 0);
1977 # FILE_NAME($2, @3);
1979 # port_declaration_context.data_type = $2;
1980 # tmp = pform_make_task_ports(@3, use_port_type, $2, ilist);
1983 # pform_set_reg_idx(name, $4);
1988 # assert(tmp->size()==1);
1989 # tmp->front().defe = $5;
1993 def p_tf_port_item_2(p
):
1994 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER error '''
1995 print('tf_port_item_2', list(p
))
1996 # { yyerror(@3, "error: Error in task/function port item after port name %s.", $3);
2001 def p_tf_port_item_expr_opt_1(p
):
2002 '''tf_port_item_expr_opt : '=' expression '''
2003 print('tf_port_item_expr_opt_1', list(p
))
2004 # { if (! gn_system_verilog()) {
2005 # yyerror(@1, "error: Task/function default arguments require "
2006 # "SystemVerilog.");
2011 def p_tf_port_item_expr_opt_2(p
):
2012 '''tf_port_item_expr_opt : '''
2013 print('tf_port_item_expr_opt_2', list(p
))
2016 def p_tf_port_list_1(p
):
2017 '''tf_port_list : _embed0_tf_port_list tf_port_item_list '''
2018 print('tf_port_list_1', list(p
))
2021 def p__embed0_tf_port_list(p
):
2022 '''_embed0_tf_port_list : '''
2023 # { port_declaration_context.port_type = gn_system_verilog() ? NetNet::PINPUT : NetNet::PIMPLICIT;
2024 # port_declaration_context.data_type = 0;
2027 def p_tf_port_item_list_1(p
):
2028 '''tf_port_item_list : tf_port_item_list ',' tf_port_item '''
2029 print('tf_port_item_list_1', list(p
))
2030 # { vector<pform_tf_port_t>*tmp;
2032 # size_t s1 = $1->size();
2034 # tmp->resize(tmp->size()+$3->size());
2035 # for (size_t idx = 0 ; idx < $3->size() ; idx += 1)
2036 # tmp->at(s1+idx) = $3->at(idx);
2046 def p_tf_port_item_list_2(p
):
2047 '''tf_port_item_list : tf_port_item '''
2048 print('tf_port_item_list_2', list(p
))
2051 def p_tf_port_item_list_3(p
):
2052 '''tf_port_item_list : error ',' tf_port_item '''
2053 print('tf_port_item_list_3', list(p
))
2054 # { yyerror(@2, "error: Syntax error in task/function port declaration.");
2058 def p_tf_port_item_list_4(p
):
2059 '''tf_port_item_list : tf_port_item_list ',' '''
2060 print('tf_port_item_list_4', list(p
))
2061 # { yyerror(@2, "error: NULL port declarations are not allowed.");
2065 def p_tf_port_item_list_5(p
):
2066 '''tf_port_item_list : tf_port_item_list ';' '''
2067 print('tf_port_item_list_5', list(p
))
2068 # { yyerror(@2, "error: ';' is an invalid port declaration separator.");
2072 def p_timeunits_declaration_1(p
):
2073 '''timeunits_declaration : K_timeunit TIME_LITERAL ';' '''
2074 print('timeunits_declaration_1', list(p
))
2075 # { pform_set_timeunit($2, allow_timeunit_decl); }
2077 def p_timeunits_declaration_2(p
):
2078 '''timeunits_declaration : K_timeunit TIME_LITERAL '/' TIME_LITERAL ';' '''
2079 print('timeunits_declaration_2', list(p
))
2080 # { bool initial_decl = allow_timeunit_decl && allow_timeprec_decl;
2081 # pform_set_timeunit($2, initial_decl);
2082 # pform_set_timeprec($4, initial_decl);
2085 def p_timeunits_declaration_3(p
):
2086 '''timeunits_declaration : K_timeprecision TIME_LITERAL ';' '''
2087 print('timeunits_declaration_3', list(p
))
2088 # { pform_set_timeprec($2, allow_timeprec_decl); }
2090 def p_timeunits_declaration_opt_1(p
):
2091 '''timeunits_declaration_opt : %prec no_timeunits_declaration '''
2092 print('timeunits_declaration_opt_1', list(p
))
2094 def p_timeunits_declaration_opt_2(p
):
2095 '''timeunits_declaration_opt : timeunits_declaration %prec one_timeunits_declaration '''
2096 print('timeunits_declaration_opt_2', list(p
))
2098 def p_timeunits_declaration_opt_3(p
):
2099 '''timeunits_declaration_opt : timeunits_declaration timeunits_declaration '''
2100 print('timeunits_declaration_opt_3', list(p
))
2102 def p_value_range_1(p
):
2103 '''value_range : expression '''
2104 print('value_range_1', list(p
))
2107 def p_value_range_2(p
):
2108 '''value_range : '[' expression ':' expression ']' '''
2109 print('value_range_2', list(p
))
2112 def p_variable_dimension_1(p
):
2113 '''variable_dimension : '[' expression ':' expression ']' '''
2114 print('variable_dimension_1', list(p
))
2115 # { list<pform_range_t> *tmp = new list<pform_range_t>;
2116 # pform_range_t index ($2,$4);
2117 # tmp->push_back(index);
2121 def p_variable_dimension_2(p
):
2122 '''variable_dimension : '[' expression ']' '''
2123 print('variable_dimension_2', list(p
))
2124 # { // SystemVerilog canonical range
2125 # if (!gn_system_verilog()) {
2127 # cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. "
2128 # << "Use at least -g2005-sv to remove this warning." << endl;
2130 # list<pform_range_t> *tmp = new list<pform_range_t>;
2131 # pform_range_t index;
2132 # index.first = new PENumber(new verinum((uint64_t)0, integer_width));
2133 # index.second = new PEBinary('-', $2, new PENumber(new verinum((uint64_t)1, integer_width)));
2134 # tmp->push_back(index);
2138 def p_variable_dimension_3(p
):
2139 '''variable_dimension : '[' ']' '''
2140 print('variable_dimension_3', list(p
))
2141 # { list<pform_range_t> *tmp = new list<pform_range_t>;
2142 # pform_range_t index (0,0);
2143 # tmp->push_back(index);
2147 def p_variable_dimension_4(p
):
2148 '''variable_dimension : '[' '$' ']' '''
2149 print('variable_dimension_4', list(p
))
2150 # { // SystemVerilog queue
2151 # list<pform_range_t> *tmp = new list<pform_range_t>;
2152 # pform_range_t index (new PENull,0);
2153 # if (!gn_system_verilog()) {
2154 # yyerror("error: Queue declarations require SystemVerilog.");
2156 # tmp->push_back(index);
2160 def p_variable_lifetime_1(p
):
2161 '''variable_lifetime : lifetime '''
2162 print('variable_lifetime_1', list(p
))
2163 # { if (!gn_system_verilog()) {
2164 # yyerror(@1, "error: overriding the default variable lifetime "
2165 # "requires SystemVerilog.");
2166 # } else if ($1 != pform_peek_scope()->default_lifetime) {
2167 # yyerror(@1, "sorry: overriding the default variable lifetime "
2168 # "is not yet supported.");
2170 # var_lifetime = $1;
2173 def p_attribute_list_opt_1(p
):
2174 '''attribute_list_opt : attribute_instance_list '''
2175 print('attribute_list_opt_1', list(p
))
2178 def p_attribute_list_opt_2(p
):
2179 '''attribute_list_opt : '''
2180 print('attribute_list_opt_2', list(p
))
2183 def p_attribute_instance_list_1(p
):
2184 '''attribute_instance_list : K_PSTAR K_STARP '''
2185 print('attribute_instance_list_1', list(p
))
2188 def p_attribute_instance_list_2(p
):
2189 '''attribute_instance_list : K_PSTAR attribute_list K_STARP '''
2190 print('attribute_instance_list_2', list(p
))
2193 def p_attribute_instance_list_3(p
):
2194 '''attribute_instance_list : attribute_instance_list K_PSTAR K_STARP '''
2195 print('attribute_instance_list_3', list(p
))
2198 def p_attribute_instance_list_4(p
):
2199 '''attribute_instance_list : attribute_instance_list K_PSTAR attribute_list K_STARP '''
2200 print('attribute_instance_list_4', list(p
))
2201 # { list<named_pexpr_t>*tmp = $1;
2203 # tmp->splice(tmp->end(), *$3);
2209 def p_attribute_list_1(p
):
2210 '''attribute_list : attribute_list ',' attribute '''
2211 print('attribute_list_1', list(p
))
2212 # { list<named_pexpr_t>*tmp = $1;
2213 # tmp->push_back(*$3);
2218 def p_attribute_list_2(p
):
2219 '''attribute_list : attribute '''
2220 print('attribute_list_2', list(p
))
2221 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
2222 # tmp->push_back(*$1);
2227 def p_attribute_1(p
):
2228 '''attribute : IDENTIFIER '''
2229 print('attribute_1', list(p
))
2230 # { named_pexpr_t*tmp = new named_pexpr_t;
2231 # tmp->name = lex_strings.make($1);
2237 def p_attribute_2(p
):
2238 '''attribute : IDENTIFIER '=' expression '''
2239 print('attribute_2', list(p
))
2241 # named_pexpr_t*tmp2 = new named_pexpr_t;
2242 # tmp2->name = lex_strings.make($1);
2248 def p_block_item_decl_1(p
):
2249 '''block_item_decl : data_type register_variable_list ';' '''
2250 print('block_item_decl_1', list(p
))
2251 # { if ($1) pform_set_data_type(@1, $1, $2, NetNet::REG, attributes_in_context);
2254 def p_block_item_decl_2(p
):
2255 '''block_item_decl : variable_lifetime data_type register_variable_list ';' '''
2256 print('block_item_decl_2', list(p
))
2257 # { if ($2) pform_set_data_type(@2, $2, $3, NetNet::REG, attributes_in_context);
2258 # var_lifetime = LexicalScope::INHERITED;
2261 def p_block_item_decl_3(p
):
2262 '''block_item_decl : K_reg data_type register_variable_list ';' '''
2263 print('block_item_decl_3', list(p
))
2264 # { if ($2) pform_set_data_type(@2, $2, $3, NetNet::REG, attributes_in_context);
2267 def p_block_item_decl_4(p
):
2268 '''block_item_decl : variable_lifetime K_reg data_type register_variable_list ';' '''
2269 print('block_item_decl_4', list(p
))
2270 # { if ($3) pform_set_data_type(@3, $3, $4, NetNet::REG, attributes_in_context);
2271 # var_lifetime = LexicalScope::INHERITED;
2274 def p_block_item_decl_5(p
):
2275 '''block_item_decl : K_event event_variable_list ';' '''
2276 print('block_item_decl_5', list(p
))
2277 # { if ($2) pform_make_events($2, @1.text, @1.first_line);
2280 def p_block_item_decl_6(p
):
2281 '''block_item_decl : K_parameter param_type parameter_assign_list ';' '''
2282 print('block_item_decl_6', list(p
))
2284 def p_block_item_decl_7(p
):
2285 '''block_item_decl : K_localparam param_type localparam_assign_list ';' '''
2286 print('block_item_decl_7', list(p
))
2288 def p_block_item_decl_8(p
):
2289 '''block_item_decl : type_declaration '''
2290 print('block_item_decl_8', list(p
))
2292 def p_block_item_decl_9(p
):
2293 '''block_item_decl : K_integer error ';' '''
2294 print('block_item_decl_9', list(p
))
2295 # { yyerror(@1, "error: syntax error in integer variable list.");
2299 def p_block_item_decl_10(p
):
2300 '''block_item_decl : K_time error ';' '''
2301 print('block_item_decl_10', list(p
))
2302 # { yyerror(@1, "error: syntax error in time variable list.");
2306 def p_block_item_decl_11(p
):
2307 '''block_item_decl : K_parameter error ';' '''
2308 print('block_item_decl_11', list(p
))
2309 # { yyerror(@1, "error: syntax error in parameter list.");
2313 def p_block_item_decl_12(p
):
2314 '''block_item_decl : K_localparam error ';' '''
2315 print('block_item_decl_12', list(p
))
2316 # { yyerror(@1, "error: syntax error localparam list.");
2320 def p_block_item_decls_1(p
):
2321 '''block_item_decls : block_item_decl '''
2322 print('block_item_decls_1', list(p
))
2324 def p_block_item_decls_2(p
):
2325 '''block_item_decls : block_item_decls block_item_decl '''
2326 print('block_item_decls_2', list(p
))
2328 def p_block_item_decls_opt_1(p
):
2329 '''block_item_decls_opt : block_item_decls '''
2330 print('block_item_decls_opt_1', list(p
))
2333 def p_block_item_decls_opt_2(p
):
2334 '''block_item_decls_opt : '''
2335 print('block_item_decls_opt_2', list(p
))
2338 def p_type_declaration_1(p
):
2339 '''type_declaration : K_typedef data_type IDENTIFIER dimensions_opt ';' '''
2340 print('type_declaration_1', list(p
))
2341 # { perm_string name = lex_strings.make($3);
2342 # pform_set_typedef(name, $2, $4);
2346 def p_type_declaration_2(p
):
2347 '''type_declaration : K_typedef data_type TYPE_IDENTIFIER ';' '''
2348 print('type_declaration_2', list(p
))
2349 # { perm_string name = lex_strings.make($3.text);
2350 # if (pform_test_type_identifier_local(name)) {
2351 # yyerror(@3, "error: Typedef identifier \"%s\" is already a type name.", $3.text);
2354 # pform_set_typedef(name, $2, NULL);
2359 def p_type_declaration_3(p
):
2360 '''type_declaration : K_typedef K_class IDENTIFIER ';' '''
2361 print('type_declaration_3', list(p
))
2362 # { // Create a synthetic typedef for the class name so that the
2363 # // lexor detects the name as a type.
2364 # perm_string name = lex_strings.make($3);
2365 # class_type_t*tmp = new class_type_t(name);
2366 # FILE_NAME(tmp, @3);
2367 # pform_set_typedef(name, tmp, NULL);
2371 def p_type_declaration_4(p
):
2372 '''type_declaration : K_typedef K_enum IDENTIFIER ';' '''
2373 print('type_declaration_4', list(p
))
2374 # { yyerror(@1, "sorry: Enum forward declarations not supported yet."); }
2376 def p_type_declaration_5(p
):
2377 '''type_declaration : K_typedef K_struct IDENTIFIER ';' '''
2378 print('type_declaration_5', list(p
))
2379 # { yyerror(@1, "sorry: Struct forward declarations not supported yet."); }
2381 def p_type_declaration_6(p
):
2382 '''type_declaration : K_typedef K_union IDENTIFIER ';' '''
2383 print('type_declaration_6', list(p
))
2384 # { yyerror(@1, "sorry: Union forward declarations not supported yet."); }
2386 def p_type_declaration_7(p
):
2387 '''type_declaration : K_typedef IDENTIFIER ';' '''
2388 print('type_declaration_7', list(p
))
2389 # { // Create a synthetic typedef for the class name so that the
2390 # // lexor detects the name as a type.
2391 # perm_string name = lex_strings.make($2);
2392 # class_type_t*tmp = new class_type_t(name);
2393 # FILE_NAME(tmp, @2);
2394 # pform_set_typedef(name, tmp, NULL);
2398 def p_type_declaration_8(p
):
2399 '''type_declaration : K_typedef error ';' '''
2400 print('type_declaration_8', list(p
))
2401 # { yyerror(@2, "error: Syntax error in typedef clause.");
2405 def p_enum_data_type_1(p
):
2406 '''enum_data_type : K_enum '{' enum_name_list '}' '''
2407 print('enum_data_type_1', list(p
))
2408 # { enum_type_t*enum_type = new enum_type_t;
2409 # FILE_NAME(enum_type, @1);
2410 # enum_type->names .reset($3);
2411 # enum_type->base_type = IVL_VT_BOOL;
2412 # enum_type->signed_flag = true;
2413 # enum_type->integer_flag = false;
2414 # enum_type->range.reset(make_range_from_width(32));
2418 def p_enum_data_type_2(p
):
2419 '''enum_data_type : K_enum atom2_type signed_unsigned_opt '{' enum_name_list '}' '''
2420 print('enum_data_type_2', list(p
))
2421 # { enum_type_t*enum_type = new enum_type_t;
2422 # FILE_NAME(enum_type, @1);
2423 # enum_type->names .reset($5);
2424 # enum_type->base_type = IVL_VT_BOOL;
2425 # enum_type->signed_flag = $3;
2426 # enum_type->integer_flag = false;
2427 # enum_type->range.reset(make_range_from_width($2));
2431 def p_enum_data_type_3(p
):
2432 '''enum_data_type : K_enum K_integer signed_unsigned_opt '{' enum_name_list '}' '''
2433 print('enum_data_type_3', list(p
))
2434 # { enum_type_t*enum_type = new enum_type_t;
2435 # FILE_NAME(enum_type, @1);
2436 # enum_type->names .reset($5);
2437 # enum_type->base_type = IVL_VT_LOGIC;
2438 # enum_type->signed_flag = $3;
2439 # enum_type->integer_flag = true;
2440 # enum_type->range.reset(make_range_from_width(integer_width));
2444 def p_enum_data_type_4(p
):
2445 '''enum_data_type : K_enum K_logic unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2446 print('enum_data_type_4', list(p
))
2447 # { enum_type_t*enum_type = new enum_type_t;
2448 # FILE_NAME(enum_type, @1);
2449 # enum_type->names .reset($6);
2450 # enum_type->base_type = IVL_VT_LOGIC;
2451 # enum_type->signed_flag = $3;
2452 # enum_type->integer_flag = false;
2453 # enum_type->range.reset($4 ? $4 : make_range_from_width(1));
2457 def p_enum_data_type_5(p
):
2458 '''enum_data_type : K_enum K_reg unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2459 print('enum_data_type_5', list(p
))
2460 # { enum_type_t*enum_type = new enum_type_t;
2461 # FILE_NAME(enum_type, @1);
2462 # enum_type->names .reset($6);
2463 # enum_type->base_type = IVL_VT_LOGIC;
2464 # enum_type->signed_flag = $3;
2465 # enum_type->integer_flag = false;
2466 # enum_type->range.reset($4 ? $4 : make_range_from_width(1));
2470 def p_enum_data_type_6(p
):
2471 '''enum_data_type : K_enum K_bit unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2472 print('enum_data_type_6', list(p
))
2473 # { enum_type_t*enum_type = new enum_type_t;
2474 # FILE_NAME(enum_type, @1);
2475 # enum_type->names .reset($6);
2476 # enum_type->base_type = IVL_VT_BOOL;
2477 # enum_type->signed_flag = $3;
2478 # enum_type->integer_flag = false;
2479 # enum_type->range.reset($4 ? $4 : make_range_from_width(1));
2483 def p_enum_name_list_1(p
):
2484 '''enum_name_list : enum_name '''
2485 print('enum_name_list_1', list(p
))
2489 def p_enum_name_list_2(p
):
2490 '''enum_name_list : enum_name_list ',' enum_name '''
2491 print('enum_name_list_2', list(p
))
2492 # { list<named_pexpr_t>*lst = $1;
2493 # lst->splice(lst->end(), *$3);
2498 def p_pos_neg_number_1(p
):
2499 '''pos_neg_number : number '''
2500 print('pos_neg_number_1', list(p
))
2504 def p_pos_neg_number_2(p
):
2505 '''pos_neg_number : '-' number '''
2506 print('pos_neg_number_2', list(p
))
2507 # { verinum tmp = -(*($2));
2512 def p_enum_name_1(p
):
2513 '''enum_name : IDENTIFIER '''
2514 print('enum_name_1', list(p
))
2515 # { perm_string name = lex_strings.make($1);
2517 # $$ = make_named_number(name);
2520 def p_enum_name_2(p
):
2521 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '''
2522 print('enum_name_2', list(p
))
2523 # { perm_string name = lex_strings.make($1);
2524 # long count = check_enum_seq_value(@1, $3, false);
2526 # $$ = make_named_numbers(name, 0, count-1);
2530 def p_enum_name_3(p
):
2531 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '''
2532 print('enum_name_3', list(p
))
2533 # { perm_string name = lex_strings.make($1);
2534 # $$ = make_named_numbers(name, check_enum_seq_value(@1, $3, true),
2535 # check_enum_seq_value(@1, $5, true));
2541 def p_enum_name_4(p
):
2542 '''enum_name : IDENTIFIER '=' expression '''
2543 print('enum_name_4', list(p
))
2544 # { perm_string name = lex_strings.make($1);
2546 # $$ = make_named_number(name, $3);
2549 def p_enum_name_5(p
):
2550 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '=' expression '''
2551 print('enum_name_5', list(p
))
2552 # { perm_string name = lex_strings.make($1);
2553 # long count = check_enum_seq_value(@1, $3, false);
2554 # $$ = make_named_numbers(name, 0, count-1, $6);
2559 def p_enum_name_6(p
):
2560 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '=' expression '''
2561 print('enum_name_6', list(p
))
2562 # { perm_string name = lex_strings.make($1);
2563 # $$ = make_named_numbers(name, check_enum_seq_value(@1, $3, true),
2564 # check_enum_seq_value(@1, $5, true), $8);
2570 def p_struct_data_type_1(p
):
2571 '''struct_data_type : K_struct K_packed_opt '{' struct_union_member_list '}' '''
2572 print('struct_data_type_1', list(p
))
2573 # { struct_type_t*tmp = new struct_type_t;
2574 # FILE_NAME(tmp, @1);
2575 # tmp->packed_flag = $2;
2576 # tmp->union_flag = false;
2577 # tmp->members .reset($4);
2581 def p_struct_data_type_2(p
):
2582 '''struct_data_type : K_union K_packed_opt '{' struct_union_member_list '}' '''
2583 print('struct_data_type_2', list(p
))
2584 # { struct_type_t*tmp = new struct_type_t;
2585 # FILE_NAME(tmp, @1);
2586 # tmp->packed_flag = $2;
2587 # tmp->union_flag = true;
2588 # tmp->members .reset($4);
2592 def p_struct_data_type_3(p
):
2593 '''struct_data_type : K_struct K_packed_opt '{' error '}' '''
2594 print('struct_data_type_3', list(p
))
2595 # { yyerror(@3, "error: Errors in struct member list.");
2597 # struct_type_t*tmp = new struct_type_t;
2598 # FILE_NAME(tmp, @1);
2599 # tmp->packed_flag = $2;
2600 # tmp->union_flag = false;
2604 def p_struct_data_type_4(p
):
2605 '''struct_data_type : K_union K_packed_opt '{' error '}' '''
2606 print('struct_data_type_4', list(p
))
2607 # { yyerror(@3, "error: Errors in union member list.");
2609 # struct_type_t*tmp = new struct_type_t;
2610 # FILE_NAME(tmp, @1);
2611 # tmp->packed_flag = $2;
2612 # tmp->union_flag = true;
2616 def p_struct_union_member_list_1(p
):
2617 '''struct_union_member_list : struct_union_member_list struct_union_member '''
2618 print('struct_union_member_list_1', list(p
))
2619 # { list<struct_member_t*>*tmp = $1;
2620 # tmp->push_back($2);
2624 def p_struct_union_member_list_2(p
):
2625 '''struct_union_member_list : struct_union_member '''
2626 print('struct_union_member_list_2', list(p
))
2627 # { list<struct_member_t*>*tmp = new list<struct_member_t*>;
2628 # tmp->push_back($1);
2632 def p_struct_union_member_1(p
):
2633 '''struct_union_member : attribute_list_opt data_type list_of_variable_decl_assignments ';' '''
2634 print('struct_union_member_1', list(p
))
2635 # { struct_member_t*tmp = new struct_member_t;
2636 # FILE_NAME(tmp, @2);
2637 # tmp->type .reset($2);
2638 # tmp->names .reset($3);
2642 def p_struct_union_member_2(p
):
2643 '''struct_union_member : error ';' '''
2644 print('struct_union_member_2', list(p
))
2645 # { yyerror(@2, "Error in struct/union member.");
2650 def p_case_item_1(p
):
2651 '''case_item : expression_list_proper ':' statement_or_null '''
2652 print('case_item_1', list(p
))
2653 # { PCase::Item*tmp = new PCase::Item;
2660 def p_case_item_2(p
):
2661 '''case_item : K_default ':' statement_or_null '''
2662 print('case_item_2', list(p
))
2663 # { PCase::Item*tmp = new PCase::Item;
2668 def p_case_item_3(p
):
2669 '''case_item : K_default statement_or_null '''
2670 print('case_item_3', list(p
))
2671 # { PCase::Item*tmp = new PCase::Item;
2676 def p_case_item_4(p
):
2677 '''case_item : error ':' statement_or_null '''
2678 print('case_item_4', list(p
))
2679 # { yyerror(@2, "error: Incomprehensible case expression.");
2683 def p_case_items_1(p
):
2684 '''case_items : case_items case_item '''
2685 print('case_items_1', list(p
))
2686 # { svector<PCase::Item*>*tmp;
2687 # tmp = new svector<PCase::Item*>(*$1, $2);
2692 def p_case_items_2(p
):
2693 '''case_items : case_item '''
2694 print('case_items_2', list(p
))
2695 # { svector<PCase::Item*>*tmp = new svector<PCase::Item*>(1);
2700 def p_charge_strength_1(p
):
2701 '''charge_strength : '(' K_small ')' '''
2702 print('charge_strength_1', list(p
))
2704 def p_charge_strength_2(p
):
2705 '''charge_strength : '(' K_medium ')' '''
2706 print('charge_strength_2', list(p
))
2708 def p_charge_strength_3(p
):
2709 '''charge_strength : '(' K_large ')' '''
2710 print('charge_strength_3', list(p
))
2712 def p_charge_strength_opt_1(p
):
2713 '''charge_strength_opt : charge_strength '''
2714 print('charge_strength_opt_1', list(p
))
2716 def p_charge_strength_opt_2(p
):
2717 '''charge_strength_opt : '''
2718 print('charge_strength_opt_2', list(p
))
2720 def p_defparam_assign_1(p
):
2721 '''defparam_assign : hierarchy_identifier '=' expression '''
2722 print('defparam_assign_1', list(p
))
2723 # { pform_set_defparam(*$1, $3);
2727 def p_defparam_assign_list_1(p
):
2728 '''defparam_assign_list : defparam_assign '''
2729 print('defparam_assign_list_1', list(p
))
2731 def p_defparam_assign_list_2(p
):
2732 '''defparam_assign_list : dimensions defparam_assign '''
2733 print('defparam_assign_list_2', list(p
))
2734 # { yyerror(@1, "error: defparam may not include a range.");
2738 def p_defparam_assign_list_3(p
):
2739 '''defparam_assign_list : defparam_assign_list ',' defparam_assign '''
2740 print('defparam_assign_list_3', list(p
))
2743 '''delay1 : '#' delay_value_simple '''
2744 print('delay1_1', list(p
))
2745 # { list<PExpr*>*tmp = new list<PExpr*>;
2746 # tmp->push_back($2);
2751 '''delay1 : '#' '(' delay_value ')' '''
2752 print('delay1_2', list(p
))
2753 # { list<PExpr*>*tmp = new list<PExpr*>;
2754 # tmp->push_back($3);
2759 '''delay3 : '#' delay_value_simple '''
2760 print('delay3_1', list(p
))
2761 # { list<PExpr*>*tmp = new list<PExpr*>;
2762 # tmp->push_back($2);
2767 '''delay3 : '#' '(' delay_value ')' '''
2768 print('delay3_2', list(p
))
2769 # { list<PExpr*>*tmp = new list<PExpr*>;
2770 # tmp->push_back($3);
2775 '''delay3 : '#' '(' delay_value ',' delay_value ')' '''
2776 print('delay3_3', list(p
))
2777 # { list<PExpr*>*tmp = new list<PExpr*>;
2778 # tmp->push_back($3);
2779 # tmp->push_back($5);
2784 '''delay3 : '#' '(' delay_value ',' delay_value ',' delay_value ')' '''
2785 print('delay3_4', list(p
))
2786 # { list<PExpr*>*tmp = new list<PExpr*>;
2787 # tmp->push_back($3);
2788 # tmp->push_back($5);
2789 # tmp->push_back($7);
2793 def p_delay3_opt_1(p
):
2794 '''delay3_opt : delay3 '''
2795 print('delay3_opt_1', list(p
))
2798 def p_delay3_opt_2(p
):
2800 print('delay3_opt_2', list(p
))
2803 def p_delay_value_list_1(p
):
2804 '''delay_value_list : delay_value '''
2805 print('delay_value_list_1', list(p
))
2806 # { list<PExpr*>*tmp = new list<PExpr*>;
2807 # tmp->push_back($1);
2811 def p_delay_value_list_2(p
):
2812 '''delay_value_list : delay_value_list ',' delay_value '''
2813 print('delay_value_list_2', list(p
))
2814 # { list<PExpr*>*tmp = $1;
2815 # tmp->push_back($3);
2819 def p_delay_value_1(p
):
2820 '''delay_value : expression '''
2821 print('delay_value_1', list(p
))
2826 def p_delay_value_2(p
):
2827 '''delay_value : expression ':' expression ':' expression '''
2828 print('delay_value_2', list(p
))
2829 # { $$ = pform_select_mtm_expr($1, $3, $5); }
2831 def p_delay_value_simple_1(p
):
2832 '''delay_value_simple : DEC_NUMBER '''
2833 print('delay_value_simple_1', list(p
))
2834 # { verinum*tmp = $1;
2836 # yyerror(@1, "internal error: delay.");
2839 # $$ = new PENumber(tmp);
2840 # FILE_NAME($$, @1);
2845 def p_delay_value_simple_2(p
):
2846 '''delay_value_simple : REALTIME '''
2847 print('delay_value_simple_2', list(p
))
2848 # { verireal*tmp = $1;
2850 # yyerror(@1, "internal error: delay.");
2853 # $$ = new PEFNumber(tmp);
2854 # FILE_NAME($$, @1);
2858 def p_delay_value_simple_3(p
):
2859 '''delay_value_simple : IDENTIFIER '''
2860 print('delay_value_simple_3', list(p
))
2861 # { PEIdent*tmp = new PEIdent(lex_strings.make($1));
2862 # FILE_NAME(tmp, @1);
2867 def p_delay_value_simple_4(p
):
2868 '''delay_value_simple : TIME_LITERAL '''
2869 print('delay_value_simple_4', list(p
))
2874 # if ($1 == 0 || !get_time_unit($1, unit))
2875 # yyerror(@1, "internal error: delay.");
2877 # double p = pow(10.0,
2878 # (double)(unit - pform_get_timeunit()));
2879 # double time = atof($1) * p;
2881 # verireal *v = new verireal(time);
2882 # $$ = new PEFNumber(v);
2883 # FILE_NAME($$, @1);
2887 def p_optional_semicolon_1(p
):
2888 '''optional_semicolon : ';' '''
2889 print('optional_semicolon_1', list(p
))
2891 def p_optional_semicolon_2(p
):
2892 '''optional_semicolon : '''
2893 print('optional_semicolon_2', list(p
))
2895 def p_discipline_declaration_1(p
):
2896 '''discipline_declaration : K_discipline IDENTIFIER optional_semicolon _embed0_discipline_declaration discipline_items K_enddiscipline '''
2897 print('discipline_declaration_1', list(p
))
2898 # { pform_end_discipline(@1); delete[] $2; }
2900 def p__embed0_discipline_declaration(p
):
2901 '''_embed0_discipline_declaration : '''
2902 # { pform_start_discipline($2); }
2904 def p_discipline_items_1(p
):
2905 '''discipline_items : discipline_items discipline_item '''
2906 print('discipline_items_1', list(p
))
2908 def p_discipline_items_2(p
):
2909 '''discipline_items : discipline_item '''
2910 print('discipline_items_2', list(p
))
2912 def p_discipline_item_1(p
):
2913 '''discipline_item : K_domain K_discrete ';' '''
2914 print('discipline_item_1', list(p
))
2915 # { pform_discipline_domain(@1, IVL_DIS_DISCRETE); }
2917 def p_discipline_item_2(p
):
2918 '''discipline_item : K_domain K_continuous ';' '''
2919 print('discipline_item_2', list(p
))
2920 # { pform_discipline_domain(@1, IVL_DIS_CONTINUOUS); }
2922 def p_discipline_item_3(p
):
2923 '''discipline_item : K_potential IDENTIFIER ';' '''
2924 print('discipline_item_3', list(p
))
2925 # { pform_discipline_potential(@1, $2); delete[] $2; }
2927 def p_discipline_item_4(p
):
2928 '''discipline_item : K_flow IDENTIFIER ';' '''
2929 print('discipline_item_4', list(p
))
2930 # { pform_discipline_flow(@1, $2); delete[] $2; }
2932 def p_nature_declaration_1(p
):
2933 '''nature_declaration : K_nature IDENTIFIER optional_semicolon _embed0_nature_declaration nature_items K_endnature '''
2934 print('nature_declaration_1', list(p
))
2935 # { pform_end_nature(@1); delete[] $2; }
2937 def p__embed0_nature_declaration(p
):
2938 '''_embed0_nature_declaration : '''
2939 # { pform_start_nature($2); }
2941 def p_nature_items_1(p
):
2942 '''nature_items : nature_items nature_item '''
2943 print('nature_items_1', list(p
))
2945 def p_nature_items_2(p
):
2946 '''nature_items : nature_item '''
2947 print('nature_items_2', list(p
))
2949 def p_nature_item_1(p
):
2950 '''nature_item : K_units '=' STRING ';' '''
2951 print('nature_item_1', list(p
))
2954 def p_nature_item_2(p
):
2955 '''nature_item : K_abstol '=' expression ';' '''
2956 print('nature_item_2', list(p
))
2958 def p_nature_item_3(p
):
2959 '''nature_item : K_access '=' IDENTIFIER ';' '''
2960 print('nature_item_3', list(p
))
2961 # { pform_nature_access(@1, $3); delete[] $3; }
2963 def p_nature_item_4(p
):
2964 '''nature_item : K_idt_nature '=' IDENTIFIER ';' '''
2965 print('nature_item_4', list(p
))
2968 def p_nature_item_5(p
):
2969 '''nature_item : K_ddt_nature '=' IDENTIFIER ';' '''
2970 print('nature_item_5', list(p
))
2973 def p_config_declaration_1(p
):
2974 '''config_declaration : K_config IDENTIFIER ';' K_design lib_cell_identifiers ';' list_of_config_rule_statements K_endconfig '''
2975 print('config_declaration_1', list(p
))
2976 # { cerr << @1 << ": sorry: config declarations are not supported and "
2977 # "will be skipped." << endl;
2981 def p_lib_cell_identifiers_1(p
):
2982 '''lib_cell_identifiers : '''
2983 print('lib_cell_identifiers_1', list(p
))
2985 def p_lib_cell_identifiers_2(p
):
2986 '''lib_cell_identifiers : lib_cell_identifiers lib_cell_id '''
2987 print('lib_cell_identifiers_2', list(p
))
2989 def p_list_of_config_rule_statements_1(p
):
2990 '''list_of_config_rule_statements : '''
2991 print('list_of_config_rule_statements_1', list(p
))
2993 def p_list_of_config_rule_statements_2(p
):
2994 '''list_of_config_rule_statements : list_of_config_rule_statements config_rule_statement '''
2995 print('list_of_config_rule_statements_2', list(p
))
2997 def p_config_rule_statement_1(p
):
2998 '''config_rule_statement : K_default K_liblist list_of_libraries ';' '''
2999 print('config_rule_statement_1', list(p
))
3001 def p_config_rule_statement_2(p
):
3002 '''config_rule_statement : K_instance hierarchy_identifier K_liblist list_of_libraries ';' '''
3003 print('config_rule_statement_2', list(p
))
3006 def p_config_rule_statement_3(p
):
3007 '''config_rule_statement : K_instance hierarchy_identifier K_use lib_cell_id opt_config ';' '''
3008 print('config_rule_statement_3', list(p
))
3011 def p_config_rule_statement_4(p
):
3012 '''config_rule_statement : K_cell lib_cell_id K_liblist list_of_libraries ';' '''
3013 print('config_rule_statement_4', list(p
))
3015 def p_config_rule_statement_5(p
):
3016 '''config_rule_statement : K_cell lib_cell_id K_use lib_cell_id opt_config ';' '''
3017 print('config_rule_statement_5', list(p
))
3019 def p_opt_config_1(p
):
3021 print('opt_config_1', list(p
))
3023 def p_opt_config_2(p
):
3024 '''opt_config : ':' K_config '''
3025 print('opt_config_2', list(p
))
3027 def p_lib_cell_id_1(p
):
3028 '''lib_cell_id : IDENTIFIER '''
3029 print('lib_cell_id_1', list(p
))
3032 def p_lib_cell_id_2(p
):
3033 '''lib_cell_id : IDENTIFIER '.' IDENTIFIER '''
3034 print('lib_cell_id_2', list(p
))
3035 # { delete[] $1; delete[] $3; }
3037 def p_list_of_libraries_1(p
):
3038 '''list_of_libraries : '''
3039 print('list_of_libraries_1', list(p
))
3041 def p_list_of_libraries_2(p
):
3042 '''list_of_libraries : list_of_libraries IDENTIFIER '''
3043 print('list_of_libraries_2', list(p
))
3046 def p_drive_strength_1(p
):
3047 '''drive_strength : '(' dr_strength0 ',' dr_strength1 ')' '''
3048 print('drive_strength_1', list(p
))
3049 # { $$.str0 = $2.str0;
3050 # $$.str1 = $4.str1;
3053 def p_drive_strength_2(p
):
3054 '''drive_strength : '(' dr_strength1 ',' dr_strength0 ')' '''
3055 print('drive_strength_2', list(p
))
3056 # { $$.str0 = $4.str0;
3057 # $$.str1 = $2.str1;
3060 def p_drive_strength_3(p
):
3061 '''drive_strength : '(' dr_strength0 ',' K_highz1 ')' '''
3062 print('drive_strength_3', list(p
))
3063 # { $$.str0 = $2.str0;
3064 # $$.str1 = IVL_DR_HiZ;
3067 def p_drive_strength_4(p
):
3068 '''drive_strength : '(' dr_strength1 ',' K_highz0 ')' '''
3069 print('drive_strength_4', list(p
))
3070 # { $$.str0 = IVL_DR_HiZ;
3071 # $$.str1 = $2.str1;
3074 def p_drive_strength_5(p
):
3075 '''drive_strength : '(' K_highz1 ',' dr_strength0 ')' '''
3076 print('drive_strength_5', list(p
))
3077 # { $$.str0 = $4.str0;
3078 # $$.str1 = IVL_DR_HiZ;
3081 def p_drive_strength_6(p
):
3082 '''drive_strength : '(' K_highz0 ',' dr_strength1 ')' '''
3083 print('drive_strength_6', list(p
))
3084 # { $$.str0 = IVL_DR_HiZ;
3085 # $$.str1 = $4.str1;
3088 def p_drive_strength_opt_1(p
):
3089 '''drive_strength_opt : drive_strength '''
3090 print('drive_strength_opt_1', list(p
))
3093 def p_drive_strength_opt_2(p
):
3094 '''drive_strength_opt : '''
3095 print('drive_strength_opt_2', list(p
))
3096 # { $$.str0 = IVL_DR_STRONG; $$.str1 = IVL_DR_STRONG; }
3098 def p_dr_strength0_1(p
):
3099 '''dr_strength0 : K_supply0 '''
3100 print('dr_strength0_1', list(p
))
3101 # { $$.str0 = IVL_DR_SUPPLY; }
3103 def p_dr_strength0_2(p
):
3104 '''dr_strength0 : K_strong0 '''
3105 print('dr_strength0_2', list(p
))
3106 # { $$.str0 = IVL_DR_STRONG; }
3108 def p_dr_strength0_3(p
):
3109 '''dr_strength0 : K_pull0 '''
3110 print('dr_strength0_3', list(p
))
3111 # { $$.str0 = IVL_DR_PULL; }
3113 def p_dr_strength0_4(p
):
3114 '''dr_strength0 : K_weak0 '''
3115 print('dr_strength0_4', list(p
))
3116 # { $$.str0 = IVL_DR_WEAK; }
3118 def p_dr_strength1_1(p
):
3119 '''dr_strength1 : K_supply1 '''
3120 print('dr_strength1_1', list(p
))
3121 # { $$.str1 = IVL_DR_SUPPLY; }
3123 def p_dr_strength1_2(p
):
3124 '''dr_strength1 : K_strong1 '''
3125 print('dr_strength1_2', list(p
))
3126 # { $$.str1 = IVL_DR_STRONG; }
3128 def p_dr_strength1_3(p
):
3129 '''dr_strength1 : K_pull1 '''
3130 print('dr_strength1_3', list(p
))
3131 # { $$.str1 = IVL_DR_PULL; }
3133 def p_dr_strength1_4(p
):
3134 '''dr_strength1 : K_weak1 '''
3135 print('dr_strength1_4', list(p
))
3136 # { $$.str1 = IVL_DR_WEAK; }
3138 def p_clocking_event_opt_1(p
):
3139 '''clocking_event_opt : event_control '''
3140 print('clocking_event_opt_1', list(p
))
3142 def p_clocking_event_opt_2(p
):
3143 '''clocking_event_opt : '''
3144 print('clocking_event_opt_2', list(p
))
3146 def p_event_control_1(p
):
3147 '''event_control : '@' hierarchy_identifier '''
3148 print('event_control_1', list(p
))
3149 # { PEIdent*tmpi = new PEIdent(*$2);
3150 # PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi);
3151 # PEventStatement*tmps = new PEventStatement(tmpe);
3152 # FILE_NAME(tmps, @1);
3157 def p_event_control_2(p
):
3158 '''event_control : '@' '(' event_expression_list ')' '''
3159 print('event_control_2', list(p
))
3160 # { PEventStatement*tmp = new PEventStatement(*$3);
3161 # FILE_NAME(tmp, @1);
3166 def p_event_control_3(p
):
3167 '''event_control : '@' '(' error ')' '''
3168 print('event_control_3', list(p
))
3169 # { yyerror(@1, "error: Malformed event control expression.");
3173 def p_event_expression_list_1(p
):
3174 '''event_expression_list : event_expression '''
3175 print('event_expression_list_1', list(p
))
3178 def p_event_expression_list_2(p
):
3179 '''event_expression_list : event_expression_list K_or event_expression '''
3180 print('event_expression_list_2', list(p
))
3181 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*$1, *$3);
3187 def p_event_expression_list_3(p
):
3188 '''event_expression_list : event_expression_list ',' event_expression '''
3189 print('event_expression_list_3', list(p
))
3190 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*$1, *$3);
3196 def p_event_expression_1(p
):
3197 '''event_expression : K_posedge expression '''
3198 print('event_expression_1', list(p
))
3199 # { PEEvent*tmp = new PEEvent(PEEvent::POSEDGE, $2);
3200 # FILE_NAME(tmp, @1);
3201 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3206 def p_event_expression_2(p
):
3207 '''event_expression : K_negedge expression '''
3208 print('event_expression_2', list(p
))
3209 # { PEEvent*tmp = new PEEvent(PEEvent::NEGEDGE, $2);
3210 # FILE_NAME(tmp, @1);
3211 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3216 def p_event_expression_3(p
):
3217 '''event_expression : expression '''
3218 print('event_expression_3', list(p
))
3219 # { PEEvent*tmp = new PEEvent(PEEvent::ANYEDGE, $1);
3220 # FILE_NAME(tmp, @1);
3221 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3226 def p_branch_probe_expression_1(p
):
3227 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ',' IDENTIFIER ')' '''
3228 print('branch_probe_expression_1', list(p
))
3229 # { $$ = pform_make_branch_probe_expression(@1, $1, $3, $5); }
3231 def p_branch_probe_expression_2(p
):
3232 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ')' '''
3233 print('branch_probe_expression_2', list(p
))
3234 # { $$ = pform_make_branch_probe_expression(@1, $1, $3); }
3236 def p_expression_1(p
):
3237 '''expression : expr_primary_or_typename '''
3238 print('expression_1', list(p
))
3241 def p_expression_2(p
):
3242 '''expression : inc_or_dec_expression '''
3243 print('expression_2', list(p
))
3246 def p_expression_3(p
):
3247 '''expression : inside_expression '''
3248 print('expression_3', list(p
))
3251 def p_expression_4(p
):
3252 '''expression : '+' attribute_list_opt expr_primary %prec UNARY_PREC '''
3253 print('expression_4', list(p
))
3256 def p_expression_5(p
):
3257 '''expression : '-' attribute_list_opt expr_primary %prec UNARY_PREC '''
3258 print('expression_5', list(p
))
3259 # { PEUnary*tmp = new PEUnary('-', $3);
3260 # FILE_NAME(tmp, @3);
3264 def p_expression_6(p
):
3265 '''expression : '~' attribute_list_opt expr_primary %prec UNARY_PREC '''
3266 print('expression_6', list(p
))
3267 # { PEUnary*tmp = new PEUnary('~', $3);
3268 # FILE_NAME(tmp, @3);
3272 def p_expression_7(p
):
3273 '''expression : '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3274 print('expression_7', list(p
))
3275 # { PEUnary*tmp = new PEUnary('&', $3);
3276 # FILE_NAME(tmp, @3);
3280 def p_expression_8(p
):
3281 '''expression : '!' attribute_list_opt expr_primary %prec UNARY_PREC '''
3282 print('expression_8', list(p
))
3283 # { PEUnary*tmp = new PEUnary('!', $3);
3284 # FILE_NAME(tmp, @3);
3288 def p_expression_9(p
):
3289 '''expression : '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3290 print('expression_9', list(p
))
3291 # { PEUnary*tmp = new PEUnary('|', $3);
3292 # FILE_NAME(tmp, @3);
3296 def p_expression_10(p
):
3297 '''expression : '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3298 print('expression_10', list(p
))
3299 # { PEUnary*tmp = new PEUnary('^', $3);
3300 # FILE_NAME(tmp, @3);
3304 def p_expression_11(p
):
3305 '''expression : '~' '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3306 print('expression_11', list(p
))
3307 # { yyerror(@1, "error: '~' '&' is not a valid expression. "
3308 # "Please use operator '~&' instead.");
3312 def p_expression_12(p
):
3313 '''expression : '~' '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3314 print('expression_12', list(p
))
3315 # { yyerror(@1, "error: '~' '|' is not a valid expression. "
3316 # "Please use operator '~|' instead.");
3320 def p_expression_13(p
):
3321 '''expression : '~' '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3322 print('expression_13', list(p
))
3323 # { yyerror(@1, "error: '~' '^' is not a valid expression. "
3324 # "Please use operator '~^' instead.");
3328 def p_expression_14(p
):
3329 '''expression : K_NAND attribute_list_opt expr_primary %prec UNARY_PREC '''
3330 print('expression_14', list(p
))
3331 # { PEUnary*tmp = new PEUnary('A', $3);
3332 # FILE_NAME(tmp, @3);
3336 def p_expression_15(p
):
3337 '''expression : K_NOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3338 print('expression_15', list(p
))
3339 # { PEUnary*tmp = new PEUnary('N', $3);
3340 # FILE_NAME(tmp, @3);
3344 def p_expression_16(p
):
3345 '''expression : K_NXOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3346 print('expression_16', list(p
))
3347 # { PEUnary*tmp = new PEUnary('X', $3);
3348 # FILE_NAME(tmp, @3);
3352 def p_expression_17(p
):
3353 '''expression : '!' error %prec UNARY_PREC '''
3354 print('expression_17', list(p
))
3355 # { yyerror(@1, "error: Operand of unary ! "
3356 # "is not a primary expression.");
3360 def p_expression_18(p
):
3361 '''expression : '^' error %prec UNARY_PREC '''
3362 print('expression_18', list(p
))
3363 # { yyerror(@1, "error: Operand of reduction ^ "
3364 # "is not a primary expression.");
3368 def p_expression_19(p
):
3369 '''expression : expression '^' attribute_list_opt expression '''
3370 print('expression_19', list(p
))
3371 # { PEBinary*tmp = new PEBinary('^', $1, $4);
3372 # FILE_NAME(tmp, @2);
3376 def p_expression_20(p
):
3377 '''expression : expression K_POW attribute_list_opt expression '''
3378 print('expression_20', list(p
))
3379 # { PEBinary*tmp = new PEBPower('p', $1, $4);
3380 # FILE_NAME(tmp, @2);
3384 def p_expression_21(p
):
3385 '''expression : expression '*' attribute_list_opt expression '''
3386 print('expression_21', list(p
))
3387 # { PEBinary*tmp = new PEBinary('*', $1, $4);
3388 # FILE_NAME(tmp, @2);
3392 def p_expression_22(p
):
3393 '''expression : expression '/' attribute_list_opt expression '''
3394 print('expression_22', list(p
))
3395 # { PEBinary*tmp = new PEBinary('/', $1, $4);
3396 # FILE_NAME(tmp, @2);
3400 def p_expression_23(p
):
3401 '''expression : expression '%' attribute_list_opt expression '''
3402 print('expression_23', list(p
))
3403 # { PEBinary*tmp = new PEBinary('%', $1, $4);
3404 # FILE_NAME(tmp, @2);
3408 def p_expression_24(p
):
3409 '''expression : expression '+' attribute_list_opt expression '''
3410 print('expression_24', list(p
))
3411 # { PEBinary*tmp = new PEBinary('+', $1, $4);
3412 # FILE_NAME(tmp, @2);
3416 def p_expression_25(p
):
3417 '''expression : expression '-' attribute_list_opt expression '''
3418 print('expression_25', list(p
))
3419 # { PEBinary*tmp = new PEBinary('-', $1, $4);
3420 # FILE_NAME(tmp, @2);
3424 def p_expression_26(p
):
3425 '''expression : expression '&' attribute_list_opt expression '''
3426 print('expression_26', list(p
))
3427 # { PEBinary*tmp = new PEBinary('&', $1, $4);
3428 # FILE_NAME(tmp, @2);
3432 def p_expression_27(p
):
3433 '''expression : expression '|' attribute_list_opt expression '''
3434 print('expression_27', list(p
))
3435 # { PEBinary*tmp = new PEBinary('|', $1, $4);
3436 # FILE_NAME(tmp, @2);
3440 def p_expression_28(p
):
3441 '''expression : expression K_NAND attribute_list_opt expression '''
3442 print('expression_28', list(p
))
3443 # { PEBinary*tmp = new PEBinary('A', $1, $4);
3444 # FILE_NAME(tmp, @2);
3448 def p_expression_29(p
):
3449 '''expression : expression K_NOR attribute_list_opt expression '''
3450 print('expression_29', list(p
))
3451 # { PEBinary*tmp = new PEBinary('O', $1, $4);
3452 # FILE_NAME(tmp, @2);
3456 def p_expression_30(p
):
3457 '''expression : expression K_NXOR attribute_list_opt expression '''
3458 print('expression_30', list(p
))
3459 # { PEBinary*tmp = new PEBinary('X', $1, $4);
3460 # FILE_NAME(tmp, @2);
3464 def p_expression_31(p
):
3465 '''expression : expression '<' attribute_list_opt expression '''
3466 print('expression_31', list(p
))
3467 # { PEBinary*tmp = new PEBComp('<', $1, $4);
3468 # FILE_NAME(tmp, @2);
3472 def p_expression_32(p
):
3473 '''expression : expression '>' attribute_list_opt expression '''
3474 print('expression_32', list(p
))
3475 # { PEBinary*tmp = new PEBComp('>', $1, $4);
3476 # FILE_NAME(tmp, @2);
3480 def p_expression_33(p
):
3481 '''expression : expression K_LS attribute_list_opt expression '''
3482 print('expression_33', list(p
))
3483 # { PEBinary*tmp = new PEBShift('l', $1, $4);
3484 # FILE_NAME(tmp, @2);
3488 def p_expression_34(p
):
3489 '''expression : expression K_RS attribute_list_opt expression '''
3490 print('expression_34', list(p
))
3491 # { PEBinary*tmp = new PEBShift('r', $1, $4);
3492 # FILE_NAME(tmp, @2);
3496 def p_expression_35(p
):
3497 '''expression : expression K_RSS attribute_list_opt expression '''
3498 print('expression_35', list(p
))
3499 # { PEBinary*tmp = new PEBShift('R', $1, $4);
3500 # FILE_NAME(tmp, @2);
3504 def p_expression_36(p
):
3505 '''expression : expression K_EQ attribute_list_opt expression '''
3506 print('expression_36', list(p
))
3507 # { PEBinary*tmp = new PEBComp('e', $1, $4);
3508 # FILE_NAME(tmp, @2);
3512 def p_expression_37(p
):
3513 '''expression : expression K_CEQ attribute_list_opt expression '''
3514 print('expression_37', list(p
))
3515 # { PEBinary*tmp = new PEBComp('E', $1, $4);
3516 # FILE_NAME(tmp, @2);
3520 def p_expression_38(p
):
3521 '''expression : expression K_WEQ attribute_list_opt expression '''
3522 print('expression_38', list(p
))
3523 # { PEBinary*tmp = new PEBComp('w', $1, $4);
3524 # FILE_NAME(tmp, @2);
3528 def p_expression_39(p
):
3529 '''expression : expression K_LE attribute_list_opt expression '''
3530 print('expression_39', list(p
))
3531 # { PEBinary*tmp = new PEBComp('L', $1, $4);
3532 # FILE_NAME(tmp, @2);
3536 def p_expression_40(p
):
3537 '''expression : expression K_GE attribute_list_opt expression '''
3538 print('expression_40', list(p
))
3539 # { PEBinary*tmp = new PEBComp('G', $1, $4);
3540 # FILE_NAME(tmp, @2);
3544 def p_expression_41(p
):
3545 '''expression : expression K_NE attribute_list_opt expression '''
3546 print('expression_41', list(p
))
3547 # { PEBinary*tmp = new PEBComp('n', $1, $4);
3548 # FILE_NAME(tmp, @2);
3552 def p_expression_42(p
):
3553 '''expression : expression K_CNE attribute_list_opt expression '''
3554 print('expression_42', list(p
))
3555 # { PEBinary*tmp = new PEBComp('N', $1, $4);
3556 # FILE_NAME(tmp, @2);
3560 def p_expression_43(p
):
3561 '''expression : expression K_WNE attribute_list_opt expression '''
3562 print('expression_43', list(p
))
3563 # { PEBinary*tmp = new PEBComp('W', $1, $4);
3564 # FILE_NAME(tmp, @2);
3568 def p_expression_44(p
):
3569 '''expression : expression K_LOR attribute_list_opt expression '''
3570 print('expression_44', list(p
))
3571 # { PEBinary*tmp = new PEBLogic('o', $1, $4);
3572 # FILE_NAME(tmp, @2);
3576 def p_expression_45(p
):
3577 '''expression : expression K_LAND attribute_list_opt expression '''
3578 print('expression_45', list(p
))
3579 # { PEBinary*tmp = new PEBLogic('a', $1, $4);
3580 # FILE_NAME(tmp, @2);
3584 def p_expression_46(p
):
3585 '''expression : expression '?' attribute_list_opt expression ':' expression '''
3586 print('expression_46', list(p
))
3587 # { PETernary*tmp = new PETernary($1, $4, $6);
3588 # FILE_NAME(tmp, @2);
3592 def p_expr_mintypmax_1(p
):
3593 '''expr_mintypmax : expression '''
3594 print('expr_mintypmax_1', list(p
))
3597 def p_expr_mintypmax_2(p
):
3598 '''expr_mintypmax : expression ':' expression ':' expression '''
3599 print('expr_mintypmax_2', list(p
))
3600 # { switch (min_typ_max_flag) {
3617 # if (min_typ_max_warn > 0) {
3618 # cerr << $$->get_fileline() << ": warning: choosing ";
3619 # switch (min_typ_max_flag) {
3630 # cerr << " expression." << endl;
3631 # min_typ_max_warn -= 1;
3635 def p_expression_list_with_nuls_1(p
):
3636 '''expression_list_with_nuls : expression_list_with_nuls ',' expression '''
3637 print('expression_list_with_nuls_1', list(p
))
3638 # { list<PExpr*>*tmp = $1;
3639 # tmp->push_back($3);
3643 def p_expression_list_with_nuls_2(p
):
3644 '''expression_list_with_nuls : expression '''
3645 print('expression_list_with_nuls_2', list(p
))
3646 # { list<PExpr*>*tmp = new list<PExpr*>;
3647 # tmp->push_back($1);
3651 def p_expression_list_with_nuls_3(p
):
3652 '''expression_list_with_nuls : '''
3653 print('expression_list_with_nuls_3', list(p
))
3654 # { list<PExpr*>*tmp = new list<PExpr*>;
3655 # tmp->push_back(0);
3659 def p_expression_list_with_nuls_4(p
):
3660 '''expression_list_with_nuls : expression_list_with_nuls ',' '''
3661 print('expression_list_with_nuls_4', list(p
))
3662 # { list<PExpr*>*tmp = $1;
3663 # tmp->push_back(0);
3667 def p_expression_list_proper_1(p
):
3668 '''expression_list_proper : expression_list_proper ',' expression '''
3669 print('expression_list_proper_1', list(p
))
3670 # { list<PExpr*>*tmp = $1;
3671 # tmp->push_back($3);
3675 def p_expression_list_proper_2(p
):
3676 '''expression_list_proper : expression '''
3677 print('expression_list_proper_2', list(p
))
3678 # { list<PExpr*>*tmp = new list<PExpr*>;
3679 # tmp->push_back($1);
3683 def p_expr_primary_or_typename_1(p
):
3684 '''expr_primary_or_typename : expr_primary '''
3685 print('expr_primary_or_typename_1', list(p
))
3688 def p_expr_primary_or_typename_2(p
):
3689 '''expr_primary_or_typename : TYPE_IDENTIFIER '''
3690 print('expr_primary_or_typename_2', list(p
))
3692 # { PETypename*tmp = new PETypename($1.type);
3693 # FILE_NAME(tmp,@1);
3698 def p_expr_primary_1(p
):
3699 '''expr_primary : number '''
3700 print('expr_primary_1', list(p
))
3703 # PENumber*tmp = new PENumber($1);
3704 # FILE_NAME(tmp, @1);
3708 def p_expr_primary_2(p
):
3709 '''expr_primary : REALTIME '''
3710 print('expr_primary_2', list(p
))
3711 # { PEFNumber*tmp = new PEFNumber($1);
3712 # FILE_NAME(tmp, @1);
3716 def p_expr_primary_3(p
):
3717 '''expr_primary : STRING '''
3718 print('expr_primary_3', list(p
))
3719 # { PEString*tmp = new PEString($1);
3720 # FILE_NAME(tmp, @1);
3724 def p_expr_primary_4(p
):
3725 '''expr_primary : TIME_LITERAL '''
3726 print('expr_primary_4', list(p
))
3731 # if ($1 == 0 || !get_time_unit($1, unit))
3732 # yyerror(@1, "internal error: delay.");
3734 # double p = pow(10.0, (double)(unit - pform_get_timeunit()));
3735 # double time = atof($1) * p;
3737 # verireal *v = new verireal(time);
3738 # $$ = new PEFNumber(v);
3739 # FILE_NAME($$, @1);
3743 def p_expr_primary_5(p
):
3744 '''expr_primary : SYSTEM_IDENTIFIER '''
3745 print('expr_primary_5', list(p
))
3746 # { perm_string tn = lex_strings.make($1);
3747 # PECallFunction*tmp = new PECallFunction(tn);
3748 # FILE_NAME(tmp, @1);
3753 def p_expr_primary_6(p
):
3754 '''expr_primary : hierarchy_identifier '''
3755 print('expr_primary_6', list(p
))
3757 # { PEIdent*tmp = pform_new_ident(*$1);
3758 # FILE_NAME(tmp, @1);
3763 def p_expr_primary_7(p
):
3764 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier '''
3765 print('expr_primary_7', list(p
))
3766 # { $$ = pform_package_ident(@2, $1, $3);
3770 def p_expr_primary_8(p
):
3771 '''expr_primary : hierarchy_identifier '(' expression_list_with_nuls ')' '''
3772 print('expr_primary_8', list(p
))
3773 # { list<PExpr*>*expr_list = $3;
3774 # strip_tail_items(expr_list);
3775 # PECallFunction*tmp = pform_make_call_function(@1, *$1, *expr_list);
3780 def p_expr_primary_9(p
):
3781 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' '''
3782 print('expr_primary_9', list(p
))
3783 # { pform_name_t*t_name = $1;
3784 # while (! $3->empty()) {
3785 # t_name->push_back($3->front());
3788 # list<PExpr*>*expr_list = $5;
3789 # strip_tail_items(expr_list);
3790 # PECallFunction*tmp = pform_make_call_function(@1, *t_name, *expr_list);
3796 def p_expr_primary_10(p
):
3797 '''expr_primary : SYSTEM_IDENTIFIER '(' expression_list_proper ')' '''
3798 print('expr_primary_10', list(p
))
3799 # { perm_string tn = lex_strings.make($1);
3800 # PECallFunction*tmp = new PECallFunction(tn, *$3);
3801 # FILE_NAME(tmp, @1);
3806 def p_expr_primary_11(p
):
3807 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')' '''
3808 print('expr_primary_11', list(p
))
3809 # { perm_string use_name = lex_strings.make($3);
3810 # PECallFunction*tmp = new PECallFunction($1, use_name, *$5);
3811 # FILE_NAME(tmp, @3);
3816 def p_expr_primary_12(p
):
3817 '''expr_primary : SYSTEM_IDENTIFIER '(' ')' '''
3818 print('expr_primary_12', list(p
))
3819 # { perm_string tn = lex_strings.make($1);
3820 # const vector<PExpr*>empty;
3821 # PECallFunction*tmp = new PECallFunction(tn, empty);
3822 # FILE_NAME(tmp, @1);
3825 # if (!gn_system_verilog()) {
3826 # yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
3830 def p_expr_primary_13(p
):
3831 '''expr_primary : implicit_class_handle '''
3832 print('expr_primary_13', list(p
))
3833 # { PEIdent*tmp = new PEIdent(*$1);
3834 # FILE_NAME(tmp,@1);
3839 def p_expr_primary_14(p
):
3840 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '''
3841 print('expr_primary_14', list(p
))
3842 # { pform_name_t*t_name = $1;
3843 # while (! $3->empty()) {
3844 # t_name->push_back($3->front());
3847 # PEIdent*tmp = new PEIdent(*t_name);
3848 # FILE_NAME(tmp,@1);
3854 def p_expr_primary_15(p
):
3855 '''expr_primary : K_acos '(' expression ')' '''
3856 print('expr_primary_15', list(p
))
3857 # { perm_string tn = perm_string::literal("$acos");
3858 # PECallFunction*tmp = make_call_function(tn, $3);
3859 # FILE_NAME(tmp,@1);
3863 def p_expr_primary_16(p
):
3864 '''expr_primary : K_acosh '(' expression ')' '''
3865 print('expr_primary_16', list(p
))
3866 # { perm_string tn = perm_string::literal("$acosh");
3867 # PECallFunction*tmp = make_call_function(tn, $3);
3868 # FILE_NAME(tmp,@1);
3872 def p_expr_primary_17(p
):
3873 '''expr_primary : K_asin '(' expression ')' '''
3874 print('expr_primary_17', list(p
))
3875 # { perm_string tn = perm_string::literal("$asin");
3876 # PECallFunction*tmp = make_call_function(tn, $3);
3877 # FILE_NAME(tmp,@1);
3881 def p_expr_primary_18(p
):
3882 '''expr_primary : K_asinh '(' expression ')' '''
3883 print('expr_primary_18', list(p
))
3884 # { perm_string tn = perm_string::literal("$asinh");
3885 # PECallFunction*tmp = make_call_function(tn, $3);
3886 # FILE_NAME(tmp,@1);
3890 def p_expr_primary_19(p
):
3891 '''expr_primary : K_atan '(' expression ')' '''
3892 print('expr_primary_19', list(p
))
3893 # { perm_string tn = perm_string::literal("$atan");
3894 # PECallFunction*tmp = make_call_function(tn, $3);
3895 # FILE_NAME(tmp,@1);
3899 def p_expr_primary_20(p
):
3900 '''expr_primary : K_atanh '(' expression ')' '''
3901 print('expr_primary_20', list(p
))
3902 # { perm_string tn = perm_string::literal("$atanh");
3903 # PECallFunction*tmp = make_call_function(tn, $3);
3904 # FILE_NAME(tmp,@1);
3908 def p_expr_primary_21(p
):
3909 '''expr_primary : K_atan2 '(' expression ',' expression ')' '''
3910 print('expr_primary_21', list(p
))
3911 # { perm_string tn = perm_string::literal("$atan2");
3912 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3913 # FILE_NAME(tmp,@1);
3917 def p_expr_primary_22(p
):
3918 '''expr_primary : K_ceil '(' expression ')' '''
3919 print('expr_primary_22', list(p
))
3920 # { perm_string tn = perm_string::literal("$ceil");
3921 # PECallFunction*tmp = make_call_function(tn, $3);
3922 # FILE_NAME(tmp,@1);
3926 def p_expr_primary_23(p
):
3927 '''expr_primary : K_cos '(' expression ')' '''
3928 print('expr_primary_23', list(p
))
3929 # { perm_string tn = perm_string::literal("$cos");
3930 # PECallFunction*tmp = make_call_function(tn, $3);
3931 # FILE_NAME(tmp,@1);
3935 def p_expr_primary_24(p
):
3936 '''expr_primary : K_cosh '(' expression ')' '''
3937 print('expr_primary_24', list(p
))
3938 # { perm_string tn = perm_string::literal("$cosh");
3939 # PECallFunction*tmp = make_call_function(tn, $3);
3940 # FILE_NAME(tmp,@1);
3944 def p_expr_primary_25(p
):
3945 '''expr_primary : K_exp '(' expression ')' '''
3946 print('expr_primary_25', list(p
))
3947 # { perm_string tn = perm_string::literal("$exp");
3948 # PECallFunction*tmp = make_call_function(tn, $3);
3949 # FILE_NAME(tmp,@1);
3953 def p_expr_primary_26(p
):
3954 '''expr_primary : K_floor '(' expression ')' '''
3955 print('expr_primary_26', list(p
))
3956 # { perm_string tn = perm_string::literal("$floor");
3957 # PECallFunction*tmp = make_call_function(tn, $3);
3958 # FILE_NAME(tmp,@1);
3962 def p_expr_primary_27(p
):
3963 '''expr_primary : K_hypot '(' expression ',' expression ')' '''
3964 print('expr_primary_27', list(p
))
3965 # { perm_string tn = perm_string::literal("$hypot");
3966 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3967 # FILE_NAME(tmp,@1);
3971 def p_expr_primary_28(p
):
3972 '''expr_primary : K_ln '(' expression ')' '''
3973 print('expr_primary_28', list(p
))
3974 # { perm_string tn = perm_string::literal("$ln");
3975 # PECallFunction*tmp = make_call_function(tn, $3);
3976 # FILE_NAME(tmp,@1);
3980 def p_expr_primary_29(p
):
3981 '''expr_primary : K_log '(' expression ')' '''
3982 print('expr_primary_29', list(p
))
3983 # { perm_string tn = perm_string::literal("$log10");
3984 # PECallFunction*tmp = make_call_function(tn, $3);
3985 # FILE_NAME(tmp,@1);
3989 def p_expr_primary_30(p
):
3990 '''expr_primary : K_pow '(' expression ',' expression ')' '''
3991 print('expr_primary_30', list(p
))
3992 # { perm_string tn = perm_string::literal("$pow");
3993 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3994 # FILE_NAME(tmp,@1);
3998 def p_expr_primary_31(p
):
3999 '''expr_primary : K_sin '(' expression ')' '''
4000 print('expr_primary_31', list(p
))
4001 # { perm_string tn = perm_string::literal("$sin");
4002 # PECallFunction*tmp = make_call_function(tn, $3);
4003 # FILE_NAME(tmp,@1);
4007 def p_expr_primary_32(p
):
4008 '''expr_primary : K_sinh '(' expression ')' '''
4009 print('expr_primary_32', list(p
))
4010 # { perm_string tn = perm_string::literal("$sinh");
4011 # PECallFunction*tmp = make_call_function(tn, $3);
4012 # FILE_NAME(tmp,@1);
4016 def p_expr_primary_33(p
):
4017 '''expr_primary : K_sqrt '(' expression ')' '''
4018 print('expr_primary_33', list(p
))
4019 # { perm_string tn = perm_string::literal("$sqrt");
4020 # PECallFunction*tmp = make_call_function(tn, $3);
4021 # FILE_NAME(tmp,@1);
4025 def p_expr_primary_34(p
):
4026 '''expr_primary : K_tan '(' expression ')' '''
4027 print('expr_primary_34', list(p
))
4028 # { perm_string tn = perm_string::literal("$tan");
4029 # PECallFunction*tmp = make_call_function(tn, $3);
4030 # FILE_NAME(tmp,@1);
4034 def p_expr_primary_35(p
):
4035 '''expr_primary : K_tanh '(' expression ')' '''
4036 print('expr_primary_35', list(p
))
4037 # { perm_string tn = perm_string::literal("$tanh");
4038 # PECallFunction*tmp = make_call_function(tn, $3);
4039 # FILE_NAME(tmp,@1);
4043 def p_expr_primary_36(p
):
4044 '''expr_primary : K_abs '(' expression ')' '''
4045 print('expr_primary_36', list(p
))
4046 # { PEUnary*tmp = new PEUnary('m', $3);
4047 # FILE_NAME(tmp,@1);
4051 def p_expr_primary_37(p
):
4052 '''expr_primary : K_max '(' expression ',' expression ')' '''
4053 print('expr_primary_37', list(p
))
4054 # { PEBinary*tmp = new PEBinary('M', $3, $5);
4055 # FILE_NAME(tmp,@1);
4059 def p_expr_primary_38(p
):
4060 '''expr_primary : K_min '(' expression ',' expression ')' '''
4061 print('expr_primary_38', list(p
))
4062 # { PEBinary*tmp = new PEBinary('m', $3, $5);
4063 # FILE_NAME(tmp,@1);
4067 def p_expr_primary_39(p
):
4068 '''expr_primary : '(' expr_mintypmax ')' '''
4069 print('expr_primary_39', list(p
))
4072 def p_expr_primary_40(p
):
4073 '''expr_primary : '{' expression_list_proper '}' '''
4074 print('expr_primary_40', list(p
))
4075 # { PEConcat*tmp = new PEConcat(*$2);
4076 # FILE_NAME(tmp, @1);
4081 def p_expr_primary_41(p
):
4082 '''expr_primary : '{' expression '{' expression_list_proper '}' '}' '''
4083 print('expr_primary_41', list(p
))
4085 # PEConcat*tmp = new PEConcat(*$4, rep);
4086 # FILE_NAME(tmp, @1);
4091 def p_expr_primary_42(p
):
4092 '''expr_primary : '{' expression '{' expression_list_proper '}' error '}' '''
4093 print('expr_primary_42', list(p
))
4095 # PEConcat*tmp = new PEConcat(*$4, rep);
4096 # FILE_NAME(tmp, @1);
4099 # yyerror(@5, "error: Syntax error between internal '}' "
4100 # "and closing '}' of repeat concatenation.");
4104 def p_expr_primary_43(p
):
4105 '''expr_primary : '{' '}' '''
4106 print('expr_primary_43', list(p
))
4107 # { // This is the empty queue syntax.
4108 # if (gn_system_verilog()) {
4109 # list<PExpr*> empty_list;
4110 # PEConcat*tmp = new PEConcat(empty_list);
4111 # FILE_NAME(tmp, @1);
4114 # yyerror(@1, "error: Concatenations are not allowed to be empty.");
4119 def p_expr_primary_44(p
):
4120 '''expr_primary : expr_primary "'" '(' expression ')' '''
4121 print('expr_primary_44', list(p
))
4122 # { PExpr*base = $4;
4123 # if (gn_system_verilog()) {
4124 # PECastSize*tmp = new PECastSize($1, base);
4125 # FILE_NAME(tmp, @1);
4128 # yyerror(@1, "error: Size cast requires SystemVerilog.");
4133 def p_expr_primary_45(p
):
4134 '''expr_primary : simple_type_or_string "'" '(' expression ')' '''
4135 print('expr_primary_45', list(p
))
4136 # { PExpr*base = $4;
4137 # if (gn_system_verilog()) {
4138 # PECastType*tmp = new PECastType($1, base);
4139 # FILE_NAME(tmp, @1);
4142 # yyerror(@1, "error: Type cast requires SystemVerilog.");
4147 def p_expr_primary_46(p
):
4148 '''expr_primary : assignment_pattern '''
4149 print('expr_primary_46', list(p
))
4152 def p_expr_primary_47(p
):
4153 '''expr_primary : streaming_concatenation '''
4154 print('expr_primary_47', list(p
))
4157 def p_expr_primary_48(p
):
4158 '''expr_primary : K_null '''
4159 print('expr_primary_48', list(p
))
4160 # { PENull*tmp = new PENull;
4161 # FILE_NAME(tmp, @1);
4165 def p_function_item_list_opt_1(p
):
4166 '''function_item_list_opt : function_item_list '''
4167 print('function_item_list_opt_1', list(p
))
4170 def p_function_item_list_opt_2(p
):
4171 '''function_item_list_opt : '''
4172 print('function_item_list_opt_2', list(p
))
4175 def p_function_item_list_1(p
):
4176 '''function_item_list : function_item '''
4177 print('function_item_list_1', list(p
))
4180 def p_function_item_list_2(p
):
4181 '''function_item_list : function_item_list function_item '''
4182 print('function_item_list_2', list(p
))
4185 # vector<pform_tf_port_t>*tmp = $1;
4186 # size_t s1 = tmp->size();
4187 # tmp->resize(s1 + $2->size());
4188 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
4189 # tmp->at(s1+idx) = $2->at(idx);
4199 def p_function_item_1(p
):
4200 '''function_item : tf_port_declaration '''
4201 print('function_item_1', list(p
))
4204 def p_function_item_2(p
):
4205 '''function_item : block_item_decl '''
4206 print('function_item_2', list(p
))
4209 def p_gate_instance_1(p
):
4210 '''gate_instance : IDENTIFIER '(' expression_list_with_nuls ')' '''
4211 print('gate_instance_1', list(p
))
4212 # { lgate*tmp = new lgate;
4215 # tmp->file = @1.text;
4216 # tmp->lineno = @1.first_line;
4221 def p_gate_instance_2(p
):
4222 '''gate_instance : IDENTIFIER dimensions '(' expression_list_with_nuls ')' '''
4223 print('gate_instance_2', list(p
))
4224 # { lgate*tmp = new lgate;
4225 # list<pform_range_t>*rng = $2;
4228 # tmp->range = rng->front();
4230 # assert(rng->empty());
4231 # tmp->file = @1.text;
4232 # tmp->lineno = @1.first_line;
4238 def p_gate_instance_3(p
):
4239 '''gate_instance : '(' expression_list_with_nuls ')' '''
4240 print('gate_instance_3', list(p
))
4241 # { lgate*tmp = new lgate;
4244 # tmp->file = @1.text;
4245 # tmp->lineno = @1.first_line;
4249 def p_gate_instance_4(p
):
4250 '''gate_instance : IDENTIFIER dimensions '''
4251 print('gate_instance_4', list(p
))
4252 # { lgate*tmp = new lgate;
4253 # list<pform_range_t>*rng = $2;
4256 # tmp->parms_by_name = 0;
4257 # tmp->range = rng->front();
4259 # assert(rng->empty());
4260 # tmp->file = @1.text;
4261 # tmp->lineno = @1.first_line;
4267 def p_gate_instance_5(p
):
4268 '''gate_instance : IDENTIFIER '(' port_name_list ')' '''
4269 print('gate_instance_5', list(p
))
4270 # { lgate*tmp = new lgate;
4273 # tmp->parms_by_name = $3;
4274 # tmp->file = @1.text;
4275 # tmp->lineno = @1.first_line;
4280 def p_gate_instance_6(p
):
4281 '''gate_instance : IDENTIFIER dimensions '(' port_name_list ')' '''
4282 print('gate_instance_6', list(p
))
4283 # { lgate*tmp = new lgate;
4284 # list<pform_range_t>*rng = $2;
4287 # tmp->parms_by_name = $4;
4288 # tmp->range = rng->front();
4290 # assert(rng->empty());
4291 # tmp->file = @1.text;
4292 # tmp->lineno = @1.first_line;
4298 def p_gate_instance_7(p
):
4299 '''gate_instance : IDENTIFIER '(' error ')' '''
4300 print('gate_instance_7', list(p
))
4301 # { lgate*tmp = new lgate;
4304 # tmp->parms_by_name = 0;
4305 # tmp->file = @1.text;
4306 # tmp->lineno = @1.first_line;
4307 # yyerror(@2, "error: Syntax error in instance port "
4308 # "expression(s).");
4313 def p_gate_instance_8(p
):
4314 '''gate_instance : IDENTIFIER dimensions '(' error ')' '''
4315 print('gate_instance_8', list(p
))
4316 # { lgate*tmp = new lgate;
4319 # tmp->parms_by_name = 0;
4320 # tmp->file = @1.text;
4321 # tmp->lineno = @1.first_line;
4322 # yyerror(@3, "error: Syntax error in instance port "
4323 # "expression(s).");
4328 def p_gate_instance_list_1(p
):
4329 '''gate_instance_list : gate_instance_list ',' gate_instance '''
4330 print('gate_instance_list_1', list(p
))
4331 # { svector<lgate>*tmp1 = $1;
4333 # svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
4339 def p_gate_instance_list_2(p
):
4340 '''gate_instance_list : gate_instance '''
4341 print('gate_instance_list_2', list(p
))
4342 # { svector<lgate>*tmp = new svector<lgate>(1);
4348 def p_gatetype_1(p
):
4349 '''gatetype : K_and '''
4350 print('gatetype_1', list(p
))
4351 # { $$ = PGBuiltin::AND; }
4353 def p_gatetype_2(p
):
4354 '''gatetype : K_nand '''
4355 print('gatetype_2', list(p
))
4356 # { $$ = PGBuiltin::NAND; }
4358 def p_gatetype_3(p
):
4359 '''gatetype : K_or '''
4360 print('gatetype_3', list(p
))
4361 # { $$ = PGBuiltin::OR; }
4363 def p_gatetype_4(p
):
4364 '''gatetype : K_nor '''
4365 print('gatetype_4', list(p
))
4366 # { $$ = PGBuiltin::NOR; }
4368 def p_gatetype_5(p
):
4369 '''gatetype : K_xor '''
4370 print('gatetype_5', list(p
))
4371 # { $$ = PGBuiltin::XOR; }
4373 def p_gatetype_6(p
):
4374 '''gatetype : K_xnor '''
4375 print('gatetype_6', list(p
))
4376 # { $$ = PGBuiltin::XNOR; }
4378 def p_gatetype_7(p
):
4379 '''gatetype : K_buf '''
4380 print('gatetype_7', list(p
))
4381 # { $$ = PGBuiltin::BUF; }
4383 def p_gatetype_8(p
):
4384 '''gatetype : K_bufif0 '''
4385 print('gatetype_8', list(p
))
4386 # { $$ = PGBuiltin::BUFIF0; }
4388 def p_gatetype_9(p
):
4389 '''gatetype : K_bufif1 '''
4390 print('gatetype_9', list(p
))
4391 # { $$ = PGBuiltin::BUFIF1; }
4393 def p_gatetype_10(p
):
4394 '''gatetype : K_not '''
4395 print('gatetype_10', list(p
))
4396 # { $$ = PGBuiltin::NOT; }
4398 def p_gatetype_11(p
):
4399 '''gatetype : K_notif0 '''
4400 print('gatetype_11', list(p
))
4401 # { $$ = PGBuiltin::NOTIF0; }
4403 def p_gatetype_12(p
):
4404 '''gatetype : K_notif1 '''
4405 print('gatetype_12', list(p
))
4406 # { $$ = PGBuiltin::NOTIF1; }
4408 def p_switchtype_1(p
):
4409 '''switchtype : K_nmos '''
4410 print('switchtype_1', list(p
))
4411 # { $$ = PGBuiltin::NMOS; }
4413 def p_switchtype_2(p
):
4414 '''switchtype : K_rnmos '''
4415 print('switchtype_2', list(p
))
4416 # { $$ = PGBuiltin::RNMOS; }
4418 def p_switchtype_3(p
):
4419 '''switchtype : K_pmos '''
4420 print('switchtype_3', list(p
))
4421 # { $$ = PGBuiltin::PMOS; }
4423 def p_switchtype_4(p
):
4424 '''switchtype : K_rpmos '''
4425 print('switchtype_4', list(p
))
4426 # { $$ = PGBuiltin::RPMOS; }
4428 def p_switchtype_5(p
):
4429 '''switchtype : K_cmos '''
4430 print('switchtype_5', list(p
))
4431 # { $$ = PGBuiltin::CMOS; }
4433 def p_switchtype_6(p
):
4434 '''switchtype : K_rcmos '''
4435 print('switchtype_6', list(p
))
4436 # { $$ = PGBuiltin::RCMOS; }
4438 def p_switchtype_7(p
):
4439 '''switchtype : K_tran '''
4440 print('switchtype_7', list(p
))
4441 # { $$ = PGBuiltin::TRAN; }
4443 def p_switchtype_8(p
):
4444 '''switchtype : K_rtran '''
4445 print('switchtype_8', list(p
))
4446 # { $$ = PGBuiltin::RTRAN; }
4448 def p_switchtype_9(p
):
4449 '''switchtype : K_tranif0 '''
4450 print('switchtype_9', list(p
))
4451 # { $$ = PGBuiltin::TRANIF0; }
4453 def p_switchtype_10(p
):
4454 '''switchtype : K_tranif1 '''
4455 print('switchtype_10', list(p
))
4456 # { $$ = PGBuiltin::TRANIF1; }
4458 def p_switchtype_11(p
):
4459 '''switchtype : K_rtranif0 '''
4460 print('switchtype_11', list(p
))
4461 # { $$ = PGBuiltin::RTRANIF0; }
4463 def p_switchtype_12(p
):
4464 '''switchtype : K_rtranif1 '''
4465 print('switchtype_12', list(p
))
4466 # { $$ = PGBuiltin::RTRANIF1; }
4468 def p_hierarchy_identifier_1(p
):
4469 '''hierarchy_identifier : IDENTIFIER '''
4470 print('hierarchy_identifier_1', list(p
))
4471 lpvalue
= Leaf(token
.NAME
, p
[1])
4473 # { $$ = new pform_name_t;
4474 # $$->push_back(name_component_t(lex_strings.make($1)));
4478 def p_hierarchy_identifier_2(p
):
4479 '''hierarchy_identifier : hierarchy_identifier '.' IDENTIFIER '''
4480 print('hierarchy_identifier_2', list(p
))
4481 # { pform_name_t * tmp = $1;
4482 # tmp->push_back(name_component_t(lex_strings.make($3)));
4487 def p_hierarchy_identifier_3(p
):
4488 '''hierarchy_identifier : hierarchy_identifier '[' expression ']' '''
4489 print('hierarchy_identifier_3', list(p
))
4490 # { pform_name_t * tmp = $1;
4491 # name_component_t&tail = tmp->back();
4492 # index_component_t itmp;
4493 # itmp.sel = index_component_t::SEL_BIT;
4495 # tail.index.push_back(itmp);
4499 def p_hierarchy_identifier_4(p
):
4500 '''hierarchy_identifier : hierarchy_identifier '[' '$' ']' '''
4501 print('hierarchy_identifier_4', list(p
))
4502 # { pform_name_t * tmp = $1;
4503 # name_component_t&tail = tmp->back();
4504 # if (! gn_system_verilog()) {
4505 # yyerror(@3, "error: Last element expression ($) "
4506 # "requires SystemVerilog. Try enabling SystemVerilog.");
4508 # index_component_t itmp;
4509 # itmp.sel = index_component_t::SEL_BIT_LAST;
4512 # tail.index.push_back(itmp);
4516 def p_hierarchy_identifier_5(p
):
4517 '''hierarchy_identifier : hierarchy_identifier '[' expression ':' expression ']' '''
4518 print('hierarchy_identifier_5', list(p
))
4519 # { pform_name_t * tmp = $1;
4520 # name_component_t&tail = tmp->back();
4521 # index_component_t itmp;
4522 # itmp.sel = index_component_t::SEL_PART;
4525 # tail.index.push_back(itmp);
4529 def p_hierarchy_identifier_6(p
):
4530 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_POS expression ']' '''
4531 print('hierarchy_identifier_6', list(p
))
4532 # { pform_name_t * tmp = $1;
4533 # name_component_t&tail = tmp->back();
4534 # index_component_t itmp;
4535 # itmp.sel = index_component_t::SEL_IDX_UP;
4538 # tail.index.push_back(itmp);
4542 def p_hierarchy_identifier_7(p
):
4543 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_NEG expression ']' '''
4544 print('hierarchy_identifier_7', list(p
))
4545 # { pform_name_t * tmp = $1;
4546 # name_component_t&tail = tmp->back();
4547 # index_component_t itmp;
4548 # itmp.sel = index_component_t::SEL_IDX_DO;
4551 # tail.index.push_back(itmp);
4555 def p_list_of_identifiers_1(p
):
4556 '''list_of_identifiers : IDENTIFIER '''
4557 print('list_of_identifiers_1', list(p
))
4558 # { $$ = list_from_identifier($1); }
4560 def p_list_of_identifiers_2(p
):
4561 '''list_of_identifiers : list_of_identifiers ',' IDENTIFIER '''
4562 print('list_of_identifiers_2', list(p
))
4563 # { $$ = list_from_identifier($1, $3); }
4565 def p_list_of_port_identifiers_1(p
):
4566 '''list_of_port_identifiers : IDENTIFIER dimensions_opt '''
4567 print('list_of_port_identifiers_1', list(p
))
4568 # { $$ = make_port_list($1, $2, 0); }
4570 def p_list_of_port_identifiers_2(p
):
4571 '''list_of_port_identifiers : list_of_port_identifiers ',' IDENTIFIER dimensions_opt '''
4572 print('list_of_port_identifiers_2', list(p
))
4573 # { $$ = make_port_list($1, $3, $4, 0); }
4575 def p_list_of_variable_port_identifiers_1(p
):
4576 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '''
4577 print('list_of_variable_port_identifiers_1', list(p
))
4578 # { $$ = make_port_list($1, $2, 0); }
4580 def p_list_of_variable_port_identifiers_2(p
):
4581 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '=' expression '''
4582 print('list_of_variable_port_identifiers_2', list(p
))
4583 # { $$ = make_port_list($1, $2, $4); }
4585 def p_list_of_variable_port_identifiers_3(p
):
4586 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '''
4587 print('list_of_variable_port_identifiers_3', list(p
))
4588 # { $$ = make_port_list($1, $3, $4, 0); }
4590 def p_list_of_variable_port_identifiers_4(p
):
4591 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '=' expression '''
4592 print('list_of_variable_port_identifiers_4', list(p
))
4593 # { $$ = make_port_list($1, $3, $4, $6); }
4595 def p_list_of_ports_1(p
):
4596 '''list_of_ports : port_opt '''
4597 print('list_of_ports_1', list(p
))
4598 # { vector<Module::port_t*>*tmp
4599 # = new vector<Module::port_t*>(1);
4604 def p_list_of_ports_2(p
):
4605 '''list_of_ports : list_of_ports ',' port_opt '''
4606 print('list_of_ports_2', list(p
))
4607 # { vector<Module::port_t*>*tmp = $1;
4608 # tmp->push_back($3);
4612 def p_list_of_port_declarations_1(p
):
4613 '''list_of_port_declarations : port_declaration '''
4614 print('list_of_port_declarations_1', list(p
))
4615 # { vector<Module::port_t*>*tmp
4616 # = new vector<Module::port_t*>(1);
4621 def p_list_of_port_declarations_2(p
):
4622 '''list_of_port_declarations : list_of_port_declarations ',' port_declaration '''
4623 print('list_of_port_declarations_2', list(p
))
4624 # { vector<Module::port_t*>*tmp = $1;
4625 # tmp->push_back($3);
4629 def p_list_of_port_declarations_3(p
):
4630 '''list_of_port_declarations : list_of_port_declarations ',' IDENTIFIER '''
4631 print('list_of_port_declarations_3', list(p
))
4632 # { Module::port_t*ptmp;
4633 # perm_string name = lex_strings.make($3);
4634 # ptmp = pform_module_port_reference(name, @3.text,
4636 # vector<Module::port_t*>*tmp = $1;
4637 # tmp->push_back(ptmp);
4639 # /* Get the port declaration details, the port type
4640 # and what not, from context data stored by the
4641 # last port_declaration rule. */
4642 # pform_module_define_port(@3, name,
4643 # port_declaration_context.port_type,
4644 # port_declaration_context.port_net_type,
4645 # port_declaration_context.data_type, 0);
4650 def p_list_of_port_declarations_4(p
):
4651 '''list_of_port_declarations : list_of_port_declarations ',' '''
4652 print('list_of_port_declarations_4', list(p
))
4654 # yyerror(@2, "error: NULL port declarations are not "
4658 def p_list_of_port_declarations_5(p
):
4659 '''list_of_port_declarations : list_of_port_declarations ';' '''
4660 print('list_of_port_declarations_5', list(p
))
4662 # yyerror(@2, "error: ';' is an invalid port declaration "
4666 def p_port_declaration_1(p
):
4667 '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4668 print('port_declaration_1', list(p
))
4669 # { Module::port_t*ptmp;
4670 # perm_string name = lex_strings.make($5);
4671 # data_type_t*use_type = $4;
4672 # if ($6) use_type = new uarray_type_t(use_type, $6);
4673 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4674 # pform_module_define_port(@2, name, NetNet::PINPUT, $3, use_type, $1);
4675 # port_declaration_context.port_type = NetNet::PINPUT;
4676 # port_declaration_context.port_net_type = $3;
4677 # port_declaration_context.data_type = $4;
4682 def p_port_declaration_2(p
):
4683 '''port_declaration : attribute_list_opt K_input K_wreal IDENTIFIER '''
4684 print('port_declaration_2', list(p
))
4685 # { Module::port_t*ptmp;
4686 # perm_string name = lex_strings.make($4);
4687 # ptmp = pform_module_port_reference(name, @2.text,
4689 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4690 # FILE_NAME(real_type, @3);
4691 # pform_module_define_port(@2, name, NetNet::PINPUT,
4692 # NetNet::WIRE, real_type, $1);
4693 # port_declaration_context.port_type = NetNet::PINPUT;
4694 # port_declaration_context.port_net_type = NetNet::WIRE;
4695 # port_declaration_context.data_type = real_type;
4700 def p_port_declaration_3(p
):
4701 '''port_declaration : attribute_list_opt K_inout net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4702 print('port_declaration_3', list(p
))
4703 # { Module::port_t*ptmp;
4704 # perm_string name = lex_strings.make($5);
4705 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4706 # pform_module_define_port(@2, name, NetNet::PINOUT, $3, $4, $1);
4707 # port_declaration_context.port_type = NetNet::PINOUT;
4708 # port_declaration_context.port_net_type = $3;
4709 # port_declaration_context.data_type = $4;
4712 # yyerror(@6, "sorry: Inout ports with unpacked dimensions not supported.");
4718 def p_port_declaration_4(p
):
4719 '''port_declaration : attribute_list_opt K_inout K_wreal IDENTIFIER '''
4720 print('port_declaration_4', list(p
))
4721 # { Module::port_t*ptmp;
4722 # perm_string name = lex_strings.make($4);
4723 # ptmp = pform_module_port_reference(name, @2.text,
4725 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4726 # FILE_NAME(real_type, @3);
4727 # pform_module_define_port(@2, name, NetNet::PINOUT,
4728 # NetNet::WIRE, real_type, $1);
4729 # port_declaration_context.port_type = NetNet::PINOUT;
4730 # port_declaration_context.port_net_type = NetNet::WIRE;
4731 # port_declaration_context.data_type = real_type;
4736 def p_port_declaration_5(p
):
4737 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4738 print('port_declaration_5', list(p
))
4739 # { Module::port_t*ptmp;
4740 # perm_string name = lex_strings.make($5);
4741 # data_type_t*use_dtype = $4;
4742 # if ($6) use_dtype = new uarray_type_t(use_dtype, $6);
4743 # NetNet::Type use_type = $3;
4744 # if (use_type == NetNet::IMPLICIT) {
4745 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($4)) {
4746 # if (dtype->reg_flag)
4747 # use_type = NetNet::REG;
4748 # else if (dtype->implicit_flag)
4749 # use_type = NetNet::IMPLICIT;
4751 # use_type = NetNet::IMPLICIT_REG;
4753 # // The SystemVerilog types that can show up as
4754 # // output ports are implicitly (on the inside)
4755 # // variables because "reg" is not valid syntax
4757 # } else if (dynamic_cast<atom2_type_t*> ($4)) {
4758 # use_type = NetNet::IMPLICIT_REG;
4759 # } else if (dynamic_cast<struct_type_t*> ($4)) {
4760 # use_type = NetNet::IMPLICIT_REG;
4761 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> ($4)) {
4762 # if(etype->base_type == IVL_VT_LOGIC)
4763 # use_type = NetNet::IMPLICIT_REG;
4766 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4767 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, use_dtype, $1);
4768 # port_declaration_context.port_type = NetNet::POUTPUT;
4769 # port_declaration_context.port_net_type = use_type;
4770 # port_declaration_context.data_type = $4;
4775 def p_port_declaration_6(p
):
4776 '''port_declaration : attribute_list_opt K_output K_wreal IDENTIFIER '''
4777 print('port_declaration_6', list(p
))
4778 # { Module::port_t*ptmp;
4779 # perm_string name = lex_strings.make($4);
4780 # ptmp = pform_module_port_reference(name, @2.text,
4782 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4783 # FILE_NAME(real_type, @3);
4784 # pform_module_define_port(@2, name, NetNet::POUTPUT,
4785 # NetNet::WIRE, real_type, $1);
4786 # port_declaration_context.port_type = NetNet::POUTPUT;
4787 # port_declaration_context.port_net_type = NetNet::WIRE;
4788 # port_declaration_context.data_type = real_type;
4793 def p_port_declaration_7(p
):
4794 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER '=' expression '''
4795 print('port_declaration_7', list(p
))
4796 # { Module::port_t*ptmp;
4797 # perm_string name = lex_strings.make($5);
4798 # NetNet::Type use_type = $3;
4799 # if (use_type == NetNet::IMPLICIT) {
4800 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($4)) {
4801 # if (dtype->reg_flag)
4802 # use_type = NetNet::REG;
4804 # use_type = NetNet::IMPLICIT_REG;
4806 # use_type = NetNet::IMPLICIT_REG;
4809 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4810 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, $4, $1);
4811 # port_declaration_context.port_type = NetNet::PINOUT;
4812 # port_declaration_context.port_net_type = use_type;
4813 # port_declaration_context.data_type = $4;
4815 # pform_make_var_init(@5, name, $7);
4821 def p_net_type_opt_1(p
):
4822 '''net_type_opt : net_type '''
4823 print('net_type_opt_1', list(p
))
4826 def p_net_type_opt_2(p
):
4827 '''net_type_opt : '''
4828 print('net_type_opt_2', list(p
))
4829 # { $$ = NetNet::IMPLICIT; }
4831 def p_unsigned_signed_opt_1(p
):
4832 '''unsigned_signed_opt : K_signed '''
4833 print('unsigned_signed_opt_1', list(p
))
4836 def p_unsigned_signed_opt_2(p
):
4837 '''unsigned_signed_opt : K_unsigned '''
4838 print('unsigned_signed_opt_2', list(p
))
4841 def p_unsigned_signed_opt_3(p
):
4842 '''unsigned_signed_opt : '''
4843 print('unsigned_signed_opt_3', list(p
))
4846 def p_signed_unsigned_opt_1(p
):
4847 '''signed_unsigned_opt : K_signed '''
4848 print('signed_unsigned_opt_1', list(p
))
4851 def p_signed_unsigned_opt_2(p
):
4852 '''signed_unsigned_opt : K_unsigned '''
4853 print('signed_unsigned_opt_2', list(p
))
4856 def p_signed_unsigned_opt_3(p
):
4857 '''signed_unsigned_opt : '''
4858 print('signed_unsigned_opt_3', list(p
))
4861 def p_atom2_type_1(p
):
4862 '''atom2_type : K_byte '''
4863 print('atom2_type_1', list(p
))
4866 def p_atom2_type_2(p
):
4867 '''atom2_type : K_shortint '''
4868 print('atom2_type_2', list(p
))
4871 def p_atom2_type_3(p
):
4872 '''atom2_type : K_int '''
4873 print('atom2_type_3', list(p
))
4876 def p_atom2_type_4(p
):
4877 '''atom2_type : K_longint '''
4878 print('atom2_type_4', list(p
))
4882 '''lpvalue : hierarchy_identifier '''
4883 print('lpvalue_1', list(p
))
4885 # { PEIdent*tmp = pform_new_ident(*$1);
4886 # FILE_NAME(tmp, @1);
4892 '''lpvalue : implicit_class_handle '.' hierarchy_identifier '''
4893 print('lpvalue_2', list(p
))
4894 # { pform_name_t*t_name = $1;
4895 # while (!$3->empty()) {
4896 # t_name->push_back($3->front());
4899 # PEIdent*tmp = new PEIdent(*t_name);
4900 # FILE_NAME(tmp, @1);
4907 '''lpvalue : '{' expression_list_proper '}' '''
4908 print('lpvalue_3', list(p
))
4909 # { PEConcat*tmp = new PEConcat(*$2);
4910 # FILE_NAME(tmp, @1);
4916 '''lpvalue : streaming_concatenation '''
4917 print('lpvalue_4', list(p
))
4918 # { yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
4922 def p_cont_assign_1(p
):
4923 '''cont_assign : lpvalue '=' expression '''
4924 print('cont_assign_1', list(p
))
4925 # { list<PExpr*>*tmp = new list<PExpr*>;
4926 # tmp->push_back($1);
4927 # tmp->push_back($3);
4931 def p_cont_assign_list_1(p
):
4932 '''cont_assign_list : cont_assign_list ',' cont_assign '''
4933 print('cont_assign_list_1', list(p
))
4934 # { list<PExpr*>*tmp = $1;
4935 # tmp->splice(tmp->end(), *$3);
4940 def p_cont_assign_list_2(p
):
4941 '''cont_assign_list : cont_assign '''
4942 print('cont_assign_list_2', list(p
))
4946 '''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 '''
4947 print('module_1', list(p
))
4948 clsname
= [Leaf(token
.NAME
, 'class'),
4949 Leaf(token
.NAME
, p
[4], prefix
=' '),
4950 Leaf(token
.COLON
, ':')]
4951 stmt
= Node(syms
.pass_stmt
, [Leaf(token
.NAME
, "pass"),])
4952 stmts
= Node(syms
.small_stmt
, [stmt
, Leaf(token
.NEWLINE
, '\n')])
4953 stmts
= Node(syms
.stmt
, [stmts
])
4954 suite
= Node(syms
.suite
, [Leaf(token
.NEWLINE
, '\n'),
4955 Leaf(token
.INDENT
, ' '),
4957 Leaf(token
.DEDENT
, '')
4959 clsdecl
= Node(syms
.classdef
, clsname
+ [suite
],
4960 prefix
='', fixers_applied
=[])
4961 clsdecl
= Node(syms
.compound_stmt
, [clsdecl
])
4962 print ("clsdecl", repr(clsdecl
))
4964 print (str(clsdecl
))
4966 # { // Last step: check any closing name. This is done late so
4967 # // that the parser can look ahead to detect the present
4968 # // endlabel_opt but still have the pform_endmodule() called
4969 # // early enough that the lexor can know we are outside the
4972 # if (strcmp($4,$17) != 0) {
4975 # yyerror(@17, "error: End label doesn't match "
4979 # yyerror(@17, "error: End label doesn't match "
4983 # yyerror(@17, "error: End label doesn't match "
4984 # "interface name.");
4990 # if (($2 == K_module) && (! gn_system_verilog())) {
4991 # yyerror(@8, "error: Module end labels require "
4992 # "SystemVerilog.");
4999 def p__embed0_module(p
):
5000 '''_embed0_module : '''
5001 # { pform_startmodule(@2, $4, $2==K_program, $2==K_interface, $3, $1); }
5003 def p__embed1_module(p
):
5004 '''_embed1_module : '''
5005 # { pform_module_set_ports($8); }
5007 def p__embed2_module(p
):
5008 '''_embed2_module : '''
5009 # { pform_set_scope_timescale(@2); }
5011 def p__embed3_module(p
):
5012 '''_embed3_module : '''
5013 # { Module::UCDriveType ucd;
5014 # // The lexor detected `unconnected_drive directives and
5015 # // marked what it found in the uc_drive variable. Use that
5016 # // to generate a UCD flag for the module.
5017 # switch (uc_drive) {
5020 # ucd = Module::UCD_NONE;
5023 # ucd = Module::UCD_PULL0;
5026 # ucd = Module::UCD_PULL1;
5029 # // Check that program/endprogram and module/endmodule
5030 # // keywords match.
5034 # yyerror(@15, "error: module not closed by endmodule.");
5037 # yyerror(@15, "error: program not closed by endprogram.");
5040 # yyerror(@15, "error: interface not closed by endinterface.");
5046 # pform_endmodule($4, in_celldefine, ucd);
5049 def p_module_start_1(p
):
5050 '''module_start : K_module '''
5051 print('module_start_1', list(p
))
5052 # { $$ = K_module; }
5054 def p_module_start_2(p
):
5055 '''module_start : K_macromodule '''
5056 print('module_start_2', list(p
))
5057 # { $$ = K_module; }
5059 def p_module_start_3(p
):
5060 '''module_start : K_program '''
5061 print('module_start_3', list(p
))
5062 # { $$ = K_program; }
5064 def p_module_start_4(p
):
5065 '''module_start : K_interface '''
5066 print('module_start_4', list(p
))
5067 # { $$ = K_interface; }
5069 def p_module_end_1(p
):
5070 '''module_end : K_endmodule '''
5071 print('module_end_1', list(p
))
5072 # { $$ = K_module; }
5074 def p_module_end_2(p
):
5075 '''module_end : K_endprogram '''
5076 print('module_end_2', list(p
))
5077 # { $$ = K_program; }
5079 def p_module_end_3(p
):
5080 '''module_end : K_endinterface '''
5081 print('module_end_3', list(p
))
5082 # { $$ = K_interface; }
5084 def p_endlabel_opt_1(p
):
5085 '''endlabel_opt : ':' IDENTIFIER '''
5086 print('endlabel_opt_1', list(p
))
5089 def p_endlabel_opt_2(p
):
5090 '''endlabel_opt : '''
5091 print('endlabel_opt_2', list(p
))
5094 def p_module_attribute_foreign_1(p
):
5095 '''module_attribute_foreign : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP '''
5096 print('module_attribute_foreign_1', list(p
))
5099 def p_module_attribute_foreign_2(p
):
5100 '''module_attribute_foreign : '''
5101 print('module_attribute_foreign_2', list(p
))
5104 def p_module_port_list_opt_1(p
):
5105 '''module_port_list_opt : '(' list_of_ports ')' '''
5106 print('module_port_list_opt_1', list(p
))
5109 def p_module_port_list_opt_2(p
):
5110 '''module_port_list_opt : '(' list_of_port_declarations ')' '''
5111 print('module_port_list_opt_2', list(p
))
5114 def p_module_port_list_opt_3(p
):
5115 '''module_port_list_opt : '''
5116 print('module_port_list_opt_3', list(p
))
5119 def p_module_port_list_opt_4(p
):
5120 '''module_port_list_opt : '(' error ')' '''
5121 print('module_port_list_opt_4', list(p
))
5122 # { yyerror(@2, "Errors in port declarations.");
5127 def p_module_parameter_port_list_opt_1(p
):
5128 '''module_parameter_port_list_opt : '''
5129 print('module_parameter_port_list_opt_1', list(p
))
5131 def p_module_parameter_port_list_opt_2(p
):
5132 '''module_parameter_port_list_opt : '#' '(' module_parameter_port_list ')' '''
5133 print('module_parameter_port_list_opt_2', list(p
))
5136 def p_module_parameter_port_list_1(p
):
5137 '''module_parameter_port_list : K_parameter param_type parameter_assign '''
5138 print('module_parameter_port_list_1', list(p
))
5141 def p_module_parameter_port_list_2(p
):
5142 '''module_parameter_port_list : module_parameter_port_list ',' parameter_assign '''
5143 print('module_parameter_port_list_2', list(p
))
5144 p
[0] = p
[1].append(p
[3])
5146 def p_module_parameter_port_list_3(p
):
5147 '''module_parameter_port_list : module_parameter_port_list ',' K_parameter param_type parameter_assign '''
5148 print('module_parameter_port_list_3', list(p
))
5152 def p_module_item_1(p
):
5153 '''module_item : module '''
5154 print('module_item_1', list(p
))
5156 def p_module_item_2(p
):
5157 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' '''
5158 print('module_item_2', list(p
))
5159 # { data_type_t*data_type = $3;
5160 # if (data_type == 0) {
5161 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5162 # FILE_NAME(data_type, @2);
5164 # pform_set_data_type(@2, data_type, $5, $2, $1);
5166 # yyerror(@2, "sorry: net delays not supported.");
5172 def p_module_item_3(p
):
5173 '''module_item : attribute_list_opt K_wreal delay3 net_variable_list ';' '''
5174 print('module_item_3', list(p
))
5175 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5176 # pform_set_data_type(@2, tmpt, $4, NetNet::WIRE, $1);
5178 # yyerror(@3, "sorry: net delays not supported.");
5184 def p_module_item_4(p
):
5185 '''module_item : attribute_list_opt K_wreal net_variable_list ';' '''
5186 print('module_item_4', list(p
))
5187 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5188 # pform_set_data_type(@2, tmpt, $3, NetNet::WIRE, $1);
5192 def p_module_item_5(p
):
5193 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_decl_assigns ';' '''
5194 print('module_item_5', list(p
))
5195 # { data_type_t*data_type = $3;
5196 # if (data_type == 0) {
5197 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5198 # FILE_NAME(data_type, @2);
5200 # pform_makewire(@2, $4, str_strength, $5, $2, data_type);
5202 # yywarn(@2, "Attributes are not supported on net declaration "
5203 # "assignments and will be discarded.");
5208 def p_module_item_6(p
):
5209 '''module_item : attribute_list_opt net_type data_type_or_implicit drive_strength net_decl_assigns ';' '''
5210 print('module_item_6', list(p
))
5211 # { data_type_t*data_type = $3;
5212 # if (data_type == 0) {
5213 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5214 # FILE_NAME(data_type, @2);
5216 # pform_makewire(@2, 0, $4, $5, $2, data_type);
5218 # yywarn(@2, "Attributes are not supported on net declaration "
5219 # "assignments and will be discarded.");
5224 def p_module_item_7(p
):
5225 '''module_item : attribute_list_opt K_wreal net_decl_assigns ';' '''
5226 print('module_item_7', list(p
))
5227 # { real_type_t*data_type = new real_type_t(real_type_t::REAL);
5228 # pform_makewire(@2, 0, str_strength, $3, NetNet::WIRE, data_type);
5230 # yywarn(@2, "Attributes are not supported on net declaration "
5231 # "assignments and will be discarded.");
5236 def p_module_item_8(p
):
5237 '''module_item : K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' '''
5238 print('module_item_8', list(p
))
5239 # { yyerror(@1, "sorry: trireg nets not supported.");
5244 def p_module_item_9(p
):
5245 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit list_of_port_identifiers ';' '''
5246 print('module_item_9', list(p
))
5247 # { pform_module_define_port(@2, $5, $2, $3, $4, $1); }
5249 def p_module_item_10(p
):
5250 '''module_item : attribute_list_opt port_direction K_wreal list_of_port_identifiers ';' '''
5251 print('module_item_10', list(p
))
5252 # { real_type_t*real_type = new real_type_t(real_type_t::REAL);
5253 # pform_module_define_port(@2, $4, $2, NetNet::WIRE, real_type, $1);
5256 def p_module_item_11(p
):
5257 '''module_item : attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' '''
5258 print('module_item_11', list(p
))
5259 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5260 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5261 # if (dtype->implicit_flag)
5262 # use_type = NetNet::NONE;
5264 # if (use_type == NetNet::NONE)
5265 # pform_set_port_type(@2, $4, NetNet::PINOUT, $3, $1);
5267 # pform_module_define_port(@2, $4, NetNet::PINOUT, use_type, $3, $1);
5270 def p_module_item_12(p
):
5271 '''module_item : attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' '''
5272 print('module_item_12', list(p
))
5273 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5274 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5275 # if (dtype->implicit_flag)
5276 # use_type = NetNet::NONE;
5278 # if (use_type == NetNet::NONE)
5279 # pform_set_port_type(@2, $4, NetNet::PINPUT, $3, $1);
5281 # pform_module_define_port(@2, $4, NetNet::PINPUT, use_type, $3, $1);
5284 def p_module_item_13(p
):
5285 '''module_item : attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' '''
5286 print('module_item_13', list(p
))
5287 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5288 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5289 # if (dtype->implicit_flag)
5290 # use_type = NetNet::NONE;
5291 # else if (dtype->reg_flag)
5292 # use_type = NetNet::REG;
5294 # use_type = NetNet::IMPLICIT_REG;
5296 # // The SystemVerilog types that can show up as
5297 # // output ports are implicitly (on the inside)
5298 # // variables because "reg" is not valid syntax
5300 # } else if (dynamic_cast<atom2_type_t*> ($3)) {
5301 # use_type = NetNet::IMPLICIT_REG;
5302 # } else if (dynamic_cast<struct_type_t*> ($3)) {
5303 # use_type = NetNet::IMPLICIT_REG;
5304 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> ($3)) {
5305 # if(etype->base_type == IVL_VT_LOGIC)
5306 # use_type = NetNet::IMPLICIT_REG;
5308 # if (use_type == NetNet::NONE)
5309 # pform_set_port_type(@2, $4, NetNet::POUTPUT, $3, $1);
5311 # pform_module_define_port(@2, $4, NetNet::POUTPUT, use_type, $3, $1);
5314 def p_module_item_14(p
):
5315 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit error ';' '''
5316 print('module_item_14', list(p
))
5317 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5318 # if ($1) delete $1;
5319 # if ($4) delete $4;
5323 def p_module_item_15(p
):
5324 '''module_item : attribute_list_opt K_inout data_type_or_implicit error ';' '''
5325 print('module_item_15', list(p
))
5326 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5327 # if ($1) delete $1;
5328 # if ($3) delete $3;
5332 def p_module_item_16(p
):
5333 '''module_item : attribute_list_opt K_input data_type_or_implicit error ';' '''
5334 print('module_item_16', list(p
))
5335 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5336 # if ($1) delete $1;
5337 # if ($3) delete $3;
5341 def p_module_item_17(p
):
5342 '''module_item : attribute_list_opt K_output data_type_or_implicit error ';' '''
5343 print('module_item_17', list(p
))
5344 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5345 # if ($1) delete $1;
5346 # if ($3) delete $3;
5350 def p_module_item_18(p
):
5351 '''module_item : DISCIPLINE_IDENTIFIER list_of_identifiers ';' '''
5352 print('module_item_18', list(p
))
5353 # { pform_attach_discipline(@1, $1, $2); }
5355 def p_module_item_19(p
):
5356 '''module_item : attribute_list_opt _embed0_module_item block_item_decl '''
5357 print('module_item_19', list(p
))
5358 # { delete attributes_in_context;
5359 # attributes_in_context = 0;
5362 def p_module_item_20(p
):
5363 '''module_item : K_defparam _embed1_module_item defparam_assign_list ';' '''
5364 print('module_item_20', list(p
))
5366 def p_module_item_21(p
):
5367 '''module_item : attribute_list_opt gatetype gate_instance_list ';' '''
5368 print('module_item_21', list(p
))
5369 # { pform_makegates(@2, $2, str_strength, 0, $3, $1); }
5371 def p_module_item_22(p
):
5372 '''module_item : attribute_list_opt gatetype delay3 gate_instance_list ';' '''
5373 print('module_item_22', list(p
))
5374 # { pform_makegates(@2, $2, str_strength, $3, $4, $1); }
5376 def p_module_item_23(p
):
5377 '''module_item : attribute_list_opt gatetype drive_strength gate_instance_list ';' '''
5378 print('module_item_23', list(p
))
5379 # { pform_makegates(@2, $2, $3, 0, $4, $1); }
5381 def p_module_item_24(p
):
5382 '''module_item : attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';' '''
5383 print('module_item_24', list(p
))
5384 # { pform_makegates(@2, $2, $3, $4, $5, $1); }
5386 def p_module_item_25(p
):
5387 '''module_item : attribute_list_opt switchtype gate_instance_list ';' '''
5388 print('module_item_25', list(p
))
5389 # { pform_makegates(@2, $2, str_strength, 0, $3, $1); }
5391 def p_module_item_26(p
):
5392 '''module_item : attribute_list_opt switchtype delay3 gate_instance_list ';' '''
5393 print('module_item_26', list(p
))
5394 # { pform_makegates(@2, $2, str_strength, $3, $4, $1); }
5396 def p_module_item_27(p
):
5397 '''module_item : K_pullup gate_instance_list ';' '''
5398 print('module_item_27', list(p
))
5399 # { pform_makegates(@1, PGBuiltin::PULLUP, pull_strength, 0, $2, 0); }
5401 def p_module_item_28(p
):
5402 '''module_item : K_pulldown gate_instance_list ';' '''
5403 print('module_item_28', list(p
))
5404 # { pform_makegates(@1, PGBuiltin::PULLDOWN, pull_strength, 0, $2, 0); }
5406 def p_module_item_29(p
):
5407 '''module_item : K_pullup '(' dr_strength1 ')' gate_instance_list ';' '''
5408 print('module_item_29', list(p
))
5409 # { pform_makegates(@1, PGBuiltin::PULLUP, $3, 0, $5, 0); }
5411 def p_module_item_30(p
):
5412 '''module_item : K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5413 print('module_item_30', list(p
))
5414 # { pform_makegates(@1, PGBuiltin::PULLUP, $3, 0, $7, 0); }
5416 def p_module_item_31(p
):
5417 '''module_item : K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5418 print('module_item_31', list(p
))
5419 # { pform_makegates(@1, PGBuiltin::PULLUP, $5, 0, $7, 0); }
5421 def p_module_item_32(p
):
5422 '''module_item : K_pulldown '(' dr_strength0 ')' gate_instance_list ';' '''
5423 print('module_item_32', list(p
))
5424 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $3, 0, $5, 0); }
5426 def p_module_item_33(p
):
5427 '''module_item : K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5428 print('module_item_33', list(p
))
5429 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $5, 0, $7, 0); }
5431 def p_module_item_34(p
):
5432 '''module_item : K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5433 print('module_item_34', list(p
))
5434 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $3, 0, $7, 0); }
5436 def p_module_item_35(p
):
5437 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' '''
5438 print('module_item_35', list(p
))
5439 # { perm_string tmp1 = lex_strings.make($2);
5440 # pform_make_modgates(@2, tmp1, $3, $4, $1);
5444 def p_module_item_36(p
):
5445 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt error ';' '''
5446 print('module_item_36', list(p
))
5447 # { yyerror(@2, "error: Invalid module instantiation");
5449 # if ($1) delete $1;
5452 def p_module_item_37(p
):
5453 '''module_item : K_assign drive_strength_opt delay3_opt cont_assign_list ';' '''
5454 print('module_item_37', list(p
))
5455 # { pform_make_pgassign_list($4, $3, $2, @1.text, @1.first_line); }
5457 def p_module_item_38(p
):
5458 '''module_item : attribute_list_opt K_always statement_item '''
5459 print('module_item_38', list(p
))
5460 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, $3, $1);
5461 # FILE_NAME(tmp, @2);
5464 def p_module_item_39(p
):
5465 '''module_item : attribute_list_opt K_always_comb statement_item '''
5466 print('module_item_39', list(p
))
5467 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_COMB, $3, $1);
5468 # FILE_NAME(tmp, @2);
5471 def p_module_item_40(p
):
5472 '''module_item : attribute_list_opt K_always_ff statement_item '''
5473 print('module_item_40', list(p
))
5474 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, $3, $1);
5475 # FILE_NAME(tmp, @2);
5478 def p_module_item_41(p
):
5479 '''module_item : attribute_list_opt K_always_latch statement_item '''
5480 print('module_item_41', list(p
))
5481 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_LATCH, $3, $1);
5482 # FILE_NAME(tmp, @2);
5485 def p_module_item_42(p
):
5486 '''module_item : attribute_list_opt K_initial statement_item '''
5487 print('module_item_42', list(p
))
5488 # { PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, $3, $1);
5489 # FILE_NAME(tmp, @2);
5492 def p_module_item_43(p
):
5493 '''module_item : attribute_list_opt K_final statement_item '''
5494 print('module_item_43', list(p
))
5495 # { PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, $3, $1);
5496 # FILE_NAME(tmp, @2);
5499 def p_module_item_44(p
):
5500 '''module_item : attribute_list_opt K_analog analog_statement '''
5501 print('module_item_44', list(p
))
5502 # { pform_make_analog_behavior(@2, IVL_PR_ALWAYS, $3); }
5504 def p_module_item_45(p
):
5505 '''module_item : attribute_list_opt assertion_item '''
5506 print('module_item_45', list(p
))
5508 def p_module_item_46(p
):
5509 '''module_item : timeunits_declaration '''
5510 print('module_item_46', list(p
))
5512 def p_module_item_47(p
):
5513 '''module_item : class_declaration '''
5514 print('module_item_47', list(p
))
5516 def p_module_item_48(p
):
5517 '''module_item : task_declaration '''
5518 print('module_item_48', list(p
))
5520 def p_module_item_49(p
):
5521 '''module_item : function_declaration '''
5522 print('module_item_49', list(p
))
5524 def p_module_item_50(p
):
5525 '''module_item : K_generate generate_item_list_opt K_endgenerate '''
5526 print('module_item_50', list(p
))
5527 # { // Test for bad nesting. I understand it, but it is illegal.
5528 # if (pform_parent_generate()) {
5529 # cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
5530 # cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
5531 # cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
5536 def p_module_item_51(p
):
5537 '''module_item : K_genvar list_of_identifiers ';' '''
5538 print('module_item_51', list(p
))
5539 # { pform_genvars(@1, $2); }
5541 def p_module_item_52(p
):
5542 '''module_item : K_for '(' IDENTIFIER '=' expression ';' expression ';' IDENTIFIER '=' expression ')' _embed2_module_item generate_block '''
5543 print('module_item_52', list(p
))
5544 # { pform_endgenerate(); }
5546 def p_module_item_53(p
):
5547 '''module_item : generate_if generate_block_opt K_else _embed3_module_item generate_block '''
5548 print('module_item_53', list(p
))
5549 # { pform_endgenerate(); }
5551 def p_module_item_54(p
):
5552 '''module_item : generate_if generate_block_opt %prec less_than_K_else '''
5553 print('module_item_54', list(p
))
5554 # { pform_endgenerate(); }
5556 def p_module_item_55(p
):
5557 '''module_item : K_case '(' expression ')' _embed4_module_item generate_case_items K_endcase '''
5558 print('module_item_55', list(p
))
5559 # { pform_endgenerate(); }
5561 def p_module_item_56(p
):
5562 '''module_item : modport_declaration '''
5563 print('module_item_56', list(p
))
5565 def p_module_item_57(p
):
5566 '''module_item : package_import_declaration '''
5567 print('module_item_57', list(p
))
5569 def p_module_item_58(p
):
5570 '''module_item : attribute_list_opt K_specparam _embed5_module_item specparam_decl ';' '''
5571 print('module_item_58', list(p
))
5573 def p_module_item_59(p
):
5574 '''module_item : K_specify _embed6_module_item specify_item_list_opt K_endspecify '''
5575 print('module_item_59', list(p
))
5577 def p_module_item_60(p
):
5578 '''module_item : K_specify error K_endspecify '''
5579 print('module_item_60', list(p
))
5580 # { yyerror(@1, "error: syntax error in specify block");
5584 def p_module_item_61(p
):
5585 '''module_item : error ';' '''
5586 print('module_item_61', list(p
))
5587 # { yyerror(@2, "error: invalid module item.");
5591 def p_module_item_62(p
):
5592 '''module_item : K_assign error '=' expression ';' '''
5593 print('module_item_62', list(p
))
5594 # { yyerror(@1, "error: syntax error in left side "
5595 # "of continuous assignment.");
5599 def p_module_item_63(p
):
5600 '''module_item : K_assign error ';' '''
5601 print('module_item_63', list(p
))
5602 # { yyerror(@1, "error: syntax error in "
5603 # "continuous assignment");
5607 def p_module_item_64(p
):
5608 '''module_item : K_function error K_endfunction endlabel_opt '''
5609 print('module_item_64', list(p
))
5610 # { yyerror(@1, "error: I give up on this "
5611 # "function definition.");
5613 # if (!gn_system_verilog()) {
5614 # yyerror(@4, "error: Function end names require "
5615 # "SystemVerilog.");
5622 def p_module_item_65(p
):
5623 '''module_item : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';' '''
5624 print('module_item_65', list(p
))
5625 # { perm_string tmp3 = lex_strings.make($3);
5626 # perm_string tmp5 = lex_strings.make($5);
5627 # pform_set_attrib(tmp3, tmp5, $7);
5632 def p_module_item_66(p
):
5633 '''module_item : KK_attribute '(' error ')' ';' '''
5634 print('module_item_66', list(p
))
5635 # { yyerror(@1, "error: Malformed $attribute parameter list."); }
5637 def p__embed0_module_item(p
):
5638 '''_embed0_module_item : '''
5639 # { attributes_in_context = $1; }
5641 def p__embed1_module_item(p
):
5642 '''_embed1_module_item : '''
5643 # { if (pform_in_interface())
5644 # yyerror(@1, "error: Parameter overrides are not allowed "
5645 # "in interfaces.");
5648 def p__embed2_module_item(p
):
5649 '''_embed2_module_item : '''
5650 # { pform_start_generate_for(@1, $3, $5, $7, $9, $11); }
5652 def p__embed3_module_item(p
):
5653 '''_embed3_module_item : '''
5654 # { pform_start_generate_else(@1); }
5656 def p__embed4_module_item(p
):
5657 '''_embed4_module_item : '''
5658 # { pform_start_generate_case(@1, $3); }
5660 def p__embed5_module_item(p
):
5661 '''_embed5_module_item : '''
5662 # { if (pform_in_interface())
5663 # yyerror(@1, "error: specparam declarations are not allowed "
5664 # "in interfaces.");
5667 def p__embed6_module_item(p
):
5668 '''_embed6_module_item : '''
5669 # { if (pform_in_interface())
5670 # yyerror(@1, "error: specify blocks are not allowed "
5671 # "in interfaces.");
5674 def p_module_item_list_1(p
):
5675 '''module_item_list : module_item_list module_item '''
5676 print('module_item_list_1', list(p
))
5678 def p_module_item_list_2(p
):
5679 '''module_item_list : module_item '''
5680 print('module_item_list_2', list(p
))
5682 def p_module_item_list_opt_1(p
):
5683 '''module_item_list_opt : module_item_list '''
5684 print('module_item_list_opt_1', list(p
))
5686 def p_module_item_list_opt_2(p
):
5687 '''module_item_list_opt : '''
5688 print('module_item_list_opt_2', list(p
))
5690 def p_generate_if_1(p
):
5691 '''generate_if : K_if '(' expression ')' '''
5692 print('generate_if_1', list(p
))
5693 # { pform_start_generate_if(@1, $3); }
5695 def p_generate_case_items_1(p
):
5696 '''generate_case_items : generate_case_items generate_case_item '''
5697 print('generate_case_items_1', list(p
))
5699 def p_generate_case_items_2(p
):
5700 '''generate_case_items : generate_case_item '''
5701 print('generate_case_items_2', list(p
))
5703 def p_generate_case_item_1(p
):
5704 '''generate_case_item : expression_list_proper ':' _embed0_generate_case_item generate_block_opt '''
5705 print('generate_case_item_1', list(p
))
5706 # { pform_endgenerate(); }
5708 def p_generate_case_item_2(p
):
5709 '''generate_case_item : K_default ':' _embed1_generate_case_item generate_block_opt '''
5710 print('generate_case_item_2', list(p
))
5711 # { pform_endgenerate(); }
5713 def p__embed0_generate_case_item(p
):
5714 '''_embed0_generate_case_item : '''
5715 # { pform_generate_case_item(@1, $1); }
5717 def p__embed1_generate_case_item(p
):
5718 '''_embed1_generate_case_item : '''
5719 # { pform_generate_case_item(@1, 0); }
5721 def p_generate_item_1(p
):
5722 '''generate_item : module_item '''
5723 print('generate_item_1', list(p
))
5725 def p_generate_item_2(p
):
5726 '''generate_item : K_begin generate_item_list_opt K_end '''
5727 print('generate_item_2', list(p
))
5728 # { /* Detect and warn about anachronistic begin/end use */
5729 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5731 # cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
5735 def p_generate_item_3(p
):
5736 '''generate_item : K_begin ':' IDENTIFIER _embed0_generate_item generate_item_list_opt K_end '''
5737 print('generate_item_3', list(p
))
5738 # { /* Detect and warn about anachronistic named begin/end use */
5739 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5741 # cerr << @1 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
5743 # pform_endgenerate();
5746 def p__embed0_generate_item(p
):
5747 '''_embed0_generate_item : '''
5749 # pform_start_generate_nblock(@1, $3);
5752 def p_generate_item_list_1(p
):
5753 '''generate_item_list : generate_item_list generate_item '''
5754 print('generate_item_list_1', list(p
))
5756 def p_generate_item_list_2(p
):
5757 '''generate_item_list : generate_item '''
5758 print('generate_item_list_2', list(p
))
5760 def p_generate_item_list_opt_1(p
):
5761 '''generate_item_list_opt : generate_item_list '''
5762 print('generate_item_list_opt_1', list(p
))
5764 def p_generate_item_list_opt_2(p
):
5765 '''generate_item_list_opt : '''
5766 print('generate_item_list_opt_2', list(p
))
5768 def p_generate_block_1(p
):
5769 '''generate_block : module_item '''
5770 print('generate_block_1', list(p
))
5772 def p_generate_block_2(p
):
5773 '''generate_block : K_begin generate_item_list_opt K_end '''
5774 print('generate_block_2', list(p
))
5776 def p_generate_block_3(p
):
5777 '''generate_block : K_begin ':' IDENTIFIER generate_item_list_opt K_end endlabel_opt '''
5778 print('generate_block_3', list(p
))
5779 # { pform_generate_block_name($3);
5781 # if (strcmp($3,$6) != 0) {
5782 # yyerror(@6, "error: End label doesn't match "
5785 # if (! gn_system_verilog()) {
5786 # yyerror(@6, "error: Begin end labels require "
5787 # "SystemVerilog.");
5794 def p_generate_block_opt_1(p
):
5795 '''generate_block_opt : generate_block '''
5796 print('generate_block_opt_1', list(p
))
5798 def p_generate_block_opt_2(p
):
5799 '''generate_block_opt : ';' '''
5800 print('generate_block_opt_2', list(p
))
5802 def p_net_decl_assign_1(p
):
5803 '''net_decl_assign : IDENTIFIER '=' expression '''
5804 print('net_decl_assign_1', list(p
))
5805 # { net_decl_assign_t*tmp = new net_decl_assign_t;
5807 # tmp->name = lex_strings.make($1);
5813 def p_net_decl_assigns_1(p
):
5814 '''net_decl_assigns : net_decl_assigns ',' net_decl_assign '''
5815 print('net_decl_assigns_1', list(p
))
5816 # { net_decl_assign_t*tmp = $1;
5817 # $3->next = tmp->next;
5822 def p_net_decl_assigns_2(p
):
5823 '''net_decl_assigns : net_decl_assign '''
5824 print('net_decl_assigns_2', list(p
))
5828 def p_bit_logic_1(p
):
5829 '''bit_logic : K_logic '''
5830 print('bit_logic_1', list(p
))
5831 # { $$ = IVL_VT_LOGIC; }
5833 def p_bit_logic_2(p
):
5834 '''bit_logic : K_bool '''
5835 print('bit_logic_2', list(p
))
5836 # { $$ = IVL_VT_BOOL; /* Icarus misc */}
5838 def p_bit_logic_3(p
):
5839 '''bit_logic : K_bit '''
5840 print('bit_logic_3', list(p
))
5841 # { $$ = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
5843 def p_bit_logic_opt_1(p
):
5844 '''bit_logic_opt : bit_logic '''
5845 print('bit_logic_opt_1', list(p
))
5847 def p_bit_logic_opt_2(p
):
5848 '''bit_logic_opt : '''
5849 print('bit_logic_opt_2', list(p
))
5850 # { $$ = IVL_VT_NO_TYPE; }
5852 def p_net_type_1(p
):
5853 '''net_type : K_wire '''
5854 print('net_type_1', list(p
))
5855 # { $$ = NetNet::WIRE; }
5857 def p_net_type_2(p
):
5858 '''net_type : K_tri '''
5859 print('net_type_2', list(p
))
5860 # { $$ = NetNet::TRI; }
5862 def p_net_type_3(p
):
5863 '''net_type : K_tri1 '''
5864 print('net_type_3', list(p
))
5865 # { $$ = NetNet::TRI1; }
5867 def p_net_type_4(p
):
5868 '''net_type : K_supply0 '''
5869 print('net_type_4', list(p
))
5870 # { $$ = NetNet::SUPPLY0; }
5872 def p_net_type_5(p
):
5873 '''net_type : K_wand '''
5874 print('net_type_5', list(p
))
5875 # { $$ = NetNet::WAND; }
5877 def p_net_type_6(p
):
5878 '''net_type : K_triand '''
5879 print('net_type_6', list(p
))
5880 # { $$ = NetNet::TRIAND; }
5882 def p_net_type_7(p
):
5883 '''net_type : K_tri0 '''
5884 print('net_type_7', list(p
))
5885 # { $$ = NetNet::TRI0; }
5887 def p_net_type_8(p
):
5888 '''net_type : K_supply1 '''
5889 print('net_type_8', list(p
))
5890 # { $$ = NetNet::SUPPLY1; }
5892 def p_net_type_9(p
):
5893 '''net_type : K_wor '''
5894 print('net_type_9', list(p
))
5895 # { $$ = NetNet::WOR; }
5897 def p_net_type_10(p
):
5898 '''net_type : K_trior '''
5899 print('net_type_10', list(p
))
5900 # { $$ = NetNet::TRIOR; }
5902 def p_net_type_11(p
):
5903 '''net_type : K_wone '''
5904 print('net_type_11', list(p
))
5905 # { $$ = NetNet::UNRESOLVED_WIRE;
5906 # cerr << @1.text << ":" << @1.first_line << ": warning: "
5907 # "'wone' is deprecated, please use 'uwire' "
5908 # "instead." << endl;
5911 def p_net_type_12(p
):
5912 '''net_type : K_uwire '''
5913 print('net_type_12', list(p
))
5914 # { $$ = NetNet::UNRESOLVED_WIRE; }
5916 def p_param_type_1(p
):
5917 '''param_type : bit_logic_opt unsigned_signed_opt dimensions_opt '''
5918 print('param_type_1', list(p
))
5919 # { param_active_range = $3;
5920 # param_active_signed = $2;
5921 # if (($1 == IVL_VT_NO_TYPE) && ($3 != 0))
5922 # param_active_type = IVL_VT_LOGIC;
5924 # param_active_type = $1;
5927 def p_param_type_2(p
):
5928 '''param_type : K_integer '''
5929 print('param_type_2', list(p
))
5930 # { param_active_range = make_range_from_width(integer_width);
5931 # param_active_signed = true;
5932 # param_active_type = IVL_VT_LOGIC;
5935 def p_param_type_3(p
):
5936 '''param_type : K_time '''
5937 print('param_type_3', list(p
))
5938 # { param_active_range = make_range_from_width(64);
5939 # param_active_signed = false;
5940 # param_active_type = IVL_VT_LOGIC;
5943 def p_param_type_4(p
):
5944 '''param_type : real_or_realtime '''
5945 print('param_type_4', list(p
))
5946 # { param_active_range = 0;
5947 # param_active_signed = true;
5948 # param_active_type = IVL_VT_REAL;
5951 def p_param_type_5(p
):
5952 '''param_type : atom2_type '''
5953 print('param_type_5', list(p
))
5954 # { param_active_range = make_range_from_width($1);
5955 # param_active_signed = true;
5956 # param_active_type = IVL_VT_BOOL;
5959 def p_param_type_6(p
):
5960 '''param_type : TYPE_IDENTIFIER '''
5961 print('param_type_6', list(p
))
5962 # { pform_set_param_from_type(@1, $1.type, $1.text, param_active_range,
5963 # param_active_signed, param_active_type);
5967 def p_parameter_assign_list_1(p
):
5968 '''parameter_assign_list : parameter_assign '''
5969 print('parameter_assign_list_1', list(p
))
5971 def p_parameter_assign_list_2(p
):
5972 '''parameter_assign_list : parameter_assign_list ',' parameter_assign '''
5973 print('parameter_assign_list_2', list(p
))
5975 def p_localparam_assign_list_1(p
):
5976 '''localparam_assign_list : localparam_assign '''
5977 print('localparam_assign_list_1', list(p
))
5979 def p_localparam_assign_list_2(p
):
5980 '''localparam_assign_list : localparam_assign_list ',' localparam_assign '''
5981 print('localparam_assign_list_2', list(p
))
5983 def p_parameter_assign_1(p
):
5984 '''parameter_assign : IDENTIFIER '=' expression parameter_value_ranges_opt '''
5985 print('parameter_assign_1', list(p
))
5986 tpname
= Node(syms
.tname
, [Leaf(token
.NAME
, p
[1])])
5987 expr
= Node(syms
.tfpdef
, [tpname
, Leaf(token
.EQUAL
, p
[2]), p
[3] ])
5990 # pform_set_parameter(@1, lex_strings.make($1), param_active_type,
5991 # param_active_signed, param_active_range, tmp, $4);
5995 def p_localparam_assign_1(p
):
5996 '''localparam_assign : IDENTIFIER '=' expression '''
5997 print('localparam_assign_1', list(p
))
5999 # pform_set_localparam(@1, lex_strings.make($1), param_active_type,
6000 # param_active_signed, param_active_range, tmp);
6004 def p_parameter_value_ranges_opt_1(p
):
6005 '''parameter_value_ranges_opt : parameter_value_ranges '''
6006 print('parameter_value_ranges_opt_1', list(p
))
6009 def p_parameter_value_ranges_opt_2(p
):
6010 '''parameter_value_ranges_opt : '''
6011 print('parameter_value_ranges_opt_2', list(p
))
6014 def p_parameter_value_ranges_1(p
):
6015 '''parameter_value_ranges : parameter_value_ranges parameter_value_range '''
6016 print('parameter_value_ranges_1', list(p
))
6017 # { $$ = $2; $$->next = $1; }
6019 def p_parameter_value_ranges_2(p
):
6020 '''parameter_value_ranges : parameter_value_range '''
6021 print('parameter_value_ranges_2', list(p
))
6022 # { $$ = $1; $$->next = 0; }
6024 def p_parameter_value_range_1(p
):
6025 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ']' '''
6026 print('parameter_value_range_1', list(p
))
6027 # { $$ = pform_parameter_value_range($1, false, $3, false, $5); }
6029 def p_parameter_value_range_2(p
):
6030 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ')' '''
6031 print('parameter_value_range_2', list(p
))
6032 # { $$ = pform_parameter_value_range($1, false, $3, true, $5); }
6034 def p_parameter_value_range_3(p
):
6035 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ']' '''
6036 print('parameter_value_range_3', list(p
))
6037 # { $$ = pform_parameter_value_range($1, true, $3, false, $5); }
6039 def p_parameter_value_range_4(p
):
6040 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ')' '''
6041 print('parameter_value_range_4', list(p
))
6042 # { $$ = pform_parameter_value_range($1, true, $3, true, $5); }
6044 def p_parameter_value_range_5(p
):
6045 '''parameter_value_range : K_exclude expression '''
6046 print('parameter_value_range_5', list(p
))
6047 # { $$ = pform_parameter_value_range(true, false, $2, false, $2); }
6049 def p_value_range_expression_1(p
):
6050 '''value_range_expression : expression '''
6051 print('value_range_expression_1', list(p
))
6054 def p_value_range_expression_2(p
):
6055 '''value_range_expression : K_inf '''
6056 print('value_range_expression_2', list(p
))
6059 def p_value_range_expression_3(p
):
6060 '''value_range_expression : '+' K_inf '''
6061 print('value_range_expression_3', list(p
))
6064 def p_value_range_expression_4(p
):
6065 '''value_range_expression : '-' K_inf '''
6066 print('value_range_expression_4', list(p
))
6069 def p_from_exclude_1(p
):
6070 '''from_exclude : K_from '''
6071 print('from_exclude_1', list(p
))
6074 def p_from_exclude_2(p
):
6075 '''from_exclude : K_exclude '''
6076 print('from_exclude_2', list(p
))
6079 def p_parameter_value_opt_1(p
):
6080 '''parameter_value_opt : '#' '(' expression_list_with_nuls ')' '''
6081 print('parameter_value_opt_1', list(p
))
6082 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6083 # tmp->by_order = $3;
6088 def p_parameter_value_opt_2(p
):
6089 '''parameter_value_opt : '#' '(' parameter_value_byname_list ')' '''
6090 print('parameter_value_opt_2', list(p
))
6091 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6092 # tmp->by_order = 0;
6093 # tmp->by_name = $3;
6097 def p_parameter_value_opt_3(p
):
6098 '''parameter_value_opt : '#' DEC_NUMBER '''
6099 print('parameter_value_opt_3', list(p
))
6101 # PENumber*tmp = new PENumber($2);
6102 # FILE_NAME(tmp, @1);
6104 # struct parmvalue_t*lst = new struct parmvalue_t;
6105 # lst->by_order = new list<PExpr*>;
6106 # lst->by_order->push_back(tmp);
6112 def p_parameter_value_opt_4(p
):
6113 '''parameter_value_opt : '#' REALTIME '''
6114 print('parameter_value_opt_4', list(p
))
6116 # PEFNumber*tmp = new PEFNumber($2);
6117 # FILE_NAME(tmp, @1);
6119 # struct parmvalue_t*lst = new struct parmvalue_t;
6120 # lst->by_order = new list<PExpr*>;
6121 # lst->by_order->push_back(tmp);
6126 def p_parameter_value_opt_5(p
):
6127 '''parameter_value_opt : '#' error '''
6128 print('parameter_value_opt_5', list(p
))
6129 # { yyerror(@1, "error: syntax error in parameter value "
6130 # "assignment list.");
6134 def p_parameter_value_opt_6(p
):
6135 '''parameter_value_opt : '''
6136 print('parameter_value_opt_6', list(p
))
6139 def p_parameter_value_byname_1(p
):
6140 '''parameter_value_byname : '.' IDENTIFIER '(' expression ')' '''
6141 print('parameter_value_byname_1', list(p
))
6142 # { named_pexpr_t*tmp = new named_pexpr_t;
6143 # tmp->name = lex_strings.make($2);
6149 def p_parameter_value_byname_2(p
):
6150 '''parameter_value_byname : '.' IDENTIFIER '(' ')' '''
6151 print('parameter_value_byname_2', list(p
))
6152 # { named_pexpr_t*tmp = new named_pexpr_t;
6153 # tmp->name = lex_strings.make($2);
6159 def p_parameter_value_byname_list_1(p
):
6160 '''parameter_value_byname_list : parameter_value_byname '''
6161 print('parameter_value_byname_list_1', list(p
))
6162 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6163 # tmp->push_back(*$1);
6168 def p_parameter_value_byname_list_2(p
):
6169 '''parameter_value_byname_list : parameter_value_byname_list ',' parameter_value_byname '''
6170 print('parameter_value_byname_list_2', list(p
))
6171 # { list<named_pexpr_t>*tmp = $1;
6172 # tmp->push_back(*$3);
6178 '''port : port_reference '''
6179 print('port_1', list(p
))
6183 '''port : '.' IDENTIFIER '(' port_reference ')' '''
6184 print('port_2', list(p
))
6185 # { Module::port_t*tmp = $4;
6186 # tmp->name = lex_strings.make($2);
6192 '''port : '{' port_reference_list '}' '''
6193 print('port_3', list(p
))
6194 # { Module::port_t*tmp = $2;
6195 # tmp->name = perm_string();
6200 '''port : '.' IDENTIFIER '(' '{' port_reference_list '}' ')' '''
6201 print('port_4', list(p
))
6202 # { Module::port_t*tmp = $5;
6203 # tmp->name = lex_strings.make($2);
6208 def p_port_opt_1(p
):
6209 '''port_opt : port '''
6210 print('port_opt_1', list(p
))
6213 def p_port_opt_2(p
):
6215 print('port_opt_2', list(p
))
6218 def p_port_name_1(p
):
6219 '''port_name : '.' IDENTIFIER '(' expression ')' '''
6220 print('port_name_1', list(p
))
6221 # { named_pexpr_t*tmp = new named_pexpr_t;
6222 # tmp->name = lex_strings.make($2);
6228 def p_port_name_2(p
):
6229 '''port_name : '.' IDENTIFIER '(' error ')' '''
6230 print('port_name_2', list(p
))
6231 # { yyerror(@3, "error: invalid port connection expression.");
6232 # named_pexpr_t*tmp = new named_pexpr_t;
6233 # tmp->name = lex_strings.make($2);
6239 def p_port_name_3(p
):
6240 '''port_name : '.' IDENTIFIER '(' ')' '''
6241 print('port_name_3', list(p
))
6242 # { named_pexpr_t*tmp = new named_pexpr_t;
6243 # tmp->name = lex_strings.make($2);
6249 def p_port_name_4(p
):
6250 '''port_name : '.' IDENTIFIER '''
6251 print('port_name_4', list(p
))
6252 # { named_pexpr_t*tmp = new named_pexpr_t;
6253 # tmp->name = lex_strings.make($2);
6254 # tmp->parm = new PEIdent(lex_strings.make($2), true);
6255 # FILE_NAME(tmp->parm, @1);
6260 def p_port_name_5(p
):
6261 '''port_name : K_DOTSTAR '''
6262 print('port_name_5', list(p
))
6263 # { named_pexpr_t*tmp = new named_pexpr_t;
6264 # tmp->name = lex_strings.make("*");
6269 def p_port_name_list_1(p
):
6270 '''port_name_list : port_name_list ',' port_name '''
6271 print('port_name_list_1', list(p
))
6272 # { list<named_pexpr_t>*tmp = $1;
6273 # tmp->push_back(*$3);
6278 def p_port_name_list_2(p
):
6279 '''port_name_list : port_name '''
6280 print('port_name_list_2', list(p
))
6281 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6282 # tmp->push_back(*$1);
6287 def p_port_reference_1(p
):
6288 '''port_reference : IDENTIFIER '''
6289 print('port_reference_1', list(p
))
6290 # { Module::port_t*ptmp;
6291 # perm_string name = lex_strings.make($1);
6292 # ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
6297 def p_port_reference_2(p
):
6298 '''port_reference : IDENTIFIER '[' expression ':' expression ']' '''
6299 print('port_reference_2', list(p
))
6300 # { index_component_t itmp;
6301 # itmp.sel = index_component_t::SEL_PART;
6305 # name_component_t ntmp (lex_strings.make($1));
6306 # ntmp.index.push_back(itmp);
6308 # pform_name_t pname;
6309 # pname.push_back(ntmp);
6311 # PEIdent*wtmp = new PEIdent(pname);
6312 # FILE_NAME(wtmp, @1);
6314 # Module::port_t*ptmp = new Module::port_t;
6315 # ptmp->name = perm_string();
6316 # ptmp->expr.push_back(wtmp);
6322 def p_port_reference_3(p
):
6323 '''port_reference : IDENTIFIER '[' expression ']' '''
6324 print('port_reference_3', list(p
))
6325 # { index_component_t itmp;
6326 # itmp.sel = index_component_t::SEL_BIT;
6330 # name_component_t ntmp (lex_strings.make($1));
6331 # ntmp.index.push_back(itmp);
6333 # pform_name_t pname;
6334 # pname.push_back(ntmp);
6336 # PEIdent*tmp = new PEIdent(pname);
6337 # FILE_NAME(tmp, @1);
6339 # Module::port_t*ptmp = new Module::port_t;
6340 # ptmp->name = perm_string();
6341 # ptmp->expr.push_back(tmp);
6346 def p_port_reference_4(p
):
6347 '''port_reference : IDENTIFIER '[' error ']' '''
6348 print('port_reference_4', list(p
))
6349 # { yyerror(@1, "error: invalid port bit select");
6350 # Module::port_t*ptmp = new Module::port_t;
6351 # PEIdent*wtmp = new PEIdent(lex_strings.make($1));
6352 # FILE_NAME(wtmp, @1);
6353 # ptmp->name = lex_strings.make($1);
6354 # ptmp->expr.push_back(wtmp);
6359 def p_port_reference_list_1(p
):
6360 '''port_reference_list : port_reference '''
6361 print('port_reference_list_1', list(p
))
6364 def p_port_reference_list_2(p
):
6365 '''port_reference_list : port_reference_list ',' port_reference '''
6366 print('port_reference_list_2', list(p
))
6367 # { Module::port_t*tmp = $1;
6368 # append(tmp->expr, $3->expr);
6373 def p_dimensions_opt_1(p
):
6374 '''dimensions_opt : '''
6375 print('dimensions_opt_1', list(p
))
6378 def p_dimensions_opt_2(p
):
6379 '''dimensions_opt : dimensions '''
6380 print('dimensions_opt_2', list(p
))
6383 def p_dimensions_1(p
):
6384 '''dimensions : variable_dimension '''
6385 print('dimensions_1', list(p
))
6388 def p_dimensions_2(p
):
6389 '''dimensions : dimensions variable_dimension '''
6390 print('dimensions_2', list(p
))
6391 # { list<pform_range_t> *tmp = $1;
6393 # tmp->splice(tmp->end(), *$2);
6399 def p_register_variable_1(p
):
6400 '''register_variable : IDENTIFIER dimensions_opt '''
6401 print('register_variable_1', list(p
))
6402 # { perm_string name = lex_strings.make($1);
6403 # pform_makewire(@1, name, NetNet::REG,
6404 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6405 # pform_set_reg_idx(name, $2);
6409 def p_register_variable_2(p
):
6410 '''register_variable : IDENTIFIER dimensions_opt '=' expression '''
6411 print('register_variable_2', list(p
))
6412 # { if (pform_peek_scope()->var_init_needs_explicit_lifetime()
6413 # && (var_lifetime == LexicalScope::INHERITED)) {
6414 # cerr << @3 << ": warning: Static variable initialization requires "
6415 # "explicit lifetime in this context." << endl;
6418 # perm_string name = lex_strings.make($1);
6419 # pform_makewire(@1, name, NetNet::REG,
6420 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6421 # pform_set_reg_idx(name, $2);
6422 # pform_make_var_init(@1, name, $4);
6426 def p_register_variable_list_1(p
):
6427 '''register_variable_list : register_variable '''
6428 print('register_variable_list_1', list(p
))
6429 # { list<perm_string>*tmp = new list<perm_string>;
6430 # tmp->push_back(lex_strings.make($1));
6435 def p_register_variable_list_2(p
):
6436 '''register_variable_list : register_variable_list ',' register_variable '''
6437 print('register_variable_list_2', list(p
))
6438 # { list<perm_string>*tmp = $1;
6439 # tmp->push_back(lex_strings.make($3));
6444 def p_net_variable_1(p
):
6445 '''net_variable : IDENTIFIER dimensions_opt '''
6446 print('net_variable_1', list(p
))
6447 # { perm_string name = lex_strings.make($1);
6448 # pform_makewire(@1, name, NetNet::IMPLICIT,
6449 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6450 # pform_set_reg_idx(name, $2);
6454 def p_net_variable_list_1(p
):
6455 '''net_variable_list : net_variable '''
6456 print('net_variable_list_1', list(p
))
6457 # { list<perm_string>*tmp = new list<perm_string>;
6458 # tmp->push_back(lex_strings.make($1));
6463 def p_net_variable_list_2(p
):
6464 '''net_variable_list : net_variable_list ',' net_variable '''
6465 print('net_variable_list_2', list(p
))
6466 # { list<perm_string>*tmp = $1;
6467 # tmp->push_back(lex_strings.make($3));
6472 def p_event_variable_1(p
):
6473 '''event_variable : IDENTIFIER dimensions_opt '''
6474 print('event_variable_1', list(p
))
6476 # yyerror(@2, "sorry: event arrays are not supported.");
6482 def p_event_variable_list_1(p
):
6483 '''event_variable_list : event_variable '''
6484 print('event_variable_list_1', list(p
))
6485 # { $$ = list_from_identifier($1); }
6487 def p_event_variable_list_2(p
):
6488 '''event_variable_list : event_variable_list ',' event_variable '''
6489 print('event_variable_list_2', list(p
))
6490 # { $$ = list_from_identifier($1, $3); }
6492 def p_specify_item_1(p
):
6493 '''specify_item : K_specparam specparam_decl ';' '''
6494 print('specify_item_1', list(p
))
6496 def p_specify_item_2(p
):
6497 '''specify_item : specify_simple_path_decl ';' '''
6498 print('specify_item_2', list(p
))
6499 # { pform_module_specify_path($1);
6502 def p_specify_item_3(p
):
6503 '''specify_item : specify_edge_path_decl ';' '''
6504 print('specify_item_3', list(p
))
6505 # { pform_module_specify_path($1);
6508 def p_specify_item_4(p
):
6509 '''specify_item : K_if '(' expression ')' specify_simple_path_decl ';' '''
6510 print('specify_item_4', list(p
))
6511 # { PSpecPath*tmp = $5;
6513 # tmp->conditional = true;
6514 # tmp->condition = $3;
6516 # pform_module_specify_path(tmp);
6519 def p_specify_item_5(p
):
6520 '''specify_item : K_if '(' expression ')' specify_edge_path_decl ';' '''
6521 print('specify_item_5', list(p
))
6522 # { PSpecPath*tmp = $5;
6524 # tmp->conditional = true;
6525 # tmp->condition = $3;
6527 # pform_module_specify_path(tmp);
6530 def p_specify_item_6(p
):
6531 '''specify_item : K_ifnone specify_simple_path_decl ';' '''
6532 print('specify_item_6', list(p
))
6533 # { PSpecPath*tmp = $2;
6535 # tmp->conditional = true;
6536 # tmp->condition = 0;
6538 # pform_module_specify_path(tmp);
6541 def p_specify_item_7(p
):
6542 '''specify_item : K_ifnone specify_edge_path_decl ';' '''
6543 print('specify_item_7', list(p
))
6544 # { yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
6545 # "not supported.");
6549 def p_specify_item_8(p
):
6550 '''specify_item : K_Sfullskew '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6551 print('specify_item_8', list(p
))
6556 def p_specify_item_9(p
):
6557 '''specify_item : K_Shold '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6558 print('specify_item_9', list(p
))
6562 def p_specify_item_10(p
):
6563 '''specify_item : K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6564 print('specify_item_10', list(p
))
6569 def p_specify_item_11(p
):
6570 '''specify_item : K_Speriod '(' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6571 print('specify_item_11', list(p
))
6575 def p_specify_item_12(p
):
6576 '''specify_item : K_Srecovery '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6577 print('specify_item_12', list(p
))
6581 def p_specify_item_13(p
):
6582 '''specify_item : K_Srecrem '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6583 print('specify_item_13', list(p
))
6588 def p_specify_item_14(p
):
6589 '''specify_item : K_Sremoval '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6590 print('specify_item_14', list(p
))
6594 def p_specify_item_15(p
):
6595 '''specify_item : K_Ssetup '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6596 print('specify_item_15', list(p
))
6600 def p_specify_item_16(p
):
6601 '''specify_item : K_Ssetuphold '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6602 print('specify_item_16', list(p
))
6607 def p_specify_item_17(p
):
6608 '''specify_item : K_Sskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6609 print('specify_item_17', list(p
))
6613 def p_specify_item_18(p
):
6614 '''specify_item : K_Stimeskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6615 print('specify_item_18', list(p
))
6619 def p_specify_item_19(p
):
6620 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ',' expression spec_notifier_opt ')' ';' '''
6621 print('specify_item_19', list(p
))
6626 def p_specify_item_20(p
):
6627 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ')' ';' '''
6628 print('specify_item_20', list(p
))
6632 def p_specify_item_21(p
):
6633 '''specify_item : K_pulsestyle_onevent specify_path_identifiers ';' '''
6634 print('specify_item_21', list(p
))
6638 def p_specify_item_22(p
):
6639 '''specify_item : K_pulsestyle_ondetect specify_path_identifiers ';' '''
6640 print('specify_item_22', list(p
))
6644 def p_specify_item_23(p
):
6645 '''specify_item : K_showcancelled specify_path_identifiers ';' '''
6646 print('specify_item_23', list(p
))
6650 def p_specify_item_24(p
):
6651 '''specify_item : K_noshowcancelled specify_path_identifiers ';' '''
6652 print('specify_item_24', list(p
))
6656 def p_specify_item_list_1(p
):
6657 '''specify_item_list : specify_item '''
6658 print('specify_item_list_1', list(p
))
6660 def p_specify_item_list_2(p
):
6661 '''specify_item_list : specify_item_list specify_item '''
6662 print('specify_item_list_2', list(p
))
6664 def p_specify_item_list_opt_1(p
):
6665 '''specify_item_list_opt : '''
6666 print('specify_item_list_opt_1', list(p
))
6669 def p_specify_item_list_opt_2(p
):
6670 '''specify_item_list_opt : specify_item_list '''
6671 print('specify_item_list_opt_2', list(p
))
6674 def p_specify_edge_path_decl_1(p
):
6675 '''specify_edge_path_decl : specify_edge_path '=' '(' delay_value_list ')' '''
6676 print('specify_edge_path_decl_1', list(p
))
6677 # { $$ = pform_assign_path_delay($1, $4); }
6679 def p_specify_edge_path_decl_2(p
):
6680 '''specify_edge_path_decl : specify_edge_path '=' delay_value_simple '''
6681 print('specify_edge_path_decl_2', list(p
))
6682 # { list<PExpr*>*tmp = new list<PExpr*>;
6683 # tmp->push_back($3);
6684 # $$ = pform_assign_path_delay($1, tmp);
6687 def p_edge_operator_1(p
):
6688 '''edge_operator : K_posedge '''
6689 print('edge_operator_1', list(p
))
6692 def p_edge_operator_2(p
):
6693 '''edge_operator : K_negedge '''
6694 print('edge_operator_2', list(p
))
6697 def p_specify_edge_path_1(p
):
6698 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6699 print('specify_edge_path_1', list(p
))
6700 # { int edge_flag = 0;
6701 # $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, false, $6, $8); }
6703 def p_specify_edge_path_2(p
):
6704 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6705 print('specify_edge_path_2', list(p
))
6706 # { int edge_flag = $2? 1 : -1;
6707 # $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, false, $7, $9);}
6709 def p_specify_edge_path_3(p
):
6710 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6711 print('specify_edge_path_3', list(p
))
6712 # { int edge_flag = 0;
6713 # $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, true, $6, $8); }
6715 def p_specify_edge_path_4(p
):
6716 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6717 print('specify_edge_path_4', list(p
))
6718 # { int edge_flag = $2? 1 : -1;
6719 # $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, true, $7, $9); }
6721 def p_polarity_operator_1(p
):
6722 '''polarity_operator : K_PO_POS '''
6723 print('polarity_operator_1', list(p
))
6725 def p_polarity_operator_2(p
):
6726 '''polarity_operator : K_PO_NEG '''
6727 print('polarity_operator_2', list(p
))
6729 def p_polarity_operator_3(p
):
6730 '''polarity_operator : ':' '''
6731 print('polarity_operator_3', list(p
))
6733 def p_specify_simple_path_decl_1(p
):
6734 '''specify_simple_path_decl : specify_simple_path '=' '(' delay_value_list ')' '''
6735 print('specify_simple_path_decl_1', list(p
))
6736 # { $$ = pform_assign_path_delay($1, $4); }
6738 def p_specify_simple_path_decl_2(p
):
6739 '''specify_simple_path_decl : specify_simple_path '=' delay_value_simple '''
6740 print('specify_simple_path_decl_2', list(p
))
6741 # { list<PExpr*>*tmp = new list<PExpr*>;
6742 # tmp->push_back($3);
6743 # $$ = pform_assign_path_delay($1, tmp);
6746 def p_specify_simple_path_decl_3(p
):
6747 '''specify_simple_path_decl : specify_simple_path '=' '(' error ')' '''
6748 print('specify_simple_path_decl_3', list(p
))
6749 # { yyerror(@3, "Syntax error in delay value list.");
6754 def p_specify_simple_path_1(p
):
6755 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' '''
6756 print('specify_simple_path_1', list(p
))
6757 # { $$ = pform_make_specify_path(@1, $2, $3, false, $5); }
6759 def p_specify_simple_path_2(p
):
6760 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' '''
6761 print('specify_simple_path_2', list(p
))
6762 # { $$ = pform_make_specify_path(@1, $2, $3, true, $5); }
6764 def p_specify_simple_path_3(p
):
6765 '''specify_simple_path : '(' error ')' '''
6766 print('specify_simple_path_3', list(p
))
6767 # { yyerror(@1, "Invalid simple path");
6771 def p_specify_path_identifiers_1(p
):
6772 '''specify_path_identifiers : IDENTIFIER '''
6773 print('specify_path_identifiers_1', list(p
))
6774 # { list<perm_string>*tmp = new list<perm_string>;
6775 # tmp->push_back(lex_strings.make($1));
6780 def p_specify_path_identifiers_2(p
):
6781 '''specify_path_identifiers : IDENTIFIER '[' expr_primary ']' '''
6782 print('specify_path_identifiers_2', list(p
))
6783 # { if (gn_specify_blocks_flag) {
6784 # yywarn(@4, "Bit selects are not currently supported "
6785 # "in path declarations. The declaration "
6786 # "will be applied to the whole vector.");
6788 # list<perm_string>*tmp = new list<perm_string>;
6789 # tmp->push_back(lex_strings.make($1));
6794 def p_specify_path_identifiers_3(p
):
6795 '''specify_path_identifiers : IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6796 print('specify_path_identifiers_3', list(p
))
6797 # { if (gn_specify_blocks_flag) {
6798 # yywarn(@4, "Part selects are not currently supported "
6799 # "in path declarations. The declaration "
6800 # "will be applied to the whole vector.");
6802 # list<perm_string>*tmp = new list<perm_string>;
6803 # tmp->push_back(lex_strings.make($1));
6808 def p_specify_path_identifiers_4(p
):
6809 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '''
6810 print('specify_path_identifiers_4', list(p
))
6811 # { list<perm_string>*tmp = $1;
6812 # tmp->push_back(lex_strings.make($3));
6817 def p_specify_path_identifiers_5(p
):
6818 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' '''
6819 print('specify_path_identifiers_5', list(p
))
6820 # { if (gn_specify_blocks_flag) {
6821 # yywarn(@4, "Bit selects are not currently supported "
6822 # "in path declarations. The declaration "
6823 # "will be applied to the whole vector.");
6825 # list<perm_string>*tmp = $1;
6826 # tmp->push_back(lex_strings.make($3));
6831 def p_specify_path_identifiers_6(p
):
6832 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6833 print('specify_path_identifiers_6', list(p
))
6834 # { if (gn_specify_blocks_flag) {
6835 # yywarn(@4, "Part selects are not currently supported "
6836 # "in path declarations. The declaration "
6837 # "will be applied to the whole vector.");
6839 # list<perm_string>*tmp = $1;
6840 # tmp->push_back(lex_strings.make($3));
6845 def p_specparam_1(p
):
6846 '''specparam : IDENTIFIER '=' expression '''
6847 print('specparam_1', list(p
))
6849 # pform_set_specparam(@1, lex_strings.make($1),
6850 # param_active_range, tmp);
6854 def p_specparam_2(p
):
6855 '''specparam : IDENTIFIER '=' expression ':' expression ':' expression '''
6856 print('specparam_2', list(p
))
6858 # switch (min_typ_max_flag) {
6875 # if (min_typ_max_warn > 0) {
6876 # cerr << tmp->get_fileline() << ": warning: choosing ";
6877 # switch (min_typ_max_flag) {
6888 # cerr << " expression." << endl;
6889 # min_typ_max_warn -= 1;
6891 # pform_set_specparam(@1, lex_strings.make($1),
6892 # param_active_range, tmp);
6896 def p_specparam_3(p
):
6897 '''specparam : PATHPULSE_IDENTIFIER '=' expression '''
6898 print('specparam_3', list(p
))
6903 def p_specparam_4(p
):
6904 '''specparam : PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' '''
6905 print('specparam_4', list(p
))
6911 def p_specparam_list_1(p
):
6912 '''specparam_list : specparam '''
6913 print('specparam_list_1', list(p
))
6915 def p_specparam_list_2(p
):
6916 '''specparam_list : specparam_list ',' specparam '''
6917 print('specparam_list_2', list(p
))
6919 def p_specparam_decl_1(p
):
6920 '''specparam_decl : specparam_list '''
6921 print('specparam_decl_1', list(p
))
6923 def p_specparam_decl_2(p
):
6924 '''specparam_decl : dimensions _embed0_specparam_decl specparam_list '''
6925 print('specparam_decl_2', list(p
))
6926 # { param_active_range = 0; }
6928 def p__embed0_specparam_decl(p
):
6929 '''_embed0_specparam_decl : '''
6930 # { param_active_range = $1; }
6932 def p_spec_polarity_1(p
):
6933 '''spec_polarity : '+' '''
6934 print('spec_polarity_1', list(p
))
6937 def p_spec_polarity_2(p
):
6938 '''spec_polarity : '-' '''
6939 print('spec_polarity_2', list(p
))
6942 def p_spec_polarity_3(p
):
6943 '''spec_polarity : '''
6944 print('spec_polarity_3', list(p
))
6947 def p_spec_reference_event_1(p
):
6948 '''spec_reference_event : K_posedge expression '''
6949 print('spec_reference_event_1', list(p
))
6952 def p_spec_reference_event_2(p
):
6953 '''spec_reference_event : K_negedge expression '''
6954 print('spec_reference_event_2', list(p
))
6957 def p_spec_reference_event_3(p
):
6958 '''spec_reference_event : K_posedge expr_primary K_TAND expression '''
6959 print('spec_reference_event_3', list(p
))
6964 def p_spec_reference_event_4(p
):
6965 '''spec_reference_event : K_negedge expr_primary K_TAND expression '''
6966 print('spec_reference_event_4', list(p
))
6971 def p_spec_reference_event_5(p
):
6972 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary '''
6973 print('spec_reference_event_5', list(p
))
6976 def p_spec_reference_event_6(p
):
6977 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression '''
6978 print('spec_reference_event_6', list(p
))
6983 def p_spec_reference_event_7(p
):
6984 '''spec_reference_event : expr_primary K_TAND expression '''
6985 print('spec_reference_event_7', list(p
))
6990 def p_spec_reference_event_8(p
):
6991 '''spec_reference_event : expr_primary '''
6992 print('spec_reference_event_8', list(p
))
6995 def p_edge_descriptor_list_1(p
):
6996 '''edge_descriptor_list : edge_descriptor_list ',' K_edge_descriptor '''
6997 print('edge_descriptor_list_1', list(p
))
6999 def p_edge_descriptor_list_2(p
):
7000 '''edge_descriptor_list : K_edge_descriptor '''
7001 print('edge_descriptor_list_2', list(p
))
7003 def p_spec_notifier_opt_1(p
):
7004 '''spec_notifier_opt : '''
7005 print('spec_notifier_opt_1', list(p
))
7008 def p_spec_notifier_opt_2(p
):
7009 '''spec_notifier_opt : spec_notifier '''
7010 print('spec_notifier_opt_2', list(p
))
7013 def p_spec_notifier_1(p
):
7014 '''spec_notifier : ',' '''
7015 print('spec_notifier_1', list(p
))
7016 # { args_after_notifier = 0; }
7018 def p_spec_notifier_2(p
):
7019 '''spec_notifier : ',' hierarchy_identifier '''
7020 print('spec_notifier_2', list(p
))
7021 # { args_after_notifier = 0; delete $2; }
7023 def p_spec_notifier_3(p
):
7024 '''spec_notifier : spec_notifier ',' '''
7025 print('spec_notifier_3', list(p
))
7026 # { args_after_notifier += 1; }
7028 def p_spec_notifier_4(p
):
7029 '''spec_notifier : spec_notifier ',' hierarchy_identifier '''
7030 print('spec_notifier_4', list(p
))
7031 # { args_after_notifier += 1;
7032 # if (args_after_notifier >= 3) {
7033 # cerr << @3 << ": warning: timing checks are not supported "
7034 # "and delayed signal \"" << *$3
7035 # << "\" will not be driven." << endl;
7039 def p_spec_notifier_5(p
):
7040 '''spec_notifier : IDENTIFIER '''
7041 print('spec_notifier_5', list(p
))
7042 # { args_after_notifier = 0; delete[]$1; }
7044 def p_statement_item_1(p
):
7045 '''statement_item : K_assign lpvalue '=' expression ';' '''
7046 print('statement_item_1', list(p
))
7047 # { PCAssign*tmp = new PCAssign($2, $4);
7048 # FILE_NAME(tmp, @1);
7052 def p_statement_item_2(p
):
7053 '''statement_item : K_deassign lpvalue ';' '''
7054 print('statement_item_2', list(p
))
7055 # { PDeassign*tmp = new PDeassign($2);
7056 # FILE_NAME(tmp, @1);
7060 def p_statement_item_3(p
):
7061 '''statement_item : K_force lpvalue '=' expression ';' '''
7062 print('statement_item_3', list(p
))
7063 # { PForce*tmp = new PForce($2, $4);
7064 # FILE_NAME(tmp, @1);
7068 def p_statement_item_4(p
):
7069 '''statement_item : K_release lpvalue ';' '''
7070 print('statement_item_4', list(p
))
7071 # { PRelease*tmp = new PRelease($2);
7072 # FILE_NAME(tmp, @1);
7076 def p_statement_item_5(p
):
7077 '''statement_item : K_begin K_end '''
7078 print('statement_item_5', list(p
))
7079 # { PBlock*tmp = new PBlock(PBlock::BL_SEQ);
7080 # FILE_NAME(tmp, @1);
7084 def p_statement_item_6(p
):
7085 '''statement_item : K_begin _embed0_statement_item block_item_decls_opt _embed1_statement_item statement_or_null_list K_end '''
7086 print('statement_item_6', list(p
))
7089 # pform_pop_scope();
7090 # assert(! current_block_stack.empty());
7091 # tmp = current_block_stack.top();
7092 # current_block_stack.pop();
7094 # tmp = new PBlock(PBlock::BL_SEQ);
7095 # FILE_NAME(tmp, @1);
7097 # if ($5) tmp->set_statement(*$5);
7102 def p_statement_item_7(p
):
7103 '''statement_item : K_begin ':' IDENTIFIER _embed2_statement_item block_item_decls_opt statement_or_null_list_opt K_end endlabel_opt '''
7104 print('statement_item_7', list(p
))
7105 # { pform_pop_scope();
7106 # assert(! current_block_stack.empty());
7107 # PBlock*tmp = current_block_stack.top();
7108 # current_block_stack.pop();
7109 # if ($6) tmp->set_statement(*$6);
7112 # if (strcmp($3,$8) != 0) {
7113 # yyerror(@8, "error: End label doesn't match begin name");
7115 # if (! gn_system_verilog()) {
7116 # yyerror(@8, "error: Begin end labels require "
7117 # "SystemVerilog.");
7125 def p_statement_item_8(p
):
7126 '''statement_item : K_fork join_keyword '''
7127 print('statement_item_8', list(p
))
7128 # { PBlock*tmp = new PBlock($2);
7129 # FILE_NAME(tmp, @1);
7133 def p_statement_item_9(p
):
7134 '''statement_item : K_fork _embed3_statement_item block_item_decls_opt _embed4_statement_item statement_or_null_list join_keyword '''
7135 print('statement_item_9', list(p
))
7138 # pform_pop_scope();
7139 # assert(! current_block_stack.empty());
7140 # tmp = current_block_stack.top();
7141 # current_block_stack.pop();
7142 # tmp->set_join_type($6);
7144 # tmp = new PBlock($6);
7145 # FILE_NAME(tmp, @1);
7147 # if ($5) tmp->set_statement(*$5);
7152 def p_statement_item_10(p
):
7153 '''statement_item : K_fork ':' IDENTIFIER _embed5_statement_item block_item_decls_opt statement_or_null_list_opt join_keyword endlabel_opt '''
7154 print('statement_item_10', list(p
))
7155 # { pform_pop_scope();
7156 # assert(! current_block_stack.empty());
7157 # PBlock*tmp = current_block_stack.top();
7158 # current_block_stack.pop();
7159 # tmp->set_join_type($7);
7160 # if ($6) tmp->set_statement(*$6);
7163 # if (strcmp($3,$8) != 0) {
7164 # yyerror(@8, "error: End label doesn't match fork name");
7166 # if (! gn_system_verilog()) {
7167 # yyerror(@8, "error: Fork end labels require "
7168 # "SystemVerilog.");
7176 def p_statement_item_11(p
):
7177 '''statement_item : K_disable hierarchy_identifier ';' '''
7178 print('statement_item_11', list(p
))
7179 # { PDisable*tmp = new PDisable(*$2);
7180 # FILE_NAME(tmp, @1);
7185 def p_statement_item_12(p
):
7186 '''statement_item : K_disable K_fork ';' '''
7187 print('statement_item_12', list(p
))
7188 # { pform_name_t tmp_name;
7189 # PDisable*tmp = new PDisable(tmp_name);
7190 # FILE_NAME(tmp, @1);
7194 def p_statement_item_13(p
):
7195 '''statement_item : K_TRIGGER hierarchy_identifier ';' '''
7196 print('statement_item_13', list(p
))
7197 # { PTrigger*tmp = new PTrigger(*$2);
7198 # FILE_NAME(tmp, @1);
7203 def p_statement_item_14(p
):
7204 '''statement_item : procedural_assertion_statement '''
7205 print('statement_item_14', list(p
))
7208 def p_statement_item_15(p
):
7209 '''statement_item : loop_statement '''
7210 print('statement_item_15', list(p
))
7213 def p_statement_item_16(p
):
7214 '''statement_item : jump_statement '''
7215 print('statement_item_16', list(p
))
7218 def p_statement_item_17(p
):
7219 '''statement_item : K_case '(' expression ')' case_items K_endcase '''
7220 print('statement_item_17', list(p
))
7221 # { PCase*tmp = new PCase(NetCase::EQ, $3, $5);
7222 # FILE_NAME(tmp, @1);
7226 def p_statement_item_18(p
):
7227 '''statement_item : K_casex '(' expression ')' case_items K_endcase '''
7228 print('statement_item_18', list(p
))
7229 # { PCase*tmp = new PCase(NetCase::EQX, $3, $5);
7230 # FILE_NAME(tmp, @1);
7234 def p_statement_item_19(p
):
7235 '''statement_item : K_casez '(' expression ')' case_items K_endcase '''
7236 print('statement_item_19', list(p
))
7237 # { PCase*tmp = new PCase(NetCase::EQZ, $3, $5);
7238 # FILE_NAME(tmp, @1);
7242 def p_statement_item_20(p
):
7243 '''statement_item : K_case '(' expression ')' error K_endcase '''
7244 print('statement_item_20', list(p
))
7247 def p_statement_item_21(p
):
7248 '''statement_item : K_casex '(' expression ')' error K_endcase '''
7249 print('statement_item_21', list(p
))
7252 def p_statement_item_22(p
):
7253 '''statement_item : K_casez '(' expression ')' error K_endcase '''
7254 print('statement_item_22', list(p
))
7257 def p_statement_item_23(p
):
7258 '''statement_item : K_if '(' expression ')' statement_or_null %prec less_than_K_else '''
7259 print('statement_item_23', list(p
))
7260 # { PCondit*tmp = new PCondit($3, $5, 0);
7261 # FILE_NAME(tmp, @1);
7265 def p_statement_item_24(p
):
7266 '''statement_item : K_if '(' expression ')' statement_or_null K_else statement_or_null '''
7267 print('statement_item_24', list(p
))
7268 # { PCondit*tmp = new PCondit($3, $5, $7);
7269 # FILE_NAME(tmp, @1);
7273 def p_statement_item_25(p
):
7274 '''statement_item : K_if '(' error ')' statement_or_null %prec less_than_K_else '''
7275 print('statement_item_25', list(p
))
7276 # { yyerror(@1, "error: Malformed conditional expression.");
7280 def p_statement_item_26(p
):
7281 '''statement_item : K_if '(' error ')' statement_or_null K_else statement_or_null '''
7282 print('statement_item_26', list(p
))
7283 # { yyerror(@1, "error: Malformed conditional expression.");
7287 def p_statement_item_27(p
):
7288 '''statement_item : compressed_statement ';' '''
7289 print('statement_item_27', list(p
))
7292 def p_statement_item_28(p
):
7293 '''statement_item : inc_or_dec_expression ';' '''
7294 print('statement_item_28', list(p
))
7295 # { $$ = pform_compressed_assign_from_inc_dec(@1, $1); }
7297 def p_statement_item_29(p
):
7298 '''statement_item : delay1 statement_or_null '''
7299 print('statement_item_29', list(p
))
7300 # { PExpr*del = $1->front();
7301 # assert($1->size() == 1);
7303 # PDelayStatement*tmp = new PDelayStatement(del, $2);
7304 # FILE_NAME(tmp, @1);
7308 def p_statement_item_30(p
):
7309 '''statement_item : event_control statement_or_null '''
7310 print('statement_item_30', list(p
))
7311 # { PEventStatement*tmp = $1;
7313 # yyerror(@1, "error: Invalid event control.");
7316 # tmp->set_statement($2);
7321 def p_statement_item_31(p
):
7322 '''statement_item : '@' '*' statement_or_null '''
7323 print('statement_item_31', list(p
))
7324 # { PEventStatement*tmp = new PEventStatement;
7325 # FILE_NAME(tmp, @1);
7326 # tmp->set_statement($3);
7330 def p_statement_item_32(p
):
7331 '''statement_item : '@' '(' '*' ')' statement_or_null '''
7332 print('statement_item_32', list(p
))
7333 # { PEventStatement*tmp = new PEventStatement;
7334 # FILE_NAME(tmp, @1);
7335 # tmp->set_statement($5);
7339 def p_statement_item_33(p
):
7340 '''statement_item : lpvalue '=' expression ';' '''
7341 print('statement_item33', list(p
))
7343 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), p
[3] ])
7344 print ("expr TODO", repr(expr
))
7346 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), ])
7347 print ("expr", repr(expr
))
7348 print ("expr (python):'%s'" % expr
)
7350 # { PAssign*tmp = new PAssign($1,$3);
7351 # FILE_NAME(tmp, @1);
7355 def p_statement_item_34(p
):
7356 '''statement_item : error '=' expression ';' '''
7357 print('statement_item_34', list(p
))
7358 # { yyerror(@2, "Syntax in assignment statement l-value.");
7363 def p_statement_item_35(p
):
7364 '''statement_item : lpvalue K_LE expression ';' '''
7365 print('statement_item_35', list(p
))
7366 # { PAssignNB*tmp = new PAssignNB($1,$3);
7367 # FILE_NAME(tmp, @1);
7371 def p_statement_item_36(p
):
7372 '''statement_item : error K_LE expression ';' '''
7373 print('statement_item_36', list(p
))
7374 # { yyerror(@2, "Syntax in assignment statement l-value.");
7379 def p_statement_item_37(p
):
7380 '''statement_item : lpvalue '=' delay1 expression ';' '''
7381 print('statement_item_37', list(p
))
7382 # { PExpr*del = $3->front(); $3->pop_front();
7383 # assert($3->empty());
7384 # PAssign*tmp = new PAssign($1,del,$4);
7385 # FILE_NAME(tmp, @1);
7389 def p_statement_item_38(p
):
7390 '''statement_item : lpvalue K_LE delay1 expression ';' '''
7391 print('statement_item_38', list(p
))
7392 # { PExpr*del = $3->front(); $3->pop_front();
7393 # assert($3->empty());
7394 # PAssignNB*tmp = new PAssignNB($1,del,$4);
7395 # FILE_NAME(tmp, @1);
7399 def p_statement_item_39(p
):
7400 '''statement_item : lpvalue '=' event_control expression ';' '''
7401 print('statement_item_39', list(p
))
7402 # { PAssign*tmp = new PAssign($1,0,$3,$4);
7403 # FILE_NAME(tmp, @1);
7407 def p_statement_item_40(p
):
7408 '''statement_item : lpvalue '=' K_repeat '(' expression ')' event_control expression ';' '''
7409 print('statement_item_40', list(p
))
7410 # { PAssign*tmp = new PAssign($1,$5,$7,$8);
7411 # FILE_NAME(tmp,@1);
7412 # tmp->set_lineno(@1.first_line);
7416 def p_statement_item_41(p
):
7417 '''statement_item : lpvalue K_LE event_control expression ';' '''
7418 print('statement_item_41', list(p
))
7419 # { PAssignNB*tmp = new PAssignNB($1,0,$3,$4);
7420 # FILE_NAME(tmp, @1);
7424 def p_statement_item_42(p
):
7425 '''statement_item : lpvalue K_LE K_repeat '(' expression ')' event_control expression ';' '''
7426 print('statement_item_42', list(p
))
7427 # { PAssignNB*tmp = new PAssignNB($1,$5,$7,$8);
7428 # FILE_NAME(tmp, @1);
7432 def p_statement_item_43(p
):
7433 '''statement_item : lpvalue '=' dynamic_array_new ';' '''
7434 print('statement_item_43', list(p
))
7435 # { PAssign*tmp = new PAssign($1,$3);
7436 # FILE_NAME(tmp, @1);
7440 def p_statement_item_44(p
):
7441 '''statement_item : lpvalue '=' class_new ';' '''
7442 print('statement_item_44', list(p
))
7443 # { PAssign*tmp = new PAssign($1,$3);
7444 # FILE_NAME(tmp, @1);
7448 def p_statement_item_45(p
):
7449 '''statement_item : K_wait '(' expression ')' statement_or_null '''
7450 print('statement_item_45', list(p
))
7451 # { PEventStatement*tmp;
7452 # PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, $3);
7453 # tmp = new PEventStatement(etmp);
7454 # FILE_NAME(tmp,@1);
7455 # tmp->set_statement($5);
7459 def p_statement_item_46(p
):
7460 '''statement_item : K_wait K_fork ';' '''
7461 print('statement_item_46', list(p
))
7462 # { PEventStatement*tmp = new PEventStatement((PEEvent*)0);
7463 # FILE_NAME(tmp,@1);
7467 def p_statement_item_47(p
):
7468 '''statement_item : SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';' '''
7469 print('statement_item_47', list(p
))
7470 # { PCallTask*tmp = new PCallTask(lex_strings.make($1), *$3);
7471 # FILE_NAME(tmp,@1);
7477 def p_statement_item_48(p
):
7478 '''statement_item : SYSTEM_IDENTIFIER ';' '''
7479 print('statement_item_48', list(p
))
7481 # PCallTask*tmp = new PCallTask(lex_strings.make($1), pt);
7482 # FILE_NAME(tmp,@1);
7487 def p_statement_item_49(p
):
7488 '''statement_item : hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7489 print('statement_item_49', list(p
))
7490 # { PCallTask*tmp = pform_make_call_task(@1, *$1, *$3);
7496 def p_statement_item_50(p
):
7497 '''statement_item : hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';' '''
7498 print('statement_item_50', list(p
))
7499 # { /* ....randomize with { <constraints> } */
7500 # if ($1 && peek_tail_name(*$1) == "randomize") {
7501 # if (!gn_system_verilog())
7502 # yyerror(@2, "error: Randomize with constraint requires SystemVerilog.");
7504 # yyerror(@2, "sorry: Randomize with constraint not supported.");
7506 # yyerror(@2, "error: Constraint block can only be applied to randomize method.");
7509 # PCallTask*tmp = new PCallTask(*$1, pt);
7510 # FILE_NAME(tmp, @1);
7515 def p_statement_item_51(p
):
7516 '''statement_item : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7517 print('statement_item_51', list(p
))
7518 # { pform_name_t*t_name = $1;
7519 # while (! $3->empty()) {
7520 # t_name->push_back($3->front());
7523 # PCallTask*tmp = new PCallTask(*t_name, *$5);
7524 # FILE_NAME(tmp, @1);
7531 def p_statement_item_52(p
):
7532 '''statement_item : hierarchy_identifier ';' '''
7533 print('statement_item_52', list(p
))
7535 # PCallTask*tmp = pform_make_call_task(@1, *$1, pt);
7540 def p_statement_item_53(p
):
7541 '''statement_item : implicit_class_handle '.' K_new '(' expression_list_with_nuls ')' ';' '''
7542 print('statement_item_53', list(p
))
7543 # { PChainConstructor*tmp = new PChainConstructor(*$5);
7544 # FILE_NAME(tmp, @3);
7549 def p_statement_item_54(p
):
7550 '''statement_item : hierarchy_identifier '(' error ')' ';' '''
7551 print('statement_item_54', list(p
))
7552 # { yyerror(@3, "error: Syntax error in task arguments.");
7554 # PCallTask*tmp = pform_make_call_task(@1, *$1, pt);
7559 def p_statement_item_55(p
):
7560 '''statement_item : error ';' '''
7561 print('statement_item_55', list(p
))
7562 # { yyerror(@2, "error: malformed statement");
7567 def p__embed0_statement_item(p
):
7568 '''_embed0_statement_item : '''
7569 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_SEQ);
7570 # FILE_NAME(tmp, @1);
7571 # current_block_stack.push(tmp);
7574 def p__embed1_statement_item(p
):
7575 '''_embed1_statement_item : '''
7577 # if (! gn_system_verilog()) {
7578 # yyerror("error: Variable declaration in unnamed block "
7579 # "requires SystemVerilog.");
7582 # /* If there are no declarations in the scope then just delete it. */
7583 # pform_pop_scope();
7584 # assert(! current_block_stack.empty());
7585 # PBlock*tmp = current_block_stack.top();
7586 # current_block_stack.pop();
7591 def p__embed2_statement_item(p
):
7592 '''_embed2_statement_item : '''
7593 # { PBlock*tmp = pform_push_block_scope($3, PBlock::BL_SEQ);
7594 # FILE_NAME(tmp, @1);
7595 # current_block_stack.push(tmp);
7598 def p__embed3_statement_item(p
):
7599 '''_embed3_statement_item : '''
7600 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
7601 # FILE_NAME(tmp, @1);
7602 # current_block_stack.push(tmp);
7605 def p__embed4_statement_item(p
):
7606 '''_embed4_statement_item : '''
7608 # if (! gn_system_verilog()) {
7609 # yyerror("error: Variable declaration in unnamed block "
7610 # "requires SystemVerilog.");
7613 # /* If there are no declarations in the scope then just delete it. */
7614 # pform_pop_scope();
7615 # assert(! current_block_stack.empty());
7616 # PBlock*tmp = current_block_stack.top();
7617 # current_block_stack.pop();
7622 def p__embed5_statement_item(p
):
7623 '''_embed5_statement_item : '''
7624 # { PBlock*tmp = pform_push_block_scope($3, PBlock::BL_PAR);
7625 # FILE_NAME(tmp, @1);
7626 # current_block_stack.push(tmp);
7629 def p_compressed_statement_1(p
):
7630 '''compressed_statement : lpvalue K_PLUS_EQ expression '''
7631 print('compressed_statement_1', list(p
))
7632 # { PAssign*tmp = new PAssign($1, '+', $3);
7633 # FILE_NAME(tmp, @1);
7637 def p_compressed_statement_2(p
):
7638 '''compressed_statement : lpvalue K_MINUS_EQ expression '''
7639 print('compressed_statement_2', list(p
))
7640 # { PAssign*tmp = new PAssign($1, '-', $3);
7641 # FILE_NAME(tmp, @1);
7645 def p_compressed_statement_3(p
):
7646 '''compressed_statement : lpvalue K_MUL_EQ expression '''
7647 print('compressed_statement_3', list(p
))
7648 # { PAssign*tmp = new PAssign($1, '*', $3);
7649 # FILE_NAME(tmp, @1);
7653 def p_compressed_statement_4(p
):
7654 '''compressed_statement : lpvalue K_DIV_EQ expression '''
7655 print('compressed_statement_4', list(p
))
7656 # { PAssign*tmp = new PAssign($1, '/', $3);
7657 # FILE_NAME(tmp, @1);
7661 def p_compressed_statement_5(p
):
7662 '''compressed_statement : lpvalue K_MOD_EQ expression '''
7663 print('compressed_statement_5', list(p
))
7664 # { PAssign*tmp = new PAssign($1, '%', $3);
7665 # FILE_NAME(tmp, @1);
7669 def p_compressed_statement_6(p
):
7670 '''compressed_statement : lpvalue K_AND_EQ expression '''
7671 print('compressed_statement_6', list(p
))
7672 # { PAssign*tmp = new PAssign($1, '&', $3);
7673 # FILE_NAME(tmp, @1);
7677 def p_compressed_statement_7(p
):
7678 '''compressed_statement : lpvalue K_OR_EQ expression '''
7679 print('compressed_statement_7', list(p
))
7680 # { PAssign*tmp = new PAssign($1, '|', $3);
7681 # FILE_NAME(tmp, @1);
7685 def p_compressed_statement_8(p
):
7686 '''compressed_statement : lpvalue K_XOR_EQ expression '''
7687 print('compressed_statement_8', list(p
))
7688 # { PAssign*tmp = new PAssign($1, '^', $3);
7689 # FILE_NAME(tmp, @1);
7693 def p_compressed_statement_9(p
):
7694 '''compressed_statement : lpvalue K_LS_EQ expression '''
7695 print('compressed_statement_9', list(p
))
7696 # { PAssign *tmp = new PAssign($1, 'l', $3);
7697 # FILE_NAME(tmp, @1);
7701 def p_compressed_statement_10(p
):
7702 '''compressed_statement : lpvalue K_RS_EQ expression '''
7703 print('compressed_statement_10', list(p
))
7704 # { PAssign*tmp = new PAssign($1, 'r', $3);
7705 # FILE_NAME(tmp, @1);
7709 def p_compressed_statement_11(p
):
7710 '''compressed_statement : lpvalue K_RSS_EQ expression '''
7711 print('compressed_statement_11', list(p
))
7712 # { PAssign *tmp = new PAssign($1, 'R', $3);
7713 # FILE_NAME(tmp, @1);
7717 def p_statement_or_null_list_opt_1(p
):
7718 '''statement_or_null_list_opt : statement_or_null_list '''
7719 print('statement_or_null_list_opt_1', list(p
))
7722 def p_statement_or_null_list_opt_2(p
):
7723 '''statement_or_null_list_opt : '''
7724 print('statement_or_null_list_opt_2', list(p
))
7727 def p_statement_or_null_list_1(p
):
7728 '''statement_or_null_list : statement_or_null_list statement_or_null '''
7729 print('statement_or_null_list_1', list(p
))
7730 # { vector<Statement*>*tmp = $1;
7731 # if ($2) tmp->push_back($2);
7735 def p_statement_or_null_list_2(p
):
7736 '''statement_or_null_list : statement_or_null '''
7737 print('statement_or_null_list_2', list(p
))
7738 # { vector<Statement*>*tmp = new vector<Statement*>(0);
7739 # if ($1) tmp->push_back($1);
7743 def p_analog_statement_1(p
):
7744 '''analog_statement : branch_probe_expression K_CONTRIBUTE expression ';' '''
7745 print('analog_statement_1', list(p
))
7746 # { $$ = pform_contribution_statement(@2, $1, $3); }
7748 def p_task_item_1(p
):
7749 '''task_item : block_item_decl '''
7750 print('task_item_1', list(p
))
7751 # { $$ = new vector<pform_tf_port_t>(0); }
7753 def p_task_item_2(p
):
7754 '''task_item : tf_port_declaration '''
7755 print('task_item_2', list(p
))
7758 def p_task_item_list_1(p
):
7759 '''task_item_list : task_item_list task_item '''
7760 print('task_item_list_1', list(p
))
7761 # { vector<pform_tf_port_t>*tmp = $1;
7762 # size_t s1 = tmp->size();
7763 # tmp->resize(s1 + $2->size());
7764 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
7765 # tmp->at(s1 + idx) = $2->at(idx);
7770 def p_task_item_list_2(p
):
7771 '''task_item_list : task_item '''
7772 print('task_item_list_2', list(p
))
7775 def p_task_item_list_opt_1(p
):
7776 '''task_item_list_opt : task_item_list '''
7777 print('task_item_list_opt_1', list(p
))
7780 def p_task_item_list_opt_2(p
):
7781 '''task_item_list_opt : '''
7782 print('task_item_list_opt_2', list(p
))
7785 def p_tf_port_list_opt_1(p
):
7786 '''tf_port_list_opt : tf_port_list '''
7787 print('tf_port_list_opt_1', list(p
))
7790 def p_tf_port_list_opt_2(p
):
7791 '''tf_port_list_opt : '''
7792 print('tf_port_list_opt_2', list(p
))
7795 def p_udp_body_1(p
):
7796 '''udp_body : K_table udp_entry_list K_endtable '''
7797 print('udp_body_1', list(p
))
7798 # { lex_end_table();
7802 def p_udp_body_2(p
):
7803 '''udp_body : K_table K_endtable '''
7804 print('udp_body_2', list(p
))
7805 # { lex_end_table();
7806 # yyerror(@1, "error: Empty UDP table.");
7810 def p_udp_body_3(p
):
7811 '''udp_body : K_table error K_endtable '''
7812 print('udp_body_3', list(p
))
7813 # { lex_end_table();
7814 # yyerror(@2, "Errors in UDP table");
7819 def p_udp_entry_list_1(p
):
7820 '''udp_entry_list : udp_comb_entry_list '''
7821 print('udp_entry_list_1', list(p
))
7823 def p_udp_entry_list_2(p
):
7824 '''udp_entry_list : udp_sequ_entry_list '''
7825 print('udp_entry_list_2', list(p
))
7827 def p_udp_comb_entry_1(p
):
7828 '''udp_comb_entry : udp_input_list ':' udp_output_sym ';' '''
7829 print('udp_comb_entry_1', list(p
))
7830 # { char*tmp = new char[strlen($1)+3];
7832 # char*tp = tmp+strlen(tmp);
7840 def p_udp_comb_entry_list_1(p
):
7841 '''udp_comb_entry_list : udp_comb_entry '''
7842 print('udp_comb_entry_list_1', list(p
))
7843 # { list<string>*tmp = new list<string>;
7844 # tmp->push_back($1);
7849 def p_udp_comb_entry_list_2(p
):
7850 '''udp_comb_entry_list : udp_comb_entry_list udp_comb_entry '''
7851 print('udp_comb_entry_list_2', list(p
))
7852 # { list<string>*tmp = $1;
7853 # tmp->push_back($2);
7858 def p_udp_sequ_entry_list_1(p
):
7859 '''udp_sequ_entry_list : udp_sequ_entry '''
7860 print('udp_sequ_entry_list_1', list(p
))
7861 # { list<string>*tmp = new list<string>;
7862 # tmp->push_back($1);
7867 def p_udp_sequ_entry_list_2(p
):
7868 '''udp_sequ_entry_list : udp_sequ_entry_list udp_sequ_entry '''
7869 print('udp_sequ_entry_list_2', list(p
))
7870 # { list<string>*tmp = $1;
7871 # tmp->push_back($2);
7876 def p_udp_sequ_entry_1(p
):
7877 '''udp_sequ_entry : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' '''
7878 print('udp_sequ_entry_1', list(p
))
7879 # { char*tmp = new char[strlen($1)+5];
7881 # char*tp = tmp+strlen(tmp);
7890 def p_udp_initial_1(p
):
7891 '''udp_initial : K_initial IDENTIFIER '=' number ';' '''
7892 print('udp_initial_1', list(p
))
7893 # { PExpr*etmp = new PENumber($4);
7894 # PEIdent*itmp = new PEIdent(lex_strings.make($2));
7895 # PAssign*atmp = new PAssign(itmp, etmp);
7896 # FILE_NAME(atmp, @2);
7901 def p_udp_init_opt_1(p
):
7902 '''udp_init_opt : udp_initial '''
7903 print('udp_init_opt_1', list(p
))
7906 def p_udp_init_opt_2(p
):
7907 '''udp_init_opt : '''
7908 print('udp_init_opt_2', list(p
))
7911 def p_udp_input_list_1(p
):
7912 '''udp_input_list : udp_input_sym '''
7913 print('udp_input_list_1', list(p
))
7914 # { char*tmp = new char[2];
7920 def p_udp_input_list_2(p
):
7921 '''udp_input_list : udp_input_list udp_input_sym '''
7922 print('udp_input_list_2', list(p
))
7923 # { char*tmp = new char[strlen($1)+2];
7925 # char*tp = tmp+strlen(tmp);
7932 def p_udp_input_sym_1(p
):
7933 '''udp_input_sym : '0' '''
7934 print('udp_input_sym_1', list(p
))
7937 def p_udp_input_sym_2(p
):
7938 '''udp_input_sym : '1' '''
7939 print('udp_input_sym_2', list(p
))
7942 def p_udp_input_sym_3(p
):
7943 '''udp_input_sym : 'x' '''
7944 print('udp_input_sym_3', list(p
))
7947 def p_udp_input_sym_4(p
):
7948 '''udp_input_sym : '?' '''
7949 print('udp_input_sym_4', list(p
))
7952 def p_udp_input_sym_5(p
):
7953 '''udp_input_sym : 'b' '''
7954 print('udp_input_sym_5', list(p
))
7957 def p_udp_input_sym_6(p
):
7958 '''udp_input_sym : '*' '''
7959 print('udp_input_sym_6', list(p
))
7962 def p_udp_input_sym_7(p
):
7963 '''udp_input_sym : '%' '''
7964 print('udp_input_sym_7', list(p
))
7967 def p_udp_input_sym_8(p
):
7968 '''udp_input_sym : 'f' '''
7969 print('udp_input_sym_8', list(p
))
7972 def p_udp_input_sym_9(p
):
7973 '''udp_input_sym : 'F' '''
7974 print('udp_input_sym_9', list(p
))
7977 def p_udp_input_sym_10(p
):
7978 '''udp_input_sym : 'l' '''
7979 print('udp_input_sym_10', list(p
))
7982 def p_udp_input_sym_11(p
):
7983 '''udp_input_sym : 'h' '''
7984 print('udp_input_sym_11', list(p
))
7987 def p_udp_input_sym_12(p
):
7988 '''udp_input_sym : 'B' '''
7989 print('udp_input_sym_12', list(p
))
7992 def p_udp_input_sym_13(p
):
7993 '''udp_input_sym : 'r' '''
7994 print('udp_input_sym_13', list(p
))
7997 def p_udp_input_sym_14(p
):
7998 '''udp_input_sym : 'R' '''
7999 print('udp_input_sym_14', list(p
))
8002 def p_udp_input_sym_15(p
):
8003 '''udp_input_sym : 'M' '''
8004 print('udp_input_sym_15', list(p
))
8007 def p_udp_input_sym_16(p
):
8008 '''udp_input_sym : 'n' '''
8009 print('udp_input_sym_16', list(p
))
8012 def p_udp_input_sym_17(p
):
8013 '''udp_input_sym : 'N' '''
8014 print('udp_input_sym_17', list(p
))
8017 def p_udp_input_sym_18(p
):
8018 '''udp_input_sym : 'p' '''
8019 print('udp_input_sym_18', list(p
))
8022 def p_udp_input_sym_19(p
):
8023 '''udp_input_sym : 'P' '''
8024 print('udp_input_sym_19', list(p
))
8027 def p_udp_input_sym_20(p
):
8028 '''udp_input_sym : 'Q' '''
8029 print('udp_input_sym_20', list(p
))
8032 def p_udp_input_sym_21(p
):
8033 '''udp_input_sym : 'q' '''
8034 print('udp_input_sym_21', list(p
))
8037 def p_udp_input_sym_22(p
):
8038 '''udp_input_sym : '_' '''
8039 print('udp_input_sym_22', list(p
))
8042 def p_udp_input_sym_23(p
):
8043 '''udp_input_sym : '+' '''
8044 print('udp_input_sym_23', list(p
))
8047 def p_udp_input_sym_24(p
):
8048 '''udp_input_sym : DEC_NUMBER '''
8049 print('udp_input_sym_24', list(p
))
8050 # { yyerror(@1, "internal error: Input digits parse as decimal number!"); $$ = '0'; }
8052 def p_udp_output_sym_1(p
):
8053 '''udp_output_sym : '0' '''
8054 print('udp_output_sym_1', list(p
))
8057 def p_udp_output_sym_2(p
):
8058 '''udp_output_sym : '1' '''
8059 print('udp_output_sym_2', list(p
))
8062 def p_udp_output_sym_3(p
):
8063 '''udp_output_sym : 'x' '''
8064 print('udp_output_sym_3', list(p
))
8067 def p_udp_output_sym_4(p
):
8068 '''udp_output_sym : '-' '''
8069 print('udp_output_sym_4', list(p
))
8072 def p_udp_output_sym_5(p
):
8073 '''udp_output_sym : DEC_NUMBER '''
8074 print('udp_output_sym_5', list(p
))
8075 # { yyerror(@1, "internal error: Output digits parse as decimal number!"); $$ = '0'; }
8077 def p_udp_port_decl_1(p
):
8078 '''udp_port_decl : K_input list_of_identifiers ';' '''
8079 print('udp_port_decl_1', list(p
))
8080 # { $$ = pform_make_udp_input_ports($2); }
8082 def p_udp_port_decl_2(p
):
8083 '''udp_port_decl : K_output IDENTIFIER ';' '''
8084 print('udp_port_decl_2', list(p
))
8085 # { perm_string pname = lex_strings.make($2);
8086 # PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
8087 # vector<PWire*>*tmp = new vector<PWire*>(1);
8093 def p_udp_port_decl_3(p
):
8094 '''udp_port_decl : K_reg IDENTIFIER ';' '''
8095 print('udp_port_decl_3', list(p
))
8096 # { perm_string pname = lex_strings.make($2);
8097 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
8098 # vector<PWire*>*tmp = new vector<PWire*>(1);
8104 def p_udp_port_decl_4(p
):
8105 '''udp_port_decl : K_reg K_output IDENTIFIER ';' '''
8106 print('udp_port_decl_4', list(p
))
8107 # { perm_string pname = lex_strings.make($3);
8108 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
8109 # vector<PWire*>*tmp = new vector<PWire*>(1);
8115 def p_udp_port_decls_1(p
):
8116 '''udp_port_decls : udp_port_decl '''
8117 print('udp_port_decls_1', list(p
))
8120 def p_udp_port_decls_2(p
):
8121 '''udp_port_decls : udp_port_decls udp_port_decl '''
8122 print('udp_port_decls_2', list(p
))
8123 # { vector<PWire*>*tmp = $1;
8124 # size_t s1 = $1->size();
8125 # tmp->resize(s1+$2->size());
8126 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
8127 # tmp->at(s1+idx) = $2->at(idx);
8132 def p_udp_port_list_1(p
):
8133 '''udp_port_list : IDENTIFIER '''
8134 print('udp_port_list_1', list(p
))
8135 # { list<perm_string>*tmp = new list<perm_string>;
8136 # tmp->push_back(lex_strings.make($1));
8141 def p_udp_port_list_2(p
):
8142 '''udp_port_list : udp_port_list ',' IDENTIFIER '''
8143 print('udp_port_list_2', list(p
))
8144 # { list<perm_string>*tmp = $1;
8145 # tmp->push_back(lex_strings.make($3));
8150 def p_udp_reg_opt_1(p
):
8151 '''udp_reg_opt : K_reg '''
8152 print('udp_reg_opt_1', list(p
))
8155 def p_udp_reg_opt_2(p
):
8156 '''udp_reg_opt : '''
8157 print('udp_reg_opt_2', list(p
))
8160 def p_udp_initial_expr_opt_1(p
):
8161 '''udp_initial_expr_opt : '=' expression '''
8162 print('udp_initial_expr_opt_1', list(p
))
8165 def p_udp_initial_expr_opt_2(p
):
8166 '''udp_initial_expr_opt : '''
8167 print('udp_initial_expr_opt_2', list(p
))
8170 def p_udp_input_declaration_list_1(p
):
8171 '''udp_input_declaration_list : K_input IDENTIFIER '''
8172 print('udp_input_declaration_list_1', list(p
))
8173 # { list<perm_string>*tmp = new list<perm_string>;
8174 # tmp->push_back(lex_strings.make($2));
8179 def p_udp_input_declaration_list_2(p
):
8180 '''udp_input_declaration_list : udp_input_declaration_list ',' K_input IDENTIFIER '''
8181 print('udp_input_declaration_list_2', list(p
))
8182 # { list<perm_string>*tmp = $1;
8183 # tmp->push_back(lex_strings.make($4));
8188 def p_udp_primitive_1(p
):
8189 '''udp_primitive : K_primitive IDENTIFIER '(' udp_port_list ')' ';' udp_port_decls udp_init_opt udp_body K_endprimitive endlabel_opt '''
8190 print('udp_primitive_1', list(p
))
8191 # { perm_string tmp2 = lex_strings.make($2);
8192 # pform_make_udp(tmp2, $4, $7, $9, $8,
8193 # @2.text, @2.first_line);
8195 # if (strcmp($2,$11) != 0) {
8196 # yyerror(@11, "error: End label doesn't match "
8197 # "primitive name");
8199 # if (! gn_system_verilog()) {
8200 # yyerror(@11, "error: Primitive end labels "
8201 # "require SystemVerilog.");
8208 def p_udp_primitive_2(p
):
8209 '''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 '''
8210 print('udp_primitive_2', list(p
))
8211 # { perm_string tmp2 = lex_strings.make($2);
8212 # perm_string tmp6 = lex_strings.make($6);
8213 # pform_make_udp(tmp2, $5, tmp6, $7, $9, $12,
8214 # @2.text, @2.first_line);
8216 # if (strcmp($2,$14) != 0) {
8217 # yyerror(@14, "error: End label doesn't match "
8218 # "primitive name");
8220 # if (! gn_system_verilog()) {
8221 # yyerror(@14, "error: Primitive end labels "
8222 # "require SystemVerilog.");
8230 def p_K_packed_opt_1(p
):
8231 '''K_packed_opt : K_packed '''
8232 print('K_packed_opt', list(p
))
8235 def p_K_packed_opt_2(p
):
8236 '''K_packed_opt : '''
8237 print('K_packed_opt', list(p
))
8240 def p_K_reg_opt_1(p
):
8241 '''K_reg_opt : K_reg '''
8242 print('K_reg_opt', list(p
))
8245 def p_K_reg_opt_2(p
):
8247 print('K_reg_opt', list(p
))
8250 def p_K_static_opt_1(p
):
8251 '''K_static_opt : K_static '''
8252 print('K_static_opt', list(p
))
8255 def p_K_static_opt_2(p
):
8256 '''K_static_opt : '''
8257 print('K_static_opt', list(p
))
8261 def p_K_virtual_opt_1(p
):
8262 '''K_virtual_opt : K_virtual '''
8266 def p_K_virtual_opt_2(p
):
8267 '''K_virtual_opt : '''