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
))
3242 def p_expression_2(p
):
3243 '''expression : inc_or_dec_expression '''
3244 print('expression_2', list(p
))
3247 def p_expression_3(p
):
3248 '''expression : inside_expression '''
3249 print('expression_3', list(p
))
3252 def p_expression_4(p
):
3253 '''expression : '+' attribute_list_opt expr_primary %prec UNARY_PREC '''
3254 print('expression_4', list(p
))
3257 def p_expression_5(p
):
3258 '''expression : '-' attribute_list_opt expr_primary %prec UNARY_PREC '''
3259 print('expression_5', list(p
))
3260 # { PEUnary*tmp = new PEUnary('-', $3);
3261 # FILE_NAME(tmp, @3);
3265 def p_expression_6(p
):
3266 '''expression : '~' attribute_list_opt expr_primary %prec UNARY_PREC '''
3267 print('expression_6', list(p
))
3268 # { PEUnary*tmp = new PEUnary('~', $3);
3269 # FILE_NAME(tmp, @3);
3273 def p_expression_7(p
):
3274 '''expression : '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3275 print('expression_7', list(p
))
3276 # { PEUnary*tmp = new PEUnary('&', $3);
3277 # FILE_NAME(tmp, @3);
3281 def p_expression_8(p
):
3282 '''expression : '!' attribute_list_opt expr_primary %prec UNARY_PREC '''
3283 print('expression_8', list(p
))
3284 # { PEUnary*tmp = new PEUnary('!', $3);
3285 # FILE_NAME(tmp, @3);
3289 def p_expression_9(p
):
3290 '''expression : '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3291 print('expression_9', list(p
))
3292 # { PEUnary*tmp = new PEUnary('|', $3);
3293 # FILE_NAME(tmp, @3);
3297 def p_expression_10(p
):
3298 '''expression : '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3299 print('expression_10', list(p
))
3300 # { PEUnary*tmp = new PEUnary('^', $3);
3301 # FILE_NAME(tmp, @3);
3305 def p_expression_11(p
):
3306 '''expression : '~' '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3307 print('expression_11', list(p
))
3308 # { yyerror(@1, "error: '~' '&' is not a valid expression. "
3309 # "Please use operator '~&' instead.");
3313 def p_expression_12(p
):
3314 '''expression : '~' '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3315 print('expression_12', list(p
))
3316 # { yyerror(@1, "error: '~' '|' is not a valid expression. "
3317 # "Please use operator '~|' instead.");
3321 def p_expression_13(p
):
3322 '''expression : '~' '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3323 print('expression_13', list(p
))
3324 # { yyerror(@1, "error: '~' '^' is not a valid expression. "
3325 # "Please use operator '~^' instead.");
3329 def p_expression_14(p
):
3330 '''expression : K_NAND attribute_list_opt expr_primary %prec UNARY_PREC '''
3331 print('expression_14', list(p
))
3332 # { PEUnary*tmp = new PEUnary('A', $3);
3333 # FILE_NAME(tmp, @3);
3337 def p_expression_15(p
):
3338 '''expression : K_NOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3339 print('expression_15', list(p
))
3340 # { PEUnary*tmp = new PEUnary('N', $3);
3341 # FILE_NAME(tmp, @3);
3345 def p_expression_16(p
):
3346 '''expression : K_NXOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3347 print('expression_16', list(p
))
3348 # { PEUnary*tmp = new PEUnary('X', $3);
3349 # FILE_NAME(tmp, @3);
3353 def p_expression_17(p
):
3354 '''expression : '!' error %prec UNARY_PREC '''
3355 print('expression_17', list(p
))
3356 # { yyerror(@1, "error: Operand of unary ! "
3357 # "is not a primary expression.");
3361 def p_expression_18(p
):
3362 '''expression : '^' error %prec UNARY_PREC '''
3363 print('expression_18', list(p
))
3364 # { yyerror(@1, "error: Operand of reduction ^ "
3365 # "is not a primary expression.");
3369 def p_expression_19(p
):
3370 '''expression : expression '^' attribute_list_opt expression '''
3371 print('expression_19', list(p
))
3372 # { PEBinary*tmp = new PEBinary('^', $1, $4);
3373 # FILE_NAME(tmp, @2);
3377 def p_expression_20(p
):
3378 '''expression : expression K_POW attribute_list_opt expression '''
3379 print('expression_20', list(p
))
3380 # { PEBinary*tmp = new PEBPower('p', $1, $4);
3381 # FILE_NAME(tmp, @2);
3385 def p_expression_21(p
):
3386 '''expression : expression '*' attribute_list_opt expression '''
3387 print('expression_21', list(p
))
3388 # { PEBinary*tmp = new PEBinary('*', $1, $4);
3389 # FILE_NAME(tmp, @2);
3393 def p_expression_22(p
):
3394 '''expression : expression '/' attribute_list_opt expression '''
3395 print('expression_22', list(p
))
3396 # { PEBinary*tmp = new PEBinary('/', $1, $4);
3397 # FILE_NAME(tmp, @2);
3401 def p_expression_23(p
):
3402 '''expression : expression '%' attribute_list_opt expression '''
3403 print('expression_23', list(p
))
3404 # { PEBinary*tmp = new PEBinary('%', $1, $4);
3405 # FILE_NAME(tmp, @2);
3409 def p_expression_24(p
):
3410 '''expression : expression '+' attribute_list_opt expression '''
3411 print('expression_24', list(p
))
3412 # { PEBinary*tmp = new PEBinary('+', $1, $4);
3413 # FILE_NAME(tmp, @2);
3417 def p_expression_25(p
):
3418 '''expression : expression '-' attribute_list_opt expression '''
3419 print('expression_25', list(p
))
3420 # { PEBinary*tmp = new PEBinary('-', $1, $4);
3421 # FILE_NAME(tmp, @2);
3425 def p_expression_26(p
):
3426 '''expression : expression '&' attribute_list_opt expression '''
3427 print('expression_26', list(p
))
3428 # { PEBinary*tmp = new PEBinary('&', $1, $4);
3429 # FILE_NAME(tmp, @2);
3433 def p_expression_27(p
):
3434 '''expression : expression '|' attribute_list_opt expression '''
3435 print('expression_27', list(p
))
3436 # { PEBinary*tmp = new PEBinary('|', $1, $4);
3437 # FILE_NAME(tmp, @2);
3441 def p_expression_28(p
):
3442 '''expression : expression K_NAND attribute_list_opt expression '''
3443 print('expression_28', list(p
))
3444 # { PEBinary*tmp = new PEBinary('A', $1, $4);
3445 # FILE_NAME(tmp, @2);
3449 def p_expression_29(p
):
3450 '''expression : expression K_NOR attribute_list_opt expression '''
3451 print('expression_29', list(p
))
3452 # { PEBinary*tmp = new PEBinary('O', $1, $4);
3453 # FILE_NAME(tmp, @2);
3457 def p_expression_30(p
):
3458 '''expression : expression K_NXOR attribute_list_opt expression '''
3459 print('expression_30', list(p
))
3460 # { PEBinary*tmp = new PEBinary('X', $1, $4);
3461 # FILE_NAME(tmp, @2);
3465 def p_expression_31(p
):
3466 '''expression : expression '<' attribute_list_opt expression '''
3467 print('expression_31', list(p
))
3468 # { PEBinary*tmp = new PEBComp('<', $1, $4);
3469 # FILE_NAME(tmp, @2);
3473 def p_expression_32(p
):
3474 '''expression : expression '>' attribute_list_opt expression '''
3475 print('expression_32', list(p
))
3476 # { PEBinary*tmp = new PEBComp('>', $1, $4);
3477 # FILE_NAME(tmp, @2);
3481 def p_expression_33(p
):
3482 '''expression : expression K_LS attribute_list_opt expression '''
3483 print('expression_33', list(p
))
3484 # { PEBinary*tmp = new PEBShift('l', $1, $4);
3485 # FILE_NAME(tmp, @2);
3489 def p_expression_34(p
):
3490 '''expression : expression K_RS attribute_list_opt expression '''
3491 print('expression_34', list(p
))
3492 # { PEBinary*tmp = new PEBShift('r', $1, $4);
3493 # FILE_NAME(tmp, @2);
3497 def p_expression_35(p
):
3498 '''expression : expression K_RSS attribute_list_opt expression '''
3499 print('expression_35', list(p
))
3500 # { PEBinary*tmp = new PEBShift('R', $1, $4);
3501 # FILE_NAME(tmp, @2);
3505 def p_expression_36(p
):
3506 '''expression : expression K_EQ attribute_list_opt expression '''
3507 print('expression_36', list(p
))
3508 # { PEBinary*tmp = new PEBComp('e', $1, $4);
3509 # FILE_NAME(tmp, @2);
3513 def p_expression_37(p
):
3514 '''expression : expression K_CEQ attribute_list_opt expression '''
3515 print('expression_37', list(p
))
3516 # { PEBinary*tmp = new PEBComp('E', $1, $4);
3517 # FILE_NAME(tmp, @2);
3521 def p_expression_38(p
):
3522 '''expression : expression K_WEQ attribute_list_opt expression '''
3523 print('expression_38', list(p
))
3524 # { PEBinary*tmp = new PEBComp('w', $1, $4);
3525 # FILE_NAME(tmp, @2);
3529 def p_expression_39(p
):
3530 '''expression : expression K_LE attribute_list_opt expression '''
3531 print('expression_39', list(p
))
3532 # { PEBinary*tmp = new PEBComp('L', $1, $4);
3533 # FILE_NAME(tmp, @2);
3537 def p_expression_40(p
):
3538 '''expression : expression K_GE attribute_list_opt expression '''
3539 print('expression_40', list(p
))
3540 # { PEBinary*tmp = new PEBComp('G', $1, $4);
3541 # FILE_NAME(tmp, @2);
3545 def p_expression_41(p
):
3546 '''expression : expression K_NE attribute_list_opt expression '''
3547 print('expression_41', list(p
))
3548 # { PEBinary*tmp = new PEBComp('n', $1, $4);
3549 # FILE_NAME(tmp, @2);
3553 def p_expression_42(p
):
3554 '''expression : expression K_CNE attribute_list_opt expression '''
3555 print('expression_42', list(p
))
3556 # { PEBinary*tmp = new PEBComp('N', $1, $4);
3557 # FILE_NAME(tmp, @2);
3561 def p_expression_43(p
):
3562 '''expression : expression K_WNE attribute_list_opt expression '''
3563 print('expression_43', list(p
))
3564 # { PEBinary*tmp = new PEBComp('W', $1, $4);
3565 # FILE_NAME(tmp, @2);
3569 def p_expression_44(p
):
3570 '''expression : expression K_LOR attribute_list_opt expression '''
3571 print('expression_44', list(p
))
3572 # { PEBinary*tmp = new PEBLogic('o', $1, $4);
3573 # FILE_NAME(tmp, @2);
3577 def p_expression_45(p
):
3578 '''expression : expression K_LAND attribute_list_opt expression '''
3579 print('expression_45', list(p
))
3580 # { PEBinary*tmp = new PEBLogic('a', $1, $4);
3581 # FILE_NAME(tmp, @2);
3585 def p_expression_46(p
):
3586 '''expression : expression '?' attribute_list_opt expression ':' expression '''
3587 print('expression_46', list(p
))
3588 # { PETernary*tmp = new PETernary($1, $4, $6);
3589 # FILE_NAME(tmp, @2);
3593 def p_expr_mintypmax_1(p
):
3594 '''expr_mintypmax : expression '''
3595 print('expr_mintypmax_1', list(p
))
3598 def p_expr_mintypmax_2(p
):
3599 '''expr_mintypmax : expression ':' expression ':' expression '''
3600 print('expr_mintypmax_2', list(p
))
3601 # { switch (min_typ_max_flag) {
3618 # if (min_typ_max_warn > 0) {
3619 # cerr << $$->get_fileline() << ": warning: choosing ";
3620 # switch (min_typ_max_flag) {
3631 # cerr << " expression." << endl;
3632 # min_typ_max_warn -= 1;
3636 def p_expression_list_with_nuls_1(p
):
3637 '''expression_list_with_nuls : expression_list_with_nuls ',' expression '''
3638 print('expression_list_with_nuls_1', list(p
))
3639 # { list<PExpr*>*tmp = $1;
3640 # tmp->push_back($3);
3644 def p_expression_list_with_nuls_2(p
):
3645 '''expression_list_with_nuls : expression '''
3646 print('expression_list_with_nuls_2', list(p
))
3647 # { list<PExpr*>*tmp = new list<PExpr*>;
3648 # tmp->push_back($1);
3652 def p_expression_list_with_nuls_3(p
):
3653 '''expression_list_with_nuls : '''
3654 print('expression_list_with_nuls_3', list(p
))
3655 # { list<PExpr*>*tmp = new list<PExpr*>;
3656 # tmp->push_back(0);
3660 def p_expression_list_with_nuls_4(p
):
3661 '''expression_list_with_nuls : expression_list_with_nuls ',' '''
3662 print('expression_list_with_nuls_4', list(p
))
3663 # { list<PExpr*>*tmp = $1;
3664 # tmp->push_back(0);
3668 def p_expression_list_proper_1(p
):
3669 '''expression_list_proper : expression_list_proper ',' expression '''
3670 print('expression_list_proper_1', list(p
))
3671 # { list<PExpr*>*tmp = $1;
3672 # tmp->push_back($3);
3676 def p_expression_list_proper_2(p
):
3677 '''expression_list_proper : expression '''
3678 print('expression_list_proper_2', list(p
))
3679 # { list<PExpr*>*tmp = new list<PExpr*>;
3680 # tmp->push_back($1);
3684 def p_expr_primary_or_typename_1(p
):
3685 '''expr_primary_or_typename : expr_primary '''
3686 print('expr_primary_or_typename_1', list(p
))
3689 def p_expr_primary_or_typename_2(p
):
3690 '''expr_primary_or_typename : TYPE_IDENTIFIER '''
3691 print('expr_primary_or_typename_2', list(p
))
3693 # { PETypename*tmp = new PETypename($1.type);
3694 # FILE_NAME(tmp,@1);
3699 def p_expr_primary_1(p
):
3700 '''expr_primary : number '''
3701 print('expr_primary_1', list(p
))
3704 # PENumber*tmp = new PENumber($1);
3705 # FILE_NAME(tmp, @1);
3709 def p_expr_primary_2(p
):
3710 '''expr_primary : REALTIME '''
3711 print('expr_primary_2', list(p
))
3712 # { PEFNumber*tmp = new PEFNumber($1);
3713 # FILE_NAME(tmp, @1);
3717 def p_expr_primary_3(p
):
3718 '''expr_primary : STRING '''
3719 print('expr_primary_3', list(p
))
3720 # { PEString*tmp = new PEString($1);
3721 # FILE_NAME(tmp, @1);
3725 def p_expr_primary_4(p
):
3726 '''expr_primary : TIME_LITERAL '''
3727 print('expr_primary_4', list(p
))
3732 # if ($1 == 0 || !get_time_unit($1, unit))
3733 # yyerror(@1, "internal error: delay.");
3735 # double p = pow(10.0, (double)(unit - pform_get_timeunit()));
3736 # double time = atof($1) * p;
3738 # verireal *v = new verireal(time);
3739 # $$ = new PEFNumber(v);
3740 # FILE_NAME($$, @1);
3744 def p_expr_primary_5(p
):
3745 '''expr_primary : SYSTEM_IDENTIFIER '''
3746 print('expr_primary_5', list(p
))
3747 # { perm_string tn = lex_strings.make($1);
3748 # PECallFunction*tmp = new PECallFunction(tn);
3749 # FILE_NAME(tmp, @1);
3754 def p_expr_primary_6(p
):
3755 '''expr_primary : hierarchy_identifier '''
3756 print('expr_primary_6', list(p
))
3758 # { PEIdent*tmp = pform_new_ident(*$1);
3759 # FILE_NAME(tmp, @1);
3764 def p_expr_primary_7(p
):
3765 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier '''
3766 print('expr_primary_7', list(p
))
3767 # { $$ = pform_package_ident(@2, $1, $3);
3771 def p_expr_primary_8(p
):
3772 '''expr_primary : hierarchy_identifier '(' expression_list_with_nuls ')' '''
3773 print('expr_primary_8', list(p
))
3774 # { list<PExpr*>*expr_list = $3;
3775 # strip_tail_items(expr_list);
3776 # PECallFunction*tmp = pform_make_call_function(@1, *$1, *expr_list);
3781 def p_expr_primary_9(p
):
3782 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' '''
3783 print('expr_primary_9', list(p
))
3784 # { pform_name_t*t_name = $1;
3785 # while (! $3->empty()) {
3786 # t_name->push_back($3->front());
3789 # list<PExpr*>*expr_list = $5;
3790 # strip_tail_items(expr_list);
3791 # PECallFunction*tmp = pform_make_call_function(@1, *t_name, *expr_list);
3797 def p_expr_primary_10(p
):
3798 '''expr_primary : SYSTEM_IDENTIFIER '(' expression_list_proper ')' '''
3799 print('expr_primary_10', list(p
))
3800 # { perm_string tn = lex_strings.make($1);
3801 # PECallFunction*tmp = new PECallFunction(tn, *$3);
3802 # FILE_NAME(tmp, @1);
3807 def p_expr_primary_11(p
):
3808 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')' '''
3809 print('expr_primary_11', list(p
))
3810 # { perm_string use_name = lex_strings.make($3);
3811 # PECallFunction*tmp = new PECallFunction($1, use_name, *$5);
3812 # FILE_NAME(tmp, @3);
3817 def p_expr_primary_12(p
):
3818 '''expr_primary : SYSTEM_IDENTIFIER '(' ')' '''
3819 print('expr_primary_12', list(p
))
3820 # { perm_string tn = lex_strings.make($1);
3821 # const vector<PExpr*>empty;
3822 # PECallFunction*tmp = new PECallFunction(tn, empty);
3823 # FILE_NAME(tmp, @1);
3826 # if (!gn_system_verilog()) {
3827 # yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
3831 def p_expr_primary_13(p
):
3832 '''expr_primary : implicit_class_handle '''
3833 print('expr_primary_13', list(p
))
3834 # { PEIdent*tmp = new PEIdent(*$1);
3835 # FILE_NAME(tmp,@1);
3840 def p_expr_primary_14(p
):
3841 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '''
3842 print('expr_primary_14', list(p
))
3843 # { pform_name_t*t_name = $1;
3844 # while (! $3->empty()) {
3845 # t_name->push_back($3->front());
3848 # PEIdent*tmp = new PEIdent(*t_name);
3849 # FILE_NAME(tmp,@1);
3855 def p_expr_primary_15(p
):
3856 '''expr_primary : K_acos '(' expression ')' '''
3857 print('expr_primary_15', list(p
))
3858 # { perm_string tn = perm_string::literal("$acos");
3859 # PECallFunction*tmp = make_call_function(tn, $3);
3860 # FILE_NAME(tmp,@1);
3864 def p_expr_primary_16(p
):
3865 '''expr_primary : K_acosh '(' expression ')' '''
3866 print('expr_primary_16', list(p
))
3867 # { perm_string tn = perm_string::literal("$acosh");
3868 # PECallFunction*tmp = make_call_function(tn, $3);
3869 # FILE_NAME(tmp,@1);
3873 def p_expr_primary_17(p
):
3874 '''expr_primary : K_asin '(' expression ')' '''
3875 print('expr_primary_17', list(p
))
3876 # { perm_string tn = perm_string::literal("$asin");
3877 # PECallFunction*tmp = make_call_function(tn, $3);
3878 # FILE_NAME(tmp,@1);
3882 def p_expr_primary_18(p
):
3883 '''expr_primary : K_asinh '(' expression ')' '''
3884 print('expr_primary_18', list(p
))
3885 # { perm_string tn = perm_string::literal("$asinh");
3886 # PECallFunction*tmp = make_call_function(tn, $3);
3887 # FILE_NAME(tmp,@1);
3891 def p_expr_primary_19(p
):
3892 '''expr_primary : K_atan '(' expression ')' '''
3893 print('expr_primary_19', list(p
))
3894 # { perm_string tn = perm_string::literal("$atan");
3895 # PECallFunction*tmp = make_call_function(tn, $3);
3896 # FILE_NAME(tmp,@1);
3900 def p_expr_primary_20(p
):
3901 '''expr_primary : K_atanh '(' expression ')' '''
3902 print('expr_primary_20', list(p
))
3903 # { perm_string tn = perm_string::literal("$atanh");
3904 # PECallFunction*tmp = make_call_function(tn, $3);
3905 # FILE_NAME(tmp,@1);
3909 def p_expr_primary_21(p
):
3910 '''expr_primary : K_atan2 '(' expression ',' expression ')' '''
3911 print('expr_primary_21', list(p
))
3912 # { perm_string tn = perm_string::literal("$atan2");
3913 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3914 # FILE_NAME(tmp,@1);
3918 def p_expr_primary_22(p
):
3919 '''expr_primary : K_ceil '(' expression ')' '''
3920 print('expr_primary_22', list(p
))
3921 # { perm_string tn = perm_string::literal("$ceil");
3922 # PECallFunction*tmp = make_call_function(tn, $3);
3923 # FILE_NAME(tmp,@1);
3927 def p_expr_primary_23(p
):
3928 '''expr_primary : K_cos '(' expression ')' '''
3929 print('expr_primary_23', list(p
))
3930 # { perm_string tn = perm_string::literal("$cos");
3931 # PECallFunction*tmp = make_call_function(tn, $3);
3932 # FILE_NAME(tmp,@1);
3936 def p_expr_primary_24(p
):
3937 '''expr_primary : K_cosh '(' expression ')' '''
3938 print('expr_primary_24', list(p
))
3939 # { perm_string tn = perm_string::literal("$cosh");
3940 # PECallFunction*tmp = make_call_function(tn, $3);
3941 # FILE_NAME(tmp,@1);
3945 def p_expr_primary_25(p
):
3946 '''expr_primary : K_exp '(' expression ')' '''
3947 print('expr_primary_25', list(p
))
3948 # { perm_string tn = perm_string::literal("$exp");
3949 # PECallFunction*tmp = make_call_function(tn, $3);
3950 # FILE_NAME(tmp,@1);
3954 def p_expr_primary_26(p
):
3955 '''expr_primary : K_floor '(' expression ')' '''
3956 print('expr_primary_26', list(p
))
3957 # { perm_string tn = perm_string::literal("$floor");
3958 # PECallFunction*tmp = make_call_function(tn, $3);
3959 # FILE_NAME(tmp,@1);
3963 def p_expr_primary_27(p
):
3964 '''expr_primary : K_hypot '(' expression ',' expression ')' '''
3965 print('expr_primary_27', list(p
))
3966 # { perm_string tn = perm_string::literal("$hypot");
3967 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3968 # FILE_NAME(tmp,@1);
3972 def p_expr_primary_28(p
):
3973 '''expr_primary : K_ln '(' expression ')' '''
3974 print('expr_primary_28', list(p
))
3975 # { perm_string tn = perm_string::literal("$ln");
3976 # PECallFunction*tmp = make_call_function(tn, $3);
3977 # FILE_NAME(tmp,@1);
3981 def p_expr_primary_29(p
):
3982 '''expr_primary : K_log '(' expression ')' '''
3983 print('expr_primary_29', list(p
))
3984 # { perm_string tn = perm_string::literal("$log10");
3985 # PECallFunction*tmp = make_call_function(tn, $3);
3986 # FILE_NAME(tmp,@1);
3990 def p_expr_primary_30(p
):
3991 '''expr_primary : K_pow '(' expression ',' expression ')' '''
3992 print('expr_primary_30', list(p
))
3993 # { perm_string tn = perm_string::literal("$pow");
3994 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3995 # FILE_NAME(tmp,@1);
3999 def p_expr_primary_31(p
):
4000 '''expr_primary : K_sin '(' expression ')' '''
4001 print('expr_primary_31', list(p
))
4002 # { perm_string tn = perm_string::literal("$sin");
4003 # PECallFunction*tmp = make_call_function(tn, $3);
4004 # FILE_NAME(tmp,@1);
4008 def p_expr_primary_32(p
):
4009 '''expr_primary : K_sinh '(' expression ')' '''
4010 print('expr_primary_32', list(p
))
4011 # { perm_string tn = perm_string::literal("$sinh");
4012 # PECallFunction*tmp = make_call_function(tn, $3);
4013 # FILE_NAME(tmp,@1);
4017 def p_expr_primary_33(p
):
4018 '''expr_primary : K_sqrt '(' expression ')' '''
4019 print('expr_primary_33', list(p
))
4020 # { perm_string tn = perm_string::literal("$sqrt");
4021 # PECallFunction*tmp = make_call_function(tn, $3);
4022 # FILE_NAME(tmp,@1);
4026 def p_expr_primary_34(p
):
4027 '''expr_primary : K_tan '(' expression ')' '''
4028 print('expr_primary_34', list(p
))
4029 # { perm_string tn = perm_string::literal("$tan");
4030 # PECallFunction*tmp = make_call_function(tn, $3);
4031 # FILE_NAME(tmp,@1);
4035 def p_expr_primary_35(p
):
4036 '''expr_primary : K_tanh '(' expression ')' '''
4037 print('expr_primary_35', list(p
))
4038 # { perm_string tn = perm_string::literal("$tanh");
4039 # PECallFunction*tmp = make_call_function(tn, $3);
4040 # FILE_NAME(tmp,@1);
4044 def p_expr_primary_36(p
):
4045 '''expr_primary : K_abs '(' expression ')' '''
4046 print('expr_primary_36', list(p
))
4047 # { PEUnary*tmp = new PEUnary('m', $3);
4048 # FILE_NAME(tmp,@1);
4052 def p_expr_primary_37(p
):
4053 '''expr_primary : K_max '(' expression ',' expression ')' '''
4054 print('expr_primary_37', list(p
))
4055 # { PEBinary*tmp = new PEBinary('M', $3, $5);
4056 # FILE_NAME(tmp,@1);
4060 def p_expr_primary_38(p
):
4061 '''expr_primary : K_min '(' expression ',' expression ')' '''
4062 print('expr_primary_38', list(p
))
4063 # { PEBinary*tmp = new PEBinary('m', $3, $5);
4064 # FILE_NAME(tmp,@1);
4068 def p_expr_primary_39(p
):
4069 '''expr_primary : '(' expr_mintypmax ')' '''
4070 print('expr_primary_39', list(p
))
4073 def p_expr_primary_40(p
):
4074 '''expr_primary : '{' expression_list_proper '}' '''
4075 print('expr_primary_40', list(p
))
4076 # { PEConcat*tmp = new PEConcat(*$2);
4077 # FILE_NAME(tmp, @1);
4082 def p_expr_primary_41(p
):
4083 '''expr_primary : '{' expression '{' expression_list_proper '}' '}' '''
4084 print('expr_primary_41', list(p
))
4086 # PEConcat*tmp = new PEConcat(*$4, rep);
4087 # FILE_NAME(tmp, @1);
4092 def p_expr_primary_42(p
):
4093 '''expr_primary : '{' expression '{' expression_list_proper '}' error '}' '''
4094 print('expr_primary_42', list(p
))
4096 # PEConcat*tmp = new PEConcat(*$4, rep);
4097 # FILE_NAME(tmp, @1);
4100 # yyerror(@5, "error: Syntax error between internal '}' "
4101 # "and closing '}' of repeat concatenation.");
4105 def p_expr_primary_43(p
):
4106 '''expr_primary : '{' '}' '''
4107 print('expr_primary_43', list(p
))
4108 # { // This is the empty queue syntax.
4109 # if (gn_system_verilog()) {
4110 # list<PExpr*> empty_list;
4111 # PEConcat*tmp = new PEConcat(empty_list);
4112 # FILE_NAME(tmp, @1);
4115 # yyerror(@1, "error: Concatenations are not allowed to be empty.");
4120 def p_expr_primary_44(p
):
4121 '''expr_primary : expr_primary "'" '(' expression ')' '''
4122 print('expr_primary_44', list(p
))
4123 # { PExpr*base = $4;
4124 # if (gn_system_verilog()) {
4125 # PECastSize*tmp = new PECastSize($1, base);
4126 # FILE_NAME(tmp, @1);
4129 # yyerror(@1, "error: Size cast requires SystemVerilog.");
4134 def p_expr_primary_45(p
):
4135 '''expr_primary : simple_type_or_string "'" '(' expression ')' '''
4136 print('expr_primary_45', list(p
))
4137 # { PExpr*base = $4;
4138 # if (gn_system_verilog()) {
4139 # PECastType*tmp = new PECastType($1, base);
4140 # FILE_NAME(tmp, @1);
4143 # yyerror(@1, "error: Type cast requires SystemVerilog.");
4148 def p_expr_primary_46(p
):
4149 '''expr_primary : assignment_pattern '''
4150 print('expr_primary_46', list(p
))
4153 def p_expr_primary_47(p
):
4154 '''expr_primary : streaming_concatenation '''
4155 print('expr_primary_47', list(p
))
4158 def p_expr_primary_48(p
):
4159 '''expr_primary : K_null '''
4160 print('expr_primary_48', list(p
))
4161 # { PENull*tmp = new PENull;
4162 # FILE_NAME(tmp, @1);
4166 def p_function_item_list_opt_1(p
):
4167 '''function_item_list_opt : function_item_list '''
4168 print('function_item_list_opt_1', list(p
))
4171 def p_function_item_list_opt_2(p
):
4172 '''function_item_list_opt : '''
4173 print('function_item_list_opt_2', list(p
))
4176 def p_function_item_list_1(p
):
4177 '''function_item_list : function_item '''
4178 print('function_item_list_1', list(p
))
4181 def p_function_item_list_2(p
):
4182 '''function_item_list : function_item_list function_item '''
4183 print('function_item_list_2', list(p
))
4186 # vector<pform_tf_port_t>*tmp = $1;
4187 # size_t s1 = tmp->size();
4188 # tmp->resize(s1 + $2->size());
4189 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
4190 # tmp->at(s1+idx) = $2->at(idx);
4200 def p_function_item_1(p
):
4201 '''function_item : tf_port_declaration '''
4202 print('function_item_1', list(p
))
4205 def p_function_item_2(p
):
4206 '''function_item : block_item_decl '''
4207 print('function_item_2', list(p
))
4210 def p_gate_instance_1(p
):
4211 '''gate_instance : IDENTIFIER '(' expression_list_with_nuls ')' '''
4212 print('gate_instance_1', list(p
))
4213 # { lgate*tmp = new lgate;
4216 # tmp->file = @1.text;
4217 # tmp->lineno = @1.first_line;
4222 def p_gate_instance_2(p
):
4223 '''gate_instance : IDENTIFIER dimensions '(' expression_list_with_nuls ')' '''
4224 print('gate_instance_2', list(p
))
4225 # { lgate*tmp = new lgate;
4226 # list<pform_range_t>*rng = $2;
4229 # tmp->range = rng->front();
4231 # assert(rng->empty());
4232 # tmp->file = @1.text;
4233 # tmp->lineno = @1.first_line;
4239 def p_gate_instance_3(p
):
4240 '''gate_instance : '(' expression_list_with_nuls ')' '''
4241 print('gate_instance_3', list(p
))
4242 # { lgate*tmp = new lgate;
4245 # tmp->file = @1.text;
4246 # tmp->lineno = @1.first_line;
4250 def p_gate_instance_4(p
):
4251 '''gate_instance : IDENTIFIER dimensions '''
4252 print('gate_instance_4', list(p
))
4253 # { lgate*tmp = new lgate;
4254 # list<pform_range_t>*rng = $2;
4257 # tmp->parms_by_name = 0;
4258 # tmp->range = rng->front();
4260 # assert(rng->empty());
4261 # tmp->file = @1.text;
4262 # tmp->lineno = @1.first_line;
4268 def p_gate_instance_5(p
):
4269 '''gate_instance : IDENTIFIER '(' port_name_list ')' '''
4270 print('gate_instance_5', list(p
))
4271 # { lgate*tmp = new lgate;
4274 # tmp->parms_by_name = $3;
4275 # tmp->file = @1.text;
4276 # tmp->lineno = @1.first_line;
4281 def p_gate_instance_6(p
):
4282 '''gate_instance : IDENTIFIER dimensions '(' port_name_list ')' '''
4283 print('gate_instance_6', list(p
))
4284 # { lgate*tmp = new lgate;
4285 # list<pform_range_t>*rng = $2;
4288 # tmp->parms_by_name = $4;
4289 # tmp->range = rng->front();
4291 # assert(rng->empty());
4292 # tmp->file = @1.text;
4293 # tmp->lineno = @1.first_line;
4299 def p_gate_instance_7(p
):
4300 '''gate_instance : IDENTIFIER '(' error ')' '''
4301 print('gate_instance_7', list(p
))
4302 # { lgate*tmp = new lgate;
4305 # tmp->parms_by_name = 0;
4306 # tmp->file = @1.text;
4307 # tmp->lineno = @1.first_line;
4308 # yyerror(@2, "error: Syntax error in instance port "
4309 # "expression(s).");
4314 def p_gate_instance_8(p
):
4315 '''gate_instance : IDENTIFIER dimensions '(' error ')' '''
4316 print('gate_instance_8', list(p
))
4317 # { lgate*tmp = new lgate;
4320 # tmp->parms_by_name = 0;
4321 # tmp->file = @1.text;
4322 # tmp->lineno = @1.first_line;
4323 # yyerror(@3, "error: Syntax error in instance port "
4324 # "expression(s).");
4329 def p_gate_instance_list_1(p
):
4330 '''gate_instance_list : gate_instance_list ',' gate_instance '''
4331 print('gate_instance_list_1', list(p
))
4332 # { svector<lgate>*tmp1 = $1;
4334 # svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
4340 def p_gate_instance_list_2(p
):
4341 '''gate_instance_list : gate_instance '''
4342 print('gate_instance_list_2', list(p
))
4343 # { svector<lgate>*tmp = new svector<lgate>(1);
4349 def p_gatetype_1(p
):
4350 '''gatetype : K_and '''
4351 print('gatetype_1', list(p
))
4352 # { $$ = PGBuiltin::AND; }
4354 def p_gatetype_2(p
):
4355 '''gatetype : K_nand '''
4356 print('gatetype_2', list(p
))
4357 # { $$ = PGBuiltin::NAND; }
4359 def p_gatetype_3(p
):
4360 '''gatetype : K_or '''
4361 print('gatetype_3', list(p
))
4362 # { $$ = PGBuiltin::OR; }
4364 def p_gatetype_4(p
):
4365 '''gatetype : K_nor '''
4366 print('gatetype_4', list(p
))
4367 # { $$ = PGBuiltin::NOR; }
4369 def p_gatetype_5(p
):
4370 '''gatetype : K_xor '''
4371 print('gatetype_5', list(p
))
4372 # { $$ = PGBuiltin::XOR; }
4374 def p_gatetype_6(p
):
4375 '''gatetype : K_xnor '''
4376 print('gatetype_6', list(p
))
4377 # { $$ = PGBuiltin::XNOR; }
4379 def p_gatetype_7(p
):
4380 '''gatetype : K_buf '''
4381 print('gatetype_7', list(p
))
4382 # { $$ = PGBuiltin::BUF; }
4384 def p_gatetype_8(p
):
4385 '''gatetype : K_bufif0 '''
4386 print('gatetype_8', list(p
))
4387 # { $$ = PGBuiltin::BUFIF0; }
4389 def p_gatetype_9(p
):
4390 '''gatetype : K_bufif1 '''
4391 print('gatetype_9', list(p
))
4392 # { $$ = PGBuiltin::BUFIF1; }
4394 def p_gatetype_10(p
):
4395 '''gatetype : K_not '''
4396 print('gatetype_10', list(p
))
4397 # { $$ = PGBuiltin::NOT; }
4399 def p_gatetype_11(p
):
4400 '''gatetype : K_notif0 '''
4401 print('gatetype_11', list(p
))
4402 # { $$ = PGBuiltin::NOTIF0; }
4404 def p_gatetype_12(p
):
4405 '''gatetype : K_notif1 '''
4406 print('gatetype_12', list(p
))
4407 # { $$ = PGBuiltin::NOTIF1; }
4409 def p_switchtype_1(p
):
4410 '''switchtype : K_nmos '''
4411 print('switchtype_1', list(p
))
4412 # { $$ = PGBuiltin::NMOS; }
4414 def p_switchtype_2(p
):
4415 '''switchtype : K_rnmos '''
4416 print('switchtype_2', list(p
))
4417 # { $$ = PGBuiltin::RNMOS; }
4419 def p_switchtype_3(p
):
4420 '''switchtype : K_pmos '''
4421 print('switchtype_3', list(p
))
4422 # { $$ = PGBuiltin::PMOS; }
4424 def p_switchtype_4(p
):
4425 '''switchtype : K_rpmos '''
4426 print('switchtype_4', list(p
))
4427 # { $$ = PGBuiltin::RPMOS; }
4429 def p_switchtype_5(p
):
4430 '''switchtype : K_cmos '''
4431 print('switchtype_5', list(p
))
4432 # { $$ = PGBuiltin::CMOS; }
4434 def p_switchtype_6(p
):
4435 '''switchtype : K_rcmos '''
4436 print('switchtype_6', list(p
))
4437 # { $$ = PGBuiltin::RCMOS; }
4439 def p_switchtype_7(p
):
4440 '''switchtype : K_tran '''
4441 print('switchtype_7', list(p
))
4442 # { $$ = PGBuiltin::TRAN; }
4444 def p_switchtype_8(p
):
4445 '''switchtype : K_rtran '''
4446 print('switchtype_8', list(p
))
4447 # { $$ = PGBuiltin::RTRAN; }
4449 def p_switchtype_9(p
):
4450 '''switchtype : K_tranif0 '''
4451 print('switchtype_9', list(p
))
4452 # { $$ = PGBuiltin::TRANIF0; }
4454 def p_switchtype_10(p
):
4455 '''switchtype : K_tranif1 '''
4456 print('switchtype_10', list(p
))
4457 # { $$ = PGBuiltin::TRANIF1; }
4459 def p_switchtype_11(p
):
4460 '''switchtype : K_rtranif0 '''
4461 print('switchtype_11', list(p
))
4462 # { $$ = PGBuiltin::RTRANIF0; }
4464 def p_switchtype_12(p
):
4465 '''switchtype : K_rtranif1 '''
4466 print('switchtype_12', list(p
))
4467 # { $$ = PGBuiltin::RTRANIF1; }
4469 def p_hierarchy_identifier_1(p
):
4470 '''hierarchy_identifier : IDENTIFIER '''
4471 print('hierarchy_identifier_1', list(p
))
4472 lpvalue
= Leaf(token
.NAME
, p
[1])
4474 # { $$ = new pform_name_t;
4475 # $$->push_back(name_component_t(lex_strings.make($1)));
4479 def p_hierarchy_identifier_2(p
):
4480 '''hierarchy_identifier : hierarchy_identifier '.' IDENTIFIER '''
4481 print('hierarchy_identifier_2', list(p
))
4482 # { pform_name_t * tmp = $1;
4483 # tmp->push_back(name_component_t(lex_strings.make($3)));
4488 def p_hierarchy_identifier_3(p
):
4489 '''hierarchy_identifier : hierarchy_identifier '[' expression ']' '''
4490 print('hierarchy_identifier_3', list(p
))
4491 # { pform_name_t * tmp = $1;
4492 # name_component_t&tail = tmp->back();
4493 # index_component_t itmp;
4494 # itmp.sel = index_component_t::SEL_BIT;
4496 # tail.index.push_back(itmp);
4500 def p_hierarchy_identifier_4(p
):
4501 '''hierarchy_identifier : hierarchy_identifier '[' '$' ']' '''
4502 print('hierarchy_identifier_4', list(p
))
4503 # { pform_name_t * tmp = $1;
4504 # name_component_t&tail = tmp->back();
4505 # if (! gn_system_verilog()) {
4506 # yyerror(@3, "error: Last element expression ($) "
4507 # "requires SystemVerilog. Try enabling SystemVerilog.");
4509 # index_component_t itmp;
4510 # itmp.sel = index_component_t::SEL_BIT_LAST;
4513 # tail.index.push_back(itmp);
4517 def p_hierarchy_identifier_5(p
):
4518 '''hierarchy_identifier : hierarchy_identifier '[' expression ':' expression ']' '''
4519 print('hierarchy_identifier_5', list(p
))
4520 # { pform_name_t * tmp = $1;
4521 # name_component_t&tail = tmp->back();
4522 # index_component_t itmp;
4523 # itmp.sel = index_component_t::SEL_PART;
4526 # tail.index.push_back(itmp);
4530 def p_hierarchy_identifier_6(p
):
4531 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_POS expression ']' '''
4532 print('hierarchy_identifier_6', list(p
))
4533 # { pform_name_t * tmp = $1;
4534 # name_component_t&tail = tmp->back();
4535 # index_component_t itmp;
4536 # itmp.sel = index_component_t::SEL_IDX_UP;
4539 # tail.index.push_back(itmp);
4543 def p_hierarchy_identifier_7(p
):
4544 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_NEG expression ']' '''
4545 print('hierarchy_identifier_7', list(p
))
4546 # { pform_name_t * tmp = $1;
4547 # name_component_t&tail = tmp->back();
4548 # index_component_t itmp;
4549 # itmp.sel = index_component_t::SEL_IDX_DO;
4552 # tail.index.push_back(itmp);
4556 def p_list_of_identifiers_1(p
):
4557 '''list_of_identifiers : IDENTIFIER '''
4558 print('list_of_identifiers_1', list(p
))
4559 # { $$ = list_from_identifier($1); }
4561 def p_list_of_identifiers_2(p
):
4562 '''list_of_identifiers : list_of_identifiers ',' IDENTIFIER '''
4563 print('list_of_identifiers_2', list(p
))
4564 # { $$ = list_from_identifier($1, $3); }
4566 def p_list_of_port_identifiers_1(p
):
4567 '''list_of_port_identifiers : IDENTIFIER dimensions_opt '''
4568 print('list_of_port_identifiers_1', list(p
))
4569 # { $$ = make_port_list($1, $2, 0); }
4571 def p_list_of_port_identifiers_2(p
):
4572 '''list_of_port_identifiers : list_of_port_identifiers ',' IDENTIFIER dimensions_opt '''
4573 print('list_of_port_identifiers_2', list(p
))
4574 # { $$ = make_port_list($1, $3, $4, 0); }
4576 def p_list_of_variable_port_identifiers_1(p
):
4577 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '''
4578 print('list_of_variable_port_identifiers_1', list(p
))
4579 # { $$ = make_port_list($1, $2, 0); }
4581 def p_list_of_variable_port_identifiers_2(p
):
4582 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '=' expression '''
4583 print('list_of_variable_port_identifiers_2', list(p
))
4584 # { $$ = make_port_list($1, $2, $4); }
4586 def p_list_of_variable_port_identifiers_3(p
):
4587 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '''
4588 print('list_of_variable_port_identifiers_3', list(p
))
4589 # { $$ = make_port_list($1, $3, $4, 0); }
4591 def p_list_of_variable_port_identifiers_4(p
):
4592 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '=' expression '''
4593 print('list_of_variable_port_identifiers_4', list(p
))
4594 # { $$ = make_port_list($1, $3, $4, $6); }
4596 def p_list_of_ports_1(p
):
4597 '''list_of_ports : port_opt '''
4598 print('list_of_ports_1', list(p
))
4599 # { vector<Module::port_t*>*tmp
4600 # = new vector<Module::port_t*>(1);
4605 def p_list_of_ports_2(p
):
4606 '''list_of_ports : list_of_ports ',' port_opt '''
4607 print('list_of_ports_2', list(p
))
4608 # { vector<Module::port_t*>*tmp = $1;
4609 # tmp->push_back($3);
4613 def p_list_of_port_declarations_1(p
):
4614 '''list_of_port_declarations : port_declaration '''
4615 print('list_of_port_declarations_1', list(p
))
4616 # { vector<Module::port_t*>*tmp
4617 # = new vector<Module::port_t*>(1);
4622 def p_list_of_port_declarations_2(p
):
4623 '''list_of_port_declarations : list_of_port_declarations ',' port_declaration '''
4624 print('list_of_port_declarations_2', list(p
))
4625 # { vector<Module::port_t*>*tmp = $1;
4626 # tmp->push_back($3);
4630 def p_list_of_port_declarations_3(p
):
4631 '''list_of_port_declarations : list_of_port_declarations ',' IDENTIFIER '''
4632 print('list_of_port_declarations_3', list(p
))
4633 # { Module::port_t*ptmp;
4634 # perm_string name = lex_strings.make($3);
4635 # ptmp = pform_module_port_reference(name, @3.text,
4637 # vector<Module::port_t*>*tmp = $1;
4638 # tmp->push_back(ptmp);
4640 # /* Get the port declaration details, the port type
4641 # and what not, from context data stored by the
4642 # last port_declaration rule. */
4643 # pform_module_define_port(@3, name,
4644 # port_declaration_context.port_type,
4645 # port_declaration_context.port_net_type,
4646 # port_declaration_context.data_type, 0);
4651 def p_list_of_port_declarations_4(p
):
4652 '''list_of_port_declarations : list_of_port_declarations ',' '''
4653 print('list_of_port_declarations_4', list(p
))
4655 # yyerror(@2, "error: NULL port declarations are not "
4659 def p_list_of_port_declarations_5(p
):
4660 '''list_of_port_declarations : list_of_port_declarations ';' '''
4661 print('list_of_port_declarations_5', list(p
))
4663 # yyerror(@2, "error: ';' is an invalid port declaration "
4667 def p_port_declaration_1(p
):
4668 '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4669 print('port_declaration_1', list(p
))
4670 # { Module::port_t*ptmp;
4671 # perm_string name = lex_strings.make($5);
4672 # data_type_t*use_type = $4;
4673 # if ($6) use_type = new uarray_type_t(use_type, $6);
4674 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4675 # pform_module_define_port(@2, name, NetNet::PINPUT, $3, use_type, $1);
4676 # port_declaration_context.port_type = NetNet::PINPUT;
4677 # port_declaration_context.port_net_type = $3;
4678 # port_declaration_context.data_type = $4;
4683 def p_port_declaration_2(p
):
4684 '''port_declaration : attribute_list_opt K_input K_wreal IDENTIFIER '''
4685 print('port_declaration_2', list(p
))
4686 # { Module::port_t*ptmp;
4687 # perm_string name = lex_strings.make($4);
4688 # ptmp = pform_module_port_reference(name, @2.text,
4690 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4691 # FILE_NAME(real_type, @3);
4692 # pform_module_define_port(@2, name, NetNet::PINPUT,
4693 # NetNet::WIRE, real_type, $1);
4694 # port_declaration_context.port_type = NetNet::PINPUT;
4695 # port_declaration_context.port_net_type = NetNet::WIRE;
4696 # port_declaration_context.data_type = real_type;
4701 def p_port_declaration_3(p
):
4702 '''port_declaration : attribute_list_opt K_inout net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4703 print('port_declaration_3', list(p
))
4704 # { Module::port_t*ptmp;
4705 # perm_string name = lex_strings.make($5);
4706 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4707 # pform_module_define_port(@2, name, NetNet::PINOUT, $3, $4, $1);
4708 # port_declaration_context.port_type = NetNet::PINOUT;
4709 # port_declaration_context.port_net_type = $3;
4710 # port_declaration_context.data_type = $4;
4713 # yyerror(@6, "sorry: Inout ports with unpacked dimensions not supported.");
4719 def p_port_declaration_4(p
):
4720 '''port_declaration : attribute_list_opt K_inout K_wreal IDENTIFIER '''
4721 print('port_declaration_4', list(p
))
4722 # { Module::port_t*ptmp;
4723 # perm_string name = lex_strings.make($4);
4724 # ptmp = pform_module_port_reference(name, @2.text,
4726 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4727 # FILE_NAME(real_type, @3);
4728 # pform_module_define_port(@2, name, NetNet::PINOUT,
4729 # NetNet::WIRE, real_type, $1);
4730 # port_declaration_context.port_type = NetNet::PINOUT;
4731 # port_declaration_context.port_net_type = NetNet::WIRE;
4732 # port_declaration_context.data_type = real_type;
4737 def p_port_declaration_5(p
):
4738 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4739 print('port_declaration_5', list(p
))
4740 # { Module::port_t*ptmp;
4741 # perm_string name = lex_strings.make($5);
4742 # data_type_t*use_dtype = $4;
4743 # if ($6) use_dtype = new uarray_type_t(use_dtype, $6);
4744 # NetNet::Type use_type = $3;
4745 # if (use_type == NetNet::IMPLICIT) {
4746 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($4)) {
4747 # if (dtype->reg_flag)
4748 # use_type = NetNet::REG;
4749 # else if (dtype->implicit_flag)
4750 # use_type = NetNet::IMPLICIT;
4752 # use_type = NetNet::IMPLICIT_REG;
4754 # // The SystemVerilog types that can show up as
4755 # // output ports are implicitly (on the inside)
4756 # // variables because "reg" is not valid syntax
4758 # } else if (dynamic_cast<atom2_type_t*> ($4)) {
4759 # use_type = NetNet::IMPLICIT_REG;
4760 # } else if (dynamic_cast<struct_type_t*> ($4)) {
4761 # use_type = NetNet::IMPLICIT_REG;
4762 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> ($4)) {
4763 # if(etype->base_type == IVL_VT_LOGIC)
4764 # use_type = NetNet::IMPLICIT_REG;
4767 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4768 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, use_dtype, $1);
4769 # port_declaration_context.port_type = NetNet::POUTPUT;
4770 # port_declaration_context.port_net_type = use_type;
4771 # port_declaration_context.data_type = $4;
4776 def p_port_declaration_6(p
):
4777 '''port_declaration : attribute_list_opt K_output K_wreal IDENTIFIER '''
4778 print('port_declaration_6', list(p
))
4779 # { Module::port_t*ptmp;
4780 # perm_string name = lex_strings.make($4);
4781 # ptmp = pform_module_port_reference(name, @2.text,
4783 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4784 # FILE_NAME(real_type, @3);
4785 # pform_module_define_port(@2, name, NetNet::POUTPUT,
4786 # NetNet::WIRE, real_type, $1);
4787 # port_declaration_context.port_type = NetNet::POUTPUT;
4788 # port_declaration_context.port_net_type = NetNet::WIRE;
4789 # port_declaration_context.data_type = real_type;
4794 def p_port_declaration_7(p
):
4795 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER '=' expression '''
4796 print('port_declaration_7', list(p
))
4797 # { Module::port_t*ptmp;
4798 # perm_string name = lex_strings.make($5);
4799 # NetNet::Type use_type = $3;
4800 # if (use_type == NetNet::IMPLICIT) {
4801 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($4)) {
4802 # if (dtype->reg_flag)
4803 # use_type = NetNet::REG;
4805 # use_type = NetNet::IMPLICIT_REG;
4807 # use_type = NetNet::IMPLICIT_REG;
4810 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4811 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, $4, $1);
4812 # port_declaration_context.port_type = NetNet::PINOUT;
4813 # port_declaration_context.port_net_type = use_type;
4814 # port_declaration_context.data_type = $4;
4816 # pform_make_var_init(@5, name, $7);
4822 def p_net_type_opt_1(p
):
4823 '''net_type_opt : net_type '''
4824 print('net_type_opt_1', list(p
))
4827 def p_net_type_opt_2(p
):
4828 '''net_type_opt : '''
4829 print('net_type_opt_2', list(p
))
4830 # { $$ = NetNet::IMPLICIT; }
4832 def p_unsigned_signed_opt_1(p
):
4833 '''unsigned_signed_opt : K_signed '''
4834 print('unsigned_signed_opt_1', list(p
))
4837 def p_unsigned_signed_opt_2(p
):
4838 '''unsigned_signed_opt : K_unsigned '''
4839 print('unsigned_signed_opt_2', list(p
))
4842 def p_unsigned_signed_opt_3(p
):
4843 '''unsigned_signed_opt : '''
4844 print('unsigned_signed_opt_3', list(p
))
4847 def p_signed_unsigned_opt_1(p
):
4848 '''signed_unsigned_opt : K_signed '''
4849 print('signed_unsigned_opt_1', list(p
))
4852 def p_signed_unsigned_opt_2(p
):
4853 '''signed_unsigned_opt : K_unsigned '''
4854 print('signed_unsigned_opt_2', list(p
))
4857 def p_signed_unsigned_opt_3(p
):
4858 '''signed_unsigned_opt : '''
4859 print('signed_unsigned_opt_3', list(p
))
4862 def p_atom2_type_1(p
):
4863 '''atom2_type : K_byte '''
4864 print('atom2_type_1', list(p
))
4867 def p_atom2_type_2(p
):
4868 '''atom2_type : K_shortint '''
4869 print('atom2_type_2', list(p
))
4872 def p_atom2_type_3(p
):
4873 '''atom2_type : K_int '''
4874 print('atom2_type_3', list(p
))
4877 def p_atom2_type_4(p
):
4878 '''atom2_type : K_longint '''
4879 print('atom2_type_4', list(p
))
4883 '''lpvalue : hierarchy_identifier '''
4884 print('lpvalue_1', list(p
))
4886 # { PEIdent*tmp = pform_new_ident(*$1);
4887 # FILE_NAME(tmp, @1);
4893 '''lpvalue : implicit_class_handle '.' hierarchy_identifier '''
4894 print('lpvalue_2', list(p
))
4895 # { pform_name_t*t_name = $1;
4896 # while (!$3->empty()) {
4897 # t_name->push_back($3->front());
4900 # PEIdent*tmp = new PEIdent(*t_name);
4901 # FILE_NAME(tmp, @1);
4908 '''lpvalue : '{' expression_list_proper '}' '''
4909 print('lpvalue_3', list(p
))
4910 # { PEConcat*tmp = new PEConcat(*$2);
4911 # FILE_NAME(tmp, @1);
4917 '''lpvalue : streaming_concatenation '''
4918 print('lpvalue_4', list(p
))
4919 # { yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
4923 def p_cont_assign_1(p
):
4924 '''cont_assign : lpvalue '=' expression '''
4925 print('cont_assign_1', list(p
))
4926 # { list<PExpr*>*tmp = new list<PExpr*>;
4927 # tmp->push_back($1);
4928 # tmp->push_back($3);
4932 def p_cont_assign_list_1(p
):
4933 '''cont_assign_list : cont_assign_list ',' cont_assign '''
4934 print('cont_assign_list_1', list(p
))
4935 # { list<PExpr*>*tmp = $1;
4936 # tmp->splice(tmp->end(), *$3);
4941 def p_cont_assign_list_2(p
):
4942 '''cont_assign_list : cont_assign '''
4943 print('cont_assign_list_2', list(p
))
4947 '''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 '''
4948 print('module_1', list(p
))
4949 clsname
= [Leaf(token
.NAME
, 'class'),
4950 Leaf(token
.NAME
, p
[4], prefix
=' '),
4951 Leaf(token
.COLON
, ':')]
4952 stmt
= Node(syms
.pass_stmt
, [Leaf(token
.NAME
, "pass"),])
4953 stmts
= Node(syms
.small_stmt
, [stmt
, Leaf(token
.NEWLINE
, '\n')])
4954 stmts
= Node(syms
.stmt
, [stmts
])
4955 suite
= Node(syms
.suite
, [Leaf(token
.NEWLINE
, '\n'),
4956 Leaf(token
.INDENT
, ' '),
4958 Leaf(token
.DEDENT
, '')
4960 clsdecl
= Node(syms
.classdef
, clsname
+ [suite
],
4961 prefix
='', fixers_applied
=[])
4962 clsdecl
= Node(syms
.compound_stmt
, [clsdecl
])
4963 print ("clsdecl", repr(clsdecl
))
4965 print (str(clsdecl
))
4967 # { // Last step: check any closing name. This is done late so
4968 # // that the parser can look ahead to detect the present
4969 # // endlabel_opt but still have the pform_endmodule() called
4970 # // early enough that the lexor can know we are outside the
4973 # if (strcmp($4,$17) != 0) {
4976 # yyerror(@17, "error: End label doesn't match "
4980 # yyerror(@17, "error: End label doesn't match "
4984 # yyerror(@17, "error: End label doesn't match "
4985 # "interface name.");
4991 # if (($2 == K_module) && (! gn_system_verilog())) {
4992 # yyerror(@8, "error: Module end labels require "
4993 # "SystemVerilog.");
5000 def p__embed0_module(p
):
5001 '''_embed0_module : '''
5002 # { pform_startmodule(@2, $4, $2==K_program, $2==K_interface, $3, $1); }
5004 def p__embed1_module(p
):
5005 '''_embed1_module : '''
5006 # { pform_module_set_ports($8); }
5008 def p__embed2_module(p
):
5009 '''_embed2_module : '''
5010 # { pform_set_scope_timescale(@2); }
5012 def p__embed3_module(p
):
5013 '''_embed3_module : '''
5014 # { Module::UCDriveType ucd;
5015 # // The lexor detected `unconnected_drive directives and
5016 # // marked what it found in the uc_drive variable. Use that
5017 # // to generate a UCD flag for the module.
5018 # switch (uc_drive) {
5021 # ucd = Module::UCD_NONE;
5024 # ucd = Module::UCD_PULL0;
5027 # ucd = Module::UCD_PULL1;
5030 # // Check that program/endprogram and module/endmodule
5031 # // keywords match.
5035 # yyerror(@15, "error: module not closed by endmodule.");
5038 # yyerror(@15, "error: program not closed by endprogram.");
5041 # yyerror(@15, "error: interface not closed by endinterface.");
5047 # pform_endmodule($4, in_celldefine, ucd);
5050 def p_module_start_1(p
):
5051 '''module_start : K_module '''
5052 print('module_start_1', list(p
))
5053 # { $$ = K_module; }
5055 def p_module_start_2(p
):
5056 '''module_start : K_macromodule '''
5057 print('module_start_2', list(p
))
5058 # { $$ = K_module; }
5060 def p_module_start_3(p
):
5061 '''module_start : K_program '''
5062 print('module_start_3', list(p
))
5063 # { $$ = K_program; }
5065 def p_module_start_4(p
):
5066 '''module_start : K_interface '''
5067 print('module_start_4', list(p
))
5068 # { $$ = K_interface; }
5070 def p_module_end_1(p
):
5071 '''module_end : K_endmodule '''
5072 print('module_end_1', list(p
))
5073 # { $$ = K_module; }
5075 def p_module_end_2(p
):
5076 '''module_end : K_endprogram '''
5077 print('module_end_2', list(p
))
5078 # { $$ = K_program; }
5080 def p_module_end_3(p
):
5081 '''module_end : K_endinterface '''
5082 print('module_end_3', list(p
))
5083 # { $$ = K_interface; }
5085 def p_endlabel_opt_1(p
):
5086 '''endlabel_opt : ':' IDENTIFIER '''
5087 print('endlabel_opt_1', list(p
))
5090 def p_endlabel_opt_2(p
):
5091 '''endlabel_opt : '''
5092 print('endlabel_opt_2', list(p
))
5095 def p_module_attribute_foreign_1(p
):
5096 '''module_attribute_foreign : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP '''
5097 print('module_attribute_foreign_1', list(p
))
5100 def p_module_attribute_foreign_2(p
):
5101 '''module_attribute_foreign : '''
5102 print('module_attribute_foreign_2', list(p
))
5105 def p_module_port_list_opt_1(p
):
5106 '''module_port_list_opt : '(' list_of_ports ')' '''
5107 print('module_port_list_opt_1', list(p
))
5110 def p_module_port_list_opt_2(p
):
5111 '''module_port_list_opt : '(' list_of_port_declarations ')' '''
5112 print('module_port_list_opt_2', list(p
))
5115 def p_module_port_list_opt_3(p
):
5116 '''module_port_list_opt : '''
5117 print('module_port_list_opt_3', list(p
))
5120 def p_module_port_list_opt_4(p
):
5121 '''module_port_list_opt : '(' error ')' '''
5122 print('module_port_list_opt_4', list(p
))
5123 # { yyerror(@2, "Errors in port declarations.");
5128 def p_module_parameter_port_list_opt_1(p
):
5129 '''module_parameter_port_list_opt : '''
5130 print('module_parameter_port_list_opt_1', list(p
))
5132 def p_module_parameter_port_list_opt_2(p
):
5133 '''module_parameter_port_list_opt : '#' '(' module_parameter_port_list ')' '''
5134 print('module_parameter_port_list_opt_2', list(p
))
5137 def p_module_parameter_port_list_1(p
):
5138 '''module_parameter_port_list : K_parameter param_type parameter_assign '''
5139 print('module_parameter_port_list_1', list(p
))
5142 def p_module_parameter_port_list_2(p
):
5143 '''module_parameter_port_list : module_parameter_port_list ',' parameter_assign '''
5144 print('module_parameter_port_list_2', list(p
))
5145 p
[0] = p
[1].append(p
[3])
5147 def p_module_parameter_port_list_3(p
):
5148 '''module_parameter_port_list : module_parameter_port_list ',' K_parameter param_type parameter_assign '''
5149 print('module_parameter_port_list_3', list(p
))
5153 def p_module_item_1(p
):
5154 '''module_item : module '''
5155 print('module_item_1', list(p
))
5157 def p_module_item_2(p
):
5158 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' '''
5159 print('module_item_2', list(p
))
5160 # { data_type_t*data_type = $3;
5161 # if (data_type == 0) {
5162 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5163 # FILE_NAME(data_type, @2);
5165 # pform_set_data_type(@2, data_type, $5, $2, $1);
5167 # yyerror(@2, "sorry: net delays not supported.");
5173 def p_module_item_3(p
):
5174 '''module_item : attribute_list_opt K_wreal delay3 net_variable_list ';' '''
5175 print('module_item_3', list(p
))
5176 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5177 # pform_set_data_type(@2, tmpt, $4, NetNet::WIRE, $1);
5179 # yyerror(@3, "sorry: net delays not supported.");
5185 def p_module_item_4(p
):
5186 '''module_item : attribute_list_opt K_wreal net_variable_list ';' '''
5187 print('module_item_4', list(p
))
5188 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5189 # pform_set_data_type(@2, tmpt, $3, NetNet::WIRE, $1);
5193 def p_module_item_5(p
):
5194 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_decl_assigns ';' '''
5195 print('module_item_5', list(p
))
5196 # { data_type_t*data_type = $3;
5197 # if (data_type == 0) {
5198 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5199 # FILE_NAME(data_type, @2);
5201 # pform_makewire(@2, $4, str_strength, $5, $2, data_type);
5203 # yywarn(@2, "Attributes are not supported on net declaration "
5204 # "assignments and will be discarded.");
5209 def p_module_item_6(p
):
5210 '''module_item : attribute_list_opt net_type data_type_or_implicit drive_strength net_decl_assigns ';' '''
5211 print('module_item_6', list(p
))
5212 # { data_type_t*data_type = $3;
5213 # if (data_type == 0) {
5214 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5215 # FILE_NAME(data_type, @2);
5217 # pform_makewire(@2, 0, $4, $5, $2, data_type);
5219 # yywarn(@2, "Attributes are not supported on net declaration "
5220 # "assignments and will be discarded.");
5225 def p_module_item_7(p
):
5226 '''module_item : attribute_list_opt K_wreal net_decl_assigns ';' '''
5227 print('module_item_7', list(p
))
5228 # { real_type_t*data_type = new real_type_t(real_type_t::REAL);
5229 # pform_makewire(@2, 0, str_strength, $3, NetNet::WIRE, data_type);
5231 # yywarn(@2, "Attributes are not supported on net declaration "
5232 # "assignments and will be discarded.");
5237 def p_module_item_8(p
):
5238 '''module_item : K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' '''
5239 print('module_item_8', list(p
))
5240 # { yyerror(@1, "sorry: trireg nets not supported.");
5245 def p_module_item_9(p
):
5246 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit list_of_port_identifiers ';' '''
5247 print('module_item_9', list(p
))
5248 # { pform_module_define_port(@2, $5, $2, $3, $4, $1); }
5250 def p_module_item_10(p
):
5251 '''module_item : attribute_list_opt port_direction K_wreal list_of_port_identifiers ';' '''
5252 print('module_item_10', list(p
))
5253 # { real_type_t*real_type = new real_type_t(real_type_t::REAL);
5254 # pform_module_define_port(@2, $4, $2, NetNet::WIRE, real_type, $1);
5257 def p_module_item_11(p
):
5258 '''module_item : attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' '''
5259 print('module_item_11', list(p
))
5260 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5261 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5262 # if (dtype->implicit_flag)
5263 # use_type = NetNet::NONE;
5265 # if (use_type == NetNet::NONE)
5266 # pform_set_port_type(@2, $4, NetNet::PINOUT, $3, $1);
5268 # pform_module_define_port(@2, $4, NetNet::PINOUT, use_type, $3, $1);
5271 def p_module_item_12(p
):
5272 '''module_item : attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' '''
5273 print('module_item_12', list(p
))
5274 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5275 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5276 # if (dtype->implicit_flag)
5277 # use_type = NetNet::NONE;
5279 # if (use_type == NetNet::NONE)
5280 # pform_set_port_type(@2, $4, NetNet::PINPUT, $3, $1);
5282 # pform_module_define_port(@2, $4, NetNet::PINPUT, use_type, $3, $1);
5285 def p_module_item_13(p
):
5286 '''module_item : attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' '''
5287 print('module_item_13', list(p
))
5288 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5289 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5290 # if (dtype->implicit_flag)
5291 # use_type = NetNet::NONE;
5292 # else if (dtype->reg_flag)
5293 # use_type = NetNet::REG;
5295 # use_type = NetNet::IMPLICIT_REG;
5297 # // The SystemVerilog types that can show up as
5298 # // output ports are implicitly (on the inside)
5299 # // variables because "reg" is not valid syntax
5301 # } else if (dynamic_cast<atom2_type_t*> ($3)) {
5302 # use_type = NetNet::IMPLICIT_REG;
5303 # } else if (dynamic_cast<struct_type_t*> ($3)) {
5304 # use_type = NetNet::IMPLICIT_REG;
5305 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> ($3)) {
5306 # if(etype->base_type == IVL_VT_LOGIC)
5307 # use_type = NetNet::IMPLICIT_REG;
5309 # if (use_type == NetNet::NONE)
5310 # pform_set_port_type(@2, $4, NetNet::POUTPUT, $3, $1);
5312 # pform_module_define_port(@2, $4, NetNet::POUTPUT, use_type, $3, $1);
5315 def p_module_item_14(p
):
5316 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit error ';' '''
5317 print('module_item_14', list(p
))
5318 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5319 # if ($1) delete $1;
5320 # if ($4) delete $4;
5324 def p_module_item_15(p
):
5325 '''module_item : attribute_list_opt K_inout data_type_or_implicit error ';' '''
5326 print('module_item_15', list(p
))
5327 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5328 # if ($1) delete $1;
5329 # if ($3) delete $3;
5333 def p_module_item_16(p
):
5334 '''module_item : attribute_list_opt K_input data_type_or_implicit error ';' '''
5335 print('module_item_16', list(p
))
5336 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5337 # if ($1) delete $1;
5338 # if ($3) delete $3;
5342 def p_module_item_17(p
):
5343 '''module_item : attribute_list_opt K_output data_type_or_implicit error ';' '''
5344 print('module_item_17', list(p
))
5345 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5346 # if ($1) delete $1;
5347 # if ($3) delete $3;
5351 def p_module_item_18(p
):
5352 '''module_item : DISCIPLINE_IDENTIFIER list_of_identifiers ';' '''
5353 print('module_item_18', list(p
))
5354 # { pform_attach_discipline(@1, $1, $2); }
5356 def p_module_item_19(p
):
5357 '''module_item : attribute_list_opt _embed0_module_item block_item_decl '''
5358 print('module_item_19', list(p
))
5359 # { delete attributes_in_context;
5360 # attributes_in_context = 0;
5363 def p_module_item_20(p
):
5364 '''module_item : K_defparam _embed1_module_item defparam_assign_list ';' '''
5365 print('module_item_20', list(p
))
5367 def p_module_item_21(p
):
5368 '''module_item : attribute_list_opt gatetype gate_instance_list ';' '''
5369 print('module_item_21', list(p
))
5370 # { pform_makegates(@2, $2, str_strength, 0, $3, $1); }
5372 def p_module_item_22(p
):
5373 '''module_item : attribute_list_opt gatetype delay3 gate_instance_list ';' '''
5374 print('module_item_22', list(p
))
5375 # { pform_makegates(@2, $2, str_strength, $3, $4, $1); }
5377 def p_module_item_23(p
):
5378 '''module_item : attribute_list_opt gatetype drive_strength gate_instance_list ';' '''
5379 print('module_item_23', list(p
))
5380 # { pform_makegates(@2, $2, $3, 0, $4, $1); }
5382 def p_module_item_24(p
):
5383 '''module_item : attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';' '''
5384 print('module_item_24', list(p
))
5385 # { pform_makegates(@2, $2, $3, $4, $5, $1); }
5387 def p_module_item_25(p
):
5388 '''module_item : attribute_list_opt switchtype gate_instance_list ';' '''
5389 print('module_item_25', list(p
))
5390 # { pform_makegates(@2, $2, str_strength, 0, $3, $1); }
5392 def p_module_item_26(p
):
5393 '''module_item : attribute_list_opt switchtype delay3 gate_instance_list ';' '''
5394 print('module_item_26', list(p
))
5395 # { pform_makegates(@2, $2, str_strength, $3, $4, $1); }
5397 def p_module_item_27(p
):
5398 '''module_item : K_pullup gate_instance_list ';' '''
5399 print('module_item_27', list(p
))
5400 # { pform_makegates(@1, PGBuiltin::PULLUP, pull_strength, 0, $2, 0); }
5402 def p_module_item_28(p
):
5403 '''module_item : K_pulldown gate_instance_list ';' '''
5404 print('module_item_28', list(p
))
5405 # { pform_makegates(@1, PGBuiltin::PULLDOWN, pull_strength, 0, $2, 0); }
5407 def p_module_item_29(p
):
5408 '''module_item : K_pullup '(' dr_strength1 ')' gate_instance_list ';' '''
5409 print('module_item_29', list(p
))
5410 # { pform_makegates(@1, PGBuiltin::PULLUP, $3, 0, $5, 0); }
5412 def p_module_item_30(p
):
5413 '''module_item : K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5414 print('module_item_30', list(p
))
5415 # { pform_makegates(@1, PGBuiltin::PULLUP, $3, 0, $7, 0); }
5417 def p_module_item_31(p
):
5418 '''module_item : K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5419 print('module_item_31', list(p
))
5420 # { pform_makegates(@1, PGBuiltin::PULLUP, $5, 0, $7, 0); }
5422 def p_module_item_32(p
):
5423 '''module_item : K_pulldown '(' dr_strength0 ')' gate_instance_list ';' '''
5424 print('module_item_32', list(p
))
5425 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $3, 0, $5, 0); }
5427 def p_module_item_33(p
):
5428 '''module_item : K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5429 print('module_item_33', list(p
))
5430 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $5, 0, $7, 0); }
5432 def p_module_item_34(p
):
5433 '''module_item : K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5434 print('module_item_34', list(p
))
5435 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $3, 0, $7, 0); }
5437 def p_module_item_35(p
):
5438 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' '''
5439 print('module_item_35', list(p
))
5440 # { perm_string tmp1 = lex_strings.make($2);
5441 # pform_make_modgates(@2, tmp1, $3, $4, $1);
5445 def p_module_item_36(p
):
5446 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt error ';' '''
5447 print('module_item_36', list(p
))
5448 # { yyerror(@2, "error: Invalid module instantiation");
5450 # if ($1) delete $1;
5453 def p_module_item_37(p
):
5454 '''module_item : K_assign drive_strength_opt delay3_opt cont_assign_list ';' '''
5455 print('module_item_37', list(p
))
5456 # { pform_make_pgassign_list($4, $3, $2, @1.text, @1.first_line); }
5458 def p_module_item_38(p
):
5459 '''module_item : attribute_list_opt K_always statement_item '''
5460 print('module_item_38', list(p
))
5461 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, $3, $1);
5462 # FILE_NAME(tmp, @2);
5465 def p_module_item_39(p
):
5466 '''module_item : attribute_list_opt K_always_comb statement_item '''
5467 print('module_item_39', list(p
))
5468 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_COMB, $3, $1);
5469 # FILE_NAME(tmp, @2);
5472 def p_module_item_40(p
):
5473 '''module_item : attribute_list_opt K_always_ff statement_item '''
5474 print('module_item_40', list(p
))
5475 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, $3, $1);
5476 # FILE_NAME(tmp, @2);
5479 def p_module_item_41(p
):
5480 '''module_item : attribute_list_opt K_always_latch statement_item '''
5481 print('module_item_41', list(p
))
5482 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_LATCH, $3, $1);
5483 # FILE_NAME(tmp, @2);
5486 def p_module_item_42(p
):
5487 '''module_item : attribute_list_opt K_initial statement_item '''
5488 print('module_item_42', list(p
))
5489 # { PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, $3, $1);
5490 # FILE_NAME(tmp, @2);
5493 def p_module_item_43(p
):
5494 '''module_item : attribute_list_opt K_final statement_item '''
5495 print('module_item_43', list(p
))
5496 # { PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, $3, $1);
5497 # FILE_NAME(tmp, @2);
5500 def p_module_item_44(p
):
5501 '''module_item : attribute_list_opt K_analog analog_statement '''
5502 print('module_item_44', list(p
))
5503 # { pform_make_analog_behavior(@2, IVL_PR_ALWAYS, $3); }
5505 def p_module_item_45(p
):
5506 '''module_item : attribute_list_opt assertion_item '''
5507 print('module_item_45', list(p
))
5509 def p_module_item_46(p
):
5510 '''module_item : timeunits_declaration '''
5511 print('module_item_46', list(p
))
5513 def p_module_item_47(p
):
5514 '''module_item : class_declaration '''
5515 print('module_item_47', list(p
))
5517 def p_module_item_48(p
):
5518 '''module_item : task_declaration '''
5519 print('module_item_48', list(p
))
5521 def p_module_item_49(p
):
5522 '''module_item : function_declaration '''
5523 print('module_item_49', list(p
))
5525 def p_module_item_50(p
):
5526 '''module_item : K_generate generate_item_list_opt K_endgenerate '''
5527 print('module_item_50', list(p
))
5528 # { // Test for bad nesting. I understand it, but it is illegal.
5529 # if (pform_parent_generate()) {
5530 # cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
5531 # cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
5532 # cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
5537 def p_module_item_51(p
):
5538 '''module_item : K_genvar list_of_identifiers ';' '''
5539 print('module_item_51', list(p
))
5540 # { pform_genvars(@1, $2); }
5542 def p_module_item_52(p
):
5543 '''module_item : K_for '(' IDENTIFIER '=' expression ';' expression ';' IDENTIFIER '=' expression ')' _embed2_module_item generate_block '''
5544 print('module_item_52', list(p
))
5545 # { pform_endgenerate(); }
5547 def p_module_item_53(p
):
5548 '''module_item : generate_if generate_block_opt K_else _embed3_module_item generate_block '''
5549 print('module_item_53', list(p
))
5550 # { pform_endgenerate(); }
5552 def p_module_item_54(p
):
5553 '''module_item : generate_if generate_block_opt %prec less_than_K_else '''
5554 print('module_item_54', list(p
))
5555 # { pform_endgenerate(); }
5557 def p_module_item_55(p
):
5558 '''module_item : K_case '(' expression ')' _embed4_module_item generate_case_items K_endcase '''
5559 print('module_item_55', list(p
))
5560 # { pform_endgenerate(); }
5562 def p_module_item_56(p
):
5563 '''module_item : modport_declaration '''
5564 print('module_item_56', list(p
))
5566 def p_module_item_57(p
):
5567 '''module_item : package_import_declaration '''
5568 print('module_item_57', list(p
))
5570 def p_module_item_58(p
):
5571 '''module_item : attribute_list_opt K_specparam _embed5_module_item specparam_decl ';' '''
5572 print('module_item_58', list(p
))
5574 def p_module_item_59(p
):
5575 '''module_item : K_specify _embed6_module_item specify_item_list_opt K_endspecify '''
5576 print('module_item_59', list(p
))
5578 def p_module_item_60(p
):
5579 '''module_item : K_specify error K_endspecify '''
5580 print('module_item_60', list(p
))
5581 # { yyerror(@1, "error: syntax error in specify block");
5585 def p_module_item_61(p
):
5586 '''module_item : error ';' '''
5587 print('module_item_61', list(p
))
5588 # { yyerror(@2, "error: invalid module item.");
5592 def p_module_item_62(p
):
5593 '''module_item : K_assign error '=' expression ';' '''
5594 print('module_item_62', list(p
))
5595 # { yyerror(@1, "error: syntax error in left side "
5596 # "of continuous assignment.");
5600 def p_module_item_63(p
):
5601 '''module_item : K_assign error ';' '''
5602 print('module_item_63', list(p
))
5603 # { yyerror(@1, "error: syntax error in "
5604 # "continuous assignment");
5608 def p_module_item_64(p
):
5609 '''module_item : K_function error K_endfunction endlabel_opt '''
5610 print('module_item_64', list(p
))
5611 # { yyerror(@1, "error: I give up on this "
5612 # "function definition.");
5614 # if (!gn_system_verilog()) {
5615 # yyerror(@4, "error: Function end names require "
5616 # "SystemVerilog.");
5623 def p_module_item_65(p
):
5624 '''module_item : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';' '''
5625 print('module_item_65', list(p
))
5626 # { perm_string tmp3 = lex_strings.make($3);
5627 # perm_string tmp5 = lex_strings.make($5);
5628 # pform_set_attrib(tmp3, tmp5, $7);
5633 def p_module_item_66(p
):
5634 '''module_item : KK_attribute '(' error ')' ';' '''
5635 print('module_item_66', list(p
))
5636 # { yyerror(@1, "error: Malformed $attribute parameter list."); }
5638 def p__embed0_module_item(p
):
5639 '''_embed0_module_item : '''
5640 # { attributes_in_context = $1; }
5642 def p__embed1_module_item(p
):
5643 '''_embed1_module_item : '''
5644 # { if (pform_in_interface())
5645 # yyerror(@1, "error: Parameter overrides are not allowed "
5646 # "in interfaces.");
5649 def p__embed2_module_item(p
):
5650 '''_embed2_module_item : '''
5651 # { pform_start_generate_for(@1, $3, $5, $7, $9, $11); }
5653 def p__embed3_module_item(p
):
5654 '''_embed3_module_item : '''
5655 # { pform_start_generate_else(@1); }
5657 def p__embed4_module_item(p
):
5658 '''_embed4_module_item : '''
5659 # { pform_start_generate_case(@1, $3); }
5661 def p__embed5_module_item(p
):
5662 '''_embed5_module_item : '''
5663 # { if (pform_in_interface())
5664 # yyerror(@1, "error: specparam declarations are not allowed "
5665 # "in interfaces.");
5668 def p__embed6_module_item(p
):
5669 '''_embed6_module_item : '''
5670 # { if (pform_in_interface())
5671 # yyerror(@1, "error: specify blocks are not allowed "
5672 # "in interfaces.");
5675 def p_module_item_list_1(p
):
5676 '''module_item_list : module_item_list module_item '''
5677 print('module_item_list_1', list(p
))
5679 def p_module_item_list_2(p
):
5680 '''module_item_list : module_item '''
5681 print('module_item_list_2', list(p
))
5683 def p_module_item_list_opt_1(p
):
5684 '''module_item_list_opt : module_item_list '''
5685 print('module_item_list_opt_1', list(p
))
5687 def p_module_item_list_opt_2(p
):
5688 '''module_item_list_opt : '''
5689 print('module_item_list_opt_2', list(p
))
5691 def p_generate_if_1(p
):
5692 '''generate_if : K_if '(' expression ')' '''
5693 print('generate_if_1', list(p
))
5694 # { pform_start_generate_if(@1, $3); }
5696 def p_generate_case_items_1(p
):
5697 '''generate_case_items : generate_case_items generate_case_item '''
5698 print('generate_case_items_1', list(p
))
5700 def p_generate_case_items_2(p
):
5701 '''generate_case_items : generate_case_item '''
5702 print('generate_case_items_2', list(p
))
5704 def p_generate_case_item_1(p
):
5705 '''generate_case_item : expression_list_proper ':' _embed0_generate_case_item generate_block_opt '''
5706 print('generate_case_item_1', list(p
))
5707 # { pform_endgenerate(); }
5709 def p_generate_case_item_2(p
):
5710 '''generate_case_item : K_default ':' _embed1_generate_case_item generate_block_opt '''
5711 print('generate_case_item_2', list(p
))
5712 # { pform_endgenerate(); }
5714 def p__embed0_generate_case_item(p
):
5715 '''_embed0_generate_case_item : '''
5716 # { pform_generate_case_item(@1, $1); }
5718 def p__embed1_generate_case_item(p
):
5719 '''_embed1_generate_case_item : '''
5720 # { pform_generate_case_item(@1, 0); }
5722 def p_generate_item_1(p
):
5723 '''generate_item : module_item '''
5724 print('generate_item_1', list(p
))
5726 def p_generate_item_2(p
):
5727 '''generate_item : K_begin generate_item_list_opt K_end '''
5728 print('generate_item_2', list(p
))
5729 # { /* Detect and warn about anachronistic begin/end use */
5730 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5732 # cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
5736 def p_generate_item_3(p
):
5737 '''generate_item : K_begin ':' IDENTIFIER _embed0_generate_item generate_item_list_opt K_end '''
5738 print('generate_item_3', list(p
))
5739 # { /* Detect and warn about anachronistic named begin/end use */
5740 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5742 # cerr << @1 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
5744 # pform_endgenerate();
5747 def p__embed0_generate_item(p
):
5748 '''_embed0_generate_item : '''
5750 # pform_start_generate_nblock(@1, $3);
5753 def p_generate_item_list_1(p
):
5754 '''generate_item_list : generate_item_list generate_item '''
5755 print('generate_item_list_1', list(p
))
5757 def p_generate_item_list_2(p
):
5758 '''generate_item_list : generate_item '''
5759 print('generate_item_list_2', list(p
))
5761 def p_generate_item_list_opt_1(p
):
5762 '''generate_item_list_opt : generate_item_list '''
5763 print('generate_item_list_opt_1', list(p
))
5765 def p_generate_item_list_opt_2(p
):
5766 '''generate_item_list_opt : '''
5767 print('generate_item_list_opt_2', list(p
))
5769 def p_generate_block_1(p
):
5770 '''generate_block : module_item '''
5771 print('generate_block_1', list(p
))
5773 def p_generate_block_2(p
):
5774 '''generate_block : K_begin generate_item_list_opt K_end '''
5775 print('generate_block_2', list(p
))
5777 def p_generate_block_3(p
):
5778 '''generate_block : K_begin ':' IDENTIFIER generate_item_list_opt K_end endlabel_opt '''
5779 print('generate_block_3', list(p
))
5780 # { pform_generate_block_name($3);
5782 # if (strcmp($3,$6) != 0) {
5783 # yyerror(@6, "error: End label doesn't match "
5786 # if (! gn_system_verilog()) {
5787 # yyerror(@6, "error: Begin end labels require "
5788 # "SystemVerilog.");
5795 def p_generate_block_opt_1(p
):
5796 '''generate_block_opt : generate_block '''
5797 print('generate_block_opt_1', list(p
))
5799 def p_generate_block_opt_2(p
):
5800 '''generate_block_opt : ';' '''
5801 print('generate_block_opt_2', list(p
))
5803 def p_net_decl_assign_1(p
):
5804 '''net_decl_assign : IDENTIFIER '=' expression '''
5805 print('net_decl_assign_1', list(p
))
5806 # { net_decl_assign_t*tmp = new net_decl_assign_t;
5808 # tmp->name = lex_strings.make($1);
5814 def p_net_decl_assigns_1(p
):
5815 '''net_decl_assigns : net_decl_assigns ',' net_decl_assign '''
5816 print('net_decl_assigns_1', list(p
))
5817 # { net_decl_assign_t*tmp = $1;
5818 # $3->next = tmp->next;
5823 def p_net_decl_assigns_2(p
):
5824 '''net_decl_assigns : net_decl_assign '''
5825 print('net_decl_assigns_2', list(p
))
5829 def p_bit_logic_1(p
):
5830 '''bit_logic : K_logic '''
5831 print('bit_logic_1', list(p
))
5832 # { $$ = IVL_VT_LOGIC; }
5834 def p_bit_logic_2(p
):
5835 '''bit_logic : K_bool '''
5836 print('bit_logic_2', list(p
))
5837 # { $$ = IVL_VT_BOOL; /* Icarus misc */}
5839 def p_bit_logic_3(p
):
5840 '''bit_logic : K_bit '''
5841 print('bit_logic_3', list(p
))
5842 # { $$ = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
5844 def p_bit_logic_opt_1(p
):
5845 '''bit_logic_opt : bit_logic '''
5846 print('bit_logic_opt_1', list(p
))
5848 def p_bit_logic_opt_2(p
):
5849 '''bit_logic_opt : '''
5850 print('bit_logic_opt_2', list(p
))
5851 # { $$ = IVL_VT_NO_TYPE; }
5853 def p_net_type_1(p
):
5854 '''net_type : K_wire '''
5855 print('net_type_1', list(p
))
5856 # { $$ = NetNet::WIRE; }
5858 def p_net_type_2(p
):
5859 '''net_type : K_tri '''
5860 print('net_type_2', list(p
))
5861 # { $$ = NetNet::TRI; }
5863 def p_net_type_3(p
):
5864 '''net_type : K_tri1 '''
5865 print('net_type_3', list(p
))
5866 # { $$ = NetNet::TRI1; }
5868 def p_net_type_4(p
):
5869 '''net_type : K_supply0 '''
5870 print('net_type_4', list(p
))
5871 # { $$ = NetNet::SUPPLY0; }
5873 def p_net_type_5(p
):
5874 '''net_type : K_wand '''
5875 print('net_type_5', list(p
))
5876 # { $$ = NetNet::WAND; }
5878 def p_net_type_6(p
):
5879 '''net_type : K_triand '''
5880 print('net_type_6', list(p
))
5881 # { $$ = NetNet::TRIAND; }
5883 def p_net_type_7(p
):
5884 '''net_type : K_tri0 '''
5885 print('net_type_7', list(p
))
5886 # { $$ = NetNet::TRI0; }
5888 def p_net_type_8(p
):
5889 '''net_type : K_supply1 '''
5890 print('net_type_8', list(p
))
5891 # { $$ = NetNet::SUPPLY1; }
5893 def p_net_type_9(p
):
5894 '''net_type : K_wor '''
5895 print('net_type_9', list(p
))
5896 # { $$ = NetNet::WOR; }
5898 def p_net_type_10(p
):
5899 '''net_type : K_trior '''
5900 print('net_type_10', list(p
))
5901 # { $$ = NetNet::TRIOR; }
5903 def p_net_type_11(p
):
5904 '''net_type : K_wone '''
5905 print('net_type_11', list(p
))
5906 # { $$ = NetNet::UNRESOLVED_WIRE;
5907 # cerr << @1.text << ":" << @1.first_line << ": warning: "
5908 # "'wone' is deprecated, please use 'uwire' "
5909 # "instead." << endl;
5912 def p_net_type_12(p
):
5913 '''net_type : K_uwire '''
5914 print('net_type_12', list(p
))
5915 # { $$ = NetNet::UNRESOLVED_WIRE; }
5917 def p_param_type_1(p
):
5918 '''param_type : bit_logic_opt unsigned_signed_opt dimensions_opt '''
5919 print('param_type_1', list(p
))
5920 # { param_active_range = $3;
5921 # param_active_signed = $2;
5922 # if (($1 == IVL_VT_NO_TYPE) && ($3 != 0))
5923 # param_active_type = IVL_VT_LOGIC;
5925 # param_active_type = $1;
5928 def p_param_type_2(p
):
5929 '''param_type : K_integer '''
5930 print('param_type_2', list(p
))
5931 # { param_active_range = make_range_from_width(integer_width);
5932 # param_active_signed = true;
5933 # param_active_type = IVL_VT_LOGIC;
5936 def p_param_type_3(p
):
5937 '''param_type : K_time '''
5938 print('param_type_3', list(p
))
5939 # { param_active_range = make_range_from_width(64);
5940 # param_active_signed = false;
5941 # param_active_type = IVL_VT_LOGIC;
5944 def p_param_type_4(p
):
5945 '''param_type : real_or_realtime '''
5946 print('param_type_4', list(p
))
5947 # { param_active_range = 0;
5948 # param_active_signed = true;
5949 # param_active_type = IVL_VT_REAL;
5952 def p_param_type_5(p
):
5953 '''param_type : atom2_type '''
5954 print('param_type_5', list(p
))
5955 # { param_active_range = make_range_from_width($1);
5956 # param_active_signed = true;
5957 # param_active_type = IVL_VT_BOOL;
5960 def p_param_type_6(p
):
5961 '''param_type : TYPE_IDENTIFIER '''
5962 print('param_type_6', list(p
))
5963 # { pform_set_param_from_type(@1, $1.type, $1.text, param_active_range,
5964 # param_active_signed, param_active_type);
5968 def p_parameter_assign_list_1(p
):
5969 '''parameter_assign_list : parameter_assign '''
5970 print('parameter_assign_list_1', list(p
))
5972 def p_parameter_assign_list_2(p
):
5973 '''parameter_assign_list : parameter_assign_list ',' parameter_assign '''
5974 print('parameter_assign_list_2', list(p
))
5976 def p_localparam_assign_list_1(p
):
5977 '''localparam_assign_list : localparam_assign '''
5978 print('localparam_assign_list_1', list(p
))
5980 def p_localparam_assign_list_2(p
):
5981 '''localparam_assign_list : localparam_assign_list ',' localparam_assign '''
5982 print('localparam_assign_list_2', list(p
))
5984 def p_parameter_assign_1(p
):
5985 '''parameter_assign : IDENTIFIER '=' expression parameter_value_ranges_opt '''
5986 print('parameter_assign_1', list(p
))
5987 tpname
= Node(syms
.tname
, [Leaf(token
.NAME
, p
[1])])
5988 expr
= Node(syms
.tfpdef
, [tpname
, Leaf(token
.EQUAL
, p
[2]), p
[3] ])
5991 # pform_set_parameter(@1, lex_strings.make($1), param_active_type,
5992 # param_active_signed, param_active_range, tmp, $4);
5996 def p_localparam_assign_1(p
):
5997 '''localparam_assign : IDENTIFIER '=' expression '''
5998 print('localparam_assign_1', list(p
))
6000 # pform_set_localparam(@1, lex_strings.make($1), param_active_type,
6001 # param_active_signed, param_active_range, tmp);
6005 def p_parameter_value_ranges_opt_1(p
):
6006 '''parameter_value_ranges_opt : parameter_value_ranges '''
6007 print('parameter_value_ranges_opt_1', list(p
))
6010 def p_parameter_value_ranges_opt_2(p
):
6011 '''parameter_value_ranges_opt : '''
6012 print('parameter_value_ranges_opt_2', list(p
))
6015 def p_parameter_value_ranges_1(p
):
6016 '''parameter_value_ranges : parameter_value_ranges parameter_value_range '''
6017 print('parameter_value_ranges_1', list(p
))
6018 # { $$ = $2; $$->next = $1; }
6020 def p_parameter_value_ranges_2(p
):
6021 '''parameter_value_ranges : parameter_value_range '''
6022 print('parameter_value_ranges_2', list(p
))
6023 # { $$ = $1; $$->next = 0; }
6025 def p_parameter_value_range_1(p
):
6026 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ']' '''
6027 print('parameter_value_range_1', list(p
))
6028 # { $$ = pform_parameter_value_range($1, false, $3, false, $5); }
6030 def p_parameter_value_range_2(p
):
6031 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ')' '''
6032 print('parameter_value_range_2', list(p
))
6033 # { $$ = pform_parameter_value_range($1, false, $3, true, $5); }
6035 def p_parameter_value_range_3(p
):
6036 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ']' '''
6037 print('parameter_value_range_3', list(p
))
6038 # { $$ = pform_parameter_value_range($1, true, $3, false, $5); }
6040 def p_parameter_value_range_4(p
):
6041 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ')' '''
6042 print('parameter_value_range_4', list(p
))
6043 # { $$ = pform_parameter_value_range($1, true, $3, true, $5); }
6045 def p_parameter_value_range_5(p
):
6046 '''parameter_value_range : K_exclude expression '''
6047 print('parameter_value_range_5', list(p
))
6048 # { $$ = pform_parameter_value_range(true, false, $2, false, $2); }
6050 def p_value_range_expression_1(p
):
6051 '''value_range_expression : expression '''
6052 print('value_range_expression_1', list(p
))
6055 def p_value_range_expression_2(p
):
6056 '''value_range_expression : K_inf '''
6057 print('value_range_expression_2', list(p
))
6060 def p_value_range_expression_3(p
):
6061 '''value_range_expression : '+' K_inf '''
6062 print('value_range_expression_3', list(p
))
6065 def p_value_range_expression_4(p
):
6066 '''value_range_expression : '-' K_inf '''
6067 print('value_range_expression_4', list(p
))
6070 def p_from_exclude_1(p
):
6071 '''from_exclude : K_from '''
6072 print('from_exclude_1', list(p
))
6075 def p_from_exclude_2(p
):
6076 '''from_exclude : K_exclude '''
6077 print('from_exclude_2', list(p
))
6080 def p_parameter_value_opt_1(p
):
6081 '''parameter_value_opt : '#' '(' expression_list_with_nuls ')' '''
6082 print('parameter_value_opt_1', list(p
))
6083 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6084 # tmp->by_order = $3;
6089 def p_parameter_value_opt_2(p
):
6090 '''parameter_value_opt : '#' '(' parameter_value_byname_list ')' '''
6091 print('parameter_value_opt_2', list(p
))
6092 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6093 # tmp->by_order = 0;
6094 # tmp->by_name = $3;
6098 def p_parameter_value_opt_3(p
):
6099 '''parameter_value_opt : '#' DEC_NUMBER '''
6100 print('parameter_value_opt_3', list(p
))
6102 # PENumber*tmp = new PENumber($2);
6103 # FILE_NAME(tmp, @1);
6105 # struct parmvalue_t*lst = new struct parmvalue_t;
6106 # lst->by_order = new list<PExpr*>;
6107 # lst->by_order->push_back(tmp);
6113 def p_parameter_value_opt_4(p
):
6114 '''parameter_value_opt : '#' REALTIME '''
6115 print('parameter_value_opt_4', list(p
))
6117 # PEFNumber*tmp = new PEFNumber($2);
6118 # FILE_NAME(tmp, @1);
6120 # struct parmvalue_t*lst = new struct parmvalue_t;
6121 # lst->by_order = new list<PExpr*>;
6122 # lst->by_order->push_back(tmp);
6127 def p_parameter_value_opt_5(p
):
6128 '''parameter_value_opt : '#' error '''
6129 print('parameter_value_opt_5', list(p
))
6130 # { yyerror(@1, "error: syntax error in parameter value "
6131 # "assignment list.");
6135 def p_parameter_value_opt_6(p
):
6136 '''parameter_value_opt : '''
6137 print('parameter_value_opt_6', list(p
))
6140 def p_parameter_value_byname_1(p
):
6141 '''parameter_value_byname : '.' IDENTIFIER '(' expression ')' '''
6142 print('parameter_value_byname_1', list(p
))
6143 # { named_pexpr_t*tmp = new named_pexpr_t;
6144 # tmp->name = lex_strings.make($2);
6150 def p_parameter_value_byname_2(p
):
6151 '''parameter_value_byname : '.' IDENTIFIER '(' ')' '''
6152 print('parameter_value_byname_2', list(p
))
6153 # { named_pexpr_t*tmp = new named_pexpr_t;
6154 # tmp->name = lex_strings.make($2);
6160 def p_parameter_value_byname_list_1(p
):
6161 '''parameter_value_byname_list : parameter_value_byname '''
6162 print('parameter_value_byname_list_1', list(p
))
6163 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6164 # tmp->push_back(*$1);
6169 def p_parameter_value_byname_list_2(p
):
6170 '''parameter_value_byname_list : parameter_value_byname_list ',' parameter_value_byname '''
6171 print('parameter_value_byname_list_2', list(p
))
6172 # { list<named_pexpr_t>*tmp = $1;
6173 # tmp->push_back(*$3);
6179 '''port : port_reference '''
6180 print('port_1', list(p
))
6184 '''port : '.' IDENTIFIER '(' port_reference ')' '''
6185 print('port_2', list(p
))
6186 # { Module::port_t*tmp = $4;
6187 # tmp->name = lex_strings.make($2);
6193 '''port : '{' port_reference_list '}' '''
6194 print('port_3', list(p
))
6195 # { Module::port_t*tmp = $2;
6196 # tmp->name = perm_string();
6201 '''port : '.' IDENTIFIER '(' '{' port_reference_list '}' ')' '''
6202 print('port_4', list(p
))
6203 # { Module::port_t*tmp = $5;
6204 # tmp->name = lex_strings.make($2);
6209 def p_port_opt_1(p
):
6210 '''port_opt : port '''
6211 print('port_opt_1', list(p
))
6214 def p_port_opt_2(p
):
6216 print('port_opt_2', list(p
))
6219 def p_port_name_1(p
):
6220 '''port_name : '.' IDENTIFIER '(' expression ')' '''
6221 print('port_name_1', list(p
))
6222 # { named_pexpr_t*tmp = new named_pexpr_t;
6223 # tmp->name = lex_strings.make($2);
6229 def p_port_name_2(p
):
6230 '''port_name : '.' IDENTIFIER '(' error ')' '''
6231 print('port_name_2', list(p
))
6232 # { yyerror(@3, "error: invalid port connection expression.");
6233 # named_pexpr_t*tmp = new named_pexpr_t;
6234 # tmp->name = lex_strings.make($2);
6240 def p_port_name_3(p
):
6241 '''port_name : '.' IDENTIFIER '(' ')' '''
6242 print('port_name_3', list(p
))
6243 # { named_pexpr_t*tmp = new named_pexpr_t;
6244 # tmp->name = lex_strings.make($2);
6250 def p_port_name_4(p
):
6251 '''port_name : '.' IDENTIFIER '''
6252 print('port_name_4', list(p
))
6253 # { named_pexpr_t*tmp = new named_pexpr_t;
6254 # tmp->name = lex_strings.make($2);
6255 # tmp->parm = new PEIdent(lex_strings.make($2), true);
6256 # FILE_NAME(tmp->parm, @1);
6261 def p_port_name_5(p
):
6262 '''port_name : K_DOTSTAR '''
6263 print('port_name_5', list(p
))
6264 # { named_pexpr_t*tmp = new named_pexpr_t;
6265 # tmp->name = lex_strings.make("*");
6270 def p_port_name_list_1(p
):
6271 '''port_name_list : port_name_list ',' port_name '''
6272 print('port_name_list_1', list(p
))
6273 # { list<named_pexpr_t>*tmp = $1;
6274 # tmp->push_back(*$3);
6279 def p_port_name_list_2(p
):
6280 '''port_name_list : port_name '''
6281 print('port_name_list_2', list(p
))
6282 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6283 # tmp->push_back(*$1);
6288 def p_port_reference_1(p
):
6289 '''port_reference : IDENTIFIER '''
6290 print('port_reference_1', list(p
))
6291 # { Module::port_t*ptmp;
6292 # perm_string name = lex_strings.make($1);
6293 # ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
6298 def p_port_reference_2(p
):
6299 '''port_reference : IDENTIFIER '[' expression ':' expression ']' '''
6300 print('port_reference_2', list(p
))
6301 # { index_component_t itmp;
6302 # itmp.sel = index_component_t::SEL_PART;
6306 # name_component_t ntmp (lex_strings.make($1));
6307 # ntmp.index.push_back(itmp);
6309 # pform_name_t pname;
6310 # pname.push_back(ntmp);
6312 # PEIdent*wtmp = new PEIdent(pname);
6313 # FILE_NAME(wtmp, @1);
6315 # Module::port_t*ptmp = new Module::port_t;
6316 # ptmp->name = perm_string();
6317 # ptmp->expr.push_back(wtmp);
6323 def p_port_reference_3(p
):
6324 '''port_reference : IDENTIFIER '[' expression ']' '''
6325 print('port_reference_3', list(p
))
6326 # { index_component_t itmp;
6327 # itmp.sel = index_component_t::SEL_BIT;
6331 # name_component_t ntmp (lex_strings.make($1));
6332 # ntmp.index.push_back(itmp);
6334 # pform_name_t pname;
6335 # pname.push_back(ntmp);
6337 # PEIdent*tmp = new PEIdent(pname);
6338 # FILE_NAME(tmp, @1);
6340 # Module::port_t*ptmp = new Module::port_t;
6341 # ptmp->name = perm_string();
6342 # ptmp->expr.push_back(tmp);
6347 def p_port_reference_4(p
):
6348 '''port_reference : IDENTIFIER '[' error ']' '''
6349 print('port_reference_4', list(p
))
6350 # { yyerror(@1, "error: invalid port bit select");
6351 # Module::port_t*ptmp = new Module::port_t;
6352 # PEIdent*wtmp = new PEIdent(lex_strings.make($1));
6353 # FILE_NAME(wtmp, @1);
6354 # ptmp->name = lex_strings.make($1);
6355 # ptmp->expr.push_back(wtmp);
6360 def p_port_reference_list_1(p
):
6361 '''port_reference_list : port_reference '''
6362 print('port_reference_list_1', list(p
))
6365 def p_port_reference_list_2(p
):
6366 '''port_reference_list : port_reference_list ',' port_reference '''
6367 print('port_reference_list_2', list(p
))
6368 # { Module::port_t*tmp = $1;
6369 # append(tmp->expr, $3->expr);
6374 def p_dimensions_opt_1(p
):
6375 '''dimensions_opt : '''
6376 print('dimensions_opt_1', list(p
))
6379 def p_dimensions_opt_2(p
):
6380 '''dimensions_opt : dimensions '''
6381 print('dimensions_opt_2', list(p
))
6384 def p_dimensions_1(p
):
6385 '''dimensions : variable_dimension '''
6386 print('dimensions_1', list(p
))
6389 def p_dimensions_2(p
):
6390 '''dimensions : dimensions variable_dimension '''
6391 print('dimensions_2', list(p
))
6392 # { list<pform_range_t> *tmp = $1;
6394 # tmp->splice(tmp->end(), *$2);
6400 def p_register_variable_1(p
):
6401 '''register_variable : IDENTIFIER dimensions_opt '''
6402 print('register_variable_1', list(p
))
6403 # { perm_string name = lex_strings.make($1);
6404 # pform_makewire(@1, name, NetNet::REG,
6405 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6406 # pform_set_reg_idx(name, $2);
6410 def p_register_variable_2(p
):
6411 '''register_variable : IDENTIFIER dimensions_opt '=' expression '''
6412 print('register_variable_2', list(p
))
6413 # { if (pform_peek_scope()->var_init_needs_explicit_lifetime()
6414 # && (var_lifetime == LexicalScope::INHERITED)) {
6415 # cerr << @3 << ": warning: Static variable initialization requires "
6416 # "explicit lifetime in this context." << endl;
6419 # perm_string name = lex_strings.make($1);
6420 # pform_makewire(@1, name, NetNet::REG,
6421 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6422 # pform_set_reg_idx(name, $2);
6423 # pform_make_var_init(@1, name, $4);
6427 def p_register_variable_list_1(p
):
6428 '''register_variable_list : register_variable '''
6429 print('register_variable_list_1', list(p
))
6430 # { list<perm_string>*tmp = new list<perm_string>;
6431 # tmp->push_back(lex_strings.make($1));
6436 def p_register_variable_list_2(p
):
6437 '''register_variable_list : register_variable_list ',' register_variable '''
6438 print('register_variable_list_2', list(p
))
6439 # { list<perm_string>*tmp = $1;
6440 # tmp->push_back(lex_strings.make($3));
6445 def p_net_variable_1(p
):
6446 '''net_variable : IDENTIFIER dimensions_opt '''
6447 print('net_variable_1', list(p
))
6448 # { perm_string name = lex_strings.make($1);
6449 # pform_makewire(@1, name, NetNet::IMPLICIT,
6450 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6451 # pform_set_reg_idx(name, $2);
6455 def p_net_variable_list_1(p
):
6456 '''net_variable_list : net_variable '''
6457 print('net_variable_list_1', list(p
))
6458 # { list<perm_string>*tmp = new list<perm_string>;
6459 # tmp->push_back(lex_strings.make($1));
6464 def p_net_variable_list_2(p
):
6465 '''net_variable_list : net_variable_list ',' net_variable '''
6466 print('net_variable_list_2', list(p
))
6467 # { list<perm_string>*tmp = $1;
6468 # tmp->push_back(lex_strings.make($3));
6473 def p_event_variable_1(p
):
6474 '''event_variable : IDENTIFIER dimensions_opt '''
6475 print('event_variable_1', list(p
))
6477 # yyerror(@2, "sorry: event arrays are not supported.");
6483 def p_event_variable_list_1(p
):
6484 '''event_variable_list : event_variable '''
6485 print('event_variable_list_1', list(p
))
6486 # { $$ = list_from_identifier($1); }
6488 def p_event_variable_list_2(p
):
6489 '''event_variable_list : event_variable_list ',' event_variable '''
6490 print('event_variable_list_2', list(p
))
6491 # { $$ = list_from_identifier($1, $3); }
6493 def p_specify_item_1(p
):
6494 '''specify_item : K_specparam specparam_decl ';' '''
6495 print('specify_item_1', list(p
))
6497 def p_specify_item_2(p
):
6498 '''specify_item : specify_simple_path_decl ';' '''
6499 print('specify_item_2', list(p
))
6500 # { pform_module_specify_path($1);
6503 def p_specify_item_3(p
):
6504 '''specify_item : specify_edge_path_decl ';' '''
6505 print('specify_item_3', list(p
))
6506 # { pform_module_specify_path($1);
6509 def p_specify_item_4(p
):
6510 '''specify_item : K_if '(' expression ')' specify_simple_path_decl ';' '''
6511 print('specify_item_4', list(p
))
6512 # { PSpecPath*tmp = $5;
6514 # tmp->conditional = true;
6515 # tmp->condition = $3;
6517 # pform_module_specify_path(tmp);
6520 def p_specify_item_5(p
):
6521 '''specify_item : K_if '(' expression ')' specify_edge_path_decl ';' '''
6522 print('specify_item_5', list(p
))
6523 # { PSpecPath*tmp = $5;
6525 # tmp->conditional = true;
6526 # tmp->condition = $3;
6528 # pform_module_specify_path(tmp);
6531 def p_specify_item_6(p
):
6532 '''specify_item : K_ifnone specify_simple_path_decl ';' '''
6533 print('specify_item_6', list(p
))
6534 # { PSpecPath*tmp = $2;
6536 # tmp->conditional = true;
6537 # tmp->condition = 0;
6539 # pform_module_specify_path(tmp);
6542 def p_specify_item_7(p
):
6543 '''specify_item : K_ifnone specify_edge_path_decl ';' '''
6544 print('specify_item_7', list(p
))
6545 # { yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
6546 # "not supported.");
6550 def p_specify_item_8(p
):
6551 '''specify_item : K_Sfullskew '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6552 print('specify_item_8', list(p
))
6557 def p_specify_item_9(p
):
6558 '''specify_item : K_Shold '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6559 print('specify_item_9', list(p
))
6563 def p_specify_item_10(p
):
6564 '''specify_item : K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6565 print('specify_item_10', list(p
))
6570 def p_specify_item_11(p
):
6571 '''specify_item : K_Speriod '(' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6572 print('specify_item_11', list(p
))
6576 def p_specify_item_12(p
):
6577 '''specify_item : K_Srecovery '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6578 print('specify_item_12', list(p
))
6582 def p_specify_item_13(p
):
6583 '''specify_item : K_Srecrem '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6584 print('specify_item_13', list(p
))
6589 def p_specify_item_14(p
):
6590 '''specify_item : K_Sremoval '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6591 print('specify_item_14', list(p
))
6595 def p_specify_item_15(p
):
6596 '''specify_item : K_Ssetup '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6597 print('specify_item_15', list(p
))
6601 def p_specify_item_16(p
):
6602 '''specify_item : K_Ssetuphold '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6603 print('specify_item_16', list(p
))
6608 def p_specify_item_17(p
):
6609 '''specify_item : K_Sskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6610 print('specify_item_17', list(p
))
6614 def p_specify_item_18(p
):
6615 '''specify_item : K_Stimeskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6616 print('specify_item_18', list(p
))
6620 def p_specify_item_19(p
):
6621 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ',' expression spec_notifier_opt ')' ';' '''
6622 print('specify_item_19', list(p
))
6627 def p_specify_item_20(p
):
6628 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ')' ';' '''
6629 print('specify_item_20', list(p
))
6633 def p_specify_item_21(p
):
6634 '''specify_item : K_pulsestyle_onevent specify_path_identifiers ';' '''
6635 print('specify_item_21', list(p
))
6639 def p_specify_item_22(p
):
6640 '''specify_item : K_pulsestyle_ondetect specify_path_identifiers ';' '''
6641 print('specify_item_22', list(p
))
6645 def p_specify_item_23(p
):
6646 '''specify_item : K_showcancelled specify_path_identifiers ';' '''
6647 print('specify_item_23', list(p
))
6651 def p_specify_item_24(p
):
6652 '''specify_item : K_noshowcancelled specify_path_identifiers ';' '''
6653 print('specify_item_24', list(p
))
6657 def p_specify_item_list_1(p
):
6658 '''specify_item_list : specify_item '''
6659 print('specify_item_list_1', list(p
))
6661 def p_specify_item_list_2(p
):
6662 '''specify_item_list : specify_item_list specify_item '''
6663 print('specify_item_list_2', list(p
))
6665 def p_specify_item_list_opt_1(p
):
6666 '''specify_item_list_opt : '''
6667 print('specify_item_list_opt_1', list(p
))
6670 def p_specify_item_list_opt_2(p
):
6671 '''specify_item_list_opt : specify_item_list '''
6672 print('specify_item_list_opt_2', list(p
))
6675 def p_specify_edge_path_decl_1(p
):
6676 '''specify_edge_path_decl : specify_edge_path '=' '(' delay_value_list ')' '''
6677 print('specify_edge_path_decl_1', list(p
))
6678 # { $$ = pform_assign_path_delay($1, $4); }
6680 def p_specify_edge_path_decl_2(p
):
6681 '''specify_edge_path_decl : specify_edge_path '=' delay_value_simple '''
6682 print('specify_edge_path_decl_2', list(p
))
6683 # { list<PExpr*>*tmp = new list<PExpr*>;
6684 # tmp->push_back($3);
6685 # $$ = pform_assign_path_delay($1, tmp);
6688 def p_edge_operator_1(p
):
6689 '''edge_operator : K_posedge '''
6690 print('edge_operator_1', list(p
))
6693 def p_edge_operator_2(p
):
6694 '''edge_operator : K_negedge '''
6695 print('edge_operator_2', list(p
))
6698 def p_specify_edge_path_1(p
):
6699 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6700 print('specify_edge_path_1', list(p
))
6701 # { int edge_flag = 0;
6702 # $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, false, $6, $8); }
6704 def p_specify_edge_path_2(p
):
6705 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6706 print('specify_edge_path_2', list(p
))
6707 # { int edge_flag = $2? 1 : -1;
6708 # $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, false, $7, $9);}
6710 def p_specify_edge_path_3(p
):
6711 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6712 print('specify_edge_path_3', list(p
))
6713 # { int edge_flag = 0;
6714 # $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, true, $6, $8); }
6716 def p_specify_edge_path_4(p
):
6717 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6718 print('specify_edge_path_4', list(p
))
6719 # { int edge_flag = $2? 1 : -1;
6720 # $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, true, $7, $9); }
6722 def p_polarity_operator_1(p
):
6723 '''polarity_operator : K_PO_POS '''
6724 print('polarity_operator_1', list(p
))
6726 def p_polarity_operator_2(p
):
6727 '''polarity_operator : K_PO_NEG '''
6728 print('polarity_operator_2', list(p
))
6730 def p_polarity_operator_3(p
):
6731 '''polarity_operator : ':' '''
6732 print('polarity_operator_3', list(p
))
6734 def p_specify_simple_path_decl_1(p
):
6735 '''specify_simple_path_decl : specify_simple_path '=' '(' delay_value_list ')' '''
6736 print('specify_simple_path_decl_1', list(p
))
6737 # { $$ = pform_assign_path_delay($1, $4); }
6739 def p_specify_simple_path_decl_2(p
):
6740 '''specify_simple_path_decl : specify_simple_path '=' delay_value_simple '''
6741 print('specify_simple_path_decl_2', list(p
))
6742 # { list<PExpr*>*tmp = new list<PExpr*>;
6743 # tmp->push_back($3);
6744 # $$ = pform_assign_path_delay($1, tmp);
6747 def p_specify_simple_path_decl_3(p
):
6748 '''specify_simple_path_decl : specify_simple_path '=' '(' error ')' '''
6749 print('specify_simple_path_decl_3', list(p
))
6750 # { yyerror(@3, "Syntax error in delay value list.");
6755 def p_specify_simple_path_1(p
):
6756 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' '''
6757 print('specify_simple_path_1', list(p
))
6758 # { $$ = pform_make_specify_path(@1, $2, $3, false, $5); }
6760 def p_specify_simple_path_2(p
):
6761 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' '''
6762 print('specify_simple_path_2', list(p
))
6763 # { $$ = pform_make_specify_path(@1, $2, $3, true, $5); }
6765 def p_specify_simple_path_3(p
):
6766 '''specify_simple_path : '(' error ')' '''
6767 print('specify_simple_path_3', list(p
))
6768 # { yyerror(@1, "Invalid simple path");
6772 def p_specify_path_identifiers_1(p
):
6773 '''specify_path_identifiers : IDENTIFIER '''
6774 print('specify_path_identifiers_1', list(p
))
6775 # { list<perm_string>*tmp = new list<perm_string>;
6776 # tmp->push_back(lex_strings.make($1));
6781 def p_specify_path_identifiers_2(p
):
6782 '''specify_path_identifiers : IDENTIFIER '[' expr_primary ']' '''
6783 print('specify_path_identifiers_2', list(p
))
6784 # { if (gn_specify_blocks_flag) {
6785 # yywarn(@4, "Bit selects are not currently supported "
6786 # "in path declarations. The declaration "
6787 # "will be applied to the whole vector.");
6789 # list<perm_string>*tmp = new list<perm_string>;
6790 # tmp->push_back(lex_strings.make($1));
6795 def p_specify_path_identifiers_3(p
):
6796 '''specify_path_identifiers : IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6797 print('specify_path_identifiers_3', list(p
))
6798 # { if (gn_specify_blocks_flag) {
6799 # yywarn(@4, "Part selects are not currently supported "
6800 # "in path declarations. The declaration "
6801 # "will be applied to the whole vector.");
6803 # list<perm_string>*tmp = new list<perm_string>;
6804 # tmp->push_back(lex_strings.make($1));
6809 def p_specify_path_identifiers_4(p
):
6810 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '''
6811 print('specify_path_identifiers_4', list(p
))
6812 # { list<perm_string>*tmp = $1;
6813 # tmp->push_back(lex_strings.make($3));
6818 def p_specify_path_identifiers_5(p
):
6819 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' '''
6820 print('specify_path_identifiers_5', list(p
))
6821 # { if (gn_specify_blocks_flag) {
6822 # yywarn(@4, "Bit selects are not currently supported "
6823 # "in path declarations. The declaration "
6824 # "will be applied to the whole vector.");
6826 # list<perm_string>*tmp = $1;
6827 # tmp->push_back(lex_strings.make($3));
6832 def p_specify_path_identifiers_6(p
):
6833 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6834 print('specify_path_identifiers_6', list(p
))
6835 # { if (gn_specify_blocks_flag) {
6836 # yywarn(@4, "Part selects are not currently supported "
6837 # "in path declarations. The declaration "
6838 # "will be applied to the whole vector.");
6840 # list<perm_string>*tmp = $1;
6841 # tmp->push_back(lex_strings.make($3));
6846 def p_specparam_1(p
):
6847 '''specparam : IDENTIFIER '=' expression '''
6848 print('specparam_1', list(p
))
6850 # pform_set_specparam(@1, lex_strings.make($1),
6851 # param_active_range, tmp);
6855 def p_specparam_2(p
):
6856 '''specparam : IDENTIFIER '=' expression ':' expression ':' expression '''
6857 print('specparam_2', list(p
))
6859 # switch (min_typ_max_flag) {
6876 # if (min_typ_max_warn > 0) {
6877 # cerr << tmp->get_fileline() << ": warning: choosing ";
6878 # switch (min_typ_max_flag) {
6889 # cerr << " expression." << endl;
6890 # min_typ_max_warn -= 1;
6892 # pform_set_specparam(@1, lex_strings.make($1),
6893 # param_active_range, tmp);
6897 def p_specparam_3(p
):
6898 '''specparam : PATHPULSE_IDENTIFIER '=' expression '''
6899 print('specparam_3', list(p
))
6904 def p_specparam_4(p
):
6905 '''specparam : PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' '''
6906 print('specparam_4', list(p
))
6912 def p_specparam_list_1(p
):
6913 '''specparam_list : specparam '''
6914 print('specparam_list_1', list(p
))
6916 def p_specparam_list_2(p
):
6917 '''specparam_list : specparam_list ',' specparam '''
6918 print('specparam_list_2', list(p
))
6920 def p_specparam_decl_1(p
):
6921 '''specparam_decl : specparam_list '''
6922 print('specparam_decl_1', list(p
))
6924 def p_specparam_decl_2(p
):
6925 '''specparam_decl : dimensions _embed0_specparam_decl specparam_list '''
6926 print('specparam_decl_2', list(p
))
6927 # { param_active_range = 0; }
6929 def p__embed0_specparam_decl(p
):
6930 '''_embed0_specparam_decl : '''
6931 # { param_active_range = $1; }
6933 def p_spec_polarity_1(p
):
6934 '''spec_polarity : '+' '''
6935 print('spec_polarity_1', list(p
))
6938 def p_spec_polarity_2(p
):
6939 '''spec_polarity : '-' '''
6940 print('spec_polarity_2', list(p
))
6943 def p_spec_polarity_3(p
):
6944 '''spec_polarity : '''
6945 print('spec_polarity_3', list(p
))
6948 def p_spec_reference_event_1(p
):
6949 '''spec_reference_event : K_posedge expression '''
6950 print('spec_reference_event_1', list(p
))
6953 def p_spec_reference_event_2(p
):
6954 '''spec_reference_event : K_negedge expression '''
6955 print('spec_reference_event_2', list(p
))
6958 def p_spec_reference_event_3(p
):
6959 '''spec_reference_event : K_posedge expr_primary K_TAND expression '''
6960 print('spec_reference_event_3', list(p
))
6965 def p_spec_reference_event_4(p
):
6966 '''spec_reference_event : K_negedge expr_primary K_TAND expression '''
6967 print('spec_reference_event_4', list(p
))
6972 def p_spec_reference_event_5(p
):
6973 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary '''
6974 print('spec_reference_event_5', list(p
))
6977 def p_spec_reference_event_6(p
):
6978 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression '''
6979 print('spec_reference_event_6', list(p
))
6984 def p_spec_reference_event_7(p
):
6985 '''spec_reference_event : expr_primary K_TAND expression '''
6986 print('spec_reference_event_7', list(p
))
6991 def p_spec_reference_event_8(p
):
6992 '''spec_reference_event : expr_primary '''
6993 print('spec_reference_event_8', list(p
))
6996 def p_edge_descriptor_list_1(p
):
6997 '''edge_descriptor_list : edge_descriptor_list ',' K_edge_descriptor '''
6998 print('edge_descriptor_list_1', list(p
))
7000 def p_edge_descriptor_list_2(p
):
7001 '''edge_descriptor_list : K_edge_descriptor '''
7002 print('edge_descriptor_list_2', list(p
))
7004 def p_spec_notifier_opt_1(p
):
7005 '''spec_notifier_opt : '''
7006 print('spec_notifier_opt_1', list(p
))
7009 def p_spec_notifier_opt_2(p
):
7010 '''spec_notifier_opt : spec_notifier '''
7011 print('spec_notifier_opt_2', list(p
))
7014 def p_spec_notifier_1(p
):
7015 '''spec_notifier : ',' '''
7016 print('spec_notifier_1', list(p
))
7017 # { args_after_notifier = 0; }
7019 def p_spec_notifier_2(p
):
7020 '''spec_notifier : ',' hierarchy_identifier '''
7021 print('spec_notifier_2', list(p
))
7022 # { args_after_notifier = 0; delete $2; }
7024 def p_spec_notifier_3(p
):
7025 '''spec_notifier : spec_notifier ',' '''
7026 print('spec_notifier_3', list(p
))
7027 # { args_after_notifier += 1; }
7029 def p_spec_notifier_4(p
):
7030 '''spec_notifier : spec_notifier ',' hierarchy_identifier '''
7031 print('spec_notifier_4', list(p
))
7032 # { args_after_notifier += 1;
7033 # if (args_after_notifier >= 3) {
7034 # cerr << @3 << ": warning: timing checks are not supported "
7035 # "and delayed signal \"" << *$3
7036 # << "\" will not be driven." << endl;
7040 def p_spec_notifier_5(p
):
7041 '''spec_notifier : IDENTIFIER '''
7042 print('spec_notifier_5', list(p
))
7043 # { args_after_notifier = 0; delete[]$1; }
7045 def p_statement_item_1(p
):
7046 '''statement_item : K_assign lpvalue '=' expression ';' '''
7047 print('statement_item_1', list(p
))
7048 # { PCAssign*tmp = new PCAssign($2, $4);
7049 # FILE_NAME(tmp, @1);
7053 def p_statement_item_2(p
):
7054 '''statement_item : K_deassign lpvalue ';' '''
7055 print('statement_item_2', list(p
))
7056 # { PDeassign*tmp = new PDeassign($2);
7057 # FILE_NAME(tmp, @1);
7061 def p_statement_item_3(p
):
7062 '''statement_item : K_force lpvalue '=' expression ';' '''
7063 print('statement_item_3', list(p
))
7064 # { PForce*tmp = new PForce($2, $4);
7065 # FILE_NAME(tmp, @1);
7069 def p_statement_item_4(p
):
7070 '''statement_item : K_release lpvalue ';' '''
7071 print('statement_item_4', list(p
))
7072 # { PRelease*tmp = new PRelease($2);
7073 # FILE_NAME(tmp, @1);
7077 def p_statement_item_5(p
):
7078 '''statement_item : K_begin K_end '''
7079 print('statement_item_5', list(p
))
7080 # { PBlock*tmp = new PBlock(PBlock::BL_SEQ);
7081 # FILE_NAME(tmp, @1);
7085 def p_statement_item_6(p
):
7086 '''statement_item : K_begin _embed0_statement_item block_item_decls_opt _embed1_statement_item statement_or_null_list K_end '''
7087 print('statement_item_6', list(p
))
7090 # pform_pop_scope();
7091 # assert(! current_block_stack.empty());
7092 # tmp = current_block_stack.top();
7093 # current_block_stack.pop();
7095 # tmp = new PBlock(PBlock::BL_SEQ);
7096 # FILE_NAME(tmp, @1);
7098 # if ($5) tmp->set_statement(*$5);
7103 def p_statement_item_7(p
):
7104 '''statement_item : K_begin ':' IDENTIFIER _embed2_statement_item block_item_decls_opt statement_or_null_list_opt K_end endlabel_opt '''
7105 print('statement_item_7', list(p
))
7106 # { pform_pop_scope();
7107 # assert(! current_block_stack.empty());
7108 # PBlock*tmp = current_block_stack.top();
7109 # current_block_stack.pop();
7110 # if ($6) tmp->set_statement(*$6);
7113 # if (strcmp($3,$8) != 0) {
7114 # yyerror(@8, "error: End label doesn't match begin name");
7116 # if (! gn_system_verilog()) {
7117 # yyerror(@8, "error: Begin end labels require "
7118 # "SystemVerilog.");
7126 def p_statement_item_8(p
):
7127 '''statement_item : K_fork join_keyword '''
7128 print('statement_item_8', list(p
))
7129 # { PBlock*tmp = new PBlock($2);
7130 # FILE_NAME(tmp, @1);
7134 def p_statement_item_9(p
):
7135 '''statement_item : K_fork _embed3_statement_item block_item_decls_opt _embed4_statement_item statement_or_null_list join_keyword '''
7136 print('statement_item_9', list(p
))
7139 # pform_pop_scope();
7140 # assert(! current_block_stack.empty());
7141 # tmp = current_block_stack.top();
7142 # current_block_stack.pop();
7143 # tmp->set_join_type($6);
7145 # tmp = new PBlock($6);
7146 # FILE_NAME(tmp, @1);
7148 # if ($5) tmp->set_statement(*$5);
7153 def p_statement_item_10(p
):
7154 '''statement_item : K_fork ':' IDENTIFIER _embed5_statement_item block_item_decls_opt statement_or_null_list_opt join_keyword endlabel_opt '''
7155 print('statement_item_10', list(p
))
7156 # { pform_pop_scope();
7157 # assert(! current_block_stack.empty());
7158 # PBlock*tmp = current_block_stack.top();
7159 # current_block_stack.pop();
7160 # tmp->set_join_type($7);
7161 # if ($6) tmp->set_statement(*$6);
7164 # if (strcmp($3,$8) != 0) {
7165 # yyerror(@8, "error: End label doesn't match fork name");
7167 # if (! gn_system_verilog()) {
7168 # yyerror(@8, "error: Fork end labels require "
7169 # "SystemVerilog.");
7177 def p_statement_item_11(p
):
7178 '''statement_item : K_disable hierarchy_identifier ';' '''
7179 print('statement_item_11', list(p
))
7180 # { PDisable*tmp = new PDisable(*$2);
7181 # FILE_NAME(tmp, @1);
7186 def p_statement_item_12(p
):
7187 '''statement_item : K_disable K_fork ';' '''
7188 print('statement_item_12', list(p
))
7189 # { pform_name_t tmp_name;
7190 # PDisable*tmp = new PDisable(tmp_name);
7191 # FILE_NAME(tmp, @1);
7195 def p_statement_item_13(p
):
7196 '''statement_item : K_TRIGGER hierarchy_identifier ';' '''
7197 print('statement_item_13', list(p
))
7198 # { PTrigger*tmp = new PTrigger(*$2);
7199 # FILE_NAME(tmp, @1);
7204 def p_statement_item_14(p
):
7205 '''statement_item : procedural_assertion_statement '''
7206 print('statement_item_14', list(p
))
7209 def p_statement_item_15(p
):
7210 '''statement_item : loop_statement '''
7211 print('statement_item_15', list(p
))
7214 def p_statement_item_16(p
):
7215 '''statement_item : jump_statement '''
7216 print('statement_item_16', list(p
))
7219 def p_statement_item_17(p
):
7220 '''statement_item : K_case '(' expression ')' case_items K_endcase '''
7221 print('statement_item_17', list(p
))
7222 # { PCase*tmp = new PCase(NetCase::EQ, $3, $5);
7223 # FILE_NAME(tmp, @1);
7227 def p_statement_item_18(p
):
7228 '''statement_item : K_casex '(' expression ')' case_items K_endcase '''
7229 print('statement_item_18', list(p
))
7230 # { PCase*tmp = new PCase(NetCase::EQX, $3, $5);
7231 # FILE_NAME(tmp, @1);
7235 def p_statement_item_19(p
):
7236 '''statement_item : K_casez '(' expression ')' case_items K_endcase '''
7237 print('statement_item_19', list(p
))
7238 # { PCase*tmp = new PCase(NetCase::EQZ, $3, $5);
7239 # FILE_NAME(tmp, @1);
7243 def p_statement_item_20(p
):
7244 '''statement_item : K_case '(' expression ')' error K_endcase '''
7245 print('statement_item_20', list(p
))
7248 def p_statement_item_21(p
):
7249 '''statement_item : K_casex '(' expression ')' error K_endcase '''
7250 print('statement_item_21', list(p
))
7253 def p_statement_item_22(p
):
7254 '''statement_item : K_casez '(' expression ')' error K_endcase '''
7255 print('statement_item_22', list(p
))
7258 def p_statement_item_23(p
):
7259 '''statement_item : K_if '(' expression ')' statement_or_null %prec less_than_K_else '''
7260 print('statement_item_23', list(p
))
7261 # { PCondit*tmp = new PCondit($3, $5, 0);
7262 # FILE_NAME(tmp, @1);
7266 def p_statement_item_24(p
):
7267 '''statement_item : K_if '(' expression ')' statement_or_null K_else statement_or_null '''
7268 print('statement_item_24', list(p
))
7269 # { PCondit*tmp = new PCondit($3, $5, $7);
7270 # FILE_NAME(tmp, @1);
7274 def p_statement_item_25(p
):
7275 '''statement_item : K_if '(' error ')' statement_or_null %prec less_than_K_else '''
7276 print('statement_item_25', list(p
))
7277 # { yyerror(@1, "error: Malformed conditional expression.");
7281 def p_statement_item_26(p
):
7282 '''statement_item : K_if '(' error ')' statement_or_null K_else statement_or_null '''
7283 print('statement_item_26', list(p
))
7284 # { yyerror(@1, "error: Malformed conditional expression.");
7288 def p_statement_item_27(p
):
7289 '''statement_item : compressed_statement ';' '''
7290 print('statement_item_27', list(p
))
7293 def p_statement_item_28(p
):
7294 '''statement_item : inc_or_dec_expression ';' '''
7295 print('statement_item_28', list(p
))
7296 # { $$ = pform_compressed_assign_from_inc_dec(@1, $1); }
7298 def p_statement_item_29(p
):
7299 '''statement_item : delay1 statement_or_null '''
7300 print('statement_item_29', list(p
))
7301 # { PExpr*del = $1->front();
7302 # assert($1->size() == 1);
7304 # PDelayStatement*tmp = new PDelayStatement(del, $2);
7305 # FILE_NAME(tmp, @1);
7309 def p_statement_item_30(p
):
7310 '''statement_item : event_control statement_or_null '''
7311 print('statement_item_30', list(p
))
7312 # { PEventStatement*tmp = $1;
7314 # yyerror(@1, "error: Invalid event control.");
7317 # tmp->set_statement($2);
7322 def p_statement_item_31(p
):
7323 '''statement_item : '@' '*' statement_or_null '''
7324 print('statement_item_31', list(p
))
7325 # { PEventStatement*tmp = new PEventStatement;
7326 # FILE_NAME(tmp, @1);
7327 # tmp->set_statement($3);
7331 def p_statement_item_32(p
):
7332 '''statement_item : '@' '(' '*' ')' statement_or_null '''
7333 print('statement_item_32', list(p
))
7334 # { PEventStatement*tmp = new PEventStatement;
7335 # FILE_NAME(tmp, @1);
7336 # tmp->set_statement($5);
7340 def p_statement_item_33(p
):
7341 '''statement_item : lpvalue '=' expression ';' '''
7342 print('statement_item33', list(p
))
7344 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), p
[3] ])
7345 print ("expr TODO", repr(expr
))
7347 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), ])
7348 print ("expr", repr(expr
))
7349 print ("expr (python):'%s'" % expr
)
7351 # { PAssign*tmp = new PAssign($1,$3);
7352 # FILE_NAME(tmp, @1);
7356 def p_statement_item_34(p
):
7357 '''statement_item : error '=' expression ';' '''
7358 print('statement_item_34', list(p
))
7359 # { yyerror(@2, "Syntax in assignment statement l-value.");
7364 def p_statement_item_35(p
):
7365 '''statement_item : lpvalue K_LE expression ';' '''
7366 print('statement_item_35', list(p
))
7367 # { PAssignNB*tmp = new PAssignNB($1,$3);
7368 # FILE_NAME(tmp, @1);
7372 def p_statement_item_36(p
):
7373 '''statement_item : error K_LE expression ';' '''
7374 print('statement_item_36', list(p
))
7375 # { yyerror(@2, "Syntax in assignment statement l-value.");
7380 def p_statement_item_37(p
):
7381 '''statement_item : lpvalue '=' delay1 expression ';' '''
7382 print('statement_item_37', list(p
))
7383 # { PExpr*del = $3->front(); $3->pop_front();
7384 # assert($3->empty());
7385 # PAssign*tmp = new PAssign($1,del,$4);
7386 # FILE_NAME(tmp, @1);
7390 def p_statement_item_38(p
):
7391 '''statement_item : lpvalue K_LE delay1 expression ';' '''
7392 print('statement_item_38', list(p
))
7393 # { PExpr*del = $3->front(); $3->pop_front();
7394 # assert($3->empty());
7395 # PAssignNB*tmp = new PAssignNB($1,del,$4);
7396 # FILE_NAME(tmp, @1);
7400 def p_statement_item_39(p
):
7401 '''statement_item : lpvalue '=' event_control expression ';' '''
7402 print('statement_item_39', list(p
))
7403 # { PAssign*tmp = new PAssign($1,0,$3,$4);
7404 # FILE_NAME(tmp, @1);
7408 def p_statement_item_40(p
):
7409 '''statement_item : lpvalue '=' K_repeat '(' expression ')' event_control expression ';' '''
7410 print('statement_item_40', list(p
))
7411 # { PAssign*tmp = new PAssign($1,$5,$7,$8);
7412 # FILE_NAME(tmp,@1);
7413 # tmp->set_lineno(@1.first_line);
7417 def p_statement_item_41(p
):
7418 '''statement_item : lpvalue K_LE event_control expression ';' '''
7419 print('statement_item_41', list(p
))
7420 # { PAssignNB*tmp = new PAssignNB($1,0,$3,$4);
7421 # FILE_NAME(tmp, @1);
7425 def p_statement_item_42(p
):
7426 '''statement_item : lpvalue K_LE K_repeat '(' expression ')' event_control expression ';' '''
7427 print('statement_item_42', list(p
))
7428 # { PAssignNB*tmp = new PAssignNB($1,$5,$7,$8);
7429 # FILE_NAME(tmp, @1);
7433 def p_statement_item_43(p
):
7434 '''statement_item : lpvalue '=' dynamic_array_new ';' '''
7435 print('statement_item_43', list(p
))
7436 # { PAssign*tmp = new PAssign($1,$3);
7437 # FILE_NAME(tmp, @1);
7441 def p_statement_item_44(p
):
7442 '''statement_item : lpvalue '=' class_new ';' '''
7443 print('statement_item_44', list(p
))
7444 # { PAssign*tmp = new PAssign($1,$3);
7445 # FILE_NAME(tmp, @1);
7449 def p_statement_item_45(p
):
7450 '''statement_item : K_wait '(' expression ')' statement_or_null '''
7451 print('statement_item_45', list(p
))
7452 # { PEventStatement*tmp;
7453 # PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, $3);
7454 # tmp = new PEventStatement(etmp);
7455 # FILE_NAME(tmp,@1);
7456 # tmp->set_statement($5);
7460 def p_statement_item_46(p
):
7461 '''statement_item : K_wait K_fork ';' '''
7462 print('statement_item_46', list(p
))
7463 # { PEventStatement*tmp = new PEventStatement((PEEvent*)0);
7464 # FILE_NAME(tmp,@1);
7468 def p_statement_item_47(p
):
7469 '''statement_item : SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';' '''
7470 print('statement_item_47', list(p
))
7471 # { PCallTask*tmp = new PCallTask(lex_strings.make($1), *$3);
7472 # FILE_NAME(tmp,@1);
7478 def p_statement_item_48(p
):
7479 '''statement_item : SYSTEM_IDENTIFIER ';' '''
7480 print('statement_item_48', list(p
))
7482 # PCallTask*tmp = new PCallTask(lex_strings.make($1), pt);
7483 # FILE_NAME(tmp,@1);
7488 def p_statement_item_49(p
):
7489 '''statement_item : hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7490 print('statement_item_49', list(p
))
7491 # { PCallTask*tmp = pform_make_call_task(@1, *$1, *$3);
7497 def p_statement_item_50(p
):
7498 '''statement_item : hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';' '''
7499 print('statement_item_50', list(p
))
7500 # { /* ....randomize with { <constraints> } */
7501 # if ($1 && peek_tail_name(*$1) == "randomize") {
7502 # if (!gn_system_verilog())
7503 # yyerror(@2, "error: Randomize with constraint requires SystemVerilog.");
7505 # yyerror(@2, "sorry: Randomize with constraint not supported.");
7507 # yyerror(@2, "error: Constraint block can only be applied to randomize method.");
7510 # PCallTask*tmp = new PCallTask(*$1, pt);
7511 # FILE_NAME(tmp, @1);
7516 def p_statement_item_51(p
):
7517 '''statement_item : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7518 print('statement_item_51', list(p
))
7519 # { pform_name_t*t_name = $1;
7520 # while (! $3->empty()) {
7521 # t_name->push_back($3->front());
7524 # PCallTask*tmp = new PCallTask(*t_name, *$5);
7525 # FILE_NAME(tmp, @1);
7532 def p_statement_item_52(p
):
7533 '''statement_item : hierarchy_identifier ';' '''
7534 print('statement_item_52', list(p
))
7536 # PCallTask*tmp = pform_make_call_task(@1, *$1, pt);
7541 def p_statement_item_53(p
):
7542 '''statement_item : implicit_class_handle '.' K_new '(' expression_list_with_nuls ')' ';' '''
7543 print('statement_item_53', list(p
))
7544 # { PChainConstructor*tmp = new PChainConstructor(*$5);
7545 # FILE_NAME(tmp, @3);
7550 def p_statement_item_54(p
):
7551 '''statement_item : hierarchy_identifier '(' error ')' ';' '''
7552 print('statement_item_54', list(p
))
7553 # { yyerror(@3, "error: Syntax error in task arguments.");
7555 # PCallTask*tmp = pform_make_call_task(@1, *$1, pt);
7560 def p_statement_item_55(p
):
7561 '''statement_item : error ';' '''
7562 print('statement_item_55', list(p
))
7563 # { yyerror(@2, "error: malformed statement");
7568 def p__embed0_statement_item(p
):
7569 '''_embed0_statement_item : '''
7570 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_SEQ);
7571 # FILE_NAME(tmp, @1);
7572 # current_block_stack.push(tmp);
7575 def p__embed1_statement_item(p
):
7576 '''_embed1_statement_item : '''
7578 # if (! gn_system_verilog()) {
7579 # yyerror("error: Variable declaration in unnamed block "
7580 # "requires SystemVerilog.");
7583 # /* If there are no declarations in the scope then just delete it. */
7584 # pform_pop_scope();
7585 # assert(! current_block_stack.empty());
7586 # PBlock*tmp = current_block_stack.top();
7587 # current_block_stack.pop();
7592 def p__embed2_statement_item(p
):
7593 '''_embed2_statement_item : '''
7594 # { PBlock*tmp = pform_push_block_scope($3, PBlock::BL_SEQ);
7595 # FILE_NAME(tmp, @1);
7596 # current_block_stack.push(tmp);
7599 def p__embed3_statement_item(p
):
7600 '''_embed3_statement_item : '''
7601 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
7602 # FILE_NAME(tmp, @1);
7603 # current_block_stack.push(tmp);
7606 def p__embed4_statement_item(p
):
7607 '''_embed4_statement_item : '''
7609 # if (! gn_system_verilog()) {
7610 # yyerror("error: Variable declaration in unnamed block "
7611 # "requires SystemVerilog.");
7614 # /* If there are no declarations in the scope then just delete it. */
7615 # pform_pop_scope();
7616 # assert(! current_block_stack.empty());
7617 # PBlock*tmp = current_block_stack.top();
7618 # current_block_stack.pop();
7623 def p__embed5_statement_item(p
):
7624 '''_embed5_statement_item : '''
7625 # { PBlock*tmp = pform_push_block_scope($3, PBlock::BL_PAR);
7626 # FILE_NAME(tmp, @1);
7627 # current_block_stack.push(tmp);
7630 def p_compressed_statement_1(p
):
7631 '''compressed_statement : lpvalue K_PLUS_EQ expression '''
7632 print('compressed_statement_1', list(p
))
7633 # { PAssign*tmp = new PAssign($1, '+', $3);
7634 # FILE_NAME(tmp, @1);
7638 def p_compressed_statement_2(p
):
7639 '''compressed_statement : lpvalue K_MINUS_EQ expression '''
7640 print('compressed_statement_2', list(p
))
7641 # { PAssign*tmp = new PAssign($1, '-', $3);
7642 # FILE_NAME(tmp, @1);
7646 def p_compressed_statement_3(p
):
7647 '''compressed_statement : lpvalue K_MUL_EQ expression '''
7648 print('compressed_statement_3', list(p
))
7649 # { PAssign*tmp = new PAssign($1, '*', $3);
7650 # FILE_NAME(tmp, @1);
7654 def p_compressed_statement_4(p
):
7655 '''compressed_statement : lpvalue K_DIV_EQ expression '''
7656 print('compressed_statement_4', list(p
))
7657 # { PAssign*tmp = new PAssign($1, '/', $3);
7658 # FILE_NAME(tmp, @1);
7662 def p_compressed_statement_5(p
):
7663 '''compressed_statement : lpvalue K_MOD_EQ expression '''
7664 print('compressed_statement_5', list(p
))
7665 # { PAssign*tmp = new PAssign($1, '%', $3);
7666 # FILE_NAME(tmp, @1);
7670 def p_compressed_statement_6(p
):
7671 '''compressed_statement : lpvalue K_AND_EQ expression '''
7672 print('compressed_statement_6', list(p
))
7673 # { PAssign*tmp = new PAssign($1, '&', $3);
7674 # FILE_NAME(tmp, @1);
7678 def p_compressed_statement_7(p
):
7679 '''compressed_statement : lpvalue K_OR_EQ expression '''
7680 print('compressed_statement_7', list(p
))
7681 # { PAssign*tmp = new PAssign($1, '|', $3);
7682 # FILE_NAME(tmp, @1);
7686 def p_compressed_statement_8(p
):
7687 '''compressed_statement : lpvalue K_XOR_EQ expression '''
7688 print('compressed_statement_8', list(p
))
7689 # { PAssign*tmp = new PAssign($1, '^', $3);
7690 # FILE_NAME(tmp, @1);
7694 def p_compressed_statement_9(p
):
7695 '''compressed_statement : lpvalue K_LS_EQ expression '''
7696 print('compressed_statement_9', list(p
))
7697 # { PAssign *tmp = new PAssign($1, 'l', $3);
7698 # FILE_NAME(tmp, @1);
7702 def p_compressed_statement_10(p
):
7703 '''compressed_statement : lpvalue K_RS_EQ expression '''
7704 print('compressed_statement_10', list(p
))
7705 # { PAssign*tmp = new PAssign($1, 'r', $3);
7706 # FILE_NAME(tmp, @1);
7710 def p_compressed_statement_11(p
):
7711 '''compressed_statement : lpvalue K_RSS_EQ expression '''
7712 print('compressed_statement_11', list(p
))
7713 # { PAssign *tmp = new PAssign($1, 'R', $3);
7714 # FILE_NAME(tmp, @1);
7718 def p_statement_or_null_list_opt_1(p
):
7719 '''statement_or_null_list_opt : statement_or_null_list '''
7720 print('statement_or_null_list_opt_1', list(p
))
7723 def p_statement_or_null_list_opt_2(p
):
7724 '''statement_or_null_list_opt : '''
7725 print('statement_or_null_list_opt_2', list(p
))
7728 def p_statement_or_null_list_1(p
):
7729 '''statement_or_null_list : statement_or_null_list statement_or_null '''
7730 print('statement_or_null_list_1', list(p
))
7731 # { vector<Statement*>*tmp = $1;
7732 # if ($2) tmp->push_back($2);
7736 def p_statement_or_null_list_2(p
):
7737 '''statement_or_null_list : statement_or_null '''
7738 print('statement_or_null_list_2', list(p
))
7739 # { vector<Statement*>*tmp = new vector<Statement*>(0);
7740 # if ($1) tmp->push_back($1);
7744 def p_analog_statement_1(p
):
7745 '''analog_statement : branch_probe_expression K_CONTRIBUTE expression ';' '''
7746 print('analog_statement_1', list(p
))
7747 # { $$ = pform_contribution_statement(@2, $1, $3); }
7749 def p_task_item_1(p
):
7750 '''task_item : block_item_decl '''
7751 print('task_item_1', list(p
))
7752 # { $$ = new vector<pform_tf_port_t>(0); }
7754 def p_task_item_2(p
):
7755 '''task_item : tf_port_declaration '''
7756 print('task_item_2', list(p
))
7759 def p_task_item_list_1(p
):
7760 '''task_item_list : task_item_list task_item '''
7761 print('task_item_list_1', list(p
))
7762 # { vector<pform_tf_port_t>*tmp = $1;
7763 # size_t s1 = tmp->size();
7764 # tmp->resize(s1 + $2->size());
7765 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
7766 # tmp->at(s1 + idx) = $2->at(idx);
7771 def p_task_item_list_2(p
):
7772 '''task_item_list : task_item '''
7773 print('task_item_list_2', list(p
))
7776 def p_task_item_list_opt_1(p
):
7777 '''task_item_list_opt : task_item_list '''
7778 print('task_item_list_opt_1', list(p
))
7781 def p_task_item_list_opt_2(p
):
7782 '''task_item_list_opt : '''
7783 print('task_item_list_opt_2', list(p
))
7786 def p_tf_port_list_opt_1(p
):
7787 '''tf_port_list_opt : tf_port_list '''
7788 print('tf_port_list_opt_1', list(p
))
7791 def p_tf_port_list_opt_2(p
):
7792 '''tf_port_list_opt : '''
7793 print('tf_port_list_opt_2', list(p
))
7796 def p_udp_body_1(p
):
7797 '''udp_body : K_table udp_entry_list K_endtable '''
7798 print('udp_body_1', list(p
))
7799 # { lex_end_table();
7803 def p_udp_body_2(p
):
7804 '''udp_body : K_table K_endtable '''
7805 print('udp_body_2', list(p
))
7806 # { lex_end_table();
7807 # yyerror(@1, "error: Empty UDP table.");
7811 def p_udp_body_3(p
):
7812 '''udp_body : K_table error K_endtable '''
7813 print('udp_body_3', list(p
))
7814 # { lex_end_table();
7815 # yyerror(@2, "Errors in UDP table");
7820 def p_udp_entry_list_1(p
):
7821 '''udp_entry_list : udp_comb_entry_list '''
7822 print('udp_entry_list_1', list(p
))
7824 def p_udp_entry_list_2(p
):
7825 '''udp_entry_list : udp_sequ_entry_list '''
7826 print('udp_entry_list_2', list(p
))
7828 def p_udp_comb_entry_1(p
):
7829 '''udp_comb_entry : udp_input_list ':' udp_output_sym ';' '''
7830 print('udp_comb_entry_1', list(p
))
7831 # { char*tmp = new char[strlen($1)+3];
7833 # char*tp = tmp+strlen(tmp);
7841 def p_udp_comb_entry_list_1(p
):
7842 '''udp_comb_entry_list : udp_comb_entry '''
7843 print('udp_comb_entry_list_1', list(p
))
7844 # { list<string>*tmp = new list<string>;
7845 # tmp->push_back($1);
7850 def p_udp_comb_entry_list_2(p
):
7851 '''udp_comb_entry_list : udp_comb_entry_list udp_comb_entry '''
7852 print('udp_comb_entry_list_2', list(p
))
7853 # { list<string>*tmp = $1;
7854 # tmp->push_back($2);
7859 def p_udp_sequ_entry_list_1(p
):
7860 '''udp_sequ_entry_list : udp_sequ_entry '''
7861 print('udp_sequ_entry_list_1', list(p
))
7862 # { list<string>*tmp = new list<string>;
7863 # tmp->push_back($1);
7868 def p_udp_sequ_entry_list_2(p
):
7869 '''udp_sequ_entry_list : udp_sequ_entry_list udp_sequ_entry '''
7870 print('udp_sequ_entry_list_2', list(p
))
7871 # { list<string>*tmp = $1;
7872 # tmp->push_back($2);
7877 def p_udp_sequ_entry_1(p
):
7878 '''udp_sequ_entry : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' '''
7879 print('udp_sequ_entry_1', list(p
))
7880 # { char*tmp = new char[strlen($1)+5];
7882 # char*tp = tmp+strlen(tmp);
7891 def p_udp_initial_1(p
):
7892 '''udp_initial : K_initial IDENTIFIER '=' number ';' '''
7893 print('udp_initial_1', list(p
))
7894 # { PExpr*etmp = new PENumber($4);
7895 # PEIdent*itmp = new PEIdent(lex_strings.make($2));
7896 # PAssign*atmp = new PAssign(itmp, etmp);
7897 # FILE_NAME(atmp, @2);
7902 def p_udp_init_opt_1(p
):
7903 '''udp_init_opt : udp_initial '''
7904 print('udp_init_opt_1', list(p
))
7907 def p_udp_init_opt_2(p
):
7908 '''udp_init_opt : '''
7909 print('udp_init_opt_2', list(p
))
7912 def p_udp_input_list_1(p
):
7913 '''udp_input_list : udp_input_sym '''
7914 print('udp_input_list_1', list(p
))
7915 # { char*tmp = new char[2];
7921 def p_udp_input_list_2(p
):
7922 '''udp_input_list : udp_input_list udp_input_sym '''
7923 print('udp_input_list_2', list(p
))
7924 # { char*tmp = new char[strlen($1)+2];
7926 # char*tp = tmp+strlen(tmp);
7933 def p_udp_input_sym_1(p
):
7934 '''udp_input_sym : '0' '''
7935 print('udp_input_sym_1', list(p
))
7938 def p_udp_input_sym_2(p
):
7939 '''udp_input_sym : '1' '''
7940 print('udp_input_sym_2', list(p
))
7943 def p_udp_input_sym_3(p
):
7944 '''udp_input_sym : 'x' '''
7945 print('udp_input_sym_3', list(p
))
7948 def p_udp_input_sym_4(p
):
7949 '''udp_input_sym : '?' '''
7950 print('udp_input_sym_4', list(p
))
7953 def p_udp_input_sym_5(p
):
7954 '''udp_input_sym : 'b' '''
7955 print('udp_input_sym_5', list(p
))
7958 def p_udp_input_sym_6(p
):
7959 '''udp_input_sym : '*' '''
7960 print('udp_input_sym_6', list(p
))
7963 def p_udp_input_sym_7(p
):
7964 '''udp_input_sym : '%' '''
7965 print('udp_input_sym_7', list(p
))
7968 def p_udp_input_sym_8(p
):
7969 '''udp_input_sym : 'f' '''
7970 print('udp_input_sym_8', list(p
))
7973 def p_udp_input_sym_9(p
):
7974 '''udp_input_sym : 'F' '''
7975 print('udp_input_sym_9', list(p
))
7978 def p_udp_input_sym_10(p
):
7979 '''udp_input_sym : 'l' '''
7980 print('udp_input_sym_10', list(p
))
7983 def p_udp_input_sym_11(p
):
7984 '''udp_input_sym : 'h' '''
7985 print('udp_input_sym_11', list(p
))
7988 def p_udp_input_sym_12(p
):
7989 '''udp_input_sym : 'B' '''
7990 print('udp_input_sym_12', list(p
))
7993 def p_udp_input_sym_13(p
):
7994 '''udp_input_sym : 'r' '''
7995 print('udp_input_sym_13', list(p
))
7998 def p_udp_input_sym_14(p
):
7999 '''udp_input_sym : 'R' '''
8000 print('udp_input_sym_14', list(p
))
8003 def p_udp_input_sym_15(p
):
8004 '''udp_input_sym : 'M' '''
8005 print('udp_input_sym_15', list(p
))
8008 def p_udp_input_sym_16(p
):
8009 '''udp_input_sym : 'n' '''
8010 print('udp_input_sym_16', list(p
))
8013 def p_udp_input_sym_17(p
):
8014 '''udp_input_sym : 'N' '''
8015 print('udp_input_sym_17', list(p
))
8018 def p_udp_input_sym_18(p
):
8019 '''udp_input_sym : 'p' '''
8020 print('udp_input_sym_18', list(p
))
8023 def p_udp_input_sym_19(p
):
8024 '''udp_input_sym : 'P' '''
8025 print('udp_input_sym_19', list(p
))
8028 def p_udp_input_sym_20(p
):
8029 '''udp_input_sym : 'Q' '''
8030 print('udp_input_sym_20', list(p
))
8033 def p_udp_input_sym_21(p
):
8034 '''udp_input_sym : 'q' '''
8035 print('udp_input_sym_21', list(p
))
8038 def p_udp_input_sym_22(p
):
8039 '''udp_input_sym : '_' '''
8040 print('udp_input_sym_22', list(p
))
8043 def p_udp_input_sym_23(p
):
8044 '''udp_input_sym : '+' '''
8045 print('udp_input_sym_23', list(p
))
8048 def p_udp_input_sym_24(p
):
8049 '''udp_input_sym : DEC_NUMBER '''
8050 print('udp_input_sym_24', list(p
))
8051 # { yyerror(@1, "internal error: Input digits parse as decimal number!"); $$ = '0'; }
8053 def p_udp_output_sym_1(p
):
8054 '''udp_output_sym : '0' '''
8055 print('udp_output_sym_1', list(p
))
8058 def p_udp_output_sym_2(p
):
8059 '''udp_output_sym : '1' '''
8060 print('udp_output_sym_2', list(p
))
8063 def p_udp_output_sym_3(p
):
8064 '''udp_output_sym : 'x' '''
8065 print('udp_output_sym_3', list(p
))
8068 def p_udp_output_sym_4(p
):
8069 '''udp_output_sym : '-' '''
8070 print('udp_output_sym_4', list(p
))
8073 def p_udp_output_sym_5(p
):
8074 '''udp_output_sym : DEC_NUMBER '''
8075 print('udp_output_sym_5', list(p
))
8076 # { yyerror(@1, "internal error: Output digits parse as decimal number!"); $$ = '0'; }
8078 def p_udp_port_decl_1(p
):
8079 '''udp_port_decl : K_input list_of_identifiers ';' '''
8080 print('udp_port_decl_1', list(p
))
8081 # { $$ = pform_make_udp_input_ports($2); }
8083 def p_udp_port_decl_2(p
):
8084 '''udp_port_decl : K_output IDENTIFIER ';' '''
8085 print('udp_port_decl_2', list(p
))
8086 # { perm_string pname = lex_strings.make($2);
8087 # PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
8088 # vector<PWire*>*tmp = new vector<PWire*>(1);
8094 def p_udp_port_decl_3(p
):
8095 '''udp_port_decl : K_reg IDENTIFIER ';' '''
8096 print('udp_port_decl_3', list(p
))
8097 # { perm_string pname = lex_strings.make($2);
8098 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
8099 # vector<PWire*>*tmp = new vector<PWire*>(1);
8105 def p_udp_port_decl_4(p
):
8106 '''udp_port_decl : K_reg K_output IDENTIFIER ';' '''
8107 print('udp_port_decl_4', list(p
))
8108 # { perm_string pname = lex_strings.make($3);
8109 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
8110 # vector<PWire*>*tmp = new vector<PWire*>(1);
8116 def p_udp_port_decls_1(p
):
8117 '''udp_port_decls : udp_port_decl '''
8118 print('udp_port_decls_1', list(p
))
8121 def p_udp_port_decls_2(p
):
8122 '''udp_port_decls : udp_port_decls udp_port_decl '''
8123 print('udp_port_decls_2', list(p
))
8124 # { vector<PWire*>*tmp = $1;
8125 # size_t s1 = $1->size();
8126 # tmp->resize(s1+$2->size());
8127 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
8128 # tmp->at(s1+idx) = $2->at(idx);
8133 def p_udp_port_list_1(p
):
8134 '''udp_port_list : IDENTIFIER '''
8135 print('udp_port_list_1', list(p
))
8136 # { list<perm_string>*tmp = new list<perm_string>;
8137 # tmp->push_back(lex_strings.make($1));
8142 def p_udp_port_list_2(p
):
8143 '''udp_port_list : udp_port_list ',' IDENTIFIER '''
8144 print('udp_port_list_2', list(p
))
8145 # { list<perm_string>*tmp = $1;
8146 # tmp->push_back(lex_strings.make($3));
8151 def p_udp_reg_opt_1(p
):
8152 '''udp_reg_opt : K_reg '''
8153 print('udp_reg_opt_1', list(p
))
8156 def p_udp_reg_opt_2(p
):
8157 '''udp_reg_opt : '''
8158 print('udp_reg_opt_2', list(p
))
8161 def p_udp_initial_expr_opt_1(p
):
8162 '''udp_initial_expr_opt : '=' expression '''
8163 print('udp_initial_expr_opt_1', list(p
))
8166 def p_udp_initial_expr_opt_2(p
):
8167 '''udp_initial_expr_opt : '''
8168 print('udp_initial_expr_opt_2', list(p
))
8171 def p_udp_input_declaration_list_1(p
):
8172 '''udp_input_declaration_list : K_input IDENTIFIER '''
8173 print('udp_input_declaration_list_1', list(p
))
8174 # { list<perm_string>*tmp = new list<perm_string>;
8175 # tmp->push_back(lex_strings.make($2));
8180 def p_udp_input_declaration_list_2(p
):
8181 '''udp_input_declaration_list : udp_input_declaration_list ',' K_input IDENTIFIER '''
8182 print('udp_input_declaration_list_2', list(p
))
8183 # { list<perm_string>*tmp = $1;
8184 # tmp->push_back(lex_strings.make($4));
8189 def p_udp_primitive_1(p
):
8190 '''udp_primitive : K_primitive IDENTIFIER '(' udp_port_list ')' ';' udp_port_decls udp_init_opt udp_body K_endprimitive endlabel_opt '''
8191 print('udp_primitive_1', list(p
))
8192 # { perm_string tmp2 = lex_strings.make($2);
8193 # pform_make_udp(tmp2, $4, $7, $9, $8,
8194 # @2.text, @2.first_line);
8196 # if (strcmp($2,$11) != 0) {
8197 # yyerror(@11, "error: End label doesn't match "
8198 # "primitive name");
8200 # if (! gn_system_verilog()) {
8201 # yyerror(@11, "error: Primitive end labels "
8202 # "require SystemVerilog.");
8209 def p_udp_primitive_2(p
):
8210 '''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 '''
8211 print('udp_primitive_2', list(p
))
8212 # { perm_string tmp2 = lex_strings.make($2);
8213 # perm_string tmp6 = lex_strings.make($6);
8214 # pform_make_udp(tmp2, $5, tmp6, $7, $9, $12,
8215 # @2.text, @2.first_line);
8217 # if (strcmp($2,$14) != 0) {
8218 # yyerror(@14, "error: End label doesn't match "
8219 # "primitive name");
8221 # if (! gn_system_verilog()) {
8222 # yyerror(@14, "error: Primitive end labels "
8223 # "require SystemVerilog.");
8231 def p_K_packed_opt_1(p
):
8232 '''K_packed_opt : K_packed '''
8233 print('K_packed_opt', list(p
))
8236 def p_K_packed_opt_2(p
):
8237 '''K_packed_opt : '''
8238 print('K_packed_opt', list(p
))
8241 def p_K_reg_opt_1(p
):
8242 '''K_reg_opt : K_reg '''
8243 print('K_reg_opt', list(p
))
8246 def p_K_reg_opt_2(p
):
8248 print('K_reg_opt', list(p
))
8251 def p_K_static_opt_1(p
):
8252 '''K_static_opt : K_static '''
8253 print('K_static_opt', list(p
))
8256 def p_K_static_opt_2(p
):
8257 '''K_static_opt : '''
8258 print('K_static_opt', list(p
))
8262 def p_K_virtual_opt_1(p
):
8263 '''K_virtual_opt : K_virtual '''
8267 def p_K_virtual_opt_2(p
):
8268 '''K_virtual_opt : '''