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'
109 for p
in st
.split('\n'):
110 res
.append(' ' * i
+ "#"+p
)
111 return '\n'.join(res
)
115 def __init__(self
, typ
, signed
):
119 def port_decl(comment
, dt
, name
):
120 if dt
is None or dt
.dims
is None:
121 width
= '' # width: 1
124 # XXX TODO, better checking, should be using data structure... *sigh*
125 width
= width
[1:-1] # strip brackets
126 width
= width
.split(':')
127 assert width
[0] == '0'
129 return 'self.%s = Signal(%s) # %s' % (name
, width
, comment
)
131 # -------------- RULES ----------------
133 def p_source_text_1(p
):
134 '''source_text : timeunits_declaration_opt _embed0_source_text description_list '''
135 if(parse_debug
>2): print('source_text', list(p
))
137 def p_source_text_2(p
):
139 if(parse_debug
): print('source_text', list(p
))
141 def p__embed0_source_text(p
):
142 '''_embed0_source_text : '''
143 # { pform_set_scope_timescale(yyloc); }
145 def p_assertion_item_1(p
):
146 '''assertion_item : concurrent_assertion_item '''
147 if(parse_debug
): print('assertion_item_1', list(p
))
149 def p_assignment_pattern_1(p
):
150 '''assignment_pattern : K_LP expression_list_proper '}' '''
151 if(parse_debug
): print('assignment_pattern_1', list(p
))
152 # { PEAssignPattern*tmp = new PEAssignPattern(*p[2]);
153 # FILE_NAME(tmp, @1);
158 def p_assignment_pattern_2(p
):
159 '''assignment_pattern : K_LP '}' '''
160 if(parse_debug
): print('assignment_pattern_2', list(p
))
161 # { PEAssignPattern*tmp = new PEAssignPattern;
162 # FILE_NAME(tmp, @1);
166 def p_block_identifier_opt_1(p
):
167 '''block_identifier_opt : IDENTIFIER ':' '''
168 if(parse_debug
): print('block_identifier_opt_1', list(p
))
170 def p_block_identifier_opt_2(p
):
171 '''block_identifier_opt : '''
172 if(parse_debug
): print('block_identifier_opt_2', list(p
))
174 def p_class_declaration_1(p
):
175 '''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 '''
176 if(parse_debug
): print('class_declaration_1', list(p
))
177 # { // Wrap up the class.
178 # if (p[11] && p[4] && p[4]->name != p[11]) {
179 # yyerror(@11, "error: Class end label doesn't match class name.");
184 def p__embed0_class_declaration(p
):
185 '''_embed0_class_declaration : '''
186 # { pform_start_class_declaration(@2, p[4], p[5].type, p[5].exprs, p[3]); }
188 def p__embed1_class_declaration(p
):
189 '''_embed1_class_declaration : '''
190 # { // Process a class.
191 # pform_end_class_declaration(@9);
194 def p_class_constraint_1(p
):
195 '''class_constraint : constraint_prototype '''
196 if(parse_debug
): print('class_constraint_1', list(p
))
198 def p_class_constraint_2(p
):
199 '''class_constraint : constraint_declaration '''
200 if(parse_debug
): print('class_constraint_2', list(p
))
202 def p_class_identifier_1(p
):
203 '''class_identifier : IDENTIFIER '''
204 if(parse_debug
): print('class_identifier_1', list(p
))
205 # { // Create a synthetic typedef for the class name so that the
206 # // lexor detects the name as a type.
207 # perm_string name = lex_strings.make(p[1]);
208 # class_type_t*tmp = new class_type_t(name);
209 # FILE_NAME(tmp, @1);
210 # pform_set_typedef(name, tmp, NULL);
215 def p_class_identifier_2(p
):
216 '''class_identifier : TYPE_IDENTIFIER '''
217 if(parse_debug
): print('class_identifier_2', list(p
))
218 # { class_type_t*tmp = dynamic_cast<class_type_t*>(p[1].type);
220 # yyerror(@1, "Type name \"%s\"is not a predeclared class name.", p[1].text);
226 def p_class_declaration_endlabel_opt_1(p
):
227 '''class_declaration_endlabel_opt : ':' TYPE_IDENTIFIER '''
228 if(parse_debug
): print('class_declaration_endlabel_opt_1', list(p
))
229 # { class_type_t*tmp = dynamic_cast<class_type_t*> (p[2].type);
231 # yyerror(@2, "error: class declaration endlabel \"%s\" is not a class name\n", p[2].text);
234 # p[0] = strdupnew(tmp->name.str());
239 def p_class_declaration_endlabel_opt_2(p
):
240 '''class_declaration_endlabel_opt : ':' IDENTIFIER '''
241 if(parse_debug
): print('class_declaration_endlabel_opt_2', list(p
))
244 def p_class_declaration_endlabel_opt_3(p
):
245 '''class_declaration_endlabel_opt : '''
246 if(parse_debug
): print('class_declaration_endlabel_opt_3', list(p
))
249 def p_class_declaration_extends_opt_1(p
):
250 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '''
251 if(parse_debug
): print('class_declaration_extends_opt_1', list(p
))
252 # { p[0].type = p[2].type;
257 def p_class_declaration_extends_opt_2(p
):
258 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '(' expression_list_with_nuls ')' '''
259 if(parse_debug
): print('class_declaration_extends_opt_2', list(p
))
260 # { p[0].type = p[2].type;
265 def p_class_declaration_extends_opt_3(p
):
266 '''class_declaration_extends_opt : '''
267 if(parse_debug
): print('class_declaration_extends_opt_3', list(p
))
268 # { p[0].type = 0; p[0].exprs = 0; }
270 def p_class_items_opt_1(p
):
271 '''class_items_opt : class_items '''
272 if(parse_debug
): print('class_items_opt_1', list(p
))
274 def p_class_items_opt_2(p
):
275 '''class_items_opt : '''
276 if(parse_debug
): print('class_items_opt_2', list(p
))
278 def p_class_items_1(p
):
279 '''class_items : class_items class_item '''
280 if(parse_debug
): print('class_items_1', list(p
))
282 def p_class_items_2(p
):
283 '''class_items : class_item '''
284 if(parse_debug
): print('class_items_2', list(p
))
286 def p_class_item_1(p
):
287 '''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 '''
288 if(parse_debug
): print('class_item_1', list(p
))
289 # { current_function->set_ports(p[6]);
290 # pform_set_constructor_return(current_function);
291 # pform_set_this_class(@3, current_function);
292 # current_function_set_statement(@3, p[10]);
294 # current_function = 0;
297 def p_class_item_2(p
):
298 '''class_item : property_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
299 if(parse_debug
): print('class_item_2', list(p
))
300 # { pform_class_property(@2, p[1], p[2], p[3]); }
302 def p_class_item_3(p
):
303 '''class_item : K_const class_item_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
304 if(parse_debug
): print('class_item_3', list(p
))
305 # { pform_class_property(@1, p[2] | property_qualifier_t::make_const(), p[3], p[4]); }
307 def p_class_item_4(p
):
308 '''class_item : method_qualifier_opt task_declaration '''
309 if(parse_debug
): print('class_item_4', list(p
))
310 # { /* The task_declaration rule puts this into the class */ }
312 def p_class_item_5(p
):
313 '''class_item : method_qualifier_opt function_declaration '''
314 if(parse_debug
): print('class_item_5', list(p
))
315 # { /* The function_declaration rule puts this into the class */ }
317 def p_class_item_6(p
):
318 '''class_item : K_extern method_qualifier_opt K_function K_new ';' '''
319 if(parse_debug
): print('class_item_6', list(p
))
320 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
322 def p_class_item_7(p
):
323 '''class_item : K_extern method_qualifier_opt K_function K_new '(' tf_port_list_opt ')' ';' '''
324 if(parse_debug
): print('class_item_7', list(p
))
325 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
327 def p_class_item_8(p
):
328 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER ';' '''
329 if(parse_debug
): print('class_item_8', list(p
))
330 # { yyerror(@1, "sorry: External methods are not yet supported.");
334 def p_class_item_9(p
):
335 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' ';' '''
336 if(parse_debug
): print('class_item_9', list(p
))
337 # { yyerror(@1, "sorry: External methods are not yet supported.");
341 def p_class_item_10(p
):
342 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER ';' '''
343 if(parse_debug
): print('class_item_10', list(p
))
344 # { yyerror(@1, "sorry: External methods are not yet supported.");
348 def p_class_item_11(p
):
349 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER '(' tf_port_list_opt ')' ';' '''
350 if(parse_debug
): print('class_item_11', list(p
))
351 # { yyerror(@1, "sorry: External methods are not yet supported.");
355 def p_class_item_12(p
):
356 '''class_item : class_constraint '''
357 if(parse_debug
): print('class_item_12', list(p
))
359 def p_class_item_13(p
):
360 '''class_item : property_qualifier_opt data_type error ';' '''
361 if(parse_debug
): print('class_item_13', list(p
))
362 # { yyerror(@3, "error: Errors in variable names after data type.");
366 def p_class_item_14(p
):
367 '''class_item : property_qualifier_opt IDENTIFIER error ';' '''
368 if(parse_debug
): print('class_item_14', list(p
))
369 # { yyerror(@3, "error: %s doesn't name a type.", p[2]);
373 def p_class_item_15(p
):
374 '''class_item : method_qualifier_opt K_function K_new error K_endfunction endnew_opt '''
375 if(parse_debug
): print('class_item_15', list(p
))
376 # { yyerror(@1, "error: I give up on this class constructor declaration.");
380 def p_class_item_16(p
):
381 '''class_item : error ';' '''
382 if(parse_debug
): print('class_item_16', list(p
))
383 # { yyerror(@2, "error: invalid class item.");
387 def p__embed0_class_item(p
):
388 '''_embed0_class_item : '''
389 # { assert(current_function==0);
390 # current_function = pform_push_constructor_scope(@3);
393 def p_class_item_qualifier_1(p
):
394 '''class_item_qualifier : K_static '''
395 if(parse_debug
): print('class_item_qualifier_1', list(p
))
396 # { p[0] = property_qualifier_t::make_static(); }
398 def p_class_item_qualifier_2(p
):
399 '''class_item_qualifier : K_protected '''
400 if(parse_debug
): print('class_item_qualifier_2', list(p
))
401 # { p[0] = property_qualifier_t::make_protected(); }
403 def p_class_item_qualifier_3(p
):
404 '''class_item_qualifier : K_local '''
405 if(parse_debug
): print('class_item_qualifier_3', list(p
))
406 # { p[0] = property_qualifier_t::make_local(); }
408 def p_class_item_qualifier_list_1(p
):
409 '''class_item_qualifier_list : class_item_qualifier_list class_item_qualifier '''
410 if(parse_debug
): print('class_item_qualifier_list_1', list(p
))
411 # { p[0] = p[1] | p[2]; }
413 def p_class_item_qualifier_list_2(p
):
414 '''class_item_qualifier_list : class_item_qualifier '''
415 if(parse_debug
): print('class_item_qualifier_list_2', list(p
))
418 def p_class_item_qualifier_opt_1(p
):
419 '''class_item_qualifier_opt : class_item_qualifier_list '''
420 if(parse_debug
): print('class_item_qualifier_opt_1', list(p
))
423 def p_class_item_qualifier_opt_2(p
):
424 '''class_item_qualifier_opt : '''
425 if(parse_debug
): print('class_item_qualifier_opt_2', list(p
))
426 # { p[0] = property_qualifier_t::make_none(); }
428 def p_class_new_1(p
):
429 '''class_new : K_new '(' expression_list_with_nuls ')' '''
430 if(parse_debug
): print('class_new_1', list(p
))
431 # { list<PExpr*>*expr_list = p[3];
432 # strip_tail_items(expr_list);
433 # PENewClass*tmp = new PENewClass(*expr_list);
434 # FILE_NAME(tmp, @1);
439 def p_class_new_2(p
):
440 '''class_new : K_new hierarchy_identifier '''
441 if(parse_debug
): print('class_new_2', list(p
))
442 # { PEIdent*tmpi = new PEIdent(*p[2]);
443 # FILE_NAME(tmpi, @2);
444 # PENewCopy*tmp = new PENewCopy(tmpi);
445 # FILE_NAME(tmp, @1);
450 def p_class_new_3(p
):
451 '''class_new : K_new '''
452 if(parse_debug
): print('class_new_3', list(p
))
453 # { PENewClass*tmp = new PENewClass;
454 # FILE_NAME(tmp, @1);
458 def p_concurrent_assertion_item_1(p
):
459 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' property_spec ')' statement_or_null '''
460 if(parse_debug
): print('concurrent_assertion_item_1', list(p
))
462 # if (gn_assertions_flag) {
463 # yyerror(@2, "sorry: concurrent_assertion_item not supported."
464 # " Try -gno-assertion to turn this message off.");
468 def p_concurrent_assertion_item_2(p
):
469 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' error ')' statement_or_null '''
470 if(parse_debug
): print('concurrent_assertion_item_2', list(p
))
472 # yyerror(@2, "error: Error in property_spec of concurrent assertion item.");
475 def p_constraint_block_item_1(p
):
476 '''constraint_block_item : constraint_expression '''
477 if(parse_debug
): print('constraint_block_item_1', list(p
))
479 def p_constraint_block_item_list_1(p
):
480 '''constraint_block_item_list : constraint_block_item_list constraint_block_item '''
481 if(parse_debug
): print('constraint_block_item_list_1', list(p
))
483 def p_constraint_block_item_list_2(p
):
484 '''constraint_block_item_list : constraint_block_item '''
485 if(parse_debug
): print('constraint_block_item_list_2', list(p
))
487 def p_constraint_block_item_list_opt_1(p
):
488 '''constraint_block_item_list_opt : '''
489 if(parse_debug
): print('constraint_block_item_list_opt_1', list(p
))
491 def p_constraint_block_item_list_opt_2(p
):
492 '''constraint_block_item_list_opt : constraint_block_item_list '''
493 if(parse_debug
): print('constraint_block_item_list_opt_2', list(p
))
495 def p_constraint_declaration_1(p
):
496 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' constraint_block_item_list_opt '}' '''
497 if(parse_debug
): print('constraint_declaration_1', list(p
))
498 # { yyerror(@2, "sorry: Constraint declarations not supported."); }
500 def p_constraint_declaration_2(p
):
501 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' error '}' '''
502 if(parse_debug
): print('constraint_declaration_2', list(p
))
503 # { yyerror(@4, "error: Errors in the constraint block item list."); }
505 def p_constraint_expression_1(p
):
506 '''constraint_expression : expression ';' '''
507 if(parse_debug
): print('constraint_expression_1', list(p
))
509 def p_constraint_expression_2(p
):
510 '''constraint_expression : expression K_dist '{' '}' ';' '''
511 if(parse_debug
): print('constraint_expression_2', list(p
))
513 def p_constraint_expression_3(p
):
514 '''constraint_expression : expression K_TRIGGER constraint_set '''
515 if(parse_debug
): print('constraint_expression_3', list(p
))
517 def p_constraint_expression_4(p
):
518 '''constraint_expression : K_if '(' expression ')' constraint_set %prec less_than_K_else '''
519 if(parse_debug
): print('constraint_expression_4', list(p
))
521 def p_constraint_expression_5(p
):
522 '''constraint_expression : K_if '(' expression ')' constraint_set K_else constraint_set '''
523 if(parse_debug
): print('constraint_expression_5', list(p
))
525 def p_constraint_expression_6(p
):
526 '''constraint_expression : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' constraint_set '''
527 if(parse_debug
): print('constraint_expression_6', list(p
))
529 def p_constraint_expression_list_1(p
):
530 '''constraint_expression_list : constraint_expression_list constraint_expression '''
531 if(parse_debug
): print('constraint_expression_list_1', list(p
))
533 def p_constraint_expression_list_2(p
):
534 '''constraint_expression_list : constraint_expression '''
535 if(parse_debug
): print('constraint_expression_list_2', list(p
))
537 def p_constraint_prototype_1(p
):
538 '''constraint_prototype : K_static_opt K_constraint IDENTIFIER ';' '''
539 if(parse_debug
): print('constraint_prototype_1', list(p
))
540 # { yyerror(@2, "sorry: Constraint prototypes not supported."); }
542 def p_constraint_set_1(p
):
543 '''constraint_set : constraint_expression '''
544 if(parse_debug
): print('constraint_set_1', list(p
))
546 def p_constraint_set_2(p
):
547 '''constraint_set : '{' constraint_expression_list '}' '''
548 if(parse_debug
): print('constraint_set_2', list(p
))
550 def p_data_declaration_1(p
):
551 '''data_declaration : attribute_list_opt data_type_or_implicit list_of_variable_decl_assignments ';' '''
552 if(parse_debug
): print('data_declaration_1', list(p
))
553 # { data_type_t*data_type = p[2];
554 # if (data_type == 0) {
555 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
556 # FILE_NAME(data_type, @2);
558 # pform_makewire(@2, 0, str_strength, p[3], NetNet::IMPLICIT_REG, data_type);
561 def p_data_type_1(p
):
562 '''data_type : integer_vector_type unsigned_signed_opt dimensions_opt '''
563 if(parse_debug
): print('data_type_1', list(p
))
566 if (use_vtype
== IVL_VT_NO_TYPE
):
567 use_vtype
= IVL_VT_LOGIC
569 dt
= DataType(use_vtype
, signed
=p
[2])
571 dt
.reg_flag
= reg_flag
573 # { ivl_variable_type_t use_vtype = p[1];
574 # bool reg_flag = false;
575 # if (use_vtype == IVL_VT_NO_TYPE) {
576 # use_vtype = IVL_VT_LOGIC;
579 # vector_type_t*tmp = new vector_type_t(use_vtype, p[2], p[3]);
580 # tmp->reg_flag = reg_flag;
581 # FILE_NAME(tmp, @1);
585 def p_data_type_2(p
):
586 '''data_type : non_integer_type '''
587 if(parse_debug
): print('data_type_2', list(p
))
589 # { real_type_t*tmp = new real_type_t(p[1]);
590 # FILE_NAME(tmp, @1);
594 def p_data_type_3(p
):
595 '''data_type : struct_data_type '''
596 if(parse_debug
): print('data_type_3', list(p
))
598 # { if (!p[1]->packed_flag) {
599 # yyerror(@1, "sorry: Unpacked structs not supported.");
604 def p_data_type_4(p
):
605 '''data_type : enum_data_type '''
606 if(parse_debug
): print('data_type_4', list(p
))
609 def p_data_type_5(p
):
610 '''data_type : atom2_type signed_unsigned_opt '''
611 if(parse_debug
): print('data_type_5', list(p
))
612 # { atom2_type_t*tmp = new atom2_type_t(p[1], p[2]);
613 # FILE_NAME(tmp, @1);
617 def p_data_type_6(p
):
618 '''data_type : K_integer signed_unsigned_opt '''
619 if(parse_debug
): print('data_type_6', list(p
))
620 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
621 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, p[2], pd);
622 # tmp->reg_flag = true;
623 # tmp->integer_flag = true;
627 def p_data_type_7(p
):
628 '''data_type : K_time '''
629 if(parse_debug
): print('data_type_7', list(p
))
630 # { list<pform_range_t>*pd = make_range_from_width(64);
631 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
632 # tmp->reg_flag = !gn_system_verilog();
636 def p_data_type_8(p
):
637 '''data_type : TYPE_IDENTIFIER dimensions_opt '''
638 if(parse_debug
): print('data_type_8', list(p
))
640 # parray_type_t*tmp = new parray_type_t(p[1].type, p[2]);
641 # FILE_NAME(tmp, @1);
643 # } else p[0] = p[1].type;
647 def p_data_type_9(p
):
648 '''data_type : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_data_type TYPE_IDENTIFIER '''
649 if(parse_debug
): print('data_type_9', list(p
))
650 # { lex_in_package_scope(0);
655 def p_data_type_10(p
):
656 '''data_type : K_string '''
657 if(parse_debug
): print('data_type_10', list(p
))
658 # { string_type_t*tmp = new string_type_t;
659 # FILE_NAME(tmp, @1);
663 def p__embed0_data_type(p
):
664 '''_embed0_data_type : '''
665 # { lex_in_package_scope(p[1]); }
667 def p_data_type_or_implicit_1(p
):
668 '''data_type_or_implicit : data_type '''
669 if(parse_debug
): print('data_type_or_implicit_1', list(p
))
672 def p_data_type_or_implicit_2(p
):
673 '''data_type_or_implicit : signing dimensions_opt '''
674 if(parse_debug
): print('data_type_or_implicit_2', list(p
))
675 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, p[1], p[2]);
676 # tmp->implicit_flag = true;
677 # FILE_NAME(tmp, @1);
681 def p_data_type_or_implicit_3(p
):
682 '''data_type_or_implicit : dimensions '''
683 if(parse_debug
): print('data_type_or_implicit_3', list(p
))
684 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, p[1]);
685 # tmp->implicit_flag = true;
686 # FILE_NAME(tmp, @1);
690 def p_data_type_or_implicit_4(p
):
691 '''data_type_or_implicit : '''
692 if(parse_debug
>2): print('data_type_or_implicit_4', list(p
))
695 def p_data_type_or_implicit_or_void_1(p
):
696 '''data_type_or_implicit_or_void : data_type_or_implicit '''
697 if(parse_debug
): print('data_type_or_implicit_or_void_1', list(p
))
700 def p_data_type_or_implicit_or_void_2(p
):
701 '''data_type_or_implicit_or_void : K_void '''
702 if(parse_debug
): print('data_type_or_implicit_or_void_2', list(p
))
703 # { void_type_t*tmp = new void_type_t;
704 # FILE_NAME(tmp, @1);
708 def p_description_1(p
):
709 '''description : module '''
710 if(parse_debug
>2): print('description_1', list(p
))
712 def p_description_2(p
):
713 '''description : udp_primitive '''
714 if(parse_debug
): print('description_2', list(p
))
716 def p_description_3(p
):
717 '''description : config_declaration '''
718 if(parse_debug
): print('description_3', list(p
))
720 def p_description_4(p
):
721 '''description : nature_declaration '''
722 if(parse_debug
): print('description_4', list(p
))
724 def p_description_5(p
):
725 '''description : package_declaration '''
726 if(parse_debug
): print('description_5', list(p
))
728 def p_description_6(p
):
729 '''description : discipline_declaration '''
730 if(parse_debug
): print('description_6', list(p
))
732 def p_description_7(p
):
733 '''description : package_item '''
734 if(parse_debug
): print('description_7', list(p
))
736 def p_description_8(p
):
737 '''description : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' '''
738 if(parse_debug
): print('description_8', list(p
))
739 # { perm_string tmp3 = lex_strings.make(p[3]);
740 # pform_set_type_attrib(tmp3, p[5], p[7]);
745 def p_description_list_1(p
):
746 '''description_list : description '''
747 if(parse_debug
>2): print('description_list_1', list(p
))
749 def p_description_list_2(p
):
750 '''description_list : description_list description '''
751 if(parse_debug
): print('description_list_2', list(p
))
753 def p_endnew_opt_1(p
):
754 '''endnew_opt : ':' K_new '''
755 if(parse_debug
): print('endnew_opt_1', list(p
))
757 def p_endnew_opt_2(p
):
759 if(parse_debug
): print('endnew_opt_2', list(p
))
761 def p_dynamic_array_new_1(p
):
762 '''dynamic_array_new : K_new '[' expression ']' '''
763 if(parse_debug
): print('dynamic_array_new_1', list(p
))
764 # { p[0] = new PENewArray(p[3], 0);
765 # FILE_NAME(p[0], @1);
768 def p_dynamic_array_new_2(p
):
769 '''dynamic_array_new : K_new '[' expression ']' '(' expression ')' '''
770 if(parse_debug
): print('dynamic_array_new_2', list(p
))
771 # { p[0] = new PENewArray(p[3], p[6]);
772 # FILE_NAME(p[0], @1);
776 '''for_step : lpvalue '=' expression '''
777 if(parse_debug
): print('for_step_1', list(p
))
778 # { PAssign*tmp = new PAssign(p[1],p[3]);
779 # FILE_NAME(tmp, @1);
784 '''for_step : inc_or_dec_expression '''
785 if(parse_debug
): print('for_step_2', list(p
))
786 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
789 '''for_step : compressed_statement '''
790 if(parse_debug
): print('for_step_3', list(p
))
793 def p_function_declaration_1(p
):
794 '''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 '''
795 if(parse_debug
): print('function_declaration_1', list(p
))
796 # { // Last step: check any closing name.
798 # if (strcmp(p[4],p[11]) != 0) {
799 # yyerror(@11, "error: End label doesn't match "
802 # if (! gn_system_verilog()) {
803 # yyerror(@11, "error: Function end labels require "
811 def p_function_declaration_2(p
):
812 '''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 '''
813 if(parse_debug
): print('function_declaration_2', list(p
))
814 # { // Last step: check any closing name.
816 # if (strcmp(p[4],p[14]) != 0) {
817 # yyerror(@14, "error: End label doesn't match "
820 # if (! gn_system_verilog()) {
821 # yyerror(@14, "error: Function end labels require "
829 def p_function_declaration_3(p
):
830 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER error K_endfunction _embed4_function_declaration endlabel_opt '''
831 if(parse_debug
): print('function_declaration_3', list(p
))
832 # { // Last step: check any closing name.
834 # if (strcmp(p[4],p[8]) != 0) {
835 # yyerror(@8, "error: End label doesn't match function name");
837 # if (! gn_system_verilog()) {
838 # yyerror(@8, "error: Function end labels require "
846 def p__embed0_function_declaration(p
):
847 '''_embed0_function_declaration : '''
848 # { assert(current_function == 0);
849 # current_function = pform_push_function_scope(@1, p[4], p[2]);
852 def p__embed1_function_declaration(p
):
853 '''_embed1_function_declaration : '''
854 # { current_function->set_ports(p[7]);
855 # current_function->set_return(p[3]);
856 # current_function_set_statement(p[8]? @8 : @4, p[8]);
857 # pform_set_this_class(@4, current_function);
859 # current_function = 0;
862 def p__embed2_function_declaration(p
):
863 '''_embed2_function_declaration : '''
864 # { assert(current_function == 0);
865 # current_function = pform_push_function_scope(@1, p[4], p[2]);
868 def p__embed3_function_declaration(p
):
869 '''_embed3_function_declaration : '''
870 # { current_function->set_ports(p[7]);
871 # current_function->set_return(p[3]);
872 # current_function_set_statement(p[11]? @11 : @4, p[11]);
873 # pform_set_this_class(@4, current_function);
875 # current_function = 0;
876 # if (p[7]==0 && !gn_system_verilog()) {
877 # yyerror(@4, "error: Empty parenthesis syntax requires SystemVerilog.");
881 def p__embed4_function_declaration(p
):
882 '''_embed4_function_declaration : '''
884 # if (current_function) {
886 # current_function = 0;
888 # assert(current_function == 0);
889 # yyerror(@1, "error: Syntax error defining function.");
893 def p_import_export_1(p
):
894 '''import_export : K_import '''
895 if(parse_debug
): print('import_export_1', list(p
))
898 def p_import_export_2(p
):
899 '''import_export : K_export '''
900 if(parse_debug
): print('import_export_2', list(p
))
903 def p_implicit_class_handle_1(p
):
904 '''implicit_class_handle : K_this '''
905 if(parse_debug
): print('implicit_class_handle_1', list(p
))
906 # { p[0] = pform_create_this(); }
908 def p_implicit_class_handle_2(p
):
909 '''implicit_class_handle : K_super '''
910 if(parse_debug
): print('implicit_class_handle_2', list(p
))
911 # { p[0] = pform_create_super(); }
913 def p_inc_or_dec_expression_1(p
):
914 '''inc_or_dec_expression : K_INCR lpvalue %prec UNARY_PREC '''
915 if(parse_debug
): print('inc_or_dec_expression_1', list(p
))
916 # { PEUnary*tmp = new PEUnary('I', p[2]);
917 # FILE_NAME(tmp, @2);
921 def p_inc_or_dec_expression_2(p
):
922 '''inc_or_dec_expression : lpvalue K_INCR %prec UNARY_PREC '''
923 if(parse_debug
): print('inc_or_dec_expression_2', list(p
))
924 # { PEUnary*tmp = new PEUnary('i', p[1]);
925 # FILE_NAME(tmp, @1);
929 def p_inc_or_dec_expression_3(p
):
930 '''inc_or_dec_expression : K_DECR lpvalue %prec UNARY_PREC '''
931 if(parse_debug
): print('inc_or_dec_expression_3', list(p
))
932 # { PEUnary*tmp = new PEUnary('D', p[2]);
933 # FILE_NAME(tmp, @2);
937 def p_inc_or_dec_expression_4(p
):
938 '''inc_or_dec_expression : lpvalue K_DECR %prec UNARY_PREC '''
939 if(parse_debug
): print('inc_or_dec_expression_4', list(p
))
940 # { PEUnary*tmp = new PEUnary('d', p[1]);
941 # FILE_NAME(tmp, @1);
945 def p_inside_expression_1(p
):
946 '''inside_expression : expression K_inside '{' open_range_list '}' '''
947 if(parse_debug
): print('inside_expression_1', list(p
))
948 # { yyerror(@2, "sorry: \"inside\" expressions not supported yet.");
952 def p_integer_vector_type_1(p
):
953 '''integer_vector_type : K_reg '''
954 if(parse_debug
): print('integer_vector_type_1', list(p
))
955 p
[0] = IVL_VT_NO_TYPE
957 def p_integer_vector_type_2(p
):
958 '''integer_vector_type : K_bit '''
959 if(parse_debug
): print('integer_vector_type_2', list(p
))
962 def p_integer_vector_type_3(p
):
963 '''integer_vector_type : K_logic '''
964 if(parse_debug
): print('integer_vector_type_3', list(p
))
967 def p_integer_vector_type_4(p
):
968 '''integer_vector_type : K_bool '''
969 if(parse_debug
): print('integer_vector_type_4', list(p
))
970 # { p[0] = IVL_VT_BOOL; }
972 def p_join_keyword_1(p
):
973 '''join_keyword : K_join '''
974 if(parse_debug
): print('join_keyword_1', list(p
))
975 # { p[0] = PBlock::BL_PAR; }
977 def p_join_keyword_2(p
):
978 '''join_keyword : K_join_none '''
979 if(parse_debug
): print('join_keyword_2', list(p
))
980 # { p[0] = PBlock::BL_JOIN_NONE; }
982 def p_join_keyword_3(p
):
983 '''join_keyword : K_join_any '''
984 if(parse_debug
): print('join_keyword_3', list(p
))
985 # { p[0] = PBlock::BL_JOIN_ANY; }
987 def p_jump_statement_1(p
):
988 '''jump_statement : K_break ';' '''
989 if(parse_debug
): print('jump_statement_1', list(p
))
990 # { yyerror(@1, "sorry: break statements not supported.");
994 def p_jump_statement_2(p
):
995 '''jump_statement : K_return ';' '''
996 if(parse_debug
): print('jump_statement_2', list(p
))
997 # { PReturn*tmp = new PReturn(0);
998 # FILE_NAME(tmp, @1);
1002 def p_jump_statement_3(p
):
1003 '''jump_statement : K_return expression ';' '''
1004 if(parse_debug
): print('jump_statement_3', list(p
))
1005 # { PReturn*tmp = new PReturn(p[2]);
1006 # FILE_NAME(tmp, @1);
1010 def p_lifetime_1(p
):
1011 '''lifetime : K_automatic '''
1012 if(parse_debug
): print('lifetime_1', list(p
))
1013 # { p[0] = LexicalScope::AUTOMATIC; }
1015 def p_lifetime_2(p
):
1016 '''lifetime : K_static '''
1017 if(parse_debug
): print('lifetime_2', list(p
))
1018 # { p[0] = LexicalScope::STATIC; }
1020 def p_lifetime_opt_1(p
):
1021 '''lifetime_opt : lifetime '''
1022 if(parse_debug
): print('lifetime_opt_1', list(p
))
1025 def p_lifetime_opt_2(p
):
1026 '''lifetime_opt : '''
1027 if(parse_debug
>2): print('lifetime_opt_2', list(p
))
1028 # { p[0] = LexicalScope::INHERITED; }
1030 def p_loop_statement_1(p
):
1031 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' for_step ')' statement_or_null '''
1032 if(parse_debug
): print('loop_statement_1', list(p
))
1033 # { PForStatement*tmp = new PForStatement(p[3], p[5], p[7], p[9], p[11]);
1034 # FILE_NAME(tmp, @1);
1038 def p_loop_statement_2(p
):
1039 '''loop_statement : K_for '(' data_type IDENTIFIER '=' expression ';' expression ';' for_step ')' _embed0_loop_statement statement_or_null '''
1040 if(parse_debug
): print('loop_statement_2', list(p
))
1041 # { pform_name_t tmp_hident;
1042 # tmp_hident.push_back(name_component_t(lex_strings.make(p[4])));
1044 # PEIdent*tmp_ident = pform_new_ident(tmp_hident);
1045 # FILE_NAME(tmp_ident, @4);
1047 # PForStatement*tmp_for = new PForStatement(tmp_ident, p[6], p[8], p[10], p[13]);
1048 # FILE_NAME(tmp_for, @1);
1050 # pform_pop_scope();
1051 # vector<Statement*>tmp_for_list (1);
1052 # tmp_for_list[0] = tmp_for;
1053 # PBlock*tmp_blk = current_block_stack.top();
1054 # current_block_stack.pop();
1055 # tmp_blk->set_statement(tmp_for_list);
1060 def p_loop_statement_3(p
):
1061 '''loop_statement : K_forever statement_or_null '''
1062 if(parse_debug
): print('loop_statement_3', list(p
))
1063 # { PForever*tmp = new PForever(p[2]);
1064 # FILE_NAME(tmp, @1);
1068 def p_loop_statement_4(p
):
1069 '''loop_statement : K_repeat '(' expression ')' statement_or_null '''
1070 if(parse_debug
): print('loop_statement_4', list(p
))
1071 # { PRepeat*tmp = new PRepeat(p[3], p[5]);
1072 # FILE_NAME(tmp, @1);
1076 def p_loop_statement_5(p
):
1077 '''loop_statement : K_while '(' expression ')' statement_or_null '''
1078 if(parse_debug
): print('loop_statement_5', list(p
))
1079 # { PWhile*tmp = new PWhile(p[3], p[5]);
1080 # FILE_NAME(tmp, @1);
1084 def p_loop_statement_6(p
):
1085 '''loop_statement : K_do statement_or_null K_while '(' expression ')' ';' '''
1086 if(parse_debug
): print('loop_statement_6', list(p
))
1087 # { PDoWhile*tmp = new PDoWhile(p[5], p[2]);
1088 # FILE_NAME(tmp, @1);
1092 def p_loop_statement_7(p
):
1093 '''loop_statement : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' _embed1_loop_statement statement_or_null '''
1094 if(parse_debug
): print('loop_statement_7', list(p
))
1095 # { PForeach*tmp_for = pform_make_foreach(@1, p[3], p[5], p[9]);
1097 # pform_pop_scope();
1098 # vector<Statement*>tmp_for_list(1);
1099 # tmp_for_list[0] = tmp_for;
1100 # PBlock*tmp_blk = current_block_stack.top();
1101 # current_block_stack.pop();
1102 # tmp_blk->set_statement(tmp_for_list);
1106 def p_loop_statement_8(p
):
1107 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' error ')' statement_or_null '''
1108 if(parse_debug
): print('loop_statement_8', list(p
))
1110 # yyerror(@1, "error: Error in for loop step assignment.");
1113 def p_loop_statement_9(p
):
1114 '''loop_statement : K_for '(' lpvalue '=' expression ';' error ';' for_step ')' statement_or_null '''
1115 if(parse_debug
): print('loop_statement_9', list(p
))
1117 # yyerror(@1, "error: Error in for loop condition expression.");
1120 def p_loop_statement_10(p
):
1121 '''loop_statement : K_for '(' error ')' statement_or_null '''
1122 if(parse_debug
): print('loop_statement_10', list(p
))
1124 # yyerror(@1, "error: Incomprehensible for loop.");
1127 def p_loop_statement_11(p
):
1128 '''loop_statement : K_while '(' error ')' statement_or_null '''
1129 if(parse_debug
): print('loop_statement_11', list(p
))
1131 # yyerror(@1, "error: Error in while loop condition.");
1134 def p_loop_statement_12(p
):
1135 '''loop_statement : K_do statement_or_null K_while '(' error ')' ';' '''
1136 if(parse_debug
): print('loop_statement_12', list(p
))
1138 # yyerror(@1, "error: Error in do/while loop condition.");
1141 def p_loop_statement_13(p
):
1142 '''loop_statement : K_foreach '(' IDENTIFIER '[' error ']' ')' statement_or_null '''
1143 if(parse_debug
): print('loop_statement_13', list(p
))
1145 # yyerror(@4, "error: Errors in foreach loop variables list.");
1148 def p__embed0_loop_statement(p
):
1149 '''_embed0_loop_statement : '''
1150 # { static unsigned for_counter = 0;
1151 # char for_block_name [64];
1152 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_for_loop%u", for_counter);
1154 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1155 # FILE_NAME(tmp, @1);
1156 # current_block_stack.push(tmp);
1158 # list<decl_assignment_t*>assign_list;
1159 # decl_assignment_t*tmp_assign = new decl_assignment_t;
1160 # tmp_assign->name = lex_strings.make(p[4]);
1161 # assign_list.push_back(tmp_assign);
1162 # pform_makewire(@4, 0, str_strength, &assign_list, NetNet::REG, p[3]);
1165 def p__embed1_loop_statement(p
):
1166 '''_embed1_loop_statement : '''
1167 # { static unsigned foreach_counter = 0;
1168 # char for_block_name[64];
1169 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_foreach%u", foreach_counter);
1170 # foreach_counter += 1;
1172 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1173 # FILE_NAME(tmp, @1);
1174 # current_block_stack.push(tmp);
1176 # pform_make_foreach_declarations(@1, p[5]);
1179 def p_list_of_variable_decl_assignments_1(p
):
1180 '''list_of_variable_decl_assignments : variable_decl_assignment '''
1181 if(parse_debug
): print('list_of_variable_decl_assignments_1', list(p
))
1182 # { list<decl_assignment_t*>*tmp = new list<decl_assignment_t*>;
1183 # tmp->push_back(p[1]);
1187 def p_list_of_variable_decl_assignments_2(p
):
1188 '''list_of_variable_decl_assignments : list_of_variable_decl_assignments ',' variable_decl_assignment '''
1189 if(parse_debug
): print('list_of_variable_decl_assignments_2', list(p
))
1190 # { list<decl_assignment_t*>*tmp = p[1];
1191 # tmp->push_back(p[3]);
1195 def p_variable_decl_assignment_1(p
):
1196 '''variable_decl_assignment : IDENTIFIER dimensions_opt '''
1197 if(parse_debug
): print('variable_decl_assignment_1', list(p
))
1198 # { decl_assignment_t*tmp = new decl_assignment_t;
1199 # tmp->name = lex_strings.make(p[1]);
1201 # tmp->index = *p[2];
1208 def p_variable_decl_assignment_2(p
):
1209 '''variable_decl_assignment : IDENTIFIER '=' expression '''
1210 if(parse_debug
): print('variable_decl_assignment_2', list(p
))
1211 # { decl_assignment_t*tmp = new decl_assignment_t;
1212 # tmp->name = lex_strings.make(p[1]);
1213 # tmp->expr .reset(p[3]);
1218 def p_variable_decl_assignment_3(p
):
1219 '''variable_decl_assignment : IDENTIFIER '=' K_new '(' ')' '''
1220 if(parse_debug
): print('variable_decl_assignment_3', list(p
))
1221 # { decl_assignment_t*tmp = new decl_assignment_t;
1222 # tmp->name = lex_strings.make(p[1]);
1223 # PENewClass*expr = new PENewClass;
1224 # FILE_NAME(expr, @3);
1225 # tmp->expr .reset(expr);
1230 def p_loop_variables_1(p
):
1231 '''loop_variables : loop_variables ',' IDENTIFIER '''
1232 if(parse_debug
): print('loop_variables_1', list(p
))
1233 # { list<perm_string>*tmp = p[1];
1234 # tmp->push_back(lex_strings.make(p[3]));
1239 def p_loop_variables_2(p
):
1240 '''loop_variables : IDENTIFIER '''
1241 if(parse_debug
): print('loop_variables_2', list(p
))
1242 # { list<perm_string>*tmp = new list<perm_string>;
1243 # tmp->push_back(lex_strings.make(p[1]));
1248 def p_method_qualifier_1(p
):
1249 '''method_qualifier : K_virtual '''
1250 if(parse_debug
): print('method_qualifier_1', list(p
))
1252 def p_method_qualifier_2(p
):
1253 '''method_qualifier : class_item_qualifier '''
1254 if(parse_debug
): print('method_qualifier_2', list(p
))
1256 def p_method_qualifier_opt_1(p
):
1257 '''method_qualifier_opt : method_qualifier '''
1258 if(parse_debug
): print('method_qualifier_opt_1', list(p
))
1260 def p_method_qualifier_opt_2(p
):
1261 '''method_qualifier_opt : '''
1262 if(parse_debug
): print('method_qualifier_opt_2', list(p
))
1264 def p_modport_declaration_1(p
):
1265 '''modport_declaration : K_modport _embed0_modport_declaration modport_item_list ';' '''
1266 if(parse_debug
): print('modport_declaration_1', list(p
))
1268 def p__embed0_modport_declaration(p
):
1269 '''_embed0_modport_declaration : '''
1270 # { if (!pform_in_interface())
1271 # yyerror(@1, "error: modport declarations are only allowed "
1272 # "in interfaces.");
1275 def p_modport_item_list_1(p
):
1276 '''modport_item_list : modport_item '''
1277 if(parse_debug
): print('modport_item_list_1', list(p
))
1279 def p_modport_item_list_2(p
):
1280 '''modport_item_list : modport_item_list ',' modport_item '''
1281 if(parse_debug
): print('modport_item_list_2', list(p
))
1283 def p_modport_item_1(p
):
1284 '''modport_item : IDENTIFIER _embed0_modport_item '(' modport_ports_list ')' '''
1285 if(parse_debug
): print('modport_item_1', list(p
))
1286 # { pform_end_modport_item(@1); }
1288 def p__embed0_modport_item(p
):
1289 '''_embed0_modport_item : '''
1290 # { pform_start_modport_item(@1, p[1]); }
1292 def p_modport_ports_list_1(p
):
1293 '''modport_ports_list : modport_ports_declaration '''
1294 if(parse_debug
): print('modport_ports_list_1', list(p
))
1296 def p_modport_ports_list_2(p
):
1297 '''modport_ports_list : modport_ports_list ',' modport_ports_declaration '''
1298 if(parse_debug
): print('modport_ports_list_2', list(p
))
1300 def p_modport_ports_list_3(p
):
1301 '''modport_ports_list : modport_ports_list ',' modport_simple_port '''
1302 if(parse_debug
): print('modport_ports_list_3', list(p
))
1303 # { if (last_modport_port.type == MP_SIMPLE) {
1304 # pform_add_modport_port(@3, last_modport_port.direction,
1305 # p[3]->name, p[3]->parm);
1307 # yyerror(@3, "error: modport expression not allowed here.");
1312 def p_modport_ports_list_4(p
):
1313 '''modport_ports_list : modport_ports_list ',' modport_tf_port '''
1314 if(parse_debug
): print('modport_ports_list_4', list(p
))
1315 # { if (last_modport_port.type != MP_TF)
1316 # yyerror(@3, "error: task/function declaration not allowed here.");
1319 def p_modport_ports_list_5(p
):
1320 '''modport_ports_list : modport_ports_list ',' IDENTIFIER '''
1321 if(parse_debug
): print('modport_ports_list_5', list(p
))
1322 # { if (last_modport_port.type == MP_SIMPLE) {
1323 # pform_add_modport_port(@3, last_modport_port.direction,
1324 # lex_strings.make(p[3]), 0);
1325 # } else if (last_modport_port.type != MP_TF) {
1326 # yyerror(@3, "error: list of identifiers not allowed here.");
1331 def p_modport_ports_list_6(p
):
1332 '''modport_ports_list : modport_ports_list ',' '''
1333 if(parse_debug
): print('modport_ports_list_6', list(p
))
1334 # { yyerror(@2, "error: NULL port declarations are not allowed"); }
1336 def p_modport_ports_declaration_1(p
):
1337 '''modport_ports_declaration : attribute_list_opt port_direction IDENTIFIER '''
1338 if(parse_debug
): print('modport_ports_declaration_1', list(p
))
1339 # { last_modport_port.type = MP_SIMPLE;
1340 # last_modport_port.direction = p[2];
1341 # pform_add_modport_port(@3, p[2], lex_strings.make(p[3]), 0);
1346 def p_modport_ports_declaration_2(p
):
1347 '''modport_ports_declaration : attribute_list_opt port_direction modport_simple_port '''
1348 if(parse_debug
): print('modport_ports_declaration_2', list(p
))
1349 # { last_modport_port.type = MP_SIMPLE;
1350 # last_modport_port.direction = p[2];
1351 # pform_add_modport_port(@3, p[2], p[3]->name, p[3]->parm);
1356 def p_modport_ports_declaration_3(p
):
1357 '''modport_ports_declaration : attribute_list_opt import_export IDENTIFIER '''
1358 if(parse_debug
): print('modport_ports_declaration_3', list(p
))
1359 # { last_modport_port.type = MP_TF;
1360 # last_modport_port.is_import = p[2];
1361 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
1366 def p_modport_ports_declaration_4(p
):
1367 '''modport_ports_declaration : attribute_list_opt import_export modport_tf_port '''
1368 if(parse_debug
): print('modport_ports_declaration_4', list(p
))
1369 # { last_modport_port.type = MP_TF;
1370 # last_modport_port.is_import = p[2];
1371 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
1375 def p_modport_ports_declaration_5(p
):
1376 '''modport_ports_declaration : attribute_list_opt K_clocking IDENTIFIER '''
1377 if(parse_debug
): print('modport_ports_declaration_5', list(p
))
1378 # { last_modport_port.type = MP_CLOCKING;
1379 # last_modport_port.direction = NetNet::NOT_A_PORT;
1380 # yyerror(@3, "sorry: modport clocking declaration is not yet supported.");
1385 def p_modport_simple_port_1(p
):
1386 '''modport_simple_port : '.' IDENTIFIER '(' expression ')' '''
1387 if(parse_debug
): print('modport_simple_port_1', list(p
))
1388 # { named_pexpr_t*tmp = new named_pexpr_t;
1389 # tmp->name = lex_strings.make(p[2]);
1395 def p_modport_tf_port_1(p
):
1396 '''modport_tf_port : K_task IDENTIFIER '''
1397 if(parse_debug
): print('modport_tf_port_1', list(p
))
1399 def p_modport_tf_port_2(p
):
1400 '''modport_tf_port : K_task IDENTIFIER '(' tf_port_list_opt ')' '''
1401 if(parse_debug
): print('modport_tf_port_2', list(p
))
1403 def p_modport_tf_port_3(p
):
1404 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '''
1405 if(parse_debug
): print('modport_tf_port_3', list(p
))
1407 def p_modport_tf_port_4(p
):
1408 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' '''
1409 if(parse_debug
): print('modport_tf_port_4', list(p
))
1411 def p_non_integer_type_1(p
):
1412 '''non_integer_type : K_real '''
1413 if(parse_debug
): print('non_integer_type_1', list(p
))
1414 # { p[0] = real_type_t::REAL; }
1416 def p_non_integer_type_2(p
):
1417 '''non_integer_type : K_realtime '''
1418 if(parse_debug
): print('non_integer_type_2', list(p
))
1419 # { p[0] = real_type_t::REAL; }
1421 def p_non_integer_type_3(p
):
1422 '''non_integer_type : K_shortreal '''
1423 if(parse_debug
): print('non_integer_type_3', list(p
))
1424 # { p[0] = real_type_t::SHORTREAL; }
1427 '''number : BASED_NUMBER '''
1428 if(parse_debug
): print('number_1', list(p
))
1429 # { p[0] = p[1]; based_size = 0;}
1432 '''number : DEC_NUMBER '''
1433 if(parse_debug
): print('number_2', list(p
))
1434 num
= Leaf(token
.NUMBER
, "%s" % (p
[1]))
1436 # { p[0] = p[1]; based_size = 0;}
1439 '''number : DEC_NUMBER BASED_NUMBER '''
1440 if(parse_debug
): print('number_3', list(p
))
1441 num
= Leaf(token
.NUMBER
, "%s:%s" % (p
[1], p
[2]))
1443 # { p[0] = pform_verinum_with_size(p[1],p[2], @2.text, @2.first_line);
1447 '''number : UNBASED_NUMBER '''
1448 if(parse_debug
): print('number_4', list(p
))
1449 # { p[0] = p[1]; based_size = 0;}
1452 '''number : DEC_NUMBER UNBASED_NUMBER '''
1453 if(parse_debug
): print('number_5', list(p
))
1454 # { yyerror(@1, "error: Unbased SystemVerilog literal cannot have "
1456 # p[0] = p[1]; based_size = 0;}
1458 def p_open_range_list_1(p
):
1459 '''open_range_list : open_range_list ',' value_range '''
1460 if(parse_debug
): print('open_range_list_1', list(p
))
1462 def p_open_range_list_2(p
):
1463 '''open_range_list : value_range '''
1464 if(parse_debug
): print('open_range_list_2', list(p
))
1466 def p_package_declaration_1(p
):
1467 '''package_declaration : K_package lifetime_opt IDENTIFIER ';' _embed0_package_declaration timeunits_declaration_opt _embed1_package_declaration package_item_list_opt K_endpackage endlabel_opt '''
1468 if(parse_debug
): print('package_declaration_1', list(p
))
1469 # { pform_end_package_declaration(@1);
1470 # // If an end label is present make sure it match the package name.
1472 # if (strcmp(p[3],p[10]) != 0) {
1473 # yyerror(@10, "error: End label doesn't match package name");
1480 def p__embed0_package_declaration(p
):
1481 '''_embed0_package_declaration : '''
1482 # { pform_start_package_declaration(@1, p[3], p[2]); }
1484 def p__embed1_package_declaration(p
):
1485 '''_embed1_package_declaration : '''
1486 # { pform_set_scope_timescale(@1); }
1488 def p_module_package_import_list_opt_1(p
):
1489 '''module_package_import_list_opt : '''
1490 if(parse_debug
>1): print('module_package_import_list_opt_1', list(p
))
1492 def p_module_package_import_list_opt_2(p
):
1493 '''module_package_import_list_opt : package_import_list '''
1494 if(parse_debug
): print('module_package_import_list_opt_2', list(p
))
1496 def p_package_import_list_1(p
):
1497 '''package_import_list : package_import_declaration '''
1498 if(parse_debug
): print('package_import_list_1', list(p
))
1500 def p_package_import_list_2(p
):
1501 '''package_import_list : package_import_list package_import_declaration '''
1502 if(parse_debug
): print('package_import_list_2', list(p
))
1504 def p_package_import_declaration_1(p
):
1505 '''package_import_declaration : K_import package_import_item_list ';' '''
1506 if(parse_debug
): print('package_import_declaration_1', list(p
))
1509 def p_package_import_item_1(p
):
1510 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '''
1511 if(parse_debug
): print('package_import_item_1', list(p
))
1512 # { pform_package_import(@2, p[1], p[3]);
1516 def p_package_import_item_2(p
):
1517 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES '*' '''
1518 if(parse_debug
): print('package_import_item_2', list(p
))
1519 # { pform_package_import(@2, p[1], 0);
1522 def p_package_import_item_list_1(p
):
1523 '''package_import_item_list : package_import_item_list ',' package_import_item '''
1524 if(parse_debug
): print('package_import_item_list_1', list(p
))
1526 def p_package_import_item_list_2(p
):
1527 '''package_import_item_list : package_import_item '''
1528 if(parse_debug
): print('package_import_item_list_2', list(p
))
1530 def p_package_item_1(p
):
1531 '''package_item : timeunits_declaration '''
1532 if(parse_debug
): print('package_item_1', list(p
))
1534 def p_package_item_2(p
):
1535 '''package_item : K_parameter param_type parameter_assign_list ';' '''
1536 if(parse_debug
): print('package_item_2', list(p
))
1538 def p_package_item_3(p
):
1539 '''package_item : K_localparam param_type localparam_assign_list ';' '''
1540 if(parse_debug
): print('package_item_3', list(p
))
1542 def p_package_item_4(p
):
1543 '''package_item : type_declaration '''
1544 if(parse_debug
): print('package_item_4', list(p
))
1546 def p_package_item_5(p
):
1547 '''package_item : function_declaration '''
1548 if(parse_debug
): print('package_item_5', list(p
))
1550 def p_package_item_6(p
):
1551 '''package_item : task_declaration '''
1552 if(parse_debug
): print('package_item_6', list(p
))
1554 def p_package_item_7(p
):
1555 '''package_item : data_declaration '''
1556 if(parse_debug
): print('package_item_7', list(p
))
1558 def p_package_item_8(p
):
1559 '''package_item : class_declaration '''
1560 if(parse_debug
): print('package_item_8', list(p
))
1562 def p_package_item_list_1(p
):
1563 '''package_item_list : package_item_list package_item '''
1564 if(parse_debug
): print('package_item_list_1', list(p
))
1566 def p_package_item_list_2(p
):
1567 '''package_item_list : package_item '''
1568 if(parse_debug
): print('package_item_list_2', list(p
))
1570 def p_package_item_list_opt_1(p
):
1571 '''package_item_list_opt : package_item_list '''
1572 if(parse_debug
): print('package_item_list_opt_1', list(p
))
1574 def p_package_item_list_opt_2(p
):
1575 '''package_item_list_opt : '''
1576 if(parse_debug
): print('package_item_list_opt_2', list(p
))
1578 def p_port_direction_1(p
):
1579 '''port_direction : K_input '''
1580 if(parse_debug
): print('port_direction_1', list(p
))
1581 # { p[0] = NetNet::PINPUT; }
1583 def p_port_direction_2(p
):
1584 '''port_direction : K_output '''
1585 if(parse_debug
): print('port_direction_2', list(p
))
1586 # { p[0] = NetNet::POUTPUT; }
1588 def p_port_direction_3(p
):
1589 '''port_direction : K_inout '''
1590 if(parse_debug
): print('port_direction_3', list(p
))
1591 # { p[0] = NetNet::PINOUT; }
1593 def p_port_direction_4(p
):
1594 '''port_direction : K_ref '''
1595 if(parse_debug
): print('port_direction_4', list(p
))
1596 # { p[0] = NetNet::PREF;
1597 # if (!gn_system_verilog()) {
1598 # yyerror(@1, "error: Reference ports (ref) require SystemVerilog.");
1599 # p[0] = NetNet::PINPUT;
1603 def p_port_direction_opt_1(p
):
1604 '''port_direction_opt : port_direction '''
1605 if(parse_debug
): print('port_direction_opt_1', list(p
))
1608 def p_port_direction_opt_2(p
):
1609 '''port_direction_opt : '''
1610 if(parse_debug
): print('port_direction_opt_2', list(p
))
1611 # { p[0] = NetNet::PIMPLICIT; }
1613 def p_property_expr_1(p
):
1614 '''property_expr : expression '''
1615 if(parse_debug
): print('property_expr_1', list(p
))
1617 def p_procedural_assertion_statement_1(p
):
1618 '''procedural_assertion_statement : K_assert '(' expression ')' statement %prec less_than_K_else '''
1619 if(parse_debug
): print('procedural_assertion_statement_1', list(p
))
1620 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1624 def p_procedural_assertion_statement_2(p
):
1625 '''procedural_assertion_statement : K_assert '(' expression ')' K_else statement '''
1626 if(parse_debug
): print('procedural_assertion_statement_2', list(p
))
1627 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1631 def p_procedural_assertion_statement_3(p
):
1632 '''procedural_assertion_statement : K_assert '(' expression ')' statement K_else statement '''
1633 if(parse_debug
): print('procedural_assertion_statement_3', list(p
))
1634 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1638 def p_property_qualifier_1(p
):
1639 '''property_qualifier : class_item_qualifier '''
1640 if(parse_debug
): print('property_qualifier_1', list(p
))
1642 def p_property_qualifier_2(p
):
1643 '''property_qualifier : random_qualifier '''
1644 if(parse_debug
): print('property_qualifier_2', list(p
))
1646 def p_property_qualifier_opt_1(p
):
1647 '''property_qualifier_opt : property_qualifier_list '''
1648 if(parse_debug
): print('property_qualifier_opt_1', list(p
))
1651 def p_property_qualifier_opt_2(p
):
1652 '''property_qualifier_opt : '''
1653 if(parse_debug
): print('property_qualifier_opt_2', list(p
))
1654 # { p[0] = property_qualifier_t::make_none(); }
1656 def p_property_qualifier_list_1(p
):
1657 '''property_qualifier_list : property_qualifier_list property_qualifier '''
1658 if(parse_debug
): print('property_qualifier_list_1', list(p
))
1659 # { p[0] = p[1] | p[2]; }
1661 def p_property_qualifier_list_2(p
):
1662 '''property_qualifier_list : property_qualifier '''
1663 if(parse_debug
): print('property_qualifier_list_2', list(p
))
1666 def p_property_spec_1(p
):
1667 '''property_spec : clocking_event_opt property_spec_disable_iff_opt property_expr '''
1668 if(parse_debug
): print('property_spec_1', list(p
))
1670 def p_property_spec_disable_iff_opt_1(p
):
1671 '''property_spec_disable_iff_opt : K_disable K_iff '(' expression ')' '''
1672 if(parse_debug
): print('property_spec_disable_iff_opt_1', list(p
))
1674 def p_property_spec_disable_iff_opt_2(p
):
1675 '''property_spec_disable_iff_opt : '''
1676 if(parse_debug
): print('property_spec_disable_iff_opt_2', list(p
))
1678 def p_random_qualifier_1(p
):
1679 '''random_qualifier : K_rand '''
1680 if(parse_debug
): print('random_qualifier_1', list(p
))
1681 # { p[0] = property_qualifier_t::make_rand(); }
1683 def p_random_qualifier_2(p
):
1684 '''random_qualifier : K_randc '''
1685 if(parse_debug
): print('random_qualifier_2', list(p
))
1686 # { p[0] = property_qualifier_t::make_randc(); }
1688 def p_real_or_realtime_1(p
):
1689 '''real_or_realtime : K_real '''
1690 if(parse_debug
): print('real_or_realtime_1', list(p
))
1692 def p_real_or_realtime_2(p
):
1693 '''real_or_realtime : K_realtime '''
1694 if(parse_debug
): print('real_or_realtime_2', list(p
))
1697 '''signing : K_signed '''
1698 if(parse_debug
): print('signing_1', list(p
))
1702 '''signing : K_unsigned '''
1703 if(parse_debug
): print('signing_2', list(p
))
1706 def p_simple_type_or_string_1(p
):
1707 '''simple_type_or_string : integer_vector_type '''
1708 if(parse_debug
): print('simple_type_or_string_1', list(p
))
1709 # { ivl_variable_type_t use_vtype = p[1];
1710 # bool reg_flag = false;
1711 # if (use_vtype == IVL_VT_NO_TYPE) {
1712 # use_vtype = IVL_VT_LOGIC;
1715 # vector_type_t*tmp = new vector_type_t(use_vtype, false, 0);
1716 # tmp->reg_flag = reg_flag;
1717 # FILE_NAME(tmp, @1);
1721 def p_simple_type_or_string_2(p
):
1722 '''simple_type_or_string : non_integer_type '''
1723 if(parse_debug
): print('simple_type_or_string_2', list(p
))
1724 # { real_type_t*tmp = new real_type_t(p[1]);
1725 # FILE_NAME(tmp, @1);
1729 def p_simple_type_or_string_3(p
):
1730 '''simple_type_or_string : atom2_type '''
1731 if(parse_debug
): print('simple_type_or_string_3', list(p
))
1732 # { atom2_type_t*tmp = new atom2_type_t(p[1], true);
1733 # FILE_NAME(tmp, @1);
1737 def p_simple_type_or_string_4(p
):
1738 '''simple_type_or_string : K_integer '''
1739 if(parse_debug
): print('simple_type_or_string_4', list(p
))
1740 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
1741 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd);
1742 # tmp->reg_flag = true;
1743 # tmp->integer_flag = true;
1747 def p_simple_type_or_string_5(p
):
1748 '''simple_type_or_string : K_time '''
1749 if(parse_debug
): print('simple_type_or_string_5', list(p
))
1750 # { list<pform_range_t>*pd = make_range_from_width(64);
1751 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
1752 # tmp->reg_flag = !gn_system_verilog();
1756 def p_simple_type_or_string_6(p
):
1757 '''simple_type_or_string : TYPE_IDENTIFIER '''
1758 if(parse_debug
): print('simple_type_or_string_6', list(p
))
1759 # { p[0] = p[1].type;
1760 # delete[]p[1].text;
1763 def p_simple_type_or_string_7(p
):
1764 '''simple_type_or_string : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_simple_type_or_string TYPE_IDENTIFIER '''
1765 if(parse_debug
): print('simple_type_or_string_7', list(p
))
1766 # { lex_in_package_scope(0);
1768 # delete[]p[4].text;
1771 def p_simple_type_or_string_8(p
):
1772 '''simple_type_or_string : K_string '''
1773 if(parse_debug
): print('simple_type_or_string_8', list(p
))
1774 # { string_type_t*tmp = new string_type_t;
1775 # FILE_NAME(tmp, @1);
1779 def p__embed0_simple_type_or_string(p
):
1780 '''_embed0_simple_type_or_string : '''
1781 # { lex_in_package_scope(p[1]); }
1783 def p_statement_1(p
):
1784 '''statement : attribute_list_opt statement_item '''
1785 if(parse_debug
): print('statement_1', list(p
))
1786 # { pform_bind_attributes(p[2]->attributes, p[1]);
1790 def p_statement_or_null_1(p
):
1791 '''statement_or_null : statement '''
1792 if(parse_debug
): print('statement_or_null_1', list(p
))
1795 def p_statement_or_null_2(p
):
1796 '''statement_or_null : attribute_list_opt ';' '''
1797 if(parse_debug
): print('statement_or_null_2', list(p
))
1800 def p_stream_expression_1(p
):
1801 '''stream_expression : expression '''
1802 if(parse_debug
): print('stream_expression_1', list(p
))
1804 def p_stream_expression_list_1(p
):
1805 '''stream_expression_list : stream_expression_list ',' stream_expression '''
1806 if(parse_debug
): print('stream_expression_list_1', list(p
))
1808 def p_stream_expression_list_2(p
):
1809 '''stream_expression_list : stream_expression '''
1810 if(parse_debug
): print('stream_expression_list_2', list(p
))
1812 def p_stream_operator_1(p
):
1813 '''stream_operator : K_LS '''
1814 if(parse_debug
): print('stream_operator_1', list(p
))
1816 def p_stream_operator_2(p
):
1817 '''stream_operator : K_RS '''
1818 if(parse_debug
): print('stream_operator_2', list(p
))
1820 def p_streaming_concatenation_1(p
):
1821 '''streaming_concatenation : '{' stream_operator '{' stream_expression_list '}' '}' '''
1822 if(parse_debug
): print('streaming_concatenation_1', list(p
))
1823 # { /* streaming concatenation is a SystemVerilog thing. */
1824 # if (gn_system_verilog()) {
1825 # yyerror(@2, "sorry: Streaming concatenation not supported.");
1828 # yyerror(@2, "error: Streaming concatenation requires SystemVerilog");
1833 def p_task_declaration_1(p
):
1834 '''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 '''
1835 if(parse_debug
): print('task_declaration_1', list(p
))
1836 # { // Last step: check any closing name. This is done late so
1837 # // that the parser can look ahead to detect the present
1838 # // endlabel_opt but still have the pform_endmodule() called
1839 # // early enough that the lexor can know we are outside the
1842 # if (strcmp(p[3],p[10]) != 0) {
1843 # yyerror(@10, "error: End label doesn't match task name");
1845 # if (! gn_system_verilog()) {
1846 # yyerror(@10, "error: Task end labels require "
1847 # "SystemVerilog.");
1854 def p_task_declaration_2(p
):
1855 '''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 '''
1856 if(parse_debug
): print('task_declaration_2', list(p
))
1857 # { // Last step: check any closing name. This is done late so
1858 # // that the parser can look ahead to detect the present
1859 # // endlabel_opt but still have the pform_endmodule() called
1860 # // early enough that the lexor can know we are outside the
1863 # if (strcmp(p[3],p[13]) != 0) {
1864 # yyerror(@13, "error: End label doesn't match task name");
1866 # if (! gn_system_verilog()) {
1867 # yyerror(@13, "error: Task end labels require "
1868 # "SystemVerilog.");
1875 def p_task_declaration_3(p
):
1876 '''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 '''
1877 if(parse_debug
): print('task_declaration_3', list(p
))
1878 # { // Last step: check any closing name. This is done late so
1879 # // that the parser can look ahead to detect the present
1880 # // endlabel_opt but still have the pform_endmodule() called
1881 # // early enough that the lexor can know we are outside the
1884 # if (strcmp(p[3],p[12]) != 0) {
1885 # yyerror(@12, "error: End label doesn't match task name");
1887 # if (! gn_system_verilog()) {
1888 # yyerror(@12, "error: Task end labels require "
1889 # "SystemVerilog.");
1896 def p_task_declaration_4(p
):
1897 '''task_declaration : K_task lifetime_opt IDENTIFIER error K_endtask _embed6_task_declaration endlabel_opt '''
1898 if(parse_debug
): print('task_declaration_4', list(p
))
1899 # { // Last step: check any closing name. This is done late so
1900 # // that the parser can look ahead to detect the present
1901 # // endlabel_opt but still have the pform_endmodule() called
1902 # // early enough that the lexor can know we are outside the
1905 # if (strcmp(p[3],p[7]) != 0) {
1906 # yyerror(@7, "error: End label doesn't match task name");
1908 # if (! gn_system_verilog()) {
1909 # yyerror(@7, "error: Task end labels require "
1910 # "SystemVerilog.");
1917 def p__embed0_task_declaration(p
):
1918 '''_embed0_task_declaration : '''
1919 # { assert(current_task == 0);
1920 # current_task = pform_push_task_scope(@1, p[3], p[2]);
1923 def p__embed1_task_declaration(p
):
1924 '''_embed1_task_declaration : '''
1925 # { current_task->set_ports(p[6]);
1926 # current_task_set_statement(@3, p[7]);
1927 # pform_set_this_class(@3, current_task);
1928 # pform_pop_scope();
1930 # if (p[7] && p[7]->size() > 1 && !gn_system_verilog()) {
1931 # yyerror(@7, "error: Task body with multiple statements requires SystemVerilog.");
1936 def p__embed2_task_declaration(p
):
1937 '''_embed2_task_declaration : '''
1938 # { assert(current_task == 0);
1939 # current_task = pform_push_task_scope(@1, p[3], p[2]);
1942 def p__embed3_task_declaration(p
):
1943 '''_embed3_task_declaration : '''
1944 # { current_task->set_ports(p[6]);
1945 # current_task_set_statement(@3, p[10]);
1946 # pform_set_this_class(@3, current_task);
1947 # pform_pop_scope();
1949 # if (p[10]) delete p[10];
1952 def p__embed4_task_declaration(p
):
1953 '''_embed4_task_declaration : '''
1954 # { assert(current_task == 0);
1955 # current_task = pform_push_task_scope(@1, p[3], p[2]);
1958 def p__embed5_task_declaration(p
):
1959 '''_embed5_task_declaration : '''
1960 # { current_task->set_ports(0);
1961 # current_task_set_statement(@3, p[9]);
1962 # pform_set_this_class(@3, current_task);
1963 # if (! current_task->method_of()) {
1964 # cerr << @3 << ": warning: task definition for \"" << p[3]
1965 # << "\" has an empty port declaration list!" << endl;
1967 # pform_pop_scope();
1969 # if (p[9]->size() > 1 && !gn_system_verilog()) {
1970 # yyerror(@9, "error: Task body with multiple statements requires SystemVerilog.");
1975 def p__embed6_task_declaration(p
):
1976 '''_embed6_task_declaration : '''
1978 # if (current_task) {
1979 # pform_pop_scope();
1984 def p_tf_port_declaration_1(p
):
1985 '''tf_port_declaration : port_direction K_reg_opt unsigned_signed_opt dimensions_opt list_of_identifiers ';' '''
1986 if(parse_debug
): print('tf_port_declaration_1', list(p
))
1987 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1],
1988 # p[2] ? IVL_VT_LOGIC :
1990 # p[3], p[4], p[5]);
1994 def p_tf_port_declaration_2(p
):
1995 '''tf_port_declaration : port_direction K_integer list_of_identifiers ';' '''
1996 if(parse_debug
): print('tf_port_declaration_2', list(p
))
1997 # { list<pform_range_t>*range_stub = make_range_from_width(integer_width);
1998 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, true,
1999 # range_stub, p[3], true);
2003 def p_tf_port_declaration_3(p
):
2004 '''tf_port_declaration : port_direction K_time list_of_identifiers ';' '''
2005 if(parse_debug
): print('tf_port_declaration_3', list(p
))
2006 # { list<pform_range_t>*range_stub = make_range_from_width(64);
2007 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, false,
2008 # range_stub, p[3]);
2012 def p_tf_port_declaration_4(p
):
2013 '''tf_port_declaration : port_direction real_or_realtime list_of_identifiers ';' '''
2014 if(parse_debug
): print('tf_port_declaration_4', list(p
))
2015 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_REAL, true,
2020 def p_tf_port_declaration_5(p
):
2021 '''tf_port_declaration : port_direction K_string list_of_identifiers ';' '''
2022 if(parse_debug
): print('tf_port_declaration_5', list(p
))
2023 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_STRING, true,
2028 def p_tf_port_item_1(p
):
2029 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER dimensions_opt tf_port_item_expr_opt '''
2030 if(parse_debug
): print('tf_port_item_1', list(p
))
2031 # { vector<pform_tf_port_t>*tmp;
2032 # NetNet::PortType use_port_type = p[1];
2033 # if ((use_port_type == NetNet::PIMPLICIT) && (gn_system_verilog() || (p[2] == 0)))
2034 # use_port_type = port_declaration_context.port_type;
2035 # perm_string name = lex_strings.make(p[3]);
2036 # list<perm_string>* ilist = list_from_identifier(p[3]);
2038 # if (use_port_type == NetNet::PIMPLICIT) {
2039 # yyerror(@1, "error: missing task/function port direction.");
2040 # use_port_type = NetNet::PINPUT; // for error recovery
2042 # if ((p[2] == 0) && (p[1]==NetNet::PIMPLICIT)) {
2043 # // Detect special case this is an undecorated
2044 # // identifier and we need to get the declaration from
2047 # yyerror(@4, "internal error: How can there be an unpacked range here?\n");
2049 # tmp = pform_make_task_ports(@3, use_port_type,
2050 # port_declaration_context.data_type,
2054 # // Otherwise, the decorations for this identifier
2055 # // indicate the type. Save the type for any right
2056 # // context that may come later.
2057 # port_declaration_context.port_type = use_port_type;
2059 # p[2] = new vector_type_t(IVL_VT_LOGIC, false, 0);
2060 # FILE_NAME(p[2], @3);
2062 # port_declaration_context.data_type = p[2];
2063 # tmp = pform_make_task_ports(@3, use_port_type, p[2], ilist);
2066 # pform_set_reg_idx(name, p[4]);
2071 # assert(tmp->size()==1);
2072 # tmp->front().defe = p[5];
2076 def p_tf_port_item_2(p
):
2077 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER error '''
2078 if(parse_debug
): print('tf_port_item_2', list(p
))
2079 # { yyerror(@3, "error: Error in task/function port item after port name %s.", p[3]);
2084 def p_tf_port_item_expr_opt_1(p
):
2085 '''tf_port_item_expr_opt : '=' expression '''
2086 if(parse_debug
): print('tf_port_item_expr_opt_1', list(p
))
2087 # { if (! gn_system_verilog()) {
2088 # yyerror(@1, "error: Task/function default arguments require "
2089 # "SystemVerilog.");
2094 def p_tf_port_item_expr_opt_2(p
):
2095 '''tf_port_item_expr_opt : '''
2096 if(parse_debug
): print('tf_port_item_expr_opt_2', list(p
))
2099 def p_tf_port_list_1(p
):
2100 '''tf_port_list : _embed0_tf_port_list tf_port_item_list '''
2101 if(parse_debug
): print('tf_port_list_1', list(p
))
2104 def p__embed0_tf_port_list(p
):
2105 '''_embed0_tf_port_list : '''
2106 # { port_declaration_context.port_type = gn_system_verilog() ? NetNet::PINPUT : NetNet::PIMPLICIT;
2107 # port_declaration_context.data_type = 0;
2110 def p_tf_port_item_list_1(p
):
2111 '''tf_port_item_list : tf_port_item_list ',' tf_port_item '''
2112 if(parse_debug
): print('tf_port_item_list_1', list(p
))
2113 # { vector<pform_tf_port_t>*tmp;
2114 # if (p[1] && p[3]) {
2115 # size_t s1 = p[1]->size();
2117 # tmp->resize(tmp->size()+p[3]->size());
2118 # for (size_t idx = 0 ; idx < p[3]->size() ; idx += 1)
2119 # tmp->at(s1+idx) = p[3]->at(idx);
2121 # } else if (p[1]) {
2129 def p_tf_port_item_list_2(p
):
2130 '''tf_port_item_list : tf_port_item '''
2131 if(parse_debug
): print('tf_port_item_list_2', list(p
))
2134 def p_tf_port_item_list_3(p
):
2135 '''tf_port_item_list : error ',' tf_port_item '''
2136 if(parse_debug
): print('tf_port_item_list_3', list(p
))
2137 # { yyerror(@2, "error: Syntax error in task/function port declaration.");
2141 def p_tf_port_item_list_4(p
):
2142 '''tf_port_item_list : tf_port_item_list ',' '''
2143 if(parse_debug
): print('tf_port_item_list_4', list(p
))
2144 # { yyerror(@2, "error: NULL port declarations are not allowed.");
2148 def p_tf_port_item_list_5(p
):
2149 '''tf_port_item_list : tf_port_item_list ';' '''
2150 if(parse_debug
): print('tf_port_item_list_5', list(p
))
2151 # { yyerror(@2, "error: ';' is an invalid port declaration separator.");
2155 def p_timeunits_declaration_1(p
):
2156 '''timeunits_declaration : K_timeunit TIME_LITERAL ';' '''
2157 if(parse_debug
): print('timeunits_declaration_1', list(p
))
2158 # { pform_set_timeunit(p[2], allow_timeunit_decl); }
2160 def p_timeunits_declaration_2(p
):
2161 '''timeunits_declaration : K_timeunit TIME_LITERAL '/' TIME_LITERAL ';' '''
2162 if(parse_debug
): print('timeunits_declaration_2', list(p
))
2163 # { bool initial_decl = allow_timeunit_decl && allow_timeprec_decl;
2164 # pform_set_timeunit(p[2], initial_decl);
2165 # pform_set_timeprec(p[4], initial_decl);
2168 def p_timeunits_declaration_3(p
):
2169 '''timeunits_declaration : K_timeprecision TIME_LITERAL ';' '''
2170 if(parse_debug
): print('timeunits_declaration_3', list(p
))
2171 # { pform_set_timeprec(p[2], allow_timeprec_decl); }
2173 def p_timeunits_declaration_opt_1(p
):
2174 '''timeunits_declaration_opt : %prec no_timeunits_declaration '''
2175 if(parse_debug
>2): print('timeunits_declaration_opt_1', list(p
))
2177 def p_timeunits_declaration_opt_2(p
):
2178 '''timeunits_declaration_opt : timeunits_declaration %prec one_timeunits_declaration '''
2179 if(parse_debug
): print('timeunits_declaration_opt_2', list(p
))
2181 def p_timeunits_declaration_opt_3(p
):
2182 '''timeunits_declaration_opt : timeunits_declaration timeunits_declaration '''
2183 if(parse_debug
): print('timeunits_declaration_opt_3', list(p
))
2185 def p_value_range_1(p
):
2186 '''value_range : expression '''
2187 if(parse_debug
): print('value_range_1', list(p
))
2190 def p_value_range_2(p
):
2191 '''value_range : '[' expression ':' expression ']' '''
2192 if(parse_debug
): print('value_range_2', list(p
))
2195 def p_variable_dimension_1(p
):
2196 '''variable_dimension : '[' expression ':' expression ']' '''
2197 if(parse_debug
): print('variable_dimension_1', list(p
))
2198 # { list<pform_range_t> *tmp = new list<pform_range_t>;
2199 # pform_range_t index (p[2],p[4]);
2200 # tmp->push_back(index);
2203 # XXX TODO: subscriptlist
2206 if end
.endswith("-1"):
2209 end
= str(int(end
)+1)
2212 p
[0] = '[%s:%s]' % (start
, end
) # python slice is LO:HI+1
2214 def p_variable_dimension_2(p
):
2215 '''variable_dimension : '[' expression ']' '''
2216 if(parse_debug
): print('variable_dimension_2', list(p
))
2217 # { // SystemVerilog canonical range
2218 # if (!gn_system_verilog()) {
2220 # cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. "
2221 # << "Use at least -g2005-sv to remove this warning." << endl;
2223 # list<pform_range_t> *tmp = new list<pform_range_t>;
2224 # pform_range_t index;
2225 # index.first = new PENumber(new verinum((uint64_t)0, integer_width));
2226 # index.second = new PEBinary('-', p[2], new PENumber(new verinum((uint64_t)1, integer_width)));
2227 # tmp->push_back(index);
2231 def p_variable_dimension_3(p
):
2232 '''variable_dimension : '[' ']' '''
2233 if(parse_debug
): print('variable_dimension_3', list(p
))
2234 # { list<pform_range_t> *tmp = new list<pform_range_t>;
2235 # pform_range_t index (0,0);
2236 # tmp->push_back(index);
2240 def p_variable_dimension_4(p
):
2241 '''variable_dimension : '[' '$' ']' '''
2242 if(parse_debug
): print('variable_dimension_4', list(p
))
2243 # { // SystemVerilog queue
2244 # list<pform_range_t> *tmp = new list<pform_range_t>;
2245 # pform_range_t index (new PENull,0);
2246 # if (!gn_system_verilog()) {
2247 # yyerror("error: Queue declarations require SystemVerilog.");
2249 # tmp->push_back(index);
2253 def p_variable_lifetime_1(p
):
2254 '''variable_lifetime : lifetime '''
2255 if(parse_debug
): print('variable_lifetime_1', list(p
))
2256 # { if (!gn_system_verilog()) {
2257 # yyerror(@1, "error: overriding the default variable lifetime "
2258 # "requires SystemVerilog.");
2259 # } else if (p[1] != pform_peek_scope()->default_lifetime) {
2260 # yyerror(@1, "sorry: overriding the default variable lifetime "
2261 # "is not yet supported.");
2263 # var_lifetime = p[1];
2266 def p_attribute_list_opt_1(p
):
2267 '''attribute_list_opt : attribute_instance_list '''
2268 if(parse_debug
): print('attribute_list_opt_1', list(p
))
2271 def p_attribute_list_opt_2(p
):
2272 '''attribute_list_opt : '''
2273 if(parse_debug
> 2): print('attribute_list_opt_2', list(p
))
2276 def p_attribute_instance_list_1(p
):
2277 '''attribute_instance_list : K_PSTAR K_STARP '''
2278 if(parse_debug
): print('attribute_instance_list_1', list(p
))
2281 def p_attribute_instance_list_2(p
):
2282 '''attribute_instance_list : K_PSTAR attribute_list K_STARP '''
2283 if(parse_debug
): print('attribute_instance_list_2', list(p
))
2286 def p_attribute_instance_list_3(p
):
2287 '''attribute_instance_list : attribute_instance_list K_PSTAR K_STARP '''
2288 if(parse_debug
): print('attribute_instance_list_3', list(p
))
2291 def p_attribute_instance_list_4(p
):
2292 '''attribute_instance_list : attribute_instance_list K_PSTAR attribute_list K_STARP '''
2293 if(parse_debug
): print('attribute_instance_list_4', list(p
))
2294 # { list<named_pexpr_t>*tmp = p[1];
2296 # tmp->splice(tmp->end(), *p[3]);
2299 # } else p[0] = p[3];
2302 def p_attribute_list_1(p
):
2303 '''attribute_list : attribute_list ',' attribute '''
2304 if(parse_debug
): print('attribute_list_1', list(p
))
2305 # { list<named_pexpr_t>*tmp = p[1];
2306 # tmp->push_back(*p[3]);
2311 def p_attribute_list_2(p
):
2312 '''attribute_list : attribute '''
2313 if(parse_debug
): print('attribute_list_2', list(p
))
2314 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
2315 # tmp->push_back(*p[1]);
2320 def p_attribute_1(p
):
2321 '''attribute : IDENTIFIER '''
2322 if(parse_debug
): print('attribute_1', list(p
))
2323 # { named_pexpr_t*tmp = new named_pexpr_t;
2324 # tmp->name = lex_strings.make(p[1]);
2330 def p_attribute_2(p
):
2331 '''attribute : IDENTIFIER '=' expression '''
2332 if(parse_debug
): print('attribute_2', list(p
))
2333 # { PExpr*tmp = p[3];
2334 # named_pexpr_t*tmp2 = new named_pexpr_t;
2335 # tmp2->name = lex_strings.make(p[1]);
2341 def p_block_item_decl_1(p
):
2342 '''block_item_decl : data_type register_variable_list ';' '''
2343 if(parse_debug
): print('block_item_decl_1', list(p
))
2344 # { if (p[1]) pform_set_data_type(@1, p[1], p[2], NetNet::REG, attributes_in_context);
2347 def p_block_item_decl_2(p
):
2348 '''block_item_decl : variable_lifetime data_type register_variable_list ';' '''
2349 if(parse_debug
): print('block_item_decl_2', list(p
))
2350 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
2351 # var_lifetime = LexicalScope::INHERITED;
2354 def p_block_item_decl_3(p
):
2355 '''block_item_decl : K_reg data_type register_variable_list ';' '''
2356 if(parse_debug
): print('block_item_decl_3', list(p
))
2357 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
2360 def p_block_item_decl_4(p
):
2361 '''block_item_decl : variable_lifetime K_reg data_type register_variable_list ';' '''
2362 if(parse_debug
): print('block_item_decl_4', list(p
))
2363 # { if (p[3]) pform_set_data_type(@3, p[3], p[4], NetNet::REG, attributes_in_context);
2364 # var_lifetime = LexicalScope::INHERITED;
2367 def p_block_item_decl_5(p
):
2368 '''block_item_decl : K_event event_variable_list ';' '''
2369 if(parse_debug
): print('block_item_decl_5', list(p
))
2370 # { if (p[2]) pform_make_events(p[2], @1.text, @1.first_line);
2373 def p_block_item_decl_6(p
):
2374 '''block_item_decl : K_parameter param_type parameter_assign_list ';' '''
2375 if(parse_debug
): print('block_item_decl_6', list(p
))
2377 def p_block_item_decl_7(p
):
2378 '''block_item_decl : K_localparam param_type localparam_assign_list ';' '''
2379 if(parse_debug
): print('block_item_decl_7', list(p
))
2381 def p_block_item_decl_8(p
):
2382 '''block_item_decl : type_declaration '''
2383 if(parse_debug
): print('block_item_decl_8', list(p
))
2385 def p_block_item_decl_9(p
):
2386 '''block_item_decl : K_integer error ';' '''
2387 if(parse_debug
): print('block_item_decl_9', list(p
))
2388 # { yyerror(@1, "error: syntax error in integer variable list.");
2392 def p_block_item_decl_10(p
):
2393 '''block_item_decl : K_time error ';' '''
2394 if(parse_debug
): print('block_item_decl_10', list(p
))
2395 # { yyerror(@1, "error: syntax error in time variable list.");
2399 def p_block_item_decl_11(p
):
2400 '''block_item_decl : K_parameter error ';' '''
2401 if(parse_debug
): print('block_item_decl_11', list(p
))
2402 # { yyerror(@1, "error: syntax error in parameter list.");
2406 def p_block_item_decl_12(p
):
2407 '''block_item_decl : K_localparam error ';' '''
2408 if(parse_debug
): print('block_item_decl_12', list(p
))
2409 # { yyerror(@1, "error: syntax error localparam list.");
2413 def p_block_item_decls_1(p
):
2414 '''block_item_decls : block_item_decl '''
2415 if(parse_debug
): print('block_item_decls_1', list(p
))
2417 def p_block_item_decls_2(p
):
2418 '''block_item_decls : block_item_decls block_item_decl '''
2419 if(parse_debug
): print('block_item_decls_2', list(p
))
2421 def p_block_item_decls_opt_1(p
):
2422 '''block_item_decls_opt : block_item_decls '''
2423 if(parse_debug
): print('block_item_decls_opt_1', list(p
))
2426 def p_block_item_decls_opt_2(p
):
2427 '''block_item_decls_opt : '''
2428 if(parse_debug
): print('block_item_decls_opt_2', list(p
))
2431 def p_type_declaration_1(p
):
2432 '''type_declaration : K_typedef data_type IDENTIFIER dimensions_opt ';' '''
2433 if(parse_debug
): print('type_declaration_1', list(p
))
2434 # { perm_string name = lex_strings.make(p[3]);
2435 # pform_set_typedef(name, p[2], p[4]);
2439 def p_type_declaration_2(p
):
2440 '''type_declaration : K_typedef data_type TYPE_IDENTIFIER ';' '''
2441 if(parse_debug
): print('type_declaration_2', list(p
))
2442 # { perm_string name = lex_strings.make(p[3].text);
2443 # if (pform_test_type_identifier_local(name)) {
2444 # yyerror(@3, "error: Typedef identifier \"%s\" is already a type name.", p[3].text);
2447 # pform_set_typedef(name, p[2], NULL);
2449 # delete[]p[3].text;
2452 def p_type_declaration_3(p
):
2453 '''type_declaration : K_typedef K_class IDENTIFIER ';' '''
2454 if(parse_debug
): print('type_declaration_3', list(p
))
2455 # { // Create a synthetic typedef for the class name so that the
2456 # // lexor detects the name as a type.
2457 # perm_string name = lex_strings.make(p[3]);
2458 # class_type_t*tmp = new class_type_t(name);
2459 # FILE_NAME(tmp, @3);
2460 # pform_set_typedef(name, tmp, NULL);
2464 def p_type_declaration_4(p
):
2465 '''type_declaration : K_typedef K_enum IDENTIFIER ';' '''
2466 if(parse_debug
): print('type_declaration_4', list(p
))
2467 # { yyerror(@1, "sorry: Enum forward declarations not supported yet."); }
2469 def p_type_declaration_5(p
):
2470 '''type_declaration : K_typedef K_struct IDENTIFIER ';' '''
2471 if(parse_debug
): print('type_declaration_5', list(p
))
2472 # { yyerror(@1, "sorry: Struct forward declarations not supported yet."); }
2474 def p_type_declaration_6(p
):
2475 '''type_declaration : K_typedef K_union IDENTIFIER ';' '''
2476 if(parse_debug
): print('type_declaration_6', list(p
))
2477 # { yyerror(@1, "sorry: Union forward declarations not supported yet."); }
2479 def p_type_declaration_7(p
):
2480 '''type_declaration : K_typedef IDENTIFIER ';' '''
2481 if(parse_debug
): print('type_declaration_7', list(p
))
2482 # { // Create a synthetic typedef for the class name so that the
2483 # // lexor detects the name as a type.
2484 # perm_string name = lex_strings.make(p[2]);
2485 # class_type_t*tmp = new class_type_t(name);
2486 # FILE_NAME(tmp, @2);
2487 # pform_set_typedef(name, tmp, NULL);
2491 def p_type_declaration_8(p
):
2492 '''type_declaration : K_typedef error ';' '''
2493 if(parse_debug
): print('type_declaration_8', list(p
))
2494 # { yyerror(@2, "error: Syntax error in typedef clause.");
2498 def p_enum_data_type_1(p
):
2499 '''enum_data_type : K_enum '{' enum_name_list '}' '''
2500 if(parse_debug
): print('enum_data_type_1', list(p
))
2501 # { enum_type_t*enum_type = new enum_type_t;
2502 # FILE_NAME(enum_type, @1);
2503 # enum_type->names .reset(p[3]);
2504 # enum_type->base_type = IVL_VT_BOOL;
2505 # enum_type->signed_flag = true;
2506 # enum_type->integer_flag = false;
2507 # enum_type->range.reset(make_range_from_width(32));
2511 def p_enum_data_type_2(p
):
2512 '''enum_data_type : K_enum atom2_type signed_unsigned_opt '{' enum_name_list '}' '''
2513 if(parse_debug
): print('enum_data_type_2', list(p
))
2514 # { enum_type_t*enum_type = new enum_type_t;
2515 # FILE_NAME(enum_type, @1);
2516 # enum_type->names .reset(p[5]);
2517 # enum_type->base_type = IVL_VT_BOOL;
2518 # enum_type->signed_flag = p[3];
2519 # enum_type->integer_flag = false;
2520 # enum_type->range.reset(make_range_from_width(p[2]));
2524 def p_enum_data_type_3(p
):
2525 '''enum_data_type : K_enum K_integer signed_unsigned_opt '{' enum_name_list '}' '''
2526 if(parse_debug
): print('enum_data_type_3', list(p
))
2527 # { enum_type_t*enum_type = new enum_type_t;
2528 # FILE_NAME(enum_type, @1);
2529 # enum_type->names .reset(p[5]);
2530 # enum_type->base_type = IVL_VT_LOGIC;
2531 # enum_type->signed_flag = p[3];
2532 # enum_type->integer_flag = true;
2533 # enum_type->range.reset(make_range_from_width(integer_width));
2537 def p_enum_data_type_4(p
):
2538 '''enum_data_type : K_enum K_logic unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2539 if(parse_debug
): print('enum_data_type_4', list(p
))
2540 # { enum_type_t*enum_type = new enum_type_t;
2541 # FILE_NAME(enum_type, @1);
2542 # enum_type->names .reset(p[6]);
2543 # enum_type->base_type = IVL_VT_LOGIC;
2544 # enum_type->signed_flag = p[3];
2545 # enum_type->integer_flag = false;
2546 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
2550 def p_enum_data_type_5(p
):
2551 '''enum_data_type : K_enum K_reg unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2552 if(parse_debug
): print('enum_data_type_5', list(p
))
2553 # { enum_type_t*enum_type = new enum_type_t;
2554 # FILE_NAME(enum_type, @1);
2555 # enum_type->names .reset(p[6]);
2556 # enum_type->base_type = IVL_VT_LOGIC;
2557 # enum_type->signed_flag = p[3];
2558 # enum_type->integer_flag = false;
2559 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
2563 def p_enum_data_type_6(p
):
2564 '''enum_data_type : K_enum K_bit unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2565 if(parse_debug
): print('enum_data_type_6', list(p
))
2566 # { enum_type_t*enum_type = new enum_type_t;
2567 # FILE_NAME(enum_type, @1);
2568 # enum_type->names .reset(p[6]);
2569 # enum_type->base_type = IVL_VT_BOOL;
2570 # enum_type->signed_flag = p[3];
2571 # enum_type->integer_flag = false;
2572 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
2576 def p_enum_name_list_1(p
):
2577 '''enum_name_list : enum_name '''
2578 if(parse_debug
): print('enum_name_list_1', list(p
))
2582 def p_enum_name_list_2(p
):
2583 '''enum_name_list : enum_name_list ',' enum_name '''
2584 if(parse_debug
): print('enum_name_list_2', list(p
))
2585 # { list<named_pexpr_t>*lst = p[1];
2586 # lst->splice(lst->end(), *p[3]);
2591 def p_pos_neg_number_1(p
):
2592 '''pos_neg_number : number '''
2593 if(parse_debug
): print('pos_neg_number_1', list(p
))
2597 def p_pos_neg_number_2(p
):
2598 '''pos_neg_number : '-' number '''
2599 if(parse_debug
): print('pos_neg_number_2', list(p
))
2600 # { verinum tmp = -(*(p[2]));
2605 def p_enum_name_1(p
):
2606 '''enum_name : IDENTIFIER '''
2607 if(parse_debug
): print('enum_name_1', list(p
))
2608 # { perm_string name = lex_strings.make(p[1]);
2610 # p[0] = make_named_number(name);
2613 def p_enum_name_2(p
):
2614 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '''
2615 if(parse_debug
): print('enum_name_2', list(p
))
2616 # { perm_string name = lex_strings.make(p[1]);
2617 # long count = check_enum_seq_value(@1, p[3], false);
2619 # p[0] = make_named_numbers(name, 0, count-1);
2623 def p_enum_name_3(p
):
2624 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '''
2625 if(parse_debug
): print('enum_name_3', list(p
))
2626 # { perm_string name = lex_strings.make(p[1]);
2627 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
2628 # check_enum_seq_value(@1, p[5], true));
2634 def p_enum_name_4(p
):
2635 '''enum_name : IDENTIFIER '=' expression '''
2636 if(parse_debug
): print('enum_name_4', list(p
))
2637 # { perm_string name = lex_strings.make(p[1]);
2639 # p[0] = make_named_number(name, p[3]);
2642 def p_enum_name_5(p
):
2643 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '=' expression '''
2644 if(parse_debug
): print('enum_name_5', list(p
))
2645 # { perm_string name = lex_strings.make(p[1]);
2646 # long count = check_enum_seq_value(@1, p[3], false);
2647 # p[0] = make_named_numbers(name, 0, count-1, p[6]);
2652 def p_enum_name_6(p
):
2653 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '=' expression '''
2654 if(parse_debug
): print('enum_name_6', list(p
))
2655 # { perm_string name = lex_strings.make(p[1]);
2656 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
2657 # check_enum_seq_value(@1, p[5], true), p[8]);
2663 def p_struct_data_type_1(p
):
2664 '''struct_data_type : K_struct K_packed_opt '{' struct_union_member_list '}' '''
2665 if(parse_debug
): print('struct_data_type_1', list(p
))
2666 # { struct_type_t*tmp = new struct_type_t;
2667 # FILE_NAME(tmp, @1);
2668 # tmp->packed_flag = p[2];
2669 # tmp->union_flag = false;
2670 # tmp->members .reset(p[4]);
2674 def p_struct_data_type_2(p
):
2675 '''struct_data_type : K_union K_packed_opt '{' struct_union_member_list '}' '''
2676 if(parse_debug
): print('struct_data_type_2', list(p
))
2677 # { struct_type_t*tmp = new struct_type_t;
2678 # FILE_NAME(tmp, @1);
2679 # tmp->packed_flag = p[2];
2680 # tmp->union_flag = true;
2681 # tmp->members .reset(p[4]);
2685 def p_struct_data_type_3(p
):
2686 '''struct_data_type : K_struct K_packed_opt '{' error '}' '''
2687 if(parse_debug
): print('struct_data_type_3', list(p
))
2688 # { yyerror(@3, "error: Errors in struct member list.");
2690 # struct_type_t*tmp = new struct_type_t;
2691 # FILE_NAME(tmp, @1);
2692 # tmp->packed_flag = p[2];
2693 # tmp->union_flag = false;
2697 def p_struct_data_type_4(p
):
2698 '''struct_data_type : K_union K_packed_opt '{' error '}' '''
2699 if(parse_debug
): print('struct_data_type_4', list(p
))
2700 # { yyerror(@3, "error: Errors in union member list.");
2702 # struct_type_t*tmp = new struct_type_t;
2703 # FILE_NAME(tmp, @1);
2704 # tmp->packed_flag = p[2];
2705 # tmp->union_flag = true;
2709 def p_struct_union_member_list_1(p
):
2710 '''struct_union_member_list : struct_union_member_list struct_union_member '''
2711 if(parse_debug
): print('struct_union_member_list_1', list(p
))
2712 # { list<struct_member_t*>*tmp = p[1];
2713 # tmp->push_back(p[2]);
2717 def p_struct_union_member_list_2(p
):
2718 '''struct_union_member_list : struct_union_member '''
2719 if(parse_debug
): print('struct_union_member_list_2', list(p
))
2720 # { list<struct_member_t*>*tmp = new list<struct_member_t*>;
2721 # tmp->push_back(p[1]);
2725 def p_struct_union_member_1(p
):
2726 '''struct_union_member : attribute_list_opt data_type list_of_variable_decl_assignments ';' '''
2727 if(parse_debug
): print('struct_union_member_1', list(p
))
2728 # { struct_member_t*tmp = new struct_member_t;
2729 # FILE_NAME(tmp, @2);
2730 # tmp->type .reset(p[2]);
2731 # tmp->names .reset(p[3]);
2735 def p_struct_union_member_2(p
):
2736 '''struct_union_member : error ';' '''
2737 if(parse_debug
): print('struct_union_member_2', list(p
))
2738 # { yyerror(@2, "Error in struct/union member.");
2743 def p_case_item_1(p
):
2744 '''case_item : expression_list_proper ':' statement_or_null '''
2745 if(parse_debug
): print('case_item_1', list(p
))
2746 # { PCase::Item*tmp = new PCase::Item;
2747 # tmp->expr = *p[1];
2753 def p_case_item_2(p
):
2754 '''case_item : K_default ':' statement_or_null '''
2755 if(parse_debug
): print('case_item_2', list(p
))
2756 # { PCase::Item*tmp = new PCase::Item;
2761 def p_case_item_3(p
):
2762 '''case_item : K_default statement_or_null '''
2763 if(parse_debug
): print('case_item_3', list(p
))
2764 # { PCase::Item*tmp = new PCase::Item;
2769 def p_case_item_4(p
):
2770 '''case_item : error ':' statement_or_null '''
2771 if(parse_debug
): print('case_item_4', list(p
))
2772 # { yyerror(@2, "error: Incomprehensible case expression.");
2776 def p_case_items_1(p
):
2777 '''case_items : case_items case_item '''
2778 if(parse_debug
): print('case_items_1', list(p
))
2779 # { svector<PCase::Item*>*tmp;
2780 # tmp = new svector<PCase::Item*>(*p[1], p[2]);
2785 def p_case_items_2(p
):
2786 '''case_items : case_item '''
2787 if(parse_debug
): print('case_items_2', list(p
))
2788 # { svector<PCase::Item*>*tmp = new svector<PCase::Item*>(1);
2793 def p_charge_strength_1(p
):
2794 '''charge_strength : '(' K_small ')' '''
2795 if(parse_debug
): print('charge_strength_1', list(p
))
2797 def p_charge_strength_2(p
):
2798 '''charge_strength : '(' K_medium ')' '''
2799 if(parse_debug
): print('charge_strength_2', list(p
))
2801 def p_charge_strength_3(p
):
2802 '''charge_strength : '(' K_large ')' '''
2803 if(parse_debug
): print('charge_strength_3', list(p
))
2805 def p_charge_strength_opt_1(p
):
2806 '''charge_strength_opt : charge_strength '''
2807 if(parse_debug
): print('charge_strength_opt_1', list(p
))
2809 def p_charge_strength_opt_2(p
):
2810 '''charge_strength_opt : '''
2811 if(parse_debug
): print('charge_strength_opt_2', list(p
))
2813 def p_defparam_assign_1(p
):
2814 '''defparam_assign : hierarchy_identifier '=' expression '''
2815 if(parse_debug
): print('defparam_assign_1', list(p
))
2816 # { pform_set_defparam(*p[1], p[3]);
2820 def p_defparam_assign_list_1(p
):
2821 '''defparam_assign_list : defparam_assign '''
2822 if(parse_debug
): print('defparam_assign_list_1', list(p
))
2824 def p_defparam_assign_list_2(p
):
2825 '''defparam_assign_list : dimensions defparam_assign '''
2826 if(parse_debug
): print('defparam_assign_list_2', list(p
))
2827 # { yyerror(@1, "error: defparam may not include a range.");
2831 def p_defparam_assign_list_3(p
):
2832 '''defparam_assign_list : defparam_assign_list ',' defparam_assign '''
2833 if(parse_debug
): print('defparam_assign_list_3', list(p
))
2836 '''delay1 : '#' delay_value_simple '''
2837 if(parse_debug
): print('delay1_1', list(p
))
2838 # { list<PExpr*>*tmp = new list<PExpr*>;
2839 # tmp->push_back(p[2]);
2844 '''delay1 : '#' '(' delay_value ')' '''
2845 if(parse_debug
): print('delay1_2', list(p
))
2846 # { list<PExpr*>*tmp = new list<PExpr*>;
2847 # tmp->push_back(p[3]);
2852 '''delay3 : '#' delay_value_simple '''
2853 if(parse_debug
): print('delay3_1', list(p
))
2854 # { list<PExpr*>*tmp = new list<PExpr*>;
2855 # tmp->push_back(p[2]);
2860 '''delay3 : '#' '(' delay_value ')' '''
2861 if(parse_debug
): print('delay3_2', list(p
))
2862 # { list<PExpr*>*tmp = new list<PExpr*>;
2863 # tmp->push_back(p[3]);
2868 '''delay3 : '#' '(' delay_value ',' delay_value ')' '''
2869 if(parse_debug
): print('delay3_3', list(p
))
2870 # { list<PExpr*>*tmp = new list<PExpr*>;
2871 # tmp->push_back(p[3]);
2872 # tmp->push_back(p[5]);
2877 '''delay3 : '#' '(' delay_value ',' delay_value ',' delay_value ')' '''
2878 if(parse_debug
): print('delay3_4', list(p
))
2879 # { list<PExpr*>*tmp = new list<PExpr*>;
2880 # tmp->push_back(p[3]);
2881 # tmp->push_back(p[5]);
2882 # tmp->push_back(p[7]);
2886 def p_delay3_opt_1(p
):
2887 '''delay3_opt : delay3 '''
2888 if(parse_debug
): print('delay3_opt_1', list(p
))
2891 def p_delay3_opt_2(p
):
2893 if(parse_debug
>2): print('delay3_opt_2', list(p
))
2896 def p_delay_value_list_1(p
):
2897 '''delay_value_list : delay_value '''
2898 if(parse_debug
): print('delay_value_list_1', list(p
))
2899 # { list<PExpr*>*tmp = new list<PExpr*>;
2900 # tmp->push_back(p[1]);
2904 def p_delay_value_list_2(p
):
2905 '''delay_value_list : delay_value_list ',' delay_value '''
2906 if(parse_debug
): print('delay_value_list_2', list(p
))
2907 # { list<PExpr*>*tmp = p[1];
2908 # tmp->push_back(p[3]);
2912 def p_delay_value_1(p
):
2913 '''delay_value : expression '''
2914 if(parse_debug
): print('delay_value_1', list(p
))
2915 # { PExpr*tmp = p[1];
2919 def p_delay_value_2(p
):
2920 '''delay_value : expression ':' expression ':' expression '''
2921 if(parse_debug
): print('delay_value_2', list(p
))
2922 # { p[0] = pform_select_mtm_expr(p[1], p[3], p[5]); }
2924 def p_delay_value_simple_1(p
):
2925 '''delay_value_simple : DEC_NUMBER '''
2926 if(parse_debug
): print('delay_value_simple_1', list(p
))
2927 # { verinum*tmp = p[1];
2929 # yyerror(@1, "internal error: delay.");
2932 # p[0] = new PENumber(tmp);
2933 # FILE_NAME(p[0], @1);
2938 def p_delay_value_simple_2(p
):
2939 '''delay_value_simple : REALTIME '''
2940 if(parse_debug
): print('delay_value_simple_2', list(p
))
2941 # { verireal*tmp = p[1];
2943 # yyerror(@1, "internal error: delay.");
2946 # p[0] = new PEFNumber(tmp);
2947 # FILE_NAME(p[0], @1);
2951 def p_delay_value_simple_3(p
):
2952 '''delay_value_simple : IDENTIFIER '''
2953 if(parse_debug
): print('delay_value_simple_3', list(p
))
2954 # { PEIdent*tmp = new PEIdent(lex_strings.make(p[1]));
2955 # FILE_NAME(tmp, @1);
2960 def p_delay_value_simple_4(p
):
2961 '''delay_value_simple : TIME_LITERAL '''
2962 if(parse_debug
): print('delay_value_simple_4', list(p
))
2967 # if (p[1] == 0 || !get_time_unit(p[1], unit))
2968 # yyerror(@1, "internal error: delay.");
2970 # double p = pow(10.0,
2971 # (double)(unit - pform_get_timeunit()));
2972 # double time = atof(p[1]) * p;
2974 # verireal *v = new verireal(time);
2975 # p[0] = new PEFNumber(v);
2976 # FILE_NAME(p[0], @1);
2980 def p_optional_semicolon_1(p
):
2981 '''optional_semicolon : ';' '''
2982 if(parse_debug
): print('optional_semicolon_1', list(p
))
2984 def p_optional_semicolon_2(p
):
2985 '''optional_semicolon : '''
2986 if(parse_debug
): print('optional_semicolon_2', list(p
))
2988 def p_discipline_declaration_1(p
):
2989 '''discipline_declaration : K_discipline IDENTIFIER optional_semicolon _embed0_discipline_declaration discipline_items K_enddiscipline '''
2990 if(parse_debug
): print('discipline_declaration_1', list(p
))
2991 # { pform_end_discipline(@1); delete[] p[2]; }
2993 def p__embed0_discipline_declaration(p
):
2994 '''_embed0_discipline_declaration : '''
2995 # { pform_start_discipline(p[2]); }
2997 def p_discipline_items_1(p
):
2998 '''discipline_items : discipline_items discipline_item '''
2999 if(parse_debug
): print('discipline_items_1', list(p
))
3001 def p_discipline_items_2(p
):
3002 '''discipline_items : discipline_item '''
3003 if(parse_debug
): print('discipline_items_2', list(p
))
3005 def p_discipline_item_1(p
):
3006 '''discipline_item : K_domain K_discrete ';' '''
3007 if(parse_debug
): print('discipline_item_1', list(p
))
3008 # { pform_discipline_domain(@1, IVL_DIS_DISCRETE); }
3010 def p_discipline_item_2(p
):
3011 '''discipline_item : K_domain K_continuous ';' '''
3012 if(parse_debug
): print('discipline_item_2', list(p
))
3013 # { pform_discipline_domain(@1, IVL_DIS_CONTINUOUS); }
3015 def p_discipline_item_3(p
):
3016 '''discipline_item : K_potential IDENTIFIER ';' '''
3017 if(parse_debug
): print('discipline_item_3', list(p
))
3018 # { pform_discipline_potential(@1, p[2]); delete[] p[2]; }
3020 def p_discipline_item_4(p
):
3021 '''discipline_item : K_flow IDENTIFIER ';' '''
3022 if(parse_debug
): print('discipline_item_4', list(p
))
3023 # { pform_discipline_flow(@1, p[2]); delete[] p[2]; }
3025 def p_nature_declaration_1(p
):
3026 '''nature_declaration : K_nature IDENTIFIER optional_semicolon _embed0_nature_declaration nature_items K_endnature '''
3027 if(parse_debug
): print('nature_declaration_1', list(p
))
3028 # { pform_end_nature(@1); delete[] p[2]; }
3030 def p__embed0_nature_declaration(p
):
3031 '''_embed0_nature_declaration : '''
3032 # { pform_start_nature(p[2]); }
3034 def p_nature_items_1(p
):
3035 '''nature_items : nature_items nature_item '''
3036 if(parse_debug
): print('nature_items_1', list(p
))
3038 def p_nature_items_2(p
):
3039 '''nature_items : nature_item '''
3040 if(parse_debug
): print('nature_items_2', list(p
))
3042 def p_nature_item_1(p
):
3043 '''nature_item : K_units '=' STRING ';' '''
3044 if(parse_debug
): print('nature_item_1', list(p
))
3045 # { delete[] p[3]; }
3047 def p_nature_item_2(p
):
3048 '''nature_item : K_abstol '=' expression ';' '''
3049 if(parse_debug
): print('nature_item_2', list(p
))
3051 def p_nature_item_3(p
):
3052 '''nature_item : K_access '=' IDENTIFIER ';' '''
3053 if(parse_debug
): print('nature_item_3', list(p
))
3054 # { pform_nature_access(@1, p[3]); delete[] p[3]; }
3056 def p_nature_item_4(p
):
3057 '''nature_item : K_idt_nature '=' IDENTIFIER ';' '''
3058 if(parse_debug
): print('nature_item_4', list(p
))
3059 # { delete[] p[3]; }
3061 def p_nature_item_5(p
):
3062 '''nature_item : K_ddt_nature '=' IDENTIFIER ';' '''
3063 if(parse_debug
): print('nature_item_5', list(p
))
3064 # { delete[] p[3]; }
3066 def p_config_declaration_1(p
):
3067 '''config_declaration : K_config IDENTIFIER ';' K_design lib_cell_identifiers ';' list_of_config_rule_statements K_endconfig '''
3068 if(parse_debug
): print('config_declaration_1', list(p
))
3069 # { cerr << @1 << ": sorry: config declarations are not supported and "
3070 # "will be skipped." << endl;
3074 def p_lib_cell_identifiers_1(p
):
3075 '''lib_cell_identifiers : '''
3076 if(parse_debug
): print('lib_cell_identifiers_1', list(p
))
3078 def p_lib_cell_identifiers_2(p
):
3079 '''lib_cell_identifiers : lib_cell_identifiers lib_cell_id '''
3080 if(parse_debug
): print('lib_cell_identifiers_2', list(p
))
3082 def p_list_of_config_rule_statements_1(p
):
3083 '''list_of_config_rule_statements : '''
3084 if(parse_debug
): print('list_of_config_rule_statements_1', list(p
))
3086 def p_list_of_config_rule_statements_2(p
):
3087 '''list_of_config_rule_statements : list_of_config_rule_statements config_rule_statement '''
3088 if(parse_debug
): print('list_of_config_rule_statements_2', list(p
))
3090 def p_config_rule_statement_1(p
):
3091 '''config_rule_statement : K_default K_liblist list_of_libraries ';' '''
3092 if(parse_debug
): print('config_rule_statement_1', list(p
))
3094 def p_config_rule_statement_2(p
):
3095 '''config_rule_statement : K_instance hierarchy_identifier K_liblist list_of_libraries ';' '''
3096 if(parse_debug
): print('config_rule_statement_2', list(p
))
3099 def p_config_rule_statement_3(p
):
3100 '''config_rule_statement : K_instance hierarchy_identifier K_use lib_cell_id opt_config ';' '''
3101 if(parse_debug
): print('config_rule_statement_3', list(p
))
3104 def p_config_rule_statement_4(p
):
3105 '''config_rule_statement : K_cell lib_cell_id K_liblist list_of_libraries ';' '''
3106 if(parse_debug
): print('config_rule_statement_4', list(p
))
3108 def p_config_rule_statement_5(p
):
3109 '''config_rule_statement : K_cell lib_cell_id K_use lib_cell_id opt_config ';' '''
3110 if(parse_debug
): print('config_rule_statement_5', list(p
))
3112 def p_opt_config_1(p
):
3114 if(parse_debug
): print('opt_config_1', list(p
))
3116 def p_opt_config_2(p
):
3117 '''opt_config : ':' K_config '''
3118 if(parse_debug
): print('opt_config_2', list(p
))
3120 def p_lib_cell_id_1(p
):
3121 '''lib_cell_id : IDENTIFIER '''
3122 if(parse_debug
): print('lib_cell_id_1', list(p
))
3123 # { delete[] p[1]; }
3125 def p_lib_cell_id_2(p
):
3126 '''lib_cell_id : IDENTIFIER '.' IDENTIFIER '''
3127 if(parse_debug
): print('lib_cell_id_2', list(p
))
3128 # { delete[] p[1]; delete[] p[3]; }
3130 def p_list_of_libraries_1(p
):
3131 '''list_of_libraries : '''
3132 if(parse_debug
): print('list_of_libraries_1', list(p
))
3134 def p_list_of_libraries_2(p
):
3135 '''list_of_libraries : list_of_libraries IDENTIFIER '''
3136 if(parse_debug
): print('list_of_libraries_2', list(p
))
3137 # { delete[] p[2]; }
3139 def p_drive_strength_1(p
):
3140 '''drive_strength : '(' dr_strength0 ',' dr_strength1 ')' '''
3141 if(parse_debug
): print('drive_strength_1', list(p
))
3142 # { p[0].str0 = p[2].str0;
3143 # p[0].str1 = p[4].str1;
3146 def p_drive_strength_2(p
):
3147 '''drive_strength : '(' dr_strength1 ',' dr_strength0 ')' '''
3148 if(parse_debug
): print('drive_strength_2', list(p
))
3149 # { p[0].str0 = p[4].str0;
3150 # p[0].str1 = p[2].str1;
3153 def p_drive_strength_3(p
):
3154 '''drive_strength : '(' dr_strength0 ',' K_highz1 ')' '''
3155 if(parse_debug
): print('drive_strength_3', list(p
))
3156 # { p[0].str0 = p[2].str0;
3157 # p[0].str1 = IVL_DR_HiZ;
3160 def p_drive_strength_4(p
):
3161 '''drive_strength : '(' dr_strength1 ',' K_highz0 ')' '''
3162 if(parse_debug
): print('drive_strength_4', list(p
))
3163 # { p[0].str0 = IVL_DR_HiZ;
3164 # p[0].str1 = p[2].str1;
3167 def p_drive_strength_5(p
):
3168 '''drive_strength : '(' K_highz1 ',' dr_strength0 ')' '''
3169 if(parse_debug
): print('drive_strength_5', list(p
))
3170 # { p[0].str0 = p[4].str0;
3171 # p[0].str1 = IVL_DR_HiZ;
3174 def p_drive_strength_6(p
):
3175 '''drive_strength : '(' K_highz0 ',' dr_strength1 ')' '''
3176 if(parse_debug
): print('drive_strength_6', list(p
))
3177 # { p[0].str0 = IVL_DR_HiZ;
3178 # p[0].str1 = p[4].str1;
3181 def p_drive_strength_opt_1(p
):
3182 '''drive_strength_opt : drive_strength '''
3183 if(parse_debug
): print('drive_strength_opt_1', list(p
))
3186 def p_drive_strength_opt_2(p
):
3187 '''drive_strength_opt : '''
3188 if(parse_debug
>2): print('drive_strength_opt_2', list(p
))
3189 # { p[0].str0 = IVL_DR_STRONG; p[0].str1 = IVL_DR_STRONG; }
3191 def p_dr_strength0_1(p
):
3192 '''dr_strength0 : K_supply0 '''
3193 if(parse_debug
): print('dr_strength0_1', list(p
))
3194 # { p[0].str0 = IVL_DR_SUPPLY; }
3196 def p_dr_strength0_2(p
):
3197 '''dr_strength0 : K_strong0 '''
3198 if(parse_debug
): print('dr_strength0_2', list(p
))
3199 # { p[0].str0 = IVL_DR_STRONG; }
3201 def p_dr_strength0_3(p
):
3202 '''dr_strength0 : K_pull0 '''
3203 if(parse_debug
): print('dr_strength0_3', list(p
))
3204 # { p[0].str0 = IVL_DR_PULL; }
3206 def p_dr_strength0_4(p
):
3207 '''dr_strength0 : K_weak0 '''
3208 if(parse_debug
): print('dr_strength0_4', list(p
))
3209 # { p[0].str0 = IVL_DR_WEAK; }
3211 def p_dr_strength1_1(p
):
3212 '''dr_strength1 : K_supply1 '''
3213 if(parse_debug
): print('dr_strength1_1', list(p
))
3214 # { p[0].str1 = IVL_DR_SUPPLY; }
3216 def p_dr_strength1_2(p
):
3217 '''dr_strength1 : K_strong1 '''
3218 if(parse_debug
): print('dr_strength1_2', list(p
))
3219 # { p[0].str1 = IVL_DR_STRONG; }
3221 def p_dr_strength1_3(p
):
3222 '''dr_strength1 : K_pull1 '''
3223 if(parse_debug
): print('dr_strength1_3', list(p
))
3224 # { p[0].str1 = IVL_DR_PULL; }
3226 def p_dr_strength1_4(p
):
3227 '''dr_strength1 : K_weak1 '''
3228 if(parse_debug
): print('dr_strength1_4', list(p
))
3229 # { p[0].str1 = IVL_DR_WEAK; }
3231 def p_clocking_event_opt_1(p
):
3232 '''clocking_event_opt : event_control '''
3233 if(parse_debug
): print('clocking_event_opt_1', list(p
))
3235 def p_clocking_event_opt_2(p
):
3236 '''clocking_event_opt : '''
3237 if(parse_debug
): print('clocking_event_opt_2', list(p
))
3239 def p_event_control_1(p
):
3240 '''event_control : '@' hierarchy_identifier '''
3241 if(parse_debug
): print('event_control_1', list(p
))
3242 # { PEIdent*tmpi = new PEIdent(*p[2]);
3243 # PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi);
3244 # PEventStatement*tmps = new PEventStatement(tmpe);
3245 # FILE_NAME(tmps, @1);
3250 def p_event_control_2(p
):
3251 '''event_control : '@' '(' event_expression_list ')' '''
3252 if(parse_debug
): print('event_control_2', list(p
))
3253 # { PEventStatement*tmp = new PEventStatement(*p[3]);
3254 # FILE_NAME(tmp, @1);
3259 def p_event_control_3(p
):
3260 '''event_control : '@' '(' error ')' '''
3261 if(parse_debug
): print('event_control_3', list(p
))
3262 # { yyerror(@1, "error: Malformed event control expression.");
3266 def p_event_expression_list_1(p
):
3267 '''event_expression_list : event_expression '''
3268 if(parse_debug
): print('event_expression_list_1', list(p
))
3271 def p_event_expression_list_2(p
):
3272 '''event_expression_list : event_expression_list K_or event_expression '''
3273 if(parse_debug
): print('event_expression_list_2', list(p
))
3274 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
3280 def p_event_expression_list_3(p
):
3281 '''event_expression_list : event_expression_list ',' event_expression '''
3282 if(parse_debug
): print('event_expression_list_3', list(p
))
3283 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
3289 def p_event_expression_1(p
):
3290 '''event_expression : K_posedge expression '''
3291 if(parse_debug
): print('event_expression_1', list(p
))
3292 # { PEEvent*tmp = new PEEvent(PEEvent::POSEDGE, p[2]);
3293 # FILE_NAME(tmp, @1);
3294 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3299 def p_event_expression_2(p
):
3300 '''event_expression : K_negedge expression '''
3301 if(parse_debug
): print('event_expression_2', list(p
))
3302 # { PEEvent*tmp = new PEEvent(PEEvent::NEGEDGE, p[2]);
3303 # FILE_NAME(tmp, @1);
3304 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3309 def p_event_expression_3(p
):
3310 '''event_expression : expression '''
3311 if(parse_debug
): print('event_expression_3', list(p
))
3312 # { PEEvent*tmp = new PEEvent(PEEvent::ANYEDGE, p[1]);
3313 # FILE_NAME(tmp, @1);
3314 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3319 def p_branch_probe_expression_1(p
):
3320 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ',' IDENTIFIER ')' '''
3321 if(parse_debug
): print('branch_probe_expression_1', list(p
))
3322 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3], p[5]); }
3324 def p_branch_probe_expression_2(p
):
3325 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ')' '''
3326 if(parse_debug
): print('branch_probe_expression_2', list(p
))
3327 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3]); }
3329 def p_expression_1(p
):
3330 '''expression : expr_primary_or_typename '''
3331 if(parse_debug
>2): print('expression_1', list(p
))
3334 def p_expression_2(p
):
3335 '''expression : inc_or_dec_expression '''
3336 if(parse_debug
): print('expression_2', list(p
))
3339 def p_expression_3(p
):
3340 '''expression : inside_expression '''
3341 if(parse_debug
): print('expression_3', list(p
))
3344 def p_expression_4(p
):
3345 '''expression : '+' attribute_list_opt expr_primary %prec UNARY_PREC '''
3346 if(parse_debug
): print('expression_4', list(p
))
3349 def p_expression_5(p
):
3350 '''expression : '-' attribute_list_opt expr_primary %prec UNARY_PREC '''
3351 if(parse_debug
): print('expression_5', list(p
))
3352 # { PEUnary*tmp = new PEUnary('-', p[3]);
3353 # FILE_NAME(tmp, @3);
3357 def p_expression_6(p
):
3358 '''expression : '~' attribute_list_opt expr_primary %prec UNARY_PREC '''
3359 if(parse_debug
): print('expression_6', list(p
))
3360 # { PEUnary*tmp = new PEUnary('~', p[3]);
3361 # FILE_NAME(tmp, @3);
3365 def p_expression_7(p
):
3366 '''expression : '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3367 if(parse_debug
): print('expression_7', list(p
))
3368 # { PEUnary*tmp = new PEUnary('&', p[3]);
3369 # FILE_NAME(tmp, @3);
3373 def p_expression_8(p
):
3374 '''expression : '!' attribute_list_opt expr_primary %prec UNARY_PREC '''
3375 if(parse_debug
): print('expression_8', list(p
))
3376 # { PEUnary*tmp = new PEUnary('!', p[3]);
3377 # FILE_NAME(tmp, @3);
3381 def p_expression_9(p
):
3382 '''expression : '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3383 if(parse_debug
): print('expression_9', list(p
))
3384 # { PEUnary*tmp = new PEUnary('|', p[3]);
3385 # FILE_NAME(tmp, @3);
3389 def p_expression_10(p
):
3390 '''expression : '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3391 if(parse_debug
): print('expression_10', list(p
))
3392 # { PEUnary*tmp = new PEUnary('^', p[3]);
3393 # FILE_NAME(tmp, @3);
3397 def p_expression_11(p
):
3398 '''expression : '~' '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3399 if(parse_debug
): print('expression_11', list(p
))
3400 # { yyerror(@1, "error: '~' '&' is not a valid expression. "
3401 # "Please use operator '~&' instead.");
3405 def p_expression_12(p
):
3406 '''expression : '~' '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3407 if(parse_debug
): print('expression_12', list(p
))
3408 # { yyerror(@1, "error: '~' '|' is not a valid expression. "
3409 # "Please use operator '~|' instead.");
3413 def p_expression_13(p
):
3414 '''expression : '~' '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3415 if(parse_debug
): print('expression_13', list(p
))
3416 # { yyerror(@1, "error: '~' '^' is not a valid expression. "
3417 # "Please use operator '~^' instead.");
3421 def p_expression_14(p
):
3422 '''expression : K_NAND attribute_list_opt expr_primary %prec UNARY_PREC '''
3423 if(parse_debug
): print('expression_14', list(p
))
3424 # { PEUnary*tmp = new PEUnary('A', p[3]);
3425 # FILE_NAME(tmp, @3);
3429 def p_expression_15(p
):
3430 '''expression : K_NOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3431 if(parse_debug
): print('expression_15', list(p
))
3432 # { PEUnary*tmp = new PEUnary('N', p[3]);
3433 # FILE_NAME(tmp, @3);
3437 def p_expression_16(p
):
3438 '''expression : K_NXOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3439 if(parse_debug
): print('expression_16', list(p
))
3440 # { PEUnary*tmp = new PEUnary('X', p[3]);
3441 # FILE_NAME(tmp, @3);
3445 def p_expression_17(p
):
3446 '''expression : '!' error %prec UNARY_PREC '''
3447 if(parse_debug
): print('expression_17', list(p
))
3448 # { yyerror(@1, "error: Operand of unary ! "
3449 # "is not a primary expression.");
3453 def p_expression_18(p
):
3454 '''expression : '^' error %prec UNARY_PREC '''
3455 if(parse_debug
): print('expression_18', list(p
))
3456 # { yyerror(@1, "error: Operand of reduction ^ "
3457 # "is not a primary expression.");
3461 def p_expression_19(p
):
3462 '''expression : expression '^' attribute_list_opt expression '''
3463 if(parse_debug
): print('expression_19', list(p
))
3464 # { PEBinary*tmp = new PEBinary('^', p[1], p[4]);
3465 # FILE_NAME(tmp, @2);
3469 def p_expression_20(p
):
3470 '''expression : expression K_POW attribute_list_opt expression '''
3471 if(parse_debug
): print('expression_20', list(p
))
3472 # { PEBinary*tmp = new PEBPower('p', p[1], p[4]);
3473 # FILE_NAME(tmp, @2);
3477 def p_expression_21(p
):
3478 '''expression : expression '*' attribute_list_opt expression '''
3479 if(parse_debug
): print('expression_21', list(p
))
3480 # { PEBinary*tmp = new PEBinary('*', p[1], p[4]);
3481 # FILE_NAME(tmp, @2);
3485 def p_expression_22(p
):
3486 '''expression : expression '/' attribute_list_opt expression '''
3487 if(parse_debug
): print('expression_22', list(p
))
3488 # { PEBinary*tmp = new PEBinary('/', p[1], p[4]);
3489 # FILE_NAME(tmp, @2);
3493 def p_expression_23(p
):
3494 '''expression : expression '%' attribute_list_opt expression '''
3495 if(parse_debug
): print('expression_23', list(p
))
3496 # { PEBinary*tmp = new PEBinary('%', p[1], p[4]);
3497 # FILE_NAME(tmp, @2);
3501 def p_expression_24(p
):
3502 '''expression : expression '+' attribute_list_opt expression '''
3503 if(parse_debug
): print('expression_24', list(p
))
3504 # { PEBinary*tmp = new PEBinary('+', p[1], p[4]);
3505 # FILE_NAME(tmp, @2);
3509 def p_expression_25(p
):
3510 '''expression : expression '-' attribute_list_opt expression '''
3511 if(parse_debug
): print('expression_25', list(p
))
3512 # { PEBinary*tmp = new PEBinary('-', p[1], p[4]);
3513 # FILE_NAME(tmp, @2);
3516 p
[0] = Node(syms
.atom
, [p
[1], Leaf(token
.MINUS
, '-'), p
[4]])
3518 def p_expression_26(p
):
3519 '''expression : expression '&' attribute_list_opt expression '''
3520 if(parse_debug
): print('expression_26', list(p
))
3521 # { PEBinary*tmp = new PEBinary('&', p[1], p[4]);
3522 # FILE_NAME(tmp, @2);
3526 def p_expression_27(p
):
3527 '''expression : expression '|' attribute_list_opt expression '''
3528 if(parse_debug
): print('expression_27', list(p
))
3529 # { PEBinary*tmp = new PEBinary('|', p[1], p[4]);
3530 # FILE_NAME(tmp, @2);
3534 def p_expression_28(p
):
3535 '''expression : expression K_NAND attribute_list_opt expression '''
3536 if(parse_debug
): print('expression_28', list(p
))
3537 # { PEBinary*tmp = new PEBinary('A', p[1], p[4]);
3538 # FILE_NAME(tmp, @2);
3542 def p_expression_29(p
):
3543 '''expression : expression K_NOR attribute_list_opt expression '''
3544 if(parse_debug
): print('expression_29', list(p
))
3545 # { PEBinary*tmp = new PEBinary('O', p[1], p[4]);
3546 # FILE_NAME(tmp, @2);
3550 def p_expression_30(p
):
3551 '''expression : expression K_NXOR attribute_list_opt expression '''
3552 if(parse_debug
): print('expression_30', list(p
))
3553 # { PEBinary*tmp = new PEBinary('X', p[1], p[4]);
3554 # FILE_NAME(tmp, @2);
3558 def p_expression_31(p
):
3559 '''expression : expression '<' attribute_list_opt expression '''
3560 if(parse_debug
): print('expression_31', list(p
))
3561 # { PEBinary*tmp = new PEBComp('<', p[1], p[4]);
3562 # FILE_NAME(tmp, @2);
3566 def p_expression_32(p
):
3567 '''expression : expression '>' attribute_list_opt expression '''
3568 if(parse_debug
): print('expression_32', list(p
))
3569 # { PEBinary*tmp = new PEBComp('>', p[1], p[4]);
3570 # FILE_NAME(tmp, @2);
3574 def p_expression_33(p
):
3575 '''expression : expression K_LS attribute_list_opt expression '''
3576 if(parse_debug
): print('expression_33', list(p
))
3577 # { PEBinary*tmp = new PEBShift('l', p[1], p[4]);
3578 # FILE_NAME(tmp, @2);
3582 def p_expression_34(p
):
3583 '''expression : expression K_RS attribute_list_opt expression '''
3584 if(parse_debug
): print('expression_34', list(p
))
3585 # { PEBinary*tmp = new PEBShift('r', p[1], p[4]);
3586 # FILE_NAME(tmp, @2);
3590 def p_expression_35(p
):
3591 '''expression : expression K_RSS attribute_list_opt expression '''
3592 if(parse_debug
): print('expression_35', list(p
))
3593 # { PEBinary*tmp = new PEBShift('R', p[1], p[4]);
3594 # FILE_NAME(tmp, @2);
3598 def p_expression_36(p
):
3599 '''expression : expression K_EQ attribute_list_opt expression '''
3600 if(parse_debug
): print('expression_36', list(p
))
3601 # { PEBinary*tmp = new PEBComp('e', p[1], p[4]);
3602 # FILE_NAME(tmp, @2);
3606 def p_expression_37(p
):
3607 '''expression : expression K_CEQ attribute_list_opt expression '''
3608 if(parse_debug
): print('expression_37', list(p
))
3609 # { PEBinary*tmp = new PEBComp('E', p[1], p[4]);
3610 # FILE_NAME(tmp, @2);
3614 def p_expression_38(p
):
3615 '''expression : expression K_WEQ attribute_list_opt expression '''
3616 if(parse_debug
): print('expression_38', list(p
))
3617 # { PEBinary*tmp = new PEBComp('w', p[1], p[4]);
3618 # FILE_NAME(tmp, @2);
3622 def p_expression_39(p
):
3623 '''expression : expression K_LE attribute_list_opt expression '''
3624 if(parse_debug
): print('expression_39', list(p
))
3625 # { PEBinary*tmp = new PEBComp('L', p[1], p[4]);
3626 # FILE_NAME(tmp, @2);
3630 def p_expression_40(p
):
3631 '''expression : expression K_GE attribute_list_opt expression '''
3632 if(parse_debug
): print('expression_40', list(p
))
3633 # { PEBinary*tmp = new PEBComp('G', p[1], p[4]);
3634 # FILE_NAME(tmp, @2);
3638 def p_expression_41(p
):
3639 '''expression : expression K_NE attribute_list_opt expression '''
3640 if(parse_debug
): print('expression_41', list(p
))
3641 # { PEBinary*tmp = new PEBComp('n', p[1], p[4]);
3642 # FILE_NAME(tmp, @2);
3646 def p_expression_42(p
):
3647 '''expression : expression K_CNE attribute_list_opt expression '''
3648 if(parse_debug
): print('expression_42', list(p
))
3649 # { PEBinary*tmp = new PEBComp('N', p[1], p[4]);
3650 # FILE_NAME(tmp, @2);
3654 def p_expression_43(p
):
3655 '''expression : expression K_WNE attribute_list_opt expression '''
3656 if(parse_debug
): print('expression_43', list(p
))
3657 # { PEBinary*tmp = new PEBComp('W', p[1], p[4]);
3658 # FILE_NAME(tmp, @2);
3662 def p_expression_44(p
):
3663 '''expression : expression K_LOR attribute_list_opt expression '''
3664 if(parse_debug
): print('expression_44', list(p
))
3665 # { PEBinary*tmp = new PEBLogic('o', p[1], p[4]);
3666 # FILE_NAME(tmp, @2);
3670 def p_expression_45(p
):
3671 '''expression : expression K_LAND attribute_list_opt expression '''
3672 if(parse_debug
): print('expression_45', list(p
))
3673 # { PEBinary*tmp = new PEBLogic('a', p[1], p[4]);
3674 # FILE_NAME(tmp, @2);
3678 def p_expression_46(p
):
3679 '''expression : expression '?' attribute_list_opt expression ':' expression '''
3680 if(parse_debug
): print('expression_46', list(p
))
3681 # { PETernary*tmp = new PETernary(p[1], p[4], p[6]);
3682 # FILE_NAME(tmp, @2);
3686 def p_expr_mintypmax_1(p
):
3687 '''expr_mintypmax : expression '''
3688 if(parse_debug
): print('expr_mintypmax_1', list(p
))
3691 def p_expr_mintypmax_2(p
):
3692 '''expr_mintypmax : expression ':' expression ':' expression '''
3693 if(parse_debug
): print('expr_mintypmax_2', list(p
))
3694 # { switch (min_typ_max_flag) {
3711 # if (min_typ_max_warn > 0) {
3712 # cerr << p[0]->get_fileline() << ": warning: choosing ";
3713 # switch (min_typ_max_flag) {
3724 # cerr << " expression." << endl;
3725 # min_typ_max_warn -= 1;
3729 def p_expression_list_with_nuls_1(p
):
3730 '''expression_list_with_nuls : expression_list_with_nuls ',' expression '''
3731 if(parse_debug
): print('expression_list_with_nuls_1', list(p
))
3732 # { list<PExpr*>*tmp = p[1];
3733 # tmp->push_back(p[3]);
3737 def p_expression_list_with_nuls_2(p
):
3738 '''expression_list_with_nuls : expression '''
3739 if(parse_debug
): print('expression_list_with_nuls_2', list(p
))
3740 # { list<PExpr*>*tmp = new list<PExpr*>;
3741 # tmp->push_back(p[1]);
3745 def p_expression_list_with_nuls_3(p
):
3746 '''expression_list_with_nuls : '''
3747 if(parse_debug
): print('expression_list_with_nuls_3', list(p
))
3748 # { list<PExpr*>*tmp = new list<PExpr*>;
3749 # tmp->push_back(0);
3753 def p_expression_list_with_nuls_4(p
):
3754 '''expression_list_with_nuls : expression_list_with_nuls ',' '''
3755 if(parse_debug
): print('expression_list_with_nuls_4', list(p
))
3756 # { list<PExpr*>*tmp = p[1];
3757 # tmp->push_back(0);
3761 def p_expression_list_proper_1(p
):
3762 '''expression_list_proper : expression_list_proper ',' expression '''
3763 if(parse_debug
): print('expression_list_proper_1', list(p
))
3764 # { list<PExpr*>*tmp = p[1];
3765 # tmp->push_back(p[3]);
3769 def p_expression_list_proper_2(p
):
3770 '''expression_list_proper : expression '''
3771 if(parse_debug
): print('expression_list_proper_2', list(p
))
3772 # { list<PExpr*>*tmp = new list<PExpr*>;
3773 # tmp->push_back(p[1]);
3777 def p_expr_primary_or_typename_1(p
):
3778 '''expr_primary_or_typename : expr_primary '''
3779 if(parse_debug
>2): print('expr_primary_or_typename_1', list(p
))
3782 def p_expr_primary_or_typename_2(p
):
3783 '''expr_primary_or_typename : TYPE_IDENTIFIER '''
3784 if(parse_debug
): print('expr_primary_or_typename_2', list(p
))
3786 # { PETypename*tmp = new PETypename(p[1].type);
3787 # FILE_NAME(tmp,@1);
3789 # delete[]p[1].text;
3792 def p_expr_primary_1(p
):
3793 '''expr_primary : number '''
3794 if(parse_debug
): print('expr_primary_1', list(p
))
3797 # PENumber*tmp = new PENumber(p[1]);
3798 # FILE_NAME(tmp, @1);
3802 def p_expr_primary_2(p
):
3803 '''expr_primary : REALTIME '''
3804 if(parse_debug
): print('expr_primary_2', list(p
))
3805 # { PEFNumber*tmp = new PEFNumber(p[1]);
3806 # FILE_NAME(tmp, @1);
3810 def p_expr_primary_3(p
):
3811 '''expr_primary : STRING '''
3812 if(parse_debug
): print('expr_primary_3', list(p
))
3813 # { PEString*tmp = new PEString(p[1]);
3814 # FILE_NAME(tmp, @1);
3818 def p_expr_primary_4(p
):
3819 '''expr_primary : TIME_LITERAL '''
3820 if(parse_debug
): print('expr_primary_4', list(p
))
3825 # if (p[1] == 0 || !get_time_unit(p[1], unit))
3826 # yyerror(@1, "internal error: delay.");
3828 # double p = pow(10.0, (double)(unit - pform_get_timeunit()));
3829 # double time = atof(p[1]) * p;
3831 # verireal *v = new verireal(time);
3832 # p[0] = new PEFNumber(v);
3833 # FILE_NAME(p[0], @1);
3837 def p_expr_primary_5(p
):
3838 '''expr_primary : SYSTEM_IDENTIFIER '''
3839 if(parse_debug
): print('expr_primary_5', list(p
))
3840 # { perm_string tn = lex_strings.make(p[1]);
3841 # PECallFunction*tmp = new PECallFunction(tn);
3842 # FILE_NAME(tmp, @1);
3847 def p_expr_primary_6(p
):
3848 '''expr_primary : hierarchy_identifier '''
3849 if(parse_debug
>2): print('expr_primary_6', list(p
))
3851 # { PEIdent*tmp = pform_new_ident(*p[1]);
3852 # FILE_NAME(tmp, @1);
3857 def p_expr_primary_7(p
):
3858 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier '''
3859 if(parse_debug
): print('expr_primary_7', list(p
))
3860 # { p[0] = pform_package_ident(@2, p[1], p[3]);
3864 def p_expr_primary_8(p
):
3865 '''expr_primary : hierarchy_identifier '(' expression_list_with_nuls ')' '''
3866 if(parse_debug
): print('expr_primary_8', list(p
))
3867 # { list<PExpr*>*expr_list = p[3];
3868 # strip_tail_items(expr_list);
3869 # PECallFunction*tmp = pform_make_call_function(@1, *p[1], *expr_list);
3874 def p_expr_primary_9(p
):
3875 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' '''
3876 if(parse_debug
): print('expr_primary_9', list(p
))
3877 # { pform_name_t*t_name = p[1];
3878 # while (! p[3]->empty()) {
3879 # t_name->push_back(p[3]->front());
3880 # p[3]->pop_front();
3882 # list<PExpr*>*expr_list = p[5];
3883 # strip_tail_items(expr_list);
3884 # PECallFunction*tmp = pform_make_call_function(@1, *t_name, *expr_list);
3890 def p_expr_primary_10(p
):
3891 '''expr_primary : SYSTEM_IDENTIFIER '(' expression_list_proper ')' '''
3892 if(parse_debug
): print('expr_primary_10', list(p
))
3893 # { perm_string tn = lex_strings.make(p[1]);
3894 # PECallFunction*tmp = new PECallFunction(tn, *p[3]);
3895 # FILE_NAME(tmp, @1);
3900 def p_expr_primary_11(p
):
3901 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')' '''
3902 if(parse_debug
): print('expr_primary_11', list(p
))
3903 # { perm_string use_name = lex_strings.make(p[3]);
3904 # PECallFunction*tmp = new PECallFunction(p[1], use_name, *p[5]);
3905 # FILE_NAME(tmp, @3);
3910 def p_expr_primary_12(p
):
3911 '''expr_primary : SYSTEM_IDENTIFIER '(' ')' '''
3912 if(parse_debug
): print('expr_primary_12', list(p
))
3913 # { perm_string tn = lex_strings.make(p[1]);
3914 # const vector<PExpr*>empty;
3915 # PECallFunction*tmp = new PECallFunction(tn, empty);
3916 # FILE_NAME(tmp, @1);
3919 # if (!gn_system_verilog()) {
3920 # yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
3924 def p_expr_primary_13(p
):
3925 '''expr_primary : implicit_class_handle '''
3926 if(parse_debug
): print('expr_primary_13', list(p
))
3927 # { PEIdent*tmp = new PEIdent(*p[1]);
3928 # FILE_NAME(tmp,@1);
3933 def p_expr_primary_14(p
):
3934 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '''
3935 if(parse_debug
): print('expr_primary_14', list(p
))
3936 # { pform_name_t*t_name = p[1];
3937 # while (! p[3]->empty()) {
3938 # t_name->push_back(p[3]->front());
3939 # p[3]->pop_front();
3941 # PEIdent*tmp = new PEIdent(*t_name);
3942 # FILE_NAME(tmp,@1);
3948 def p_expr_primary_15(p
):
3949 '''expr_primary : K_acos '(' expression ')' '''
3950 if(parse_debug
): print('expr_primary_15', list(p
))
3951 # { perm_string tn = perm_string::literal("$acos");
3952 # PECallFunction*tmp = make_call_function(tn, p[3]);
3953 # FILE_NAME(tmp,@1);
3957 def p_expr_primary_16(p
):
3958 '''expr_primary : K_acosh '(' expression ')' '''
3959 if(parse_debug
): print('expr_primary_16', list(p
))
3960 # { perm_string tn = perm_string::literal("$acosh");
3961 # PECallFunction*tmp = make_call_function(tn, p[3]);
3962 # FILE_NAME(tmp,@1);
3966 def p_expr_primary_17(p
):
3967 '''expr_primary : K_asin '(' expression ')' '''
3968 if(parse_debug
): print('expr_primary_17', list(p
))
3969 # { perm_string tn = perm_string::literal("$asin");
3970 # PECallFunction*tmp = make_call_function(tn, p[3]);
3971 # FILE_NAME(tmp,@1);
3975 def p_expr_primary_18(p
):
3976 '''expr_primary : K_asinh '(' expression ')' '''
3977 if(parse_debug
): print('expr_primary_18', list(p
))
3978 # { perm_string tn = perm_string::literal("$asinh");
3979 # PECallFunction*tmp = make_call_function(tn, p[3]);
3980 # FILE_NAME(tmp,@1);
3984 def p_expr_primary_19(p
):
3985 '''expr_primary : K_atan '(' expression ')' '''
3986 if(parse_debug
): print('expr_primary_19', list(p
))
3987 # { perm_string tn = perm_string::literal("$atan");
3988 # PECallFunction*tmp = make_call_function(tn, p[3]);
3989 # FILE_NAME(tmp,@1);
3993 def p_expr_primary_20(p
):
3994 '''expr_primary : K_atanh '(' expression ')' '''
3995 if(parse_debug
): print('expr_primary_20', list(p
))
3996 # { perm_string tn = perm_string::literal("$atanh");
3997 # PECallFunction*tmp = make_call_function(tn, p[3]);
3998 # FILE_NAME(tmp,@1);
4002 def p_expr_primary_21(p
):
4003 '''expr_primary : K_atan2 '(' expression ',' expression ')' '''
4004 if(parse_debug
): print('expr_primary_21', list(p
))
4005 # { perm_string tn = perm_string::literal("$atan2");
4006 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
4007 # FILE_NAME(tmp,@1);
4011 def p_expr_primary_22(p
):
4012 '''expr_primary : K_ceil '(' expression ')' '''
4013 if(parse_debug
): print('expr_primary_22', list(p
))
4014 # { perm_string tn = perm_string::literal("$ceil");
4015 # PECallFunction*tmp = make_call_function(tn, p[3]);
4016 # FILE_NAME(tmp,@1);
4020 def p_expr_primary_23(p
):
4021 '''expr_primary : K_cos '(' expression ')' '''
4022 if(parse_debug
): print('expr_primary_23', list(p
))
4023 # { perm_string tn = perm_string::literal("$cos");
4024 # PECallFunction*tmp = make_call_function(tn, p[3]);
4025 # FILE_NAME(tmp,@1);
4029 def p_expr_primary_24(p
):
4030 '''expr_primary : K_cosh '(' expression ')' '''
4031 if(parse_debug
): print('expr_primary_24', list(p
))
4032 # { perm_string tn = perm_string::literal("$cosh");
4033 # PECallFunction*tmp = make_call_function(tn, p[3]);
4034 # FILE_NAME(tmp,@1);
4038 def p_expr_primary_25(p
):
4039 '''expr_primary : K_exp '(' expression ')' '''
4040 if(parse_debug
): print('expr_primary_25', list(p
))
4041 # { perm_string tn = perm_string::literal("$exp");
4042 # PECallFunction*tmp = make_call_function(tn, p[3]);
4043 # FILE_NAME(tmp,@1);
4047 def p_expr_primary_26(p
):
4048 '''expr_primary : K_floor '(' expression ')' '''
4049 if(parse_debug
): print('expr_primary_26', list(p
))
4050 # { perm_string tn = perm_string::literal("$floor");
4051 # PECallFunction*tmp = make_call_function(tn, p[3]);
4052 # FILE_NAME(tmp,@1);
4056 def p_expr_primary_27(p
):
4057 '''expr_primary : K_hypot '(' expression ',' expression ')' '''
4058 if(parse_debug
): print('expr_primary_27', list(p
))
4059 # { perm_string tn = perm_string::literal("$hypot");
4060 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
4061 # FILE_NAME(tmp,@1);
4065 def p_expr_primary_28(p
):
4066 '''expr_primary : K_ln '(' expression ')' '''
4067 if(parse_debug
): print('expr_primary_28', list(p
))
4068 # { perm_string tn = perm_string::literal("$ln");
4069 # PECallFunction*tmp = make_call_function(tn, p[3]);
4070 # FILE_NAME(tmp,@1);
4074 def p_expr_primary_29(p
):
4075 '''expr_primary : K_log '(' expression ')' '''
4076 if(parse_debug
): print('expr_primary_29', list(p
))
4077 # { perm_string tn = perm_string::literal("$log10");
4078 # PECallFunction*tmp = make_call_function(tn, p[3]);
4079 # FILE_NAME(tmp,@1);
4083 def p_expr_primary_30(p
):
4084 '''expr_primary : K_pow '(' expression ',' expression ')' '''
4085 if(parse_debug
): print('expr_primary_30', list(p
))
4086 # { perm_string tn = perm_string::literal("$pow");
4087 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
4088 # FILE_NAME(tmp,@1);
4092 def p_expr_primary_31(p
):
4093 '''expr_primary : K_sin '(' expression ')' '''
4094 if(parse_debug
): print('expr_primary_31', list(p
))
4095 # { perm_string tn = perm_string::literal("$sin");
4096 # PECallFunction*tmp = make_call_function(tn, p[3]);
4097 # FILE_NAME(tmp,@1);
4101 def p_expr_primary_32(p
):
4102 '''expr_primary : K_sinh '(' expression ')' '''
4103 if(parse_debug
): print('expr_primary_32', list(p
))
4104 # { perm_string tn = perm_string::literal("$sinh");
4105 # PECallFunction*tmp = make_call_function(tn, p[3]);
4106 # FILE_NAME(tmp,@1);
4110 def p_expr_primary_33(p
):
4111 '''expr_primary : K_sqrt '(' expression ')' '''
4112 if(parse_debug
): print('expr_primary_33', list(p
))
4113 # { perm_string tn = perm_string::literal("$sqrt");
4114 # PECallFunction*tmp = make_call_function(tn, p[3]);
4115 # FILE_NAME(tmp,@1);
4119 def p_expr_primary_34(p
):
4120 '''expr_primary : K_tan '(' expression ')' '''
4121 if(parse_debug
): print('expr_primary_34', list(p
))
4122 # { perm_string tn = perm_string::literal("$tan");
4123 # PECallFunction*tmp = make_call_function(tn, p[3]);
4124 # FILE_NAME(tmp,@1);
4128 def p_expr_primary_35(p
):
4129 '''expr_primary : K_tanh '(' expression ')' '''
4130 if(parse_debug
): print('expr_primary_35', list(p
))
4131 # { perm_string tn = perm_string::literal("$tanh");
4132 # PECallFunction*tmp = make_call_function(tn, p[3]);
4133 # FILE_NAME(tmp,@1);
4137 def p_expr_primary_36(p
):
4138 '''expr_primary : K_abs '(' expression ')' '''
4139 if(parse_debug
): print('expr_primary_36', list(p
))
4140 # { PEUnary*tmp = new PEUnary('m', p[3]);
4141 # FILE_NAME(tmp,@1);
4145 def p_expr_primary_37(p
):
4146 '''expr_primary : K_max '(' expression ',' expression ')' '''
4147 if(parse_debug
): print('expr_primary_37', list(p
))
4148 # { PEBinary*tmp = new PEBinary('M', p[3], p[5]);
4149 # FILE_NAME(tmp,@1);
4153 def p_expr_primary_38(p
):
4154 '''expr_primary : K_min '(' expression ',' expression ')' '''
4155 if(parse_debug
): print('expr_primary_38', list(p
))
4156 # { PEBinary*tmp = new PEBinary('m', p[3], p[5]);
4157 # FILE_NAME(tmp,@1);
4161 def p_expr_primary_39(p
):
4162 '''expr_primary : '(' expr_mintypmax ')' '''
4163 if(parse_debug
): print('expr_primary_39', list(p
))
4166 def p_expr_primary_40(p
):
4167 '''expr_primary : '{' expression_list_proper '}' '''
4168 if(parse_debug
): print('expr_primary_40', list(p
))
4169 # { PEConcat*tmp = new PEConcat(*p[2]);
4170 # FILE_NAME(tmp, @1);
4175 def p_expr_primary_41(p
):
4176 '''expr_primary : '{' expression '{' expression_list_proper '}' '}' '''
4177 if(parse_debug
): print('expr_primary_41', list(p
))
4178 # { PExpr*rep = p[2];
4179 # PEConcat*tmp = new PEConcat(*p[4], rep);
4180 # FILE_NAME(tmp, @1);
4185 def p_expr_primary_42(p
):
4186 '''expr_primary : '{' expression '{' expression_list_proper '}' error '}' '''
4187 if(parse_debug
): print('expr_primary_42', list(p
))
4188 # { PExpr*rep = p[2];
4189 # PEConcat*tmp = new PEConcat(*p[4], rep);
4190 # FILE_NAME(tmp, @1);
4193 # yyerror(@5, "error: Syntax error between internal '}' "
4194 # "and closing '}' of repeat concatenation.");
4198 def p_expr_primary_43(p
):
4199 '''expr_primary : '{' '}' '''
4200 if(parse_debug
): print('expr_primary_43', list(p
))
4201 # { // This is the empty queue syntax.
4202 # if (gn_system_verilog()) {
4203 # list<PExpr*> empty_list;
4204 # PEConcat*tmp = new PEConcat(empty_list);
4205 # FILE_NAME(tmp, @1);
4208 # yyerror(@1, "error: Concatenations are not allowed to be empty.");
4213 def p_expr_primary_44(p
):
4214 '''expr_primary : expr_primary "'" '(' expression ')' '''
4215 if(parse_debug
): print('expr_primary_44', list(p
))
4216 # { PExpr*base = p[4];
4217 # if (gn_system_verilog()) {
4218 # PECastSize*tmp = new PECastSize(p[1], base);
4219 # FILE_NAME(tmp, @1);
4222 # yyerror(@1, "error: Size cast requires SystemVerilog.");
4227 def p_expr_primary_45(p
):
4228 '''expr_primary : simple_type_or_string "'" '(' expression ')' '''
4229 if(parse_debug
): print('expr_primary_45', list(p
))
4230 # { PExpr*base = p[4];
4231 # if (gn_system_verilog()) {
4232 # PECastType*tmp = new PECastType(p[1], base);
4233 # FILE_NAME(tmp, @1);
4236 # yyerror(@1, "error: Type cast requires SystemVerilog.");
4241 def p_expr_primary_46(p
):
4242 '''expr_primary : assignment_pattern '''
4243 if(parse_debug
): print('expr_primary_46', list(p
))
4246 def p_expr_primary_47(p
):
4247 '''expr_primary : streaming_concatenation '''
4248 if(parse_debug
): print('expr_primary_47', list(p
))
4251 def p_expr_primary_48(p
):
4252 '''expr_primary : K_null '''
4253 if(parse_debug
): print('expr_primary_48', list(p
))
4254 # { PENull*tmp = new PENull;
4255 # FILE_NAME(tmp, @1);
4259 def p_function_item_list_opt_1(p
):
4260 '''function_item_list_opt : function_item_list '''
4261 if(parse_debug
): print('function_item_list_opt_1', list(p
))
4264 def p_function_item_list_opt_2(p
):
4265 '''function_item_list_opt : '''
4266 if(parse_debug
): print('function_item_list_opt_2', list(p
))
4269 def p_function_item_list_1(p
):
4270 '''function_item_list : function_item '''
4271 if(parse_debug
): print('function_item_list_1', list(p
))
4274 def p_function_item_list_2(p
):
4275 '''function_item_list : function_item_list function_item '''
4276 if(parse_debug
): print('function_item_list_2', list(p
))
4278 # if (p[1] && p[2]) {
4279 # vector<pform_tf_port_t>*tmp = p[1];
4280 # size_t s1 = tmp->size();
4281 # tmp->resize(s1 + p[2]->size());
4282 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
4283 # tmp->at(s1+idx) = p[2]->at(idx);
4286 # } else if (p[1]) {
4293 def p_function_item_1(p
):
4294 '''function_item : tf_port_declaration '''
4295 if(parse_debug
): print('function_item_1', list(p
))
4298 def p_function_item_2(p
):
4299 '''function_item : block_item_decl '''
4300 if(parse_debug
): print('function_item_2', list(p
))
4303 def p_gate_instance_1(p
):
4304 '''gate_instance : IDENTIFIER '(' expression_list_with_nuls ')' '''
4305 if(parse_debug
): print('gate_instance_1', list(p
))
4306 # { lgate*tmp = new lgate;
4308 # tmp->parms = p[3];
4309 # tmp->file = @1.text;
4310 # tmp->lineno = @1.first_line;
4315 def p_gate_instance_2(p
):
4316 '''gate_instance : IDENTIFIER dimensions '(' expression_list_with_nuls ')' '''
4317 if(parse_debug
): print('gate_instance_2', list(p
))
4318 # { lgate*tmp = new lgate;
4319 # list<pform_range_t>*rng = p[2];
4321 # tmp->parms = p[4];
4322 # tmp->range = rng->front();
4324 # assert(rng->empty());
4325 # tmp->file = @1.text;
4326 # tmp->lineno = @1.first_line;
4332 def p_gate_instance_3(p
):
4333 '''gate_instance : '(' expression_list_with_nuls ')' '''
4334 if(parse_debug
): print('gate_instance_3', list(p
))
4335 # { lgate*tmp = new lgate;
4337 # tmp->parms = p[2];
4338 # tmp->file = @1.text;
4339 # tmp->lineno = @1.first_line;
4343 def p_gate_instance_4(p
):
4344 '''gate_instance : IDENTIFIER dimensions '''
4345 if(parse_debug
): print('gate_instance_4', list(p
))
4346 # { lgate*tmp = new lgate;
4347 # list<pform_range_t>*rng = p[2];
4350 # tmp->parms_by_name = 0;
4351 # tmp->range = rng->front();
4353 # assert(rng->empty());
4354 # tmp->file = @1.text;
4355 # tmp->lineno = @1.first_line;
4361 def p_gate_instance_5(p
):
4362 '''gate_instance : IDENTIFIER '(' port_name_list ')' '''
4363 if(parse_debug
): print('gate_instance_5', list(p
))
4364 # { lgate*tmp = new lgate;
4367 # tmp->parms_by_name = p[3];
4368 # tmp->file = @1.text;
4369 # tmp->lineno = @1.first_line;
4374 def p_gate_instance_6(p
):
4375 '''gate_instance : IDENTIFIER dimensions '(' port_name_list ')' '''
4376 if(parse_debug
): print('gate_instance_6', list(p
))
4377 # { lgate*tmp = new lgate;
4378 # list<pform_range_t>*rng = p[2];
4381 # tmp->parms_by_name = p[4];
4382 # tmp->range = rng->front();
4384 # assert(rng->empty());
4385 # tmp->file = @1.text;
4386 # tmp->lineno = @1.first_line;
4392 def p_gate_instance_7(p
):
4393 '''gate_instance : IDENTIFIER '(' error ')' '''
4394 if(parse_debug
): print('gate_instance_7', list(p
))
4395 # { lgate*tmp = new lgate;
4398 # tmp->parms_by_name = 0;
4399 # tmp->file = @1.text;
4400 # tmp->lineno = @1.first_line;
4401 # yyerror(@2, "error: Syntax error in instance port "
4402 # "expression(s).");
4407 def p_gate_instance_8(p
):
4408 '''gate_instance : IDENTIFIER dimensions '(' error ')' '''
4409 if(parse_debug
): print('gate_instance_8', list(p
))
4410 # { lgate*tmp = new lgate;
4413 # tmp->parms_by_name = 0;
4414 # tmp->file = @1.text;
4415 # tmp->lineno = @1.first_line;
4416 # yyerror(@3, "error: Syntax error in instance port "
4417 # "expression(s).");
4422 def p_gate_instance_list_1(p
):
4423 '''gate_instance_list : gate_instance_list ',' gate_instance '''
4424 if(parse_debug
): print('gate_instance_list_1', list(p
))
4425 # { svector<lgate>*tmp1 = p[1];
4426 # lgate*tmp2 = p[3];
4427 # svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
4433 def p_gate_instance_list_2(p
):
4434 '''gate_instance_list : gate_instance '''
4435 if(parse_debug
): print('gate_instance_list_2', list(p
))
4436 # { svector<lgate>*tmp = new svector<lgate>(1);
4437 # (*tmp)[0] = *p[1];
4442 def p_gatetype_1(p
):
4443 '''gatetype : K_and '''
4444 if(parse_debug
): print('gatetype_1', list(p
))
4445 # { p[0] = PGBuiltin::AND; }
4447 def p_gatetype_2(p
):
4448 '''gatetype : K_nand '''
4449 if(parse_debug
): print('gatetype_2', list(p
))
4450 # { p[0] = PGBuiltin::NAND; }
4452 def p_gatetype_3(p
):
4453 '''gatetype : K_or '''
4454 if(parse_debug
): print('gatetype_3', list(p
))
4455 # { p[0] = PGBuiltin::OR; }
4457 def p_gatetype_4(p
):
4458 '''gatetype : K_nor '''
4459 if(parse_debug
): print('gatetype_4', list(p
))
4460 # { p[0] = PGBuiltin::NOR; }
4462 def p_gatetype_5(p
):
4463 '''gatetype : K_xor '''
4464 if(parse_debug
): print('gatetype_5', list(p
))
4465 # { p[0] = PGBuiltin::XOR; }
4467 def p_gatetype_6(p
):
4468 '''gatetype : K_xnor '''
4469 if(parse_debug
): print('gatetype_6', list(p
))
4470 # { p[0] = PGBuiltin::XNOR; }
4472 def p_gatetype_7(p
):
4473 '''gatetype : K_buf '''
4474 if(parse_debug
): print('gatetype_7', list(p
))
4475 # { p[0] = PGBuiltin::BUF; }
4477 def p_gatetype_8(p
):
4478 '''gatetype : K_bufif0 '''
4479 if(parse_debug
): print('gatetype_8', list(p
))
4480 # { p[0] = PGBuiltin::BUFIF0; }
4482 def p_gatetype_9(p
):
4483 '''gatetype : K_bufif1 '''
4484 if(parse_debug
): print('gatetype_9', list(p
))
4485 # { p[0] = PGBuiltin::BUFIF1; }
4487 def p_gatetype_10(p
):
4488 '''gatetype : K_not '''
4489 if(parse_debug
): print('gatetype_10', list(p
))
4490 # { p[0] = PGBuiltin::NOT; }
4492 def p_gatetype_11(p
):
4493 '''gatetype : K_notif0 '''
4494 if(parse_debug
): print('gatetype_11', list(p
))
4495 # { p[0] = PGBuiltin::NOTIF0; }
4497 def p_gatetype_12(p
):
4498 '''gatetype : K_notif1 '''
4499 if(parse_debug
): print('gatetype_12', list(p
))
4500 # { p[0] = PGBuiltin::NOTIF1; }
4502 def p_switchtype_1(p
):
4503 '''switchtype : K_nmos '''
4504 if(parse_debug
): print('switchtype_1', list(p
))
4505 # { p[0] = PGBuiltin::NMOS; }
4507 def p_switchtype_2(p
):
4508 '''switchtype : K_rnmos '''
4509 if(parse_debug
): print('switchtype_2', list(p
))
4510 # { p[0] = PGBuiltin::RNMOS; }
4512 def p_switchtype_3(p
):
4513 '''switchtype : K_pmos '''
4514 if(parse_debug
): print('switchtype_3', list(p
))
4515 # { p[0] = PGBuiltin::PMOS; }
4517 def p_switchtype_4(p
):
4518 '''switchtype : K_rpmos '''
4519 if(parse_debug
): print('switchtype_4', list(p
))
4520 # { p[0] = PGBuiltin::RPMOS; }
4522 def p_switchtype_5(p
):
4523 '''switchtype : K_cmos '''
4524 if(parse_debug
): print('switchtype_5', list(p
))
4525 # { p[0] = PGBuiltin::CMOS; }
4527 def p_switchtype_6(p
):
4528 '''switchtype : K_rcmos '''
4529 if(parse_debug
): print('switchtype_6', list(p
))
4530 # { p[0] = PGBuiltin::RCMOS; }
4532 def p_switchtype_7(p
):
4533 '''switchtype : K_tran '''
4534 if(parse_debug
): print('switchtype_7', list(p
))
4535 # { p[0] = PGBuiltin::TRAN; }
4537 def p_switchtype_8(p
):
4538 '''switchtype : K_rtran '''
4539 if(parse_debug
): print('switchtype_8', list(p
))
4540 # { p[0] = PGBuiltin::RTRAN; }
4542 def p_switchtype_9(p
):
4543 '''switchtype : K_tranif0 '''
4544 if(parse_debug
): print('switchtype_9', list(p
))
4545 # { p[0] = PGBuiltin::TRANIF0; }
4547 def p_switchtype_10(p
):
4548 '''switchtype : K_tranif1 '''
4549 if(parse_debug
): print('switchtype_10', list(p
))
4550 # { p[0] = PGBuiltin::TRANIF1; }
4552 def p_switchtype_11(p
):
4553 '''switchtype : K_rtranif0 '''
4554 if(parse_debug
): print('switchtype_11', list(p
))
4555 # { p[0] = PGBuiltin::RTRANIF0; }
4557 def p_switchtype_12(p
):
4558 '''switchtype : K_rtranif1 '''
4559 if(parse_debug
): print('switchtype_12', list(p
))
4560 # { p[0] = PGBuiltin::RTRANIF1; }
4562 def p_hierarchy_identifier_1(p
):
4563 '''hierarchy_identifier : IDENTIFIER '''
4564 if(parse_debug
): print('hierarchy_identifier_1 FIXME', list(p
))
4565 lpvalue
= Leaf(token
.NAME
, p
[1])
4567 # { p[0] = new pform_name_t;
4568 # p[0]->push_back(name_component_t(lex_strings.make(p[1])));
4572 def p_hierarchy_identifier_2(p
):
4573 '''hierarchy_identifier : hierarchy_identifier '.' IDENTIFIER '''
4574 if(parse_debug
): print('hierarchy_identifier_2', list(p
))
4575 # { pform_name_t * tmp = p[1];
4576 # tmp->push_back(name_component_t(lex_strings.make(p[3])));
4581 def p_hierarchy_identifier_3(p
):
4582 '''hierarchy_identifier : hierarchy_identifier '[' expression ']' '''
4583 if(parse_debug
): print('hierarchy_identifier_3', list(p
))
4584 # { pform_name_t * tmp = p[1];
4585 # name_component_t&tail = tmp->back();
4586 # index_component_t itmp;
4587 # itmp.sel = index_component_t::SEL_BIT;
4589 # tail.index.push_back(itmp);
4593 def p_hierarchy_identifier_4(p
):
4594 '''hierarchy_identifier : hierarchy_identifier '[' '$' ']' '''
4595 if(parse_debug
): print('hierarchy_identifier_4', list(p
))
4596 # { pform_name_t * tmp = p[1];
4597 # name_component_t&tail = tmp->back();
4598 # if (! gn_system_verilog()) {
4599 # yyerror(@3, "error: Last element expression ($) "
4600 # "requires SystemVerilog. Try enabling SystemVerilog.");
4602 # index_component_t itmp;
4603 # itmp.sel = index_component_t::SEL_BIT_LAST;
4606 # tail.index.push_back(itmp);
4610 def p_hierarchy_identifier_5(p
):
4611 '''hierarchy_identifier : hierarchy_identifier '[' expression ':' expression ']' '''
4612 if(parse_debug
): print('hierarchy_identifier_5', list(p
))
4613 # { pform_name_t * tmp = p[1];
4614 # name_component_t&tail = tmp->back();
4615 # index_component_t itmp;
4616 # itmp.sel = index_component_t::SEL_PART;
4619 # tail.index.push_back(itmp);
4623 def p_hierarchy_identifier_6(p
):
4624 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_POS expression ']' '''
4625 if(parse_debug
): print('hierarchy_identifier_6', list(p
))
4626 # { pform_name_t * tmp = p[1];
4627 # name_component_t&tail = tmp->back();
4628 # index_component_t itmp;
4629 # itmp.sel = index_component_t::SEL_IDX_UP;
4632 # tail.index.push_back(itmp);
4636 def p_hierarchy_identifier_7(p
):
4637 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_NEG expression ']' '''
4638 if(parse_debug
): print('hierarchy_identifier_7', list(p
))
4639 # { pform_name_t * tmp = p[1];
4640 # name_component_t&tail = tmp->back();
4641 # index_component_t itmp;
4642 # itmp.sel = index_component_t::SEL_IDX_DO;
4645 # tail.index.push_back(itmp);
4649 def p_list_of_identifiers_1(p
):
4650 '''list_of_identifiers : IDENTIFIER '''
4651 if(parse_debug
): print('list_of_identifiers_1', list(p
))
4652 # { p[0] = list_from_identifier(p[1]); }
4654 def p_list_of_identifiers_2(p
):
4655 '''list_of_identifiers : list_of_identifiers ',' IDENTIFIER '''
4656 if(parse_debug
): print('list_of_identifiers_2', list(p
))
4657 # { p[0] = list_from_identifier(p[1], p[3]); }
4659 def p_list_of_port_identifiers_1(p
):
4660 '''list_of_port_identifiers : IDENTIFIER dimensions_opt '''
4661 if(parse_debug
): print('list_of_port_identifiers_1', list(p
))
4662 # { p[0] = make_port_list(p[1], p[2], 0); }
4664 def p_list_of_port_identifiers_2(p
):
4665 '''list_of_port_identifiers : list_of_port_identifiers ',' IDENTIFIER dimensions_opt '''
4666 if(parse_debug
): print('list_of_port_identifiers_2', list(p
))
4667 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
4669 def p_list_of_variable_port_identifiers_1(p
):
4670 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '''
4671 if(parse_debug
): print('list_of_variable_port_identifiers_1', list(p
))
4672 # { p[0] = make_port_list(p[1], p[2], 0); }
4674 def p_list_of_variable_port_identifiers_2(p
):
4675 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '=' expression '''
4676 if(parse_debug
): print('list_of_variable_port_identifiers_2', list(p
))
4677 # { p[0] = make_port_list(p[1], p[2], p[4]); }
4679 def p_list_of_variable_port_identifiers_3(p
):
4680 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '''
4681 if(parse_debug
): print('list_of_variable_port_identifiers_3', list(p
))
4682 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
4684 def p_list_of_variable_port_identifiers_4(p
):
4685 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '=' expression '''
4686 if(parse_debug
): print('list_of_variable_port_identifiers_4', list(p
))
4687 # { p[0] = make_port_list(p[1], p[3], p[4], p[6]); }
4689 def p_list_of_ports_1(p
):
4690 '''list_of_ports : port_opt '''
4691 if(parse_debug
): print('list_of_ports_1', list(p
))
4692 # { vector<Module::port_t*>*tmp
4693 # = new vector<Module::port_t*>(1);
4698 def p_list_of_ports_2(p
):
4699 '''list_of_ports : list_of_ports ',' port_opt '''
4700 if(parse_debug
): print('list_of_ports_2', list(p
))
4701 # { vector<Module::port_t*>*tmp = p[1];
4702 # tmp->push_back(p[3]);
4706 def p_list_of_port_declarations_1(p
):
4707 '''list_of_port_declarations : port_declaration '''
4708 if(parse_debug
>1): print('list_of_port_declarations_1', list(p
))
4710 # { vector<Module::port_t*>*tmp
4711 # = new vector<Module::port_t*>(1);
4716 def p_list_of_port_declarations_2(p
):
4717 '''list_of_port_declarations : list_of_port_declarations ',' port_declaration '''
4718 if(parse_debug
): print('list_of_port_declarations_2 FIXME', list(p
))
4719 p
[1].append(Leaf(token
.NEWLINE
, '\n')) # should be a comma
4720 # XXX p[3].prefix=' ' # add a space after the NL, must go in parameter
4723 # { vector<Module::port_t*>*tmp = p[1];
4724 # tmp->push_back(p[3]);
4728 def p_list_of_port_declarations_3(p
):
4729 '''list_of_port_declarations : list_of_port_declarations ',' IDENTIFIER '''
4730 if(parse_debug
): print('list_of_port_declarations_3', list(p
))
4731 # { Module::port_t*ptmp;
4732 # perm_string name = lex_strings.make(p[3]);
4733 # ptmp = pform_module_port_reference(name, @3.text,
4735 # vector<Module::port_t*>*tmp = p[1];
4736 # tmp->push_back(ptmp);
4738 # /* Get the port declaration details, the port type
4739 # and what not, from context data stored by the
4740 # last port_declaration rule. */
4741 # pform_module_define_port(@3, name,
4742 # port_declaration_context.port_type,
4743 # port_declaration_context.port_net_type,
4744 # port_declaration_context.data_type, 0);
4749 def p_list_of_port_declarations_4(p
):
4750 '''list_of_port_declarations : list_of_port_declarations ',' '''
4751 if(parse_debug
): print('list_of_port_declarations_4', list(p
))
4753 # yyerror(@2, "error: NULL port declarations are not "
4757 def p_list_of_port_declarations_5(p
):
4758 '''list_of_port_declarations : list_of_port_declarations ';' '''
4759 if(parse_debug
): print('list_of_port_declarations_5', list(p
))
4761 # yyerror(@2, "error: ';' is an invalid port declaration "
4765 def p_port_declaration_1(p
):
4766 '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4767 if(parse_debug
): print('port_declaration_1 FIXME', list(p
))
4768 # XXX TODO: python AST
4769 comment
, dt
, name
= p
[2], p
[4], p
[5]
4770 p
[0] = port_decl(comment
, dt
, name
)
4771 # { Module::port_t*ptmp;
4772 # perm_string name = lex_strings.make(p[5]);
4773 # data_type_t*use_type = p[4];
4774 # if (p[6]) use_type = new uarray_type_t(use_type, p[6]);
4775 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4776 # pform_module_define_port(@2, name, NetNet::PINPUT, p[3], use_type, p[1]);
4777 # port_declaration_context.port_type = NetNet::PINPUT;
4778 # port_declaration_context.port_net_type = p[3];
4779 # port_declaration_context.data_type = p[4];
4784 def p_port_declaration_2(p
):
4785 '''port_declaration : attribute_list_opt K_input K_wreal IDENTIFIER '''
4786 if(parse_debug
): print('port_declaration_2', list(p
))
4787 # { Module::port_t*ptmp;
4788 # perm_string name = lex_strings.make(p[4]);
4789 # ptmp = pform_module_port_reference(name, @2.text,
4791 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4792 # FILE_NAME(real_type, @3);
4793 # pform_module_define_port(@2, name, NetNet::PINPUT,
4794 # NetNet::WIRE, real_type, p[1]);
4795 # port_declaration_context.port_type = NetNet::PINPUT;
4796 # port_declaration_context.port_net_type = NetNet::WIRE;
4797 # port_declaration_context.data_type = real_type;
4802 def p_port_declaration_3(p
):
4803 '''port_declaration : attribute_list_opt K_inout net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4804 if(parse_debug
): print('port_declaration_3', list(p
))
4805 # { Module::port_t*ptmp;
4806 # perm_string name = lex_strings.make(p[5]);
4807 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4808 # pform_module_define_port(@2, name, NetNet::PINOUT, p[3], p[4], p[1]);
4809 # port_declaration_context.port_type = NetNet::PINOUT;
4810 # port_declaration_context.port_net_type = p[3];
4811 # port_declaration_context.data_type = p[4];
4814 # yyerror(@6, "sorry: Inout ports with unpacked dimensions not supported.");
4820 def p_port_declaration_4(p
):
4821 '''port_declaration : attribute_list_opt K_inout K_wreal IDENTIFIER '''
4822 if(parse_debug
): print('port_declaration_4', list(p
))
4823 # { Module::port_t*ptmp;
4824 # perm_string name = lex_strings.make(p[4]);
4825 # ptmp = pform_module_port_reference(name, @2.text,
4827 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4828 # FILE_NAME(real_type, @3);
4829 # pform_module_define_port(@2, name, NetNet::PINOUT,
4830 # NetNet::WIRE, real_type, p[1]);
4831 # port_declaration_context.port_type = NetNet::PINOUT;
4832 # port_declaration_context.port_net_type = NetNet::WIRE;
4833 # port_declaration_context.data_type = real_type;
4838 def p_port_declaration_5(p
):
4839 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4840 if(parse_debug
): print('port_declaration_5 FIXME', list(p
))
4841 # XXX TODO: python AST
4842 comment
, dt
, name
= p
[2], p
[4], p
[5]
4843 p
[0] = port_decl(comment
, dt
, name
)
4844 # { Module::port_t*ptmp;
4845 # perm_string name = lex_strings.make(p[5]);
4846 # data_type_t*use_dtype = p[4];
4847 # if (p[6]) use_dtype = new uarray_type_t(use_dtype, p[6]);
4848 # NetNet::Type use_type = p[3];
4849 # if (use_type == NetNet::IMPLICIT) {
4850 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
4851 # if (dtype->reg_flag)
4852 # use_type = NetNet::REG;
4853 # else if (dtype->implicit_flag)
4854 # use_type = NetNet::IMPLICIT;
4856 # use_type = NetNet::IMPLICIT_REG;
4858 # // The SystemVerilog types that can show up as
4859 # // output ports are implicitly (on the inside)
4860 # // variables because "reg" is not valid syntax
4862 # } else if (dynamic_cast<atom2_type_t*> (p[4])) {
4863 # use_type = NetNet::IMPLICIT_REG;
4864 # } else if (dynamic_cast<struct_type_t*> (p[4])) {
4865 # use_type = NetNet::IMPLICIT_REG;
4866 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[4])) {
4867 # if(etype->base_type == IVL_VT_LOGIC)
4868 # use_type = NetNet::IMPLICIT_REG;
4871 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4872 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, use_dtype, p[1]);
4873 # port_declaration_context.port_type = NetNet::POUTPUT;
4874 # port_declaration_context.port_net_type = use_type;
4875 # port_declaration_context.data_type = p[4];
4880 def p_port_declaration_6(p
):
4881 '''port_declaration : attribute_list_opt K_output K_wreal IDENTIFIER '''
4882 if(parse_debug
): print('port_declaration_6', list(p
))
4883 # { Module::port_t*ptmp;
4884 # perm_string name = lex_strings.make(p[4]);
4885 # ptmp = pform_module_port_reference(name, @2.text,
4887 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4888 # FILE_NAME(real_type, @3);
4889 # pform_module_define_port(@2, name, NetNet::POUTPUT,
4890 # NetNet::WIRE, real_type, p[1]);
4891 # port_declaration_context.port_type = NetNet::POUTPUT;
4892 # port_declaration_context.port_net_type = NetNet::WIRE;
4893 # port_declaration_context.data_type = real_type;
4898 def p_port_declaration_7(p
):
4899 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER '=' expression '''
4900 if(parse_debug
): print('port_declaration_7', list(p
))
4901 # { Module::port_t*ptmp;
4902 # perm_string name = lex_strings.make(p[5]);
4903 # NetNet::Type use_type = p[3];
4904 # if (use_type == NetNet::IMPLICIT) {
4905 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
4906 # if (dtype->reg_flag)
4907 # use_type = NetNet::REG;
4909 # use_type = NetNet::IMPLICIT_REG;
4911 # use_type = NetNet::IMPLICIT_REG;
4914 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4915 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, p[4], p[1]);
4916 # port_declaration_context.port_type = NetNet::PINOUT;
4917 # port_declaration_context.port_net_type = use_type;
4918 # port_declaration_context.data_type = p[4];
4920 # pform_make_var_init(@5, name, p[7]);
4926 def p_net_type_opt_1(p
):
4927 '''net_type_opt : net_type '''
4928 if(parse_debug
): print('net_type_opt_1', list(p
))
4931 def p_net_type_opt_2(p
):
4932 '''net_type_opt : '''
4933 if(parse_debug
>2): print('net_type_opt_2', list(p
))
4936 def p_unsigned_signed_opt_1(p
):
4937 '''unsigned_signed_opt : K_signed '''
4938 if(parse_debug
): print('unsigned_signed_opt_1', list(p
))
4941 def p_unsigned_signed_opt_2(p
):
4942 '''unsigned_signed_opt : K_unsigned '''
4943 if(parse_debug
): print('unsigned_signed_opt_2', list(p
))
4946 def p_unsigned_signed_opt_3(p
):
4947 '''unsigned_signed_opt : '''
4948 if(parse_debug
): print('unsigned_signed_opt_3', list(p
))
4951 def p_signed_unsigned_opt_1(p
):
4952 '''signed_unsigned_opt : K_signed '''
4953 if(parse_debug
): print('signed_unsigned_opt_1', list(p
))
4956 def p_signed_unsigned_opt_2(p
):
4957 '''signed_unsigned_opt : K_unsigned '''
4958 if(parse_debug
): print('signed_unsigned_opt_2', list(p
))
4961 def p_signed_unsigned_opt_3(p
):
4962 '''signed_unsigned_opt : '''
4963 if(parse_debug
): print('signed_unsigned_opt_3', list(p
))
4966 def p_atom2_type_1(p
):
4967 '''atom2_type : K_byte '''
4968 if(parse_debug
): print('atom2_type_1', list(p
))
4971 def p_atom2_type_2(p
):
4972 '''atom2_type : K_shortint '''
4973 if(parse_debug
): print('atom2_type_2', list(p
))
4976 def p_atom2_type_3(p
):
4977 '''atom2_type : K_int '''
4978 if(parse_debug
): print('atom2_type_3', list(p
))
4981 def p_atom2_type_4(p
):
4982 '''atom2_type : K_longint '''
4983 if(parse_debug
): print('atom2_type_4', list(p
))
4987 '''lpvalue : hierarchy_identifier '''
4988 if(parse_debug
>2): print('lpvalue_1', list(p
))
4990 # { PEIdent*tmp = pform_new_ident(*p[1]);
4991 # FILE_NAME(tmp, @1);
4997 '''lpvalue : implicit_class_handle '.' hierarchy_identifier '''
4998 if(parse_debug
): print('lpvalue_2', list(p
))
4999 # { pform_name_t*t_name = p[1];
5000 # while (!p[3]->empty()) {
5001 # t_name->push_back(p[3]->front());
5002 # p[3]->pop_front();
5004 # PEIdent*tmp = new PEIdent(*t_name);
5005 # FILE_NAME(tmp, @1);
5012 '''lpvalue : '{' expression_list_proper '}' '''
5013 if(parse_debug
): print('lpvalue_3', list(p
))
5014 # { PEConcat*tmp = new PEConcat(*p[2]);
5015 # FILE_NAME(tmp, @1);
5021 '''lpvalue : streaming_concatenation '''
5022 if(parse_debug
): print('lpvalue_4', list(p
))
5023 # { yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
5027 def p_cont_assign_1(p
):
5028 '''cont_assign : lpvalue '=' expression '''
5029 if(parse_debug
): print('cont_assign_1 TODO', list(p
))
5030 # { list<PExpr*>*tmp = new list<PExpr*>;
5031 # tmp->push_back(p[1]);
5032 # tmp->push_back(p[3]);
5036 def p_cont_assign_list_1(p
):
5037 '''cont_assign_list : cont_assign_list ',' cont_assign '''
5038 if(parse_debug
): print('cont_assign_list_1', list(p
))
5039 # { list<PExpr*>*tmp = p[1];
5040 # tmp->splice(tmp->end(), *p[3]);
5045 def p_cont_assign_list_2(p
):
5046 '''cont_assign_list : cont_assign '''
5047 if(parse_debug
>2): print('cont_assign_list_2', list(p
))
5051 '''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 '''
5052 if(parse_debug
>2): print('module_1', list(p
))
5053 absyn
.printpy("# module_1")
5055 clsname
= [Leaf(token
.NAME
, 'class'),
5056 Leaf(token
.NAME
, p
[4], prefix
=' '),
5057 Leaf(token
.COLON
, ':')]
5058 pass_stmt
= Node(syms
.pass_stmt
, [Leaf(token
.NAME
, "pass"),])
5060 params
= [Leaf(token
.LPAR
, '(')] + params
+ [Leaf(token
.RPAR
, ')')]
5061 fn
= [Leaf(token
.NAME
, 'def'),
5062 Leaf(token
.NAME
, '__init__', prefix
=' '),
5063 Node(syms
.parameters
, params
),
5064 Leaf(token
.COLON
, ':')]
5065 fndef
= Node(syms
.funcdef
, fn
)
5066 stmts
= Node(syms
.stmt
, [fndef
])
5068 stmts
= Node(syms
.small_stmt
, [pass_stmt
, Leaf(token
.NEWLINE
, '\n')])
5069 stmts
= Node(syms
.stmt
, [stmts
])
5071 # XXX TODO ports as py nodes
5073 stmts
.children
.append(Leaf(token
.STRING
, '\n' + indent(ports
, 8)))
5074 suite
= Node(syms
.suite
, [Leaf(token
.NEWLINE
, '\n'),
5075 Leaf(token
.INDENT
, ' '),
5077 Leaf(token
.DEDENT
, '')
5079 clsdecl
= Node(syms
.classdef
, clsname
+ [suite
])
5080 clsdecl
= Node(syms
.compound_stmt
, [clsdecl
])
5081 absyn
.printpy("#clsdecl"+ repr(clsdecl
))
5082 absyn
.printpy("#clsstr:")
5083 absyn
.printpy(str(clsdecl
))
5085 # { // Last step: check any closing name. This is done late so
5086 # // that the parser can look ahead to detect the present
5087 # // endlabel_opt but still have the pform_endmodule() called
5088 # // early enough that the lexor can know we are outside the
5091 # if (strcmp(p[4],p[1]7) != 0) {
5094 # yyerror(@17, "error: End label doesn't match "
5098 # yyerror(@17, "error: End label doesn't match "
5102 # yyerror(@17, "error: End label doesn't match "
5103 # "interface name.");
5109 # if ((p[2] == K_module) && (! gn_system_verilog())) {
5110 # yyerror(@8, "error: Module end labels require "
5111 # "SystemVerilog.");
5118 def p__embed0_module(p
):
5119 '''_embed0_module : '''
5120 # { pform_startmodule(@2, p[4], p[2]==K_program, p[2]==K_interface, p[3], p[1]); }
5122 def p__embed1_module(p
):
5123 '''_embed1_module : '''
5124 # { pform_module_set_ports(p[8]); }
5126 def p__embed2_module(p
):
5127 '''_embed2_module : '''
5128 # { pform_set_scope_timescale(@2); }
5130 def p__embed3_module(p
):
5131 '''_embed3_module : '''
5132 # { Module::UCDriveType ucd;
5133 # // The lexor detected `unconnected_drive directives and
5134 # // marked what it found in the uc_drive variable. Use that
5135 # // to generate a UCD flag for the module.
5136 # switch (uc_drive) {
5139 # ucd = Module::UCD_NONE;
5142 # ucd = Module::UCD_PULL0;
5145 # ucd = Module::UCD_PULL1;
5148 # // Check that program/endprogram and module/endmodule
5149 # // keywords match.
5150 # if (p[2] != p[15]) {
5153 # yyerror(@15, "error: module not closed by endmodule.");
5156 # yyerror(@15, "error: program not closed by endprogram.");
5159 # yyerror(@15, "error: interface not closed by endinterface.");
5165 # pform_endmodule(p[4], in_celldefine, ucd);
5168 def p_module_start_1(p
):
5169 '''module_start : K_module '''
5170 if(parse_debug
>1): print('module_start_1', list(p
))
5171 # { p[0] = K_module; }
5173 def p_module_start_2(p
):
5174 '''module_start : K_macromodule '''
5175 if(parse_debug
): print('module_start_2', list(p
))
5176 # { p[0] = K_module; }
5178 def p_module_start_3(p
):
5179 '''module_start : K_program '''
5180 if(parse_debug
): print('module_start_3', list(p
))
5181 # { p[0] = K_program; }
5183 def p_module_start_4(p
):
5184 '''module_start : K_interface '''
5185 if(parse_debug
): print('module_start_4', list(p
))
5186 # { p[0] = K_interface; }
5188 def p_module_end_1(p
):
5189 '''module_end : K_endmodule '''
5190 if(parse_debug
>2): print('module_end_1', list(p
))
5191 # { p[0] = K_module; }
5193 def p_module_end_2(p
):
5194 '''module_end : K_endprogram '''
5195 if(parse_debug
): print('module_end_2', list(p
))
5196 # { p[0] = K_program; }
5198 def p_module_end_3(p
):
5199 '''module_end : K_endinterface '''
5200 if(parse_debug
): print('module_end_3', list(p
))
5201 # { p[0] = K_interface; }
5203 def p_endlabel_opt_1(p
):
5204 '''endlabel_opt : ':' IDENTIFIER '''
5205 if(parse_debug
): print('endlabel_opt_1', list(p
))
5208 def p_endlabel_opt_2(p
):
5209 '''endlabel_opt : '''
5210 if(parse_debug
>2): print('endlabel_opt_2', list(p
))
5213 def p_module_attribute_foreign_1(p
):
5214 '''module_attribute_foreign : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP '''
5215 if(parse_debug
): print('module_attribute_foreign_1', list(p
))
5218 def p_module_attribute_foreign_2(p
):
5219 '''module_attribute_foreign : '''
5220 if(parse_debug
>2): print('module_attribute_foreign_2', list(p
))
5223 def p_module_port_list_opt_1(p
):
5224 '''module_port_list_opt : '(' list_of_ports ')' '''
5225 if(parse_debug
): print('module_port_list_opt_1', list(p
))
5228 def p_module_port_list_opt_2(p
):
5229 '''module_port_list_opt : '(' list_of_port_declarations ')' '''
5230 if(parse_debug
>2): print('module_port_list_opt_2', list(p
))
5233 def p_module_port_list_opt_3(p
):
5234 '''module_port_list_opt : '''
5235 if(parse_debug
): print('module_port_list_opt_3', list(p
))
5238 def p_module_port_list_opt_4(p
):
5239 '''module_port_list_opt : '(' error ')' '''
5240 if(parse_debug
): print('module_port_list_opt_4', list(p
))
5241 # { yyerror(@2, "Errors in port declarations.");
5246 def p_module_parameter_port_list_opt_1(p
):
5247 '''module_parameter_port_list_opt : '''
5248 if(parse_debug
>2): print('module_parameter_port_list_opt_1', list(p
))
5250 def p_module_parameter_port_list_opt_2(p
):
5251 '''module_parameter_port_list_opt : '#' '(' module_parameter_port_list ')' '''
5252 if(parse_debug
): print('module_parameter_port_list_opt_2', list(p
))
5255 def p_module_parameter_port_list_1(p
):
5256 '''module_parameter_port_list : K_parameter param_type parameter_assign '''
5257 if(parse_debug
): print('module_parameter_port_list_1', list(p
))
5260 def p_module_parameter_port_list_2(p
):
5261 '''module_parameter_port_list : module_parameter_port_list ',' parameter_assign '''
5262 if(parse_debug
): print('module_parameter_port_list_2', list(p
))
5263 p
[0] = p
[1].append(p
[3])
5265 def p_module_parameter_port_list_3(p
):
5266 '''module_parameter_port_list : module_parameter_port_list ',' K_parameter param_type parameter_assign '''
5267 if(parse_debug
): print('module_parameter_port_list_3', list(p
))
5268 p
[1].append(Leaf(token
.COMMA
, ','))
5269 p
[1].append(Leaf(token
.NEWLINE
, '\n'))
5270 p
[5].prefix
=' ' # add space after newline
5274 def p_module_item_1(p
):
5275 '''module_item : module '''
5276 if(parse_debug
): print('module_item_1', list(p
))
5278 def p_module_item_2(p
):
5279 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' '''
5280 if(parse_debug
): print('module_item_2', list(p
))
5281 # { data_type_t*data_type = p[3];
5282 # if (data_type == 0) {
5283 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5284 # FILE_NAME(data_type, @2);
5286 # pform_set_data_type(@2, data_type, p[5], p[2], p[1]);
5288 # yyerror(@2, "sorry: net delays not supported.");
5294 def p_module_item_3(p
):
5295 '''module_item : attribute_list_opt K_wreal delay3 net_variable_list ';' '''
5296 if(parse_debug
): print('module_item_3', list(p
))
5297 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5298 # pform_set_data_type(@2, tmpt, p[4], NetNet::WIRE, p[1]);
5300 # yyerror(@3, "sorry: net delays not supported.");
5306 def p_module_item_4(p
):
5307 '''module_item : attribute_list_opt K_wreal net_variable_list ';' '''
5308 if(parse_debug
): print('module_item_4', list(p
))
5309 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5310 # pform_set_data_type(@2, tmpt, p[3], NetNet::WIRE, p[1]);
5314 def p_module_item_5(p
):
5315 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_decl_assigns ';' '''
5316 if(parse_debug
): print('module_item_5', list(p
))
5317 # { data_type_t*data_type = p[3];
5318 # if (data_type == 0) {
5319 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5320 # FILE_NAME(data_type, @2);
5322 # pform_makewire(@2, p[4], str_strength, p[5], p[2], data_type);
5324 # yywarn(@2, "Attributes are not supported on net declaration "
5325 # "assignments and will be discarded.");
5330 def p_module_item_6(p
):
5331 '''module_item : attribute_list_opt net_type data_type_or_implicit drive_strength net_decl_assigns ';' '''
5332 if(parse_debug
): print('module_item_6', list(p
))
5333 # { data_type_t*data_type = p[3];
5334 # if (data_type == 0) {
5335 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5336 # FILE_NAME(data_type, @2);
5338 # pform_makewire(@2, 0, p[4], p[5], p[2], data_type);
5340 # yywarn(@2, "Attributes are not supported on net declaration "
5341 # "assignments and will be discarded.");
5346 def p_module_item_7(p
):
5347 '''module_item : attribute_list_opt K_wreal net_decl_assigns ';' '''
5348 if(parse_debug
): print('module_item_7', list(p
))
5349 # { real_type_t*data_type = new real_type_t(real_type_t::REAL);
5350 # pform_makewire(@2, 0, str_strength, p[3], NetNet::WIRE, data_type);
5352 # yywarn(@2, "Attributes are not supported on net declaration "
5353 # "assignments and will be discarded.");
5358 def p_module_item_8(p
):
5359 '''module_item : K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' '''
5360 if(parse_debug
): print('module_item_8', list(p
))
5361 # { yyerror(@1, "sorry: trireg nets not supported.");
5366 def p_module_item_9(p
):
5367 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit list_of_port_identifiers ';' '''
5368 if(parse_debug
): print('module_item_9', list(p
))
5369 # { pform_module_define_port(@2, p[5], p[2], p[3], p[4], p[1]); }
5371 def p_module_item_10(p
):
5372 '''module_item : attribute_list_opt port_direction K_wreal list_of_port_identifiers ';' '''
5373 if(parse_debug
): print('module_item_10', list(p
))
5374 # { real_type_t*real_type = new real_type_t(real_type_t::REAL);
5375 # pform_module_define_port(@2, p[4], p[2], NetNet::WIRE, real_type, p[1]);
5378 def p_module_item_11(p
):
5379 '''module_item : attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' '''
5380 if(parse_debug
): print('module_item_11', list(p
))
5381 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
5382 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
5383 # if (dtype->implicit_flag)
5384 # use_type = NetNet::NONE;
5386 # if (use_type == NetNet::NONE)
5387 # pform_set_port_type(@2, p[4], NetNet::PINOUT, p[3], p[1]);
5389 # pform_module_define_port(@2, p[4], NetNet::PINOUT, use_type, p[3], p[1]);
5392 def p_module_item_12(p
):
5393 '''module_item : attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' '''
5394 if(parse_debug
): print('module_item_12', list(p
))
5395 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
5396 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
5397 # if (dtype->implicit_flag)
5398 # use_type = NetNet::NONE;
5400 # if (use_type == NetNet::NONE)
5401 # pform_set_port_type(@2, p[4], NetNet::PINPUT, p[3], p[1]);
5403 # pform_module_define_port(@2, p[4], NetNet::PINPUT, use_type, p[3], p[1]);
5406 def p_module_item_13(p
):
5407 '''module_item : attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' '''
5408 if(parse_debug
): print('module_item_13', list(p
))
5409 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
5410 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
5411 # if (dtype->implicit_flag)
5412 # use_type = NetNet::NONE;
5413 # else if (dtype->reg_flag)
5414 # use_type = NetNet::REG;
5416 # use_type = NetNet::IMPLICIT_REG;
5418 # // The SystemVerilog types that can show up as
5419 # // output ports are implicitly (on the inside)
5420 # // variables because "reg" is not valid syntax
5422 # } else if (dynamic_cast<atom2_type_t*> (p[3])) {
5423 # use_type = NetNet::IMPLICIT_REG;
5424 # } else if (dynamic_cast<struct_type_t*> (p[3])) {
5425 # use_type = NetNet::IMPLICIT_REG;
5426 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[3])) {
5427 # if(etype->base_type == IVL_VT_LOGIC)
5428 # use_type = NetNet::IMPLICIT_REG;
5430 # if (use_type == NetNet::NONE)
5431 # pform_set_port_type(@2, p[4], NetNet::POUTPUT, p[3], p[1]);
5433 # pform_module_define_port(@2, p[4], NetNet::POUTPUT, use_type, p[3], p[1]);
5436 def p_module_item_14(p
):
5437 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit error ';' '''
5438 if(parse_debug
): print('module_item_14', list(p
))
5439 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5440 # if (p[1]) delete p[1];
5441 # if (p[4]) delete p[4];
5445 def p_module_item_15(p
):
5446 '''module_item : attribute_list_opt K_inout data_type_or_implicit error ';' '''
5447 if(parse_debug
): print('module_item_15', list(p
))
5448 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5449 # if (p[1]) delete p[1];
5450 # if (p[3]) delete p[3];
5454 def p_module_item_16(p
):
5455 '''module_item : attribute_list_opt K_input data_type_or_implicit error ';' '''
5456 if(parse_debug
): print('module_item_16', list(p
))
5457 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5458 # if (p[1]) delete p[1];
5459 # if (p[3]) delete p[3];
5463 def p_module_item_17(p
):
5464 '''module_item : attribute_list_opt K_output data_type_or_implicit error ';' '''
5465 if(parse_debug
): print('module_item_17', list(p
))
5466 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5467 # if (p[1]) delete p[1];
5468 # if (p[3]) delete p[3];
5472 def p_module_item_18(p
):
5473 '''module_item : DISCIPLINE_IDENTIFIER list_of_identifiers ';' '''
5474 if(parse_debug
): print('module_item_18', list(p
))
5475 # { pform_attach_discipline(@1, p[1], p[2]); }
5477 def p_module_item_19(p
):
5478 '''module_item : attribute_list_opt _embed0_module_item block_item_decl '''
5479 if(parse_debug
): print('module_item_19', list(p
))
5480 # { delete attributes_in_context;
5481 # attributes_in_context = 0;
5484 def p_module_item_20(p
):
5485 '''module_item : K_defparam _embed1_module_item defparam_assign_list ';' '''
5486 if(parse_debug
): print('module_item_20', list(p
))
5488 def p_module_item_21(p
):
5489 '''module_item : attribute_list_opt gatetype gate_instance_list ';' '''
5490 if(parse_debug
): print('module_item_21', list(p
))
5491 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
5493 def p_module_item_22(p
):
5494 '''module_item : attribute_list_opt gatetype delay3 gate_instance_list ';' '''
5495 if(parse_debug
): print('module_item_22', list(p
))
5496 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
5498 def p_module_item_23(p
):
5499 '''module_item : attribute_list_opt gatetype drive_strength gate_instance_list ';' '''
5500 if(parse_debug
): print('module_item_23', list(p
))
5501 # { pform_makegates(@2, p[2], p[3], 0, p[4], p[1]); }
5503 def p_module_item_24(p
):
5504 '''module_item : attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';' '''
5505 if(parse_debug
): print('module_item_24', list(p
))
5506 # { pform_makegates(@2, p[2], p[3], p[4], p[5], p[1]); }
5508 def p_module_item_25(p
):
5509 '''module_item : attribute_list_opt switchtype gate_instance_list ';' '''
5510 if(parse_debug
): print('module_item_25', list(p
))
5511 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
5513 def p_module_item_26(p
):
5514 '''module_item : attribute_list_opt switchtype delay3 gate_instance_list ';' '''
5515 if(parse_debug
): print('module_item_26', list(p
))
5516 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
5518 def p_module_item_27(p
):
5519 '''module_item : K_pullup gate_instance_list ';' '''
5520 if(parse_debug
): print('module_item_27', list(p
))
5521 # { pform_makegates(@1, PGBuiltin::PULLUP, pull_strength, 0, p[2], 0); }
5523 def p_module_item_28(p
):
5524 '''module_item : K_pulldown gate_instance_list ';' '''
5525 if(parse_debug
): print('module_item_28', list(p
))
5526 # { pform_makegates(@1, PGBuiltin::PULLDOWN, pull_strength, 0, p[2], 0); }
5528 def p_module_item_29(p
):
5529 '''module_item : K_pullup '(' dr_strength1 ')' gate_instance_list ';' '''
5530 if(parse_debug
): print('module_item_29', list(p
))
5531 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[5], 0); }
5533 def p_module_item_30(p
):
5534 '''module_item : K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5535 if(parse_debug
): print('module_item_30', list(p
))
5536 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[7], 0); }
5538 def p_module_item_31(p
):
5539 '''module_item : K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5540 if(parse_debug
): print('module_item_31', list(p
))
5541 # { pform_makegates(@1, PGBuiltin::PULLUP, p[5], 0, p[7], 0); }
5543 def p_module_item_32(p
):
5544 '''module_item : K_pulldown '(' dr_strength0 ')' gate_instance_list ';' '''
5545 if(parse_debug
): print('module_item_32', list(p
))
5546 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[5], 0); }
5548 def p_module_item_33(p
):
5549 '''module_item : K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5550 if(parse_debug
): print('module_item_33', list(p
))
5551 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[5], 0, p[7], 0); }
5553 def p_module_item_34(p
):
5554 '''module_item : K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5555 if(parse_debug
): print('module_item_34', list(p
))
5556 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[7], 0); }
5558 def p_module_item_35(p
):
5559 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' '''
5560 if(parse_debug
): print('module_item_35', list(p
))
5561 # { perm_string tmp1 = lex_strings.make(p[2]);
5562 # pform_make_modgates(@2, tmp1, p[3], p[4], p[1]);
5566 def p_module_item_36(p
):
5567 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt error ';' '''
5568 if(parse_debug
): print('module_item_36', list(p
))
5569 # { yyerror(@2, "error: Invalid module instantiation");
5571 # if (p[1]) delete p[1];
5574 def p_module_item_37(p
):
5575 '''module_item : K_assign drive_strength_opt delay3_opt cont_assign_list ';' '''
5576 if(parse_debug
>2): print('module_item_37', list(p
))
5577 # { pform_make_pgassign_list(p[4], p[3], p[2], @1.text, @1.first_line); }
5579 def p_module_item_38(p
):
5580 '''module_item : attribute_list_opt K_always statement_item '''
5581 if(parse_debug
): print('module_item_38', list(p
))
5582 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, p[3], p[1]);
5583 # FILE_NAME(tmp, @2);
5586 def p_module_item_39(p
):
5587 '''module_item : attribute_list_opt K_always_comb statement_item '''
5588 if(parse_debug
): print('module_item_39', list(p
))
5589 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_COMB, p[3], p[1]);
5590 # FILE_NAME(tmp, @2);
5593 def p_module_item_40(p
):
5594 '''module_item : attribute_list_opt K_always_ff statement_item '''
5595 if(parse_debug
): print('module_item_40', list(p
))
5596 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, p[3], p[1]);
5597 # FILE_NAME(tmp, @2);
5600 def p_module_item_41(p
):
5601 '''module_item : attribute_list_opt K_always_latch statement_item '''
5602 if(parse_debug
): print('module_item_41', list(p
))
5603 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_LATCH, p[3], p[1]);
5604 # FILE_NAME(tmp, @2);
5607 def p_module_item_42(p
):
5608 '''module_item : attribute_list_opt K_initial statement_item '''
5609 if(parse_debug
): print('module_item_42', list(p
))
5610 # { PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, p[3], p[1]);
5611 # FILE_NAME(tmp, @2);
5614 def p_module_item_43(p
):
5615 '''module_item : attribute_list_opt K_final statement_item '''
5616 if(parse_debug
): print('module_item_43', list(p
))
5617 # { PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, p[3], p[1]);
5618 # FILE_NAME(tmp, @2);
5621 def p_module_item_44(p
):
5622 '''module_item : attribute_list_opt K_analog analog_statement '''
5623 if(parse_debug
): print('module_item_44', list(p
))
5624 # { pform_make_analog_behavior(@2, IVL_PR_ALWAYS, p[3]); }
5626 def p_module_item_45(p
):
5627 '''module_item : attribute_list_opt assertion_item '''
5628 if(parse_debug
): print('module_item_45', list(p
))
5630 def p_module_item_46(p
):
5631 '''module_item : timeunits_declaration '''
5632 if(parse_debug
): print('module_item_46', list(p
))
5634 def p_module_item_47(p
):
5635 '''module_item : class_declaration '''
5636 if(parse_debug
): print('module_item_47', list(p
))
5638 def p_module_item_48(p
):
5639 '''module_item : task_declaration '''
5640 if(parse_debug
): print('module_item_48', list(p
))
5642 def p_module_item_49(p
):
5643 '''module_item : function_declaration '''
5644 if(parse_debug
): print('module_item_49', list(p
))
5646 def p_module_item_50(p
):
5647 '''module_item : K_generate generate_item_list_opt K_endgenerate '''
5648 if(parse_debug
): print('module_item_50', list(p
))
5649 # { // Test for bad nesting. I understand it, but it is illegal.
5650 # if (pform_parent_generate()) {
5651 # cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
5652 # cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
5653 # cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
5658 def p_module_item_51(p
):
5659 '''module_item : K_genvar list_of_identifiers ';' '''
5660 if(parse_debug
): print('module_item_51', list(p
))
5661 # { pform_genvars(@1, p[2]); }
5663 def p_module_item_52(p
):
5664 '''module_item : K_for '(' IDENTIFIER '=' expression ';' expression ';' IDENTIFIER '=' expression ')' _embed2_module_item generate_block '''
5665 if(parse_debug
): print('module_item_52', list(p
))
5666 # { pform_endgenerate(); }
5668 def p_module_item_53(p
):
5669 '''module_item : generate_if generate_block_opt K_else _embed3_module_item generate_block '''
5670 if(parse_debug
): print('module_item_53', list(p
))
5671 # { pform_endgenerate(); }
5673 def p_module_item_54(p
):
5674 '''module_item : generate_if generate_block_opt %prec less_than_K_else '''
5675 if(parse_debug
): print('module_item_54', list(p
))
5676 # { pform_endgenerate(); }
5678 def p_module_item_55(p
):
5679 '''module_item : K_case '(' expression ')' _embed4_module_item generate_case_items K_endcase '''
5680 if(parse_debug
): print('module_item_55', list(p
))
5681 # { pform_endgenerate(); }
5683 def p_module_item_56(p
):
5684 '''module_item : modport_declaration '''
5685 if(parse_debug
): print('module_item_56', list(p
))
5687 def p_module_item_57(p
):
5688 '''module_item : package_import_declaration '''
5689 if(parse_debug
): print('module_item_57', list(p
))
5691 def p_module_item_58(p
):
5692 '''module_item : attribute_list_opt K_specparam _embed5_module_item specparam_decl ';' '''
5693 if(parse_debug
): print('module_item_58', list(p
))
5695 def p_module_item_59(p
):
5696 '''module_item : K_specify _embed6_module_item specify_item_list_opt K_endspecify '''
5697 if(parse_debug
): print('module_item_59', list(p
))
5699 def p_module_item_60(p
):
5700 '''module_item : K_specify error K_endspecify '''
5701 if(parse_debug
): print('module_item_60', list(p
))
5702 # { yyerror(@1, "error: syntax error in specify block");
5706 def p_module_item_61(p
):
5707 '''module_item : error ';' '''
5708 if(parse_debug
): print('module_item_61', list(p
))
5709 # { yyerror(@2, "error: invalid module item.");
5713 def p_module_item_62(p
):
5714 '''module_item : K_assign error '=' expression ';' '''
5715 if(parse_debug
): print('module_item_62', list(p
))
5716 # { yyerror(@1, "error: syntax error in left side "
5717 # "of continuous assignment.");
5721 def p_module_item_63(p
):
5722 '''module_item : K_assign error ';' '''
5723 if(parse_debug
): print('module_item_63', list(p
))
5724 # { yyerror(@1, "error: syntax error in "
5725 # "continuous assignment");
5729 def p_module_item_64(p
):
5730 '''module_item : K_function error K_endfunction endlabel_opt '''
5731 if(parse_debug
): print('module_item_64', list(p
))
5732 # { yyerror(@1, "error: I give up on this "
5733 # "function definition.");
5735 # if (!gn_system_verilog()) {
5736 # yyerror(@4, "error: Function end names require "
5737 # "SystemVerilog.");
5744 def p_module_item_65(p
):
5745 '''module_item : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';' '''
5746 if(parse_debug
): print('module_item_65', list(p
))
5747 # { perm_string tmp3 = lex_strings.make(p[3]);
5748 # perm_string tmp5 = lex_strings.make(p[5]);
5749 # pform_set_attrib(tmp3, tmp5, p[7]);
5754 def p_module_item_66(p
):
5755 '''module_item : KK_attribute '(' error ')' ';' '''
5756 if(parse_debug
): print('module_item_66', list(p
))
5757 # { yyerror(@1, "error: Malformed $attribute parameter list."); }
5759 def p__embed0_module_item(p
):
5760 '''_embed0_module_item : '''
5761 # { attributes_in_context = p[1]; }
5763 def p__embed1_module_item(p
):
5764 '''_embed1_module_item : '''
5765 # { if (pform_in_interface())
5766 # yyerror(@1, "error: Parameter overrides are not allowed "
5767 # "in interfaces.");
5770 def p__embed2_module_item(p
):
5771 '''_embed2_module_item : '''
5772 # { pform_start_generate_for(@1, p[3], p[5], p[7], p[9], p[11]); }
5774 def p__embed3_module_item(p
):
5775 '''_embed3_module_item : '''
5776 # { pform_start_generate_else(@1); }
5778 def p__embed4_module_item(p
):
5779 '''_embed4_module_item : '''
5780 # { pform_start_generate_case(@1, p[3]); }
5782 def p__embed5_module_item(p
):
5783 '''_embed5_module_item : '''
5784 # { if (pform_in_interface())
5785 # yyerror(@1, "error: specparam declarations are not allowed "
5786 # "in interfaces.");
5789 def p__embed6_module_item(p
):
5790 '''_embed6_module_item : '''
5791 # { if (pform_in_interface())
5792 # yyerror(@1, "error: specify blocks are not allowed "
5793 # "in interfaces.");
5796 def p_module_item_list_1(p
):
5797 '''module_item_list : module_item_list module_item '''
5798 if(parse_debug
): print('module_item_list_1', list(p
))
5800 def p_module_item_list_2(p
):
5801 '''module_item_list : module_item '''
5802 if(parse_debug
>2): print('module_item_list_2', list(p
))
5804 def p_module_item_list_opt_1(p
):
5805 '''module_item_list_opt : module_item_list '''
5806 if(parse_debug
>2): print('module_item_list_opt_1', list(p
))
5808 def p_module_item_list_opt_2(p
):
5809 '''module_item_list_opt : '''
5810 if(parse_debug
): print('module_item_list_opt_2', list(p
))
5812 def p_generate_if_1(p
):
5813 '''generate_if : K_if '(' expression ')' '''
5814 if(parse_debug
): print('generate_if_1', list(p
))
5815 # { pform_start_generate_if(@1, p[3]); }
5817 def p_generate_case_items_1(p
):
5818 '''generate_case_items : generate_case_items generate_case_item '''
5819 if(parse_debug
): print('generate_case_items_1', list(p
))
5821 def p_generate_case_items_2(p
):
5822 '''generate_case_items : generate_case_item '''
5823 if(parse_debug
): print('generate_case_items_2', list(p
))
5825 def p_generate_case_item_1(p
):
5826 '''generate_case_item : expression_list_proper ':' _embed0_generate_case_item generate_block_opt '''
5827 if(parse_debug
): print('generate_case_item_1', list(p
))
5828 # { pform_endgenerate(); }
5830 def p_generate_case_item_2(p
):
5831 '''generate_case_item : K_default ':' _embed1_generate_case_item generate_block_opt '''
5832 if(parse_debug
): print('generate_case_item_2', list(p
))
5833 # { pform_endgenerate(); }
5835 def p__embed0_generate_case_item(p
):
5836 '''_embed0_generate_case_item : '''
5837 # { pform_generate_case_item(@1, p[1]); }
5839 def p__embed1_generate_case_item(p
):
5840 '''_embed1_generate_case_item : '''
5841 # { pform_generate_case_item(@1, 0); }
5843 def p_generate_item_1(p
):
5844 '''generate_item : module_item '''
5845 if(parse_debug
): print('generate_item_1', list(p
))
5847 def p_generate_item_2(p
):
5848 '''generate_item : K_begin generate_item_list_opt K_end '''
5849 if(parse_debug
): print('generate_item_2', list(p
))
5850 # { /* Detect and warn about anachronistic begin/end use */
5851 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5853 # cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
5857 def p_generate_item_3(p
):
5858 '''generate_item : K_begin ':' IDENTIFIER _embed0_generate_item generate_item_list_opt K_end '''
5859 if(parse_debug
): print('generate_item_3', list(p
))
5860 # { /* Detect and warn about anachronistic named begin/end use */
5861 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5863 # cerr << @1 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
5865 # pform_endgenerate();
5868 def p__embed0_generate_item(p
):
5869 '''_embed0_generate_item : '''
5871 # pform_start_generate_nblock(@1, p[3]);
5874 def p_generate_item_list_1(p
):
5875 '''generate_item_list : generate_item_list generate_item '''
5876 if(parse_debug
): print('generate_item_list_1', list(p
))
5878 def p_generate_item_list_2(p
):
5879 '''generate_item_list : generate_item '''
5880 if(parse_debug
): print('generate_item_list_2', list(p
))
5882 def p_generate_item_list_opt_1(p
):
5883 '''generate_item_list_opt : generate_item_list '''
5884 if(parse_debug
): print('generate_item_list_opt_1', list(p
))
5886 def p_generate_item_list_opt_2(p
):
5887 '''generate_item_list_opt : '''
5888 if(parse_debug
): print('generate_item_list_opt_2', list(p
))
5890 def p_generate_block_1(p
):
5891 '''generate_block : module_item '''
5892 if(parse_debug
): print('generate_block_1', list(p
))
5894 def p_generate_block_2(p
):
5895 '''generate_block : K_begin generate_item_list_opt K_end '''
5896 if(parse_debug
): print('generate_block_2', list(p
))
5898 def p_generate_block_3(p
):
5899 '''generate_block : K_begin ':' IDENTIFIER generate_item_list_opt K_end endlabel_opt '''
5900 if(parse_debug
): print('generate_block_3', list(p
))
5901 # { pform_generate_block_name(p[3]);
5903 # if (strcmp(p[3],p[6]) != 0) {
5904 # yyerror(@6, "error: End label doesn't match "
5907 # if (! gn_system_verilog()) {
5908 # yyerror(@6, "error: Begin end labels require "
5909 # "SystemVerilog.");
5916 def p_generate_block_opt_1(p
):
5917 '''generate_block_opt : generate_block '''
5918 if(parse_debug
): print('generate_block_opt_1', list(p
))
5920 def p_generate_block_opt_2(p
):
5921 '''generate_block_opt : ';' '''
5922 if(parse_debug
): print('generate_block_opt_2', list(p
))
5924 def p_net_decl_assign_1(p
):
5925 '''net_decl_assign : IDENTIFIER '=' expression '''
5926 if(parse_debug
): print('net_decl_assign_1', list(p
))
5927 # { net_decl_assign_t*tmp = new net_decl_assign_t;
5929 # tmp->name = lex_strings.make(p[1]);
5935 def p_net_decl_assigns_1(p
):
5936 '''net_decl_assigns : net_decl_assigns ',' net_decl_assign '''
5937 if(parse_debug
): print('net_decl_assigns_1', list(p
))
5938 # { net_decl_assign_t*tmp = p[1];
5939 # p[3]->next = tmp->next;
5944 def p_net_decl_assigns_2(p
):
5945 '''net_decl_assigns : net_decl_assign '''
5946 if(parse_debug
): print('net_decl_assigns_2', list(p
))
5950 def p_bit_logic_1(p
):
5951 '''bit_logic : K_logic '''
5952 if(parse_debug
): print('bit_logic_1', list(p
))
5953 # { p[0] = IVL_VT_LOGIC; }
5955 def p_bit_logic_2(p
):
5956 '''bit_logic : K_bool '''
5957 if(parse_debug
): print('bit_logic_2', list(p
))
5958 # { p[0] = IVL_VT_BOOL; /* Icarus misc */}
5960 def p_bit_logic_3(p
):
5961 '''bit_logic : K_bit '''
5962 if(parse_debug
): print('bit_logic_3', list(p
))
5963 # { p[0] = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
5965 def p_bit_logic_opt_1(p
):
5966 '''bit_logic_opt : bit_logic '''
5967 if(parse_debug
): print('bit_logic_opt_1', list(p
))
5969 def p_bit_logic_opt_2(p
):
5970 '''bit_logic_opt : '''
5971 if(parse_debug
): print('bit_logic_opt_2', list(p
))
5972 # { p[0] = IVL_VT_NO_TYPE; }
5974 def p_net_type_1(p
):
5975 '''net_type : K_wire '''
5976 if(parse_debug
): print('net_type_1', list(p
))
5977 # { p[0] = NetNet::WIRE; }
5979 def p_net_type_2(p
):
5980 '''net_type : K_tri '''
5981 if(parse_debug
): print('net_type_2', list(p
))
5982 # { p[0] = NetNet::TRI; }
5984 def p_net_type_3(p
):
5985 '''net_type : K_tri1 '''
5986 if(parse_debug
): print('net_type_3', list(p
))
5987 # { p[0] = NetNet::TRI1; }
5989 def p_net_type_4(p
):
5990 '''net_type : K_supply0 '''
5991 if(parse_debug
): print('net_type_4', list(p
))
5992 # { p[0] = NetNet::SUPPLY0; }
5994 def p_net_type_5(p
):
5995 '''net_type : K_wand '''
5996 if(parse_debug
): print('net_type_5', list(p
))
5997 # { p[0] = NetNet::WAND; }
5999 def p_net_type_6(p
):
6000 '''net_type : K_triand '''
6001 if(parse_debug
): print('net_type_6', list(p
))
6002 # { p[0] = NetNet::TRIAND; }
6004 def p_net_type_7(p
):
6005 '''net_type : K_tri0 '''
6006 if(parse_debug
): print('net_type_7', list(p
))
6007 # { p[0] = NetNet::TRI0; }
6009 def p_net_type_8(p
):
6010 '''net_type : K_supply1 '''
6011 if(parse_debug
): print('net_type_8', list(p
))
6012 # { p[0] = NetNet::SUPPLY1; }
6014 def p_net_type_9(p
):
6015 '''net_type : K_wor '''
6016 if(parse_debug
): print('net_type_9', list(p
))
6017 # { p[0] = NetNet::WOR; }
6019 def p_net_type_10(p
):
6020 '''net_type : K_trior '''
6021 if(parse_debug
): print('net_type_10', list(p
))
6022 # { p[0] = NetNet::TRIOR; }
6024 def p_net_type_11(p
):
6025 '''net_type : K_wone '''
6026 if(parse_debug
): print('net_type_11', list(p
))
6027 # { p[0] = NetNet::UNRESOLVED_WIRE;
6028 # cerr << @1.text << ":" << @1.first_line << ": warning: "
6029 # "'wone' is deprecated, please use 'uwire' "
6030 # "instead." << endl;
6033 def p_net_type_12(p
):
6034 '''net_type : K_uwire '''
6035 if(parse_debug
): print('net_type_12', list(p
))
6036 # { p[0] = NetNet::UNRESOLVED_WIRE; }
6038 def p_param_type_1(p
):
6039 '''param_type : bit_logic_opt unsigned_signed_opt dimensions_opt '''
6040 if(parse_debug
): print('param_type_1', list(p
))
6041 # { param_active_range = p[3];
6042 # param_active_signed = p[2];
6043 # if ((p[1] == IVL_VT_NO_TYPE) && (p[3] != 0))
6044 # param_active_type = IVL_VT_LOGIC;
6046 # param_active_type = p[1];
6049 def p_param_type_2(p
):
6050 '''param_type : K_integer '''
6051 if(parse_debug
): print('param_type_2', list(p
))
6052 # { param_active_range = make_range_from_width(integer_width);
6053 # param_active_signed = true;
6054 # param_active_type = IVL_VT_LOGIC;
6057 def p_param_type_3(p
):
6058 '''param_type : K_time '''
6059 if(parse_debug
): print('param_type_3', list(p
))
6060 # { param_active_range = make_range_from_width(64);
6061 # param_active_signed = false;
6062 # param_active_type = IVL_VT_LOGIC;
6065 def p_param_type_4(p
):
6066 '''param_type : real_or_realtime '''
6067 if(parse_debug
): print('param_type_4', list(p
))
6068 # { param_active_range = 0;
6069 # param_active_signed = true;
6070 # param_active_type = IVL_VT_REAL;
6073 def p_param_type_5(p
):
6074 '''param_type : atom2_type '''
6075 if(parse_debug
): print('param_type_5', list(p
))
6076 # { param_active_range = make_range_from_width(p[1]);
6077 # param_active_signed = true;
6078 # param_active_type = IVL_VT_BOOL;
6081 def p_param_type_6(p
):
6082 '''param_type : TYPE_IDENTIFIER '''
6083 if(parse_debug
): print('param_type_6', list(p
))
6084 # { pform_set_param_from_type(@1, p[1].type, p[1].text, param_active_range,
6085 # param_active_signed, param_active_type);
6086 # delete[]p[1].text;
6089 def p_parameter_assign_list_1(p
):
6090 '''parameter_assign_list : parameter_assign '''
6091 if(parse_debug
): print('parameter_assign_list_1', list(p
))
6093 def p_parameter_assign_list_2(p
):
6094 '''parameter_assign_list : parameter_assign_list ',' parameter_assign '''
6095 if(parse_debug
): print('parameter_assign_list_2', list(p
))
6097 def p_localparam_assign_list_1(p
):
6098 '''localparam_assign_list : localparam_assign '''
6099 if(parse_debug
): print('localparam_assign_list_1', list(p
))
6101 def p_localparam_assign_list_2(p
):
6102 '''localparam_assign_list : localparam_assign_list ',' localparam_assign '''
6103 if(parse_debug
): print('localparam_assign_list_2', list(p
))
6105 def p_parameter_assign_1(p
):
6106 '''parameter_assign : IDENTIFIER '=' expression parameter_value_ranges_opt '''
6107 if(parse_debug
): print('parameter_assign_1', list(p
))
6108 tpname
= Node(syms
.tname
, [Leaf(token
.NAME
, p
[1])])
6109 expr
= Node(syms
.tfpdef
, [tpname
, Leaf(token
.EQUAL
, p
[2]), p
[3] ])
6111 # { PExpr*tmp = p[3];
6112 # pform_set_parameter(@1, lex_strings.make(p[1]), param_active_type,
6113 # param_active_signed, param_active_range, tmp, p[4]);
6117 def p_localparam_assign_1(p
):
6118 '''localparam_assign : IDENTIFIER '=' expression '''
6119 if(parse_debug
): print('localparam_assign_1', list(p
))
6120 # { PExpr*tmp = p[3];
6121 # pform_set_localparam(@1, lex_strings.make(p[1]), param_active_type,
6122 # param_active_signed, param_active_range, tmp);
6126 def p_parameter_value_ranges_opt_1(p
):
6127 '''parameter_value_ranges_opt : parameter_value_ranges '''
6128 if(parse_debug
): print('parameter_value_ranges_opt_1', list(p
))
6131 def p_parameter_value_ranges_opt_2(p
):
6132 '''parameter_value_ranges_opt : '''
6133 if(parse_debug
): print('parameter_value_ranges_opt_2', list(p
))
6136 def p_parameter_value_ranges_1(p
):
6137 '''parameter_value_ranges : parameter_value_ranges parameter_value_range '''
6138 if(parse_debug
): print('parameter_value_ranges_1', list(p
))
6139 # { p[0] = p[2]; p[0]->next = p[1]; }
6141 def p_parameter_value_ranges_2(p
):
6142 '''parameter_value_ranges : parameter_value_range '''
6143 if(parse_debug
): print('parameter_value_ranges_2', list(p
))
6144 # { p[0] = p[1]; p[0]->next = 0; }
6146 def p_parameter_value_range_1(p
):
6147 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ']' '''
6148 if(parse_debug
): print('parameter_value_range_1', list(p
))
6149 # { p[0] = pform_parameter_value_range(p[1], false, p[3], false, p[5]); }
6151 def p_parameter_value_range_2(p
):
6152 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ')' '''
6153 if(parse_debug
): print('parameter_value_range_2', list(p
))
6154 # { p[0] = pform_parameter_value_range(p[1], false, p[3], true, p[5]); }
6156 def p_parameter_value_range_3(p
):
6157 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ']' '''
6158 if(parse_debug
): print('parameter_value_range_3', list(p
))
6159 # { p[0] = pform_parameter_value_range(p[1], true, p[3], false, p[5]); }
6161 def p_parameter_value_range_4(p
):
6162 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ')' '''
6163 if(parse_debug
): print('parameter_value_range_4', list(p
))
6164 # { p[0] = pform_parameter_value_range(p[1], true, p[3], true, p[5]); }
6166 def p_parameter_value_range_5(p
):
6167 '''parameter_value_range : K_exclude expression '''
6168 if(parse_debug
): print('parameter_value_range_5', list(p
))
6169 # { p[0] = pform_parameter_value_range(true, false, p[2], false, p[2]); }
6171 def p_value_range_expression_1(p
):
6172 '''value_range_expression : expression '''
6173 if(parse_debug
): print('value_range_expression_1', list(p
))
6176 def p_value_range_expression_2(p
):
6177 '''value_range_expression : K_inf '''
6178 if(parse_debug
): print('value_range_expression_2', list(p
))
6181 def p_value_range_expression_3(p
):
6182 '''value_range_expression : '+' K_inf '''
6183 if(parse_debug
): print('value_range_expression_3', list(p
))
6186 def p_value_range_expression_4(p
):
6187 '''value_range_expression : '-' K_inf '''
6188 if(parse_debug
): print('value_range_expression_4', list(p
))
6191 def p_from_exclude_1(p
):
6192 '''from_exclude : K_from '''
6193 if(parse_debug
): print('from_exclude_1', list(p
))
6196 def p_from_exclude_2(p
):
6197 '''from_exclude : K_exclude '''
6198 if(parse_debug
): print('from_exclude_2', list(p
))
6201 def p_parameter_value_opt_1(p
):
6202 '''parameter_value_opt : '#' '(' expression_list_with_nuls ')' '''
6203 if(parse_debug
): print('parameter_value_opt_1', list(p
))
6204 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6205 # tmp->by_order = p[3];
6210 def p_parameter_value_opt_2(p
):
6211 '''parameter_value_opt : '#' '(' parameter_value_byname_list ')' '''
6212 if(parse_debug
): print('parameter_value_opt_2', list(p
))
6213 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6214 # tmp->by_order = 0;
6215 # tmp->by_name = p[3];
6219 def p_parameter_value_opt_3(p
):
6220 '''parameter_value_opt : '#' DEC_NUMBER '''
6221 if(parse_debug
): print('parameter_value_opt_3', list(p
))
6223 # PENumber*tmp = new PENumber(p[2]);
6224 # FILE_NAME(tmp, @1);
6226 # struct parmvalue_t*lst = new struct parmvalue_t;
6227 # lst->by_order = new list<PExpr*>;
6228 # lst->by_order->push_back(tmp);
6234 def p_parameter_value_opt_4(p
):
6235 '''parameter_value_opt : '#' REALTIME '''
6236 if(parse_debug
): print('parameter_value_opt_4', list(p
))
6238 # PEFNumber*tmp = new PEFNumber(p[2]);
6239 # FILE_NAME(tmp, @1);
6241 # struct parmvalue_t*lst = new struct parmvalue_t;
6242 # lst->by_order = new list<PExpr*>;
6243 # lst->by_order->push_back(tmp);
6248 def p_parameter_value_opt_5(p
):
6249 '''parameter_value_opt : '#' error '''
6250 if(parse_debug
): print('parameter_value_opt_5', list(p
))
6251 # { yyerror(@1, "error: syntax error in parameter value "
6252 # "assignment list.");
6256 def p_parameter_value_opt_6(p
):
6257 '''parameter_value_opt : '''
6258 if(parse_debug
): print('parameter_value_opt_6', list(p
))
6261 def p_parameter_value_byname_1(p
):
6262 '''parameter_value_byname : '.' IDENTIFIER '(' expression ')' '''
6263 if(parse_debug
): print('parameter_value_byname_1', list(p
))
6264 # { named_pexpr_t*tmp = new named_pexpr_t;
6265 # tmp->name = lex_strings.make(p[2]);
6271 def p_parameter_value_byname_2(p
):
6272 '''parameter_value_byname : '.' IDENTIFIER '(' ')' '''
6273 if(parse_debug
): print('parameter_value_byname_2', list(p
))
6274 # { named_pexpr_t*tmp = new named_pexpr_t;
6275 # tmp->name = lex_strings.make(p[2]);
6281 def p_parameter_value_byname_list_1(p
):
6282 '''parameter_value_byname_list : parameter_value_byname '''
6283 if(parse_debug
): print('parameter_value_byname_list_1', list(p
))
6284 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6285 # tmp->push_back(*p[1]);
6290 def p_parameter_value_byname_list_2(p
):
6291 '''parameter_value_byname_list : parameter_value_byname_list ',' parameter_value_byname '''
6292 if(parse_debug
): print('parameter_value_byname_list_2', list(p
))
6293 # { list<named_pexpr_t>*tmp = p[1];
6294 # tmp->push_back(*p[3]);
6300 '''port : port_reference '''
6301 if(parse_debug
): print('port_1', list(p
))
6305 '''port : '.' IDENTIFIER '(' port_reference ')' '''
6306 if(parse_debug
): print('port_2', list(p
))
6307 # { Module::port_t*tmp = p[4];
6308 # tmp->name = lex_strings.make(p[2]);
6314 '''port : '{' port_reference_list '}' '''
6315 if(parse_debug
): print('port_3', list(p
))
6316 # { Module::port_t*tmp = p[2];
6317 # tmp->name = perm_string();
6322 '''port : '.' IDENTIFIER '(' '{' port_reference_list '}' ')' '''
6323 if(parse_debug
): print('port_4', list(p
))
6324 # { Module::port_t*tmp = p[5];
6325 # tmp->name = lex_strings.make(p[2]);
6330 def p_port_opt_1(p
):
6331 '''port_opt : port '''
6332 if(parse_debug
): print('port_opt_1', list(p
))
6335 def p_port_opt_2(p
):
6337 if(parse_debug
): print('port_opt_2', list(p
))
6340 def p_port_name_1(p
):
6341 '''port_name : '.' IDENTIFIER '(' expression ')' '''
6342 if(parse_debug
): print('port_name_1', list(p
))
6343 # { named_pexpr_t*tmp = new named_pexpr_t;
6344 # tmp->name = lex_strings.make(p[2]);
6350 def p_port_name_2(p
):
6351 '''port_name : '.' IDENTIFIER '(' error ')' '''
6352 if(parse_debug
): print('port_name_2', list(p
))
6353 # { yyerror(@3, "error: invalid port connection expression.");
6354 # named_pexpr_t*tmp = new named_pexpr_t;
6355 # tmp->name = lex_strings.make(p[2]);
6361 def p_port_name_3(p
):
6362 '''port_name : '.' IDENTIFIER '(' ')' '''
6363 if(parse_debug
): print('port_name_3', list(p
))
6364 # { named_pexpr_t*tmp = new named_pexpr_t;
6365 # tmp->name = lex_strings.make(p[2]);
6371 def p_port_name_4(p
):
6372 '''port_name : '.' IDENTIFIER '''
6373 if(parse_debug
): print('port_name_4', list(p
))
6374 # { named_pexpr_t*tmp = new named_pexpr_t;
6375 # tmp->name = lex_strings.make(p[2]);
6376 # tmp->parm = new PEIdent(lex_strings.make(p[2]), true);
6377 # FILE_NAME(tmp->parm, @1);
6382 def p_port_name_5(p
):
6383 '''port_name : K_DOTSTAR '''
6384 if(parse_debug
): print('port_name_5', list(p
))
6385 # { named_pexpr_t*tmp = new named_pexpr_t;
6386 # tmp->name = lex_strings.make("*");
6391 def p_port_name_list_1(p
):
6392 '''port_name_list : port_name_list ',' port_name '''
6393 if(parse_debug
): print('port_name_list_1', list(p
))
6394 # { list<named_pexpr_t>*tmp = p[1];
6395 # tmp->push_back(*p[3]);
6400 def p_port_name_list_2(p
):
6401 '''port_name_list : port_name '''
6402 if(parse_debug
): print('port_name_list_2', list(p
))
6403 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6404 # tmp->push_back(*p[1]);
6409 def p_port_reference_1(p
):
6410 '''port_reference : IDENTIFIER '''
6411 if(parse_debug
): print('port_reference_1', list(p
))
6412 # { Module::port_t*ptmp;
6413 # perm_string name = lex_strings.make(p[1]);
6414 # ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
6419 def p_port_reference_2(p
):
6420 '''port_reference : IDENTIFIER '[' expression ':' expression ']' '''
6421 if(parse_debug
): print('port_reference_2', list(p
))
6422 # { index_component_t itmp;
6423 # itmp.sel = index_component_t::SEL_PART;
6427 # name_component_t ntmp (lex_strings.make(p[1]));
6428 # ntmp.index.push_back(itmp);
6430 # pform_name_t pname;
6431 # pname.push_back(ntmp);
6433 # PEIdent*wtmp = new PEIdent(pname);
6434 # FILE_NAME(wtmp, @1);
6436 # Module::port_t*ptmp = new Module::port_t;
6437 # ptmp->name = perm_string();
6438 # ptmp->expr.push_back(wtmp);
6444 def p_port_reference_3(p
):
6445 '''port_reference : IDENTIFIER '[' expression ']' '''
6446 if(parse_debug
): print('port_reference_3', list(p
))
6447 # { index_component_t itmp;
6448 # itmp.sel = index_component_t::SEL_BIT;
6452 # name_component_t ntmp (lex_strings.make(p[1]));
6453 # ntmp.index.push_back(itmp);
6455 # pform_name_t pname;
6456 # pname.push_back(ntmp);
6458 # PEIdent*tmp = new PEIdent(pname);
6459 # FILE_NAME(tmp, @1);
6461 # Module::port_t*ptmp = new Module::port_t;
6462 # ptmp->name = perm_string();
6463 # ptmp->expr.push_back(tmp);
6468 def p_port_reference_4(p
):
6469 '''port_reference : IDENTIFIER '[' error ']' '''
6470 if(parse_debug
): print('port_reference_4', list(p
))
6471 # { yyerror(@1, "error: invalid port bit select");
6472 # Module::port_t*ptmp = new Module::port_t;
6473 # PEIdent*wtmp = new PEIdent(lex_strings.make(p[1]));
6474 # FILE_NAME(wtmp, @1);
6475 # ptmp->name = lex_strings.make(p[1]);
6476 # ptmp->expr.push_back(wtmp);
6481 def p_port_reference_list_1(p
):
6482 '''port_reference_list : port_reference '''
6483 if(parse_debug
): print('port_reference_list_1', list(p
))
6486 def p_port_reference_list_2(p
):
6487 '''port_reference_list : port_reference_list ',' port_reference '''
6488 if(parse_debug
): print('port_reference_list_2', list(p
))
6489 # { Module::port_t*tmp = p[1];
6490 # append(tmp->expr, p[3]->expr);
6495 def p_dimensions_opt_1(p
):
6496 '''dimensions_opt : '''
6497 if(parse_debug
>2): print('dimensions_opt_1', list(p
))
6500 def p_dimensions_opt_2(p
):
6501 '''dimensions_opt : dimensions '''
6502 if(parse_debug
): print('dimensions_opt_2', list(p
))
6505 def p_dimensions_1(p
):
6506 '''dimensions : variable_dimension '''
6507 if(parse_debug
): print('dimensions_1', list(p
))
6510 def p_dimensions_2(p
):
6511 '''dimensions : dimensions variable_dimension '''
6512 if(parse_debug
): print('dimensions_2', list(p
))
6513 # { list<pform_range_t> *tmp = p[1];
6515 # tmp->splice(tmp->end(), *p[2]);
6521 def p_register_variable_1(p
):
6522 '''register_variable : IDENTIFIER dimensions_opt '''
6523 if(parse_debug
): print('register_variable_1', list(p
))
6524 # { perm_string name = lex_strings.make(p[1]);
6525 # pform_makewire(@1, name, NetNet::REG,
6526 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6527 # pform_set_reg_idx(name, p[2]);
6531 def p_register_variable_2(p
):
6532 '''register_variable : IDENTIFIER dimensions_opt '=' expression '''
6533 if(parse_debug
): print('register_variable_2', list(p
))
6534 # { if (pform_peek_scope()->var_init_needs_explicit_lifetime()
6535 # && (var_lifetime == LexicalScope::INHERITED)) {
6536 # cerr << @3 << ": warning: Static variable initialization requires "
6537 # "explicit lifetime in this context." << endl;
6540 # perm_string name = lex_strings.make(p[1]);
6541 # pform_makewire(@1, name, NetNet::REG,
6542 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6543 # pform_set_reg_idx(name, p[2]);
6544 # pform_make_var_init(@1, name, p[4]);
6548 def p_register_variable_list_1(p
):
6549 '''register_variable_list : register_variable '''
6550 if(parse_debug
): print('register_variable_list_1', list(p
))
6551 # { list<perm_string>*tmp = new list<perm_string>;
6552 # tmp->push_back(lex_strings.make(p[1]));
6557 def p_register_variable_list_2(p
):
6558 '''register_variable_list : register_variable_list ',' register_variable '''
6559 if(parse_debug
): print('register_variable_list_2', list(p
))
6560 # { list<perm_string>*tmp = p[1];
6561 # tmp->push_back(lex_strings.make(p[3]));
6566 def p_net_variable_1(p
):
6567 '''net_variable : IDENTIFIER dimensions_opt '''
6568 if(parse_debug
): print('net_variable_1', list(p
))
6569 # { perm_string name = lex_strings.make(p[1]);
6570 # pform_makewire(@1, name, NetNet::IMPLICIT,
6571 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6572 # pform_set_reg_idx(name, p[2]);
6576 def p_net_variable_list_1(p
):
6577 '''net_variable_list : net_variable '''
6578 if(parse_debug
): print('net_variable_list_1', list(p
))
6579 # { list<perm_string>*tmp = new list<perm_string>;
6580 # tmp->push_back(lex_strings.make(p[1]));
6585 def p_net_variable_list_2(p
):
6586 '''net_variable_list : net_variable_list ',' net_variable '''
6587 if(parse_debug
): print('net_variable_list_2', list(p
))
6588 # { list<perm_string>*tmp = p[1];
6589 # tmp->push_back(lex_strings.make(p[3]));
6594 def p_event_variable_1(p
):
6595 '''event_variable : IDENTIFIER dimensions_opt '''
6596 if(parse_debug
): print('event_variable_1', list(p
))
6598 # yyerror(@2, "sorry: event arrays are not supported.");
6604 def p_event_variable_list_1(p
):
6605 '''event_variable_list : event_variable '''
6606 if(parse_debug
): print('event_variable_list_1', list(p
))
6607 # { p[0] = list_from_identifier(p[1]); }
6609 def p_event_variable_list_2(p
):
6610 '''event_variable_list : event_variable_list ',' event_variable '''
6611 if(parse_debug
): print('event_variable_list_2', list(p
))
6612 # { p[0] = list_from_identifier(p[1], p[3]); }
6614 def p_specify_item_1(p
):
6615 '''specify_item : K_specparam specparam_decl ';' '''
6616 if(parse_debug
): print('specify_item_1', list(p
))
6618 def p_specify_item_2(p
):
6619 '''specify_item : specify_simple_path_decl ';' '''
6620 if(parse_debug
): print('specify_item_2', list(p
))
6621 # { pform_module_specify_path(p[1]);
6624 def p_specify_item_3(p
):
6625 '''specify_item : specify_edge_path_decl ';' '''
6626 if(parse_debug
): print('specify_item_3', list(p
))
6627 # { pform_module_specify_path(p[1]);
6630 def p_specify_item_4(p
):
6631 '''specify_item : K_if '(' expression ')' specify_simple_path_decl ';' '''
6632 if(parse_debug
): print('specify_item_4', list(p
))
6633 # { PSpecPath*tmp = p[5];
6635 # tmp->conditional = true;
6636 # tmp->condition = p[3];
6638 # pform_module_specify_path(tmp);
6641 def p_specify_item_5(p
):
6642 '''specify_item : K_if '(' expression ')' specify_edge_path_decl ';' '''
6643 if(parse_debug
): print('specify_item_5', list(p
))
6644 # { PSpecPath*tmp = p[5];
6646 # tmp->conditional = true;
6647 # tmp->condition = p[3];
6649 # pform_module_specify_path(tmp);
6652 def p_specify_item_6(p
):
6653 '''specify_item : K_ifnone specify_simple_path_decl ';' '''
6654 if(parse_debug
): print('specify_item_6', list(p
))
6655 # { PSpecPath*tmp = p[2];
6657 # tmp->conditional = true;
6658 # tmp->condition = 0;
6660 # pform_module_specify_path(tmp);
6663 def p_specify_item_7(p
):
6664 '''specify_item : K_ifnone specify_edge_path_decl ';' '''
6665 if(parse_debug
): print('specify_item_7', list(p
))
6666 # { yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
6667 # "not supported.");
6671 def p_specify_item_8(p
):
6672 '''specify_item : K_Sfullskew '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6673 if(parse_debug
): print('specify_item_8', list(p
))
6678 def p_specify_item_9(p
):
6679 '''specify_item : K_Shold '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6680 if(parse_debug
): print('specify_item_9', list(p
))
6684 def p_specify_item_10(p
):
6685 '''specify_item : K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6686 if(parse_debug
): print('specify_item_10', list(p
))
6691 def p_specify_item_11(p
):
6692 '''specify_item : K_Speriod '(' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6693 if(parse_debug
): print('specify_item_11', list(p
))
6697 def p_specify_item_12(p
):
6698 '''specify_item : K_Srecovery '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6699 if(parse_debug
): print('specify_item_12', list(p
))
6703 def p_specify_item_13(p
):
6704 '''specify_item : K_Srecrem '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6705 if(parse_debug
): print('specify_item_13', list(p
))
6710 def p_specify_item_14(p
):
6711 '''specify_item : K_Sremoval '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6712 if(parse_debug
): print('specify_item_14', list(p
))
6716 def p_specify_item_15(p
):
6717 '''specify_item : K_Ssetup '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6718 if(parse_debug
): print('specify_item_15', list(p
))
6722 def p_specify_item_16(p
):
6723 '''specify_item : K_Ssetuphold '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6724 if(parse_debug
): print('specify_item_16', list(p
))
6729 def p_specify_item_17(p
):
6730 '''specify_item : K_Sskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6731 if(parse_debug
): print('specify_item_17', list(p
))
6735 def p_specify_item_18(p
):
6736 '''specify_item : K_Stimeskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6737 if(parse_debug
): print('specify_item_18', list(p
))
6741 def p_specify_item_19(p
):
6742 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ',' expression spec_notifier_opt ')' ';' '''
6743 if(parse_debug
): print('specify_item_19', list(p
))
6748 def p_specify_item_20(p
):
6749 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ')' ';' '''
6750 if(parse_debug
): print('specify_item_20', list(p
))
6754 def p_specify_item_21(p
):
6755 '''specify_item : K_pulsestyle_onevent specify_path_identifiers ';' '''
6756 if(parse_debug
): print('specify_item_21', list(p
))
6760 def p_specify_item_22(p
):
6761 '''specify_item : K_pulsestyle_ondetect specify_path_identifiers ';' '''
6762 if(parse_debug
): print('specify_item_22', list(p
))
6766 def p_specify_item_23(p
):
6767 '''specify_item : K_showcancelled specify_path_identifiers ';' '''
6768 if(parse_debug
): print('specify_item_23', list(p
))
6772 def p_specify_item_24(p
):
6773 '''specify_item : K_noshowcancelled specify_path_identifiers ';' '''
6774 if(parse_debug
): print('specify_item_24', list(p
))
6778 def p_specify_item_list_1(p
):
6779 '''specify_item_list : specify_item '''
6780 if(parse_debug
): print('specify_item_list_1', list(p
))
6782 def p_specify_item_list_2(p
):
6783 '''specify_item_list : specify_item_list specify_item '''
6784 if(parse_debug
): print('specify_item_list_2', list(p
))
6786 def p_specify_item_list_opt_1(p
):
6787 '''specify_item_list_opt : '''
6788 if(parse_debug
): print('specify_item_list_opt_1', list(p
))
6791 def p_specify_item_list_opt_2(p
):
6792 '''specify_item_list_opt : specify_item_list '''
6793 if(parse_debug
): print('specify_item_list_opt_2', list(p
))
6796 def p_specify_edge_path_decl_1(p
):
6797 '''specify_edge_path_decl : specify_edge_path '=' '(' delay_value_list ')' '''
6798 if(parse_debug
): print('specify_edge_path_decl_1', list(p
))
6799 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
6801 def p_specify_edge_path_decl_2(p
):
6802 '''specify_edge_path_decl : specify_edge_path '=' delay_value_simple '''
6803 if(parse_debug
): print('specify_edge_path_decl_2', list(p
))
6804 # { list<PExpr*>*tmp = new list<PExpr*>;
6805 # tmp->push_back(p[3]);
6806 # p[0] = pform_assign_path_delay(p[1], tmp);
6809 def p_edge_operator_1(p
):
6810 '''edge_operator : K_posedge '''
6811 if(parse_debug
): print('edge_operator_1', list(p
))
6814 def p_edge_operator_2(p
):
6815 '''edge_operator : K_negedge '''
6816 if(parse_debug
): print('edge_operator_2', list(p
))
6819 def p_specify_edge_path_1(p
):
6820 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6821 if(parse_debug
): print('specify_edge_path_1', list(p
))
6822 # { int edge_flag = 0;
6823 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], false, p[6], p[8]); }
6825 def p_specify_edge_path_2(p
):
6826 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6827 if(parse_debug
): print('specify_edge_path_2', list(p
))
6828 # { int edge_flag = p[2]? 1 : -1;
6829 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], false, p[7], p[9]);}
6831 def p_specify_edge_path_3(p
):
6832 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6833 if(parse_debug
): print('specify_edge_path_3', list(p
))
6834 # { int edge_flag = 0;
6835 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], true, p[6], p[8]); }
6837 def p_specify_edge_path_4(p
):
6838 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6839 if(parse_debug
): print('specify_edge_path_4', list(p
))
6840 # { int edge_flag = p[2]? 1 : -1;
6841 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], true, p[7], p[9]); }
6843 def p_polarity_operator_1(p
):
6844 '''polarity_operator : K_PO_POS '''
6845 if(parse_debug
): print('polarity_operator_1', list(p
))
6847 def p_polarity_operator_2(p
):
6848 '''polarity_operator : K_PO_NEG '''
6849 if(parse_debug
): print('polarity_operator_2', list(p
))
6851 def p_polarity_operator_3(p
):
6852 '''polarity_operator : ':' '''
6853 if(parse_debug
): print('polarity_operator_3', list(p
))
6855 def p_specify_simple_path_decl_1(p
):
6856 '''specify_simple_path_decl : specify_simple_path '=' '(' delay_value_list ')' '''
6857 if(parse_debug
): print('specify_simple_path_decl_1', list(p
))
6858 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
6860 def p_specify_simple_path_decl_2(p
):
6861 '''specify_simple_path_decl : specify_simple_path '=' delay_value_simple '''
6862 if(parse_debug
): print('specify_simple_path_decl_2', list(p
))
6863 # { list<PExpr*>*tmp = new list<PExpr*>;
6864 # tmp->push_back(p[3]);
6865 # p[0] = pform_assign_path_delay(p[1], tmp);
6868 def p_specify_simple_path_decl_3(p
):
6869 '''specify_simple_path_decl : specify_simple_path '=' '(' error ')' '''
6870 if(parse_debug
): print('specify_simple_path_decl_3', list(p
))
6871 # { yyerror(@3, "Syntax error in delay value list.");
6876 def p_specify_simple_path_1(p
):
6877 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' '''
6878 if(parse_debug
): print('specify_simple_path_1', list(p
))
6879 # { p[0] = pform_make_specify_path(@1, p[2], p[3], false, p[5]); }
6881 def p_specify_simple_path_2(p
):
6882 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' '''
6883 if(parse_debug
): print('specify_simple_path_2', list(p
))
6884 # { p[0] = pform_make_specify_path(@1, p[2], p[3], true, p[5]); }
6886 def p_specify_simple_path_3(p
):
6887 '''specify_simple_path : '(' error ')' '''
6888 if(parse_debug
): print('specify_simple_path_3', list(p
))
6889 # { yyerror(@1, "Invalid simple path");
6893 def p_specify_path_identifiers_1(p
):
6894 '''specify_path_identifiers : IDENTIFIER '''
6895 if(parse_debug
): print('specify_path_identifiers_1', list(p
))
6896 # { list<perm_string>*tmp = new list<perm_string>;
6897 # tmp->push_back(lex_strings.make(p[1]));
6902 def p_specify_path_identifiers_2(p
):
6903 '''specify_path_identifiers : IDENTIFIER '[' expr_primary ']' '''
6904 if(parse_debug
): print('specify_path_identifiers_2', list(p
))
6905 # { if (gn_specify_blocks_flag) {
6906 # yywarn(@4, "Bit selects are not currently supported "
6907 # "in path declarations. The declaration "
6908 # "will be applied to the whole vector.");
6910 # list<perm_string>*tmp = new list<perm_string>;
6911 # tmp->push_back(lex_strings.make(p[1]));
6916 def p_specify_path_identifiers_3(p
):
6917 '''specify_path_identifiers : IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6918 if(parse_debug
): print('specify_path_identifiers_3', list(p
))
6919 # { if (gn_specify_blocks_flag) {
6920 # yywarn(@4, "Part selects are not currently supported "
6921 # "in path declarations. The declaration "
6922 # "will be applied to the whole vector.");
6924 # list<perm_string>*tmp = new list<perm_string>;
6925 # tmp->push_back(lex_strings.make(p[1]));
6930 def p_specify_path_identifiers_4(p
):
6931 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '''
6932 if(parse_debug
): print('specify_path_identifiers_4', list(p
))
6933 # { list<perm_string>*tmp = p[1];
6934 # tmp->push_back(lex_strings.make(p[3]));
6939 def p_specify_path_identifiers_5(p
):
6940 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' '''
6941 if(parse_debug
): print('specify_path_identifiers_5', list(p
))
6942 # { if (gn_specify_blocks_flag) {
6943 # yywarn(@4, "Bit selects are not currently supported "
6944 # "in path declarations. The declaration "
6945 # "will be applied to the whole vector.");
6947 # list<perm_string>*tmp = p[1];
6948 # tmp->push_back(lex_strings.make(p[3]));
6953 def p_specify_path_identifiers_6(p
):
6954 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6955 if(parse_debug
): print('specify_path_identifiers_6', list(p
))
6956 # { if (gn_specify_blocks_flag) {
6957 # yywarn(@4, "Part selects are not currently supported "
6958 # "in path declarations. The declaration "
6959 # "will be applied to the whole vector.");
6961 # list<perm_string>*tmp = p[1];
6962 # tmp->push_back(lex_strings.make(p[3]));
6967 def p_specparam_1(p
):
6968 '''specparam : IDENTIFIER '=' expression '''
6969 if(parse_debug
): print('specparam_1', list(p
))
6970 # { PExpr*tmp = p[3];
6971 # pform_set_specparam(@1, lex_strings.make(p[1]),
6972 # param_active_range, tmp);
6976 def p_specparam_2(p
):
6977 '''specparam : IDENTIFIER '=' expression ':' expression ':' expression '''
6978 if(parse_debug
): print('specparam_2', list(p
))
6980 # switch (min_typ_max_flag) {
6997 # if (min_typ_max_warn > 0) {
6998 # cerr << tmp->get_fileline() << ": warning: choosing ";
6999 # switch (min_typ_max_flag) {
7010 # cerr << " expression." << endl;
7011 # min_typ_max_warn -= 1;
7013 # pform_set_specparam(@1, lex_strings.make(p[1]),
7014 # param_active_range, tmp);
7018 def p_specparam_3(p
):
7019 '''specparam : PATHPULSE_IDENTIFIER '=' expression '''
7020 if(parse_debug
): print('specparam_3', list(p
))
7025 def p_specparam_4(p
):
7026 '''specparam : PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' '''
7027 if(parse_debug
): print('specparam_4', list(p
))
7033 def p_specparam_list_1(p
):
7034 '''specparam_list : specparam '''
7035 if(parse_debug
): print('specparam_list_1', list(p
))
7037 def p_specparam_list_2(p
):
7038 '''specparam_list : specparam_list ',' specparam '''
7039 if(parse_debug
): print('specparam_list_2', list(p
))
7041 def p_specparam_decl_1(p
):
7042 '''specparam_decl : specparam_list '''
7043 if(parse_debug
): print('specparam_decl_1', list(p
))
7045 def p_specparam_decl_2(p
):
7046 '''specparam_decl : dimensions _embed0_specparam_decl specparam_list '''
7047 if(parse_debug
): print('specparam_decl_2', list(p
))
7048 # { param_active_range = 0; }
7050 def p__embed0_specparam_decl(p
):
7051 '''_embed0_specparam_decl : '''
7052 # { param_active_range = p[1]; }
7054 def p_spec_polarity_1(p
):
7055 '''spec_polarity : '+' '''
7056 if(parse_debug
): print('spec_polarity_1', list(p
))
7059 def p_spec_polarity_2(p
):
7060 '''spec_polarity : '-' '''
7061 if(parse_debug
): print('spec_polarity_2', list(p
))
7064 def p_spec_polarity_3(p
):
7065 '''spec_polarity : '''
7066 if(parse_debug
): print('spec_polarity_3', list(p
))
7069 def p_spec_reference_event_1(p
):
7070 '''spec_reference_event : K_posedge expression '''
7071 if(parse_debug
): print('spec_reference_event_1', list(p
))
7074 def p_spec_reference_event_2(p
):
7075 '''spec_reference_event : K_negedge expression '''
7076 if(parse_debug
): print('spec_reference_event_2', list(p
))
7079 def p_spec_reference_event_3(p
):
7080 '''spec_reference_event : K_posedge expr_primary K_TAND expression '''
7081 if(parse_debug
): print('spec_reference_event_3', list(p
))
7086 def p_spec_reference_event_4(p
):
7087 '''spec_reference_event : K_negedge expr_primary K_TAND expression '''
7088 if(parse_debug
): print('spec_reference_event_4', list(p
))
7093 def p_spec_reference_event_5(p
):
7094 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary '''
7095 if(parse_debug
): print('spec_reference_event_5', list(p
))
7098 def p_spec_reference_event_6(p
):
7099 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression '''
7100 if(parse_debug
): print('spec_reference_event_6', list(p
))
7105 def p_spec_reference_event_7(p
):
7106 '''spec_reference_event : expr_primary K_TAND expression '''
7107 if(parse_debug
): print('spec_reference_event_7', list(p
))
7112 def p_spec_reference_event_8(p
):
7113 '''spec_reference_event : expr_primary '''
7114 if(parse_debug
): print('spec_reference_event_8', list(p
))
7117 def p_edge_descriptor_list_1(p
):
7118 '''edge_descriptor_list : edge_descriptor_list ',' K_edge_descriptor '''
7119 if(parse_debug
): print('edge_descriptor_list_1', list(p
))
7121 def p_edge_descriptor_list_2(p
):
7122 '''edge_descriptor_list : K_edge_descriptor '''
7123 if(parse_debug
): print('edge_descriptor_list_2', list(p
))
7125 def p_spec_notifier_opt_1(p
):
7126 '''spec_notifier_opt : '''
7127 if(parse_debug
): print('spec_notifier_opt_1', list(p
))
7130 def p_spec_notifier_opt_2(p
):
7131 '''spec_notifier_opt : spec_notifier '''
7132 if(parse_debug
): print('spec_notifier_opt_2', list(p
))
7135 def p_spec_notifier_1(p
):
7136 '''spec_notifier : ',' '''
7137 if(parse_debug
): print('spec_notifier_1', list(p
))
7138 # { args_after_notifier = 0; }
7140 def p_spec_notifier_2(p
):
7141 '''spec_notifier : ',' hierarchy_identifier '''
7142 if(parse_debug
): print('spec_notifier_2', list(p
))
7143 # { args_after_notifier = 0; delete p[2]; }
7145 def p_spec_notifier_3(p
):
7146 '''spec_notifier : spec_notifier ',' '''
7147 if(parse_debug
): print('spec_notifier_3', list(p
))
7148 # { args_after_notifier += 1; }
7150 def p_spec_notifier_4(p
):
7151 '''spec_notifier : spec_notifier ',' hierarchy_identifier '''
7152 if(parse_debug
): print('spec_notifier_4', list(p
))
7153 # { args_after_notifier += 1;
7154 # if (args_after_notifier >= 3) {
7155 # cerr << @3 << ": warning: timing checks are not supported "
7156 # "and delayed signal \"" << *p[3]
7157 # << "\" will not be driven." << endl;
7161 def p_spec_notifier_5(p
):
7162 '''spec_notifier : IDENTIFIER '''
7163 if(parse_debug
): print('spec_notifier_5', list(p
))
7164 # { args_after_notifier = 0; delete[]p[1]; }
7166 def p_statement_item_1(p
):
7167 '''statement_item : K_assign lpvalue '=' expression ';' '''
7168 if(parse_debug
): print('statement_item_1', list(p
))
7169 # { PCAssign*tmp = new PCAssign(p[2], p[4]);
7170 # FILE_NAME(tmp, @1);
7174 def p_statement_item_2(p
):
7175 '''statement_item : K_deassign lpvalue ';' '''
7176 if(parse_debug
): print('statement_item_2', list(p
))
7177 # { PDeassign*tmp = new PDeassign(p[2]);
7178 # FILE_NAME(tmp, @1);
7182 def p_statement_item_3(p
):
7183 '''statement_item : K_force lpvalue '=' expression ';' '''
7184 if(parse_debug
): print('statement_item_3', list(p
))
7185 # { PForce*tmp = new PForce(p[2], p[4]);
7186 # FILE_NAME(tmp, @1);
7190 def p_statement_item_4(p
):
7191 '''statement_item : K_release lpvalue ';' '''
7192 if(parse_debug
): print('statement_item_4', list(p
))
7193 # { PRelease*tmp = new PRelease(p[2]);
7194 # FILE_NAME(tmp, @1);
7198 def p_statement_item_5(p
):
7199 '''statement_item : K_begin K_end '''
7200 if(parse_debug
): print('statement_item_5', list(p
))
7201 # { PBlock*tmp = new PBlock(PBlock::BL_SEQ);
7202 # FILE_NAME(tmp, @1);
7206 def p_statement_item_6(p
):
7207 '''statement_item : K_begin _embed0_statement_item block_item_decls_opt _embed1_statement_item statement_or_null_list K_end '''
7208 if(parse_debug
): print('statement_item_6', list(p
))
7211 # pform_pop_scope();
7212 # assert(! current_block_stack.empty());
7213 # tmp = current_block_stack.top();
7214 # current_block_stack.pop();
7216 # tmp = new PBlock(PBlock::BL_SEQ);
7217 # FILE_NAME(tmp, @1);
7219 # if (p[5]) tmp->set_statement(*p[5]);
7224 def p_statement_item_7(p
):
7225 '''statement_item : K_begin ':' IDENTIFIER _embed2_statement_item block_item_decls_opt statement_or_null_list_opt K_end endlabel_opt '''
7226 if(parse_debug
): print('statement_item_7', list(p
))
7227 # { pform_pop_scope();
7228 # assert(! current_block_stack.empty());
7229 # PBlock*tmp = current_block_stack.top();
7230 # current_block_stack.pop();
7231 # if (p[6]) tmp->set_statement(*p[6]);
7234 # if (strcmp(p[3],p[8]) != 0) {
7235 # yyerror(@8, "error: End label doesn't match begin name");
7237 # if (! gn_system_verilog()) {
7238 # yyerror(@8, "error: Begin end labels require "
7239 # "SystemVerilog.");
7247 def p_statement_item_8(p
):
7248 '''statement_item : K_fork join_keyword '''
7249 if(parse_debug
): print('statement_item_8', list(p
))
7250 # { PBlock*tmp = new PBlock(p[2]);
7251 # FILE_NAME(tmp, @1);
7255 def p_statement_item_9(p
):
7256 '''statement_item : K_fork _embed3_statement_item block_item_decls_opt _embed4_statement_item statement_or_null_list join_keyword '''
7257 if(parse_debug
): print('statement_item_9', list(p
))
7260 # pform_pop_scope();
7261 # assert(! current_block_stack.empty());
7262 # tmp = current_block_stack.top();
7263 # current_block_stack.pop();
7264 # tmp->set_join_type(p[6]);
7266 # tmp = new PBlock(p[6]);
7267 # FILE_NAME(tmp, @1);
7269 # if (p[5]) tmp->set_statement(*p[5]);
7274 def p_statement_item_10(p
):
7275 '''statement_item : K_fork ':' IDENTIFIER _embed5_statement_item block_item_decls_opt statement_or_null_list_opt join_keyword endlabel_opt '''
7276 if(parse_debug
): print('statement_item_10', list(p
))
7277 # { pform_pop_scope();
7278 # assert(! current_block_stack.empty());
7279 # PBlock*tmp = current_block_stack.top();
7280 # current_block_stack.pop();
7281 # tmp->set_join_type(p[7]);
7282 # if (p[6]) tmp->set_statement(*p[6]);
7285 # if (strcmp(p[3],p[8]) != 0) {
7286 # yyerror(@8, "error: End label doesn't match fork name");
7288 # if (! gn_system_verilog()) {
7289 # yyerror(@8, "error: Fork end labels require "
7290 # "SystemVerilog.");
7298 def p_statement_item_11(p
):
7299 '''statement_item : K_disable hierarchy_identifier ';' '''
7300 if(parse_debug
): print('statement_item_11', list(p
))
7301 # { PDisable*tmp = new PDisable(*p[2]);
7302 # FILE_NAME(tmp, @1);
7307 def p_statement_item_12(p
):
7308 '''statement_item : K_disable K_fork ';' '''
7309 if(parse_debug
): print('statement_item_12', list(p
))
7310 # { pform_name_t tmp_name;
7311 # PDisable*tmp = new PDisable(tmp_name);
7312 # FILE_NAME(tmp, @1);
7316 def p_statement_item_13(p
):
7317 '''statement_item : K_TRIGGER hierarchy_identifier ';' '''
7318 if(parse_debug
): print('statement_item_13', list(p
))
7319 # { PTrigger*tmp = new PTrigger(*p[2]);
7320 # FILE_NAME(tmp, @1);
7325 def p_statement_item_14(p
):
7326 '''statement_item : procedural_assertion_statement '''
7327 if(parse_debug
): print('statement_item_14', list(p
))
7330 def p_statement_item_15(p
):
7331 '''statement_item : loop_statement '''
7332 if(parse_debug
): print('statement_item_15', list(p
))
7335 def p_statement_item_16(p
):
7336 '''statement_item : jump_statement '''
7337 if(parse_debug
): print('statement_item_16', list(p
))
7340 def p_statement_item_17(p
):
7341 '''statement_item : K_case '(' expression ')' case_items K_endcase '''
7342 if(parse_debug
): print('statement_item_17', list(p
))
7343 # { PCase*tmp = new PCase(NetCase::EQ, p[3], p[5]);
7344 # FILE_NAME(tmp, @1);
7348 def p_statement_item_18(p
):
7349 '''statement_item : K_casex '(' expression ')' case_items K_endcase '''
7350 if(parse_debug
): print('statement_item_18', list(p
))
7351 # { PCase*tmp = new PCase(NetCase::EQX, p[3], p[5]);
7352 # FILE_NAME(tmp, @1);
7356 def p_statement_item_19(p
):
7357 '''statement_item : K_casez '(' expression ')' case_items K_endcase '''
7358 if(parse_debug
): print('statement_item_19', list(p
))
7359 # { PCase*tmp = new PCase(NetCase::EQZ, p[3], p[5]);
7360 # FILE_NAME(tmp, @1);
7364 def p_statement_item_20(p
):
7365 '''statement_item : K_case '(' expression ')' error K_endcase '''
7366 if(parse_debug
): print('statement_item_20', list(p
))
7369 def p_statement_item_21(p
):
7370 '''statement_item : K_casex '(' expression ')' error K_endcase '''
7371 if(parse_debug
): print('statement_item_21', list(p
))
7374 def p_statement_item_22(p
):
7375 '''statement_item : K_casez '(' expression ')' error K_endcase '''
7376 if(parse_debug
): print('statement_item_22', list(p
))
7379 def p_statement_item_23(p
):
7380 '''statement_item : K_if '(' expression ')' statement_or_null %prec less_than_K_else '''
7381 if(parse_debug
): print('statement_item_23', list(p
))
7382 # { PCondit*tmp = new PCondit(p[3], p[5], 0);
7383 # FILE_NAME(tmp, @1);
7387 def p_statement_item_24(p
):
7388 '''statement_item : K_if '(' expression ')' statement_or_null K_else statement_or_null '''
7389 if(parse_debug
): print('statement_item_24', list(p
))
7390 # { PCondit*tmp = new PCondit(p[3], p[5], p[7]);
7391 # FILE_NAME(tmp, @1);
7395 def p_statement_item_25(p
):
7396 '''statement_item : K_if '(' error ')' statement_or_null %prec less_than_K_else '''
7397 if(parse_debug
): print('statement_item_25', list(p
))
7398 # { yyerror(@1, "error: Malformed conditional expression.");
7402 def p_statement_item_26(p
):
7403 '''statement_item : K_if '(' error ')' statement_or_null K_else statement_or_null '''
7404 if(parse_debug
): print('statement_item_26', list(p
))
7405 # { yyerror(@1, "error: Malformed conditional expression.");
7409 def p_statement_item_27(p
):
7410 '''statement_item : compressed_statement ';' '''
7411 if(parse_debug
): print('statement_item_27', list(p
))
7414 def p_statement_item_28(p
):
7415 '''statement_item : inc_or_dec_expression ';' '''
7416 if(parse_debug
): print('statement_item_28', list(p
))
7417 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
7419 def p_statement_item_29(p
):
7420 '''statement_item : delay1 statement_or_null '''
7421 if(parse_debug
): print('statement_item_29', list(p
))
7422 # { PExpr*del = p[1]->front();
7423 # assert(p[1]->size() == 1);
7425 # PDelayStatement*tmp = new PDelayStatement(del, p[2]);
7426 # FILE_NAME(tmp, @1);
7430 def p_statement_item_30(p
):
7431 '''statement_item : event_control statement_or_null '''
7432 if(parse_debug
): print('statement_item_30', list(p
))
7433 # { PEventStatement*tmp = p[1];
7435 # yyerror(@1, "error: Invalid event control.");
7438 # tmp->set_statement(p[2]);
7443 def p_statement_item_31(p
):
7444 '''statement_item : '@' '*' statement_or_null '''
7445 if(parse_debug
): print('statement_item_31', list(p
))
7446 # { PEventStatement*tmp = new PEventStatement;
7447 # FILE_NAME(tmp, @1);
7448 # tmp->set_statement(p[3]);
7452 def p_statement_item_32(p
):
7453 '''statement_item : '@' '(' '*' ')' statement_or_null '''
7454 if(parse_debug
): print('statement_item_32', list(p
))
7455 # { PEventStatement*tmp = new PEventStatement;
7456 # FILE_NAME(tmp, @1);
7457 # tmp->set_statement(p[5]);
7461 def p_statement_item_33(p
):
7462 '''statement_item : lpvalue '=' expression ';' '''
7463 if(parse_debug
): print('statement_item33', list(p
))
7465 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), p
[3] ])
7466 if(parse_debug
): print ("expr TODO", repr(expr
))
7468 expr
= Node(syms
.expr_stmt
, [p
[1], Leaf(token
.EQUAL
, p
[2]), ])
7469 if(parse_debug
): print ("expr", repr(expr
))
7470 if(parse_debug
): print ("expr (python):'%s'" % expr
)
7472 # { PAssign*tmp = new PAssign(p[1],p[3]);
7473 # FILE_NAME(tmp, @1);
7477 def p_statement_item_34(p
):
7478 '''statement_item : error '=' expression ';' '''
7479 if(parse_debug
): print('statement_item_34', list(p
))
7480 # { yyerror(@2, "Syntax in assignment statement l-value.");
7485 def p_statement_item_35(p
):
7486 '''statement_item : lpvalue K_LE expression ';' '''
7487 if(parse_debug
): print('statement_item_35', list(p
))
7488 # { PAssignNB*tmp = new PAssignNB(p[1],p[3]);
7489 # FILE_NAME(tmp, @1);
7493 def p_statement_item_36(p
):
7494 '''statement_item : error K_LE expression ';' '''
7495 if(parse_debug
): print('statement_item_36', list(p
))
7496 # { yyerror(@2, "Syntax in assignment statement l-value.");
7501 def p_statement_item_37(p
):
7502 '''statement_item : lpvalue '=' delay1 expression ';' '''
7503 if(parse_debug
): print('statement_item_37', list(p
))
7504 # { PExpr*del = p[3]->front(); p[3]->pop_front();
7505 # assert(p[3]->empty());
7506 # PAssign*tmp = new PAssign(p[1],del,p[4]);
7507 # FILE_NAME(tmp, @1);
7511 def p_statement_item_38(p
):
7512 '''statement_item : lpvalue K_LE delay1 expression ';' '''
7513 if(parse_debug
): print('statement_item_38', list(p
))
7514 # { PExpr*del = p[3]->front(); p[3]->pop_front();
7515 # assert(p[3]->empty());
7516 # PAssignNB*tmp = new PAssignNB(p[1],del,p[4]);
7517 # FILE_NAME(tmp, @1);
7521 def p_statement_item_39(p
):
7522 '''statement_item : lpvalue '=' event_control expression ';' '''
7523 if(parse_debug
): print('statement_item_39', list(p
))
7524 # { PAssign*tmp = new PAssign(p[1],0,p[3],p[4]);
7525 # FILE_NAME(tmp, @1);
7529 def p_statement_item_40(p
):
7530 '''statement_item : lpvalue '=' K_repeat '(' expression ')' event_control expression ';' '''
7531 if(parse_debug
): print('statement_item_40', list(p
))
7532 # { PAssign*tmp = new PAssign(p[1],p[5],p[7],p[8]);
7533 # FILE_NAME(tmp,@1);
7534 # tmp->set_lineno(@1.first_line);
7538 def p_statement_item_41(p
):
7539 '''statement_item : lpvalue K_LE event_control expression ';' '''
7540 if(parse_debug
): print('statement_item_41', list(p
))
7541 # { PAssignNB*tmp = new PAssignNB(p[1],0,p[3],p[4]);
7542 # FILE_NAME(tmp, @1);
7546 def p_statement_item_42(p
):
7547 '''statement_item : lpvalue K_LE K_repeat '(' expression ')' event_control expression ';' '''
7548 if(parse_debug
): print('statement_item_42', list(p
))
7549 # { PAssignNB*tmp = new PAssignNB(p[1],p[5],p[7],p[8]);
7550 # FILE_NAME(tmp, @1);
7554 def p_statement_item_43(p
):
7555 '''statement_item : lpvalue '=' dynamic_array_new ';' '''
7556 if(parse_debug
): print('statement_item_43', list(p
))
7557 # { PAssign*tmp = new PAssign(p[1],p[3]);
7558 # FILE_NAME(tmp, @1);
7562 def p_statement_item_44(p
):
7563 '''statement_item : lpvalue '=' class_new ';' '''
7564 if(parse_debug
): print('statement_item_44', list(p
))
7565 # { PAssign*tmp = new PAssign(p[1],p[3]);
7566 # FILE_NAME(tmp, @1);
7570 def p_statement_item_45(p
):
7571 '''statement_item : K_wait '(' expression ')' statement_or_null '''
7572 if(parse_debug
): print('statement_item_45', list(p
))
7573 # { PEventStatement*tmp;
7574 # PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, p[3]);
7575 # tmp = new PEventStatement(etmp);
7576 # FILE_NAME(tmp,@1);
7577 # tmp->set_statement(p[5]);
7581 def p_statement_item_46(p
):
7582 '''statement_item : K_wait K_fork ';' '''
7583 if(parse_debug
): print('statement_item_46', list(p
))
7584 # { PEventStatement*tmp = new PEventStatement((PEEvent*)0);
7585 # FILE_NAME(tmp,@1);
7589 def p_statement_item_47(p
):
7590 '''statement_item : SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';' '''
7591 if(parse_debug
): print('statement_item_47', list(p
))
7592 # { PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), *p[3]);
7593 # FILE_NAME(tmp,@1);
7599 def p_statement_item_48(p
):
7600 '''statement_item : SYSTEM_IDENTIFIER ';' '''
7601 if(parse_debug
): print('statement_item_48', list(p
))
7603 # PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), pt);
7604 # FILE_NAME(tmp,@1);
7609 def p_statement_item_49(p
):
7610 '''statement_item : hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7611 if(parse_debug
): print('statement_item_49', list(p
))
7612 # { PCallTask*tmp = pform_make_call_task(@1, *p[1], *p[3]);
7618 def p_statement_item_50(p
):
7619 '''statement_item : hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';' '''
7620 if(parse_debug
): print('statement_item_50', list(p
))
7621 # { /* ....randomize with { <constraints> } */
7622 # if (p[1] && peek_tail_name(*p[1]) == "randomize") {
7623 # if (!gn_system_verilog())
7624 # yyerror(@2, "error: Randomize with constraint requires SystemVerilog.");
7626 # yyerror(@2, "sorry: Randomize with constraint not supported.");
7628 # yyerror(@2, "error: Constraint block can only be applied to randomize method.");
7631 # PCallTask*tmp = new PCallTask(*p[1], pt);
7632 # FILE_NAME(tmp, @1);
7637 def p_statement_item_51(p
):
7638 '''statement_item : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7639 if(parse_debug
): print('statement_item_51', list(p
))
7640 # { pform_name_t*t_name = p[1];
7641 # while (! p[3]->empty()) {
7642 # t_name->push_back(p[3]->front());
7643 # p[3]->pop_front();
7645 # PCallTask*tmp = new PCallTask(*t_name, *p[5]);
7646 # FILE_NAME(tmp, @1);
7653 def p_statement_item_52(p
):
7654 '''statement_item : hierarchy_identifier ';' '''
7655 if(parse_debug
): print('statement_item_52', list(p
))
7657 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
7662 def p_statement_item_53(p
):
7663 '''statement_item : implicit_class_handle '.' K_new '(' expression_list_with_nuls ')' ';' '''
7664 if(parse_debug
): print('statement_item_53', list(p
))
7665 # { PChainConstructor*tmp = new PChainConstructor(*p[5]);
7666 # FILE_NAME(tmp, @3);
7671 def p_statement_item_54(p
):
7672 '''statement_item : hierarchy_identifier '(' error ')' ';' '''
7673 if(parse_debug
): print('statement_item_54', list(p
))
7674 # { yyerror(@3, "error: Syntax error in task arguments.");
7676 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
7681 def p_statement_item_55(p
):
7682 '''statement_item : error ';' '''
7683 if(parse_debug
): print('statement_item_55', list(p
))
7684 # { yyerror(@2, "error: malformed statement");
7689 def p__embed0_statement_item(p
):
7690 '''_embed0_statement_item : '''
7691 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_SEQ);
7692 # FILE_NAME(tmp, @1);
7693 # current_block_stack.push(tmp);
7696 def p__embed1_statement_item(p
):
7697 '''_embed1_statement_item : '''
7699 # if (! gn_system_verilog()) {
7700 # yyerror("error: Variable declaration in unnamed block "
7701 # "requires SystemVerilog.");
7704 # /* If there are no declarations in the scope then just delete it. */
7705 # pform_pop_scope();
7706 # assert(! current_block_stack.empty());
7707 # PBlock*tmp = current_block_stack.top();
7708 # current_block_stack.pop();
7713 def p__embed2_statement_item(p
):
7714 '''_embed2_statement_item : '''
7715 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_SEQ);
7716 # FILE_NAME(tmp, @1);
7717 # current_block_stack.push(tmp);
7720 def p__embed3_statement_item(p
):
7721 '''_embed3_statement_item : '''
7722 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
7723 # FILE_NAME(tmp, @1);
7724 # current_block_stack.push(tmp);
7727 def p__embed4_statement_item(p
):
7728 '''_embed4_statement_item : '''
7730 # if (! gn_system_verilog()) {
7731 # yyerror("error: Variable declaration in unnamed block "
7732 # "requires SystemVerilog.");
7735 # /* If there are no declarations in the scope then just delete it. */
7736 # pform_pop_scope();
7737 # assert(! current_block_stack.empty());
7738 # PBlock*tmp = current_block_stack.top();
7739 # current_block_stack.pop();
7744 def p__embed5_statement_item(p
):
7745 '''_embed5_statement_item : '''
7746 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_PAR);
7747 # FILE_NAME(tmp, @1);
7748 # current_block_stack.push(tmp);
7751 def p_compressed_statement_1(p
):
7752 '''compressed_statement : lpvalue K_PLUS_EQ expression '''
7753 if(parse_debug
): print('compressed_statement_1', list(p
))
7754 # { PAssign*tmp = new PAssign(p[1], '+', p[3]);
7755 # FILE_NAME(tmp, @1);
7759 def p_compressed_statement_2(p
):
7760 '''compressed_statement : lpvalue K_MINUS_EQ expression '''
7761 if(parse_debug
): print('compressed_statement_2', list(p
))
7762 # { PAssign*tmp = new PAssign(p[1], '-', p[3]);
7763 # FILE_NAME(tmp, @1);
7767 def p_compressed_statement_3(p
):
7768 '''compressed_statement : lpvalue K_MUL_EQ expression '''
7769 if(parse_debug
): print('compressed_statement_3', list(p
))
7770 # { PAssign*tmp = new PAssign(p[1], '*', p[3]);
7771 # FILE_NAME(tmp, @1);
7775 def p_compressed_statement_4(p
):
7776 '''compressed_statement : lpvalue K_DIV_EQ expression '''
7777 if(parse_debug
): print('compressed_statement_4', list(p
))
7778 # { PAssign*tmp = new PAssign(p[1], '/', p[3]);
7779 # FILE_NAME(tmp, @1);
7783 def p_compressed_statement_5(p
):
7784 '''compressed_statement : lpvalue K_MOD_EQ expression '''
7785 if(parse_debug
): print('compressed_statement_5', list(p
))
7786 # { PAssign*tmp = new PAssign(p[1], '%', p[3]);
7787 # FILE_NAME(tmp, @1);
7791 def p_compressed_statement_6(p
):
7792 '''compressed_statement : lpvalue K_AND_EQ expression '''
7793 if(parse_debug
): print('compressed_statement_6', list(p
))
7794 # { PAssign*tmp = new PAssign(p[1], '&', p[3]);
7795 # FILE_NAME(tmp, @1);
7799 def p_compressed_statement_7(p
):
7800 '''compressed_statement : lpvalue K_OR_EQ expression '''
7801 if(parse_debug
): print('compressed_statement_7', list(p
))
7802 # { PAssign*tmp = new PAssign(p[1], '|', p[3]);
7803 # FILE_NAME(tmp, @1);
7807 def p_compressed_statement_8(p
):
7808 '''compressed_statement : lpvalue K_XOR_EQ expression '''
7809 if(parse_debug
): print('compressed_statement_8', list(p
))
7810 # { PAssign*tmp = new PAssign(p[1], '^', p[3]);
7811 # FILE_NAME(tmp, @1);
7815 def p_compressed_statement_9(p
):
7816 '''compressed_statement : lpvalue K_LS_EQ expression '''
7817 if(parse_debug
): print('compressed_statement_9', list(p
))
7818 # { PAssign *tmp = new PAssign(p[1], 'l', p[3]);
7819 # FILE_NAME(tmp, @1);
7823 def p_compressed_statement_10(p
):
7824 '''compressed_statement : lpvalue K_RS_EQ expression '''
7825 if(parse_debug
): print('compressed_statement_10', list(p
))
7826 # { PAssign*tmp = new PAssign(p[1], 'r', p[3]);
7827 # FILE_NAME(tmp, @1);
7831 def p_compressed_statement_11(p
):
7832 '''compressed_statement : lpvalue K_RSS_EQ expression '''
7833 if(parse_debug
): print('compressed_statement_11', list(p
))
7834 # { PAssign *tmp = new PAssign(p[1], 'R', p[3]);
7835 # FILE_NAME(tmp, @1);
7839 def p_statement_or_null_list_opt_1(p
):
7840 '''statement_or_null_list_opt : statement_or_null_list '''
7841 if(parse_debug
): print('statement_or_null_list_opt_1', list(p
))
7844 def p_statement_or_null_list_opt_2(p
):
7845 '''statement_or_null_list_opt : '''
7846 if(parse_debug
): print('statement_or_null_list_opt_2', list(p
))
7849 def p_statement_or_null_list_1(p
):
7850 '''statement_or_null_list : statement_or_null_list statement_or_null '''
7851 if(parse_debug
): print('statement_or_null_list_1', list(p
))
7852 # { vector<Statement*>*tmp = p[1];
7853 # if (p[2]) tmp->push_back(p[2]);
7857 def p_statement_or_null_list_2(p
):
7858 '''statement_or_null_list : statement_or_null '''
7859 if(parse_debug
): print('statement_or_null_list_2', list(p
))
7860 # { vector<Statement*>*tmp = new vector<Statement*>(0);
7861 # if (p[1]) tmp->push_back(p[1]);
7865 def p_analog_statement_1(p
):
7866 '''analog_statement : branch_probe_expression K_CONTRIBUTE expression ';' '''
7867 if(parse_debug
): print('analog_statement_1', list(p
))
7868 # { p[0] = pform_contribution_statement(@2, p[1], p[3]); }
7870 def p_task_item_1(p
):
7871 '''task_item : block_item_decl '''
7872 if(parse_debug
): print('task_item_1', list(p
))
7873 # { p[0] = new vector<pform_tf_port_t>(0); }
7875 def p_task_item_2(p
):
7876 '''task_item : tf_port_declaration '''
7877 if(parse_debug
): print('task_item_2', list(p
))
7880 def p_task_item_list_1(p
):
7881 '''task_item_list : task_item_list task_item '''
7882 if(parse_debug
): print('task_item_list_1', list(p
))
7883 # { vector<pform_tf_port_t>*tmp = p[1];
7884 # size_t s1 = tmp->size();
7885 # tmp->resize(s1 + p[2]->size());
7886 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
7887 # tmp->at(s1 + idx) = p[2]->at(idx);
7892 def p_task_item_list_2(p
):
7893 '''task_item_list : task_item '''
7894 if(parse_debug
): print('task_item_list_2', list(p
))
7897 def p_task_item_list_opt_1(p
):
7898 '''task_item_list_opt : task_item_list '''
7899 if(parse_debug
): print('task_item_list_opt_1', list(p
))
7902 def p_task_item_list_opt_2(p
):
7903 '''task_item_list_opt : '''
7904 if(parse_debug
): print('task_item_list_opt_2', list(p
))
7907 def p_tf_port_list_opt_1(p
):
7908 '''tf_port_list_opt : tf_port_list '''
7909 if(parse_debug
): print('tf_port_list_opt_1', list(p
))
7912 def p_tf_port_list_opt_2(p
):
7913 '''tf_port_list_opt : '''
7914 if(parse_debug
): print('tf_port_list_opt_2', list(p
))
7917 def p_udp_body_1(p
):
7918 '''udp_body : K_table udp_entry_list K_endtable '''
7919 if(parse_debug
): print('udp_body_1', list(p
))
7920 # { lex_end_table();
7924 def p_udp_body_2(p
):
7925 '''udp_body : K_table K_endtable '''
7926 if(parse_debug
): print('udp_body_2', list(p
))
7927 # { lex_end_table();
7928 # yyerror(@1, "error: Empty UDP table.");
7932 def p_udp_body_3(p
):
7933 '''udp_body : K_table error K_endtable '''
7934 if(parse_debug
): print('udp_body_3', list(p
))
7935 # { lex_end_table();
7936 # yyerror(@2, "Errors in UDP table");
7941 def p_udp_entry_list_1(p
):
7942 '''udp_entry_list : udp_comb_entry_list '''
7943 if(parse_debug
): print('udp_entry_list_1', list(p
))
7945 def p_udp_entry_list_2(p
):
7946 '''udp_entry_list : udp_sequ_entry_list '''
7947 if(parse_debug
): print('udp_entry_list_2', list(p
))
7949 def p_udp_comb_entry_1(p
):
7950 '''udp_comb_entry : udp_input_list ':' udp_output_sym ';' '''
7951 if(parse_debug
): print('udp_comb_entry_1', list(p
))
7952 # { char*tmp = new char[strlen(p[1])+3];
7953 # strcpy(tmp, p[1]);
7954 # char*tp = tmp+strlen(tmp);
7962 def p_udp_comb_entry_list_1(p
):
7963 '''udp_comb_entry_list : udp_comb_entry '''
7964 if(parse_debug
): print('udp_comb_entry_list_1', list(p
))
7965 # { list<string>*tmp = new list<string>;
7966 # tmp->push_back(p[1]);
7971 def p_udp_comb_entry_list_2(p
):
7972 '''udp_comb_entry_list : udp_comb_entry_list udp_comb_entry '''
7973 if(parse_debug
): print('udp_comb_entry_list_2', list(p
))
7974 # { list<string>*tmp = p[1];
7975 # tmp->push_back(p[2]);
7980 def p_udp_sequ_entry_list_1(p
):
7981 '''udp_sequ_entry_list : udp_sequ_entry '''
7982 if(parse_debug
): print('udp_sequ_entry_list_1', list(p
))
7983 # { list<string>*tmp = new list<string>;
7984 # tmp->push_back(p[1]);
7989 def p_udp_sequ_entry_list_2(p
):
7990 '''udp_sequ_entry_list : udp_sequ_entry_list udp_sequ_entry '''
7991 if(parse_debug
): print('udp_sequ_entry_list_2', list(p
))
7992 # { list<string>*tmp = p[1];
7993 # tmp->push_back(p[2]);
7998 def p_udp_sequ_entry_1(p
):
7999 '''udp_sequ_entry : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' '''
8000 if(parse_debug
): print('udp_sequ_entry_1', list(p
))
8001 # { char*tmp = new char[strlen(p[1])+5];
8002 # strcpy(tmp, p[1]);
8003 # char*tp = tmp+strlen(tmp);
8012 def p_udp_initial_1(p
):
8013 '''udp_initial : K_initial IDENTIFIER '=' number ';' '''
8014 if(parse_debug
): print('udp_initial_1', list(p
))
8015 # { PExpr*etmp = new PENumber(p[4]);
8016 # PEIdent*itmp = new PEIdent(lex_strings.make(p[2]));
8017 # PAssign*atmp = new PAssign(itmp, etmp);
8018 # FILE_NAME(atmp, @2);
8023 def p_udp_init_opt_1(p
):
8024 '''udp_init_opt : udp_initial '''
8025 if(parse_debug
): print('udp_init_opt_1', list(p
))
8028 def p_udp_init_opt_2(p
):
8029 '''udp_init_opt : '''
8030 if(parse_debug
): print('udp_init_opt_2', list(p
))
8033 def p_udp_input_list_1(p
):
8034 '''udp_input_list : udp_input_sym '''
8035 if(parse_debug
): print('udp_input_list_1', list(p
))
8036 # { char*tmp = new char[2];
8042 def p_udp_input_list_2(p
):
8043 '''udp_input_list : udp_input_list udp_input_sym '''
8044 if(parse_debug
): print('udp_input_list_2', list(p
))
8045 # { char*tmp = new char[strlen(p[1])+2];
8046 # strcpy(tmp, p[1]);
8047 # char*tp = tmp+strlen(tmp);
8054 def p_udp_input_sym_1(p
):
8055 '''udp_input_sym : '0' '''
8056 if(parse_debug
): print('udp_input_sym_1', list(p
))
8059 def p_udp_input_sym_2(p
):
8060 '''udp_input_sym : '1' '''
8061 if(parse_debug
): print('udp_input_sym_2', list(p
))
8064 def p_udp_input_sym_3(p
):
8065 '''udp_input_sym : 'x' '''
8066 if(parse_debug
): print('udp_input_sym_3', list(p
))
8069 def p_udp_input_sym_4(p
):
8070 '''udp_input_sym : '?' '''
8071 if(parse_debug
): print('udp_input_sym_4', list(p
))
8074 def p_udp_input_sym_5(p
):
8075 '''udp_input_sym : 'b' '''
8076 if(parse_debug
): print('udp_input_sym_5', list(p
))
8079 def p_udp_input_sym_6(p
):
8080 '''udp_input_sym : '*' '''
8081 if(parse_debug
): print('udp_input_sym_6', list(p
))
8084 def p_udp_input_sym_7(p
):
8085 '''udp_input_sym : '%' '''
8086 if(parse_debug
): print('udp_input_sym_7', list(p
))
8089 def p_udp_input_sym_8(p
):
8090 '''udp_input_sym : 'f' '''
8091 if(parse_debug
): print('udp_input_sym_8', list(p
))
8094 def p_udp_input_sym_9(p
):
8095 '''udp_input_sym : 'F' '''
8096 if(parse_debug
): print('udp_input_sym_9', list(p
))
8099 def p_udp_input_sym_10(p
):
8100 '''udp_input_sym : 'l' '''
8101 if(parse_debug
): print('udp_input_sym_10', list(p
))
8104 def p_udp_input_sym_11(p
):
8105 '''udp_input_sym : 'h' '''
8106 if(parse_debug
): print('udp_input_sym_11', list(p
))
8109 def p_udp_input_sym_12(p
):
8110 '''udp_input_sym : 'B' '''
8111 if(parse_debug
): print('udp_input_sym_12', list(p
))
8114 def p_udp_input_sym_13(p
):
8115 '''udp_input_sym : 'r' '''
8116 if(parse_debug
): print('udp_input_sym_13', list(p
))
8119 def p_udp_input_sym_14(p
):
8120 '''udp_input_sym : 'R' '''
8121 if(parse_debug
): print('udp_input_sym_14', list(p
))
8124 def p_udp_input_sym_15(p
):
8125 '''udp_input_sym : 'M' '''
8126 if(parse_debug
): print('udp_input_sym_15', list(p
))
8129 def p_udp_input_sym_16(p
):
8130 '''udp_input_sym : 'n' '''
8131 if(parse_debug
): print('udp_input_sym_16', list(p
))
8134 def p_udp_input_sym_17(p
):
8135 '''udp_input_sym : 'N' '''
8136 if(parse_debug
): print('udp_input_sym_17', list(p
))
8139 def p_udp_input_sym_18(p
):
8140 '''udp_input_sym : 'p' '''
8141 if(parse_debug
): print('udp_input_sym_18', list(p
))
8144 def p_udp_input_sym_19(p
):
8145 '''udp_input_sym : 'P' '''
8146 if(parse_debug
): print('udp_input_sym_19', list(p
))
8149 def p_udp_input_sym_20(p
):
8150 '''udp_input_sym : 'Q' '''
8151 if(parse_debug
): print('udp_input_sym_20', list(p
))
8154 def p_udp_input_sym_21(p
):
8155 '''udp_input_sym : 'q' '''
8156 if(parse_debug
): print('udp_input_sym_21', list(p
))
8159 def p_udp_input_sym_22(p
):
8160 '''udp_input_sym : '_' '''
8161 if(parse_debug
): print('udp_input_sym_22', list(p
))
8164 def p_udp_input_sym_23(p
):
8165 '''udp_input_sym : '+' '''
8166 if(parse_debug
): print('udp_input_sym_23', list(p
))
8169 def p_udp_input_sym_24(p
):
8170 '''udp_input_sym : DEC_NUMBER '''
8171 if(parse_debug
): print('udp_input_sym_24', list(p
))
8172 # { yyerror(@1, "internal error: Input digits parse as decimal number!"); p[0] = '0'; }
8174 def p_udp_output_sym_1(p
):
8175 '''udp_output_sym : '0' '''
8176 if(parse_debug
): print('udp_output_sym_1', list(p
))
8179 def p_udp_output_sym_2(p
):
8180 '''udp_output_sym : '1' '''
8181 if(parse_debug
): print('udp_output_sym_2', list(p
))
8184 def p_udp_output_sym_3(p
):
8185 '''udp_output_sym : 'x' '''
8186 if(parse_debug
): print('udp_output_sym_3', list(p
))
8189 def p_udp_output_sym_4(p
):
8190 '''udp_output_sym : '-' '''
8191 if(parse_debug
): print('udp_output_sym_4', list(p
))
8194 def p_udp_output_sym_5(p
):
8195 '''udp_output_sym : DEC_NUMBER '''
8196 if(parse_debug
): print('udp_output_sym_5', list(p
))
8197 # { yyerror(@1, "internal error: Output digits parse as decimal number!"); p[0] = '0'; }
8199 def p_udp_port_decl_1(p
):
8200 '''udp_port_decl : K_input list_of_identifiers ';' '''
8201 if(parse_debug
): print('udp_port_decl_1', list(p
))
8202 # { p[0] = pform_make_udp_input_ports(p[2]); }
8204 def p_udp_port_decl_2(p
):
8205 '''udp_port_decl : K_output IDENTIFIER ';' '''
8206 if(parse_debug
): print('udp_port_decl_2', list(p
))
8207 # { perm_string pname = lex_strings.make(p[2]);
8208 # PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
8209 # vector<PWire*>*tmp = new vector<PWire*>(1);
8215 def p_udp_port_decl_3(p
):
8216 '''udp_port_decl : K_reg IDENTIFIER ';' '''
8217 if(parse_debug
): print('udp_port_decl_3', list(p
))
8218 # { perm_string pname = lex_strings.make(p[2]);
8219 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
8220 # vector<PWire*>*tmp = new vector<PWire*>(1);
8226 def p_udp_port_decl_4(p
):
8227 '''udp_port_decl : K_reg K_output IDENTIFIER ';' '''
8228 if(parse_debug
): print('udp_port_decl_4', list(p
))
8229 # { perm_string pname = lex_strings.make(p[3]);
8230 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
8231 # vector<PWire*>*tmp = new vector<PWire*>(1);
8237 def p_udp_port_decls_1(p
):
8238 '''udp_port_decls : udp_port_decl '''
8239 if(parse_debug
): print('udp_port_decls_1', list(p
))
8242 def p_udp_port_decls_2(p
):
8243 '''udp_port_decls : udp_port_decls udp_port_decl '''
8244 if(parse_debug
): print('udp_port_decls_2', list(p
))
8245 # { vector<PWire*>*tmp = p[1];
8246 # size_t s1 = p[1]->size();
8247 # tmp->resize(s1+p[2]->size());
8248 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
8249 # tmp->at(s1+idx) = p[2]->at(idx);
8254 def p_udp_port_list_1(p
):
8255 '''udp_port_list : IDENTIFIER '''
8256 if(parse_debug
): print('udp_port_list_1', list(p
))
8257 # { list<perm_string>*tmp = new list<perm_string>;
8258 # tmp->push_back(lex_strings.make(p[1]));
8263 def p_udp_port_list_2(p
):
8264 '''udp_port_list : udp_port_list ',' IDENTIFIER '''
8265 if(parse_debug
): print('udp_port_list_2', list(p
))
8266 # { list<perm_string>*tmp = p[1];
8267 # tmp->push_back(lex_strings.make(p[3]));
8272 def p_udp_reg_opt_1(p
):
8273 '''udp_reg_opt : K_reg '''
8274 if(parse_debug
): print('udp_reg_opt_1', list(p
))
8277 def p_udp_reg_opt_2(p
):
8278 '''udp_reg_opt : '''
8279 if(parse_debug
): print('udp_reg_opt_2', list(p
))
8282 def p_udp_initial_expr_opt_1(p
):
8283 '''udp_initial_expr_opt : '=' expression '''
8284 if(parse_debug
): print('udp_initial_expr_opt_1', list(p
))
8287 def p_udp_initial_expr_opt_2(p
):
8288 '''udp_initial_expr_opt : '''
8289 if(parse_debug
): print('udp_initial_expr_opt_2', list(p
))
8292 def p_udp_input_declaration_list_1(p
):
8293 '''udp_input_declaration_list : K_input IDENTIFIER '''
8294 if(parse_debug
): print('udp_input_declaration_list_1', list(p
))
8295 # { list<perm_string>*tmp = new list<perm_string>;
8296 # tmp->push_back(lex_strings.make(p[2]));
8301 def p_udp_input_declaration_list_2(p
):
8302 '''udp_input_declaration_list : udp_input_declaration_list ',' K_input IDENTIFIER '''
8303 if(parse_debug
): print('udp_input_declaration_list_2', list(p
))
8304 # { list<perm_string>*tmp = p[1];
8305 # tmp->push_back(lex_strings.make(p[4]));
8310 def p_udp_primitive_1(p
):
8311 '''udp_primitive : K_primitive IDENTIFIER '(' udp_port_list ')' ';' udp_port_decls udp_init_opt udp_body K_endprimitive endlabel_opt '''
8312 if(parse_debug
): print('udp_primitive_1', list(p
))
8313 # { perm_string tmp2 = lex_strings.make(p[2]);
8314 # pform_make_udp(tmp2, p[4], p[7], p[9], p[8],
8315 # @2.text, @2.first_line);
8317 # if (strcmp(p[2],p[11]) != 0) {
8318 # yyerror(@11, "error: End label doesn't match "
8319 # "primitive name");
8321 # if (! gn_system_verilog()) {
8322 # yyerror(@11, "error: Primitive end labels "
8323 # "require SystemVerilog.");
8330 def p_udp_primitive_2(p
):
8331 '''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 '''
8332 if(parse_debug
): print('udp_primitive_2', list(p
))
8333 # { perm_string tmp2 = lex_strings.make(p[2]);
8334 # perm_string tmp6 = lex_strings.make(p[6]);
8335 # pform_make_udp(tmp2, p[5], tmp6, p[7], p[9], p[12],
8336 # @2.text, @2.first_line);
8338 # if (strcmp(p[2],p[14]) != 0) {
8339 # yyerror(@14, "error: End label doesn't match "
8340 # "primitive name");
8342 # if (! gn_system_verilog()) {
8343 # yyerror(@14, "error: Primitive end labels "
8344 # "require SystemVerilog.");
8352 def p_K_packed_opt_1(p
):
8353 '''K_packed_opt : K_packed '''
8354 if(parse_debug
): print('K_packed_opt', list(p
))
8357 def p_K_packed_opt_2(p
):
8358 '''K_packed_opt : '''
8359 if(parse_debug
): print('K_packed_opt', list(p
))
8362 def p_K_reg_opt_1(p
):
8363 '''K_reg_opt : K_reg '''
8364 if(parse_debug
): print('K_reg_opt', list(p
))
8367 def p_K_reg_opt_2(p
):
8369 if(parse_debug
): print('K_reg_opt', list(p
))
8372 def p_K_static_opt_1(p
):
8373 '''K_static_opt : K_static '''
8374 if(parse_debug
): print('K_static_opt', list(p
))
8377 def p_K_static_opt_2(p
):
8378 '''K_static_opt : '''
8379 if(parse_debug
): print('K_static_opt', list(p
))
8383 def p_K_virtual_opt_1(p
):
8384 '''K_virtual_opt : K_virtual '''
8385 if(parse_debug
): print(p
)
8388 def p_K_virtual_opt_2(p
):
8389 '''K_virtual_opt : '''
8390 if(parse_debug
): print(p
)
8395 if(parse_debug
): print ("error", p
)