wire assignments
[sv2nmigen.git] / parse_sv.py
1 # %{
2 # /*
3 # * Copyright (c) 1998-2017 Stephen Williams (steve@icarus.com)
4 # * Copyright CERN 2012-2013 / Stephen Williams (steve@icarus.com)
5 # *
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.
11 # *
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.
16 # *
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.
20 # */
21
22 import lexor
23 from ply import yacc, lex
24 from lib2to3.pytree import Node, Leaf
25 from lib2to3.pgen2 import token
26 from lib2to3.pygram import python_symbols as syms
27
28 yacc1_debug = 0
29 yacc2_debug = 0
30 parse_debug = 1
31
32
33 #from parse_tokens import tokens
34 tokens = lexor.tokens # list(set(lexor.tokens).union(set(tokens)))
35 literals = lexor.literals
36
37 precedence = [
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'),
42 ('left', 'K_LOR'),
43 ('left', 'K_LAND'),
44 ('left', '|'),
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'),
50 ('left', '+', '-'),
51 ('left', '*', '/', '%'),
52 ('left', 'K_POW'),
53 ('left', 'UNARY_PREC'),
54 ('nonassoc', 'less_than_K_else'),
55 ('nonassoc', 'K_else'),
56 ('nonassoc', '('),
57 ('nonassoc', 'K_exclude'),
58 ('nonassoc', 'no_timeunits_declaration'),
59 ('nonassoc', 'one_timeunits_declaration'),
60 ('nonassoc', 'K_timeunit', 'K_timeprecision')
61 ]
62
63
64 IVL_VT_NO_TYPE = 'VT_NO_TYPE'
65 IVL_VT_BOOL = 'VT_BOOL'
66 IVL_VT_LOGIC = 'VT_LOGIC'
67 """
68 IVL_VT_VOID = 0, /* Not used */
69 IVL_VT_NO_TYPE = 1, /* Place holder for missing/unknown type. */
70 IVL_VT_REAL = 2,
71 IVL_VT_BOOL = 3,
72 IVL_VT_LOGIC = 4,
73 IVL_VT_STRING = 5,
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 */
78 """
79
80 NN_NONE = 'NONE'
81 NN_IMPLICIT = 'IMPLICIT'
82 NN_IMPLICIT_REG = 'IMPLICIT_REG'
83 NN_INTEGER = 'INTEGER'
84 NN_WIRE = 'WIRE'
85 NN_TRI = 'TRI'
86 NN_TRI1 = 'TRI1'
87 NN_SUPPLY0 = 'SUPPLY0'
88 NN_SUPPLY1 = 'SUPPLY1'
89 NN_WAND = 'WAND'
90 NN_TRIAND = 'TRIAND'
91 NN_TRI0 = 'TRI0'
92 NN_WOR = 'WOR'
93 NN_TRIOR = 'TRIOR'
94 NN_REG = 'REG'
95 NN_UNRESOLVED_WIRE = 'UNRESOLVED_WIRE'
96
97 NP_NOT_A_PORT = 'NOT_A_PORT'
98 NP_PIMPLICIT = 'PIMPLICIT'
99 NP_PINPUT = 'PINPUT'
100 NP_POUTPUT = 'POUTPUT'
101 NP_PINOUT = 'PINOUT'
102 NP_PREF = 'PREF'
103
104
105 class DataType:
106 def __init__(self, typ, signed):
107 self.typ = typ
108 self.signed = signed
109
110
111 # -------------- RULES ----------------
112 ()
113
114
115 def p_source_text_1(p):
116 '''source_text : timeunits_declaration_opt _embed0_source_text description_list '''
117 if(parse_debug > 2):
118 print('source_text', list(p))
119
120
121 ()
122
123
124 def p_source_text_2(p):
125 '''source_text : '''
126 if(parse_debug):
127 print('source_text', list(p))
128
129
130 ()
131
132
133 def p__embed0_source_text(p):
134 '''_embed0_source_text : '''
135
136 # { pform_set_scope_timescale(yyloc); }
137 ()
138
139
140 def p_assertion_item_1(p):
141 '''assertion_item : concurrent_assertion_item '''
142 if(parse_debug):
143 print('assertion_item_1', list(p))
144
145
146 ()
147
148
149 def p_assignment_pattern_1(p):
150 '''assignment_pattern : K_LP expression_list_proper '}' '''
151 if(parse_debug):
152 print('assignment_pattern_1', list(p))
153
154 # { PEAssignPattern*tmp = new PEAssignPattern(*p[2]);
155 # FILE_NAME(tmp, @1);
156 # delete p[2];
157 # p[0] = tmp;
158 # }
159 ()
160
161
162 def p_assignment_pattern_2(p):
163 '''assignment_pattern : K_LP '}' '''
164 if(parse_debug):
165 print('assignment_pattern_2', list(p))
166
167 # { PEAssignPattern*tmp = new PEAssignPattern;
168 # FILE_NAME(tmp, @1);
169 # p[0] = tmp;
170 # }
171 ()
172
173
174 def p_block_identifier_opt_1(p):
175 '''block_identifier_opt : IDENTIFIER ':' '''
176 if(parse_debug):
177 print('block_identifier_opt_1', list(p))
178
179
180 ()
181
182
183 def p_block_identifier_opt_2(p):
184 '''block_identifier_opt : '''
185 if(parse_debug):
186 print('block_identifier_opt_2', list(p))
187
188
189 ()
190
191
192 def p_class_declaration_1(p):
193 '''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 '''
194 if(parse_debug):
195 print('class_declaration_1', list(p))
196
197 # { // Wrap up the class.
198 # if (p[11] && p[4] && p[4]->name != p[11]) {
199 # yyerror(@11, "error: Class end label doesn't match class name.");
200 # delete[]p[11];
201 # }
202 # }
203 ()
204
205
206 def p__embed0_class_declaration(p):
207 '''_embed0_class_declaration : '''
208
209 # { pform_start_class_declaration(@2, p[4], p[5].type, p[5].exprs, p[3]); }
210 ()
211
212
213 def p__embed1_class_declaration(p):
214 '''_embed1_class_declaration : '''
215
216 # { // Process a class.
217 # pform_end_class_declaration(@9);
218 # }
219 ()
220
221
222 def p_class_constraint_1(p):
223 '''class_constraint : constraint_prototype '''
224 if(parse_debug):
225 print('class_constraint_1', list(p))
226
227
228 ()
229
230
231 def p_class_constraint_2(p):
232 '''class_constraint : constraint_declaration '''
233 if(parse_debug):
234 print('class_constraint_2', list(p))
235
236
237 ()
238
239
240 def p_class_identifier_1(p):
241 '''class_identifier : IDENTIFIER '''
242 if(parse_debug):
243 print('class_identifier_1', list(p))
244
245 # { // Create a synthetic typedef for the class name so that the
246 # // lexor detects the name as a type.
247 # perm_string name = lex_strings.make(p[1]);
248 # class_type_t*tmp = new class_type_t(name);
249 # FILE_NAME(tmp, @1);
250 # pform_set_typedef(name, tmp, NULL);
251 # delete[]p[1];
252 # p[0] = tmp;
253 # }
254 ()
255
256
257 def p_class_identifier_2(p):
258 '''class_identifier : TYPE_IDENTIFIER '''
259 if(parse_debug):
260 print('class_identifier_2', list(p))
261
262 # { class_type_t*tmp = dynamic_cast<class_type_t*>(p[1].type);
263 # if (tmp == 0) {
264 # yyerror(@1, "Type name \"%s\"is not a predeclared class name.", p[1].text);
265 # }
266 # delete[]p[1].text;
267 # p[0] = tmp;
268 # }
269 ()
270
271
272 def p_class_declaration_endlabel_opt_1(p):
273 '''class_declaration_endlabel_opt : ':' TYPE_IDENTIFIER '''
274 if(parse_debug):
275 print('class_declaration_endlabel_opt_1', list(p))
276
277 # { class_type_t*tmp = dynamic_cast<class_type_t*> (p[2].type);
278 # if (tmp == 0) {
279 # yyerror(@2, "error: class declaration endlabel \"%s\" is not a class name\n", p[2].text);
280 # p[0] = None
281 # } else {
282 # p[0] = strdupnew(tmp->name.str());
283 # }
284 # delete[]p[2].text;
285 # }
286 ()
287
288
289 def p_class_declaration_endlabel_opt_2(p):
290 '''class_declaration_endlabel_opt : ':' IDENTIFIER '''
291 if(parse_debug):
292 print('class_declaration_endlabel_opt_2', list(p))
293 p[0] = p[2]
294
295
296 ()
297
298
299 def p_class_declaration_endlabel_opt_3(p):
300 '''class_declaration_endlabel_opt : '''
301 if(parse_debug):
302 print('class_declaration_endlabel_opt_3', list(p))
303
304 # { p[0] = None }
305 ()
306
307
308 def p_class_declaration_extends_opt_1(p):
309 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '''
310 if(parse_debug):
311 print('class_declaration_extends_opt_1', list(p))
312
313 # { p[0].type = p[2].type;
314 # p[0].exprs= 0;
315 # delete[]p[2].text;
316 # }
317 ()
318
319
320 def p_class_declaration_extends_opt_2(p):
321 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '(' expression_list_with_nuls ')' '''
322 if(parse_debug):
323 print('class_declaration_extends_opt_2', list(p))
324
325 # { p[0].type = p[2].type;
326 # p[0].exprs = p[4];
327 # delete[]p[2].text;
328 # }
329 ()
330
331
332 def p_class_declaration_extends_opt_3(p):
333 '''class_declaration_extends_opt : '''
334 if(parse_debug):
335 print('class_declaration_extends_opt_3', list(p))
336
337 # { p[0].type = 0; p[0].exprs = 0; }
338 ()
339
340
341 def p_class_items_opt_1(p):
342 '''class_items_opt : class_items '''
343 if(parse_debug):
344 print('class_items_opt_1', list(p))
345
346
347 ()
348
349
350 def p_class_items_opt_2(p):
351 '''class_items_opt : '''
352 if(parse_debug):
353 print('class_items_opt_2', list(p))
354
355
356 ()
357
358
359 def p_class_items_1(p):
360 '''class_items : class_items class_item '''
361 if(parse_debug):
362 print('class_items_1', list(p))
363
364
365 ()
366
367
368 def p_class_items_2(p):
369 '''class_items : class_item '''
370 if(parse_debug):
371 print('class_items_2', list(p))
372
373
374 ()
375
376
377 def p_class_item_1(p):
378 '''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 '''
379 if(parse_debug):
380 print('class_item_1', list(p))
381
382 # { current_function->set_ports(p[6]);
383 # pform_set_constructor_return(current_function);
384 # pform_set_this_class(@3, current_function);
385 # current_function_set_statement(@3, p[10]);
386 # pform_pop_scope();
387 # current_function = 0;
388 # }
389 ()
390
391
392 def p_class_item_2(p):
393 '''class_item : property_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
394 if(parse_debug):
395 print('class_item_2', list(p))
396
397 # { pform_class_property(@2, p[1], p[2], p[3]); }
398 ()
399
400
401 def p_class_item_3(p):
402 '''class_item : K_const class_item_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
403 if(parse_debug):
404 print('class_item_3', list(p))
405
406 # { pform_class_property(@1, p[2] | property_qualifier_t::make_const(), p[3], p[4]); }
407 ()
408
409
410 def p_class_item_4(p):
411 '''class_item : method_qualifier_opt task_declaration '''
412 if(parse_debug):
413 print('class_item_4', list(p))
414
415 # { /* The task_declaration rule puts this into the class */ }
416 ()
417
418
419 def p_class_item_5(p):
420 '''class_item : method_qualifier_opt function_declaration '''
421 if(parse_debug):
422 print('class_item_5', list(p))
423
424 # { /* The function_declaration rule puts this into the class */ }
425 ()
426
427
428 def p_class_item_6(p):
429 '''class_item : K_extern method_qualifier_opt K_function K_new ';' '''
430 if(parse_debug):
431 print('class_item_6', list(p))
432
433 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
434 ()
435
436
437 def p_class_item_7(p):
438 '''class_item : K_extern method_qualifier_opt K_function K_new '(' tf_port_list_opt ')' ';' '''
439 if(parse_debug):
440 print('class_item_7', list(p))
441
442 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
443 ()
444
445
446 def p_class_item_8(p):
447 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER ';' '''
448 if(parse_debug):
449 print('class_item_8', list(p))
450
451 # { yyerror(@1, "sorry: External methods are not yet supported.");
452 # delete[] p[5];
453 # }
454 ()
455
456
457 def p_class_item_9(p):
458 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' ';' '''
459 if(parse_debug):
460 print('class_item_9', list(p))
461
462 # { yyerror(@1, "sorry: External methods are not yet supported.");
463 # delete[] p[5];
464 # }
465 ()
466
467
468 def p_class_item_10(p):
469 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER ';' '''
470 if(parse_debug):
471 print('class_item_10', list(p))
472
473 # { yyerror(@1, "sorry: External methods are not yet supported.");
474 # delete[] p[4];
475 # }
476 ()
477
478
479 def p_class_item_11(p):
480 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER '(' tf_port_list_opt ')' ';' '''
481 if(parse_debug):
482 print('class_item_11', list(p))
483
484 # { yyerror(@1, "sorry: External methods are not yet supported.");
485 # delete[] p[4];
486 # }
487 ()
488
489
490 def p_class_item_12(p):
491 '''class_item : class_constraint '''
492 if(parse_debug):
493 print('class_item_12', list(p))
494
495
496 ()
497
498
499 def p_class_item_13(p):
500 '''class_item : property_qualifier_opt data_type error ';' '''
501 if(parse_debug):
502 print('class_item_13', list(p))
503
504 # { yyerror(@3, "error: Errors in variable names after data type.");
505 # yyerrok;
506 # }
507 ()
508
509
510 def p_class_item_14(p):
511 '''class_item : property_qualifier_opt IDENTIFIER error ';' '''
512 if(parse_debug):
513 print('class_item_14', list(p))
514
515 # { yyerror(@3, "error: %s doesn't name a type.", p[2]);
516 # yyerrok;
517 # }
518 ()
519
520
521 def p_class_item_15(p):
522 '''class_item : method_qualifier_opt K_function K_new error K_endfunction endnew_opt '''
523 if(parse_debug):
524 print('class_item_15', list(p))
525
526 # { yyerror(@1, "error: I give up on this class constructor declaration.");
527 # yyerrok;
528 # }
529 ()
530
531
532 def p_class_item_16(p):
533 '''class_item : error ';' '''
534 if(parse_debug):
535 print('class_item_16', list(p))
536
537 # { yyerror(@2, "error: invalid class item.");
538 # yyerrok;
539 # }
540 ()
541
542
543 def p__embed0_class_item(p):
544 '''_embed0_class_item : '''
545
546 # { assert(current_function==0);
547 # current_function = pform_push_constructor_scope(@3);
548 # }
549 ()
550
551
552 def p_class_item_qualifier_1(p):
553 '''class_item_qualifier : K_static '''
554 if(parse_debug):
555 print('class_item_qualifier_1', list(p))
556
557 # { p[0] = property_qualifier_t::make_static(); }
558 ()
559
560
561 def p_class_item_qualifier_2(p):
562 '''class_item_qualifier : K_protected '''
563 if(parse_debug):
564 print('class_item_qualifier_2', list(p))
565
566 # { p[0] = property_qualifier_t::make_protected(); }
567 ()
568
569
570 def p_class_item_qualifier_3(p):
571 '''class_item_qualifier : K_local '''
572 if(parse_debug):
573 print('class_item_qualifier_3', list(p))
574
575 # { p[0] = property_qualifier_t::make_local(); }
576 ()
577
578
579 def p_class_item_qualifier_list_1(p):
580 '''class_item_qualifier_list : class_item_qualifier_list class_item_qualifier '''
581 if(parse_debug):
582 print('class_item_qualifier_list_1', list(p))
583
584 # { p[0] = p[1] | p[2]; }
585 ()
586
587
588 def p_class_item_qualifier_list_2(p):
589 '''class_item_qualifier_list : class_item_qualifier '''
590 if(parse_debug):
591 print('class_item_qualifier_list_2', list(p))
592 p[0] = p[1]
593
594
595 ()
596
597
598 def p_class_item_qualifier_opt_1(p):
599 '''class_item_qualifier_opt : class_item_qualifier_list '''
600 if(parse_debug):
601 print('class_item_qualifier_opt_1', list(p))
602 p[0] = p[1]
603
604
605 ()
606
607
608 def p_class_item_qualifier_opt_2(p):
609 '''class_item_qualifier_opt : '''
610 if(parse_debug):
611 print('class_item_qualifier_opt_2', list(p))
612
613 # { p[0] = property_qualifier_t::make_none(); }
614 ()
615
616
617 def p_class_new_1(p):
618 '''class_new : K_new '(' expression_list_with_nuls ')' '''
619 if(parse_debug):
620 print('class_new_1', list(p))
621
622 # { list<PExpr*>*expr_list = p[3];
623 # strip_tail_items(expr_list);
624 # PENewClass*tmp = new PENewClass(*expr_list);
625 # FILE_NAME(tmp, @1);
626 # delete p[3];
627 # p[0] = tmp;
628 # }
629 ()
630
631
632 def p_class_new_2(p):
633 '''class_new : K_new hierarchy_identifier '''
634 if(parse_debug):
635 print('class_new_2', list(p))
636
637 # { PEIdent*tmpi = new PEIdent(*p[2]);
638 # FILE_NAME(tmpi, @2);
639 # PENewCopy*tmp = new PENewCopy(tmpi);
640 # FILE_NAME(tmp, @1);
641 # delete p[2];
642 # p[0] = tmp;
643 # }
644 ()
645
646
647 def p_class_new_3(p):
648 '''class_new : K_new '''
649 if(parse_debug):
650 print('class_new_3', list(p))
651
652 # { PENewClass*tmp = new PENewClass;
653 # FILE_NAME(tmp, @1);
654 # p[0] = tmp;
655 # }
656 ()
657
658
659 def p_concurrent_assertion_item_1(p):
660 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' property_spec ')' statement_or_null '''
661 if(parse_debug):
662 print('concurrent_assertion_item_1', list(p))
663
664 # { /* */
665 # if (gn_assertions_flag) {
666 # yyerror(@2, "sorry: concurrent_assertion_item not supported."
667 # " Try -gno-assertion to turn this message off.");
668 # }
669 # }
670 ()
671
672
673 def p_concurrent_assertion_item_2(p):
674 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' error ')' statement_or_null '''
675 if(parse_debug):
676 print('concurrent_assertion_item_2', list(p))
677
678 # { yyerrok;
679 # yyerror(@2, "error: Error in property_spec of concurrent assertion item.");
680 # }
681 ()
682
683
684 def p_constraint_block_item_1(p):
685 '''constraint_block_item : constraint_expression '''
686 if(parse_debug):
687 print('constraint_block_item_1', list(p))
688
689
690 ()
691
692
693 def p_constraint_block_item_list_1(p):
694 '''constraint_block_item_list : constraint_block_item_list constraint_block_item '''
695 if(parse_debug):
696 print('constraint_block_item_list_1', list(p))
697
698
699 ()
700
701
702 def p_constraint_block_item_list_2(p):
703 '''constraint_block_item_list : constraint_block_item '''
704 if(parse_debug):
705 print('constraint_block_item_list_2', list(p))
706
707
708 ()
709
710
711 def p_constraint_block_item_list_opt_1(p):
712 '''constraint_block_item_list_opt : '''
713 if(parse_debug):
714 print('constraint_block_item_list_opt_1', list(p))
715
716
717 ()
718
719
720 def p_constraint_block_item_list_opt_2(p):
721 '''constraint_block_item_list_opt : constraint_block_item_list '''
722 if(parse_debug):
723 print('constraint_block_item_list_opt_2', list(p))
724
725
726 ()
727
728
729 def p_constraint_declaration_1(p):
730 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' constraint_block_item_list_opt '}' '''
731 if(parse_debug):
732 print('constraint_declaration_1', list(p))
733
734 # { yyerror(@2, "sorry: Constraint declarations not supported."); }
735 ()
736
737
738 def p_constraint_declaration_2(p):
739 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' error '}' '''
740 if(parse_debug):
741 print('constraint_declaration_2', list(p))
742
743 # { yyerror(@4, "error: Errors in the constraint block item list."); }
744 ()
745
746
747 def p_constraint_expression_1(p):
748 '''constraint_expression : expression ';' '''
749 if(parse_debug):
750 print('constraint_expression_1', list(p))
751
752
753 ()
754
755
756 def p_constraint_expression_2(p):
757 '''constraint_expression : expression K_dist '{' '}' ';' '''
758 if(parse_debug):
759 print('constraint_expression_2', list(p))
760
761
762 ()
763
764
765 def p_constraint_expression_3(p):
766 '''constraint_expression : expression K_TRIGGER constraint_set '''
767 if(parse_debug):
768 print('constraint_expression_3', list(p))
769
770
771 ()
772
773
774 def p_constraint_expression_4(p):
775 '''constraint_expression : K_if '(' expression ')' constraint_set %prec less_than_K_else '''
776 if(parse_debug):
777 print('constraint_expression_4', list(p))
778
779
780 ()
781
782
783 def p_constraint_expression_5(p):
784 '''constraint_expression : K_if '(' expression ')' constraint_set K_else constraint_set '''
785 if(parse_debug):
786 print('constraint_expression_5', list(p))
787
788
789 ()
790
791
792 def p_constraint_expression_6(p):
793 '''constraint_expression : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' constraint_set '''
794 if(parse_debug):
795 print('constraint_expression_6', list(p))
796
797
798 ()
799
800
801 def p_constraint_expression_list_1(p):
802 '''constraint_expression_list : constraint_expression_list constraint_expression '''
803 if(parse_debug):
804 print('constraint_expression_list_1', list(p))
805
806
807 ()
808
809
810 def p_constraint_expression_list_2(p):
811 '''constraint_expression_list : constraint_expression '''
812 if(parse_debug):
813 print('constraint_expression_list_2', list(p))
814
815
816 ()
817
818
819 def p_constraint_prototype_1(p):
820 '''constraint_prototype : K_static_opt K_constraint IDENTIFIER ';' '''
821 if(parse_debug):
822 print('constraint_prototype_1', list(p))
823
824 # { yyerror(@2, "sorry: Constraint prototypes not supported."); }
825 ()
826
827
828 def p_constraint_set_1(p):
829 '''constraint_set : constraint_expression '''
830 if(parse_debug):
831 print('constraint_set_1', list(p))
832
833
834 ()
835
836
837 def p_constraint_set_2(p):
838 '''constraint_set : '{' constraint_expression_list '}' '''
839 if(parse_debug):
840 print('constraint_set_2', list(p))
841
842
843 ()
844
845
846 def p_data_declaration_1(p):
847 '''data_declaration : attribute_list_opt data_type_or_implicit list_of_variable_decl_assignments ';' '''
848 if(parse_debug):
849 print('data_declaration_1', list(p))
850
851 # { data_type_t*data_type = p[2];
852 # if (data_type == 0) {
853 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
854 # FILE_NAME(data_type, @2);
855 # }
856 # pform_makewire(@2, 0, str_strength, p[3], NetNet::IMPLICIT_REG, data_type);
857 # }
858 ()
859
860
861 def p_data_type_1(p):
862 '''data_type : integer_vector_type unsigned_signed_opt dimensions_opt '''
863 if(parse_debug):
864 print('data_type_1', list(p))
865 use_vtype = p[1]
866 reg_flag = False
867 if (use_vtype == IVL_VT_NO_TYPE):
868 use_vtype = IVL_VT_LOGIC
869 reg_flag = True
870 dt = DataType(use_vtype, signed=p[2])
871 dt.dims = p[3]
872 dt.reg_flag = reg_flag
873 p[0] = dt
874
875 # { ivl_variable_type_t use_vtype = p[1];
876 # bool reg_flag = false;
877 # if (use_vtype == IVL_VT_NO_TYPE) {
878 # use_vtype = IVL_VT_LOGIC;
879 # reg_flag = true;
880 # }
881 # vector_type_t*tmp = new vector_type_t(use_vtype, p[2], p[3]);
882 # tmp->reg_flag = reg_flag;
883 # FILE_NAME(tmp, @1);
884 # p[0] = tmp;
885 # }
886 ()
887
888
889 def p_data_type_2(p):
890 '''data_type : non_integer_type '''
891 if(parse_debug):
892 print('data_type_2', list(p))
893 p[0] = p[1]
894
895 # { real_type_t*tmp = new real_type_t(p[1]);
896 # FILE_NAME(tmp, @1);
897 # p[0] = tmp;
898 # }
899 ()
900
901
902 def p_data_type_3(p):
903 '''data_type : struct_data_type '''
904 if(parse_debug):
905 print('data_type_3', list(p))
906 p[0] = p[1]
907
908 # { if (!p[1]->packed_flag) {
909 # yyerror(@1, "sorry: Unpacked structs not supported.");
910 # }
911 # p[0] = p[1];
912 # }
913 ()
914
915
916 def p_data_type_4(p):
917 '''data_type : enum_data_type '''
918 if(parse_debug):
919 print('data_type_4', list(p))
920 p[0] = p[1]
921
922
923 ()
924
925
926 def p_data_type_5(p):
927 '''data_type : atom2_type signed_unsigned_opt '''
928 if(parse_debug):
929 print('data_type_5', list(p))
930
931 # { atom2_type_t*tmp = new atom2_type_t(p[1], p[2]);
932 # FILE_NAME(tmp, @1);
933 # p[0] = tmp;
934 # }
935 ()
936
937
938 def p_data_type_6(p):
939 '''data_type : K_integer signed_unsigned_opt '''
940 if(parse_debug):
941 print('data_type_6', list(p))
942
943 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
944 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, p[2], pd);
945 # tmp->reg_flag = true;
946 # tmp->integer_flag = true;
947 # p[0] = tmp;
948 # }
949 ()
950
951
952 def p_data_type_7(p):
953 '''data_type : K_time '''
954 if(parse_debug):
955 print('data_type_7', list(p))
956
957 # { list<pform_range_t>*pd = make_range_from_width(64);
958 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
959 # tmp->reg_flag = !gn_system_verilog();
960 # p[0] = tmp;
961 # }
962 ()
963
964
965 def p_data_type_8(p):
966 '''data_type : TYPE_IDENTIFIER dimensions_opt '''
967 if(parse_debug):
968 print('data_type_8', list(p))
969
970 # { if (p[2]) {
971 # parray_type_t*tmp = new parray_type_t(p[1].type, p[2]);
972 # FILE_NAME(tmp, @1);
973 # p[0] = tmp;
974 # } else p[0] = p[1].type;
975 # delete[]p[1].text;
976 # }
977 ()
978
979
980 def p_data_type_9(p):
981 '''data_type : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_data_type TYPE_IDENTIFIER '''
982 if(parse_debug):
983 print('data_type_9', list(p))
984
985 # { lex_in_package_scope(0);
986 # p[0] = p[4].type;
987 # delete[]p[4].text;
988 # }
989 ()
990
991
992 def p_data_type_10(p):
993 '''data_type : K_string '''
994 if(parse_debug):
995 print('data_type_10', list(p))
996
997 # { string_type_t*tmp = new string_type_t;
998 # FILE_NAME(tmp, @1);
999 # p[0] = tmp;
1000 # }
1001 ()
1002
1003
1004 def p__embed0_data_type(p):
1005 '''_embed0_data_type : '''
1006
1007 # { lex_in_package_scope(p[1]); }
1008 ()
1009
1010
1011 def p_data_type_or_implicit_1(p):
1012 '''data_type_or_implicit : data_type '''
1013 if(parse_debug):
1014 print('data_type_or_implicit_1', list(p))
1015 p[0] = p[1]
1016
1017
1018 ()
1019
1020
1021 def p_data_type_or_implicit_2(p):
1022 '''data_type_or_implicit : signing dimensions_opt '''
1023 if(parse_debug):
1024 print('data_type_or_implicit_2', list(p))
1025
1026 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, p[1], p[2]);
1027 # tmp->implicit_flag = true;
1028 # FILE_NAME(tmp, @1);
1029 # p[0] = tmp;
1030 # }
1031 ()
1032
1033
1034 def p_data_type_or_implicit_3(p):
1035 '''data_type_or_implicit : dimensions '''
1036 if(parse_debug):
1037 print('data_type_or_implicit_3', list(p))
1038 p[0] = list(p)
1039
1040 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, p[1]);
1041 # tmp->implicit_flag = true;
1042 # FILE_NAME(tmp, @1);
1043 # p[0] = tmp;
1044 # }
1045 ()
1046
1047
1048 def p_data_type_or_implicit_4(p):
1049 '''data_type_or_implicit : '''
1050 if(parse_debug > 2):
1051 print('data_type_or_implicit_4', list(p))
1052
1053 # { p[0] = None }
1054 ()
1055
1056
1057 def p_data_type_or_implicit_or_void_1(p):
1058 '''data_type_or_implicit_or_void : data_type_or_implicit '''
1059 if(parse_debug):
1060 print('data_type_or_implicit_or_void_1', list(p))
1061 p[0] = p[1]
1062
1063
1064 ()
1065
1066
1067 def p_data_type_or_implicit_or_void_2(p):
1068 '''data_type_or_implicit_or_void : K_void '''
1069 if(parse_debug):
1070 print('data_type_or_implicit_or_void_2', list(p))
1071
1072 # { void_type_t*tmp = new void_type_t;
1073 # FILE_NAME(tmp, @1);
1074 # p[0] = tmp;
1075 # }
1076 ()
1077
1078
1079 def p_description_1(p):
1080 '''description : module '''
1081 if(parse_debug > 2):
1082 print('description_1', list(p))
1083
1084
1085 ()
1086
1087
1088 def p_description_2(p):
1089 '''description : udp_primitive '''
1090 if(parse_debug):
1091 print('description_2', list(p))
1092
1093
1094 ()
1095
1096
1097 def p_description_3(p):
1098 '''description : config_declaration '''
1099 if(parse_debug):
1100 print('description_3', list(p))
1101
1102
1103 ()
1104
1105
1106 def p_description_4(p):
1107 '''description : nature_declaration '''
1108 if(parse_debug):
1109 print('description_4', list(p))
1110
1111
1112 ()
1113
1114
1115 def p_description_5(p):
1116 '''description : package_declaration '''
1117 if(parse_debug):
1118 print('description_5', list(p))
1119
1120
1121 ()
1122
1123
1124 def p_description_6(p):
1125 '''description : discipline_declaration '''
1126 if(parse_debug):
1127 print('description_6', list(p))
1128
1129
1130 ()
1131
1132
1133 def p_description_7(p):
1134 '''description : package_item '''
1135 if(parse_debug):
1136 print('description_7', list(p))
1137
1138
1139 ()
1140
1141
1142 def p_description_8(p):
1143 '''description : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' '''
1144 if(parse_debug):
1145 print('description_8', list(p))
1146
1147 # { perm_string tmp3 = lex_strings.make(p[3]);
1148 # pform_set_type_attrib(tmp3, p[5], p[7]);
1149 # delete[] p[3];
1150 # delete[] p[5];
1151 # }
1152 ()
1153
1154
1155 def p_description_list_1(p):
1156 '''description_list : description '''
1157 if(parse_debug > 2):
1158 print('description_list_1', list(p))
1159
1160
1161 ()
1162
1163
1164 def p_description_list_2(p):
1165 '''description_list : description_list description '''
1166 if(parse_debug):
1167 print('description_list_2', list(p))
1168
1169
1170 ()
1171
1172
1173 def p_endnew_opt_1(p):
1174 '''endnew_opt : ':' K_new '''
1175 if(parse_debug):
1176 print('endnew_opt_1', list(p))
1177
1178
1179 ()
1180
1181
1182 def p_endnew_opt_2(p):
1183 '''endnew_opt : '''
1184 if(parse_debug):
1185 print('endnew_opt_2', list(p))
1186
1187
1188 ()
1189
1190
1191 def p_dynamic_array_new_1(p):
1192 '''dynamic_array_new : K_new '[' expression ']' '''
1193 if(parse_debug):
1194 print('dynamic_array_new_1', list(p))
1195
1196 # { p[0] = new PENewArray(p[3], 0);
1197 # FILE_NAME(p[0], @1);
1198 # }
1199 ()
1200
1201
1202 def p_dynamic_array_new_2(p):
1203 '''dynamic_array_new : K_new '[' expression ']' '(' expression ')' '''
1204 if(parse_debug):
1205 print('dynamic_array_new_2', list(p))
1206
1207 # { p[0] = new PENewArray(p[3], p[6]);
1208 # FILE_NAME(p[0], @1);
1209 # }
1210 ()
1211
1212
1213 def p_for_step_1(p):
1214 '''for_step : lpvalue '=' expression '''
1215 if(parse_debug):
1216 print('for_step_1', list(p))
1217
1218 # { PAssign*tmp = new PAssign(p[1],p[3]);
1219 # FILE_NAME(tmp, @1);
1220 # p[0] = tmp;
1221 # }
1222 ()
1223
1224
1225 def p_for_step_2(p):
1226 '''for_step : inc_or_dec_expression '''
1227 if(parse_debug):
1228 print('for_step_2', list(p))
1229
1230 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
1231 ()
1232
1233
1234 def p_for_step_3(p):
1235 '''for_step : compressed_statement '''
1236 if(parse_debug):
1237 print('for_step_3', list(p))
1238 p[0] = p[1]
1239
1240
1241 ()
1242
1243
1244 def p_function_declaration_1(p):
1245 '''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 '''
1246 if(parse_debug):
1247 print('function_declaration_1', list(p))
1248
1249 # { // Last step: check any closing name.
1250 # if (p[11]) {
1251 # if (strcmp(p[4],p[11]) != 0) {
1252 # yyerror(@11, "error: End label doesn't match "
1253 # "function name");
1254 # }
1255 # if (! gn_system_verilog()) {
1256 # yyerror(@11, "error: Function end labels require "
1257 # "SystemVerilog.");
1258 # }
1259 # delete[]p[11];
1260 # }
1261 # delete[]p[4];
1262 # }
1263 ()
1264
1265
1266 def p_function_declaration_2(p):
1267 '''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 '''
1268 if(parse_debug):
1269 print('function_declaration_2', list(p))
1270
1271 # { // Last step: check any closing name.
1272 # if (p[14]) {
1273 # if (strcmp(p[4],p[14]) != 0) {
1274 # yyerror(@14, "error: End label doesn't match "
1275 # "function name");
1276 # }
1277 # if (! gn_system_verilog()) {
1278 # yyerror(@14, "error: Function end labels require "
1279 # "SystemVerilog.");
1280 # }
1281 # delete[]p[14];
1282 # }
1283 # delete[]p[4];
1284 # }
1285 ()
1286
1287
1288 def p_function_declaration_3(p):
1289 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER error K_endfunction _embed4_function_declaration endlabel_opt '''
1290 if(parse_debug):
1291 print('function_declaration_3', list(p))
1292
1293 # { // Last step: check any closing name.
1294 # if (p[8]) {
1295 # if (strcmp(p[4],p[8]) != 0) {
1296 # yyerror(@8, "error: End label doesn't match function name");
1297 # }
1298 # if (! gn_system_verilog()) {
1299 # yyerror(@8, "error: Function end labels require "
1300 # "SystemVerilog.");
1301 # }
1302 # delete[]p[8];
1303 # }
1304 # delete[]p[4];
1305 # }
1306 ()
1307
1308
1309 def p__embed0_function_declaration(p):
1310 '''_embed0_function_declaration : '''
1311
1312 # { assert(current_function == 0);
1313 # current_function = pform_push_function_scope(@1, p[4], p[2]);
1314 # }
1315 ()
1316
1317
1318 def p__embed1_function_declaration(p):
1319 '''_embed1_function_declaration : '''
1320
1321 # { current_function->set_ports(p[7]);
1322 # current_function->set_return(p[3]);
1323 # current_function_set_statement(p[8]? @8 : @4, p[8]);
1324 # pform_set_this_class(@4, current_function);
1325 # pform_pop_scope();
1326 # current_function = 0;
1327 # }
1328 ()
1329
1330
1331 def p__embed2_function_declaration(p):
1332 '''_embed2_function_declaration : '''
1333
1334 # { assert(current_function == 0);
1335 # current_function = pform_push_function_scope(@1, p[4], p[2]);
1336 # }
1337 ()
1338
1339
1340 def p__embed3_function_declaration(p):
1341 '''_embed3_function_declaration : '''
1342
1343 # { current_function->set_ports(p[7]);
1344 # current_function->set_return(p[3]);
1345 # current_function_set_statement(p[11]? @11 : @4, p[11]);
1346 # pform_set_this_class(@4, current_function);
1347 # pform_pop_scope();
1348 # current_function = 0;
1349 # if (p[7]==0 && !gn_system_verilog()) {
1350 # yyerror(@4, "error: Empty parenthesis syntax requires SystemVerilog.");
1351 # }
1352 # }
1353 ()
1354
1355
1356 def p__embed4_function_declaration(p):
1357 '''_embed4_function_declaration : '''
1358
1359 # { /* */
1360 # if (current_function) {
1361 # pform_pop_scope();
1362 # current_function = 0;
1363 # }
1364 # assert(current_function == 0);
1365 # yyerror(@1, "error: Syntax error defining function.");
1366 # yyerrok;
1367 # }
1368 ()
1369
1370
1371 def p_import_export_1(p):
1372 '''import_export : K_import '''
1373 if(parse_debug):
1374 print('import_export_1', list(p))
1375 p[0] = True
1376
1377
1378 ()
1379
1380
1381 def p_import_export_2(p):
1382 '''import_export : K_export '''
1383 if(parse_debug):
1384 print('import_export_2', list(p))
1385 p[0] = False
1386
1387
1388 ()
1389
1390
1391 def p_implicit_class_handle_1(p):
1392 '''implicit_class_handle : K_this '''
1393 if(parse_debug):
1394 print('implicit_class_handle_1', list(p))
1395
1396 # { p[0] = pform_create_this(); }
1397 ()
1398
1399
1400 def p_implicit_class_handle_2(p):
1401 '''implicit_class_handle : K_super '''
1402 if(parse_debug):
1403 print('implicit_class_handle_2', list(p))
1404
1405 # { p[0] = pform_create_super(); }
1406 ()
1407
1408
1409 def p_inc_or_dec_expression_1(p):
1410 '''inc_or_dec_expression : K_INCR lpvalue %prec UNARY_PREC '''
1411 if(parse_debug):
1412 print('inc_or_dec_expression_1', list(p))
1413
1414 # { PEUnary*tmp = new PEUnary('I', p[2]);
1415 # FILE_NAME(tmp, @2);
1416 # p[0] = tmp;
1417 # }
1418 ()
1419
1420
1421 def p_inc_or_dec_expression_2(p):
1422 '''inc_or_dec_expression : lpvalue K_INCR %prec UNARY_PREC '''
1423 if(parse_debug):
1424 print('inc_or_dec_expression_2', list(p))
1425
1426 # { PEUnary*tmp = new PEUnary('i', p[1]);
1427 # FILE_NAME(tmp, @1);
1428 # p[0] = tmp;
1429 # }
1430 ()
1431
1432
1433 def p_inc_or_dec_expression_3(p):
1434 '''inc_or_dec_expression : K_DECR lpvalue %prec UNARY_PREC '''
1435 if(parse_debug):
1436 print('inc_or_dec_expression_3', list(p))
1437
1438 # { PEUnary*tmp = new PEUnary('D', p[2]);
1439 # FILE_NAME(tmp, @2);
1440 # p[0] = tmp;
1441 # }
1442 ()
1443
1444
1445 def p_inc_or_dec_expression_4(p):
1446 '''inc_or_dec_expression : lpvalue K_DECR %prec UNARY_PREC '''
1447 if(parse_debug):
1448 print('inc_or_dec_expression_4', list(p))
1449
1450 # { PEUnary*tmp = new PEUnary('d', p[1]);
1451 # FILE_NAME(tmp, @1);
1452 # p[0] = tmp;
1453 # }
1454 ()
1455
1456
1457 def p_inside_expression_1(p):
1458 '''inside_expression : expression K_inside '{' open_range_list '}' '''
1459 if(parse_debug):
1460 print('inside_expression_1', list(p))
1461
1462 # { yyerror(@2, "sorry: \"inside\" expressions not supported yet.");
1463 # p[0] = None
1464 # }
1465 ()
1466
1467
1468 def p_integer_vector_type_1(p):
1469 '''integer_vector_type : K_reg '''
1470 if(parse_debug):
1471 print('integer_vector_type_1', list(p))
1472 p[0] = IVL_VT_NO_TYPE
1473
1474
1475 ()
1476
1477
1478 def p_integer_vector_type_2(p):
1479 '''integer_vector_type : K_bit '''
1480 if(parse_debug):
1481 print('integer_vector_type_2', list(p))
1482 p[0] = IVL_VT_BOOL
1483
1484
1485 ()
1486
1487
1488 def p_integer_vector_type_3(p):
1489 '''integer_vector_type : K_logic '''
1490 if(parse_debug):
1491 print('integer_vector_type_3', list(p))
1492 p[0] = IVL_VT_LOGIC
1493
1494
1495 ()
1496
1497
1498 def p_integer_vector_type_4(p):
1499 '''integer_vector_type : K_bool '''
1500 if(parse_debug):
1501 print('integer_vector_type_4', list(p))
1502
1503 # { p[0] = IVL_VT_BOOL; }
1504 ()
1505
1506
1507 def p_join_keyword_1(p):
1508 '''join_keyword : K_join '''
1509 if(parse_debug):
1510 print('join_keyword_1', list(p))
1511
1512 # { p[0] = PBlock::BL_PAR; }
1513 ()
1514
1515
1516 def p_join_keyword_2(p):
1517 '''join_keyword : K_join_none '''
1518 if(parse_debug):
1519 print('join_keyword_2', list(p))
1520
1521 # { p[0] = PBlock::BL_JOIN_NONE; }
1522 ()
1523
1524
1525 def p_join_keyword_3(p):
1526 '''join_keyword : K_join_any '''
1527 if(parse_debug):
1528 print('join_keyword_3', list(p))
1529
1530 # { p[0] = PBlock::BL_JOIN_ANY; }
1531 ()
1532
1533
1534 def p_jump_statement_1(p):
1535 '''jump_statement : K_break ';' '''
1536 if(parse_debug):
1537 print('jump_statement_1', list(p))
1538
1539 # { yyerror(@1, "sorry: break statements not supported.");
1540 # p[0] = None
1541 # }
1542 ()
1543
1544
1545 def p_jump_statement_2(p):
1546 '''jump_statement : K_return ';' '''
1547 if(parse_debug):
1548 print('jump_statement_2', list(p))
1549
1550 # { PReturn*tmp = new PReturn(0);
1551 # FILE_NAME(tmp, @1);
1552 # p[0] = tmp;
1553 # }
1554 ()
1555
1556
1557 def p_jump_statement_3(p):
1558 '''jump_statement : K_return expression ';' '''
1559 if(parse_debug):
1560 print('jump_statement_3', list(p))
1561
1562 # { PReturn*tmp = new PReturn(p[2]);
1563 # FILE_NAME(tmp, @1);
1564 # p[0] = tmp;
1565 # }
1566 ()
1567
1568
1569 def p_lifetime_1(p):
1570 '''lifetime : K_automatic '''
1571 if(parse_debug):
1572 print('lifetime_1', list(p))
1573
1574 # { p[0] = LexicalScope::AUTOMATIC; }
1575 ()
1576
1577
1578 def p_lifetime_2(p):
1579 '''lifetime : K_static '''
1580 if(parse_debug):
1581 print('lifetime_2', list(p))
1582
1583 # { p[0] = LexicalScope::STATIC; }
1584 ()
1585
1586
1587 def p_lifetime_opt_1(p):
1588 '''lifetime_opt : lifetime '''
1589 if(parse_debug):
1590 print('lifetime_opt_1', list(p))
1591 p[0] = p[1]
1592
1593
1594 ()
1595
1596
1597 def p_lifetime_opt_2(p):
1598 '''lifetime_opt : '''
1599 if(parse_debug > 2):
1600 print('lifetime_opt_2', list(p))
1601
1602 # { p[0] = LexicalScope::INHERITED; }
1603 ()
1604
1605
1606 def p_loop_statement_1(p):
1607 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' for_step ')' statement_or_null '''
1608 if(parse_debug):
1609 print('loop_statement_1', list(p))
1610
1611 # { PForStatement*tmp = new PForStatement(p[3], p[5], p[7], p[9], p[11]);
1612 # FILE_NAME(tmp, @1);
1613 # p[0] = tmp;
1614 # }
1615 ()
1616
1617
1618 def p_loop_statement_2(p):
1619 '''loop_statement : K_for '(' data_type IDENTIFIER '=' expression ';' expression ';' for_step ')' _embed0_loop_statement statement_or_null '''
1620 if(parse_debug):
1621 print('loop_statement_2', list(p))
1622
1623 # { pform_name_t tmp_hident;
1624 # tmp_hident.push_back(name_component_t(lex_strings.make(p[4])));
1625 #
1626 # PEIdent*tmp_ident = pform_new_ident(tmp_hident);
1627 # FILE_NAME(tmp_ident, @4);
1628 #
1629 # PForStatement*tmp_for = new PForStatement(tmp_ident, p[6], p[8], p[10], p[13]);
1630 # FILE_NAME(tmp_for, @1);
1631 #
1632 # pform_pop_scope();
1633 # vector<Statement*>tmp_for_list (1);
1634 # tmp_for_list[0] = tmp_for;
1635 # PBlock*tmp_blk = current_block_stack.top();
1636 # current_block_stack.pop();
1637 # tmp_blk->set_statement(tmp_for_list);
1638 # p[0] = tmp_blk;
1639 # delete[]p[4];
1640 # }
1641 ()
1642
1643
1644 def p_loop_statement_3(p):
1645 '''loop_statement : K_forever statement_or_null '''
1646 if(parse_debug):
1647 print('loop_statement_3', list(p))
1648
1649 # { PForever*tmp = new PForever(p[2]);
1650 # FILE_NAME(tmp, @1);
1651 # p[0] = tmp;
1652 # }
1653 ()
1654
1655
1656 def p_loop_statement_4(p):
1657 '''loop_statement : K_repeat '(' expression ')' statement_or_null '''
1658 if(parse_debug):
1659 print('loop_statement_4', list(p))
1660
1661 # { PRepeat*tmp = new PRepeat(p[3], p[5]);
1662 # FILE_NAME(tmp, @1);
1663 # p[0] = tmp;
1664 # }
1665 ()
1666
1667
1668 def p_loop_statement_5(p):
1669 '''loop_statement : K_while '(' expression ')' statement_or_null '''
1670 if(parse_debug):
1671 print('loop_statement_5', list(p))
1672
1673 # { PWhile*tmp = new PWhile(p[3], p[5]);
1674 # FILE_NAME(tmp, @1);
1675 # p[0] = tmp;
1676 # }
1677 ()
1678
1679
1680 def p_loop_statement_6(p):
1681 '''loop_statement : K_do statement_or_null K_while '(' expression ')' ';' '''
1682 if(parse_debug):
1683 print('loop_statement_6', list(p))
1684
1685 # { PDoWhile*tmp = new PDoWhile(p[5], p[2]);
1686 # FILE_NAME(tmp, @1);
1687 # p[0] = tmp;
1688 # }
1689 ()
1690
1691
1692 def p_loop_statement_7(p):
1693 '''loop_statement : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' _embed1_loop_statement statement_or_null '''
1694 if(parse_debug):
1695 print('loop_statement_7', list(p))
1696
1697 # { PForeach*tmp_for = pform_make_foreach(@1, p[3], p[5], p[9]);
1698 #
1699 # pform_pop_scope();
1700 # vector<Statement*>tmp_for_list(1);
1701 # tmp_for_list[0] = tmp_for;
1702 # PBlock*tmp_blk = current_block_stack.top();
1703 # current_block_stack.pop();
1704 # tmp_blk->set_statement(tmp_for_list);
1705 # p[0] = tmp_blk;
1706 # }
1707 ()
1708
1709
1710 def p_loop_statement_8(p):
1711 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' error ')' statement_or_null '''
1712 if(parse_debug):
1713 print('loop_statement_8', list(p))
1714
1715 # { p[0] = None
1716 # yyerror(@1, "error: Error in for loop step assignment.");
1717 # }
1718 ()
1719
1720
1721 def p_loop_statement_9(p):
1722 '''loop_statement : K_for '(' lpvalue '=' expression ';' error ';' for_step ')' statement_or_null '''
1723 if(parse_debug):
1724 print('loop_statement_9', list(p))
1725
1726 # { p[0] = None
1727 # yyerror(@1, "error: Error in for loop condition expression.");
1728 # }
1729 ()
1730
1731
1732 def p_loop_statement_10(p):
1733 '''loop_statement : K_for '(' error ')' statement_or_null '''
1734 if(parse_debug):
1735 print('loop_statement_10', list(p))
1736
1737 # { p[0] = None
1738 # yyerror(@1, "error: Incomprehensible for loop.");
1739 # }
1740 ()
1741
1742
1743 def p_loop_statement_11(p):
1744 '''loop_statement : K_while '(' error ')' statement_or_null '''
1745 if(parse_debug):
1746 print('loop_statement_11', list(p))
1747
1748 # { p[0] = None
1749 # yyerror(@1, "error: Error in while loop condition.");
1750 # }
1751 ()
1752
1753
1754 def p_loop_statement_12(p):
1755 '''loop_statement : K_do statement_or_null K_while '(' error ')' ';' '''
1756 if(parse_debug):
1757 print('loop_statement_12', list(p))
1758
1759 # { p[0] = None
1760 # yyerror(@1, "error: Error in do/while loop condition.");
1761 # }
1762 ()
1763
1764
1765 def p_loop_statement_13(p):
1766 '''loop_statement : K_foreach '(' IDENTIFIER '[' error ']' ')' statement_or_null '''
1767 if(parse_debug):
1768 print('loop_statement_13', list(p))
1769
1770 # { p[0] = None
1771 # yyerror(@4, "error: Errors in foreach loop variables list.");
1772 # }
1773 ()
1774
1775
1776 def p__embed0_loop_statement(p):
1777 '''_embed0_loop_statement : '''
1778
1779 # { static unsigned for_counter = 0;
1780 # char for_block_name [64];
1781 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_for_loop%u", for_counter);
1782 # for_counter += 1;
1783 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1784 # FILE_NAME(tmp, @1);
1785 # current_block_stack.push(tmp);
1786 #
1787 # list<decl_assignment_t*>assign_list;
1788 # decl_assignment_t*tmp_assign = new decl_assignment_t;
1789 # tmp_assign->name = lex_strings.make(p[4]);
1790 # assign_list.push_back(tmp_assign);
1791 # pform_makewire(@4, 0, str_strength, &assign_list, NetNet::REG, p[3]);
1792 # }
1793 ()
1794
1795
1796 def p__embed1_loop_statement(p):
1797 '''_embed1_loop_statement : '''
1798
1799 # { static unsigned foreach_counter = 0;
1800 # char for_block_name[64];
1801 # snif(parse_debug): printf(for_block_name, sizeof for_block_name, "$ivl_foreach%u", foreach_counter);
1802 # foreach_counter += 1;
1803 #
1804 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1805 # FILE_NAME(tmp, @1);
1806 # current_block_stack.push(tmp);
1807 #
1808 # pform_make_foreach_declarations(@1, p[5]);
1809 # }
1810 ()
1811
1812
1813 def p_list_of_variable_decl_assignments_1(p):
1814 '''list_of_variable_decl_assignments : variable_decl_assignment '''
1815 if(parse_debug):
1816 print('list_of_variable_decl_assignments_1', list(p))
1817
1818 # { list<decl_assignment_t*>*tmp = new list<decl_assignment_t*>;
1819 # tmp->push_back(p[1]);
1820 # p[0] = tmp;
1821 # }
1822 ()
1823
1824
1825 def p_list_of_variable_decl_assignments_2(p):
1826 '''list_of_variable_decl_assignments : list_of_variable_decl_assignments ',' variable_decl_assignment '''
1827 if(parse_debug):
1828 print('list_of_variable_decl_assignments_2', list(p))
1829
1830 # { list<decl_assignment_t*>*tmp = p[1];
1831 # tmp->push_back(p[3]);
1832 # p[0] = tmp;
1833 # }
1834 ()
1835
1836
1837 def p_variable_decl_assignment_1(p):
1838 '''variable_decl_assignment : IDENTIFIER dimensions_opt '''
1839 if(parse_debug):
1840 print('variable_decl_assignment_1', list(p))
1841
1842 # { decl_assignment_t*tmp = new decl_assignment_t;
1843 # tmp->name = lex_strings.make(p[1]);
1844 # if (p[2]) {
1845 # tmp->index = *p[2];
1846 # delete p[2];
1847 # }
1848 # delete[]p[1];
1849 # p[0] = tmp;
1850 # }
1851 ()
1852
1853
1854 def p_variable_decl_assignment_2(p):
1855 '''variable_decl_assignment : IDENTIFIER '=' expression '''
1856 if(parse_debug):
1857 print('variable_decl_assignment_2', list(p))
1858
1859 # { decl_assignment_t*tmp = new decl_assignment_t;
1860 # tmp->name = lex_strings.make(p[1]);
1861 # tmp->expr .reset(p[3]);
1862 # delete[]p[1];
1863 # p[0] = tmp;
1864 # }
1865 ()
1866
1867
1868 def p_variable_decl_assignment_3(p):
1869 '''variable_decl_assignment : IDENTIFIER '=' K_new '(' ')' '''
1870 if(parse_debug):
1871 print('variable_decl_assignment_3', list(p))
1872
1873 # { decl_assignment_t*tmp = new decl_assignment_t;
1874 # tmp->name = lex_strings.make(p[1]);
1875 # PENewClass*expr = new PENewClass;
1876 # FILE_NAME(expr, @3);
1877 # tmp->expr .reset(expr);
1878 # delete[]p[1];
1879 # p[0] = tmp;
1880 # }
1881 ()
1882
1883
1884 def p_loop_variables_1(p):
1885 '''loop_variables : loop_variables ',' IDENTIFIER '''
1886 if(parse_debug):
1887 print('loop_variables_1', list(p))
1888
1889 # { list<perm_string>*tmp = p[1];
1890 # tmp->push_back(lex_strings.make(p[3]));
1891 # delete[]p[3];
1892 # p[0] = tmp;
1893 # }
1894 ()
1895
1896
1897 def p_loop_variables_2(p):
1898 '''loop_variables : IDENTIFIER '''
1899 if(parse_debug):
1900 print('loop_variables_2', list(p))
1901
1902 # { list<perm_string>*tmp = new list<perm_string>;
1903 # tmp->push_back(lex_strings.make(p[1]));
1904 # delete[]p[1];
1905 # p[0] = tmp;
1906 # }
1907 ()
1908
1909
1910 def p_method_qualifier_1(p):
1911 '''method_qualifier : K_virtual '''
1912 if(parse_debug):
1913 print('method_qualifier_1', list(p))
1914
1915
1916 ()
1917
1918
1919 def p_method_qualifier_2(p):
1920 '''method_qualifier : class_item_qualifier '''
1921 if(parse_debug):
1922 print('method_qualifier_2', list(p))
1923
1924
1925 ()
1926
1927
1928 def p_method_qualifier_opt_1(p):
1929 '''method_qualifier_opt : method_qualifier '''
1930 if(parse_debug):
1931 print('method_qualifier_opt_1', list(p))
1932
1933
1934 ()
1935
1936
1937 def p_method_qualifier_opt_2(p):
1938 '''method_qualifier_opt : '''
1939 if(parse_debug):
1940 print('method_qualifier_opt_2', list(p))
1941
1942
1943 ()
1944
1945
1946 def p_modport_declaration_1(p):
1947 '''modport_declaration : K_modport _embed0_modport_declaration modport_item_list ';' '''
1948 if(parse_debug):
1949 print('modport_declaration_1', list(p))
1950
1951
1952 ()
1953
1954
1955 def p__embed0_modport_declaration(p):
1956 '''_embed0_modport_declaration : '''
1957
1958 # { if (!pform_in_interface())
1959 # yyerror(@1, "error: modport declarations are only allowed "
1960 # "in interfaces.");
1961 # }
1962 ()
1963
1964
1965 def p_modport_item_list_1(p):
1966 '''modport_item_list : modport_item '''
1967 if(parse_debug):
1968 print('modport_item_list_1', list(p))
1969
1970
1971 ()
1972
1973
1974 def p_modport_item_list_2(p):
1975 '''modport_item_list : modport_item_list ',' modport_item '''
1976 if(parse_debug):
1977 print('modport_item_list_2', list(p))
1978
1979
1980 ()
1981
1982
1983 def p_modport_item_1(p):
1984 '''modport_item : IDENTIFIER _embed0_modport_item '(' modport_ports_list ')' '''
1985 if(parse_debug):
1986 print('modport_item_1', list(p))
1987
1988 # { pform_end_modport_item(@1); }
1989 ()
1990
1991
1992 def p__embed0_modport_item(p):
1993 '''_embed0_modport_item : '''
1994
1995 # { pform_start_modport_item(@1, p[1]); }
1996 ()
1997
1998
1999 def p_modport_ports_list_1(p):
2000 '''modport_ports_list : modport_ports_declaration '''
2001 if(parse_debug):
2002 print('modport_ports_list_1', list(p))
2003
2004
2005 ()
2006
2007
2008 def p_modport_ports_list_2(p):
2009 '''modport_ports_list : modport_ports_list ',' modport_ports_declaration '''
2010 if(parse_debug):
2011 print('modport_ports_list_2', list(p))
2012
2013
2014 ()
2015
2016
2017 def p_modport_ports_list_3(p):
2018 '''modport_ports_list : modport_ports_list ',' modport_simple_port '''
2019 if(parse_debug):
2020 print('modport_ports_list_3', list(p))
2021
2022 # { if (last_modport_port.type == MP_SIMPLE) {
2023 # pform_add_modport_port(@3, last_modport_port.direction,
2024 # p[3]->name, p[3]->parm);
2025 # } else {
2026 # yyerror(@3, "error: modport expression not allowed here.");
2027 # }
2028 # delete p[3];
2029 # }
2030 ()
2031
2032
2033 def p_modport_ports_list_4(p):
2034 '''modport_ports_list : modport_ports_list ',' modport_tf_port '''
2035 if(parse_debug):
2036 print('modport_ports_list_4', list(p))
2037
2038 # { if (last_modport_port.type != MP_TF)
2039 # yyerror(@3, "error: task/function declaration not allowed here.");
2040 # }
2041 ()
2042
2043
2044 def p_modport_ports_list_5(p):
2045 '''modport_ports_list : modport_ports_list ',' IDENTIFIER '''
2046 if(parse_debug):
2047 print('modport_ports_list_5', list(p))
2048
2049 # { if (last_modport_port.type == MP_SIMPLE) {
2050 # pform_add_modport_port(@3, last_modport_port.direction,
2051 # lex_strings.make(p[3]), 0);
2052 # } else if (last_modport_port.type != MP_TF) {
2053 # yyerror(@3, "error: list of identifiers not allowed here.");
2054 # }
2055 # delete[] p[3];
2056 # }
2057 ()
2058
2059
2060 def p_modport_ports_list_6(p):
2061 '''modport_ports_list : modport_ports_list ',' '''
2062 if(parse_debug):
2063 print('modport_ports_list_6', list(p))
2064
2065 # { yyerror(@2, "error: NULL port declarations are not allowed"); }
2066 ()
2067
2068
2069 def p_modport_ports_declaration_1(p):
2070 '''modport_ports_declaration : attribute_list_opt port_direction IDENTIFIER '''
2071 if(parse_debug):
2072 print('modport_ports_declaration_1', list(p))
2073
2074 # { last_modport_port.type = MP_SIMPLE;
2075 # last_modport_port.direction = p[2];
2076 # pform_add_modport_port(@3, p[2], lex_strings.make(p[3]), 0);
2077 # delete[] p[3];
2078 # delete p[1];
2079 # }
2080 ()
2081
2082
2083 def p_modport_ports_declaration_2(p):
2084 '''modport_ports_declaration : attribute_list_opt port_direction modport_simple_port '''
2085 if(parse_debug):
2086 print('modport_ports_declaration_2', list(p))
2087
2088 # { last_modport_port.type = MP_SIMPLE;
2089 # last_modport_port.direction = p[2];
2090 # pform_add_modport_port(@3, p[2], p[3]->name, p[3]->parm);
2091 # delete p[3];
2092 # delete p[1];
2093 # }
2094 ()
2095
2096
2097 def p_modport_ports_declaration_3(p):
2098 '''modport_ports_declaration : attribute_list_opt import_export IDENTIFIER '''
2099 if(parse_debug):
2100 print('modport_ports_declaration_3', list(p))
2101
2102 # { last_modport_port.type = MP_TF;
2103 # last_modport_port.is_import = p[2];
2104 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
2105 # delete[] p[3];
2106 # delete p[1];
2107 # }
2108 ()
2109
2110
2111 def p_modport_ports_declaration_4(p):
2112 '''modport_ports_declaration : attribute_list_opt import_export modport_tf_port '''
2113 if(parse_debug):
2114 print('modport_ports_declaration_4', list(p))
2115
2116 # { last_modport_port.type = MP_TF;
2117 # last_modport_port.is_import = p[2];
2118 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
2119 # delete p[1];
2120 # }
2121 ()
2122
2123
2124 def p_modport_ports_declaration_5(p):
2125 '''modport_ports_declaration : attribute_list_opt K_clocking IDENTIFIER '''
2126 if(parse_debug):
2127 print('modport_ports_declaration_5', list(p))
2128
2129 # { last_modport_port.type = MP_CLOCKING;
2130 # last_modport_port.direction = NetNet::NOT_A_PORT;
2131 # yyerror(@3, "sorry: modport clocking declaration is not yet supported.");
2132 # delete[] p[3];
2133 # delete p[1];
2134 # }
2135 ()
2136
2137
2138 def p_modport_simple_port_1(p):
2139 '''modport_simple_port : '.' IDENTIFIER '(' expression ')' '''
2140 if(parse_debug):
2141 print('modport_simple_port_1', list(p))
2142
2143 # { named_pexpr_t*tmp = new named_pexpr_t;
2144 # tmp->name = lex_strings.make(p[2]);
2145 # tmp->parm = p[4];
2146 # delete[]p[2];
2147 # p[0] = tmp;
2148 # }
2149 ()
2150
2151
2152 def p_modport_tf_port_1(p):
2153 '''modport_tf_port : K_task IDENTIFIER '''
2154 if(parse_debug):
2155 print('modport_tf_port_1', list(p))
2156
2157
2158 ()
2159
2160
2161 def p_modport_tf_port_2(p):
2162 '''modport_tf_port : K_task IDENTIFIER '(' tf_port_list_opt ')' '''
2163 if(parse_debug):
2164 print('modport_tf_port_2', list(p))
2165
2166
2167 ()
2168
2169
2170 def p_modport_tf_port_3(p):
2171 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '''
2172 if(parse_debug):
2173 print('modport_tf_port_3', list(p))
2174
2175
2176 ()
2177
2178
2179 def p_modport_tf_port_4(p):
2180 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' '''
2181 if(parse_debug):
2182 print('modport_tf_port_4', list(p))
2183
2184
2185 ()
2186
2187
2188 def p_non_integer_type_1(p):
2189 '''non_integer_type : K_real '''
2190 if(parse_debug):
2191 print('non_integer_type_1', list(p))
2192
2193 # { p[0] = real_type_t::REAL; }
2194 ()
2195
2196
2197 def p_non_integer_type_2(p):
2198 '''non_integer_type : K_realtime '''
2199 if(parse_debug):
2200 print('non_integer_type_2', list(p))
2201
2202 # { p[0] = real_type_t::REAL; }
2203 ()
2204
2205
2206 def p_non_integer_type_3(p):
2207 '''non_integer_type : K_shortreal '''
2208 if(parse_debug):
2209 print('non_integer_type_3', list(p))
2210
2211 # { p[0] = real_type_t::SHORTREAL; }
2212 ()
2213
2214
2215 def p_number_1(p):
2216 '''number : BASED_NUMBER '''
2217 if(parse_debug):
2218 print('number_1', list(p))
2219
2220 # { p[0] = p[1]; based_size = 0;}
2221 ()
2222
2223
2224 def p_number_2(p):
2225 '''number : DEC_NUMBER '''
2226 if(parse_debug):
2227 print('number_2', list(p))
2228 num = Leaf(token.NUMBER, "%s" % (p[1]))
2229 p[0] = num
2230
2231 # { p[0] = p[1]; based_size = 0;}
2232 ()
2233
2234
2235 def p_number_3(p):
2236 '''number : DEC_NUMBER BASED_NUMBER '''
2237 if(parse_debug):
2238 print('number_3', list(p))
2239 num = Leaf(token.NUMBER, "%s:%s" % (p[1], p[2]))
2240 p[0] = num
2241
2242 # { p[0] = pform_verinum_with_size(p[1],p[2], @2.text, @2.first_line);
2243 # based_size = 0; }
2244 ()
2245
2246
2247 def p_number_4(p):
2248 '''number : UNBASED_NUMBER '''
2249 if(parse_debug):
2250 print('number_4', list(p))
2251
2252 # { p[0] = p[1]; based_size = 0;}
2253 ()
2254
2255
2256 def p_number_5(p):
2257 '''number : DEC_NUMBER UNBASED_NUMBER '''
2258 if(parse_debug):
2259 print('number_5', list(p))
2260
2261 # { yyerror(@1, "error: Unbased SystemVerilog literal cannot have "
2262 # "a size.");
2263 # p[0] = p[1]; based_size = 0;}
2264 ()
2265
2266
2267 def p_open_range_list_1(p):
2268 '''open_range_list : open_range_list ',' value_range '''
2269 if(parse_debug):
2270 print('open_range_list_1', list(p))
2271
2272
2273 ()
2274
2275
2276 def p_open_range_list_2(p):
2277 '''open_range_list : value_range '''
2278 if(parse_debug):
2279 print('open_range_list_2', list(p))
2280
2281
2282 ()
2283
2284
2285 def p_package_declaration_1(p):
2286 '''package_declaration : K_package lifetime_opt IDENTIFIER ';' _embed0_package_declaration timeunits_declaration_opt _embed1_package_declaration package_item_list_opt K_endpackage endlabel_opt '''
2287 if(parse_debug):
2288 print('package_declaration_1', list(p))
2289
2290 # { pform_end_package_declaration(@1);
2291 # // If an end label is present make sure it match the package name.
2292 # if (p[10]) {
2293 # if (strcmp(p[3],p[10]) != 0) {
2294 # yyerror(@10, "error: End label doesn't match package name");
2295 # }
2296 # delete[]p[10];
2297 # }
2298 # delete[]p[3];
2299 # }
2300 ()
2301
2302
2303 def p__embed0_package_declaration(p):
2304 '''_embed0_package_declaration : '''
2305
2306 # { pform_start_package_declaration(@1, p[3], p[2]); }
2307 ()
2308
2309
2310 def p__embed1_package_declaration(p):
2311 '''_embed1_package_declaration : '''
2312
2313 # { pform_set_scope_timescale(@1); }
2314 ()
2315
2316
2317 def p_module_package_import_list_opt_1(p):
2318 '''module_package_import_list_opt : '''
2319 if(parse_debug > 1):
2320 print('module_package_import_list_opt_1', list(p))
2321
2322
2323 ()
2324
2325
2326 def p_module_package_import_list_opt_2(p):
2327 '''module_package_import_list_opt : package_import_list '''
2328 if(parse_debug):
2329 print('module_package_import_list_opt_2', list(p))
2330
2331
2332 ()
2333
2334
2335 def p_package_import_list_1(p):
2336 '''package_import_list : package_import_declaration '''
2337 if(parse_debug):
2338 print('package_import_list_1', list(p))
2339
2340
2341 ()
2342
2343
2344 def p_package_import_list_2(p):
2345 '''package_import_list : package_import_list package_import_declaration '''
2346 if(parse_debug):
2347 print('package_import_list_2', list(p))
2348
2349
2350 ()
2351
2352
2353 def p_package_import_declaration_1(p):
2354 '''package_import_declaration : K_import package_import_item_list ';' '''
2355 if(parse_debug):
2356 print('package_import_declaration_1', list(p))
2357
2358 # { }
2359 ()
2360
2361
2362 def p_package_import_item_1(p):
2363 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '''
2364 if(parse_debug):
2365 print('package_import_item_1', list(p))
2366
2367 # { pform_package_import(@2, p[1], p[3]);
2368 # delete[]p[3];
2369 # }
2370 ()
2371
2372
2373 def p_package_import_item_2(p):
2374 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES '*' '''
2375 if(parse_debug):
2376 print('package_import_item_2', list(p))
2377
2378 # { pform_package_import(@2, p[1], 0);
2379 # }
2380 ()
2381
2382
2383 def p_package_import_item_list_1(p):
2384 '''package_import_item_list : package_import_item_list ',' package_import_item '''
2385 if(parse_debug):
2386 print('package_import_item_list_1', list(p))
2387
2388
2389 ()
2390
2391
2392 def p_package_import_item_list_2(p):
2393 '''package_import_item_list : package_import_item '''
2394 if(parse_debug):
2395 print('package_import_item_list_2', list(p))
2396
2397
2398 ()
2399
2400
2401 def p_package_item_1(p):
2402 '''package_item : timeunits_declaration '''
2403 if(parse_debug):
2404 print('package_item_1', list(p))
2405
2406
2407 ()
2408
2409
2410 def p_package_item_2(p):
2411 '''package_item : K_parameter param_type parameter_assign_list ';' '''
2412 if(parse_debug):
2413 print('package_item_2', list(p))
2414
2415
2416 ()
2417
2418
2419 def p_package_item_3(p):
2420 '''package_item : K_localparam param_type localparam_assign_list ';' '''
2421 if(parse_debug):
2422 print('package_item_3', list(p))
2423
2424
2425 ()
2426
2427
2428 def p_package_item_4(p):
2429 '''package_item : type_declaration '''
2430 if(parse_debug):
2431 print('package_item_4', list(p))
2432
2433
2434 ()
2435
2436
2437 def p_package_item_5(p):
2438 '''package_item : function_declaration '''
2439 if(parse_debug):
2440 print('package_item_5', list(p))
2441
2442
2443 ()
2444
2445
2446 def p_package_item_6(p):
2447 '''package_item : task_declaration '''
2448 if(parse_debug):
2449 print('package_item_6', list(p))
2450
2451
2452 ()
2453
2454
2455 def p_package_item_7(p):
2456 '''package_item : data_declaration '''
2457 if(parse_debug):
2458 print('package_item_7', list(p))
2459
2460
2461 ()
2462
2463
2464 def p_package_item_8(p):
2465 '''package_item : class_declaration '''
2466 if(parse_debug):
2467 print('package_item_8', list(p))
2468
2469
2470 ()
2471
2472
2473 def p_package_item_list_1(p):
2474 '''package_item_list : package_item_list package_item '''
2475 if(parse_debug):
2476 print('package_item_list_1', list(p))
2477
2478
2479 ()
2480
2481
2482 def p_package_item_list_2(p):
2483 '''package_item_list : package_item '''
2484 if(parse_debug):
2485 print('package_item_list_2', list(p))
2486
2487
2488 ()
2489
2490
2491 def p_package_item_list_opt_1(p):
2492 '''package_item_list_opt : package_item_list '''
2493 if(parse_debug):
2494 print('package_item_list_opt_1', list(p))
2495
2496
2497 ()
2498
2499
2500 def p_package_item_list_opt_2(p):
2501 '''package_item_list_opt : '''
2502 if(parse_debug):
2503 print('package_item_list_opt_2', list(p))
2504
2505
2506 ()
2507
2508
2509 def p_port_direction_1(p):
2510 '''port_direction : K_input '''
2511 if(parse_debug):
2512 print('port_direction_1', list(p))
2513
2514 # { p[0] = NetNet::PINPUT; }
2515 ()
2516
2517
2518 def p_port_direction_2(p):
2519 '''port_direction : K_output '''
2520 if(parse_debug):
2521 print('port_direction_2', list(p))
2522
2523 # { p[0] = NetNet::POUTPUT; }
2524 ()
2525
2526
2527 def p_port_direction_3(p):
2528 '''port_direction : K_inout '''
2529 if(parse_debug):
2530 print('port_direction_3', list(p))
2531
2532 # { p[0] = NetNet::PINOUT; }
2533 ()
2534
2535
2536 def p_port_direction_4(p):
2537 '''port_direction : K_ref '''
2538 if(parse_debug):
2539 print('port_direction_4', list(p))
2540
2541 # { p[0] = NetNet::PREF;
2542 # if (!gn_system_verilog()) {
2543 # yyerror(@1, "error: Reference ports (ref) require SystemVerilog.");
2544 # p[0] = NetNet::PINPUT;
2545 # }
2546 # }
2547 ()
2548
2549
2550 def p_port_direction_opt_1(p):
2551 '''port_direction_opt : port_direction '''
2552 if(parse_debug):
2553 print('port_direction_opt_1', list(p))
2554 p[0] = p[1]
2555
2556
2557 ()
2558
2559
2560 def p_port_direction_opt_2(p):
2561 '''port_direction_opt : '''
2562 if(parse_debug):
2563 print('port_direction_opt_2', list(p))
2564
2565 # { p[0] = NetNet::PIMPLICIT; }
2566 ()
2567
2568
2569 def p_property_expr_1(p):
2570 '''property_expr : expression '''
2571 if(parse_debug):
2572 print('property_expr_1', list(p))
2573
2574
2575 ()
2576
2577
2578 def p_procedural_assertion_statement_1(p):
2579 '''procedural_assertion_statement : K_assert '(' expression ')' statement %prec less_than_K_else '''
2580 if(parse_debug):
2581 print('procedural_assertion_statement_1', list(p))
2582
2583 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2584 # p[0] = None
2585 # }
2586 ()
2587
2588
2589 def p_procedural_assertion_statement_2(p):
2590 '''procedural_assertion_statement : K_assert '(' expression ')' K_else statement '''
2591 if(parse_debug):
2592 print('procedural_assertion_statement_2', list(p))
2593
2594 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2595 # p[0] = None
2596 # }
2597 ()
2598
2599
2600 def p_procedural_assertion_statement_3(p):
2601 '''procedural_assertion_statement : K_assert '(' expression ')' statement K_else statement '''
2602 if(parse_debug):
2603 print('procedural_assertion_statement_3', list(p))
2604
2605 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
2606 # p[0] = None
2607 # }
2608 ()
2609
2610
2611 def p_property_qualifier_1(p):
2612 '''property_qualifier : class_item_qualifier '''
2613 if(parse_debug):
2614 print('property_qualifier_1', list(p))
2615
2616
2617 ()
2618
2619
2620 def p_property_qualifier_2(p):
2621 '''property_qualifier : random_qualifier '''
2622 if(parse_debug):
2623 print('property_qualifier_2', list(p))
2624
2625
2626 ()
2627
2628
2629 def p_property_qualifier_opt_1(p):
2630 '''property_qualifier_opt : property_qualifier_list '''
2631 if(parse_debug):
2632 print('property_qualifier_opt_1', list(p))
2633 p[0] = p[1]
2634
2635
2636 ()
2637
2638
2639 def p_property_qualifier_opt_2(p):
2640 '''property_qualifier_opt : '''
2641 if(parse_debug):
2642 print('property_qualifier_opt_2', list(p))
2643
2644 # { p[0] = property_qualifier_t::make_none(); }
2645 ()
2646
2647
2648 def p_property_qualifier_list_1(p):
2649 '''property_qualifier_list : property_qualifier_list property_qualifier '''
2650 if(parse_debug):
2651 print('property_qualifier_list_1', list(p))
2652
2653 # { p[0] = p[1] | p[2]; }
2654 ()
2655
2656
2657 def p_property_qualifier_list_2(p):
2658 '''property_qualifier_list : property_qualifier '''
2659 if(parse_debug):
2660 print('property_qualifier_list_2', list(p))
2661 p[0] = p[1]
2662
2663
2664 ()
2665
2666
2667 def p_property_spec_1(p):
2668 '''property_spec : clocking_event_opt property_spec_disable_iff_opt property_expr '''
2669 if(parse_debug):
2670 print('property_spec_1', list(p))
2671
2672
2673 ()
2674
2675
2676 def p_property_spec_disable_iff_opt_1(p):
2677 '''property_spec_disable_iff_opt : K_disable K_iff '(' expression ')' '''
2678 if(parse_debug):
2679 print('property_spec_disable_iff_opt_1', list(p))
2680
2681
2682 ()
2683
2684
2685 def p_property_spec_disable_iff_opt_2(p):
2686 '''property_spec_disable_iff_opt : '''
2687 if(parse_debug):
2688 print('property_spec_disable_iff_opt_2', list(p))
2689
2690
2691 ()
2692
2693
2694 def p_random_qualifier_1(p):
2695 '''random_qualifier : K_rand '''
2696 if(parse_debug):
2697 print('random_qualifier_1', list(p))
2698
2699 # { p[0] = property_qualifier_t::make_rand(); }
2700 ()
2701
2702
2703 def p_random_qualifier_2(p):
2704 '''random_qualifier : K_randc '''
2705 if(parse_debug):
2706 print('random_qualifier_2', list(p))
2707
2708 # { p[0] = property_qualifier_t::make_randc(); }
2709 ()
2710
2711
2712 def p_real_or_realtime_1(p):
2713 '''real_or_realtime : K_real '''
2714 if(parse_debug):
2715 print('real_or_realtime_1', list(p))
2716
2717
2718 ()
2719
2720
2721 def p_real_or_realtime_2(p):
2722 '''real_or_realtime : K_realtime '''
2723 if(parse_debug):
2724 print('real_or_realtime_2', list(p))
2725
2726
2727 ()
2728
2729
2730 def p_signing_1(p):
2731 '''signing : K_signed '''
2732 if(parse_debug):
2733 print('signing_1', list(p))
2734 p[0] = True
2735
2736
2737 ()
2738
2739
2740 def p_signing_2(p):
2741 '''signing : K_unsigned '''
2742 if(parse_debug):
2743 print('signing_2', list(p))
2744 p[0] = False
2745
2746
2747 ()
2748
2749
2750 def p_simple_type_or_string_1(p):
2751 '''simple_type_or_string : integer_vector_type '''
2752 if(parse_debug):
2753 print('simple_type_or_string_1', list(p))
2754
2755 # { ivl_variable_type_t use_vtype = p[1];
2756 # bool reg_flag = false;
2757 # if (use_vtype == IVL_VT_NO_TYPE) {
2758 # use_vtype = IVL_VT_LOGIC;
2759 # reg_flag = true;
2760 # }
2761 # vector_type_t*tmp = new vector_type_t(use_vtype, false, 0);
2762 # tmp->reg_flag = reg_flag;
2763 # FILE_NAME(tmp, @1);
2764 # p[0] = tmp;
2765 # }
2766 ()
2767
2768
2769 def p_simple_type_or_string_2(p):
2770 '''simple_type_or_string : non_integer_type '''
2771 if(parse_debug):
2772 print('simple_type_or_string_2', list(p))
2773
2774 # { real_type_t*tmp = new real_type_t(p[1]);
2775 # FILE_NAME(tmp, @1);
2776 # p[0] = tmp;
2777 # }
2778 ()
2779
2780
2781 def p_simple_type_or_string_3(p):
2782 '''simple_type_or_string : atom2_type '''
2783 if(parse_debug):
2784 print('simple_type_or_string_3', list(p))
2785
2786 # { atom2_type_t*tmp = new atom2_type_t(p[1], true);
2787 # FILE_NAME(tmp, @1);
2788 # p[0] = tmp;
2789 # }
2790 ()
2791
2792
2793 def p_simple_type_or_string_4(p):
2794 '''simple_type_or_string : K_integer '''
2795 if(parse_debug):
2796 print('simple_type_or_string_4', list(p))
2797
2798 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
2799 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd);
2800 # tmp->reg_flag = true;
2801 # tmp->integer_flag = true;
2802 # p[0] = tmp;
2803 # }
2804 ()
2805
2806
2807 def p_simple_type_or_string_5(p):
2808 '''simple_type_or_string : K_time '''
2809 if(parse_debug):
2810 print('simple_type_or_string_5', list(p))
2811
2812 # { list<pform_range_t>*pd = make_range_from_width(64);
2813 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
2814 # tmp->reg_flag = !gn_system_verilog();
2815 # p[0] = tmp;
2816 # }
2817 ()
2818
2819
2820 def p_simple_type_or_string_6(p):
2821 '''simple_type_or_string : TYPE_IDENTIFIER '''
2822 if(parse_debug):
2823 print('simple_type_or_string_6', list(p))
2824
2825 # { p[0] = p[1].type;
2826 # delete[]p[1].text;
2827 # }
2828 ()
2829
2830
2831 def p_simple_type_or_string_7(p):
2832 '''simple_type_or_string : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_simple_type_or_string TYPE_IDENTIFIER '''
2833 if(parse_debug):
2834 print('simple_type_or_string_7', list(p))
2835
2836 # { lex_in_package_scope(0);
2837 # p[0] = p[4].type;
2838 # delete[]p[4].text;
2839 # }
2840 ()
2841
2842
2843 def p_simple_type_or_string_8(p):
2844 '''simple_type_or_string : K_string '''
2845 if(parse_debug):
2846 print('simple_type_or_string_8', list(p))
2847
2848 # { string_type_t*tmp = new string_type_t;
2849 # FILE_NAME(tmp, @1);
2850 # p[0] = tmp;
2851 # }
2852 ()
2853
2854
2855 def p__embed0_simple_type_or_string(p):
2856 '''_embed0_simple_type_or_string : '''
2857
2858 # { lex_in_package_scope(p[1]); }
2859 ()
2860
2861
2862 def p_statement_1(p):
2863 '''statement : attribute_list_opt statement_item '''
2864 if(parse_debug):
2865 print('statement_1', list(p))
2866
2867 # { pform_bind_attributes(p[2]->attributes, p[1]);
2868 # p[0] = p[2];
2869 # }
2870 ()
2871
2872
2873 def p_statement_or_null_1(p):
2874 '''statement_or_null : statement '''
2875 if(parse_debug):
2876 print('statement_or_null_1', list(p))
2877 p[0] = p[1]
2878
2879
2880 ()
2881
2882
2883 def p_statement_or_null_2(p):
2884 '''statement_or_null : attribute_list_opt ';' '''
2885 if(parse_debug):
2886 print('statement_or_null_2', list(p))
2887
2888 # { p[0] = None }
2889 ()
2890
2891
2892 def p_stream_expression_1(p):
2893 '''stream_expression : expression '''
2894 if(parse_debug):
2895 print('stream_expression_1', list(p))
2896
2897
2898 ()
2899
2900
2901 def p_stream_expression_list_1(p):
2902 '''stream_expression_list : stream_expression_list ',' stream_expression '''
2903 if(parse_debug):
2904 print('stream_expression_list_1', list(p))
2905
2906
2907 ()
2908
2909
2910 def p_stream_expression_list_2(p):
2911 '''stream_expression_list : stream_expression '''
2912 if(parse_debug):
2913 print('stream_expression_list_2', list(p))
2914
2915
2916 ()
2917
2918
2919 def p_stream_operator_1(p):
2920 '''stream_operator : K_LS '''
2921 if(parse_debug):
2922 print('stream_operator_1', list(p))
2923
2924
2925 ()
2926
2927
2928 def p_stream_operator_2(p):
2929 '''stream_operator : K_RS '''
2930 if(parse_debug):
2931 print('stream_operator_2', list(p))
2932
2933
2934 ()
2935
2936
2937 def p_streaming_concatenation_1(p):
2938 '''streaming_concatenation : '{' stream_operator '{' stream_expression_list '}' '}' '''
2939 if(parse_debug):
2940 print('streaming_concatenation_1', list(p))
2941
2942 # { /* streaming concatenation is a SystemVerilog thing. */
2943 # if (gn_system_verilog()) {
2944 # yyerror(@2, "sorry: Streaming concatenation not supported.");
2945 # p[0] = None
2946 # } else {
2947 # yyerror(@2, "error: Streaming concatenation requires SystemVerilog");
2948 # p[0] = None
2949 # }
2950 # }
2951 ()
2952
2953
2954 def p_task_declaration_1(p):
2955 '''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 '''
2956 if(parse_debug):
2957 print('task_declaration_1', list(p))
2958
2959 # { // Last step: check any closing name. This is done late so
2960 # // that the parser can look ahead to detect the present
2961 # // endlabel_opt but still have the pform_endmodule() called
2962 # // early enough that the lexor can know we are outside the
2963 # // module.
2964 # if (p[10]) {
2965 # if (strcmp(p[3],p[10]) != 0) {
2966 # yyerror(@10, "error: End label doesn't match task name");
2967 # }
2968 # if (! gn_system_verilog()) {
2969 # yyerror(@10, "error: Task end labels require "
2970 # "SystemVerilog.");
2971 # }
2972 # delete[]p[10];
2973 # }
2974 # delete[]p[3];
2975 # }
2976 ()
2977
2978
2979 def p_task_declaration_2(p):
2980 '''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 '''
2981 if(parse_debug):
2982 print('task_declaration_2', list(p))
2983
2984 # { // Last step: check any closing name. This is done late so
2985 # // that the parser can look ahead to detect the present
2986 # // endlabel_opt but still have the pform_endmodule() called
2987 # // early enough that the lexor can know we are outside the
2988 # // module.
2989 # if (p[13]) {
2990 # if (strcmp(p[3],p[13]) != 0) {
2991 # yyerror(@13, "error: End label doesn't match task name");
2992 # }
2993 # if (! gn_system_verilog()) {
2994 # yyerror(@13, "error: Task end labels require "
2995 # "SystemVerilog.");
2996 # }
2997 # delete[]p[13];
2998 # }
2999 # delete[]p[3];
3000 # }
3001 ()
3002
3003
3004 def p_task_declaration_3(p):
3005 '''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 '''
3006 if(parse_debug):
3007 print('task_declaration_3', list(p))
3008
3009 # { // Last step: check any closing name. This is done late so
3010 # // that the parser can look ahead to detect the present
3011 # // endlabel_opt but still have the pform_endmodule() called
3012 # // early enough that the lexor can know we are outside the
3013 # // module.
3014 # if (p[12]) {
3015 # if (strcmp(p[3],p[12]) != 0) {
3016 # yyerror(@12, "error: End label doesn't match task name");
3017 # }
3018 # if (! gn_system_verilog()) {
3019 # yyerror(@12, "error: Task end labels require "
3020 # "SystemVerilog.");
3021 # }
3022 # delete[]p[12];
3023 # }
3024 # delete[]p[3];
3025 # }
3026 ()
3027
3028
3029 def p_task_declaration_4(p):
3030 '''task_declaration : K_task lifetime_opt IDENTIFIER error K_endtask _embed6_task_declaration endlabel_opt '''
3031 if(parse_debug):
3032 print('task_declaration_4', list(p))
3033
3034 # { // Last step: check any closing name. This is done late so
3035 # // that the parser can look ahead to detect the present
3036 # // endlabel_opt but still have the pform_endmodule() called
3037 # // early enough that the lexor can know we are outside the
3038 # // module.
3039 # if (p[7]) {
3040 # if (strcmp(p[3],p[7]) != 0) {
3041 # yyerror(@7, "error: End label doesn't match task name");
3042 # }
3043 # if (! gn_system_verilog()) {
3044 # yyerror(@7, "error: Task end labels require "
3045 # "SystemVerilog.");
3046 # }
3047 # delete[]p[7];
3048 # }
3049 # delete[]p[3];
3050 # }
3051 ()
3052
3053
3054 def p__embed0_task_declaration(p):
3055 '''_embed0_task_declaration : '''
3056
3057 # { assert(current_task == 0);
3058 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3059 # }
3060 ()
3061
3062
3063 def p__embed1_task_declaration(p):
3064 '''_embed1_task_declaration : '''
3065
3066 # { current_task->set_ports(p[6]);
3067 # current_task_set_statement(@3, p[7]);
3068 # pform_set_this_class(@3, current_task);
3069 # pform_pop_scope();
3070 # current_task = 0;
3071 # if (p[7] && p[7]->size() > 1 && !gn_system_verilog()) {
3072 # yyerror(@7, "error: Task body with multiple statements requires SystemVerilog.");
3073 # }
3074 # delete p[7];
3075 # }
3076 ()
3077
3078
3079 def p__embed2_task_declaration(p):
3080 '''_embed2_task_declaration : '''
3081
3082 # { assert(current_task == 0);
3083 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3084 # }
3085 ()
3086
3087
3088 def p__embed3_task_declaration(p):
3089 '''_embed3_task_declaration : '''
3090
3091 # { current_task->set_ports(p[6]);
3092 # current_task_set_statement(@3, p[10]);
3093 # pform_set_this_class(@3, current_task);
3094 # pform_pop_scope();
3095 # current_task = 0;
3096 # if (p[10]) delete p[10];
3097 # }
3098 ()
3099
3100
3101 def p__embed4_task_declaration(p):
3102 '''_embed4_task_declaration : '''
3103
3104 # { assert(current_task == 0);
3105 # current_task = pform_push_task_scope(@1, p[3], p[2]);
3106 # }
3107 ()
3108
3109
3110 def p__embed5_task_declaration(p):
3111 '''_embed5_task_declaration : '''
3112
3113 # { current_task->set_ports(0);
3114 # current_task_set_statement(@3, p[9]);
3115 # pform_set_this_class(@3, current_task);
3116 # if (! current_task->method_of()) {
3117 # cerr << @3 << ": warning: task definition for \"" << p[3]
3118 # << "\" has an empty port declaration list!" << endl;
3119 # }
3120 # pform_pop_scope();
3121 # current_task = 0;
3122 # if (p[9]->size() > 1 && !gn_system_verilog()) {
3123 # yyerror(@9, "error: Task body with multiple statements requires SystemVerilog.");
3124 # }
3125 # delete p[9];
3126 # }
3127 ()
3128
3129
3130 def p__embed6_task_declaration(p):
3131 '''_embed6_task_declaration : '''
3132
3133 # {
3134 # if (current_task) {
3135 # pform_pop_scope();
3136 # current_task = 0;
3137 # }
3138 # }
3139 ()
3140
3141
3142 def p_tf_port_declaration_1(p):
3143 '''tf_port_declaration : port_direction K_reg_opt unsigned_signed_opt dimensions_opt list_of_identifiers ';' '''
3144 if(parse_debug):
3145 print('tf_port_declaration_1', list(p))
3146
3147 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1],
3148 # p[2] ? IVL_VT_LOGIC :
3149 # IVL_VT_NO_TYPE,
3150 # p[3], p[4], p[5]);
3151 # p[0] = tmp;
3152 # }
3153 ()
3154
3155
3156 def p_tf_port_declaration_2(p):
3157 '''tf_port_declaration : port_direction K_integer list_of_identifiers ';' '''
3158 if(parse_debug):
3159 print('tf_port_declaration_2', list(p))
3160
3161 # { list<pform_range_t>*range_stub = make_range_from_width(integer_width);
3162 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, true,
3163 # range_stub, p[3], true);
3164 # p[0] = tmp;
3165 # }
3166 ()
3167
3168
3169 def p_tf_port_declaration_3(p):
3170 '''tf_port_declaration : port_direction K_time list_of_identifiers ';' '''
3171 if(parse_debug):
3172 print('tf_port_declaration_3', list(p))
3173
3174 # { list<pform_range_t>*range_stub = make_range_from_width(64);
3175 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_LOGIC, false,
3176 # range_stub, p[3]);
3177 # p[0] = tmp;
3178 # }
3179 ()
3180
3181
3182 def p_tf_port_declaration_4(p):
3183 '''tf_port_declaration : port_direction real_or_realtime list_of_identifiers ';' '''
3184 if(parse_debug):
3185 print('tf_port_declaration_4', list(p))
3186
3187 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_REAL, true,
3188 # 0, p[3]);
3189 # p[0] = tmp;
3190 # }
3191 ()
3192
3193
3194 def p_tf_port_declaration_5(p):
3195 '''tf_port_declaration : port_direction K_string list_of_identifiers ';' '''
3196 if(parse_debug):
3197 print('tf_port_declaration_5', list(p))
3198
3199 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, p[1], IVL_VT_STRING, true,
3200 # 0, p[3]);
3201 # p[0] = tmp;
3202 # }
3203 ()
3204
3205
3206 def p_tf_port_item_1(p):
3207 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER dimensions_opt tf_port_item_expr_opt '''
3208 if(parse_debug):
3209 print('tf_port_item_1', list(p))
3210
3211 # { vector<pform_tf_port_t>*tmp;
3212 # NetNet::PortType use_port_type = p[1];
3213 # if ((use_port_type == NetNet::PIMPLICIT) && (gn_system_verilog() || (p[2] == 0)))
3214 # use_port_type = port_declaration_context.port_type;
3215 # perm_string name = lex_strings.make(p[3]);
3216 # list<perm_string>* ilist = list_from_identifier(p[3]);
3217 #
3218 # if (use_port_type == NetNet::PIMPLICIT) {
3219 # yyerror(@1, "error: missing task/function port direction.");
3220 # use_port_type = NetNet::PINPUT; // for error recovery
3221 # }
3222 # if ((p[2] == 0) && (p[1]==NetNet::PIMPLICIT)) {
3223 # // Detect special case this is an undecorated
3224 # // identifier and we need to get the declaration from
3225 # // left context.
3226 # if (p[4] != 0) {
3227 # yyerror(@4, "internal error: How can there be an unpacked range here?\n");
3228 # }
3229 # tmp = pform_make_task_ports(@3, use_port_type,
3230 # port_declaration_context.data_type,
3231 # ilist);
3232 #
3233 # } else {
3234 # // Otherwise, the decorations for this identifier
3235 # // indicate the type. Save the type for any right
3236 # // context that may come later.
3237 # port_declaration_context.port_type = use_port_type;
3238 # if (p[2] == 0) {
3239 # p[2] = new vector_type_t(IVL_VT_LOGIC, false, 0);
3240 # FILE_NAME(p[2], @3);
3241 # }
3242 # port_declaration_context.data_type = p[2];
3243 # tmp = pform_make_task_ports(@3, use_port_type, p[2], ilist);
3244 # }
3245 # if (p[4] != 0) {
3246 # pform_set_reg_idx(name, p[4]);
3247 # }
3248 #
3249 # p[0] = tmp;
3250 # if (p[5]) {
3251 # assert(tmp->size()==1);
3252 # tmp->front().defe = p[5];
3253 # }
3254 # }
3255 ()
3256
3257
3258 def p_tf_port_item_2(p):
3259 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER error '''
3260 if(parse_debug):
3261 print('tf_port_item_2', list(p))
3262
3263 # { yyerror(@3, "error: Error in task/function port item after port name %s.", p[3]);
3264 # yyerrok;
3265 # p[0] = None
3266 # }
3267 ()
3268
3269
3270 def p_tf_port_item_expr_opt_1(p):
3271 '''tf_port_item_expr_opt : '=' expression '''
3272 if(parse_debug):
3273 print('tf_port_item_expr_opt_1', list(p))
3274
3275 # { if (! gn_system_verilog()) {
3276 # yyerror(@1, "error: Task/function default arguments require "
3277 # "SystemVerilog.");
3278 # }
3279 # p[0] = p[2];
3280 # }
3281 ()
3282
3283
3284 def p_tf_port_item_expr_opt_2(p):
3285 '''tf_port_item_expr_opt : '''
3286 if(parse_debug):
3287 print('tf_port_item_expr_opt_2', list(p))
3288
3289 # { p[0] = None }
3290 ()
3291
3292
3293 def p_tf_port_list_1(p):
3294 '''tf_port_list : _embed0_tf_port_list tf_port_item_list '''
3295 if(parse_debug):
3296 print('tf_port_list_1', list(p))
3297 p[0] = p[2]
3298
3299
3300 ()
3301
3302
3303 def p__embed0_tf_port_list(p):
3304 '''_embed0_tf_port_list : '''
3305
3306 # { port_declaration_context.port_type = gn_system_verilog() ? NetNet::PINPUT : NetNet::PIMPLICIT;
3307 # port_declaration_context.data_type = 0;
3308 # }
3309 ()
3310
3311
3312 def p_tf_port_item_list_1(p):
3313 '''tf_port_item_list : tf_port_item_list ',' tf_port_item '''
3314 if(parse_debug):
3315 print('tf_port_item_list_1', list(p))
3316
3317 # { vector<pform_tf_port_t>*tmp;
3318 # if (p[1] && p[3]) {
3319 # size_t s1 = p[1]->size();
3320 # tmp = p[1];
3321 # tmp->resize(tmp->size()+p[3]->size());
3322 # for (size_t idx = 0 ; idx < p[3]->size() ; idx += 1)
3323 # tmp->at(s1+idx) = p[3]->at(idx);
3324 # delete p[3];
3325 # } else if (p[1]) {
3326 # tmp = p[1];
3327 # } else {
3328 # tmp = p[3];
3329 # }
3330 # p[0] = tmp;
3331 # }
3332 ()
3333
3334
3335 def p_tf_port_item_list_2(p):
3336 '''tf_port_item_list : tf_port_item '''
3337 if(parse_debug):
3338 print('tf_port_item_list_2', list(p))
3339 p[0] = p[1]
3340
3341
3342 ()
3343
3344
3345 def p_tf_port_item_list_3(p):
3346 '''tf_port_item_list : error ',' tf_port_item '''
3347 if(parse_debug):
3348 print('tf_port_item_list_3', list(p))
3349
3350 # { yyerror(@2, "error: Syntax error in task/function port declaration.");
3351 # p[0] = p[3];
3352 # }
3353 ()
3354
3355
3356 def p_tf_port_item_list_4(p):
3357 '''tf_port_item_list : tf_port_item_list ',' '''
3358 if(parse_debug):
3359 print('tf_port_item_list_4', list(p))
3360
3361 # { yyerror(@2, "error: NULL port declarations are not allowed.");
3362 # p[0] = p[1];
3363 # }
3364 ()
3365
3366
3367 def p_tf_port_item_list_5(p):
3368 '''tf_port_item_list : tf_port_item_list ';' '''
3369 if(parse_debug):
3370 print('tf_port_item_list_5', list(p))
3371
3372 # { yyerror(@2, "error: ';' is an invalid port declaration separator.");
3373 # p[0] = p[1];
3374 # }
3375 ()
3376
3377
3378 def p_timeunits_declaration_1(p):
3379 '''timeunits_declaration : K_timeunit TIME_LITERAL ';' '''
3380 if(parse_debug):
3381 print('timeunits_declaration_1', list(p))
3382
3383 # { pform_set_timeunit(p[2], allow_timeunit_decl); }
3384 ()
3385
3386
3387 def p_timeunits_declaration_2(p):
3388 '''timeunits_declaration : K_timeunit TIME_LITERAL '/' TIME_LITERAL ';' '''
3389 if(parse_debug):
3390 print('timeunits_declaration_2', list(p))
3391
3392 # { bool initial_decl = allow_timeunit_decl && allow_timeprec_decl;
3393 # pform_set_timeunit(p[2], initial_decl);
3394 # pform_set_timeprec(p[4], initial_decl);
3395 # }
3396 ()
3397
3398
3399 def p_timeunits_declaration_3(p):
3400 '''timeunits_declaration : K_timeprecision TIME_LITERAL ';' '''
3401 if(parse_debug):
3402 print('timeunits_declaration_3', list(p))
3403
3404 # { pform_set_timeprec(p[2], allow_timeprec_decl); }
3405 ()
3406
3407
3408 def p_timeunits_declaration_opt_1(p):
3409 '''timeunits_declaration_opt : %prec no_timeunits_declaration '''
3410 if(parse_debug > 2):
3411 print('timeunits_declaration_opt_1', list(p))
3412
3413
3414 ()
3415
3416
3417 def p_timeunits_declaration_opt_2(p):
3418 '''timeunits_declaration_opt : timeunits_declaration %prec one_timeunits_declaration '''
3419 if(parse_debug):
3420 print('timeunits_declaration_opt_2', list(p))
3421
3422
3423 ()
3424
3425
3426 def p_timeunits_declaration_opt_3(p):
3427 '''timeunits_declaration_opt : timeunits_declaration timeunits_declaration '''
3428 if(parse_debug):
3429 print('timeunits_declaration_opt_3', list(p))
3430
3431
3432 ()
3433
3434
3435 def p_value_range_1(p):
3436 '''value_range : expression '''
3437 if(parse_debug):
3438 print('value_range_1', list(p))
3439
3440 # { }
3441 ()
3442
3443
3444 def p_value_range_2(p):
3445 '''value_range : '[' expression ':' expression ']' '''
3446 if(parse_debug):
3447 print('value_range_2', list(p))
3448
3449 # { }
3450 ()
3451
3452
3453 def p_variable_dimension_1(p):
3454 '''variable_dimension : '[' expression ':' expression ']' '''
3455 if(parse_debug):
3456 print('variable_dimension_1', list(p))
3457 # { list<pform_range_t> *tmp = new list<pform_range_t>;
3458 # pform_range_t index (p[2],p[4]);
3459 # tmp->push_back(index);
3460 # p[0] = tmp;
3461 # }
3462 # XXX TODO: subscriptlist
3463 start = str(p[4])
3464 end = str(p[2])
3465 if end.endswith("-1"):
3466 end = end[:-2]
3467 elif end.isdigit():
3468 end = str(int(end)+1)
3469 else:
3470 end = "1+%s" % end
3471 p[0] = '[%s:%s]' % (start, end) # python slice is LO:HI+1
3472
3473
3474 ()
3475
3476
3477 def p_variable_dimension_2(p):
3478 '''variable_dimension : '[' expression ']' '''
3479 if(parse_debug):
3480 print('variable_dimension_2', list(p))
3481
3482 # { // SystemVerilog canonical range
3483 # if (!gn_system_verilog()) {
3484 # warn_count += 1;
3485 # cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. "
3486 # << "Use at least -g2005-sv to remove this warning." << endl;
3487 # }
3488 # list<pform_range_t> *tmp = new list<pform_range_t>;
3489 # pform_range_t index;
3490 # index.first = new PENumber(new verinum((uint64_t)0, integer_width));
3491 # index.second = new PEBinary('-', p[2], new PENumber(new verinum((uint64_t)1, integer_width)));
3492 # tmp->push_back(index);
3493 # p[0] = tmp;
3494 # }
3495 ()
3496
3497
3498 def p_variable_dimension_3(p):
3499 '''variable_dimension : '[' ']' '''
3500 if(parse_debug):
3501 print('variable_dimension_3', list(p))
3502
3503 # { list<pform_range_t> *tmp = new list<pform_range_t>;
3504 # pform_range_t index (0,0);
3505 # tmp->push_back(index);
3506 # p[0] = tmp;
3507 # }
3508 ()
3509
3510
3511 def p_variable_dimension_4(p):
3512 '''variable_dimension : '[' '$' ']' '''
3513 if(parse_debug):
3514 print('variable_dimension_4', list(p))
3515
3516 # { // SystemVerilog queue
3517 # list<pform_range_t> *tmp = new list<pform_range_t>;
3518 # pform_range_t index (new PENull,0);
3519 # if (!gn_system_verilog()) {
3520 # yyerror("error: Queue declarations require SystemVerilog.");
3521 # }
3522 # tmp->push_back(index);
3523 # p[0] = tmp;
3524 # }
3525 ()
3526
3527
3528 def p_variable_lifetime_1(p):
3529 '''variable_lifetime : lifetime '''
3530 if(parse_debug):
3531 print('variable_lifetime_1', list(p))
3532
3533 # { if (!gn_system_verilog()) {
3534 # yyerror(@1, "error: overriding the default variable lifetime "
3535 # "requires SystemVerilog.");
3536 # } else if (p[1] != pform_peek_scope()->default_lifetime) {
3537 # yyerror(@1, "sorry: overriding the default variable lifetime "
3538 # "is not yet supported.");
3539 # }
3540 # var_lifetime = p[1];
3541 # }
3542 ()
3543
3544
3545 def p_attribute_list_opt_1(p):
3546 '''attribute_list_opt : attribute_instance_list '''
3547 if(parse_debug):
3548 print('attribute_list_opt_1', list(p))
3549 p[0] = p[1]
3550
3551
3552 ()
3553
3554
3555 def p_attribute_list_opt_2(p):
3556 '''attribute_list_opt : '''
3557 if(parse_debug > 2):
3558 print('attribute_list_opt_2', list(p))
3559
3560 # { p[0] = None }
3561 ()
3562
3563
3564 def p_attribute_instance_list_1(p):
3565 '''attribute_instance_list : K_PSTAR K_STARP '''
3566 if(parse_debug):
3567 print('attribute_instance_list_1', list(p))
3568
3569 # { p[0] = None }
3570 ()
3571
3572
3573 def p_attribute_instance_list_2(p):
3574 '''attribute_instance_list : K_PSTAR attribute_list K_STARP '''
3575 if(parse_debug):
3576 print('attribute_instance_list_2', list(p))
3577 p[0] = p[2]
3578
3579
3580 ()
3581
3582
3583 def p_attribute_instance_list_3(p):
3584 '''attribute_instance_list : attribute_instance_list K_PSTAR K_STARP '''
3585 if(parse_debug):
3586 print('attribute_instance_list_3', list(p))
3587 p[0] = p[1]
3588
3589
3590 ()
3591
3592
3593 def p_attribute_instance_list_4(p):
3594 '''attribute_instance_list : attribute_instance_list K_PSTAR attribute_list K_STARP '''
3595 if(parse_debug):
3596 print('attribute_instance_list_4', list(p))
3597
3598 # { list<named_pexpr_t>*tmp = p[1];
3599 # if (tmp) {
3600 # tmp->splice(tmp->end(), *p[3]);
3601 # delete p[3];
3602 # p[0] = tmp;
3603 # } else p[0] = p[3];
3604 # }
3605 ()
3606
3607
3608 def p_attribute_list_1(p):
3609 '''attribute_list : attribute_list ',' attribute '''
3610 if(parse_debug):
3611 print('attribute_list_1', list(p))
3612
3613 # { list<named_pexpr_t>*tmp = p[1];
3614 # tmp->push_back(*p[3]);
3615 # delete p[3];
3616 # p[0] = tmp;
3617 # }
3618 ()
3619
3620
3621 def p_attribute_list_2(p):
3622 '''attribute_list : attribute '''
3623 if(parse_debug):
3624 print('attribute_list_2', list(p))
3625
3626 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
3627 # tmp->push_back(*p[1]);
3628 # delete p[1];
3629 # p[0] = tmp;
3630 # }
3631 ()
3632
3633
3634 def p_attribute_1(p):
3635 '''attribute : IDENTIFIER '''
3636 if(parse_debug):
3637 print('attribute_1', list(p))
3638
3639 # { named_pexpr_t*tmp = new named_pexpr_t;
3640 # tmp->name = lex_strings.make(p[1]);
3641 # tmp->parm = 0;
3642 # delete[]p[1];
3643 # p[0] = tmp;
3644 # }
3645 ()
3646
3647
3648 def p_attribute_2(p):
3649 '''attribute : IDENTIFIER '=' expression '''
3650 if(parse_debug):
3651 print('attribute_2', list(p))
3652
3653 # { PExpr*tmp = p[3];
3654 # named_pexpr_t*tmp2 = new named_pexpr_t;
3655 # tmp2->name = lex_strings.make(p[1]);
3656 # tmp2->parm = tmp;
3657 # delete[]p[1];
3658 # p[0] = tmp2;
3659 # }
3660 ()
3661
3662
3663 def p_block_item_decl_1(p):
3664 '''block_item_decl : data_type register_variable_list ';' '''
3665 if(parse_debug):
3666 print('block_item_decl_1', list(p))
3667
3668 # { if (p[1]) pform_set_data_type(@1, p[1], p[2], NetNet::REG, attributes_in_context);
3669 # }
3670 ()
3671
3672
3673 def p_block_item_decl_2(p):
3674 '''block_item_decl : variable_lifetime data_type register_variable_list ';' '''
3675 if(parse_debug):
3676 print('block_item_decl_2', list(p))
3677
3678 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
3679 # var_lifetime = LexicalScope::INHERITED;
3680 # }
3681 ()
3682
3683
3684 def p_block_item_decl_3(p):
3685 '''block_item_decl : K_reg data_type register_variable_list ';' '''
3686 if(parse_debug):
3687 print('block_item_decl_3', list(p))
3688
3689 # { if (p[2]) pform_set_data_type(@2, p[2], p[3], NetNet::REG, attributes_in_context);
3690 # }
3691 ()
3692
3693
3694 def p_block_item_decl_4(p):
3695 '''block_item_decl : variable_lifetime K_reg data_type register_variable_list ';' '''
3696 if(parse_debug):
3697 print('block_item_decl_4', list(p))
3698
3699 # { if (p[3]) pform_set_data_type(@3, p[3], p[4], NetNet::REG, attributes_in_context);
3700 # var_lifetime = LexicalScope::INHERITED;
3701 # }
3702 ()
3703
3704
3705 def p_block_item_decl_5(p):
3706 '''block_item_decl : K_event event_variable_list ';' '''
3707 if(parse_debug):
3708 print('block_item_decl_5', list(p))
3709
3710 # { if (p[2]) pform_make_events(p[2], @1.text, @1.first_line);
3711 # }
3712 ()
3713
3714
3715 def p_block_item_decl_6(p):
3716 '''block_item_decl : K_parameter param_type parameter_assign_list ';' '''
3717 if(parse_debug):
3718 print('block_item_decl_6', list(p))
3719
3720
3721 ()
3722
3723
3724 def p_block_item_decl_7(p):
3725 '''block_item_decl : K_localparam param_type localparam_assign_list ';' '''
3726 if(parse_debug):
3727 print('block_item_decl_7', list(p))
3728
3729
3730 ()
3731
3732
3733 def p_block_item_decl_8(p):
3734 '''block_item_decl : type_declaration '''
3735 if(parse_debug):
3736 print('block_item_decl_8', list(p))
3737
3738
3739 ()
3740
3741
3742 def p_block_item_decl_9(p):
3743 '''block_item_decl : K_integer error ';' '''
3744 if(parse_debug):
3745 print('block_item_decl_9', list(p))
3746
3747 # { yyerror(@1, "error: syntax error in integer variable list.");
3748 # yyerrok;
3749 # }
3750 ()
3751
3752
3753 def p_block_item_decl_10(p):
3754 '''block_item_decl : K_time error ';' '''
3755 if(parse_debug):
3756 print('block_item_decl_10', list(p))
3757
3758 # { yyerror(@1, "error: syntax error in time variable list.");
3759 # yyerrok;
3760 # }
3761 ()
3762
3763
3764 def p_block_item_decl_11(p):
3765 '''block_item_decl : K_parameter error ';' '''
3766 if(parse_debug):
3767 print('block_item_decl_11', list(p))
3768
3769 # { yyerror(@1, "error: syntax error in parameter list.");
3770 # yyerrok;
3771 # }
3772 ()
3773
3774
3775 def p_block_item_decl_12(p):
3776 '''block_item_decl : K_localparam error ';' '''
3777 if(parse_debug):
3778 print('block_item_decl_12', list(p))
3779
3780 # { yyerror(@1, "error: syntax error localparam list.");
3781 # yyerrok;
3782 # }
3783 ()
3784
3785
3786 def p_block_item_decls_1(p):
3787 '''block_item_decls : block_item_decl '''
3788 if(parse_debug):
3789 print('block_item_decls_1', list(p))
3790
3791
3792 ()
3793
3794
3795 def p_block_item_decls_2(p):
3796 '''block_item_decls : block_item_decls block_item_decl '''
3797 if(parse_debug):
3798 print('block_item_decls_2', list(p))
3799
3800
3801 ()
3802
3803
3804 def p_block_item_decls_opt_1(p):
3805 '''block_item_decls_opt : block_item_decls '''
3806 if(parse_debug):
3807 print('block_item_decls_opt_1', list(p))
3808 p[0] = True
3809
3810
3811 ()
3812
3813
3814 def p_block_item_decls_opt_2(p):
3815 '''block_item_decls_opt : '''
3816 if(parse_debug):
3817 print('block_item_decls_opt_2', list(p))
3818 p[0] = False
3819
3820
3821 ()
3822
3823
3824 def p_type_declaration_1(p):
3825 '''type_declaration : K_typedef data_type IDENTIFIER dimensions_opt ';' '''
3826 if(parse_debug):
3827 print('type_declaration_1', list(p))
3828
3829 # { perm_string name = lex_strings.make(p[3]);
3830 # pform_set_typedef(name, p[2], p[4]);
3831 # delete[]p[3];
3832 # }
3833 ()
3834
3835
3836 def p_type_declaration_2(p):
3837 '''type_declaration : K_typedef data_type TYPE_IDENTIFIER ';' '''
3838 if(parse_debug):
3839 print('type_declaration_2', list(p))
3840
3841 # { perm_string name = lex_strings.make(p[3].text);
3842 # if (pform_test_type_identifier_local(name)) {
3843 # yyerror(@3, "error: Typedef identifier \"%s\" is already a type name.", p[3].text);
3844 #
3845 # } else {
3846 # pform_set_typedef(name, p[2], NULL);
3847 # }
3848 # delete[]p[3].text;
3849 # }
3850 ()
3851
3852
3853 def p_type_declaration_3(p):
3854 '''type_declaration : K_typedef K_class IDENTIFIER ';' '''
3855 if(parse_debug):
3856 print('type_declaration_3', list(p))
3857
3858 # { // Create a synthetic typedef for the class name so that the
3859 # // lexor detects the name as a type.
3860 # perm_string name = lex_strings.make(p[3]);
3861 # class_type_t*tmp = new class_type_t(name);
3862 # FILE_NAME(tmp, @3);
3863 # pform_set_typedef(name, tmp, NULL);
3864 # delete[]p[3];
3865 # }
3866 ()
3867
3868
3869 def p_type_declaration_4(p):
3870 '''type_declaration : K_typedef K_enum IDENTIFIER ';' '''
3871 if(parse_debug):
3872 print('type_declaration_4', list(p))
3873
3874 # { yyerror(@1, "sorry: Enum forward declarations not supported yet."); }
3875 ()
3876
3877
3878 def p_type_declaration_5(p):
3879 '''type_declaration : K_typedef K_struct IDENTIFIER ';' '''
3880 if(parse_debug):
3881 print('type_declaration_5', list(p))
3882
3883 # { yyerror(@1, "sorry: Struct forward declarations not supported yet."); }
3884 ()
3885
3886
3887 def p_type_declaration_6(p):
3888 '''type_declaration : K_typedef K_union IDENTIFIER ';' '''
3889 if(parse_debug):
3890 print('type_declaration_6', list(p))
3891
3892 # { yyerror(@1, "sorry: Union forward declarations not supported yet."); }
3893 ()
3894
3895
3896 def p_type_declaration_7(p):
3897 '''type_declaration : K_typedef IDENTIFIER ';' '''
3898 if(parse_debug):
3899 print('type_declaration_7', list(p))
3900
3901 # { // Create a synthetic typedef for the class name so that the
3902 # // lexor detects the name as a type.
3903 # perm_string name = lex_strings.make(p[2]);
3904 # class_type_t*tmp = new class_type_t(name);
3905 # FILE_NAME(tmp, @2);
3906 # pform_set_typedef(name, tmp, NULL);
3907 # delete[]p[2];
3908 # }
3909 ()
3910
3911
3912 def p_type_declaration_8(p):
3913 '''type_declaration : K_typedef error ';' '''
3914 if(parse_debug):
3915 print('type_declaration_8', list(p))
3916
3917 # { yyerror(@2, "error: Syntax error in typedef clause.");
3918 # yyerrok;
3919 # }
3920 ()
3921
3922
3923 def p_enum_data_type_1(p):
3924 '''enum_data_type : K_enum '{' enum_name_list '}' '''
3925 if(parse_debug):
3926 print('enum_data_type_1', list(p))
3927
3928 # { enum_type_t*enum_type = new enum_type_t;
3929 # FILE_NAME(enum_type, @1);
3930 # enum_type->names .reset(p[3]);
3931 # enum_type->base_type = IVL_VT_BOOL;
3932 # enum_type->signed_flag = true;
3933 # enum_type->integer_flag = false;
3934 # enum_type->range.reset(make_range_from_width(32));
3935 # p[0] = enum_type;
3936 # }
3937 ()
3938
3939
3940 def p_enum_data_type_2(p):
3941 '''enum_data_type : K_enum atom2_type signed_unsigned_opt '{' enum_name_list '}' '''
3942 if(parse_debug):
3943 print('enum_data_type_2', list(p))
3944
3945 # { enum_type_t*enum_type = new enum_type_t;
3946 # FILE_NAME(enum_type, @1);
3947 # enum_type->names .reset(p[5]);
3948 # enum_type->base_type = IVL_VT_BOOL;
3949 # enum_type->signed_flag = p[3];
3950 # enum_type->integer_flag = false;
3951 # enum_type->range.reset(make_range_from_width(p[2]));
3952 # p[0] = enum_type;
3953 # }
3954 ()
3955
3956
3957 def p_enum_data_type_3(p):
3958 '''enum_data_type : K_enum K_integer signed_unsigned_opt '{' enum_name_list '}' '''
3959 if(parse_debug):
3960 print('enum_data_type_3', list(p))
3961
3962 # { enum_type_t*enum_type = new enum_type_t;
3963 # FILE_NAME(enum_type, @1);
3964 # enum_type->names .reset(p[5]);
3965 # enum_type->base_type = IVL_VT_LOGIC;
3966 # enum_type->signed_flag = p[3];
3967 # enum_type->integer_flag = true;
3968 # enum_type->range.reset(make_range_from_width(integer_width));
3969 # p[0] = enum_type;
3970 # }
3971 ()
3972
3973
3974 def p_enum_data_type_4(p):
3975 '''enum_data_type : K_enum K_logic unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
3976 if(parse_debug):
3977 print('enum_data_type_4', list(p))
3978
3979 # { enum_type_t*enum_type = new enum_type_t;
3980 # FILE_NAME(enum_type, @1);
3981 # enum_type->names .reset(p[6]);
3982 # enum_type->base_type = IVL_VT_LOGIC;
3983 # enum_type->signed_flag = p[3];
3984 # enum_type->integer_flag = false;
3985 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
3986 # p[0] = enum_type;
3987 # }
3988 ()
3989
3990
3991 def p_enum_data_type_5(p):
3992 '''enum_data_type : K_enum K_reg unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
3993 if(parse_debug):
3994 print('enum_data_type_5', list(p))
3995
3996 # { enum_type_t*enum_type = new enum_type_t;
3997 # FILE_NAME(enum_type, @1);
3998 # enum_type->names .reset(p[6]);
3999 # enum_type->base_type = IVL_VT_LOGIC;
4000 # enum_type->signed_flag = p[3];
4001 # enum_type->integer_flag = false;
4002 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4003 # p[0] = enum_type;
4004 # }
4005 ()
4006
4007
4008 def p_enum_data_type_6(p):
4009 '''enum_data_type : K_enum K_bit unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
4010 if(parse_debug):
4011 print('enum_data_type_6', list(p))
4012
4013 # { enum_type_t*enum_type = new enum_type_t;
4014 # FILE_NAME(enum_type, @1);
4015 # enum_type->names .reset(p[6]);
4016 # enum_type->base_type = IVL_VT_BOOL;
4017 # enum_type->signed_flag = p[3];
4018 # enum_type->integer_flag = false;
4019 # enum_type->range.reset(p[4] ? p[4] : make_range_from_width(1));
4020 # p[0] = enum_type;
4021 # }
4022 ()
4023
4024
4025 def p_enum_name_list_1(p):
4026 '''enum_name_list : enum_name '''
4027 if(parse_debug):
4028 print('enum_name_list_1', list(p))
4029
4030 # { p[0] = p[1];
4031 # }
4032 ()
4033
4034
4035 def p_enum_name_list_2(p):
4036 '''enum_name_list : enum_name_list ',' enum_name '''
4037 if(parse_debug):
4038 print('enum_name_list_2', list(p))
4039
4040 # { list<named_pexpr_t>*lst = p[1];
4041 # lst->splice(lst->end(), *p[3]);
4042 # delete p[3];
4043 # p[0] = lst;
4044 # }
4045 ()
4046
4047
4048 def p_pos_neg_number_1(p):
4049 '''pos_neg_number : number '''
4050 if(parse_debug):
4051 print('pos_neg_number_1', list(p))
4052
4053 # { p[0] = p[1];
4054 # }
4055 ()
4056
4057
4058 def p_pos_neg_number_2(p):
4059 '''pos_neg_number : '-' number '''
4060 if(parse_debug):
4061 print('pos_neg_number_2', list(p))
4062
4063 # { verinum tmp = -(*(p[2]));
4064 # *(p[2]) = tmp;
4065 # p[0] = p[2];
4066 # }
4067 ()
4068
4069
4070 def p_enum_name_1(p):
4071 '''enum_name : IDENTIFIER '''
4072 if(parse_debug):
4073 print('enum_name_1', list(p))
4074
4075 # { perm_string name = lex_strings.make(p[1]);
4076 # delete[]p[1];
4077 # p[0] = make_named_number(name);
4078 # }
4079 ()
4080
4081
4082 def p_enum_name_2(p):
4083 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '''
4084 if(parse_debug):
4085 print('enum_name_2', list(p))
4086
4087 # { perm_string name = lex_strings.make(p[1]);
4088 # long count = check_enum_seq_value(@1, p[3], false);
4089 # delete[]p[1];
4090 # p[0] = make_named_numbers(name, 0, count-1);
4091 # delete p[3];
4092 # }
4093 ()
4094
4095
4096 def p_enum_name_3(p):
4097 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '''
4098 if(parse_debug):
4099 print('enum_name_3', list(p))
4100
4101 # { perm_string name = lex_strings.make(p[1]);
4102 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
4103 # check_enum_seq_value(@1, p[5], true));
4104 # delete[]p[1];
4105 # delete p[3];
4106 # delete p[5];
4107 # }
4108 ()
4109
4110
4111 def p_enum_name_4(p):
4112 '''enum_name : IDENTIFIER '=' expression '''
4113 if(parse_debug):
4114 print('enum_name_4', list(p))
4115
4116 # { perm_string name = lex_strings.make(p[1]);
4117 # delete[]p[1];
4118 # p[0] = make_named_number(name, p[3]);
4119 # }
4120 ()
4121
4122
4123 def p_enum_name_5(p):
4124 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '=' expression '''
4125 if(parse_debug):
4126 print('enum_name_5', list(p))
4127
4128 # { perm_string name = lex_strings.make(p[1]);
4129 # long count = check_enum_seq_value(@1, p[3], false);
4130 # p[0] = make_named_numbers(name, 0, count-1, p[6]);
4131 # delete[]p[1];
4132 # delete p[3];
4133 # }
4134 ()
4135
4136
4137 def p_enum_name_6(p):
4138 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '=' expression '''
4139 if(parse_debug):
4140 print('enum_name_6', list(p))
4141
4142 # { perm_string name = lex_strings.make(p[1]);
4143 # p[0] = make_named_numbers(name, check_enum_seq_value(@1, p[3], true),
4144 # check_enum_seq_value(@1, p[5], true), p[8]);
4145 # delete[]p[1];
4146 # delete p[3];
4147 # delete p[5];
4148 # }
4149 ()
4150
4151
4152 def p_struct_data_type_1(p):
4153 '''struct_data_type : K_struct K_packed_opt '{' struct_union_member_list '}' '''
4154 if(parse_debug):
4155 print('struct_data_type_1', list(p))
4156
4157 # { struct_type_t*tmp = new struct_type_t;
4158 # FILE_NAME(tmp, @1);
4159 # tmp->packed_flag = p[2];
4160 # tmp->union_flag = false;
4161 # tmp->members .reset(p[4]);
4162 # p[0] = tmp;
4163 # }
4164 ()
4165
4166
4167 def p_struct_data_type_2(p):
4168 '''struct_data_type : K_union K_packed_opt '{' struct_union_member_list '}' '''
4169 if(parse_debug):
4170 print('struct_data_type_2', list(p))
4171
4172 # { struct_type_t*tmp = new struct_type_t;
4173 # FILE_NAME(tmp, @1);
4174 # tmp->packed_flag = p[2];
4175 # tmp->union_flag = true;
4176 # tmp->members .reset(p[4]);
4177 # p[0] = tmp;
4178 # }
4179 ()
4180
4181
4182 def p_struct_data_type_3(p):
4183 '''struct_data_type : K_struct K_packed_opt '{' error '}' '''
4184 if(parse_debug):
4185 print('struct_data_type_3', list(p))
4186
4187 # { yyerror(@3, "error: Errors in struct member list.");
4188 # yyerrok;
4189 # struct_type_t*tmp = new struct_type_t;
4190 # FILE_NAME(tmp, @1);
4191 # tmp->packed_flag = p[2];
4192 # tmp->union_flag = false;
4193 # p[0] = tmp;
4194 # }
4195 ()
4196
4197
4198 def p_struct_data_type_4(p):
4199 '''struct_data_type : K_union K_packed_opt '{' error '}' '''
4200 if(parse_debug):
4201 print('struct_data_type_4', list(p))
4202
4203 # { yyerror(@3, "error: Errors in union member list.");
4204 # yyerrok;
4205 # struct_type_t*tmp = new struct_type_t;
4206 # FILE_NAME(tmp, @1);
4207 # tmp->packed_flag = p[2];
4208 # tmp->union_flag = true;
4209 # p[0] = tmp;
4210 # }
4211 ()
4212
4213
4214 def p_struct_union_member_list_1(p):
4215 '''struct_union_member_list : struct_union_member_list struct_union_member '''
4216 if(parse_debug):
4217 print('struct_union_member_list_1', list(p))
4218
4219 # { list<struct_member_t*>*tmp = p[1];
4220 # tmp->push_back(p[2]);
4221 # p[0] = tmp;
4222 # }
4223 ()
4224
4225
4226 def p_struct_union_member_list_2(p):
4227 '''struct_union_member_list : struct_union_member '''
4228 if(parse_debug):
4229 print('struct_union_member_list_2', list(p))
4230
4231 # { list<struct_member_t*>*tmp = new list<struct_member_t*>;
4232 # tmp->push_back(p[1]);
4233 # p[0] = tmp;
4234 # }
4235 ()
4236
4237
4238 def p_struct_union_member_1(p):
4239 '''struct_union_member : attribute_list_opt data_type list_of_variable_decl_assignments ';' '''
4240 if(parse_debug):
4241 print('struct_union_member_1', list(p))
4242
4243 # { struct_member_t*tmp = new struct_member_t;
4244 # FILE_NAME(tmp, @2);
4245 # tmp->type .reset(p[2]);
4246 # tmp->names .reset(p[3]);
4247 # p[0] = tmp;
4248 # }
4249 ()
4250
4251
4252 def p_struct_union_member_2(p):
4253 '''struct_union_member : error ';' '''
4254 if(parse_debug):
4255 print('struct_union_member_2', list(p))
4256
4257 # { yyerror(@2, "Error in struct/union member.");
4258 # yyerrok;
4259 # p[0] = None
4260 # }
4261 ()
4262
4263
4264 def p_case_item_1(p):
4265 '''case_item : expression_list_proper ':' statement_or_null '''
4266 if(parse_debug):
4267 print('case_item_1', list(p))
4268
4269 # { PCase::Item*tmp = new PCase::Item;
4270 # tmp->expr = *p[1];
4271 # tmp->stat = p[3];
4272 # delete p[1];
4273 # p[0] = tmp;
4274 # }
4275 ()
4276
4277
4278 def p_case_item_2(p):
4279 '''case_item : K_default ':' statement_or_null '''
4280 if(parse_debug):
4281 print('case_item_2', list(p))
4282
4283 # { PCase::Item*tmp = new PCase::Item;
4284 # tmp->stat = p[3];
4285 # p[0] = tmp;
4286 # }
4287 ()
4288
4289
4290 def p_case_item_3(p):
4291 '''case_item : K_default statement_or_null '''
4292 if(parse_debug):
4293 print('case_item_3', list(p))
4294
4295 # { PCase::Item*tmp = new PCase::Item;
4296 # tmp->stat = p[2];
4297 # p[0] = tmp;
4298 # }
4299 ()
4300
4301
4302 def p_case_item_4(p):
4303 '''case_item : error ':' statement_or_null '''
4304 if(parse_debug):
4305 print('case_item_4', list(p))
4306
4307 # { yyerror(@2, "error: Incomprehensible case expression.");
4308 # yyerrok;
4309 # }
4310 ()
4311
4312
4313 def p_case_items_1(p):
4314 '''case_items : case_items case_item '''
4315 if(parse_debug):
4316 print('case_items_1', list(p))
4317
4318 # { svector<PCase::Item*>*tmp;
4319 # tmp = new svector<PCase::Item*>(*p[1], p[2]);
4320 # delete p[1];
4321 # p[0] = tmp;
4322 # }
4323 ()
4324
4325
4326 def p_case_items_2(p):
4327 '''case_items : case_item '''
4328 if(parse_debug):
4329 print('case_items_2', list(p))
4330
4331 # { svector<PCase::Item*>*tmp = new svector<PCase::Item*>(1);
4332 # (*tmp)[0] = p[1];
4333 # p[0] = tmp;
4334 # }
4335 ()
4336
4337
4338 def p_charge_strength_1(p):
4339 '''charge_strength : '(' K_small ')' '''
4340 if(parse_debug):
4341 print('charge_strength_1', list(p))
4342
4343
4344 ()
4345
4346
4347 def p_charge_strength_2(p):
4348 '''charge_strength : '(' K_medium ')' '''
4349 if(parse_debug):
4350 print('charge_strength_2', list(p))
4351
4352
4353 ()
4354
4355
4356 def p_charge_strength_3(p):
4357 '''charge_strength : '(' K_large ')' '''
4358 if(parse_debug):
4359 print('charge_strength_3', list(p))
4360
4361
4362 ()
4363
4364
4365 def p_charge_strength_opt_1(p):
4366 '''charge_strength_opt : charge_strength '''
4367 if(parse_debug):
4368 print('charge_strength_opt_1', list(p))
4369
4370
4371 ()
4372
4373
4374 def p_charge_strength_opt_2(p):
4375 '''charge_strength_opt : '''
4376 if(parse_debug):
4377 print('charge_strength_opt_2', list(p))
4378
4379
4380 ()
4381
4382
4383 def p_defparam_assign_1(p):
4384 '''defparam_assign : hierarchy_identifier '=' expression '''
4385 if(parse_debug):
4386 print('defparam_assign_1', list(p))
4387
4388 # { pform_set_defparam(*p[1], p[3]);
4389 # delete p[1];
4390 # }
4391 ()
4392
4393
4394 def p_defparam_assign_list_1(p):
4395 '''defparam_assign_list : defparam_assign '''
4396 if(parse_debug):
4397 print('defparam_assign_list_1', list(p))
4398
4399
4400 ()
4401
4402
4403 def p_defparam_assign_list_2(p):
4404 '''defparam_assign_list : dimensions defparam_assign '''
4405 if(parse_debug):
4406 print('defparam_assign_list_2', list(p))
4407
4408 # { yyerror(@1, "error: defparam may not include a range.");
4409 # delete p[1];
4410 # }
4411 ()
4412
4413
4414 def p_defparam_assign_list_3(p):
4415 '''defparam_assign_list : defparam_assign_list ',' defparam_assign '''
4416 if(parse_debug):
4417 print('defparam_assign_list_3', list(p))
4418
4419
4420 ()
4421
4422
4423 def p_delay1_1(p):
4424 '''delay1 : '#' delay_value_simple '''
4425 if(parse_debug):
4426 print('delay1_1', list(p))
4427
4428 # { list<PExpr*>*tmp = new list<PExpr*>;
4429 # tmp->push_back(p[2]);
4430 # p[0] = tmp;
4431 # }
4432 ()
4433
4434
4435 def p_delay1_2(p):
4436 '''delay1 : '#' '(' delay_value ')' '''
4437 if(parse_debug):
4438 print('delay1_2', list(p))
4439
4440 # { list<PExpr*>*tmp = new list<PExpr*>;
4441 # tmp->push_back(p[3]);
4442 # p[0] = tmp;
4443 # }
4444 ()
4445
4446
4447 def p_delay3_1(p):
4448 '''delay3 : '#' delay_value_simple '''
4449 if(parse_debug):
4450 print('delay3_1', list(p))
4451
4452 # { list<PExpr*>*tmp = new list<PExpr*>;
4453 # tmp->push_back(p[2]);
4454 # p[0] = tmp;
4455 # }
4456 ()
4457
4458
4459 def p_delay3_2(p):
4460 '''delay3 : '#' '(' delay_value ')' '''
4461 if(parse_debug):
4462 print('delay3_2', list(p))
4463
4464 # { list<PExpr*>*tmp = new list<PExpr*>;
4465 # tmp->push_back(p[3]);
4466 # p[0] = tmp;
4467 # }
4468 ()
4469
4470
4471 def p_delay3_3(p):
4472 '''delay3 : '#' '(' delay_value ',' delay_value ')' '''
4473 if(parse_debug):
4474 print('delay3_3', list(p))
4475
4476 # { list<PExpr*>*tmp = new list<PExpr*>;
4477 # tmp->push_back(p[3]);
4478 # tmp->push_back(p[5]);
4479 # p[0] = tmp;
4480 # }
4481 ()
4482
4483
4484 def p_delay3_4(p):
4485 '''delay3 : '#' '(' delay_value ',' delay_value ',' delay_value ')' '''
4486 if(parse_debug):
4487 print('delay3_4', list(p))
4488
4489 # { list<PExpr*>*tmp = new list<PExpr*>;
4490 # tmp->push_back(p[3]);
4491 # tmp->push_back(p[5]);
4492 # tmp->push_back(p[7]);
4493 # p[0] = tmp;
4494 # }
4495 ()
4496
4497
4498 def p_delay3_opt_1(p):
4499 '''delay3_opt : delay3 '''
4500 if(parse_debug):
4501 print('delay3_opt_1', list(p))
4502 p[0] = p[1]
4503
4504
4505 ()
4506
4507
4508 def p_delay3_opt_2(p):
4509 '''delay3_opt : '''
4510 if(parse_debug > 2):
4511 print('delay3_opt_2', list(p))
4512
4513 # { p[0] = None }
4514 ()
4515
4516
4517 def p_delay_value_list_1(p):
4518 '''delay_value_list : delay_value '''
4519 if(parse_debug):
4520 print('delay_value_list_1', list(p))
4521
4522 # { list<PExpr*>*tmp = new list<PExpr*>;
4523 # tmp->push_back(p[1]);
4524 # p[0] = tmp;
4525 # }
4526 ()
4527
4528
4529 def p_delay_value_list_2(p):
4530 '''delay_value_list : delay_value_list ',' delay_value '''
4531 if(parse_debug):
4532 print('delay_value_list_2', list(p))
4533
4534 # { list<PExpr*>*tmp = p[1];
4535 # tmp->push_back(p[3]);
4536 # p[0] = tmp;
4537 # }
4538 ()
4539
4540
4541 def p_delay_value_1(p):
4542 '''delay_value : expression '''
4543 if(parse_debug):
4544 print('delay_value_1', list(p))
4545
4546 # { PExpr*tmp = p[1];
4547 # p[0] = tmp;
4548 # }
4549 ()
4550
4551
4552 def p_delay_value_2(p):
4553 '''delay_value : expression ':' expression ':' expression '''
4554 if(parse_debug):
4555 print('delay_value_2', list(p))
4556
4557 # { p[0] = pform_select_mtm_expr(p[1], p[3], p[5]); }
4558 ()
4559
4560
4561 def p_delay_value_simple_1(p):
4562 '''delay_value_simple : DEC_NUMBER '''
4563 if(parse_debug):
4564 print('delay_value_simple_1', list(p))
4565
4566 # { verinum*tmp = p[1];
4567 # if (tmp == 0) {
4568 # yyerror(@1, "internal error: delay.");
4569 # p[0] = None
4570 # } else {
4571 # p[0] = new PENumber(tmp);
4572 # FILE_NAME(p[0], @1);
4573 # }
4574 # based_size = 0;
4575 # }
4576 ()
4577
4578
4579 def p_delay_value_simple_2(p):
4580 '''delay_value_simple : REALTIME '''
4581 if(parse_debug):
4582 print('delay_value_simple_2', list(p))
4583
4584 # { verireal*tmp = p[1];
4585 # if (tmp == 0) {
4586 # yyerror(@1, "internal error: delay.");
4587 # p[0] = None
4588 # } else {
4589 # p[0] = new PEFNumber(tmp);
4590 # FILE_NAME(p[0], @1);
4591 # }
4592 # }
4593 ()
4594
4595
4596 def p_delay_value_simple_3(p):
4597 '''delay_value_simple : IDENTIFIER '''
4598 if(parse_debug):
4599 print('delay_value_simple_3', list(p))
4600
4601 # { PEIdent*tmp = new PEIdent(lex_strings.make(p[1]));
4602 # FILE_NAME(tmp, @1);
4603 # p[0] = tmp;
4604 # delete[]p[1];
4605 # }
4606 ()
4607
4608
4609 def p_delay_value_simple_4(p):
4610 '''delay_value_simple : TIME_LITERAL '''
4611 if(parse_debug):
4612 print('delay_value_simple_4', list(p))
4613
4614 # { int unit;
4615 #
4616 # based_size = 0;
4617 # p[0] = 0;
4618 # if (p[1] == 0 || !get_time_unit(p[1], unit))
4619 # yyerror(@1, "internal error: delay.");
4620 # else {
4621 # double p = pow(10.0,
4622 # (double)(unit - pform_get_timeunit()));
4623 # double time = atof(p[1]) * p;
4624 #
4625 # verireal *v = new verireal(time);
4626 # p[0] = new PEFNumber(v);
4627 # FILE_NAME(p[0], @1);
4628 # }
4629 # }
4630 ()
4631
4632
4633 def p_optional_semicolon_1(p):
4634 '''optional_semicolon : ';' '''
4635 if(parse_debug):
4636 print('optional_semicolon_1', list(p))
4637
4638
4639 ()
4640
4641
4642 def p_optional_semicolon_2(p):
4643 '''optional_semicolon : '''
4644 if(parse_debug):
4645 print('optional_semicolon_2', list(p))
4646
4647
4648 ()
4649
4650
4651 def p_discipline_declaration_1(p):
4652 '''discipline_declaration : K_discipline IDENTIFIER optional_semicolon _embed0_discipline_declaration discipline_items K_enddiscipline '''
4653 if(parse_debug):
4654 print('discipline_declaration_1', list(p))
4655
4656 # { pform_end_discipline(@1); delete[] p[2]; }
4657 ()
4658
4659
4660 def p__embed0_discipline_declaration(p):
4661 '''_embed0_discipline_declaration : '''
4662
4663 # { pform_start_discipline(p[2]); }
4664 ()
4665
4666
4667 def p_discipline_items_1(p):
4668 '''discipline_items : discipline_items discipline_item '''
4669 if(parse_debug):
4670 print('discipline_items_1', list(p))
4671
4672
4673 ()
4674
4675
4676 def p_discipline_items_2(p):
4677 '''discipline_items : discipline_item '''
4678 if(parse_debug):
4679 print('discipline_items_2', list(p))
4680
4681
4682 ()
4683
4684
4685 def p_discipline_item_1(p):
4686 '''discipline_item : K_domain K_discrete ';' '''
4687 if(parse_debug):
4688 print('discipline_item_1', list(p))
4689
4690 # { pform_discipline_domain(@1, IVL_DIS_DISCRETE); }
4691 ()
4692
4693
4694 def p_discipline_item_2(p):
4695 '''discipline_item : K_domain K_continuous ';' '''
4696 if(parse_debug):
4697 print('discipline_item_2', list(p))
4698
4699 # { pform_discipline_domain(@1, IVL_DIS_CONTINUOUS); }
4700 ()
4701
4702
4703 def p_discipline_item_3(p):
4704 '''discipline_item : K_potential IDENTIFIER ';' '''
4705 if(parse_debug):
4706 print('discipline_item_3', list(p))
4707
4708 # { pform_discipline_potential(@1, p[2]); delete[] p[2]; }
4709 ()
4710
4711
4712 def p_discipline_item_4(p):
4713 '''discipline_item : K_flow IDENTIFIER ';' '''
4714 if(parse_debug):
4715 print('discipline_item_4', list(p))
4716
4717 # { pform_discipline_flow(@1, p[2]); delete[] p[2]; }
4718 ()
4719
4720
4721 def p_nature_declaration_1(p):
4722 '''nature_declaration : K_nature IDENTIFIER optional_semicolon _embed0_nature_declaration nature_items K_endnature '''
4723 if(parse_debug):
4724 print('nature_declaration_1', list(p))
4725
4726 # { pform_end_nature(@1); delete[] p[2]; }
4727 ()
4728
4729
4730 def p__embed0_nature_declaration(p):
4731 '''_embed0_nature_declaration : '''
4732
4733 # { pform_start_nature(p[2]); }
4734 ()
4735
4736
4737 def p_nature_items_1(p):
4738 '''nature_items : nature_items nature_item '''
4739 if(parse_debug):
4740 print('nature_items_1', list(p))
4741
4742
4743 ()
4744
4745
4746 def p_nature_items_2(p):
4747 '''nature_items : nature_item '''
4748 if(parse_debug):
4749 print('nature_items_2', list(p))
4750
4751
4752 ()
4753
4754
4755 def p_nature_item_1(p):
4756 '''nature_item : K_units '=' STRING ';' '''
4757 if(parse_debug):
4758 print('nature_item_1', list(p))
4759
4760 # { delete[] p[3]; }
4761 ()
4762
4763
4764 def p_nature_item_2(p):
4765 '''nature_item : K_abstol '=' expression ';' '''
4766 if(parse_debug):
4767 print('nature_item_2', list(p))
4768
4769
4770 ()
4771
4772
4773 def p_nature_item_3(p):
4774 '''nature_item : K_access '=' IDENTIFIER ';' '''
4775 if(parse_debug):
4776 print('nature_item_3', list(p))
4777
4778 # { pform_nature_access(@1, p[3]); delete[] p[3]; }
4779 ()
4780
4781
4782 def p_nature_item_4(p):
4783 '''nature_item : K_idt_nature '=' IDENTIFIER ';' '''
4784 if(parse_debug):
4785 print('nature_item_4', list(p))
4786
4787 # { delete[] p[3]; }
4788 ()
4789
4790
4791 def p_nature_item_5(p):
4792 '''nature_item : K_ddt_nature '=' IDENTIFIER ';' '''
4793 if(parse_debug):
4794 print('nature_item_5', list(p))
4795
4796 # { delete[] p[3]; }
4797 ()
4798
4799
4800 def p_config_declaration_1(p):
4801 '''config_declaration : K_config IDENTIFIER ';' K_design lib_cell_identifiers ';' list_of_config_rule_statements K_endconfig '''
4802 if(parse_debug):
4803 print('config_declaration_1', list(p))
4804
4805 # { cerr << @1 << ": sorry: config declarations are not supported and "
4806 # "will be skipped." << endl;
4807 # delete[] p[2];
4808 # }
4809 ()
4810
4811
4812 def p_lib_cell_identifiers_1(p):
4813 '''lib_cell_identifiers : '''
4814 if(parse_debug):
4815 print('lib_cell_identifiers_1', list(p))
4816
4817
4818 ()
4819
4820
4821 def p_lib_cell_identifiers_2(p):
4822 '''lib_cell_identifiers : lib_cell_identifiers lib_cell_id '''
4823 if(parse_debug):
4824 print('lib_cell_identifiers_2', list(p))
4825
4826
4827 ()
4828
4829
4830 def p_list_of_config_rule_statements_1(p):
4831 '''list_of_config_rule_statements : '''
4832 if(parse_debug):
4833 print('list_of_config_rule_statements_1', list(p))
4834
4835
4836 ()
4837
4838
4839 def p_list_of_config_rule_statements_2(p):
4840 '''list_of_config_rule_statements : list_of_config_rule_statements config_rule_statement '''
4841 if(parse_debug):
4842 print('list_of_config_rule_statements_2', list(p))
4843
4844
4845 ()
4846
4847
4848 def p_config_rule_statement_1(p):
4849 '''config_rule_statement : K_default K_liblist list_of_libraries ';' '''
4850 if(parse_debug):
4851 print('config_rule_statement_1', list(p))
4852
4853
4854 ()
4855
4856
4857 def p_config_rule_statement_2(p):
4858 '''config_rule_statement : K_instance hierarchy_identifier K_liblist list_of_libraries ';' '''
4859 if(parse_debug):
4860 print('config_rule_statement_2', list(p))
4861
4862 # { delete p[2]; }
4863 ()
4864
4865
4866 def p_config_rule_statement_3(p):
4867 '''config_rule_statement : K_instance hierarchy_identifier K_use lib_cell_id opt_config ';' '''
4868 if(parse_debug):
4869 print('config_rule_statement_3', list(p))
4870
4871 # { delete p[2]; }
4872 ()
4873
4874
4875 def p_config_rule_statement_4(p):
4876 '''config_rule_statement : K_cell lib_cell_id K_liblist list_of_libraries ';' '''
4877 if(parse_debug):
4878 print('config_rule_statement_4', list(p))
4879
4880
4881 ()
4882
4883
4884 def p_config_rule_statement_5(p):
4885 '''config_rule_statement : K_cell lib_cell_id K_use lib_cell_id opt_config ';' '''
4886 if(parse_debug):
4887 print('config_rule_statement_5', list(p))
4888
4889
4890 ()
4891
4892
4893 def p_opt_config_1(p):
4894 '''opt_config : '''
4895 if(parse_debug):
4896 print('opt_config_1', list(p))
4897
4898
4899 ()
4900
4901
4902 def p_opt_config_2(p):
4903 '''opt_config : ':' K_config '''
4904 if(parse_debug):
4905 print('opt_config_2', list(p))
4906
4907
4908 ()
4909
4910
4911 def p_lib_cell_id_1(p):
4912 '''lib_cell_id : IDENTIFIER '''
4913 if(parse_debug):
4914 print('lib_cell_id_1', list(p))
4915
4916 # { delete[] p[1]; }
4917 ()
4918
4919
4920 def p_lib_cell_id_2(p):
4921 '''lib_cell_id : IDENTIFIER '.' IDENTIFIER '''
4922 if(parse_debug):
4923 print('lib_cell_id_2', list(p))
4924
4925 # { delete[] p[1]; delete[] p[3]; }
4926 ()
4927
4928
4929 def p_list_of_libraries_1(p):
4930 '''list_of_libraries : '''
4931 if(parse_debug):
4932 print('list_of_libraries_1', list(p))
4933
4934
4935 ()
4936
4937
4938 def p_list_of_libraries_2(p):
4939 '''list_of_libraries : list_of_libraries IDENTIFIER '''
4940 if(parse_debug):
4941 print('list_of_libraries_2', list(p))
4942
4943 # { delete[] p[2]; }
4944 ()
4945
4946
4947 def p_drive_strength_1(p):
4948 '''drive_strength : '(' dr_strength0 ',' dr_strength1 ')' '''
4949 if(parse_debug):
4950 print('drive_strength_1', list(p))
4951
4952 # { p[0].str0 = p[2].str0;
4953 # p[0].str1 = p[4].str1;
4954 # }
4955 ()
4956
4957
4958 def p_drive_strength_2(p):
4959 '''drive_strength : '(' dr_strength1 ',' dr_strength0 ')' '''
4960 if(parse_debug):
4961 print('drive_strength_2', list(p))
4962
4963 # { p[0].str0 = p[4].str0;
4964 # p[0].str1 = p[2].str1;
4965 # }
4966 ()
4967
4968
4969 def p_drive_strength_3(p):
4970 '''drive_strength : '(' dr_strength0 ',' K_highz1 ')' '''
4971 if(parse_debug):
4972 print('drive_strength_3', list(p))
4973
4974 # { p[0].str0 = p[2].str0;
4975 # p[0].str1 = IVL_DR_HiZ;
4976 # }
4977 ()
4978
4979
4980 def p_drive_strength_4(p):
4981 '''drive_strength : '(' dr_strength1 ',' K_highz0 ')' '''
4982 if(parse_debug):
4983 print('drive_strength_4', list(p))
4984
4985 # { p[0].str0 = IVL_DR_HiZ;
4986 # p[0].str1 = p[2].str1;
4987 # }
4988 ()
4989
4990
4991 def p_drive_strength_5(p):
4992 '''drive_strength : '(' K_highz1 ',' dr_strength0 ')' '''
4993 if(parse_debug):
4994 print('drive_strength_5', list(p))
4995
4996 # { p[0].str0 = p[4].str0;
4997 # p[0].str1 = IVL_DR_HiZ;
4998 # }
4999 ()
5000
5001
5002 def p_drive_strength_6(p):
5003 '''drive_strength : '(' K_highz0 ',' dr_strength1 ')' '''
5004 if(parse_debug):
5005 print('drive_strength_6', list(p))
5006
5007 # { p[0].str0 = IVL_DR_HiZ;
5008 # p[0].str1 = p[4].str1;
5009 # }
5010 ()
5011
5012
5013 def p_drive_strength_opt_1(p):
5014 '''drive_strength_opt : drive_strength '''
5015 if(parse_debug):
5016 print('drive_strength_opt_1', list(p))
5017 p[0] = p[1]
5018
5019
5020 ()
5021
5022
5023 def p_drive_strength_opt_2(p):
5024 '''drive_strength_opt : '''
5025 if(parse_debug > 2):
5026 print('drive_strength_opt_2', list(p))
5027
5028 # { p[0].str0 = IVL_DR_STRONG; p[0].str1 = IVL_DR_STRONG; }
5029 ()
5030
5031
5032 def p_dr_strength0_1(p):
5033 '''dr_strength0 : K_supply0 '''
5034 if(parse_debug):
5035 print('dr_strength0_1', list(p))
5036
5037 # { p[0].str0 = IVL_DR_SUPPLY; }
5038 ()
5039
5040
5041 def p_dr_strength0_2(p):
5042 '''dr_strength0 : K_strong0 '''
5043 if(parse_debug):
5044 print('dr_strength0_2', list(p))
5045
5046 # { p[0].str0 = IVL_DR_STRONG; }
5047 ()
5048
5049
5050 def p_dr_strength0_3(p):
5051 '''dr_strength0 : K_pull0 '''
5052 if(parse_debug):
5053 print('dr_strength0_3', list(p))
5054
5055 # { p[0].str0 = IVL_DR_PULL; }
5056 ()
5057
5058
5059 def p_dr_strength0_4(p):
5060 '''dr_strength0 : K_weak0 '''
5061 if(parse_debug):
5062 print('dr_strength0_4', list(p))
5063
5064 # { p[0].str0 = IVL_DR_WEAK; }
5065 ()
5066
5067
5068 def p_dr_strength1_1(p):
5069 '''dr_strength1 : K_supply1 '''
5070 if(parse_debug):
5071 print('dr_strength1_1', list(p))
5072
5073 # { p[0].str1 = IVL_DR_SUPPLY; }
5074 ()
5075
5076
5077 def p_dr_strength1_2(p):
5078 '''dr_strength1 : K_strong1 '''
5079 if(parse_debug):
5080 print('dr_strength1_2', list(p))
5081
5082 # { p[0].str1 = IVL_DR_STRONG; }
5083 ()
5084
5085
5086 def p_dr_strength1_3(p):
5087 '''dr_strength1 : K_pull1 '''
5088 if(parse_debug):
5089 print('dr_strength1_3', list(p))
5090
5091 # { p[0].str1 = IVL_DR_PULL; }
5092 ()
5093
5094
5095 def p_dr_strength1_4(p):
5096 '''dr_strength1 : K_weak1 '''
5097 if(parse_debug):
5098 print('dr_strength1_4', list(p))
5099
5100 # { p[0].str1 = IVL_DR_WEAK; }
5101 ()
5102
5103
5104 def p_clocking_event_opt_1(p):
5105 '''clocking_event_opt : event_control '''
5106 if(parse_debug):
5107 print('clocking_event_opt_1', list(p))
5108
5109
5110 ()
5111
5112
5113 def p_clocking_event_opt_2(p):
5114 '''clocking_event_opt : '''
5115 if(parse_debug):
5116 print('clocking_event_opt_2', list(p))
5117
5118
5119 ()
5120
5121
5122 def p_event_control_1(p):
5123 '''event_control : '@' hierarchy_identifier '''
5124 if(parse_debug):
5125 print('event_control_1', list(p))
5126
5127 # { PEIdent*tmpi = new PEIdent(*p[2]);
5128 # PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi);
5129 # PEventStatement*tmps = new PEventStatement(tmpe);
5130 # FILE_NAME(tmps, @1);
5131 # p[0] = tmps;
5132 # delete p[2];
5133 # }
5134 ()
5135
5136
5137 def p_event_control_2(p):
5138 '''event_control : '@' '(' event_expression_list ')' '''
5139 if(parse_debug):
5140 print('event_control_2', list(p))
5141
5142 # { PEventStatement*tmp = new PEventStatement(*p[3]);
5143 # FILE_NAME(tmp, @1);
5144 # delete p[3];
5145 # p[0] = tmp;
5146 # }
5147 ()
5148
5149
5150 def p_event_control_3(p):
5151 '''event_control : '@' '(' error ')' '''
5152 if(parse_debug):
5153 print('event_control_3', list(p))
5154
5155 # { yyerror(@1, "error: Malformed event control expression.");
5156 # p[0] = None
5157 # }
5158 ()
5159
5160
5161 def p_event_expression_list_1(p):
5162 '''event_expression_list : event_expression '''
5163 if(parse_debug):
5164 print('event_expression_list_1', list(p))
5165 p[0] = p[1]
5166
5167
5168 ()
5169
5170
5171 def p_event_expression_list_2(p):
5172 '''event_expression_list : event_expression_list K_or event_expression '''
5173 if(parse_debug):
5174 print('event_expression_list_2', list(p))
5175
5176 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
5177 # delete p[1];
5178 # delete p[3];
5179 # p[0] = tmp;
5180 # }
5181 ()
5182
5183
5184 def p_event_expression_list_3(p):
5185 '''event_expression_list : event_expression_list ',' event_expression '''
5186 if(parse_debug):
5187 print('event_expression_list_3', list(p))
5188
5189 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*p[1], *p[3]);
5190 # delete p[1];
5191 # delete p[3];
5192 # p[0] = tmp;
5193 # }
5194 ()
5195
5196
5197 def p_event_expression_1(p):
5198 '''event_expression : K_posedge expression '''
5199 if(parse_debug):
5200 print('event_expression_1', list(p))
5201
5202 # { PEEvent*tmp = new PEEvent(PEEvent::POSEDGE, p[2]);
5203 # FILE_NAME(tmp, @1);
5204 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5205 # (*tl)[0] = tmp;
5206 # p[0] = tl;
5207 # }
5208 ()
5209
5210
5211 def p_event_expression_2(p):
5212 '''event_expression : K_negedge expression '''
5213 if(parse_debug):
5214 print('event_expression_2', list(p))
5215
5216 # { PEEvent*tmp = new PEEvent(PEEvent::NEGEDGE, p[2]);
5217 # FILE_NAME(tmp, @1);
5218 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5219 # (*tl)[0] = tmp;
5220 # p[0] = tl;
5221 # }
5222 ()
5223
5224
5225 def p_event_expression_3(p):
5226 '''event_expression : expression '''
5227 if(parse_debug):
5228 print('event_expression_3', list(p))
5229
5230 # { PEEvent*tmp = new PEEvent(PEEvent::ANYEDGE, p[1]);
5231 # FILE_NAME(tmp, @1);
5232 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
5233 # (*tl)[0] = tmp;
5234 # p[0] = tl;
5235 # }
5236 ()
5237
5238
5239 def p_branch_probe_expression_1(p):
5240 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ',' IDENTIFIER ')' '''
5241 if(parse_debug):
5242 print('branch_probe_expression_1', list(p))
5243
5244 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3], p[5]); }
5245 ()
5246
5247
5248 def p_branch_probe_expression_2(p):
5249 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ')' '''
5250 if(parse_debug):
5251 print('branch_probe_expression_2', list(p))
5252
5253 # { p[0] = pform_make_branch_probe_expression(@1, p[1], p[3]); }
5254 ()
5255
5256
5257 def p_expression_1(p):
5258 '''expression : expr_primary_or_typename '''
5259 if(parse_debug > 2):
5260 print('expression_1', list(p))
5261 p[0] = p[1]
5262
5263
5264 ()
5265
5266
5267 def p_expression_2(p):
5268 '''expression : inc_or_dec_expression '''
5269 if(parse_debug):
5270 print('expression_2', list(p))
5271 p[0] = p[1]
5272
5273
5274 ()
5275
5276
5277 def p_expression_3(p):
5278 '''expression : inside_expression '''
5279 if(parse_debug):
5280 print('expression_3', list(p))
5281 p[0] = p[1]
5282
5283
5284 ()
5285
5286
5287 def p_expression_4(p):
5288 '''expression : '+' attribute_list_opt expr_primary %prec UNARY_PREC '''
5289 if(parse_debug):
5290 print('expression_4', list(p))
5291 p[0] = p[3]
5292
5293
5294 ()
5295
5296
5297 def p_expression_5(p):
5298 '''expression : '-' attribute_list_opt expr_primary %prec UNARY_PREC '''
5299 if(parse_debug):
5300 print('expression_5', list(p))
5301
5302 # { PEUnary*tmp = new PEUnary('-', p[3]);
5303 # FILE_NAME(tmp, @3);
5304 # p[0] = tmp;
5305 # }
5306 ()
5307
5308
5309 def p_expression_6(p):
5310 '''expression : '~' attribute_list_opt expr_primary %prec UNARY_PREC '''
5311 if(parse_debug):
5312 print('expression_6', list(p))
5313
5314 # { PEUnary*tmp = new PEUnary('~', p[3]);
5315 # FILE_NAME(tmp, @3);
5316 # p[0] = tmp;
5317 # }
5318 ()
5319
5320
5321 def p_expression_7(p):
5322 '''expression : '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
5323 if(parse_debug):
5324 print('expression_7', list(p))
5325
5326 # { PEUnary*tmp = new PEUnary('&', p[3]);
5327 # FILE_NAME(tmp, @3);
5328 # p[0] = tmp;
5329 # }
5330 ()
5331
5332
5333 def p_expression_8(p):
5334 '''expression : '!' attribute_list_opt expr_primary %prec UNARY_PREC '''
5335 if(parse_debug):
5336 print('expression_8', list(p))
5337
5338 # { PEUnary*tmp = new PEUnary('!', p[3]);
5339 # FILE_NAME(tmp, @3);
5340 # p[0] = tmp;
5341 # }
5342 ()
5343
5344
5345 def p_expression_9(p):
5346 '''expression : '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
5347 if(parse_debug):
5348 print('expression_9', list(p))
5349
5350 # { PEUnary*tmp = new PEUnary('|', p[3]);
5351 # FILE_NAME(tmp, @3);
5352 # p[0] = tmp;
5353 # }
5354 ()
5355
5356
5357 def p_expression_10(p):
5358 '''expression : '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
5359 if(parse_debug):
5360 print('expression_10', list(p))
5361
5362 # { PEUnary*tmp = new PEUnary('^', p[3]);
5363 # FILE_NAME(tmp, @3);
5364 # p[0] = tmp;
5365 # }
5366 ()
5367
5368
5369 def p_expression_11(p):
5370 '''expression : '~' '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
5371 if(parse_debug):
5372 print('expression_11', list(p))
5373
5374 # { yyerror(@1, "error: '~' '&' is not a valid expression. "
5375 # "Please use operator '~&' instead.");
5376 # p[0] = None
5377 # }
5378 ()
5379
5380
5381 def p_expression_12(p):
5382 '''expression : '~' '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
5383 if(parse_debug):
5384 print('expression_12', list(p))
5385
5386 # { yyerror(@1, "error: '~' '|' is not a valid expression. "
5387 # "Please use operator '~|' instead.");
5388 # p[0] = None
5389 # }
5390 ()
5391
5392
5393 def p_expression_13(p):
5394 '''expression : '~' '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
5395 if(parse_debug):
5396 print('expression_13', list(p))
5397
5398 # { yyerror(@1, "error: '~' '^' is not a valid expression. "
5399 # "Please use operator '~^' instead.");
5400 # p[0] = None
5401 # }
5402 ()
5403
5404
5405 def p_expression_14(p):
5406 '''expression : K_NAND attribute_list_opt expr_primary %prec UNARY_PREC '''
5407 if(parse_debug):
5408 print('expression_14', list(p))
5409
5410 # { PEUnary*tmp = new PEUnary('A', p[3]);
5411 # FILE_NAME(tmp, @3);
5412 # p[0] = tmp;
5413 # }
5414 ()
5415
5416
5417 def p_expression_15(p):
5418 '''expression : K_NOR attribute_list_opt expr_primary %prec UNARY_PREC '''
5419 if(parse_debug):
5420 print('expression_15', list(p))
5421
5422 # { PEUnary*tmp = new PEUnary('N', p[3]);
5423 # FILE_NAME(tmp, @3);
5424 # p[0] = tmp;
5425 # }
5426 ()
5427
5428
5429 def p_expression_16(p):
5430 '''expression : K_NXOR attribute_list_opt expr_primary %prec UNARY_PREC '''
5431 if(parse_debug):
5432 print('expression_16', list(p))
5433
5434 # { PEUnary*tmp = new PEUnary('X', p[3]);
5435 # FILE_NAME(tmp, @3);
5436 # p[0] = tmp;
5437 # }
5438 ()
5439
5440
5441 def p_expression_17(p):
5442 '''expression : '!' error %prec UNARY_PREC '''
5443 if(parse_debug):
5444 print('expression_17', list(p))
5445
5446 # { yyerror(@1, "error: Operand of unary ! "
5447 # "is not a primary expression.");
5448 # p[0] = None
5449 # }
5450 ()
5451
5452
5453 def p_expression_18(p):
5454 '''expression : '^' error %prec UNARY_PREC '''
5455 if(parse_debug):
5456 print('expression_18', list(p))
5457
5458 # { yyerror(@1, "error: Operand of reduction ^ "
5459 # "is not a primary expression.");
5460 # p[0] = None
5461 # }
5462 ()
5463
5464
5465 def p_expression_19(p):
5466 '''expression : expression '^' attribute_list_opt expression '''
5467 if(parse_debug):
5468 print('expression_19', list(p))
5469
5470 # { PEBinary*tmp = new PEBinary('^', p[1], p[4]);
5471 # FILE_NAME(tmp, @2);
5472 # p[0] = tmp;
5473 # }
5474 ()
5475
5476
5477 def p_expression_20(p):
5478 '''expression : expression K_POW attribute_list_opt expression '''
5479 if(parse_debug):
5480 print('expression_20', list(p))
5481
5482 # { PEBinary*tmp = new PEBPower('p', p[1], p[4]);
5483 # FILE_NAME(tmp, @2);
5484 # p[0] = tmp;
5485 # }
5486 ()
5487
5488
5489 def p_expression_21(p):
5490 '''expression : expression '*' attribute_list_opt expression '''
5491 if(parse_debug):
5492 print('expression_21', list(p))
5493
5494 # { PEBinary*tmp = new PEBinary('*', p[1], p[4]);
5495 # FILE_NAME(tmp, @2);
5496 # p[0] = tmp;
5497 # }
5498 ()
5499
5500
5501 def p_expression_22(p):
5502 '''expression : expression '/' attribute_list_opt expression '''
5503 if(parse_debug):
5504 print('expression_22', list(p))
5505
5506 # { PEBinary*tmp = new PEBinary('/', p[1], p[4]);
5507 # FILE_NAME(tmp, @2);
5508 # p[0] = tmp;
5509 # }
5510 ()
5511
5512
5513 def p_expression_23(p):
5514 '''expression : expression '%' attribute_list_opt expression '''
5515 if(parse_debug):
5516 print('expression_23', list(p))
5517
5518 # { PEBinary*tmp = new PEBinary('%', p[1], p[4]);
5519 # FILE_NAME(tmp, @2);
5520 # p[0] = tmp;
5521 # }
5522 ()
5523
5524
5525 def p_expression_24(p):
5526 '''expression : expression '+' attribute_list_opt expression '''
5527 if(parse_debug):
5528 print('expression_24', list(p))
5529
5530 # { PEBinary*tmp = new PEBinary('+', p[1], p[4]);
5531 # FILE_NAME(tmp, @2);
5532 # p[0] = tmp;
5533 # }
5534 ()
5535
5536
5537 def p_expression_25(p):
5538 '''expression : expression '-' attribute_list_opt expression '''
5539 if(parse_debug):
5540 print('expression_25', list(p))
5541 # { PEBinary*tmp = new PEBinary('-', p[1], p[4]);
5542 # FILE_NAME(tmp, @2);
5543 # p[0] = tmp;
5544 # }
5545 try:
5546 p[0] = Node(syms.atom, [p[1], Leaf(token.MINUS, '-'), p[4]])
5547 except:
5548 p[0] = "bad input in p_expression_25"
5549
5550
5551 ()
5552
5553
5554 def p_expression_26(p):
5555 '''expression : expression '&' attribute_list_opt expression '''
5556 if(parse_debug):
5557 print('expression_26', list(p))
5558
5559 # { PEBinary*tmp = new PEBinary('&', p[1], p[4]);
5560 # FILE_NAME(tmp, @2);
5561 # p[0] = tmp;
5562 # }
5563 ()
5564
5565
5566 def p_expression_27(p):
5567 '''expression : expression '|' attribute_list_opt expression '''
5568 if(parse_debug):
5569 print('expression_27', list(p))
5570
5571 # { PEBinary*tmp = new PEBinary('|', p[1], p[4]);
5572 # FILE_NAME(tmp, @2);
5573 # p[0] = tmp;
5574 # }
5575 ()
5576
5577
5578 def p_expression_28(p):
5579 '''expression : expression K_NAND attribute_list_opt expression '''
5580 if(parse_debug):
5581 print('expression_28', list(p))
5582
5583 # { PEBinary*tmp = new PEBinary('A', p[1], p[4]);
5584 # FILE_NAME(tmp, @2);
5585 # p[0] = tmp;
5586 # }
5587 ()
5588
5589
5590 def p_expression_29(p):
5591 '''expression : expression K_NOR attribute_list_opt expression '''
5592 if(parse_debug):
5593 print('expression_29', list(p))
5594
5595 # { PEBinary*tmp = new PEBinary('O', p[1], p[4]);
5596 # FILE_NAME(tmp, @2);
5597 # p[0] = tmp;
5598 # }
5599 ()
5600
5601
5602 def p_expression_30(p):
5603 '''expression : expression K_NXOR attribute_list_opt expression '''
5604 if(parse_debug):
5605 print('expression_30', list(p))
5606
5607 # { PEBinary*tmp = new PEBinary('X', p[1], p[4]);
5608 # FILE_NAME(tmp, @2);
5609 # p[0] = tmp;
5610 # }
5611 ()
5612
5613
5614 def p_expression_31(p):
5615 '''expression : expression '<' attribute_list_opt expression '''
5616 if(parse_debug):
5617 print('expression_31', list(p))
5618
5619 # { PEBinary*tmp = new PEBComp('<', p[1], p[4]);
5620 # FILE_NAME(tmp, @2);
5621 # p[0] = tmp;
5622 # }
5623 ()
5624
5625
5626 def p_expression_32(p):
5627 '''expression : expression '>' attribute_list_opt expression '''
5628 if(parse_debug):
5629 print('expression_32', list(p))
5630
5631 # { PEBinary*tmp = new PEBComp('>', p[1], p[4]);
5632 # FILE_NAME(tmp, @2);
5633 # p[0] = tmp;
5634 # }
5635 ()
5636
5637
5638 def p_expression_33(p):
5639 '''expression : expression K_LS attribute_list_opt expression '''
5640 if(parse_debug):
5641 print('expression_33', list(p))
5642
5643 # { PEBinary*tmp = new PEBShift('l', p[1], p[4]);
5644 # FILE_NAME(tmp, @2);
5645 # p[0] = tmp;
5646 # }
5647 ()
5648
5649
5650 def p_expression_34(p):
5651 '''expression : expression K_RS attribute_list_opt expression '''
5652 if(parse_debug):
5653 print('expression_34', list(p))
5654
5655 # { PEBinary*tmp = new PEBShift('r', p[1], p[4]);
5656 # FILE_NAME(tmp, @2);
5657 # p[0] = tmp;
5658 # }
5659 ()
5660
5661
5662 def p_expression_35(p):
5663 '''expression : expression K_RSS attribute_list_opt expression '''
5664 if(parse_debug):
5665 print('expression_35', list(p))
5666
5667 # { PEBinary*tmp = new PEBShift('R', p[1], p[4]);
5668 # FILE_NAME(tmp, @2);
5669 # p[0] = tmp;
5670 # }
5671 ()
5672
5673
5674 def p_expression_36(p):
5675 '''expression : expression K_EQ attribute_list_opt expression '''
5676 if(parse_debug):
5677 print('expression_36', list(p))
5678
5679 # { PEBinary*tmp = new PEBComp('e', p[1], p[4]);
5680 # FILE_NAME(tmp, @2);
5681 # p[0] = tmp;
5682 # }
5683 ()
5684
5685
5686 def p_expression_37(p):
5687 '''expression : expression K_CEQ attribute_list_opt expression '''
5688 if(parse_debug):
5689 print('expression_37', list(p))
5690
5691 # { PEBinary*tmp = new PEBComp('E', p[1], p[4]);
5692 # FILE_NAME(tmp, @2);
5693 # p[0] = tmp;
5694 # }
5695 ()
5696
5697
5698 def p_expression_38(p):
5699 '''expression : expression K_WEQ attribute_list_opt expression '''
5700 if(parse_debug):
5701 print('expression_38', list(p))
5702
5703 # { PEBinary*tmp = new PEBComp('w', p[1], p[4]);
5704 # FILE_NAME(tmp, @2);
5705 # p[0] = tmp;
5706 # }
5707 ()
5708
5709
5710 def p_expression_39(p):
5711 '''expression : expression K_LE attribute_list_opt expression '''
5712 if(parse_debug):
5713 print('expression_39', list(p))
5714
5715 # { PEBinary*tmp = new PEBComp('L', p[1], p[4]);
5716 # FILE_NAME(tmp, @2);
5717 # p[0] = tmp;
5718 # }
5719 ()
5720
5721
5722 def p_expression_40(p):
5723 '''expression : expression K_GE attribute_list_opt expression '''
5724 if(parse_debug):
5725 print('expression_40', list(p))
5726
5727 # { PEBinary*tmp = new PEBComp('G', p[1], p[4]);
5728 # FILE_NAME(tmp, @2);
5729 # p[0] = tmp;
5730 # }
5731 ()
5732
5733
5734 def p_expression_41(p):
5735 '''expression : expression K_NE attribute_list_opt expression '''
5736 if(parse_debug):
5737 print('expression_41', list(p))
5738
5739 # { PEBinary*tmp = new PEBComp('n', p[1], p[4]);
5740 # FILE_NAME(tmp, @2);
5741 # p[0] = tmp;
5742 # }
5743 ()
5744
5745
5746 def p_expression_42(p):
5747 '''expression : expression K_CNE attribute_list_opt expression '''
5748 if(parse_debug):
5749 print('expression_42', list(p))
5750
5751 # { PEBinary*tmp = new PEBComp('N', p[1], p[4]);
5752 # FILE_NAME(tmp, @2);
5753 # p[0] = tmp;
5754 # }
5755 ()
5756
5757
5758 def p_expression_43(p):
5759 '''expression : expression K_WNE attribute_list_opt expression '''
5760 if(parse_debug):
5761 print('expression_43', list(p))
5762
5763 # { PEBinary*tmp = new PEBComp('W', p[1], p[4]);
5764 # FILE_NAME(tmp, @2);
5765 # p[0] = tmp;
5766 # }
5767 ()
5768
5769
5770 def p_expression_44(p):
5771 '''expression : expression K_LOR attribute_list_opt expression '''
5772 if(parse_debug):
5773 print('expression_44', list(p))
5774
5775 # { PEBinary*tmp = new PEBLogic('o', p[1], p[4]);
5776 # FILE_NAME(tmp, @2);
5777 # p[0] = tmp;
5778 # }
5779 ()
5780
5781
5782 def p_expression_45(p):
5783 '''expression : expression K_LAND attribute_list_opt expression '''
5784 if(parse_debug):
5785 print('expression_45', list(p))
5786
5787 # { PEBinary*tmp = new PEBLogic('a', p[1], p[4]);
5788 # FILE_NAME(tmp, @2);
5789 # p[0] = tmp;
5790 # }
5791 ()
5792
5793
5794 def p_expression_46(p):
5795 '''expression : expression '?' attribute_list_opt expression ':' expression '''
5796 if(parse_debug):
5797 print('expression_46', list(p))
5798
5799 # { PETernary*tmp = new PETernary(p[1], p[4], p[6]);
5800 # FILE_NAME(tmp, @2);
5801 # p[0] = tmp;
5802 # }
5803 ()
5804
5805
5806 def p_expr_mintypmax_1(p):
5807 '''expr_mintypmax : expression '''
5808 if(parse_debug):
5809 print('expr_mintypmax_1', list(p))
5810 p[0] = p[1]
5811
5812
5813 ()
5814
5815
5816 def p_expr_mintypmax_2(p):
5817 '''expr_mintypmax : expression ':' expression ':' expression '''
5818 if(parse_debug):
5819 print('expr_mintypmax_2', list(p))
5820
5821 # { switch (min_typ_max_flag) {
5822 # case MIN:
5823 # p[0] = p[1];
5824 # delete p[3];
5825 # delete p[5];
5826 # break;
5827 # case TYP:
5828 # delete p[1];
5829 # p[0] = p[3];
5830 # delete p[5];
5831 # break;
5832 # case MAX:
5833 # delete p[1];
5834 # delete p[3];
5835 # p[0] = p[5];
5836 # break;
5837 # }
5838 # if (min_typ_max_warn > 0) {
5839 # cerr << p[0]->get_fileline() << ": warning: choosing ";
5840 # switch (min_typ_max_flag) {
5841 # case MIN:
5842 # cerr << "min";
5843 # break;
5844 # case TYP:
5845 # cerr << "typ";
5846 # break;
5847 # case MAX:
5848 # cerr << "max";
5849 # break;
5850 # }
5851 # cerr << " expression." << endl;
5852 # min_typ_max_warn -= 1;
5853 # }
5854 # }
5855 ()
5856
5857
5858 def p_expression_list_with_nuls_1(p):
5859 '''expression_list_with_nuls : expression_list_with_nuls ',' expression '''
5860 if(parse_debug):
5861 print('expression_list_with_nuls_1', list(p))
5862
5863 # { list<PExpr*>*tmp = p[1];
5864 # tmp->push_back(p[3]);
5865 # p[0] = tmp;
5866 # }
5867 ()
5868
5869
5870 def p_expression_list_with_nuls_2(p):
5871 '''expression_list_with_nuls : expression '''
5872 if(parse_debug):
5873 print('expression_list_with_nuls_2', list(p))
5874
5875 # { list<PExpr*>*tmp = new list<PExpr*>;
5876 # tmp->push_back(p[1]);
5877 # p[0] = tmp;
5878 # }
5879 ()
5880
5881
5882 def p_expression_list_with_nuls_3(p):
5883 '''expression_list_with_nuls : '''
5884 if(parse_debug):
5885 print('expression_list_with_nuls_3', list(p))
5886
5887 # { list<PExpr*>*tmp = new list<PExpr*>;
5888 # tmp->push_back(0);
5889 # p[0] = tmp;
5890 # }
5891 ()
5892
5893
5894 def p_expression_list_with_nuls_4(p):
5895 '''expression_list_with_nuls : expression_list_with_nuls ',' '''
5896 if(parse_debug):
5897 print('expression_list_with_nuls_4', list(p))
5898
5899 # { list<PExpr*>*tmp = p[1];
5900 # tmp->push_back(0);
5901 # p[0] = tmp;
5902 # }
5903 ()
5904
5905
5906 def p_expression_list_proper_1(p):
5907 '''expression_list_proper : expression_list_proper ',' expression '''
5908 if(parse_debug):
5909 print('expression_list_proper_1', list(p))
5910
5911 # { list<PExpr*>*tmp = p[1];
5912 # tmp->push_back(p[3]);
5913 # p[0] = tmp;
5914 # }
5915 ()
5916
5917
5918 def p_expression_list_proper_2(p):
5919 '''expression_list_proper : expression '''
5920 if(parse_debug):
5921 print('expression_list_proper_2', list(p))
5922
5923 # { list<PExpr*>*tmp = new list<PExpr*>;
5924 # tmp->push_back(p[1]);
5925 # p[0] = tmp;
5926 # }
5927 ()
5928
5929
5930 def p_expr_primary_or_typename_1(p):
5931 '''expr_primary_or_typename : expr_primary '''
5932 if(parse_debug > 2):
5933 print('expr_primary_or_typename_1', list(p))
5934 p[0] = p[1]
5935
5936
5937 ()
5938
5939
5940 def p_expr_primary_or_typename_2(p):
5941 '''expr_primary_or_typename : TYPE_IDENTIFIER '''
5942 if(parse_debug):
5943 print('expr_primary_or_typename_2', list(p))
5944 p[0] = p[1]
5945
5946 # { PETypename*tmp = new PETypename(p[1].type);
5947 # FILE_NAME(tmp,@1);
5948 # p[0] = tmp;
5949 # delete[]p[1].text;
5950 # }
5951 ()
5952
5953
5954 def p_expr_primary_1(p):
5955 '''expr_primary : number '''
5956 if(parse_debug):
5957 print('expr_primary_1', list(p))
5958 p[0] = p[1]
5959
5960 # { assert(p[1]);
5961 # PENumber*tmp = new PENumber(p[1]);
5962 # FILE_NAME(tmp, @1);
5963 # p[0] = tmp;
5964 # }
5965 ()
5966
5967
5968 def p_expr_primary_2(p):
5969 '''expr_primary : REALTIME '''
5970 if(parse_debug):
5971 print('expr_primary_2', list(p))
5972
5973 # { PEFNumber*tmp = new PEFNumber(p[1]);
5974 # FILE_NAME(tmp, @1);
5975 # p[0] = tmp;
5976 # }
5977 ()
5978
5979
5980 def p_expr_primary_3(p):
5981 '''expr_primary : STRING '''
5982 if(parse_debug):
5983 print('expr_primary_3', list(p))
5984
5985 # { PEString*tmp = new PEString(p[1]);
5986 # FILE_NAME(tmp, @1);
5987 # p[0] = tmp;
5988 # }
5989 ()
5990
5991
5992 def p_expr_primary_4(p):
5993 '''expr_primary : TIME_LITERAL '''
5994 if(parse_debug):
5995 print('expr_primary_4', list(p))
5996
5997 # { int unit;
5998 #
5999 # based_size = 0;
6000 # p[0] = 0;
6001 # if (p[1] == 0 || !get_time_unit(p[1], unit))
6002 # yyerror(@1, "internal error: delay.");
6003 # else {
6004 # double p = pow(10.0, (double)(unit - pform_get_timeunit()));
6005 # double time = atof(p[1]) * p;
6006 #
6007 # verireal *v = new verireal(time);
6008 # p[0] = new PEFNumber(v);
6009 # FILE_NAME(p[0], @1);
6010 # }
6011 # }
6012 ()
6013
6014
6015 def p_expr_primary_5(p):
6016 '''expr_primary : SYSTEM_IDENTIFIER '''
6017 if(parse_debug):
6018 print('expr_primary_5', list(p))
6019
6020 # { perm_string tn = lex_strings.make(p[1]);
6021 # PECallFunction*tmp = new PECallFunction(tn);
6022 # FILE_NAME(tmp, @1);
6023 # p[0] = tmp;
6024 # delete[]p[1];
6025 # }
6026 ()
6027
6028
6029 def p_expr_primary_6(p):
6030 '''expr_primary : hierarchy_identifier '''
6031 if(parse_debug > 2):
6032 print('expr_primary_6', list(p))
6033 p[0] = p[1]
6034
6035 # { PEIdent*tmp = pform_new_ident(*p[1]);
6036 # FILE_NAME(tmp, @1);
6037 # p[0] = tmp;
6038 # delete p[1];
6039 # }
6040 ()
6041
6042
6043 def p_expr_primary_7(p):
6044 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier '''
6045 if(parse_debug):
6046 print('expr_primary_7', list(p))
6047
6048 # { p[0] = pform_package_ident(@2, p[1], p[3]);
6049 # delete p[3];
6050 # }
6051 ()
6052
6053
6054 def p_expr_primary_8(p):
6055 '''expr_primary : hierarchy_identifier '(' expression_list_with_nuls ')' '''
6056 if(parse_debug):
6057 print('expr_primary_8', list(p))
6058
6059 # { list<PExpr*>*expr_list = p[3];
6060 # strip_tail_items(expr_list);
6061 # PECallFunction*tmp = pform_make_call_function(@1, *p[1], *expr_list);
6062 # delete p[1];
6063 # p[0] = tmp;
6064 # }
6065 ()
6066
6067
6068 def p_expr_primary_9(p):
6069 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' '''
6070 if(parse_debug):
6071 print('expr_primary_9', list(p))
6072
6073 # { pform_name_t*t_name = p[1];
6074 # while (! p[3]->empty()) {
6075 # t_name->push_back(p[3]->front());
6076 # p[3]->pop_front();
6077 # }
6078 # list<PExpr*>*expr_list = p[5];
6079 # strip_tail_items(expr_list);
6080 # PECallFunction*tmp = pform_make_call_function(@1, *t_name, *expr_list);
6081 # delete p[1];
6082 # delete p[3];
6083 # p[0] = tmp;
6084 # }
6085 ()
6086
6087
6088 def p_expr_primary_10(p):
6089 '''expr_primary : SYSTEM_IDENTIFIER '(' expression_list_proper ')' '''
6090 if(parse_debug):
6091 print('expr_primary_10', list(p))
6092
6093 # { perm_string tn = lex_strings.make(p[1]);
6094 # PECallFunction*tmp = new PECallFunction(tn, *p[3]);
6095 # FILE_NAME(tmp, @1);
6096 # delete[]p[1];
6097 # p[0] = tmp;
6098 # }
6099 ()
6100
6101
6102 def p_expr_primary_11(p):
6103 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')' '''
6104 if(parse_debug):
6105 print('expr_primary_11', list(p))
6106
6107 # { perm_string use_name = lex_strings.make(p[3]);
6108 # PECallFunction*tmp = new PECallFunction(p[1], use_name, *p[5]);
6109 # FILE_NAME(tmp, @3);
6110 # delete[]p[3];
6111 # p[0] = tmp;
6112 # }
6113 ()
6114
6115
6116 def p_expr_primary_12(p):
6117 '''expr_primary : SYSTEM_IDENTIFIER '(' ')' '''
6118 if(parse_debug):
6119 print('expr_primary_12', list(p))
6120
6121 # { perm_string tn = lex_strings.make(p[1]);
6122 # const vector<PExpr*>empty;
6123 # PECallFunction*tmp = new PECallFunction(tn, empty);
6124 # FILE_NAME(tmp, @1);
6125 # delete[]p[1];
6126 # p[0] = tmp;
6127 # if (!gn_system_verilog()) {
6128 # yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
6129 # }
6130 # }
6131 ()
6132
6133
6134 def p_expr_primary_13(p):
6135 '''expr_primary : implicit_class_handle '''
6136 if(parse_debug):
6137 print('expr_primary_13', list(p))
6138
6139 # { PEIdent*tmp = new PEIdent(*p[1]);
6140 # FILE_NAME(tmp,@1);
6141 # delete p[1];
6142 # p[0] = tmp;
6143 # }
6144 ()
6145
6146
6147 def p_expr_primary_14(p):
6148 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '''
6149 if(parse_debug):
6150 print('expr_primary_14', list(p))
6151
6152 # { pform_name_t*t_name = p[1];
6153 # while (! p[3]->empty()) {
6154 # t_name->push_back(p[3]->front());
6155 # p[3]->pop_front();
6156 # }
6157 # PEIdent*tmp = new PEIdent(*t_name);
6158 # FILE_NAME(tmp,@1);
6159 # delete p[1];
6160 # delete p[3];
6161 # p[0] = tmp;
6162 # }
6163 ()
6164
6165
6166 def p_expr_primary_15(p):
6167 '''expr_primary : K_acos '(' expression ')' '''
6168 if(parse_debug):
6169 print('expr_primary_15', list(p))
6170
6171 # { perm_string tn = perm_string::literal("$acos");
6172 # PECallFunction*tmp = make_call_function(tn, p[3]);
6173 # FILE_NAME(tmp,@1);
6174 # p[0] = tmp;
6175 # }
6176 ()
6177
6178
6179 def p_expr_primary_16(p):
6180 '''expr_primary : K_acosh '(' expression ')' '''
6181 if(parse_debug):
6182 print('expr_primary_16', list(p))
6183
6184 # { perm_string tn = perm_string::literal("$acosh");
6185 # PECallFunction*tmp = make_call_function(tn, p[3]);
6186 # FILE_NAME(tmp,@1);
6187 # p[0] = tmp;
6188 # }
6189 ()
6190
6191
6192 def p_expr_primary_17(p):
6193 '''expr_primary : K_asin '(' expression ')' '''
6194 if(parse_debug):
6195 print('expr_primary_17', list(p))
6196
6197 # { perm_string tn = perm_string::literal("$asin");
6198 # PECallFunction*tmp = make_call_function(tn, p[3]);
6199 # FILE_NAME(tmp,@1);
6200 # p[0] = tmp;
6201 # }
6202 ()
6203
6204
6205 def p_expr_primary_18(p):
6206 '''expr_primary : K_asinh '(' expression ')' '''
6207 if(parse_debug):
6208 print('expr_primary_18', list(p))
6209
6210 # { perm_string tn = perm_string::literal("$asinh");
6211 # PECallFunction*tmp = make_call_function(tn, p[3]);
6212 # FILE_NAME(tmp,@1);
6213 # p[0] = tmp;
6214 # }
6215 ()
6216
6217
6218 def p_expr_primary_19(p):
6219 '''expr_primary : K_atan '(' expression ')' '''
6220 if(parse_debug):
6221 print('expr_primary_19', list(p))
6222
6223 # { perm_string tn = perm_string::literal("$atan");
6224 # PECallFunction*tmp = make_call_function(tn, p[3]);
6225 # FILE_NAME(tmp,@1);
6226 # p[0] = tmp;
6227 # }
6228 ()
6229
6230
6231 def p_expr_primary_20(p):
6232 '''expr_primary : K_atanh '(' expression ')' '''
6233 if(parse_debug):
6234 print('expr_primary_20', list(p))
6235
6236 # { perm_string tn = perm_string::literal("$atanh");
6237 # PECallFunction*tmp = make_call_function(tn, p[3]);
6238 # FILE_NAME(tmp,@1);
6239 # p[0] = tmp;
6240 # }
6241 ()
6242
6243
6244 def p_expr_primary_21(p):
6245 '''expr_primary : K_atan2 '(' expression ',' expression ')' '''
6246 if(parse_debug):
6247 print('expr_primary_21', list(p))
6248
6249 # { perm_string tn = perm_string::literal("$atan2");
6250 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6251 # FILE_NAME(tmp,@1);
6252 # p[0] = tmp;
6253 # }
6254 ()
6255
6256
6257 def p_expr_primary_22(p):
6258 '''expr_primary : K_ceil '(' expression ')' '''
6259 if(parse_debug):
6260 print('expr_primary_22', list(p))
6261
6262 # { perm_string tn = perm_string::literal("$ceil");
6263 # PECallFunction*tmp = make_call_function(tn, p[3]);
6264 # FILE_NAME(tmp,@1);
6265 # p[0] = tmp;
6266 # }
6267 ()
6268
6269
6270 def p_expr_primary_23(p):
6271 '''expr_primary : K_cos '(' expression ')' '''
6272 if(parse_debug):
6273 print('expr_primary_23', list(p))
6274
6275 # { perm_string tn = perm_string::literal("$cos");
6276 # PECallFunction*tmp = make_call_function(tn, p[3]);
6277 # FILE_NAME(tmp,@1);
6278 # p[0] = tmp;
6279 # }
6280 ()
6281
6282
6283 def p_expr_primary_24(p):
6284 '''expr_primary : K_cosh '(' expression ')' '''
6285 if(parse_debug):
6286 print('expr_primary_24', list(p))
6287
6288 # { perm_string tn = perm_string::literal("$cosh");
6289 # PECallFunction*tmp = make_call_function(tn, p[3]);
6290 # FILE_NAME(tmp,@1);
6291 # p[0] = tmp;
6292 # }
6293 ()
6294
6295
6296 def p_expr_primary_25(p):
6297 '''expr_primary : K_exp '(' expression ')' '''
6298 if(parse_debug):
6299 print('expr_primary_25', list(p))
6300
6301 # { perm_string tn = perm_string::literal("$exp");
6302 # PECallFunction*tmp = make_call_function(tn, p[3]);
6303 # FILE_NAME(tmp,@1);
6304 # p[0] = tmp;
6305 # }
6306 ()
6307
6308
6309 def p_expr_primary_26(p):
6310 '''expr_primary : K_floor '(' expression ')' '''
6311 if(parse_debug):
6312 print('expr_primary_26', list(p))
6313
6314 # { perm_string tn = perm_string::literal("$floor");
6315 # PECallFunction*tmp = make_call_function(tn, p[3]);
6316 # FILE_NAME(tmp,@1);
6317 # p[0] = tmp;
6318 # }
6319 ()
6320
6321
6322 def p_expr_primary_27(p):
6323 '''expr_primary : K_hypot '(' expression ',' expression ')' '''
6324 if(parse_debug):
6325 print('expr_primary_27', list(p))
6326
6327 # { perm_string tn = perm_string::literal("$hypot");
6328 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6329 # FILE_NAME(tmp,@1);
6330 # p[0] = tmp;
6331 # }
6332 ()
6333
6334
6335 def p_expr_primary_28(p):
6336 '''expr_primary : K_ln '(' expression ')' '''
6337 if(parse_debug):
6338 print('expr_primary_28', list(p))
6339
6340 # { perm_string tn = perm_string::literal("$ln");
6341 # PECallFunction*tmp = make_call_function(tn, p[3]);
6342 # FILE_NAME(tmp,@1);
6343 # p[0] = tmp;
6344 # }
6345 ()
6346
6347
6348 def p_expr_primary_29(p):
6349 '''expr_primary : K_log '(' expression ')' '''
6350 if(parse_debug):
6351 print('expr_primary_29', list(p))
6352
6353 # { perm_string tn = perm_string::literal("$log10");
6354 # PECallFunction*tmp = make_call_function(tn, p[3]);
6355 # FILE_NAME(tmp,@1);
6356 # p[0] = tmp;
6357 # }
6358 ()
6359
6360
6361 def p_expr_primary_30(p):
6362 '''expr_primary : K_pow '(' expression ',' expression ')' '''
6363 if(parse_debug):
6364 print('expr_primary_30', list(p))
6365
6366 # { perm_string tn = perm_string::literal("$pow");
6367 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6368 # FILE_NAME(tmp,@1);
6369 # p[0] = tmp;
6370 # }
6371 ()
6372
6373
6374 def p_expr_primary_31(p):
6375 '''expr_primary : K_sin '(' expression ')' '''
6376 if(parse_debug):
6377 print('expr_primary_31', list(p))
6378
6379 # { perm_string tn = perm_string::literal("$sin");
6380 # PECallFunction*tmp = make_call_function(tn, p[3]);
6381 # FILE_NAME(tmp,@1);
6382 # p[0] = tmp;
6383 # }
6384 ()
6385
6386
6387 def p_expr_primary_32(p):
6388 '''expr_primary : K_sinh '(' expression ')' '''
6389 if(parse_debug):
6390 print('expr_primary_32', list(p))
6391
6392 # { perm_string tn = perm_string::literal("$sinh");
6393 # PECallFunction*tmp = make_call_function(tn, p[3]);
6394 # FILE_NAME(tmp,@1);
6395 # p[0] = tmp;
6396 # }
6397 ()
6398
6399
6400 def p_expr_primary_33(p):
6401 '''expr_primary : K_sqrt '(' expression ')' '''
6402 if(parse_debug):
6403 print('expr_primary_33', list(p))
6404
6405 # { perm_string tn = perm_string::literal("$sqrt");
6406 # PECallFunction*tmp = make_call_function(tn, p[3]);
6407 # FILE_NAME(tmp,@1);
6408 # p[0] = tmp;
6409 # }
6410 ()
6411
6412
6413 def p_expr_primary_34(p):
6414 '''expr_primary : K_tan '(' expression ')' '''
6415 if(parse_debug):
6416 print('expr_primary_34', list(p))
6417
6418 # { perm_string tn = perm_string::literal("$tan");
6419 # PECallFunction*tmp = make_call_function(tn, p[3]);
6420 # FILE_NAME(tmp,@1);
6421 # p[0] = tmp;
6422 # }
6423 ()
6424
6425
6426 def p_expr_primary_35(p):
6427 '''expr_primary : K_tanh '(' expression ')' '''
6428 if(parse_debug):
6429 print('expr_primary_35', list(p))
6430
6431 # { perm_string tn = perm_string::literal("$tanh");
6432 # PECallFunction*tmp = make_call_function(tn, p[3]);
6433 # FILE_NAME(tmp,@1);
6434 # p[0] = tmp;
6435 # }
6436 ()
6437
6438
6439 def p_expr_primary_36(p):
6440 '''expr_primary : K_abs '(' expression ')' '''
6441 if(parse_debug):
6442 print('expr_primary_36', list(p))
6443
6444 # { PEUnary*tmp = new PEUnary('m', p[3]);
6445 # FILE_NAME(tmp,@1);
6446 # p[0] = tmp;
6447 # }
6448 ()
6449
6450
6451 def p_expr_primary_37(p):
6452 '''expr_primary : K_max '(' expression ',' expression ')' '''
6453 if(parse_debug):
6454 print('expr_primary_37', list(p))
6455
6456 # { PEBinary*tmp = new PEBinary('M', p[3], p[5]);
6457 # FILE_NAME(tmp,@1);
6458 # p[0] = tmp;
6459 # }
6460 ()
6461
6462
6463 def p_expr_primary_38(p):
6464 '''expr_primary : K_min '(' expression ',' expression ')' '''
6465 if(parse_debug):
6466 print('expr_primary_38', list(p))
6467
6468 # { PEBinary*tmp = new PEBinary('m', p[3], p[5]);
6469 # FILE_NAME(tmp,@1);
6470 # p[0] = tmp;
6471 # }
6472 ()
6473
6474
6475 def p_expr_primary_39(p):
6476 '''expr_primary : '(' expr_mintypmax ')' '''
6477 if(parse_debug):
6478 print('expr_primary_39', list(p))
6479 p[0] = p[2]
6480
6481
6482 ()
6483
6484
6485 def p_expr_primary_40(p):
6486 '''expr_primary : '{' expression_list_proper '}' '''
6487 if(parse_debug):
6488 print('expr_primary_40', list(p))
6489
6490 # { PEConcat*tmp = new PEConcat(*p[2]);
6491 # FILE_NAME(tmp, @1);
6492 # delete p[2];
6493 # p[0] = tmp;
6494 # }
6495 ()
6496
6497
6498 def p_expr_primary_41(p):
6499 '''expr_primary : '{' expression '{' expression_list_proper '}' '}' '''
6500 if(parse_debug):
6501 print('expr_primary_41', list(p))
6502
6503 # { PExpr*rep = p[2];
6504 # PEConcat*tmp = new PEConcat(*p[4], rep);
6505 # FILE_NAME(tmp, @1);
6506 # delete p[4];
6507 # p[0] = tmp;
6508 # }
6509 ()
6510
6511
6512 def p_expr_primary_42(p):
6513 '''expr_primary : '{' expression '{' expression_list_proper '}' error '}' '''
6514 if(parse_debug):
6515 print('expr_primary_42', list(p))
6516
6517 # { PExpr*rep = p[2];
6518 # PEConcat*tmp = new PEConcat(*p[4], rep);
6519 # FILE_NAME(tmp, @1);
6520 # delete p[4];
6521 # p[0] = tmp;
6522 # yyerror(@5, "error: Syntax error between internal '}' "
6523 # "and closing '}' of repeat concatenation.");
6524 # yyerrok;
6525 # }
6526 ()
6527
6528
6529 def p_expr_primary_43(p):
6530 '''expr_primary : '{' '}' '''
6531 if(parse_debug):
6532 print('expr_primary_43', list(p))
6533
6534 # { // This is the empty queue syntax.
6535 # if (gn_system_verilog()) {
6536 # list<PExpr*> empty_list;
6537 # PEConcat*tmp = new PEConcat(empty_list);
6538 # FILE_NAME(tmp, @1);
6539 # p[0] = tmp;
6540 # } else {
6541 # yyerror(@1, "error: Concatenations are not allowed to be empty.");
6542 # p[0] = None
6543 # }
6544 # }
6545 ()
6546
6547
6548 def p_expr_primary_44(p):
6549 '''expr_primary : expr_primary "'" '(' expression ')' '''
6550 if(parse_debug):
6551 print('expr_primary_44', list(p))
6552
6553 # { PExpr*base = p[4];
6554 # if (gn_system_verilog()) {
6555 # PECastSize*tmp = new PECastSize(p[1], base);
6556 # FILE_NAME(tmp, @1);
6557 # p[0] = tmp;
6558 # } else {
6559 # yyerror(@1, "error: Size cast requires SystemVerilog.");
6560 # p[0] = base;
6561 # }
6562 # }
6563 ()
6564
6565
6566 def p_expr_primary_45(p):
6567 '''expr_primary : simple_type_or_string "'" '(' expression ')' '''
6568 if(parse_debug):
6569 print('expr_primary_45', list(p))
6570
6571 # { PExpr*base = p[4];
6572 # if (gn_system_verilog()) {
6573 # PECastType*tmp = new PECastType(p[1], base);
6574 # FILE_NAME(tmp, @1);
6575 # p[0] = tmp;
6576 # } else {
6577 # yyerror(@1, "error: Type cast requires SystemVerilog.");
6578 # p[0] = base;
6579 # }
6580 # }
6581 ()
6582
6583
6584 def p_expr_primary_46(p):
6585 '''expr_primary : assignment_pattern '''
6586 if(parse_debug):
6587 print('expr_primary_46', list(p))
6588 p[0] = p[1]
6589
6590
6591 ()
6592
6593
6594 def p_expr_primary_47(p):
6595 '''expr_primary : streaming_concatenation '''
6596 if(parse_debug):
6597 print('expr_primary_47', list(p))
6598 p[0] = p[1]
6599
6600
6601 ()
6602
6603
6604 def p_expr_primary_48(p):
6605 '''expr_primary : K_null '''
6606 if(parse_debug):
6607 print('expr_primary_48', list(p))
6608
6609 # { PENull*tmp = new PENull;
6610 # FILE_NAME(tmp, @1);
6611 # p[0] = tmp;
6612 # }
6613 ()
6614
6615
6616 def p_function_item_list_opt_1(p):
6617 '''function_item_list_opt : function_item_list '''
6618 if(parse_debug):
6619 print('function_item_list_opt_1', list(p))
6620 p[0] = p[1]
6621
6622
6623 ()
6624
6625
6626 def p_function_item_list_opt_2(p):
6627 '''function_item_list_opt : '''
6628 if(parse_debug):
6629 print('function_item_list_opt_2', list(p))
6630
6631 # { p[0] = None }
6632 ()
6633
6634
6635 def p_function_item_list_1(p):
6636 '''function_item_list : function_item '''
6637 if(parse_debug):
6638 print('function_item_list_1', list(p))
6639 p[0] = p[1]
6640
6641
6642 ()
6643
6644
6645 def p_function_item_list_2(p):
6646 '''function_item_list : function_item_list function_item '''
6647 if(parse_debug):
6648 print('function_item_list_2', list(p))
6649
6650 # { /* */
6651 # if (p[1] && p[2]) {
6652 # vector<pform_tf_port_t>*tmp = p[1];
6653 # size_t s1 = tmp->size();
6654 # tmp->resize(s1 + p[2]->size());
6655 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
6656 # tmp->at(s1+idx) = p[2]->at(idx);
6657 # delete p[2];
6658 # p[0] = tmp;
6659 # } else if (p[1]) {
6660 # p[0] = p[1];
6661 # } else {
6662 # p[0] = p[2];
6663 # }
6664 # }
6665 ()
6666
6667
6668 def p_function_item_1(p):
6669 '''function_item : tf_port_declaration '''
6670 if(parse_debug):
6671 print('function_item_1', list(p))
6672 p[0] = p[1]
6673
6674
6675 ()
6676
6677
6678 def p_function_item_2(p):
6679 '''function_item : block_item_decl '''
6680 if(parse_debug):
6681 print('function_item_2', list(p))
6682
6683 # { p[0] = None }
6684 ()
6685
6686
6687 def p_gate_instance_1(p):
6688 '''gate_instance : IDENTIFIER '(' expression_list_with_nuls ')' '''
6689 if(parse_debug):
6690 print('gate_instance_1', list(p))
6691
6692 # { lgate*tmp = new lgate;
6693 # tmp->name = p[1];
6694 # tmp->parms = p[3];
6695 # tmp->file = @1.text;
6696 # tmp->lineno = @1.first_line;
6697 # delete[]p[1];
6698 # p[0] = tmp;
6699 # }
6700 ()
6701
6702
6703 def p_gate_instance_2(p):
6704 '''gate_instance : IDENTIFIER dimensions '(' expression_list_with_nuls ')' '''
6705 if(parse_debug):
6706 print('gate_instance_2', list(p))
6707
6708 # { lgate*tmp = new lgate;
6709 # list<pform_range_t>*rng = p[2];
6710 # tmp->name = p[1];
6711 # tmp->parms = p[4];
6712 # tmp->range = rng->front();
6713 # rng->pop_front();
6714 # assert(rng->empty());
6715 # tmp->file = @1.text;
6716 # tmp->lineno = @1.first_line;
6717 # delete[]p[1];
6718 # delete rng;
6719 # p[0] = tmp;
6720 # }
6721 ()
6722
6723
6724 def p_gate_instance_3(p):
6725 '''gate_instance : '(' expression_list_with_nuls ')' '''
6726 if(parse_debug):
6727 print('gate_instance_3', list(p))
6728
6729 # { lgate*tmp = new lgate;
6730 # tmp->name = "";
6731 # tmp->parms = p[2];
6732 # tmp->file = @1.text;
6733 # tmp->lineno = @1.first_line;
6734 # p[0] = tmp;
6735 # }
6736 ()
6737
6738
6739 def p_gate_instance_4(p):
6740 '''gate_instance : IDENTIFIER dimensions '''
6741 if(parse_debug):
6742 print('gate_instance_4', list(p))
6743
6744 # { lgate*tmp = new lgate;
6745 # list<pform_range_t>*rng = p[2];
6746 # tmp->name = p[1];
6747 # tmp->parms = 0;
6748 # tmp->parms_by_name = 0;
6749 # tmp->range = rng->front();
6750 # rng->pop_front();
6751 # assert(rng->empty());
6752 # tmp->file = @1.text;
6753 # tmp->lineno = @1.first_line;
6754 # delete[]p[1];
6755 # delete rng;
6756 # p[0] = tmp;
6757 # }
6758 ()
6759
6760
6761 def p_gate_instance_5(p):
6762 '''gate_instance : IDENTIFIER '(' port_name_list ')' '''
6763 if(parse_debug):
6764 print('gate_instance_5', list(p))
6765
6766 # { lgate*tmp = new lgate;
6767 # tmp->name = p[1];
6768 # tmp->parms = 0;
6769 # tmp->parms_by_name = p[3];
6770 # tmp->file = @1.text;
6771 # tmp->lineno = @1.first_line;
6772 # delete[]p[1];
6773 # p[0] = tmp;
6774 # }
6775 ()
6776
6777
6778 def p_gate_instance_6(p):
6779 '''gate_instance : IDENTIFIER dimensions '(' port_name_list ')' '''
6780 if(parse_debug):
6781 print('gate_instance_6', list(p))
6782
6783 # { lgate*tmp = new lgate;
6784 # list<pform_range_t>*rng = p[2];
6785 # tmp->name = p[1];
6786 # tmp->parms = 0;
6787 # tmp->parms_by_name = p[4];
6788 # tmp->range = rng->front();
6789 # rng->pop_front();
6790 # assert(rng->empty());
6791 # tmp->file = @1.text;
6792 # tmp->lineno = @1.first_line;
6793 # delete[]p[1];
6794 # delete rng;
6795 # p[0] = tmp;
6796 # }
6797 ()
6798
6799
6800 def p_gate_instance_7(p):
6801 '''gate_instance : IDENTIFIER '(' error ')' '''
6802 if(parse_debug):
6803 print('gate_instance_7', list(p))
6804
6805 # { lgate*tmp = new lgate;
6806 # tmp->name = p[1];
6807 # tmp->parms = 0;
6808 # tmp->parms_by_name = 0;
6809 # tmp->file = @1.text;
6810 # tmp->lineno = @1.first_line;
6811 # yyerror(@2, "error: Syntax error in instance port "
6812 # "expression(s).");
6813 # delete[]p[1];
6814 # p[0] = tmp;
6815 # }
6816 ()
6817
6818
6819 def p_gate_instance_8(p):
6820 '''gate_instance : IDENTIFIER dimensions '(' error ')' '''
6821 if(parse_debug):
6822 print('gate_instance_8', list(p))
6823
6824 # { lgate*tmp = new lgate;
6825 # tmp->name = p[1];
6826 # tmp->parms = 0;
6827 # tmp->parms_by_name = 0;
6828 # tmp->file = @1.text;
6829 # tmp->lineno = @1.first_line;
6830 # yyerror(@3, "error: Syntax error in instance port "
6831 # "expression(s).");
6832 # delete[]p[1];
6833 # p[0] = tmp;
6834 # }
6835 ()
6836
6837
6838 def p_gate_instance_list_1(p):
6839 '''gate_instance_list : gate_instance_list ',' gate_instance '''
6840 if(parse_debug):
6841 print('gate_instance_list_1', list(p))
6842
6843 # { svector<lgate>*tmp1 = p[1];
6844 # lgate*tmp2 = p[3];
6845 # svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
6846 # delete tmp1;
6847 # delete tmp2;
6848 # p[0] = out;
6849 # }
6850 ()
6851
6852
6853 def p_gate_instance_list_2(p):
6854 '''gate_instance_list : gate_instance '''
6855 if(parse_debug):
6856 print('gate_instance_list_2', list(p))
6857
6858 # { svector<lgate>*tmp = new svector<lgate>(1);
6859 # (*tmp)[0] = *p[1];
6860 # delete p[1];
6861 # p[0] = tmp;
6862 # }
6863 ()
6864
6865
6866 def p_gatetype_1(p):
6867 '''gatetype : K_and '''
6868 if(parse_debug):
6869 print('gatetype_1', list(p))
6870
6871 # { p[0] = PGBuiltin::AND; }
6872 ()
6873
6874
6875 def p_gatetype_2(p):
6876 '''gatetype : K_nand '''
6877 if(parse_debug):
6878 print('gatetype_2', list(p))
6879
6880 # { p[0] = PGBuiltin::NAND; }
6881 ()
6882
6883
6884 def p_gatetype_3(p):
6885 '''gatetype : K_or '''
6886 if(parse_debug):
6887 print('gatetype_3', list(p))
6888
6889 # { p[0] = PGBuiltin::OR; }
6890 ()
6891
6892
6893 def p_gatetype_4(p):
6894 '''gatetype : K_nor '''
6895 if(parse_debug):
6896 print('gatetype_4', list(p))
6897
6898 # { p[0] = PGBuiltin::NOR; }
6899 ()
6900
6901
6902 def p_gatetype_5(p):
6903 '''gatetype : K_xor '''
6904 if(parse_debug):
6905 print('gatetype_5', list(p))
6906
6907 # { p[0] = PGBuiltin::XOR; }
6908 ()
6909
6910
6911 def p_gatetype_6(p):
6912 '''gatetype : K_xnor '''
6913 if(parse_debug):
6914 print('gatetype_6', list(p))
6915
6916 # { p[0] = PGBuiltin::XNOR; }
6917 ()
6918
6919
6920 def p_gatetype_7(p):
6921 '''gatetype : K_buf '''
6922 if(parse_debug):
6923 print('gatetype_7', list(p))
6924
6925 # { p[0] = PGBuiltin::BUF; }
6926 ()
6927
6928
6929 def p_gatetype_8(p):
6930 '''gatetype : K_bufif0 '''
6931 if(parse_debug):
6932 print('gatetype_8', list(p))
6933
6934 # { p[0] = PGBuiltin::BUFIF0; }
6935 ()
6936
6937
6938 def p_gatetype_9(p):
6939 '''gatetype : K_bufif1 '''
6940 if(parse_debug):
6941 print('gatetype_9', list(p))
6942
6943 # { p[0] = PGBuiltin::BUFIF1; }
6944 ()
6945
6946
6947 def p_gatetype_10(p):
6948 '''gatetype : K_not '''
6949 if(parse_debug):
6950 print('gatetype_10', list(p))
6951
6952 # { p[0] = PGBuiltin::NOT; }
6953 ()
6954
6955
6956 def p_gatetype_11(p):
6957 '''gatetype : K_notif0 '''
6958 if(parse_debug):
6959 print('gatetype_11', list(p))
6960
6961 # { p[0] = PGBuiltin::NOTIF0; }
6962 ()
6963
6964
6965 def p_gatetype_12(p):
6966 '''gatetype : K_notif1 '''
6967 if(parse_debug):
6968 print('gatetype_12', list(p))
6969
6970 # { p[0] = PGBuiltin::NOTIF1; }
6971 ()
6972
6973
6974 def p_switchtype_1(p):
6975 '''switchtype : K_nmos '''
6976 if(parse_debug):
6977 print('switchtype_1', list(p))
6978
6979 # { p[0] = PGBuiltin::NMOS; }
6980 ()
6981
6982
6983 def p_switchtype_2(p):
6984 '''switchtype : K_rnmos '''
6985 if(parse_debug):
6986 print('switchtype_2', list(p))
6987
6988 # { p[0] = PGBuiltin::RNMOS; }
6989 ()
6990
6991
6992 def p_switchtype_3(p):
6993 '''switchtype : K_pmos '''
6994 if(parse_debug):
6995 print('switchtype_3', list(p))
6996
6997 # { p[0] = PGBuiltin::PMOS; }
6998 ()
6999
7000
7001 def p_switchtype_4(p):
7002 '''switchtype : K_rpmos '''
7003 if(parse_debug):
7004 print('switchtype_4', list(p))
7005
7006 # { p[0] = PGBuiltin::RPMOS; }
7007 ()
7008
7009
7010 def p_switchtype_5(p):
7011 '''switchtype : K_cmos '''
7012 if(parse_debug):
7013 print('switchtype_5', list(p))
7014
7015 # { p[0] = PGBuiltin::CMOS; }
7016 ()
7017
7018
7019 def p_switchtype_6(p):
7020 '''switchtype : K_rcmos '''
7021 if(parse_debug):
7022 print('switchtype_6', list(p))
7023
7024 # { p[0] = PGBuiltin::RCMOS; }
7025 ()
7026
7027
7028 def p_switchtype_7(p):
7029 '''switchtype : K_tran '''
7030 if(parse_debug):
7031 print('switchtype_7', list(p))
7032
7033 # { p[0] = PGBuiltin::TRAN; }
7034 ()
7035
7036
7037 def p_switchtype_8(p):
7038 '''switchtype : K_rtran '''
7039 if(parse_debug):
7040 print('switchtype_8', list(p))
7041
7042 # { p[0] = PGBuiltin::RTRAN; }
7043 ()
7044
7045
7046 def p_switchtype_9(p):
7047 '''switchtype : K_tranif0 '''
7048 if(parse_debug):
7049 print('switchtype_9', list(p))
7050
7051 # { p[0] = PGBuiltin::TRANIF0; }
7052 ()
7053
7054
7055 def p_switchtype_10(p):
7056 '''switchtype : K_tranif1 '''
7057 if(parse_debug):
7058 print('switchtype_10', list(p))
7059
7060 # { p[0] = PGBuiltin::TRANIF1; }
7061 ()
7062
7063
7064 def p_switchtype_11(p):
7065 '''switchtype : K_rtranif0 '''
7066 if(parse_debug):
7067 print('switchtype_11', list(p))
7068
7069 # { p[0] = PGBuiltin::RTRANIF0; }
7070 ()
7071
7072
7073 def p_switchtype_12(p):
7074 '''switchtype : K_rtranif1 '''
7075 if(parse_debug):
7076 print('switchtype_12', list(p))
7077
7078 # { p[0] = PGBuiltin::RTRANIF1; }
7079 ()
7080
7081
7082 def p_hierarchy_identifier_1(p):
7083 '''hierarchy_identifier : IDENTIFIER '''
7084 if(parse_debug):
7085 print('hierarchy_identifier_1 FIXME', list(p))
7086 lpvalue = Leaf(token.NAME, p[1])
7087 p[0] = lpvalue
7088
7089 # { p[0] = new pform_name_t;
7090 # p[0]->push_back(name_component_t(lex_strings.make(p[1])));
7091 # delete[]p[1];
7092 # }
7093 ()
7094
7095
7096 def p_hierarchy_identifier_2(p):
7097 '''hierarchy_identifier : hierarchy_identifier '.' IDENTIFIER '''
7098 if(parse_debug):
7099 print('hierarchy_identifier_2', list(p))
7100
7101 # { pform_name_t * tmp = p[1];
7102 # tmp->push_back(name_component_t(lex_strings.make(p[3])));
7103 # delete[]p[3];
7104 # p[0] = tmp;
7105 # }
7106 ()
7107
7108
7109 def p_hierarchy_identifier_3(p):
7110 '''hierarchy_identifier : hierarchy_identifier '[' expression ']' '''
7111 if(parse_debug):
7112 print('hierarchy_identifier_3', list(p))
7113
7114 # { pform_name_t * tmp = p[1];
7115 # name_component_t&tail = tmp->back();
7116 # index_component_t itmp;
7117 # itmp.sel = index_component_t::SEL_BIT;
7118 # itmp.msb = p[3];
7119 # tail.index.push_back(itmp);
7120 # p[0] = tmp;
7121 # }
7122 ()
7123
7124
7125 def p_hierarchy_identifier_4(p):
7126 '''hierarchy_identifier : hierarchy_identifier '[' '$' ']' '''
7127 if(parse_debug):
7128 print('hierarchy_identifier_4', list(p))
7129
7130 # { pform_name_t * tmp = p[1];
7131 # name_component_t&tail = tmp->back();
7132 # if (! gn_system_verilog()) {
7133 # yyerror(@3, "error: Last element expression ($) "
7134 # "requires SystemVerilog. Try enabling SystemVerilog.");
7135 # }
7136 # index_component_t itmp;
7137 # itmp.sel = index_component_t::SEL_BIT_LAST;
7138 # itmp.msb = 0;
7139 # itmp.lsb = 0;
7140 # tail.index.push_back(itmp);
7141 # p[0] = tmp;
7142 # }
7143 ()
7144
7145
7146 def p_hierarchy_identifier_5(p):
7147 '''hierarchy_identifier : hierarchy_identifier '[' expression ':' expression ']' '''
7148 if(parse_debug):
7149 print('hierarchy_identifier_5', list(p))
7150
7151 # { pform_name_t * tmp = p[1];
7152 # name_component_t&tail = tmp->back();
7153 # index_component_t itmp;
7154 # itmp.sel = index_component_t::SEL_PART;
7155 # itmp.msb = p[3];
7156 # itmp.lsb = p[5];
7157 # tail.index.push_back(itmp);
7158 # p[0] = tmp;
7159 # }
7160 ()
7161
7162
7163 def p_hierarchy_identifier_6(p):
7164 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_POS expression ']' '''
7165 if(parse_debug):
7166 print('hierarchy_identifier_6', list(p))
7167
7168 # { pform_name_t * tmp = p[1];
7169 # name_component_t&tail = tmp->back();
7170 # index_component_t itmp;
7171 # itmp.sel = index_component_t::SEL_IDX_UP;
7172 # itmp.msb = p[3];
7173 # itmp.lsb = p[5];
7174 # tail.index.push_back(itmp);
7175 # p[0] = tmp;
7176 # }
7177 ()
7178
7179
7180 def p_hierarchy_identifier_7(p):
7181 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_NEG expression ']' '''
7182 if(parse_debug):
7183 print('hierarchy_identifier_7', list(p))
7184
7185 # { pform_name_t * tmp = p[1];
7186 # name_component_t&tail = tmp->back();
7187 # index_component_t itmp;
7188 # itmp.sel = index_component_t::SEL_IDX_DO;
7189 # itmp.msb = p[3];
7190 # itmp.lsb = p[5];
7191 # tail.index.push_back(itmp);
7192 # p[0] = tmp;
7193 # }
7194 ()
7195
7196
7197 def p_list_of_identifiers_1(p):
7198 '''list_of_identifiers : IDENTIFIER '''
7199 if(parse_debug):
7200 print('list_of_identifiers_1', list(p))
7201
7202 # { p[0] = list_from_identifier(p[1]); }
7203 ()
7204
7205
7206 def p_list_of_identifiers_2(p):
7207 '''list_of_identifiers : list_of_identifiers ',' IDENTIFIER '''
7208 if(parse_debug):
7209 print('list_of_identifiers_2', list(p))
7210
7211 # { p[0] = list_from_identifier(p[1], p[3]); }
7212 ()
7213
7214
7215 def p_list_of_port_identifiers_1(p):
7216 '''list_of_port_identifiers : IDENTIFIER dimensions_opt '''
7217 if(parse_debug):
7218 print('list_of_port_identifiers_1', list(p))
7219
7220 # { p[0] = make_port_list(p[1], p[2], 0); }
7221 ()
7222
7223
7224 def p_list_of_port_identifiers_2(p):
7225 '''list_of_port_identifiers : list_of_port_identifiers ',' IDENTIFIER dimensions_opt '''
7226 if(parse_debug):
7227 print('list_of_port_identifiers_2', list(p))
7228
7229 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
7230 ()
7231
7232
7233 def p_list_of_variable_port_identifiers_1(p):
7234 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '''
7235 if(parse_debug):
7236 print('list_of_variable_port_identifiers_1', list(p))
7237
7238 # { p[0] = make_port_list(p[1], p[2], 0); }
7239 ()
7240
7241
7242 def p_list_of_variable_port_identifiers_2(p):
7243 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '=' expression '''
7244 if(parse_debug):
7245 print('list_of_variable_port_identifiers_2', list(p))
7246
7247 # { p[0] = make_port_list(p[1], p[2], p[4]); }
7248 ()
7249
7250
7251 def p_list_of_variable_port_identifiers_3(p):
7252 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '''
7253 if(parse_debug):
7254 print('list_of_variable_port_identifiers_3', list(p))
7255
7256 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
7257 ()
7258
7259
7260 def p_list_of_variable_port_identifiers_4(p):
7261 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '=' expression '''
7262 if(parse_debug):
7263 print('list_of_variable_port_identifiers_4', list(p))
7264
7265 # { p[0] = make_port_list(p[1], p[3], p[4], p[6]); }
7266 ()
7267
7268
7269 def p_list_of_ports_1(p):
7270 '''list_of_ports : port_opt '''
7271 if(parse_debug):
7272 print('list_of_ports_1', list(p))
7273
7274 # { vector<Module::port_t*>*tmp
7275 # = new vector<Module::port_t*>(1);
7276 # (*tmp)[0] = p[1];
7277 # p[0] = tmp;
7278 # }
7279 ()
7280
7281
7282 def p_list_of_ports_2(p):
7283 '''list_of_ports : list_of_ports ',' port_opt '''
7284 if(parse_debug):
7285 print('list_of_ports_2', list(p))
7286
7287 # { vector<Module::port_t*>*tmp = p[1];
7288 # tmp->push_back(p[3]);
7289 # p[0] = tmp;
7290 # }
7291 ()
7292
7293
7294 def p_list_of_port_declarations_1(p):
7295 '''list_of_port_declarations : port_declaration '''
7296 if(parse_debug > 1):
7297 print('list_of_port_declarations_1', list(p))
7298 p[0] = [p[1]]
7299
7300 # { vector<Module::port_t*>*tmp
7301 # = new vector<Module::port_t*>(1);
7302 # (*tmp)[0] = p[1];
7303 # p[0] = tmp;
7304 # }
7305 ()
7306
7307
7308 def p_list_of_port_declarations_2(p):
7309 '''list_of_port_declarations : list_of_port_declarations ',' port_declaration '''
7310 if(parse_debug):
7311 print('list_of_port_declarations_2 FIXME', list(p))
7312 # MOVE_TO absyn p[1].append(Leaf(token.NEWLINE, '\n')) # should be a comma
7313 # XXX p[3].prefix=' ' # add a space after the NL, must go in parameter
7314 p[1].append(p[3])
7315 p[0] = p[1]
7316
7317 # { vector<Module::port_t*>*tmp = p[1];
7318 # tmp->push_back(p[3]);
7319 # p[0] = tmp;
7320 # }
7321 ()
7322
7323
7324 def p_list_of_port_declarations_3(p):
7325 '''list_of_port_declarations : list_of_port_declarations ',' IDENTIFIER '''
7326 if(parse_debug):
7327 print('list_of_port_declarations_3', list(p))
7328
7329 # { Module::port_t*ptmp;
7330 # perm_string name = lex_strings.make(p[3]);
7331 # ptmp = pform_module_port_reference(name, @3.text,
7332 # @3.first_line);
7333 # vector<Module::port_t*>*tmp = p[1];
7334 # tmp->push_back(ptmp);
7335 #
7336 # /* Get the port declaration details, the port type
7337 # and what not, from context data stored by the
7338 # last port_declaration rule. */
7339 # pform_module_define_port(@3, name,
7340 # port_declaration_context.port_type,
7341 # port_declaration_context.port_net_type,
7342 # port_declaration_context.data_type, 0);
7343 # delete[]p[3];
7344 # p[0] = tmp;
7345 # }
7346 ()
7347
7348
7349 def p_list_of_port_declarations_4(p):
7350 '''list_of_port_declarations : list_of_port_declarations ',' '''
7351 if(parse_debug):
7352 print('list_of_port_declarations_4', list(p))
7353
7354 # {
7355 # yyerror(@2, "error: NULL port declarations are not "
7356 # "allowed.");
7357 # }
7358 ()
7359
7360
7361 def p_list_of_port_declarations_5(p):
7362 '''list_of_port_declarations : list_of_port_declarations ';' '''
7363 if(parse_debug):
7364 print('list_of_port_declarations_5', list(p))
7365
7366 # {
7367 # yyerror(@2, "error: ';' is an invalid port declaration "
7368 # "separator.");
7369 # }
7370 ()
7371
7372
7373 def p_port_declaration_1(p):
7374 '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7375 if(parse_debug):
7376 print('port_declaration_1 FIXME', list(p))
7377 comment, dt, name = p[2], p[4], p[5]
7378 p[0] = absyn.port_decl(comment, dt, name)
7379
7380 # { Module::port_t*ptmp;
7381 # perm_string name = lex_strings.make(p[5]);
7382 # data_type_t*use_type = p[4];
7383 # if (p[6]) use_type = new uarray_type_t(use_type, p[6]);
7384 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7385 # pform_module_define_port(@2, name, NetNet::PINPUT, p[3], use_type, p[1]);
7386 # port_declaration_context.port_type = NetNet::PINPUT;
7387 # port_declaration_context.port_net_type = p[3];
7388 # port_declaration_context.data_type = p[4];
7389 # delete[]p[5];
7390 # p[0] = ptmp;
7391 # }
7392 ()
7393
7394
7395 def p_port_declaration_2(p):
7396 '''port_declaration : attribute_list_opt K_input K_wreal IDENTIFIER '''
7397 if(parse_debug):
7398 print('port_declaration_2', list(p))
7399
7400 # { Module::port_t*ptmp;
7401 # perm_string name = lex_strings.make(p[4]);
7402 # ptmp = pform_module_port_reference(name, @2.text,
7403 # @2.first_line);
7404 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7405 # FILE_NAME(real_type, @3);
7406 # pform_module_define_port(@2, name, NetNet::PINPUT,
7407 # NetNet::WIRE, real_type, p[1]);
7408 # port_declaration_context.port_type = NetNet::PINPUT;
7409 # port_declaration_context.port_net_type = NetNet::WIRE;
7410 # port_declaration_context.data_type = real_type;
7411 # delete[]p[4];
7412 # p[0] = ptmp;
7413 # }
7414 ()
7415
7416
7417 def p_port_declaration_3(p):
7418 '''port_declaration : attribute_list_opt K_inout net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7419 if(parse_debug):
7420 print('port_declaration_3', list(p))
7421
7422 # { Module::port_t*ptmp;
7423 # perm_string name = lex_strings.make(p[5]);
7424 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7425 # pform_module_define_port(@2, name, NetNet::PINOUT, p[3], p[4], p[1]);
7426 # port_declaration_context.port_type = NetNet::PINOUT;
7427 # port_declaration_context.port_net_type = p[3];
7428 # port_declaration_context.data_type = p[4];
7429 # delete[]p[5];
7430 # if (p[6]) {
7431 # yyerror(@6, "sorry: Inout ports with unpacked dimensions not supported.");
7432 # delete p[6];
7433 # }
7434 # p[0] = ptmp;
7435 # }
7436 ()
7437
7438
7439 def p_port_declaration_4(p):
7440 '''port_declaration : attribute_list_opt K_inout K_wreal IDENTIFIER '''
7441 if(parse_debug):
7442 print('port_declaration_4', list(p))
7443
7444 # { Module::port_t*ptmp;
7445 # perm_string name = lex_strings.make(p[4]);
7446 # ptmp = pform_module_port_reference(name, @2.text,
7447 # @2.first_line);
7448 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7449 # FILE_NAME(real_type, @3);
7450 # pform_module_define_port(@2, name, NetNet::PINOUT,
7451 # NetNet::WIRE, real_type, p[1]);
7452 # port_declaration_context.port_type = NetNet::PINOUT;
7453 # port_declaration_context.port_net_type = NetNet::WIRE;
7454 # port_declaration_context.data_type = real_type;
7455 # delete[]p[4];
7456 # p[0] = ptmp;
7457 # }
7458 ()
7459
7460
7461 def p_port_declaration_5(p):
7462 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7463 if(parse_debug):
7464 print('port_declaration_5 FIXME', list(p))
7465 comment, dt, name = p[2], p[4], p[5]
7466 p[0] = absyn.port_decl(comment, dt, name)
7467
7468 # { Module::port_t*ptmp;
7469 # perm_string name = lex_strings.make(p[5]);
7470 # data_type_t*use_dtype = p[4];
7471 # if (p[6]) use_dtype = new uarray_type_t(use_dtype, p[6]);
7472 # NetNet::Type use_type = p[3];
7473 # if (use_type == NetNet::IMPLICIT) {
7474 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
7475 # if (dtype->reg_flag)
7476 # use_type = NetNet::REG;
7477 # else if (dtype->implicit_flag)
7478 # use_type = NetNet::IMPLICIT;
7479 # else
7480 # use_type = NetNet::IMPLICIT_REG;
7481 #
7482 # // The SystemVerilog types that can show up as
7483 # // output ports are implicitly (on the inside)
7484 # // variables because "reg" is not valid syntax
7485 # // here.
7486 # } else if (dynamic_cast<atom2_type_t*> (p[4])) {
7487 # use_type = NetNet::IMPLICIT_REG;
7488 # } else if (dynamic_cast<struct_type_t*> (p[4])) {
7489 # use_type = NetNet::IMPLICIT_REG;
7490 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[4])) {
7491 # if(etype->base_type == IVL_VT_LOGIC)
7492 # use_type = NetNet::IMPLICIT_REG;
7493 # }
7494 # }
7495 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7496 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, use_dtype, p[1]);
7497 # port_declaration_context.port_type = NetNet::POUTPUT;
7498 # port_declaration_context.port_net_type = use_type;
7499 # port_declaration_context.data_type = p[4];
7500 # delete[]p[5];
7501 # p[0] = ptmp;
7502 # }
7503 ()
7504
7505
7506 def p_port_declaration_6(p):
7507 '''port_declaration : attribute_list_opt K_output K_wreal IDENTIFIER '''
7508 if(parse_debug):
7509 print('port_declaration_6', list(p))
7510
7511 # { Module::port_t*ptmp;
7512 # perm_string name = lex_strings.make(p[4]);
7513 # ptmp = pform_module_port_reference(name, @2.text,
7514 # @2.first_line);
7515 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7516 # FILE_NAME(real_type, @3);
7517 # pform_module_define_port(@2, name, NetNet::POUTPUT,
7518 # NetNet::WIRE, real_type, p[1]);
7519 # port_declaration_context.port_type = NetNet::POUTPUT;
7520 # port_declaration_context.port_net_type = NetNet::WIRE;
7521 # port_declaration_context.data_type = real_type;
7522 # delete[]p[4];
7523 # p[0] = ptmp;
7524 # }
7525 ()
7526
7527
7528 def p_port_declaration_7(p):
7529 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER '=' expression '''
7530 if(parse_debug):
7531 print('port_declaration_7', list(p))
7532
7533 # { Module::port_t*ptmp;
7534 # perm_string name = lex_strings.make(p[5]);
7535 # NetNet::Type use_type = p[3];
7536 # if (use_type == NetNet::IMPLICIT) {
7537 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
7538 # if (dtype->reg_flag)
7539 # use_type = NetNet::REG;
7540 # else
7541 # use_type = NetNet::IMPLICIT_REG;
7542 # } else {
7543 # use_type = NetNet::IMPLICIT_REG;
7544 # }
7545 # }
7546 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7547 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, p[4], p[1]);
7548 # port_declaration_context.port_type = NetNet::PINOUT;
7549 # port_declaration_context.port_net_type = use_type;
7550 # port_declaration_context.data_type = p[4];
7551 #
7552 # pform_make_var_init(@5, name, p[7]);
7553 #
7554 # delete[]p[5];
7555 # p[0] = ptmp;
7556 # }
7557 ()
7558
7559
7560 def p_net_type_opt_1(p):
7561 '''net_type_opt : net_type '''
7562 if(parse_debug):
7563 print('net_type_opt_1', list(p))
7564 p[0] = p[1]
7565
7566
7567 ()
7568
7569
7570 def p_net_type_opt_2(p):
7571 '''net_type_opt : '''
7572 if(parse_debug > 2):
7573 print('net_type_opt_2', list(p))
7574 p[0] = NN_IMPLICIT
7575
7576
7577 ()
7578
7579
7580 def p_unsigned_signed_opt_1(p):
7581 '''unsigned_signed_opt : K_signed '''
7582 if(parse_debug):
7583 print('unsigned_signed_opt_1', list(p))
7584 p[0] = True
7585
7586
7587 ()
7588
7589
7590 def p_unsigned_signed_opt_2(p):
7591 '''unsigned_signed_opt : K_unsigned '''
7592 if(parse_debug):
7593 print('unsigned_signed_opt_2', list(p))
7594 p[0] = False
7595
7596
7597 ()
7598
7599
7600 def p_unsigned_signed_opt_3(p):
7601 '''unsigned_signed_opt : '''
7602 if(parse_debug):
7603 print('unsigned_signed_opt_3', list(p))
7604 p[0] = False
7605
7606
7607 ()
7608
7609
7610 def p_signed_unsigned_opt_1(p):
7611 '''signed_unsigned_opt : K_signed '''
7612 if(parse_debug):
7613 print('signed_unsigned_opt_1', list(p))
7614 p[0] = True
7615
7616
7617 ()
7618
7619
7620 def p_signed_unsigned_opt_2(p):
7621 '''signed_unsigned_opt : K_unsigned '''
7622 if(parse_debug):
7623 print('signed_unsigned_opt_2', list(p))
7624 p[0] = False
7625
7626
7627 ()
7628
7629
7630 def p_signed_unsigned_opt_3(p):
7631 '''signed_unsigned_opt : '''
7632 if(parse_debug):
7633 print('signed_unsigned_opt_3', list(p))
7634 p[0] = True
7635
7636
7637 ()
7638
7639
7640 def p_atom2_type_1(p):
7641 '''atom2_type : K_byte '''
7642 if(parse_debug):
7643 print('atom2_type_1', list(p))
7644
7645 # { p[0] = 8; }
7646 ()
7647
7648
7649 def p_atom2_type_2(p):
7650 '''atom2_type : K_shortint '''
7651 if(parse_debug):
7652 print('atom2_type_2', list(p))
7653
7654 # { p[0] = 16; }
7655 ()
7656
7657
7658 def p_atom2_type_3(p):
7659 '''atom2_type : K_int '''
7660 if(parse_debug):
7661 print('atom2_type_3', list(p))
7662
7663 # { p[0] = 32; }
7664 ()
7665
7666
7667 def p_atom2_type_4(p):
7668 '''atom2_type : K_longint '''
7669 if(parse_debug):
7670 print('atom2_type_4', list(p))
7671
7672 # { p[0] = 64; }
7673 ()
7674
7675
7676 def p_lpvalue_1(p):
7677 '''lpvalue : hierarchy_identifier '''
7678 if(parse_debug > 2):
7679 print('lpvalue_1', list(p))
7680 p[0] = p[1]
7681
7682 # { PEIdent*tmp = pform_new_ident(*p[1]);
7683 # FILE_NAME(tmp, @1);
7684 # p[0] = tmp;
7685 # delete p[1];
7686 # }
7687 ()
7688
7689
7690 def p_lpvalue_2(p):
7691 '''lpvalue : implicit_class_handle '.' hierarchy_identifier '''
7692 if(parse_debug):
7693 print('lpvalue_2', list(p))
7694
7695 # { pform_name_t*t_name = p[1];
7696 # while (!p[3]->empty()) {
7697 # t_name->push_back(p[3]->front());
7698 # p[3]->pop_front();
7699 # }
7700 # PEIdent*tmp = new PEIdent(*t_name);
7701 # FILE_NAME(tmp, @1);
7702 # p[0] = tmp;
7703 # delete p[1];
7704 # delete p[3];
7705 # }
7706 ()
7707
7708
7709 def p_lpvalue_3(p):
7710 '''lpvalue : '{' expression_list_proper '}' '''
7711 if(parse_debug):
7712 print('lpvalue_3', list(p))
7713
7714 # { PEConcat*tmp = new PEConcat(*p[2]);
7715 # FILE_NAME(tmp, @1);
7716 # delete p[2];
7717 # p[0] = tmp;
7718 # }
7719 ()
7720
7721
7722 def p_lpvalue_4(p):
7723 '''lpvalue : streaming_concatenation '''
7724 if(parse_debug):
7725 print('lpvalue_4', list(p))
7726
7727 # { yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
7728 # p[0] = None
7729 # }
7730 ()
7731
7732
7733 def p_cont_assign_1(p):
7734 '''cont_assign : lpvalue '=' expression '''
7735 if(parse_debug):
7736 print('cont_assign_1', list(p))
7737 absyn.cont_assign_1(p)
7738
7739 # { list<PExpr*>*tmp = new list<PExpr*>;
7740 # tmp->push_back(p[1]);
7741 # tmp->push_back(p[3]);
7742 # p[0] = tmp;
7743 # }
7744 ()
7745
7746
7747 def p_cont_assign_list_1(p):
7748 '''cont_assign_list : cont_assign_list ',' cont_assign '''
7749 if(parse_debug):
7750 print('cont_assign_list_1', list(p))
7751
7752 # { list<PExpr*>*tmp = p[1];
7753 # tmp->splice(tmp->end(), *p[3]);
7754 # delete p[3];
7755 # p[0] = tmp;
7756 # }
7757 ()
7758
7759
7760 def p_cont_assign_list_2(p):
7761 '''cont_assign_list : cont_assign '''
7762 if(parse_debug > 2):
7763 print('cont_assign_list_2', list(p))
7764 p[0] = p[1]
7765
7766
7767 ()
7768
7769
7770 def p_module_1(p):
7771 '''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 '''
7772 if(parse_debug > 2):
7773 print('module_1', list(p))
7774 clsdecl = absyn.module_1(p)
7775 p[0] = clsdecl
7776
7777
7778 ()
7779
7780
7781 def p__embed0_module(p):
7782 '''_embed0_module : '''
7783
7784 # { pform_startmodule(@2, p[4], p[2]==K_program, p[2]==K_interface, p[3], p[1]); }
7785 ()
7786
7787
7788 def p__embed1_module(p):
7789 '''_embed1_module : '''
7790
7791 # { pform_module_set_ports(p[8]); }
7792 ()
7793
7794
7795 def p__embed2_module(p):
7796 '''_embed2_module : '''
7797
7798 # { pform_set_scope_timescale(@2); }
7799 ()
7800
7801
7802 def p__embed3_module(p):
7803 '''_embed3_module : '''
7804
7805 # { Module::UCDriveType ucd;
7806 # // The lexor detected `unconnected_drive directives and
7807 # // marked what it found in the uc_drive variable. Use that
7808 # // to generate a UCD flag for the module.
7809 # switch (uc_drive) {
7810 # case UCD_NONE:
7811 # default:
7812 # ucd = Module::UCD_NONE;
7813 # break;
7814 # case UCD_PULL0:
7815 # ucd = Module::UCD_PULL0;
7816 # break;
7817 # case UCD_PULL1:
7818 # ucd = Module::UCD_PULL1;
7819 # break;
7820 # }
7821 # // Check that program/endprogram and module/endmodule
7822 # // keywords match.
7823 # if (p[2] != p[15]) {
7824 # switch (p[2]) {
7825 # case K_module:
7826 # yyerror(@15, "error: module not closed by endmodule.");
7827 # break;
7828 # case K_program:
7829 # yyerror(@15, "error: program not closed by endprogram.");
7830 # break;
7831 # case K_interface:
7832 # yyerror(@15, "error: interface not closed by endinterface.");
7833 # break;
7834 # default:
7835 # break;
7836 # }
7837 # }
7838 # pform_endmodule(p[4], in_celldefine, ucd);
7839 # }
7840 ()
7841
7842
7843 def p_module_start_1(p):
7844 '''module_start : K_module '''
7845 if(parse_debug > 1):
7846 print('module_start_1', list(p))
7847
7848 # { p[0] = K_module; }
7849 ()
7850
7851
7852 def p_module_start_2(p):
7853 '''module_start : K_macromodule '''
7854 if(parse_debug):
7855 print('module_start_2', list(p))
7856
7857 # { p[0] = K_module; }
7858 ()
7859
7860
7861 def p_module_start_3(p):
7862 '''module_start : K_program '''
7863 if(parse_debug):
7864 print('module_start_3', list(p))
7865
7866 # { p[0] = K_program; }
7867 ()
7868
7869
7870 def p_module_start_4(p):
7871 '''module_start : K_interface '''
7872 if(parse_debug):
7873 print('module_start_4', list(p))
7874
7875 # { p[0] = K_interface; }
7876 ()
7877
7878
7879 def p_module_end_1(p):
7880 '''module_end : K_endmodule '''
7881 if(parse_debug > 2):
7882 print('module_end_1', list(p))
7883
7884 # { p[0] = K_module; }
7885 ()
7886
7887
7888 def p_module_end_2(p):
7889 '''module_end : K_endprogram '''
7890 if(parse_debug):
7891 print('module_end_2', list(p))
7892
7893 # { p[0] = K_program; }
7894 ()
7895
7896
7897 def p_module_end_3(p):
7898 '''module_end : K_endinterface '''
7899 if(parse_debug):
7900 print('module_end_3', list(p))
7901
7902 # { p[0] = K_interface; }
7903 ()
7904
7905
7906 def p_endlabel_opt_1(p):
7907 '''endlabel_opt : ':' IDENTIFIER '''
7908 if(parse_debug):
7909 print('endlabel_opt_1', list(p))
7910 p[0] = p[2]
7911
7912
7913 ()
7914
7915
7916 def p_endlabel_opt_2(p):
7917 '''endlabel_opt : '''
7918 if(parse_debug > 2):
7919 print('endlabel_opt_2', list(p))
7920
7921 # { p[0] = None }
7922 ()
7923
7924
7925 def p_module_attribute_foreign_1(p):
7926 '''module_attribute_foreign : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP '''
7927 if(parse_debug):
7928 print('module_attribute_foreign_1', list(p))
7929
7930 # { p[0] = None }
7931 ()
7932
7933
7934 def p_module_attribute_foreign_2(p):
7935 '''module_attribute_foreign : '''
7936 if(parse_debug > 2):
7937 print('module_attribute_foreign_2', list(p))
7938
7939 # { p[0] = None }
7940 ()
7941
7942
7943 def p_module_port_list_opt_1(p):
7944 '''module_port_list_opt : '(' list_of_ports ')' '''
7945 if(parse_debug):
7946 print('module_port_list_opt_1', list(p))
7947 p[0] = p[2]
7948
7949
7950 ()
7951
7952
7953 def p_module_port_list_opt_2(p):
7954 '''module_port_list_opt : '(' list_of_port_declarations ')' '''
7955 if(parse_debug > 2):
7956 print('module_port_list_opt_2', list(p))
7957 p[0] = p[2]
7958
7959
7960 ()
7961
7962
7963 def p_module_port_list_opt_3(p):
7964 '''module_port_list_opt : '''
7965 if(parse_debug):
7966 print('module_port_list_opt_3', list(p))
7967
7968 # { p[0] = None }
7969 ()
7970
7971
7972 def p_module_port_list_opt_4(p):
7973 '''module_port_list_opt : '(' error ')' '''
7974 if(parse_debug):
7975 print('module_port_list_opt_4', list(p))
7976
7977 # { yyerror(@2, "Errors in port declarations.");
7978 # yyerrok;
7979 # p[0] = None
7980 # }
7981 ()
7982
7983
7984 def p_module_parameter_port_list_opt_1(p):
7985 '''module_parameter_port_list_opt : '''
7986 if(parse_debug > 2):
7987 print('module_parameter_port_list_opt_1', list(p))
7988
7989
7990 ()
7991
7992
7993 def p_module_parameter_port_list_opt_2(p):
7994 '''module_parameter_port_list_opt : '#' '(' module_parameter_port_list ')' '''
7995 if(parse_debug):
7996 print('module_parameter_port_list_opt_2', list(p))
7997 p[0] = p[3]
7998
7999
8000 ()
8001
8002
8003 def p_module_parameter_port_list_1(p):
8004 '''module_parameter_port_list : K_parameter param_type parameter_assign '''
8005 if(parse_debug):
8006 print('module_parameter_port_list_1', list(p))
8007 p[0] = [p[3]]
8008
8009
8010 ()
8011
8012
8013 def p_module_parameter_port_list_2(p):
8014 '''module_parameter_port_list : module_parameter_port_list ',' parameter_assign '''
8015 if(parse_debug):
8016 print('module_parameter_port_list_2', list(p))
8017 p[0] = p[1].append(p[3])
8018
8019
8020 ()
8021
8022
8023 def p_module_parameter_port_list_3(p):
8024 '''module_parameter_port_list : module_parameter_port_list ',' K_parameter param_type parameter_assign '''
8025 if(parse_debug):
8026 print('module_parameter_port_list_3', list(p))
8027 p[1].append(Leaf(token.COMMA, ','))
8028 p[1].append(Leaf(token.NEWLINE, '\n'))
8029 p[5].prefix = ' ' # add space after newline
8030 p[1].append(p[5])
8031 p[0] = p[1]
8032
8033
8034 ()
8035
8036
8037 def p_module_item_1(p):
8038 '''module_item : module '''
8039 if(parse_debug):
8040 print('module_item_1', list(p))
8041
8042
8043 ()
8044
8045
8046 def p_module_item_2(p):
8047 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' '''
8048 if(parse_debug):
8049 print('module_item_2', list(p))
8050
8051 p[0] = absyn.module_item_2(p[2], p[3], p[5])
8052 #p[0] = ["module_item_2"]+list(p)
8053
8054 # { data_type_t*data_type = p[3];
8055 # if (data_type == 0) {
8056 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8057 # FILE_NAME(data_type, @2);
8058 # }
8059 # pform_set_data_type(@2, data_type, p[5], p[2], p[1]);
8060 # if (p[4] != 0) {
8061 # yyerror(@2, "sorry: net delays not supported.");
8062 # delete p[4];
8063 # }
8064 # delete p[1];
8065 # }
8066 ()
8067
8068
8069 def p_module_item_3(p):
8070 '''module_item : attribute_list_opt K_wreal delay3 net_variable_list ';' '''
8071 if(parse_debug):
8072 print('module_item_3', list(p))
8073
8074 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
8075 # pform_set_data_type(@2, tmpt, p[4], NetNet::WIRE, p[1]);
8076 # if (p[3] != 0) {
8077 # yyerror(@3, "sorry: net delays not supported.");
8078 # delete p[3];
8079 # }
8080 # delete p[1];
8081 # }
8082 ()
8083
8084
8085 def p_module_item_4(p):
8086 '''module_item : attribute_list_opt K_wreal net_variable_list ';' '''
8087 if(parse_debug):
8088 print('module_item_4', list(p))
8089
8090 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
8091 # pform_set_data_type(@2, tmpt, p[3], NetNet::WIRE, p[1]);
8092 # delete p[1];
8093 # }
8094 ()
8095
8096
8097 def p_module_item_5(p):
8098 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_decl_assigns ';' '''
8099 if(parse_debug):
8100 print('module_item_5', list(p))
8101
8102 # { data_type_t*data_type = p[3];
8103 # if (data_type == 0) {
8104 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8105 # FILE_NAME(data_type, @2);
8106 # }
8107 # pform_makewire(@2, p[4], str_strength, p[5], p[2], data_type);
8108 # if (p[1]) {
8109 # yywarn(@2, "Attributes are not supported on net declaration "
8110 # "assignments and will be discarded.");
8111 # delete p[1];
8112 # }
8113 # }
8114 ()
8115
8116
8117 def p_module_item_6(p):
8118 '''module_item : attribute_list_opt net_type data_type_or_implicit drive_strength net_decl_assigns ';' '''
8119 if(parse_debug):
8120 print('module_item_6', list(p))
8121
8122 # { data_type_t*data_type = p[3];
8123 # if (data_type == 0) {
8124 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8125 # FILE_NAME(data_type, @2);
8126 # }
8127 # pform_makewire(@2, 0, p[4], p[5], p[2], data_type);
8128 # if (p[1]) {
8129 # yywarn(@2, "Attributes are not supported on net declaration "
8130 # "assignments and will be discarded.");
8131 # delete p[1];
8132 # }
8133 # }
8134 ()
8135
8136
8137 def p_module_item_7(p):
8138 '''module_item : attribute_list_opt K_wreal net_decl_assigns ';' '''
8139 if(parse_debug):
8140 print('module_item_7', list(p))
8141
8142 # { real_type_t*data_type = new real_type_t(real_type_t::REAL);
8143 # pform_makewire(@2, 0, str_strength, p[3], NetNet::WIRE, data_type);
8144 # if (p[1]) {
8145 # yywarn(@2, "Attributes are not supported on net declaration "
8146 # "assignments and will be discarded.");
8147 # delete p[1];
8148 # }
8149 # }
8150 ()
8151
8152
8153 def p_module_item_8(p):
8154 '''module_item : K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' '''
8155 if(parse_debug):
8156 print('module_item_8', list(p))
8157
8158 # { yyerror(@1, "sorry: trireg nets not supported.");
8159 # delete p[3];
8160 # delete p[4];
8161 # }
8162 ()
8163
8164
8165 def p_module_item_9(p):
8166 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit list_of_port_identifiers ';' '''
8167 if(parse_debug):
8168 print('module_item_9', list(p))
8169
8170 # { pform_module_define_port(@2, p[5], p[2], p[3], p[4], p[1]); }
8171 ()
8172
8173
8174 def p_module_item_10(p):
8175 '''module_item : attribute_list_opt port_direction K_wreal list_of_port_identifiers ';' '''
8176 if(parse_debug):
8177 print('module_item_10', list(p))
8178
8179 # { real_type_t*real_type = new real_type_t(real_type_t::REAL);
8180 # pform_module_define_port(@2, p[4], p[2], NetNet::WIRE, real_type, p[1]);
8181 # }
8182 ()
8183
8184
8185 def p_module_item_11(p):
8186 '''module_item : attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' '''
8187 if(parse_debug):
8188 print('module_item_11', list(p))
8189
8190 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8191 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8192 # if (dtype->implicit_flag)
8193 # use_type = NetNet::NONE;
8194 # }
8195 # if (use_type == NetNet::NONE)
8196 # pform_set_port_type(@2, p[4], NetNet::PINOUT, p[3], p[1]);
8197 # else
8198 # pform_module_define_port(@2, p[4], NetNet::PINOUT, use_type, p[3], p[1]);
8199 # }
8200 ()
8201
8202
8203 def p_module_item_12(p):
8204 '''module_item : attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' '''
8205 if(parse_debug):
8206 print('module_item_12', list(p))
8207
8208 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8209 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8210 # if (dtype->implicit_flag)
8211 # use_type = NetNet::NONE;
8212 # }
8213 # if (use_type == NetNet::NONE)
8214 # pform_set_port_type(@2, p[4], NetNet::PINPUT, p[3], p[1]);
8215 # else
8216 # pform_module_define_port(@2, p[4], NetNet::PINPUT, use_type, p[3], p[1]);
8217 # }
8218 ()
8219
8220
8221 def p_module_item_13(p):
8222 '''module_item : attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' '''
8223 if(parse_debug):
8224 print('module_item_13', list(p))
8225
8226 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8227 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8228 # if (dtype->implicit_flag)
8229 # use_type = NetNet::NONE;
8230 # else if (dtype->reg_flag)
8231 # use_type = NetNet::REG;
8232 # else
8233 # use_type = NetNet::IMPLICIT_REG;
8234 #
8235 # // The SystemVerilog types that can show up as
8236 # // output ports are implicitly (on the inside)
8237 # // variables because "reg" is not valid syntax
8238 # // here.
8239 # } else if (dynamic_cast<atom2_type_t*> (p[3])) {
8240 # use_type = NetNet::IMPLICIT_REG;
8241 # } else if (dynamic_cast<struct_type_t*> (p[3])) {
8242 # use_type = NetNet::IMPLICIT_REG;
8243 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[3])) {
8244 # if(etype->base_type == IVL_VT_LOGIC)
8245 # use_type = NetNet::IMPLICIT_REG;
8246 # }
8247 # if (use_type == NetNet::NONE)
8248 # pform_set_port_type(@2, p[4], NetNet::POUTPUT, p[3], p[1]);
8249 # else
8250 # pform_module_define_port(@2, p[4], NetNet::POUTPUT, use_type, p[3], p[1]);
8251 # }
8252 ()
8253
8254
8255 def p_module_item_14(p):
8256 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit error ';' '''
8257 if(parse_debug):
8258 print('module_item_14', list(p))
8259
8260 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8261 # if (p[1]) delete p[1];
8262 # if (p[4]) delete p[4];
8263 # yyerrok;
8264 # }
8265 ()
8266
8267
8268 def p_module_item_15(p):
8269 '''module_item : attribute_list_opt K_inout data_type_or_implicit error ';' '''
8270 if(parse_debug):
8271 print('module_item_15', list(p))
8272
8273 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8274 # if (p[1]) delete p[1];
8275 # if (p[3]) delete p[3];
8276 # yyerrok;
8277 # }
8278 ()
8279
8280
8281 def p_module_item_16(p):
8282 '''module_item : attribute_list_opt K_input data_type_or_implicit error ';' '''
8283 if(parse_debug):
8284 print('module_item_16', list(p))
8285
8286 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8287 # if (p[1]) delete p[1];
8288 # if (p[3]) delete p[3];
8289 # yyerrok;
8290 # }
8291 ()
8292
8293
8294 def p_module_item_17(p):
8295 '''module_item : attribute_list_opt K_output data_type_or_implicit error ';' '''
8296 if(parse_debug):
8297 print('module_item_17', list(p))
8298
8299 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8300 # if (p[1]) delete p[1];
8301 # if (p[3]) delete p[3];
8302 # yyerrok;
8303 # }
8304 ()
8305
8306
8307 def p_module_item_18(p):
8308 '''module_item : DISCIPLINE_IDENTIFIER list_of_identifiers ';' '''
8309 if(parse_debug):
8310 print('module_item_18', list(p))
8311
8312 # { pform_attach_discipline(@1, p[1], p[2]); }
8313 ()
8314
8315
8316 def p_module_item_19(p):
8317 '''module_item : attribute_list_opt _embed0_module_item block_item_decl '''
8318 if(parse_debug):
8319 print('module_item_19', list(p))
8320
8321 # { delete attributes_in_context;
8322 # attributes_in_context = 0;
8323 # }
8324 ()
8325
8326
8327 def p_module_item_20(p):
8328 '''module_item : K_defparam _embed1_module_item defparam_assign_list ';' '''
8329 if(parse_debug):
8330 print('module_item_20', list(p))
8331
8332
8333 ()
8334
8335
8336 def p_module_item_21(p):
8337 '''module_item : attribute_list_opt gatetype gate_instance_list ';' '''
8338 if(parse_debug):
8339 print('module_item_21', list(p))
8340
8341 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
8342 ()
8343
8344
8345 def p_module_item_22(p):
8346 '''module_item : attribute_list_opt gatetype delay3 gate_instance_list ';' '''
8347 if(parse_debug):
8348 print('module_item_22', list(p))
8349
8350 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
8351 ()
8352
8353
8354 def p_module_item_23(p):
8355 '''module_item : attribute_list_opt gatetype drive_strength gate_instance_list ';' '''
8356 if(parse_debug):
8357 print('module_item_23', list(p))
8358
8359 # { pform_makegates(@2, p[2], p[3], 0, p[4], p[1]); }
8360 ()
8361
8362
8363 def p_module_item_24(p):
8364 '''module_item : attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';' '''
8365 if(parse_debug):
8366 print('module_item_24', list(p))
8367
8368 # { pform_makegates(@2, p[2], p[3], p[4], p[5], p[1]); }
8369 ()
8370
8371
8372 def p_module_item_25(p):
8373 '''module_item : attribute_list_opt switchtype gate_instance_list ';' '''
8374 if(parse_debug):
8375 print('module_item_25', list(p))
8376
8377 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
8378 ()
8379
8380
8381 def p_module_item_26(p):
8382 '''module_item : attribute_list_opt switchtype delay3 gate_instance_list ';' '''
8383 if(parse_debug):
8384 print('module_item_26', list(p))
8385
8386 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
8387 ()
8388
8389
8390 def p_module_item_27(p):
8391 '''module_item : K_pullup gate_instance_list ';' '''
8392 if(parse_debug):
8393 print('module_item_27', list(p))
8394
8395 # { pform_makegates(@1, PGBuiltin::PULLUP, pull_strength, 0, p[2], 0); }
8396 ()
8397
8398
8399 def p_module_item_28(p):
8400 '''module_item : K_pulldown gate_instance_list ';' '''
8401 if(parse_debug):
8402 print('module_item_28', list(p))
8403
8404 # { pform_makegates(@1, PGBuiltin::PULLDOWN, pull_strength, 0, p[2], 0); }
8405 ()
8406
8407
8408 def p_module_item_29(p):
8409 '''module_item : K_pullup '(' dr_strength1 ')' gate_instance_list ';' '''
8410 if(parse_debug):
8411 print('module_item_29', list(p))
8412
8413 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[5], 0); }
8414 ()
8415
8416
8417 def p_module_item_30(p):
8418 '''module_item : K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
8419 if(parse_debug):
8420 print('module_item_30', list(p))
8421
8422 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[7], 0); }
8423 ()
8424
8425
8426 def p_module_item_31(p):
8427 '''module_item : K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
8428 if(parse_debug):
8429 print('module_item_31', list(p))
8430
8431 # { pform_makegates(@1, PGBuiltin::PULLUP, p[5], 0, p[7], 0); }
8432 ()
8433
8434
8435 def p_module_item_32(p):
8436 '''module_item : K_pulldown '(' dr_strength0 ')' gate_instance_list ';' '''
8437 if(parse_debug):
8438 print('module_item_32', list(p))
8439
8440 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[5], 0); }
8441 ()
8442
8443
8444 def p_module_item_33(p):
8445 '''module_item : K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
8446 if(parse_debug):
8447 print('module_item_33', list(p))
8448
8449 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[5], 0, p[7], 0); }
8450 ()
8451
8452
8453 def p_module_item_34(p):
8454 '''module_item : K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
8455 if(parse_debug):
8456 print('module_item_34', list(p))
8457
8458 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[7], 0); }
8459 ()
8460
8461
8462 def p_module_item_35(p):
8463 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' '''
8464 if(parse_debug):
8465 print('module_item_35', list(p))
8466
8467 # { perm_string tmp1 = lex_strings.make(p[2]);
8468 # pform_make_modgates(@2, tmp1, p[3], p[4], p[1]);
8469 # delete[]p[2];
8470 # }
8471 ()
8472
8473
8474 def p_module_item_36(p):
8475 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt error ';' '''
8476 if(parse_debug):
8477 print('module_item_36', list(p))
8478
8479 # { yyerror(@2, "error: Invalid module instantiation");
8480 # delete[]p[2];
8481 # if (p[1]) delete p[1];
8482 # }
8483 ()
8484
8485
8486 def p_module_item_37(p):
8487 '''module_item : K_assign drive_strength_opt delay3_opt cont_assign_list ';' '''
8488 if(parse_debug > 2):
8489 print('module_item_37', list(p))
8490
8491 # { pform_make_pgassign_list(p[4], p[3], p[2], @1.text, @1.first_line); }
8492 ()
8493
8494
8495 def p_module_item_38(p):
8496 '''module_item : attribute_list_opt K_always statement_item '''
8497 if(parse_debug):
8498 print('module_item_38', list(p))
8499
8500 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, p[3], p[1]);
8501 # FILE_NAME(tmp, @2);
8502 # }
8503 ()
8504
8505
8506 def p_module_item_39(p):
8507 '''module_item : attribute_list_opt K_always_comb statement_item '''
8508 if(parse_debug):
8509 print('module_item_39', list(p))
8510
8511 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_COMB, p[3], p[1]);
8512 # FILE_NAME(tmp, @2);
8513 # }
8514 ()
8515
8516
8517 def p_module_item_40(p):
8518 '''module_item : attribute_list_opt K_always_ff statement_item '''
8519 if(parse_debug):
8520 print('module_item_40', list(p))
8521
8522 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, p[3], p[1]);
8523 # FILE_NAME(tmp, @2);
8524 # }
8525 ()
8526
8527
8528 def p_module_item_41(p):
8529 '''module_item : attribute_list_opt K_always_latch statement_item '''
8530 if(parse_debug):
8531 print('module_item_41', list(p))
8532
8533 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_LATCH, p[3], p[1]);
8534 # FILE_NAME(tmp, @2);
8535 # }
8536 ()
8537
8538
8539 def p_module_item_42(p):
8540 '''module_item : attribute_list_opt K_initial statement_item '''
8541 if(parse_debug):
8542 print('module_item_42', list(p))
8543
8544 # { PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, p[3], p[1]);
8545 # FILE_NAME(tmp, @2);
8546 # }
8547 ()
8548
8549
8550 def p_module_item_43(p):
8551 '''module_item : attribute_list_opt K_final statement_item '''
8552 if(parse_debug):
8553 print('module_item_43', list(p))
8554
8555 # { PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, p[3], p[1]);
8556 # FILE_NAME(tmp, @2);
8557 # }
8558 ()
8559
8560
8561 def p_module_item_44(p):
8562 '''module_item : attribute_list_opt K_analog analog_statement '''
8563 if(parse_debug):
8564 print('module_item_44', list(p))
8565
8566 # { pform_make_analog_behavior(@2, IVL_PR_ALWAYS, p[3]); }
8567 ()
8568
8569
8570 def p_module_item_45(p):
8571 '''module_item : attribute_list_opt assertion_item '''
8572 if(parse_debug):
8573 print('module_item_45', list(p))
8574
8575
8576 ()
8577
8578
8579 def p_module_item_46(p):
8580 '''module_item : timeunits_declaration '''
8581 if(parse_debug):
8582 print('module_item_46', list(p))
8583
8584
8585 ()
8586
8587
8588 def p_module_item_47(p):
8589 '''module_item : class_declaration '''
8590 if(parse_debug):
8591 print('module_item_47', list(p))
8592
8593
8594 ()
8595
8596
8597 def p_module_item_48(p):
8598 '''module_item : task_declaration '''
8599 if(parse_debug):
8600 print('module_item_48', list(p))
8601
8602
8603 ()
8604
8605
8606 def p_module_item_49(p):
8607 '''module_item : function_declaration '''
8608 if(parse_debug):
8609 print('module_item_49', list(p))
8610
8611
8612 ()
8613
8614
8615 def p_module_item_50(p):
8616 '''module_item : K_generate generate_item_list_opt K_endgenerate '''
8617 if(parse_debug):
8618 print('module_item_50', list(p))
8619
8620 # { // Test for bad nesting. I understand it, but it is illegal.
8621 # if (pform_parent_generate()) {
8622 # cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
8623 # cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
8624 # cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
8625 # error_count += 1;
8626 # }
8627 # }
8628 ()
8629
8630
8631 def p_module_item_51(p):
8632 '''module_item : K_genvar list_of_identifiers ';' '''
8633 if(parse_debug):
8634 print('module_item_51', list(p))
8635
8636 # { pform_genvars(@1, p[2]); }
8637 ()
8638
8639
8640 def p_module_item_52(p):
8641 '''module_item : K_for '(' IDENTIFIER '=' expression ';' expression ';' IDENTIFIER '=' expression ')' _embed2_module_item generate_block '''
8642 if(parse_debug):
8643 print('module_item_52', list(p))
8644
8645 # { pform_endgenerate(); }
8646 ()
8647
8648
8649 def p_module_item_53(p):
8650 '''module_item : generate_if generate_block_opt K_else _embed3_module_item generate_block '''
8651 if(parse_debug):
8652 print('module_item_53', list(p))
8653
8654 # { pform_endgenerate(); }
8655 ()
8656
8657
8658 def p_module_item_54(p):
8659 '''module_item : generate_if generate_block_opt %prec less_than_K_else '''
8660 if(parse_debug):
8661 print('module_item_54', list(p))
8662
8663 # { pform_endgenerate(); }
8664 ()
8665
8666
8667 def p_module_item_55(p):
8668 '''module_item : K_case '(' expression ')' _embed4_module_item generate_case_items K_endcase '''
8669 if(parse_debug):
8670 print('module_item_55', list(p))
8671
8672 # { pform_endgenerate(); }
8673 ()
8674
8675
8676 def p_module_item_56(p):
8677 '''module_item : modport_declaration '''
8678 if(parse_debug):
8679 print('module_item_56', list(p))
8680
8681
8682 ()
8683
8684
8685 def p_module_item_57(p):
8686 '''module_item : package_import_declaration '''
8687 if(parse_debug):
8688 print('module_item_57', list(p))
8689
8690
8691 ()
8692
8693
8694 def p_module_item_58(p):
8695 '''module_item : attribute_list_opt K_specparam _embed5_module_item specparam_decl ';' '''
8696 if(parse_debug):
8697 print('module_item_58', list(p))
8698
8699
8700 ()
8701
8702
8703 def p_module_item_59(p):
8704 '''module_item : K_specify _embed6_module_item specify_item_list_opt K_endspecify '''
8705 if(parse_debug):
8706 print('module_item_59', list(p))
8707
8708
8709 ()
8710
8711
8712 def p_module_item_60(p):
8713 '''module_item : K_specify error K_endspecify '''
8714 if(parse_debug):
8715 print('module_item_60', list(p))
8716
8717 # { yyerror(@1, "error: syntax error in specify block");
8718 # yyerrok;
8719 # }
8720 ()
8721
8722
8723 def p_module_item_61(p):
8724 '''module_item : error ';' '''
8725 if(parse_debug):
8726 print('module_item_61', list(p))
8727
8728 # { yyerror(@2, "error: invalid module item.");
8729 # yyerrok;
8730 # }
8731 ()
8732
8733
8734 def p_module_item_62(p):
8735 '''module_item : K_assign error '=' expression ';' '''
8736 if(parse_debug):
8737 print('module_item_62', list(p))
8738
8739 # { yyerror(@1, "error: syntax error in left side "
8740 # "of continuous assignment.");
8741 # yyerrok;
8742 # }
8743 ()
8744
8745
8746 def p_module_item_63(p):
8747 '''module_item : K_assign error ';' '''
8748 if(parse_debug):
8749 print('module_item_63', list(p))
8750
8751 # { yyerror(@1, "error: syntax error in "
8752 # "continuous assignment");
8753 # yyerrok;
8754 # }
8755 ()
8756
8757
8758 def p_module_item_64(p):
8759 '''module_item : K_function error K_endfunction endlabel_opt '''
8760 if(parse_debug):
8761 print('module_item_64', list(p))
8762
8763 # { yyerror(@1, "error: I give up on this "
8764 # "function definition.");
8765 # if (p[4]) {
8766 # if (!gn_system_verilog()) {
8767 # yyerror(@4, "error: Function end names require "
8768 # "SystemVerilog.");
8769 # }
8770 # delete[]p[4];
8771 # }
8772 # yyerrok;
8773 # }
8774 ()
8775
8776
8777 def p_module_item_65(p):
8778 '''module_item : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';' '''
8779 if(parse_debug):
8780 print('module_item_65', list(p))
8781
8782 # { perm_string tmp3 = lex_strings.make(p[3]);
8783 # perm_string tmp5 = lex_strings.make(p[5]);
8784 # pform_set_attrib(tmp3, tmp5, p[7]);
8785 # delete[] p[3];
8786 # delete[] p[5];
8787 # }
8788 ()
8789
8790
8791 def p_module_item_66(p):
8792 '''module_item : KK_attribute '(' error ')' ';' '''
8793 if(parse_debug):
8794 print('module_item_66', list(p))
8795
8796 # { yyerror(@1, "error: Malformed $attribute parameter list."); }
8797 ()
8798
8799
8800 def p__embed0_module_item(p):
8801 '''_embed0_module_item : '''
8802
8803 # { attributes_in_context = p[1]; }
8804 ()
8805
8806
8807 def p__embed1_module_item(p):
8808 '''_embed1_module_item : '''
8809
8810 # { if (pform_in_interface())
8811 # yyerror(@1, "error: Parameter overrides are not allowed "
8812 # "in interfaces.");
8813 # }
8814 ()
8815
8816
8817 def p__embed2_module_item(p):
8818 '''_embed2_module_item : '''
8819
8820 # { pform_start_generate_for(@1, p[3], p[5], p[7], p[9], p[11]); }
8821 ()
8822
8823
8824 def p__embed3_module_item(p):
8825 '''_embed3_module_item : '''
8826
8827 # { pform_start_generate_else(@1); }
8828 ()
8829
8830
8831 def p__embed4_module_item(p):
8832 '''_embed4_module_item : '''
8833
8834 # { pform_start_generate_case(@1, p[3]); }
8835 ()
8836
8837
8838 def p__embed5_module_item(p):
8839 '''_embed5_module_item : '''
8840
8841 # { if (pform_in_interface())
8842 # yyerror(@1, "error: specparam declarations are not allowed "
8843 # "in interfaces.");
8844 # }
8845 ()
8846
8847
8848 def p__embed6_module_item(p):
8849 '''_embed6_module_item : '''
8850
8851 # { if (pform_in_interface())
8852 # yyerror(@1, "error: specify blocks are not allowed "
8853 # "in interfaces.");
8854 # }
8855 ()
8856
8857
8858 def p_module_item_list_1(p):
8859 '''module_item_list : module_item_list module_item '''
8860 if(parse_debug):
8861 print('module_item_list_1', list(p))
8862
8863
8864 ()
8865
8866
8867 def p_module_item_list_2(p):
8868 '''module_item_list : module_item '''
8869 if(parse_debug > 2):
8870 print('module_item_list_2', list(p))
8871
8872
8873 ()
8874
8875
8876 def p_module_item_list_opt_1(p):
8877 '''module_item_list_opt : module_item_list '''
8878 if(parse_debug > 2):
8879 print('module_item_list_opt_1', list(p))
8880
8881
8882 ()
8883
8884
8885 def p_module_item_list_opt_2(p):
8886 '''module_item_list_opt : '''
8887 if(parse_debug):
8888 print('module_item_list_opt_2', list(p))
8889
8890
8891 ()
8892
8893
8894 def p_generate_if_1(p):
8895 '''generate_if : K_if '(' expression ')' '''
8896 if(parse_debug):
8897 print('generate_if_1', list(p))
8898
8899 # { pform_start_generate_if(@1, p[3]); }
8900 ()
8901
8902
8903 def p_generate_case_items_1(p):
8904 '''generate_case_items : generate_case_items generate_case_item '''
8905 if(parse_debug):
8906 print('generate_case_items_1', list(p))
8907
8908
8909 ()
8910
8911
8912 def p_generate_case_items_2(p):
8913 '''generate_case_items : generate_case_item '''
8914 if(parse_debug):
8915 print('generate_case_items_2', list(p))
8916
8917
8918 ()
8919
8920
8921 def p_generate_case_item_1(p):
8922 '''generate_case_item : expression_list_proper ':' _embed0_generate_case_item generate_block_opt '''
8923 if(parse_debug):
8924 print('generate_case_item_1', list(p))
8925
8926 # { pform_endgenerate(); }
8927 ()
8928
8929
8930 def p_generate_case_item_2(p):
8931 '''generate_case_item : K_default ':' _embed1_generate_case_item generate_block_opt '''
8932 if(parse_debug):
8933 print('generate_case_item_2', list(p))
8934
8935 # { pform_endgenerate(); }
8936 ()
8937
8938
8939 def p__embed0_generate_case_item(p):
8940 '''_embed0_generate_case_item : '''
8941
8942 # { pform_generate_case_item(@1, p[1]); }
8943 ()
8944
8945
8946 def p__embed1_generate_case_item(p):
8947 '''_embed1_generate_case_item : '''
8948
8949 # { pform_generate_case_item(@1, 0); }
8950 ()
8951
8952
8953 def p_generate_item_1(p):
8954 '''generate_item : module_item '''
8955 if(parse_debug):
8956 print('generate_item_1', list(p))
8957
8958
8959 ()
8960
8961
8962 def p_generate_item_2(p):
8963 '''generate_item : K_begin generate_item_list_opt K_end '''
8964 if(parse_debug):
8965 print('generate_item_2', list(p))
8966
8967 # { /* Detect and warn about anachronistic begin/end use */
8968 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
8969 # warn_count += 1;
8970 # cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
8971 # }
8972 # }
8973 ()
8974
8975
8976 def p_generate_item_3(p):
8977 '''generate_item : K_begin ':' IDENTIFIER _embed0_generate_item generate_item_list_opt K_end '''
8978 if(parse_debug):
8979 print('generate_item_3', list(p))
8980
8981 # { /* Detect and warn about anachronistic named begin/end use */
8982 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
8983 # warn_count += 1;
8984 # cerr << @1 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
8985 # }
8986 # pform_endgenerate();
8987 # }
8988 ()
8989
8990
8991 def p__embed0_generate_item(p):
8992 '''_embed0_generate_item : '''
8993
8994 # {
8995 # pform_start_generate_nblock(@1, p[3]);
8996 # }
8997 ()
8998
8999
9000 def p_generate_item_list_1(p):
9001 '''generate_item_list : generate_item_list generate_item '''
9002 if(parse_debug):
9003 print('generate_item_list_1', list(p))
9004
9005
9006 ()
9007
9008
9009 def p_generate_item_list_2(p):
9010 '''generate_item_list : generate_item '''
9011 if(parse_debug):
9012 print('generate_item_list_2', list(p))
9013
9014
9015 ()
9016
9017
9018 def p_generate_item_list_opt_1(p):
9019 '''generate_item_list_opt : generate_item_list '''
9020 if(parse_debug):
9021 print('generate_item_list_opt_1', list(p))
9022
9023
9024 ()
9025
9026
9027 def p_generate_item_list_opt_2(p):
9028 '''generate_item_list_opt : '''
9029 if(parse_debug):
9030 print('generate_item_list_opt_2', list(p))
9031
9032
9033 ()
9034
9035
9036 def p_generate_block_1(p):
9037 '''generate_block : module_item '''
9038 if(parse_debug):
9039 print('generate_block_1', list(p))
9040
9041
9042 ()
9043
9044
9045 def p_generate_block_2(p):
9046 '''generate_block : K_begin generate_item_list_opt K_end '''
9047 if(parse_debug):
9048 print('generate_block_2', list(p))
9049
9050
9051 ()
9052
9053
9054 def p_generate_block_3(p):
9055 '''generate_block : K_begin ':' IDENTIFIER generate_item_list_opt K_end endlabel_opt '''
9056 if(parse_debug):
9057 print('generate_block_3', list(p))
9058
9059 # { pform_generate_block_name(p[3]);
9060 # if (p[6]) {
9061 # if (strcmp(p[3],p[6]) != 0) {
9062 # yyerror(@6, "error: End label doesn't match "
9063 # "begin name");
9064 # }
9065 # if (! gn_system_verilog()) {
9066 # yyerror(@6, "error: Begin end labels require "
9067 # "SystemVerilog.");
9068 # }
9069 # delete[]p[6];
9070 # }
9071 # delete[]p[3];
9072 # }
9073 ()
9074
9075
9076 def p_generate_block_opt_1(p):
9077 '''generate_block_opt : generate_block '''
9078 if(parse_debug):
9079 print('generate_block_opt_1', list(p))
9080
9081
9082 ()
9083
9084
9085 def p_generate_block_opt_2(p):
9086 '''generate_block_opt : ';' '''
9087 if(parse_debug):
9088 print('generate_block_opt_2', list(p))
9089
9090
9091 ()
9092
9093
9094 def p_net_decl_assign_1(p):
9095 '''net_decl_assign : IDENTIFIER '=' expression '''
9096 if(parse_debug):
9097 print('net_decl_assign_1', list(p))
9098
9099 # { net_decl_assign_t*tmp = new net_decl_assign_t;
9100 # tmp->next = tmp;
9101 # tmp->name = lex_strings.make(p[1]);
9102 # tmp->expr = p[3];
9103 # delete[]p[1];
9104 # p[0] = tmp;
9105 # }
9106 ()
9107
9108
9109 def p_net_decl_assigns_1(p):
9110 '''net_decl_assigns : net_decl_assigns ',' net_decl_assign '''
9111 if(parse_debug):
9112 print('net_decl_assigns_1', list(p))
9113
9114 # { net_decl_assign_t*tmp = p[1];
9115 # p[3]->next = tmp->next;
9116 # tmp->next = p[3];
9117 # p[0] = tmp;
9118 # }
9119 ()
9120
9121
9122 def p_net_decl_assigns_2(p):
9123 '''net_decl_assigns : net_decl_assign '''
9124 if(parse_debug):
9125 print('net_decl_assigns_2', list(p))
9126
9127 # { p[0] = p[1];
9128 # }
9129 ()
9130
9131
9132 def p_bit_logic_1(p):
9133 '''bit_logic : K_logic '''
9134 if(parse_debug):
9135 print('bit_logic_1', list(p))
9136
9137 # { p[0] = IVL_VT_LOGIC; }
9138 ()
9139
9140
9141 def p_bit_logic_2(p):
9142 '''bit_logic : K_bool '''
9143 if(parse_debug):
9144 print('bit_logic_2', list(p))
9145
9146 # { p[0] = IVL_VT_BOOL; /* Icarus misc */}
9147 ()
9148
9149
9150 def p_bit_logic_3(p):
9151 '''bit_logic : K_bit '''
9152 if(parse_debug):
9153 print('bit_logic_3', list(p))
9154
9155 # { p[0] = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
9156 ()
9157
9158
9159 def p_bit_logic_opt_1(p):
9160 '''bit_logic_opt : bit_logic '''
9161 if(parse_debug):
9162 print('bit_logic_opt_1', list(p))
9163
9164
9165 ()
9166
9167
9168 def p_bit_logic_opt_2(p):
9169 '''bit_logic_opt : '''
9170 if(parse_debug):
9171 print('bit_logic_opt_2', list(p))
9172
9173 # { p[0] = IVL_VT_NO_TYPE; }
9174 ()
9175
9176
9177 def p_net_type_1(p):
9178 '''net_type : K_wire '''
9179 if(parse_debug > 2):
9180 print('net_type_1', list(p))
9181
9182 p[0] = "wire"
9183
9184
9185 ()
9186
9187
9188 def p_net_type_2(p):
9189 '''net_type : K_tri '''
9190 if(parse_debug):
9191 print('net_type_2', list(p))
9192
9193 # { p[0] = NetNet::TRI; }
9194 ()
9195
9196
9197 def p_net_type_3(p):
9198 '''net_type : K_tri1 '''
9199 if(parse_debug):
9200 print('net_type_3', list(p))
9201
9202 # { p[0] = NetNet::TRI1; }
9203 ()
9204
9205
9206 def p_net_type_4(p):
9207 '''net_type : K_supply0 '''
9208 if(parse_debug):
9209 print('net_type_4', list(p))
9210
9211 # { p[0] = NetNet::SUPPLY0; }
9212 ()
9213
9214
9215 def p_net_type_5(p):
9216 '''net_type : K_wand '''
9217 if(parse_debug):
9218 print('net_type_5', list(p))
9219
9220 # { p[0] = NetNet::WAND; }
9221 ()
9222
9223
9224 def p_net_type_6(p):
9225 '''net_type : K_triand '''
9226 if(parse_debug):
9227 print('net_type_6', list(p))
9228
9229 # { p[0] = NetNet::TRIAND; }
9230 ()
9231
9232
9233 def p_net_type_7(p):
9234 '''net_type : K_tri0 '''
9235 if(parse_debug):
9236 print('net_type_7', list(p))
9237
9238 # { p[0] = NetNet::TRI0; }
9239 ()
9240
9241
9242 def p_net_type_8(p):
9243 '''net_type : K_supply1 '''
9244 if(parse_debug):
9245 print('net_type_8', list(p))
9246
9247 # { p[0] = NetNet::SUPPLY1; }
9248 ()
9249
9250
9251 def p_net_type_9(p):
9252 '''net_type : K_wor '''
9253 if(parse_debug):
9254 print('net_type_9', list(p))
9255
9256 # { p[0] = NetNet::WOR; }
9257 ()
9258
9259
9260 def p_net_type_10(p):
9261 '''net_type : K_trior '''
9262 if(parse_debug):
9263 print('net_type_10', list(p))
9264
9265 # { p[0] = NetNet::TRIOR; }
9266 ()
9267
9268
9269 def p_net_type_11(p):
9270 '''net_type : K_wone '''
9271 if(parse_debug):
9272 print('net_type_11', list(p))
9273
9274 # { p[0] = NetNet::UNRESOLVED_WIRE;
9275 # cerr << @1.text << ":" << @1.first_line << ": warning: "
9276 # "'wone' is deprecated, please use 'uwire' "
9277 # "instead." << endl;
9278 # }
9279 ()
9280
9281
9282 def p_net_type_12(p):
9283 '''net_type : K_uwire '''
9284 if(parse_debug):
9285 print('net_type_12', list(p))
9286
9287 # { p[0] = NetNet::UNRESOLVED_WIRE; }
9288 ()
9289
9290
9291 def p_param_type_1(p):
9292 '''param_type : bit_logic_opt unsigned_signed_opt dimensions_opt '''
9293 if(parse_debug):
9294 print('param_type_1', list(p))
9295
9296 # { param_active_range = p[3];
9297 # param_active_signed = p[2];
9298 # if ((p[1] == IVL_VT_NO_TYPE) && (p[3] != 0))
9299 # param_active_type = IVL_VT_LOGIC;
9300 # else
9301 # param_active_type = p[1];
9302 # }
9303 ()
9304
9305
9306 def p_param_type_2(p):
9307 '''param_type : K_integer '''
9308 if(parse_debug):
9309 print('param_type_2', list(p))
9310
9311 # { param_active_range = make_range_from_width(integer_width);
9312 # param_active_signed = true;
9313 # param_active_type = IVL_VT_LOGIC;
9314 # }
9315 ()
9316
9317
9318 def p_param_type_3(p):
9319 '''param_type : K_time '''
9320 if(parse_debug):
9321 print('param_type_3', list(p))
9322
9323 # { param_active_range = make_range_from_width(64);
9324 # param_active_signed = false;
9325 # param_active_type = IVL_VT_LOGIC;
9326 # }
9327 ()
9328
9329
9330 def p_param_type_4(p):
9331 '''param_type : real_or_realtime '''
9332 if(parse_debug):
9333 print('param_type_4', list(p))
9334
9335 # { param_active_range = 0;
9336 # param_active_signed = true;
9337 # param_active_type = IVL_VT_REAL;
9338 # }
9339 ()
9340
9341
9342 def p_param_type_5(p):
9343 '''param_type : atom2_type '''
9344 if(parse_debug):
9345 print('param_type_5', list(p))
9346
9347 # { param_active_range = make_range_from_width(p[1]);
9348 # param_active_signed = true;
9349 # param_active_type = IVL_VT_BOOL;
9350 # }
9351 ()
9352
9353
9354 def p_param_type_6(p):
9355 '''param_type : TYPE_IDENTIFIER '''
9356 if(parse_debug):
9357 print('param_type_6', list(p))
9358
9359 # { pform_set_param_from_type(@1, p[1].type, p[1].text, param_active_range,
9360 # param_active_signed, param_active_type);
9361 # delete[]p[1].text;
9362 # }
9363 ()
9364
9365
9366 def p_parameter_assign_list_1(p):
9367 '''parameter_assign_list : parameter_assign '''
9368 if(parse_debug):
9369 print('parameter_assign_list_1', list(p))
9370
9371
9372 ()
9373
9374
9375 def p_parameter_assign_list_2(p):
9376 '''parameter_assign_list : parameter_assign_list ',' parameter_assign '''
9377 if(parse_debug):
9378 print('parameter_assign_list_2', list(p))
9379
9380
9381 ()
9382
9383
9384 def p_localparam_assign_list_1(p):
9385 '''localparam_assign_list : localparam_assign '''
9386 if(parse_debug):
9387 print('localparam_assign_list_1', list(p))
9388
9389
9390 ()
9391
9392
9393 def p_localparam_assign_list_2(p):
9394 '''localparam_assign_list : localparam_assign_list ',' localparam_assign '''
9395 if(parse_debug):
9396 print('localparam_assign_list_2', list(p))
9397
9398
9399 ()
9400
9401
9402 def p_parameter_assign_1(p):
9403 '''parameter_assign : IDENTIFIER '=' expression parameter_value_ranges_opt '''
9404 if(parse_debug):
9405 print('parameter_assign_1', list(p))
9406 tpname = Node(syms.tname, [Leaf(token.NAME, p[1])])
9407 expr = Node(syms.tfpdef, [tpname, Leaf(token.EQUAL, p[2]), p[3]])
9408 p[0] = expr
9409
9410 # { PExpr*tmp = p[3];
9411 # pform_set_parameter(@1, lex_strings.make(p[1]), param_active_type,
9412 # param_active_signed, param_active_range, tmp, p[4]);
9413 # delete[]p[1];
9414 # }
9415 ()
9416
9417
9418 def p_localparam_assign_1(p):
9419 '''localparam_assign : IDENTIFIER '=' expression '''
9420 if(parse_debug):
9421 print('localparam_assign_1', list(p))
9422
9423 # { PExpr*tmp = p[3];
9424 # pform_set_localparam(@1, lex_strings.make(p[1]), param_active_type,
9425 # param_active_signed, param_active_range, tmp);
9426 # delete[]p[1];
9427 # }
9428 ()
9429
9430
9431 def p_parameter_value_ranges_opt_1(p):
9432 '''parameter_value_ranges_opt : parameter_value_ranges '''
9433 if(parse_debug):
9434 print('parameter_value_ranges_opt_1', list(p))
9435 p[0] = p[1]
9436
9437
9438 ()
9439
9440
9441 def p_parameter_value_ranges_opt_2(p):
9442 '''parameter_value_ranges_opt : '''
9443 if(parse_debug):
9444 print('parameter_value_ranges_opt_2', list(p))
9445
9446 # { p[0] = None }
9447 ()
9448
9449
9450 def p_parameter_value_ranges_1(p):
9451 '''parameter_value_ranges : parameter_value_ranges parameter_value_range '''
9452 if(parse_debug):
9453 print('parameter_value_ranges_1', list(p))
9454
9455 # { p[0] = p[2]; p[0]->next = p[1]; }
9456 ()
9457
9458
9459 def p_parameter_value_ranges_2(p):
9460 '''parameter_value_ranges : parameter_value_range '''
9461 if(parse_debug):
9462 print('parameter_value_ranges_2', list(p))
9463
9464 # { p[0] = p[1]; p[0]->next = 0; }
9465 ()
9466
9467
9468 def p_parameter_value_range_1(p):
9469 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ']' '''
9470 if(parse_debug):
9471 print('parameter_value_range_1', list(p))
9472
9473 # { p[0] = pform_parameter_value_range(p[1], false, p[3], false, p[5]); }
9474 ()
9475
9476
9477 def p_parameter_value_range_2(p):
9478 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ')' '''
9479 if(parse_debug):
9480 print('parameter_value_range_2', list(p))
9481
9482 # { p[0] = pform_parameter_value_range(p[1], false, p[3], true, p[5]); }
9483 ()
9484
9485
9486 def p_parameter_value_range_3(p):
9487 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ']' '''
9488 if(parse_debug):
9489 print('parameter_value_range_3', list(p))
9490
9491 # { p[0] = pform_parameter_value_range(p[1], true, p[3], false, p[5]); }
9492 ()
9493
9494
9495 def p_parameter_value_range_4(p):
9496 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ')' '''
9497 if(parse_debug):
9498 print('parameter_value_range_4', list(p))
9499
9500 # { p[0] = pform_parameter_value_range(p[1], true, p[3], true, p[5]); }
9501 ()
9502
9503
9504 def p_parameter_value_range_5(p):
9505 '''parameter_value_range : K_exclude expression '''
9506 if(parse_debug):
9507 print('parameter_value_range_5', list(p))
9508
9509 # { p[0] = pform_parameter_value_range(true, false, p[2], false, p[2]); }
9510 ()
9511
9512
9513 def p_value_range_expression_1(p):
9514 '''value_range_expression : expression '''
9515 if(parse_debug):
9516 print('value_range_expression_1', list(p))
9517 p[0] = p[1]
9518
9519
9520 ()
9521
9522
9523 def p_value_range_expression_2(p):
9524 '''value_range_expression : K_inf '''
9525 if(parse_debug):
9526 print('value_range_expression_2', list(p))
9527
9528 # { p[0] = None }
9529 ()
9530
9531
9532 def p_value_range_expression_3(p):
9533 '''value_range_expression : '+' K_inf '''
9534 if(parse_debug):
9535 print('value_range_expression_3', list(p))
9536
9537 # { p[0] = None }
9538 ()
9539
9540
9541 def p_value_range_expression_4(p):
9542 '''value_range_expression : '-' K_inf '''
9543 if(parse_debug):
9544 print('value_range_expression_4', list(p))
9545
9546 # { p[0] = None }
9547 ()
9548
9549
9550 def p_from_exclude_1(p):
9551 '''from_exclude : K_from '''
9552 if(parse_debug):
9553 print('from_exclude_1', list(p))
9554 p[0] = False
9555
9556
9557 ()
9558
9559
9560 def p_from_exclude_2(p):
9561 '''from_exclude : K_exclude '''
9562 if(parse_debug):
9563 print('from_exclude_2', list(p))
9564 p[0] = True
9565
9566
9567 ()
9568
9569
9570 def p_parameter_value_opt_1(p):
9571 '''parameter_value_opt : '#' '(' expression_list_with_nuls ')' '''
9572 if(parse_debug):
9573 print('parameter_value_opt_1', list(p))
9574
9575 # { struct parmvalue_t*tmp = new struct parmvalue_t;
9576 # tmp->by_order = p[3];
9577 # tmp->by_name = 0;
9578 # p[0] = tmp;
9579 # }
9580 ()
9581
9582
9583 def p_parameter_value_opt_2(p):
9584 '''parameter_value_opt : '#' '(' parameter_value_byname_list ')' '''
9585 if(parse_debug):
9586 print('parameter_value_opt_2', list(p))
9587
9588 # { struct parmvalue_t*tmp = new struct parmvalue_t;
9589 # tmp->by_order = 0;
9590 # tmp->by_name = p[3];
9591 # p[0] = tmp;
9592 # }
9593 ()
9594
9595
9596 def p_parameter_value_opt_3(p):
9597 '''parameter_value_opt : '#' DEC_NUMBER '''
9598 if(parse_debug):
9599 print('parameter_value_opt_3', list(p))
9600
9601 # { assert(p[2]);
9602 # PENumber*tmp = new PENumber(p[2]);
9603 # FILE_NAME(tmp, @1);
9604 #
9605 # struct parmvalue_t*lst = new struct parmvalue_t;
9606 # lst->by_order = new list<PExpr*>;
9607 # lst->by_order->push_back(tmp);
9608 # lst->by_name = 0;
9609 # p[0] = lst;
9610 # based_size = 0;
9611 # }
9612 ()
9613
9614
9615 def p_parameter_value_opt_4(p):
9616 '''parameter_value_opt : '#' REALTIME '''
9617 if(parse_debug):
9618 print('parameter_value_opt_4', list(p))
9619
9620 # { assert(p[2]);
9621 # PEFNumber*tmp = new PEFNumber(p[2]);
9622 # FILE_NAME(tmp, @1);
9623 #
9624 # struct parmvalue_t*lst = new struct parmvalue_t;
9625 # lst->by_order = new list<PExpr*>;
9626 # lst->by_order->push_back(tmp);
9627 # lst->by_name = 0;
9628 # p[0] = lst;
9629 # }
9630 ()
9631
9632
9633 def p_parameter_value_opt_5(p):
9634 '''parameter_value_opt : '#' error '''
9635 if(parse_debug):
9636 print('parameter_value_opt_5', list(p))
9637
9638 # { yyerror(@1, "error: syntax error in parameter value "
9639 # "assignment list.");
9640 # p[0] = None
9641 # }
9642 ()
9643
9644
9645 def p_parameter_value_opt_6(p):
9646 '''parameter_value_opt : '''
9647 if(parse_debug):
9648 print('parameter_value_opt_6', list(p))
9649
9650 # { p[0] = None }
9651 ()
9652
9653
9654 def p_parameter_value_byname_1(p):
9655 '''parameter_value_byname : '.' IDENTIFIER '(' expression ')' '''
9656 if(parse_debug):
9657 print('parameter_value_byname_1', list(p))
9658
9659 # { named_pexpr_t*tmp = new named_pexpr_t;
9660 # tmp->name = lex_strings.make(p[2]);
9661 # tmp->parm = p[4];
9662 # delete[]p[2];
9663 # p[0] = tmp;
9664 # }
9665 ()
9666
9667
9668 def p_parameter_value_byname_2(p):
9669 '''parameter_value_byname : '.' IDENTIFIER '(' ')' '''
9670 if(parse_debug):
9671 print('parameter_value_byname_2', list(p))
9672
9673 # { named_pexpr_t*tmp = new named_pexpr_t;
9674 # tmp->name = lex_strings.make(p[2]);
9675 # tmp->parm = 0;
9676 # delete[]p[2];
9677 # p[0] = tmp;
9678 # }
9679 ()
9680
9681
9682 def p_parameter_value_byname_list_1(p):
9683 '''parameter_value_byname_list : parameter_value_byname '''
9684 if(parse_debug):
9685 print('parameter_value_byname_list_1', list(p))
9686
9687 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
9688 # tmp->push_back(*p[1]);
9689 # delete p[1];
9690 # p[0] = tmp;
9691 # }
9692 ()
9693
9694
9695 def p_parameter_value_byname_list_2(p):
9696 '''parameter_value_byname_list : parameter_value_byname_list ',' parameter_value_byname '''
9697 if(parse_debug):
9698 print('parameter_value_byname_list_2', list(p))
9699
9700 # { list<named_pexpr_t>*tmp = p[1];
9701 # tmp->push_back(*p[3]);
9702 # delete p[3];
9703 # p[0] = tmp;
9704 # }
9705 ()
9706
9707
9708 def p_port_1(p):
9709 '''port : port_reference '''
9710 if(parse_debug):
9711 print('port_1', list(p))
9712 p[0] = p[1]
9713
9714
9715 ()
9716
9717
9718 def p_port_2(p):
9719 '''port : '.' IDENTIFIER '(' port_reference ')' '''
9720 if(parse_debug):
9721 print('port_2', list(p))
9722
9723 # { Module::port_t*tmp = p[4];
9724 # tmp->name = lex_strings.make(p[2]);
9725 # delete[]p[2];
9726 # p[0] = tmp;
9727 # }
9728 ()
9729
9730
9731 def p_port_3(p):
9732 '''port : '{' port_reference_list '}' '''
9733 if(parse_debug):
9734 print('port_3', list(p))
9735
9736 # { Module::port_t*tmp = p[2];
9737 # tmp->name = perm_string();
9738 # p[0] = tmp;
9739 # }
9740 ()
9741
9742
9743 def p_port_4(p):
9744 '''port : '.' IDENTIFIER '(' '{' port_reference_list '}' ')' '''
9745 if(parse_debug):
9746 print('port_4', list(p))
9747
9748 # { Module::port_t*tmp = p[5];
9749 # tmp->name = lex_strings.make(p[2]);
9750 # delete[]p[2];
9751 # p[0] = tmp;
9752 # }
9753 ()
9754
9755
9756 def p_port_opt_1(p):
9757 '''port_opt : port '''
9758 if(parse_debug):
9759 print('port_opt_1', list(p))
9760 p[0] = p[1]
9761
9762
9763 ()
9764
9765
9766 def p_port_opt_2(p):
9767 '''port_opt : '''
9768 if(parse_debug):
9769 print('port_opt_2', list(p))
9770
9771 # { p[0] = None }
9772 ()
9773
9774
9775 def p_port_name_1(p):
9776 '''port_name : '.' IDENTIFIER '(' expression ')' '''
9777 if(parse_debug):
9778 print('port_name_1', list(p))
9779
9780 # { named_pexpr_t*tmp = new named_pexpr_t;
9781 # tmp->name = lex_strings.make(p[2]);
9782 # tmp->parm = p[4];
9783 # delete[]p[2];
9784 # p[0] = tmp;
9785 # }
9786 ()
9787
9788
9789 def p_port_name_2(p):
9790 '''port_name : '.' IDENTIFIER '(' error ')' '''
9791 if(parse_debug):
9792 print('port_name_2', list(p))
9793
9794 # { yyerror(@3, "error: invalid port connection expression.");
9795 # named_pexpr_t*tmp = new named_pexpr_t;
9796 # tmp->name = lex_strings.make(p[2]);
9797 # tmp->parm = 0;
9798 # delete[]p[2];
9799 # p[0] = tmp;
9800 # }
9801 ()
9802
9803
9804 def p_port_name_3(p):
9805 '''port_name : '.' IDENTIFIER '(' ')' '''
9806 if(parse_debug):
9807 print('port_name_3', list(p))
9808
9809 # { named_pexpr_t*tmp = new named_pexpr_t;
9810 # tmp->name = lex_strings.make(p[2]);
9811 # tmp->parm = 0;
9812 # delete[]p[2];
9813 # p[0] = tmp;
9814 # }
9815 ()
9816
9817
9818 def p_port_name_4(p):
9819 '''port_name : '.' IDENTIFIER '''
9820 if(parse_debug):
9821 print('port_name_4', list(p))
9822
9823 # { named_pexpr_t*tmp = new named_pexpr_t;
9824 # tmp->name = lex_strings.make(p[2]);
9825 # tmp->parm = new PEIdent(lex_strings.make(p[2]), true);
9826 # FILE_NAME(tmp->parm, @1);
9827 # delete[]p[2];
9828 # p[0] = tmp;
9829 # }
9830 ()
9831
9832
9833 def p_port_name_5(p):
9834 '''port_name : K_DOTSTAR '''
9835 if(parse_debug):
9836 print('port_name_5', list(p))
9837
9838 # { named_pexpr_t*tmp = new named_pexpr_t;
9839 # tmp->name = lex_strings.make("*");
9840 # tmp->parm = 0;
9841 # p[0] = tmp;
9842 # }
9843 ()
9844
9845
9846 def p_port_name_list_1(p):
9847 '''port_name_list : port_name_list ',' port_name '''
9848 if(parse_debug):
9849 print('port_name_list_1', list(p))
9850
9851 # { list<named_pexpr_t>*tmp = p[1];
9852 # tmp->push_back(*p[3]);
9853 # delete p[3];
9854 # p[0] = tmp;
9855 # }
9856 ()
9857
9858
9859 def p_port_name_list_2(p):
9860 '''port_name_list : port_name '''
9861 if(parse_debug):
9862 print('port_name_list_2', list(p))
9863
9864 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
9865 # tmp->push_back(*p[1]);
9866 # delete p[1];
9867 # p[0] = tmp;
9868 # }
9869 ()
9870
9871
9872 def p_port_reference_1(p):
9873 '''port_reference : IDENTIFIER '''
9874 if(parse_debug):
9875 print('port_reference_1', list(p))
9876
9877 # { Module::port_t*ptmp;
9878 # perm_string name = lex_strings.make(p[1]);
9879 # ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
9880 # delete[]p[1];
9881 # p[0] = ptmp;
9882 # }
9883 ()
9884
9885
9886 def p_port_reference_2(p):
9887 '''port_reference : IDENTIFIER '[' expression ':' expression ']' '''
9888 if(parse_debug):
9889 print('port_reference_2', list(p))
9890
9891 # { index_component_t itmp;
9892 # itmp.sel = index_component_t::SEL_PART;
9893 # itmp.msb = p[3];
9894 # itmp.lsb = p[5];
9895 #
9896 # name_component_t ntmp (lex_strings.make(p[1]));
9897 # ntmp.index.push_back(itmp);
9898 #
9899 # pform_name_t pname;
9900 # pname.push_back(ntmp);
9901 #
9902 # PEIdent*wtmp = new PEIdent(pname);
9903 # FILE_NAME(wtmp, @1);
9904 #
9905 # Module::port_t*ptmp = new Module::port_t;
9906 # ptmp->name = perm_string();
9907 # ptmp->expr.push_back(wtmp);
9908 #
9909 # delete[]p[1];
9910 # p[0] = ptmp;
9911 # }
9912 ()
9913
9914
9915 def p_port_reference_3(p):
9916 '''port_reference : IDENTIFIER '[' expression ']' '''
9917 if(parse_debug):
9918 print('port_reference_3', list(p))
9919
9920 # { index_component_t itmp;
9921 # itmp.sel = index_component_t::SEL_BIT;
9922 # itmp.msb = p[3];
9923 # itmp.lsb = 0;
9924 #
9925 # name_component_t ntmp (lex_strings.make(p[1]));
9926 # ntmp.index.push_back(itmp);
9927 #
9928 # pform_name_t pname;
9929 # pname.push_back(ntmp);
9930 #
9931 # PEIdent*tmp = new PEIdent(pname);
9932 # FILE_NAME(tmp, @1);
9933 #
9934 # Module::port_t*ptmp = new Module::port_t;
9935 # ptmp->name = perm_string();
9936 # ptmp->expr.push_back(tmp);
9937 # delete[]p[1];
9938 # p[0] = ptmp;
9939 # }
9940 ()
9941
9942
9943 def p_port_reference_4(p):
9944 '''port_reference : IDENTIFIER '[' error ']' '''
9945 if(parse_debug):
9946 print('port_reference_4', list(p))
9947
9948 # { yyerror(@1, "error: invalid port bit select");
9949 # Module::port_t*ptmp = new Module::port_t;
9950 # PEIdent*wtmp = new PEIdent(lex_strings.make(p[1]));
9951 # FILE_NAME(wtmp, @1);
9952 # ptmp->name = lex_strings.make(p[1]);
9953 # ptmp->expr.push_back(wtmp);
9954 # delete[]p[1];
9955 # p[0] = ptmp;
9956 # }
9957 ()
9958
9959
9960 def p_port_reference_list_1(p):
9961 '''port_reference_list : port_reference '''
9962 if(parse_debug):
9963 print('port_reference_list_1', list(p))
9964 p[0] = p[1]
9965
9966
9967 ()
9968
9969
9970 def p_port_reference_list_2(p):
9971 '''port_reference_list : port_reference_list ',' port_reference '''
9972 if(parse_debug):
9973 print('port_reference_list_2', list(p))
9974
9975 # { Module::port_t*tmp = p[1];
9976 # append(tmp->expr, p[3]->expr);
9977 # delete p[3];
9978 # p[0] = tmp;
9979 # }
9980 ()
9981
9982
9983 def p_dimensions_opt_1(p):
9984 '''dimensions_opt : '''
9985 if(parse_debug > 2):
9986 print('dimensions_opt_1', list(p))
9987
9988 # { p[0] = None }
9989 ()
9990
9991
9992 def p_dimensions_opt_2(p):
9993 '''dimensions_opt : dimensions '''
9994 if(parse_debug):
9995 print('dimensions_opt_2', list(p))
9996 p[0] = p[1]
9997
9998
9999 ()
10000
10001
10002 def p_dimensions_1(p):
10003 '''dimensions : variable_dimension '''
10004 if(parse_debug):
10005 print('dimensions_1', list(p))
10006 p[0] = p[1]
10007
10008
10009 ()
10010
10011
10012 def p_dimensions_2(p):
10013 '''dimensions : dimensions variable_dimension '''
10014 if(parse_debug):
10015 print('dimensions_2', list(p))
10016
10017 # { list<pform_range_t> *tmp = p[1];
10018 # if (p[2]) {
10019 # tmp->splice(tmp->end(), *p[2]);
10020 # delete p[2];
10021 # }
10022 # p[0] = tmp;
10023 # }
10024 ()
10025
10026
10027 def p_register_variable_1(p):
10028 '''register_variable : IDENTIFIER dimensions_opt '''
10029 if(parse_debug):
10030 print('register_variable_1', list(p))
10031
10032 # { perm_string name = lex_strings.make(p[1]);
10033 # pform_makewire(@1, name, NetNet::REG,
10034 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10035 # pform_set_reg_idx(name, p[2]);
10036 # p[0] = p[1];
10037 # }
10038 ()
10039
10040
10041 def p_register_variable_2(p):
10042 '''register_variable : IDENTIFIER dimensions_opt '=' expression '''
10043 if(parse_debug):
10044 print('register_variable_2', list(p))
10045
10046 # { if (pform_peek_scope()->var_init_needs_explicit_lifetime()
10047 # && (var_lifetime == LexicalScope::INHERITED)) {
10048 # cerr << @3 << ": warning: Static variable initialization requires "
10049 # "explicit lifetime in this context." << endl;
10050 # warn_count += 1;
10051 # }
10052 # perm_string name = lex_strings.make(p[1]);
10053 # pform_makewire(@1, name, NetNet::REG,
10054 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10055 # pform_set_reg_idx(name, p[2]);
10056 # pform_make_var_init(@1, name, p[4]);
10057 # p[0] = p[1];
10058 # }
10059 ()
10060
10061
10062 def p_register_variable_list_1(p):
10063 '''register_variable_list : register_variable '''
10064 if(parse_debug):
10065 print('register_variable_list_1', list(p))
10066
10067 # { list<perm_string>*tmp = new list<perm_string>;
10068 # tmp->push_back(lex_strings.make(p[1]));
10069 # p[0] = tmp;
10070 # delete[]p[1];
10071 # }
10072 ()
10073
10074
10075 def p_register_variable_list_2(p):
10076 '''register_variable_list : register_variable_list ',' register_variable '''
10077 if(parse_debug):
10078 print('register_variable_list_2', list(p))
10079
10080 # { list<perm_string>*tmp = p[1];
10081 # tmp->push_back(lex_strings.make(p[3]));
10082 # p[0] = tmp;
10083 # delete[]p[3];
10084 # }
10085 ()
10086
10087
10088 def p_net_variable_1(p):
10089 '''net_variable : IDENTIFIER dimensions_opt '''
10090 if(parse_debug > 2):
10091 print('net_variable_1', list(p))
10092
10093 #p[0]= ('net_variable_1', list(p))
10094
10095 # { perm_string name = lex_strings.make(p[1]);
10096 # pform_makewire(@1, name, NetNet::IMPLICIT,
10097 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10098 # pform_set_reg_idx(name, p[2]);
10099 p[0] = [p[1], p[2]]
10100
10101
10102 # }
10103 ()
10104
10105
10106 def p_net_variable_list_1(p):
10107 '''net_variable_list : net_variable '''
10108 if(parse_debug > 2):
10109 print('net_variable_list_1', list(p))
10110 p[0] = [p[1]]
10111
10112 # { list<perm_string>*tmp = new list<perm_string>;
10113 # tmp->push_back(lex_strings.make(p[1]));
10114 # p[0] = tmp;
10115 # delete[]p[1];
10116 # }
10117 ()
10118
10119
10120 def p_net_variable_list_2(p):
10121 '''net_variable_list : net_variable_list ',' net_variable '''
10122 if(parse_debug > 2):
10123 print('net_variable_list_2', list(p))
10124 p[0] = p[1]+[p[3]]
10125
10126 # { list<perm_string>*tmp = p[1];
10127 # tmp->push_back(lex_strings.make(p[3]));
10128 # p[0] = tmp;
10129 # delete[]p[3];
10130 # }
10131 ()
10132
10133
10134 def p_event_variable_1(p):
10135 '''event_variable : IDENTIFIER dimensions_opt '''
10136 if(parse_debug):
10137 print('event_variable_1', list(p))
10138
10139 # { if (p[2]) {
10140 # yyerror(@2, "sorry: event arrays are not supported.");
10141 # delete p[2];
10142 # }
10143 # p[0] = p[1];
10144 # }
10145 ()
10146
10147
10148 def p_event_variable_list_1(p):
10149 '''event_variable_list : event_variable '''
10150 if(parse_debug):
10151 print('event_variable_list_1', list(p))
10152
10153 # { p[0] = list_from_identifier(p[1]); }
10154 ()
10155
10156
10157 def p_event_variable_list_2(p):
10158 '''event_variable_list : event_variable_list ',' event_variable '''
10159 if(parse_debug):
10160 print('event_variable_list_2', list(p))
10161
10162 # { p[0] = list_from_identifier(p[1], p[3]); }
10163 ()
10164
10165
10166 def p_specify_item_1(p):
10167 '''specify_item : K_specparam specparam_decl ';' '''
10168 if(parse_debug):
10169 print('specify_item_1', list(p))
10170
10171
10172 ()
10173
10174
10175 def p_specify_item_2(p):
10176 '''specify_item : specify_simple_path_decl ';' '''
10177 if(parse_debug):
10178 print('specify_item_2', list(p))
10179
10180 # { pform_module_specify_path(p[1]);
10181 # }
10182 ()
10183
10184
10185 def p_specify_item_3(p):
10186 '''specify_item : specify_edge_path_decl ';' '''
10187 if(parse_debug):
10188 print('specify_item_3', list(p))
10189
10190 # { pform_module_specify_path(p[1]);
10191 # }
10192 ()
10193
10194
10195 def p_specify_item_4(p):
10196 '''specify_item : K_if '(' expression ')' specify_simple_path_decl ';' '''
10197 if(parse_debug):
10198 print('specify_item_4', list(p))
10199
10200 # { PSpecPath*tmp = p[5];
10201 # if (tmp) {
10202 # tmp->conditional = true;
10203 # tmp->condition = p[3];
10204 # }
10205 # pform_module_specify_path(tmp);
10206 # }
10207 ()
10208
10209
10210 def p_specify_item_5(p):
10211 '''specify_item : K_if '(' expression ')' specify_edge_path_decl ';' '''
10212 if(parse_debug):
10213 print('specify_item_5', list(p))
10214
10215 # { PSpecPath*tmp = p[5];
10216 # if (tmp) {
10217 # tmp->conditional = true;
10218 # tmp->condition = p[3];
10219 # }
10220 # pform_module_specify_path(tmp);
10221 # }
10222 ()
10223
10224
10225 def p_specify_item_6(p):
10226 '''specify_item : K_ifnone specify_simple_path_decl ';' '''
10227 if(parse_debug):
10228 print('specify_item_6', list(p))
10229
10230 # { PSpecPath*tmp = p[2];
10231 # if (tmp) {
10232 # tmp->conditional = true;
10233 # tmp->condition = 0;
10234 # }
10235 # pform_module_specify_path(tmp);
10236 # }
10237 ()
10238
10239
10240 def p_specify_item_7(p):
10241 '''specify_item : K_ifnone specify_edge_path_decl ';' '''
10242 if(parse_debug):
10243 print('specify_item_7', list(p))
10244
10245 # { yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
10246 # "not supported.");
10247 # yyerrok;
10248 # }
10249 ()
10250
10251
10252 def p_specify_item_8(p):
10253 '''specify_item : K_Sfullskew '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10254 if(parse_debug):
10255 print('specify_item_8', list(p))
10256
10257 # { delete p[7];
10258 # delete p[9];
10259 # }
10260 ()
10261
10262
10263 def p_specify_item_9(p):
10264 '''specify_item : K_Shold '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10265 if(parse_debug):
10266 print('specify_item_9', list(p))
10267
10268 # { delete p[7];
10269 # }
10270 ()
10271
10272
10273 def p_specify_item_10(p):
10274 '''specify_item : K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10275 if(parse_debug):
10276 print('specify_item_10', list(p))
10277
10278 # { delete p[7];
10279 # delete p[9];
10280 # }
10281 ()
10282
10283
10284 def p_specify_item_11(p):
10285 '''specify_item : K_Speriod '(' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10286 if(parse_debug):
10287 print('specify_item_11', list(p))
10288
10289 # { delete p[5];
10290 # }
10291 ()
10292
10293
10294 def p_specify_item_12(p):
10295 '''specify_item : K_Srecovery '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10296 if(parse_debug):
10297 print('specify_item_12', list(p))
10298
10299 # { delete p[7];
10300 # }
10301 ()
10302
10303
10304 def p_specify_item_13(p):
10305 '''specify_item : K_Srecrem '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10306 if(parse_debug):
10307 print('specify_item_13', list(p))
10308
10309 # { delete p[7];
10310 # delete p[9];
10311 # }
10312 ()
10313
10314
10315 def p_specify_item_14(p):
10316 '''specify_item : K_Sremoval '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10317 if(parse_debug):
10318 print('specify_item_14', list(p))
10319
10320 # { delete p[7];
10321 # }
10322 ()
10323
10324
10325 def p_specify_item_15(p):
10326 '''specify_item : K_Ssetup '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10327 if(parse_debug):
10328 print('specify_item_15', list(p))
10329
10330 # { delete p[7];
10331 # }
10332 ()
10333
10334
10335 def p_specify_item_16(p):
10336 '''specify_item : K_Ssetuphold '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10337 if(parse_debug):
10338 print('specify_item_16', list(p))
10339
10340 # { delete p[7];
10341 # delete p[9];
10342 # }
10343 ()
10344
10345
10346 def p_specify_item_17(p):
10347 '''specify_item : K_Sskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10348 if(parse_debug):
10349 print('specify_item_17', list(p))
10350
10351 # { delete p[7];
10352 # }
10353 ()
10354
10355
10356 def p_specify_item_18(p):
10357 '''specify_item : K_Stimeskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10358 if(parse_debug):
10359 print('specify_item_18', list(p))
10360
10361 # { delete p[7];
10362 # }
10363 ()
10364
10365
10366 def p_specify_item_19(p):
10367 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ',' expression spec_notifier_opt ')' ';' '''
10368 if(parse_debug):
10369 print('specify_item_19', list(p))
10370
10371 # { delete p[5];
10372 # delete p[7];
10373 # }
10374 ()
10375
10376
10377 def p_specify_item_20(p):
10378 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ')' ';' '''
10379 if(parse_debug):
10380 print('specify_item_20', list(p))
10381
10382 # { delete p[5];
10383 # }
10384 ()
10385
10386
10387 def p_specify_item_21(p):
10388 '''specify_item : K_pulsestyle_onevent specify_path_identifiers ';' '''
10389 if(parse_debug):
10390 print('specify_item_21', list(p))
10391
10392 # { delete p[2];
10393 # }
10394 ()
10395
10396
10397 def p_specify_item_22(p):
10398 '''specify_item : K_pulsestyle_ondetect specify_path_identifiers ';' '''
10399 if(parse_debug):
10400 print('specify_item_22', list(p))
10401
10402 # { delete p[2];
10403 # }
10404 ()
10405
10406
10407 def p_specify_item_23(p):
10408 '''specify_item : K_showcancelled specify_path_identifiers ';' '''
10409 if(parse_debug):
10410 print('specify_item_23', list(p))
10411
10412 # { delete p[2];
10413 # }
10414 ()
10415
10416
10417 def p_specify_item_24(p):
10418 '''specify_item : K_noshowcancelled specify_path_identifiers ';' '''
10419 if(parse_debug):
10420 print('specify_item_24', list(p))
10421
10422 # { delete p[2];
10423 # }
10424 ()
10425
10426
10427 def p_specify_item_list_1(p):
10428 '''specify_item_list : specify_item '''
10429 if(parse_debug):
10430 print('specify_item_list_1', list(p))
10431
10432
10433 ()
10434
10435
10436 def p_specify_item_list_2(p):
10437 '''specify_item_list : specify_item_list specify_item '''
10438 if(parse_debug):
10439 print('specify_item_list_2', list(p))
10440
10441
10442 ()
10443
10444
10445 def p_specify_item_list_opt_1(p):
10446 '''specify_item_list_opt : '''
10447 if(parse_debug):
10448 print('specify_item_list_opt_1', list(p))
10449
10450 # { }
10451 ()
10452
10453
10454 def p_specify_item_list_opt_2(p):
10455 '''specify_item_list_opt : specify_item_list '''
10456 if(parse_debug):
10457 print('specify_item_list_opt_2', list(p))
10458
10459 # { }
10460 ()
10461
10462
10463 def p_specify_edge_path_decl_1(p):
10464 '''specify_edge_path_decl : specify_edge_path '=' '(' delay_value_list ')' '''
10465 if(parse_debug):
10466 print('specify_edge_path_decl_1', list(p))
10467
10468 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
10469 ()
10470
10471
10472 def p_specify_edge_path_decl_2(p):
10473 '''specify_edge_path_decl : specify_edge_path '=' delay_value_simple '''
10474 if(parse_debug):
10475 print('specify_edge_path_decl_2', list(p))
10476
10477 # { list<PExpr*>*tmp = new list<PExpr*>;
10478 # tmp->push_back(p[3]);
10479 # p[0] = pform_assign_path_delay(p[1], tmp);
10480 # }
10481 ()
10482
10483
10484 def p_edge_operator_1(p):
10485 '''edge_operator : K_posedge '''
10486 if(parse_debug):
10487 print('edge_operator_1', list(p))
10488 p[0] = True
10489
10490
10491 ()
10492
10493
10494 def p_edge_operator_2(p):
10495 '''edge_operator : K_negedge '''
10496 if(parse_debug):
10497 print('edge_operator_2', list(p))
10498 p[0] = False
10499
10500
10501 ()
10502
10503
10504 def p_specify_edge_path_1(p):
10505 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10506 if(parse_debug):
10507 print('specify_edge_path_1', list(p))
10508
10509 # { int edge_flag = 0;
10510 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], false, p[6], p[8]); }
10511 ()
10512
10513
10514 def p_specify_edge_path_2(p):
10515 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10516 if(parse_debug):
10517 print('specify_edge_path_2', list(p))
10518
10519 # { int edge_flag = p[2]? 1 : -1;
10520 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], false, p[7], p[9]);}
10521 ()
10522
10523
10524 def p_specify_edge_path_3(p):
10525 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10526 if(parse_debug):
10527 print('specify_edge_path_3', list(p))
10528
10529 # { int edge_flag = 0;
10530 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], true, p[6], p[8]); }
10531 ()
10532
10533
10534 def p_specify_edge_path_4(p):
10535 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10536 if(parse_debug):
10537 print('specify_edge_path_4', list(p))
10538
10539 # { int edge_flag = p[2]? 1 : -1;
10540 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], true, p[7], p[9]); }
10541 ()
10542
10543
10544 def p_polarity_operator_1(p):
10545 '''polarity_operator : K_PO_POS '''
10546 if(parse_debug):
10547 print('polarity_operator_1', list(p))
10548
10549
10550 ()
10551
10552
10553 def p_polarity_operator_2(p):
10554 '''polarity_operator : K_PO_NEG '''
10555 if(parse_debug):
10556 print('polarity_operator_2', list(p))
10557
10558
10559 ()
10560
10561
10562 def p_polarity_operator_3(p):
10563 '''polarity_operator : ':' '''
10564 if(parse_debug):
10565 print('polarity_operator_3', list(p))
10566
10567
10568 ()
10569
10570
10571 def p_specify_simple_path_decl_1(p):
10572 '''specify_simple_path_decl : specify_simple_path '=' '(' delay_value_list ')' '''
10573 if(parse_debug):
10574 print('specify_simple_path_decl_1', list(p))
10575
10576 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
10577 ()
10578
10579
10580 def p_specify_simple_path_decl_2(p):
10581 '''specify_simple_path_decl : specify_simple_path '=' delay_value_simple '''
10582 if(parse_debug):
10583 print('specify_simple_path_decl_2', list(p))
10584
10585 # { list<PExpr*>*tmp = new list<PExpr*>;
10586 # tmp->push_back(p[3]);
10587 # p[0] = pform_assign_path_delay(p[1], tmp);
10588 # }
10589 ()
10590
10591
10592 def p_specify_simple_path_decl_3(p):
10593 '''specify_simple_path_decl : specify_simple_path '=' '(' error ')' '''
10594 if(parse_debug):
10595 print('specify_simple_path_decl_3', list(p))
10596
10597 # { yyerror(@3, "Syntax error in delay value list.");
10598 # yyerrok;
10599 # p[0] = None
10600 # }
10601 ()
10602
10603
10604 def p_specify_simple_path_1(p):
10605 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' '''
10606 if(parse_debug):
10607 print('specify_simple_path_1', list(p))
10608
10609 # { p[0] = pform_make_specify_path(@1, p[2], p[3], false, p[5]); }
10610 ()
10611
10612
10613 def p_specify_simple_path_2(p):
10614 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' '''
10615 if(parse_debug):
10616 print('specify_simple_path_2', list(p))
10617
10618 # { p[0] = pform_make_specify_path(@1, p[2], p[3], true, p[5]); }
10619 ()
10620
10621
10622 def p_specify_simple_path_3(p):
10623 '''specify_simple_path : '(' error ')' '''
10624 if(parse_debug):
10625 print('specify_simple_path_3', list(p))
10626
10627 # { yyerror(@1, "Invalid simple path");
10628 # yyerrok;
10629 # }
10630 ()
10631
10632
10633 def p_specify_path_identifiers_1(p):
10634 '''specify_path_identifiers : IDENTIFIER '''
10635 if(parse_debug):
10636 print('specify_path_identifiers_1', list(p))
10637
10638 # { list<perm_string>*tmp = new list<perm_string>;
10639 # tmp->push_back(lex_strings.make(p[1]));
10640 # p[0] = tmp;
10641 # delete[]p[1];
10642 # }
10643 ()
10644
10645
10646 def p_specify_path_identifiers_2(p):
10647 '''specify_path_identifiers : IDENTIFIER '[' expr_primary ']' '''
10648 if(parse_debug):
10649 print('specify_path_identifiers_2', list(p))
10650
10651 # { if (gn_specify_blocks_flag) {
10652 # yywarn(@4, "Bit selects are not currently supported "
10653 # "in path declarations. The declaration "
10654 # "will be applied to the whole vector.");
10655 # }
10656 # list<perm_string>*tmp = new list<perm_string>;
10657 # tmp->push_back(lex_strings.make(p[1]));
10658 # p[0] = tmp;
10659 # delete[]p[1];
10660 # }
10661 ()
10662
10663
10664 def p_specify_path_identifiers_3(p):
10665 '''specify_path_identifiers : IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
10666 if(parse_debug):
10667 print('specify_path_identifiers_3', list(p))
10668
10669 # { if (gn_specify_blocks_flag) {
10670 # yywarn(@4, "Part selects are not currently supported "
10671 # "in path declarations. The declaration "
10672 # "will be applied to the whole vector.");
10673 # }
10674 # list<perm_string>*tmp = new list<perm_string>;
10675 # tmp->push_back(lex_strings.make(p[1]));
10676 # p[0] = tmp;
10677 # delete[]p[1];
10678 # }
10679 ()
10680
10681
10682 def p_specify_path_identifiers_4(p):
10683 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '''
10684 if(parse_debug):
10685 print('specify_path_identifiers_4', list(p))
10686
10687 # { list<perm_string>*tmp = p[1];
10688 # tmp->push_back(lex_strings.make(p[3]));
10689 # p[0] = tmp;
10690 # delete[]p[3];
10691 # }
10692 ()
10693
10694
10695 def p_specify_path_identifiers_5(p):
10696 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' '''
10697 if(parse_debug):
10698 print('specify_path_identifiers_5', list(p))
10699
10700 # { if (gn_specify_blocks_flag) {
10701 # yywarn(@4, "Bit selects are not currently supported "
10702 # "in path declarations. The declaration "
10703 # "will be applied to the whole vector.");
10704 # }
10705 # list<perm_string>*tmp = p[1];
10706 # tmp->push_back(lex_strings.make(p[3]));
10707 # p[0] = tmp;
10708 # delete[]p[3];
10709 # }
10710 ()
10711
10712
10713 def p_specify_path_identifiers_6(p):
10714 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
10715 if(parse_debug):
10716 print('specify_path_identifiers_6', list(p))
10717
10718 # { if (gn_specify_blocks_flag) {
10719 # yywarn(@4, "Part selects are not currently supported "
10720 # "in path declarations. The declaration "
10721 # "will be applied to the whole vector.");
10722 # }
10723 # list<perm_string>*tmp = p[1];
10724 # tmp->push_back(lex_strings.make(p[3]));
10725 # p[0] = tmp;
10726 # delete[]p[3];
10727 # }
10728 ()
10729
10730
10731 def p_specparam_1(p):
10732 '''specparam : IDENTIFIER '=' expression '''
10733 if(parse_debug):
10734 print('specparam_1', list(p))
10735
10736 # { PExpr*tmp = p[3];
10737 # pform_set_specparam(@1, lex_strings.make(p[1]),
10738 # param_active_range, tmp);
10739 # delete[]p[1];
10740 # }
10741 ()
10742
10743
10744 def p_specparam_2(p):
10745 '''specparam : IDENTIFIER '=' expression ':' expression ':' expression '''
10746 if(parse_debug):
10747 print('specparam_2', list(p))
10748
10749 # { PExpr*tmp = 0;
10750 # switch (min_typ_max_flag) {
10751 # case MIN:
10752 # tmp = p[3];
10753 # delete p[5];
10754 # delete p[7];
10755 # break;
10756 # case TYP:
10757 # delete p[3];
10758 # tmp = p[5];
10759 # delete p[7];
10760 # break;
10761 # case MAX:
10762 # delete p[3];
10763 # delete p[5];
10764 # tmp = p[7];
10765 # break;
10766 # }
10767 # if (min_typ_max_warn > 0) {
10768 # cerr << tmp->get_fileline() << ": warning: choosing ";
10769 # switch (min_typ_max_flag) {
10770 # case MIN:
10771 # cerr << "min";
10772 # break;
10773 # case TYP:
10774 # cerr << "typ";
10775 # break;
10776 # case MAX:
10777 # cerr << "max";
10778 # break;
10779 # }
10780 # cerr << " expression." << endl;
10781 # min_typ_max_warn -= 1;
10782 # }
10783 # pform_set_specparam(@1, lex_strings.make(p[1]),
10784 # param_active_range, tmp);
10785 # delete[]p[1];
10786 # }
10787 ()
10788
10789
10790 def p_specparam_3(p):
10791 '''specparam : PATHPULSE_IDENTIFIER '=' expression '''
10792 if(parse_debug):
10793 print('specparam_3', list(p))
10794
10795 # { delete[]p[1];
10796 # delete p[3];
10797 # }
10798 ()
10799
10800
10801 def p_specparam_4(p):
10802 '''specparam : PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' '''
10803 if(parse_debug):
10804 print('specparam_4', list(p))
10805
10806 # { delete[]p[1];
10807 # delete p[4];
10808 # delete p[6];
10809 # }
10810 ()
10811
10812
10813 def p_specparam_list_1(p):
10814 '''specparam_list : specparam '''
10815 if(parse_debug):
10816 print('specparam_list_1', list(p))
10817
10818
10819 ()
10820
10821
10822 def p_specparam_list_2(p):
10823 '''specparam_list : specparam_list ',' specparam '''
10824 if(parse_debug):
10825 print('specparam_list_2', list(p))
10826
10827
10828 ()
10829
10830
10831 def p_specparam_decl_1(p):
10832 '''specparam_decl : specparam_list '''
10833 if(parse_debug):
10834 print('specparam_decl_1', list(p))
10835
10836
10837 ()
10838
10839
10840 def p_specparam_decl_2(p):
10841 '''specparam_decl : dimensions _embed0_specparam_decl specparam_list '''
10842 if(parse_debug):
10843 print('specparam_decl_2', list(p))
10844
10845 # { param_active_range = 0; }
10846 ()
10847
10848
10849 def p__embed0_specparam_decl(p):
10850 '''_embed0_specparam_decl : '''
10851
10852 # { param_active_range = p[1]; }
10853 ()
10854
10855
10856 def p_spec_polarity_1(p):
10857 '''spec_polarity : '+' '''
10858 if(parse_debug):
10859 print('spec_polarity_1', list(p))
10860
10861 # { p[0] = '+'; }
10862 ()
10863
10864
10865 def p_spec_polarity_2(p):
10866 '''spec_polarity : '-' '''
10867 if(parse_debug):
10868 print('spec_polarity_2', list(p))
10869
10870 # { p[0] = '-'; }
10871 ()
10872
10873
10874 def p_spec_polarity_3(p):
10875 '''spec_polarity : '''
10876 if(parse_debug):
10877 print('spec_polarity_3', list(p))
10878
10879 # { p[0] = None }
10880 ()
10881
10882
10883 def p_spec_reference_event_1(p):
10884 '''spec_reference_event : K_posedge expression '''
10885 if(parse_debug):
10886 print('spec_reference_event_1', list(p))
10887
10888 # { delete p[2]; }
10889 ()
10890
10891
10892 def p_spec_reference_event_2(p):
10893 '''spec_reference_event : K_negedge expression '''
10894 if(parse_debug):
10895 print('spec_reference_event_2', list(p))
10896
10897 # { delete p[2]; }
10898 ()
10899
10900
10901 def p_spec_reference_event_3(p):
10902 '''spec_reference_event : K_posedge expr_primary K_TAND expression '''
10903 if(parse_debug):
10904 print('spec_reference_event_3', list(p))
10905
10906 # { delete p[2];
10907 # delete p[4];
10908 # }
10909 ()
10910
10911
10912 def p_spec_reference_event_4(p):
10913 '''spec_reference_event : K_negedge expr_primary K_TAND expression '''
10914 if(parse_debug):
10915 print('spec_reference_event_4', list(p))
10916
10917 # { delete p[2];
10918 # delete p[4];
10919 # }
10920 ()
10921
10922
10923 def p_spec_reference_event_5(p):
10924 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary '''
10925 if(parse_debug):
10926 print('spec_reference_event_5', list(p))
10927
10928 # { delete p[5]; }
10929 ()
10930
10931
10932 def p_spec_reference_event_6(p):
10933 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression '''
10934 if(parse_debug):
10935 print('spec_reference_event_6', list(p))
10936
10937 # { delete p[5];
10938 # delete p[7];
10939 # }
10940 ()
10941
10942
10943 def p_spec_reference_event_7(p):
10944 '''spec_reference_event : expr_primary K_TAND expression '''
10945 if(parse_debug):
10946 print('spec_reference_event_7', list(p))
10947
10948 # { delete p[1];
10949 # delete p[3];
10950 # }
10951 ()
10952
10953
10954 def p_spec_reference_event_8(p):
10955 '''spec_reference_event : expr_primary '''
10956 if(parse_debug):
10957 print('spec_reference_event_8', list(p))
10958
10959 # { delete p[1]; }
10960 ()
10961
10962
10963 def p_edge_descriptor_list_1(p):
10964 '''edge_descriptor_list : edge_descriptor_list ',' K_edge_descriptor '''
10965 if(parse_debug):
10966 print('edge_descriptor_list_1', list(p))
10967
10968
10969 ()
10970
10971
10972 def p_edge_descriptor_list_2(p):
10973 '''edge_descriptor_list : K_edge_descriptor '''
10974 if(parse_debug):
10975 print('edge_descriptor_list_2', list(p))
10976
10977
10978 ()
10979
10980
10981 def p_spec_notifier_opt_1(p):
10982 '''spec_notifier_opt : '''
10983 if(parse_debug):
10984 print('spec_notifier_opt_1', list(p))
10985
10986 # { }
10987 ()
10988
10989
10990 def p_spec_notifier_opt_2(p):
10991 '''spec_notifier_opt : spec_notifier '''
10992 if(parse_debug):
10993 print('spec_notifier_opt_2', list(p))
10994
10995 # { }
10996 ()
10997
10998
10999 def p_spec_notifier_1(p):
11000 '''spec_notifier : ',' '''
11001 if(parse_debug):
11002 print('spec_notifier_1', list(p))
11003
11004 # { args_after_notifier = 0; }
11005 ()
11006
11007
11008 def p_spec_notifier_2(p):
11009 '''spec_notifier : ',' hierarchy_identifier '''
11010 if(parse_debug):
11011 print('spec_notifier_2', list(p))
11012
11013 # { args_after_notifier = 0; delete p[2]; }
11014 ()
11015
11016
11017 def p_spec_notifier_3(p):
11018 '''spec_notifier : spec_notifier ',' '''
11019 if(parse_debug):
11020 print('spec_notifier_3', list(p))
11021
11022 # { args_after_notifier += 1; }
11023 ()
11024
11025
11026 def p_spec_notifier_4(p):
11027 '''spec_notifier : spec_notifier ',' hierarchy_identifier '''
11028 if(parse_debug):
11029 print('spec_notifier_4', list(p))
11030
11031 # { args_after_notifier += 1;
11032 # if (args_after_notifier >= 3) {
11033 # cerr << @3 << ": warning: timing checks are not supported "
11034 # "and delayed signal \"" << *p[3]
11035 # << "\" will not be driven." << endl;
11036 # }
11037 # delete p[3]; }
11038 ()
11039
11040
11041 def p_spec_notifier_5(p):
11042 '''spec_notifier : IDENTIFIER '''
11043 if(parse_debug):
11044 print('spec_notifier_5', list(p))
11045
11046 # { args_after_notifier = 0; delete[]p[1]; }
11047 ()
11048
11049
11050 def p_statement_item_1(p):
11051 '''statement_item : K_assign lpvalue '=' expression ';' '''
11052 if(parse_debug):
11053 print('statement_item_1', list(p))
11054
11055 # { PCAssign*tmp = new PCAssign(p[2], p[4]);
11056 # FILE_NAME(tmp, @1);
11057 # p[0] = tmp;
11058 # }
11059 ()
11060
11061
11062 def p_statement_item_2(p):
11063 '''statement_item : K_deassign lpvalue ';' '''
11064 if(parse_debug):
11065 print('statement_item_2', list(p))
11066
11067 # { PDeassign*tmp = new PDeassign(p[2]);
11068 # FILE_NAME(tmp, @1);
11069 # p[0] = tmp;
11070 # }
11071 ()
11072
11073
11074 def p_statement_item_3(p):
11075 '''statement_item : K_force lpvalue '=' expression ';' '''
11076 if(parse_debug):
11077 print('statement_item_3', list(p))
11078
11079 # { PForce*tmp = new PForce(p[2], p[4]);
11080 # FILE_NAME(tmp, @1);
11081 # p[0] = tmp;
11082 # }
11083 ()
11084
11085
11086 def p_statement_item_4(p):
11087 '''statement_item : K_release lpvalue ';' '''
11088 if(parse_debug):
11089 print('statement_item_4', list(p))
11090
11091 # { PRelease*tmp = new PRelease(p[2]);
11092 # FILE_NAME(tmp, @1);
11093 # p[0] = tmp;
11094 # }
11095 ()
11096
11097
11098 def p_statement_item_5(p):
11099 '''statement_item : K_begin K_end '''
11100 if(parse_debug):
11101 print('statement_item_5', list(p))
11102
11103 # { PBlock*tmp = new PBlock(PBlock::BL_SEQ);
11104 # FILE_NAME(tmp, @1);
11105 # p[0] = tmp;
11106 # }
11107 ()
11108
11109
11110 def p_statement_item_6(p):
11111 '''statement_item : K_begin _embed0_statement_item block_item_decls_opt _embed1_statement_item statement_or_null_list K_end '''
11112 if(parse_debug):
11113 print('statement_item_6', list(p))
11114
11115 # { PBlock*tmp;
11116 # if (p[3]) {
11117 # pform_pop_scope();
11118 # assert(! current_block_stack.empty());
11119 # tmp = current_block_stack.top();
11120 # current_block_stack.pop();
11121 # } else {
11122 # tmp = new PBlock(PBlock::BL_SEQ);
11123 # FILE_NAME(tmp, @1);
11124 # }
11125 # if (p[5]) tmp->set_statement(*p[5]);
11126 # delete p[5];
11127 # p[0] = tmp;
11128 # }
11129 ()
11130
11131
11132 def p_statement_item_7(p):
11133 '''statement_item : K_begin ':' IDENTIFIER _embed2_statement_item block_item_decls_opt statement_or_null_list_opt K_end endlabel_opt '''
11134 if(parse_debug):
11135 print('statement_item_7', list(p))
11136
11137 # { pform_pop_scope();
11138 # assert(! current_block_stack.empty());
11139 # PBlock*tmp = current_block_stack.top();
11140 # current_block_stack.pop();
11141 # if (p[6]) tmp->set_statement(*p[6]);
11142 # delete p[6];
11143 # if (p[8]) {
11144 # if (strcmp(p[3],p[8]) != 0) {
11145 # yyerror(@8, "error: End label doesn't match begin name");
11146 # }
11147 # if (! gn_system_verilog()) {
11148 # yyerror(@8, "error: Begin end labels require "
11149 # "SystemVerilog.");
11150 # }
11151 # delete[]p[8];
11152 # }
11153 # delete[]p[3];
11154 # p[0] = tmp;
11155 # }
11156 ()
11157
11158
11159 def p_statement_item_8(p):
11160 '''statement_item : K_fork join_keyword '''
11161 if(parse_debug):
11162 print('statement_item_8', list(p))
11163
11164 # { PBlock*tmp = new PBlock(p[2]);
11165 # FILE_NAME(tmp, @1);
11166 # p[0] = tmp;
11167 # }
11168 ()
11169
11170
11171 def p_statement_item_9(p):
11172 '''statement_item : K_fork _embed3_statement_item block_item_decls_opt _embed4_statement_item statement_or_null_list join_keyword '''
11173 if(parse_debug):
11174 print('statement_item_9', list(p))
11175
11176 # { PBlock*tmp;
11177 # if (p[3]) {
11178 # pform_pop_scope();
11179 # assert(! current_block_stack.empty());
11180 # tmp = current_block_stack.top();
11181 # current_block_stack.pop();
11182 # tmp->set_join_type(p[6]);
11183 # } else {
11184 # tmp = new PBlock(p[6]);
11185 # FILE_NAME(tmp, @1);
11186 # }
11187 # if (p[5]) tmp->set_statement(*p[5]);
11188 # delete p[5];
11189 # p[0] = tmp;
11190 # }
11191 ()
11192
11193
11194 def p_statement_item_10(p):
11195 '''statement_item : K_fork ':' IDENTIFIER _embed5_statement_item block_item_decls_opt statement_or_null_list_opt join_keyword endlabel_opt '''
11196 if(parse_debug):
11197 print('statement_item_10', list(p))
11198
11199 # { pform_pop_scope();
11200 # assert(! current_block_stack.empty());
11201 # PBlock*tmp = current_block_stack.top();
11202 # current_block_stack.pop();
11203 # tmp->set_join_type(p[7]);
11204 # if (p[6]) tmp->set_statement(*p[6]);
11205 # delete p[6];
11206 # if (p[8]) {
11207 # if (strcmp(p[3],p[8]) != 0) {
11208 # yyerror(@8, "error: End label doesn't match fork name");
11209 # }
11210 # if (! gn_system_verilog()) {
11211 # yyerror(@8, "error: Fork end labels require "
11212 # "SystemVerilog.");
11213 # }
11214 # delete[]p[8];
11215 # }
11216 # delete[]p[3];
11217 # p[0] = tmp;
11218 # }
11219 ()
11220
11221
11222 def p_statement_item_11(p):
11223 '''statement_item : K_disable hierarchy_identifier ';' '''
11224 if(parse_debug):
11225 print('statement_item_11', list(p))
11226
11227 # { PDisable*tmp = new PDisable(*p[2]);
11228 # FILE_NAME(tmp, @1);
11229 # delete p[2];
11230 # p[0] = tmp;
11231 # }
11232 ()
11233
11234
11235 def p_statement_item_12(p):
11236 '''statement_item : K_disable K_fork ';' '''
11237 if(parse_debug):
11238 print('statement_item_12', list(p))
11239
11240 # { pform_name_t tmp_name;
11241 # PDisable*tmp = new PDisable(tmp_name);
11242 # FILE_NAME(tmp, @1);
11243 # p[0] = tmp;
11244 # }
11245 ()
11246
11247
11248 def p_statement_item_13(p):
11249 '''statement_item : K_TRIGGER hierarchy_identifier ';' '''
11250 if(parse_debug):
11251 print('statement_item_13', list(p))
11252
11253 # { PTrigger*tmp = new PTrigger(*p[2]);
11254 # FILE_NAME(tmp, @1);
11255 # delete p[2];
11256 # p[0] = tmp;
11257 # }
11258 ()
11259
11260
11261 def p_statement_item_14(p):
11262 '''statement_item : procedural_assertion_statement '''
11263 if(parse_debug):
11264 print('statement_item_14', list(p))
11265 p[0] = p[1]
11266
11267
11268 ()
11269
11270
11271 def p_statement_item_15(p):
11272 '''statement_item : loop_statement '''
11273 if(parse_debug):
11274 print('statement_item_15', list(p))
11275 p[0] = p[1]
11276
11277
11278 ()
11279
11280
11281 def p_statement_item_16(p):
11282 '''statement_item : jump_statement '''
11283 if(parse_debug):
11284 print('statement_item_16', list(p))
11285 p[0] = p[1]
11286
11287
11288 ()
11289
11290
11291 def p_statement_item_17(p):
11292 '''statement_item : K_case '(' expression ')' case_items K_endcase '''
11293 if(parse_debug):
11294 print('statement_item_17', list(p))
11295
11296 # { PCase*tmp = new PCase(NetCase::EQ, p[3], p[5]);
11297 # FILE_NAME(tmp, @1);
11298 # p[0] = tmp;
11299 # }
11300 ()
11301
11302
11303 def p_statement_item_18(p):
11304 '''statement_item : K_casex '(' expression ')' case_items K_endcase '''
11305 if(parse_debug):
11306 print('statement_item_18', list(p))
11307
11308 # { PCase*tmp = new PCase(NetCase::EQX, p[3], p[5]);
11309 # FILE_NAME(tmp, @1);
11310 # p[0] = tmp;
11311 # }
11312 ()
11313
11314
11315 def p_statement_item_19(p):
11316 '''statement_item : K_casez '(' expression ')' case_items K_endcase '''
11317 if(parse_debug):
11318 print('statement_item_19', list(p))
11319
11320 # { PCase*tmp = new PCase(NetCase::EQZ, p[3], p[5]);
11321 # FILE_NAME(tmp, @1);
11322 # p[0] = tmp;
11323 # }
11324 ()
11325
11326
11327 def p_statement_item_20(p):
11328 '''statement_item : K_case '(' expression ')' error K_endcase '''
11329 if(parse_debug):
11330 print('statement_item_20', list(p))
11331
11332 # { yyerrok; }
11333 ()
11334
11335
11336 def p_statement_item_21(p):
11337 '''statement_item : K_casex '(' expression ')' error K_endcase '''
11338 if(parse_debug):
11339 print('statement_item_21', list(p))
11340
11341 # { yyerrok; }
11342 ()
11343
11344
11345 def p_statement_item_22(p):
11346 '''statement_item : K_casez '(' expression ')' error K_endcase '''
11347 if(parse_debug):
11348 print('statement_item_22', list(p))
11349
11350 # { yyerrok; }
11351 ()
11352
11353
11354 def p_statement_item_23(p):
11355 '''statement_item : K_if '(' expression ')' statement_or_null %prec less_than_K_else '''
11356 if(parse_debug):
11357 print('statement_item_23', list(p))
11358
11359 # { PCondit*tmp = new PCondit(p[3], p[5], 0);
11360 # FILE_NAME(tmp, @1);
11361 # p[0] = tmp;
11362 # }
11363 ()
11364
11365
11366 def p_statement_item_24(p):
11367 '''statement_item : K_if '(' expression ')' statement_or_null K_else statement_or_null '''
11368 if(parse_debug):
11369 print('statement_item_24', list(p))
11370
11371 # { PCondit*tmp = new PCondit(p[3], p[5], p[7]);
11372 # FILE_NAME(tmp, @1);
11373 # p[0] = tmp;
11374 # }
11375 ()
11376
11377
11378 def p_statement_item_25(p):
11379 '''statement_item : K_if '(' error ')' statement_or_null %prec less_than_K_else '''
11380 if(parse_debug):
11381 print('statement_item_25', list(p))
11382
11383 # { yyerror(@1, "error: Malformed conditional expression.");
11384 # p[0] = p[5];
11385 # }
11386 ()
11387
11388
11389 def p_statement_item_26(p):
11390 '''statement_item : K_if '(' error ')' statement_or_null K_else statement_or_null '''
11391 if(parse_debug):
11392 print('statement_item_26', list(p))
11393
11394 # { yyerror(@1, "error: Malformed conditional expression.");
11395 # p[0] = p[5];
11396 # }
11397 ()
11398
11399
11400 def p_statement_item_27(p):
11401 '''statement_item : compressed_statement ';' '''
11402 if(parse_debug):
11403 print('statement_item_27', list(p))
11404 p[0] = p[1]
11405
11406
11407 ()
11408
11409
11410 def p_statement_item_28(p):
11411 '''statement_item : inc_or_dec_expression ';' '''
11412 if(parse_debug):
11413 print('statement_item_28', list(p))
11414
11415 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
11416 ()
11417
11418
11419 def p_statement_item_29(p):
11420 '''statement_item : delay1 statement_or_null '''
11421 if(parse_debug):
11422 print('statement_item_29', list(p))
11423
11424 # { PExpr*del = p[1]->front();
11425 # assert(p[1]->size() == 1);
11426 # delete p[1];
11427 # PDelayStatement*tmp = new PDelayStatement(del, p[2]);
11428 # FILE_NAME(tmp, @1);
11429 # p[0] = tmp;
11430 # }
11431 ()
11432
11433
11434 def p_statement_item_30(p):
11435 '''statement_item : event_control statement_or_null '''
11436 if(parse_debug):
11437 print('statement_item_30', list(p))
11438
11439 # { PEventStatement*tmp = p[1];
11440 # if (tmp == 0) {
11441 # yyerror(@1, "error: Invalid event control.");
11442 # p[0] = None
11443 # } else {
11444 # tmp->set_statement(p[2]);
11445 # p[0] = tmp;
11446 # }
11447 # }
11448 ()
11449
11450
11451 def p_statement_item_31(p):
11452 '''statement_item : '@' '*' statement_or_null '''
11453 if(parse_debug):
11454 print('statement_item_31', list(p))
11455
11456 # { PEventStatement*tmp = new PEventStatement;
11457 # FILE_NAME(tmp, @1);
11458 # tmp->set_statement(p[3]);
11459 # p[0] = tmp;
11460 # }
11461 ()
11462
11463
11464 def p_statement_item_32(p):
11465 '''statement_item : '@' '(' '*' ')' statement_or_null '''
11466 if(parse_debug):
11467 print('statement_item_32', list(p))
11468
11469 # { PEventStatement*tmp = new PEventStatement;
11470 # FILE_NAME(tmp, @1);
11471 # tmp->set_statement(p[5]);
11472 # p[0] = tmp;
11473 # }
11474 ()
11475
11476
11477 def p_statement_item_33(p):
11478 '''statement_item : lpvalue '=' expression ';' '''
11479 if(parse_debug):
11480 print('statement_item33', list(p))
11481 if p[3]:
11482 expr = Node(syms.expr_stmt, [p[1], Leaf(token.EQUAL, p[2]), p[3]])
11483 if(parse_debug):
11484 print("expr TODO", repr(expr))
11485 else:
11486 expr = Node(syms.expr_stmt, [p[1], Leaf(token.EQUAL, p[2]), ])
11487 if(parse_debug):
11488 print("expr", repr(expr))
11489 if(parse_debug):
11490 print("expr (python):'%s'" % expr)
11491 p[0] = expr
11492
11493 # { PAssign*tmp = new PAssign(p[1],p[3]);
11494 # FILE_NAME(tmp, @1);
11495 # p[0] = tmp;
11496 # }
11497 ()
11498
11499
11500 def p_statement_item_34(p):
11501 '''statement_item : error '=' expression ';' '''
11502 if(parse_debug):
11503 print('statement_item_34', list(p))
11504
11505 # { yyerror(@2, "Syntax in assignment statement l-value.");
11506 # yyerrok;
11507 # p[0] = new PNoop;
11508 # }
11509 ()
11510
11511
11512 def p_statement_item_35(p):
11513 '''statement_item : lpvalue K_LE expression ';' '''
11514 if(parse_debug):
11515 print('statement_item_35', list(p))
11516
11517 # { PAssignNB*tmp = new PAssignNB(p[1],p[3]);
11518 # FILE_NAME(tmp, @1);
11519 # p[0] = tmp;
11520 # }
11521 ()
11522
11523
11524 def p_statement_item_36(p):
11525 '''statement_item : error K_LE expression ';' '''
11526 if(parse_debug):
11527 print('statement_item_36', list(p))
11528
11529 # { yyerror(@2, "Syntax in assignment statement l-value.");
11530 # yyerrok;
11531 # p[0] = new PNoop;
11532 # }
11533 ()
11534
11535
11536 def p_statement_item_37(p):
11537 '''statement_item : lpvalue '=' delay1 expression ';' '''
11538 if(parse_debug):
11539 print('statement_item_37', list(p))
11540
11541 # { PExpr*del = p[3]->front(); p[3]->pop_front();
11542 # assert(p[3]->empty());
11543 # PAssign*tmp = new PAssign(p[1],del,p[4]);
11544 # FILE_NAME(tmp, @1);
11545 # p[0] = tmp;
11546 # }
11547 ()
11548
11549
11550 def p_statement_item_38(p):
11551 '''statement_item : lpvalue K_LE delay1 expression ';' '''
11552 if(parse_debug):
11553 print('statement_item_38', list(p))
11554
11555 # { PExpr*del = p[3]->front(); p[3]->pop_front();
11556 # assert(p[3]->empty());
11557 # PAssignNB*tmp = new PAssignNB(p[1],del,p[4]);
11558 # FILE_NAME(tmp, @1);
11559 # p[0] = tmp;
11560 # }
11561 ()
11562
11563
11564 def p_statement_item_39(p):
11565 '''statement_item : lpvalue '=' event_control expression ';' '''
11566 if(parse_debug):
11567 print('statement_item_39', list(p))
11568
11569 # { PAssign*tmp = new PAssign(p[1],0,p[3],p[4]);
11570 # FILE_NAME(tmp, @1);
11571 # p[0] = tmp;
11572 # }
11573 ()
11574
11575
11576 def p_statement_item_40(p):
11577 '''statement_item : lpvalue '=' K_repeat '(' expression ')' event_control expression ';' '''
11578 if(parse_debug):
11579 print('statement_item_40', list(p))
11580
11581 # { PAssign*tmp = new PAssign(p[1],p[5],p[7],p[8]);
11582 # FILE_NAME(tmp,@1);
11583 # tmp->set_lineno(@1.first_line);
11584 # p[0] = tmp;
11585 # }
11586 ()
11587
11588
11589 def p_statement_item_41(p):
11590 '''statement_item : lpvalue K_LE event_control expression ';' '''
11591 if(parse_debug):
11592 print('statement_item_41', list(p))
11593
11594 # { PAssignNB*tmp = new PAssignNB(p[1],0,p[3],p[4]);
11595 # FILE_NAME(tmp, @1);
11596 # p[0] = tmp;
11597 # }
11598 ()
11599
11600
11601 def p_statement_item_42(p):
11602 '''statement_item : lpvalue K_LE K_repeat '(' expression ')' event_control expression ';' '''
11603 if(parse_debug):
11604 print('statement_item_42', list(p))
11605
11606 # { PAssignNB*tmp = new PAssignNB(p[1],p[5],p[7],p[8]);
11607 # FILE_NAME(tmp, @1);
11608 # p[0] = tmp;
11609 # }
11610 ()
11611
11612
11613 def p_statement_item_43(p):
11614 '''statement_item : lpvalue '=' dynamic_array_new ';' '''
11615 if(parse_debug):
11616 print('statement_item_43', list(p))
11617
11618 # { PAssign*tmp = new PAssign(p[1],p[3]);
11619 # FILE_NAME(tmp, @1);
11620 # p[0] = tmp;
11621 # }
11622 ()
11623
11624
11625 def p_statement_item_44(p):
11626 '''statement_item : lpvalue '=' class_new ';' '''
11627 if(parse_debug):
11628 print('statement_item_44', list(p))
11629
11630 # { PAssign*tmp = new PAssign(p[1],p[3]);
11631 # FILE_NAME(tmp, @1);
11632 # p[0] = tmp;
11633 # }
11634 ()
11635
11636
11637 def p_statement_item_45(p):
11638 '''statement_item : K_wait '(' expression ')' statement_or_null '''
11639 if(parse_debug):
11640 print('statement_item_45', list(p))
11641
11642 # { PEventStatement*tmp;
11643 # PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, p[3]);
11644 # tmp = new PEventStatement(etmp);
11645 # FILE_NAME(tmp,@1);
11646 # tmp->set_statement(p[5]);
11647 # p[0] = tmp;
11648 # }
11649 ()
11650
11651
11652 def p_statement_item_46(p):
11653 '''statement_item : K_wait K_fork ';' '''
11654 if(parse_debug):
11655 print('statement_item_46', list(p))
11656
11657 # { PEventStatement*tmp = new PEventStatement((PEEvent*)0);
11658 # FILE_NAME(tmp,@1);
11659 # p[0] = tmp;
11660 # }
11661 ()
11662
11663
11664 def p_statement_item_47(p):
11665 '''statement_item : SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';' '''
11666 if(parse_debug):
11667 print('statement_item_47', list(p))
11668
11669 # { PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), *p[3]);
11670 # FILE_NAME(tmp,@1);
11671 # delete[]p[1];
11672 # delete p[3];
11673 # p[0] = tmp;
11674 # }
11675 ()
11676
11677
11678 def p_statement_item_48(p):
11679 '''statement_item : SYSTEM_IDENTIFIER ';' '''
11680 if(parse_debug):
11681 print('statement_item_48', list(p))
11682
11683 # { list<PExpr*>pt;
11684 # PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), pt);
11685 # FILE_NAME(tmp,@1);
11686 # delete[]p[1];
11687 # p[0] = tmp;
11688 # }
11689 ()
11690
11691
11692 def p_statement_item_49(p):
11693 '''statement_item : hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
11694 if(parse_debug):
11695 print('statement_item_49', list(p))
11696
11697 # { PCallTask*tmp = pform_make_call_task(@1, *p[1], *p[3]);
11698 # delete p[1];
11699 # delete p[3];
11700 # p[0] = tmp;
11701 # }
11702 ()
11703
11704
11705 def p_statement_item_50(p):
11706 '''statement_item : hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';' '''
11707 if(parse_debug):
11708 print('statement_item_50', list(p))
11709
11710 # { /* ....randomize with { <constraints> } */
11711 # if (p[1] && peek_tail_name(*p[1]) == "randomize") {
11712 # if (!gn_system_verilog())
11713 # yyerror(@2, "error: Randomize with constraint requires SystemVerilog.");
11714 # else
11715 # yyerror(@2, "sorry: Randomize with constraint not supported.");
11716 # } else {
11717 # yyerror(@2, "error: Constraint block can only be applied to randomize method.");
11718 # }
11719 # list<PExpr*>pt;
11720 # PCallTask*tmp = new PCallTask(*p[1], pt);
11721 # FILE_NAME(tmp, @1);
11722 # delete p[1];
11723 # p[0] = tmp;
11724 # }
11725 ()
11726
11727
11728 def p_statement_item_51(p):
11729 '''statement_item : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
11730 if(parse_debug):
11731 print('statement_item_51', list(p))
11732
11733 # { pform_name_t*t_name = p[1];
11734 # while (! p[3]->empty()) {
11735 # t_name->push_back(p[3]->front());
11736 # p[3]->pop_front();
11737 # }
11738 # PCallTask*tmp = new PCallTask(*t_name, *p[5]);
11739 # FILE_NAME(tmp, @1);
11740 # delete p[1];
11741 # delete p[3];
11742 # delete p[5];
11743 # p[0] = tmp;
11744 # }
11745 ()
11746
11747
11748 def p_statement_item_52(p):
11749 '''statement_item : hierarchy_identifier ';' '''
11750 if(parse_debug):
11751 print('statement_item_52', list(p))
11752
11753 # { list<PExpr*>pt;
11754 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
11755 # delete p[1];
11756 # p[0] = tmp;
11757 # }
11758 ()
11759
11760
11761 def p_statement_item_53(p):
11762 '''statement_item : implicit_class_handle '.' K_new '(' expression_list_with_nuls ')' ';' '''
11763 if(parse_debug):
11764 print('statement_item_53', list(p))
11765
11766 # { PChainConstructor*tmp = new PChainConstructor(*p[5]);
11767 # FILE_NAME(tmp, @3);
11768 # delete p[1];
11769 # p[0] = tmp;
11770 # }
11771 ()
11772
11773
11774 def p_statement_item_54(p):
11775 '''statement_item : hierarchy_identifier '(' error ')' ';' '''
11776 if(parse_debug):
11777 print('statement_item_54', list(p))
11778
11779 # { yyerror(@3, "error: Syntax error in task arguments.");
11780 # list<PExpr*>pt;
11781 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
11782 # delete p[1];
11783 # p[0] = tmp;
11784 # }
11785 ()
11786
11787
11788 def p_statement_item_55(p):
11789 '''statement_item : error ';' '''
11790 if(parse_debug):
11791 print('statement_item_55', list(p))
11792
11793 # { yyerror(@2, "error: malformed statement");
11794 # yyerrok;
11795 # p[0] = new PNoop;
11796 # }
11797 ()
11798
11799
11800 def p__embed0_statement_item(p):
11801 '''_embed0_statement_item : '''
11802
11803 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_SEQ);
11804 # FILE_NAME(tmp, @1);
11805 # current_block_stack.push(tmp);
11806 # }
11807 ()
11808
11809
11810 def p__embed1_statement_item(p):
11811 '''_embed1_statement_item : '''
11812
11813 # { if (p[3]) {
11814 # if (! gn_system_verilog()) {
11815 # yyerror("error: Variable declaration in unnamed block "
11816 # "requires SystemVerilog.");
11817 # }
11818 # } else {
11819 # /* If there are no declarations in the scope then just delete it. */
11820 # pform_pop_scope();
11821 # assert(! current_block_stack.empty());
11822 # PBlock*tmp = current_block_stack.top();
11823 # current_block_stack.pop();
11824 # delete tmp;
11825 # }
11826 # }
11827 ()
11828
11829
11830 def p__embed2_statement_item(p):
11831 '''_embed2_statement_item : '''
11832
11833 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_SEQ);
11834 # FILE_NAME(tmp, @1);
11835 # current_block_stack.push(tmp);
11836 # }
11837 ()
11838
11839
11840 def p__embed3_statement_item(p):
11841 '''_embed3_statement_item : '''
11842
11843 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
11844 # FILE_NAME(tmp, @1);
11845 # current_block_stack.push(tmp);
11846 # }
11847 ()
11848
11849
11850 def p__embed4_statement_item(p):
11851 '''_embed4_statement_item : '''
11852
11853 # { if (p[3]) {
11854 # if (! gn_system_verilog()) {
11855 # yyerror("error: Variable declaration in unnamed block "
11856 # "requires SystemVerilog.");
11857 # }
11858 # } else {
11859 # /* If there are no declarations in the scope then just delete it. */
11860 # pform_pop_scope();
11861 # assert(! current_block_stack.empty());
11862 # PBlock*tmp = current_block_stack.top();
11863 # current_block_stack.pop();
11864 # delete tmp;
11865 # }
11866 # }
11867 ()
11868
11869
11870 def p__embed5_statement_item(p):
11871 '''_embed5_statement_item : '''
11872
11873 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_PAR);
11874 # FILE_NAME(tmp, @1);
11875 # current_block_stack.push(tmp);
11876 # }
11877 ()
11878
11879
11880 def p_compressed_statement_1(p):
11881 '''compressed_statement : lpvalue K_PLUS_EQ expression '''
11882 if(parse_debug):
11883 print('compressed_statement_1', list(p))
11884
11885 # { PAssign*tmp = new PAssign(p[1], '+', p[3]);
11886 # FILE_NAME(tmp, @1);
11887 # p[0] = tmp;
11888 # }
11889 ()
11890
11891
11892 def p_compressed_statement_2(p):
11893 '''compressed_statement : lpvalue K_MINUS_EQ expression '''
11894 if(parse_debug):
11895 print('compressed_statement_2', list(p))
11896
11897 # { PAssign*tmp = new PAssign(p[1], '-', p[3]);
11898 # FILE_NAME(tmp, @1);
11899 # p[0] = tmp;
11900 # }
11901 ()
11902
11903
11904 def p_compressed_statement_3(p):
11905 '''compressed_statement : lpvalue K_MUL_EQ expression '''
11906 if(parse_debug):
11907 print('compressed_statement_3', list(p))
11908
11909 # { PAssign*tmp = new PAssign(p[1], '*', p[3]);
11910 # FILE_NAME(tmp, @1);
11911 # p[0] = tmp;
11912 # }
11913 ()
11914
11915
11916 def p_compressed_statement_4(p):
11917 '''compressed_statement : lpvalue K_DIV_EQ expression '''
11918 if(parse_debug):
11919 print('compressed_statement_4', list(p))
11920
11921 # { PAssign*tmp = new PAssign(p[1], '/', p[3]);
11922 # FILE_NAME(tmp, @1);
11923 # p[0] = tmp;
11924 # }
11925 ()
11926
11927
11928 def p_compressed_statement_5(p):
11929 '''compressed_statement : lpvalue K_MOD_EQ expression '''
11930 if(parse_debug):
11931 print('compressed_statement_5', list(p))
11932
11933 # { PAssign*tmp = new PAssign(p[1], '%', p[3]);
11934 # FILE_NAME(tmp, @1);
11935 # p[0] = tmp;
11936 # }
11937 ()
11938
11939
11940 def p_compressed_statement_6(p):
11941 '''compressed_statement : lpvalue K_AND_EQ expression '''
11942 if(parse_debug):
11943 print('compressed_statement_6', list(p))
11944
11945 # { PAssign*tmp = new PAssign(p[1], '&', p[3]);
11946 # FILE_NAME(tmp, @1);
11947 # p[0] = tmp;
11948 # }
11949 ()
11950
11951
11952 def p_compressed_statement_7(p):
11953 '''compressed_statement : lpvalue K_OR_EQ expression '''
11954 if(parse_debug):
11955 print('compressed_statement_7', list(p))
11956
11957 # { PAssign*tmp = new PAssign(p[1], '|', p[3]);
11958 # FILE_NAME(tmp, @1);
11959 # p[0] = tmp;
11960 # }
11961 ()
11962
11963
11964 def p_compressed_statement_8(p):
11965 '''compressed_statement : lpvalue K_XOR_EQ expression '''
11966 if(parse_debug):
11967 print('compressed_statement_8', list(p))
11968
11969 # { PAssign*tmp = new PAssign(p[1], '^', p[3]);
11970 # FILE_NAME(tmp, @1);
11971 # p[0] = tmp;
11972 # }
11973 ()
11974
11975
11976 def p_compressed_statement_9(p):
11977 '''compressed_statement : lpvalue K_LS_EQ expression '''
11978 if(parse_debug):
11979 print('compressed_statement_9', list(p))
11980
11981 # { PAssign *tmp = new PAssign(p[1], 'l', p[3]);
11982 # FILE_NAME(tmp, @1);
11983 # p[0] = tmp;
11984 # }
11985 ()
11986
11987
11988 def p_compressed_statement_10(p):
11989 '''compressed_statement : lpvalue K_RS_EQ expression '''
11990 if(parse_debug):
11991 print('compressed_statement_10', list(p))
11992
11993 # { PAssign*tmp = new PAssign(p[1], 'r', p[3]);
11994 # FILE_NAME(tmp, @1);
11995 # p[0] = tmp;
11996 # }
11997 ()
11998
11999
12000 def p_compressed_statement_11(p):
12001 '''compressed_statement : lpvalue K_RSS_EQ expression '''
12002 if(parse_debug):
12003 print('compressed_statement_11', list(p))
12004
12005 # { PAssign *tmp = new PAssign(p[1], 'R', p[3]);
12006 # FILE_NAME(tmp, @1);
12007 # p[0] = tmp;
12008 # }
12009 ()
12010
12011
12012 def p_statement_or_null_list_opt_1(p):
12013 '''statement_or_null_list_opt : statement_or_null_list '''
12014 if(parse_debug):
12015 print('statement_or_null_list_opt_1', list(p))
12016 p[0] = p[1]
12017
12018
12019 ()
12020
12021
12022 def p_statement_or_null_list_opt_2(p):
12023 '''statement_or_null_list_opt : '''
12024 if(parse_debug):
12025 print('statement_or_null_list_opt_2', list(p))
12026
12027 # { p[0] = None }
12028 ()
12029
12030
12031 def p_statement_or_null_list_1(p):
12032 '''statement_or_null_list : statement_or_null_list statement_or_null '''
12033 if(parse_debug):
12034 print('statement_or_null_list_1', list(p))
12035
12036 # { vector<Statement*>*tmp = p[1];
12037 # if (p[2]) tmp->push_back(p[2]);
12038 # p[0] = tmp;
12039 # }
12040 ()
12041
12042
12043 def p_statement_or_null_list_2(p):
12044 '''statement_or_null_list : statement_or_null '''
12045 if(parse_debug):
12046 print('statement_or_null_list_2', list(p))
12047
12048 # { vector<Statement*>*tmp = new vector<Statement*>(0);
12049 # if (p[1]) tmp->push_back(p[1]);
12050 # p[0] = tmp;
12051 # }
12052 ()
12053
12054
12055 def p_analog_statement_1(p):
12056 '''analog_statement : branch_probe_expression K_CONTRIBUTE expression ';' '''
12057 if(parse_debug):
12058 print('analog_statement_1', list(p))
12059
12060 # { p[0] = pform_contribution_statement(@2, p[1], p[3]); }
12061 ()
12062
12063
12064 def p_task_item_1(p):
12065 '''task_item : block_item_decl '''
12066 if(parse_debug):
12067 print('task_item_1', list(p))
12068
12069 # { p[0] = new vector<pform_tf_port_t>(0); }
12070 ()
12071
12072
12073 def p_task_item_2(p):
12074 '''task_item : tf_port_declaration '''
12075 if(parse_debug):
12076 print('task_item_2', list(p))
12077 p[0] = p[1]
12078
12079
12080 ()
12081
12082
12083 def p_task_item_list_1(p):
12084 '''task_item_list : task_item_list task_item '''
12085 if(parse_debug):
12086 print('task_item_list_1', list(p))
12087
12088 # { vector<pform_tf_port_t>*tmp = p[1];
12089 # size_t s1 = tmp->size();
12090 # tmp->resize(s1 + p[2]->size());
12091 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
12092 # tmp->at(s1 + idx) = p[2]->at(idx);
12093 # delete p[2];
12094 # p[0] = tmp;
12095 # }
12096 ()
12097
12098
12099 def p_task_item_list_2(p):
12100 '''task_item_list : task_item '''
12101 if(parse_debug):
12102 print('task_item_list_2', list(p))
12103 p[0] = p[1]
12104
12105
12106 ()
12107
12108
12109 def p_task_item_list_opt_1(p):
12110 '''task_item_list_opt : task_item_list '''
12111 if(parse_debug):
12112 print('task_item_list_opt_1', list(p))
12113 p[0] = p[1]
12114
12115
12116 ()
12117
12118
12119 def p_task_item_list_opt_2(p):
12120 '''task_item_list_opt : '''
12121 if(parse_debug):
12122 print('task_item_list_opt_2', list(p))
12123
12124 # { p[0] = None }
12125 ()
12126
12127
12128 def p_tf_port_list_opt_1(p):
12129 '''tf_port_list_opt : tf_port_list '''
12130 if(parse_debug):
12131 print('tf_port_list_opt_1', list(p))
12132 p[0] = p[1]
12133
12134
12135 ()
12136
12137
12138 def p_tf_port_list_opt_2(p):
12139 '''tf_port_list_opt : '''
12140 if(parse_debug):
12141 print('tf_port_list_opt_2', list(p))
12142
12143 # { p[0] = None }
12144 ()
12145
12146
12147 def p_udp_body_1(p):
12148 '''udp_body : K_table udp_entry_list K_endtable '''
12149 if(parse_debug):
12150 print('udp_body_1', list(p))
12151
12152 # { lex_end_table();
12153 # p[0] = p[2];
12154 # }
12155 ()
12156
12157
12158 def p_udp_body_2(p):
12159 '''udp_body : K_table K_endtable '''
12160 if(parse_debug):
12161 print('udp_body_2', list(p))
12162
12163 # { lex_end_table();
12164 # yyerror(@1, "error: Empty UDP table.");
12165 # p[0] = None
12166 # }
12167 ()
12168
12169
12170 def p_udp_body_3(p):
12171 '''udp_body : K_table error K_endtable '''
12172 if(parse_debug):
12173 print('udp_body_3', list(p))
12174
12175 # { lex_end_table();
12176 # yyerror(@2, "Errors in UDP table");
12177 # yyerrok;
12178 # p[0] = None
12179 # }
12180 ()
12181
12182
12183 def p_udp_entry_list_1(p):
12184 '''udp_entry_list : udp_comb_entry_list '''
12185 if(parse_debug):
12186 print('udp_entry_list_1', list(p))
12187
12188
12189 ()
12190
12191
12192 def p_udp_entry_list_2(p):
12193 '''udp_entry_list : udp_sequ_entry_list '''
12194 if(parse_debug):
12195 print('udp_entry_list_2', list(p))
12196
12197
12198 ()
12199
12200
12201 def p_udp_comb_entry_1(p):
12202 '''udp_comb_entry : udp_input_list ':' udp_output_sym ';' '''
12203 if(parse_debug):
12204 print('udp_comb_entry_1', list(p))
12205
12206 # { char*tmp = new char[strlen(p[1])+3];
12207 # strcpy(tmp, p[1]);
12208 # char*tp = tmp+strlen(tmp);
12209 # *tp++ = ':';
12210 # *tp++ = p[3];
12211 # *tp++ = 0;
12212 # delete[]p[1];
12213 # p[0] = tmp;
12214 # }
12215 ()
12216
12217
12218 def p_udp_comb_entry_list_1(p):
12219 '''udp_comb_entry_list : udp_comb_entry '''
12220 if(parse_debug):
12221 print('udp_comb_entry_list_1', list(p))
12222
12223 # { list<string>*tmp = new list<string>;
12224 # tmp->push_back(p[1]);
12225 # delete[]p[1];
12226 # p[0] = tmp;
12227 # }
12228 ()
12229
12230
12231 def p_udp_comb_entry_list_2(p):
12232 '''udp_comb_entry_list : udp_comb_entry_list udp_comb_entry '''
12233 if(parse_debug):
12234 print('udp_comb_entry_list_2', list(p))
12235
12236 # { list<string>*tmp = p[1];
12237 # tmp->push_back(p[2]);
12238 # delete[]p[2];
12239 # p[0] = tmp;
12240 # }
12241 ()
12242
12243
12244 def p_udp_sequ_entry_list_1(p):
12245 '''udp_sequ_entry_list : udp_sequ_entry '''
12246 if(parse_debug):
12247 print('udp_sequ_entry_list_1', list(p))
12248
12249 # { list<string>*tmp = new list<string>;
12250 # tmp->push_back(p[1]);
12251 # delete[]p[1];
12252 # p[0] = tmp;
12253 # }
12254 ()
12255
12256
12257 def p_udp_sequ_entry_list_2(p):
12258 '''udp_sequ_entry_list : udp_sequ_entry_list udp_sequ_entry '''
12259 if(parse_debug):
12260 print('udp_sequ_entry_list_2', list(p))
12261
12262 # { list<string>*tmp = p[1];
12263 # tmp->push_back(p[2]);
12264 # delete[]p[2];
12265 # p[0] = tmp;
12266 # }
12267 ()
12268
12269
12270 def p_udp_sequ_entry_1(p):
12271 '''udp_sequ_entry : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' '''
12272 if(parse_debug):
12273 print('udp_sequ_entry_1', list(p))
12274
12275 # { char*tmp = new char[strlen(p[1])+5];
12276 # strcpy(tmp, p[1]);
12277 # char*tp = tmp+strlen(tmp);
12278 # *tp++ = ':';
12279 # *tp++ = p[3];
12280 # *tp++ = ':';
12281 # *tp++ = p[5];
12282 # *tp++ = 0;
12283 # p[0] = tmp;
12284 # }
12285 ()
12286
12287
12288 def p_udp_initial_1(p):
12289 '''udp_initial : K_initial IDENTIFIER '=' number ';' '''
12290 if(parse_debug):
12291 print('udp_initial_1', list(p))
12292
12293 # { PExpr*etmp = new PENumber(p[4]);
12294 # PEIdent*itmp = new PEIdent(lex_strings.make(p[2]));
12295 # PAssign*atmp = new PAssign(itmp, etmp);
12296 # FILE_NAME(atmp, @2);
12297 # delete[]p[2];
12298 # p[0] = atmp;
12299 # }
12300 ()
12301
12302
12303 def p_udp_init_opt_1(p):
12304 '''udp_init_opt : udp_initial '''
12305 if(parse_debug):
12306 print('udp_init_opt_1', list(p))
12307 p[0] = p[1]
12308
12309
12310 ()
12311
12312
12313 def p_udp_init_opt_2(p):
12314 '''udp_init_opt : '''
12315 if(parse_debug):
12316 print('udp_init_opt_2', list(p))
12317
12318 # { p[0] = None }
12319 ()
12320
12321
12322 def p_udp_input_list_1(p):
12323 '''udp_input_list : udp_input_sym '''
12324 if(parse_debug):
12325 print('udp_input_list_1', list(p))
12326
12327 # { char*tmp = new char[2];
12328 # tmp[0] = p[1];
12329 # tmp[1] = 0;
12330 # p[0] = tmp;
12331 # }
12332 ()
12333
12334
12335 def p_udp_input_list_2(p):
12336 '''udp_input_list : udp_input_list udp_input_sym '''
12337 if(parse_debug):
12338 print('udp_input_list_2', list(p))
12339
12340 # { char*tmp = new char[strlen(p[1])+2];
12341 # strcpy(tmp, p[1]);
12342 # char*tp = tmp+strlen(tmp);
12343 # *tp++ = p[2];
12344 # *tp++ = 0;
12345 # delete[]p[1];
12346 # p[0] = tmp;
12347 # }
12348 ()
12349
12350
12351 def p_udp_input_sym_1(p):
12352 '''udp_input_sym : '0' '''
12353 if(parse_debug):
12354 print('udp_input_sym_1', list(p))
12355
12356 # { p[0] = '0'; }
12357 ()
12358
12359
12360 def p_udp_input_sym_2(p):
12361 '''udp_input_sym : '1' '''
12362 if(parse_debug):
12363 print('udp_input_sym_2', list(p))
12364
12365 # { p[0] = '1'; }
12366 ()
12367
12368
12369 def p_udp_input_sym_3(p):
12370 '''udp_input_sym : 'x' '''
12371 if(parse_debug):
12372 print('udp_input_sym_3', list(p))
12373
12374 # { p[0] = 'x'; }
12375 ()
12376
12377
12378 def p_udp_input_sym_4(p):
12379 '''udp_input_sym : '?' '''
12380 if(parse_debug):
12381 print('udp_input_sym_4', list(p))
12382
12383 # { p[0] = '?'; }
12384 ()
12385
12386
12387 def p_udp_input_sym_5(p):
12388 '''udp_input_sym : 'b' '''
12389 if(parse_debug):
12390 print('udp_input_sym_5', list(p))
12391
12392 # { p[0] = 'b'; }
12393 ()
12394
12395
12396 def p_udp_input_sym_6(p):
12397 '''udp_input_sym : '*' '''
12398 if(parse_debug):
12399 print('udp_input_sym_6', list(p))
12400
12401 # { p[0] = '*'; }
12402 ()
12403
12404
12405 def p_udp_input_sym_7(p):
12406 '''udp_input_sym : '%' '''
12407 if(parse_debug):
12408 print('udp_input_sym_7', list(p))
12409
12410 # { p[0] = '%'; }
12411 ()
12412
12413
12414 def p_udp_input_sym_8(p):
12415 '''udp_input_sym : 'f' '''
12416 if(parse_debug):
12417 print('udp_input_sym_8', list(p))
12418
12419 # { p[0] = 'f'; }
12420 ()
12421
12422
12423 def p_udp_input_sym_9(p):
12424 '''udp_input_sym : 'F' '''
12425 if(parse_debug):
12426 print('udp_input_sym_9', list(p))
12427
12428 # { p[0] = 'F'; }
12429 ()
12430
12431
12432 def p_udp_input_sym_10(p):
12433 '''udp_input_sym : 'l' '''
12434 if(parse_debug):
12435 print('udp_input_sym_10', list(p))
12436
12437 # { p[0] = 'l'; }
12438 ()
12439
12440
12441 def p_udp_input_sym_11(p):
12442 '''udp_input_sym : 'h' '''
12443 if(parse_debug):
12444 print('udp_input_sym_11', list(p))
12445
12446 # { p[0] = 'h'; }
12447 ()
12448
12449
12450 def p_udp_input_sym_12(p):
12451 '''udp_input_sym : 'B' '''
12452 if(parse_debug):
12453 print('udp_input_sym_12', list(p))
12454
12455 # { p[0] = 'B'; }
12456 ()
12457
12458
12459 def p_udp_input_sym_13(p):
12460 '''udp_input_sym : 'r' '''
12461 if(parse_debug):
12462 print('udp_input_sym_13', list(p))
12463
12464 # { p[0] = 'r'; }
12465 ()
12466
12467
12468 def p_udp_input_sym_14(p):
12469 '''udp_input_sym : 'R' '''
12470 if(parse_debug):
12471 print('udp_input_sym_14', list(p))
12472
12473 # { p[0] = 'R'; }
12474 ()
12475
12476
12477 def p_udp_input_sym_15(p):
12478 '''udp_input_sym : 'M' '''
12479 if(parse_debug):
12480 print('udp_input_sym_15', list(p))
12481
12482 # { p[0] = 'M'; }
12483 ()
12484
12485
12486 def p_udp_input_sym_16(p):
12487 '''udp_input_sym : 'n' '''
12488 if(parse_debug):
12489 print('udp_input_sym_16', list(p))
12490
12491 # { p[0] = 'n'; }
12492 ()
12493
12494
12495 def p_udp_input_sym_17(p):
12496 '''udp_input_sym : 'N' '''
12497 if(parse_debug):
12498 print('udp_input_sym_17', list(p))
12499
12500 # { p[0] = 'N'; }
12501 ()
12502
12503
12504 def p_udp_input_sym_18(p):
12505 '''udp_input_sym : 'p' '''
12506 if(parse_debug):
12507 print('udp_input_sym_18', list(p))
12508
12509 # { p[0] = 'p'; }
12510 ()
12511
12512
12513 def p_udp_input_sym_19(p):
12514 '''udp_input_sym : 'P' '''
12515 if(parse_debug):
12516 print('udp_input_sym_19', list(p))
12517
12518 # { p[0] = 'P'; }
12519 ()
12520
12521
12522 def p_udp_input_sym_20(p):
12523 '''udp_input_sym : 'Q' '''
12524 if(parse_debug):
12525 print('udp_input_sym_20', list(p))
12526
12527 # { p[0] = 'Q'; }
12528 ()
12529
12530
12531 def p_udp_input_sym_21(p):
12532 '''udp_input_sym : 'q' '''
12533 if(parse_debug):
12534 print('udp_input_sym_21', list(p))
12535
12536 # { p[0] = 'q'; }
12537 ()
12538
12539
12540 def p_udp_input_sym_22(p):
12541 '''udp_input_sym : '_' '''
12542 if(parse_debug):
12543 print('udp_input_sym_22', list(p))
12544
12545 # { p[0] = '_'; }
12546 ()
12547
12548
12549 def p_udp_input_sym_23(p):
12550 '''udp_input_sym : '+' '''
12551 if(parse_debug):
12552 print('udp_input_sym_23', list(p))
12553
12554 # { p[0] = '+'; }
12555 ()
12556
12557
12558 def p_udp_input_sym_24(p):
12559 '''udp_input_sym : DEC_NUMBER '''
12560 if(parse_debug):
12561 print('udp_input_sym_24', list(p))
12562
12563 # { yyerror(@1, "internal error: Input digits parse as decimal number!"); p[0] = '0'; }
12564 ()
12565
12566
12567 def p_udp_output_sym_1(p):
12568 '''udp_output_sym : '0' '''
12569 if(parse_debug):
12570 print('udp_output_sym_1', list(p))
12571
12572 # { p[0] = '0'; }
12573 ()
12574
12575
12576 def p_udp_output_sym_2(p):
12577 '''udp_output_sym : '1' '''
12578 if(parse_debug):
12579 print('udp_output_sym_2', list(p))
12580
12581 # { p[0] = '1'; }
12582 ()
12583
12584
12585 def p_udp_output_sym_3(p):
12586 '''udp_output_sym : 'x' '''
12587 if(parse_debug):
12588 print('udp_output_sym_3', list(p))
12589
12590 # { p[0] = 'x'; }
12591 ()
12592
12593
12594 def p_udp_output_sym_4(p):
12595 '''udp_output_sym : '-' '''
12596 if(parse_debug):
12597 print('udp_output_sym_4', list(p))
12598
12599 # { p[0] = '-'; }
12600 ()
12601
12602
12603 def p_udp_output_sym_5(p):
12604 '''udp_output_sym : DEC_NUMBER '''
12605 if(parse_debug):
12606 print('udp_output_sym_5', list(p))
12607
12608 # { yyerror(@1, "internal error: Output digits parse as decimal number!"); p[0] = '0'; }
12609 ()
12610
12611
12612 def p_udp_port_decl_1(p):
12613 '''udp_port_decl : K_input list_of_identifiers ';' '''
12614 if(parse_debug):
12615 print('udp_port_decl_1', list(p))
12616
12617 # { p[0] = pform_make_udp_input_ports(p[2]); }
12618 ()
12619
12620
12621 def p_udp_port_decl_2(p):
12622 '''udp_port_decl : K_output IDENTIFIER ';' '''
12623 if(parse_debug):
12624 print('udp_port_decl_2', list(p))
12625
12626 # { perm_string pname = lex_strings.make(p[2]);
12627 # PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
12628 # vector<PWire*>*tmp = new vector<PWire*>(1);
12629 # (*tmp)[0] = pp;
12630 # p[0] = tmp;
12631 # delete[]p[2];
12632 # }
12633 ()
12634
12635
12636 def p_udp_port_decl_3(p):
12637 '''udp_port_decl : K_reg IDENTIFIER ';' '''
12638 if(parse_debug):
12639 print('udp_port_decl_3', list(p))
12640
12641 # { perm_string pname = lex_strings.make(p[2]);
12642 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
12643 # vector<PWire*>*tmp = new vector<PWire*>(1);
12644 # (*tmp)[0] = pp;
12645 # p[0] = tmp;
12646 # delete[]p[2];
12647 # }
12648 ()
12649
12650
12651 def p_udp_port_decl_4(p):
12652 '''udp_port_decl : K_reg K_output IDENTIFIER ';' '''
12653 if(parse_debug):
12654 print('udp_port_decl_4', list(p))
12655
12656 # { perm_string pname = lex_strings.make(p[3]);
12657 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
12658 # vector<PWire*>*tmp = new vector<PWire*>(1);
12659 # (*tmp)[0] = pp;
12660 # p[0] = tmp;
12661 # delete[]p[3];
12662 # }
12663 ()
12664
12665
12666 def p_udp_port_decls_1(p):
12667 '''udp_port_decls : udp_port_decl '''
12668 if(parse_debug):
12669 print('udp_port_decls_1', list(p))
12670 p[0] = p[1]
12671
12672
12673 ()
12674
12675
12676 def p_udp_port_decls_2(p):
12677 '''udp_port_decls : udp_port_decls udp_port_decl '''
12678 if(parse_debug):
12679 print('udp_port_decls_2', list(p))
12680
12681 # { vector<PWire*>*tmp = p[1];
12682 # size_t s1 = p[1]->size();
12683 # tmp->resize(s1+p[2]->size());
12684 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
12685 # tmp->at(s1+idx) = p[2]->at(idx);
12686 # p[0] = tmp;
12687 # delete p[2];
12688 # }
12689 ()
12690
12691
12692 def p_udp_port_list_1(p):
12693 '''udp_port_list : IDENTIFIER '''
12694 if(parse_debug):
12695 print('udp_port_list_1', list(p))
12696
12697 # { list<perm_string>*tmp = new list<perm_string>;
12698 # tmp->push_back(lex_strings.make(p[1]));
12699 # delete[]p[1];
12700 # p[0] = tmp;
12701 # }
12702 ()
12703
12704
12705 def p_udp_port_list_2(p):
12706 '''udp_port_list : udp_port_list ',' IDENTIFIER '''
12707 if(parse_debug):
12708 print('udp_port_list_2', list(p))
12709
12710 # { list<perm_string>*tmp = p[1];
12711 # tmp->push_back(lex_strings.make(p[3]));
12712 # delete[]p[3];
12713 # p[0] = tmp;
12714 # }
12715 ()
12716
12717
12718 def p_udp_reg_opt_1(p):
12719 '''udp_reg_opt : K_reg '''
12720 if(parse_debug):
12721 print('udp_reg_opt_1', list(p))
12722 p[0] = True
12723
12724
12725 ()
12726
12727
12728 def p_udp_reg_opt_2(p):
12729 '''udp_reg_opt : '''
12730 if(parse_debug):
12731 print('udp_reg_opt_2', list(p))
12732 p[0] = False
12733
12734
12735 ()
12736
12737
12738 def p_udp_initial_expr_opt_1(p):
12739 '''udp_initial_expr_opt : '=' expression '''
12740 if(parse_debug):
12741 print('udp_initial_expr_opt_1', list(p))
12742 p[0] = p[2]
12743
12744
12745 ()
12746
12747
12748 def p_udp_initial_expr_opt_2(p):
12749 '''udp_initial_expr_opt : '''
12750 if(parse_debug):
12751 print('udp_initial_expr_opt_2', list(p))
12752
12753 # { p[0] = None }
12754 ()
12755
12756
12757 def p_udp_input_declaration_list_1(p):
12758 '''udp_input_declaration_list : K_input IDENTIFIER '''
12759 if(parse_debug):
12760 print('udp_input_declaration_list_1', list(p))
12761
12762 # { list<perm_string>*tmp = new list<perm_string>;
12763 # tmp->push_back(lex_strings.make(p[2]));
12764 # p[0] = tmp;
12765 # delete[]p[2];
12766 # }
12767 ()
12768
12769
12770 def p_udp_input_declaration_list_2(p):
12771 '''udp_input_declaration_list : udp_input_declaration_list ',' K_input IDENTIFIER '''
12772 if(parse_debug):
12773 print('udp_input_declaration_list_2', list(p))
12774
12775 # { list<perm_string>*tmp = p[1];
12776 # tmp->push_back(lex_strings.make(p[4]));
12777 # p[0] = tmp;
12778 # delete[]p[4];
12779 # }
12780 ()
12781
12782
12783 def p_udp_primitive_1(p):
12784 '''udp_primitive : K_primitive IDENTIFIER '(' udp_port_list ')' ';' udp_port_decls udp_init_opt udp_body K_endprimitive endlabel_opt '''
12785 if(parse_debug):
12786 print('udp_primitive_1', list(p))
12787
12788 # { perm_string tmp2 = lex_strings.make(p[2]);
12789 # pform_make_udp(tmp2, p[4], p[7], p[9], p[8],
12790 # @2.text, @2.first_line);
12791 # if (p[11]) {
12792 # if (strcmp(p[2],p[11]) != 0) {
12793 # yyerror(@11, "error: End label doesn't match "
12794 # "primitive name");
12795 # }
12796 # if (! gn_system_verilog()) {
12797 # yyerror(@11, "error: Primitive end labels "
12798 # "require SystemVerilog.");
12799 # }
12800 # delete[]p[11];
12801 # }
12802 # delete[]p[2];
12803 # }
12804 ()
12805
12806
12807 def p_udp_primitive_2(p):
12808 '''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 '''
12809 if(parse_debug):
12810 print('udp_primitive_2', list(p))
12811
12812 # { perm_string tmp2 = lex_strings.make(p[2]);
12813 # perm_string tmp6 = lex_strings.make(p[6]);
12814 # pform_make_udp(tmp2, p[5], tmp6, p[7], p[9], p[12],
12815 # @2.text, @2.first_line);
12816 # if (p[14]) {
12817 # if (strcmp(p[2],p[14]) != 0) {
12818 # yyerror(@14, "error: End label doesn't match "
12819 # "primitive name");
12820 # }
12821 # if (! gn_system_verilog()) {
12822 # yyerror(@14, "error: Primitive end labels "
12823 # "require SystemVerilog.");
12824 # }
12825 # delete[]p[14];
12826 # }
12827 # delete[]p[2];
12828 # delete[]p[6];
12829 # }
12830 ()
12831
12832
12833 def p_K_packed_opt_1(p):
12834 '''K_packed_opt : K_packed '''
12835 if(parse_debug):
12836 print('K_packed_opt', list(p))
12837 p[0] = True
12838
12839
12840 ()
12841
12842
12843 def p_K_packed_opt_2(p):
12844 '''K_packed_opt : '''
12845 if(parse_debug):
12846 print('K_packed_opt', list(p))
12847 p[0] = False
12848
12849
12850 ()
12851
12852
12853 def p_K_reg_opt_1(p):
12854 '''K_reg_opt : K_reg '''
12855 if(parse_debug):
12856 print('K_reg_opt', list(p))
12857 p[0] = True
12858
12859
12860 ()
12861
12862
12863 def p_K_reg_opt_2(p):
12864 '''K_reg_opt : '''
12865 if(parse_debug):
12866 print('K_reg_opt', list(p))
12867 p[0] = False
12868
12869
12870 ()
12871
12872
12873 def p_K_static_opt_1(p):
12874 '''K_static_opt : K_static '''
12875 if(parse_debug):
12876 print('K_static_opt', list(p))
12877 p[0] = True
12878
12879
12880 ()
12881
12882
12883 def p_K_static_opt_2(p):
12884 '''K_static_opt : '''
12885 if(parse_debug):
12886 print('K_static_opt', list(p))
12887 p[0] = False
12888
12889
12890 ()
12891
12892
12893 def p_K_virtual_opt_1(p):
12894 '''K_virtual_opt : K_virtual '''
12895 if(parse_debug):
12896 print(p)
12897 p[0] = True
12898
12899
12900 ()
12901
12902
12903 def p_K_virtual_opt_2(p):
12904 '''K_virtual_opt : '''
12905 if(parse_debug):
12906 print(p)
12907 p[0] = False
12908
12909
12910 ()
12911
12912
12913 def p_error(p):
12914 if(parse_debug):
12915 print("error", p)
12916 exit(0)
12917
12918
12919 yacc.yacc(debug=0)