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