1490051f5126653611bd263dad68eda21f1719e6
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')
64 # -------------- RULES ----------------
66 def p_source_text_1(p
):
67 '''source_text : timeunits_declaration_opt _embed0_source_text description_list '''
68 print('source_text', list(p
))
70 def p_source_text_2(p
):
72 print('source_text', list(p
))
74 def p__embed0_source_text(p
):
75 '''_embed0_source_text : '''
76 # { pform_set_scope_timescale(yyloc); }
78 def p_assertion_item_1(p
):
79 '''assertion_item : concurrent_assertion_item '''
80 print('assertion_item_1', list(p
))
82 def p_assignment_pattern_1(p
):
83 '''assignment_pattern : K_LP expression_list_proper '}' '''
84 print('assignment_pattern_1', list(p
))
85 # { PEAssignPattern*tmp = new PEAssignPattern(*$2);
91 def p_assignment_pattern_2(p
):
92 '''assignment_pattern : K_LP '}' '''
93 print('assignment_pattern_2', list(p
))
94 # { PEAssignPattern*tmp = new PEAssignPattern;
99 def p_block_identifier_opt_1(p
):
100 '''block_identifier_opt : IDENTIFIER ':' '''
101 print('block_identifier_opt_1', list(p
))
103 def p_block_identifier_opt_2(p
):
104 '''block_identifier_opt : '''
105 print('block_identifier_opt_2', list(p
))
107 def p_class_declaration_1(p
):
108 '''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 '''
109 print('class_declaration_1', list(p
))
110 # { // Wrap up the class.
111 # if ($11 && $4 && $4->name != $11) {
112 # yyerror(@11, "error: Class end label doesn't match class name.");
117 def p__embed0_class_declaration(p
):
118 '''_embed0_class_declaration : '''
119 # { pform_start_class_declaration(@2, $4, $5.type, $5.exprs, $3); }
121 def p__embed1_class_declaration(p
):
122 '''_embed1_class_declaration : '''
123 # { // Process a class.
124 # pform_end_class_declaration(@9);
127 def p_class_constraint_1(p
):
128 '''class_constraint : constraint_prototype '''
129 print('class_constraint_1', list(p
))
131 def p_class_constraint_2(p
):
132 '''class_constraint : constraint_declaration '''
133 print('class_constraint_2', list(p
))
135 def p_class_identifier_1(p
):
136 '''class_identifier : IDENTIFIER '''
137 print('class_identifier_1', list(p
))
138 # { // Create a synthetic typedef for the class name so that the
139 # // lexor detects the name as a type.
140 # perm_string name = lex_strings.make($1);
141 # class_type_t*tmp = new class_type_t(name);
142 # FILE_NAME(tmp, @1);
143 # pform_set_typedef(name, tmp, NULL);
148 def p_class_identifier_2(p
):
149 '''class_identifier : TYPE_IDENTIFIER '''
150 print('class_identifier_2', list(p
))
151 # { class_type_t*tmp = dynamic_cast<class_type_t*>($1.type);
153 # yyerror(@1, "Type name \"%s\"is not a predeclared class name.", $1.text);
159 def p_class_declaration_endlabel_opt_1(p
):
160 '''class_declaration_endlabel_opt : ':' TYPE_IDENTIFIER '''
161 print('class_declaration_endlabel_opt_1', list(p
))
162 # { class_type_t*tmp = dynamic_cast<class_type_t*> ($2.type);
164 # yyerror(@2, "error: class declaration endlabel \"%s\" is not a class name\n", $2.text);
167 # $$ = strdupnew(tmp->name.str());
172 def p_class_declaration_endlabel_opt_2(p
):
173 '''class_declaration_endlabel_opt : ':' IDENTIFIER '''
174 print('class_declaration_endlabel_opt_2', list(p
))
177 def p_class_declaration_endlabel_opt_3(p
):
178 '''class_declaration_endlabel_opt : '''
179 print('class_declaration_endlabel_opt_3', list(p
))
182 def p_class_declaration_extends_opt_1(p
):
183 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '''
184 print('class_declaration_extends_opt_1', list(p
))
185 # { $$.type = $2.type;
190 def p_class_declaration_extends_opt_2(p
):
191 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '(' expression_list_with_nuls ')' '''
192 print('class_declaration_extends_opt_2', list(p
))
193 # { $$.type = $2.type;
198 def p_class_declaration_extends_opt_3(p
):
199 '''class_declaration_extends_opt : '''
200 print('class_declaration_extends_opt_3', list(p
))
201 # { $$.type = 0; $$.exprs = 0; }
203 def p_class_items_opt_1(p
):
204 '''class_items_opt : class_items '''
205 print('class_items_opt_1', list(p
))
207 def p_class_items_opt_2(p
):
208 '''class_items_opt : '''
209 print('class_items_opt_2', list(p
))
211 def p_class_items_1(p
):
212 '''class_items : class_items class_item '''
213 print('class_items_1', list(p
))
215 def p_class_items_2(p
):
216 '''class_items : class_item '''
217 print('class_items_2', list(p
))
219 def p_class_item_1(p
):
220 '''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 '''
221 print('class_item_1', list(p
))
222 # { current_function->set_ports($6);
223 # pform_set_constructor_return(current_function);
224 # pform_set_this_class(@3, current_function);
225 # current_function_set_statement(@3, $10);
227 # current_function = 0;
230 def p_class_item_2(p
):
231 '''class_item : property_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
232 print('class_item_2', list(p
))
233 # { pform_class_property(@2, $1, $2, $3); }
235 def p_class_item_3(p
):
236 '''class_item : K_const class_item_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
237 print('class_item_3', list(p
))
238 # { pform_class_property(@1, $2 | property_qualifier_t::make_const(), $3, $4); }
240 def p_class_item_4(p
):
241 '''class_item : method_qualifier_opt task_declaration '''
242 print('class_item_4', list(p
))
243 # { /* The task_declaration rule puts this into the class */ }
245 def p_class_item_5(p
):
246 '''class_item : method_qualifier_opt function_declaration '''
247 print('class_item_5', list(p
))
248 # { /* The function_declaration rule puts this into the class */ }
250 def p_class_item_6(p
):
251 '''class_item : K_extern method_qualifier_opt K_function K_new ';' '''
252 print('class_item_6', list(p
))
253 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
255 def p_class_item_7(p
):
256 '''class_item : K_extern method_qualifier_opt K_function K_new '(' tf_port_list_opt ')' ';' '''
257 print('class_item_7', list(p
))
258 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
260 def p_class_item_8(p
):
261 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER ';' '''
262 print('class_item_8', list(p
))
263 # { yyerror(@1, "sorry: External methods are not yet supported.");
267 def p_class_item_9(p
):
268 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' ';' '''
269 print('class_item_9', list(p
))
270 # { yyerror(@1, "sorry: External methods are not yet supported.");
274 def p_class_item_10(p
):
275 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER ';' '''
276 print('class_item_10', list(p
))
277 # { yyerror(@1, "sorry: External methods are not yet supported.");
281 def p_class_item_11(p
):
282 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER '(' tf_port_list_opt ')' ';' '''
283 print('class_item_11', list(p
))
284 # { yyerror(@1, "sorry: External methods are not yet supported.");
288 def p_class_item_12(p
):
289 '''class_item : class_constraint '''
290 print('class_item_12', list(p
))
292 def p_class_item_13(p
):
293 '''class_item : property_qualifier_opt data_type error ';' '''
294 print('class_item_13', list(p
))
295 # { yyerror(@3, "error: Errors in variable names after data type.");
299 def p_class_item_14(p
):
300 '''class_item : property_qualifier_opt IDENTIFIER error ';' '''
301 print('class_item_14', list(p
))
302 # { yyerror(@3, "error: %s doesn't name a type.", $2);
306 def p_class_item_15(p
):
307 '''class_item : method_qualifier_opt K_function K_new error K_endfunction endnew_opt '''
308 print('class_item_15', list(p
))
309 # { yyerror(@1, "error: I give up on this class constructor declaration.");
313 def p_class_item_16(p
):
314 '''class_item : error ';' '''
315 print('class_item_16', list(p
))
316 # { yyerror(@2, "error: invalid class item.");
320 def p__embed0_class_item(p
):
321 '''_embed0_class_item : '''
322 # { assert(current_function==0);
323 # current_function = pform_push_constructor_scope(@3);
326 def p_class_item_qualifier_1(p
):
327 '''class_item_qualifier : K_static '''
328 print('class_item_qualifier_1', list(p
))
329 # { $$ = property_qualifier_t::make_static(); }
331 def p_class_item_qualifier_2(p
):
332 '''class_item_qualifier : K_protected '''
333 print('class_item_qualifier_2', list(p
))
334 # { $$ = property_qualifier_t::make_protected(); }
336 def p_class_item_qualifier_3(p
):
337 '''class_item_qualifier : K_local '''
338 print('class_item_qualifier_3', list(p
))
339 # { $$ = property_qualifier_t::make_local(); }
341 def p_class_item_qualifier_list_1(p
):
342 '''class_item_qualifier_list : class_item_qualifier_list class_item_qualifier '''
343 print('class_item_qualifier_list_1', list(p
))
346 def p_class_item_qualifier_list_2(p
):
347 '''class_item_qualifier_list : class_item_qualifier '''
348 print('class_item_qualifier_list_2', list(p
))
351 def p_class_item_qualifier_opt_1(p
):
352 '''class_item_qualifier_opt : class_item_qualifier_list '''
353 print('class_item_qualifier_opt_1', list(p
))
356 def p_class_item_qualifier_opt_2(p
):
357 '''class_item_qualifier_opt : '''
358 print('class_item_qualifier_opt_2', list(p
))
359 # { $$ = property_qualifier_t::make_none(); }
361 def p_class_new_1(p
):
362 '''class_new : K_new '(' expression_list_with_nuls ')' '''
363 print('class_new_1', list(p
))
364 # { list<PExpr*>*expr_list = $3;
365 # strip_tail_items(expr_list);
366 # PENewClass*tmp = new PENewClass(*expr_list);
367 # FILE_NAME(tmp, @1);
372 def p_class_new_2(p
):
373 '''class_new : K_new hierarchy_identifier '''
374 print('class_new_2', list(p
))
375 # { PEIdent*tmpi = new PEIdent(*$2);
376 # FILE_NAME(tmpi, @2);
377 # PENewCopy*tmp = new PENewCopy(tmpi);
378 # FILE_NAME(tmp, @1);
383 def p_class_new_3(p
):
384 '''class_new : K_new '''
385 print('class_new_3', list(p
))
386 # { PENewClass*tmp = new PENewClass;
387 # FILE_NAME(tmp, @1);
391 def p_concurrent_assertion_item_1(p
):
392 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' property_spec ')' statement_or_null '''
393 print('concurrent_assertion_item_1', list(p
))
395 # if (gn_assertions_flag) {
396 # yyerror(@2, "sorry: concurrent_assertion_item not supported."
397 # " Try -gno-assertion to turn this message off.");
401 def p_concurrent_assertion_item_2(p
):
402 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' error ')' statement_or_null '''
403 print('concurrent_assertion_item_2', list(p
))
405 # yyerror(@2, "error: Error in property_spec of concurrent assertion item.");
408 def p_constraint_block_item_1(p
):
409 '''constraint_block_item : constraint_expression '''
410 print('constraint_block_item_1', list(p
))
412 def p_constraint_block_item_list_1(p
):
413 '''constraint_block_item_list : constraint_block_item_list constraint_block_item '''
414 print('constraint_block_item_list_1', list(p
))
416 def p_constraint_block_item_list_2(p
):
417 '''constraint_block_item_list : constraint_block_item '''
418 print('constraint_block_item_list_2', list(p
))
420 def p_constraint_block_item_list_opt_1(p
):
421 '''constraint_block_item_list_opt : '''
422 print('constraint_block_item_list_opt_1', list(p
))
424 def p_constraint_block_item_list_opt_2(p
):
425 '''constraint_block_item_list_opt : constraint_block_item_list '''
426 print('constraint_block_item_list_opt_2', list(p
))
428 def p_constraint_declaration_1(p
):
429 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' constraint_block_item_list_opt '}' '''
430 print('constraint_declaration_1', list(p
))
431 # { yyerror(@2, "sorry: Constraint declarations not supported."); }
433 def p_constraint_declaration_2(p
):
434 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' error '}' '''
435 print('constraint_declaration_2', list(p
))
436 # { yyerror(@4, "error: Errors in the constraint block item list."); }
438 def p_constraint_expression_1(p
):
439 '''constraint_expression : expression ';' '''
440 print('constraint_expression_1', list(p
))
442 def p_constraint_expression_2(p
):
443 '''constraint_expression : expression K_dist '{' '}' ';' '''
444 print('constraint_expression_2', list(p
))
446 def p_constraint_expression_3(p
):
447 '''constraint_expression : expression K_TRIGGER constraint_set '''
448 print('constraint_expression_3', list(p
))
450 def p_constraint_expression_4(p
):
451 '''constraint_expression : K_if '(' expression ')' constraint_set %prec less_than_K_else '''
452 print('constraint_expression_4', list(p
))
454 def p_constraint_expression_5(p
):
455 '''constraint_expression : K_if '(' expression ')' constraint_set K_else constraint_set '''
456 print('constraint_expression_5', list(p
))
458 def p_constraint_expression_6(p
):
459 '''constraint_expression : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' constraint_set '''
460 print('constraint_expression_6', list(p
))
462 def p_constraint_expression_list_1(p
):
463 '''constraint_expression_list : constraint_expression_list constraint_expression '''
464 print('constraint_expression_list_1', list(p
))
466 def p_constraint_expression_list_2(p
):
467 '''constraint_expression_list : constraint_expression '''
468 print('constraint_expression_list_2', list(p
))
470 def p_constraint_prototype_1(p
):
471 '''constraint_prototype : K_static_opt K_constraint IDENTIFIER ';' '''
472 print('constraint_prototype_1', list(p
))
473 # { yyerror(@2, "sorry: Constraint prototypes not supported."); }
475 def p_constraint_set_1(p
):
476 '''constraint_set : constraint_expression '''
477 print('constraint_set_1', list(p
))
479 def p_constraint_set_2(p
):
480 '''constraint_set : '{' constraint_expression_list '}' '''
481 print('constraint_set_2', list(p
))
483 def p_data_declaration_1(p
):
484 '''data_declaration : attribute_list_opt data_type_or_implicit list_of_variable_decl_assignments ';' '''
485 print('data_declaration_1', list(p
))
486 # { data_type_t*data_type = $2;
487 # if (data_type == 0) {
488 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
489 # FILE_NAME(data_type, @2);
491 # pform_makewire(@2, 0, str_strength, $3, NetNet::IMPLICIT_REG, data_type);
494 def p_data_type_1(p
):
495 '''data_type : integer_vector_type unsigned_signed_opt dimensions_opt '''
496 print('data_type_1', list(p
))
497 # { ivl_variable_type_t use_vtype = $1;
498 # bool reg_flag = false;
499 # if (use_vtype == IVL_VT_NO_TYPE) {
500 # use_vtype = IVL_VT_LOGIC;
503 # vector_type_t*tmp = new vector_type_t(use_vtype, $2, $3);
504 # tmp->reg_flag = reg_flag;
505 # FILE_NAME(tmp, @1);
509 def p_data_type_2(p
):
510 '''data_type : non_integer_type '''
511 print('data_type_2', list(p
))
512 # { real_type_t*tmp = new real_type_t($1);
513 # FILE_NAME(tmp, @1);
517 def p_data_type_3(p
):
518 '''data_type : struct_data_type '''
519 print('data_type_3', list(p
))
520 # { if (!$1->packed_flag) {
521 # yyerror(@1, "sorry: Unpacked structs not supported.");
526 def p_data_type_4(p
):
527 '''data_type : enum_data_type '''
528 print('data_type_4', list(p
))
531 def p_data_type_5(p
):
532 '''data_type : atom2_type signed_unsigned_opt '''
533 print('data_type_5', list(p
))
534 # { atom2_type_t*tmp = new atom2_type_t($1, $2);
535 # FILE_NAME(tmp, @1);
539 def p_data_type_6(p
):
540 '''data_type : K_integer signed_unsigned_opt '''
541 print('data_type_6', list(p
))
542 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
543 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, $2, pd);
544 # tmp->reg_flag = true;
545 # tmp->integer_flag = true;
549 def p_data_type_7(p
):
550 '''data_type : K_time '''
551 print('data_type_7', list(p
))
552 # { list<pform_range_t>*pd = make_range_from_width(64);
553 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
554 # tmp->reg_flag = !gn_system_verilog();
558 def p_data_type_8(p
):
559 '''data_type : TYPE_IDENTIFIER dimensions_opt '''
560 print('data_type_8', list(p
))
562 # parray_type_t*tmp = new parray_type_t($1.type, $2);
563 # FILE_NAME(tmp, @1);
565 # } else $$ = $1.type;
569 def p_data_type_9(p
):
570 '''data_type : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_data_type TYPE_IDENTIFIER '''
571 print('data_type_9', list(p
))
572 # { lex_in_package_scope(0);
577 def p_data_type_10(p
):
578 '''data_type : K_string '''
579 print('data_type_10', list(p
))
580 # { string_type_t*tmp = new string_type_t;
581 # FILE_NAME(tmp, @1);
585 def p__embed0_data_type(p
):
586 '''_embed0_data_type : '''
587 # { lex_in_package_scope($1); }
589 def p_data_type_or_implicit_1(p
):
590 '''data_type_or_implicit : data_type '''
591 print('data_type_or_implicit_1', list(p
))
594 def p_data_type_or_implicit_2(p
):
595 '''data_type_or_implicit : signing dimensions_opt '''
596 print('data_type_or_implicit_2', list(p
))
597 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, $1, $2);
598 # tmp->implicit_flag = true;
599 # FILE_NAME(tmp, @1);
603 def p_data_type_or_implicit_3(p
):
604 '''data_type_or_implicit : dimensions '''
605 print('data_type_or_implicit_3', list(p
))
606 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, $1);
607 # tmp->implicit_flag = true;
608 # FILE_NAME(tmp, @1);
612 def p_data_type_or_implicit_4(p
):
613 '''data_type_or_implicit : '''
614 print('data_type_or_implicit_4', list(p
))
617 def p_data_type_or_implicit_or_void_1(p
):
618 '''data_type_or_implicit_or_void : data_type_or_implicit '''
619 print('data_type_or_implicit_or_void_1', list(p
))
622 def p_data_type_or_implicit_or_void_2(p
):
623 '''data_type_or_implicit_or_void : K_void '''
624 print('data_type_or_implicit_or_void_2', list(p
))
625 # { void_type_t*tmp = new void_type_t;
626 # FILE_NAME(tmp, @1);
630 def p_description_1(p
):
631 '''description : module '''
632 print('description_1', list(p
))
634 def p_description_2(p
):
635 '''description : udp_primitive '''
636 print('description_2', list(p
))
638 def p_description_3(p
):
639 '''description : config_declaration '''
640 print('description_3', list(p
))
642 def p_description_4(p
):
643 '''description : nature_declaration '''
644 print('description_4', list(p
))
646 def p_description_5(p
):
647 '''description : package_declaration '''
648 print('description_5', list(p
))
650 def p_description_6(p
):
651 '''description : discipline_declaration '''
652 print('description_6', list(p
))
654 def p_description_7(p
):
655 '''description : package_item '''
656 print('description_7', list(p
))
658 def p_description_8(p
):
659 '''description : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' '''
660 print('description_8', list(p
))
661 # { perm_string tmp3 = lex_strings.make($3);
662 # pform_set_type_attrib(tmp3, $5, $7);
667 def p_description_list_1(p
):
668 '''description_list : description '''
669 print('description_list_1', list(p
))
671 def p_description_list_2(p
):
672 '''description_list : description_list description '''
673 print('description_list_2', list(p
))
675 def p_endnew_opt_1(p
):
676 '''endnew_opt : ':' K_new '''
677 print('endnew_opt_1', list(p
))
679 def p_endnew_opt_2(p
):
681 print('endnew_opt_2', list(p
))
683 def p_dynamic_array_new_1(p
):
684 '''dynamic_array_new : K_new '[' expression ']' '''
685 print('dynamic_array_new_1', list(p
))
686 # { $$ = new PENewArray($3, 0);
690 def p_dynamic_array_new_2(p
):
691 '''dynamic_array_new : K_new '[' expression ']' '(' expression ')' '''
692 print('dynamic_array_new_2', list(p
))
693 # { $$ = new PENewArray($3, $6);
698 '''for_step : lpvalue '=' expression '''
699 print('for_step_1', list(p
))
700 # { PAssign*tmp = new PAssign($1,$3);
701 # FILE_NAME(tmp, @1);
706 '''for_step : inc_or_dec_expression '''
707 print('for_step_2', list(p
))
708 # { $$ = pform_compressed_assign_from_inc_dec(@1, $1); }
711 '''for_step : compressed_statement '''
712 print('for_step_3', list(p
))
715 def p_function_declaration_1(p
):
716 '''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 '''
717 print('function_declaration_1', list(p
))
718 # { // Last step: check any closing name.
720 # if (strcmp($4,$11) != 0) {
721 # yyerror(@11, "error: End label doesn't match "
724 # if (! gn_system_verilog()) {
725 # yyerror(@11, "error: Function end labels require "
733 def p_function_declaration_2(p
):
734 '''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 '''
735 print('function_declaration_2', list(p
))
736 # { // Last step: check any closing name.
738 # if (strcmp($4,$14) != 0) {
739 # yyerror(@14, "error: End label doesn't match "
742 # if (! gn_system_verilog()) {
743 # yyerror(@14, "error: Function end labels require "
751 def p_function_declaration_3(p
):
752 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER error K_endfunction _embed4_function_declaration endlabel_opt '''
753 print('function_declaration_3', list(p
))
754 # { // Last step: check any closing name.
756 # if (strcmp($4,$8) != 0) {
757 # yyerror(@8, "error: End label doesn't match function name");
759 # if (! gn_system_verilog()) {
760 # yyerror(@8, "error: Function end labels require "
768 def p__embed0_function_declaration(p
):
769 '''_embed0_function_declaration : '''
770 # { assert(current_function == 0);
771 # current_function = pform_push_function_scope(@1, $4, $2);
774 def p__embed1_function_declaration(p
):
775 '''_embed1_function_declaration : '''
776 # { current_function->set_ports($7);
777 # current_function->set_return($3);
778 # current_function_set_statement($8? @8 : @4, $8);
779 # pform_set_this_class(@4, current_function);
781 # current_function = 0;
784 def p__embed2_function_declaration(p
):
785 '''_embed2_function_declaration : '''
786 # { assert(current_function == 0);
787 # current_function = pform_push_function_scope(@1, $4, $2);
790 def p__embed3_function_declaration(p
):
791 '''_embed3_function_declaration : '''
792 # { current_function->set_ports($7);
793 # current_function->set_return($3);
794 # current_function_set_statement($11? @11 : @4, $11);
795 # pform_set_this_class(@4, current_function);
797 # current_function = 0;
798 # if ($7==0 && !gn_system_verilog()) {
799 # yyerror(@4, "error: Empty parenthesis syntax requires SystemVerilog.");
803 def p__embed4_function_declaration(p
):
804 '''_embed4_function_declaration : '''
806 # if (current_function) {
808 # current_function = 0;
810 # assert(current_function == 0);
811 # yyerror(@1, "error: Syntax error defining function.");
815 def p_import_export_1(p
):
816 '''import_export : K_import '''
817 print('import_export_1', list(p
))
820 def p_import_export_2(p
):
821 '''import_export : K_export '''
822 print('import_export_2', list(p
))
825 def p_implicit_class_handle_1(p
):
826 '''implicit_class_handle : K_this '''
827 print('implicit_class_handle_1', list(p
))
828 # { $$ = pform_create_this(); }
830 def p_implicit_class_handle_2(p
):
831 '''implicit_class_handle : K_super '''
832 print('implicit_class_handle_2', list(p
))
833 # { $$ = pform_create_super(); }
835 def p_inc_or_dec_expression_1(p
):
836 '''inc_or_dec_expression : K_INCR lpvalue %prec UNARY_PREC '''
837 print('inc_or_dec_expression_1', list(p
))
838 # { PEUnary*tmp = new PEUnary('I', $2);
839 # FILE_NAME(tmp, @2);
843 def p_inc_or_dec_expression_2(p
):
844 '''inc_or_dec_expression : lpvalue K_INCR %prec UNARY_PREC '''
845 print('inc_or_dec_expression_2', list(p
))
846 # { PEUnary*tmp = new PEUnary('i', $1);
847 # FILE_NAME(tmp, @1);
851 def p_inc_or_dec_expression_3(p
):
852 '''inc_or_dec_expression : K_DECR lpvalue %prec UNARY_PREC '''
853 print('inc_or_dec_expression_3', list(p
))
854 # { PEUnary*tmp = new PEUnary('D', $2);
855 # FILE_NAME(tmp, @2);
859 def p_inc_or_dec_expression_4(p
):
860 '''inc_or_dec_expression : lpvalue K_DECR %prec UNARY_PREC '''
861 print('inc_or_dec_expression_4', list(p
))
862 # { PEUnary*tmp = new PEUnary('d', $1);
863 # FILE_NAME(tmp, @1);
867 def p_inside_expression_1(p
):
868 '''inside_expression : expression K_inside '{' open_range_list '}' '''
869 print('inside_expression_1', list(p
))
870 # { yyerror(@2, "sorry: \"inside\" expressions not supported yet.");
874 def p_integer_vector_type_1(p
):
875 '''integer_vector_type : K_reg '''
876 print('integer_vector_type_1', list(p
))
877 # { $$ = IVL_VT_NO_TYPE; }
879 def p_integer_vector_type_2(p
):
880 '''integer_vector_type : K_bit '''
881 print('integer_vector_type_2', list(p
))
882 # { $$ = IVL_VT_BOOL; }
884 def p_integer_vector_type_3(p
):
885 '''integer_vector_type : K_logic '''
886 print('integer_vector_type_3', list(p
))
887 # { $$ = IVL_VT_LOGIC; }
889 def p_integer_vector_type_4(p
):
890 '''integer_vector_type : K_bool '''
891 print('integer_vector_type_4', list(p
))
892 # { $$ = IVL_VT_BOOL; }
894 def p_join_keyword_1(p
):
895 '''join_keyword : K_join '''
896 print('join_keyword_1', list(p
))
897 # { $$ = PBlock::BL_PAR; }
899 def p_join_keyword_2(p
):
900 '''join_keyword : K_join_none '''
901 print('join_keyword_2', list(p
))
902 # { $$ = PBlock::BL_JOIN_NONE; }
904 def p_join_keyword_3(p
):
905 '''join_keyword : K_join_any '''
906 print('join_keyword_3', list(p
))
907 # { $$ = PBlock::BL_JOIN_ANY; }
909 def p_jump_statement_1(p
):
910 '''jump_statement : K_break ';' '''
911 print('jump_statement_1', list(p
))
912 # { yyerror(@1, "sorry: break statements not supported.");
916 def p_jump_statement_2(p
):
917 '''jump_statement : K_return ';' '''
918 print('jump_statement_2', list(p
))
919 # { PReturn*tmp = new PReturn(0);
920 # FILE_NAME(tmp, @1);
924 def p_jump_statement_3(p
):
925 '''jump_statement : K_return expression ';' '''
926 print('jump_statement_3', list(p
))
927 # { PReturn*tmp = new PReturn($2);
928 # FILE_NAME(tmp, @1);
933 '''lifetime : K_automatic '''
934 print('lifetime_1', list(p
))
935 # { $$ = LexicalScope::AUTOMATIC; }
938 '''lifetime : K_static '''
939 print('lifetime_2', list(p
))
940 # { $$ = LexicalScope::STATIC; }
942 def p_lifetime_opt_1(p
):
943 '''lifetime_opt : lifetime '''
944 print('lifetime_opt_1', list(p
))
947 def p_lifetime_opt_2(p
):
948 '''lifetime_opt : '''
949 print('lifetime_opt_2', list(p
))
950 # { $$ = LexicalScope::INHERITED; }
952 def p_loop_statement_1(p
):
953 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' for_step ')' statement_or_null '''
954 print('loop_statement_1', list(p
))
955 # { PForStatement*tmp = new PForStatement($3, $5, $7, $9, $11);
956 # FILE_NAME(tmp, @1);
960 def p_loop_statement_2(p
):
961 '''loop_statement : K_for '(' data_type IDENTIFIER '=' expression ';' expression ';' for_step ')' _embed0_loop_statement statement_or_null '''
962 print('loop_statement_2', list(p
))
963 # { pform_name_t tmp_hident;
964 # tmp_hident.push_back(name_component_t(lex_strings.make($4)));
966 # PEIdent*tmp_ident = pform_new_ident(tmp_hident);
967 # FILE_NAME(tmp_ident, @4);
969 # PForStatement*tmp_for = new PForStatement(tmp_ident, $6, $8, $10, $13);
970 # FILE_NAME(tmp_for, @1);
973 # vector<Statement*>tmp_for_list (1);
974 # tmp_for_list[0] = tmp_for;
975 # PBlock*tmp_blk = current_block_stack.top();
976 # current_block_stack.pop();
977 # tmp_blk->set_statement(tmp_for_list);
982 def p_loop_statement_3(p
):
983 '''loop_statement : K_forever statement_or_null '''
984 print('loop_statement_3', list(p
))
985 # { PForever*tmp = new PForever($2);
986 # FILE_NAME(tmp, @1);
990 def p_loop_statement_4(p
):
991 '''loop_statement : K_repeat '(' expression ')' statement_or_null '''
992 print('loop_statement_4', list(p
))
993 # { PRepeat*tmp = new PRepeat($3, $5);
994 # FILE_NAME(tmp, @1);
998 def p_loop_statement_5(p
):
999 '''loop_statement : K_while '(' expression ')' statement_or_null '''
1000 print('loop_statement_5', list(p
))
1001 # { PWhile*tmp = new PWhile($3, $5);
1002 # FILE_NAME(tmp, @1);
1006 def p_loop_statement_6(p
):
1007 '''loop_statement : K_do statement_or_null K_while '(' expression ')' ';' '''
1008 print('loop_statement_6', list(p
))
1009 # { PDoWhile*tmp = new PDoWhile($5, $2);
1010 # FILE_NAME(tmp, @1);
1014 def p_loop_statement_7(p
):
1015 '''loop_statement : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' _embed1_loop_statement statement_or_null '''
1016 print('loop_statement_7', list(p
))
1017 # { PForeach*tmp_for = pform_make_foreach(@1, $3, $5, $9);
1019 # pform_pop_scope();
1020 # vector<Statement*>tmp_for_list(1);
1021 # tmp_for_list[0] = tmp_for;
1022 # PBlock*tmp_blk = current_block_stack.top();
1023 # current_block_stack.pop();
1024 # tmp_blk->set_statement(tmp_for_list);
1028 def p_loop_statement_8(p
):
1029 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' error ')' statement_or_null '''
1030 print('loop_statement_8', list(p
))
1032 # yyerror(@1, "error: Error in for loop step assignment.");
1035 def p_loop_statement_9(p
):
1036 '''loop_statement : K_for '(' lpvalue '=' expression ';' error ';' for_step ')' statement_or_null '''
1037 print('loop_statement_9', list(p
))
1039 # yyerror(@1, "error: Error in for loop condition expression.");
1042 def p_loop_statement_10(p
):
1043 '''loop_statement : K_for '(' error ')' statement_or_null '''
1044 print('loop_statement_10', list(p
))
1046 # yyerror(@1, "error: Incomprehensible for loop.");
1049 def p_loop_statement_11(p
):
1050 '''loop_statement : K_while '(' error ')' statement_or_null '''
1051 print('loop_statement_11', list(p
))
1053 # yyerror(@1, "error: Error in while loop condition.");
1056 def p_loop_statement_12(p
):
1057 '''loop_statement : K_do statement_or_null K_while '(' error ')' ';' '''
1058 print('loop_statement_12', list(p
))
1060 # yyerror(@1, "error: Error in do/while loop condition.");
1063 def p_loop_statement_13(p
):
1064 '''loop_statement : K_foreach '(' IDENTIFIER '[' error ']' ')' statement_or_null '''
1065 print('loop_statement_13', list(p
))
1067 # yyerror(@4, "error: Errors in foreach loop variables list.");
1070 def p__embed0_loop_statement(p
):
1071 '''_embed0_loop_statement : '''
1072 # { static unsigned for_counter = 0;
1073 # char for_block_name [64];
1074 # snprintf(for_block_name, sizeof for_block_name, "$ivl_for_loop%u", for_counter);
1076 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1077 # FILE_NAME(tmp, @1);
1078 # current_block_stack.push(tmp);
1080 # list<decl_assignment_t*>assign_list;
1081 # decl_assignment_t*tmp_assign = new decl_assignment_t;
1082 # tmp_assign->name = lex_strings.make($4);
1083 # assign_list.push_back(tmp_assign);
1084 # pform_makewire(@4, 0, str_strength, &assign_list, NetNet::REG, $3);
1087 def p__embed1_loop_statement(p
):
1088 '''_embed1_loop_statement : '''
1089 # { static unsigned foreach_counter = 0;
1090 # char for_block_name[64];
1091 # snprintf(for_block_name, sizeof for_block_name, "$ivl_foreach%u", foreach_counter);
1092 # foreach_counter += 1;
1094 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1095 # FILE_NAME(tmp, @1);
1096 # current_block_stack.push(tmp);
1098 # pform_make_foreach_declarations(@1, $5);
1101 def p_list_of_variable_decl_assignments_1(p
):
1102 '''list_of_variable_decl_assignments : variable_decl_assignment '''
1103 print('list_of_variable_decl_assignments_1', list(p
))
1104 # { list<decl_assignment_t*>*tmp = new list<decl_assignment_t*>;
1105 # tmp->push_back($1);
1109 def p_list_of_variable_decl_assignments_2(p
):
1110 '''list_of_variable_decl_assignments : list_of_variable_decl_assignments ',' variable_decl_assignment '''
1111 print('list_of_variable_decl_assignments_2', list(p
))
1112 # { list<decl_assignment_t*>*tmp = $1;
1113 # tmp->push_back($3);
1117 def p_variable_decl_assignment_1(p
):
1118 '''variable_decl_assignment : IDENTIFIER dimensions_opt '''
1119 print('variable_decl_assignment_1', list(p
))
1120 # { decl_assignment_t*tmp = new decl_assignment_t;
1121 # tmp->name = lex_strings.make($1);
1130 def p_variable_decl_assignment_2(p
):
1131 '''variable_decl_assignment : IDENTIFIER '=' expression '''
1132 print('variable_decl_assignment_2', list(p
))
1133 # { decl_assignment_t*tmp = new decl_assignment_t;
1134 # tmp->name = lex_strings.make($1);
1135 # tmp->expr .reset($3);
1140 def p_variable_decl_assignment_3(p
):
1141 '''variable_decl_assignment : IDENTIFIER '=' K_new '(' ')' '''
1142 print('variable_decl_assignment_3', list(p
))
1143 # { decl_assignment_t*tmp = new decl_assignment_t;
1144 # tmp->name = lex_strings.make($1);
1145 # PENewClass*expr = new PENewClass;
1146 # FILE_NAME(expr, @3);
1147 # tmp->expr .reset(expr);
1152 def p_loop_variables_1(p
):
1153 '''loop_variables : loop_variables ',' IDENTIFIER '''
1154 print('loop_variables_1', list(p
))
1155 # { list<perm_string>*tmp = $1;
1156 # tmp->push_back(lex_strings.make($3));
1161 def p_loop_variables_2(p
):
1162 '''loop_variables : IDENTIFIER '''
1163 print('loop_variables_2', list(p
))
1164 # { list<perm_string>*tmp = new list<perm_string>;
1165 # tmp->push_back(lex_strings.make($1));
1170 def p_method_qualifier_1(p
):
1171 '''method_qualifier : K_virtual '''
1172 print('method_qualifier_1', list(p
))
1174 def p_method_qualifier_2(p
):
1175 '''method_qualifier : class_item_qualifier '''
1176 print('method_qualifier_2', list(p
))
1178 def p_method_qualifier_opt_1(p
):
1179 '''method_qualifier_opt : method_qualifier '''
1180 print('method_qualifier_opt_1', list(p
))
1182 def p_method_qualifier_opt_2(p
):
1183 '''method_qualifier_opt : '''
1184 print('method_qualifier_opt_2', list(p
))
1186 def p_modport_declaration_1(p
):
1187 '''modport_declaration : K_modport _embed0_modport_declaration modport_item_list ';' '''
1188 print('modport_declaration_1', list(p
))
1190 def p__embed0_modport_declaration(p
):
1191 '''_embed0_modport_declaration : '''
1192 # { if (!pform_in_interface())
1193 # yyerror(@1, "error: modport declarations are only allowed "
1194 # "in interfaces.");
1197 def p_modport_item_list_1(p
):
1198 '''modport_item_list : modport_item '''
1199 print('modport_item_list_1', list(p
))
1201 def p_modport_item_list_2(p
):
1202 '''modport_item_list : modport_item_list ',' modport_item '''
1203 print('modport_item_list_2', list(p
))
1205 def p_modport_item_1(p
):
1206 '''modport_item : IDENTIFIER _embed0_modport_item '(' modport_ports_list ')' '''
1207 print('modport_item_1', list(p
))
1208 # { pform_end_modport_item(@1); }
1210 def p__embed0_modport_item(p
):
1211 '''_embed0_modport_item : '''
1212 # { pform_start_modport_item(@1, $1); }
1214 def p_modport_ports_list_1(p
):
1215 '''modport_ports_list : modport_ports_declaration '''
1216 print('modport_ports_list_1', list(p
))
1218 def p_modport_ports_list_2(p
):
1219 '''modport_ports_list : modport_ports_list ',' modport_ports_declaration '''
1220 print('modport_ports_list_2', list(p
))
1222 def p_modport_ports_list_3(p
):
1223 '''modport_ports_list : modport_ports_list ',' modport_simple_port '''
1224 print('modport_ports_list_3', list(p
))
1225 # { if (last_modport_port.type == MP_SIMPLE) {
1226 # pform_add_modport_port(@3, last_modport_port.direction,
1227 # $3->name, $3->parm);
1229 # yyerror(@3, "error: modport expression not allowed here.");
1234 def p_modport_ports_list_4(p
):
1235 '''modport_ports_list : modport_ports_list ',' modport_tf_port '''
1236 print('modport_ports_list_4', list(p
))
1237 # { if (last_modport_port.type != MP_TF)
1238 # yyerror(@3, "error: task/function declaration not allowed here.");
1241 def p_modport_ports_list_5(p
):
1242 '''modport_ports_list : modport_ports_list ',' IDENTIFIER '''
1243 print('modport_ports_list_5', list(p
))
1244 # { if (last_modport_port.type == MP_SIMPLE) {
1245 # pform_add_modport_port(@3, last_modport_port.direction,
1246 # lex_strings.make($3), 0);
1247 # } else if (last_modport_port.type != MP_TF) {
1248 # yyerror(@3, "error: list of identifiers not allowed here.");
1253 def p_modport_ports_list_6(p
):
1254 '''modport_ports_list : modport_ports_list ',' '''
1255 print('modport_ports_list_6', list(p
))
1256 # { yyerror(@2, "error: NULL port declarations are not allowed"); }
1258 def p_modport_ports_declaration_1(p
):
1259 '''modport_ports_declaration : attribute_list_opt port_direction IDENTIFIER '''
1260 print('modport_ports_declaration_1', list(p
))
1261 # { last_modport_port.type = MP_SIMPLE;
1262 # last_modport_port.direction = $2;
1263 # pform_add_modport_port(@3, $2, lex_strings.make($3), 0);
1268 def p_modport_ports_declaration_2(p
):
1269 '''modport_ports_declaration : attribute_list_opt port_direction modport_simple_port '''
1270 print('modport_ports_declaration_2', list(p
))
1271 # { last_modport_port.type = MP_SIMPLE;
1272 # last_modport_port.direction = $2;
1273 # pform_add_modport_port(@3, $2, $3->name, $3->parm);
1278 def p_modport_ports_declaration_3(p
):
1279 '''modport_ports_declaration : attribute_list_opt import_export IDENTIFIER '''
1280 print('modport_ports_declaration_3', list(p
))
1281 # { last_modport_port.type = MP_TF;
1282 # last_modport_port.is_import = $2;
1283 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
1288 def p_modport_ports_declaration_4(p
):
1289 '''modport_ports_declaration : attribute_list_opt import_export modport_tf_port '''
1290 print('modport_ports_declaration_4', list(p
))
1291 # { last_modport_port.type = MP_TF;
1292 # last_modport_port.is_import = $2;
1293 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
1297 def p_modport_ports_declaration_5(p
):
1298 '''modport_ports_declaration : attribute_list_opt K_clocking IDENTIFIER '''
1299 print('modport_ports_declaration_5', list(p
))
1300 # { last_modport_port.type = MP_CLOCKING;
1301 # last_modport_port.direction = NetNet::NOT_A_PORT;
1302 # yyerror(@3, "sorry: modport clocking declaration is not yet supported.");
1307 def p_modport_simple_port_1(p
):
1308 '''modport_simple_port : '.' IDENTIFIER '(' expression ')' '''
1309 print('modport_simple_port_1', list(p
))
1310 # { named_pexpr_t*tmp = new named_pexpr_t;
1311 # tmp->name = lex_strings.make($2);
1317 def p_modport_tf_port_1(p
):
1318 '''modport_tf_port : K_task IDENTIFIER '''
1319 print('modport_tf_port_1', list(p
))
1321 def p_modport_tf_port_2(p
):
1322 '''modport_tf_port : K_task IDENTIFIER '(' tf_port_list_opt ')' '''
1323 print('modport_tf_port_2', list(p
))
1325 def p_modport_tf_port_3(p
):
1326 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '''
1327 print('modport_tf_port_3', list(p
))
1329 def p_modport_tf_port_4(p
):
1330 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' '''
1331 print('modport_tf_port_4', list(p
))
1333 def p_non_integer_type_1(p
):
1334 '''non_integer_type : K_real '''
1335 print('non_integer_type_1', list(p
))
1336 # { $$ = real_type_t::REAL; }
1338 def p_non_integer_type_2(p
):
1339 '''non_integer_type : K_realtime '''
1340 print('non_integer_type_2', list(p
))
1341 # { $$ = real_type_t::REAL; }
1343 def p_non_integer_type_3(p
):
1344 '''non_integer_type : K_shortreal '''
1345 print('non_integer_type_3', list(p
))
1346 # { $$ = real_type_t::SHORTREAL; }
1349 '''number : BASED_NUMBER '''
1350 print('number_1', list(p
))
1351 # { $$ = $1; based_size = 0;}
1354 '''number : DEC_NUMBER '''
1355 print('number_2', list(p
))
1356 num
= Leaf(token
.NUMBER
, "%s" % (p
[1]))
1358 # { $$ = $1; based_size = 0;}
1361 '''number : DEC_NUMBER BASED_NUMBER '''
1362 print('number_3', list(p
))
1363 num
= Leaf(token
.NUMBER
, "%s:%s" % (p
[1], p
[2]))
1365 # { $$ = pform_verinum_with_size($1,$2, @2.text, @2.first_line);
1369 '''number : UNBASED_NUMBER '''
1370 print('number_4', list(p
))
1371 # { $$ = $1; based_size = 0;}
1374 '''number : DEC_NUMBER UNBASED_NUMBER '''
1375 print('number_5', list(p
))
1376 # { yyerror(@1, "error: Unbased SystemVerilog literal cannot have "
1378 # $$ = $1; based_size = 0;}
1380 def p_open_range_list_1(p
):
1381 '''open_range_list : open_range_list ',' value_range '''
1382 print('open_range_list_1', list(p
))
1384 def p_open_range_list_2(p
):
1385 '''open_range_list : value_range '''
1386 print('open_range_list_2', list(p
))
1388 def p_package_declaration_1(p
):
1389 '''package_declaration : K_package lifetime_opt IDENTIFIER ';' _embed0_package_declaration timeunits_declaration_opt _embed1_package_declaration package_item_list_opt K_endpackage endlabel_opt '''
1390 print('package_declaration_1', list(p
))
1391 # { pform_end_package_declaration(@1);
1392 # // If an end label is present make sure it match the package name.
1394 # if (strcmp($3,$10) != 0) {
1395 # yyerror(@10, "error: End label doesn't match package name");
1402 def p__embed0_package_declaration(p
):
1403 '''_embed0_package_declaration : '''
1404 # { pform_start_package_declaration(@1, $3, $2); }
1406 def p__embed1_package_declaration(p
):
1407 '''_embed1_package_declaration : '''
1408 # { pform_set_scope_timescale(@1); }
1410 def p_module_package_import_list_opt_1(p
):
1411 '''module_package_import_list_opt : '''
1412 print('module_package_import_list_opt_1', list(p
))
1414 def p_module_package_import_list_opt_2(p
):
1415 '''module_package_import_list_opt : package_import_list '''
1416 print('module_package_import_list_opt_2', list(p
))
1418 def p_package_import_list_1(p
):
1419 '''package_import_list : package_import_declaration '''
1420 print('package_import_list_1', list(p
))
1422 def p_package_import_list_2(p
):
1423 '''package_import_list : package_import_list package_import_declaration '''
1424 print('package_import_list_2', list(p
))
1426 def p_package_import_declaration_1(p
):
1427 '''package_import_declaration : K_import package_import_item_list ';' '''
1428 print('package_import_declaration_1', list(p
))
1431 def p_package_import_item_1(p
):
1432 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '''
1433 print('package_import_item_1', list(p
))
1434 # { pform_package_import(@2, $1, $3);
1438 def p_package_import_item_2(p
):
1439 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES '*' '''
1440 print('package_import_item_2', list(p
))
1441 # { pform_package_import(@2, $1, 0);
1444 def p_package_import_item_list_1(p
):
1445 '''package_import_item_list : package_import_item_list ',' package_import_item '''
1446 print('package_import_item_list_1', list(p
))
1448 def p_package_import_item_list_2(p
):
1449 '''package_import_item_list : package_import_item '''
1450 print('package_import_item_list_2', list(p
))
1452 def p_package_item_1(p
):
1453 '''package_item : timeunits_declaration '''
1454 print('package_item_1', list(p
))
1456 def p_package_item_2(p
):
1457 '''package_item : K_parameter param_type parameter_assign_list ';' '''
1458 print('package_item_2', list(p
))
1460 def p_package_item_3(p
):
1461 '''package_item : K_localparam param_type localparam_assign_list ';' '''
1462 print('package_item_3', list(p
))
1464 def p_package_item_4(p
):
1465 '''package_item : type_declaration '''
1466 print('package_item_4', list(p
))
1468 def p_package_item_5(p
):
1469 '''package_item : function_declaration '''
1470 print('package_item_5', list(p
))
1472 def p_package_item_6(p
):
1473 '''package_item : task_declaration '''
1474 print('package_item_6', list(p
))
1476 def p_package_item_7(p
):
1477 '''package_item : data_declaration '''
1478 print('package_item_7', list(p
))
1480 def p_package_item_8(p
):
1481 '''package_item : class_declaration '''
1482 print('package_item_8', list(p
))
1484 def p_package_item_list_1(p
):
1485 '''package_item_list : package_item_list package_item '''
1486 print('package_item_list_1', list(p
))
1488 def p_package_item_list_2(p
):
1489 '''package_item_list : package_item '''
1490 print('package_item_list_2', list(p
))
1492 def p_package_item_list_opt_1(p
):
1493 '''package_item_list_opt : package_item_list '''
1494 print('package_item_list_opt_1', list(p
))
1496 def p_package_item_list_opt_2(p
):
1497 '''package_item_list_opt : '''
1498 print('package_item_list_opt_2', list(p
))
1500 def p_port_direction_1(p
):
1501 '''port_direction : K_input '''
1502 print('port_direction_1', list(p
))
1503 # { $$ = NetNet::PINPUT; }
1505 def p_port_direction_2(p
):
1506 '''port_direction : K_output '''
1507 print('port_direction_2', list(p
))
1508 # { $$ = NetNet::POUTPUT; }
1510 def p_port_direction_3(p
):
1511 '''port_direction : K_inout '''
1512 print('port_direction_3', list(p
))
1513 # { $$ = NetNet::PINOUT; }
1515 def p_port_direction_4(p
):
1516 '''port_direction : K_ref '''
1517 print('port_direction_4', list(p
))
1518 # { $$ = NetNet::PREF;
1519 # if (!gn_system_verilog()) {
1520 # yyerror(@1, "error: Reference ports (ref) require SystemVerilog.");
1521 # $$ = NetNet::PINPUT;
1525 def p_port_direction_opt_1(p
):
1526 '''port_direction_opt : port_direction '''
1527 print('port_direction_opt_1', list(p
))
1530 def p_port_direction_opt_2(p
):
1531 '''port_direction_opt : '''
1532 print('port_direction_opt_2', list(p
))
1533 # { $$ = NetNet::PIMPLICIT; }
1535 def p_property_expr_1(p
):
1536 '''property_expr : expression '''
1537 print('property_expr_1', list(p
))
1539 def p_procedural_assertion_statement_1(p
):
1540 '''procedural_assertion_statement : K_assert '(' expression ')' statement %prec less_than_K_else '''
1541 print('procedural_assertion_statement_1', list(p
))
1542 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1546 def p_procedural_assertion_statement_2(p
):
1547 '''procedural_assertion_statement : K_assert '(' expression ')' K_else statement '''
1548 print('procedural_assertion_statement_2', list(p
))
1549 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1553 def p_procedural_assertion_statement_3(p
):
1554 '''procedural_assertion_statement : K_assert '(' expression ')' statement K_else statement '''
1555 print('procedural_assertion_statement_3', list(p
))
1556 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1560 def p_property_qualifier_1(p
):
1561 '''property_qualifier : class_item_qualifier '''
1562 print('property_qualifier_1', list(p
))
1564 def p_property_qualifier_2(p
):
1565 '''property_qualifier : random_qualifier '''
1566 print('property_qualifier_2', list(p
))
1568 def p_property_qualifier_opt_1(p
):
1569 '''property_qualifier_opt : property_qualifier_list '''
1570 print('property_qualifier_opt_1', list(p
))
1573 def p_property_qualifier_opt_2(p
):
1574 '''property_qualifier_opt : '''
1575 print('property_qualifier_opt_2', list(p
))
1576 # { $$ = property_qualifier_t::make_none(); }
1578 def p_property_qualifier_list_1(p
):
1579 '''property_qualifier_list : property_qualifier_list property_qualifier '''
1580 print('property_qualifier_list_1', list(p
))
1583 def p_property_qualifier_list_2(p
):
1584 '''property_qualifier_list : property_qualifier '''
1585 print('property_qualifier_list_2', list(p
))
1588 def p_property_spec_1(p
):
1589 '''property_spec : clocking_event_opt property_spec_disable_iff_opt property_expr '''
1590 print('property_spec_1', list(p
))
1592 def p_property_spec_disable_iff_opt_1(p
):
1593 '''property_spec_disable_iff_opt : K_disable K_iff '(' expression ')' '''
1594 print('property_spec_disable_iff_opt_1', list(p
))
1596 def p_property_spec_disable_iff_opt_2(p
):
1597 '''property_spec_disable_iff_opt : '''
1598 print('property_spec_disable_iff_opt_2', list(p
))
1600 def p_random_qualifier_1(p
):
1601 '''random_qualifier : K_rand '''
1602 print('random_qualifier_1', list(p
))
1603 # { $$ = property_qualifier_t::make_rand(); }
1605 def p_random_qualifier_2(p
):
1606 '''random_qualifier : K_randc '''
1607 print('random_qualifier_2', list(p
))
1608 # { $$ = property_qualifier_t::make_randc(); }
1610 def p_real_or_realtime_1(p
):
1611 '''real_or_realtime : K_real '''
1612 print('real_or_realtime_1', list(p
))
1614 def p_real_or_realtime_2(p
):
1615 '''real_or_realtime : K_realtime '''
1616 print('real_or_realtime_2', list(p
))
1619 '''signing : K_signed '''
1620 print('signing_1', list(p
))
1624 '''signing : K_unsigned '''
1625 print('signing_2', list(p
))
1628 def p_simple_type_or_string_1(p
):
1629 '''simple_type_or_string : integer_vector_type '''
1630 print('simple_type_or_string_1', list(p
))
1631 # { ivl_variable_type_t use_vtype = $1;
1632 # bool reg_flag = false;
1633 # if (use_vtype == IVL_VT_NO_TYPE) {
1634 # use_vtype = IVL_VT_LOGIC;
1637 # vector_type_t*tmp = new vector_type_t(use_vtype, false, 0);
1638 # tmp->reg_flag = reg_flag;
1639 # FILE_NAME(tmp, @1);
1643 def p_simple_type_or_string_2(p
):
1644 '''simple_type_or_string : non_integer_type '''
1645 print('simple_type_or_string_2', list(p
))
1646 # { real_type_t*tmp = new real_type_t($1);
1647 # FILE_NAME(tmp, @1);
1651 def p_simple_type_or_string_3(p
):
1652 '''simple_type_or_string : atom2_type '''
1653 print('simple_type_or_string_3', list(p
))
1654 # { atom2_type_t*tmp = new atom2_type_t($1, true);
1655 # FILE_NAME(tmp, @1);
1659 def p_simple_type_or_string_4(p
):
1660 '''simple_type_or_string : K_integer '''
1661 print('simple_type_or_string_4', list(p
))
1662 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
1663 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd);
1664 # tmp->reg_flag = true;
1665 # tmp->integer_flag = true;
1669 def p_simple_type_or_string_5(p
):
1670 '''simple_type_or_string : K_time '''
1671 print('simple_type_or_string_5', list(p
))
1672 # { list<pform_range_t>*pd = make_range_from_width(64);
1673 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
1674 # tmp->reg_flag = !gn_system_verilog();
1678 def p_simple_type_or_string_6(p
):
1679 '''simple_type_or_string : TYPE_IDENTIFIER '''
1680 print('simple_type_or_string_6', list(p
))
1685 def p_simple_type_or_string_7(p
):
1686 '''simple_type_or_string : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_simple_type_or_string TYPE_IDENTIFIER '''
1687 print('simple_type_or_string_7', list(p
))
1688 # { lex_in_package_scope(0);
1693 def p_simple_type_or_string_8(p
):
1694 '''simple_type_or_string : K_string '''
1695 print('simple_type_or_string_8', list(p
))
1696 # { string_type_t*tmp = new string_type_t;
1697 # FILE_NAME(tmp, @1);
1701 def p__embed0_simple_type_or_string(p
):
1702 '''_embed0_simple_type_or_string : '''
1703 # { lex_in_package_scope($1); }
1705 def p_statement_1(p
):
1706 '''statement : attribute_list_opt statement_item '''
1707 print('statement_1', list(p
))
1708 # { pform_bind_attributes($2->attributes, $1);
1712 def p_statement_or_null_1(p
):
1713 '''statement_or_null : statement '''
1714 print('statement_or_null_1', list(p
))
1717 def p_statement_or_null_2(p
):
1718 '''statement_or_null : attribute_list_opt ';' '''
1719 print('statement_or_null_2', list(p
))
1722 def p_stream_expression_1(p
):
1723 '''stream_expression : expression '''
1724 print('stream_expression_1', list(p
))
1726 def p_stream_expression_list_1(p
):
1727 '''stream_expression_list : stream_expression_list ',' stream_expression '''
1728 print('stream_expression_list_1', list(p
))
1730 def p_stream_expression_list_2(p
):
1731 '''stream_expression_list : stream_expression '''
1732 print('stream_expression_list_2', list(p
))
1734 def p_stream_operator_1(p
):
1735 '''stream_operator : K_LS '''
1736 print('stream_operator_1', list(p
))
1738 def p_stream_operator_2(p
):
1739 '''stream_operator : K_RS '''
1740 print('stream_operator_2', list(p
))
1742 def p_streaming_concatenation_1(p
):
1743 '''streaming_concatenation : '{' stream_operator '{' stream_expression_list '}' '}' '''
1744 print('streaming_concatenation_1', list(p
))
1745 # { /* streaming concatenation is a SystemVerilog thing. */
1746 # if (gn_system_verilog()) {
1747 # yyerror(@2, "sorry: Streaming concatenation not supported.");
1750 # yyerror(@2, "error: Streaming concatenation requires SystemVerilog");
1755 def p_task_declaration_1(p
):
1756 '''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 '''
1757 print('task_declaration_1', list(p
))
1758 # { // Last step: check any closing name. This is done late so
1759 # // that the parser can look ahead to detect the present
1760 # // endlabel_opt but still have the pform_endmodule() called
1761 # // early enough that the lexor can know we are outside the
1764 # if (strcmp($3,$10) != 0) {
1765 # yyerror(@10, "error: End label doesn't match task name");
1767 # if (! gn_system_verilog()) {
1768 # yyerror(@10, "error: Task end labels require "
1769 # "SystemVerilog.");
1776 def p_task_declaration_2(p
):
1777 '''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 '''
1778 print('task_declaration_2', list(p
))
1779 # { // Last step: check any closing name. This is done late so
1780 # // that the parser can look ahead to detect the present
1781 # // endlabel_opt but still have the pform_endmodule() called
1782 # // early enough that the lexor can know we are outside the
1785 # if (strcmp($3,$13) != 0) {
1786 # yyerror(@13, "error: End label doesn't match task name");
1788 # if (! gn_system_verilog()) {
1789 # yyerror(@13, "error: Task end labels require "
1790 # "SystemVerilog.");
1797 def p_task_declaration_3(p
):
1798 '''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 '''
1799 print('task_declaration_3', list(p
))
1800 # { // Last step: check any closing name. This is done late so
1801 # // that the parser can look ahead to detect the present
1802 # // endlabel_opt but still have the pform_endmodule() called
1803 # // early enough that the lexor can know we are outside the
1806 # if (strcmp($3,$12) != 0) {
1807 # yyerror(@12, "error: End label doesn't match task name");
1809 # if (! gn_system_verilog()) {
1810 # yyerror(@12, "error: Task end labels require "
1811 # "SystemVerilog.");
1818 def p_task_declaration_4(p
):
1819 '''task_declaration : K_task lifetime_opt IDENTIFIER error K_endtask _embed6_task_declaration endlabel_opt '''
1820 print('task_declaration_4', list(p
))
1821 # { // Last step: check any closing name. This is done late so
1822 # // that the parser can look ahead to detect the present
1823 # // endlabel_opt but still have the pform_endmodule() called
1824 # // early enough that the lexor can know we are outside the
1827 # if (strcmp($3,$7) != 0) {
1828 # yyerror(@7, "error: End label doesn't match task name");
1830 # if (! gn_system_verilog()) {
1831 # yyerror(@7, "error: Task end labels require "
1832 # "SystemVerilog.");
1839 def p__embed0_task_declaration(p
):
1840 '''_embed0_task_declaration : '''
1841 # { assert(current_task == 0);
1842 # current_task = pform_push_task_scope(@1, $3, $2);
1845 def p__embed1_task_declaration(p
):
1846 '''_embed1_task_declaration : '''
1847 # { current_task->set_ports($6);
1848 # current_task_set_statement(@3, $7);
1849 # pform_set_this_class(@3, current_task);
1850 # pform_pop_scope();
1852 # if ($7 && $7->size() > 1 && !gn_system_verilog()) {
1853 # yyerror(@7, "error: Task body with multiple statements requires SystemVerilog.");
1858 def p__embed2_task_declaration(p
):
1859 '''_embed2_task_declaration : '''
1860 # { assert(current_task == 0);
1861 # current_task = pform_push_task_scope(@1, $3, $2);
1864 def p__embed3_task_declaration(p
):
1865 '''_embed3_task_declaration : '''
1866 # { current_task->set_ports($6);
1867 # current_task_set_statement(@3, $10);
1868 # pform_set_this_class(@3, current_task);
1869 # pform_pop_scope();
1871 # if ($10) delete $10;
1874 def p__embed4_task_declaration(p
):
1875 '''_embed4_task_declaration : '''
1876 # { assert(current_task == 0);
1877 # current_task = pform_push_task_scope(@1, $3, $2);
1880 def p__embed5_task_declaration(p
):
1881 '''_embed5_task_declaration : '''
1882 # { current_task->set_ports(0);
1883 # current_task_set_statement(@3, $9);
1884 # pform_set_this_class(@3, current_task);
1885 # if (! current_task->method_of()) {
1886 # cerr << @3 << ": warning: task definition for \"" << $3
1887 # << "\" has an empty port declaration list!" << endl;
1889 # pform_pop_scope();
1891 # if ($9->size() > 1 && !gn_system_verilog()) {
1892 # yyerror(@9, "error: Task body with multiple statements requires SystemVerilog.");
1897 def p__embed6_task_declaration(p
):
1898 '''_embed6_task_declaration : '''
1900 # if (current_task) {
1901 # pform_pop_scope();
1906 def p_tf_port_declaration_1(p
):
1907 '''tf_port_declaration : port_direction K_reg_opt unsigned_signed_opt dimensions_opt list_of_identifiers ';' '''
1908 print('tf_port_declaration_1', list(p
))
1909 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1,
1910 # $2 ? IVL_VT_LOGIC :
1916 def p_tf_port_declaration_2(p
):
1917 '''tf_port_declaration : port_direction K_integer list_of_identifiers ';' '''
1918 print('tf_port_declaration_2', list(p
))
1919 # { list<pform_range_t>*range_stub = make_range_from_width(integer_width);
1920 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_LOGIC, true,
1921 # range_stub, $3, true);
1925 def p_tf_port_declaration_3(p
):
1926 '''tf_port_declaration : port_direction K_time list_of_identifiers ';' '''
1927 print('tf_port_declaration_3', list(p
))
1928 # { list<pform_range_t>*range_stub = make_range_from_width(64);
1929 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_LOGIC, false,
1934 def p_tf_port_declaration_4(p
):
1935 '''tf_port_declaration : port_direction real_or_realtime list_of_identifiers ';' '''
1936 print('tf_port_declaration_4', list(p
))
1937 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_REAL, true,
1942 def p_tf_port_declaration_5(p
):
1943 '''tf_port_declaration : port_direction K_string list_of_identifiers ';' '''
1944 print('tf_port_declaration_5', list(p
))
1945 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_STRING, true,
1950 def p_tf_port_item_1(p
):
1951 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER dimensions_opt tf_port_item_expr_opt '''
1952 print('tf_port_item_1', list(p
))
1953 # { vector<pform_tf_port_t>*tmp;
1954 # NetNet::PortType use_port_type = $1;
1955 # if ((use_port_type == NetNet::PIMPLICIT) && (gn_system_verilog() || ($2 == 0)))
1956 # use_port_type = port_declaration_context.port_type;
1957 # perm_string name = lex_strings.make($3);
1958 # list<perm_string>* ilist = list_from_identifier($3);
1960 # if (use_port_type == NetNet::PIMPLICIT) {
1961 # yyerror(@1, "error: missing task/function port direction.");
1962 # use_port_type = NetNet::PINPUT; // for error recovery
1964 # if (($2 == 0) && ($1==NetNet::PIMPLICIT)) {
1965 # // Detect special case this is an undecorated
1966 # // identifier and we need to get the declaration from
1969 # yyerror(@4, "internal error: How can there be an unpacked range here?\n");
1971 # tmp = pform_make_task_ports(@3, use_port_type,
1972 # port_declaration_context.data_type,
1976 # // Otherwise, the decorations for this identifier
1977 # // indicate the type. Save the type for any right
1978 # // context that may come later.
1979 # port_declaration_context.port_type = use_port_type;
1981 # $2 = new vector_type_t(IVL_VT_LOGIC, false, 0);
1982 # FILE_NAME($2, @3);
1984 # port_declaration_context.data_type = $2;
1985 # tmp = pform_make_task_ports(@3, use_port_type, $2, ilist);
1988 # pform_set_reg_idx(name, $4);
1993 # assert(tmp->size()==1);
1994 # tmp->front().defe = $5;
1998 def p_tf_port_item_2(p
):
1999 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER error '''
2000 print('tf_port_item_2', list(p
))
2001 # { yyerror(@3, "error: Error in task/function port item after port name %s.", $3);
2006 def p_tf_port_item_expr_opt_1(p
):
2007 '''tf_port_item_expr_opt : '=' expression '''
2008 print('tf_port_item_expr_opt_1', list(p
))
2009 # { if (! gn_system_verilog()) {
2010 # yyerror(@1, "error: Task/function default arguments require "
2011 # "SystemVerilog.");
2016 def p_tf_port_item_expr_opt_2(p
):
2017 '''tf_port_item_expr_opt : '''
2018 print('tf_port_item_expr_opt_2', list(p
))
2021 def p_tf_port_list_1(p
):
2022 '''tf_port_list : _embed0_tf_port_list tf_port_item_list '''
2023 print('tf_port_list_1', list(p
))
2026 def p__embed0_tf_port_list(p
):
2027 '''_embed0_tf_port_list : '''
2028 # { port_declaration_context.port_type = gn_system_verilog() ? NetNet::PINPUT : NetNet::PIMPLICIT;
2029 # port_declaration_context.data_type = 0;
2032 def p_tf_port_item_list_1(p
):
2033 '''tf_port_item_list : tf_port_item_list ',' tf_port_item '''
2034 print('tf_port_item_list_1', list(p
))
2035 # { vector<pform_tf_port_t>*tmp;
2037 # size_t s1 = $1->size();
2039 # tmp->resize(tmp->size()+$3->size());
2040 # for (size_t idx = 0 ; idx < $3->size() ; idx += 1)
2041 # tmp->at(s1+idx) = $3->at(idx);
2051 def p_tf_port_item_list_2(p
):
2052 '''tf_port_item_list : tf_port_item '''
2053 print('tf_port_item_list_2', list(p
))
2056 def p_tf_port_item_list_3(p
):
2057 '''tf_port_item_list : error ',' tf_port_item '''
2058 print('tf_port_item_list_3', list(p
))
2059 # { yyerror(@2, "error: Syntax error in task/function port declaration.");
2063 def p_tf_port_item_list_4(p
):
2064 '''tf_port_item_list : tf_port_item_list ',' '''
2065 print('tf_port_item_list_4', list(p
))
2066 # { yyerror(@2, "error: NULL port declarations are not allowed.");
2070 def p_tf_port_item_list_5(p
):
2071 '''tf_port_item_list : tf_port_item_list ';' '''
2072 print('tf_port_item_list_5', list(p
))
2073 # { yyerror(@2, "error: ';' is an invalid port declaration separator.");
2077 def p_timeunits_declaration_1(p
):
2078 '''timeunits_declaration : K_timeunit TIME_LITERAL ';' '''
2079 print('timeunits_declaration_1', list(p
))
2080 # { pform_set_timeunit($2, allow_timeunit_decl); }
2082 def p_timeunits_declaration_2(p
):
2083 '''timeunits_declaration : K_timeunit TIME_LITERAL '/' TIME_LITERAL ';' '''
2084 print('timeunits_declaration_2', list(p
))
2085 # { bool initial_decl = allow_timeunit_decl && allow_timeprec_decl;
2086 # pform_set_timeunit($2, initial_decl);
2087 # pform_set_timeprec($4, initial_decl);
2090 def p_timeunits_declaration_3(p
):
2091 '''timeunits_declaration : K_timeprecision TIME_LITERAL ';' '''
2092 print('timeunits_declaration_3', list(p
))
2093 # { pform_set_timeprec($2, allow_timeprec_decl); }
2095 def p_timeunits_declaration_opt_1(p
):
2096 '''timeunits_declaration_opt : %prec no_timeunits_declaration '''
2097 print('timeunits_declaration_opt_1', list(p
))
2099 def p_timeunits_declaration_opt_2(p
):
2100 '''timeunits_declaration_opt : timeunits_declaration %prec one_timeunits_declaration '''
2101 print('timeunits_declaration_opt_2', list(p
))
2103 def p_timeunits_declaration_opt_3(p
):
2104 '''timeunits_declaration_opt : timeunits_declaration timeunits_declaration '''
2105 print('timeunits_declaration_opt_3', list(p
))
2107 def p_value_range_1(p
):
2108 '''value_range : expression '''
2109 print('value_range_1', list(p
))
2112 def p_value_range_2(p
):
2113 '''value_range : '[' expression ':' expression ']' '''
2114 print('value_range_2', list(p
))
2117 def p_variable_dimension_1(p
):
2118 '''variable_dimension : '[' expression ':' expression ']' '''
2119 print('variable_dimension_1', list(p
))
2120 # { list<pform_range_t> *tmp = new list<pform_range_t>;
2121 # pform_range_t index ($2,$4);
2122 # tmp->push_back(index);
2126 def p_variable_dimension_2(p
):
2127 '''variable_dimension : '[' expression ']' '''
2128 print('variable_dimension_2', list(p
))
2129 # { // SystemVerilog canonical range
2130 # if (!gn_system_verilog()) {
2132 # cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. "
2133 # << "Use at least -g2005-sv to remove this warning." << endl;
2135 # list<pform_range_t> *tmp = new list<pform_range_t>;
2136 # pform_range_t index;
2137 # index.first = new PENumber(new verinum((uint64_t)0, integer_width));
2138 # index.second = new PEBinary('-', $2, new PENumber(new verinum((uint64_t)1, integer_width)));
2139 # tmp->push_back(index);
2143 def p_variable_dimension_3(p
):
2144 '''variable_dimension : '[' ']' '''
2145 print('variable_dimension_3', list(p
))
2146 # { list<pform_range_t> *tmp = new list<pform_range_t>;
2147 # pform_range_t index (0,0);
2148 # tmp->push_back(index);
2152 def p_variable_dimension_4(p
):
2153 '''variable_dimension : '[' '$' ']' '''
2154 print('variable_dimension_4', list(p
))
2155 # { // SystemVerilog queue
2156 # list<pform_range_t> *tmp = new list<pform_range_t>;
2157 # pform_range_t index (new PENull,0);
2158 # if (!gn_system_verilog()) {
2159 # yyerror("error: Queue declarations require SystemVerilog.");
2161 # tmp->push_back(index);
2165 def p_variable_lifetime_1(p
):
2166 '''variable_lifetime : lifetime '''
2167 print('variable_lifetime_1', list(p
))
2168 # { if (!gn_system_verilog()) {
2169 # yyerror(@1, "error: overriding the default variable lifetime "
2170 # "requires SystemVerilog.");
2171 # } else if ($1 != pform_peek_scope()->default_lifetime) {
2172 # yyerror(@1, "sorry: overriding the default variable lifetime "
2173 # "is not yet supported.");
2175 # var_lifetime = $1;
2178 def p_attribute_list_opt_1(p
):
2179 '''attribute_list_opt : attribute_instance_list '''
2180 print('attribute_list_opt_1', list(p
))
2183 def p_attribute_list_opt_2(p
):
2184 '''attribute_list_opt : '''
2185 print('attribute_list_opt_2', list(p
))
2188 def p_attribute_instance_list_1(p
):
2189 '''attribute_instance_list : K_PSTAR K_STARP '''
2190 print('attribute_instance_list_1', list(p
))
2193 def p_attribute_instance_list_2(p
):
2194 '''attribute_instance_list : K_PSTAR attribute_list K_STARP '''
2195 print('attribute_instance_list_2', list(p
))
2198 def p_attribute_instance_list_3(p
):
2199 '''attribute_instance_list : attribute_instance_list K_PSTAR K_STARP '''
2200 print('attribute_instance_list_3', list(p
))
2203 def p_attribute_instance_list_4(p
):
2204 '''attribute_instance_list : attribute_instance_list K_PSTAR attribute_list K_STARP '''
2205 print('attribute_instance_list_4', list(p
))
2206 # { list<named_pexpr_t>*tmp = $1;
2208 # tmp->splice(tmp->end(), *$3);
2214 def p_attribute_list_1(p
):
2215 '''attribute_list : attribute_list ',' attribute '''
2216 print('attribute_list_1', list(p
))
2217 # { list<named_pexpr_t>*tmp = $1;
2218 # tmp->push_back(*$3);
2223 def p_attribute_list_2(p
):
2224 '''attribute_list : attribute '''
2225 print('attribute_list_2', list(p
))
2226 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
2227 # tmp->push_back(*$1);
2232 def p_attribute_1(p
):
2233 '''attribute : IDENTIFIER '''
2234 print('attribute_1', list(p
))
2235 # { named_pexpr_t*tmp = new named_pexpr_t;
2236 # tmp->name = lex_strings.make($1);
2242 def p_attribute_2(p
):
2243 '''attribute : IDENTIFIER '=' expression '''
2244 print('attribute_2', list(p
))
2246 # named_pexpr_t*tmp2 = new named_pexpr_t;
2247 # tmp2->name = lex_strings.make($1);
2253 def p_block_item_decl_1(p
):
2254 '''block_item_decl : data_type register_variable_list ';' '''
2255 print('block_item_decl_1', list(p
))
2256 # { if ($1) pform_set_data_type(@1, $1, $2, NetNet::REG, attributes_in_context);
2259 def p_block_item_decl_2(p
):
2260 '''block_item_decl : variable_lifetime data_type register_variable_list ';' '''
2261 print('block_item_decl_2', list(p
))
2262 # { if ($2) pform_set_data_type(@2, $2, $3, NetNet::REG, attributes_in_context);
2263 # var_lifetime = LexicalScope::INHERITED;
2266 def p_block_item_decl_3(p
):
2267 '''block_item_decl : K_reg data_type register_variable_list ';' '''
2268 print('block_item_decl_3', list(p
))
2269 # { if ($2) pform_set_data_type(@2, $2, $3, NetNet::REG, attributes_in_context);
2272 def p_block_item_decl_4(p
):
2273 '''block_item_decl : variable_lifetime K_reg data_type register_variable_list ';' '''
2274 print('block_item_decl_4', list(p
))
2275 # { if ($3) pform_set_data_type(@3, $3, $4, NetNet::REG, attributes_in_context);
2276 # var_lifetime = LexicalScope::INHERITED;
2279 def p_block_item_decl_5(p
):
2280 '''block_item_decl : K_event event_variable_list ';' '''
2281 print('block_item_decl_5', list(p
))
2282 # { if ($2) pform_make_events($2, @1.text, @1.first_line);
2285 def p_block_item_decl_6(p
):
2286 '''block_item_decl : K_parameter param_type parameter_assign_list ';' '''
2287 print('block_item_decl_6', list(p
))
2289 def p_block_item_decl_7(p
):
2290 '''block_item_decl : K_localparam param_type localparam_assign_list ';' '''
2291 print('block_item_decl_7', list(p
))
2293 def p_block_item_decl_8(p
):
2294 '''block_item_decl : type_declaration '''
2295 print('block_item_decl_8', list(p
))
2297 def p_block_item_decl_9(p
):
2298 '''block_item_decl : K_integer error ';' '''
2299 print('block_item_decl_9', list(p
))
2300 # { yyerror(@1, "error: syntax error in integer variable list.");
2304 def p_block_item_decl_10(p
):
2305 '''block_item_decl : K_time error ';' '''
2306 print('block_item_decl_10', list(p
))
2307 # { yyerror(@1, "error: syntax error in time variable list.");
2311 def p_block_item_decl_11(p
):
2312 '''block_item_decl : K_parameter error ';' '''
2313 print('block_item_decl_11', list(p
))
2314 # { yyerror(@1, "error: syntax error in parameter list.");
2318 def p_block_item_decl_12(p
):
2319 '''block_item_decl : K_localparam error ';' '''
2320 print('block_item_decl_12', list(p
))
2321 # { yyerror(@1, "error: syntax error localparam list.");
2325 def p_block_item_decls_1(p
):
2326 '''block_item_decls : block_item_decl '''
2327 print('block_item_decls_1', list(p
))
2329 def p_block_item_decls_2(p
):
2330 '''block_item_decls : block_item_decls block_item_decl '''
2331 print('block_item_decls_2', list(p
))
2333 def p_block_item_decls_opt_1(p
):
2334 '''block_item_decls_opt : block_item_decls '''
2335 print('block_item_decls_opt_1', list(p
))
2338 def p_block_item_decls_opt_2(p
):
2339 '''block_item_decls_opt : '''
2340 print('block_item_decls_opt_2', list(p
))
2343 def p_type_declaration_1(p
):
2344 '''type_declaration : K_typedef data_type IDENTIFIER dimensions_opt ';' '''
2345 print('type_declaration_1', list(p
))
2346 # { perm_string name = lex_strings.make($3);
2347 # pform_set_typedef(name, $2, $4);
2351 def p_type_declaration_2(p
):
2352 '''type_declaration : K_typedef data_type TYPE_IDENTIFIER ';' '''
2353 print('type_declaration_2', list(p
))
2354 # { perm_string name = lex_strings.make($3.text);
2355 # if (pform_test_type_identifier_local(name)) {
2356 # yyerror(@3, "error: Typedef identifier \"%s\" is already a type name.", $3.text);
2359 # pform_set_typedef(name, $2, NULL);
2364 def p_type_declaration_3(p
):
2365 '''type_declaration : K_typedef K_class IDENTIFIER ';' '''
2366 print('type_declaration_3', list(p
))
2367 # { // Create a synthetic typedef for the class name so that the
2368 # // lexor detects the name as a type.
2369 # perm_string name = lex_strings.make($3);
2370 # class_type_t*tmp = new class_type_t(name);
2371 # FILE_NAME(tmp, @3);
2372 # pform_set_typedef(name, tmp, NULL);
2376 def p_type_declaration_4(p
):
2377 '''type_declaration : K_typedef K_enum IDENTIFIER ';' '''
2378 print('type_declaration_4', list(p
))
2379 # { yyerror(@1, "sorry: Enum forward declarations not supported yet."); }
2381 def p_type_declaration_5(p
):
2382 '''type_declaration : K_typedef K_struct IDENTIFIER ';' '''
2383 print('type_declaration_5', list(p
))
2384 # { yyerror(@1, "sorry: Struct forward declarations not supported yet."); }
2386 def p_type_declaration_6(p
):
2387 '''type_declaration : K_typedef K_union IDENTIFIER ';' '''
2388 print('type_declaration_6', list(p
))
2389 # { yyerror(@1, "sorry: Union forward declarations not supported yet."); }
2391 def p_type_declaration_7(p
):
2392 '''type_declaration : K_typedef IDENTIFIER ';' '''
2393 print('type_declaration_7', list(p
))
2394 # { // Create a synthetic typedef for the class name so that the
2395 # // lexor detects the name as a type.
2396 # perm_string name = lex_strings.make($2);
2397 # class_type_t*tmp = new class_type_t(name);
2398 # FILE_NAME(tmp, @2);
2399 # pform_set_typedef(name, tmp, NULL);
2403 def p_type_declaration_8(p
):
2404 '''type_declaration : K_typedef error ';' '''
2405 print('type_declaration_8', list(p
))
2406 # { yyerror(@2, "error: Syntax error in typedef clause.");
2410 def p_enum_data_type_1(p
):
2411 '''enum_data_type : K_enum '{' enum_name_list '}' '''
2412 print('enum_data_type_1', list(p
))
2413 # { enum_type_t*enum_type = new enum_type_t;
2414 # FILE_NAME(enum_type, @1);
2415 # enum_type->names .reset($3);
2416 # enum_type->base_type = IVL_VT_BOOL;
2417 # enum_type->signed_flag = true;
2418 # enum_type->integer_flag = false;
2419 # enum_type->range.reset(make_range_from_width(32));
2423 def p_enum_data_type_2(p
):
2424 '''enum_data_type : K_enum atom2_type signed_unsigned_opt '{' enum_name_list '}' '''
2425 print('enum_data_type_2', list(p
))
2426 # { enum_type_t*enum_type = new enum_type_t;
2427 # FILE_NAME(enum_type, @1);
2428 # enum_type->names .reset($5);
2429 # enum_type->base_type = IVL_VT_BOOL;
2430 # enum_type->signed_flag = $3;
2431 # enum_type->integer_flag = false;
2432 # enum_type->range.reset(make_range_from_width($2));
2436 def p_enum_data_type_3(p
):
2437 '''enum_data_type : K_enum K_integer signed_unsigned_opt '{' enum_name_list '}' '''
2438 print('enum_data_type_3', list(p
))
2439 # { enum_type_t*enum_type = new enum_type_t;
2440 # FILE_NAME(enum_type, @1);
2441 # enum_type->names .reset($5);
2442 # enum_type->base_type = IVL_VT_LOGIC;
2443 # enum_type->signed_flag = $3;
2444 # enum_type->integer_flag = true;
2445 # enum_type->range.reset(make_range_from_width(integer_width));
2449 def p_enum_data_type_4(p
):
2450 '''enum_data_type : K_enum K_logic unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2451 print('enum_data_type_4', list(p
))
2452 # { enum_type_t*enum_type = new enum_type_t;
2453 # FILE_NAME(enum_type, @1);
2454 # enum_type->names .reset($6);
2455 # enum_type->base_type = IVL_VT_LOGIC;
2456 # enum_type->signed_flag = $3;
2457 # enum_type->integer_flag = false;
2458 # enum_type->range.reset($4 ? $4 : make_range_from_width(1));
2462 def p_enum_data_type_5(p
):
2463 '''enum_data_type : K_enum K_reg unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2464 print('enum_data_type_5', list(p
))
2465 # { enum_type_t*enum_type = new enum_type_t;
2466 # FILE_NAME(enum_type, @1);
2467 # enum_type->names .reset($6);
2468 # enum_type->base_type = IVL_VT_LOGIC;
2469 # enum_type->signed_flag = $3;
2470 # enum_type->integer_flag = false;
2471 # enum_type->range.reset($4 ? $4 : make_range_from_width(1));
2475 def p_enum_data_type_6(p
):
2476 '''enum_data_type : K_enum K_bit unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2477 print('enum_data_type_6', list(p
))
2478 # { enum_type_t*enum_type = new enum_type_t;
2479 # FILE_NAME(enum_type, @1);
2480 # enum_type->names .reset($6);
2481 # enum_type->base_type = IVL_VT_BOOL;
2482 # enum_type->signed_flag = $3;
2483 # enum_type->integer_flag = false;
2484 # enum_type->range.reset($4 ? $4 : make_range_from_width(1));
2488 def p_enum_name_list_1(p
):
2489 '''enum_name_list : enum_name '''
2490 print('enum_name_list_1', list(p
))
2494 def p_enum_name_list_2(p
):
2495 '''enum_name_list : enum_name_list ',' enum_name '''
2496 print('enum_name_list_2', list(p
))
2497 # { list<named_pexpr_t>*lst = $1;
2498 # lst->splice(lst->end(), *$3);
2503 def p_pos_neg_number_1(p
):
2504 '''pos_neg_number : number '''
2505 print('pos_neg_number_1', list(p
))
2509 def p_pos_neg_number_2(p
):
2510 '''pos_neg_number : '-' number '''
2511 print('pos_neg_number_2', list(p
))
2512 # { verinum tmp = -(*($2));
2517 def p_enum_name_1(p
):
2518 '''enum_name : IDENTIFIER '''
2519 print('enum_name_1', list(p
))
2520 # { perm_string name = lex_strings.make($1);
2522 # $$ = make_named_number(name);
2525 def p_enum_name_2(p
):
2526 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '''
2527 print('enum_name_2', list(p
))
2528 # { perm_string name = lex_strings.make($1);
2529 # long count = check_enum_seq_value(@1, $3, false);
2531 # $$ = make_named_numbers(name, 0, count-1);
2535 def p_enum_name_3(p
):
2536 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '''
2537 print('enum_name_3', list(p
))
2538 # { perm_string name = lex_strings.make($1);
2539 # $$ = make_named_numbers(name, check_enum_seq_value(@1, $3, true),
2540 # check_enum_seq_value(@1, $5, true));
2546 def p_enum_name_4(p
):
2547 '''enum_name : IDENTIFIER '=' expression '''
2548 print('enum_name_4', list(p
))
2549 # { perm_string name = lex_strings.make($1);
2551 # $$ = make_named_number(name, $3);
2554 def p_enum_name_5(p
):
2555 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '=' expression '''
2556 print('enum_name_5', list(p
))
2557 # { perm_string name = lex_strings.make($1);
2558 # long count = check_enum_seq_value(@1, $3, false);
2559 # $$ = make_named_numbers(name, 0, count-1, $6);
2564 def p_enum_name_6(p
):
2565 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '=' expression '''
2566 print('enum_name_6', list(p
))
2567 # { perm_string name = lex_strings.make($1);
2568 # $$ = make_named_numbers(name, check_enum_seq_value(@1, $3, true),
2569 # check_enum_seq_value(@1, $5, true), $8);
2575 def p_struct_data_type_1(p
):
2576 '''struct_data_type : K_struct K_packed_opt '{' struct_union_member_list '}' '''
2577 print('struct_data_type_1', list(p
))
2578 # { struct_type_t*tmp = new struct_type_t;
2579 # FILE_NAME(tmp, @1);
2580 # tmp->packed_flag = $2;
2581 # tmp->union_flag = false;
2582 # tmp->members .reset($4);
2586 def p_struct_data_type_2(p
):
2587 '''struct_data_type : K_union K_packed_opt '{' struct_union_member_list '}' '''
2588 print('struct_data_type_2', list(p
))
2589 # { struct_type_t*tmp = new struct_type_t;
2590 # FILE_NAME(tmp, @1);
2591 # tmp->packed_flag = $2;
2592 # tmp->union_flag = true;
2593 # tmp->members .reset($4);
2597 def p_struct_data_type_3(p
):
2598 '''struct_data_type : K_struct K_packed_opt '{' error '}' '''
2599 print('struct_data_type_3', list(p
))
2600 # { yyerror(@3, "error: Errors in struct member list.");
2602 # struct_type_t*tmp = new struct_type_t;
2603 # FILE_NAME(tmp, @1);
2604 # tmp->packed_flag = $2;
2605 # tmp->union_flag = false;
2609 def p_struct_data_type_4(p
):
2610 '''struct_data_type : K_union K_packed_opt '{' error '}' '''
2611 print('struct_data_type_4', list(p
))
2612 # { yyerror(@3, "error: Errors in union member list.");
2614 # struct_type_t*tmp = new struct_type_t;
2615 # FILE_NAME(tmp, @1);
2616 # tmp->packed_flag = $2;
2617 # tmp->union_flag = true;
2621 def p_struct_union_member_list_1(p
):
2622 '''struct_union_member_list : struct_union_member_list struct_union_member '''
2623 print('struct_union_member_list_1', list(p
))
2624 # { list<struct_member_t*>*tmp = $1;
2625 # tmp->push_back($2);
2629 def p_struct_union_member_list_2(p
):
2630 '''struct_union_member_list : struct_union_member '''
2631 print('struct_union_member_list_2', list(p
))
2632 # { list<struct_member_t*>*tmp = new list<struct_member_t*>;
2633 # tmp->push_back($1);
2637 def p_struct_union_member_1(p
):
2638 '''struct_union_member : attribute_list_opt data_type list_of_variable_decl_assignments ';' '''
2639 print('struct_union_member_1', list(p
))
2640 # { struct_member_t*tmp = new struct_member_t;
2641 # FILE_NAME(tmp, @2);
2642 # tmp->type .reset($2);
2643 # tmp->names .reset($3);
2647 def p_struct_union_member_2(p
):
2648 '''struct_union_member : error ';' '''
2649 print('struct_union_member_2', list(p
))
2650 # { yyerror(@2, "Error in struct/union member.");
2655 def p_case_item_1(p
):
2656 '''case_item : expression_list_proper ':' statement_or_null '''
2657 print('case_item_1', list(p
))
2658 # { PCase::Item*tmp = new PCase::Item;
2665 def p_case_item_2(p
):
2666 '''case_item : K_default ':' statement_or_null '''
2667 print('case_item_2', list(p
))
2668 # { PCase::Item*tmp = new PCase::Item;
2673 def p_case_item_3(p
):
2674 '''case_item : K_default statement_or_null '''
2675 print('case_item_3', list(p
))
2676 # { PCase::Item*tmp = new PCase::Item;
2681 def p_case_item_4(p
):
2682 '''case_item : error ':' statement_or_null '''
2683 print('case_item_4', list(p
))
2684 # { yyerror(@2, "error: Incomprehensible case expression.");
2688 def p_case_items_1(p
):
2689 '''case_items : case_items case_item '''
2690 print('case_items_1', list(p
))
2691 # { svector<PCase::Item*>*tmp;
2692 # tmp = new svector<PCase::Item*>(*$1, $2);
2697 def p_case_items_2(p
):
2698 '''case_items : case_item '''
2699 print('case_items_2', list(p
))
2700 # { svector<PCase::Item*>*tmp = new svector<PCase::Item*>(1);
2705 def p_charge_strength_1(p
):
2706 '''charge_strength : '(' K_small ')' '''
2707 print('charge_strength_1', list(p
))
2709 def p_charge_strength_2(p
):
2710 '''charge_strength : '(' K_medium ')' '''
2711 print('charge_strength_2', list(p
))
2713 def p_charge_strength_3(p
):
2714 '''charge_strength : '(' K_large ')' '''
2715 print('charge_strength_3', list(p
))
2717 def p_charge_strength_opt_1(p
):
2718 '''charge_strength_opt : charge_strength '''
2719 print('charge_strength_opt_1', list(p
))
2721 def p_charge_strength_opt_2(p
):
2722 '''charge_strength_opt : '''
2723 print('charge_strength_opt_2', list(p
))
2725 def p_defparam_assign_1(p
):
2726 '''defparam_assign : hierarchy_identifier '=' expression '''
2727 print('defparam_assign_1', list(p
))
2728 # { pform_set_defparam(*$1, $3);
2732 def p_defparam_assign_list_1(p
):
2733 '''defparam_assign_list : defparam_assign '''
2734 print('defparam_assign_list_1', list(p
))
2736 def p_defparam_assign_list_2(p
):
2737 '''defparam_assign_list : dimensions defparam_assign '''
2738 print('defparam_assign_list_2', list(p
))
2739 # { yyerror(@1, "error: defparam may not include a range.");
2743 def p_defparam_assign_list_3(p
):
2744 '''defparam_assign_list : defparam_assign_list ',' defparam_assign '''
2745 print('defparam_assign_list_3', list(p
))
2748 '''delay1 : '#' delay_value_simple '''
2749 print('delay1_1', list(p
))
2750 # { list<PExpr*>*tmp = new list<PExpr*>;
2751 # tmp->push_back($2);
2756 '''delay1 : '#' '(' delay_value ')' '''
2757 print('delay1_2', list(p
))
2758 # { list<PExpr*>*tmp = new list<PExpr*>;
2759 # tmp->push_back($3);
2764 '''delay3 : '#' delay_value_simple '''
2765 print('delay3_1', list(p
))
2766 # { list<PExpr*>*tmp = new list<PExpr*>;
2767 # tmp->push_back($2);
2772 '''delay3 : '#' '(' delay_value ')' '''
2773 print('delay3_2', list(p
))
2774 # { list<PExpr*>*tmp = new list<PExpr*>;
2775 # tmp->push_back($3);
2780 '''delay3 : '#' '(' delay_value ',' delay_value ')' '''
2781 print('delay3_3', list(p
))
2782 # { list<PExpr*>*tmp = new list<PExpr*>;
2783 # tmp->push_back($3);
2784 # tmp->push_back($5);
2789 '''delay3 : '#' '(' delay_value ',' delay_value ',' delay_value ')' '''
2790 print('delay3_4', list(p
))
2791 # { list<PExpr*>*tmp = new list<PExpr*>;
2792 # tmp->push_back($3);
2793 # tmp->push_back($5);
2794 # tmp->push_back($7);
2798 def p_delay3_opt_1(p
):
2799 '''delay3_opt : delay3 '''
2800 print('delay3_opt_1', list(p
))
2803 def p_delay3_opt_2(p
):
2805 print('delay3_opt_2', list(p
))
2808 def p_delay_value_list_1(p
):
2809 '''delay_value_list : delay_value '''
2810 print('delay_value_list_1', list(p
))
2811 # { list<PExpr*>*tmp = new list<PExpr*>;
2812 # tmp->push_back($1);
2816 def p_delay_value_list_2(p
):
2817 '''delay_value_list : delay_value_list ',' delay_value '''
2818 print('delay_value_list_2', list(p
))
2819 # { list<PExpr*>*tmp = $1;
2820 # tmp->push_back($3);
2824 def p_delay_value_1(p
):
2825 '''delay_value : expression '''
2826 print('delay_value_1', list(p
))
2831 def p_delay_value_2(p
):
2832 '''delay_value : expression ':' expression ':' expression '''
2833 print('delay_value_2', list(p
))
2834 # { $$ = pform_select_mtm_expr($1, $3, $5); }
2836 def p_delay_value_simple_1(p
):
2837 '''delay_value_simple : DEC_NUMBER '''
2838 print('delay_value_simple_1', list(p
))
2839 # { verinum*tmp = $1;
2841 # yyerror(@1, "internal error: delay.");
2844 # $$ = new PENumber(tmp);
2845 # FILE_NAME($$, @1);
2850 def p_delay_value_simple_2(p
):
2851 '''delay_value_simple : REALTIME '''
2852 print('delay_value_simple_2', list(p
))
2853 # { verireal*tmp = $1;
2855 # yyerror(@1, "internal error: delay.");
2858 # $$ = new PEFNumber(tmp);
2859 # FILE_NAME($$, @1);
2863 def p_delay_value_simple_3(p
):
2864 '''delay_value_simple : IDENTIFIER '''
2865 print('delay_value_simple_3', list(p
))
2866 # { PEIdent*tmp = new PEIdent(lex_strings.make($1));
2867 # FILE_NAME(tmp, @1);
2872 def p_delay_value_simple_4(p
):
2873 '''delay_value_simple : TIME_LITERAL '''
2874 print('delay_value_simple_4', list(p
))
2879 # if ($1 == 0 || !get_time_unit($1, unit))
2880 # yyerror(@1, "internal error: delay.");
2882 # double p = pow(10.0,
2883 # (double)(unit - pform_get_timeunit()));
2884 # double time = atof($1) * p;
2886 # verireal *v = new verireal(time);
2887 # $$ = new PEFNumber(v);
2888 # FILE_NAME($$, @1);
2892 def p_optional_semicolon_1(p
):
2893 '''optional_semicolon : ';' '''
2894 print('optional_semicolon_1', list(p
))
2896 def p_optional_semicolon_2(p
):
2897 '''optional_semicolon : '''
2898 print('optional_semicolon_2', list(p
))
2900 def p_discipline_declaration_1(p
):
2901 '''discipline_declaration : K_discipline IDENTIFIER optional_semicolon _embed0_discipline_declaration discipline_items K_enddiscipline '''
2902 print('discipline_declaration_1', list(p
))
2903 # { pform_end_discipline(@1); delete[] $2; }
2905 def p__embed0_discipline_declaration(p
):
2906 '''_embed0_discipline_declaration : '''
2907 # { pform_start_discipline($2); }
2909 def p_discipline_items_1(p
):
2910 '''discipline_items : discipline_items discipline_item '''
2911 print('discipline_items_1', list(p
))
2913 def p_discipline_items_2(p
):
2914 '''discipline_items : discipline_item '''
2915 print('discipline_items_2', list(p
))
2917 def p_discipline_item_1(p
):
2918 '''discipline_item : K_domain K_discrete ';' '''
2919 print('discipline_item_1', list(p
))
2920 # { pform_discipline_domain(@1, IVL_DIS_DISCRETE); }
2922 def p_discipline_item_2(p
):
2923 '''discipline_item : K_domain K_continuous ';' '''
2924 print('discipline_item_2', list(p
))
2925 # { pform_discipline_domain(@1, IVL_DIS_CONTINUOUS); }
2927 def p_discipline_item_3(p
):
2928 '''discipline_item : K_potential IDENTIFIER ';' '''
2929 print('discipline_item_3', list(p
))
2930 # { pform_discipline_potential(@1, $2); delete[] $2; }
2932 def p_discipline_item_4(p
):
2933 '''discipline_item : K_flow IDENTIFIER ';' '''
2934 print('discipline_item_4', list(p
))
2935 # { pform_discipline_flow(@1, $2); delete[] $2; }
2937 def p_nature_declaration_1(p
):
2938 '''nature_declaration : K_nature IDENTIFIER optional_semicolon _embed0_nature_declaration nature_items K_endnature '''
2939 print('nature_declaration_1', list(p
))
2940 # { pform_end_nature(@1); delete[] $2; }
2942 def p__embed0_nature_declaration(p
):
2943 '''_embed0_nature_declaration : '''
2944 # { pform_start_nature($2); }
2946 def p_nature_items_1(p
):
2947 '''nature_items : nature_items nature_item '''
2948 print('nature_items_1', list(p
))
2950 def p_nature_items_2(p
):
2951 '''nature_items : nature_item '''
2952 print('nature_items_2', list(p
))
2954 def p_nature_item_1(p
):
2955 '''nature_item : K_units '=' STRING ';' '''
2956 print('nature_item_1', list(p
))
2959 def p_nature_item_2(p
):
2960 '''nature_item : K_abstol '=' expression ';' '''
2961 print('nature_item_2', list(p
))
2963 def p_nature_item_3(p
):
2964 '''nature_item : K_access '=' IDENTIFIER ';' '''
2965 print('nature_item_3', list(p
))
2966 # { pform_nature_access(@1, $3); delete[] $3; }
2968 def p_nature_item_4(p
):
2969 '''nature_item : K_idt_nature '=' IDENTIFIER ';' '''
2970 print('nature_item_4', list(p
))
2973 def p_nature_item_5(p
):
2974 '''nature_item : K_ddt_nature '=' IDENTIFIER ';' '''
2975 print('nature_item_5', list(p
))
2978 def p_config_declaration_1(p
):
2979 '''config_declaration : K_config IDENTIFIER ';' K_design lib_cell_identifiers ';' list_of_config_rule_statements K_endconfig '''
2980 print('config_declaration_1', list(p
))
2981 # { cerr << @1 << ": sorry: config declarations are not supported and "
2982 # "will be skipped." << endl;
2986 def p_lib_cell_identifiers_1(p
):
2987 '''lib_cell_identifiers : '''
2988 print('lib_cell_identifiers_1', list(p
))
2990 def p_lib_cell_identifiers_2(p
):
2991 '''lib_cell_identifiers : lib_cell_identifiers lib_cell_id '''
2992 print('lib_cell_identifiers_2', list(p
))
2994 def p_list_of_config_rule_statements_1(p
):
2995 '''list_of_config_rule_statements : '''
2996 print('list_of_config_rule_statements_1', list(p
))
2998 def p_list_of_config_rule_statements_2(p
):
2999 '''list_of_config_rule_statements : list_of_config_rule_statements config_rule_statement '''
3000 print('list_of_config_rule_statements_2', list(p
))
3002 def p_config_rule_statement_1(p
):
3003 '''config_rule_statement : K_default K_liblist list_of_libraries ';' '''
3004 print('config_rule_statement_1', list(p
))
3006 def p_config_rule_statement_2(p
):
3007 '''config_rule_statement : K_instance hierarchy_identifier K_liblist list_of_libraries ';' '''
3008 print('config_rule_statement_2', list(p
))
3011 def p_config_rule_statement_3(p
):
3012 '''config_rule_statement : K_instance hierarchy_identifier K_use lib_cell_id opt_config ';' '''
3013 print('config_rule_statement_3', list(p
))
3016 def p_config_rule_statement_4(p
):
3017 '''config_rule_statement : K_cell lib_cell_id K_liblist list_of_libraries ';' '''
3018 print('config_rule_statement_4', list(p
))
3020 def p_config_rule_statement_5(p
):
3021 '''config_rule_statement : K_cell lib_cell_id K_use lib_cell_id opt_config ';' '''
3022 print('config_rule_statement_5', list(p
))
3024 def p_opt_config_1(p
):
3026 print('opt_config_1', list(p
))
3028 def p_opt_config_2(p
):
3029 '''opt_config : ':' K_config '''
3030 print('opt_config_2', list(p
))
3032 def p_lib_cell_id_1(p
):
3033 '''lib_cell_id : IDENTIFIER '''
3034 print('lib_cell_id_1', list(p
))
3037 def p_lib_cell_id_2(p
):
3038 '''lib_cell_id : IDENTIFIER '.' IDENTIFIER '''
3039 print('lib_cell_id_2', list(p
))
3040 # { delete[] $1; delete[] $3; }
3042 def p_list_of_libraries_1(p
):
3043 '''list_of_libraries : '''
3044 print('list_of_libraries_1', list(p
))
3046 def p_list_of_libraries_2(p
):
3047 '''list_of_libraries : list_of_libraries IDENTIFIER '''
3048 print('list_of_libraries_2', list(p
))
3051 def p_drive_strength_1(p
):
3052 '''drive_strength : '(' dr_strength0 ',' dr_strength1 ')' '''
3053 print('drive_strength_1', list(p
))
3054 # { $$.str0 = $2.str0;
3055 # $$.str1 = $4.str1;
3058 def p_drive_strength_2(p
):
3059 '''drive_strength : '(' dr_strength1 ',' dr_strength0 ')' '''
3060 print('drive_strength_2', list(p
))
3061 # { $$.str0 = $4.str0;
3062 # $$.str1 = $2.str1;
3065 def p_drive_strength_3(p
):
3066 '''drive_strength : '(' dr_strength0 ',' K_highz1 ')' '''
3067 print('drive_strength_3', list(p
))
3068 # { $$.str0 = $2.str0;
3069 # $$.str1 = IVL_DR_HiZ;
3072 def p_drive_strength_4(p
):
3073 '''drive_strength : '(' dr_strength1 ',' K_highz0 ')' '''
3074 print('drive_strength_4', list(p
))
3075 # { $$.str0 = IVL_DR_HiZ;
3076 # $$.str1 = $2.str1;
3079 def p_drive_strength_5(p
):
3080 '''drive_strength : '(' K_highz1 ',' dr_strength0 ')' '''
3081 print('drive_strength_5', list(p
))
3082 # { $$.str0 = $4.str0;
3083 # $$.str1 = IVL_DR_HiZ;
3086 def p_drive_strength_6(p
):
3087 '''drive_strength : '(' K_highz0 ',' dr_strength1 ')' '''
3088 print('drive_strength_6', list(p
))
3089 # { $$.str0 = IVL_DR_HiZ;
3090 # $$.str1 = $4.str1;
3093 def p_drive_strength_opt_1(p
):
3094 '''drive_strength_opt : drive_strength '''
3095 print('drive_strength_opt_1', list(p
))
3098 def p_drive_strength_opt_2(p
):
3099 '''drive_strength_opt : '''
3100 print('drive_strength_opt_2', list(p
))
3101 # { $$.str0 = IVL_DR_STRONG; $$.str1 = IVL_DR_STRONG; }
3103 def p_dr_strength0_1(p
):
3104 '''dr_strength0 : K_supply0 '''
3105 print('dr_strength0_1', list(p
))
3106 # { $$.str0 = IVL_DR_SUPPLY; }
3108 def p_dr_strength0_2(p
):
3109 '''dr_strength0 : K_strong0 '''
3110 print('dr_strength0_2', list(p
))
3111 # { $$.str0 = IVL_DR_STRONG; }
3113 def p_dr_strength0_3(p
):
3114 '''dr_strength0 : K_pull0 '''
3115 print('dr_strength0_3', list(p
))
3116 # { $$.str0 = IVL_DR_PULL; }
3118 def p_dr_strength0_4(p
):
3119 '''dr_strength0 : K_weak0 '''
3120 print('dr_strength0_4', list(p
))
3121 # { $$.str0 = IVL_DR_WEAK; }
3123 def p_dr_strength1_1(p
):
3124 '''dr_strength1 : K_supply1 '''
3125 print('dr_strength1_1', list(p
))
3126 # { $$.str1 = IVL_DR_SUPPLY; }
3128 def p_dr_strength1_2(p
):
3129 '''dr_strength1 : K_strong1 '''
3130 print('dr_strength1_2', list(p
))
3131 # { $$.str1 = IVL_DR_STRONG; }
3133 def p_dr_strength1_3(p
):
3134 '''dr_strength1 : K_pull1 '''
3135 print('dr_strength1_3', list(p
))
3136 # { $$.str1 = IVL_DR_PULL; }
3138 def p_dr_strength1_4(p
):
3139 '''dr_strength1 : K_weak1 '''
3140 print('dr_strength1_4', list(p
))
3141 # { $$.str1 = IVL_DR_WEAK; }
3143 def p_clocking_event_opt_1(p
):
3144 '''clocking_event_opt : event_control '''
3145 print('clocking_event_opt_1', list(p
))
3147 def p_clocking_event_opt_2(p
):
3148 '''clocking_event_opt : '''
3149 print('clocking_event_opt_2', list(p
))
3151 def p_event_control_1(p
):
3152 '''event_control : '@' hierarchy_identifier '''
3153 print('event_control_1', list(p
))
3154 # { PEIdent*tmpi = new PEIdent(*$2);
3155 # PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi);
3156 # PEventStatement*tmps = new PEventStatement(tmpe);
3157 # FILE_NAME(tmps, @1);
3162 def p_event_control_2(p
):
3163 '''event_control : '@' '(' event_expression_list ')' '''
3164 print('event_control_2', list(p
))
3165 # { PEventStatement*tmp = new PEventStatement(*$3);
3166 # FILE_NAME(tmp, @1);
3171 def p_event_control_3(p
):
3172 '''event_control : '@' '(' error ')' '''
3173 print('event_control_3', list(p
))
3174 # { yyerror(@1, "error: Malformed event control expression.");
3178 def p_event_expression_list_1(p
):
3179 '''event_expression_list : event_expression '''
3180 print('event_expression_list_1', list(p
))
3183 def p_event_expression_list_2(p
):
3184 '''event_expression_list : event_expression_list K_or event_expression '''
3185 print('event_expression_list_2', list(p
))
3186 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*$1, *$3);
3192 def p_event_expression_list_3(p
):
3193 '''event_expression_list : event_expression_list ',' event_expression '''
3194 print('event_expression_list_3', list(p
))
3195 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*$1, *$3);
3201 def p_event_expression_1(p
):
3202 '''event_expression : K_posedge expression '''
3203 print('event_expression_1', list(p
))
3204 # { PEEvent*tmp = new PEEvent(PEEvent::POSEDGE, $2);
3205 # FILE_NAME(tmp, @1);
3206 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3211 def p_event_expression_2(p
):
3212 '''event_expression : K_negedge expression '''
3213 print('event_expression_2', list(p
))
3214 # { PEEvent*tmp = new PEEvent(PEEvent::NEGEDGE, $2);
3215 # FILE_NAME(tmp, @1);
3216 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3221 def p_event_expression_3(p
):
3222 '''event_expression : expression '''
3223 print('event_expression_3', list(p
))
3224 # { PEEvent*tmp = new PEEvent(PEEvent::ANYEDGE, $1);
3225 # FILE_NAME(tmp, @1);
3226 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3231 def p_branch_probe_expression_1(p
):
3232 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ',' IDENTIFIER ')' '''
3233 print('branch_probe_expression_1', list(p
))
3234 # { $$ = pform_make_branch_probe_expression(@1, $1, $3, $5); }
3236 def p_branch_probe_expression_2(p
):
3237 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ')' '''
3238 print('branch_probe_expression_2', list(p
))
3239 # { $$ = pform_make_branch_probe_expression(@1, $1, $3); }
3241 def p_expression_1(p
):
3242 '''expression : expr_primary_or_typename '''
3243 print('expression_1', list(p
))
3246 def p_expression_2(p
):
3247 '''expression : inc_or_dec_expression '''
3248 print('expression_2', list(p
))
3251 def p_expression_3(p
):
3252 '''expression : inside_expression '''
3253 print('expression_3', list(p
))
3256 def p_expression_4(p
):
3257 '''expression : '+' attribute_list_opt expr_primary %prec UNARY_PREC '''
3258 print('expression_4', list(p
))
3261 def p_expression_5(p
):
3262 '''expression : '-' attribute_list_opt expr_primary %prec UNARY_PREC '''
3263 print('expression_5', list(p
))
3264 # { PEUnary*tmp = new PEUnary('-', $3);
3265 # FILE_NAME(tmp, @3);
3269 def p_expression_6(p
):
3270 '''expression : '~' attribute_list_opt expr_primary %prec UNARY_PREC '''
3271 print('expression_6', list(p
))
3272 # { PEUnary*tmp = new PEUnary('~', $3);
3273 # FILE_NAME(tmp, @3);
3277 def p_expression_7(p
):
3278 '''expression : '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3279 print('expression_7', list(p
))
3280 # { PEUnary*tmp = new PEUnary('&', $3);
3281 # FILE_NAME(tmp, @3);
3285 def p_expression_8(p
):
3286 '''expression : '!' attribute_list_opt expr_primary %prec UNARY_PREC '''
3287 print('expression_8', list(p
))
3288 # { PEUnary*tmp = new PEUnary('!', $3);
3289 # FILE_NAME(tmp, @3);
3293 def p_expression_9(p
):
3294 '''expression : '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3295 print('expression_9', list(p
))
3296 # { PEUnary*tmp = new PEUnary('|', $3);
3297 # FILE_NAME(tmp, @3);
3301 def p_expression_10(p
):
3302 '''expression : '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3303 print('expression_10', list(p
))
3304 # { PEUnary*tmp = new PEUnary('^', $3);
3305 # FILE_NAME(tmp, @3);
3309 def p_expression_11(p
):
3310 '''expression : '~' '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3311 print('expression_11', list(p
))
3312 # { yyerror(@1, "error: '~' '&' is not a valid expression. "
3313 # "Please use operator '~&' instead.");
3317 def p_expression_12(p
):
3318 '''expression : '~' '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3319 print('expression_12', list(p
))
3320 # { yyerror(@1, "error: '~' '|' is not a valid expression. "
3321 # "Please use operator '~|' instead.");
3325 def p_expression_13(p
):
3326 '''expression : '~' '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3327 print('expression_13', list(p
))
3328 # { yyerror(@1, "error: '~' '^' is not a valid expression. "
3329 # "Please use operator '~^' instead.");
3333 def p_expression_14(p
):
3334 '''expression : K_NAND attribute_list_opt expr_primary %prec UNARY_PREC '''
3335 print('expression_14', list(p
))
3336 # { PEUnary*tmp = new PEUnary('A', $3);
3337 # FILE_NAME(tmp, @3);
3341 def p_expression_15(p
):
3342 '''expression : K_NOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3343 print('expression_15', list(p
))
3344 # { PEUnary*tmp = new PEUnary('N', $3);
3345 # FILE_NAME(tmp, @3);
3349 def p_expression_16(p
):
3350 '''expression : K_NXOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3351 print('expression_16', list(p
))
3352 # { PEUnary*tmp = new PEUnary('X', $3);
3353 # FILE_NAME(tmp, @3);
3357 def p_expression_17(p
):
3358 '''expression : '!' error %prec UNARY_PREC '''
3359 print('expression_17', list(p
))
3360 # { yyerror(@1, "error: Operand of unary ! "
3361 # "is not a primary expression.");
3365 def p_expression_18(p
):
3366 '''expression : '^' error %prec UNARY_PREC '''
3367 print('expression_18', list(p
))
3368 # { yyerror(@1, "error: Operand of reduction ^ "
3369 # "is not a primary expression.");
3373 def p_expression_19(p
):
3374 '''expression : expression '^' attribute_list_opt expression '''
3375 print('expression_19', list(p
))
3376 # { PEBinary*tmp = new PEBinary('^', $1, $4);
3377 # FILE_NAME(tmp, @2);
3381 def p_expression_20(p
):
3382 '''expression : expression K_POW attribute_list_opt expression '''
3383 print('expression_20', list(p
))
3384 # { PEBinary*tmp = new PEBPower('p', $1, $4);
3385 # FILE_NAME(tmp, @2);
3389 def p_expression_21(p
):
3390 '''expression : expression '*' attribute_list_opt expression '''
3391 print('expression_21', list(p
))
3392 # { PEBinary*tmp = new PEBinary('*', $1, $4);
3393 # FILE_NAME(tmp, @2);
3397 def p_expression_22(p
):
3398 '''expression : expression '/' attribute_list_opt expression '''
3399 print('expression_22', list(p
))
3400 # { PEBinary*tmp = new PEBinary('/', $1, $4);
3401 # FILE_NAME(tmp, @2);
3405 def p_expression_23(p
):
3406 '''expression : expression '%' attribute_list_opt expression '''
3407 print('expression_23', list(p
))
3408 # { PEBinary*tmp = new PEBinary('%', $1, $4);
3409 # FILE_NAME(tmp, @2);
3413 def p_expression_24(p
):
3414 '''expression : expression '+' attribute_list_opt expression '''
3415 print('expression_24', list(p
))
3416 # { PEBinary*tmp = new PEBinary('+', $1, $4);
3417 # FILE_NAME(tmp, @2);
3421 def p_expression_25(p
):
3422 '''expression : expression '-' attribute_list_opt expression '''
3423 print('expression_25', list(p
))
3424 # { PEBinary*tmp = new PEBinary('-', $1, $4);
3425 # FILE_NAME(tmp, @2);
3429 def p_expression_26(p
):
3430 '''expression : expression '&' attribute_list_opt expression '''
3431 print('expression_26', list(p
))
3432 # { PEBinary*tmp = new PEBinary('&', $1, $4);
3433 # FILE_NAME(tmp, @2);
3437 def p_expression_27(p
):
3438 '''expression : expression '|' attribute_list_opt expression '''
3439 print('expression_27', list(p
))
3440 # { PEBinary*tmp = new PEBinary('|', $1, $4);
3441 # FILE_NAME(tmp, @2);
3445 def p_expression_28(p
):
3446 '''expression : expression K_NAND attribute_list_opt expression '''
3447 print('expression_28', list(p
))
3448 # { PEBinary*tmp = new PEBinary('A', $1, $4);
3449 # FILE_NAME(tmp, @2);
3453 def p_expression_29(p
):
3454 '''expression : expression K_NOR attribute_list_opt expression '''
3455 print('expression_29', list(p
))
3456 # { PEBinary*tmp = new PEBinary('O', $1, $4);
3457 # FILE_NAME(tmp, @2);
3461 def p_expression_30(p
):
3462 '''expression : expression K_NXOR attribute_list_opt expression '''
3463 print('expression_30', list(p
))
3464 # { PEBinary*tmp = new PEBinary('X', $1, $4);
3465 # FILE_NAME(tmp, @2);
3469 def p_expression_31(p
):
3470 '''expression : expression '<' attribute_list_opt expression '''
3471 print('expression_31', list(p
))
3472 # { PEBinary*tmp = new PEBComp('<', $1, $4);
3473 # FILE_NAME(tmp, @2);
3477 def p_expression_32(p
):
3478 '''expression : expression '>' attribute_list_opt expression '''
3479 print('expression_32', list(p
))
3480 # { PEBinary*tmp = new PEBComp('>', $1, $4);
3481 # FILE_NAME(tmp, @2);
3485 def p_expression_33(p
):
3486 '''expression : expression K_LS attribute_list_opt expression '''
3487 print('expression_33', list(p
))
3488 # { PEBinary*tmp = new PEBShift('l', $1, $4);
3489 # FILE_NAME(tmp, @2);
3493 def p_expression_34(p
):
3494 '''expression : expression K_RS attribute_list_opt expression '''
3495 print('expression_34', list(p
))
3496 # { PEBinary*tmp = new PEBShift('r', $1, $4);
3497 # FILE_NAME(tmp, @2);
3501 def p_expression_35(p
):
3502 '''expression : expression K_RSS attribute_list_opt expression '''
3503 print('expression_35', list(p
))
3504 # { PEBinary*tmp = new PEBShift('R', $1, $4);
3505 # FILE_NAME(tmp, @2);
3509 def p_expression_36(p
):
3510 '''expression : expression K_EQ attribute_list_opt expression '''
3511 print('expression_36', list(p
))
3512 # { PEBinary*tmp = new PEBComp('e', $1, $4);
3513 # FILE_NAME(tmp, @2);
3517 def p_expression_37(p
):
3518 '''expression : expression K_CEQ attribute_list_opt expression '''
3519 print('expression_37', list(p
))
3520 # { PEBinary*tmp = new PEBComp('E', $1, $4);
3521 # FILE_NAME(tmp, @2);
3525 def p_expression_38(p
):
3526 '''expression : expression K_WEQ attribute_list_opt expression '''
3527 print('expression_38', list(p
))
3528 # { PEBinary*tmp = new PEBComp('w', $1, $4);
3529 # FILE_NAME(tmp, @2);
3533 def p_expression_39(p
):
3534 '''expression : expression K_LE attribute_list_opt expression '''
3535 print('expression_39', list(p
))
3536 # { PEBinary*tmp = new PEBComp('L', $1, $4);
3537 # FILE_NAME(tmp, @2);
3541 def p_expression_40(p
):
3542 '''expression : expression K_GE attribute_list_opt expression '''
3543 print('expression_40', list(p
))
3544 # { PEBinary*tmp = new PEBComp('G', $1, $4);
3545 # FILE_NAME(tmp, @2);
3549 def p_expression_41(p
):
3550 '''expression : expression K_NE attribute_list_opt expression '''
3551 print('expression_41', list(p
))
3552 # { PEBinary*tmp = new PEBComp('n', $1, $4);
3553 # FILE_NAME(tmp, @2);
3557 def p_expression_42(p
):
3558 '''expression : expression K_CNE attribute_list_opt expression '''
3559 print('expression_42', list(p
))
3560 # { PEBinary*tmp = new PEBComp('N', $1, $4);
3561 # FILE_NAME(tmp, @2);
3565 def p_expression_43(p
):
3566 '''expression : expression K_WNE attribute_list_opt expression '''
3567 print('expression_43', list(p
))
3568 # { PEBinary*tmp = new PEBComp('W', $1, $4);
3569 # FILE_NAME(tmp, @2);
3573 def p_expression_44(p
):
3574 '''expression : expression K_LOR attribute_list_opt expression '''
3575 print('expression_44', list(p
))
3576 # { PEBinary*tmp = new PEBLogic('o', $1, $4);
3577 # FILE_NAME(tmp, @2);
3581 def p_expression_45(p
):
3582 '''expression : expression K_LAND attribute_list_opt expression '''
3583 print('expression_45', list(p
))
3584 # { PEBinary*tmp = new PEBLogic('a', $1, $4);
3585 # FILE_NAME(tmp, @2);
3589 def p_expression_46(p
):
3590 '''expression : expression '?' attribute_list_opt expression ':' expression '''
3591 print('expression_46', list(p
))
3592 # { PETernary*tmp = new PETernary($1, $4, $6);
3593 # FILE_NAME(tmp, @2);
3597 def p_expr_mintypmax_1(p
):
3598 '''expr_mintypmax : expression '''
3599 print('expr_mintypmax_1', list(p
))
3602 def p_expr_mintypmax_2(p
):
3603 '''expr_mintypmax : expression ':' expression ':' expression '''
3604 print('expr_mintypmax_2', list(p
))
3605 # { switch (min_typ_max_flag) {
3622 # if (min_typ_max_warn > 0) {
3623 # cerr << $$->get_fileline() << ": warning: choosing ";
3624 # switch (min_typ_max_flag) {
3635 # cerr << " expression." << endl;
3636 # min_typ_max_warn -= 1;
3640 def p_expression_list_with_nuls_1(p
):
3641 '''expression_list_with_nuls : expression_list_with_nuls ',' expression '''
3642 print('expression_list_with_nuls_1', list(p
))
3643 # { list<PExpr*>*tmp = $1;
3644 # tmp->push_back($3);
3648 def p_expression_list_with_nuls_2(p
):
3649 '''expression_list_with_nuls : expression '''
3650 print('expression_list_with_nuls_2', list(p
))
3651 # { list<PExpr*>*tmp = new list<PExpr*>;
3652 # tmp->push_back($1);
3656 def p_expression_list_with_nuls_3(p
):
3657 '''expression_list_with_nuls : '''
3658 print('expression_list_with_nuls_3', list(p
))
3659 # { list<PExpr*>*tmp = new list<PExpr*>;
3660 # tmp->push_back(0);
3664 def p_expression_list_with_nuls_4(p
):
3665 '''expression_list_with_nuls : expression_list_with_nuls ',' '''
3666 print('expression_list_with_nuls_4', list(p
))
3667 # { list<PExpr*>*tmp = $1;
3668 # tmp->push_back(0);
3672 def p_expression_list_proper_1(p
):
3673 '''expression_list_proper : expression_list_proper ',' expression '''
3674 print('expression_list_proper_1', list(p
))
3675 # { list<PExpr*>*tmp = $1;
3676 # tmp->push_back($3);
3680 def p_expression_list_proper_2(p
):
3681 '''expression_list_proper : expression '''
3682 print('expression_list_proper_2', list(p
))
3683 # { list<PExpr*>*tmp = new list<PExpr*>;
3684 # tmp->push_back($1);
3688 def p_expr_primary_or_typename_1(p
):
3689 '''expr_primary_or_typename : expr_primary '''
3690 print('expr_primary_or_typename_1', list(p
))
3693 def p_expr_primary_or_typename_2(p
):
3694 '''expr_primary_or_typename : TYPE_IDENTIFIER '''
3695 print('expr_primary_or_typename_2', list(p
))
3697 # { PETypename*tmp = new PETypename($1.type);
3698 # FILE_NAME(tmp,@1);
3703 def p_expr_primary_1(p
):
3704 '''expr_primary : number '''
3705 print('expr_primary_1', list(p
))
3708 # PENumber*tmp = new PENumber($1);
3709 # FILE_NAME(tmp, @1);
3713 def p_expr_primary_2(p
):
3714 '''expr_primary : REALTIME '''
3715 print('expr_primary_2', list(p
))
3716 # { PEFNumber*tmp = new PEFNumber($1);
3717 # FILE_NAME(tmp, @1);
3721 def p_expr_primary_3(p
):
3722 '''expr_primary : STRING '''
3723 print('expr_primary_3', list(p
))
3724 # { PEString*tmp = new PEString($1);
3725 # FILE_NAME(tmp, @1);
3729 def p_expr_primary_4(p
):
3730 '''expr_primary : TIME_LITERAL '''
3731 print('expr_primary_4', list(p
))
3736 # if ($1 == 0 || !get_time_unit($1, unit))
3737 # yyerror(@1, "internal error: delay.");
3739 # double p = pow(10.0, (double)(unit - pform_get_timeunit()));
3740 # double time = atof($1) * p;
3742 # verireal *v = new verireal(time);
3743 # $$ = new PEFNumber(v);
3744 # FILE_NAME($$, @1);
3748 def p_expr_primary_5(p
):
3749 '''expr_primary : SYSTEM_IDENTIFIER '''
3750 print('expr_primary_5', list(p
))
3751 # { perm_string tn = lex_strings.make($1);
3752 # PECallFunction*tmp = new PECallFunction(tn);
3753 # FILE_NAME(tmp, @1);
3758 def p_expr_primary_6(p
):
3759 '''expr_primary : hierarchy_identifier '''
3760 print('expr_primary_6', list(p
))
3762 # { PEIdent*tmp = pform_new_ident(*$1);
3763 # FILE_NAME(tmp, @1);
3768 def p_expr_primary_7(p
):
3769 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier '''
3770 print('expr_primary_7', list(p
))
3771 # { $$ = pform_package_ident(@2, $1, $3);
3775 def p_expr_primary_8(p
):
3776 '''expr_primary : hierarchy_identifier '(' expression_list_with_nuls ')' '''
3777 print('expr_primary_8', list(p
))
3778 # { list<PExpr*>*expr_list = $3;
3779 # strip_tail_items(expr_list);
3780 # PECallFunction*tmp = pform_make_call_function(@1, *$1, *expr_list);
3785 def p_expr_primary_9(p
):
3786 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' '''
3787 print('expr_primary_9', list(p
))
3788 # { pform_name_t*t_name = $1;
3789 # while (! $3->empty()) {
3790 # t_name->push_back($3->front());
3793 # list<PExpr*>*expr_list = $5;
3794 # strip_tail_items(expr_list);
3795 # PECallFunction*tmp = pform_make_call_function(@1, *t_name, *expr_list);
3801 def p_expr_primary_10(p
):
3802 '''expr_primary : SYSTEM_IDENTIFIER '(' expression_list_proper ')' '''
3803 print('expr_primary_10', list(p
))
3804 # { perm_string tn = lex_strings.make($1);
3805 # PECallFunction*tmp = new PECallFunction(tn, *$3);
3806 # FILE_NAME(tmp, @1);
3811 def p_expr_primary_11(p
):
3812 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')' '''
3813 print('expr_primary_11', list(p
))
3814 # { perm_string use_name = lex_strings.make($3);
3815 # PECallFunction*tmp = new PECallFunction($1, use_name, *$5);
3816 # FILE_NAME(tmp, @3);
3821 def p_expr_primary_12(p
):
3822 '''expr_primary : SYSTEM_IDENTIFIER '(' ')' '''
3823 print('expr_primary_12', list(p
))
3824 # { perm_string tn = lex_strings.make($1);
3825 # const vector<PExpr*>empty;
3826 # PECallFunction*tmp = new PECallFunction(tn, empty);
3827 # FILE_NAME(tmp, @1);
3830 # if (!gn_system_verilog()) {
3831 # yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
3835 def p_expr_primary_13(p
):
3836 '''expr_primary : implicit_class_handle '''
3837 print('expr_primary_13', list(p
))
3838 # { PEIdent*tmp = new PEIdent(*$1);
3839 # FILE_NAME(tmp,@1);
3844 def p_expr_primary_14(p
):
3845 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '''
3846 print('expr_primary_14', list(p
))
3847 # { pform_name_t*t_name = $1;
3848 # while (! $3->empty()) {
3849 # t_name->push_back($3->front());
3852 # PEIdent*tmp = new PEIdent(*t_name);
3853 # FILE_NAME(tmp,@1);
3859 def p_expr_primary_15(p
):
3860 '''expr_primary : K_acos '(' expression ')' '''
3861 print('expr_primary_15', list(p
))
3862 # { perm_string tn = perm_string::literal("$acos");
3863 # PECallFunction*tmp = make_call_function(tn, $3);
3864 # FILE_NAME(tmp,@1);
3868 def p_expr_primary_16(p
):
3869 '''expr_primary : K_acosh '(' expression ')' '''
3870 print('expr_primary_16', list(p
))
3871 # { perm_string tn = perm_string::literal("$acosh");
3872 # PECallFunction*tmp = make_call_function(tn, $3);
3873 # FILE_NAME(tmp,@1);
3877 def p_expr_primary_17(p
):
3878 '''expr_primary : K_asin '(' expression ')' '''
3879 print('expr_primary_17', list(p
))
3880 # { perm_string tn = perm_string::literal("$asin");
3881 # PECallFunction*tmp = make_call_function(tn, $3);
3882 # FILE_NAME(tmp,@1);
3886 def p_expr_primary_18(p
):
3887 '''expr_primary : K_asinh '(' expression ')' '''
3888 print('expr_primary_18', list(p
))
3889 # { perm_string tn = perm_string::literal("$asinh");
3890 # PECallFunction*tmp = make_call_function(tn, $3);
3891 # FILE_NAME(tmp,@1);
3895 def p_expr_primary_19(p
):
3896 '''expr_primary : K_atan '(' expression ')' '''
3897 print('expr_primary_19', list(p
))
3898 # { perm_string tn = perm_string::literal("$atan");
3899 # PECallFunction*tmp = make_call_function(tn, $3);
3900 # FILE_NAME(tmp,@1);
3904 def p_expr_primary_20(p
):
3905 '''expr_primary : K_atanh '(' expression ')' '''
3906 print('expr_primary_20', list(p
))
3907 # { perm_string tn = perm_string::literal("$atanh");
3908 # PECallFunction*tmp = make_call_function(tn, $3);
3909 # FILE_NAME(tmp,@1);
3913 def p_expr_primary_21(p
):
3914 '''expr_primary : K_atan2 '(' expression ',' expression ')' '''
3915 print('expr_primary_21', list(p
))
3916 # { perm_string tn = perm_string::literal("$atan2");
3917 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3918 # FILE_NAME(tmp,@1);
3922 def p_expr_primary_22(p
):
3923 '''expr_primary : K_ceil '(' expression ')' '''
3924 print('expr_primary_22', list(p
))
3925 # { perm_string tn = perm_string::literal("$ceil");
3926 # PECallFunction*tmp = make_call_function(tn, $3);
3927 # FILE_NAME(tmp,@1);
3931 def p_expr_primary_23(p
):
3932 '''expr_primary : K_cos '(' expression ')' '''
3933 print('expr_primary_23', list(p
))
3934 # { perm_string tn = perm_string::literal("$cos");
3935 # PECallFunction*tmp = make_call_function(tn, $3);
3936 # FILE_NAME(tmp,@1);
3940 def p_expr_primary_24(p
):
3941 '''expr_primary : K_cosh '(' expression ')' '''
3942 print('expr_primary_24', list(p
))
3943 # { perm_string tn = perm_string::literal("$cosh");
3944 # PECallFunction*tmp = make_call_function(tn, $3);
3945 # FILE_NAME(tmp,@1);
3949 def p_expr_primary_25(p
):
3950 '''expr_primary : K_exp '(' expression ')' '''
3951 print('expr_primary_25', list(p
))
3952 # { perm_string tn = perm_string::literal("$exp");
3953 # PECallFunction*tmp = make_call_function(tn, $3);
3954 # FILE_NAME(tmp,@1);
3958 def p_expr_primary_26(p
):
3959 '''expr_primary : K_floor '(' expression ')' '''
3960 print('expr_primary_26', list(p
))
3961 # { perm_string tn = perm_string::literal("$floor");
3962 # PECallFunction*tmp = make_call_function(tn, $3);
3963 # FILE_NAME(tmp,@1);
3967 def p_expr_primary_27(p
):
3968 '''expr_primary : K_hypot '(' expression ',' expression ')' '''
3969 print('expr_primary_27', list(p
))
3970 # { perm_string tn = perm_string::literal("$hypot");
3971 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3972 # FILE_NAME(tmp,@1);
3976 def p_expr_primary_28(p
):
3977 '''expr_primary : K_ln '(' expression ')' '''
3978 print('expr_primary_28', list(p
))
3979 # { perm_string tn = perm_string::literal("$ln");
3980 # PECallFunction*tmp = make_call_function(tn, $3);
3981 # FILE_NAME(tmp,@1);
3985 def p_expr_primary_29(p
):
3986 '''expr_primary : K_log '(' expression ')' '''
3987 print('expr_primary_29', list(p
))
3988 # { perm_string tn = perm_string::literal("$log10");
3989 # PECallFunction*tmp = make_call_function(tn, $3);
3990 # FILE_NAME(tmp,@1);
3994 def p_expr_primary_30(p
):
3995 '''expr_primary : K_pow '(' expression ',' expression ')' '''
3996 print('expr_primary_30', list(p
))
3997 # { perm_string tn = perm_string::literal("$pow");
3998 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3999 # FILE_NAME(tmp,@1);
4003 def p_expr_primary_31(p
):
4004 '''expr_primary : K_sin '(' expression ')' '''
4005 print('expr_primary_31', list(p
))
4006 # { perm_string tn = perm_string::literal("$sin");
4007 # PECallFunction*tmp = make_call_function(tn, $3);
4008 # FILE_NAME(tmp,@1);
4012 def p_expr_primary_32(p
):
4013 '''expr_primary : K_sinh '(' expression ')' '''
4014 print('expr_primary_32', list(p
))
4015 # { perm_string tn = perm_string::literal("$sinh");
4016 # PECallFunction*tmp = make_call_function(tn, $3);
4017 # FILE_NAME(tmp,@1);
4021 def p_expr_primary_33(p
):
4022 '''expr_primary : K_sqrt '(' expression ')' '''
4023 print('expr_primary_33', list(p
))
4024 # { perm_string tn = perm_string::literal("$sqrt");
4025 # PECallFunction*tmp = make_call_function(tn, $3);
4026 # FILE_NAME(tmp,@1);
4030 def p_expr_primary_34(p
):
4031 '''expr_primary : K_tan '(' expression ')' '''
4032 print('expr_primary_34', list(p
))
4033 # { perm_string tn = perm_string::literal("$tan");
4034 # PECallFunction*tmp = make_call_function(tn, $3);
4035 # FILE_NAME(tmp,@1);
4039 def p_expr_primary_35(p
):
4040 '''expr_primary : K_tanh '(' expression ')' '''
4041 print('expr_primary_35', list(p
))
4042 # { perm_string tn = perm_string::literal("$tanh");
4043 # PECallFunction*tmp = make_call_function(tn, $3);
4044 # FILE_NAME(tmp,@1);
4048 def p_expr_primary_36(p
):
4049 '''expr_primary : K_abs '(' expression ')' '''
4050 print('expr_primary_36', list(p
))
4051 # { PEUnary*tmp = new PEUnary('m', $3);
4052 # FILE_NAME(tmp,@1);
4056 def p_expr_primary_37(p
):
4057 '''expr_primary : K_max '(' expression ',' expression ')' '''
4058 print('expr_primary_37', list(p
))
4059 # { PEBinary*tmp = new PEBinary('M', $3, $5);
4060 # FILE_NAME(tmp,@1);
4064 def p_expr_primary_38(p
):
4065 '''expr_primary : K_min '(' expression ',' expression ')' '''
4066 print('expr_primary_38', list(p
))
4067 # { PEBinary*tmp = new PEBinary('m', $3, $5);
4068 # FILE_NAME(tmp,@1);
4072 def p_expr_primary_39(p
):
4073 '''expr_primary : '(' expr_mintypmax ')' '''
4074 print('expr_primary_39', list(p
))
4077 def p_expr_primary_40(p
):
4078 '''expr_primary : '{' expression_list_proper '}' '''
4079 print('expr_primary_40', list(p
))
4080 # { PEConcat*tmp = new PEConcat(*$2);
4081 # FILE_NAME(tmp, @1);
4086 def p_expr_primary_41(p
):
4087 '''expr_primary : '{' expression '{' expression_list_proper '}' '}' '''
4088 print('expr_primary_41', list(p
))
4090 # PEConcat*tmp = new PEConcat(*$4, rep);
4091 # FILE_NAME(tmp, @1);
4096 def p_expr_primary_42(p
):
4097 '''expr_primary : '{' expression '{' expression_list_proper '}' error '}' '''
4098 print('expr_primary_42', list(p
))
4100 # PEConcat*tmp = new PEConcat(*$4, rep);
4101 # FILE_NAME(tmp, @1);
4104 # yyerror(@5, "error: Syntax error between internal '}' "
4105 # "and closing '}' of repeat concatenation.");
4109 def p_expr_primary_43(p
):
4110 '''expr_primary : '{' '}' '''
4111 print('expr_primary_43', list(p
))
4112 # { // This is the empty queue syntax.
4113 # if (gn_system_verilog()) {
4114 # list<PExpr*> empty_list;
4115 # PEConcat*tmp = new PEConcat(empty_list);
4116 # FILE_NAME(tmp, @1);
4119 # yyerror(@1, "error: Concatenations are not allowed to be empty.");
4124 def p_expr_primary_44(p
):
4125 '''expr_primary : expr_primary "'" '(' expression ')' '''
4126 print('expr_primary_44', list(p
))
4127 # { PExpr*base = $4;
4128 # if (gn_system_verilog()) {
4129 # PECastSize*tmp = new PECastSize($1, base);
4130 # FILE_NAME(tmp, @1);
4133 # yyerror(@1, "error: Size cast requires SystemVerilog.");
4138 def p_expr_primary_45(p
):
4139 '''expr_primary : simple_type_or_string "'" '(' expression ')' '''
4140 print('expr_primary_45', list(p
))
4141 # { PExpr*base = $4;
4142 # if (gn_system_verilog()) {
4143 # PECastType*tmp = new PECastType($1, base);
4144 # FILE_NAME(tmp, @1);
4147 # yyerror(@1, "error: Type cast requires SystemVerilog.");
4152 def p_expr_primary_46(p
):
4153 '''expr_primary : assignment_pattern '''
4154 print('expr_primary_46', list(p
))
4157 def p_expr_primary_47(p
):
4158 '''expr_primary : streaming_concatenation '''
4159 print('expr_primary_47', list(p
))
4162 def p_expr_primary_48(p
):
4163 '''expr_primary : K_null '''
4164 print('expr_primary_48', list(p
))
4165 # { PENull*tmp = new PENull;
4166 # FILE_NAME(tmp, @1);
4170 def p_function_item_list_opt_1(p
):
4171 '''function_item_list_opt : function_item_list '''
4172 print('function_item_list_opt_1', list(p
))
4175 def p_function_item_list_opt_2(p
):
4176 '''function_item_list_opt : '''
4177 print('function_item_list_opt_2', list(p
))
4180 def p_function_item_list_1(p
):
4181 '''function_item_list : function_item '''
4182 print('function_item_list_1', list(p
))
4185 def p_function_item_list_2(p
):
4186 '''function_item_list : function_item_list function_item '''
4187 print('function_item_list_2', list(p
))
4190 # vector<pform_tf_port_t>*tmp = $1;
4191 # size_t s1 = tmp->size();
4192 # tmp->resize(s1 + $2->size());
4193 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
4194 # tmp->at(s1+idx) = $2->at(idx);
4204 def p_function_item_1(p
):
4205 '''function_item : tf_port_declaration '''
4206 print('function_item_1', list(p
))
4209 def p_function_item_2(p
):
4210 '''function_item : block_item_decl '''
4211 print('function_item_2', list(p
))
4214 def p_gate_instance_1(p
):
4215 '''gate_instance : IDENTIFIER '(' expression_list_with_nuls ')' '''
4216 print('gate_instance_1', list(p
))
4217 # { lgate*tmp = new lgate;
4220 # tmp->file = @1.text;
4221 # tmp->lineno = @1.first_line;
4226 def p_gate_instance_2(p
):
4227 '''gate_instance : IDENTIFIER dimensions '(' expression_list_with_nuls ')' '''
4228 print('gate_instance_2', list(p
))
4229 # { lgate*tmp = new lgate;
4230 # list<pform_range_t>*rng = $2;
4233 # tmp->range = rng->front();
4235 # assert(rng->empty());
4236 # tmp->file = @1.text;
4237 # tmp->lineno = @1.first_line;
4243 def p_gate_instance_3(p
):
4244 '''gate_instance : '(' expression_list_with_nuls ')' '''
4245 print('gate_instance_3', list(p
))
4246 # { lgate*tmp = new lgate;
4249 # tmp->file = @1.text;
4250 # tmp->lineno = @1.first_line;
4254 def p_gate_instance_4(p
):
4255 '''gate_instance : IDENTIFIER dimensions '''
4256 print('gate_instance_4', list(p
))
4257 # { lgate*tmp = new lgate;
4258 # list<pform_range_t>*rng = $2;
4261 # tmp->parms_by_name = 0;
4262 # tmp->range = rng->front();
4264 # assert(rng->empty());
4265 # tmp->file = @1.text;
4266 # tmp->lineno = @1.first_line;
4272 def p_gate_instance_5(p
):
4273 '''gate_instance : IDENTIFIER '(' port_name_list ')' '''
4274 print('gate_instance_5', list(p
))
4275 # { lgate*tmp = new lgate;
4278 # tmp->parms_by_name = $3;
4279 # tmp->file = @1.text;
4280 # tmp->lineno = @1.first_line;
4285 def p_gate_instance_6(p
):
4286 '''gate_instance : IDENTIFIER dimensions '(' port_name_list ')' '''
4287 print('gate_instance_6', list(p
))
4288 # { lgate*tmp = new lgate;
4289 # list<pform_range_t>*rng = $2;
4292 # tmp->parms_by_name = $4;
4293 # tmp->range = rng->front();
4295 # assert(rng->empty());
4296 # tmp->file = @1.text;
4297 # tmp->lineno = @1.first_line;
4303 def p_gate_instance_7(p
):
4304 '''gate_instance : IDENTIFIER '(' error ')' '''
4305 print('gate_instance_7', list(p
))
4306 # { lgate*tmp = new lgate;
4309 # tmp->parms_by_name = 0;
4310 # tmp->file = @1.text;
4311 # tmp->lineno = @1.first_line;
4312 # yyerror(@2, "error: Syntax error in instance port "
4313 # "expression(s).");
4318 def p_gate_instance_8(p
):
4319 '''gate_instance : IDENTIFIER dimensions '(' error ')' '''
4320 print('gate_instance_8', list(p
))
4321 # { lgate*tmp = new lgate;
4324 # tmp->parms_by_name = 0;
4325 # tmp->file = @1.text;
4326 # tmp->lineno = @1.first_line;
4327 # yyerror(@3, "error: Syntax error in instance port "
4328 # "expression(s).");
4333 def p_gate_instance_list_1(p
):
4334 '''gate_instance_list : gate_instance_list ',' gate_instance '''
4335 print('gate_instance_list_1', list(p
))
4336 # { svector<lgate>*tmp1 = $1;
4338 # svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
4344 def p_gate_instance_list_2(p
):
4345 '''gate_instance_list : gate_instance '''
4346 print('gate_instance_list_2', list(p
))
4347 # { svector<lgate>*tmp = new svector<lgate>(1);
4353 def p_gatetype_1(p
):
4354 '''gatetype : K_and '''
4355 print('gatetype_1', list(p
))
4356 # { $$ = PGBuiltin::AND; }
4358 def p_gatetype_2(p
):
4359 '''gatetype : K_nand '''
4360 print('gatetype_2', list(p
))
4361 # { $$ = PGBuiltin::NAND; }
4363 def p_gatetype_3(p
):
4364 '''gatetype : K_or '''
4365 print('gatetype_3', list(p
))
4366 # { $$ = PGBuiltin::OR; }
4368 def p_gatetype_4(p
):
4369 '''gatetype : K_nor '''
4370 print('gatetype_4', list(p
))
4371 # { $$ = PGBuiltin::NOR; }
4373 def p_gatetype_5(p
):
4374 '''gatetype : K_xor '''
4375 print('gatetype_5', list(p
))
4376 # { $$ = PGBuiltin::XOR; }
4378 def p_gatetype_6(p
):
4379 '''gatetype : K_xnor '''
4380 print('gatetype_6', list(p
))
4381 # { $$ = PGBuiltin::XNOR; }
4383 def p_gatetype_7(p
):
4384 '''gatetype : K_buf '''
4385 print('gatetype_7', list(p
))
4386 # { $$ = PGBuiltin::BUF; }
4388 def p_gatetype_8(p
):
4389 '''gatetype : K_bufif0 '''
4390 print('gatetype_8', list(p
))
4391 # { $$ = PGBuiltin::BUFIF0; }
4393 def p_gatetype_9(p
):
4394 '''gatetype : K_bufif1 '''
4395 print('gatetype_9', list(p
))
4396 # { $$ = PGBuiltin::BUFIF1; }
4398 def p_gatetype_10(p
):
4399 '''gatetype : K_not '''
4400 print('gatetype_10', list(p
))
4401 # { $$ = PGBuiltin::NOT; }
4403 def p_gatetype_11(p
):
4404 '''gatetype : K_notif0 '''
4405 print('gatetype_11', list(p
))
4406 # { $$ = PGBuiltin::NOTIF0; }
4408 def p_gatetype_12(p
):
4409 '''gatetype : K_notif1 '''
4410 print('gatetype_12', list(p
))
4411 # { $$ = PGBuiltin::NOTIF1; }
4413 def p_switchtype_1(p
):
4414 '''switchtype : K_nmos '''
4415 print('switchtype_1', list(p
))
4416 # { $$ = PGBuiltin::NMOS; }
4418 def p_switchtype_2(p
):
4419 '''switchtype : K_rnmos '''
4420 print('switchtype_2', list(p
))
4421 # { $$ = PGBuiltin::RNMOS; }
4423 def p_switchtype_3(p
):
4424 '''switchtype : K_pmos '''
4425 print('switchtype_3', list(p
))
4426 # { $$ = PGBuiltin::PMOS; }
4428 def p_switchtype_4(p
):
4429 '''switchtype : K_rpmos '''
4430 print('switchtype_4', list(p
))
4431 # { $$ = PGBuiltin::RPMOS; }
4433 def p_switchtype_5(p
):
4434 '''switchtype : K_cmos '''
4435 print('switchtype_5', list(p
))
4436 # { $$ = PGBuiltin::CMOS; }
4438 def p_switchtype_6(p
):
4439 '''switchtype : K_rcmos '''
4440 print('switchtype_6', list(p
))
4441 # { $$ = PGBuiltin::RCMOS; }
4443 def p_switchtype_7(p
):
4444 '''switchtype : K_tran '''
4445 print('switchtype_7', list(p
))
4446 # { $$ = PGBuiltin::TRAN; }
4448 def p_switchtype_8(p
):
4449 '''switchtype : K_rtran '''
4450 print('switchtype_8', list(p
))
4451 # { $$ = PGBuiltin::RTRAN; }
4453 def p_switchtype_9(p
):
4454 '''switchtype : K_tranif0 '''
4455 print('switchtype_9', list(p
))
4456 # { $$ = PGBuiltin::TRANIF0; }
4458 def p_switchtype_10(p
):
4459 '''switchtype : K_tranif1 '''
4460 print('switchtype_10', list(p
))
4461 # { $$ = PGBuiltin::TRANIF1; }
4463 def p_switchtype_11(p
):
4464 '''switchtype : K_rtranif0 '''
4465 print('switchtype_11', list(p
))
4466 # { $$ = PGBuiltin::RTRANIF0; }
4468 def p_switchtype_12(p
):
4469 '''switchtype : K_rtranif1 '''
4470 print('switchtype_12', list(p
))
4471 # { $$ = PGBuiltin::RTRANIF1; }
4473 def p_hierarchy_identifier_1(p
):
4474 '''hierarchy_identifier : IDENTIFIER '''
4475 print('hierarchy_identifier_1', list(p
))
4476 lpvalue
= Leaf(token
.NAME
, p
[1])
4478 # { $$ = new pform_name_t;
4479 # $$->push_back(name_component_t(lex_strings.make($1)));
4483 def p_hierarchy_identifier_2(p
):
4484 '''hierarchy_identifier : hierarchy_identifier '.' IDENTIFIER '''
4485 print('hierarchy_identifier_2', list(p
))
4486 # { pform_name_t * tmp = $1;
4487 # tmp->push_back(name_component_t(lex_strings.make($3)));
4492 def p_hierarchy_identifier_3(p
):
4493 '''hierarchy_identifier : hierarchy_identifier '[' expression ']' '''
4494 print('hierarchy_identifier_3', list(p
))
4495 # { pform_name_t * tmp = $1;
4496 # name_component_t&tail = tmp->back();
4497 # index_component_t itmp;
4498 # itmp.sel = index_component_t::SEL_BIT;
4500 # tail.index.push_back(itmp);
4504 def p_hierarchy_identifier_4(p
):
4505 '''hierarchy_identifier : hierarchy_identifier '[' '$' ']' '''
4506 print('hierarchy_identifier_4', list(p
))
4507 # { pform_name_t * tmp = $1;
4508 # name_component_t&tail = tmp->back();
4509 # if (! gn_system_verilog()) {
4510 # yyerror(@3, "error: Last element expression ($) "
4511 # "requires SystemVerilog. Try enabling SystemVerilog.");
4513 # index_component_t itmp;
4514 # itmp.sel = index_component_t::SEL_BIT_LAST;
4517 # tail.index.push_back(itmp);
4521 def p_hierarchy_identifier_5(p
):
4522 '''hierarchy_identifier : hierarchy_identifier '[' expression ':' expression ']' '''
4523 print('hierarchy_identifier_5', list(p
))
4524 # { pform_name_t * tmp = $1;
4525 # name_component_t&tail = tmp->back();
4526 # index_component_t itmp;
4527 # itmp.sel = index_component_t::SEL_PART;
4530 # tail.index.push_back(itmp);
4534 def p_hierarchy_identifier_6(p
):
4535 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_POS expression ']' '''
4536 print('hierarchy_identifier_6', list(p
))
4537 # { pform_name_t * tmp = $1;
4538 # name_component_t&tail = tmp->back();
4539 # index_component_t itmp;
4540 # itmp.sel = index_component_t::SEL_IDX_UP;
4543 # tail.index.push_back(itmp);
4547 def p_hierarchy_identifier_7(p
):
4548 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_NEG expression ']' '''
4549 print('hierarchy_identifier_7', list(p
))
4550 # { pform_name_t * tmp = $1;
4551 # name_component_t&tail = tmp->back();
4552 # index_component_t itmp;
4553 # itmp.sel = index_component_t::SEL_IDX_DO;
4556 # tail.index.push_back(itmp);
4560 def p_list_of_identifiers_1(p
):
4561 '''list_of_identifiers : IDENTIFIER '''
4562 print('list_of_identifiers_1', list(p
))
4563 # { $$ = list_from_identifier($1); }
4565 def p_list_of_identifiers_2(p
):
4566 '''list_of_identifiers : list_of_identifiers ',' IDENTIFIER '''
4567 print('list_of_identifiers_2', list(p
))
4568 # { $$ = list_from_identifier($1, $3); }
4570 def p_list_of_port_identifiers_1(p
):
4571 '''list_of_port_identifiers : IDENTIFIER dimensions_opt '''
4572 print('list_of_port_identifiers_1', list(p
))
4573 # { $$ = make_port_list($1, $2, 0); }
4575 def p_list_of_port_identifiers_2(p
):
4576 '''list_of_port_identifiers : list_of_port_identifiers ',' IDENTIFIER dimensions_opt '''
4577 print('list_of_port_identifiers_2', list(p
))
4578 # { $$ = make_port_list($1, $3, $4, 0); }
4580 def p_list_of_variable_port_identifiers_1(p
):
4581 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '''
4582 print('list_of_variable_port_identifiers_1', list(p
))
4583 # { $$ = make_port_list($1, $2, 0); }
4585 def p_list_of_variable_port_identifiers_2(p
):
4586 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '=' expression '''
4587 print('list_of_variable_port_identifiers_2', list(p
))
4588 # { $$ = make_port_list($1, $2, $4); }
4590 def p_list_of_variable_port_identifiers_3(p
):
4591 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '''
4592 print('list_of_variable_port_identifiers_3', list(p
))
4593 # { $$ = make_port_list($1, $3, $4, 0); }
4595 def p_list_of_variable_port_identifiers_4(p
):
4596 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '=' expression '''
4597 print('list_of_variable_port_identifiers_4', list(p
))
4598 # { $$ = make_port_list($1, $3, $4, $6); }
4600 def p_list_of_ports_1(p
):
4601 '''list_of_ports : port_opt '''
4602 print('list_of_ports_1', list(p
))
4603 # { vector<Module::port_t*>*tmp
4604 # = new vector<Module::port_t*>(1);
4609 def p_list_of_ports_2(p
):
4610 '''list_of_ports : list_of_ports ',' port_opt '''
4611 print('list_of_ports_2', list(p
))
4612 # { vector<Module::port_t*>*tmp = $1;
4613 # tmp->push_back($3);
4617 def p_list_of_port_declarations_1(p
):
4618 '''list_of_port_declarations : port_declaration '''
4619 print('list_of_port_declarations_1', list(p
))
4620 # { vector<Module::port_t*>*tmp
4621 # = new vector<Module::port_t*>(1);
4626 def p_list_of_port_declarations_2(p
):
4627 '''list_of_port_declarations : list_of_port_declarations ',' port_declaration '''
4628 print('list_of_port_declarations_2', list(p
))
4629 # { vector<Module::port_t*>*tmp = $1;
4630 # tmp->push_back($3);
4634 def p_list_of_port_declarations_3(p
):
4635 '''list_of_port_declarations : list_of_port_declarations ',' IDENTIFIER '''
4636 print('list_of_port_declarations_3', list(p
))
4637 # { Module::port_t*ptmp;
4638 # perm_string name = lex_strings.make($3);
4639 # ptmp = pform_module_port_reference(name, @3.text,
4641 # vector<Module::port_t*>*tmp = $1;
4642 # tmp->push_back(ptmp);
4644 # /* Get the port declaration details, the port type
4645 # and what not, from context data stored by the
4646 # last port_declaration rule. */
4647 # pform_module_define_port(@3, name,
4648 # port_declaration_context.port_type,
4649 # port_declaration_context.port_net_type,
4650 # port_declaration_context.data_type, 0);
4655 def p_list_of_port_declarations_4(p
):
4656 '''list_of_port_declarations : list_of_port_declarations ',' '''
4657 print('list_of_port_declarations_4', list(p
))
4659 # yyerror(@2, "error: NULL port declarations are not "
4663 def p_list_of_port_declarations_5(p
):
4664 '''list_of_port_declarations : list_of_port_declarations ';' '''
4665 print('list_of_port_declarations_5', list(p
))
4667 # yyerror(@2, "error: ';' is an invalid port declaration "
4671 def p_port_declaration_1(p
):
4672 '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4673 print('port_declaration_1', list(p
))
4674 # { Module::port_t*ptmp;
4675 # perm_string name = lex_strings.make($5);
4676 # data_type_t*use_type = $4;
4677 # if ($6) use_type = new uarray_type_t(use_type, $6);
4678 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4679 # pform_module_define_port(@2, name, NetNet::PINPUT, $3, use_type, $1);
4680 # port_declaration_context.port_type = NetNet::PINPUT;
4681 # port_declaration_context.port_net_type = $3;
4682 # port_declaration_context.data_type = $4;
4687 def p_port_declaration_2(p
):
4688 '''port_declaration : attribute_list_opt K_input K_wreal IDENTIFIER '''
4689 print('port_declaration_2', list(p
))
4690 # { Module::port_t*ptmp;
4691 # perm_string name = lex_strings.make($4);
4692 # ptmp = pform_module_port_reference(name, @2.text,
4694 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4695 # FILE_NAME(real_type, @3);
4696 # pform_module_define_port(@2, name, NetNet::PINPUT,
4697 # NetNet::WIRE, real_type, $1);
4698 # port_declaration_context.port_type = NetNet::PINPUT;
4699 # port_declaration_context.port_net_type = NetNet::WIRE;
4700 # port_declaration_context.data_type = real_type;
4705 def p_port_declaration_3(p
):
4706 '''port_declaration : attribute_list_opt K_inout net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4707 print('port_declaration_3', list(p
))
4708 # { Module::port_t*ptmp;
4709 # perm_string name = lex_strings.make($5);
4710 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4711 # pform_module_define_port(@2, name, NetNet::PINOUT, $3, $4, $1);
4712 # port_declaration_context.port_type = NetNet::PINOUT;
4713 # port_declaration_context.port_net_type = $3;
4714 # port_declaration_context.data_type = $4;
4717 # yyerror(@6, "sorry: Inout ports with unpacked dimensions not supported.");
4723 def p_port_declaration_4(p
):
4724 '''port_declaration : attribute_list_opt K_inout K_wreal IDENTIFIER '''
4725 print('port_declaration_4', list(p
))
4726 # { Module::port_t*ptmp;
4727 # perm_string name = lex_strings.make($4);
4728 # ptmp = pform_module_port_reference(name, @2.text,
4730 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4731 # FILE_NAME(real_type, @3);
4732 # pform_module_define_port(@2, name, NetNet::PINOUT,
4733 # NetNet::WIRE, real_type, $1);
4734 # port_declaration_context.port_type = NetNet::PINOUT;
4735 # port_declaration_context.port_net_type = NetNet::WIRE;
4736 # port_declaration_context.data_type = real_type;
4741 def p_port_declaration_5(p
):
4742 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4743 print('port_declaration_5', list(p
))
4744 # { Module::port_t*ptmp;
4745 # perm_string name = lex_strings.make($5);
4746 # data_type_t*use_dtype = $4;
4747 # if ($6) use_dtype = new uarray_type_t(use_dtype, $6);
4748 # NetNet::Type use_type = $3;
4749 # if (use_type == NetNet::IMPLICIT) {
4750 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($4)) {
4751 # if (dtype->reg_flag)
4752 # use_type = NetNet::REG;
4753 # else if (dtype->implicit_flag)
4754 # use_type = NetNet::IMPLICIT;
4756 # use_type = NetNet::IMPLICIT_REG;
4758 # // The SystemVerilog types that can show up as
4759 # // output ports are implicitly (on the inside)
4760 # // variables because "reg" is not valid syntax
4762 # } else if (dynamic_cast<atom2_type_t*> ($4)) {
4763 # use_type = NetNet::IMPLICIT_REG;
4764 # } else if (dynamic_cast<struct_type_t*> ($4)) {
4765 # use_type = NetNet::IMPLICIT_REG;
4766 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> ($4)) {
4767 # if(etype->base_type == IVL_VT_LOGIC)
4768 # use_type = NetNet::IMPLICIT_REG;
4771 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4772 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, use_dtype, $1);
4773 # port_declaration_context.port_type = NetNet::POUTPUT;
4774 # port_declaration_context.port_net_type = use_type;
4775 # port_declaration_context.data_type = $4;
4780 def p_port_declaration_6(p
):
4781 '''port_declaration : attribute_list_opt K_output K_wreal IDENTIFIER '''
4782 print('port_declaration_6', list(p
))
4783 # { Module::port_t*ptmp;
4784 # perm_string name = lex_strings.make($4);
4785 # ptmp = pform_module_port_reference(name, @2.text,
4787 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4788 # FILE_NAME(real_type, @3);
4789 # pform_module_define_port(@2, name, NetNet::POUTPUT,
4790 # NetNet::WIRE, real_type, $1);
4791 # port_declaration_context.port_type = NetNet::POUTPUT;
4792 # port_declaration_context.port_net_type = NetNet::WIRE;
4793 # port_declaration_context.data_type = real_type;
4798 def p_port_declaration_7(p
):
4799 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER '=' expression '''
4800 print('port_declaration_7', list(p
))
4801 # { Module::port_t*ptmp;
4802 # perm_string name = lex_strings.make($5);
4803 # NetNet::Type use_type = $3;
4804 # if (use_type == NetNet::IMPLICIT) {
4805 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($4)) {
4806 # if (dtype->reg_flag)
4807 # use_type = NetNet::REG;
4809 # use_type = NetNet::IMPLICIT_REG;
4811 # use_type = NetNet::IMPLICIT_REG;
4814 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4815 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, $4, $1);
4816 # port_declaration_context.port_type = NetNet::PINOUT;
4817 # port_declaration_context.port_net_type = use_type;
4818 # port_declaration_context.data_type = $4;
4820 # pform_make_var_init(@5, name, $7);
4826 def p_net_type_opt_1(p
):
4827 '''net_type_opt : net_type '''
4828 print('net_type_opt_1', list(p
))
4831 def p_net_type_opt_2(p
):
4832 '''net_type_opt : '''
4833 print('net_type_opt_2', list(p
))
4834 # { $$ = NetNet::IMPLICIT; }
4836 def p_unsigned_signed_opt_1(p
):
4837 '''unsigned_signed_opt : K_signed '''
4838 print('unsigned_signed_opt_1', list(p
))
4841 def p_unsigned_signed_opt_2(p
):
4842 '''unsigned_signed_opt : K_unsigned '''
4843 print('unsigned_signed_opt_2', list(p
))
4846 def p_unsigned_signed_opt_3(p
):
4847 '''unsigned_signed_opt : '''
4848 print('unsigned_signed_opt_3', list(p
))
4851 def p_signed_unsigned_opt_1(p
):
4852 '''signed_unsigned_opt : K_signed '''
4853 print('signed_unsigned_opt_1', list(p
))
4856 def p_signed_unsigned_opt_2(p
):
4857 '''signed_unsigned_opt : K_unsigned '''
4858 print('signed_unsigned_opt_2', list(p
))
4861 def p_signed_unsigned_opt_3(p
):
4862 '''signed_unsigned_opt : '''
4863 print('signed_unsigned_opt_3', list(p
))
4866 def p_atom2_type_1(p
):
4867 '''atom2_type : K_byte '''
4868 print('atom2_type_1', list(p
))
4871 def p_atom2_type_2(p
):
4872 '''atom2_type : K_shortint '''
4873 print('atom2_type_2', list(p
))
4876 def p_atom2_type_3(p
):
4877 '''atom2_type : K_int '''
4878 print('atom2_type_3', list(p
))
4881 def p_atom2_type_4(p
):
4882 '''atom2_type : K_longint '''
4883 print('atom2_type_4', list(p
))
4887 '''lpvalue : hierarchy_identifier '''
4888 print('lpvalue_1', list(p
))
4890 # { PEIdent*tmp = pform_new_ident(*$1);
4891 # FILE_NAME(tmp, @1);
4897 '''lpvalue : implicit_class_handle '.' hierarchy_identifier '''
4898 print('lpvalue_2', list(p
))
4899 # { pform_name_t*t_name = $1;
4900 # while (!$3->empty()) {
4901 # t_name->push_back($3->front());
4904 # PEIdent*tmp = new PEIdent(*t_name);
4905 # FILE_NAME(tmp, @1);
4912 '''lpvalue : '{' expression_list_proper '}' '''
4913 print('lpvalue_3', list(p
))
4914 # { PEConcat*tmp = new PEConcat(*$2);
4915 # FILE_NAME(tmp, @1);
4921 '''lpvalue : streaming_concatenation '''
4922 print('lpvalue_4', list(p
))
4923 # { yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
4927 def p_cont_assign_1(p
):
4928 '''cont_assign : lpvalue '=' expression '''
4929 print('cont_assign_1', list(p
))
4930 # { list<PExpr*>*tmp = new list<PExpr*>;
4931 # tmp->push_back($1);
4932 # tmp->push_back($3);
4936 def p_cont_assign_list_1(p
):
4937 '''cont_assign_list : cont_assign_list ',' cont_assign '''
4938 print('cont_assign_list_1', list(p
))
4939 # { list<PExpr*>*tmp = $1;
4940 # tmp->splice(tmp->end(), *$3);
4945 def p_cont_assign_list_2(p
):
4946 '''cont_assign_list : cont_assign '''
4947 print('cont_assign_list_2', list(p
))
4951 '''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 '''
4952 print('module_1', list(p
))
4954 clsname
= [Leaf(token
.NAME
, 'class'),
4955 Leaf(token
.NAME
, p
[4], prefix
=' '),
4956 Leaf(token
.COLON
, ':')]
4957 pass_stmt
= Node(syms
.pass_stmt
, [Leaf(token
.NAME
, "pass"),])
4959 params
= [Leaf(token
.LPAR
, '(')] + params
+ [Leaf(token
.RPAR
, ')')]
4960 fn
= [Leaf(token
.NAME
, 'def'),
4961 Leaf(token
.NAME
, '__init__', prefix
=' '),
4962 Node(syms
.parameters
, params
),
4963 Leaf(token
.COLON
, ':')]
4964 fndef
= Node(syms
.funcdef
, fn
)
4965 stmts
= Node(syms
.stmt
, [fndef
])
4967 stmts
= Node(syms
.small_stmt
, [pass_stmt
, Leaf(token
.NEWLINE
, '\n')])
4968 stmts
= Node(syms
.stmt
, [stmts
])
4969 suite
= Node(syms
.suite
, [Leaf(token
.NEWLINE
, '\n'),
4970 Leaf(token
.INDENT
, ' '),
4972 Leaf(token
.DEDENT
, '')
4974 clsdecl
= Node(syms
.classdef
, clsname
+ [suite
],
4975 prefix
='', fixers_applied
=[])
4976 clsdecl
= Node(syms
.compound_stmt
, [clsdecl
])
4977 print ("clsdecl", repr(clsdecl
))
4979 print (str(clsdecl
))
4981 # { // Last step: check any closing name. This is done late so
4982 # // that the parser can look ahead to detect the present
4983 # // endlabel_opt but still have the pform_endmodule() called
4984 # // early enough that the lexor can know we are outside the
4987 # if (strcmp($4,$17) != 0) {
4990 # yyerror(@17, "error: End label doesn't match "
4994 # yyerror(@17, "error: End label doesn't match "
4998 # yyerror(@17, "error: End label doesn't match "
4999 # "interface name.");
5005 # if (($2 == K_module) && (! gn_system_verilog())) {
5006 # yyerror(@8, "error: Module end labels require "
5007 # "SystemVerilog.");
5014 def p__embed0_module(p
):
5015 '''_embed0_module : '''
5016 # { pform_startmodule(@2, $4, $2==K_program, $2==K_interface, $3, $1); }
5018 def p__embed1_module(p
):
5019 '''_embed1_module : '''
5020 # { pform_module_set_ports($8); }
5022 def p__embed2_module(p
):
5023 '''_embed2_module : '''
5024 # { pform_set_scope_timescale(@2); }
5026 def p__embed3_module(p
):
5027 '''_embed3_module : '''
5028 # { Module::UCDriveType ucd;
5029 # // The lexor detected `unconnected_drive directives and
5030 # // marked what it found in the uc_drive variable. Use that
5031 # // to generate a UCD flag for the module.
5032 # switch (uc_drive) {
5035 # ucd = Module::UCD_NONE;
5038 # ucd = Module::UCD_PULL0;
5041 # ucd = Module::UCD_PULL1;
5044 # // Check that program/endprogram and module/endmodule
5045 # // keywords match.
5049 # yyerror(@15, "error: module not closed by endmodule.");
5052 # yyerror(@15, "error: program not closed by endprogram.");
5055 # yyerror(@15, "error: interface not closed by endinterface.");
5061 # pform_endmodule($4, in_celldefine, ucd);
5064 def p_module_start_1(p
):
5065 '''module_start : K_module '''
5066 print('module_start_1', list(p
))
5067 # { $$ = K_module; }
5069 def p_module_start_2(p
):
5070 '''module_start : K_macromodule '''
5071 print('module_start_2', list(p
))
5072 # { $$ = K_module; }
5074 def p_module_start_3(p
):
5075 '''module_start : K_program '''
5076 print('module_start_3', list(p
))
5077 # { $$ = K_program; }
5079 def p_module_start_4(p
):
5080 '''module_start : K_interface '''
5081 print('module_start_4', list(p
))
5082 # { $$ = K_interface; }
5084 def p_module_end_1(p
):
5085 '''module_end : K_endmodule '''
5086 print('module_end_1', list(p
))
5087 # { $$ = K_module; }
5089 def p_module_end_2(p
):
5090 '''module_end : K_endprogram '''
5091 print('module_end_2', list(p
))
5092 # { $$ = K_program; }
5094 def p_module_end_3(p
):
5095 '''module_end : K_endinterface '''
5096 print('module_end_3', list(p
))
5097 # { $$ = K_interface; }
5099 def p_endlabel_opt_1(p
):
5100 '''endlabel_opt : ':' IDENTIFIER '''
5101 print('endlabel_opt_1', list(p
))
5104 def p_endlabel_opt_2(p
):
5105 '''endlabel_opt : '''
5106 print('endlabel_opt_2', list(p
))
5109 def p_module_attribute_foreign_1(p
):
5110 '''module_attribute_foreign : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP '''
5111 print('module_attribute_foreign_1', list(p
))
5114 def p_module_attribute_foreign_2(p
):
5115 '''module_attribute_foreign : '''
5116 print('module_attribute_foreign_2', list(p
))
5119 def p_module_port_list_opt_1(p
):
5120 '''module_port_list_opt : '(' list_of_ports ')' '''
5121 print('module_port_list_opt_1', list(p
))
5124 def p_module_port_list_opt_2(p
):
5125 '''module_port_list_opt : '(' list_of_port_declarations ')' '''
5126 print('module_port_list_opt_2', list(p
))
5129 def p_module_port_list_opt_3(p
):
5130 '''module_port_list_opt : '''
5131 print('module_port_list_opt_3', list(p
))
5134 def p_module_port_list_opt_4(p
):
5135 '''module_port_list_opt : '(' error ')' '''
5136 print('module_port_list_opt_4', list(p
))
5137 # { yyerror(@2, "Errors in port declarations.");
5142 def p_module_parameter_port_list_opt_1(p
):
5143 '''module_parameter_port_list_opt : '''
5144 print('module_parameter_port_list_opt_1', list(p
))
5146 def p_module_parameter_port_list_opt_2(p
):
5147 '''module_parameter_port_list_opt : '#' '(' module_parameter_port_list ')' '''
5148 print('module_parameter_port_list_opt_2', list(p
))
5151 def p_module_parameter_port_list_1(p
):
5152 '''module_parameter_port_list : K_parameter param_type parameter_assign '''
5153 print('module_parameter_port_list_1', list(p
))
5156 def p_module_parameter_port_list_2(p
):
5157 '''module_parameter_port_list : module_parameter_port_list ',' parameter_assign '''
5158 print('module_parameter_port_list_2', list(p
))
5159 p
[0] = p
[1].append(p
[3])
5161 def p_module_parameter_port_list_3(p
):
5162 '''module_parameter_port_list : module_parameter_port_list ',' K_parameter param_type parameter_assign '''
5163 print('module_parameter_port_list_3', list(p
))
5164 p
[1].append(Leaf(token
.COMMA
, ','))
5165 p
[5].prefix
=' ' # add a space after the comma, must go in the parameter
5169 def p_module_item_1(p
):
5170 '''module_item : module '''
5171 print('module_item_1', list(p
))
5173 def p_module_item_2(p
):
5174 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' '''
5175 print('module_item_2', list(p
))
5176 # { data_type_t*data_type = $3;
5177 # if (data_type == 0) {
5178 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5179 # FILE_NAME(data_type, @2);
5181 # pform_set_data_type(@2, data_type, $5, $2, $1);
5183 # yyerror(@2, "sorry: net delays not supported.");
5189 def p_module_item_3(p
):
5190 '''module_item : attribute_list_opt K_wreal delay3 net_variable_list ';' '''
5191 print('module_item_3', list(p
))
5192 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5193 # pform_set_data_type(@2, tmpt, $4, NetNet::WIRE, $1);
5195 # yyerror(@3, "sorry: net delays not supported.");
5201 def p_module_item_4(p
):
5202 '''module_item : attribute_list_opt K_wreal net_variable_list ';' '''
5203 print('module_item_4', list(p
))
5204 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5205 # pform_set_data_type(@2, tmpt, $3, NetNet::WIRE, $1);
5209 def p_module_item_5(p
):
5210 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_decl_assigns ';' '''
5211 print('module_item_5', 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, $4, str_strength, $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_6(p
):
5226 '''module_item : attribute_list_opt net_type data_type_or_implicit drive_strength net_decl_assigns ';' '''
5227 print('module_item_6', list(p
))
5228 # { data_type_t*data_type = $3;
5229 # if (data_type == 0) {
5230 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5231 # FILE_NAME(data_type, @2);
5233 # pform_makewire(@2, 0, $4, $5, $2, data_type);
5235 # yywarn(@2, "Attributes are not supported on net declaration "
5236 # "assignments and will be discarded.");
5241 def p_module_item_7(p
):
5242 '''module_item : attribute_list_opt K_wreal net_decl_assigns ';' '''
5243 print('module_item_7', list(p
))
5244 # { real_type_t*data_type = new real_type_t(real_type_t::REAL);
5245 # pform_makewire(@2, 0, str_strength, $3, NetNet::WIRE, data_type);
5247 # yywarn(@2, "Attributes are not supported on net declaration "
5248 # "assignments and will be discarded.");
5253 def p_module_item_8(p
):
5254 '''module_item : K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' '''
5255 print('module_item_8', list(p
))
5256 # { yyerror(@1, "sorry: trireg nets not supported.");
5261 def p_module_item_9(p
):
5262 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit list_of_port_identifiers ';' '''
5263 print('module_item_9', list(p
))
5264 # { pform_module_define_port(@2, $5, $2, $3, $4, $1); }
5266 def p_module_item_10(p
):
5267 '''module_item : attribute_list_opt port_direction K_wreal list_of_port_identifiers ';' '''
5268 print('module_item_10', list(p
))
5269 # { real_type_t*real_type = new real_type_t(real_type_t::REAL);
5270 # pform_module_define_port(@2, $4, $2, NetNet::WIRE, real_type, $1);
5273 def p_module_item_11(p
):
5274 '''module_item : attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' '''
5275 print('module_item_11', list(p
))
5276 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5277 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5278 # if (dtype->implicit_flag)
5279 # use_type = NetNet::NONE;
5281 # if (use_type == NetNet::NONE)
5282 # pform_set_port_type(@2, $4, NetNet::PINOUT, $3, $1);
5284 # pform_module_define_port(@2, $4, NetNet::PINOUT, use_type, $3, $1);
5287 def p_module_item_12(p
):
5288 '''module_item : attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' '''
5289 print('module_item_12', list(p
))
5290 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5291 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5292 # if (dtype->implicit_flag)
5293 # use_type = NetNet::NONE;
5295 # if (use_type == NetNet::NONE)
5296 # pform_set_port_type(@2, $4, NetNet::PINPUT, $3, $1);
5298 # pform_module_define_port(@2, $4, NetNet::PINPUT, use_type, $3, $1);
5301 def p_module_item_13(p
):
5302 '''module_item : attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' '''
5303 print('module_item_13', list(p
))
5304 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5305 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5306 # if (dtype->implicit_flag)
5307 # use_type = NetNet::NONE;
5308 # else if (dtype->reg_flag)
5309 # use_type = NetNet::REG;
5311 # use_type = NetNet::IMPLICIT_REG;
5313 # // The SystemVerilog types that can show up as
5314 # // output ports are implicitly (on the inside)
5315 # // variables because "reg" is not valid syntax
5317 # } else if (dynamic_cast<atom2_type_t*> ($3)) {
5318 # use_type = NetNet::IMPLICIT_REG;
5319 # } else if (dynamic_cast<struct_type_t*> ($3)) {
5320 # use_type = NetNet::IMPLICIT_REG;
5321 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> ($3)) {
5322 # if(etype->base_type == IVL_VT_LOGIC)
5323 # use_type = NetNet::IMPLICIT_REG;
5325 # if (use_type == NetNet::NONE)
5326 # pform_set_port_type(@2, $4, NetNet::POUTPUT, $3, $1);
5328 # pform_module_define_port(@2, $4, NetNet::POUTPUT, use_type, $3, $1);
5331 def p_module_item_14(p
):
5332 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit error ';' '''
5333 print('module_item_14', list(p
))
5334 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5335 # if ($1) delete $1;
5336 # if ($4) delete $4;
5340 def p_module_item_15(p
):
5341 '''module_item : attribute_list_opt K_inout data_type_or_implicit error ';' '''
5342 print('module_item_15', list(p
))
5343 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5344 # if ($1) delete $1;
5345 # if ($3) delete $3;
5349 def p_module_item_16(p
):
5350 '''module_item : attribute_list_opt K_input data_type_or_implicit error ';' '''
5351 print('module_item_16', list(p
))
5352 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5353 # if ($1) delete $1;
5354 # if ($3) delete $3;
5358 def p_module_item_17(p
):
5359 '''module_item : attribute_list_opt K_output data_type_or_implicit error ';' '''
5360 print('module_item_17', list(p
))
5361 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5362 # if ($1) delete $1;
5363 # if ($3) delete $3;
5367 def p_module_item_18(p
):
5368 '''module_item : DISCIPLINE_IDENTIFIER list_of_identifiers ';' '''
5369 print('module_item_18', list(p
))
5370 # { pform_attach_discipline(@1, $1, $2); }
5372 def p_module_item_19(p
):
5373 '''module_item : attribute_list_opt _embed0_module_item block_item_decl '''
5374 print('module_item_19', list(p
))
5375 # { delete attributes_in_context;
5376 # attributes_in_context = 0;
5379 def p_module_item_20(p
):
5380 '''module_item : K_defparam _embed1_module_item defparam_assign_list ';' '''
5381 print('module_item_20', list(p
))
5383 def p_module_item_21(p
):
5384 '''module_item : attribute_list_opt gatetype gate_instance_list ';' '''
5385 print('module_item_21', list(p
))
5386 # { pform_makegates(@2, $2, str_strength, 0, $3, $1); }
5388 def p_module_item_22(p
):
5389 '''module_item : attribute_list_opt gatetype delay3 gate_instance_list ';' '''
5390 print('module_item_22', list(p
))
5391 # { pform_makegates(@2, $2, str_strength, $3, $4, $1); }
5393 def p_module_item_23(p
):
5394 '''module_item : attribute_list_opt gatetype drive_strength gate_instance_list ';' '''
5395 print('module_item_23', list(p
))
5396 # { pform_makegates(@2, $2, $3, 0, $4, $1); }
5398 def p_module_item_24(p
):
5399 '''module_item : attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';' '''
5400 print('module_item_24', list(p
))
5401 # { pform_makegates(@2, $2, $3, $4, $5, $1); }
5403 def p_module_item_25(p
):
5404 '''module_item : attribute_list_opt switchtype gate_instance_list ';' '''
5405 print('module_item_25', list(p
))
5406 # { pform_makegates(@2, $2, str_strength, 0, $3, $1); }
5408 def p_module_item_26(p
):
5409 '''module_item : attribute_list_opt switchtype delay3 gate_instance_list ';' '''
5410 print('module_item_26', list(p
))
5411 # { pform_makegates(@2, $2, str_strength, $3, $4, $1); }
5413 def p_module_item_27(p
):
5414 '''module_item : K_pullup gate_instance_list ';' '''
5415 print('module_item_27', list(p
))
5416 # { pform_makegates(@1, PGBuiltin::PULLUP, pull_strength, 0, $2, 0); }
5418 def p_module_item_28(p
):
5419 '''module_item : K_pulldown gate_instance_list ';' '''
5420 print('module_item_28', list(p
))
5421 # { pform_makegates(@1, PGBuiltin::PULLDOWN, pull_strength, 0, $2, 0); }
5423 def p_module_item_29(p
):
5424 '''module_item : K_pullup '(' dr_strength1 ')' gate_instance_list ';' '''
5425 print('module_item_29', list(p
))
5426 # { pform_makegates(@1, PGBuiltin::PULLUP, $3, 0, $5, 0); }
5428 def p_module_item_30(p
):
5429 '''module_item : K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5430 print('module_item_30', list(p
))
5431 # { pform_makegates(@1, PGBuiltin::PULLUP, $3, 0, $7, 0); }
5433 def p_module_item_31(p
):
5434 '''module_item : K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5435 print('module_item_31', list(p
))
5436 # { pform_makegates(@1, PGBuiltin::PULLUP, $5, 0, $7, 0); }
5438 def p_module_item_32(p
):
5439 '''module_item : K_pulldown '(' dr_strength0 ')' gate_instance_list ';' '''
5440 print('module_item_32', list(p
))
5441 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $3, 0, $5, 0); }
5443 def p_module_item_33(p
):
5444 '''module_item : K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5445 print('module_item_33', list(p
))
5446 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $5, 0, $7, 0); }
5448 def p_module_item_34(p
):
5449 '''module_item : K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5450 print('module_item_34', list(p
))
5451 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $3, 0, $7, 0); }
5453 def p_module_item_35(p
):
5454 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' '''
5455 print('module_item_35', list(p
))
5456 # { perm_string tmp1 = lex_strings.make($2);
5457 # pform_make_modgates(@2, tmp1, $3, $4, $1);
5461 def p_module_item_36(p
):
5462 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt error ';' '''
5463 print('module_item_36', list(p
))
5464 # { yyerror(@2, "error: Invalid module instantiation");
5466 # if ($1) delete $1;
5469 def p_module_item_37(p
):
5470 '''module_item : K_assign drive_strength_opt delay3_opt cont_assign_list ';' '''
5471 print('module_item_37', list(p
))
5472 # { pform_make_pgassign_list($4, $3, $2, @1.text, @1.first_line); }
5474 def p_module_item_38(p
):
5475 '''module_item : attribute_list_opt K_always statement_item '''
5476 print('module_item_38', list(p
))
5477 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, $3, $1);
5478 # FILE_NAME(tmp, @2);
5481 def p_module_item_39(p
):
5482 '''module_item : attribute_list_opt K_always_comb statement_item '''
5483 print('module_item_39', list(p
))
5484 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_COMB, $3, $1);
5485 # FILE_NAME(tmp, @2);
5488 def p_module_item_40(p
):
5489 '''module_item : attribute_list_opt K_always_ff statement_item '''
5490 print('module_item_40', list(p
))
5491 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, $3, $1);
5492 # FILE_NAME(tmp, @2);
5495 def p_module_item_41(p
):
5496 '''module_item : attribute_list_opt K_always_latch statement_item '''
5497 print('module_item_41', list(p
))
5498 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_LATCH, $3, $1);
5499 # FILE_NAME(tmp, @2);
5502 def p_module_item_42(p
):
5503 '''module_item : attribute_list_opt K_initial statement_item '''
5504 print('module_item_42', list(p
))
5505 # { PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, $3, $1);
5506 # FILE_NAME(tmp, @2);
5509 def p_module_item_43(p
):
5510 '''module_item : attribute_list_opt K_final statement_item '''
5511 print('module_item_43', list(p
))
5512 # { PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, $3, $1);
5513 # FILE_NAME(tmp, @2);
5516 def p_module_item_44(p
):
5517 '''module_item : attribute_list_opt K_analog analog_statement '''
5518 print('module_item_44', list(p
))
5519 # { pform_make_analog_behavior(@2, IVL_PR_ALWAYS, $3); }
5521 def p_module_item_45(p
):
5522 '''module_item : attribute_list_opt assertion_item '''
5523 print('module_item_45', list(p
))
5525 def p_module_item_46(p
):
5526 '''module_item : timeunits_declaration '''
5527 print('module_item_46', list(p
))
5529 def p_module_item_47(p
):
5530 '''module_item : class_declaration '''
5531 print('module_item_47', list(p
))
5533 def p_module_item_48(p
):
5534 '''module_item : task_declaration '''
5535 print('module_item_48', list(p
))
5537 def p_module_item_49(p
):
5538 '''module_item : function_declaration '''
5539 print('module_item_49', list(p
))
5541 def p_module_item_50(p
):
5542 '''module_item : K_generate generate_item_list_opt K_endgenerate '''
5543 print('module_item_50', list(p
))
5544 # { // Test for bad nesting. I understand it, but it is illegal.
5545 # if (pform_parent_generate()) {
5546 # cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
5547 # cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
5548 # cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
5553 def p_module_item_51(p
):
5554 '''module_item : K_genvar list_of_identifiers ';' '''
5555 print('module_item_51', list(p
))
5556 # { pform_genvars(@1, $2); }
5558 def p_module_item_52(p
):
5559 '''module_item : K_for '(' IDENTIFIER '=' expression ';' expression ';' IDENTIFIER '=' expression ')' _embed2_module_item generate_block '''
5560 print('module_item_52', list(p
))
5561 # { pform_endgenerate(); }
5563 def p_module_item_53(p
):
5564 '''module_item : generate_if generate_block_opt K_else _embed3_module_item generate_block '''
5565 print('module_item_53', list(p
))
5566 # { pform_endgenerate(); }
5568 def p_module_item_54(p
):
5569 '''module_item : generate_if generate_block_opt %prec less_than_K_else '''
5570 print('module_item_54', list(p
))
5571 # { pform_endgenerate(); }
5573 def p_module_item_55(p
):
5574 '''module_item : K_case '(' expression ')' _embed4_module_item generate_case_items K_endcase '''
5575 print('module_item_55', list(p
))
5576 # { pform_endgenerate(); }
5578 def p_module_item_56(p
):
5579 '''module_item : modport_declaration '''
5580 print('module_item_56', list(p
))
5582 def p_module_item_57(p
):
5583 '''module_item : package_import_declaration '''
5584 print('module_item_57', list(p
))
5586 def p_module_item_58(p
):
5587 '''module_item : attribute_list_opt K_specparam _embed5_module_item specparam_decl ';' '''
5588 print('module_item_58', list(p
))
5590 def p_module_item_59(p
):
5591 '''module_item : K_specify _embed6_module_item specify_item_list_opt K_endspecify '''
5592 print('module_item_59', list(p
))
5594 def p_module_item_60(p
):
5595 '''module_item : K_specify error K_endspecify '''
5596 print('module_item_60', list(p
))
5597 # { yyerror(@1, "error: syntax error in specify block");
5601 def p_module_item_61(p
):
5602 '''module_item : error ';' '''
5603 print('module_item_61', list(p
))
5604 # { yyerror(@2, "error: invalid module item.");
5608 def p_module_item_62(p
):
5609 '''module_item : K_assign error '=' expression ';' '''
5610 print('module_item_62', list(p
))
5611 # { yyerror(@1, "error: syntax error in left side "
5612 # "of continuous assignment.");
5616 def p_module_item_63(p
):
5617 '''module_item : K_assign error ';' '''
5618 print('module_item_63', list(p
))
5619 # { yyerror(@1, "error: syntax error in "
5620 # "continuous assignment");
5624 def p_module_item_64(p
):
5625 '''module_item : K_function error K_endfunction endlabel_opt '''
5626 print('module_item_64', list(p
))
5627 # { yyerror(@1, "error: I give up on this "
5628 # "function definition.");
5630 # if (!gn_system_verilog()) {
5631 # yyerror(@4, "error: Function end names require "
5632 # "SystemVerilog.");
5639 def p_module_item_65(p
):
5640 '''module_item : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';' '''
5641 print('module_item_65', list(p
))
5642 # { perm_string tmp3 = lex_strings.make($3);
5643 # perm_string tmp5 = lex_strings.make($5);
5644 # pform_set_attrib(tmp3, tmp5, $7);
5649 def p_module_item_66(p
):
5650 '''module_item : KK_attribute '(' error ')' ';' '''
5651 print('module_item_66', list(p
))
5652 # { yyerror(@1, "error: Malformed $attribute parameter list."); }
5654 def p__embed0_module_item(p
):
5655 '''_embed0_module_item : '''
5656 # { attributes_in_context = $1; }
5658 def p__embed1_module_item(p
):
5659 '''_embed1_module_item : '''
5660 # { if (pform_in_interface())
5661 # yyerror(@1, "error: Parameter overrides are not allowed "
5662 # "in interfaces.");
5665 def p__embed2_module_item(p
):
5666 '''_embed2_module_item : '''
5667 # { pform_start_generate_for(@1, $3, $5, $7, $9, $11); }
5669 def p__embed3_module_item(p
):
5670 '''_embed3_module_item : '''
5671 # { pform_start_generate_else(@1); }
5673 def p__embed4_module_item(p
):
5674 '''_embed4_module_item : '''
5675 # { pform_start_generate_case(@1, $3); }
5677 def p__embed5_module_item(p
):
5678 '''_embed5_module_item : '''
5679 # { if (pform_in_interface())
5680 # yyerror(@1, "error: specparam declarations are not allowed "
5681 # "in interfaces.");
5684 def p__embed6_module_item(p
):
5685 '''_embed6_module_item : '''
5686 # { if (pform_in_interface())
5687 # yyerror(@1, "error: specify blocks are not allowed "
5688 # "in interfaces.");
5691 def p_module_item_list_1(p
):
5692 '''module_item_list : module_item_list module_item '''
5693 print('module_item_list_1', list(p
))
5695 def p_module_item_list_2(p
):
5696 '''module_item_list : module_item '''
5697 print('module_item_list_2', list(p
))
5699 def p_module_item_list_opt_1(p
):
5700 '''module_item_list_opt : module_item_list '''
5701 print('module_item_list_opt_1', list(p
))
5703 def p_module_item_list_opt_2(p
):
5704 '''module_item_list_opt : '''
5705 print('module_item_list_opt_2', list(p
))
5707 def p_generate_if_1(p
):
5708 '''generate_if : K_if '(' expression ')' '''
5709 print('generate_if_1', list(p
))
5710 # { pform_start_generate_if(@1, $3); }
5712 def p_generate_case_items_1(p
):
5713 '''generate_case_items : generate_case_items generate_case_item '''
5714 print('generate_case_items_1', list(p
))
5716 def p_generate_case_items_2(p
):
5717 '''generate_case_items : generate_case_item '''
5718 print('generate_case_items_2', list(p
))
5720 def p_generate_case_item_1(p
):
5721 '''generate_case_item : expression_list_proper ':' _embed0_generate_case_item generate_block_opt '''
5722 print('generate_case_item_1', list(p
))
5723 # { pform_endgenerate(); }
5725 def p_generate_case_item_2(p
):
5726 '''generate_case_item : K_default ':' _embed1_generate_case_item generate_block_opt '''
5727 print('generate_case_item_2', list(p
))
5728 # { pform_endgenerate(); }
5730 def p__embed0_generate_case_item(p
):
5731 '''_embed0_generate_case_item : '''
5732 # { pform_generate_case_item(@1, $1); }
5734 def p__embed1_generate_case_item(p
):
5735 '''_embed1_generate_case_item : '''
5736 # { pform_generate_case_item(@1, 0); }
5738 def p_generate_item_1(p
):
5739 '''generate_item : module_item '''
5740 print('generate_item_1', list(p
))
5742 def p_generate_item_2(p
):
5743 '''generate_item : K_begin generate_item_list_opt K_end '''
5744 print('generate_item_2', list(p
))
5745 # { /* Detect and warn about anachronistic begin/end use */
5746 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5748 # cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
5752 def p_generate_item_3(p
):
5753 '''generate_item : K_begin ':' IDENTIFIER _embed0_generate_item generate_item_list_opt K_end '''
5754 print('generate_item_3', list(p
))
5755 # { /* Detect and warn about anachronistic named begin/end use */
5756 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5758 # cerr << @1 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
5760 # pform_endgenerate();
5763 def p__embed0_generate_item(p
):
5764 '''_embed0_generate_item : '''
5766 # pform_start_generate_nblock(@1, $3);
5769 def p_generate_item_list_1(p
):
5770 '''generate_item_list : generate_item_list generate_item '''
5771 print('generate_item_list_1', list(p
))
5773 def p_generate_item_list_2(p
):
5774 '''generate_item_list : generate_item '''
5775 print('generate_item_list_2', list(p
))
5777 def p_generate_item_list_opt_1(p
):
5778 '''generate_item_list_opt : generate_item_list '''
5779 print('generate_item_list_opt_1', list(p
))
5781 def p_generate_item_list_opt_2(p
):
5782 '''generate_item_list_opt : '''
5783 print('generate_item_list_opt_2', list(p
))
5785 def p_generate_block_1(p
):
5786 '''generate_block : module_item '''
5787 print('generate_block_1', list(p
))
5789 def p_generate_block_2(p
):
5790 '''generate_block : K_begin generate_item_list_opt K_end '''
5791 print('generate_block_2', list(p
))
5793 def p_generate_block_3(p
):
5794 '''generate_block : K_begin ':' IDENTIFIER generate_item_list_opt K_end endlabel_opt '''
5795 print('generate_block_3', list(p
))
5796 # { pform_generate_block_name($3);
5798 # if (strcmp($3,$6) != 0) {
5799 # yyerror(@6, "error: End label doesn't match "
5802 # if (! gn_system_verilog()) {
5803 # yyerror(@6, "error: Begin end labels require "
5804 # "SystemVerilog.");
5811 def p_generate_block_opt_1(p
):
5812 '''generate_block_opt : generate_block '''
5813 print('generate_block_opt_1', list(p
))
5815 def p_generate_block_opt_2(p
):
5816 '''generate_block_opt : ';' '''
5817 print('generate_block_opt_2', list(p
))
5819 def p_net_decl_assign_1(p
):
5820 '''net_decl_assign : IDENTIFIER '=' expression '''
5821 print('net_decl_assign_1', list(p
))
5822 # { net_decl_assign_t*tmp = new net_decl_assign_t;
5824 # tmp->name = lex_strings.make($1);
5830 def p_net_decl_assigns_1(p
):
5831 '''net_decl_assigns : net_decl_assigns ',' net_decl_assign '''
5832 print('net_decl_assigns_1', list(p
))
5833 # { net_decl_assign_t*tmp = $1;
5834 # $3->next = tmp->next;
5839 def p_net_decl_assigns_2(p
):
5840 '''net_decl_assigns : net_decl_assign '''
5841 print('net_decl_assigns_2', list(p
))
5845 def p_bit_logic_1(p
):
5846 '''bit_logic : K_logic '''
5847 print('bit_logic_1', list(p
))
5848 # { $$ = IVL_VT_LOGIC; }
5850 def p_bit_logic_2(p
):
5851 '''bit_logic : K_bool '''
5852 print('bit_logic_2', list(p
))
5853 # { $$ = IVL_VT_BOOL; /* Icarus misc */}
5855 def p_bit_logic_3(p
):
5856 '''bit_logic : K_bit '''
5857 print('bit_logic_3', list(p
))
5858 # { $$ = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
5860 def p_bit_logic_opt_1(p
):
5861 '''bit_logic_opt : bit_logic '''
5862 print('bit_logic_opt_1', list(p
))
5864 def p_bit_logic_opt_2(p
):
5865 '''bit_logic_opt : '''
5866 print('bit_logic_opt_2', list(p
))
5867 # { $$ = IVL_VT_NO_TYPE; }
5869 def p_net_type_1(p
):
5870 '''net_type : K_wire '''
5871 print('net_type_1', list(p
))
5872 # { $$ = NetNet::WIRE; }
5874 def p_net_type_2(p
):
5875 '''net_type : K_tri '''
5876 print('net_type_2', list(p
))
5877 # { $$ = NetNet::TRI; }
5879 def p_net_type_3(p
):
5880 '''net_type : K_tri1 '''
5881 print('net_type_3', list(p
))
5882 # { $$ = NetNet::TRI1; }
5884 def p_net_type_4(p
):
5885 '''net_type : K_supply0 '''
5886 print('net_type_4', list(p
))
5887 # { $$ = NetNet::SUPPLY0; }
5889 def p_net_type_5(p
):
5890 '''net_type : K_wand '''
5891 print('net_type_5', list(p
))
5892 # { $$ = NetNet::WAND; }
5894 def p_net_type_6(p
):
5895 '''net_type : K_triand '''
5896 print('net_type_6', list(p
))
5897 # { $$ = NetNet::TRIAND; }
5899 def p_net_type_7(p
):
5900 '''net_type : K_tri0 '''
5901 print('net_type_7', list(p
))
5902 # { $$ = NetNet::TRI0; }
5904 def p_net_type_8(p
):
5905 '''net_type : K_supply1 '''
5906 print('net_type_8', list(p
))
5907 # { $$ = NetNet::SUPPLY1; }
5909 def p_net_type_9(p
):
5910 '''net_type : K_wor '''
5911 print('net_type_9', list(p
))
5912 # { $$ = NetNet::WOR; }
5914 def p_net_type_10(p
):
5915 '''net_type : K_trior '''
5916 print('net_type_10', list(p
))
5917 # { $$ = NetNet::TRIOR; }
5919 def p_net_type_11(p
):
5920 '''net_type : K_wone '''
5921 print('net_type_11', list(p
))
5922 # { $$ = NetNet::UNRESOLVED_WIRE;
5923 # cerr << @1.text << ":" << @1.first_line << ": warning: "
5924 # "'wone' is deprecated, please use 'uwire' "
5925 # "instead." << endl;
5928 def p_net_type_12(p
):
5929 '''net_type : K_uwire '''
5930 print('net_type_12', list(p
))
5931 # { $$ = NetNet::UNRESOLVED_WIRE; }
5933 def p_param_type_1(p
):
5934 '''param_type : bit_logic_opt unsigned_signed_opt dimensions_opt '''
5935 print('param_type_1', list(p
))
5936 # { param_active_range = $3;
5937 # param_active_signed = $2;
5938 # if (($1 == IVL_VT_NO_TYPE) && ($3 != 0))
5939 # param_active_type = IVL_VT_LOGIC;
5941 # param_active_type = $1;
5944 def p_param_type_2(p
):
5945 '''param_type : K_integer '''
5946 print('param_type_2', list(p
))
5947 # { param_active_range = make_range_from_width(integer_width);
5948 # param_active_signed = true;
5949 # param_active_type = IVL_VT_LOGIC;
5952 def p_param_type_3(p
):
5953 '''param_type : K_time '''
5954 print('param_type_3', list(p
))
5955 # { param_active_range = make_range_from_width(64);
5956 # param_active_signed = false;
5957 # param_active_type = IVL_VT_LOGIC;
5960 def p_param_type_4(p
):
5961 '''param_type : real_or_realtime '''
5962 print('param_type_4', list(p
))
5963 # { param_active_range = 0;
5964 # param_active_signed = true;
5965 # param_active_type = IVL_VT_REAL;
5968 def p_param_type_5(p
):
5969 '''param_type : atom2_type '''
5970 print('param_type_5', list(p
))
5971 # { param_active_range = make_range_from_width($1);
5972 # param_active_signed = true;
5973 # param_active_type = IVL_VT_BOOL;
5976 def p_param_type_6(p
):
5977 '''param_type : TYPE_IDENTIFIER '''
5978 print('param_type_6', list(p
))
5979 # { pform_set_param_from_type(@1, $1.type, $1.text, param_active_range,
5980 # param_active_signed, param_active_type);
5984 def p_parameter_assign_list_1(p
):
5985 '''parameter_assign_list : parameter_assign '''
5986 print('parameter_assign_list_1', list(p
))
5988 def p_parameter_assign_list_2(p
):
5989 '''parameter_assign_list : parameter_assign_list ',' parameter_assign '''
5990 print('parameter_assign_list_2', list(p
))
5992 def p_localparam_assign_list_1(p
):
5993 '''localparam_assign_list : localparam_assign '''
5994 print('localparam_assign_list_1', list(p
))
5996 def p_localparam_assign_list_2(p
):
5997 '''localparam_assign_list : localparam_assign_list ',' localparam_assign '''
5998 print('localparam_assign_list_2', list(p
))
6000 def p_parameter_assign_1(p
):
6001 '''parameter_assign : IDENTIFIER '=' expression parameter_value_ranges_opt '''
6002 print('parameter_assign_1', list(p
))
6003 tpname
= Node(syms
.tname
, [Leaf(token
.NAME
, p
[1])])
6004 expr
= Node(syms
.tfpdef
, [tpname
, Leaf(token
.EQUAL
, p
[2]), p
[3] ])
6007 # pform_set_parameter(@1, lex_strings.make($1), param_active_type,
6008 # param_active_signed, param_active_range, tmp, $4);
6012 def p_localparam_assign_1(p
):
6013 '''localparam_assign : IDENTIFIER '=' expression '''
6014 print('localparam_assign_1', list(p
))
6016 # pform_set_localparam(@1, lex_strings.make($1), param_active_type,
6017 # param_active_signed, param_active_range, tmp);
6021 def p_parameter_value_ranges_opt_1(p
):
6022 '''parameter_value_ranges_opt : parameter_value_ranges '''
6023 print('parameter_value_ranges_opt_1', list(p
))
6026 def p_parameter_value_ranges_opt_2(p
):
6027 '''parameter_value_ranges_opt : '''
6028 print('parameter_value_ranges_opt_2', list(p
))
6031 def p_parameter_value_ranges_1(p
):
6032 '''parameter_value_ranges : parameter_value_ranges parameter_value_range '''
6033 print('parameter_value_ranges_1', list(p
))
6034 # { $$ = $2; $$->next = $1; }
6036 def p_parameter_value_ranges_2(p
):
6037 '''parameter_value_ranges : parameter_value_range '''
6038 print('parameter_value_ranges_2', list(p
))
6039 # { $$ = $1; $$->next = 0; }
6041 def p_parameter_value_range_1(p
):
6042 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ']' '''
6043 print('parameter_value_range_1', list(p
))
6044 # { $$ = pform_parameter_value_range($1, false, $3, false, $5); }
6046 def p_parameter_value_range_2(p
):
6047 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ')' '''
6048 print('parameter_value_range_2', list(p
))
6049 # { $$ = pform_parameter_value_range($1, false, $3, true, $5); }
6051 def p_parameter_value_range_3(p
):
6052 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ']' '''
6053 print('parameter_value_range_3', list(p
))
6054 # { $$ = pform_parameter_value_range($1, true, $3, false, $5); }
6056 def p_parameter_value_range_4(p
):
6057 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ')' '''
6058 print('parameter_value_range_4', list(p
))
6059 # { $$ = pform_parameter_value_range($1, true, $3, true, $5); }
6061 def p_parameter_value_range_5(p
):
6062 '''parameter_value_range : K_exclude expression '''
6063 print('parameter_value_range_5', list(p
))
6064 # { $$ = pform_parameter_value_range(true, false, $2, false, $2); }
6066 def p_value_range_expression_1(p
):
6067 '''value_range_expression : expression '''
6068 print('value_range_expression_1', list(p
))
6071 def p_value_range_expression_2(p
):
6072 '''value_range_expression : K_inf '''
6073 print('value_range_expression_2', list(p
))
6076 def p_value_range_expression_3(p
):
6077 '''value_range_expression : '+' K_inf '''
6078 print('value_range_expression_3', list(p
))
6081 def p_value_range_expression_4(p
):
6082 '''value_range_expression : '-' K_inf '''
6083 print('value_range_expression_4', list(p
))
6086 def p_from_exclude_1(p
):
6087 '''from_exclude : K_from '''
6088 print('from_exclude_1', list(p
))
6091 def p_from_exclude_2(p
):
6092 '''from_exclude : K_exclude '''
6093 print('from_exclude_2', list(p
))
6096 def p_parameter_value_opt_1(p
):
6097 '''parameter_value_opt : '#' '(' expression_list_with_nuls ')' '''
6098 print('parameter_value_opt_1', list(p
))
6099 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6100 # tmp->by_order = $3;
6105 def p_parameter_value_opt_2(p
):
6106 '''parameter_value_opt : '#' '(' parameter_value_byname_list ')' '''
6107 print('parameter_value_opt_2', list(p
))
6108 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6109 # tmp->by_order = 0;
6110 # tmp->by_name = $3;
6114 def p_parameter_value_opt_3(p
):
6115 '''parameter_value_opt : '#' DEC_NUMBER '''
6116 print('parameter_value_opt_3', list(p
))
6118 # PENumber*tmp = new PENumber($2);
6119 # FILE_NAME(tmp, @1);
6121 # struct parmvalue_t*lst = new struct parmvalue_t;
6122 # lst->by_order = new list<PExpr*>;
6123 # lst->by_order->push_back(tmp);
6129 def p_parameter_value_opt_4(p
):
6130 '''parameter_value_opt : '#' REALTIME '''
6131 print('parameter_value_opt_4', list(p
))
6133 # PEFNumber*tmp = new PEFNumber($2);
6134 # FILE_NAME(tmp, @1);
6136 # struct parmvalue_t*lst = new struct parmvalue_t;
6137 # lst->by_order = new list<PExpr*>;
6138 # lst->by_order->push_back(tmp);
6143 def p_parameter_value_opt_5(p
):
6144 '''parameter_value_opt : '#' error '''
6145 print('parameter_value_opt_5', list(p
))
6146 # { yyerror(@1, "error: syntax error in parameter value "
6147 # "assignment list.");
6151 def p_parameter_value_opt_6(p
):
6152 '''parameter_value_opt : '''
6153 print('parameter_value_opt_6', list(p
))
6156 def p_parameter_value_byname_1(p
):
6157 '''parameter_value_byname : '.' IDENTIFIER '(' expression ')' '''
6158 print('parameter_value_byname_1', list(p
))
6159 # { named_pexpr_t*tmp = new named_pexpr_t;
6160 # tmp->name = lex_strings.make($2);
6166 def p_parameter_value_byname_2(p
):
6167 '''parameter_value_byname : '.' IDENTIFIER '(' ')' '''
6168 print('parameter_value_byname_2', list(p
))
6169 # { named_pexpr_t*tmp = new named_pexpr_t;
6170 # tmp->name = lex_strings.make($2);
6176 def p_parameter_value_byname_list_1(p
):
6177 '''parameter_value_byname_list : parameter_value_byname '''
6178 print('parameter_value_byname_list_1', list(p
))
6179 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6180 # tmp->push_back(*$1);
6185 def p_parameter_value_byname_list_2(p
):
6186 '''parameter_value_byname_list : parameter_value_byname_list ',' parameter_value_byname '''
6187 print('parameter_value_byname_list_2', list(p
))
6188 # { list<named_pexpr_t>*tmp = $1;
6189 # tmp->push_back(*$3);
6195 '''port : port_reference '''
6196 print('port_1', list(p
))
6200 '''port : '.' IDENTIFIER '(' port_reference ')' '''
6201 print('port_2', list(p
))
6202 # { Module::port_t*tmp = $4;
6203 # tmp->name = lex_strings.make($2);
6209 '''port : '{' port_reference_list '}' '''
6210 print('port_3', list(p
))
6211 # { Module::port_t*tmp = $2;
6212 # tmp->name = perm_string();
6217 '''port : '.' IDENTIFIER '(' '{' port_reference_list '}' ')' '''
6218 print('port_4', list(p
))
6219 # { Module::port_t*tmp = $5;
6220 # tmp->name = lex_strings.make($2);
6225 def p_port_opt_1(p
):
6226 '''port_opt : port '''
6227 print('port_opt_1', list(p
))
6230 def p_port_opt_2(p
):
6232 print('port_opt_2', list(p
))
6235 def p_port_name_1(p
):
6236 '''port_name : '.' IDENTIFIER '(' expression ')' '''
6237 print('port_name_1', list(p
))
6238 # { named_pexpr_t*tmp = new named_pexpr_t;
6239 # tmp->name = lex_strings.make($2);
6245 def p_port_name_2(p
):
6246 '''port_name : '.' IDENTIFIER '(' error ')' '''
6247 print('port_name_2', list(p
))
6248 # { yyerror(@3, "error: invalid port connection expression.");
6249 # named_pexpr_t*tmp = new named_pexpr_t;
6250 # tmp->name = lex_strings.make($2);
6256 def p_port_name_3(p
):
6257 '''port_name : '.' IDENTIFIER '(' ')' '''
6258 print('port_name_3', list(p
))
6259 # { named_pexpr_t*tmp = new named_pexpr_t;
6260 # tmp->name = lex_strings.make($2);
6266 def p_port_name_4(p
):
6267 '''port_name : '.' IDENTIFIER '''
6268 print('port_name_4', list(p
))
6269 # { named_pexpr_t*tmp = new named_pexpr_t;
6270 # tmp->name = lex_strings.make($2);
6271 # tmp->parm = new PEIdent(lex_strings.make($2), true);
6272 # FILE_NAME(tmp->parm, @1);
6277 def p_port_name_5(p
):
6278 '''port_name : K_DOTSTAR '''
6279 print('port_name_5', list(p
))
6280 # { named_pexpr_t*tmp = new named_pexpr_t;
6281 # tmp->name = lex_strings.make("*");
6286 def p_port_name_list_1(p
):
6287 '''port_name_list : port_name_list ',' port_name '''
6288 print('port_name_list_1', list(p
))
6289 # { list<named_pexpr_t>*tmp = $1;
6290 # tmp->push_back(*$3);
6295 def p_port_name_list_2(p
):
6296 '''port_name_list : port_name '''
6297 print('port_name_list_2', list(p
))
6298 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6299 # tmp->push_back(*$1);
6304 def p_port_reference_1(p
):
6305 '''port_reference : IDENTIFIER '''
6306 print('port_reference_1', list(p
))
6307 # { Module::port_t*ptmp;
6308 # perm_string name = lex_strings.make($1);
6309 # ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
6314 def p_port_reference_2(p
):
6315 '''port_reference : IDENTIFIER '[' expression ':' expression ']' '''
6316 print('port_reference_2', list(p
))
6317 # { index_component_t itmp;
6318 # itmp.sel = index_component_t::SEL_PART;
6322 # name_component_t ntmp (lex_strings.make($1));
6323 # ntmp.index.push_back(itmp);
6325 # pform_name_t pname;
6326 # pname.push_back(ntmp);
6328 # PEIdent*wtmp = new PEIdent(pname);
6329 # FILE_NAME(wtmp, @1);
6331 # Module::port_t*ptmp = new Module::port_t;
6332 # ptmp->name = perm_string();
6333 # ptmp->expr.push_back(wtmp);
6339 def p_port_reference_3(p
):
6340 '''port_reference : IDENTIFIER '[' expression ']' '''
6341 print('port_reference_3', list(p
))
6342 # { index_component_t itmp;
6343 # itmp.sel = index_component_t::SEL_BIT;
6347 # name_component_t ntmp (lex_strings.make($1));
6348 # ntmp.index.push_back(itmp);
6350 # pform_name_t pname;
6351 # pname.push_back(ntmp);
6353 # PEIdent*tmp = new PEIdent(pname);
6354 # FILE_NAME(tmp, @1);
6356 # Module::port_t*ptmp = new Module::port_t;
6357 # ptmp->name = perm_string();
6358 # ptmp->expr.push_back(tmp);
6363 def p_port_reference_4(p
):
6364 '''port_reference : IDENTIFIER '[' error ']' '''
6365 print('port_reference_4', list(p
))
6366 # { yyerror(@1, "error: invalid port bit select");
6367 # Module::port_t*ptmp = new Module::port_t;
6368 # PEIdent*wtmp = new PEIdent(lex_strings.make($1));
6369 # FILE_NAME(wtmp, @1);
6370 # ptmp->name = lex_strings.make($1);
6371 # ptmp->expr.push_back(wtmp);
6376 def p_port_reference_list_1(p
):
6377 '''port_reference_list : port_reference '''
6378 print('port_reference_list_1', list(p
))
6381 def p_port_reference_list_2(p
):
6382 '''port_reference_list : port_reference_list ',' port_reference '''
6383 print('port_reference_list_2', list(p
))
6384 # { Module::port_t*tmp = $1;
6385 # append(tmp->expr, $3->expr);
6390 def p_dimensions_opt_1(p
):
6391 '''dimensions_opt : '''
6392 print('dimensions_opt_1', list(p
))
6395 def p_dimensions_opt_2(p
):
6396 '''dimensions_opt : dimensions '''
6397 print('dimensions_opt_2', list(p
))
6400 def p_dimensions_1(p
):
6401 '''dimensions : variable_dimension '''
6402 print('dimensions_1', list(p
))
6405 def p_dimensions_2(p
):
6406 '''dimensions : dimensions variable_dimension '''
6407 print('dimensions_2', list(p
))
6408 # { list<pform_range_t> *tmp = $1;
6410 # tmp->splice(tmp->end(), *$2);
6416 def p_register_variable_1(p
):
6417 '''register_variable : IDENTIFIER dimensions_opt '''
6418 print('register_variable_1', list(p
))
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);
6426 def p_register_variable_2(p
):
6427 '''register_variable : IDENTIFIER dimensions_opt '=' expression '''
6428 print('register_variable_2', list(p
))
6429 # { if (pform_peek_scope()->var_init_needs_explicit_lifetime()
6430 # && (var_lifetime == LexicalScope::INHERITED)) {
6431 # cerr << @3 << ": warning: Static variable initialization requires "
6432 # "explicit lifetime in this context." << endl;
6435 # perm_string name = lex_strings.make($1);
6436 # pform_makewire(@1, name, NetNet::REG,
6437 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6438 # pform_set_reg_idx(name, $2);
6439 # pform_make_var_init(@1, name, $4);
6443 def p_register_variable_list_1(p
):
6444 '''register_variable_list : register_variable '''
6445 print('register_variable_list_1', list(p
))
6446 # { list<perm_string>*tmp = new list<perm_string>;
6447 # tmp->push_back(lex_strings.make($1));
6452 def p_register_variable_list_2(p
):
6453 '''register_variable_list : register_variable_list ',' register_variable '''
6454 print('register_variable_list_2', list(p
))
6455 # { list<perm_string>*tmp = $1;
6456 # tmp->push_back(lex_strings.make($3));
6461 def p_net_variable_1(p
):
6462 '''net_variable : IDENTIFIER dimensions_opt '''
6463 print('net_variable_1', list(p
))
6464 # { perm_string name = lex_strings.make($1);
6465 # pform_makewire(@1, name, NetNet::IMPLICIT,
6466 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6467 # pform_set_reg_idx(name, $2);
6471 def p_net_variable_list_1(p
):
6472 '''net_variable_list : net_variable '''
6473 print('net_variable_list_1', list(p
))
6474 # { list<perm_string>*tmp = new list<perm_string>;
6475 # tmp->push_back(lex_strings.make($1));
6480 def p_net_variable_list_2(p
):
6481 '''net_variable_list : net_variable_list ',' net_variable '''
6482 print('net_variable_list_2', list(p
))
6483 # { list<perm_string>*tmp = $1;
6484 # tmp->push_back(lex_strings.make($3));
6489 def p_event_variable_1(p
):
6490 '''event_variable : IDENTIFIER dimensions_opt '''
6491 print('event_variable_1', list(p
))
6493 # yyerror(@2, "sorry: event arrays are not supported.");
6499 def p_event_variable_list_1(p
):
6500 '''event_variable_list : event_variable '''
6501 print('event_variable_list_1', list(p
))
6502 # { $$ = list_from_identifier($1); }
6504 def p_event_variable_list_2(p
):
6505 '''event_variable_list : event_variable_list ',' event_variable '''
6506 print('event_variable_list_2', list(p
))
6507 # { $$ = list_from_identifier($1, $3); }
6509 def p_specify_item_1(p
):
6510 '''specify_item : K_specparam specparam_decl ';' '''
6511 print('specify_item_1', list(p
))
6513 def p_specify_item_2(p
):
6514 '''specify_item : specify_simple_path_decl ';' '''
6515 print('specify_item_2', list(p
))
6516 # { pform_module_specify_path($1);
6519 def p_specify_item_3(p
):
6520 '''specify_item : specify_edge_path_decl ';' '''
6521 print('specify_item_3', list(p
))
6522 # { pform_module_specify_path($1);
6525 def p_specify_item_4(p
):
6526 '''specify_item : K_if '(' expression ')' specify_simple_path_decl ';' '''
6527 print('specify_item_4', list(p
))
6528 # { PSpecPath*tmp = $5;
6530 # tmp->conditional = true;
6531 # tmp->condition = $3;
6533 # pform_module_specify_path(tmp);
6536 def p_specify_item_5(p
):
6537 '''specify_item : K_if '(' expression ')' specify_edge_path_decl ';' '''
6538 print('specify_item_5', list(p
))
6539 # { PSpecPath*tmp = $5;
6541 # tmp->conditional = true;
6542 # tmp->condition = $3;
6544 # pform_module_specify_path(tmp);
6547 def p_specify_item_6(p
):
6548 '''specify_item : K_ifnone specify_simple_path_decl ';' '''
6549 print('specify_item_6', list(p
))
6550 # { PSpecPath*tmp = $2;
6552 # tmp->conditional = true;
6553 # tmp->condition = 0;
6555 # pform_module_specify_path(tmp);
6558 def p_specify_item_7(p
):
6559 '''specify_item : K_ifnone specify_edge_path_decl ';' '''
6560 print('specify_item_7', list(p
))
6561 # { yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
6562 # "not supported.");
6566 def p_specify_item_8(p
):
6567 '''specify_item : K_Sfullskew '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6568 print('specify_item_8', list(p
))
6573 def p_specify_item_9(p
):
6574 '''specify_item : K_Shold '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6575 print('specify_item_9', list(p
))
6579 def p_specify_item_10(p
):
6580 '''specify_item : K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6581 print('specify_item_10', list(p
))
6586 def p_specify_item_11(p
):
6587 '''specify_item : K_Speriod '(' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6588 print('specify_item_11', list(p
))
6592 def p_specify_item_12(p
):
6593 '''specify_item : K_Srecovery '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6594 print('specify_item_12', list(p
))
6598 def p_specify_item_13(p
):
6599 '''specify_item : K_Srecrem '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6600 print('specify_item_13', list(p
))
6605 def p_specify_item_14(p
):
6606 '''specify_item : K_Sremoval '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6607 print('specify_item_14', list(p
))
6611 def p_specify_item_15(p
):
6612 '''specify_item : K_Ssetup '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6613 print('specify_item_15', list(p
))
6617 def p_specify_item_16(p
):
6618 '''specify_item : K_Ssetuphold '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6619 print('specify_item_16', list(p
))
6624 def p_specify_item_17(p
):
6625 '''specify_item : K_Sskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6626 print('specify_item_17', list(p
))
6630 def p_specify_item_18(p
):
6631 '''specify_item : K_Stimeskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6632 print('specify_item_18', list(p
))
6636 def p_specify_item_19(p
):
6637 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ',' expression spec_notifier_opt ')' ';' '''
6638 print('specify_item_19', list(p
))
6643 def p_specify_item_20(p
):
6644 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ')' ';' '''
6645 print('specify_item_20', list(p
))
6649 def p_specify_item_21(p
):
6650 '''specify_item : K_pulsestyle_onevent specify_path_identifiers ';' '''
6651 print('specify_item_21', list(p
))
6655 def p_specify_item_22(p
):
6656 '''specify_item : K_pulsestyle_ondetect specify_path_identifiers ';' '''
6657 print('specify_item_22', list(p
))
6661 def p_specify_item_23(p
):
6662 '''specify_item : K_showcancelled specify_path_identifiers ';' '''
6663 print('specify_item_23', list(p
))
6667 def p_specify_item_24(p
):
6668 '''specify_item : K_noshowcancelled specify_path_identifiers ';' '''
6669 print('specify_item_24', list(p
))
6673 def p_specify_item_list_1(p
):
6674 '''specify_item_list : specify_item '''
6675 print('specify_item_list_1', list(p
))
6677 def p_specify_item_list_2(p
):
6678 '''specify_item_list : specify_item_list specify_item '''
6679 print('specify_item_list_2', list(p
))
6681 def p_specify_item_list_opt_1(p
):
6682 '''specify_item_list_opt : '''
6683 print('specify_item_list_opt_1', list(p
))
6686 def p_specify_item_list_opt_2(p
):
6687 '''specify_item_list_opt : specify_item_list '''
6688 print('specify_item_list_opt_2', list(p
))
6691 def p_specify_edge_path_decl_1(p
):
6692 '''specify_edge_path_decl : specify_edge_path '=' '(' delay_value_list ')' '''
6693 print('specify_edge_path_decl_1', list(p
))
6694 # { $$ = pform_assign_path_delay($1, $4); }
6696 def p_specify_edge_path_decl_2(p
):
6697 '''specify_edge_path_decl : specify_edge_path '=' delay_value_simple '''
6698 print('specify_edge_path_decl_2', list(p
))
6699 # { list<PExpr*>*tmp = new list<PExpr*>;
6700 # tmp->push_back($3);
6701 # $$ = pform_assign_path_delay($1, tmp);
6704 def p_edge_operator_1(p
):
6705 '''edge_operator : K_posedge '''
6706 print('edge_operator_1', list(p
))
6709 def p_edge_operator_2(p
):
6710 '''edge_operator : K_negedge '''
6711 print('edge_operator_2', list(p
))
6714 def p_specify_edge_path_1(p
):
6715 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6716 print('specify_edge_path_1', list(p
))
6717 # { int edge_flag = 0;
6718 # $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, false, $6, $8); }
6720 def p_specify_edge_path_2(p
):
6721 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6722 print('specify_edge_path_2', list(p
))
6723 # { int edge_flag = $2? 1 : -1;
6724 # $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, false, $7, $9);}
6726 def p_specify_edge_path_3(p
):
6727 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6728 print('specify_edge_path_3', list(p
))
6729 # { int edge_flag = 0;
6730 # $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, true, $6, $8); }
6732 def p_specify_edge_path_4(p
):
6733 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6734 print('specify_edge_path_4', list(p
))
6735 # { int edge_flag = $2? 1 : -1;
6736 # $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, true, $7, $9); }
6738 def p_polarity_operator_1(p
):
6739 '''polarity_operator : K_PO_POS '''
6740 print('polarity_operator_1', list(p
))
6742 def p_polarity_operator_2(p
):
6743 '''polarity_operator : K_PO_NEG '''
6744 print('polarity_operator_2', list(p
))
6746 def p_polarity_operator_3(p
):
6747 '''polarity_operator : ':' '''
6748 print('polarity_operator_3', list(p
))
6750 def p_specify_simple_path_decl_1(p
):
6751 '''specify_simple_path_decl : specify_simple_path '=' '(' delay_value_list ')' '''
6752 print('specify_simple_path_decl_1', list(p
))
6753 # { $$ = pform_assign_path_delay($1, $4); }
6755 def p_specify_simple_path_decl_2(p
):
6756 '''specify_simple_path_decl : specify_simple_path '=' delay_value_simple '''
6757 print('specify_simple_path_decl_2', list(p
))
6758 # { list<PExpr*>*tmp = new list<PExpr*>;
6759 # tmp->push_back($3);
6760 # $$ = pform_assign_path_delay($1, tmp);
6763 def p_specify_simple_path_decl_3(p
):
6764 '''specify_simple_path_decl : specify_simple_path '=' '(' error ')' '''
6765 print('specify_simple_path_decl_3', list(p
))
6766 # { yyerror(@3, "Syntax error in delay value list.");
6771 def p_specify_simple_path_1(p
):
6772 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' '''
6773 print('specify_simple_path_1', list(p
))
6774 # { $$ = pform_make_specify_path(@1, $2, $3, false, $5); }
6776 def p_specify_simple_path_2(p
):
6777 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' '''
6778 print('specify_simple_path_2', list(p
))
6779 # { $$ = pform_make_specify_path(@1, $2, $3, true, $5); }
6781 def p_specify_simple_path_3(p
):
6782 '''specify_simple_path : '(' error ')' '''
6783 print('specify_simple_path_3', list(p
))
6784 # { yyerror(@1, "Invalid simple path");
6788 def p_specify_path_identifiers_1(p
):
6789 '''specify_path_identifiers : IDENTIFIER '''
6790 print('specify_path_identifiers_1', list(p
))
6791 # { list<perm_string>*tmp = new list<perm_string>;
6792 # tmp->push_back(lex_strings.make($1));
6797 def p_specify_path_identifiers_2(p
):
6798 '''specify_path_identifiers : IDENTIFIER '[' expr_primary ']' '''
6799 print('specify_path_identifiers_2', list(p
))
6800 # { if (gn_specify_blocks_flag) {
6801 # yywarn(@4, "Bit selects are not currently supported "
6802 # "in path declarations. The declaration "
6803 # "will be applied to the whole vector.");
6805 # list<perm_string>*tmp = new list<perm_string>;
6806 # tmp->push_back(lex_strings.make($1));
6811 def p_specify_path_identifiers_3(p
):
6812 '''specify_path_identifiers : IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6813 print('specify_path_identifiers_3', list(p
))
6814 # { if (gn_specify_blocks_flag) {
6815 # yywarn(@4, "Part selects are not currently supported "
6816 # "in path declarations. The declaration "
6817 # "will be applied to the whole vector.");
6819 # list<perm_string>*tmp = new list<perm_string>;
6820 # tmp->push_back(lex_strings.make($1));
6825 def p_specify_path_identifiers_4(p
):
6826 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '''
6827 print('specify_path_identifiers_4', list(p
))
6828 # { list<perm_string>*tmp = $1;
6829 # tmp->push_back(lex_strings.make($3));
6834 def p_specify_path_identifiers_5(p
):
6835 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' '''
6836 print('specify_path_identifiers_5', list(p
))
6837 # { if (gn_specify_blocks_flag) {
6838 # yywarn(@4, "Bit selects are not currently supported "
6839 # "in path declarations. The declaration "
6840 # "will be applied to the whole vector.");
6842 # list<perm_string>*tmp = $1;
6843 # tmp->push_back(lex_strings.make($3));
6848 def p_specify_path_identifiers_6(p
):
6849 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6850 print('specify_path_identifiers_6', list(p
))
6851 # { if (gn_specify_blocks_flag) {
6852 # yywarn(@4, "Part selects are not currently supported "
6853 # "in path declarations. The declaration "
6854 # "will be applied to the whole vector.");
6856 # list<perm_string>*tmp = $1;
6857 # tmp->push_back(lex_strings.make($3));
6862 def p_specparam_1(p
):
6863 '''specparam : IDENTIFIER '=' expression '''
6864 print('specparam_1', list(p
))
6866 # pform_set_specparam(@1, lex_strings.make($1),
6867 # param_active_range, tmp);
6871 def p_specparam_2(p
):
6872 '''specparam : IDENTIFIER '=' expression ':' expression ':' expression '''
6873 print('specparam_2', list(p
))
6875 # switch (min_typ_max_flag) {
6892 # if (min_typ_max_warn > 0) {
6893 # cerr << tmp->get_fileline() << ": warning: choosing ";
6894 # switch (min_typ_max_flag) {
6905 # cerr << " expression." << endl;
6906 # min_typ_max_warn -= 1;
6908 # pform_set_specparam(@1, lex_strings.make($1),
6909 # param_active_range, tmp);
6913 def p_specparam_3(p
):
6914 '''specparam : PATHPULSE_IDENTIFIER '=' expression '''
6915 print('specparam_3', list(p
))
6920 def p_specparam_4(p
):
6921 '''specparam : PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' '''
6922 print('specparam_4', list(p
))
6928 def p_specparam_list_1(p
):
6929 '''specparam_list : specparam '''
6930 print('specparam_list_1', list(p
))
6932 def p_specparam_list_2(p
):
6933 '''specparam_list : specparam_list ',' specparam '''
6934 print('specparam_list_2', list(p
))
6936 def p_specparam_decl_1(p
):
6937 '''specparam_decl : specparam_list '''
6938 print('specparam_decl_1', list(p
))
6940 def p_specparam_decl_2(p
):
6941 '''specparam_decl : dimensions _embed0_specparam_decl specparam_list '''
6942 print('specparam_decl_2', list(p
))
6943 # { param_active_range = 0; }
6945 def p__embed0_specparam_decl(p
):
6946 '''_embed0_specparam_decl : '''
6947 # { param_active_range = $1; }
6949 def p_spec_polarity_1(p
):
6950 '''spec_polarity : '+' '''
6951 print('spec_polarity_1', list(p
))
6954 def p_spec_polarity_2(p
):
6955 '''spec_polarity : '-' '''
6956 print('spec_polarity_2', list(p
))
6959 def p_spec_polarity_3(p
):
6960 '''spec_polarity : '''
6961 print('spec_polarity_3', list(p
))
6964 def p_spec_reference_event_1(p
):
6965 '''spec_reference_event : K_posedge expression '''
6966 print('spec_reference_event_1', list(p
))
6969 def p_spec_reference_event_2(p
):
6970 '''spec_reference_event : K_negedge expression '''
6971 print('spec_reference_event_2', list(p
))
6974 def p_spec_reference_event_3(p
):
6975 '''spec_reference_event : K_posedge expr_primary K_TAND expression '''
6976 print('spec_reference_event_3', list(p
))
6981 def p_spec_reference_event_4(p
):
6982 '''spec_reference_event : K_negedge expr_primary K_TAND expression '''
6983 print('spec_reference_event_4', list(p
))
6988 def p_spec_reference_event_5(p
):
6989 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary '''
6990 print('spec_reference_event_5', list(p
))
6993 def p_spec_reference_event_6(p
):
6994 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression '''
6995 print('spec_reference_event_6', list(p
))
7000 def p_spec_reference_event_7(p
):
7001 '''spec_reference_event : expr_primary K_TAND expression '''
7002 print('spec_reference_event_7', list(p
))
7007 def p_spec_reference_event_8(p
):
7008 '''spec_reference_event : expr_primary '''
7009 print('spec_reference_event_8', list(p
))
7012 def p_edge_descriptor_list_1(p
):
7013 '''edge_descriptor_list : edge_descriptor_list ',' K_edge_descriptor '''
7014 print('edge_descriptor_list_1', list(p
))
7016 def p_edge_descriptor_list_2(p
):
7017 '''edge_descriptor_list : K_edge_descriptor '''
7018 print('edge_descriptor_list_2', list(p
))
7020 def p_spec_notifier_opt_1(p
):
7021 '''spec_notifier_opt : '''
7022 print('spec_notifier_opt_1', list(p
))
7025 def p_spec_notifier_opt_2(p
):
7026 '''spec_notifier_opt : spec_notifier '''
7027 print('spec_notifier_opt_2', list(p
))
7030 def p_spec_notifier_1(p
):
7031 '''spec_notifier : ',' '''
7032 print('spec_notifier_1', list(p
))
7033 # { args_after_notifier = 0; }
7035 def p_spec_notifier_2(p
):
7036 '''spec_notifier : ',' hierarchy_identifier '''
7037 print('spec_notifier_2', list(p
))
7038 # { args_after_notifier = 0; delete $2; }
7040 def p_spec_notifier_3(p
):
7041 '''spec_notifier : spec_notifier ',' '''
7042 print('spec_notifier_3', list(p
))
7043 # { args_after_notifier += 1; }
7045 def p_spec_notifier_4(p
):
7046 '''spec_notifier : spec_notifier ',' hierarchy_identifier '''
7047 print('spec_notifier_4', list(p
))
7048 # { args_after_notifier += 1;
7049 # if (args_after_notifier >= 3) {
7050 # cerr << @3 << ": warning: timing checks are not supported "
7051 # "and delayed signal \"" << *$3
7052 # << "\" will not be driven." << endl;
7056 def p_spec_notifier_5(p
):
7057 '''spec_notifier : IDENTIFIER '''
7058 print('spec_notifier_5', list(p
))
7059 # { args_after_notifier = 0; delete[]$1; }
7061 def p_statement_item_1(p
):
7062 '''statement_item : K_assign lpvalue '=' expression ';' '''
7063 print('statement_item_1', list(p
))
7064 # { PCAssign*tmp = new PCAssign($2, $4);
7065 # FILE_NAME(tmp, @1);
7069 def p_statement_item_2(p
):
7070 '''statement_item : K_deassign lpvalue ';' '''
7071 print('statement_item_2', list(p
))
7072 # { PDeassign*tmp = new PDeassign($2);
7073 # FILE_NAME(tmp, @1);
7077 def p_statement_item_3(p
):
7078 '''statement_item : K_force lpvalue '=' expression ';' '''
7079 print('statement_item_3', list(p
))
7080 # { PForce*tmp = new PForce($2, $4);
7081 # FILE_NAME(tmp, @1);
7085 def p_statement_item_4(p
):
7086 '''statement_item : K_release lpvalue ';' '''
7087 print('statement_item_4', list(p
))
7088 # { PRelease*tmp = new PRelease($2);
7089 # FILE_NAME(tmp, @1);
7093 def p_statement_item_5(p
):
7094 '''statement_item : K_begin K_end '''
7095 print('statement_item_5', list(p
))
7096 # { PBlock*tmp = new PBlock(PBlock::BL_SEQ);
7097 # FILE_NAME(tmp, @1);
7101 def p_statement_item_6(p
):
7102 '''statement_item : K_begin _embed0_statement_item block_item_decls_opt _embed1_statement_item statement_or_null_list K_end '''
7103 print('statement_item_6', list(p
))
7106 # pform_pop_scope();
7107 # assert(! current_block_stack.empty());
7108 # tmp = current_block_stack.top();
7109 # current_block_stack.pop();
7111 # tmp = new PBlock(PBlock::BL_SEQ);
7112 # FILE_NAME(tmp, @1);
7114 # if ($5) tmp->set_statement(*$5);
7119 def p_statement_item_7(p
):
7120 '''statement_item : K_begin ':' IDENTIFIER _embed2_statement_item block_item_decls_opt statement_or_null_list_opt K_end endlabel_opt '''
7121 print('statement_item_7', list(p
))
7122 # { pform_pop_scope();
7123 # assert(! current_block_stack.empty());
7124 # PBlock*tmp = current_block_stack.top();
7125 # current_block_stack.pop();
7126 # if ($6) tmp->set_statement(*$6);
7129 # if (strcmp($3,$8) != 0) {
7130 # yyerror(@8, "error: End label doesn't match begin name");
7132 # if (! gn_system_verilog()) {
7133 # yyerror(@8, "error: Begin end labels require "
7134 # "SystemVerilog.");
7142 def p_statement_item_8(p
):
7143 '''statement_item : K_fork join_keyword '''
7144 print('statement_item_8', list(p
))
7145 # { PBlock*tmp = new PBlock($2);
7146 # FILE_NAME(tmp, @1);
7150 def p_statement_item_9(p
):
7151 '''statement_item : K_fork _embed3_statement_item block_item_decls_opt _embed4_statement_item statement_or_null_list join_keyword '''
7152 print('statement_item_9', list(p
))
7155 # pform_pop_scope();
7156 # assert(! current_block_stack.empty());
7157 # tmp = current_block_stack.top();
7158 # current_block_stack.pop();
7159 # tmp->set_join_type($6);
7161 # tmp = new PBlock($6);
7162 # FILE_NAME(tmp, @1);
7164 # if ($5) tmp->set_statement(*$5);
7169 def p_statement_item_10(p
):
7170 '''statement_item : K_fork ':' IDENTIFIER _embed5_statement_item block_item_decls_opt statement_or_null_list_opt join_keyword endlabel_opt '''
7171 print('statement_item_10', list(p
))
7172 # { pform_pop_scope();
7173 # assert(! current_block_stack.empty());
7174 # PBlock*tmp = current_block_stack.top();
7175 # current_block_stack.pop();
7176 # tmp->set_join_type($7);
7177 # if ($6) tmp->set_statement(*$6);
7180 # if (strcmp($3,$8) != 0) {
7181 # yyerror(@8, "error: End label doesn't match fork name");
7183 # if (! gn_system_verilog()) {
7184 # yyerror(@8, "error: Fork end labels require "
7185 # "SystemVerilog.");
7193 def p_statement_item_11(p
):
7194 '''statement_item : K_disable hierarchy_identifier ';' '''
7195 print('statement_item_11', list(p
))
7196 # { PDisable*tmp = new PDisable(*$2);
7197 # FILE_NAME(tmp, @1);
7202 def p_statement_item_12(p
):
7203 '''statement_item : K_disable K_fork ';' '''
7204 print('statement_item_12', list(p
))
7205 # { pform_name_t tmp_name;
7206 # PDisable*tmp = new PDisable(tmp_name);
7207 # FILE_NAME(tmp, @1);
7211 def p_statement_item_13(p
):
7212 '''statement_item : K_TRIGGER hierarchy_identifier ';' '''
7213 print('statement_item_13', list(p
))
7214 # { PTrigger*tmp = new PTrigger(*$2);
7215 # FILE_NAME(tmp, @1);
7220 def p_statement_item_14(p
):
7221 '''statement_item : procedural_assertion_statement '''
7222 print('statement_item_14', list(p
))
7225 def p_statement_item_15(p
):
7226 '''statement_item : loop_statement '''
7227 print('statement_item_15', list(p
))
7230 def p_statement_item_16(p
):
7231 '''statement_item : jump_statement '''
7232 print('statement_item_16', list(p
))
7235 def p_statement_item_17(p
):
7236 '''statement_item : K_case '(' expression ')' case_items K_endcase '''
7237 print('statement_item_17', list(p
))
7238 # { PCase*tmp = new PCase(NetCase::EQ, $3, $5);
7239 # FILE_NAME(tmp, @1);
7243 def p_statement_item_18(p
):
7244 '''statement_item : K_casex '(' expression ')' case_items K_endcase '''
7245 print('statement_item_18', list(p
))
7246 # { PCase*tmp = new PCase(NetCase::EQX, $3, $5);
7247 # FILE_NAME(tmp, @1);
7251 def p_statement_item_19(p
):
7252 '''statement_item : K_casez '(' expression ')' case_items K_endcase '''
7253 print('statement_item_19', list(p
))
7254 # { PCase*tmp = new PCase(NetCase::EQZ, $3, $5);
7255 # FILE_NAME(tmp, @1);
7259 def p_statement_item_20(p
):
7260 '''statement_item : K_case '(' expression ')' error K_endcase '''
7261 print('statement_item_20', list(p
))
7264 def p_statement_item_21(p
):
7265 '''statement_item : K_casex '(' expression ')' error K_endcase '''
7266 print('statement_item_21', list(p
))
7269 def p_statement_item_22(p
):
7270 '''statement_item : K_casez '(' expression ')' error K_endcase '''
7271 print('statement_item_22', list(p
))
7274 def p_statement_item_23(p
):
7275 '''statement_item : K_if '(' expression ')' statement_or_null %prec less_than_K_else '''
7276 print('statement_item_23', list(p
))
7277 # { PCondit*tmp = new PCondit($3, $5, 0);
7278 # FILE_NAME(tmp, @1);
7282 def p_statement_item_24(p
):
7283 '''statement_item : K_if '(' expression ')' statement_or_null K_else statement_or_null '''
7284 print('statement_item_24', list(p
))
7285 # { PCondit*tmp = new PCondit($3, $5, $7);
7286 # FILE_NAME(tmp, @1);
7290 def p_statement_item_25(p
):
7291 '''statement_item : K_if '(' error ')' statement_or_null %prec less_than_K_else '''
7292 print('statement_item_25', list(p
))
7293 # { yyerror(@1, "error: Malformed conditional expression.");
7297 def p_statement_item_26(p
):
7298 '''statement_item : K_if '(' error ')' statement_or_null K_else statement_or_null '''
7299 print('statement_item_26', list(p
))
7300 # { yyerror(@1, "error: Malformed conditional expression.");
7304 def p_statement_item_27(p
):
7305 '''statement_item : compressed_statement ';' '''
7306 print('statement_item_27', list(p
))
7309 def p_statement_item_28(p
):
7310 '''statement_item : inc_or_dec_expression ';' '''
7311 print('statement_item_28', list(p
))
7312 # { $$ = pform_compressed_assign_from_inc_dec(@1, $1); }
7314 def p_statement_item_29(p
):
7315 '''statement_item : delay1 statement_or_null '''
7316 print('statement_item_29', list(p
))
7317 # { PExpr*del = $1->front();
7318 # assert($1->size() == 1);
7320 # PDelayStatement*tmp = new PDelayStatement(del, $2);
7321 # FILE_NAME(tmp, @1);
7325 def p_statement_item_30(p
):
7326 '''statement_item : event_control statement_or_null '''
7327 print('statement_item_30', list(p
))
7328 # { PEventStatement*tmp = $1;
7330 # yyerror(@1, "error: Invalid event control.");
7333 # tmp->set_statement($2);
7338 def p_statement_item_31(p
):
7339 '''statement_item : '@' '*' statement_or_null '''
7340 print('statement_item_31', list(p
))
7341 # { PEventStatement*tmp = new PEventStatement;
7342 # FILE_NAME(tmp, @1);
7343 # tmp->set_statement($3);
7347 def p_statement_item_32(p
):
7348 '''statement_item : '@' '(' '*' ')' statement_or_null '''
7349 print('statement_item_32', list(p
))
7350 # { PEventStatement*tmp = new PEventStatement;
7351 # FILE_NAME(tmp, @1);
7352 # tmp->set_statement($5);
7356 def p_statement_item_33(p
):
7357 '''statement_item : lpvalue '=' expression ';' '''
7358 print('statement_item33', list(p
))
7360 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), p
[3] ])
7361 print ("expr TODO", repr(expr
))
7363 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), ])
7364 print ("expr", repr(expr
))
7365 print ("expr (python):'%s'" % expr
)
7367 # { PAssign*tmp = new PAssign($1,$3);
7368 # FILE_NAME(tmp, @1);
7372 def p_statement_item_34(p
):
7373 '''statement_item : error '=' expression ';' '''
7374 print('statement_item_34', list(p
))
7375 # { yyerror(@2, "Syntax in assignment statement l-value.");
7380 def p_statement_item_35(p
):
7381 '''statement_item : lpvalue K_LE expression ';' '''
7382 print('statement_item_35', list(p
))
7383 # { PAssignNB*tmp = new PAssignNB($1,$3);
7384 # FILE_NAME(tmp, @1);
7388 def p_statement_item_36(p
):
7389 '''statement_item : error K_LE expression ';' '''
7390 print('statement_item_36', list(p
))
7391 # { yyerror(@2, "Syntax in assignment statement l-value.");
7396 def p_statement_item_37(p
):
7397 '''statement_item : lpvalue '=' delay1 expression ';' '''
7398 print('statement_item_37', list(p
))
7399 # { PExpr*del = $3->front(); $3->pop_front();
7400 # assert($3->empty());
7401 # PAssign*tmp = new PAssign($1,del,$4);
7402 # FILE_NAME(tmp, @1);
7406 def p_statement_item_38(p
):
7407 '''statement_item : lpvalue K_LE delay1 expression ';' '''
7408 print('statement_item_38', list(p
))
7409 # { PExpr*del = $3->front(); $3->pop_front();
7410 # assert($3->empty());
7411 # PAssignNB*tmp = new PAssignNB($1,del,$4);
7412 # FILE_NAME(tmp, @1);
7416 def p_statement_item_39(p
):
7417 '''statement_item : lpvalue '=' event_control expression ';' '''
7418 print('statement_item_39', list(p
))
7419 # { PAssign*tmp = new PAssign($1,0,$3,$4);
7420 # FILE_NAME(tmp, @1);
7424 def p_statement_item_40(p
):
7425 '''statement_item : lpvalue '=' K_repeat '(' expression ')' event_control expression ';' '''
7426 print('statement_item_40', list(p
))
7427 # { PAssign*tmp = new PAssign($1,$5,$7,$8);
7428 # FILE_NAME(tmp,@1);
7429 # tmp->set_lineno(@1.first_line);
7433 def p_statement_item_41(p
):
7434 '''statement_item : lpvalue K_LE event_control expression ';' '''
7435 print('statement_item_41', list(p
))
7436 # { PAssignNB*tmp = new PAssignNB($1,0,$3,$4);
7437 # FILE_NAME(tmp, @1);
7441 def p_statement_item_42(p
):
7442 '''statement_item : lpvalue K_LE K_repeat '(' expression ')' event_control expression ';' '''
7443 print('statement_item_42', list(p
))
7444 # { PAssignNB*tmp = new PAssignNB($1,$5,$7,$8);
7445 # FILE_NAME(tmp, @1);
7449 def p_statement_item_43(p
):
7450 '''statement_item : lpvalue '=' dynamic_array_new ';' '''
7451 print('statement_item_43', list(p
))
7452 # { PAssign*tmp = new PAssign($1,$3);
7453 # FILE_NAME(tmp, @1);
7457 def p_statement_item_44(p
):
7458 '''statement_item : lpvalue '=' class_new ';' '''
7459 print('statement_item_44', list(p
))
7460 # { PAssign*tmp = new PAssign($1,$3);
7461 # FILE_NAME(tmp, @1);
7465 def p_statement_item_45(p
):
7466 '''statement_item : K_wait '(' expression ')' statement_or_null '''
7467 print('statement_item_45', list(p
))
7468 # { PEventStatement*tmp;
7469 # PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, $3);
7470 # tmp = new PEventStatement(etmp);
7471 # FILE_NAME(tmp,@1);
7472 # tmp->set_statement($5);
7476 def p_statement_item_46(p
):
7477 '''statement_item : K_wait K_fork ';' '''
7478 print('statement_item_46', list(p
))
7479 # { PEventStatement*tmp = new PEventStatement((PEEvent*)0);
7480 # FILE_NAME(tmp,@1);
7484 def p_statement_item_47(p
):
7485 '''statement_item : SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';' '''
7486 print('statement_item_47', list(p
))
7487 # { PCallTask*tmp = new PCallTask(lex_strings.make($1), *$3);
7488 # FILE_NAME(tmp,@1);
7494 def p_statement_item_48(p
):
7495 '''statement_item : SYSTEM_IDENTIFIER ';' '''
7496 print('statement_item_48', list(p
))
7498 # PCallTask*tmp = new PCallTask(lex_strings.make($1), pt);
7499 # FILE_NAME(tmp,@1);
7504 def p_statement_item_49(p
):
7505 '''statement_item : hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7506 print('statement_item_49', list(p
))
7507 # { PCallTask*tmp = pform_make_call_task(@1, *$1, *$3);
7513 def p_statement_item_50(p
):
7514 '''statement_item : hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';' '''
7515 print('statement_item_50', list(p
))
7516 # { /* ....randomize with { <constraints> } */
7517 # if ($1 && peek_tail_name(*$1) == "randomize") {
7518 # if (!gn_system_verilog())
7519 # yyerror(@2, "error: Randomize with constraint requires SystemVerilog.");
7521 # yyerror(@2, "sorry: Randomize with constraint not supported.");
7523 # yyerror(@2, "error: Constraint block can only be applied to randomize method.");
7526 # PCallTask*tmp = new PCallTask(*$1, pt);
7527 # FILE_NAME(tmp, @1);
7532 def p_statement_item_51(p
):
7533 '''statement_item : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7534 print('statement_item_51', list(p
))
7535 # { pform_name_t*t_name = $1;
7536 # while (! $3->empty()) {
7537 # t_name->push_back($3->front());
7540 # PCallTask*tmp = new PCallTask(*t_name, *$5);
7541 # FILE_NAME(tmp, @1);
7548 def p_statement_item_52(p
):
7549 '''statement_item : hierarchy_identifier ';' '''
7550 print('statement_item_52', list(p
))
7552 # PCallTask*tmp = pform_make_call_task(@1, *$1, pt);
7557 def p_statement_item_53(p
):
7558 '''statement_item : implicit_class_handle '.' K_new '(' expression_list_with_nuls ')' ';' '''
7559 print('statement_item_53', list(p
))
7560 # { PChainConstructor*tmp = new PChainConstructor(*$5);
7561 # FILE_NAME(tmp, @3);
7566 def p_statement_item_54(p
):
7567 '''statement_item : hierarchy_identifier '(' error ')' ';' '''
7568 print('statement_item_54', list(p
))
7569 # { yyerror(@3, "error: Syntax error in task arguments.");
7571 # PCallTask*tmp = pform_make_call_task(@1, *$1, pt);
7576 def p_statement_item_55(p
):
7577 '''statement_item : error ';' '''
7578 print('statement_item_55', list(p
))
7579 # { yyerror(@2, "error: malformed statement");
7584 def p__embed0_statement_item(p
):
7585 '''_embed0_statement_item : '''
7586 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_SEQ);
7587 # FILE_NAME(tmp, @1);
7588 # current_block_stack.push(tmp);
7591 def p__embed1_statement_item(p
):
7592 '''_embed1_statement_item : '''
7594 # if (! gn_system_verilog()) {
7595 # yyerror("error: Variable declaration in unnamed block "
7596 # "requires SystemVerilog.");
7599 # /* If there are no declarations in the scope then just delete it. */
7600 # pform_pop_scope();
7601 # assert(! current_block_stack.empty());
7602 # PBlock*tmp = current_block_stack.top();
7603 # current_block_stack.pop();
7608 def p__embed2_statement_item(p
):
7609 '''_embed2_statement_item : '''
7610 # { PBlock*tmp = pform_push_block_scope($3, PBlock::BL_SEQ);
7611 # FILE_NAME(tmp, @1);
7612 # current_block_stack.push(tmp);
7615 def p__embed3_statement_item(p
):
7616 '''_embed3_statement_item : '''
7617 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
7618 # FILE_NAME(tmp, @1);
7619 # current_block_stack.push(tmp);
7622 def p__embed4_statement_item(p
):
7623 '''_embed4_statement_item : '''
7625 # if (! gn_system_verilog()) {
7626 # yyerror("error: Variable declaration in unnamed block "
7627 # "requires SystemVerilog.");
7630 # /* If there are no declarations in the scope then just delete it. */
7631 # pform_pop_scope();
7632 # assert(! current_block_stack.empty());
7633 # PBlock*tmp = current_block_stack.top();
7634 # current_block_stack.pop();
7639 def p__embed5_statement_item(p
):
7640 '''_embed5_statement_item : '''
7641 # { PBlock*tmp = pform_push_block_scope($3, PBlock::BL_PAR);
7642 # FILE_NAME(tmp, @1);
7643 # current_block_stack.push(tmp);
7646 def p_compressed_statement_1(p
):
7647 '''compressed_statement : lpvalue K_PLUS_EQ expression '''
7648 print('compressed_statement_1', list(p
))
7649 # { PAssign*tmp = new PAssign($1, '+', $3);
7650 # FILE_NAME(tmp, @1);
7654 def p_compressed_statement_2(p
):
7655 '''compressed_statement : lpvalue K_MINUS_EQ expression '''
7656 print('compressed_statement_2', list(p
))
7657 # { PAssign*tmp = new PAssign($1, '-', $3);
7658 # FILE_NAME(tmp, @1);
7662 def p_compressed_statement_3(p
):
7663 '''compressed_statement : lpvalue K_MUL_EQ expression '''
7664 print('compressed_statement_3', list(p
))
7665 # { PAssign*tmp = new PAssign($1, '*', $3);
7666 # FILE_NAME(tmp, @1);
7670 def p_compressed_statement_4(p
):
7671 '''compressed_statement : lpvalue K_DIV_EQ expression '''
7672 print('compressed_statement_4', list(p
))
7673 # { PAssign*tmp = new PAssign($1, '/', $3);
7674 # FILE_NAME(tmp, @1);
7678 def p_compressed_statement_5(p
):
7679 '''compressed_statement : lpvalue K_MOD_EQ expression '''
7680 print('compressed_statement_5', list(p
))
7681 # { PAssign*tmp = new PAssign($1, '%', $3);
7682 # FILE_NAME(tmp, @1);
7686 def p_compressed_statement_6(p
):
7687 '''compressed_statement : lpvalue K_AND_EQ expression '''
7688 print('compressed_statement_6', list(p
))
7689 # { PAssign*tmp = new PAssign($1, '&', $3);
7690 # FILE_NAME(tmp, @1);
7694 def p_compressed_statement_7(p
):
7695 '''compressed_statement : lpvalue K_OR_EQ expression '''
7696 print('compressed_statement_7', list(p
))
7697 # { PAssign*tmp = new PAssign($1, '|', $3);
7698 # FILE_NAME(tmp, @1);
7702 def p_compressed_statement_8(p
):
7703 '''compressed_statement : lpvalue K_XOR_EQ expression '''
7704 print('compressed_statement_8', list(p
))
7705 # { PAssign*tmp = new PAssign($1, '^', $3);
7706 # FILE_NAME(tmp, @1);
7710 def p_compressed_statement_9(p
):
7711 '''compressed_statement : lpvalue K_LS_EQ expression '''
7712 print('compressed_statement_9', list(p
))
7713 # { PAssign *tmp = new PAssign($1, 'l', $3);
7714 # FILE_NAME(tmp, @1);
7718 def p_compressed_statement_10(p
):
7719 '''compressed_statement : lpvalue K_RS_EQ expression '''
7720 print('compressed_statement_10', list(p
))
7721 # { PAssign*tmp = new PAssign($1, 'r', $3);
7722 # FILE_NAME(tmp, @1);
7726 def p_compressed_statement_11(p
):
7727 '''compressed_statement : lpvalue K_RSS_EQ expression '''
7728 print('compressed_statement_11', list(p
))
7729 # { PAssign *tmp = new PAssign($1, 'R', $3);
7730 # FILE_NAME(tmp, @1);
7734 def p_statement_or_null_list_opt_1(p
):
7735 '''statement_or_null_list_opt : statement_or_null_list '''
7736 print('statement_or_null_list_opt_1', list(p
))
7739 def p_statement_or_null_list_opt_2(p
):
7740 '''statement_or_null_list_opt : '''
7741 print('statement_or_null_list_opt_2', list(p
))
7744 def p_statement_or_null_list_1(p
):
7745 '''statement_or_null_list : statement_or_null_list statement_or_null '''
7746 print('statement_or_null_list_1', list(p
))
7747 # { vector<Statement*>*tmp = $1;
7748 # if ($2) tmp->push_back($2);
7752 def p_statement_or_null_list_2(p
):
7753 '''statement_or_null_list : statement_or_null '''
7754 print('statement_or_null_list_2', list(p
))
7755 # { vector<Statement*>*tmp = new vector<Statement*>(0);
7756 # if ($1) tmp->push_back($1);
7760 def p_analog_statement_1(p
):
7761 '''analog_statement : branch_probe_expression K_CONTRIBUTE expression ';' '''
7762 print('analog_statement_1', list(p
))
7763 # { $$ = pform_contribution_statement(@2, $1, $3); }
7765 def p_task_item_1(p
):
7766 '''task_item : block_item_decl '''
7767 print('task_item_1', list(p
))
7768 # { $$ = new vector<pform_tf_port_t>(0); }
7770 def p_task_item_2(p
):
7771 '''task_item : tf_port_declaration '''
7772 print('task_item_2', list(p
))
7775 def p_task_item_list_1(p
):
7776 '''task_item_list : task_item_list task_item '''
7777 print('task_item_list_1', list(p
))
7778 # { vector<pform_tf_port_t>*tmp = $1;
7779 # size_t s1 = tmp->size();
7780 # tmp->resize(s1 + $2->size());
7781 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
7782 # tmp->at(s1 + idx) = $2->at(idx);
7787 def p_task_item_list_2(p
):
7788 '''task_item_list : task_item '''
7789 print('task_item_list_2', list(p
))
7792 def p_task_item_list_opt_1(p
):
7793 '''task_item_list_opt : task_item_list '''
7794 print('task_item_list_opt_1', list(p
))
7797 def p_task_item_list_opt_2(p
):
7798 '''task_item_list_opt : '''
7799 print('task_item_list_opt_2', list(p
))
7802 def p_tf_port_list_opt_1(p
):
7803 '''tf_port_list_opt : tf_port_list '''
7804 print('tf_port_list_opt_1', list(p
))
7807 def p_tf_port_list_opt_2(p
):
7808 '''tf_port_list_opt : '''
7809 print('tf_port_list_opt_2', list(p
))
7812 def p_udp_body_1(p
):
7813 '''udp_body : K_table udp_entry_list K_endtable '''
7814 print('udp_body_1', list(p
))
7815 # { lex_end_table();
7819 def p_udp_body_2(p
):
7820 '''udp_body : K_table K_endtable '''
7821 print('udp_body_2', list(p
))
7822 # { lex_end_table();
7823 # yyerror(@1, "error: Empty UDP table.");
7827 def p_udp_body_3(p
):
7828 '''udp_body : K_table error K_endtable '''
7829 print('udp_body_3', list(p
))
7830 # { lex_end_table();
7831 # yyerror(@2, "Errors in UDP table");
7836 def p_udp_entry_list_1(p
):
7837 '''udp_entry_list : udp_comb_entry_list '''
7838 print('udp_entry_list_1', list(p
))
7840 def p_udp_entry_list_2(p
):
7841 '''udp_entry_list : udp_sequ_entry_list '''
7842 print('udp_entry_list_2', list(p
))
7844 def p_udp_comb_entry_1(p
):
7845 '''udp_comb_entry : udp_input_list ':' udp_output_sym ';' '''
7846 print('udp_comb_entry_1', list(p
))
7847 # { char*tmp = new char[strlen($1)+3];
7849 # char*tp = tmp+strlen(tmp);
7857 def p_udp_comb_entry_list_1(p
):
7858 '''udp_comb_entry_list : udp_comb_entry '''
7859 print('udp_comb_entry_list_1', list(p
))
7860 # { list<string>*tmp = new list<string>;
7861 # tmp->push_back($1);
7866 def p_udp_comb_entry_list_2(p
):
7867 '''udp_comb_entry_list : udp_comb_entry_list udp_comb_entry '''
7868 print('udp_comb_entry_list_2', list(p
))
7869 # { list<string>*tmp = $1;
7870 # tmp->push_back($2);
7875 def p_udp_sequ_entry_list_1(p
):
7876 '''udp_sequ_entry_list : udp_sequ_entry '''
7877 print('udp_sequ_entry_list_1', list(p
))
7878 # { list<string>*tmp = new list<string>;
7879 # tmp->push_back($1);
7884 def p_udp_sequ_entry_list_2(p
):
7885 '''udp_sequ_entry_list : udp_sequ_entry_list udp_sequ_entry '''
7886 print('udp_sequ_entry_list_2', list(p
))
7887 # { list<string>*tmp = $1;
7888 # tmp->push_back($2);
7893 def p_udp_sequ_entry_1(p
):
7894 '''udp_sequ_entry : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' '''
7895 print('udp_sequ_entry_1', list(p
))
7896 # { char*tmp = new char[strlen($1)+5];
7898 # char*tp = tmp+strlen(tmp);
7907 def p_udp_initial_1(p
):
7908 '''udp_initial : K_initial IDENTIFIER '=' number ';' '''
7909 print('udp_initial_1', list(p
))
7910 # { PExpr*etmp = new PENumber($4);
7911 # PEIdent*itmp = new PEIdent(lex_strings.make($2));
7912 # PAssign*atmp = new PAssign(itmp, etmp);
7913 # FILE_NAME(atmp, @2);
7918 def p_udp_init_opt_1(p
):
7919 '''udp_init_opt : udp_initial '''
7920 print('udp_init_opt_1', list(p
))
7923 def p_udp_init_opt_2(p
):
7924 '''udp_init_opt : '''
7925 print('udp_init_opt_2', list(p
))
7928 def p_udp_input_list_1(p
):
7929 '''udp_input_list : udp_input_sym '''
7930 print('udp_input_list_1', list(p
))
7931 # { char*tmp = new char[2];
7937 def p_udp_input_list_2(p
):
7938 '''udp_input_list : udp_input_list udp_input_sym '''
7939 print('udp_input_list_2', list(p
))
7940 # { char*tmp = new char[strlen($1)+2];
7942 # char*tp = tmp+strlen(tmp);
7949 def p_udp_input_sym_1(p
):
7950 '''udp_input_sym : '0' '''
7951 print('udp_input_sym_1', list(p
))
7954 def p_udp_input_sym_2(p
):
7955 '''udp_input_sym : '1' '''
7956 print('udp_input_sym_2', list(p
))
7959 def p_udp_input_sym_3(p
):
7960 '''udp_input_sym : 'x' '''
7961 print('udp_input_sym_3', list(p
))
7964 def p_udp_input_sym_4(p
):
7965 '''udp_input_sym : '?' '''
7966 print('udp_input_sym_4', list(p
))
7969 def p_udp_input_sym_5(p
):
7970 '''udp_input_sym : 'b' '''
7971 print('udp_input_sym_5', list(p
))
7974 def p_udp_input_sym_6(p
):
7975 '''udp_input_sym : '*' '''
7976 print('udp_input_sym_6', list(p
))
7979 def p_udp_input_sym_7(p
):
7980 '''udp_input_sym : '%' '''
7981 print('udp_input_sym_7', list(p
))
7984 def p_udp_input_sym_8(p
):
7985 '''udp_input_sym : 'f' '''
7986 print('udp_input_sym_8', list(p
))
7989 def p_udp_input_sym_9(p
):
7990 '''udp_input_sym : 'F' '''
7991 print('udp_input_sym_9', list(p
))
7994 def p_udp_input_sym_10(p
):
7995 '''udp_input_sym : 'l' '''
7996 print('udp_input_sym_10', list(p
))
7999 def p_udp_input_sym_11(p
):
8000 '''udp_input_sym : 'h' '''
8001 print('udp_input_sym_11', list(p
))
8004 def p_udp_input_sym_12(p
):
8005 '''udp_input_sym : 'B' '''
8006 print('udp_input_sym_12', list(p
))
8009 def p_udp_input_sym_13(p
):
8010 '''udp_input_sym : 'r' '''
8011 print('udp_input_sym_13', list(p
))
8014 def p_udp_input_sym_14(p
):
8015 '''udp_input_sym : 'R' '''
8016 print('udp_input_sym_14', list(p
))
8019 def p_udp_input_sym_15(p
):
8020 '''udp_input_sym : 'M' '''
8021 print('udp_input_sym_15', list(p
))
8024 def p_udp_input_sym_16(p
):
8025 '''udp_input_sym : 'n' '''
8026 print('udp_input_sym_16', list(p
))
8029 def p_udp_input_sym_17(p
):
8030 '''udp_input_sym : 'N' '''
8031 print('udp_input_sym_17', list(p
))
8034 def p_udp_input_sym_18(p
):
8035 '''udp_input_sym : 'p' '''
8036 print('udp_input_sym_18', list(p
))
8039 def p_udp_input_sym_19(p
):
8040 '''udp_input_sym : 'P' '''
8041 print('udp_input_sym_19', list(p
))
8044 def p_udp_input_sym_20(p
):
8045 '''udp_input_sym : 'Q' '''
8046 print('udp_input_sym_20', list(p
))
8049 def p_udp_input_sym_21(p
):
8050 '''udp_input_sym : 'q' '''
8051 print('udp_input_sym_21', list(p
))
8054 def p_udp_input_sym_22(p
):
8055 '''udp_input_sym : '_' '''
8056 print('udp_input_sym_22', list(p
))
8059 def p_udp_input_sym_23(p
):
8060 '''udp_input_sym : '+' '''
8061 print('udp_input_sym_23', list(p
))
8064 def p_udp_input_sym_24(p
):
8065 '''udp_input_sym : DEC_NUMBER '''
8066 print('udp_input_sym_24', list(p
))
8067 # { yyerror(@1, "internal error: Input digits parse as decimal number!"); $$ = '0'; }
8069 def p_udp_output_sym_1(p
):
8070 '''udp_output_sym : '0' '''
8071 print('udp_output_sym_1', list(p
))
8074 def p_udp_output_sym_2(p
):
8075 '''udp_output_sym : '1' '''
8076 print('udp_output_sym_2', list(p
))
8079 def p_udp_output_sym_3(p
):
8080 '''udp_output_sym : 'x' '''
8081 print('udp_output_sym_3', list(p
))
8084 def p_udp_output_sym_4(p
):
8085 '''udp_output_sym : '-' '''
8086 print('udp_output_sym_4', list(p
))
8089 def p_udp_output_sym_5(p
):
8090 '''udp_output_sym : DEC_NUMBER '''
8091 print('udp_output_sym_5', list(p
))
8092 # { yyerror(@1, "internal error: Output digits parse as decimal number!"); $$ = '0'; }
8094 def p_udp_port_decl_1(p
):
8095 '''udp_port_decl : K_input list_of_identifiers ';' '''
8096 print('udp_port_decl_1', list(p
))
8097 # { $$ = pform_make_udp_input_ports($2); }
8099 def p_udp_port_decl_2(p
):
8100 '''udp_port_decl : K_output IDENTIFIER ';' '''
8101 print('udp_port_decl_2', list(p
))
8102 # { perm_string pname = lex_strings.make($2);
8103 # PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
8104 # vector<PWire*>*tmp = new vector<PWire*>(1);
8110 def p_udp_port_decl_3(p
):
8111 '''udp_port_decl : K_reg IDENTIFIER ';' '''
8112 print('udp_port_decl_3', list(p
))
8113 # { perm_string pname = lex_strings.make($2);
8114 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
8115 # vector<PWire*>*tmp = new vector<PWire*>(1);
8121 def p_udp_port_decl_4(p
):
8122 '''udp_port_decl : K_reg K_output IDENTIFIER ';' '''
8123 print('udp_port_decl_4', list(p
))
8124 # { perm_string pname = lex_strings.make($3);
8125 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
8126 # vector<PWire*>*tmp = new vector<PWire*>(1);
8132 def p_udp_port_decls_1(p
):
8133 '''udp_port_decls : udp_port_decl '''
8134 print('udp_port_decls_1', list(p
))
8137 def p_udp_port_decls_2(p
):
8138 '''udp_port_decls : udp_port_decls udp_port_decl '''
8139 print('udp_port_decls_2', list(p
))
8140 # { vector<PWire*>*tmp = $1;
8141 # size_t s1 = $1->size();
8142 # tmp->resize(s1+$2->size());
8143 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
8144 # tmp->at(s1+idx) = $2->at(idx);
8149 def p_udp_port_list_1(p
):
8150 '''udp_port_list : IDENTIFIER '''
8151 print('udp_port_list_1', list(p
))
8152 # { list<perm_string>*tmp = new list<perm_string>;
8153 # tmp->push_back(lex_strings.make($1));
8158 def p_udp_port_list_2(p
):
8159 '''udp_port_list : udp_port_list ',' IDENTIFIER '''
8160 print('udp_port_list_2', list(p
))
8161 # { list<perm_string>*tmp = $1;
8162 # tmp->push_back(lex_strings.make($3));
8167 def p_udp_reg_opt_1(p
):
8168 '''udp_reg_opt : K_reg '''
8169 print('udp_reg_opt_1', list(p
))
8172 def p_udp_reg_opt_2(p
):
8173 '''udp_reg_opt : '''
8174 print('udp_reg_opt_2', list(p
))
8177 def p_udp_initial_expr_opt_1(p
):
8178 '''udp_initial_expr_opt : '=' expression '''
8179 print('udp_initial_expr_opt_1', list(p
))
8182 def p_udp_initial_expr_opt_2(p
):
8183 '''udp_initial_expr_opt : '''
8184 print('udp_initial_expr_opt_2', list(p
))
8187 def p_udp_input_declaration_list_1(p
):
8188 '''udp_input_declaration_list : K_input IDENTIFIER '''
8189 print('udp_input_declaration_list_1', list(p
))
8190 # { list<perm_string>*tmp = new list<perm_string>;
8191 # tmp->push_back(lex_strings.make($2));
8196 def p_udp_input_declaration_list_2(p
):
8197 '''udp_input_declaration_list : udp_input_declaration_list ',' K_input IDENTIFIER '''
8198 print('udp_input_declaration_list_2', list(p
))
8199 # { list<perm_string>*tmp = $1;
8200 # tmp->push_back(lex_strings.make($4));
8205 def p_udp_primitive_1(p
):
8206 '''udp_primitive : K_primitive IDENTIFIER '(' udp_port_list ')' ';' udp_port_decls udp_init_opt udp_body K_endprimitive endlabel_opt '''
8207 print('udp_primitive_1', list(p
))
8208 # { perm_string tmp2 = lex_strings.make($2);
8209 # pform_make_udp(tmp2, $4, $7, $9, $8,
8210 # @2.text, @2.first_line);
8212 # if (strcmp($2,$11) != 0) {
8213 # yyerror(@11, "error: End label doesn't match "
8214 # "primitive name");
8216 # if (! gn_system_verilog()) {
8217 # yyerror(@11, "error: Primitive end labels "
8218 # "require SystemVerilog.");
8225 def p_udp_primitive_2(p
):
8226 '''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 '''
8227 print('udp_primitive_2', list(p
))
8228 # { perm_string tmp2 = lex_strings.make($2);
8229 # perm_string tmp6 = lex_strings.make($6);
8230 # pform_make_udp(tmp2, $5, tmp6, $7, $9, $12,
8231 # @2.text, @2.first_line);
8233 # if (strcmp($2,$14) != 0) {
8234 # yyerror(@14, "error: End label doesn't match "
8235 # "primitive name");
8237 # if (! gn_system_verilog()) {
8238 # yyerror(@14, "error: Primitive end labels "
8239 # "require SystemVerilog.");
8247 def p_K_packed_opt_1(p
):
8248 '''K_packed_opt : K_packed '''
8249 print('K_packed_opt', list(p
))
8252 def p_K_packed_opt_2(p
):
8253 '''K_packed_opt : '''
8254 print('K_packed_opt', list(p
))
8257 def p_K_reg_opt_1(p
):
8258 '''K_reg_opt : K_reg '''
8259 print('K_reg_opt', list(p
))
8262 def p_K_reg_opt_2(p
):
8264 print('K_reg_opt', list(p
))
8267 def p_K_static_opt_1(p
):
8268 '''K_static_opt : K_static '''
8269 print('K_static_opt', list(p
))
8272 def p_K_static_opt_2(p
):
8273 '''K_static_opt : '''
8274 print('K_static_opt', list(p
))
8278 def p_K_virtual_opt_1(p
):
8279 '''K_virtual_opt : K_virtual '''
8283 def p_K_virtual_opt_2(p
):
8284 '''K_virtual_opt : '''