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
30 from ply
import yacc
, lex
32 #from parse_tokens import tokens
34 tokens
= lexor
.tokens
# list(set(lexor.tokens).union(set(tokens)))
35 literals
= lexor
.literals
38 ('right', 'K_PLUS_EQ', 'K_MINUS_EQ', 'K_MUL_EQ', 'K_DIV_EQ',
39 'K_MOD_EQ', 'K_AND_EQ', 'K_OR_EQ'),
40 ('right', 'K_XOR_EQ', 'K_LS_EQ', 'K_RS_EQ', 'K_RSS_EQ'),
41 ('right', '?', ':', 'K_inside'),
45 ('left', '^', 'K_NXOR', 'K_NOR'),
46 ('left', '&', 'K_NAND'),
47 ('left', 'K_EQ', 'K_NE', 'K_CEQ', 'K_CNE', 'K_WEQ', 'K_WNE'),
48 ('left', 'K_GE', 'K_LE', '<', '>'),
49 ('left', 'K_LS', 'K_RS', 'K_RSS'),
51 ('left', '*', '/', '%'),
53 ('left', 'UNARY_PREC'),
54 ('nonassoc', 'less_than_K_else'),
55 ('nonassoc', 'K_else'),
57 ('nonassoc', 'K_exclude'),
58 ('nonassoc', 'no_timeunits_declaration'),
59 ('nonassoc', 'one_timeunits_declaration'),
60 ('nonassoc', 'K_timeunit', 'K_timeprecision')
64 IVL_VT_NO_TYPE
= 'VT_NO_TYPE'
65 IVL_VT_BOOL
= 'VT_BOOL'
66 IVL_VT_LOGIC
= 'VT_LOGIC'
68 IVL_VT_VOID = 0, /* Not used */
69 IVL_VT_NO_TYPE = 1, /* Place holder for missing/unknown type. */
74 IVL_VT_DARRAY = 6, /* Array (esp. dynamic array) */
75 IVL_VT_CLASS = 7, /* SystemVerilog class instances */
76 IVL_VT_QUEUE = 8, /* SystemVerilog queue instances */
77 IVL_VT_VECTOR = IVL_VT_LOGIC /* For compatibility */
81 NN_IMPLICIT
= 'IMPLICIT'
82 NN_IMPLICIT_REG
= 'IMPLICIT_REG'
83 NN_INTEGER
= 'INTEGER'
87 NN_SUPPLY0
= 'SUPPLY0'
88 NN_SUPPLY1
= 'SUPPLY1'
95 NN_UNRESOLVED_WIRE
= 'UNRESOLVED_WIRE'
97 NP_NOT_A_PORT
= 'NOT_A_PORT'
98 NP_PIMPLICIT
= 'PIMPLICIT'
100 NP_POUTPUT
= 'POUTPUT'
108 def __init__(self
, typ
, signed
):
112 # -------------- RULES ----------------
114 def p_source_text_1(p
):
115 '''source_text : timeunits_declaration_opt _embed0_source_text description_list '''
116 if(parse_debug
>2): print('source_text', list(p
))
118 def p_source_text_2(p
):
120 if(parse_debug
): print('source_text', list(p
))
122 def p__embed0_source_text(p
):
123 '''_embed0_source_text : '''
124 # { pform_set_scope_timescale(yyloc); }
126 def p_assertion_item_1(p
):
127 '''assertion_item : concurrent_assertion_item '''
128 if(parse_debug
): print('assertion_item_1', list(p
))
130 def p_assignment_pattern_1(p
):
131 '''assignment_pattern : K_LP expression_list_proper '}' '''
132 if(parse_debug
): print('assignment_pattern_1', list(p
))
133 # { PEAssignPattern*tmp = new PEAssignPattern(*p[2]);
134 # FILE_NAME(tmp, @1);
139 def p_assignment_pattern_2(p
):
140 '''assignment_pattern : K_LP '}' '''
141 if(parse_debug
): print('assignment_pattern_2', list(p
))
142 # { PEAssignPattern*tmp = new PEAssignPattern;
143 # FILE_NAME(tmp, @1);
147 def p_block_identifier_opt_1(p
):
148 '''block_identifier_opt : IDENTIFIER ':' '''
149 if(parse_debug
): print('block_identifier_opt_1', list(p
))
151 def p_block_identifier_opt_2(p
):
152 '''block_identifier_opt : '''
153 if(parse_debug
): print('block_identifier_opt_2', list(p
))
155 def p_class_declaration_1(p
):
156 '''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 '''
157 if(parse_debug
): print('class_declaration_1', list(p
))
158 # { // Wrap up the class.
159 # if (p[11] && p[4] && p[4]->name != p[11]) {
160 # yyerror(@11, "error: Class end label doesn't match class name.");
165 def p__embed0_class_declaration(p
):
166 '''_embed0_class_declaration : '''
167 # { pform_start_class_declaration(@2, p[4], p[5].type, p[5].exprs, p[3]); }
169 def p__embed1_class_declaration(p
):
170 '''_embed1_class_declaration : '''
171 # { // Process a class.
172 # pform_end_class_declaration(@9);
175 def p_class_constraint_1(p
):
176 '''class_constraint : constraint_prototype '''
177 if(parse_debug
): print('class_constraint_1', list(p
))
179 def p_class_constraint_2(p
):
180 '''class_constraint : constraint_declaration '''
181 if(parse_debug
): print('class_constraint_2', list(p
))
183 def p_class_identifier_1(p
):
184 '''class_identifier : IDENTIFIER '''
185 if(parse_debug
): print('class_identifier_1', list(p
))
186 # { // Create a synthetic typedef for the class name so that the
187 # // lexor detects the name as a type.
188 # perm_string name = lex_strings.make(p[1]);
189 # class_type_t*tmp = new class_type_t(name);
190 # FILE_NAME(tmp, @1);
191 # pform_set_typedef(name, tmp, NULL);
196 def p_class_identifier_2(p
):
197 '''class_identifier : TYPE_IDENTIFIER '''
198 if(parse_debug
): print('class_identifier_2', list(p
))
199 # { class_type_t*tmp = dynamic_cast<class_type_t*>(p[1].type);
201 # yyerror(@1, "Type name \"%s\"is not a predeclared class name.", p[1].text);
207 def p_class_declaration_endlabel_opt_1(p
):
208 '''class_declaration_endlabel_opt : ':' TYPE_IDENTIFIER '''
209 if(parse_debug
): print('class_declaration_endlabel_opt_1', list(p
))
210 # { class_type_t*tmp = dynamic_cast<class_type_t*> (p[2].type);
212 # yyerror(@2, "error: class declaration endlabel \"%s\" is not a class name\n", p[2].text);
215 # p[0] = strdupnew(tmp->name.str());
220 def p_class_declaration_endlabel_opt_2(p
):
221 '''class_declaration_endlabel_opt : ':' IDENTIFIER '''
222 if(parse_debug
): print('class_declaration_endlabel_opt_2', list(p
))
225 def p_class_declaration_endlabel_opt_3(p
):
226 '''class_declaration_endlabel_opt : '''
227 if(parse_debug
): print('class_declaration_endlabel_opt_3', list(p
))
230 def p_class_declaration_extends_opt_1(p
):
231 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '''
232 if(parse_debug
): print('class_declaration_extends_opt_1', list(p
))
233 # { p[0].type = p[2].type;
238 def p_class_declaration_extends_opt_2(p
):
239 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '(' expression_list_with_nuls ')' '''
240 if(parse_debug
): print('class_declaration_extends_opt_2', list(p
))
241 # { p[0].type = p[2].type;
246 def p_class_declaration_extends_opt_3(p
):
247 '''class_declaration_extends_opt : '''
248 if(parse_debug
): print('class_declaration_extends_opt_3', list(p
))
249 # { p[0].type = 0; p[0].exprs = 0; }
251 def p_class_items_opt_1(p
):
252 '''class_items_opt : class_items '''
253 if(parse_debug
): print('class_items_opt_1', list(p
))
255 def p_class_items_opt_2(p
):
256 '''class_items_opt : '''
257 if(parse_debug
): print('class_items_opt_2', list(p
))
259 def p_class_items_1(p
):
260 '''class_items : class_items class_item '''
261 if(parse_debug
): print('class_items_1', list(p
))
263 def p_class_items_2(p
):
264 '''class_items : class_item '''
265 if(parse_debug
): print('class_items_2', list(p
))
267 def p_class_item_1(p
):
268 '''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 '''
269 if(parse_debug
): print('class_item_1', list(p
))
270 # { current_function->set_ports(p[6]);
271 # pform_set_constructor_return(current_function);
272 # pform_set_this_class(@3, current_function);
273 # current_function_set_statement(@3, p[10]);
275 # current_function = 0;
278 def p_class_item_2(p
):
279 '''class_item : property_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
280 if(parse_debug
): print('class_item_2', list(p
))
281 # { pform_class_property(@2, p[1], p[2], p[3]); }
283 def p_class_item_3(p
):
284 '''class_item : K_const class_item_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
285 if(parse_debug
): print('class_item_3', list(p
))
286 # { pform_class_property(@1, p[2] | property_qualifier_t::make_const(), p[3], p[4]); }
288 def p_class_item_4(p
):
289 '''class_item : method_qualifier_opt task_declaration '''
290 if(parse_debug
): print('class_item_4', list(p
))
291 # { /* The task_declaration rule puts this into the class */ }
293 def p_class_item_5(p
):
294 '''class_item : method_qualifier_opt function_declaration '''
295 if(parse_debug
): print('class_item_5', list(p
))
296 # { /* The function_declaration rule puts this into the class */ }
298 def p_class_item_6(p
):
299 '''class_item : K_extern method_qualifier_opt K_function K_new ';' '''
300 if(parse_debug
): print('class_item_6', list(p
))
301 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
303 def p_class_item_7(p
):
304 '''class_item : K_extern method_qualifier_opt K_function K_new '(' tf_port_list_opt ')' ';' '''
305 if(parse_debug
): print('class_item_7', list(p
))
306 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
308 def p_class_item_8(p
):
309 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER ';' '''
310 if(parse_debug
): print('class_item_8', list(p
))
311 # { yyerror(@1, "sorry: External methods are not yet supported.");
315 def p_class_item_9(p
):
316 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' ';' '''
317 if(parse_debug
): print('class_item_9', list(p
))
318 # { yyerror(@1, "sorry: External methods are not yet supported.");
322 def p_class_item_10(p
):
323 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER ';' '''
324 if(parse_debug
): print('class_item_10', list(p
))
325 # { yyerror(@1, "sorry: External methods are not yet supported.");
329 def p_class_item_11(p
):
330 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER '(' tf_port_list_opt ')' ';' '''
331 if(parse_debug
): print('class_item_11', list(p
))
332 # { yyerror(@1, "sorry: External methods are not yet supported.");
336 def p_class_item_12(p
):
337 '''class_item : class_constraint '''
338 if(parse_debug
): print('class_item_12', list(p
))
340 def p_class_item_13(p
):
341 '''class_item : property_qualifier_opt data_type error ';' '''
342 if(parse_debug
): print('class_item_13', list(p
))
343 # { yyerror(@3, "error: Errors in variable names after data type.");
347 def p_class_item_14(p
):
348 '''class_item : property_qualifier_opt IDENTIFIER error ';' '''
349 if(parse_debug
): print('class_item_14', list(p
))
350 # { yyerror(@3, "error: %s doesn't name a type.", p[2]);
354 def p_class_item_15(p
):
355 '''class_item : method_qualifier_opt K_function K_new error K_endfunction endnew_opt '''
356 if(parse_debug
): print('class_item_15', list(p
))
357 # { yyerror(@1, "error: I give up on this class constructor declaration.");
361 def p_class_item_16(p
):
362 '''class_item : error ';' '''
363 if(parse_debug
): print('class_item_16', list(p
))
364 # { yyerror(@2, "error: invalid class item.");
368 def p__embed0_class_item(p
):
369 '''_embed0_class_item : '''
370 # { assert(current_function==0);
371 # current_function = pform_push_constructor_scope(@3);
374 def p_class_item_qualifier_1(p
):
375 '''class_item_qualifier : K_static '''
376 if(parse_debug
): print('class_item_qualifier_1', list(p
))
377 # { p[0] = property_qualifier_t::make_static(); }
379 def p_class_item_qualifier_2(p
):
380 '''class_item_qualifier : K_protected '''
381 if(parse_debug
): print('class_item_qualifier_2', list(p
))
382 # { p[0] = property_qualifier_t::make_protected(); }
384 def p_class_item_qualifier_3(p
):
385 '''class_item_qualifier : K_local '''
386 if(parse_debug
): print('class_item_qualifier_3', list(p
))
387 # { p[0] = property_qualifier_t::make_local(); }
389 def p_class_item_qualifier_list_1(p
):
390 '''class_item_qualifier_list : class_item_qualifier_list class_item_qualifier '''
391 if(parse_debug
): print('class_item_qualifier_list_1', list(p
))
392 # { p[0] = p[1] | p[2]; }
394 def p_class_item_qualifier_list_2(p
):
395 '''class_item_qualifier_list : class_item_qualifier '''
396 if(parse_debug
): print('class_item_qualifier_list_2', list(p
))
399 def p_class_item_qualifier_opt_1(p
):
400 '''class_item_qualifier_opt : class_item_qualifier_list '''
401 if(parse_debug
): print('class_item_qualifier_opt_1', list(p
))
404 def p_class_item_qualifier_opt_2(p
):
405 '''class_item_qualifier_opt : '''
406 if(parse_debug
): print('class_item_qualifier_opt_2', list(p
))
407 # { p[0] = property_qualifier_t::make_none(); }
409 def p_class_new_1(p
):
410 '''class_new : K_new '(' expression_list_with_nuls ')' '''
411 if(parse_debug
): print('class_new_1', list(p
))
412 # { list<PExpr*>*expr_list = p[3];
413 # strip_tail_items(expr_list);
414 # PENewClass*tmp = new PENewClass(*expr_list);
415 # FILE_NAME(tmp, @1);
420 def p_class_new_2(p
):
421 '''class_new : K_new hierarchy_identifier '''
422 if(parse_debug
): print('class_new_2', list(p
))
423 # { PEIdent*tmpi = new PEIdent(*p[2]);
424 # FILE_NAME(tmpi, @2);
425 # PENewCopy*tmp = new PENewCopy(tmpi);
426 # FILE_NAME(tmp, @1);
431 def p_class_new_3(p
):
432 '''class_new : K_new '''
433 if(parse_debug
): print('class_new_3', list(p
))
434 # { PENewClass*tmp = new PENewClass;
435 # FILE_NAME(tmp, @1);
439 def p_concurrent_assertion_item_1(p
):
440 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' property_spec ')' statement_or_null '''
441 if(parse_debug
): print('concurrent_assertion_item_1', list(p
))
443 # if (gn_assertions_flag) {
444 # yyerror(@2, "sorry: concurrent_assertion_item not supported."
445 # " Try -gno-assertion to turn this message off.");
449 def p_concurrent_assertion_item_2(p
):
450 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' error ')' statement_or_null '''
451 if(parse_debug
): print('concurrent_assertion_item_2', list(p
))
453 # yyerror(@2, "error: Error in property_spec of concurrent assertion item.");
456 def p_constraint_block_item_1(p
):
457 '''constraint_block_item : constraint_expression '''
458 if(parse_debug
): print('constraint_block_item_1', list(p
))
460 def p_constraint_block_item_list_1(p
):
461 '''constraint_block_item_list : constraint_block_item_list constraint_block_item '''
462 if(parse_debug
): print('constraint_block_item_list_1', list(p
))
464 def p_constraint_block_item_list_2(p
):
465 '''constraint_block_item_list : constraint_block_item '''
466 if(parse_debug
): print('constraint_block_item_list_2', list(p
))
468 def p_constraint_block_item_list_opt_1(p
):
469 '''constraint_block_item_list_opt : '''
470 if(parse_debug
): print('constraint_block_item_list_opt_1', list(p
))
472 def p_constraint_block_item_list_opt_2(p
):
473 '''constraint_block_item_list_opt : constraint_block_item_list '''
474 if(parse_debug
): print('constraint_block_item_list_opt_2', list(p
))
476 def p_constraint_declaration_1(p
):
477 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' constraint_block_item_list_opt '}' '''
478 if(parse_debug
): print('constraint_declaration_1', list(p
))
479 # { yyerror(@2, "sorry: Constraint declarations not supported."); }
481 def p_constraint_declaration_2(p
):
482 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' error '}' '''
483 if(parse_debug
): print('constraint_declaration_2', list(p
))
484 # { yyerror(@4, "error: Errors in the constraint block item list."); }
486 def p_constraint_expression_1(p
):
487 '''constraint_expression : expression ';' '''
488 if(parse_debug
): print('constraint_expression_1', list(p
))
490 def p_constraint_expression_2(p
):
491 '''constraint_expression : expression K_dist '{' '}' ';' '''
492 if(parse_debug
): print('constraint_expression_2', list(p
))
494 def p_constraint_expression_3(p
):
495 '''constraint_expression : expression K_TRIGGER constraint_set '''
496 if(parse_debug
): print('constraint_expression_3', list(p
))
498 def p_constraint_expression_4(p
):
499 '''constraint_expression : K_if '(' expression ')' constraint_set %prec less_than_K_else '''
500 if(parse_debug
): print('constraint_expression_4', list(p
))
502 def p_constraint_expression_5(p
):
503 '''constraint_expression : K_if '(' expression ')' constraint_set K_else constraint_set '''
504 if(parse_debug
): print('constraint_expression_5', list(p
))
506 def p_constraint_expression_6(p
):
507 '''constraint_expression : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' constraint_set '''
508 if(parse_debug
): print('constraint_expression_6', list(p
))
510 def p_constraint_expression_list_1(p
):
511 '''constraint_expression_list : constraint_expression_list constraint_expression '''
512 if(parse_debug
): print('constraint_expression_list_1', list(p
))
514 def p_constraint_expression_list_2(p
):
515 '''constraint_expression_list : constraint_expression '''
516 if(parse_debug
): print('constraint_expression_list_2', list(p
))
518 def p_constraint_prototype_1(p
):
519 '''constraint_prototype : K_static_opt K_constraint IDENTIFIER ';' '''
520 if(parse_debug
): print('constraint_prototype_1', list(p
))
521 # { yyerror(@2, "sorry: Constraint prototypes not supported."); }
523 def p_constraint_set_1(p
):
524 '''constraint_set : constraint_expression '''
525 if(parse_debug
): print('constraint_set_1', list(p
))
527 def p_constraint_set_2(p
):
528 '''constraint_set : '{' constraint_expression_list '}' '''
529 if(parse_debug
): print('constraint_set_2', list(p
))
531 def p_data_declaration_1(p
):
532 '''data_declaration : attribute_list_opt data_type_or_implicit list_of_variable_decl_assignments ';' '''
533 if(parse_debug
): print('data_declaration_1', list(p
))
534 # { data_type_t*data_type = p[2];
535 # if (data_type == 0) {
536 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
537 # FILE_NAME(data_type, @2);
539 # pform_makewire(@2, 0, str_strength, p[3], NetNet::IMPLICIT_REG, data_type);
542 def p_data_type_1(p
):
543 '''data_type : integer_vector_type unsigned_signed_opt dimensions_opt '''
544 if(parse_debug
): print('data_type_1', list(p
))
547 if (use_vtype
== IVL_VT_NO_TYPE
):
548 use_vtype
= IVL_VT_LOGIC
550 dt
= DataType(use_vtype
, signed
=p
[2])
552 dt
.reg_flag
= reg_flag
554 # { ivl_variable_type_t use_vtype = p[1];
555 # bool reg_flag = false;
556 # if (use_vtype == IVL_VT_NO_TYPE) {
557 # use_vtype = IVL_VT_LOGIC;
560 # vector_type_t*tmp = new vector_type_t(use_vtype, p[2], p[3]);
561 # tmp->reg_flag = reg_flag;
562 # FILE_NAME(tmp, @1);
566 def p_data_type_2(p
):
567 '''data_type : non_integer_type '''
568 if(parse_debug
): print('data_type_2', list(p
))
570 # { real_type_t*tmp = new real_type_t(p[1]);
571 # FILE_NAME(tmp, @1);
575 def p_data_type_3(p
):
576 '''data_type : struct_data_type '''
577 if(parse_debug
): print('data_type_3', list(p
))
579 # { if (!p[1]->packed_flag) {
580 # yyerror(@1, "sorry: Unpacked structs not supported.");
585 def p_data_type_4(p
):
586 '''data_type : enum_data_type '''
587 if(parse_debug
): print('data_type_4', list(p
))
590 def p_data_type_5(p
):
591 '''data_type : atom2_type signed_unsigned_opt '''
592 if(parse_debug
): print('data_type_5', list(p
))
593 # { atom2_type_t*tmp = new atom2_type_t(p[1], p[2]);
594 # FILE_NAME(tmp, @1);
598 def p_data_type_6(p
):
599 '''data_type : K_integer signed_unsigned_opt '''
600 if(parse_debug
): print('data_type_6', list(p
))
601 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
602 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, p[2], pd);
603 # tmp->reg_flag = true;
604 # tmp->integer_flag = true;
608 def p_data_type_7(p
):
609 '''data_type : K_time '''
610 if(parse_debug
): print('data_type_7', list(p
))
611 # { list<pform_range_t>*pd = make_range_from_width(64);
612 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
613 # tmp->reg_flag = !gn_system_verilog();
617 def p_data_type_8(p
):
618 '''data_type : TYPE_IDENTIFIER dimensions_opt '''
619 if(parse_debug
): print('data_type_8', list(p
))
621 # parray_type_t*tmp = new parray_type_t(p[1].type, p[2]);
622 # FILE_NAME(tmp, @1);
624 # } else p[0] = p[1].type;
628 def p_data_type_9(p
):
629 '''data_type : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_data_type TYPE_IDENTIFIER '''
630 if(parse_debug
): print('data_type_9', list(p
))
631 # { lex_in_package_scope(0);
636 def p_data_type_10(p
):
637 '''data_type : K_string '''
638 if(parse_debug
): print('data_type_10', list(p
))
639 # { string_type_t*tmp = new string_type_t;
640 # FILE_NAME(tmp, @1);
644 def p__embed0_data_type(p
):
645 '''_embed0_data_type : '''
646 # { lex_in_package_scope(p[1]); }
648 def p_data_type_or_implicit_1(p
):
649 '''data_type_or_implicit : data_type '''
650 if(parse_debug
): print('data_type_or_implicit_1', list(p
))
653 def p_data_type_or_implicit_2(p
):
654 '''data_type_or_implicit : signing dimensions_opt '''
655 if(parse_debug
): print('data_type_or_implicit_2', list(p
))
656 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, p[1], p[2]);
657 # tmp->implicit_flag = true;
658 # FILE_NAME(tmp, @1);
662 def p_data_type_or_implicit_3(p
):
663 '''data_type_or_implicit : dimensions '''
664 if(parse_debug
): print('data_type_or_implicit_3', list(p
))
665 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, p[1]);
666 # tmp->implicit_flag = true;
667 # FILE_NAME(tmp, @1);
671 def p_data_type_or_implicit_4(p
):
672 '''data_type_or_implicit : '''
673 if(parse_debug
>2): print('data_type_or_implicit_4', list(p
))
676 def p_data_type_or_implicit_or_void_1(p
):
677 '''data_type_or_implicit_or_void : data_type_or_implicit '''
678 if(parse_debug
): print('data_type_or_implicit_or_void_1', list(p
))
681 def p_data_type_or_implicit_or_void_2(p
):
682 '''data_type_or_implicit_or_void : K_void '''
683 if(parse_debug
): print('data_type_or_implicit_or_void_2', list(p
))
684 # { void_type_t*tmp = new void_type_t;
685 # FILE_NAME(tmp, @1);
689 def p_description_1(p
):
690 '''description : module '''
691 if(parse_debug
>2): print('description_1', list(p
))
693 def p_description_2(p
):
694 '''description : udp_primitive '''
695 if(parse_debug
): print('description_2', list(p
))
697 def p_description_3(p
):
698 '''description : config_declaration '''
699 if(parse_debug
): print('description_3', list(p
))
701 def p_description_4(p
):
702 '''description : nature_declaration '''
703 if(parse_debug
): print('description_4', list(p
))
705 def p_description_5(p
):
706 '''description : package_declaration '''
707 if(parse_debug
): print('description_5', list(p
))
709 def p_description_6(p
):
710 '''description : discipline_declaration '''
711 if(parse_debug
): print('description_6', list(p
))
713 def p_description_7(p
):
714 '''description : package_item '''
715 if(parse_debug
): print('description_7', list(p
))
717 def p_description_8(p
):
718 '''description : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' '''
719 if(parse_debug
): print('description_8', list(p
))
720 # { perm_string tmp3 = lex_strings.make(p[3]);
721 # pform_set_type_attrib(tmp3, p[5], p[7]);
726 def p_description_list_1(p
):
727 '''description_list : description '''
728 if(parse_debug
>2): print('description_list_1', list(p
))
730 def p_description_list_2(p
):
731 '''description_list : description_list description '''
732 if(parse_debug
): print('description_list_2', list(p
))
734 def p_endnew_opt_1(p
):
735 '''endnew_opt : ':' K_new '''
736 if(parse_debug
): print('endnew_opt_1', list(p
))
738 def p_endnew_opt_2(p
):
740 if(parse_debug
): print('endnew_opt_2', list(p
))
742 def p_dynamic_array_new_1(p
):
743 '''dynamic_array_new : K_new '[' expression ']' '''
744 if(parse_debug
): print('dynamic_array_new_1', list(p
))
745 # { p[0] = new PENewArray(p[3], 0);
746 # FILE_NAME(p[0], @1);
749 def p_dynamic_array_new_2(p
):
750 '''dynamic_array_new : K_new '[' expression ']' '(' expression ')' '''
751 if(parse_debug
): print('dynamic_array_new_2', list(p
))
752 # { p[0] = new PENewArray(p[3], p[6]);
753 # FILE_NAME(p[0], @1);
757 '''for_step : lpvalue '=' expression '''
758 if(parse_debug
): print('for_step_1', list(p
))
759 # { PAssign*tmp = new PAssign(p[1],p[3]);
760 # FILE_NAME(tmp, @1);
765 '''for_step : inc_or_dec_expression '''
766 if(parse_debug
): print('for_step_2', list(p
))
767 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
770 '''for_step : compressed_statement '''
771 if(parse_debug
): print('for_step_3', list(p
))
774 def p_function_declaration_1(p
):
775 '''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 '''
776 if(parse_debug
): print('function_declaration_1', list(p
))
777 # { // Last step: check any closing name.
779 # if (strcmp(p[4],p[11]) != 0) {
780 # yyerror(@11, "error: End label doesn't match "
783 # if (! gn_system_verilog()) {
784 # yyerror(@11, "error: Function end labels require "
792 def p_function_declaration_2(p
):
793 '''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 '''
794 if(parse_debug
): print('function_declaration_2', list(p
))
795 # { // Last step: check any closing name.
797 # if (strcmp(p[4],p[14]) != 0) {
798 # yyerror(@14, "error: End label doesn't match "
801 # if (! gn_system_verilog()) {
802 # yyerror(@14, "error: Function end labels require "
810 def p_function_declaration_3(p
):
811 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER error K_endfunction _embed4_function_declaration endlabel_opt '''
812 if(parse_debug
): print('function_declaration_3', list(p
))
813 # { // Last step: check any closing name.
815 # if (strcmp(p[4],p[8]) != 0) {
816 # yyerror(@8, "error: End label doesn't match function name");
818 # if (! gn_system_verilog()) {
819 # yyerror(@8, "error: Function end labels require "
827 def p__embed0_function_declaration(p
):
828 '''_embed0_function_declaration : '''
829 # { assert(current_function == 0);
830 # current_function = pform_push_function_scope(@1, p[4], p[2]);
833 def p__embed1_function_declaration(p
):
834 '''_embed1_function_declaration : '''
835 # { current_function->set_ports(p[7]);
836 # current_function->set_return(p[3]);
837 # current_function_set_statement(p[8]? @8 : @4, p[8]);
838 # pform_set_this_class(@4, current_function);
840 # current_function = 0;
843 def p__embed2_function_declaration(p
):
844 '''_embed2_function_declaration : '''
845 # { assert(current_function == 0);
846 # current_function = pform_push_function_scope(@1, p[4], p[2]);
849 def p__embed3_function_declaration(p
):
850 '''_embed3_function_declaration : '''
851 # { current_function->set_ports(p[7]);
852 # current_function->set_return(p[3]);
853 # current_function_set_statement(p[11]? @11 : @4, p[11]);
854 # pform_set_this_class(@4, current_function);
856 # current_function = 0;
857 # if (p[7]==0 && !gn_system_verilog()) {
858 # yyerror(@4, "error: Empty parenthesis syntax requires SystemVerilog.");
862 def p__embed4_function_declaration(p
):
863 '''_embed4_function_declaration : '''
865 # if (current_function) {
867 # current_function = 0;
869 # assert(current_function == 0);
870 # yyerror(@1, "error: Syntax error defining function.");
874 def p_import_export_1(p
):
875 '''import_export : K_import '''
876 if(parse_debug
): print('import_export_1', list(p
))
879 def p_import_export_2(p
):
880 '''import_export : K_export '''
881 if(parse_debug
): print('import_export_2', list(p
))
884 def p_implicit_class_handle_1(p
):
885 '''implicit_class_handle : K_this '''
886 if(parse_debug
): print('implicit_class_handle_1', list(p
))
887 # { p[0] = pform_create_this(); }
889 def p_implicit_class_handle_2(p
):
890 '''implicit_class_handle : K_super '''
891 if(parse_debug
): print('implicit_class_handle_2', list(p
))
892 # { p[0] = pform_create_super(); }
894 def p_inc_or_dec_expression_1(p
):
895 '''inc_or_dec_expression : K_INCR lpvalue %prec UNARY_PREC '''
896 if(parse_debug
): print('inc_or_dec_expression_1', list(p
))
897 # { PEUnary*tmp = new PEUnary('I', p[2]);
898 # FILE_NAME(tmp, @2);
902 def p_inc_or_dec_expression_2(p
):
903 '''inc_or_dec_expression : lpvalue K_INCR %prec UNARY_PREC '''
904 if(parse_debug
): print('inc_or_dec_expression_2', list(p
))
905 # { PEUnary*tmp = new PEUnary('i', p[1]);
906 # FILE_NAME(tmp, @1);
910 def p_inc_or_dec_expression_3(p
):
911 '''inc_or_dec_expression : K_DECR lpvalue %prec UNARY_PREC '''
912 if(parse_debug
): print('inc_or_dec_expression_3', list(p
))
913 # { PEUnary*tmp = new PEUnary('D', p[2]);
914 # FILE_NAME(tmp, @2);
918 def p_inc_or_dec_expression_4(p
):
919 '''inc_or_dec_expression : lpvalue K_DECR %prec UNARY_PREC '''
920 if(parse_debug
): print('inc_or_dec_expression_4', list(p
))
921 # { PEUnary*tmp = new PEUnary('d', p[1]);
922 # FILE_NAME(tmp, @1);
926 def p_inside_expression_1(p
):
927 '''inside_expression : expression K_inside '{' open_range_list '}' '''
928 if(parse_debug
): print('inside_expression_1', list(p
))
929 # { yyerror(@2, "sorry: \"inside\" expressions not supported yet.");
933 def p_integer_vector_type_1(p
):
934 '''integer_vector_type : K_reg '''
935 if(parse_debug
): print('integer_vector_type_1', list(p
))
936 p
[0] = IVL_VT_NO_TYPE
938 def p_integer_vector_type_2(p
):
939 '''integer_vector_type : K_bit '''
940 if(parse_debug
): print('integer_vector_type_2', list(p
))
943 def p_integer_vector_type_3(p
):
944 '''integer_vector_type : K_logic '''
945 if(parse_debug
): print('integer_vector_type_3', list(p
))
948 def p_integer_vector_type_4(p
):
949 '''integer_vector_type : K_bool '''
950 if(parse_debug
): print('integer_vector_type_4', list(p
))
951 # { p[0] = IVL_VT_BOOL; }
953 def p_join_keyword_1(p
):
954 '''join_keyword : K_join '''
955 if(parse_debug
): print('join_keyword_1', list(p
))
956 # { p[0] = PBlock::BL_PAR; }
958 def p_join_keyword_2(p
):
959 '''join_keyword : K_join_none '''
960 if(parse_debug
): print('join_keyword_2', list(p
))
961 # { p[0] = PBlock::BL_JOIN_NONE; }
963 def p_join_keyword_3(p
):
964 '''join_keyword : K_join_any '''
965 if(parse_debug
): print('join_keyword_3', list(p
))
966 # { p[0] = PBlock::BL_JOIN_ANY; }
968 def p_jump_statement_1(p
):
969 '''jump_statement : K_break ';' '''
970 if(parse_debug
): print('jump_statement_1', list(p
))
971 # { yyerror(@1, "sorry: break statements not supported.");
975 def p_jump_statement_2(p
):
976 '''jump_statement : K_return ';' '''
977 if(parse_debug
): print('jump_statement_2', list(p
))
978 # { PReturn*tmp = new PReturn(0);
979 # FILE_NAME(tmp, @1);
983 def p_jump_statement_3(p
):
984 '''jump_statement : K_return expression ';' '''
985 if(parse_debug
): print('jump_statement_3', list(p
))
986 # { PReturn*tmp = new PReturn(p[2]);
987 # FILE_NAME(tmp, @1);
992 '''lifetime : K_automatic '''
993 if(parse_debug
): print('lifetime_1', list(p
))
994 # { p[0] = LexicalScope::AUTOMATIC; }
997 '''lifetime : K_static '''
998 if(parse_debug
): print('lifetime_2', list(p
))
999 # { p[0] = LexicalScope::STATIC; }
1001 def p_lifetime_opt_1(p
):
1002 '''lifetime_opt : lifetime '''
1003 if(parse_debug
): print('lifetime_opt_1', list(p
))
1006 def p_lifetime_opt_2(p
):
1007 '''lifetime_opt : '''
1008 if(parse_debug
>2): print('lifetime_opt_2', list(p
))
1009 # { p[0] = LexicalScope::INHERITED; }
1011 def p_loop_statement_1(p
):
1012 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' for_step ')' statement_or_null '''
1013 if(parse_debug
): print('loop_statement_1', list(p
))
1014 # { PForStatement*tmp = new PForStatement(p[3], p[5], p[7], p[9], p[11]);
1015 # FILE_NAME(tmp, @1);
1019 def p_loop_statement_2(p
):
1020 '''loop_statement : K_for '(' data_type IDENTIFIER '=' expression ';' expression ';' for_step ')' _embed0_loop_statement statement_or_null '''
1021 if(parse_debug
): print('loop_statement_2', list(p
))
1022 # { pform_name_t tmp_hident;
1023 # tmp_hident.push_back(name_component_t(lex_strings.make(p[4])));
1025 # PEIdent*tmp_ident = pform_new_ident(tmp_hident);
1026 # FILE_NAME(tmp_ident, @4);
1028 # PForStatement*tmp_for = new PForStatement(tmp_ident, p[6], p[8], p[10], p[13]);
1029 # FILE_NAME(tmp_for, @1);
1031 # pform_pop_scope();
1032 # vector<Statement*>tmp_for_list (1);
1033 # tmp_for_list[0] = tmp_for;
1034 # PBlock*tmp_blk = current_block_stack.top();
1035 # current_block_stack.pop();
1036 # tmp_blk->set_statement(tmp_for_list);
1041 def p_loop_statement_3(p
):
1042 '''loop_statement : K_forever statement_or_null '''
1043 if(parse_debug
): print('loop_statement_3', list(p
))
1044 # { PForever*tmp = new PForever(p[2]);
1045 # FILE_NAME(tmp, @1);
1049 def p_loop_statement_4(p
):
1050 '''loop_statement : K_repeat '(' expression ')' statement_or_null '''
1051 if(parse_debug
): print('loop_statement_4', list(p
))
1052 # { PRepeat*tmp = new PRepeat(p[3], p[5]);
1053 # FILE_NAME(tmp, @1);
1057 def p_loop_statement_5(p
):
1058 '''loop_statement : K_while '(' expression ')' statement_or_null '''
1059 if(parse_debug
): print('loop_statement_5', list(p
))
1060 # { PWhile*tmp = new PWhile(p[3], p[5]);
1061 # FILE_NAME(tmp, @1);
1065 def p_loop_statement_6(p
):
1066 '''loop_statement : K_do statement_or_null K_while '(' expression ')' ';' '''
1067 if(parse_debug
): print('loop_statement_6', list(p
))
1068 # { PDoWhile*tmp = new PDoWhile(p[5], p[2]);
1069 # FILE_NAME(tmp, @1);
1073 def p_loop_statement_7(p
):
1074 '''loop_statement : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' _embed1_loop_statement statement_or_null '''
1075 if(parse_debug
): print('loop_statement_7', list(p
))
1076 # { PForeach*tmp_for = pform_make_foreach(@1, p[3], p[5], p[9]);
1078 # pform_pop_scope();
1079 # vector<Statement*>tmp_for_list(1);
1080 # tmp_for_list[0] = tmp_for;
1081 # PBlock*tmp_blk = current_block_stack.top();
1082 # current_block_stack.pop();
1083 # tmp_blk->set_statement(tmp_for_list);
1087 def p_loop_statement_8(p
):
1088 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' error ')' statement_or_null '''
1089 if(parse_debug
): print('loop_statement_8', list(p
))
1091 # yyerror(@1, "error: Error in for loop step assignment.");
1094 def p_loop_statement_9(p
):
1095 '''loop_statement : K_for '(' lpvalue '=' expression ';' error ';' for_step ')' statement_or_null '''
1096 if(parse_debug
): print('loop_statement_9', list(p
))
1098 # yyerror(@1, "error: Error in for loop condition expression.");
1101 def p_loop_statement_10(p
):
1102 '''loop_statement : K_for '(' error ')' statement_or_null '''
1103 if(parse_debug
): print('loop_statement_10', list(p
))
1105 # yyerror(@1, "error: Incomprehensible for loop.");
1108 def p_loop_statement_11(p
):
1109 '''loop_statement : K_while '(' error ')' statement_or_null '''
1110 if(parse_debug
): print('loop_statement_11', list(p
))
1112 # yyerror(@1, "error: Error in while loop condition.");
1115 def p_loop_statement_12(p
):
1116 '''loop_statement : K_do statement_or_null K_while '(' error ')' ';' '''
1117 if(parse_debug
): print('loop_statement_12', list(p
))
1119 # yyerror(@1, "error: Error in do/while loop condition.");
1122 def p_loop_statement_13(p
):
1123 '''loop_statement : K_foreach '(' IDENTIFIER '[' error ']' ')' statement_or_null '''
1124 if(parse_debug
): print('loop_statement_13', list(p
))
1126 # yyerror(@4, "error: Errors in foreach loop variables list.");
1129 def p__embed0_loop_statement(p
):
1130 '''_embed0_loop_statement : '''
1131 # { static unsigned for_counter = 0;
1132 # char for_block_name [64];
1133 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_for_loop%u", for_counter);
1135 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1136 # FILE_NAME(tmp, @1);
1137 # current_block_stack.push(tmp);
1139 # list<decl_assignment_t*>assign_list;
1140 # decl_assignment_t*tmp_assign = new decl_assignment_t;
1141 # tmp_assign->name = lex_strings.make(p[4]);
1142 # assign_list.push_back(tmp_assign);
1143 # pform_makewire(@4, 0, str_strength, &assign_list, NetNet::REG, p[3]);
1146 def p__embed1_loop_statement(p
):
1147 '''_embed1_loop_statement : '''
1148 # { static unsigned foreach_counter = 0;
1149 # char for_block_name[64];
1150 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_foreach%u", foreach_counter);
1151 # foreach_counter += 1;
1153 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1154 # FILE_NAME(tmp, @1);
1155 # current_block_stack.push(tmp);
1157 # pform_make_foreach_declarations(@1, p[5]);
1160 def p_list_of_variable_decl_assignments_1(p
):
1161 '''list_of_variable_decl_assignments : variable_decl_assignment '''
1162 if(parse_debug
): print('list_of_variable_decl_assignments_1', list(p
))
1163 # { list<decl_assignment_t*>*tmp = new list<decl_assignment_t*>;
1164 # tmp->push_back(p[1]);
1168 def p_list_of_variable_decl_assignments_2(p
):
1169 '''list_of_variable_decl_assignments : list_of_variable_decl_assignments ',' variable_decl_assignment '''
1170 if(parse_debug
): print('list_of_variable_decl_assignments_2', list(p
))
1171 # { list<decl_assignment_t*>*tmp = p[1];
1172 # tmp->push_back(p[3]);
1176 def p_variable_decl_assignment_1(p
):
1177 '''variable_decl_assignment : IDENTIFIER dimensions_opt '''
1178 if(parse_debug
): print('variable_decl_assignment_1', list(p
))
1179 # { decl_assignment_t*tmp = new decl_assignment_t;
1180 # tmp->name = lex_strings.make(p[1]);
1182 # tmp->index = *p[2];
1189 def p_variable_decl_assignment_2(p
):
1190 '''variable_decl_assignment : IDENTIFIER '=' expression '''
1191 if(parse_debug
): print('variable_decl_assignment_2', list(p
))
1192 # { decl_assignment_t*tmp = new decl_assignment_t;
1193 # tmp->name = lex_strings.make(p[1]);
1194 # tmp->expr .reset(p[3]);
1199 def p_variable_decl_assignment_3(p
):
1200 '''variable_decl_assignment : IDENTIFIER '=' K_new '(' ')' '''
1201 if(parse_debug
): print('variable_decl_assignment_3', list(p
))
1202 # { decl_assignment_t*tmp = new decl_assignment_t;
1203 # tmp->name = lex_strings.make(p[1]);
1204 # PENewClass*expr = new PENewClass;
1205 # FILE_NAME(expr, @3);
1206 # tmp->expr .reset(expr);
1211 def p_loop_variables_1(p
):
1212 '''loop_variables : loop_variables ',' IDENTIFIER '''
1213 if(parse_debug
): print('loop_variables_1', list(p
))
1214 # { list<perm_string>*tmp = p[1];
1215 # tmp->push_back(lex_strings.make(p[3]));
1220 def p_loop_variables_2(p
):
1221 '''loop_variables : IDENTIFIER '''
1222 if(parse_debug
): print('loop_variables_2', list(p
))
1223 # { list<perm_string>*tmp = new list<perm_string>;
1224 # tmp->push_back(lex_strings.make(p[1]));
1229 def p_method_qualifier_1(p
):
1230 '''method_qualifier : K_virtual '''
1231 if(parse_debug
): print('method_qualifier_1', list(p
))
1233 def p_method_qualifier_2(p
):
1234 '''method_qualifier : class_item_qualifier '''
1235 if(parse_debug
): print('method_qualifier_2', list(p
))
1237 def p_method_qualifier_opt_1(p
):
1238 '''method_qualifier_opt : method_qualifier '''
1239 if(parse_debug
): print('method_qualifier_opt_1', list(p
))
1241 def p_method_qualifier_opt_2(p
):
1242 '''method_qualifier_opt : '''
1243 if(parse_debug
): print('method_qualifier_opt_2', list(p
))
1245 def p_modport_declaration_1(p
):
1246 '''modport_declaration : K_modport _embed0_modport_declaration modport_item_list ';' '''
1247 if(parse_debug
): print('modport_declaration_1', list(p
))
1249 def p__embed0_modport_declaration(p
):
1250 '''_embed0_modport_declaration : '''
1251 # { if (!pform_in_interface())
1252 # yyerror(@1, "error: modport declarations are only allowed "
1253 # "in interfaces.");
1256 def p_modport_item_list_1(p
):
1257 '''modport_item_list : modport_item '''
1258 if(parse_debug
): print('modport_item_list_1', list(p
))
1260 def p_modport_item_list_2(p
):
1261 '''modport_item_list : modport_item_list ',' modport_item '''
1262 if(parse_debug
): print('modport_item_list_2', list(p
))
1264 def p_modport_item_1(p
):
1265 '''modport_item : IDENTIFIER _embed0_modport_item '(' modport_ports_list ')' '''
1266 if(parse_debug
): print('modport_item_1', list(p
))
1267 # { pform_end_modport_item(@1); }
1269 def p__embed0_modport_item(p
):
1270 '''_embed0_modport_item : '''
1271 # { pform_start_modport_item(@1, p[1]); }
1273 def p_modport_ports_list_1(p
):
1274 '''modport_ports_list : modport_ports_declaration '''
1275 if(parse_debug
): print('modport_ports_list_1', list(p
))
1277 def p_modport_ports_list_2(p
):
1278 '''modport_ports_list : modport_ports_list ',' modport_ports_declaration '''
1279 if(parse_debug
): print('modport_ports_list_2', list(p
))
1281 def p_modport_ports_list_3(p
):
1282 '''modport_ports_list : modport_ports_list ',' modport_simple_port '''
1283 if(parse_debug
): print('modport_ports_list_3', list(p
))
1284 # { if (last_modport_port.type == MP_SIMPLE) {
1285 # pform_add_modport_port(@3, last_modport_port.direction,
1286 # p[3]->name, p[3]->parm);
1288 # yyerror(@3, "error: modport expression not allowed here.");
1293 def p_modport_ports_list_4(p
):
1294 '''modport_ports_list : modport_ports_list ',' modport_tf_port '''
1295 if(parse_debug
): print('modport_ports_list_4', list(p
))
1296 # { if (last_modport_port.type != MP_TF)
1297 # yyerror(@3, "error: task/function declaration not allowed here.");
1300 def p_modport_ports_list_5(p
):
1301 '''modport_ports_list : modport_ports_list ',' IDENTIFIER '''
1302 if(parse_debug
): print('modport_ports_list_5', list(p
))
1303 # { if (last_modport_port.type == MP_SIMPLE) {
1304 # pform_add_modport_port(@3, last_modport_port.direction,
1305 # lex_strings.make(p[3]), 0);
1306 # } else if (last_modport_port.type != MP_TF) {
1307 # yyerror(@3, "error: list of identifiers not allowed here.");
1312 def p_modport_ports_list_6(p
):
1313 '''modport_ports_list : modport_ports_list ',' '''
1314 if(parse_debug
): print('modport_ports_list_6', list(p
))
1315 # { yyerror(@2, "error: NULL port declarations are not allowed"); }
1317 def p_modport_ports_declaration_1(p
):
1318 '''modport_ports_declaration : attribute_list_opt port_direction IDENTIFIER '''
1319 if(parse_debug
): print('modport_ports_declaration_1', list(p
))
1320 # { last_modport_port.type = MP_SIMPLE;
1321 # last_modport_port.direction = p[2];
1322 # pform_add_modport_port(@3, p[2], lex_strings.make(p[3]), 0);
1327 def p_modport_ports_declaration_2(p
):
1328 '''modport_ports_declaration : attribute_list_opt port_direction modport_simple_port '''
1329 if(parse_debug
): print('modport_ports_declaration_2', list(p
))
1330 # { last_modport_port.type = MP_SIMPLE;
1331 # last_modport_port.direction = p[2];
1332 # pform_add_modport_port(@3, p[2], p[3]->name, p[3]->parm);
1337 def p_modport_ports_declaration_3(p
):
1338 '''modport_ports_declaration : attribute_list_opt import_export IDENTIFIER '''
1339 if(parse_debug
): print('modport_ports_declaration_3', list(p
))
1340 # { last_modport_port.type = MP_TF;
1341 # last_modport_port.is_import = p[2];
1342 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
1347 def p_modport_ports_declaration_4(p
):
1348 '''modport_ports_declaration : attribute_list_opt import_export modport_tf_port '''
1349 if(parse_debug
): print('modport_ports_declaration_4', list(p
))
1350 # { last_modport_port.type = MP_TF;
1351 # last_modport_port.is_import = p[2];
1352 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
1356 def p_modport_ports_declaration_5(p
):
1357 '''modport_ports_declaration : attribute_list_opt K_clocking IDENTIFIER '''
1358 if(parse_debug
): print('modport_ports_declaration_5', list(p
))
1359 # { last_modport_port.type = MP_CLOCKING;
1360 # last_modport_port.direction = NetNet::NOT_A_PORT;
1361 # yyerror(@3, "sorry: modport clocking declaration is not yet supported.");
1366 def p_modport_simple_port_1(p
):
1367 '''modport_simple_port : '.' IDENTIFIER '(' expression ')' '''
1368 if(parse_debug
): print('modport_simple_port_1', list(p
))
1369 # { named_pexpr_t*tmp = new named_pexpr_t;
1370 # tmp->name = lex_strings.make(p[2]);
1376 def p_modport_tf_port_1(p
):
1377 '''modport_tf_port : K_task IDENTIFIER '''
1378 if(parse_debug
): print('modport_tf_port_1', list(p
))
1380 def p_modport_tf_port_2(p
):
1381 '''modport_tf_port : K_task IDENTIFIER '(' tf_port_list_opt ')' '''
1382 if(parse_debug
): print('modport_tf_port_2', list(p
))
1384 def p_modport_tf_port_3(p
):
1385 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '''
1386 if(parse_debug
): print('modport_tf_port_3', list(p
))
1388 def p_modport_tf_port_4(p
):
1389 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' '''
1390 if(parse_debug
): print('modport_tf_port_4', list(p
))
1392 def p_non_integer_type_1(p
):
1393 '''non_integer_type : K_real '''
1394 if(parse_debug
): print('non_integer_type_1', list(p
))
1395 # { p[0] = real_type_t::REAL; }
1397 def p_non_integer_type_2(p
):
1398 '''non_integer_type : K_realtime '''
1399 if(parse_debug
): print('non_integer_type_2', list(p
))
1400 # { p[0] = real_type_t::REAL; }
1402 def p_non_integer_type_3(p
):
1403 '''non_integer_type : K_shortreal '''
1404 if(parse_debug
): print('non_integer_type_3', list(p
))
1405 # { p[0] = real_type_t::SHORTREAL; }
1408 '''number : BASED_NUMBER '''
1409 if(parse_debug
): print('number_1', list(p
))
1410 # { p[0] = p[1]; based_size = 0;}
1413 '''number : DEC_NUMBER '''
1414 if(parse_debug
): print('number_2', list(p
))
1415 num
= Leaf(token
.NUMBER
, "%s" % (p
[1]))
1417 # { p[0] = p[1]; based_size = 0;}
1420 '''number : DEC_NUMBER BASED_NUMBER '''
1421 if(parse_debug
): print('number_3', list(p
))
1422 num
= Leaf(token
.NUMBER
, "%s:%s" % (p
[1], p
[2]))
1424 # { p[0] = pform_verinum_with_size(p[1],p[2], @2.text, @2.first_line);
1428 '''number : UNBASED_NUMBER '''
1429 if(parse_debug
): print('number_4', list(p
))
1430 # { p[0] = p[1]; based_size = 0;}
1433 '''number : DEC_NUMBER UNBASED_NUMBER '''
1434 if(parse_debug
): print('number_5', list(p
))
1435 # { yyerror(@1, "error: Unbased SystemVerilog literal cannot have "
1437 # p[0] = p[1]; based_size = 0;}
1439 def p_open_range_list_1(p
):
1440 '''open_range_list : open_range_list ',' value_range '''
1441 if(parse_debug
): print('open_range_list_1', list(p
))
1443 def p_open_range_list_2(p
):
1444 '''open_range_list : value_range '''
1445 if(parse_debug
): print('open_range_list_2', list(p
))
1447 def p_package_declaration_1(p
):
1448 '''package_declaration : K_package lifetime_opt IDENTIFIER ';' _embed0_package_declaration timeunits_declaration_opt _embed1_package_declaration package_item_list_opt K_endpackage endlabel_opt '''
1449 if(parse_debug
): print('package_declaration_1', list(p
))
1450 # { pform_end_package_declaration(@1);
1451 # // If an end label is present make sure it match the package name.
1453 # if (strcmp(p[3],p[10]) != 0) {
1454 # yyerror(@10, "error: End label doesn't match package name");
1461 def p__embed0_package_declaration(p
):
1462 '''_embed0_package_declaration : '''
1463 # { pform_start_package_declaration(@1, p[3], p[2]); }
1465 def p__embed1_package_declaration(p
):
1466 '''_embed1_package_declaration : '''
1467 # { pform_set_scope_timescale(@1); }
1469 def p_module_package_import_list_opt_1(p
):
1470 '''module_package_import_list_opt : '''
1471 if(parse_debug
>1): print('module_package_import_list_opt_1', list(p
))
1473 def p_module_package_import_list_opt_2(p
):
1474 '''module_package_import_list_opt : package_import_list '''
1475 if(parse_debug
): print('module_package_import_list_opt_2', list(p
))
1477 def p_package_import_list_1(p
):
1478 '''package_import_list : package_import_declaration '''
1479 if(parse_debug
): print('package_import_list_1', list(p
))
1481 def p_package_import_list_2(p
):
1482 '''package_import_list : package_import_list package_import_declaration '''
1483 if(parse_debug
): print('package_import_list_2', list(p
))
1485 def p_package_import_declaration_1(p
):
1486 '''package_import_declaration : K_import package_import_item_list ';' '''
1487 if(parse_debug
): print('package_import_declaration_1', list(p
))
1490 def p_package_import_item_1(p
):
1491 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '''
1492 if(parse_debug
): print('package_import_item_1', list(p
))
1493 # { pform_package_import(@2, p[1], p[3]);
1497 def p_package_import_item_2(p
):
1498 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES '*' '''
1499 if(parse_debug
): print('package_import_item_2', list(p
))
1500 # { pform_package_import(@2, p[1], 0);
1503 def p_package_import_item_list_1(p
):
1504 '''package_import_item_list : package_import_item_list ',' package_import_item '''
1505 if(parse_debug
): print('package_import_item_list_1', list(p
))
1507 def p_package_import_item_list_2(p
):
1508 '''package_import_item_list : package_import_item '''
1509 if(parse_debug
): print('package_import_item_list_2', list(p
))
1511 def p_package_item_1(p
):
1512 '''package_item : timeunits_declaration '''
1513 if(parse_debug
): print('package_item_1', list(p
))
1515 def p_package_item_2(p
):
1516 '''package_item : K_parameter param_type parameter_assign_list ';' '''
1517 if(parse_debug
): print('package_item_2', list(p
))
1519 def p_package_item_3(p
):
1520 '''package_item : K_localparam param_type localparam_assign_list ';' '''
1521 if(parse_debug
): print('package_item_3', list(p
))
1523 def p_package_item_4(p
):
1524 '''package_item : type_declaration '''
1525 if(parse_debug
): print('package_item_4', list(p
))
1527 def p_package_item_5(p
):
1528 '''package_item : function_declaration '''
1529 if(parse_debug
): print('package_item_5', list(p
))
1531 def p_package_item_6(p
):
1532 '''package_item : task_declaration '''
1533 if(parse_debug
): print('package_item_6', list(p
))
1535 def p_package_item_7(p
):
1536 '''package_item : data_declaration '''
1537 if(parse_debug
): print('package_item_7', list(p
))
1539 def p_package_item_8(p
):
1540 '''package_item : class_declaration '''
1541 if(parse_debug
): print('package_item_8', list(p
))
1543 def p_package_item_list_1(p
):
1544 '''package_item_list : package_item_list package_item '''
1545 if(parse_debug
): print('package_item_list_1', list(p
))
1547 def p_package_item_list_2(p
):
1548 '''package_item_list : package_item '''
1549 if(parse_debug
): print('package_item_list_2', list(p
))
1551 def p_package_item_list_opt_1(p
):
1552 '''package_item_list_opt : package_item_list '''
1553 if(parse_debug
): print('package_item_list_opt_1', list(p
))
1555 def p_package_item_list_opt_2(p
):
1556 '''package_item_list_opt : '''
1557 if(parse_debug
): print('package_item_list_opt_2', list(p
))
1559 def p_port_direction_1(p
):
1560 '''port_direction : K_input '''
1561 if(parse_debug
): print('port_direction_1', list(p
))
1562 # { p[0] = NetNet::PINPUT; }
1564 def p_port_direction_2(p
):
1565 '''port_direction : K_output '''
1566 if(parse_debug
): print('port_direction_2', list(p
))
1567 # { p[0] = NetNet::POUTPUT; }
1569 def p_port_direction_3(p
):
1570 '''port_direction : K_inout '''
1571 if(parse_debug
): print('port_direction_3', list(p
))
1572 # { p[0] = NetNet::PINOUT; }
1574 def p_port_direction_4(p
):
1575 '''port_direction : K_ref '''
1576 if(parse_debug
): print('port_direction_4', list(p
))
1577 # { p[0] = NetNet::PREF;
1578 # if (!gn_system_verilog()) {
1579 # yyerror(@1, "error: Reference ports (ref) require SystemVerilog.");
1580 # p[0] = NetNet::PINPUT;
1584 def p_port_direction_opt_1(p
):
1585 '''port_direction_opt : port_direction '''
1586 if(parse_debug
): print('port_direction_opt_1', list(p
))
1589 def p_port_direction_opt_2(p
):
1590 '''port_direction_opt : '''
1591 if(parse_debug
): print('port_direction_opt_2', list(p
))
1592 # { p[0] = NetNet::PIMPLICIT; }
1594 def p_property_expr_1(p
):
1595 '''property_expr : expression '''
1596 if(parse_debug
): print('property_expr_1', list(p
))
1598 def p_procedural_assertion_statement_1(p
):
1599 '''procedural_assertion_statement : K_assert '(' expression ')' statement %prec less_than_K_else '''
1600 if(parse_debug
): print('procedural_assertion_statement_1', list(p
))
1601 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1605 def p_procedural_assertion_statement_2(p
):
1606 '''procedural_assertion_statement : K_assert '(' expression ')' K_else statement '''
1607 if(parse_debug
): print('procedural_assertion_statement_2', list(p
))
1608 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1612 def p_procedural_assertion_statement_3(p
):
1613 '''procedural_assertion_statement : K_assert '(' expression ')' statement K_else statement '''
1614 if(parse_debug
): print('procedural_assertion_statement_3', list(p
))
1615 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1619 def p_property_qualifier_1(p
):
1620 '''property_qualifier : class_item_qualifier '''
1621 if(parse_debug
): print('property_qualifier_1', list(p
))
1623 def p_property_qualifier_2(p
):
1624 '''property_qualifier : random_qualifier '''
1625 if(parse_debug
): print('property_qualifier_2', list(p
))
1627 def p_property_qualifier_opt_1(p
):
1628 '''property_qualifier_opt : property_qualifier_list '''
1629 if(parse_debug
): print('property_qualifier_opt_1', list(p
))
1632 def p_property_qualifier_opt_2(p
):
1633 '''property_qualifier_opt : '''
1634 if(parse_debug
): print('property_qualifier_opt_2', list(p
))
1635 # { p[0] = property_qualifier_t::make_none(); }
1637 def p_property_qualifier_list_1(p
):
1638 '''property_qualifier_list : property_qualifier_list property_qualifier '''
1639 if(parse_debug
): print('property_qualifier_list_1', list(p
))
1640 # { p[0] = p[1] | p[2]; }
1642 def p_property_qualifier_list_2(p
):
1643 '''property_qualifier_list : property_qualifier '''
1644 if(parse_debug
): print('property_qualifier_list_2', list(p
))
1647 def p_property_spec_1(p
):
1648 '''property_spec : clocking_event_opt property_spec_disable_iff_opt property_expr '''
1649 if(parse_debug
): print('property_spec_1', list(p
))
1651 def p_property_spec_disable_iff_opt_1(p
):
1652 '''property_spec_disable_iff_opt : K_disable K_iff '(' expression ')' '''
1653 if(parse_debug
): print('property_spec_disable_iff_opt_1', list(p
))
1655 def p_property_spec_disable_iff_opt_2(p
):
1656 '''property_spec_disable_iff_opt : '''
1657 if(parse_debug
): print('property_spec_disable_iff_opt_2', list(p
))
1659 def p_random_qualifier_1(p
):
1660 '''random_qualifier : K_rand '''
1661 if(parse_debug
): print('random_qualifier_1', list(p
))
1662 # { p[0] = property_qualifier_t::make_rand(); }
1664 def p_random_qualifier_2(p
):
1665 '''random_qualifier : K_randc '''
1666 if(parse_debug
): print('random_qualifier_2', list(p
))
1667 # { p[0] = property_qualifier_t::make_randc(); }
1669 def p_real_or_realtime_1(p
):
1670 '''real_or_realtime : K_real '''
1671 if(parse_debug
): print('real_or_realtime_1', list(p
))
1673 def p_real_or_realtime_2(p
):
1674 '''real_or_realtime : K_realtime '''
1675 if(parse_debug
): print('real_or_realtime_2', list(p
))
1678 '''signing : K_signed '''
1679 if(parse_debug
): print('signing_1', list(p
))
1683 '''signing : K_unsigned '''
1684 if(parse_debug
): print('signing_2', list(p
))
1687 def p_simple_type_or_string_1(p
):
1688 '''simple_type_or_string : integer_vector_type '''
1689 if(parse_debug
): print('simple_type_or_string_1', list(p
))
1690 # { ivl_variable_type_t use_vtype = p[1];
1691 # bool reg_flag = false;
1692 # if (use_vtype == IVL_VT_NO_TYPE) {
1693 # use_vtype = IVL_VT_LOGIC;
1696 # vector_type_t*tmp = new vector_type_t(use_vtype, false, 0);
1697 # tmp->reg_flag = reg_flag;
1698 # FILE_NAME(tmp, @1);
1702 def p_simple_type_or_string_2(p
):
1703 '''simple_type_or_string : non_integer_type '''
1704 if(parse_debug
): print('simple_type_or_string_2', list(p
))
1705 # { real_type_t*tmp = new real_type_t(p[1]);
1706 # FILE_NAME(tmp, @1);
1710 def p_simple_type_or_string_3(p
):
1711 '''simple_type_or_string : atom2_type '''
1712 if(parse_debug
): print('simple_type_or_string_3', list(p
))
1713 # { atom2_type_t*tmp = new atom2_type_t(p[1], true);
1714 # FILE_NAME(tmp, @1);
1718 def p_simple_type_or_string_4(p
):
1719 '''simple_type_or_string : K_integer '''
1720 if(parse_debug
): print('simple_type_or_string_4', list(p
))
1721 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
1722 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd);
1723 # tmp->reg_flag = true;
1724 # tmp->integer_flag = true;
1728 def p_simple_type_or_string_5(p
):
1729 '''simple_type_or_string : K_time '''
1730 if(parse_debug
): print('simple_type_or_string_5', list(p
))
1731 # { list<pform_range_t>*pd = make_range_from_width(64);
1732 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
1733 # tmp->reg_flag = !gn_system_verilog();
1737 def p_simple_type_or_string_6(p
):
1738 '''simple_type_or_string : TYPE_IDENTIFIER '''
1739 if(parse_debug
): print('simple_type_or_string_6', list(p
))
1740 # { p[0] = p[1].type;
1741 # delete[]p[1].text;
1744 def p_simple_type_or_string_7(p
):
1745 '''simple_type_or_string : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_simple_type_or_string TYPE_IDENTIFIER '''
1746 if(parse_debug
): print('simple_type_or_string_7', list(p
))
1747 # { lex_in_package_scope(0);
1749 # delete[]p[4].text;
1752 def p_simple_type_or_string_8(p
):
1753 '''simple_type_or_string : K_string '''
1754 if(parse_debug
): print('simple_type_or_string_8', list(p
))
1755 # { string_type_t*tmp = new string_type_t;
1756 # FILE_NAME(tmp, @1);
1760 def p__embed0_simple_type_or_string(p
):
1761 '''_embed0_simple_type_or_string : '''
1762 # { lex_in_package_scope(p[1]); }
1764 def p_statement_1(p
):
1765 '''statement : attribute_list_opt statement_item '''
1766 if(parse_debug
): print('statement_1', list(p
))
1767 # { pform_bind_attributes(p[2]->attributes, p[1]);
1771 def p_statement_or_null_1(p
):
1772 '''statement_or_null : statement '''
1773 if(parse_debug
): print('statement_or_null_1', list(p
))
1776 def p_statement_or_null_2(p
):
1777 '''statement_or_null : attribute_list_opt ';' '''
1778 if(parse_debug
): print('statement_or_null_2', list(p
))
1781 def p_stream_expression_1(p
):
1782 '''stream_expression : expression '''
1783 if(parse_debug
): print('stream_expression_1', list(p
))
1785 def p_stream_expression_list_1(p
):
1786 '''stream_expression_list : stream_expression_list ',' stream_expression '''
1787 if(parse_debug
): print('stream_expression_list_1', list(p
))
1789 def p_stream_expression_list_2(p
):
1790 '''stream_expression_list : stream_expression '''
1791 if(parse_debug
): print('stream_expression_list_2', list(p
))
1793 def p_stream_operator_1(p
):
1794 '''stream_operator : K_LS '''
1795 if(parse_debug
): print('stream_operator_1', list(p
))
1797 def p_stream_operator_2(p
):
1798 '''stream_operator : K_RS '''
1799 if(parse_debug
): print('stream_operator_2', list(p
))
1801 def p_streaming_concatenation_1(p
):
1802 '''streaming_concatenation : '{' stream_operator '{' stream_expression_list '}' '}' '''
1803 if(parse_debug
): print('streaming_concatenation_1', list(p
))
1804 # { /* streaming concatenation is a SystemVerilog thing. */
1805 # if (gn_system_verilog()) {
1806 # yyerror(@2, "sorry: Streaming concatenation not supported.");
1809 # yyerror(@2, "error: Streaming concatenation requires SystemVerilog");
1814 def p_task_declaration_1(p
):
1815 '''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 '''
1816 if(parse_debug
): print('task_declaration_1', list(p
))
1817 # { // Last step: check any closing name. This is done late so
1818 # // that the parser can look ahead to detect the present
1819 # // endlabel_opt but still have the pform_endmodule() called
1820 # // early enough that the lexor can know we are outside the
1823 # if (strcmp(p[3],p[10]) != 0) {
1824 # yyerror(@10, "error: End label doesn't match task name");
1826 # if (! gn_system_verilog()) {
1827 # yyerror(@10, "error: Task end labels require "
1828 # "SystemVerilog.");
1835 def p_task_declaration_2(p
):
1836 '''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 '''
1837 if(parse_debug
): print('task_declaration_2', list(p
))
1838 # { // Last step: check any closing name. This is done late so
1839 # // that the parser can look ahead to detect the present
1840 # // endlabel_opt but still have the pform_endmodule() called
1841 # // early enough that the lexor can know we are outside the
1844 # if (strcmp(p[3],p[13]) != 0) {
1845 # yyerror(@13, "error: End label doesn't match task name");
1847 # if (! gn_system_verilog()) {
1848 # yyerror(@13, "error: Task end labels require "
1849 # "SystemVerilog.");
1856 def p_task_declaration_3(p
):
1857 '''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 '''
1858 if(parse_debug
): print('task_declaration_3', list(p
))
1859 # { // Last step: check any closing name. This is done late so
1860 # // that the parser can look ahead to detect the present
1861 # // endlabel_opt but still have the pform_endmodule() called
1862 # // early enough that the lexor can know we are outside the
1865 # if (strcmp(p[3],p[12]) != 0) {
1866 # yyerror(@12, "error: End label doesn't match task name");
1868 # if (! gn_system_verilog()) {
1869 # yyerror(@12, "error: Task end labels require "
1870 # "SystemVerilog.");
1877 def p_task_declaration_4(p
):
1878 '''task_declaration : K_task lifetime_opt IDENTIFIER error K_endtask _embed6_task_declaration endlabel_opt '''
1879 if(parse_debug
): print('task_declaration_4', list(p
))
1880 # { // Last step: check any closing name. This is done late so
1881 # // that the parser can look ahead to detect the present
1882 # // endlabel_opt but still have the pform_endmodule() called
1883 # // early enough that the lexor can know we are outside the
1886 # if (strcmp(p[3],p[7]) != 0) {
1887 # yyerror(@7, "error: End label doesn't match task name");
1889 # if (! gn_system_verilog()) {
1890 # yyerror(@7, "error: Task end labels require "
1891 # "SystemVerilog.");
1898 def p__embed0_task_declaration(p
):
1899 '''_embed0_task_declaration : '''
1900 # { assert(current_task == 0);
1901 # current_task = pform_push_task_scope(@1, p[3], p[2]);
1904 def p__embed1_task_declaration(p
):
1905 '''_embed1_task_declaration : '''
1906 # { current_task->set_ports(p[6]);
1907 # current_task_set_statement(@3, p[7]);
1908 # pform_set_this_class(@3, current_task);
1909 # pform_pop_scope();
1911 # if (p[7] && p[7]->size() > 1 && !gn_system_verilog()) {
1912 # yyerror(@7, "error: Task body with multiple statements requires SystemVerilog.");
1917 def p__embed2_task_declaration(p
):
1918 '''_embed2_task_declaration : '''
1919 # { assert(current_task == 0);
1920 # current_task = pform_push_task_scope(@1, p[3], p[2]);
1923 def p__embed3_task_declaration(p
):
1924 '''_embed3_task_declaration : '''
1925 # { current_task->set_ports(p[6]);
1926 # current_task_set_statement(@3, p[10]);
1927 # pform_set_this_class(@3, current_task);
1928 # pform_pop_scope();
1930 # if (p[10]) delete p[10];
1933 def p__embed4_task_declaration(p
):
1934 '''_embed4_task_declaration : '''
1935 # { assert(current_task == 0);
1936 # current_task = pform_push_task_scope(@1, p[3], p[2]);
1939 def p__embed5_task_declaration(p
):
1940 '''_embed5_task_declaration : '''
1941 # { current_task->set_ports(0);
1942 # current_task_set_statement(@3, p[9]);
1943 # pform_set_this_class(@3, current_task);
1944 # if (! current_task->method_of()) {
1945 # cerr << @3 << ": warning: task definition for \"" << p[3]
1946 # << "\" has an empty port declaration list!" << endl;
1948 # pform_pop_scope();
1950 # if (p[9]->size() > 1 && !gn_system_verilog()) {
1951 # yyerror(@9, "error: Task body with multiple statements requires SystemVerilog.");
1956 def p__embed6_task_declaration(p
):
1957 '''_embed6_task_declaration : '''
1959 # if (current_task) {
1960 # pform_pop_scope();
1965 def p_tf_port_declaration_1(p
):
1966 '''tf_port_declaration : port_direction K_reg_opt unsigned_signed_opt dimensions_opt list_of_identifiers ';' '''
1967 if(parse_debug
): print('tf_port_declaration_1', list(p
))
1968 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1],
1969 # p[2] ? IVL_VT_LOGIC :
1971 # p[3], p[4], p[5]);
1975 def p_tf_port_declaration_2(p
):
1976 '''tf_port_declaration : port_direction K_integer list_of_identifiers ';' '''
1977 if(parse_debug
): print('tf_port_declaration_2', list(p
))
1978 # { list<pform_range_t>*range_stub = make_range_from_width(integer_width);
1979 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, true,
1980 # range_stub, p[3], true);
1984 def p_tf_port_declaration_3(p
):
1985 '''tf_port_declaration : port_direction K_time list_of_identifiers ';' '''
1986 if(parse_debug
): print('tf_port_declaration_3', list(p
))
1987 # { list<pform_range_t>*range_stub = make_range_from_width(64);
1988 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, false,
1989 # range_stub, p[3]);
1993 def p_tf_port_declaration_4(p
):
1994 '''tf_port_declaration : port_direction real_or_realtime list_of_identifiers ';' '''
1995 if(parse_debug
): print('tf_port_declaration_4', list(p
))
1996 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_REAL, true,
2001 def p_tf_port_declaration_5(p
):
2002 '''tf_port_declaration : port_direction K_string list_of_identifiers ';' '''
2003 if(parse_debug
): print('tf_port_declaration_5', list(p
))
2004 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_STRING, true,
2009 def p_tf_port_item_1(p
):
2010 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER dimensions_opt tf_port_item_expr_opt '''
2011 if(parse_debug
): print('tf_port_item_1', list(p
))
2012 # { vector<pform_tf_port_t>*tmp;
2013 # NetNet::PortType use_port_type = p[1];
2014 # if ((use_port_type == NetNet::PIMPLICIT) && (gn_system_verilog() || (p[2] == 0)))
2015 # use_port_type = port_declaration_context.port_type;
2016 # perm_string name = lex_strings.make(p[3]);
2017 # list<perm_string>* ilist = list_from_identifier(p[3]);
2019 # if (use_port_type == NetNet::PIMPLICIT) {
2020 # yyerror(@1, "error: missing task/function port direction.");
2021 # use_port_type = NetNet::PINPUT; // for error recovery
2023 # if ((p[2] == 0) && (p[1]==NetNet::PIMPLICIT)) {
2024 # // Detect special case this is an undecorated
2025 # // identifier and we need to get the declaration from
2028 # yyerror(@4, "internal error: How can there be an unpacked range here?\n");
2030 # tmp = pform_make_task_ports(@3, use_port_type,
2031 # port_declaration_context.data_type,
2035 # // Otherwise, the decorations for this identifier
2036 # // indicate the type. Save the type for any right
2037 # // context that may come later.
2038 # port_declaration_context.port_type = use_port_type;
2040 # p[2] = new vector_type_t(IVL_VT_LOGIC, false, 0);
2041 # FILE_NAME(p[2], @3);
2043 # port_declaration_context.data_type = p[2];
2044 # tmp = pform_make_task_ports(@3, use_port_type, p[2], ilist);
2047 # pform_set_reg_idx(name, p[4]);
2052 # assert(tmp->size()==1);
2053 # tmp->front().defe = p[5];
2057 def p_tf_port_item_2(p
):
2058 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER error '''
2059 if(parse_debug
): print('tf_port_item_2', list(p
))
2060 # { yyerror(@3, "error: Error in task/function port item after port name %s.", p[3]);
2065 def p_tf_port_item_expr_opt_1(p
):
2066 '''tf_port_item_expr_opt : '=' expression '''
2067 if(parse_debug
): print('tf_port_item_expr_opt_1', list(p
))
2068 # { if (! gn_system_verilog()) {
2069 # yyerror(@1, "error: Task/function default arguments require "
2070 # "SystemVerilog.");
2075 def p_tf_port_item_expr_opt_2(p
):
2076 '''tf_port_item_expr_opt : '''
2077 if(parse_debug
): print('tf_port_item_expr_opt_2', list(p
))
2080 def p_tf_port_list_1(p
):
2081 '''tf_port_list : _embed0_tf_port_list tf_port_item_list '''
2082 if(parse_debug
): print('tf_port_list_1', list(p
))
2085 def p__embed0_tf_port_list(p
):
2086 '''_embed0_tf_port_list : '''
2087 # { port_declaration_context.port_type = gn_system_verilog() ? NetNet::PINPUT : NetNet::PIMPLICIT;
2088 # port_declaration_context.data_type = 0;
2091 def p_tf_port_item_list_1(p
):
2092 '''tf_port_item_list : tf_port_item_list ',' tf_port_item '''
2093 if(parse_debug
): print('tf_port_item_list_1', list(p
))
2094 # { vector<pform_tf_port_t>*tmp;
2095 # if (p[1] && p[3]) {
2096 # size_t s1 = p[1]->size();
2098 # tmp->resize(tmp->size()+p[3]->size());
2099 # for (size_t idx = 0 ; idx < p[3]->size() ; idx += 1)
2100 # tmp->at(s1+idx) = p[3]->at(idx);
2102 # } else if (p[1]) {
2110 def p_tf_port_item_list_2(p
):
2111 '''tf_port_item_list : tf_port_item '''
2112 if(parse_debug
): print('tf_port_item_list_2', list(p
))
2115 def p_tf_port_item_list_3(p
):
2116 '''tf_port_item_list : error ',' tf_port_item '''
2117 if(parse_debug
): print('tf_port_item_list_3', list(p
))
2118 # { yyerror(@2, "error: Syntax error in task/function port declaration.");
2122 def p_tf_port_item_list_4(p
):
2123 '''tf_port_item_list : tf_port_item_list ',' '''
2124 if(parse_debug
): print('tf_port_item_list_4', list(p
))
2125 # { yyerror(@2, "error: NULL port declarations are not allowed.");
2129 def p_tf_port_item_list_5(p
):
2130 '''tf_port_item_list : tf_port_item_list ';' '''
2131 if(parse_debug
): print('tf_port_item_list_5', list(p
))
2132 # { yyerror(@2, "error: ';' is an invalid port declaration separator.");
2136 def p_timeunits_declaration_1(p
):
2137 '''timeunits_declaration : K_timeunit TIME_LITERAL ';' '''
2138 if(parse_debug
): print('timeunits_declaration_1', list(p
))
2139 # { pform_set_timeunit(p[2], allow_timeunit_decl); }
2141 def p_timeunits_declaration_2(p
):
2142 '''timeunits_declaration : K_timeunit TIME_LITERAL '/' TIME_LITERAL ';' '''
2143 if(parse_debug
): print('timeunits_declaration_2', list(p
))
2144 # { bool initial_decl = allow_timeunit_decl && allow_timeprec_decl;
2145 # pform_set_timeunit(p[2], initial_decl);
2146 # pform_set_timeprec(p[4], initial_decl);
2149 def p_timeunits_declaration_3(p
):
2150 '''timeunits_declaration : K_timeprecision TIME_LITERAL ';' '''
2151 if(parse_debug
): print('timeunits_declaration_3', list(p
))
2152 # { pform_set_timeprec(p[2], allow_timeprec_decl); }
2154 def p_timeunits_declaration_opt_1(p
):
2155 '''timeunits_declaration_opt : %prec no_timeunits_declaration '''
2156 if(parse_debug
>2): print('timeunits_declaration_opt_1', list(p
))
2158 def p_timeunits_declaration_opt_2(p
):
2159 '''timeunits_declaration_opt : timeunits_declaration %prec one_timeunits_declaration '''
2160 if(parse_debug
): print('timeunits_declaration_opt_2', list(p
))
2162 def p_timeunits_declaration_opt_3(p
):
2163 '''timeunits_declaration_opt : timeunits_declaration timeunits_declaration '''
2164 if(parse_debug
): print('timeunits_declaration_opt_3', list(p
))
2166 def p_value_range_1(p
):
2167 '''value_range : expression '''
2168 if(parse_debug
): print('value_range_1', list(p
))
2171 def p_value_range_2(p
):
2172 '''value_range : '[' expression ':' expression ']' '''
2173 if(parse_debug
): print('value_range_2', list(p
))
2176 def p_variable_dimension_1(p
):
2177 '''variable_dimension : '[' expression ':' expression ']' '''
2178 if(parse_debug
): print('variable_dimension_1', list(p
))
2179 # { list<pform_range_t> *tmp = new list<pform_range_t>;
2180 # pform_range_t index (p[2],p[4]);
2181 # tmp->push_back(index);
2184 # XXX TODO: subscriptlist
2187 if end
.endswith("-1"):
2190 end
= str(int(end
)+1)
2193 p
[0] = '[%s:%s]' % (start
, end
) # python slice is LO:HI+1
2195 def p_variable_dimension_2(p
):
2196 '''variable_dimension : '[' expression ']' '''
2197 if(parse_debug
): print('variable_dimension_2', list(p
))
2198 # { // SystemVerilog canonical range
2199 # if (!gn_system_verilog()) {
2201 # cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. "
2202 # << "Use at least -g2005-sv to remove this warning." << endl;
2204 # list<pform_range_t> *tmp = new list<pform_range_t>;
2205 # pform_range_t index;
2206 # index.first = new PENumber(new verinum((uint64_t)0, integer_width));
2207 # index.second = new PEBinary('-', p[2], new PENumber(new verinum((uint64_t)1, integer_width)));
2208 # tmp->push_back(index);
2212 def p_variable_dimension_3(p
):
2213 '''variable_dimension : '[' ']' '''
2214 if(parse_debug
): print('variable_dimension_3', list(p
))
2215 # { list<pform_range_t> *tmp = new list<pform_range_t>;
2216 # pform_range_t index (0,0);
2217 # tmp->push_back(index);
2221 def p_variable_dimension_4(p
):
2222 '''variable_dimension : '[' '$' ']' '''
2223 if(parse_debug
): print('variable_dimension_4', list(p
))
2224 # { // SystemVerilog queue
2225 # list<pform_range_t> *tmp = new list<pform_range_t>;
2226 # pform_range_t index (new PENull,0);
2227 # if (!gn_system_verilog()) {
2228 # yyerror("error: Queue declarations require SystemVerilog.");
2230 # tmp->push_back(index);
2234 def p_variable_lifetime_1(p
):
2235 '''variable_lifetime : lifetime '''
2236 if(parse_debug
): print('variable_lifetime_1', list(p
))
2237 # { if (!gn_system_verilog()) {
2238 # yyerror(@1, "error: overriding the default variable lifetime "
2239 # "requires SystemVerilog.");
2240 # } else if (p[1] != pform_peek_scope()->default_lifetime) {
2241 # yyerror(@1, "sorry: overriding the default variable lifetime "
2242 # "is not yet supported.");
2244 # var_lifetime = p[1];
2247 def p_attribute_list_opt_1(p
):
2248 '''attribute_list_opt : attribute_instance_list '''
2249 if(parse_debug
): print('attribute_list_opt_1', list(p
))
2252 def p_attribute_list_opt_2(p
):
2253 '''attribute_list_opt : '''
2254 if(parse_debug
> 2): print('attribute_list_opt_2', list(p
))
2257 def p_attribute_instance_list_1(p
):
2258 '''attribute_instance_list : K_PSTAR K_STARP '''
2259 if(parse_debug
): print('attribute_instance_list_1', list(p
))
2262 def p_attribute_instance_list_2(p
):
2263 '''attribute_instance_list : K_PSTAR attribute_list K_STARP '''
2264 if(parse_debug
): print('attribute_instance_list_2', list(p
))
2267 def p_attribute_instance_list_3(p
):
2268 '''attribute_instance_list : attribute_instance_list K_PSTAR K_STARP '''
2269 if(parse_debug
): print('attribute_instance_list_3', list(p
))
2272 def p_attribute_instance_list_4(p
):
2273 '''attribute_instance_list : attribute_instance_list K_PSTAR attribute_list K_STARP '''
2274 if(parse_debug
): print('attribute_instance_list_4', list(p
))
2275 # { list<named_pexpr_t>*tmp = p[1];
2277 # tmp->splice(tmp->end(), *p[3]);
2280 # } else p[0] = p[3];
2283 def p_attribute_list_1(p
):
2284 '''attribute_list : attribute_list ',' attribute '''
2285 if(parse_debug
): print('attribute_list_1', list(p
))
2286 # { list<named_pexpr_t>*tmp = p[1];
2287 # tmp->push_back(*p[3]);
2292 def p_attribute_list_2(p
):
2293 '''attribute_list : attribute '''
2294 if(parse_debug
): print('attribute_list_2', list(p
))
2295 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
2296 # tmp->push_back(*p[1]);
2301 def p_attribute_1(p
):
2302 '''attribute : IDENTIFIER '''
2303 if(parse_debug
): print('attribute_1', list(p
))
2304 # { named_pexpr_t*tmp = new named_pexpr_t;
2305 # tmp->name = lex_strings.make(p[1]);
2311 def p_attribute_2(p
):
2312 '''attribute : IDENTIFIER '=' expression '''
2313 if(parse_debug
): print('attribute_2', list(p
))
2314 # { PExpr*tmp = p[3];
2315 # named_pexpr_t*tmp2 = new named_pexpr_t;
2316 # tmp2->name = lex_strings.make(p[1]);
2322 def p_block_item_decl_1(p
):
2323 '''block_item_decl : data_type register_variable_list ';' '''
2324 if(parse_debug
): print('block_item_decl_1', list(p
))
2325 # { if (p[1]) pform_set_data_type(@1, p[1], p[2], NetNet::REG, attributes_in_context);
2328 def p_block_item_decl_2(p
):
2329 '''block_item_decl : variable_lifetime data_type register_variable_list ';' '''
2330 if(parse_debug
): print('block_item_decl_2', list(p
))
2331 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
2332 # var_lifetime = LexicalScope::INHERITED;
2335 def p_block_item_decl_3(p
):
2336 '''block_item_decl : K_reg data_type register_variable_list ';' '''
2337 if(parse_debug
): print('block_item_decl_3', list(p
))
2338 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
2341 def p_block_item_decl_4(p
):
2342 '''block_item_decl : variable_lifetime K_reg data_type register_variable_list ';' '''
2343 if(parse_debug
): print('block_item_decl_4', list(p
))
2344 # { if (p[3]) pform_set_data_type(@3, p[3], p[4], NetNet::REG, attributes_in_context);
2345 # var_lifetime = LexicalScope::INHERITED;
2348 def p_block_item_decl_5(p
):
2349 '''block_item_decl : K_event event_variable_list ';' '''
2350 if(parse_debug
): print('block_item_decl_5', list(p
))
2351 # { if (p[2]) pform_make_events(p[2], @1.text, @1.first_line);
2354 def p_block_item_decl_6(p
):
2355 '''block_item_decl : K_parameter param_type parameter_assign_list ';' '''
2356 if(parse_debug
): print('block_item_decl_6', list(p
))
2358 def p_block_item_decl_7(p
):
2359 '''block_item_decl : K_localparam param_type localparam_assign_list ';' '''
2360 if(parse_debug
): print('block_item_decl_7', list(p
))
2362 def p_block_item_decl_8(p
):
2363 '''block_item_decl : type_declaration '''
2364 if(parse_debug
): print('block_item_decl_8', list(p
))
2366 def p_block_item_decl_9(p
):
2367 '''block_item_decl : K_integer error ';' '''
2368 if(parse_debug
): print('block_item_decl_9', list(p
))
2369 # { yyerror(@1, "error: syntax error in integer variable list.");
2373 def p_block_item_decl_10(p
):
2374 '''block_item_decl : K_time error ';' '''
2375 if(parse_debug
): print('block_item_decl_10', list(p
))
2376 # { yyerror(@1, "error: syntax error in time variable list.");
2380 def p_block_item_decl_11(p
):
2381 '''block_item_decl : K_parameter error ';' '''
2382 if(parse_debug
): print('block_item_decl_11', list(p
))
2383 # { yyerror(@1, "error: syntax error in parameter list.");
2387 def p_block_item_decl_12(p
):
2388 '''block_item_decl : K_localparam error ';' '''
2389 if(parse_debug
): print('block_item_decl_12', list(p
))
2390 # { yyerror(@1, "error: syntax error localparam list.");
2394 def p_block_item_decls_1(p
):
2395 '''block_item_decls : block_item_decl '''
2396 if(parse_debug
): print('block_item_decls_1', list(p
))
2398 def p_block_item_decls_2(p
):
2399 '''block_item_decls : block_item_decls block_item_decl '''
2400 if(parse_debug
): print('block_item_decls_2', list(p
))
2402 def p_block_item_decls_opt_1(p
):
2403 '''block_item_decls_opt : block_item_decls '''
2404 if(parse_debug
): print('block_item_decls_opt_1', list(p
))
2407 def p_block_item_decls_opt_2(p
):
2408 '''block_item_decls_opt : '''
2409 if(parse_debug
): print('block_item_decls_opt_2', list(p
))
2412 def p_type_declaration_1(p
):
2413 '''type_declaration : K_typedef data_type IDENTIFIER dimensions_opt ';' '''
2414 if(parse_debug
): print('type_declaration_1', list(p
))
2415 # { perm_string name = lex_strings.make(p[3]);
2416 # pform_set_typedef(name, p[2], p[4]);
2420 def p_type_declaration_2(p
):
2421 '''type_declaration : K_typedef data_type TYPE_IDENTIFIER ';' '''
2422 if(parse_debug
): print('type_declaration_2', list(p
))
2423 # { perm_string name = lex_strings.make(p[3].text);
2424 # if (pform_test_type_identifier_local(name)) {
2425 # yyerror(@3, "error: Typedef identifier \"%s\" is already a type name.", p[3].text);
2428 # pform_set_typedef(name, p[2], NULL);
2430 # delete[]p[3].text;
2433 def p_type_declaration_3(p
):
2434 '''type_declaration : K_typedef K_class IDENTIFIER ';' '''
2435 if(parse_debug
): print('type_declaration_3', list(p
))
2436 # { // Create a synthetic typedef for the class name so that the
2437 # // lexor detects the name as a type.
2438 # perm_string name = lex_strings.make(p[3]);
2439 # class_type_t*tmp = new class_type_t(name);
2440 # FILE_NAME(tmp, @3);
2441 # pform_set_typedef(name, tmp, NULL);
2445 def p_type_declaration_4(p
):
2446 '''type_declaration : K_typedef K_enum IDENTIFIER ';' '''
2447 if(parse_debug
): print('type_declaration_4', list(p
))
2448 # { yyerror(@1, "sorry: Enum forward declarations not supported yet."); }
2450 def p_type_declaration_5(p
):
2451 '''type_declaration : K_typedef K_struct IDENTIFIER ';' '''
2452 if(parse_debug
): print('type_declaration_5', list(p
))
2453 # { yyerror(@1, "sorry: Struct forward declarations not supported yet."); }
2455 def p_type_declaration_6(p
):
2456 '''type_declaration : K_typedef K_union IDENTIFIER ';' '''
2457 if(parse_debug
): print('type_declaration_6', list(p
))
2458 # { yyerror(@1, "sorry: Union forward declarations not supported yet."); }
2460 def p_type_declaration_7(p
):
2461 '''type_declaration : K_typedef IDENTIFIER ';' '''
2462 if(parse_debug
): print('type_declaration_7', list(p
))
2463 # { // Create a synthetic typedef for the class name so that the
2464 # // lexor detects the name as a type.
2465 # perm_string name = lex_strings.make(p[2]);
2466 # class_type_t*tmp = new class_type_t(name);
2467 # FILE_NAME(tmp, @2);
2468 # pform_set_typedef(name, tmp, NULL);
2472 def p_type_declaration_8(p
):
2473 '''type_declaration : K_typedef error ';' '''
2474 if(parse_debug
): print('type_declaration_8', list(p
))
2475 # { yyerror(@2, "error: Syntax error in typedef clause.");
2479 def p_enum_data_type_1(p
):
2480 '''enum_data_type : K_enum '{' enum_name_list '}' '''
2481 if(parse_debug
): print('enum_data_type_1', list(p
))
2482 # { enum_type_t*enum_type = new enum_type_t;
2483 # FILE_NAME(enum_type, @1);
2484 # enum_type->names .reset(p[3]);
2485 # enum_type->base_type = IVL_VT_BOOL;
2486 # enum_type->signed_flag = true;
2487 # enum_type->integer_flag = false;
2488 # enum_type->range.reset(make_range_from_width(32));
2492 def p_enum_data_type_2(p
):
2493 '''enum_data_type : K_enum atom2_type signed_unsigned_opt '{' enum_name_list '}' '''
2494 if(parse_debug
): print('enum_data_type_2', list(p
))
2495 # { enum_type_t*enum_type = new enum_type_t;
2496 # FILE_NAME(enum_type, @1);
2497 # enum_type->names .reset(p[5]);
2498 # enum_type->base_type = IVL_VT_BOOL;
2499 # enum_type->signed_flag = p[3];
2500 # enum_type->integer_flag = false;
2501 # enum_type->range.reset(make_range_from_width(p[2]));
2505 def p_enum_data_type_3(p
):
2506 '''enum_data_type : K_enum K_integer signed_unsigned_opt '{' enum_name_list '}' '''
2507 if(parse_debug
): print('enum_data_type_3', list(p
))
2508 # { enum_type_t*enum_type = new enum_type_t;
2509 # FILE_NAME(enum_type, @1);
2510 # enum_type->names .reset(p[5]);
2511 # enum_type->base_type = IVL_VT_LOGIC;
2512 # enum_type->signed_flag = p[3];
2513 # enum_type->integer_flag = true;
2514 # enum_type->range.reset(make_range_from_width(integer_width));
2518 def p_enum_data_type_4(p
):
2519 '''enum_data_type : K_enum K_logic unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2520 if(parse_debug
): print('enum_data_type_4', list(p
))
2521 # { enum_type_t*enum_type = new enum_type_t;
2522 # FILE_NAME(enum_type, @1);
2523 # enum_type->names .reset(p[6]);
2524 # enum_type->base_type = IVL_VT_LOGIC;
2525 # enum_type->signed_flag = p[3];
2526 # enum_type->integer_flag = false;
2527 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
2531 def p_enum_data_type_5(p
):
2532 '''enum_data_type : K_enum K_reg unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2533 if(parse_debug
): print('enum_data_type_5', list(p
))
2534 # { enum_type_t*enum_type = new enum_type_t;
2535 # FILE_NAME(enum_type, @1);
2536 # enum_type->names .reset(p[6]);
2537 # enum_type->base_type = IVL_VT_LOGIC;
2538 # enum_type->signed_flag = p[3];
2539 # enum_type->integer_flag = false;
2540 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
2544 def p_enum_data_type_6(p
):
2545 '''enum_data_type : K_enum K_bit unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2546 if(parse_debug
): print('enum_data_type_6', list(p
))
2547 # { enum_type_t*enum_type = new enum_type_t;
2548 # FILE_NAME(enum_type, @1);
2549 # enum_type->names .reset(p[6]);
2550 # enum_type->base_type = IVL_VT_BOOL;
2551 # enum_type->signed_flag = p[3];
2552 # enum_type->integer_flag = false;
2553 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
2557 def p_enum_name_list_1(p
):
2558 '''enum_name_list : enum_name '''
2559 if(parse_debug
): print('enum_name_list_1', list(p
))
2563 def p_enum_name_list_2(p
):
2564 '''enum_name_list : enum_name_list ',' enum_name '''
2565 if(parse_debug
): print('enum_name_list_2', list(p
))
2566 # { list<named_pexpr_t>*lst = p[1];
2567 # lst->splice(lst->end(), *p[3]);
2572 def p_pos_neg_number_1(p
):
2573 '''pos_neg_number : number '''
2574 if(parse_debug
): print('pos_neg_number_1', list(p
))
2578 def p_pos_neg_number_2(p
):
2579 '''pos_neg_number : '-' number '''
2580 if(parse_debug
): print('pos_neg_number_2', list(p
))
2581 # { verinum tmp = -(*(p[2]));
2586 def p_enum_name_1(p
):
2587 '''enum_name : IDENTIFIER '''
2588 if(parse_debug
): print('enum_name_1', list(p
))
2589 # { perm_string name = lex_strings.make(p[1]);
2591 # p[0] = make_named_number(name);
2594 def p_enum_name_2(p
):
2595 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '''
2596 if(parse_debug
): print('enum_name_2', list(p
))
2597 # { perm_string name = lex_strings.make(p[1]);
2598 # long count = check_enum_seq_value(@1, p[3], false);
2600 # p[0] = make_named_numbers(name, 0, count-1);
2604 def p_enum_name_3(p
):
2605 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '''
2606 if(parse_debug
): print('enum_name_3', list(p
))
2607 # { perm_string name = lex_strings.make(p[1]);
2608 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
2609 # check_enum_seq_value(@1, p[5], true));
2615 def p_enum_name_4(p
):
2616 '''enum_name : IDENTIFIER '=' expression '''
2617 if(parse_debug
): print('enum_name_4', list(p
))
2618 # { perm_string name = lex_strings.make(p[1]);
2620 # p[0] = make_named_number(name, p[3]);
2623 def p_enum_name_5(p
):
2624 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '=' expression '''
2625 if(parse_debug
): print('enum_name_5', list(p
))
2626 # { perm_string name = lex_strings.make(p[1]);
2627 # long count = check_enum_seq_value(@1, p[3], false);
2628 # p[0] = make_named_numbers(name, 0, count-1, p[6]);
2633 def p_enum_name_6(p
):
2634 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '=' expression '''
2635 if(parse_debug
): print('enum_name_6', list(p
))
2636 # { perm_string name = lex_strings.make(p[1]);
2637 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
2638 # check_enum_seq_value(@1, p[5], true), p[8]);
2644 def p_struct_data_type_1(p
):
2645 '''struct_data_type : K_struct K_packed_opt '{' struct_union_member_list '}' '''
2646 if(parse_debug
): print('struct_data_type_1', list(p
))
2647 # { struct_type_t*tmp = new struct_type_t;
2648 # FILE_NAME(tmp, @1);
2649 # tmp->packed_flag = p[2];
2650 # tmp->union_flag = false;
2651 # tmp->members .reset(p[4]);
2655 def p_struct_data_type_2(p
):
2656 '''struct_data_type : K_union K_packed_opt '{' struct_union_member_list '}' '''
2657 if(parse_debug
): print('struct_data_type_2', list(p
))
2658 # { struct_type_t*tmp = new struct_type_t;
2659 # FILE_NAME(tmp, @1);
2660 # tmp->packed_flag = p[2];
2661 # tmp->union_flag = true;
2662 # tmp->members .reset(p[4]);
2666 def p_struct_data_type_3(p
):
2667 '''struct_data_type : K_struct K_packed_opt '{' error '}' '''
2668 if(parse_debug
): print('struct_data_type_3', list(p
))
2669 # { yyerror(@3, "error: Errors in struct member list.");
2671 # struct_type_t*tmp = new struct_type_t;
2672 # FILE_NAME(tmp, @1);
2673 # tmp->packed_flag = p[2];
2674 # tmp->union_flag = false;
2678 def p_struct_data_type_4(p
):
2679 '''struct_data_type : K_union K_packed_opt '{' error '}' '''
2680 if(parse_debug
): print('struct_data_type_4', list(p
))
2681 # { yyerror(@3, "error: Errors in union member list.");
2683 # struct_type_t*tmp = new struct_type_t;
2684 # FILE_NAME(tmp, @1);
2685 # tmp->packed_flag = p[2];
2686 # tmp->union_flag = true;
2690 def p_struct_union_member_list_1(p
):
2691 '''struct_union_member_list : struct_union_member_list struct_union_member '''
2692 if(parse_debug
): print('struct_union_member_list_1', list(p
))
2693 # { list<struct_member_t*>*tmp = p[1];
2694 # tmp->push_back(p[2]);
2698 def p_struct_union_member_list_2(p
):
2699 '''struct_union_member_list : struct_union_member '''
2700 if(parse_debug
): print('struct_union_member_list_2', list(p
))
2701 # { list<struct_member_t*>*tmp = new list<struct_member_t*>;
2702 # tmp->push_back(p[1]);
2706 def p_struct_union_member_1(p
):
2707 '''struct_union_member : attribute_list_opt data_type list_of_variable_decl_assignments ';' '''
2708 if(parse_debug
): print('struct_union_member_1', list(p
))
2709 # { struct_member_t*tmp = new struct_member_t;
2710 # FILE_NAME(tmp, @2);
2711 # tmp->type .reset(p[2]);
2712 # tmp->names .reset(p[3]);
2716 def p_struct_union_member_2(p
):
2717 '''struct_union_member : error ';' '''
2718 if(parse_debug
): print('struct_union_member_2', list(p
))
2719 # { yyerror(@2, "Error in struct/union member.");
2724 def p_case_item_1(p
):
2725 '''case_item : expression_list_proper ':' statement_or_null '''
2726 if(parse_debug
): print('case_item_1', list(p
))
2727 # { PCase::Item*tmp = new PCase::Item;
2728 # tmp->expr = *p[1];
2734 def p_case_item_2(p
):
2735 '''case_item : K_default ':' statement_or_null '''
2736 if(parse_debug
): print('case_item_2', list(p
))
2737 # { PCase::Item*tmp = new PCase::Item;
2742 def p_case_item_3(p
):
2743 '''case_item : K_default statement_or_null '''
2744 if(parse_debug
): print('case_item_3', list(p
))
2745 # { PCase::Item*tmp = new PCase::Item;
2750 def p_case_item_4(p
):
2751 '''case_item : error ':' statement_or_null '''
2752 if(parse_debug
): print('case_item_4', list(p
))
2753 # { yyerror(@2, "error: Incomprehensible case expression.");
2757 def p_case_items_1(p
):
2758 '''case_items : case_items case_item '''
2759 if(parse_debug
): print('case_items_1', list(p
))
2760 # { svector<PCase::Item*>*tmp;
2761 # tmp = new svector<PCase::Item*>(*p[1], p[2]);
2766 def p_case_items_2(p
):
2767 '''case_items : case_item '''
2768 if(parse_debug
): print('case_items_2', list(p
))
2769 # { svector<PCase::Item*>*tmp = new svector<PCase::Item*>(1);
2774 def p_charge_strength_1(p
):
2775 '''charge_strength : '(' K_small ')' '''
2776 if(parse_debug
): print('charge_strength_1', list(p
))
2778 def p_charge_strength_2(p
):
2779 '''charge_strength : '(' K_medium ')' '''
2780 if(parse_debug
): print('charge_strength_2', list(p
))
2782 def p_charge_strength_3(p
):
2783 '''charge_strength : '(' K_large ')' '''
2784 if(parse_debug
): print('charge_strength_3', list(p
))
2786 def p_charge_strength_opt_1(p
):
2787 '''charge_strength_opt : charge_strength '''
2788 if(parse_debug
): print('charge_strength_opt_1', list(p
))
2790 def p_charge_strength_opt_2(p
):
2791 '''charge_strength_opt : '''
2792 if(parse_debug
): print('charge_strength_opt_2', list(p
))
2794 def p_defparam_assign_1(p
):
2795 '''defparam_assign : hierarchy_identifier '=' expression '''
2796 if(parse_debug
): print('defparam_assign_1', list(p
))
2797 # { pform_set_defparam(*p[1], p[3]);
2801 def p_defparam_assign_list_1(p
):
2802 '''defparam_assign_list : defparam_assign '''
2803 if(parse_debug
): print('defparam_assign_list_1', list(p
))
2805 def p_defparam_assign_list_2(p
):
2806 '''defparam_assign_list : dimensions defparam_assign '''
2807 if(parse_debug
): print('defparam_assign_list_2', list(p
))
2808 # { yyerror(@1, "error: defparam may not include a range.");
2812 def p_defparam_assign_list_3(p
):
2813 '''defparam_assign_list : defparam_assign_list ',' defparam_assign '''
2814 if(parse_debug
): print('defparam_assign_list_3', list(p
))
2817 '''delay1 : '#' delay_value_simple '''
2818 if(parse_debug
): print('delay1_1', list(p
))
2819 # { list<PExpr*>*tmp = new list<PExpr*>;
2820 # tmp->push_back(p[2]);
2825 '''delay1 : '#' '(' delay_value ')' '''
2826 if(parse_debug
): print('delay1_2', list(p
))
2827 # { list<PExpr*>*tmp = new list<PExpr*>;
2828 # tmp->push_back(p[3]);
2833 '''delay3 : '#' delay_value_simple '''
2834 if(parse_debug
): print('delay3_1', list(p
))
2835 # { list<PExpr*>*tmp = new list<PExpr*>;
2836 # tmp->push_back(p[2]);
2841 '''delay3 : '#' '(' delay_value ')' '''
2842 if(parse_debug
): print('delay3_2', list(p
))
2843 # { list<PExpr*>*tmp = new list<PExpr*>;
2844 # tmp->push_back(p[3]);
2849 '''delay3 : '#' '(' delay_value ',' delay_value ')' '''
2850 if(parse_debug
): print('delay3_3', list(p
))
2851 # { list<PExpr*>*tmp = new list<PExpr*>;
2852 # tmp->push_back(p[3]);
2853 # tmp->push_back(p[5]);
2858 '''delay3 : '#' '(' delay_value ',' delay_value ',' delay_value ')' '''
2859 if(parse_debug
): print('delay3_4', list(p
))
2860 # { list<PExpr*>*tmp = new list<PExpr*>;
2861 # tmp->push_back(p[3]);
2862 # tmp->push_back(p[5]);
2863 # tmp->push_back(p[7]);
2867 def p_delay3_opt_1(p
):
2868 '''delay3_opt : delay3 '''
2869 if(parse_debug
): print('delay3_opt_1', list(p
))
2872 def p_delay3_opt_2(p
):
2874 if(parse_debug
>2): print('delay3_opt_2', list(p
))
2877 def p_delay_value_list_1(p
):
2878 '''delay_value_list : delay_value '''
2879 if(parse_debug
): print('delay_value_list_1', list(p
))
2880 # { list<PExpr*>*tmp = new list<PExpr*>;
2881 # tmp->push_back(p[1]);
2885 def p_delay_value_list_2(p
):
2886 '''delay_value_list : delay_value_list ',' delay_value '''
2887 if(parse_debug
): print('delay_value_list_2', list(p
))
2888 # { list<PExpr*>*tmp = p[1];
2889 # tmp->push_back(p[3]);
2893 def p_delay_value_1(p
):
2894 '''delay_value : expression '''
2895 if(parse_debug
): print('delay_value_1', list(p
))
2896 # { PExpr*tmp = p[1];
2900 def p_delay_value_2(p
):
2901 '''delay_value : expression ':' expression ':' expression '''
2902 if(parse_debug
): print('delay_value_2', list(p
))
2903 # { p[0] = pform_select_mtm_expr(p[1], p[3], p[5]); }
2905 def p_delay_value_simple_1(p
):
2906 '''delay_value_simple : DEC_NUMBER '''
2907 if(parse_debug
): print('delay_value_simple_1', list(p
))
2908 # { verinum*tmp = p[1];
2910 # yyerror(@1, "internal error: delay.");
2913 # p[0] = new PENumber(tmp);
2914 # FILE_NAME(p[0], @1);
2919 def p_delay_value_simple_2(p
):
2920 '''delay_value_simple : REALTIME '''
2921 if(parse_debug
): print('delay_value_simple_2', list(p
))
2922 # { verireal*tmp = p[1];
2924 # yyerror(@1, "internal error: delay.");
2927 # p[0] = new PEFNumber(tmp);
2928 # FILE_NAME(p[0], @1);
2932 def p_delay_value_simple_3(p
):
2933 '''delay_value_simple : IDENTIFIER '''
2934 if(parse_debug
): print('delay_value_simple_3', list(p
))
2935 # { PEIdent*tmp = new PEIdent(lex_strings.make(p[1]));
2936 # FILE_NAME(tmp, @1);
2941 def p_delay_value_simple_4(p
):
2942 '''delay_value_simple : TIME_LITERAL '''
2943 if(parse_debug
): print('delay_value_simple_4', list(p
))
2948 # if (p[1] == 0 || !get_time_unit(p[1], unit))
2949 # yyerror(@1, "internal error: delay.");
2951 # double p = pow(10.0,
2952 # (double)(unit - pform_get_timeunit()));
2953 # double time = atof(p[1]) * p;
2955 # verireal *v = new verireal(time);
2956 # p[0] = new PEFNumber(v);
2957 # FILE_NAME(p[0], @1);
2961 def p_optional_semicolon_1(p
):
2962 '''optional_semicolon : ';' '''
2963 if(parse_debug
): print('optional_semicolon_1', list(p
))
2965 def p_optional_semicolon_2(p
):
2966 '''optional_semicolon : '''
2967 if(parse_debug
): print('optional_semicolon_2', list(p
))
2969 def p_discipline_declaration_1(p
):
2970 '''discipline_declaration : K_discipline IDENTIFIER optional_semicolon _embed0_discipline_declaration discipline_items K_enddiscipline '''
2971 if(parse_debug
): print('discipline_declaration_1', list(p
))
2972 # { pform_end_discipline(@1); delete[] p[2]; }
2974 def p__embed0_discipline_declaration(p
):
2975 '''_embed0_discipline_declaration : '''
2976 # { pform_start_discipline(p[2]); }
2978 def p_discipline_items_1(p
):
2979 '''discipline_items : discipline_items discipline_item '''
2980 if(parse_debug
): print('discipline_items_1', list(p
))
2982 def p_discipline_items_2(p
):
2983 '''discipline_items : discipline_item '''
2984 if(parse_debug
): print('discipline_items_2', list(p
))
2986 def p_discipline_item_1(p
):
2987 '''discipline_item : K_domain K_discrete ';' '''
2988 if(parse_debug
): print('discipline_item_1', list(p
))
2989 # { pform_discipline_domain(@1, IVL_DIS_DISCRETE); }
2991 def p_discipline_item_2(p
):
2992 '''discipline_item : K_domain K_continuous ';' '''
2993 if(parse_debug
): print('discipline_item_2', list(p
))
2994 # { pform_discipline_domain(@1, IVL_DIS_CONTINUOUS); }
2996 def p_discipline_item_3(p
):
2997 '''discipline_item : K_potential IDENTIFIER ';' '''
2998 if(parse_debug
): print('discipline_item_3', list(p
))
2999 # { pform_discipline_potential(@1, p[2]); delete[] p[2]; }
3001 def p_discipline_item_4(p
):
3002 '''discipline_item : K_flow IDENTIFIER ';' '''
3003 if(parse_debug
): print('discipline_item_4', list(p
))
3004 # { pform_discipline_flow(@1, p[2]); delete[] p[2]; }
3006 def p_nature_declaration_1(p
):
3007 '''nature_declaration : K_nature IDENTIFIER optional_semicolon _embed0_nature_declaration nature_items K_endnature '''
3008 if(parse_debug
): print('nature_declaration_1', list(p
))
3009 # { pform_end_nature(@1); delete[] p[2]; }
3011 def p__embed0_nature_declaration(p
):
3012 '''_embed0_nature_declaration : '''
3013 # { pform_start_nature(p[2]); }
3015 def p_nature_items_1(p
):
3016 '''nature_items : nature_items nature_item '''
3017 if(parse_debug
): print('nature_items_1', list(p
))
3019 def p_nature_items_2(p
):
3020 '''nature_items : nature_item '''
3021 if(parse_debug
): print('nature_items_2', list(p
))
3023 def p_nature_item_1(p
):
3024 '''nature_item : K_units '=' STRING ';' '''
3025 if(parse_debug
): print('nature_item_1', list(p
))
3026 # { delete[] p[3]; }
3028 def p_nature_item_2(p
):
3029 '''nature_item : K_abstol '=' expression ';' '''
3030 if(parse_debug
): print('nature_item_2', list(p
))
3032 def p_nature_item_3(p
):
3033 '''nature_item : K_access '=' IDENTIFIER ';' '''
3034 if(parse_debug
): print('nature_item_3', list(p
))
3035 # { pform_nature_access(@1, p[3]); delete[] p[3]; }
3037 def p_nature_item_4(p
):
3038 '''nature_item : K_idt_nature '=' IDENTIFIER ';' '''
3039 if(parse_debug
): print('nature_item_4', list(p
))
3040 # { delete[] p[3]; }
3042 def p_nature_item_5(p
):
3043 '''nature_item : K_ddt_nature '=' IDENTIFIER ';' '''
3044 if(parse_debug
): print('nature_item_5', list(p
))
3045 # { delete[] p[3]; }
3047 def p_config_declaration_1(p
):
3048 '''config_declaration : K_config IDENTIFIER ';' K_design lib_cell_identifiers ';' list_of_config_rule_statements K_endconfig '''
3049 if(parse_debug
): print('config_declaration_1', list(p
))
3050 # { cerr << @1 << ": sorry: config declarations are not supported and "
3051 # "will be skipped." << endl;
3055 def p_lib_cell_identifiers_1(p
):
3056 '''lib_cell_identifiers : '''
3057 if(parse_debug
): print('lib_cell_identifiers_1', list(p
))
3059 def p_lib_cell_identifiers_2(p
):
3060 '''lib_cell_identifiers : lib_cell_identifiers lib_cell_id '''
3061 if(parse_debug
): print('lib_cell_identifiers_2', list(p
))
3063 def p_list_of_config_rule_statements_1(p
):
3064 '''list_of_config_rule_statements : '''
3065 if(parse_debug
): print('list_of_config_rule_statements_1', list(p
))
3067 def p_list_of_config_rule_statements_2(p
):
3068 '''list_of_config_rule_statements : list_of_config_rule_statements config_rule_statement '''
3069 if(parse_debug
): print('list_of_config_rule_statements_2', list(p
))
3071 def p_config_rule_statement_1(p
):
3072 '''config_rule_statement : K_default K_liblist list_of_libraries ';' '''
3073 if(parse_debug
): print('config_rule_statement_1', list(p
))
3075 def p_config_rule_statement_2(p
):
3076 '''config_rule_statement : K_instance hierarchy_identifier K_liblist list_of_libraries ';' '''
3077 if(parse_debug
): print('config_rule_statement_2', list(p
))
3080 def p_config_rule_statement_3(p
):
3081 '''config_rule_statement : K_instance hierarchy_identifier K_use lib_cell_id opt_config ';' '''
3082 if(parse_debug
): print('config_rule_statement_3', list(p
))
3085 def p_config_rule_statement_4(p
):
3086 '''config_rule_statement : K_cell lib_cell_id K_liblist list_of_libraries ';' '''
3087 if(parse_debug
): print('config_rule_statement_4', list(p
))
3089 def p_config_rule_statement_5(p
):
3090 '''config_rule_statement : K_cell lib_cell_id K_use lib_cell_id opt_config ';' '''
3091 if(parse_debug
): print('config_rule_statement_5', list(p
))
3093 def p_opt_config_1(p
):
3095 if(parse_debug
): print('opt_config_1', list(p
))
3097 def p_opt_config_2(p
):
3098 '''opt_config : ':' K_config '''
3099 if(parse_debug
): print('opt_config_2', list(p
))
3101 def p_lib_cell_id_1(p
):
3102 '''lib_cell_id : IDENTIFIER '''
3103 if(parse_debug
): print('lib_cell_id_1', list(p
))
3104 # { delete[] p[1]; }
3106 def p_lib_cell_id_2(p
):
3107 '''lib_cell_id : IDENTIFIER '.' IDENTIFIER '''
3108 if(parse_debug
): print('lib_cell_id_2', list(p
))
3109 # { delete[] p[1]; delete[] p[3]; }
3111 def p_list_of_libraries_1(p
):
3112 '''list_of_libraries : '''
3113 if(parse_debug
): print('list_of_libraries_1', list(p
))
3115 def p_list_of_libraries_2(p
):
3116 '''list_of_libraries : list_of_libraries IDENTIFIER '''
3117 if(parse_debug
): print('list_of_libraries_2', list(p
))
3118 # { delete[] p[2]; }
3120 def p_drive_strength_1(p
):
3121 '''drive_strength : '(' dr_strength0 ',' dr_strength1 ')' '''
3122 if(parse_debug
): print('drive_strength_1', list(p
))
3123 # { p[0].str0 = p[2].str0;
3124 # p[0].str1 = p[4].str1;
3127 def p_drive_strength_2(p
):
3128 '''drive_strength : '(' dr_strength1 ',' dr_strength0 ')' '''
3129 if(parse_debug
): print('drive_strength_2', list(p
))
3130 # { p[0].str0 = p[4].str0;
3131 # p[0].str1 = p[2].str1;
3134 def p_drive_strength_3(p
):
3135 '''drive_strength : '(' dr_strength0 ',' K_highz1 ')' '''
3136 if(parse_debug
): print('drive_strength_3', list(p
))
3137 # { p[0].str0 = p[2].str0;
3138 # p[0].str1 = IVL_DR_HiZ;
3141 def p_drive_strength_4(p
):
3142 '''drive_strength : '(' dr_strength1 ',' K_highz0 ')' '''
3143 if(parse_debug
): print('drive_strength_4', list(p
))
3144 # { p[0].str0 = IVL_DR_HiZ;
3145 # p[0].str1 = p[2].str1;
3148 def p_drive_strength_5(p
):
3149 '''drive_strength : '(' K_highz1 ',' dr_strength0 ')' '''
3150 if(parse_debug
): print('drive_strength_5', list(p
))
3151 # { p[0].str0 = p[4].str0;
3152 # p[0].str1 = IVL_DR_HiZ;
3155 def p_drive_strength_6(p
):
3156 '''drive_strength : '(' K_highz0 ',' dr_strength1 ')' '''
3157 if(parse_debug
): print('drive_strength_6', list(p
))
3158 # { p[0].str0 = IVL_DR_HiZ;
3159 # p[0].str1 = p[4].str1;
3162 def p_drive_strength_opt_1(p
):
3163 '''drive_strength_opt : drive_strength '''
3164 if(parse_debug
): print('drive_strength_opt_1', list(p
))
3167 def p_drive_strength_opt_2(p
):
3168 '''drive_strength_opt : '''
3169 if(parse_debug
>2): print('drive_strength_opt_2', list(p
))
3170 # { p[0].str0 = IVL_DR_STRONG; p[0].str1 = IVL_DR_STRONG; }
3172 def p_dr_strength0_1(p
):
3173 '''dr_strength0 : K_supply0 '''
3174 if(parse_debug
): print('dr_strength0_1', list(p
))
3175 # { p[0].str0 = IVL_DR_SUPPLY; }
3177 def p_dr_strength0_2(p
):
3178 '''dr_strength0 : K_strong0 '''
3179 if(parse_debug
): print('dr_strength0_2', list(p
))
3180 # { p[0].str0 = IVL_DR_STRONG; }
3182 def p_dr_strength0_3(p
):
3183 '''dr_strength0 : K_pull0 '''
3184 if(parse_debug
): print('dr_strength0_3', list(p
))
3185 # { p[0].str0 = IVL_DR_PULL; }
3187 def p_dr_strength0_4(p
):
3188 '''dr_strength0 : K_weak0 '''
3189 if(parse_debug
): print('dr_strength0_4', list(p
))
3190 # { p[0].str0 = IVL_DR_WEAK; }
3192 def p_dr_strength1_1(p
):
3193 '''dr_strength1 : K_supply1 '''
3194 if(parse_debug
): print('dr_strength1_1', list(p
))
3195 # { p[0].str1 = IVL_DR_SUPPLY; }
3197 def p_dr_strength1_2(p
):
3198 '''dr_strength1 : K_strong1 '''
3199 if(parse_debug
): print('dr_strength1_2', list(p
))
3200 # { p[0].str1 = IVL_DR_STRONG; }
3202 def p_dr_strength1_3(p
):
3203 '''dr_strength1 : K_pull1 '''
3204 if(parse_debug
): print('dr_strength1_3', list(p
))
3205 # { p[0].str1 = IVL_DR_PULL; }
3207 def p_dr_strength1_4(p
):
3208 '''dr_strength1 : K_weak1 '''
3209 if(parse_debug
): print('dr_strength1_4', list(p
))
3210 # { p[0].str1 = IVL_DR_WEAK; }
3212 def p_clocking_event_opt_1(p
):
3213 '''clocking_event_opt : event_control '''
3214 if(parse_debug
): print('clocking_event_opt_1', list(p
))
3216 def p_clocking_event_opt_2(p
):
3217 '''clocking_event_opt : '''
3218 if(parse_debug
): print('clocking_event_opt_2', list(p
))
3220 def p_event_control_1(p
):
3221 '''event_control : '@' hierarchy_identifier '''
3222 if(parse_debug
): print('event_control_1', list(p
))
3223 # { PEIdent*tmpi = new PEIdent(*p[2]);
3224 # PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi);
3225 # PEventStatement*tmps = new PEventStatement(tmpe);
3226 # FILE_NAME(tmps, @1);
3231 def p_event_control_2(p
):
3232 '''event_control : '@' '(' event_expression_list ')' '''
3233 if(parse_debug
): print('event_control_2', list(p
))
3234 # { PEventStatement*tmp = new PEventStatement(*p[3]);
3235 # FILE_NAME(tmp, @1);
3240 def p_event_control_3(p
):
3241 '''event_control : '@' '(' error ')' '''
3242 if(parse_debug
): print('event_control_3', list(p
))
3243 # { yyerror(@1, "error: Malformed event control expression.");
3247 def p_event_expression_list_1(p
):
3248 '''event_expression_list : event_expression '''
3249 if(parse_debug
): print('event_expression_list_1', list(p
))
3252 def p_event_expression_list_2(p
):
3253 '''event_expression_list : event_expression_list K_or event_expression '''
3254 if(parse_debug
): print('event_expression_list_2', list(p
))
3255 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
3261 def p_event_expression_list_3(p
):
3262 '''event_expression_list : event_expression_list ',' event_expression '''
3263 if(parse_debug
): print('event_expression_list_3', list(p
))
3264 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
3270 def p_event_expression_1(p
):
3271 '''event_expression : K_posedge expression '''
3272 if(parse_debug
): print('event_expression_1', list(p
))
3273 # { PEEvent*tmp = new PEEvent(PEEvent::POSEDGE, p[2]);
3274 # FILE_NAME(tmp, @1);
3275 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3280 def p_event_expression_2(p
):
3281 '''event_expression : K_negedge expression '''
3282 if(parse_debug
): print('event_expression_2', list(p
))
3283 # { PEEvent*tmp = new PEEvent(PEEvent::NEGEDGE, p[2]);
3284 # FILE_NAME(tmp, @1);
3285 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3290 def p_event_expression_3(p
):
3291 '''event_expression : expression '''
3292 if(parse_debug
): print('event_expression_3', list(p
))
3293 # { PEEvent*tmp = new PEEvent(PEEvent::ANYEDGE, p[1]);
3294 # FILE_NAME(tmp, @1);
3295 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3300 def p_branch_probe_expression_1(p
):
3301 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ',' IDENTIFIER ')' '''
3302 if(parse_debug
): print('branch_probe_expression_1', list(p
))
3303 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3], p[5]); }
3305 def p_branch_probe_expression_2(p
):
3306 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ')' '''
3307 if(parse_debug
): print('branch_probe_expression_2', list(p
))
3308 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3]); }
3310 def p_expression_1(p
):
3311 '''expression : expr_primary_or_typename '''
3312 if(parse_debug
>2): print('expression_1', list(p
))
3315 def p_expression_2(p
):
3316 '''expression : inc_or_dec_expression '''
3317 if(parse_debug
): print('expression_2', list(p
))
3320 def p_expression_3(p
):
3321 '''expression : inside_expression '''
3322 if(parse_debug
): print('expression_3', list(p
))
3325 def p_expression_4(p
):
3326 '''expression : '+' attribute_list_opt expr_primary %prec UNARY_PREC '''
3327 if(parse_debug
): print('expression_4', list(p
))
3330 def p_expression_5(p
):
3331 '''expression : '-' attribute_list_opt expr_primary %prec UNARY_PREC '''
3332 if(parse_debug
): print('expression_5', list(p
))
3333 # { PEUnary*tmp = new PEUnary('-', p[3]);
3334 # FILE_NAME(tmp, @3);
3338 def p_expression_6(p
):
3339 '''expression : '~' attribute_list_opt expr_primary %prec UNARY_PREC '''
3340 if(parse_debug
): print('expression_6', list(p
))
3341 # { PEUnary*tmp = new PEUnary('~', p[3]);
3342 # FILE_NAME(tmp, @3);
3346 def p_expression_7(p
):
3347 '''expression : '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3348 if(parse_debug
): print('expression_7', list(p
))
3349 # { PEUnary*tmp = new PEUnary('&', p[3]);
3350 # FILE_NAME(tmp, @3);
3354 def p_expression_8(p
):
3355 '''expression : '!' attribute_list_opt expr_primary %prec UNARY_PREC '''
3356 if(parse_debug
): print('expression_8', list(p
))
3357 # { PEUnary*tmp = new PEUnary('!', p[3]);
3358 # FILE_NAME(tmp, @3);
3362 def p_expression_9(p
):
3363 '''expression : '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3364 if(parse_debug
): print('expression_9', list(p
))
3365 # { PEUnary*tmp = new PEUnary('|', p[3]);
3366 # FILE_NAME(tmp, @3);
3370 def p_expression_10(p
):
3371 '''expression : '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3372 if(parse_debug
): print('expression_10', list(p
))
3373 # { PEUnary*tmp = new PEUnary('^', p[3]);
3374 # FILE_NAME(tmp, @3);
3378 def p_expression_11(p
):
3379 '''expression : '~' '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3380 if(parse_debug
): print('expression_11', list(p
))
3381 # { yyerror(@1, "error: '~' '&' is not a valid expression. "
3382 # "Please use operator '~&' instead.");
3386 def p_expression_12(p
):
3387 '''expression : '~' '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3388 if(parse_debug
): print('expression_12', list(p
))
3389 # { yyerror(@1, "error: '~' '|' is not a valid expression. "
3390 # "Please use operator '~|' instead.");
3394 def p_expression_13(p
):
3395 '''expression : '~' '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3396 if(parse_debug
): print('expression_13', list(p
))
3397 # { yyerror(@1, "error: '~' '^' is not a valid expression. "
3398 # "Please use operator '~^' instead.");
3402 def p_expression_14(p
):
3403 '''expression : K_NAND attribute_list_opt expr_primary %prec UNARY_PREC '''
3404 if(parse_debug
): print('expression_14', list(p
))
3405 # { PEUnary*tmp = new PEUnary('A', p[3]);
3406 # FILE_NAME(tmp, @3);
3410 def p_expression_15(p
):
3411 '''expression : K_NOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3412 if(parse_debug
): print('expression_15', list(p
))
3413 # { PEUnary*tmp = new PEUnary('N', p[3]);
3414 # FILE_NAME(tmp, @3);
3418 def p_expression_16(p
):
3419 '''expression : K_NXOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3420 if(parse_debug
): print('expression_16', list(p
))
3421 # { PEUnary*tmp = new PEUnary('X', p[3]);
3422 # FILE_NAME(tmp, @3);
3426 def p_expression_17(p
):
3427 '''expression : '!' error %prec UNARY_PREC '''
3428 if(parse_debug
): print('expression_17', list(p
))
3429 # { yyerror(@1, "error: Operand of unary ! "
3430 # "is not a primary expression.");
3434 def p_expression_18(p
):
3435 '''expression : '^' error %prec UNARY_PREC '''
3436 if(parse_debug
): print('expression_18', list(p
))
3437 # { yyerror(@1, "error: Operand of reduction ^ "
3438 # "is not a primary expression.");
3442 def p_expression_19(p
):
3443 '''expression : expression '^' attribute_list_opt expression '''
3444 if(parse_debug
): print('expression_19', list(p
))
3445 # { PEBinary*tmp = new PEBinary('^', p[1], p[4]);
3446 # FILE_NAME(tmp, @2);
3450 def p_expression_20(p
):
3451 '''expression : expression K_POW attribute_list_opt expression '''
3452 if(parse_debug
): print('expression_20', list(p
))
3453 # { PEBinary*tmp = new PEBPower('p', p[1], p[4]);
3454 # FILE_NAME(tmp, @2);
3458 def p_expression_21(p
):
3459 '''expression : expression '*' attribute_list_opt expression '''
3460 if(parse_debug
): print('expression_21', list(p
))
3461 # { PEBinary*tmp = new PEBinary('*', p[1], p[4]);
3462 # FILE_NAME(tmp, @2);
3466 def p_expression_22(p
):
3467 '''expression : expression '/' attribute_list_opt expression '''
3468 if(parse_debug
): print('expression_22', list(p
))
3469 # { PEBinary*tmp = new PEBinary('/', p[1], p[4]);
3470 # FILE_NAME(tmp, @2);
3474 def p_expression_23(p
):
3475 '''expression : expression '%' attribute_list_opt expression '''
3476 if(parse_debug
): print('expression_23', list(p
))
3477 # { PEBinary*tmp = new PEBinary('%', p[1], p[4]);
3478 # FILE_NAME(tmp, @2);
3482 def p_expression_24(p
):
3483 '''expression : expression '+' attribute_list_opt expression '''
3484 if(parse_debug
): print('expression_24', list(p
))
3485 # { PEBinary*tmp = new PEBinary('+', p[1], p[4]);
3486 # FILE_NAME(tmp, @2);
3490 def p_expression_25(p
):
3491 '''expression : expression '-' attribute_list_opt expression '''
3492 if(parse_debug
): print('expression_25', list(p
))
3493 # { PEBinary*tmp = new PEBinary('-', p[1], p[4]);
3494 # FILE_NAME(tmp, @2);
3497 p
[0] = Node(syms
.atom
, [p
[1], Leaf(token
.MINUS
, '-'), p
[4]])
3499 def p_expression_26(p
):
3500 '''expression : expression '&' attribute_list_opt expression '''
3501 if(parse_debug
): print('expression_26', list(p
))
3502 # { PEBinary*tmp = new PEBinary('&', p[1], p[4]);
3503 # FILE_NAME(tmp, @2);
3507 def p_expression_27(p
):
3508 '''expression : expression '|' attribute_list_opt expression '''
3509 if(parse_debug
): print('expression_27', list(p
))
3510 # { PEBinary*tmp = new PEBinary('|', p[1], p[4]);
3511 # FILE_NAME(tmp, @2);
3515 def p_expression_28(p
):
3516 '''expression : expression K_NAND attribute_list_opt expression '''
3517 if(parse_debug
): print('expression_28', list(p
))
3518 # { PEBinary*tmp = new PEBinary('A', p[1], p[4]);
3519 # FILE_NAME(tmp, @2);
3523 def p_expression_29(p
):
3524 '''expression : expression K_NOR attribute_list_opt expression '''
3525 if(parse_debug
): print('expression_29', list(p
))
3526 # { PEBinary*tmp = new PEBinary('O', p[1], p[4]);
3527 # FILE_NAME(tmp, @2);
3531 def p_expression_30(p
):
3532 '''expression : expression K_NXOR attribute_list_opt expression '''
3533 if(parse_debug
): print('expression_30', list(p
))
3534 # { PEBinary*tmp = new PEBinary('X', p[1], p[4]);
3535 # FILE_NAME(tmp, @2);
3539 def p_expression_31(p
):
3540 '''expression : expression '<' attribute_list_opt expression '''
3541 if(parse_debug
): print('expression_31', list(p
))
3542 # { PEBinary*tmp = new PEBComp('<', p[1], p[4]);
3543 # FILE_NAME(tmp, @2);
3547 def p_expression_32(p
):
3548 '''expression : expression '>' attribute_list_opt expression '''
3549 if(parse_debug
): print('expression_32', list(p
))
3550 # { PEBinary*tmp = new PEBComp('>', p[1], p[4]);
3551 # FILE_NAME(tmp, @2);
3555 def p_expression_33(p
):
3556 '''expression : expression K_LS attribute_list_opt expression '''
3557 if(parse_debug
): print('expression_33', list(p
))
3558 # { PEBinary*tmp = new PEBShift('l', p[1], p[4]);
3559 # FILE_NAME(tmp, @2);
3563 def p_expression_34(p
):
3564 '''expression : expression K_RS attribute_list_opt expression '''
3565 if(parse_debug
): print('expression_34', list(p
))
3566 # { PEBinary*tmp = new PEBShift('r', p[1], p[4]);
3567 # FILE_NAME(tmp, @2);
3571 def p_expression_35(p
):
3572 '''expression : expression K_RSS attribute_list_opt expression '''
3573 if(parse_debug
): print('expression_35', list(p
))
3574 # { PEBinary*tmp = new PEBShift('R', p[1], p[4]);
3575 # FILE_NAME(tmp, @2);
3579 def p_expression_36(p
):
3580 '''expression : expression K_EQ attribute_list_opt expression '''
3581 if(parse_debug
): print('expression_36', list(p
))
3582 # { PEBinary*tmp = new PEBComp('e', p[1], p[4]);
3583 # FILE_NAME(tmp, @2);
3587 def p_expression_37(p
):
3588 '''expression : expression K_CEQ attribute_list_opt expression '''
3589 if(parse_debug
): print('expression_37', list(p
))
3590 # { PEBinary*tmp = new PEBComp('E', p[1], p[4]);
3591 # FILE_NAME(tmp, @2);
3595 def p_expression_38(p
):
3596 '''expression : expression K_WEQ attribute_list_opt expression '''
3597 if(parse_debug
): print('expression_38', list(p
))
3598 # { PEBinary*tmp = new PEBComp('w', p[1], p[4]);
3599 # FILE_NAME(tmp, @2);
3603 def p_expression_39(p
):
3604 '''expression : expression K_LE attribute_list_opt expression '''
3605 if(parse_debug
): print('expression_39', list(p
))
3606 # { PEBinary*tmp = new PEBComp('L', p[1], p[4]);
3607 # FILE_NAME(tmp, @2);
3611 def p_expression_40(p
):
3612 '''expression : expression K_GE attribute_list_opt expression '''
3613 if(parse_debug
): print('expression_40', list(p
))
3614 # { PEBinary*tmp = new PEBComp('G', p[1], p[4]);
3615 # FILE_NAME(tmp, @2);
3619 def p_expression_41(p
):
3620 '''expression : expression K_NE attribute_list_opt expression '''
3621 if(parse_debug
): print('expression_41', list(p
))
3622 # { PEBinary*tmp = new PEBComp('n', p[1], p[4]);
3623 # FILE_NAME(tmp, @2);
3627 def p_expression_42(p
):
3628 '''expression : expression K_CNE attribute_list_opt expression '''
3629 if(parse_debug
): print('expression_42', list(p
))
3630 # { PEBinary*tmp = new PEBComp('N', p[1], p[4]);
3631 # FILE_NAME(tmp, @2);
3635 def p_expression_43(p
):
3636 '''expression : expression K_WNE attribute_list_opt expression '''
3637 if(parse_debug
): print('expression_43', list(p
))
3638 # { PEBinary*tmp = new PEBComp('W', p[1], p[4]);
3639 # FILE_NAME(tmp, @2);
3643 def p_expression_44(p
):
3644 '''expression : expression K_LOR attribute_list_opt expression '''
3645 if(parse_debug
): print('expression_44', list(p
))
3646 # { PEBinary*tmp = new PEBLogic('o', p[1], p[4]);
3647 # FILE_NAME(tmp, @2);
3651 def p_expression_45(p
):
3652 '''expression : expression K_LAND attribute_list_opt expression '''
3653 if(parse_debug
): print('expression_45', list(p
))
3654 # { PEBinary*tmp = new PEBLogic('a', p[1], p[4]);
3655 # FILE_NAME(tmp, @2);
3659 def p_expression_46(p
):
3660 '''expression : expression '?' attribute_list_opt expression ':' expression '''
3661 if(parse_debug
): print('expression_46', list(p
))
3662 # { PETernary*tmp = new PETernary(p[1], p[4], p[6]);
3663 # FILE_NAME(tmp, @2);
3667 def p_expr_mintypmax_1(p
):
3668 '''expr_mintypmax : expression '''
3669 if(parse_debug
): print('expr_mintypmax_1', list(p
))
3672 def p_expr_mintypmax_2(p
):
3673 '''expr_mintypmax : expression ':' expression ':' expression '''
3674 if(parse_debug
): print('expr_mintypmax_2', list(p
))
3675 # { switch (min_typ_max_flag) {
3692 # if (min_typ_max_warn > 0) {
3693 # cerr << p[0]->get_fileline() << ": warning: choosing ";
3694 # switch (min_typ_max_flag) {
3705 # cerr << " expression." << endl;
3706 # min_typ_max_warn -= 1;
3710 def p_expression_list_with_nuls_1(p
):
3711 '''expression_list_with_nuls : expression_list_with_nuls ',' expression '''
3712 if(parse_debug
): print('expression_list_with_nuls_1', list(p
))
3713 # { list<PExpr*>*tmp = p[1];
3714 # tmp->push_back(p[3]);
3718 def p_expression_list_with_nuls_2(p
):
3719 '''expression_list_with_nuls : expression '''
3720 if(parse_debug
): print('expression_list_with_nuls_2', list(p
))
3721 # { list<PExpr*>*tmp = new list<PExpr*>;
3722 # tmp->push_back(p[1]);
3726 def p_expression_list_with_nuls_3(p
):
3727 '''expression_list_with_nuls : '''
3728 if(parse_debug
): print('expression_list_with_nuls_3', list(p
))
3729 # { list<PExpr*>*tmp = new list<PExpr*>;
3730 # tmp->push_back(0);
3734 def p_expression_list_with_nuls_4(p
):
3735 '''expression_list_with_nuls : expression_list_with_nuls ',' '''
3736 if(parse_debug
): print('expression_list_with_nuls_4', list(p
))
3737 # { list<PExpr*>*tmp = p[1];
3738 # tmp->push_back(0);
3742 def p_expression_list_proper_1(p
):
3743 '''expression_list_proper : expression_list_proper ',' expression '''
3744 if(parse_debug
): print('expression_list_proper_1', list(p
))
3745 # { list<PExpr*>*tmp = p[1];
3746 # tmp->push_back(p[3]);
3750 def p_expression_list_proper_2(p
):
3751 '''expression_list_proper : expression '''
3752 if(parse_debug
): print('expression_list_proper_2', list(p
))
3753 # { list<PExpr*>*tmp = new list<PExpr*>;
3754 # tmp->push_back(p[1]);
3758 def p_expr_primary_or_typename_1(p
):
3759 '''expr_primary_or_typename : expr_primary '''
3760 if(parse_debug
>2): print('expr_primary_or_typename_1', list(p
))
3763 def p_expr_primary_or_typename_2(p
):
3764 '''expr_primary_or_typename : TYPE_IDENTIFIER '''
3765 if(parse_debug
): print('expr_primary_or_typename_2', list(p
))
3767 # { PETypename*tmp = new PETypename(p[1].type);
3768 # FILE_NAME(tmp,@1);
3770 # delete[]p[1].text;
3773 def p_expr_primary_1(p
):
3774 '''expr_primary : number '''
3775 if(parse_debug
): print('expr_primary_1', list(p
))
3778 # PENumber*tmp = new PENumber(p[1]);
3779 # FILE_NAME(tmp, @1);
3783 def p_expr_primary_2(p
):
3784 '''expr_primary : REALTIME '''
3785 if(parse_debug
): print('expr_primary_2', list(p
))
3786 # { PEFNumber*tmp = new PEFNumber(p[1]);
3787 # FILE_NAME(tmp, @1);
3791 def p_expr_primary_3(p
):
3792 '''expr_primary : STRING '''
3793 if(parse_debug
): print('expr_primary_3', list(p
))
3794 # { PEString*tmp = new PEString(p[1]);
3795 # FILE_NAME(tmp, @1);
3799 def p_expr_primary_4(p
):
3800 '''expr_primary : TIME_LITERAL '''
3801 if(parse_debug
): print('expr_primary_4', list(p
))
3806 # if (p[1] == 0 || !get_time_unit(p[1], unit))
3807 # yyerror(@1, "internal error: delay.");
3809 # double p = pow(10.0, (double)(unit - pform_get_timeunit()));
3810 # double time = atof(p[1]) * p;
3812 # verireal *v = new verireal(time);
3813 # p[0] = new PEFNumber(v);
3814 # FILE_NAME(p[0], @1);
3818 def p_expr_primary_5(p
):
3819 '''expr_primary : SYSTEM_IDENTIFIER '''
3820 if(parse_debug
): print('expr_primary_5', list(p
))
3821 # { perm_string tn = lex_strings.make(p[1]);
3822 # PECallFunction*tmp = new PECallFunction(tn);
3823 # FILE_NAME(tmp, @1);
3828 def p_expr_primary_6(p
):
3829 '''expr_primary : hierarchy_identifier '''
3830 if(parse_debug
>2): print('expr_primary_6', list(p
))
3832 # { PEIdent*tmp = pform_new_ident(*p[1]);
3833 # FILE_NAME(tmp, @1);
3838 def p_expr_primary_7(p
):
3839 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier '''
3840 if(parse_debug
): print('expr_primary_7', list(p
))
3841 # { p[0] = pform_package_ident(@2, p[1], p[3]);
3845 def p_expr_primary_8(p
):
3846 '''expr_primary : hierarchy_identifier '(' expression_list_with_nuls ')' '''
3847 if(parse_debug
): print('expr_primary_8', list(p
))
3848 # { list<PExpr*>*expr_list = p[3];
3849 # strip_tail_items(expr_list);
3850 # PECallFunction*tmp = pform_make_call_function(@1, *p[1], *expr_list);
3855 def p_expr_primary_9(p
):
3856 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' '''
3857 if(parse_debug
): print('expr_primary_9', list(p
))
3858 # { pform_name_t*t_name = p[1];
3859 # while (! p[3]->empty()) {
3860 # t_name->push_back(p[3]->front());
3861 # p[3]->pop_front();
3863 # list<PExpr*>*expr_list = p[5];
3864 # strip_tail_items(expr_list);
3865 # PECallFunction*tmp = pform_make_call_function(@1, *t_name, *expr_list);
3871 def p_expr_primary_10(p
):
3872 '''expr_primary : SYSTEM_IDENTIFIER '(' expression_list_proper ')' '''
3873 if(parse_debug
): print('expr_primary_10', list(p
))
3874 # { perm_string tn = lex_strings.make(p[1]);
3875 # PECallFunction*tmp = new PECallFunction(tn, *p[3]);
3876 # FILE_NAME(tmp, @1);
3881 def p_expr_primary_11(p
):
3882 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')' '''
3883 if(parse_debug
): print('expr_primary_11', list(p
))
3884 # { perm_string use_name = lex_strings.make(p[3]);
3885 # PECallFunction*tmp = new PECallFunction(p[1], use_name, *p[5]);
3886 # FILE_NAME(tmp, @3);
3891 def p_expr_primary_12(p
):
3892 '''expr_primary : SYSTEM_IDENTIFIER '(' ')' '''
3893 if(parse_debug
): print('expr_primary_12', list(p
))
3894 # { perm_string tn = lex_strings.make(p[1]);
3895 # const vector<PExpr*>empty;
3896 # PECallFunction*tmp = new PECallFunction(tn, empty);
3897 # FILE_NAME(tmp, @1);
3900 # if (!gn_system_verilog()) {
3901 # yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
3905 def p_expr_primary_13(p
):
3906 '''expr_primary : implicit_class_handle '''
3907 if(parse_debug
): print('expr_primary_13', list(p
))
3908 # { PEIdent*tmp = new PEIdent(*p[1]);
3909 # FILE_NAME(tmp,@1);
3914 def p_expr_primary_14(p
):
3915 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '''
3916 if(parse_debug
): print('expr_primary_14', list(p
))
3917 # { pform_name_t*t_name = p[1];
3918 # while (! p[3]->empty()) {
3919 # t_name->push_back(p[3]->front());
3920 # p[3]->pop_front();
3922 # PEIdent*tmp = new PEIdent(*t_name);
3923 # FILE_NAME(tmp,@1);
3929 def p_expr_primary_15(p
):
3930 '''expr_primary : K_acos '(' expression ')' '''
3931 if(parse_debug
): print('expr_primary_15', list(p
))
3932 # { perm_string tn = perm_string::literal("$acos");
3933 # PECallFunction*tmp = make_call_function(tn, p[3]);
3934 # FILE_NAME(tmp,@1);
3938 def p_expr_primary_16(p
):
3939 '''expr_primary : K_acosh '(' expression ')' '''
3940 if(parse_debug
): print('expr_primary_16', list(p
))
3941 # { perm_string tn = perm_string::literal("$acosh");
3942 # PECallFunction*tmp = make_call_function(tn, p[3]);
3943 # FILE_NAME(tmp,@1);
3947 def p_expr_primary_17(p
):
3948 '''expr_primary : K_asin '(' expression ')' '''
3949 if(parse_debug
): print('expr_primary_17', list(p
))
3950 # { perm_string tn = perm_string::literal("$asin");
3951 # PECallFunction*tmp = make_call_function(tn, p[3]);
3952 # FILE_NAME(tmp,@1);
3956 def p_expr_primary_18(p
):
3957 '''expr_primary : K_asinh '(' expression ')' '''
3958 if(parse_debug
): print('expr_primary_18', list(p
))
3959 # { perm_string tn = perm_string::literal("$asinh");
3960 # PECallFunction*tmp = make_call_function(tn, p[3]);
3961 # FILE_NAME(tmp,@1);
3965 def p_expr_primary_19(p
):
3966 '''expr_primary : K_atan '(' expression ')' '''
3967 if(parse_debug
): print('expr_primary_19', list(p
))
3968 # { perm_string tn = perm_string::literal("$atan");
3969 # PECallFunction*tmp = make_call_function(tn, p[3]);
3970 # FILE_NAME(tmp,@1);
3974 def p_expr_primary_20(p
):
3975 '''expr_primary : K_atanh '(' expression ')' '''
3976 if(parse_debug
): print('expr_primary_20', list(p
))
3977 # { perm_string tn = perm_string::literal("$atanh");
3978 # PECallFunction*tmp = make_call_function(tn, p[3]);
3979 # FILE_NAME(tmp,@1);
3983 def p_expr_primary_21(p
):
3984 '''expr_primary : K_atan2 '(' expression ',' expression ')' '''
3985 if(parse_debug
): print('expr_primary_21', list(p
))
3986 # { perm_string tn = perm_string::literal("$atan2");
3987 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
3988 # FILE_NAME(tmp,@1);
3992 def p_expr_primary_22(p
):
3993 '''expr_primary : K_ceil '(' expression ')' '''
3994 if(parse_debug
): print('expr_primary_22', list(p
))
3995 # { perm_string tn = perm_string::literal("$ceil");
3996 # PECallFunction*tmp = make_call_function(tn, p[3]);
3997 # FILE_NAME(tmp,@1);
4001 def p_expr_primary_23(p
):
4002 '''expr_primary : K_cos '(' expression ')' '''
4003 if(parse_debug
): print('expr_primary_23', list(p
))
4004 # { perm_string tn = perm_string::literal("$cos");
4005 # PECallFunction*tmp = make_call_function(tn, p[3]);
4006 # FILE_NAME(tmp,@1);
4010 def p_expr_primary_24(p
):
4011 '''expr_primary : K_cosh '(' expression ')' '''
4012 if(parse_debug
): print('expr_primary_24', list(p
))
4013 # { perm_string tn = perm_string::literal("$cosh");
4014 # PECallFunction*tmp = make_call_function(tn, p[3]);
4015 # FILE_NAME(tmp,@1);
4019 def p_expr_primary_25(p
):
4020 '''expr_primary : K_exp '(' expression ')' '''
4021 if(parse_debug
): print('expr_primary_25', list(p
))
4022 # { perm_string tn = perm_string::literal("$exp");
4023 # PECallFunction*tmp = make_call_function(tn, p[3]);
4024 # FILE_NAME(tmp,@1);
4028 def p_expr_primary_26(p
):
4029 '''expr_primary : K_floor '(' expression ')' '''
4030 if(parse_debug
): print('expr_primary_26', list(p
))
4031 # { perm_string tn = perm_string::literal("$floor");
4032 # PECallFunction*tmp = make_call_function(tn, p[3]);
4033 # FILE_NAME(tmp,@1);
4037 def p_expr_primary_27(p
):
4038 '''expr_primary : K_hypot '(' expression ',' expression ')' '''
4039 if(parse_debug
): print('expr_primary_27', list(p
))
4040 # { perm_string tn = perm_string::literal("$hypot");
4041 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
4042 # FILE_NAME(tmp,@1);
4046 def p_expr_primary_28(p
):
4047 '''expr_primary : K_ln '(' expression ')' '''
4048 if(parse_debug
): print('expr_primary_28', list(p
))
4049 # { perm_string tn = perm_string::literal("$ln");
4050 # PECallFunction*tmp = make_call_function(tn, p[3]);
4051 # FILE_NAME(tmp,@1);
4055 def p_expr_primary_29(p
):
4056 '''expr_primary : K_log '(' expression ')' '''
4057 if(parse_debug
): print('expr_primary_29', list(p
))
4058 # { perm_string tn = perm_string::literal("$log10");
4059 # PECallFunction*tmp = make_call_function(tn, p[3]);
4060 # FILE_NAME(tmp,@1);
4064 def p_expr_primary_30(p
):
4065 '''expr_primary : K_pow '(' expression ',' expression ')' '''
4066 if(parse_debug
): print('expr_primary_30', list(p
))
4067 # { perm_string tn = perm_string::literal("$pow");
4068 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
4069 # FILE_NAME(tmp,@1);
4073 def p_expr_primary_31(p
):
4074 '''expr_primary : K_sin '(' expression ')' '''
4075 if(parse_debug
): print('expr_primary_31', list(p
))
4076 # { perm_string tn = perm_string::literal("$sin");
4077 # PECallFunction*tmp = make_call_function(tn, p[3]);
4078 # FILE_NAME(tmp,@1);
4082 def p_expr_primary_32(p
):
4083 '''expr_primary : K_sinh '(' expression ')' '''
4084 if(parse_debug
): print('expr_primary_32', list(p
))
4085 # { perm_string tn = perm_string::literal("$sinh");
4086 # PECallFunction*tmp = make_call_function(tn, p[3]);
4087 # FILE_NAME(tmp,@1);
4091 def p_expr_primary_33(p
):
4092 '''expr_primary : K_sqrt '(' expression ')' '''
4093 if(parse_debug
): print('expr_primary_33', list(p
))
4094 # { perm_string tn = perm_string::literal("$sqrt");
4095 # PECallFunction*tmp = make_call_function(tn, p[3]);
4096 # FILE_NAME(tmp,@1);
4100 def p_expr_primary_34(p
):
4101 '''expr_primary : K_tan '(' expression ')' '''
4102 if(parse_debug
): print('expr_primary_34', list(p
))
4103 # { perm_string tn = perm_string::literal("$tan");
4104 # PECallFunction*tmp = make_call_function(tn, p[3]);
4105 # FILE_NAME(tmp,@1);
4109 def p_expr_primary_35(p
):
4110 '''expr_primary : K_tanh '(' expression ')' '''
4111 if(parse_debug
): print('expr_primary_35', list(p
))
4112 # { perm_string tn = perm_string::literal("$tanh");
4113 # PECallFunction*tmp = make_call_function(tn, p[3]);
4114 # FILE_NAME(tmp,@1);
4118 def p_expr_primary_36(p
):
4119 '''expr_primary : K_abs '(' expression ')' '''
4120 if(parse_debug
): print('expr_primary_36', list(p
))
4121 # { PEUnary*tmp = new PEUnary('m', p[3]);
4122 # FILE_NAME(tmp,@1);
4126 def p_expr_primary_37(p
):
4127 '''expr_primary : K_max '(' expression ',' expression ')' '''
4128 if(parse_debug
): print('expr_primary_37', list(p
))
4129 # { PEBinary*tmp = new PEBinary('M', p[3], p[5]);
4130 # FILE_NAME(tmp,@1);
4134 def p_expr_primary_38(p
):
4135 '''expr_primary : K_min '(' expression ',' expression ')' '''
4136 if(parse_debug
): print('expr_primary_38', list(p
))
4137 # { PEBinary*tmp = new PEBinary('m', p[3], p[5]);
4138 # FILE_NAME(tmp,@1);
4142 def p_expr_primary_39(p
):
4143 '''expr_primary : '(' expr_mintypmax ')' '''
4144 if(parse_debug
): print('expr_primary_39', list(p
))
4147 def p_expr_primary_40(p
):
4148 '''expr_primary : '{' expression_list_proper '}' '''
4149 if(parse_debug
): print('expr_primary_40', list(p
))
4150 # { PEConcat*tmp = new PEConcat(*p[2]);
4151 # FILE_NAME(tmp, @1);
4156 def p_expr_primary_41(p
):
4157 '''expr_primary : '{' expression '{' expression_list_proper '}' '}' '''
4158 if(parse_debug
): print('expr_primary_41', list(p
))
4159 # { PExpr*rep = p[2];
4160 # PEConcat*tmp = new PEConcat(*p[4], rep);
4161 # FILE_NAME(tmp, @1);
4166 def p_expr_primary_42(p
):
4167 '''expr_primary : '{' expression '{' expression_list_proper '}' error '}' '''
4168 if(parse_debug
): print('expr_primary_42', list(p
))
4169 # { PExpr*rep = p[2];
4170 # PEConcat*tmp = new PEConcat(*p[4], rep);
4171 # FILE_NAME(tmp, @1);
4174 # yyerror(@5, "error: Syntax error between internal '}' "
4175 # "and closing '}' of repeat concatenation.");
4179 def p_expr_primary_43(p
):
4180 '''expr_primary : '{' '}' '''
4181 if(parse_debug
): print('expr_primary_43', list(p
))
4182 # { // This is the empty queue syntax.
4183 # if (gn_system_verilog()) {
4184 # list<PExpr*> empty_list;
4185 # PEConcat*tmp = new PEConcat(empty_list);
4186 # FILE_NAME(tmp, @1);
4189 # yyerror(@1, "error: Concatenations are not allowed to be empty.");
4194 def p_expr_primary_44(p
):
4195 '''expr_primary : expr_primary "'" '(' expression ')' '''
4196 if(parse_debug
): print('expr_primary_44', list(p
))
4197 # { PExpr*base = p[4];
4198 # if (gn_system_verilog()) {
4199 # PECastSize*tmp = new PECastSize(p[1], base);
4200 # FILE_NAME(tmp, @1);
4203 # yyerror(@1, "error: Size cast requires SystemVerilog.");
4208 def p_expr_primary_45(p
):
4209 '''expr_primary : simple_type_or_string "'" '(' expression ')' '''
4210 if(parse_debug
): print('expr_primary_45', list(p
))
4211 # { PExpr*base = p[4];
4212 # if (gn_system_verilog()) {
4213 # PECastType*tmp = new PECastType(p[1], base);
4214 # FILE_NAME(tmp, @1);
4217 # yyerror(@1, "error: Type cast requires SystemVerilog.");
4222 def p_expr_primary_46(p
):
4223 '''expr_primary : assignment_pattern '''
4224 if(parse_debug
): print('expr_primary_46', list(p
))
4227 def p_expr_primary_47(p
):
4228 '''expr_primary : streaming_concatenation '''
4229 if(parse_debug
): print('expr_primary_47', list(p
))
4232 def p_expr_primary_48(p
):
4233 '''expr_primary : K_null '''
4234 if(parse_debug
): print('expr_primary_48', list(p
))
4235 # { PENull*tmp = new PENull;
4236 # FILE_NAME(tmp, @1);
4240 def p_function_item_list_opt_1(p
):
4241 '''function_item_list_opt : function_item_list '''
4242 if(parse_debug
): print('function_item_list_opt_1', list(p
))
4245 def p_function_item_list_opt_2(p
):
4246 '''function_item_list_opt : '''
4247 if(parse_debug
): print('function_item_list_opt_2', list(p
))
4250 def p_function_item_list_1(p
):
4251 '''function_item_list : function_item '''
4252 if(parse_debug
): print('function_item_list_1', list(p
))
4255 def p_function_item_list_2(p
):
4256 '''function_item_list : function_item_list function_item '''
4257 if(parse_debug
): print('function_item_list_2', list(p
))
4259 # if (p[1] && p[2]) {
4260 # vector<pform_tf_port_t>*tmp = p[1];
4261 # size_t s1 = tmp->size();
4262 # tmp->resize(s1 + p[2]->size());
4263 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
4264 # tmp->at(s1+idx) = p[2]->at(idx);
4267 # } else if (p[1]) {
4274 def p_function_item_1(p
):
4275 '''function_item : tf_port_declaration '''
4276 if(parse_debug
): print('function_item_1', list(p
))
4279 def p_function_item_2(p
):
4280 '''function_item : block_item_decl '''
4281 if(parse_debug
): print('function_item_2', list(p
))
4284 def p_gate_instance_1(p
):
4285 '''gate_instance : IDENTIFIER '(' expression_list_with_nuls ')' '''
4286 if(parse_debug
): print('gate_instance_1', list(p
))
4287 # { lgate*tmp = new lgate;
4289 # tmp->parms = p[3];
4290 # tmp->file = @1.text;
4291 # tmp->lineno = @1.first_line;
4296 def p_gate_instance_2(p
):
4297 '''gate_instance : IDENTIFIER dimensions '(' expression_list_with_nuls ')' '''
4298 if(parse_debug
): print('gate_instance_2', list(p
))
4299 # { lgate*tmp = new lgate;
4300 # list<pform_range_t>*rng = p[2];
4302 # tmp->parms = p[4];
4303 # tmp->range = rng->front();
4305 # assert(rng->empty());
4306 # tmp->file = @1.text;
4307 # tmp->lineno = @1.first_line;
4313 def p_gate_instance_3(p
):
4314 '''gate_instance : '(' expression_list_with_nuls ')' '''
4315 if(parse_debug
): print('gate_instance_3', list(p
))
4316 # { lgate*tmp = new lgate;
4318 # tmp->parms = p[2];
4319 # tmp->file = @1.text;
4320 # tmp->lineno = @1.first_line;
4324 def p_gate_instance_4(p
):
4325 '''gate_instance : IDENTIFIER dimensions '''
4326 if(parse_debug
): print('gate_instance_4', list(p
))
4327 # { lgate*tmp = new lgate;
4328 # list<pform_range_t>*rng = p[2];
4331 # tmp->parms_by_name = 0;
4332 # tmp->range = rng->front();
4334 # assert(rng->empty());
4335 # tmp->file = @1.text;
4336 # tmp->lineno = @1.first_line;
4342 def p_gate_instance_5(p
):
4343 '''gate_instance : IDENTIFIER '(' port_name_list ')' '''
4344 if(parse_debug
): print('gate_instance_5', list(p
))
4345 # { lgate*tmp = new lgate;
4348 # tmp->parms_by_name = p[3];
4349 # tmp->file = @1.text;
4350 # tmp->lineno = @1.first_line;
4355 def p_gate_instance_6(p
):
4356 '''gate_instance : IDENTIFIER dimensions '(' port_name_list ')' '''
4357 if(parse_debug
): print('gate_instance_6', list(p
))
4358 # { lgate*tmp = new lgate;
4359 # list<pform_range_t>*rng = p[2];
4362 # tmp->parms_by_name = p[4];
4363 # tmp->range = rng->front();
4365 # assert(rng->empty());
4366 # tmp->file = @1.text;
4367 # tmp->lineno = @1.first_line;
4373 def p_gate_instance_7(p
):
4374 '''gate_instance : IDENTIFIER '(' error ')' '''
4375 if(parse_debug
): print('gate_instance_7', list(p
))
4376 # { lgate*tmp = new lgate;
4379 # tmp->parms_by_name = 0;
4380 # tmp->file = @1.text;
4381 # tmp->lineno = @1.first_line;
4382 # yyerror(@2, "error: Syntax error in instance port "
4383 # "expression(s).");
4388 def p_gate_instance_8(p
):
4389 '''gate_instance : IDENTIFIER dimensions '(' error ')' '''
4390 if(parse_debug
): print('gate_instance_8', list(p
))
4391 # { lgate*tmp = new lgate;
4394 # tmp->parms_by_name = 0;
4395 # tmp->file = @1.text;
4396 # tmp->lineno = @1.first_line;
4397 # yyerror(@3, "error: Syntax error in instance port "
4398 # "expression(s).");
4403 def p_gate_instance_list_1(p
):
4404 '''gate_instance_list : gate_instance_list ',' gate_instance '''
4405 if(parse_debug
): print('gate_instance_list_1', list(p
))
4406 # { svector<lgate>*tmp1 = p[1];
4407 # lgate*tmp2 = p[3];
4408 # svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
4414 def p_gate_instance_list_2(p
):
4415 '''gate_instance_list : gate_instance '''
4416 if(parse_debug
): print('gate_instance_list_2', list(p
))
4417 # { svector<lgate>*tmp = new svector<lgate>(1);
4418 # (*tmp)[0] = *p[1];
4423 def p_gatetype_1(p
):
4424 '''gatetype : K_and '''
4425 if(parse_debug
): print('gatetype_1', list(p
))
4426 # { p[0] = PGBuiltin::AND; }
4428 def p_gatetype_2(p
):
4429 '''gatetype : K_nand '''
4430 if(parse_debug
): print('gatetype_2', list(p
))
4431 # { p[0] = PGBuiltin::NAND; }
4433 def p_gatetype_3(p
):
4434 '''gatetype : K_or '''
4435 if(parse_debug
): print('gatetype_3', list(p
))
4436 # { p[0] = PGBuiltin::OR; }
4438 def p_gatetype_4(p
):
4439 '''gatetype : K_nor '''
4440 if(parse_debug
): print('gatetype_4', list(p
))
4441 # { p[0] = PGBuiltin::NOR; }
4443 def p_gatetype_5(p
):
4444 '''gatetype : K_xor '''
4445 if(parse_debug
): print('gatetype_5', list(p
))
4446 # { p[0] = PGBuiltin::XOR; }
4448 def p_gatetype_6(p
):
4449 '''gatetype : K_xnor '''
4450 if(parse_debug
): print('gatetype_6', list(p
))
4451 # { p[0] = PGBuiltin::XNOR; }
4453 def p_gatetype_7(p
):
4454 '''gatetype : K_buf '''
4455 if(parse_debug
): print('gatetype_7', list(p
))
4456 # { p[0] = PGBuiltin::BUF; }
4458 def p_gatetype_8(p
):
4459 '''gatetype : K_bufif0 '''
4460 if(parse_debug
): print('gatetype_8', list(p
))
4461 # { p[0] = PGBuiltin::BUFIF0; }
4463 def p_gatetype_9(p
):
4464 '''gatetype : K_bufif1 '''
4465 if(parse_debug
): print('gatetype_9', list(p
))
4466 # { p[0] = PGBuiltin::BUFIF1; }
4468 def p_gatetype_10(p
):
4469 '''gatetype : K_not '''
4470 if(parse_debug
): print('gatetype_10', list(p
))
4471 # { p[0] = PGBuiltin::NOT; }
4473 def p_gatetype_11(p
):
4474 '''gatetype : K_notif0 '''
4475 if(parse_debug
): print('gatetype_11', list(p
))
4476 # { p[0] = PGBuiltin::NOTIF0; }
4478 def p_gatetype_12(p
):
4479 '''gatetype : K_notif1 '''
4480 if(parse_debug
): print('gatetype_12', list(p
))
4481 # { p[0] = PGBuiltin::NOTIF1; }
4483 def p_switchtype_1(p
):
4484 '''switchtype : K_nmos '''
4485 if(parse_debug
): print('switchtype_1', list(p
))
4486 # { p[0] = PGBuiltin::NMOS; }
4488 def p_switchtype_2(p
):
4489 '''switchtype : K_rnmos '''
4490 if(parse_debug
): print('switchtype_2', list(p
))
4491 # { p[0] = PGBuiltin::RNMOS; }
4493 def p_switchtype_3(p
):
4494 '''switchtype : K_pmos '''
4495 if(parse_debug
): print('switchtype_3', list(p
))
4496 # { p[0] = PGBuiltin::PMOS; }
4498 def p_switchtype_4(p
):
4499 '''switchtype : K_rpmos '''
4500 if(parse_debug
): print('switchtype_4', list(p
))
4501 # { p[0] = PGBuiltin::RPMOS; }
4503 def p_switchtype_5(p
):
4504 '''switchtype : K_cmos '''
4505 if(parse_debug
): print('switchtype_5', list(p
))
4506 # { p[0] = PGBuiltin::CMOS; }
4508 def p_switchtype_6(p
):
4509 '''switchtype : K_rcmos '''
4510 if(parse_debug
): print('switchtype_6', list(p
))
4511 # { p[0] = PGBuiltin::RCMOS; }
4513 def p_switchtype_7(p
):
4514 '''switchtype : K_tran '''
4515 if(parse_debug
): print('switchtype_7', list(p
))
4516 # { p[0] = PGBuiltin::TRAN; }
4518 def p_switchtype_8(p
):
4519 '''switchtype : K_rtran '''
4520 if(parse_debug
): print('switchtype_8', list(p
))
4521 # { p[0] = PGBuiltin::RTRAN; }
4523 def p_switchtype_9(p
):
4524 '''switchtype : K_tranif0 '''
4525 if(parse_debug
): print('switchtype_9', list(p
))
4526 # { p[0] = PGBuiltin::TRANIF0; }
4528 def p_switchtype_10(p
):
4529 '''switchtype : K_tranif1 '''
4530 if(parse_debug
): print('switchtype_10', list(p
))
4531 # { p[0] = PGBuiltin::TRANIF1; }
4533 def p_switchtype_11(p
):
4534 '''switchtype : K_rtranif0 '''
4535 if(parse_debug
): print('switchtype_11', list(p
))
4536 # { p[0] = PGBuiltin::RTRANIF0; }
4538 def p_switchtype_12(p
):
4539 '''switchtype : K_rtranif1 '''
4540 if(parse_debug
): print('switchtype_12', list(p
))
4541 # { p[0] = PGBuiltin::RTRANIF1; }
4543 def p_hierarchy_identifier_1(p
):
4544 '''hierarchy_identifier : IDENTIFIER '''
4545 if(parse_debug
): print('hierarchy_identifier_1 FIXME', list(p
))
4546 lpvalue
= Leaf(token
.NAME
, p
[1])
4548 # { p[0] = new pform_name_t;
4549 # p[0]->push_back(name_component_t(lex_strings.make(p[1])));
4553 def p_hierarchy_identifier_2(p
):
4554 '''hierarchy_identifier : hierarchy_identifier '.' IDENTIFIER '''
4555 if(parse_debug
): print('hierarchy_identifier_2', list(p
))
4556 # { pform_name_t * tmp = p[1];
4557 # tmp->push_back(name_component_t(lex_strings.make(p[3])));
4562 def p_hierarchy_identifier_3(p
):
4563 '''hierarchy_identifier : hierarchy_identifier '[' expression ']' '''
4564 if(parse_debug
): print('hierarchy_identifier_3', list(p
))
4565 # { pform_name_t * tmp = p[1];
4566 # name_component_t&tail = tmp->back();
4567 # index_component_t itmp;
4568 # itmp.sel = index_component_t::SEL_BIT;
4570 # tail.index.push_back(itmp);
4574 def p_hierarchy_identifier_4(p
):
4575 '''hierarchy_identifier : hierarchy_identifier '[' '$' ']' '''
4576 if(parse_debug
): print('hierarchy_identifier_4', list(p
))
4577 # { pform_name_t * tmp = p[1];
4578 # name_component_t&tail = tmp->back();
4579 # if (! gn_system_verilog()) {
4580 # yyerror(@3, "error: Last element expression ($) "
4581 # "requires SystemVerilog. Try enabling SystemVerilog.");
4583 # index_component_t itmp;
4584 # itmp.sel = index_component_t::SEL_BIT_LAST;
4587 # tail.index.push_back(itmp);
4591 def p_hierarchy_identifier_5(p
):
4592 '''hierarchy_identifier : hierarchy_identifier '[' expression ':' expression ']' '''
4593 if(parse_debug
): print('hierarchy_identifier_5', list(p
))
4594 # { pform_name_t * tmp = p[1];
4595 # name_component_t&tail = tmp->back();
4596 # index_component_t itmp;
4597 # itmp.sel = index_component_t::SEL_PART;
4600 # tail.index.push_back(itmp);
4604 def p_hierarchy_identifier_6(p
):
4605 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_POS expression ']' '''
4606 if(parse_debug
): print('hierarchy_identifier_6', list(p
))
4607 # { pform_name_t * tmp = p[1];
4608 # name_component_t&tail = tmp->back();
4609 # index_component_t itmp;
4610 # itmp.sel = index_component_t::SEL_IDX_UP;
4613 # tail.index.push_back(itmp);
4617 def p_hierarchy_identifier_7(p
):
4618 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_NEG expression ']' '''
4619 if(parse_debug
): print('hierarchy_identifier_7', list(p
))
4620 # { pform_name_t * tmp = p[1];
4621 # name_component_t&tail = tmp->back();
4622 # index_component_t itmp;
4623 # itmp.sel = index_component_t::SEL_IDX_DO;
4626 # tail.index.push_back(itmp);
4630 def p_list_of_identifiers_1(p
):
4631 '''list_of_identifiers : IDENTIFIER '''
4632 if(parse_debug
): print('list_of_identifiers_1', list(p
))
4633 # { p[0] = list_from_identifier(p[1]); }
4635 def p_list_of_identifiers_2(p
):
4636 '''list_of_identifiers : list_of_identifiers ',' IDENTIFIER '''
4637 if(parse_debug
): print('list_of_identifiers_2', list(p
))
4638 # { p[0] = list_from_identifier(p[1], p[3]); }
4640 def p_list_of_port_identifiers_1(p
):
4641 '''list_of_port_identifiers : IDENTIFIER dimensions_opt '''
4642 if(parse_debug
): print('list_of_port_identifiers_1', list(p
))
4643 # { p[0] = make_port_list(p[1], p[2], 0); }
4645 def p_list_of_port_identifiers_2(p
):
4646 '''list_of_port_identifiers : list_of_port_identifiers ',' IDENTIFIER dimensions_opt '''
4647 if(parse_debug
): print('list_of_port_identifiers_2', list(p
))
4648 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
4650 def p_list_of_variable_port_identifiers_1(p
):
4651 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '''
4652 if(parse_debug
): print('list_of_variable_port_identifiers_1', list(p
))
4653 # { p[0] = make_port_list(p[1], p[2], 0); }
4655 def p_list_of_variable_port_identifiers_2(p
):
4656 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '=' expression '''
4657 if(parse_debug
): print('list_of_variable_port_identifiers_2', list(p
))
4658 # { p[0] = make_port_list(p[1], p[2], p[4]); }
4660 def p_list_of_variable_port_identifiers_3(p
):
4661 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '''
4662 if(parse_debug
): print('list_of_variable_port_identifiers_3', list(p
))
4663 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
4665 def p_list_of_variable_port_identifiers_4(p
):
4666 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '=' expression '''
4667 if(parse_debug
): print('list_of_variable_port_identifiers_4', list(p
))
4668 # { p[0] = make_port_list(p[1], p[3], p[4], p[6]); }
4670 def p_list_of_ports_1(p
):
4671 '''list_of_ports : port_opt '''
4672 if(parse_debug
): print('list_of_ports_1', list(p
))
4673 # { vector<Module::port_t*>*tmp
4674 # = new vector<Module::port_t*>(1);
4679 def p_list_of_ports_2(p
):
4680 '''list_of_ports : list_of_ports ',' port_opt '''
4681 if(parse_debug
): print('list_of_ports_2', list(p
))
4682 # { vector<Module::port_t*>*tmp = p[1];
4683 # tmp->push_back(p[3]);
4687 def p_list_of_port_declarations_1(p
):
4688 '''list_of_port_declarations : port_declaration '''
4689 if(parse_debug
>1): print('list_of_port_declarations_1', list(p
))
4691 # { vector<Module::port_t*>*tmp
4692 # = new vector<Module::port_t*>(1);
4697 def p_list_of_port_declarations_2(p
):
4698 '''list_of_port_declarations : list_of_port_declarations ',' port_declaration '''
4699 if(parse_debug
): print('list_of_port_declarations_2 FIXME', list(p
))
4700 # MOVE_TO absyn p[1].append(Leaf(token.NEWLINE, '\n')) # should be a comma
4701 # XXX p[3].prefix=' ' # add a space after the NL, must go in parameter
4704 # { vector<Module::port_t*>*tmp = p[1];
4705 # tmp->push_back(p[3]);
4709 def p_list_of_port_declarations_3(p
):
4710 '''list_of_port_declarations : list_of_port_declarations ',' IDENTIFIER '''
4711 if(parse_debug
): print('list_of_port_declarations_3', list(p
))
4712 # { Module::port_t*ptmp;
4713 # perm_string name = lex_strings.make(p[3]);
4714 # ptmp = pform_module_port_reference(name, @3.text,
4716 # vector<Module::port_t*>*tmp = p[1];
4717 # tmp->push_back(ptmp);
4719 # /* Get the port declaration details, the port type
4720 # and what not, from context data stored by the
4721 # last port_declaration rule. */
4722 # pform_module_define_port(@3, name,
4723 # port_declaration_context.port_type,
4724 # port_declaration_context.port_net_type,
4725 # port_declaration_context.data_type, 0);
4730 def p_list_of_port_declarations_4(p
):
4731 '''list_of_port_declarations : list_of_port_declarations ',' '''
4732 if(parse_debug
): print('list_of_port_declarations_4', list(p
))
4734 # yyerror(@2, "error: NULL port declarations are not "
4738 def p_list_of_port_declarations_5(p
):
4739 '''list_of_port_declarations : list_of_port_declarations ';' '''
4740 if(parse_debug
): print('list_of_port_declarations_5', list(p
))
4742 # yyerror(@2, "error: ';' is an invalid port declaration "
4746 def p_port_declaration_1(p
):
4747 '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4748 if(parse_debug
): print('port_declaration_1 FIXME', list(p
))
4749 comment
, dt
, name
= p
[2], p
[4], p
[5]
4750 p
[0] = absyn
.port_decl(comment
, dt
, name
)
4751 # { Module::port_t*ptmp;
4752 # perm_string name = lex_strings.make(p[5]);
4753 # data_type_t*use_type = p[4];
4754 # if (p[6]) use_type = new uarray_type_t(use_type, p[6]);
4755 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4756 # pform_module_define_port(@2, name, NetNet::PINPUT, p[3], use_type, p[1]);
4757 # port_declaration_context.port_type = NetNet::PINPUT;
4758 # port_declaration_context.port_net_type = p[3];
4759 # port_declaration_context.data_type = p[4];
4764 def p_port_declaration_2(p
):
4765 '''port_declaration : attribute_list_opt K_input K_wreal IDENTIFIER '''
4766 if(parse_debug
): print('port_declaration_2', list(p
))
4767 # { Module::port_t*ptmp;
4768 # perm_string name = lex_strings.make(p[4]);
4769 # ptmp = pform_module_port_reference(name, @2.text,
4771 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4772 # FILE_NAME(real_type, @3);
4773 # pform_module_define_port(@2, name, NetNet::PINPUT,
4774 # NetNet::WIRE, real_type, p[1]);
4775 # port_declaration_context.port_type = NetNet::PINPUT;
4776 # port_declaration_context.port_net_type = NetNet::WIRE;
4777 # port_declaration_context.data_type = real_type;
4782 def p_port_declaration_3(p
):
4783 '''port_declaration : attribute_list_opt K_inout net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4784 if(parse_debug
): print('port_declaration_3', list(p
))
4785 # { Module::port_t*ptmp;
4786 # perm_string name = lex_strings.make(p[5]);
4787 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4788 # pform_module_define_port(@2, name, NetNet::PINOUT, p[3], p[4], p[1]);
4789 # port_declaration_context.port_type = NetNet::PINOUT;
4790 # port_declaration_context.port_net_type = p[3];
4791 # port_declaration_context.data_type = p[4];
4794 # yyerror(@6, "sorry: Inout ports with unpacked dimensions not supported.");
4800 def p_port_declaration_4(p
):
4801 '''port_declaration : attribute_list_opt K_inout K_wreal IDENTIFIER '''
4802 if(parse_debug
): print('port_declaration_4', list(p
))
4803 # { Module::port_t*ptmp;
4804 # perm_string name = lex_strings.make(p[4]);
4805 # ptmp = pform_module_port_reference(name, @2.text,
4807 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4808 # FILE_NAME(real_type, @3);
4809 # pform_module_define_port(@2, name, NetNet::PINOUT,
4810 # NetNet::WIRE, real_type, p[1]);
4811 # port_declaration_context.port_type = NetNet::PINOUT;
4812 # port_declaration_context.port_net_type = NetNet::WIRE;
4813 # port_declaration_context.data_type = real_type;
4818 def p_port_declaration_5(p
):
4819 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4820 if(parse_debug
): print('port_declaration_5 FIXME', list(p
))
4821 comment
, dt
, name
= p
[2], p
[4], p
[5]
4822 p
[0] = absyn
.port_decl(comment
, dt
, name
)
4823 # { Module::port_t*ptmp;
4824 # perm_string name = lex_strings.make(p[5]);
4825 # data_type_t*use_dtype = p[4];
4826 # if (p[6]) use_dtype = new uarray_type_t(use_dtype, p[6]);
4827 # NetNet::Type use_type = p[3];
4828 # if (use_type == NetNet::IMPLICIT) {
4829 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
4830 # if (dtype->reg_flag)
4831 # use_type = NetNet::REG;
4832 # else if (dtype->implicit_flag)
4833 # use_type = NetNet::IMPLICIT;
4835 # use_type = NetNet::IMPLICIT_REG;
4837 # // The SystemVerilog types that can show up as
4838 # // output ports are implicitly (on the inside)
4839 # // variables because "reg" is not valid syntax
4841 # } else if (dynamic_cast<atom2_type_t*> (p[4])) {
4842 # use_type = NetNet::IMPLICIT_REG;
4843 # } else if (dynamic_cast<struct_type_t*> (p[4])) {
4844 # use_type = NetNet::IMPLICIT_REG;
4845 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[4])) {
4846 # if(etype->base_type == IVL_VT_LOGIC)
4847 # use_type = NetNet::IMPLICIT_REG;
4850 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4851 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, use_dtype, p[1]);
4852 # port_declaration_context.port_type = NetNet::POUTPUT;
4853 # port_declaration_context.port_net_type = use_type;
4854 # port_declaration_context.data_type = p[4];
4859 def p_port_declaration_6(p
):
4860 '''port_declaration : attribute_list_opt K_output K_wreal IDENTIFIER '''
4861 if(parse_debug
): print('port_declaration_6', list(p
))
4862 # { Module::port_t*ptmp;
4863 # perm_string name = lex_strings.make(p[4]);
4864 # ptmp = pform_module_port_reference(name, @2.text,
4866 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4867 # FILE_NAME(real_type, @3);
4868 # pform_module_define_port(@2, name, NetNet::POUTPUT,
4869 # NetNet::WIRE, real_type, p[1]);
4870 # port_declaration_context.port_type = NetNet::POUTPUT;
4871 # port_declaration_context.port_net_type = NetNet::WIRE;
4872 # port_declaration_context.data_type = real_type;
4877 def p_port_declaration_7(p
):
4878 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER '=' expression '''
4879 if(parse_debug
): print('port_declaration_7', list(p
))
4880 # { Module::port_t*ptmp;
4881 # perm_string name = lex_strings.make(p[5]);
4882 # NetNet::Type use_type = p[3];
4883 # if (use_type == NetNet::IMPLICIT) {
4884 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
4885 # if (dtype->reg_flag)
4886 # use_type = NetNet::REG;
4888 # use_type = NetNet::IMPLICIT_REG;
4890 # use_type = NetNet::IMPLICIT_REG;
4893 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4894 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, p[4], p[1]);
4895 # port_declaration_context.port_type = NetNet::PINOUT;
4896 # port_declaration_context.port_net_type = use_type;
4897 # port_declaration_context.data_type = p[4];
4899 # pform_make_var_init(@5, name, p[7]);
4905 def p_net_type_opt_1(p
):
4906 '''net_type_opt : net_type '''
4907 if(parse_debug
): print('net_type_opt_1', list(p
))
4910 def p_net_type_opt_2(p
):
4911 '''net_type_opt : '''
4912 if(parse_debug
>2): print('net_type_opt_2', list(p
))
4915 def p_unsigned_signed_opt_1(p
):
4916 '''unsigned_signed_opt : K_signed '''
4917 if(parse_debug
): print('unsigned_signed_opt_1', list(p
))
4920 def p_unsigned_signed_opt_2(p
):
4921 '''unsigned_signed_opt : K_unsigned '''
4922 if(parse_debug
): print('unsigned_signed_opt_2', list(p
))
4925 def p_unsigned_signed_opt_3(p
):
4926 '''unsigned_signed_opt : '''
4927 if(parse_debug
): print('unsigned_signed_opt_3', list(p
))
4930 def p_signed_unsigned_opt_1(p
):
4931 '''signed_unsigned_opt : K_signed '''
4932 if(parse_debug
): print('signed_unsigned_opt_1', list(p
))
4935 def p_signed_unsigned_opt_2(p
):
4936 '''signed_unsigned_opt : K_unsigned '''
4937 if(parse_debug
): print('signed_unsigned_opt_2', list(p
))
4940 def p_signed_unsigned_opt_3(p
):
4941 '''signed_unsigned_opt : '''
4942 if(parse_debug
): print('signed_unsigned_opt_3', list(p
))
4945 def p_atom2_type_1(p
):
4946 '''atom2_type : K_byte '''
4947 if(parse_debug
): print('atom2_type_1', list(p
))
4950 def p_atom2_type_2(p
):
4951 '''atom2_type : K_shortint '''
4952 if(parse_debug
): print('atom2_type_2', list(p
))
4955 def p_atom2_type_3(p
):
4956 '''atom2_type : K_int '''
4957 if(parse_debug
): print('atom2_type_3', list(p
))
4960 def p_atom2_type_4(p
):
4961 '''atom2_type : K_longint '''
4962 if(parse_debug
): print('atom2_type_4', list(p
))
4966 '''lpvalue : hierarchy_identifier '''
4967 if(parse_debug
>2): print('lpvalue_1', list(p
))
4969 # { PEIdent*tmp = pform_new_ident(*p[1]);
4970 # FILE_NAME(tmp, @1);
4976 '''lpvalue : implicit_class_handle '.' hierarchy_identifier '''
4977 if(parse_debug
): print('lpvalue_2', list(p
))
4978 # { pform_name_t*t_name = p[1];
4979 # while (!p[3]->empty()) {
4980 # t_name->push_back(p[3]->front());
4981 # p[3]->pop_front();
4983 # PEIdent*tmp = new PEIdent(*t_name);
4984 # FILE_NAME(tmp, @1);
4991 '''lpvalue : '{' expression_list_proper '}' '''
4992 if(parse_debug
): print('lpvalue_3', list(p
))
4993 # { PEConcat*tmp = new PEConcat(*p[2]);
4994 # FILE_NAME(tmp, @1);
5000 '''lpvalue : streaming_concatenation '''
5001 if(parse_debug
): print('lpvalue_4', list(p
))
5002 # { yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
5006 def p_cont_assign_1(p
):
5007 '''cont_assign : lpvalue '=' expression '''
5008 if(parse_debug
): print('cont_assign_1', list(p
))
5009 absyn
.cont_assign_1(p
)
5010 # { list<PExpr*>*tmp = new list<PExpr*>;
5011 # tmp->push_back(p[1]);
5012 # tmp->push_back(p[3]);
5016 def p_cont_assign_list_1(p
):
5017 '''cont_assign_list : cont_assign_list ',' cont_assign '''
5018 if(parse_debug
): print('cont_assign_list_1', list(p
))
5019 # { list<PExpr*>*tmp = p[1];
5020 # tmp->splice(tmp->end(), *p[3]);
5025 def p_cont_assign_list_2(p
):
5026 '''cont_assign_list : cont_assign '''
5027 if(parse_debug
>2): print('cont_assign_list_2', list(p
))
5031 '''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 '''
5032 if(parse_debug
>2): print('module_1', list(p
))
5033 clsdecl
= absyn
.module_1(p
)
5036 def p__embed0_module(p
):
5037 '''_embed0_module : '''
5038 # { pform_startmodule(@2, p[4], p[2]==K_program, p[2]==K_interface, p[3], p[1]); }
5040 def p__embed1_module(p
):
5041 '''_embed1_module : '''
5042 # { pform_module_set_ports(p[8]); }
5044 def p__embed2_module(p
):
5045 '''_embed2_module : '''
5046 # { pform_set_scope_timescale(@2); }
5048 def p__embed3_module(p
):
5049 '''_embed3_module : '''
5050 # { Module::UCDriveType ucd;
5051 # // The lexor detected `unconnected_drive directives and
5052 # // marked what it found in the uc_drive variable. Use that
5053 # // to generate a UCD flag for the module.
5054 # switch (uc_drive) {
5057 # ucd = Module::UCD_NONE;
5060 # ucd = Module::UCD_PULL0;
5063 # ucd = Module::UCD_PULL1;
5066 # // Check that program/endprogram and module/endmodule
5067 # // keywords match.
5068 # if (p[2] != p[15]) {
5071 # yyerror(@15, "error: module not closed by endmodule.");
5074 # yyerror(@15, "error: program not closed by endprogram.");
5077 # yyerror(@15, "error: interface not closed by endinterface.");
5083 # pform_endmodule(p[4], in_celldefine, ucd);
5086 def p_module_start_1(p
):
5087 '''module_start : K_module '''
5088 if(parse_debug
>1): print('module_start_1', list(p
))
5089 # { p[0] = K_module; }
5091 def p_module_start_2(p
):
5092 '''module_start : K_macromodule '''
5093 if(parse_debug
): print('module_start_2', list(p
))
5094 # { p[0] = K_module; }
5096 def p_module_start_3(p
):
5097 '''module_start : K_program '''
5098 if(parse_debug
): print('module_start_3', list(p
))
5099 # { p[0] = K_program; }
5101 def p_module_start_4(p
):
5102 '''module_start : K_interface '''
5103 if(parse_debug
): print('module_start_4', list(p
))
5104 # { p[0] = K_interface; }
5106 def p_module_end_1(p
):
5107 '''module_end : K_endmodule '''
5108 if(parse_debug
>2): print('module_end_1', list(p
))
5109 # { p[0] = K_module; }
5111 def p_module_end_2(p
):
5112 '''module_end : K_endprogram '''
5113 if(parse_debug
): print('module_end_2', list(p
))
5114 # { p[0] = K_program; }
5116 def p_module_end_3(p
):
5117 '''module_end : K_endinterface '''
5118 if(parse_debug
): print('module_end_3', list(p
))
5119 # { p[0] = K_interface; }
5121 def p_endlabel_opt_1(p
):
5122 '''endlabel_opt : ':' IDENTIFIER '''
5123 if(parse_debug
): print('endlabel_opt_1', list(p
))
5126 def p_endlabel_opt_2(p
):
5127 '''endlabel_opt : '''
5128 if(parse_debug
>2): print('endlabel_opt_2', list(p
))
5131 def p_module_attribute_foreign_1(p
):
5132 '''module_attribute_foreign : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP '''
5133 if(parse_debug
): print('module_attribute_foreign_1', list(p
))
5136 def p_module_attribute_foreign_2(p
):
5137 '''module_attribute_foreign : '''
5138 if(parse_debug
>2): print('module_attribute_foreign_2', list(p
))
5141 def p_module_port_list_opt_1(p
):
5142 '''module_port_list_opt : '(' list_of_ports ')' '''
5143 if(parse_debug
): print('module_port_list_opt_1', list(p
))
5146 def p_module_port_list_opt_2(p
):
5147 '''module_port_list_opt : '(' list_of_port_declarations ')' '''
5148 if(parse_debug
>2): print('module_port_list_opt_2', list(p
))
5151 def p_module_port_list_opt_3(p
):
5152 '''module_port_list_opt : '''
5153 if(parse_debug
): print('module_port_list_opt_3', list(p
))
5156 def p_module_port_list_opt_4(p
):
5157 '''module_port_list_opt : '(' error ')' '''
5158 if(parse_debug
): print('module_port_list_opt_4', list(p
))
5159 # { yyerror(@2, "Errors in port declarations.");
5164 def p_module_parameter_port_list_opt_1(p
):
5165 '''module_parameter_port_list_opt : '''
5166 if(parse_debug
>2): print('module_parameter_port_list_opt_1', list(p
))
5168 def p_module_parameter_port_list_opt_2(p
):
5169 '''module_parameter_port_list_opt : '#' '(' module_parameter_port_list ')' '''
5170 if(parse_debug
): print('module_parameter_port_list_opt_2', list(p
))
5173 def p_module_parameter_port_list_1(p
):
5174 '''module_parameter_port_list : K_parameter param_type parameter_assign '''
5175 if(parse_debug
): print('module_parameter_port_list_1', list(p
))
5178 def p_module_parameter_port_list_2(p
):
5179 '''module_parameter_port_list : module_parameter_port_list ',' parameter_assign '''
5180 if(parse_debug
): print('module_parameter_port_list_2', list(p
))
5181 p
[0] = p
[1].append(p
[3])
5183 def p_module_parameter_port_list_3(p
):
5184 '''module_parameter_port_list : module_parameter_port_list ',' K_parameter param_type parameter_assign '''
5185 if(parse_debug
): print('module_parameter_port_list_3', list(p
))
5186 p
[1].append(Leaf(token
.COMMA
, ','))
5187 p
[1].append(Leaf(token
.NEWLINE
, '\n'))
5188 p
[5].prefix
=' ' # add space after newline
5192 def p_module_item_1(p
):
5193 '''module_item : module '''
5194 if(parse_debug
): print('module_item_1', list(p
))
5196 def p_module_item_2(p
):
5197 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' '''
5198 if(parse_debug
): print('module_item_2', list(p
))
5199 # { data_type_t*data_type = p[3];
5200 # if (data_type == 0) {
5201 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5202 # FILE_NAME(data_type, @2);
5204 # pform_set_data_type(@2, data_type, p[5], p[2], p[1]);
5206 # yyerror(@2, "sorry: net delays not supported.");
5212 def p_module_item_3(p
):
5213 '''module_item : attribute_list_opt K_wreal delay3 net_variable_list ';' '''
5214 if(parse_debug
): print('module_item_3', list(p
))
5215 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5216 # pform_set_data_type(@2, tmpt, p[4], NetNet::WIRE, p[1]);
5218 # yyerror(@3, "sorry: net delays not supported.");
5224 def p_module_item_4(p
):
5225 '''module_item : attribute_list_opt K_wreal net_variable_list ';' '''
5226 if(parse_debug
): print('module_item_4', list(p
))
5227 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5228 # pform_set_data_type(@2, tmpt, p[3], NetNet::WIRE, p[1]);
5232 def p_module_item_5(p
):
5233 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_decl_assigns ';' '''
5234 if(parse_debug
): print('module_item_5', list(p
))
5235 # { data_type_t*data_type = p[3];
5236 # if (data_type == 0) {
5237 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5238 # FILE_NAME(data_type, @2);
5240 # pform_makewire(@2, p[4], str_strength, p[5], p[2], data_type);
5242 # yywarn(@2, "Attributes are not supported on net declaration "
5243 # "assignments and will be discarded.");
5248 def p_module_item_6(p
):
5249 '''module_item : attribute_list_opt net_type data_type_or_implicit drive_strength net_decl_assigns ';' '''
5250 if(parse_debug
): print('module_item_6', list(p
))
5251 # { data_type_t*data_type = p[3];
5252 # if (data_type == 0) {
5253 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5254 # FILE_NAME(data_type, @2);
5256 # pform_makewire(@2, 0, p[4], p[5], p[2], data_type);
5258 # yywarn(@2, "Attributes are not supported on net declaration "
5259 # "assignments and will be discarded.");
5264 def p_module_item_7(p
):
5265 '''module_item : attribute_list_opt K_wreal net_decl_assigns ';' '''
5266 if(parse_debug
): print('module_item_7', list(p
))
5267 # { real_type_t*data_type = new real_type_t(real_type_t::REAL);
5268 # pform_makewire(@2, 0, str_strength, p[3], NetNet::WIRE, data_type);
5270 # yywarn(@2, "Attributes are not supported on net declaration "
5271 # "assignments and will be discarded.");
5276 def p_module_item_8(p
):
5277 '''module_item : K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' '''
5278 if(parse_debug
): print('module_item_8', list(p
))
5279 # { yyerror(@1, "sorry: trireg nets not supported.");
5284 def p_module_item_9(p
):
5285 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit list_of_port_identifiers ';' '''
5286 if(parse_debug
): print('module_item_9', list(p
))
5287 # { pform_module_define_port(@2, p[5], p[2], p[3], p[4], p[1]); }
5289 def p_module_item_10(p
):
5290 '''module_item : attribute_list_opt port_direction K_wreal list_of_port_identifiers ';' '''
5291 if(parse_debug
): print('module_item_10', list(p
))
5292 # { real_type_t*real_type = new real_type_t(real_type_t::REAL);
5293 # pform_module_define_port(@2, p[4], p[2], NetNet::WIRE, real_type, p[1]);
5296 def p_module_item_11(p
):
5297 '''module_item : attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' '''
5298 if(parse_debug
): print('module_item_11', list(p
))
5299 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
5300 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
5301 # if (dtype->implicit_flag)
5302 # use_type = NetNet::NONE;
5304 # if (use_type == NetNet::NONE)
5305 # pform_set_port_type(@2, p[4], NetNet::PINOUT, p[3], p[1]);
5307 # pform_module_define_port(@2, p[4], NetNet::PINOUT, use_type, p[3], p[1]);
5310 def p_module_item_12(p
):
5311 '''module_item : attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' '''
5312 if(parse_debug
): print('module_item_12', list(p
))
5313 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
5314 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
5315 # if (dtype->implicit_flag)
5316 # use_type = NetNet::NONE;
5318 # if (use_type == NetNet::NONE)
5319 # pform_set_port_type(@2, p[4], NetNet::PINPUT, p[3], p[1]);
5321 # pform_module_define_port(@2, p[4], NetNet::PINPUT, use_type, p[3], p[1]);
5324 def p_module_item_13(p
):
5325 '''module_item : attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' '''
5326 if(parse_debug
): print('module_item_13', list(p
))
5327 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
5328 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
5329 # if (dtype->implicit_flag)
5330 # use_type = NetNet::NONE;
5331 # else if (dtype->reg_flag)
5332 # use_type = NetNet::REG;
5334 # use_type = NetNet::IMPLICIT_REG;
5336 # // The SystemVerilog types that can show up as
5337 # // output ports are implicitly (on the inside)
5338 # // variables because "reg" is not valid syntax
5340 # } else if (dynamic_cast<atom2_type_t*> (p[3])) {
5341 # use_type = NetNet::IMPLICIT_REG;
5342 # } else if (dynamic_cast<struct_type_t*> (p[3])) {
5343 # use_type = NetNet::IMPLICIT_REG;
5344 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[3])) {
5345 # if(etype->base_type == IVL_VT_LOGIC)
5346 # use_type = NetNet::IMPLICIT_REG;
5348 # if (use_type == NetNet::NONE)
5349 # pform_set_port_type(@2, p[4], NetNet::POUTPUT, p[3], p[1]);
5351 # pform_module_define_port(@2, p[4], NetNet::POUTPUT, use_type, p[3], p[1]);
5354 def p_module_item_14(p
):
5355 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit error ';' '''
5356 if(parse_debug
): print('module_item_14', list(p
))
5357 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5358 # if (p[1]) delete p[1];
5359 # if (p[4]) delete p[4];
5363 def p_module_item_15(p
):
5364 '''module_item : attribute_list_opt K_inout data_type_or_implicit error ';' '''
5365 if(parse_debug
): print('module_item_15', list(p
))
5366 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5367 # if (p[1]) delete p[1];
5368 # if (p[3]) delete p[3];
5372 def p_module_item_16(p
):
5373 '''module_item : attribute_list_opt K_input data_type_or_implicit error ';' '''
5374 if(parse_debug
): print('module_item_16', list(p
))
5375 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5376 # if (p[1]) delete p[1];
5377 # if (p[3]) delete p[3];
5381 def p_module_item_17(p
):
5382 '''module_item : attribute_list_opt K_output data_type_or_implicit error ';' '''
5383 if(parse_debug
): print('module_item_17', list(p
))
5384 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5385 # if (p[1]) delete p[1];
5386 # if (p[3]) delete p[3];
5390 def p_module_item_18(p
):
5391 '''module_item : DISCIPLINE_IDENTIFIER list_of_identifiers ';' '''
5392 if(parse_debug
): print('module_item_18', list(p
))
5393 # { pform_attach_discipline(@1, p[1], p[2]); }
5395 def p_module_item_19(p
):
5396 '''module_item : attribute_list_opt _embed0_module_item block_item_decl '''
5397 if(parse_debug
): print('module_item_19', list(p
))
5398 # { delete attributes_in_context;
5399 # attributes_in_context = 0;
5402 def p_module_item_20(p
):
5403 '''module_item : K_defparam _embed1_module_item defparam_assign_list ';' '''
5404 if(parse_debug
): print('module_item_20', list(p
))
5406 def p_module_item_21(p
):
5407 '''module_item : attribute_list_opt gatetype gate_instance_list ';' '''
5408 if(parse_debug
): print('module_item_21', list(p
))
5409 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
5411 def p_module_item_22(p
):
5412 '''module_item : attribute_list_opt gatetype delay3 gate_instance_list ';' '''
5413 if(parse_debug
): print('module_item_22', list(p
))
5414 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
5416 def p_module_item_23(p
):
5417 '''module_item : attribute_list_opt gatetype drive_strength gate_instance_list ';' '''
5418 if(parse_debug
): print('module_item_23', list(p
))
5419 # { pform_makegates(@2, p[2], p[3], 0, p[4], p[1]); }
5421 def p_module_item_24(p
):
5422 '''module_item : attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';' '''
5423 if(parse_debug
): print('module_item_24', list(p
))
5424 # { pform_makegates(@2, p[2], p[3], p[4], p[5], p[1]); }
5426 def p_module_item_25(p
):
5427 '''module_item : attribute_list_opt switchtype gate_instance_list ';' '''
5428 if(parse_debug
): print('module_item_25', list(p
))
5429 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
5431 def p_module_item_26(p
):
5432 '''module_item : attribute_list_opt switchtype delay3 gate_instance_list ';' '''
5433 if(parse_debug
): print('module_item_26', list(p
))
5434 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
5436 def p_module_item_27(p
):
5437 '''module_item : K_pullup gate_instance_list ';' '''
5438 if(parse_debug
): print('module_item_27', list(p
))
5439 # { pform_makegates(@1, PGBuiltin::PULLUP, pull_strength, 0, p[2], 0); }
5441 def p_module_item_28(p
):
5442 '''module_item : K_pulldown gate_instance_list ';' '''
5443 if(parse_debug
): print('module_item_28', list(p
))
5444 # { pform_makegates(@1, PGBuiltin::PULLDOWN, pull_strength, 0, p[2], 0); }
5446 def p_module_item_29(p
):
5447 '''module_item : K_pullup '(' dr_strength1 ')' gate_instance_list ';' '''
5448 if(parse_debug
): print('module_item_29', list(p
))
5449 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[5], 0); }
5451 def p_module_item_30(p
):
5452 '''module_item : K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5453 if(parse_debug
): print('module_item_30', list(p
))
5454 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[7], 0); }
5456 def p_module_item_31(p
):
5457 '''module_item : K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5458 if(parse_debug
): print('module_item_31', list(p
))
5459 # { pform_makegates(@1, PGBuiltin::PULLUP, p[5], 0, p[7], 0); }
5461 def p_module_item_32(p
):
5462 '''module_item : K_pulldown '(' dr_strength0 ')' gate_instance_list ';' '''
5463 if(parse_debug
): print('module_item_32', list(p
))
5464 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[5], 0); }
5466 def p_module_item_33(p
):
5467 '''module_item : K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5468 if(parse_debug
): print('module_item_33', list(p
))
5469 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[5], 0, p[7], 0); }
5471 def p_module_item_34(p
):
5472 '''module_item : K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5473 if(parse_debug
): print('module_item_34', list(p
))
5474 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[7], 0); }
5476 def p_module_item_35(p
):
5477 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' '''
5478 if(parse_debug
): print('module_item_35', list(p
))
5479 # { perm_string tmp1 = lex_strings.make(p[2]);
5480 # pform_make_modgates(@2, tmp1, p[3], p[4], p[1]);
5484 def p_module_item_36(p
):
5485 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt error ';' '''
5486 if(parse_debug
): print('module_item_36', list(p
))
5487 # { yyerror(@2, "error: Invalid module instantiation");
5489 # if (p[1]) delete p[1];
5492 def p_module_item_37(p
):
5493 '''module_item : K_assign drive_strength_opt delay3_opt cont_assign_list ';' '''
5494 if(parse_debug
>2): print('module_item_37', list(p
))
5495 # { pform_make_pgassign_list(p[4], p[3], p[2], @1.text, @1.first_line); }
5497 def p_module_item_38(p
):
5498 '''module_item : attribute_list_opt K_always statement_item '''
5499 if(parse_debug
): print('module_item_38', list(p
))
5500 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, p[3], p[1]);
5501 # FILE_NAME(tmp, @2);
5504 def p_module_item_39(p
):
5505 '''module_item : attribute_list_opt K_always_comb statement_item '''
5506 if(parse_debug
): print('module_item_39', list(p
))
5507 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_COMB, p[3], p[1]);
5508 # FILE_NAME(tmp, @2);
5511 def p_module_item_40(p
):
5512 '''module_item : attribute_list_opt K_always_ff statement_item '''
5513 if(parse_debug
): print('module_item_40', list(p
))
5514 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, p[3], p[1]);
5515 # FILE_NAME(tmp, @2);
5518 def p_module_item_41(p
):
5519 '''module_item : attribute_list_opt K_always_latch statement_item '''
5520 if(parse_debug
): print('module_item_41', list(p
))
5521 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_LATCH, p[3], p[1]);
5522 # FILE_NAME(tmp, @2);
5525 def p_module_item_42(p
):
5526 '''module_item : attribute_list_opt K_initial statement_item '''
5527 if(parse_debug
): print('module_item_42', list(p
))
5528 # { PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, p[3], p[1]);
5529 # FILE_NAME(tmp, @2);
5532 def p_module_item_43(p
):
5533 '''module_item : attribute_list_opt K_final statement_item '''
5534 if(parse_debug
): print('module_item_43', list(p
))
5535 # { PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, p[3], p[1]);
5536 # FILE_NAME(tmp, @2);
5539 def p_module_item_44(p
):
5540 '''module_item : attribute_list_opt K_analog analog_statement '''
5541 if(parse_debug
): print('module_item_44', list(p
))
5542 # { pform_make_analog_behavior(@2, IVL_PR_ALWAYS, p[3]); }
5544 def p_module_item_45(p
):
5545 '''module_item : attribute_list_opt assertion_item '''
5546 if(parse_debug
): print('module_item_45', list(p
))
5548 def p_module_item_46(p
):
5549 '''module_item : timeunits_declaration '''
5550 if(parse_debug
): print('module_item_46', list(p
))
5552 def p_module_item_47(p
):
5553 '''module_item : class_declaration '''
5554 if(parse_debug
): print('module_item_47', list(p
))
5556 def p_module_item_48(p
):
5557 '''module_item : task_declaration '''
5558 if(parse_debug
): print('module_item_48', list(p
))
5560 def p_module_item_49(p
):
5561 '''module_item : function_declaration '''
5562 if(parse_debug
): print('module_item_49', list(p
))
5564 def p_module_item_50(p
):
5565 '''module_item : K_generate generate_item_list_opt K_endgenerate '''
5566 if(parse_debug
): print('module_item_50', list(p
))
5567 # { // Test for bad nesting. I understand it, but it is illegal.
5568 # if (pform_parent_generate()) {
5569 # cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
5570 # cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
5571 # cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
5576 def p_module_item_51(p
):
5577 '''module_item : K_genvar list_of_identifiers ';' '''
5578 if(parse_debug
): print('module_item_51', list(p
))
5579 # { pform_genvars(@1, p[2]); }
5581 def p_module_item_52(p
):
5582 '''module_item : K_for '(' IDENTIFIER '=' expression ';' expression ';' IDENTIFIER '=' expression ')' _embed2_module_item generate_block '''
5583 if(parse_debug
): print('module_item_52', list(p
))
5584 # { pform_endgenerate(); }
5586 def p_module_item_53(p
):
5587 '''module_item : generate_if generate_block_opt K_else _embed3_module_item generate_block '''
5588 if(parse_debug
): print('module_item_53', list(p
))
5589 # { pform_endgenerate(); }
5591 def p_module_item_54(p
):
5592 '''module_item : generate_if generate_block_opt %prec less_than_K_else '''
5593 if(parse_debug
): print('module_item_54', list(p
))
5594 # { pform_endgenerate(); }
5596 def p_module_item_55(p
):
5597 '''module_item : K_case '(' expression ')' _embed4_module_item generate_case_items K_endcase '''
5598 if(parse_debug
): print('module_item_55', list(p
))
5599 # { pform_endgenerate(); }
5601 def p_module_item_56(p
):
5602 '''module_item : modport_declaration '''
5603 if(parse_debug
): print('module_item_56', list(p
))
5605 def p_module_item_57(p
):
5606 '''module_item : package_import_declaration '''
5607 if(parse_debug
): print('module_item_57', list(p
))
5609 def p_module_item_58(p
):
5610 '''module_item : attribute_list_opt K_specparam _embed5_module_item specparam_decl ';' '''
5611 if(parse_debug
): print('module_item_58', list(p
))
5613 def p_module_item_59(p
):
5614 '''module_item : K_specify _embed6_module_item specify_item_list_opt K_endspecify '''
5615 if(parse_debug
): print('module_item_59', list(p
))
5617 def p_module_item_60(p
):
5618 '''module_item : K_specify error K_endspecify '''
5619 if(parse_debug
): print('module_item_60', list(p
))
5620 # { yyerror(@1, "error: syntax error in specify block");
5624 def p_module_item_61(p
):
5625 '''module_item : error ';' '''
5626 if(parse_debug
): print('module_item_61', list(p
))
5627 # { yyerror(@2, "error: invalid module item.");
5631 def p_module_item_62(p
):
5632 '''module_item : K_assign error '=' expression ';' '''
5633 if(parse_debug
): print('module_item_62', list(p
))
5634 # { yyerror(@1, "error: syntax error in left side "
5635 # "of continuous assignment.");
5639 def p_module_item_63(p
):
5640 '''module_item : K_assign error ';' '''
5641 if(parse_debug
): print('module_item_63', list(p
))
5642 # { yyerror(@1, "error: syntax error in "
5643 # "continuous assignment");
5647 def p_module_item_64(p
):
5648 '''module_item : K_function error K_endfunction endlabel_opt '''
5649 if(parse_debug
): print('module_item_64', list(p
))
5650 # { yyerror(@1, "error: I give up on this "
5651 # "function definition.");
5653 # if (!gn_system_verilog()) {
5654 # yyerror(@4, "error: Function end names require "
5655 # "SystemVerilog.");
5662 def p_module_item_65(p
):
5663 '''module_item : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';' '''
5664 if(parse_debug
): print('module_item_65', list(p
))
5665 # { perm_string tmp3 = lex_strings.make(p[3]);
5666 # perm_string tmp5 = lex_strings.make(p[5]);
5667 # pform_set_attrib(tmp3, tmp5, p[7]);
5672 def p_module_item_66(p
):
5673 '''module_item : KK_attribute '(' error ')' ';' '''
5674 if(parse_debug
): print('module_item_66', list(p
))
5675 # { yyerror(@1, "error: Malformed $attribute parameter list."); }
5677 def p__embed0_module_item(p
):
5678 '''_embed0_module_item : '''
5679 # { attributes_in_context = p[1]; }
5681 def p__embed1_module_item(p
):
5682 '''_embed1_module_item : '''
5683 # { if (pform_in_interface())
5684 # yyerror(@1, "error: Parameter overrides are not allowed "
5685 # "in interfaces.");
5688 def p__embed2_module_item(p
):
5689 '''_embed2_module_item : '''
5690 # { pform_start_generate_for(@1, p[3], p[5], p[7], p[9], p[11]); }
5692 def p__embed3_module_item(p
):
5693 '''_embed3_module_item : '''
5694 # { pform_start_generate_else(@1); }
5696 def p__embed4_module_item(p
):
5697 '''_embed4_module_item : '''
5698 # { pform_start_generate_case(@1, p[3]); }
5700 def p__embed5_module_item(p
):
5701 '''_embed5_module_item : '''
5702 # { if (pform_in_interface())
5703 # yyerror(@1, "error: specparam declarations are not allowed "
5704 # "in interfaces.");
5707 def p__embed6_module_item(p
):
5708 '''_embed6_module_item : '''
5709 # { if (pform_in_interface())
5710 # yyerror(@1, "error: specify blocks are not allowed "
5711 # "in interfaces.");
5714 def p_module_item_list_1(p
):
5715 '''module_item_list : module_item_list module_item '''
5716 if(parse_debug
): print('module_item_list_1', list(p
))
5718 def p_module_item_list_2(p
):
5719 '''module_item_list : module_item '''
5720 if(parse_debug
>2): print('module_item_list_2', list(p
))
5722 def p_module_item_list_opt_1(p
):
5723 '''module_item_list_opt : module_item_list '''
5724 if(parse_debug
>2): print('module_item_list_opt_1', list(p
))
5726 def p_module_item_list_opt_2(p
):
5727 '''module_item_list_opt : '''
5728 if(parse_debug
): print('module_item_list_opt_2', list(p
))
5730 def p_generate_if_1(p
):
5731 '''generate_if : K_if '(' expression ')' '''
5732 if(parse_debug
): print('generate_if_1', list(p
))
5733 # { pform_start_generate_if(@1, p[3]); }
5735 def p_generate_case_items_1(p
):
5736 '''generate_case_items : generate_case_items generate_case_item '''
5737 if(parse_debug
): print('generate_case_items_1', list(p
))
5739 def p_generate_case_items_2(p
):
5740 '''generate_case_items : generate_case_item '''
5741 if(parse_debug
): print('generate_case_items_2', list(p
))
5743 def p_generate_case_item_1(p
):
5744 '''generate_case_item : expression_list_proper ':' _embed0_generate_case_item generate_block_opt '''
5745 if(parse_debug
): print('generate_case_item_1', list(p
))
5746 # { pform_endgenerate(); }
5748 def p_generate_case_item_2(p
):
5749 '''generate_case_item : K_default ':' _embed1_generate_case_item generate_block_opt '''
5750 if(parse_debug
): print('generate_case_item_2', list(p
))
5751 # { pform_endgenerate(); }
5753 def p__embed0_generate_case_item(p
):
5754 '''_embed0_generate_case_item : '''
5755 # { pform_generate_case_item(@1, p[1]); }
5757 def p__embed1_generate_case_item(p
):
5758 '''_embed1_generate_case_item : '''
5759 # { pform_generate_case_item(@1, 0); }
5761 def p_generate_item_1(p
):
5762 '''generate_item : module_item '''
5763 if(parse_debug
): print('generate_item_1', list(p
))
5765 def p_generate_item_2(p
):
5766 '''generate_item : K_begin generate_item_list_opt K_end '''
5767 if(parse_debug
): print('generate_item_2', list(p
))
5768 # { /* Detect and warn about anachronistic begin/end use */
5769 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5771 # cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
5775 def p_generate_item_3(p
):
5776 '''generate_item : K_begin ':' IDENTIFIER _embed0_generate_item generate_item_list_opt K_end '''
5777 if(parse_debug
): print('generate_item_3', list(p
))
5778 # { /* Detect and warn about anachronistic named begin/end use */
5779 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5781 # cerr << @1 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
5783 # pform_endgenerate();
5786 def p__embed0_generate_item(p
):
5787 '''_embed0_generate_item : '''
5789 # pform_start_generate_nblock(@1, p[3]);
5792 def p_generate_item_list_1(p
):
5793 '''generate_item_list : generate_item_list generate_item '''
5794 if(parse_debug
): print('generate_item_list_1', list(p
))
5796 def p_generate_item_list_2(p
):
5797 '''generate_item_list : generate_item '''
5798 if(parse_debug
): print('generate_item_list_2', list(p
))
5800 def p_generate_item_list_opt_1(p
):
5801 '''generate_item_list_opt : generate_item_list '''
5802 if(parse_debug
): print('generate_item_list_opt_1', list(p
))
5804 def p_generate_item_list_opt_2(p
):
5805 '''generate_item_list_opt : '''
5806 if(parse_debug
): print('generate_item_list_opt_2', list(p
))
5808 def p_generate_block_1(p
):
5809 '''generate_block : module_item '''
5810 if(parse_debug
): print('generate_block_1', list(p
))
5812 def p_generate_block_2(p
):
5813 '''generate_block : K_begin generate_item_list_opt K_end '''
5814 if(parse_debug
): print('generate_block_2', list(p
))
5816 def p_generate_block_3(p
):
5817 '''generate_block : K_begin ':' IDENTIFIER generate_item_list_opt K_end endlabel_opt '''
5818 if(parse_debug
): print('generate_block_3', list(p
))
5819 # { pform_generate_block_name(p[3]);
5821 # if (strcmp(p[3],p[6]) != 0) {
5822 # yyerror(@6, "error: End label doesn't match "
5825 # if (! gn_system_verilog()) {
5826 # yyerror(@6, "error: Begin end labels require "
5827 # "SystemVerilog.");
5834 def p_generate_block_opt_1(p
):
5835 '''generate_block_opt : generate_block '''
5836 if(parse_debug
): print('generate_block_opt_1', list(p
))
5838 def p_generate_block_opt_2(p
):
5839 '''generate_block_opt : ';' '''
5840 if(parse_debug
): print('generate_block_opt_2', list(p
))
5842 def p_net_decl_assign_1(p
):
5843 '''net_decl_assign : IDENTIFIER '=' expression '''
5844 if(parse_debug
): print('net_decl_assign_1', list(p
))
5845 # { net_decl_assign_t*tmp = new net_decl_assign_t;
5847 # tmp->name = lex_strings.make(p[1]);
5853 def p_net_decl_assigns_1(p
):
5854 '''net_decl_assigns : net_decl_assigns ',' net_decl_assign '''
5855 if(parse_debug
): print('net_decl_assigns_1', list(p
))
5856 # { net_decl_assign_t*tmp = p[1];
5857 # p[3]->next = tmp->next;
5862 def p_net_decl_assigns_2(p
):
5863 '''net_decl_assigns : net_decl_assign '''
5864 if(parse_debug
): print('net_decl_assigns_2', list(p
))
5868 def p_bit_logic_1(p
):
5869 '''bit_logic : K_logic '''
5870 if(parse_debug
): print('bit_logic_1', list(p
))
5871 # { p[0] = IVL_VT_LOGIC; }
5873 def p_bit_logic_2(p
):
5874 '''bit_logic : K_bool '''
5875 if(parse_debug
): print('bit_logic_2', list(p
))
5876 # { p[0] = IVL_VT_BOOL; /* Icarus misc */}
5878 def p_bit_logic_3(p
):
5879 '''bit_logic : K_bit '''
5880 if(parse_debug
): print('bit_logic_3', list(p
))
5881 # { p[0] = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
5883 def p_bit_logic_opt_1(p
):
5884 '''bit_logic_opt : bit_logic '''
5885 if(parse_debug
): print('bit_logic_opt_1', list(p
))
5887 def p_bit_logic_opt_2(p
):
5888 '''bit_logic_opt : '''
5889 if(parse_debug
): print('bit_logic_opt_2', list(p
))
5890 # { p[0] = IVL_VT_NO_TYPE; }
5892 def p_net_type_1(p
):
5893 '''net_type : K_wire '''
5894 if(parse_debug
): print('net_type_1', list(p
))
5895 # { p[0] = NetNet::WIRE; }
5897 def p_net_type_2(p
):
5898 '''net_type : K_tri '''
5899 if(parse_debug
): print('net_type_2', list(p
))
5900 # { p[0] = NetNet::TRI; }
5902 def p_net_type_3(p
):
5903 '''net_type : K_tri1 '''
5904 if(parse_debug
): print('net_type_3', list(p
))
5905 # { p[0] = NetNet::TRI1; }
5907 def p_net_type_4(p
):
5908 '''net_type : K_supply0 '''
5909 if(parse_debug
): print('net_type_4', list(p
))
5910 # { p[0] = NetNet::SUPPLY0; }
5912 def p_net_type_5(p
):
5913 '''net_type : K_wand '''
5914 if(parse_debug
): print('net_type_5', list(p
))
5915 # { p[0] = NetNet::WAND; }
5917 def p_net_type_6(p
):
5918 '''net_type : K_triand '''
5919 if(parse_debug
): print('net_type_6', list(p
))
5920 # { p[0] = NetNet::TRIAND; }
5922 def p_net_type_7(p
):
5923 '''net_type : K_tri0 '''
5924 if(parse_debug
): print('net_type_7', list(p
))
5925 # { p[0] = NetNet::TRI0; }
5927 def p_net_type_8(p
):
5928 '''net_type : K_supply1 '''
5929 if(parse_debug
): print('net_type_8', list(p
))
5930 # { p[0] = NetNet::SUPPLY1; }
5932 def p_net_type_9(p
):
5933 '''net_type : K_wor '''
5934 if(parse_debug
): print('net_type_9', list(p
))
5935 # { p[0] = NetNet::WOR; }
5937 def p_net_type_10(p
):
5938 '''net_type : K_trior '''
5939 if(parse_debug
): print('net_type_10', list(p
))
5940 # { p[0] = NetNet::TRIOR; }
5942 def p_net_type_11(p
):
5943 '''net_type : K_wone '''
5944 if(parse_debug
): print('net_type_11', list(p
))
5945 # { p[0] = NetNet::UNRESOLVED_WIRE;
5946 # cerr << @1.text << ":" << @1.first_line << ": warning: "
5947 # "'wone' is deprecated, please use 'uwire' "
5948 # "instead." << endl;
5951 def p_net_type_12(p
):
5952 '''net_type : K_uwire '''
5953 if(parse_debug
): print('net_type_12', list(p
))
5954 # { p[0] = NetNet::UNRESOLVED_WIRE; }
5956 def p_param_type_1(p
):
5957 '''param_type : bit_logic_opt unsigned_signed_opt dimensions_opt '''
5958 if(parse_debug
): print('param_type_1', list(p
))
5959 # { param_active_range = p[3];
5960 # param_active_signed = p[2];
5961 # if ((p[1] == IVL_VT_NO_TYPE) && (p[3] != 0))
5962 # param_active_type = IVL_VT_LOGIC;
5964 # param_active_type = p[1];
5967 def p_param_type_2(p
):
5968 '''param_type : K_integer '''
5969 if(parse_debug
): print('param_type_2', list(p
))
5970 # { param_active_range = make_range_from_width(integer_width);
5971 # param_active_signed = true;
5972 # param_active_type = IVL_VT_LOGIC;
5975 def p_param_type_3(p
):
5976 '''param_type : K_time '''
5977 if(parse_debug
): print('param_type_3', list(p
))
5978 # { param_active_range = make_range_from_width(64);
5979 # param_active_signed = false;
5980 # param_active_type = IVL_VT_LOGIC;
5983 def p_param_type_4(p
):
5984 '''param_type : real_or_realtime '''
5985 if(parse_debug
): print('param_type_4', list(p
))
5986 # { param_active_range = 0;
5987 # param_active_signed = true;
5988 # param_active_type = IVL_VT_REAL;
5991 def p_param_type_5(p
):
5992 '''param_type : atom2_type '''
5993 if(parse_debug
): print('param_type_5', list(p
))
5994 # { param_active_range = make_range_from_width(p[1]);
5995 # param_active_signed = true;
5996 # param_active_type = IVL_VT_BOOL;
5999 def p_param_type_6(p
):
6000 '''param_type : TYPE_IDENTIFIER '''
6001 if(parse_debug
): print('param_type_6', list(p
))
6002 # { pform_set_param_from_type(@1, p[1].type, p[1].text, param_active_range,
6003 # param_active_signed, param_active_type);
6004 # delete[]p[1].text;
6007 def p_parameter_assign_list_1(p
):
6008 '''parameter_assign_list : parameter_assign '''
6009 if(parse_debug
): print('parameter_assign_list_1', list(p
))
6011 def p_parameter_assign_list_2(p
):
6012 '''parameter_assign_list : parameter_assign_list ',' parameter_assign '''
6013 if(parse_debug
): print('parameter_assign_list_2', list(p
))
6015 def p_localparam_assign_list_1(p
):
6016 '''localparam_assign_list : localparam_assign '''
6017 if(parse_debug
): print('localparam_assign_list_1', list(p
))
6019 def p_localparam_assign_list_2(p
):
6020 '''localparam_assign_list : localparam_assign_list ',' localparam_assign '''
6021 if(parse_debug
): print('localparam_assign_list_2', list(p
))
6023 def p_parameter_assign_1(p
):
6024 '''parameter_assign : IDENTIFIER '=' expression parameter_value_ranges_opt '''
6025 if(parse_debug
): print('parameter_assign_1', list(p
))
6026 tpname
= Node(syms
.tname
, [Leaf(token
.NAME
, p
[1])])
6027 expr
= Node(syms
.tfpdef
, [tpname
, Leaf(token
.EQUAL
, p
[2]), p
[3] ])
6029 # { PExpr*tmp = p[3];
6030 # pform_set_parameter(@1, lex_strings.make(p[1]), param_active_type,
6031 # param_active_signed, param_active_range, tmp, p[4]);
6035 def p_localparam_assign_1(p
):
6036 '''localparam_assign : IDENTIFIER '=' expression '''
6037 if(parse_debug
): print('localparam_assign_1', list(p
))
6038 # { PExpr*tmp = p[3];
6039 # pform_set_localparam(@1, lex_strings.make(p[1]), param_active_type,
6040 # param_active_signed, param_active_range, tmp);
6044 def p_parameter_value_ranges_opt_1(p
):
6045 '''parameter_value_ranges_opt : parameter_value_ranges '''
6046 if(parse_debug
): print('parameter_value_ranges_opt_1', list(p
))
6049 def p_parameter_value_ranges_opt_2(p
):
6050 '''parameter_value_ranges_opt : '''
6051 if(parse_debug
): print('parameter_value_ranges_opt_2', list(p
))
6054 def p_parameter_value_ranges_1(p
):
6055 '''parameter_value_ranges : parameter_value_ranges parameter_value_range '''
6056 if(parse_debug
): print('parameter_value_ranges_1', list(p
))
6057 # { p[0] = p[2]; p[0]->next = p[1]; }
6059 def p_parameter_value_ranges_2(p
):
6060 '''parameter_value_ranges : parameter_value_range '''
6061 if(parse_debug
): print('parameter_value_ranges_2', list(p
))
6062 # { p[0] = p[1]; p[0]->next = 0; }
6064 def p_parameter_value_range_1(p
):
6065 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ']' '''
6066 if(parse_debug
): print('parameter_value_range_1', list(p
))
6067 # { p[0] = pform_parameter_value_range(p[1], false, p[3], false, p[5]); }
6069 def p_parameter_value_range_2(p
):
6070 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ')' '''
6071 if(parse_debug
): print('parameter_value_range_2', list(p
))
6072 # { p[0] = pform_parameter_value_range(p[1], false, p[3], true, p[5]); }
6074 def p_parameter_value_range_3(p
):
6075 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ']' '''
6076 if(parse_debug
): print('parameter_value_range_3', list(p
))
6077 # { p[0] = pform_parameter_value_range(p[1], true, p[3], false, p[5]); }
6079 def p_parameter_value_range_4(p
):
6080 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ')' '''
6081 if(parse_debug
): print('parameter_value_range_4', list(p
))
6082 # { p[0] = pform_parameter_value_range(p[1], true, p[3], true, p[5]); }
6084 def p_parameter_value_range_5(p
):
6085 '''parameter_value_range : K_exclude expression '''
6086 if(parse_debug
): print('parameter_value_range_5', list(p
))
6087 # { p[0] = pform_parameter_value_range(true, false, p[2], false, p[2]); }
6089 def p_value_range_expression_1(p
):
6090 '''value_range_expression : expression '''
6091 if(parse_debug
): print('value_range_expression_1', list(p
))
6094 def p_value_range_expression_2(p
):
6095 '''value_range_expression : K_inf '''
6096 if(parse_debug
): print('value_range_expression_2', list(p
))
6099 def p_value_range_expression_3(p
):
6100 '''value_range_expression : '+' K_inf '''
6101 if(parse_debug
): print('value_range_expression_3', list(p
))
6104 def p_value_range_expression_4(p
):
6105 '''value_range_expression : '-' K_inf '''
6106 if(parse_debug
): print('value_range_expression_4', list(p
))
6109 def p_from_exclude_1(p
):
6110 '''from_exclude : K_from '''
6111 if(parse_debug
): print('from_exclude_1', list(p
))
6114 def p_from_exclude_2(p
):
6115 '''from_exclude : K_exclude '''
6116 if(parse_debug
): print('from_exclude_2', list(p
))
6119 def p_parameter_value_opt_1(p
):
6120 '''parameter_value_opt : '#' '(' expression_list_with_nuls ')' '''
6121 if(parse_debug
): print('parameter_value_opt_1', list(p
))
6122 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6123 # tmp->by_order = p[3];
6128 def p_parameter_value_opt_2(p
):
6129 '''parameter_value_opt : '#' '(' parameter_value_byname_list ')' '''
6130 if(parse_debug
): print('parameter_value_opt_2', list(p
))
6131 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6132 # tmp->by_order = 0;
6133 # tmp->by_name = p[3];
6137 def p_parameter_value_opt_3(p
):
6138 '''parameter_value_opt : '#' DEC_NUMBER '''
6139 if(parse_debug
): print('parameter_value_opt_3', list(p
))
6141 # PENumber*tmp = new PENumber(p[2]);
6142 # FILE_NAME(tmp, @1);
6144 # struct parmvalue_t*lst = new struct parmvalue_t;
6145 # lst->by_order = new list<PExpr*>;
6146 # lst->by_order->push_back(tmp);
6152 def p_parameter_value_opt_4(p
):
6153 '''parameter_value_opt : '#' REALTIME '''
6154 if(parse_debug
): print('parameter_value_opt_4', list(p
))
6156 # PEFNumber*tmp = new PEFNumber(p[2]);
6157 # FILE_NAME(tmp, @1);
6159 # struct parmvalue_t*lst = new struct parmvalue_t;
6160 # lst->by_order = new list<PExpr*>;
6161 # lst->by_order->push_back(tmp);
6166 def p_parameter_value_opt_5(p
):
6167 '''parameter_value_opt : '#' error '''
6168 if(parse_debug
): print('parameter_value_opt_5', list(p
))
6169 # { yyerror(@1, "error: syntax error in parameter value "
6170 # "assignment list.");
6174 def p_parameter_value_opt_6(p
):
6175 '''parameter_value_opt : '''
6176 if(parse_debug
): print('parameter_value_opt_6', list(p
))
6179 def p_parameter_value_byname_1(p
):
6180 '''parameter_value_byname : '.' IDENTIFIER '(' expression ')' '''
6181 if(parse_debug
): print('parameter_value_byname_1', list(p
))
6182 # { named_pexpr_t*tmp = new named_pexpr_t;
6183 # tmp->name = lex_strings.make(p[2]);
6189 def p_parameter_value_byname_2(p
):
6190 '''parameter_value_byname : '.' IDENTIFIER '(' ')' '''
6191 if(parse_debug
): print('parameter_value_byname_2', list(p
))
6192 # { named_pexpr_t*tmp = new named_pexpr_t;
6193 # tmp->name = lex_strings.make(p[2]);
6199 def p_parameter_value_byname_list_1(p
):
6200 '''parameter_value_byname_list : parameter_value_byname '''
6201 if(parse_debug
): print('parameter_value_byname_list_1', list(p
))
6202 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6203 # tmp->push_back(*p[1]);
6208 def p_parameter_value_byname_list_2(p
):
6209 '''parameter_value_byname_list : parameter_value_byname_list ',' parameter_value_byname '''
6210 if(parse_debug
): print('parameter_value_byname_list_2', list(p
))
6211 # { list<named_pexpr_t>*tmp = p[1];
6212 # tmp->push_back(*p[3]);
6218 '''port : port_reference '''
6219 if(parse_debug
): print('port_1', list(p
))
6223 '''port : '.' IDENTIFIER '(' port_reference ')' '''
6224 if(parse_debug
): print('port_2', list(p
))
6225 # { Module::port_t*tmp = p[4];
6226 # tmp->name = lex_strings.make(p[2]);
6232 '''port : '{' port_reference_list '}' '''
6233 if(parse_debug
): print('port_3', list(p
))
6234 # { Module::port_t*tmp = p[2];
6235 # tmp->name = perm_string();
6240 '''port : '.' IDENTIFIER '(' '{' port_reference_list '}' ')' '''
6241 if(parse_debug
): print('port_4', list(p
))
6242 # { Module::port_t*tmp = p[5];
6243 # tmp->name = lex_strings.make(p[2]);
6248 def p_port_opt_1(p
):
6249 '''port_opt : port '''
6250 if(parse_debug
): print('port_opt_1', list(p
))
6253 def p_port_opt_2(p
):
6255 if(parse_debug
): print('port_opt_2', list(p
))
6258 def p_port_name_1(p
):
6259 '''port_name : '.' IDENTIFIER '(' expression ')' '''
6260 if(parse_debug
): print('port_name_1', list(p
))
6261 # { named_pexpr_t*tmp = new named_pexpr_t;
6262 # tmp->name = lex_strings.make(p[2]);
6268 def p_port_name_2(p
):
6269 '''port_name : '.' IDENTIFIER '(' error ')' '''
6270 if(parse_debug
): print('port_name_2', list(p
))
6271 # { yyerror(@3, "error: invalid port connection expression.");
6272 # named_pexpr_t*tmp = new named_pexpr_t;
6273 # tmp->name = lex_strings.make(p[2]);
6279 def p_port_name_3(p
):
6280 '''port_name : '.' IDENTIFIER '(' ')' '''
6281 if(parse_debug
): print('port_name_3', list(p
))
6282 # { named_pexpr_t*tmp = new named_pexpr_t;
6283 # tmp->name = lex_strings.make(p[2]);
6289 def p_port_name_4(p
):
6290 '''port_name : '.' IDENTIFIER '''
6291 if(parse_debug
): print('port_name_4', list(p
))
6292 # { named_pexpr_t*tmp = new named_pexpr_t;
6293 # tmp->name = lex_strings.make(p[2]);
6294 # tmp->parm = new PEIdent(lex_strings.make(p[2]), true);
6295 # FILE_NAME(tmp->parm, @1);
6300 def p_port_name_5(p
):
6301 '''port_name : K_DOTSTAR '''
6302 if(parse_debug
): print('port_name_5', list(p
))
6303 # { named_pexpr_t*tmp = new named_pexpr_t;
6304 # tmp->name = lex_strings.make("*");
6309 def p_port_name_list_1(p
):
6310 '''port_name_list : port_name_list ',' port_name '''
6311 if(parse_debug
): print('port_name_list_1', list(p
))
6312 # { list<named_pexpr_t>*tmp = p[1];
6313 # tmp->push_back(*p[3]);
6318 def p_port_name_list_2(p
):
6319 '''port_name_list : port_name '''
6320 if(parse_debug
): print('port_name_list_2', list(p
))
6321 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6322 # tmp->push_back(*p[1]);
6327 def p_port_reference_1(p
):
6328 '''port_reference : IDENTIFIER '''
6329 if(parse_debug
): print('port_reference_1', list(p
))
6330 # { Module::port_t*ptmp;
6331 # perm_string name = lex_strings.make(p[1]);
6332 # ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
6337 def p_port_reference_2(p
):
6338 '''port_reference : IDENTIFIER '[' expression ':' expression ']' '''
6339 if(parse_debug
): print('port_reference_2', list(p
))
6340 # { index_component_t itmp;
6341 # itmp.sel = index_component_t::SEL_PART;
6345 # name_component_t ntmp (lex_strings.make(p[1]));
6346 # ntmp.index.push_back(itmp);
6348 # pform_name_t pname;
6349 # pname.push_back(ntmp);
6351 # PEIdent*wtmp = new PEIdent(pname);
6352 # FILE_NAME(wtmp, @1);
6354 # Module::port_t*ptmp = new Module::port_t;
6355 # ptmp->name = perm_string();
6356 # ptmp->expr.push_back(wtmp);
6362 def p_port_reference_3(p
):
6363 '''port_reference : IDENTIFIER '[' expression ']' '''
6364 if(parse_debug
): print('port_reference_3', list(p
))
6365 # { index_component_t itmp;
6366 # itmp.sel = index_component_t::SEL_BIT;
6370 # name_component_t ntmp (lex_strings.make(p[1]));
6371 # ntmp.index.push_back(itmp);
6373 # pform_name_t pname;
6374 # pname.push_back(ntmp);
6376 # PEIdent*tmp = new PEIdent(pname);
6377 # FILE_NAME(tmp, @1);
6379 # Module::port_t*ptmp = new Module::port_t;
6380 # ptmp->name = perm_string();
6381 # ptmp->expr.push_back(tmp);
6386 def p_port_reference_4(p
):
6387 '''port_reference : IDENTIFIER '[' error ']' '''
6388 if(parse_debug
): print('port_reference_4', list(p
))
6389 # { yyerror(@1, "error: invalid port bit select");
6390 # Module::port_t*ptmp = new Module::port_t;
6391 # PEIdent*wtmp = new PEIdent(lex_strings.make(p[1]));
6392 # FILE_NAME(wtmp, @1);
6393 # ptmp->name = lex_strings.make(p[1]);
6394 # ptmp->expr.push_back(wtmp);
6399 def p_port_reference_list_1(p
):
6400 '''port_reference_list : port_reference '''
6401 if(parse_debug
): print('port_reference_list_1', list(p
))
6404 def p_port_reference_list_2(p
):
6405 '''port_reference_list : port_reference_list ',' port_reference '''
6406 if(parse_debug
): print('port_reference_list_2', list(p
))
6407 # { Module::port_t*tmp = p[1];
6408 # append(tmp->expr, p[3]->expr);
6413 def p_dimensions_opt_1(p
):
6414 '''dimensions_opt : '''
6415 if(parse_debug
>2): print('dimensions_opt_1', list(p
))
6418 def p_dimensions_opt_2(p
):
6419 '''dimensions_opt : dimensions '''
6420 if(parse_debug
): print('dimensions_opt_2', list(p
))
6423 def p_dimensions_1(p
):
6424 '''dimensions : variable_dimension '''
6425 if(parse_debug
): print('dimensions_1', list(p
))
6428 def p_dimensions_2(p
):
6429 '''dimensions : dimensions variable_dimension '''
6430 if(parse_debug
): print('dimensions_2', list(p
))
6431 # { list<pform_range_t> *tmp = p[1];
6433 # tmp->splice(tmp->end(), *p[2]);
6439 def p_register_variable_1(p
):
6440 '''register_variable : IDENTIFIER dimensions_opt '''
6441 if(parse_debug
): print('register_variable_1', list(p
))
6442 # { perm_string name = lex_strings.make(p[1]);
6443 # pform_makewire(@1, name, NetNet::REG,
6444 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6445 # pform_set_reg_idx(name, p[2]);
6449 def p_register_variable_2(p
):
6450 '''register_variable : IDENTIFIER dimensions_opt '=' expression '''
6451 if(parse_debug
): print('register_variable_2', list(p
))
6452 # { if (pform_peek_scope()->var_init_needs_explicit_lifetime()
6453 # && (var_lifetime == LexicalScope::INHERITED)) {
6454 # cerr << @3 << ": warning: Static variable initialization requires "
6455 # "explicit lifetime in this context." << endl;
6458 # perm_string name = lex_strings.make(p[1]);
6459 # pform_makewire(@1, name, NetNet::REG,
6460 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6461 # pform_set_reg_idx(name, p[2]);
6462 # pform_make_var_init(@1, name, p[4]);
6466 def p_register_variable_list_1(p
):
6467 '''register_variable_list : register_variable '''
6468 if(parse_debug
): print('register_variable_list_1', list(p
))
6469 # { list<perm_string>*tmp = new list<perm_string>;
6470 # tmp->push_back(lex_strings.make(p[1]));
6475 def p_register_variable_list_2(p
):
6476 '''register_variable_list : register_variable_list ',' register_variable '''
6477 if(parse_debug
): print('register_variable_list_2', list(p
))
6478 # { list<perm_string>*tmp = p[1];
6479 # tmp->push_back(lex_strings.make(p[3]));
6484 def p_net_variable_1(p
):
6485 '''net_variable : IDENTIFIER dimensions_opt '''
6486 if(parse_debug
): print('net_variable_1', list(p
))
6487 # { perm_string name = lex_strings.make(p[1]);
6488 # pform_makewire(@1, name, NetNet::IMPLICIT,
6489 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6490 # pform_set_reg_idx(name, p[2]);
6494 def p_net_variable_list_1(p
):
6495 '''net_variable_list : net_variable '''
6496 if(parse_debug
): print('net_variable_list_1', list(p
))
6497 # { list<perm_string>*tmp = new list<perm_string>;
6498 # tmp->push_back(lex_strings.make(p[1]));
6503 def p_net_variable_list_2(p
):
6504 '''net_variable_list : net_variable_list ',' net_variable '''
6505 if(parse_debug
): print('net_variable_list_2', list(p
))
6506 # { list<perm_string>*tmp = p[1];
6507 # tmp->push_back(lex_strings.make(p[3]));
6512 def p_event_variable_1(p
):
6513 '''event_variable : IDENTIFIER dimensions_opt '''
6514 if(parse_debug
): print('event_variable_1', list(p
))
6516 # yyerror(@2, "sorry: event arrays are not supported.");
6522 def p_event_variable_list_1(p
):
6523 '''event_variable_list : event_variable '''
6524 if(parse_debug
): print('event_variable_list_1', list(p
))
6525 # { p[0] = list_from_identifier(p[1]); }
6527 def p_event_variable_list_2(p
):
6528 '''event_variable_list : event_variable_list ',' event_variable '''
6529 if(parse_debug
): print('event_variable_list_2', list(p
))
6530 # { p[0] = list_from_identifier(p[1], p[3]); }
6532 def p_specify_item_1(p
):
6533 '''specify_item : K_specparam specparam_decl ';' '''
6534 if(parse_debug
): print('specify_item_1', list(p
))
6536 def p_specify_item_2(p
):
6537 '''specify_item : specify_simple_path_decl ';' '''
6538 if(parse_debug
): print('specify_item_2', list(p
))
6539 # { pform_module_specify_path(p[1]);
6542 def p_specify_item_3(p
):
6543 '''specify_item : specify_edge_path_decl ';' '''
6544 if(parse_debug
): print('specify_item_3', list(p
))
6545 # { pform_module_specify_path(p[1]);
6548 def p_specify_item_4(p
):
6549 '''specify_item : K_if '(' expression ')' specify_simple_path_decl ';' '''
6550 if(parse_debug
): print('specify_item_4', list(p
))
6551 # { PSpecPath*tmp = p[5];
6553 # tmp->conditional = true;
6554 # tmp->condition = p[3];
6556 # pform_module_specify_path(tmp);
6559 def p_specify_item_5(p
):
6560 '''specify_item : K_if '(' expression ')' specify_edge_path_decl ';' '''
6561 if(parse_debug
): print('specify_item_5', list(p
))
6562 # { PSpecPath*tmp = p[5];
6564 # tmp->conditional = true;
6565 # tmp->condition = p[3];
6567 # pform_module_specify_path(tmp);
6570 def p_specify_item_6(p
):
6571 '''specify_item : K_ifnone specify_simple_path_decl ';' '''
6572 if(parse_debug
): print('specify_item_6', list(p
))
6573 # { PSpecPath*tmp = p[2];
6575 # tmp->conditional = true;
6576 # tmp->condition = 0;
6578 # pform_module_specify_path(tmp);
6581 def p_specify_item_7(p
):
6582 '''specify_item : K_ifnone specify_edge_path_decl ';' '''
6583 if(parse_debug
): print('specify_item_7', list(p
))
6584 # { yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
6585 # "not supported.");
6589 def p_specify_item_8(p
):
6590 '''specify_item : K_Sfullskew '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6591 if(parse_debug
): print('specify_item_8', list(p
))
6596 def p_specify_item_9(p
):
6597 '''specify_item : K_Shold '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6598 if(parse_debug
): print('specify_item_9', list(p
))
6602 def p_specify_item_10(p
):
6603 '''specify_item : K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6604 if(parse_debug
): print('specify_item_10', list(p
))
6609 def p_specify_item_11(p
):
6610 '''specify_item : K_Speriod '(' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6611 if(parse_debug
): print('specify_item_11', list(p
))
6615 def p_specify_item_12(p
):
6616 '''specify_item : K_Srecovery '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6617 if(parse_debug
): print('specify_item_12', list(p
))
6621 def p_specify_item_13(p
):
6622 '''specify_item : K_Srecrem '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6623 if(parse_debug
): print('specify_item_13', list(p
))
6628 def p_specify_item_14(p
):
6629 '''specify_item : K_Sremoval '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6630 if(parse_debug
): print('specify_item_14', list(p
))
6634 def p_specify_item_15(p
):
6635 '''specify_item : K_Ssetup '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6636 if(parse_debug
): print('specify_item_15', list(p
))
6640 def p_specify_item_16(p
):
6641 '''specify_item : K_Ssetuphold '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6642 if(parse_debug
): print('specify_item_16', list(p
))
6647 def p_specify_item_17(p
):
6648 '''specify_item : K_Sskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6649 if(parse_debug
): print('specify_item_17', list(p
))
6653 def p_specify_item_18(p
):
6654 '''specify_item : K_Stimeskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6655 if(parse_debug
): print('specify_item_18', list(p
))
6659 def p_specify_item_19(p
):
6660 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ',' expression spec_notifier_opt ')' ';' '''
6661 if(parse_debug
): print('specify_item_19', list(p
))
6666 def p_specify_item_20(p
):
6667 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ')' ';' '''
6668 if(parse_debug
): print('specify_item_20', list(p
))
6672 def p_specify_item_21(p
):
6673 '''specify_item : K_pulsestyle_onevent specify_path_identifiers ';' '''
6674 if(parse_debug
): print('specify_item_21', list(p
))
6678 def p_specify_item_22(p
):
6679 '''specify_item : K_pulsestyle_ondetect specify_path_identifiers ';' '''
6680 if(parse_debug
): print('specify_item_22', list(p
))
6684 def p_specify_item_23(p
):
6685 '''specify_item : K_showcancelled specify_path_identifiers ';' '''
6686 if(parse_debug
): print('specify_item_23', list(p
))
6690 def p_specify_item_24(p
):
6691 '''specify_item : K_noshowcancelled specify_path_identifiers ';' '''
6692 if(parse_debug
): print('specify_item_24', list(p
))
6696 def p_specify_item_list_1(p
):
6697 '''specify_item_list : specify_item '''
6698 if(parse_debug
): print('specify_item_list_1', list(p
))
6700 def p_specify_item_list_2(p
):
6701 '''specify_item_list : specify_item_list specify_item '''
6702 if(parse_debug
): print('specify_item_list_2', list(p
))
6704 def p_specify_item_list_opt_1(p
):
6705 '''specify_item_list_opt : '''
6706 if(parse_debug
): print('specify_item_list_opt_1', list(p
))
6709 def p_specify_item_list_opt_2(p
):
6710 '''specify_item_list_opt : specify_item_list '''
6711 if(parse_debug
): print('specify_item_list_opt_2', list(p
))
6714 def p_specify_edge_path_decl_1(p
):
6715 '''specify_edge_path_decl : specify_edge_path '=' '(' delay_value_list ')' '''
6716 if(parse_debug
): print('specify_edge_path_decl_1', list(p
))
6717 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
6719 def p_specify_edge_path_decl_2(p
):
6720 '''specify_edge_path_decl : specify_edge_path '=' delay_value_simple '''
6721 if(parse_debug
): print('specify_edge_path_decl_2', list(p
))
6722 # { list<PExpr*>*tmp = new list<PExpr*>;
6723 # tmp->push_back(p[3]);
6724 # p[0] = pform_assign_path_delay(p[1], tmp);
6727 def p_edge_operator_1(p
):
6728 '''edge_operator : K_posedge '''
6729 if(parse_debug
): print('edge_operator_1', list(p
))
6732 def p_edge_operator_2(p
):
6733 '''edge_operator : K_negedge '''
6734 if(parse_debug
): print('edge_operator_2', list(p
))
6737 def p_specify_edge_path_1(p
):
6738 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6739 if(parse_debug
): print('specify_edge_path_1', list(p
))
6740 # { int edge_flag = 0;
6741 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], false, p[6], p[8]); }
6743 def p_specify_edge_path_2(p
):
6744 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6745 if(parse_debug
): print('specify_edge_path_2', list(p
))
6746 # { int edge_flag = p[2]? 1 : -1;
6747 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], false, p[7], p[9]);}
6749 def p_specify_edge_path_3(p
):
6750 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6751 if(parse_debug
): print('specify_edge_path_3', list(p
))
6752 # { int edge_flag = 0;
6753 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], true, p[6], p[8]); }
6755 def p_specify_edge_path_4(p
):
6756 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6757 if(parse_debug
): print('specify_edge_path_4', list(p
))
6758 # { int edge_flag = p[2]? 1 : -1;
6759 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], true, p[7], p[9]); }
6761 def p_polarity_operator_1(p
):
6762 '''polarity_operator : K_PO_POS '''
6763 if(parse_debug
): print('polarity_operator_1', list(p
))
6765 def p_polarity_operator_2(p
):
6766 '''polarity_operator : K_PO_NEG '''
6767 if(parse_debug
): print('polarity_operator_2', list(p
))
6769 def p_polarity_operator_3(p
):
6770 '''polarity_operator : ':' '''
6771 if(parse_debug
): print('polarity_operator_3', list(p
))
6773 def p_specify_simple_path_decl_1(p
):
6774 '''specify_simple_path_decl : specify_simple_path '=' '(' delay_value_list ')' '''
6775 if(parse_debug
): print('specify_simple_path_decl_1', list(p
))
6776 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
6778 def p_specify_simple_path_decl_2(p
):
6779 '''specify_simple_path_decl : specify_simple_path '=' delay_value_simple '''
6780 if(parse_debug
): print('specify_simple_path_decl_2', list(p
))
6781 # { list<PExpr*>*tmp = new list<PExpr*>;
6782 # tmp->push_back(p[3]);
6783 # p[0] = pform_assign_path_delay(p[1], tmp);
6786 def p_specify_simple_path_decl_3(p
):
6787 '''specify_simple_path_decl : specify_simple_path '=' '(' error ')' '''
6788 if(parse_debug
): print('specify_simple_path_decl_3', list(p
))
6789 # { yyerror(@3, "Syntax error in delay value list.");
6794 def p_specify_simple_path_1(p
):
6795 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' '''
6796 if(parse_debug
): print('specify_simple_path_1', list(p
))
6797 # { p[0] = pform_make_specify_path(@1, p[2], p[3], false, p[5]); }
6799 def p_specify_simple_path_2(p
):
6800 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' '''
6801 if(parse_debug
): print('specify_simple_path_2', list(p
))
6802 # { p[0] = pform_make_specify_path(@1, p[2], p[3], true, p[5]); }
6804 def p_specify_simple_path_3(p
):
6805 '''specify_simple_path : '(' error ')' '''
6806 if(parse_debug
): print('specify_simple_path_3', list(p
))
6807 # { yyerror(@1, "Invalid simple path");
6811 def p_specify_path_identifiers_1(p
):
6812 '''specify_path_identifiers : IDENTIFIER '''
6813 if(parse_debug
): print('specify_path_identifiers_1', list(p
))
6814 # { list<perm_string>*tmp = new list<perm_string>;
6815 # tmp->push_back(lex_strings.make(p[1]));
6820 def p_specify_path_identifiers_2(p
):
6821 '''specify_path_identifiers : IDENTIFIER '[' expr_primary ']' '''
6822 if(parse_debug
): print('specify_path_identifiers_2', list(p
))
6823 # { if (gn_specify_blocks_flag) {
6824 # yywarn(@4, "Bit selects are not currently supported "
6825 # "in path declarations. The declaration "
6826 # "will be applied to the whole vector.");
6828 # list<perm_string>*tmp = new list<perm_string>;
6829 # tmp->push_back(lex_strings.make(p[1]));
6834 def p_specify_path_identifiers_3(p
):
6835 '''specify_path_identifiers : IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6836 if(parse_debug
): print('specify_path_identifiers_3', list(p
))
6837 # { if (gn_specify_blocks_flag) {
6838 # yywarn(@4, "Part selects are not currently supported "
6839 # "in path declarations. The declaration "
6840 # "will be applied to the whole vector.");
6842 # list<perm_string>*tmp = new list<perm_string>;
6843 # tmp->push_back(lex_strings.make(p[1]));
6848 def p_specify_path_identifiers_4(p
):
6849 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '''
6850 if(parse_debug
): print('specify_path_identifiers_4', list(p
))
6851 # { list<perm_string>*tmp = p[1];
6852 # tmp->push_back(lex_strings.make(p[3]));
6857 def p_specify_path_identifiers_5(p
):
6858 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' '''
6859 if(parse_debug
): print('specify_path_identifiers_5', list(p
))
6860 # { if (gn_specify_blocks_flag) {
6861 # yywarn(@4, "Bit selects are not currently supported "
6862 # "in path declarations. The declaration "
6863 # "will be applied to the whole vector.");
6865 # list<perm_string>*tmp = p[1];
6866 # tmp->push_back(lex_strings.make(p[3]));
6871 def p_specify_path_identifiers_6(p
):
6872 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6873 if(parse_debug
): print('specify_path_identifiers_6', list(p
))
6874 # { if (gn_specify_blocks_flag) {
6875 # yywarn(@4, "Part selects are not currently supported "
6876 # "in path declarations. The declaration "
6877 # "will be applied to the whole vector.");
6879 # list<perm_string>*tmp = p[1];
6880 # tmp->push_back(lex_strings.make(p[3]));
6885 def p_specparam_1(p
):
6886 '''specparam : IDENTIFIER '=' expression '''
6887 if(parse_debug
): print('specparam_1', list(p
))
6888 # { PExpr*tmp = p[3];
6889 # pform_set_specparam(@1, lex_strings.make(p[1]),
6890 # param_active_range, tmp);
6894 def p_specparam_2(p
):
6895 '''specparam : IDENTIFIER '=' expression ':' expression ':' expression '''
6896 if(parse_debug
): print('specparam_2', list(p
))
6898 # switch (min_typ_max_flag) {
6915 # if (min_typ_max_warn > 0) {
6916 # cerr << tmp->get_fileline() << ": warning: choosing ";
6917 # switch (min_typ_max_flag) {
6928 # cerr << " expression." << endl;
6929 # min_typ_max_warn -= 1;
6931 # pform_set_specparam(@1, lex_strings.make(p[1]),
6932 # param_active_range, tmp);
6936 def p_specparam_3(p
):
6937 '''specparam : PATHPULSE_IDENTIFIER '=' expression '''
6938 if(parse_debug
): print('specparam_3', list(p
))
6943 def p_specparam_4(p
):
6944 '''specparam : PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' '''
6945 if(parse_debug
): print('specparam_4', list(p
))
6951 def p_specparam_list_1(p
):
6952 '''specparam_list : specparam '''
6953 if(parse_debug
): print('specparam_list_1', list(p
))
6955 def p_specparam_list_2(p
):
6956 '''specparam_list : specparam_list ',' specparam '''
6957 if(parse_debug
): print('specparam_list_2', list(p
))
6959 def p_specparam_decl_1(p
):
6960 '''specparam_decl : specparam_list '''
6961 if(parse_debug
): print('specparam_decl_1', list(p
))
6963 def p_specparam_decl_2(p
):
6964 '''specparam_decl : dimensions _embed0_specparam_decl specparam_list '''
6965 if(parse_debug
): print('specparam_decl_2', list(p
))
6966 # { param_active_range = 0; }
6968 def p__embed0_specparam_decl(p
):
6969 '''_embed0_specparam_decl : '''
6970 # { param_active_range = p[1]; }
6972 def p_spec_polarity_1(p
):
6973 '''spec_polarity : '+' '''
6974 if(parse_debug
): print('spec_polarity_1', list(p
))
6977 def p_spec_polarity_2(p
):
6978 '''spec_polarity : '-' '''
6979 if(parse_debug
): print('spec_polarity_2', list(p
))
6982 def p_spec_polarity_3(p
):
6983 '''spec_polarity : '''
6984 if(parse_debug
): print('spec_polarity_3', list(p
))
6987 def p_spec_reference_event_1(p
):
6988 '''spec_reference_event : K_posedge expression '''
6989 if(parse_debug
): print('spec_reference_event_1', list(p
))
6992 def p_spec_reference_event_2(p
):
6993 '''spec_reference_event : K_negedge expression '''
6994 if(parse_debug
): print('spec_reference_event_2', list(p
))
6997 def p_spec_reference_event_3(p
):
6998 '''spec_reference_event : K_posedge expr_primary K_TAND expression '''
6999 if(parse_debug
): print('spec_reference_event_3', list(p
))
7004 def p_spec_reference_event_4(p
):
7005 '''spec_reference_event : K_negedge expr_primary K_TAND expression '''
7006 if(parse_debug
): print('spec_reference_event_4', list(p
))
7011 def p_spec_reference_event_5(p
):
7012 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary '''
7013 if(parse_debug
): print('spec_reference_event_5', list(p
))
7016 def p_spec_reference_event_6(p
):
7017 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression '''
7018 if(parse_debug
): print('spec_reference_event_6', list(p
))
7023 def p_spec_reference_event_7(p
):
7024 '''spec_reference_event : expr_primary K_TAND expression '''
7025 if(parse_debug
): print('spec_reference_event_7', list(p
))
7030 def p_spec_reference_event_8(p
):
7031 '''spec_reference_event : expr_primary '''
7032 if(parse_debug
): print('spec_reference_event_8', list(p
))
7035 def p_edge_descriptor_list_1(p
):
7036 '''edge_descriptor_list : edge_descriptor_list ',' K_edge_descriptor '''
7037 if(parse_debug
): print('edge_descriptor_list_1', list(p
))
7039 def p_edge_descriptor_list_2(p
):
7040 '''edge_descriptor_list : K_edge_descriptor '''
7041 if(parse_debug
): print('edge_descriptor_list_2', list(p
))
7043 def p_spec_notifier_opt_1(p
):
7044 '''spec_notifier_opt : '''
7045 if(parse_debug
): print('spec_notifier_opt_1', list(p
))
7048 def p_spec_notifier_opt_2(p
):
7049 '''spec_notifier_opt : spec_notifier '''
7050 if(parse_debug
): print('spec_notifier_opt_2', list(p
))
7053 def p_spec_notifier_1(p
):
7054 '''spec_notifier : ',' '''
7055 if(parse_debug
): print('spec_notifier_1', list(p
))
7056 # { args_after_notifier = 0; }
7058 def p_spec_notifier_2(p
):
7059 '''spec_notifier : ',' hierarchy_identifier '''
7060 if(parse_debug
): print('spec_notifier_2', list(p
))
7061 # { args_after_notifier = 0; delete p[2]; }
7063 def p_spec_notifier_3(p
):
7064 '''spec_notifier : spec_notifier ',' '''
7065 if(parse_debug
): print('spec_notifier_3', list(p
))
7066 # { args_after_notifier += 1; }
7068 def p_spec_notifier_4(p
):
7069 '''spec_notifier : spec_notifier ',' hierarchy_identifier '''
7070 if(parse_debug
): print('spec_notifier_4', list(p
))
7071 # { args_after_notifier += 1;
7072 # if (args_after_notifier >= 3) {
7073 # cerr << @3 << ": warning: timing checks are not supported "
7074 # "and delayed signal \"" << *p[3]
7075 # << "\" will not be driven." << endl;
7079 def p_spec_notifier_5(p
):
7080 '''spec_notifier : IDENTIFIER '''
7081 if(parse_debug
): print('spec_notifier_5', list(p
))
7082 # { args_after_notifier = 0; delete[]p[1]; }
7084 def p_statement_item_1(p
):
7085 '''statement_item : K_assign lpvalue '=' expression ';' '''
7086 if(parse_debug
): print('statement_item_1', list(p
))
7087 # { PCAssign*tmp = new PCAssign(p[2], p[4]);
7088 # FILE_NAME(tmp, @1);
7092 def p_statement_item_2(p
):
7093 '''statement_item : K_deassign lpvalue ';' '''
7094 if(parse_debug
): print('statement_item_2', list(p
))
7095 # { PDeassign*tmp = new PDeassign(p[2]);
7096 # FILE_NAME(tmp, @1);
7100 def p_statement_item_3(p
):
7101 '''statement_item : K_force lpvalue '=' expression ';' '''
7102 if(parse_debug
): print('statement_item_3', list(p
))
7103 # { PForce*tmp = new PForce(p[2], p[4]);
7104 # FILE_NAME(tmp, @1);
7108 def p_statement_item_4(p
):
7109 '''statement_item : K_release lpvalue ';' '''
7110 if(parse_debug
): print('statement_item_4', list(p
))
7111 # { PRelease*tmp = new PRelease(p[2]);
7112 # FILE_NAME(tmp, @1);
7116 def p_statement_item_5(p
):
7117 '''statement_item : K_begin K_end '''
7118 if(parse_debug
): print('statement_item_5', list(p
))
7119 # { PBlock*tmp = new PBlock(PBlock::BL_SEQ);
7120 # FILE_NAME(tmp, @1);
7124 def p_statement_item_6(p
):
7125 '''statement_item : K_begin _embed0_statement_item block_item_decls_opt _embed1_statement_item statement_or_null_list K_end '''
7126 if(parse_debug
): print('statement_item_6', list(p
))
7129 # pform_pop_scope();
7130 # assert(! current_block_stack.empty());
7131 # tmp = current_block_stack.top();
7132 # current_block_stack.pop();
7134 # tmp = new PBlock(PBlock::BL_SEQ);
7135 # FILE_NAME(tmp, @1);
7137 # if (p[5]) tmp->set_statement(*p[5]);
7142 def p_statement_item_7(p
):
7143 '''statement_item : K_begin ':' IDENTIFIER _embed2_statement_item block_item_decls_opt statement_or_null_list_opt K_end endlabel_opt '''
7144 if(parse_debug
): print('statement_item_7', list(p
))
7145 # { pform_pop_scope();
7146 # assert(! current_block_stack.empty());
7147 # PBlock*tmp = current_block_stack.top();
7148 # current_block_stack.pop();
7149 # if (p[6]) tmp->set_statement(*p[6]);
7152 # if (strcmp(p[3],p[8]) != 0) {
7153 # yyerror(@8, "error: End label doesn't match begin name");
7155 # if (! gn_system_verilog()) {
7156 # yyerror(@8, "error: Begin end labels require "
7157 # "SystemVerilog.");
7165 def p_statement_item_8(p
):
7166 '''statement_item : K_fork join_keyword '''
7167 if(parse_debug
): print('statement_item_8', list(p
))
7168 # { PBlock*tmp = new PBlock(p[2]);
7169 # FILE_NAME(tmp, @1);
7173 def p_statement_item_9(p
):
7174 '''statement_item : K_fork _embed3_statement_item block_item_decls_opt _embed4_statement_item statement_or_null_list join_keyword '''
7175 if(parse_debug
): print('statement_item_9', list(p
))
7178 # pform_pop_scope();
7179 # assert(! current_block_stack.empty());
7180 # tmp = current_block_stack.top();
7181 # current_block_stack.pop();
7182 # tmp->set_join_type(p[6]);
7184 # tmp = new PBlock(p[6]);
7185 # FILE_NAME(tmp, @1);
7187 # if (p[5]) tmp->set_statement(*p[5]);
7192 def p_statement_item_10(p
):
7193 '''statement_item : K_fork ':' IDENTIFIER _embed5_statement_item block_item_decls_opt statement_or_null_list_opt join_keyword endlabel_opt '''
7194 if(parse_debug
): print('statement_item_10', list(p
))
7195 # { pform_pop_scope();
7196 # assert(! current_block_stack.empty());
7197 # PBlock*tmp = current_block_stack.top();
7198 # current_block_stack.pop();
7199 # tmp->set_join_type(p[7]);
7200 # if (p[6]) tmp->set_statement(*p[6]);
7203 # if (strcmp(p[3],p[8]) != 0) {
7204 # yyerror(@8, "error: End label doesn't match fork name");
7206 # if (! gn_system_verilog()) {
7207 # yyerror(@8, "error: Fork end labels require "
7208 # "SystemVerilog.");
7216 def p_statement_item_11(p
):
7217 '''statement_item : K_disable hierarchy_identifier ';' '''
7218 if(parse_debug
): print('statement_item_11', list(p
))
7219 # { PDisable*tmp = new PDisable(*p[2]);
7220 # FILE_NAME(tmp, @1);
7225 def p_statement_item_12(p
):
7226 '''statement_item : K_disable K_fork ';' '''
7227 if(parse_debug
): print('statement_item_12', list(p
))
7228 # { pform_name_t tmp_name;
7229 # PDisable*tmp = new PDisable(tmp_name);
7230 # FILE_NAME(tmp, @1);
7234 def p_statement_item_13(p
):
7235 '''statement_item : K_TRIGGER hierarchy_identifier ';' '''
7236 if(parse_debug
): print('statement_item_13', list(p
))
7237 # { PTrigger*tmp = new PTrigger(*p[2]);
7238 # FILE_NAME(tmp, @1);
7243 def p_statement_item_14(p
):
7244 '''statement_item : procedural_assertion_statement '''
7245 if(parse_debug
): print('statement_item_14', list(p
))
7248 def p_statement_item_15(p
):
7249 '''statement_item : loop_statement '''
7250 if(parse_debug
): print('statement_item_15', list(p
))
7253 def p_statement_item_16(p
):
7254 '''statement_item : jump_statement '''
7255 if(parse_debug
): print('statement_item_16', list(p
))
7258 def p_statement_item_17(p
):
7259 '''statement_item : K_case '(' expression ')' case_items K_endcase '''
7260 if(parse_debug
): print('statement_item_17', list(p
))
7261 # { PCase*tmp = new PCase(NetCase::EQ, p[3], p[5]);
7262 # FILE_NAME(tmp, @1);
7266 def p_statement_item_18(p
):
7267 '''statement_item : K_casex '(' expression ')' case_items K_endcase '''
7268 if(parse_debug
): print('statement_item_18', list(p
))
7269 # { PCase*tmp = new PCase(NetCase::EQX, p[3], p[5]);
7270 # FILE_NAME(tmp, @1);
7274 def p_statement_item_19(p
):
7275 '''statement_item : K_casez '(' expression ')' case_items K_endcase '''
7276 if(parse_debug
): print('statement_item_19', list(p
))
7277 # { PCase*tmp = new PCase(NetCase::EQZ, p[3], p[5]);
7278 # FILE_NAME(tmp, @1);
7282 def p_statement_item_20(p
):
7283 '''statement_item : K_case '(' expression ')' error K_endcase '''
7284 if(parse_debug
): print('statement_item_20', list(p
))
7287 def p_statement_item_21(p
):
7288 '''statement_item : K_casex '(' expression ')' error K_endcase '''
7289 if(parse_debug
): print('statement_item_21', list(p
))
7292 def p_statement_item_22(p
):
7293 '''statement_item : K_casez '(' expression ')' error K_endcase '''
7294 if(parse_debug
): print('statement_item_22', list(p
))
7297 def p_statement_item_23(p
):
7298 '''statement_item : K_if '(' expression ')' statement_or_null %prec less_than_K_else '''
7299 if(parse_debug
): print('statement_item_23', list(p
))
7300 # { PCondit*tmp = new PCondit(p[3], p[5], 0);
7301 # FILE_NAME(tmp, @1);
7305 def p_statement_item_24(p
):
7306 '''statement_item : K_if '(' expression ')' statement_or_null K_else statement_or_null '''
7307 if(parse_debug
): print('statement_item_24', list(p
))
7308 # { PCondit*tmp = new PCondit(p[3], p[5], p[7]);
7309 # FILE_NAME(tmp, @1);
7313 def p_statement_item_25(p
):
7314 '''statement_item : K_if '(' error ')' statement_or_null %prec less_than_K_else '''
7315 if(parse_debug
): print('statement_item_25', list(p
))
7316 # { yyerror(@1, "error: Malformed conditional expression.");
7320 def p_statement_item_26(p
):
7321 '''statement_item : K_if '(' error ')' statement_or_null K_else statement_or_null '''
7322 if(parse_debug
): print('statement_item_26', list(p
))
7323 # { yyerror(@1, "error: Malformed conditional expression.");
7327 def p_statement_item_27(p
):
7328 '''statement_item : compressed_statement ';' '''
7329 if(parse_debug
): print('statement_item_27', list(p
))
7332 def p_statement_item_28(p
):
7333 '''statement_item : inc_or_dec_expression ';' '''
7334 if(parse_debug
): print('statement_item_28', list(p
))
7335 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
7337 def p_statement_item_29(p
):
7338 '''statement_item : delay1 statement_or_null '''
7339 if(parse_debug
): print('statement_item_29', list(p
))
7340 # { PExpr*del = p[1]->front();
7341 # assert(p[1]->size() == 1);
7343 # PDelayStatement*tmp = new PDelayStatement(del, p[2]);
7344 # FILE_NAME(tmp, @1);
7348 def p_statement_item_30(p
):
7349 '''statement_item : event_control statement_or_null '''
7350 if(parse_debug
): print('statement_item_30', list(p
))
7351 # { PEventStatement*tmp = p[1];
7353 # yyerror(@1, "error: Invalid event control.");
7356 # tmp->set_statement(p[2]);
7361 def p_statement_item_31(p
):
7362 '''statement_item : '@' '*' statement_or_null '''
7363 if(parse_debug
): print('statement_item_31', list(p
))
7364 # { PEventStatement*tmp = new PEventStatement;
7365 # FILE_NAME(tmp, @1);
7366 # tmp->set_statement(p[3]);
7370 def p_statement_item_32(p
):
7371 '''statement_item : '@' '(' '*' ')' statement_or_null '''
7372 if(parse_debug
): print('statement_item_32', list(p
))
7373 # { PEventStatement*tmp = new PEventStatement;
7374 # FILE_NAME(tmp, @1);
7375 # tmp->set_statement(p[5]);
7379 def p_statement_item_33(p
):
7380 '''statement_item : lpvalue '=' expression ';' '''
7381 if(parse_debug
): print('statement_item33', list(p
))
7383 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), p
[3] ])
7384 if(parse_debug
): print ("expr TODO", repr(expr
))
7386 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), ])
7387 if(parse_debug
): print ("expr", repr(expr
))
7388 if(parse_debug
): print ("expr (python):'%s'" % expr
)
7390 # { PAssign*tmp = new PAssign(p[1],p[3]);
7391 # FILE_NAME(tmp, @1);
7395 def p_statement_item_34(p
):
7396 '''statement_item : error '=' expression ';' '''
7397 if(parse_debug
): print('statement_item_34', list(p
))
7398 # { yyerror(@2, "Syntax in assignment statement l-value.");
7403 def p_statement_item_35(p
):
7404 '''statement_item : lpvalue K_LE expression ';' '''
7405 if(parse_debug
): print('statement_item_35', list(p
))
7406 # { PAssignNB*tmp = new PAssignNB(p[1],p[3]);
7407 # FILE_NAME(tmp, @1);
7411 def p_statement_item_36(p
):
7412 '''statement_item : error K_LE expression ';' '''
7413 if(parse_debug
): print('statement_item_36', list(p
))
7414 # { yyerror(@2, "Syntax in assignment statement l-value.");
7419 def p_statement_item_37(p
):
7420 '''statement_item : lpvalue '=' delay1 expression ';' '''
7421 if(parse_debug
): print('statement_item_37', list(p
))
7422 # { PExpr*del = p[3]->front(); p[3]->pop_front();
7423 # assert(p[3]->empty());
7424 # PAssign*tmp = new PAssign(p[1],del,p[4]);
7425 # FILE_NAME(tmp, @1);
7429 def p_statement_item_38(p
):
7430 '''statement_item : lpvalue K_LE delay1 expression ';' '''
7431 if(parse_debug
): print('statement_item_38', list(p
))
7432 # { PExpr*del = p[3]->front(); p[3]->pop_front();
7433 # assert(p[3]->empty());
7434 # PAssignNB*tmp = new PAssignNB(p[1],del,p[4]);
7435 # FILE_NAME(tmp, @1);
7439 def p_statement_item_39(p
):
7440 '''statement_item : lpvalue '=' event_control expression ';' '''
7441 if(parse_debug
): print('statement_item_39', list(p
))
7442 # { PAssign*tmp = new PAssign(p[1],0,p[3],p[4]);
7443 # FILE_NAME(tmp, @1);
7447 def p_statement_item_40(p
):
7448 '''statement_item : lpvalue '=' K_repeat '(' expression ')' event_control expression ';' '''
7449 if(parse_debug
): print('statement_item_40', list(p
))
7450 # { PAssign*tmp = new PAssign(p[1],p[5],p[7],p[8]);
7451 # FILE_NAME(tmp,@1);
7452 # tmp->set_lineno(@1.first_line);
7456 def p_statement_item_41(p
):
7457 '''statement_item : lpvalue K_LE event_control expression ';' '''
7458 if(parse_debug
): print('statement_item_41', list(p
))
7459 # { PAssignNB*tmp = new PAssignNB(p[1],0,p[3],p[4]);
7460 # FILE_NAME(tmp, @1);
7464 def p_statement_item_42(p
):
7465 '''statement_item : lpvalue K_LE K_repeat '(' expression ')' event_control expression ';' '''
7466 if(parse_debug
): print('statement_item_42', list(p
))
7467 # { PAssignNB*tmp = new PAssignNB(p[1],p[5],p[7],p[8]);
7468 # FILE_NAME(tmp, @1);
7472 def p_statement_item_43(p
):
7473 '''statement_item : lpvalue '=' dynamic_array_new ';' '''
7474 if(parse_debug
): print('statement_item_43', list(p
))
7475 # { PAssign*tmp = new PAssign(p[1],p[3]);
7476 # FILE_NAME(tmp, @1);
7480 def p_statement_item_44(p
):
7481 '''statement_item : lpvalue '=' class_new ';' '''
7482 if(parse_debug
): print('statement_item_44', list(p
))
7483 # { PAssign*tmp = new PAssign(p[1],p[3]);
7484 # FILE_NAME(tmp, @1);
7488 def p_statement_item_45(p
):
7489 '''statement_item : K_wait '(' expression ')' statement_or_null '''
7490 if(parse_debug
): print('statement_item_45', list(p
))
7491 # { PEventStatement*tmp;
7492 # PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, p[3]);
7493 # tmp = new PEventStatement(etmp);
7494 # FILE_NAME(tmp,@1);
7495 # tmp->set_statement(p[5]);
7499 def p_statement_item_46(p
):
7500 '''statement_item : K_wait K_fork ';' '''
7501 if(parse_debug
): print('statement_item_46', list(p
))
7502 # { PEventStatement*tmp = new PEventStatement((PEEvent*)0);
7503 # FILE_NAME(tmp,@1);
7507 def p_statement_item_47(p
):
7508 '''statement_item : SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';' '''
7509 if(parse_debug
): print('statement_item_47', list(p
))
7510 # { PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), *p[3]);
7511 # FILE_NAME(tmp,@1);
7517 def p_statement_item_48(p
):
7518 '''statement_item : SYSTEM_IDENTIFIER ';' '''
7519 if(parse_debug
): print('statement_item_48', list(p
))
7521 # PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), pt);
7522 # FILE_NAME(tmp,@1);
7527 def p_statement_item_49(p
):
7528 '''statement_item : hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7529 if(parse_debug
): print('statement_item_49', list(p
))
7530 # { PCallTask*tmp = pform_make_call_task(@1, *p[1], *p[3]);
7536 def p_statement_item_50(p
):
7537 '''statement_item : hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';' '''
7538 if(parse_debug
): print('statement_item_50', list(p
))
7539 # { /* ....randomize with { <constraints> } */
7540 # if (p[1] && peek_tail_name(*p[1]) == "randomize") {
7541 # if (!gn_system_verilog())
7542 # yyerror(@2, "error: Randomize with constraint requires SystemVerilog.");
7544 # yyerror(@2, "sorry: Randomize with constraint not supported.");
7546 # yyerror(@2, "error: Constraint block can only be applied to randomize method.");
7549 # PCallTask*tmp = new PCallTask(*p[1], pt);
7550 # FILE_NAME(tmp, @1);
7555 def p_statement_item_51(p
):
7556 '''statement_item : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7557 if(parse_debug
): print('statement_item_51', list(p
))
7558 # { pform_name_t*t_name = p[1];
7559 # while (! p[3]->empty()) {
7560 # t_name->push_back(p[3]->front());
7561 # p[3]->pop_front();
7563 # PCallTask*tmp = new PCallTask(*t_name, *p[5]);
7564 # FILE_NAME(tmp, @1);
7571 def p_statement_item_52(p
):
7572 '''statement_item : hierarchy_identifier ';' '''
7573 if(parse_debug
): print('statement_item_52', list(p
))
7575 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
7580 def p_statement_item_53(p
):
7581 '''statement_item : implicit_class_handle '.' K_new '(' expression_list_with_nuls ')' ';' '''
7582 if(parse_debug
): print('statement_item_53', list(p
))
7583 # { PChainConstructor*tmp = new PChainConstructor(*p[5]);
7584 # FILE_NAME(tmp, @3);
7589 def p_statement_item_54(p
):
7590 '''statement_item : hierarchy_identifier '(' error ')' ';' '''
7591 if(parse_debug
): print('statement_item_54', list(p
))
7592 # { yyerror(@3, "error: Syntax error in task arguments.");
7594 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
7599 def p_statement_item_55(p
):
7600 '''statement_item : error ';' '''
7601 if(parse_debug
): print('statement_item_55', list(p
))
7602 # { yyerror(@2, "error: malformed statement");
7607 def p__embed0_statement_item(p
):
7608 '''_embed0_statement_item : '''
7609 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_SEQ);
7610 # FILE_NAME(tmp, @1);
7611 # current_block_stack.push(tmp);
7614 def p__embed1_statement_item(p
):
7615 '''_embed1_statement_item : '''
7617 # if (! gn_system_verilog()) {
7618 # yyerror("error: Variable declaration in unnamed block "
7619 # "requires SystemVerilog.");
7622 # /* If there are no declarations in the scope then just delete it. */
7623 # pform_pop_scope();
7624 # assert(! current_block_stack.empty());
7625 # PBlock*tmp = current_block_stack.top();
7626 # current_block_stack.pop();
7631 def p__embed2_statement_item(p
):
7632 '''_embed2_statement_item : '''
7633 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_SEQ);
7634 # FILE_NAME(tmp, @1);
7635 # current_block_stack.push(tmp);
7638 def p__embed3_statement_item(p
):
7639 '''_embed3_statement_item : '''
7640 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
7641 # FILE_NAME(tmp, @1);
7642 # current_block_stack.push(tmp);
7645 def p__embed4_statement_item(p
):
7646 '''_embed4_statement_item : '''
7648 # if (! gn_system_verilog()) {
7649 # yyerror("error: Variable declaration in unnamed block "
7650 # "requires SystemVerilog.");
7653 # /* If there are no declarations in the scope then just delete it. */
7654 # pform_pop_scope();
7655 # assert(! current_block_stack.empty());
7656 # PBlock*tmp = current_block_stack.top();
7657 # current_block_stack.pop();
7662 def p__embed5_statement_item(p
):
7663 '''_embed5_statement_item : '''
7664 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_PAR);
7665 # FILE_NAME(tmp, @1);
7666 # current_block_stack.push(tmp);
7669 def p_compressed_statement_1(p
):
7670 '''compressed_statement : lpvalue K_PLUS_EQ expression '''
7671 if(parse_debug
): print('compressed_statement_1', list(p
))
7672 # { PAssign*tmp = new PAssign(p[1], '+', p[3]);
7673 # FILE_NAME(tmp, @1);
7677 def p_compressed_statement_2(p
):
7678 '''compressed_statement : lpvalue K_MINUS_EQ expression '''
7679 if(parse_debug
): print('compressed_statement_2', list(p
))
7680 # { PAssign*tmp = new PAssign(p[1], '-', p[3]);
7681 # FILE_NAME(tmp, @1);
7685 def p_compressed_statement_3(p
):
7686 '''compressed_statement : lpvalue K_MUL_EQ expression '''
7687 if(parse_debug
): print('compressed_statement_3', list(p
))
7688 # { PAssign*tmp = new PAssign(p[1], '*', p[3]);
7689 # FILE_NAME(tmp, @1);
7693 def p_compressed_statement_4(p
):
7694 '''compressed_statement : lpvalue K_DIV_EQ expression '''
7695 if(parse_debug
): print('compressed_statement_4', list(p
))
7696 # { PAssign*tmp = new PAssign(p[1], '/', p[3]);
7697 # FILE_NAME(tmp, @1);
7701 def p_compressed_statement_5(p
):
7702 '''compressed_statement : lpvalue K_MOD_EQ expression '''
7703 if(parse_debug
): print('compressed_statement_5', list(p
))
7704 # { PAssign*tmp = new PAssign(p[1], '%', p[3]);
7705 # FILE_NAME(tmp, @1);
7709 def p_compressed_statement_6(p
):
7710 '''compressed_statement : lpvalue K_AND_EQ expression '''
7711 if(parse_debug
): print('compressed_statement_6', list(p
))
7712 # { PAssign*tmp = new PAssign(p[1], '&', p[3]);
7713 # FILE_NAME(tmp, @1);
7717 def p_compressed_statement_7(p
):
7718 '''compressed_statement : lpvalue K_OR_EQ expression '''
7719 if(parse_debug
): print('compressed_statement_7', list(p
))
7720 # { PAssign*tmp = new PAssign(p[1], '|', p[3]);
7721 # FILE_NAME(tmp, @1);
7725 def p_compressed_statement_8(p
):
7726 '''compressed_statement : lpvalue K_XOR_EQ expression '''
7727 if(parse_debug
): print('compressed_statement_8', list(p
))
7728 # { PAssign*tmp = new PAssign(p[1], '^', p[3]);
7729 # FILE_NAME(tmp, @1);
7733 def p_compressed_statement_9(p
):
7734 '''compressed_statement : lpvalue K_LS_EQ expression '''
7735 if(parse_debug
): print('compressed_statement_9', list(p
))
7736 # { PAssign *tmp = new PAssign(p[1], 'l', p[3]);
7737 # FILE_NAME(tmp, @1);
7741 def p_compressed_statement_10(p
):
7742 '''compressed_statement : lpvalue K_RS_EQ expression '''
7743 if(parse_debug
): print('compressed_statement_10', list(p
))
7744 # { PAssign*tmp = new PAssign(p[1], 'r', p[3]);
7745 # FILE_NAME(tmp, @1);
7749 def p_compressed_statement_11(p
):
7750 '''compressed_statement : lpvalue K_RSS_EQ expression '''
7751 if(parse_debug
): print('compressed_statement_11', list(p
))
7752 # { PAssign *tmp = new PAssign(p[1], 'R', p[3]);
7753 # FILE_NAME(tmp, @1);
7757 def p_statement_or_null_list_opt_1(p
):
7758 '''statement_or_null_list_opt : statement_or_null_list '''
7759 if(parse_debug
): print('statement_or_null_list_opt_1', list(p
))
7762 def p_statement_or_null_list_opt_2(p
):
7763 '''statement_or_null_list_opt : '''
7764 if(parse_debug
): print('statement_or_null_list_opt_2', list(p
))
7767 def p_statement_or_null_list_1(p
):
7768 '''statement_or_null_list : statement_or_null_list statement_or_null '''
7769 if(parse_debug
): print('statement_or_null_list_1', list(p
))
7770 # { vector<Statement*>*tmp = p[1];
7771 # if (p[2]) tmp->push_back(p[2]);
7775 def p_statement_or_null_list_2(p
):
7776 '''statement_or_null_list : statement_or_null '''
7777 if(parse_debug
): print('statement_or_null_list_2', list(p
))
7778 # { vector<Statement*>*tmp = new vector<Statement*>(0);
7779 # if (p[1]) tmp->push_back(p[1]);
7783 def p_analog_statement_1(p
):
7784 '''analog_statement : branch_probe_expression K_CONTRIBUTE expression ';' '''
7785 if(parse_debug
): print('analog_statement_1', list(p
))
7786 # { p[0] = pform_contribution_statement(@2, p[1], p[3]); }
7788 def p_task_item_1(p
):
7789 '''task_item : block_item_decl '''
7790 if(parse_debug
): print('task_item_1', list(p
))
7791 # { p[0] = new vector<pform_tf_port_t>(0); }
7793 def p_task_item_2(p
):
7794 '''task_item : tf_port_declaration '''
7795 if(parse_debug
): print('task_item_2', list(p
))
7798 def p_task_item_list_1(p
):
7799 '''task_item_list : task_item_list task_item '''
7800 if(parse_debug
): print('task_item_list_1', list(p
))
7801 # { vector<pform_tf_port_t>*tmp = p[1];
7802 # size_t s1 = tmp->size();
7803 # tmp->resize(s1 + p[2]->size());
7804 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
7805 # tmp->at(s1 + idx) = p[2]->at(idx);
7810 def p_task_item_list_2(p
):
7811 '''task_item_list : task_item '''
7812 if(parse_debug
): print('task_item_list_2', list(p
))
7815 def p_task_item_list_opt_1(p
):
7816 '''task_item_list_opt : task_item_list '''
7817 if(parse_debug
): print('task_item_list_opt_1', list(p
))
7820 def p_task_item_list_opt_2(p
):
7821 '''task_item_list_opt : '''
7822 if(parse_debug
): print('task_item_list_opt_2', list(p
))
7825 def p_tf_port_list_opt_1(p
):
7826 '''tf_port_list_opt : tf_port_list '''
7827 if(parse_debug
): print('tf_port_list_opt_1', list(p
))
7830 def p_tf_port_list_opt_2(p
):
7831 '''tf_port_list_opt : '''
7832 if(parse_debug
): print('tf_port_list_opt_2', list(p
))
7835 def p_udp_body_1(p
):
7836 '''udp_body : K_table udp_entry_list K_endtable '''
7837 if(parse_debug
): print('udp_body_1', list(p
))
7838 # { lex_end_table();
7842 def p_udp_body_2(p
):
7843 '''udp_body : K_table K_endtable '''
7844 if(parse_debug
): print('udp_body_2', list(p
))
7845 # { lex_end_table();
7846 # yyerror(@1, "error: Empty UDP table.");
7850 def p_udp_body_3(p
):
7851 '''udp_body : K_table error K_endtable '''
7852 if(parse_debug
): print('udp_body_3', list(p
))
7853 # { lex_end_table();
7854 # yyerror(@2, "Errors in UDP table");
7859 def p_udp_entry_list_1(p
):
7860 '''udp_entry_list : udp_comb_entry_list '''
7861 if(parse_debug
): print('udp_entry_list_1', list(p
))
7863 def p_udp_entry_list_2(p
):
7864 '''udp_entry_list : udp_sequ_entry_list '''
7865 if(parse_debug
): print('udp_entry_list_2', list(p
))
7867 def p_udp_comb_entry_1(p
):
7868 '''udp_comb_entry : udp_input_list ':' udp_output_sym ';' '''
7869 if(parse_debug
): print('udp_comb_entry_1', list(p
))
7870 # { char*tmp = new char[strlen(p[1])+3];
7871 # strcpy(tmp, p[1]);
7872 # char*tp = tmp+strlen(tmp);
7880 def p_udp_comb_entry_list_1(p
):
7881 '''udp_comb_entry_list : udp_comb_entry '''
7882 if(parse_debug
): print('udp_comb_entry_list_1', list(p
))
7883 # { list<string>*tmp = new list<string>;
7884 # tmp->push_back(p[1]);
7889 def p_udp_comb_entry_list_2(p
):
7890 '''udp_comb_entry_list : udp_comb_entry_list udp_comb_entry '''
7891 if(parse_debug
): print('udp_comb_entry_list_2', list(p
))
7892 # { list<string>*tmp = p[1];
7893 # tmp->push_back(p[2]);
7898 def p_udp_sequ_entry_list_1(p
):
7899 '''udp_sequ_entry_list : udp_sequ_entry '''
7900 if(parse_debug
): print('udp_sequ_entry_list_1', list(p
))
7901 # { list<string>*tmp = new list<string>;
7902 # tmp->push_back(p[1]);
7907 def p_udp_sequ_entry_list_2(p
):
7908 '''udp_sequ_entry_list : udp_sequ_entry_list udp_sequ_entry '''
7909 if(parse_debug
): print('udp_sequ_entry_list_2', list(p
))
7910 # { list<string>*tmp = p[1];
7911 # tmp->push_back(p[2]);
7916 def p_udp_sequ_entry_1(p
):
7917 '''udp_sequ_entry : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' '''
7918 if(parse_debug
): print('udp_sequ_entry_1', list(p
))
7919 # { char*tmp = new char[strlen(p[1])+5];
7920 # strcpy(tmp, p[1]);
7921 # char*tp = tmp+strlen(tmp);
7930 def p_udp_initial_1(p
):
7931 '''udp_initial : K_initial IDENTIFIER '=' number ';' '''
7932 if(parse_debug
): print('udp_initial_1', list(p
))
7933 # { PExpr*etmp = new PENumber(p[4]);
7934 # PEIdent*itmp = new PEIdent(lex_strings.make(p[2]));
7935 # PAssign*atmp = new PAssign(itmp, etmp);
7936 # FILE_NAME(atmp, @2);
7941 def p_udp_init_opt_1(p
):
7942 '''udp_init_opt : udp_initial '''
7943 if(parse_debug
): print('udp_init_opt_1', list(p
))
7946 def p_udp_init_opt_2(p
):
7947 '''udp_init_opt : '''
7948 if(parse_debug
): print('udp_init_opt_2', list(p
))
7951 def p_udp_input_list_1(p
):
7952 '''udp_input_list : udp_input_sym '''
7953 if(parse_debug
): print('udp_input_list_1', list(p
))
7954 # { char*tmp = new char[2];
7960 def p_udp_input_list_2(p
):
7961 '''udp_input_list : udp_input_list udp_input_sym '''
7962 if(parse_debug
): print('udp_input_list_2', list(p
))
7963 # { char*tmp = new char[strlen(p[1])+2];
7964 # strcpy(tmp, p[1]);
7965 # char*tp = tmp+strlen(tmp);
7972 def p_udp_input_sym_1(p
):
7973 '''udp_input_sym : '0' '''
7974 if(parse_debug
): print('udp_input_sym_1', list(p
))
7977 def p_udp_input_sym_2(p
):
7978 '''udp_input_sym : '1' '''
7979 if(parse_debug
): print('udp_input_sym_2', list(p
))
7982 def p_udp_input_sym_3(p
):
7983 '''udp_input_sym : 'x' '''
7984 if(parse_debug
): print('udp_input_sym_3', list(p
))
7987 def p_udp_input_sym_4(p
):
7988 '''udp_input_sym : '?' '''
7989 if(parse_debug
): print('udp_input_sym_4', list(p
))
7992 def p_udp_input_sym_5(p
):
7993 '''udp_input_sym : 'b' '''
7994 if(parse_debug
): print('udp_input_sym_5', list(p
))
7997 def p_udp_input_sym_6(p
):
7998 '''udp_input_sym : '*' '''
7999 if(parse_debug
): print('udp_input_sym_6', list(p
))
8002 def p_udp_input_sym_7(p
):
8003 '''udp_input_sym : '%' '''
8004 if(parse_debug
): print('udp_input_sym_7', list(p
))
8007 def p_udp_input_sym_8(p
):
8008 '''udp_input_sym : 'f' '''
8009 if(parse_debug
): print('udp_input_sym_8', list(p
))
8012 def p_udp_input_sym_9(p
):
8013 '''udp_input_sym : 'F' '''
8014 if(parse_debug
): print('udp_input_sym_9', list(p
))
8017 def p_udp_input_sym_10(p
):
8018 '''udp_input_sym : 'l' '''
8019 if(parse_debug
): print('udp_input_sym_10', list(p
))
8022 def p_udp_input_sym_11(p
):
8023 '''udp_input_sym : 'h' '''
8024 if(parse_debug
): print('udp_input_sym_11', list(p
))
8027 def p_udp_input_sym_12(p
):
8028 '''udp_input_sym : 'B' '''
8029 if(parse_debug
): print('udp_input_sym_12', list(p
))
8032 def p_udp_input_sym_13(p
):
8033 '''udp_input_sym : 'r' '''
8034 if(parse_debug
): print('udp_input_sym_13', list(p
))
8037 def p_udp_input_sym_14(p
):
8038 '''udp_input_sym : 'R' '''
8039 if(parse_debug
): print('udp_input_sym_14', list(p
))
8042 def p_udp_input_sym_15(p
):
8043 '''udp_input_sym : 'M' '''
8044 if(parse_debug
): print('udp_input_sym_15', list(p
))
8047 def p_udp_input_sym_16(p
):
8048 '''udp_input_sym : 'n' '''
8049 if(parse_debug
): print('udp_input_sym_16', list(p
))
8052 def p_udp_input_sym_17(p
):
8053 '''udp_input_sym : 'N' '''
8054 if(parse_debug
): print('udp_input_sym_17', list(p
))
8057 def p_udp_input_sym_18(p
):
8058 '''udp_input_sym : 'p' '''
8059 if(parse_debug
): print('udp_input_sym_18', list(p
))
8062 def p_udp_input_sym_19(p
):
8063 '''udp_input_sym : 'P' '''
8064 if(parse_debug
): print('udp_input_sym_19', list(p
))
8067 def p_udp_input_sym_20(p
):
8068 '''udp_input_sym : 'Q' '''
8069 if(parse_debug
): print('udp_input_sym_20', list(p
))
8072 def p_udp_input_sym_21(p
):
8073 '''udp_input_sym : 'q' '''
8074 if(parse_debug
): print('udp_input_sym_21', list(p
))
8077 def p_udp_input_sym_22(p
):
8078 '''udp_input_sym : '_' '''
8079 if(parse_debug
): print('udp_input_sym_22', list(p
))
8082 def p_udp_input_sym_23(p
):
8083 '''udp_input_sym : '+' '''
8084 if(parse_debug
): print('udp_input_sym_23', list(p
))
8087 def p_udp_input_sym_24(p
):
8088 '''udp_input_sym : DEC_NUMBER '''
8089 if(parse_debug
): print('udp_input_sym_24', list(p
))
8090 # { yyerror(@1, "internal error: Input digits parse as decimal number!"); p[0] = '0'; }
8092 def p_udp_output_sym_1(p
):
8093 '''udp_output_sym : '0' '''
8094 if(parse_debug
): print('udp_output_sym_1', list(p
))
8097 def p_udp_output_sym_2(p
):
8098 '''udp_output_sym : '1' '''
8099 if(parse_debug
): print('udp_output_sym_2', list(p
))
8102 def p_udp_output_sym_3(p
):
8103 '''udp_output_sym : 'x' '''
8104 if(parse_debug
): print('udp_output_sym_3', list(p
))
8107 def p_udp_output_sym_4(p
):
8108 '''udp_output_sym : '-' '''
8109 if(parse_debug
): print('udp_output_sym_4', list(p
))
8112 def p_udp_output_sym_5(p
):
8113 '''udp_output_sym : DEC_NUMBER '''
8114 if(parse_debug
): print('udp_output_sym_5', list(p
))
8115 # { yyerror(@1, "internal error: Output digits parse as decimal number!"); p[0] = '0'; }
8117 def p_udp_port_decl_1(p
):
8118 '''udp_port_decl : K_input list_of_identifiers ';' '''
8119 if(parse_debug
): print('udp_port_decl_1', list(p
))
8120 # { p[0] = pform_make_udp_input_ports(p[2]); }
8122 def p_udp_port_decl_2(p
):
8123 '''udp_port_decl : K_output IDENTIFIER ';' '''
8124 if(parse_debug
): print('udp_port_decl_2', list(p
))
8125 # { perm_string pname = lex_strings.make(p[2]);
8126 # PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
8127 # vector<PWire*>*tmp = new vector<PWire*>(1);
8133 def p_udp_port_decl_3(p
):
8134 '''udp_port_decl : K_reg IDENTIFIER ';' '''
8135 if(parse_debug
): print('udp_port_decl_3', list(p
))
8136 # { perm_string pname = lex_strings.make(p[2]);
8137 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
8138 # vector<PWire*>*tmp = new vector<PWire*>(1);
8144 def p_udp_port_decl_4(p
):
8145 '''udp_port_decl : K_reg K_output IDENTIFIER ';' '''
8146 if(parse_debug
): print('udp_port_decl_4', list(p
))
8147 # { perm_string pname = lex_strings.make(p[3]);
8148 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
8149 # vector<PWire*>*tmp = new vector<PWire*>(1);
8155 def p_udp_port_decls_1(p
):
8156 '''udp_port_decls : udp_port_decl '''
8157 if(parse_debug
): print('udp_port_decls_1', list(p
))
8160 def p_udp_port_decls_2(p
):
8161 '''udp_port_decls : udp_port_decls udp_port_decl '''
8162 if(parse_debug
): print('udp_port_decls_2', list(p
))
8163 # { vector<PWire*>*tmp = p[1];
8164 # size_t s1 = p[1]->size();
8165 # tmp->resize(s1+p[2]->size());
8166 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
8167 # tmp->at(s1+idx) = p[2]->at(idx);
8172 def p_udp_port_list_1(p
):
8173 '''udp_port_list : IDENTIFIER '''
8174 if(parse_debug
): print('udp_port_list_1', list(p
))
8175 # { list<perm_string>*tmp = new list<perm_string>;
8176 # tmp->push_back(lex_strings.make(p[1]));
8181 def p_udp_port_list_2(p
):
8182 '''udp_port_list : udp_port_list ',' IDENTIFIER '''
8183 if(parse_debug
): print('udp_port_list_2', list(p
))
8184 # { list<perm_string>*tmp = p[1];
8185 # tmp->push_back(lex_strings.make(p[3]));
8190 def p_udp_reg_opt_1(p
):
8191 '''udp_reg_opt : K_reg '''
8192 if(parse_debug
): print('udp_reg_opt_1', list(p
))
8195 def p_udp_reg_opt_2(p
):
8196 '''udp_reg_opt : '''
8197 if(parse_debug
): print('udp_reg_opt_2', list(p
))
8200 def p_udp_initial_expr_opt_1(p
):
8201 '''udp_initial_expr_opt : '=' expression '''
8202 if(parse_debug
): print('udp_initial_expr_opt_1', list(p
))
8205 def p_udp_initial_expr_opt_2(p
):
8206 '''udp_initial_expr_opt : '''
8207 if(parse_debug
): print('udp_initial_expr_opt_2', list(p
))
8210 def p_udp_input_declaration_list_1(p
):
8211 '''udp_input_declaration_list : K_input IDENTIFIER '''
8212 if(parse_debug
): print('udp_input_declaration_list_1', list(p
))
8213 # { list<perm_string>*tmp = new list<perm_string>;
8214 # tmp->push_back(lex_strings.make(p[2]));
8219 def p_udp_input_declaration_list_2(p
):
8220 '''udp_input_declaration_list : udp_input_declaration_list ',' K_input IDENTIFIER '''
8221 if(parse_debug
): print('udp_input_declaration_list_2', list(p
))
8222 # { list<perm_string>*tmp = p[1];
8223 # tmp->push_back(lex_strings.make(p[4]));
8228 def p_udp_primitive_1(p
):
8229 '''udp_primitive : K_primitive IDENTIFIER '(' udp_port_list ')' ';' udp_port_decls udp_init_opt udp_body K_endprimitive endlabel_opt '''
8230 if(parse_debug
): print('udp_primitive_1', list(p
))
8231 # { perm_string tmp2 = lex_strings.make(p[2]);
8232 # pform_make_udp(tmp2, p[4], p[7], p[9], p[8],
8233 # @2.text, @2.first_line);
8235 # if (strcmp(p[2],p[11]) != 0) {
8236 # yyerror(@11, "error: End label doesn't match "
8237 # "primitive name");
8239 # if (! gn_system_verilog()) {
8240 # yyerror(@11, "error: Primitive end labels "
8241 # "require SystemVerilog.");
8248 def p_udp_primitive_2(p
):
8249 '''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 '''
8250 if(parse_debug
): print('udp_primitive_2', list(p
))
8251 # { perm_string tmp2 = lex_strings.make(p[2]);
8252 # perm_string tmp6 = lex_strings.make(p[6]);
8253 # pform_make_udp(tmp2, p[5], tmp6, p[7], p[9], p[12],
8254 # @2.text, @2.first_line);
8256 # if (strcmp(p[2],p[14]) != 0) {
8257 # yyerror(@14, "error: End label doesn't match "
8258 # "primitive name");
8260 # if (! gn_system_verilog()) {
8261 # yyerror(@14, "error: Primitive end labels "
8262 # "require SystemVerilog.");
8270 def p_K_packed_opt_1(p
):
8271 '''K_packed_opt : K_packed '''
8272 if(parse_debug
): print('K_packed_opt', list(p
))
8275 def p_K_packed_opt_2(p
):
8276 '''K_packed_opt : '''
8277 if(parse_debug
): print('K_packed_opt', list(p
))
8280 def p_K_reg_opt_1(p
):
8281 '''K_reg_opt : K_reg '''
8282 if(parse_debug
): print('K_reg_opt', list(p
))
8285 def p_K_reg_opt_2(p
):
8287 if(parse_debug
): print('K_reg_opt', list(p
))
8290 def p_K_static_opt_1(p
):
8291 '''K_static_opt : K_static '''
8292 if(parse_debug
): print('K_static_opt', list(p
))
8295 def p_K_static_opt_2(p
):
8296 '''K_static_opt : '''
8297 if(parse_debug
): print('K_static_opt', list(p
))
8301 def p_K_virtual_opt_1(p
):
8302 '''K_virtual_opt : K_virtual '''
8303 if(parse_debug
): print(p
)
8306 def p_K_virtual_opt_2(p
):
8307 '''K_virtual_opt : '''
8308 if(parse_debug
): print(p
)
8313 if(parse_debug
): print ("error", p
)