run autopep8
[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 = 1
29 yacc2_debug = 1
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 p[0] = Node(syms.atom, [p[1], Leaf(token.MINUS, '-'), p[4]])
5545
5546
5547 ()
5548
5549
5550 def p_expression_26(p):
5551 '''expression : expression '&' attribute_list_opt expression '''
5552 if(parse_debug):
5553 print('expression_26', list(p))
5554
5555 # { PEBinary*tmp = new PEBinary('&', p[1], p[4]);
5556 # FILE_NAME(tmp, @2);
5557 # p[0] = tmp;
5558 # }
5559 ()
5560
5561
5562 def p_expression_27(p):
5563 '''expression : expression '|' attribute_list_opt expression '''
5564 if(parse_debug):
5565 print('expression_27', list(p))
5566
5567 # { PEBinary*tmp = new PEBinary('|', p[1], p[4]);
5568 # FILE_NAME(tmp, @2);
5569 # p[0] = tmp;
5570 # }
5571 ()
5572
5573
5574 def p_expression_28(p):
5575 '''expression : expression K_NAND attribute_list_opt expression '''
5576 if(parse_debug):
5577 print('expression_28', list(p))
5578
5579 # { PEBinary*tmp = new PEBinary('A', p[1], p[4]);
5580 # FILE_NAME(tmp, @2);
5581 # p[0] = tmp;
5582 # }
5583 ()
5584
5585
5586 def p_expression_29(p):
5587 '''expression : expression K_NOR attribute_list_opt expression '''
5588 if(parse_debug):
5589 print('expression_29', list(p))
5590
5591 # { PEBinary*tmp = new PEBinary('O', p[1], p[4]);
5592 # FILE_NAME(tmp, @2);
5593 # p[0] = tmp;
5594 # }
5595 ()
5596
5597
5598 def p_expression_30(p):
5599 '''expression : expression K_NXOR attribute_list_opt expression '''
5600 if(parse_debug):
5601 print('expression_30', list(p))
5602
5603 # { PEBinary*tmp = new PEBinary('X', p[1], p[4]);
5604 # FILE_NAME(tmp, @2);
5605 # p[0] = tmp;
5606 # }
5607 ()
5608
5609
5610 def p_expression_31(p):
5611 '''expression : expression '<' attribute_list_opt expression '''
5612 if(parse_debug):
5613 print('expression_31', list(p))
5614
5615 # { PEBinary*tmp = new PEBComp('<', p[1], p[4]);
5616 # FILE_NAME(tmp, @2);
5617 # p[0] = tmp;
5618 # }
5619 ()
5620
5621
5622 def p_expression_32(p):
5623 '''expression : expression '>' attribute_list_opt expression '''
5624 if(parse_debug):
5625 print('expression_32', list(p))
5626
5627 # { PEBinary*tmp = new PEBComp('>', p[1], p[4]);
5628 # FILE_NAME(tmp, @2);
5629 # p[0] = tmp;
5630 # }
5631 ()
5632
5633
5634 def p_expression_33(p):
5635 '''expression : expression K_LS attribute_list_opt expression '''
5636 if(parse_debug):
5637 print('expression_33', list(p))
5638
5639 # { PEBinary*tmp = new PEBShift('l', p[1], p[4]);
5640 # FILE_NAME(tmp, @2);
5641 # p[0] = tmp;
5642 # }
5643 ()
5644
5645
5646 def p_expression_34(p):
5647 '''expression : expression K_RS attribute_list_opt expression '''
5648 if(parse_debug):
5649 print('expression_34', list(p))
5650
5651 # { PEBinary*tmp = new PEBShift('r', p[1], p[4]);
5652 # FILE_NAME(tmp, @2);
5653 # p[0] = tmp;
5654 # }
5655 ()
5656
5657
5658 def p_expression_35(p):
5659 '''expression : expression K_RSS attribute_list_opt expression '''
5660 if(parse_debug):
5661 print('expression_35', list(p))
5662
5663 # { PEBinary*tmp = new PEBShift('R', p[1], p[4]);
5664 # FILE_NAME(tmp, @2);
5665 # p[0] = tmp;
5666 # }
5667 ()
5668
5669
5670 def p_expression_36(p):
5671 '''expression : expression K_EQ attribute_list_opt expression '''
5672 if(parse_debug):
5673 print('expression_36', list(p))
5674
5675 # { PEBinary*tmp = new PEBComp('e', p[1], p[4]);
5676 # FILE_NAME(tmp, @2);
5677 # p[0] = tmp;
5678 # }
5679 ()
5680
5681
5682 def p_expression_37(p):
5683 '''expression : expression K_CEQ attribute_list_opt expression '''
5684 if(parse_debug):
5685 print('expression_37', list(p))
5686
5687 # { PEBinary*tmp = new PEBComp('E', p[1], p[4]);
5688 # FILE_NAME(tmp, @2);
5689 # p[0] = tmp;
5690 # }
5691 ()
5692
5693
5694 def p_expression_38(p):
5695 '''expression : expression K_WEQ attribute_list_opt expression '''
5696 if(parse_debug):
5697 print('expression_38', list(p))
5698
5699 # { PEBinary*tmp = new PEBComp('w', p[1], p[4]);
5700 # FILE_NAME(tmp, @2);
5701 # p[0] = tmp;
5702 # }
5703 ()
5704
5705
5706 def p_expression_39(p):
5707 '''expression : expression K_LE attribute_list_opt expression '''
5708 if(parse_debug):
5709 print('expression_39', list(p))
5710
5711 # { PEBinary*tmp = new PEBComp('L', p[1], p[4]);
5712 # FILE_NAME(tmp, @2);
5713 # p[0] = tmp;
5714 # }
5715 ()
5716
5717
5718 def p_expression_40(p):
5719 '''expression : expression K_GE attribute_list_opt expression '''
5720 if(parse_debug):
5721 print('expression_40', list(p))
5722
5723 # { PEBinary*tmp = new PEBComp('G', p[1], p[4]);
5724 # FILE_NAME(tmp, @2);
5725 # p[0] = tmp;
5726 # }
5727 ()
5728
5729
5730 def p_expression_41(p):
5731 '''expression : expression K_NE attribute_list_opt expression '''
5732 if(parse_debug):
5733 print('expression_41', list(p))
5734
5735 # { PEBinary*tmp = new PEBComp('n', p[1], p[4]);
5736 # FILE_NAME(tmp, @2);
5737 # p[0] = tmp;
5738 # }
5739 ()
5740
5741
5742 def p_expression_42(p):
5743 '''expression : expression K_CNE attribute_list_opt expression '''
5744 if(parse_debug):
5745 print('expression_42', list(p))
5746
5747 # { PEBinary*tmp = new PEBComp('N', p[1], p[4]);
5748 # FILE_NAME(tmp, @2);
5749 # p[0] = tmp;
5750 # }
5751 ()
5752
5753
5754 def p_expression_43(p):
5755 '''expression : expression K_WNE attribute_list_opt expression '''
5756 if(parse_debug):
5757 print('expression_43', list(p))
5758
5759 # { PEBinary*tmp = new PEBComp('W', p[1], p[4]);
5760 # FILE_NAME(tmp, @2);
5761 # p[0] = tmp;
5762 # }
5763 ()
5764
5765
5766 def p_expression_44(p):
5767 '''expression : expression K_LOR attribute_list_opt expression '''
5768 if(parse_debug):
5769 print('expression_44', list(p))
5770
5771 # { PEBinary*tmp = new PEBLogic('o', p[1], p[4]);
5772 # FILE_NAME(tmp, @2);
5773 # p[0] = tmp;
5774 # }
5775 ()
5776
5777
5778 def p_expression_45(p):
5779 '''expression : expression K_LAND attribute_list_opt expression '''
5780 if(parse_debug):
5781 print('expression_45', list(p))
5782
5783 # { PEBinary*tmp = new PEBLogic('a', p[1], p[4]);
5784 # FILE_NAME(tmp, @2);
5785 # p[0] = tmp;
5786 # }
5787 ()
5788
5789
5790 def p_expression_46(p):
5791 '''expression : expression '?' attribute_list_opt expression ':' expression '''
5792 if(parse_debug):
5793 print('expression_46', list(p))
5794
5795 # { PETernary*tmp = new PETernary(p[1], p[4], p[6]);
5796 # FILE_NAME(tmp, @2);
5797 # p[0] = tmp;
5798 # }
5799 ()
5800
5801
5802 def p_expr_mintypmax_1(p):
5803 '''expr_mintypmax : expression '''
5804 if(parse_debug):
5805 print('expr_mintypmax_1', list(p))
5806 p[0] = p[1]
5807
5808
5809 ()
5810
5811
5812 def p_expr_mintypmax_2(p):
5813 '''expr_mintypmax : expression ':' expression ':' expression '''
5814 if(parse_debug):
5815 print('expr_mintypmax_2', list(p))
5816
5817 # { switch (min_typ_max_flag) {
5818 # case MIN:
5819 # p[0] = p[1];
5820 # delete p[3];
5821 # delete p[5];
5822 # break;
5823 # case TYP:
5824 # delete p[1];
5825 # p[0] = p[3];
5826 # delete p[5];
5827 # break;
5828 # case MAX:
5829 # delete p[1];
5830 # delete p[3];
5831 # p[0] = p[5];
5832 # break;
5833 # }
5834 # if (min_typ_max_warn > 0) {
5835 # cerr << p[0]->get_fileline() << ": warning: choosing ";
5836 # switch (min_typ_max_flag) {
5837 # case MIN:
5838 # cerr << "min";
5839 # break;
5840 # case TYP:
5841 # cerr << "typ";
5842 # break;
5843 # case MAX:
5844 # cerr << "max";
5845 # break;
5846 # }
5847 # cerr << " expression." << endl;
5848 # min_typ_max_warn -= 1;
5849 # }
5850 # }
5851 ()
5852
5853
5854 def p_expression_list_with_nuls_1(p):
5855 '''expression_list_with_nuls : expression_list_with_nuls ',' expression '''
5856 if(parse_debug):
5857 print('expression_list_with_nuls_1', list(p))
5858
5859 # { list<PExpr*>*tmp = p[1];
5860 # tmp->push_back(p[3]);
5861 # p[0] = tmp;
5862 # }
5863 ()
5864
5865
5866 def p_expression_list_with_nuls_2(p):
5867 '''expression_list_with_nuls : expression '''
5868 if(parse_debug):
5869 print('expression_list_with_nuls_2', list(p))
5870
5871 # { list<PExpr*>*tmp = new list<PExpr*>;
5872 # tmp->push_back(p[1]);
5873 # p[0] = tmp;
5874 # }
5875 ()
5876
5877
5878 def p_expression_list_with_nuls_3(p):
5879 '''expression_list_with_nuls : '''
5880 if(parse_debug):
5881 print('expression_list_with_nuls_3', list(p))
5882
5883 # { list<PExpr*>*tmp = new list<PExpr*>;
5884 # tmp->push_back(0);
5885 # p[0] = tmp;
5886 # }
5887 ()
5888
5889
5890 def p_expression_list_with_nuls_4(p):
5891 '''expression_list_with_nuls : expression_list_with_nuls ',' '''
5892 if(parse_debug):
5893 print('expression_list_with_nuls_4', list(p))
5894
5895 # { list<PExpr*>*tmp = p[1];
5896 # tmp->push_back(0);
5897 # p[0] = tmp;
5898 # }
5899 ()
5900
5901
5902 def p_expression_list_proper_1(p):
5903 '''expression_list_proper : expression_list_proper ',' expression '''
5904 if(parse_debug):
5905 print('expression_list_proper_1', list(p))
5906
5907 # { list<PExpr*>*tmp = p[1];
5908 # tmp->push_back(p[3]);
5909 # p[0] = tmp;
5910 # }
5911 ()
5912
5913
5914 def p_expression_list_proper_2(p):
5915 '''expression_list_proper : expression '''
5916 if(parse_debug):
5917 print('expression_list_proper_2', list(p))
5918
5919 # { list<PExpr*>*tmp = new list<PExpr*>;
5920 # tmp->push_back(p[1]);
5921 # p[0] = tmp;
5922 # }
5923 ()
5924
5925
5926 def p_expr_primary_or_typename_1(p):
5927 '''expr_primary_or_typename : expr_primary '''
5928 if(parse_debug > 2):
5929 print('expr_primary_or_typename_1', list(p))
5930 p[0] = p[1]
5931
5932
5933 ()
5934
5935
5936 def p_expr_primary_or_typename_2(p):
5937 '''expr_primary_or_typename : TYPE_IDENTIFIER '''
5938 if(parse_debug):
5939 print('expr_primary_or_typename_2', list(p))
5940 p[0] = p[1]
5941
5942 # { PETypename*tmp = new PETypename(p[1].type);
5943 # FILE_NAME(tmp,@1);
5944 # p[0] = tmp;
5945 # delete[]p[1].text;
5946 # }
5947 ()
5948
5949
5950 def p_expr_primary_1(p):
5951 '''expr_primary : number '''
5952 if(parse_debug):
5953 print('expr_primary_1', list(p))
5954 p[0] = p[1]
5955
5956 # { assert(p[1]);
5957 # PENumber*tmp = new PENumber(p[1]);
5958 # FILE_NAME(tmp, @1);
5959 # p[0] = tmp;
5960 # }
5961 ()
5962
5963
5964 def p_expr_primary_2(p):
5965 '''expr_primary : REALTIME '''
5966 if(parse_debug):
5967 print('expr_primary_2', list(p))
5968
5969 # { PEFNumber*tmp = new PEFNumber(p[1]);
5970 # FILE_NAME(tmp, @1);
5971 # p[0] = tmp;
5972 # }
5973 ()
5974
5975
5976 def p_expr_primary_3(p):
5977 '''expr_primary : STRING '''
5978 if(parse_debug):
5979 print('expr_primary_3', list(p))
5980
5981 # { PEString*tmp = new PEString(p[1]);
5982 # FILE_NAME(tmp, @1);
5983 # p[0] = tmp;
5984 # }
5985 ()
5986
5987
5988 def p_expr_primary_4(p):
5989 '''expr_primary : TIME_LITERAL '''
5990 if(parse_debug):
5991 print('expr_primary_4', list(p))
5992
5993 # { int unit;
5994 #
5995 # based_size = 0;
5996 # p[0] = 0;
5997 # if (p[1] == 0 || !get_time_unit(p[1], unit))
5998 # yyerror(@1, "internal error: delay.");
5999 # else {
6000 # double p = pow(10.0, (double)(unit - pform_get_timeunit()));
6001 # double time = atof(p[1]) * p;
6002 #
6003 # verireal *v = new verireal(time);
6004 # p[0] = new PEFNumber(v);
6005 # FILE_NAME(p[0], @1);
6006 # }
6007 # }
6008 ()
6009
6010
6011 def p_expr_primary_5(p):
6012 '''expr_primary : SYSTEM_IDENTIFIER '''
6013 if(parse_debug):
6014 print('expr_primary_5', list(p))
6015
6016 # { perm_string tn = lex_strings.make(p[1]);
6017 # PECallFunction*tmp = new PECallFunction(tn);
6018 # FILE_NAME(tmp, @1);
6019 # p[0] = tmp;
6020 # delete[]p[1];
6021 # }
6022 ()
6023
6024
6025 def p_expr_primary_6(p):
6026 '''expr_primary : hierarchy_identifier '''
6027 if(parse_debug > 2):
6028 print('expr_primary_6', list(p))
6029 p[0] = p[1]
6030
6031 # { PEIdent*tmp = pform_new_ident(*p[1]);
6032 # FILE_NAME(tmp, @1);
6033 # p[0] = tmp;
6034 # delete p[1];
6035 # }
6036 ()
6037
6038
6039 def p_expr_primary_7(p):
6040 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier '''
6041 if(parse_debug):
6042 print('expr_primary_7', list(p))
6043
6044 # { p[0] = pform_package_ident(@2, p[1], p[3]);
6045 # delete p[3];
6046 # }
6047 ()
6048
6049
6050 def p_expr_primary_8(p):
6051 '''expr_primary : hierarchy_identifier '(' expression_list_with_nuls ')' '''
6052 if(parse_debug):
6053 print('expr_primary_8', list(p))
6054
6055 # { list<PExpr*>*expr_list = p[3];
6056 # strip_tail_items(expr_list);
6057 # PECallFunction*tmp = pform_make_call_function(@1, *p[1], *expr_list);
6058 # delete p[1];
6059 # p[0] = tmp;
6060 # }
6061 ()
6062
6063
6064 def p_expr_primary_9(p):
6065 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' '''
6066 if(parse_debug):
6067 print('expr_primary_9', list(p))
6068
6069 # { pform_name_t*t_name = p[1];
6070 # while (! p[3]->empty()) {
6071 # t_name->push_back(p[3]->front());
6072 # p[3]->pop_front();
6073 # }
6074 # list<PExpr*>*expr_list = p[5];
6075 # strip_tail_items(expr_list);
6076 # PECallFunction*tmp = pform_make_call_function(@1, *t_name, *expr_list);
6077 # delete p[1];
6078 # delete p[3];
6079 # p[0] = tmp;
6080 # }
6081 ()
6082
6083
6084 def p_expr_primary_10(p):
6085 '''expr_primary : SYSTEM_IDENTIFIER '(' expression_list_proper ')' '''
6086 if(parse_debug):
6087 print('expr_primary_10', list(p))
6088
6089 # { perm_string tn = lex_strings.make(p[1]);
6090 # PECallFunction*tmp = new PECallFunction(tn, *p[3]);
6091 # FILE_NAME(tmp, @1);
6092 # delete[]p[1];
6093 # p[0] = tmp;
6094 # }
6095 ()
6096
6097
6098 def p_expr_primary_11(p):
6099 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')' '''
6100 if(parse_debug):
6101 print('expr_primary_11', list(p))
6102
6103 # { perm_string use_name = lex_strings.make(p[3]);
6104 # PECallFunction*tmp = new PECallFunction(p[1], use_name, *p[5]);
6105 # FILE_NAME(tmp, @3);
6106 # delete[]p[3];
6107 # p[0] = tmp;
6108 # }
6109 ()
6110
6111
6112 def p_expr_primary_12(p):
6113 '''expr_primary : SYSTEM_IDENTIFIER '(' ')' '''
6114 if(parse_debug):
6115 print('expr_primary_12', list(p))
6116
6117 # { perm_string tn = lex_strings.make(p[1]);
6118 # const vector<PExpr*>empty;
6119 # PECallFunction*tmp = new PECallFunction(tn, empty);
6120 # FILE_NAME(tmp, @1);
6121 # delete[]p[1];
6122 # p[0] = tmp;
6123 # if (!gn_system_verilog()) {
6124 # yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
6125 # }
6126 # }
6127 ()
6128
6129
6130 def p_expr_primary_13(p):
6131 '''expr_primary : implicit_class_handle '''
6132 if(parse_debug):
6133 print('expr_primary_13', list(p))
6134
6135 # { PEIdent*tmp = new PEIdent(*p[1]);
6136 # FILE_NAME(tmp,@1);
6137 # delete p[1];
6138 # p[0] = tmp;
6139 # }
6140 ()
6141
6142
6143 def p_expr_primary_14(p):
6144 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '''
6145 if(parse_debug):
6146 print('expr_primary_14', list(p))
6147
6148 # { pform_name_t*t_name = p[1];
6149 # while (! p[3]->empty()) {
6150 # t_name->push_back(p[3]->front());
6151 # p[3]->pop_front();
6152 # }
6153 # PEIdent*tmp = new PEIdent(*t_name);
6154 # FILE_NAME(tmp,@1);
6155 # delete p[1];
6156 # delete p[3];
6157 # p[0] = tmp;
6158 # }
6159 ()
6160
6161
6162 def p_expr_primary_15(p):
6163 '''expr_primary : K_acos '(' expression ')' '''
6164 if(parse_debug):
6165 print('expr_primary_15', list(p))
6166
6167 # { perm_string tn = perm_string::literal("$acos");
6168 # PECallFunction*tmp = make_call_function(tn, p[3]);
6169 # FILE_NAME(tmp,@1);
6170 # p[0] = tmp;
6171 # }
6172 ()
6173
6174
6175 def p_expr_primary_16(p):
6176 '''expr_primary : K_acosh '(' expression ')' '''
6177 if(parse_debug):
6178 print('expr_primary_16', list(p))
6179
6180 # { perm_string tn = perm_string::literal("$acosh");
6181 # PECallFunction*tmp = make_call_function(tn, p[3]);
6182 # FILE_NAME(tmp,@1);
6183 # p[0] = tmp;
6184 # }
6185 ()
6186
6187
6188 def p_expr_primary_17(p):
6189 '''expr_primary : K_asin '(' expression ')' '''
6190 if(parse_debug):
6191 print('expr_primary_17', list(p))
6192
6193 # { perm_string tn = perm_string::literal("$asin");
6194 # PECallFunction*tmp = make_call_function(tn, p[3]);
6195 # FILE_NAME(tmp,@1);
6196 # p[0] = tmp;
6197 # }
6198 ()
6199
6200
6201 def p_expr_primary_18(p):
6202 '''expr_primary : K_asinh '(' expression ')' '''
6203 if(parse_debug):
6204 print('expr_primary_18', list(p))
6205
6206 # { perm_string tn = perm_string::literal("$asinh");
6207 # PECallFunction*tmp = make_call_function(tn, p[3]);
6208 # FILE_NAME(tmp,@1);
6209 # p[0] = tmp;
6210 # }
6211 ()
6212
6213
6214 def p_expr_primary_19(p):
6215 '''expr_primary : K_atan '(' expression ')' '''
6216 if(parse_debug):
6217 print('expr_primary_19', list(p))
6218
6219 # { perm_string tn = perm_string::literal("$atan");
6220 # PECallFunction*tmp = make_call_function(tn, p[3]);
6221 # FILE_NAME(tmp,@1);
6222 # p[0] = tmp;
6223 # }
6224 ()
6225
6226
6227 def p_expr_primary_20(p):
6228 '''expr_primary : K_atanh '(' expression ')' '''
6229 if(parse_debug):
6230 print('expr_primary_20', list(p))
6231
6232 # { perm_string tn = perm_string::literal("$atanh");
6233 # PECallFunction*tmp = make_call_function(tn, p[3]);
6234 # FILE_NAME(tmp,@1);
6235 # p[0] = tmp;
6236 # }
6237 ()
6238
6239
6240 def p_expr_primary_21(p):
6241 '''expr_primary : K_atan2 '(' expression ',' expression ')' '''
6242 if(parse_debug):
6243 print('expr_primary_21', list(p))
6244
6245 # { perm_string tn = perm_string::literal("$atan2");
6246 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6247 # FILE_NAME(tmp,@1);
6248 # p[0] = tmp;
6249 # }
6250 ()
6251
6252
6253 def p_expr_primary_22(p):
6254 '''expr_primary : K_ceil '(' expression ')' '''
6255 if(parse_debug):
6256 print('expr_primary_22', list(p))
6257
6258 # { perm_string tn = perm_string::literal("$ceil");
6259 # PECallFunction*tmp = make_call_function(tn, p[3]);
6260 # FILE_NAME(tmp,@1);
6261 # p[0] = tmp;
6262 # }
6263 ()
6264
6265
6266 def p_expr_primary_23(p):
6267 '''expr_primary : K_cos '(' expression ')' '''
6268 if(parse_debug):
6269 print('expr_primary_23', list(p))
6270
6271 # { perm_string tn = perm_string::literal("$cos");
6272 # PECallFunction*tmp = make_call_function(tn, p[3]);
6273 # FILE_NAME(tmp,@1);
6274 # p[0] = tmp;
6275 # }
6276 ()
6277
6278
6279 def p_expr_primary_24(p):
6280 '''expr_primary : K_cosh '(' expression ')' '''
6281 if(parse_debug):
6282 print('expr_primary_24', list(p))
6283
6284 # { perm_string tn = perm_string::literal("$cosh");
6285 # PECallFunction*tmp = make_call_function(tn, p[3]);
6286 # FILE_NAME(tmp,@1);
6287 # p[0] = tmp;
6288 # }
6289 ()
6290
6291
6292 def p_expr_primary_25(p):
6293 '''expr_primary : K_exp '(' expression ')' '''
6294 if(parse_debug):
6295 print('expr_primary_25', list(p))
6296
6297 # { perm_string tn = perm_string::literal("$exp");
6298 # PECallFunction*tmp = make_call_function(tn, p[3]);
6299 # FILE_NAME(tmp,@1);
6300 # p[0] = tmp;
6301 # }
6302 ()
6303
6304
6305 def p_expr_primary_26(p):
6306 '''expr_primary : K_floor '(' expression ')' '''
6307 if(parse_debug):
6308 print('expr_primary_26', list(p))
6309
6310 # { perm_string tn = perm_string::literal("$floor");
6311 # PECallFunction*tmp = make_call_function(tn, p[3]);
6312 # FILE_NAME(tmp,@1);
6313 # p[0] = tmp;
6314 # }
6315 ()
6316
6317
6318 def p_expr_primary_27(p):
6319 '''expr_primary : K_hypot '(' expression ',' expression ')' '''
6320 if(parse_debug):
6321 print('expr_primary_27', list(p))
6322
6323 # { perm_string tn = perm_string::literal("$hypot");
6324 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6325 # FILE_NAME(tmp,@1);
6326 # p[0] = tmp;
6327 # }
6328 ()
6329
6330
6331 def p_expr_primary_28(p):
6332 '''expr_primary : K_ln '(' expression ')' '''
6333 if(parse_debug):
6334 print('expr_primary_28', list(p))
6335
6336 # { perm_string tn = perm_string::literal("$ln");
6337 # PECallFunction*tmp = make_call_function(tn, p[3]);
6338 # FILE_NAME(tmp,@1);
6339 # p[0] = tmp;
6340 # }
6341 ()
6342
6343
6344 def p_expr_primary_29(p):
6345 '''expr_primary : K_log '(' expression ')' '''
6346 if(parse_debug):
6347 print('expr_primary_29', list(p))
6348
6349 # { perm_string tn = perm_string::literal("$log10");
6350 # PECallFunction*tmp = make_call_function(tn, p[3]);
6351 # FILE_NAME(tmp,@1);
6352 # p[0] = tmp;
6353 # }
6354 ()
6355
6356
6357 def p_expr_primary_30(p):
6358 '''expr_primary : K_pow '(' expression ',' expression ')' '''
6359 if(parse_debug):
6360 print('expr_primary_30', list(p))
6361
6362 # { perm_string tn = perm_string::literal("$pow");
6363 # PECallFunction*tmp = make_call_function(tn, p[3], p[5]);
6364 # FILE_NAME(tmp,@1);
6365 # p[0] = tmp;
6366 # }
6367 ()
6368
6369
6370 def p_expr_primary_31(p):
6371 '''expr_primary : K_sin '(' expression ')' '''
6372 if(parse_debug):
6373 print('expr_primary_31', list(p))
6374
6375 # { perm_string tn = perm_string::literal("$sin");
6376 # PECallFunction*tmp = make_call_function(tn, p[3]);
6377 # FILE_NAME(tmp,@1);
6378 # p[0] = tmp;
6379 # }
6380 ()
6381
6382
6383 def p_expr_primary_32(p):
6384 '''expr_primary : K_sinh '(' expression ')' '''
6385 if(parse_debug):
6386 print('expr_primary_32', list(p))
6387
6388 # { perm_string tn = perm_string::literal("$sinh");
6389 # PECallFunction*tmp = make_call_function(tn, p[3]);
6390 # FILE_NAME(tmp,@1);
6391 # p[0] = tmp;
6392 # }
6393 ()
6394
6395
6396 def p_expr_primary_33(p):
6397 '''expr_primary : K_sqrt '(' expression ')' '''
6398 if(parse_debug):
6399 print('expr_primary_33', list(p))
6400
6401 # { perm_string tn = perm_string::literal("$sqrt");
6402 # PECallFunction*tmp = make_call_function(tn, p[3]);
6403 # FILE_NAME(tmp,@1);
6404 # p[0] = tmp;
6405 # }
6406 ()
6407
6408
6409 def p_expr_primary_34(p):
6410 '''expr_primary : K_tan '(' expression ')' '''
6411 if(parse_debug):
6412 print('expr_primary_34', list(p))
6413
6414 # { perm_string tn = perm_string::literal("$tan");
6415 # PECallFunction*tmp = make_call_function(tn, p[3]);
6416 # FILE_NAME(tmp,@1);
6417 # p[0] = tmp;
6418 # }
6419 ()
6420
6421
6422 def p_expr_primary_35(p):
6423 '''expr_primary : K_tanh '(' expression ')' '''
6424 if(parse_debug):
6425 print('expr_primary_35', list(p))
6426
6427 # { perm_string tn = perm_string::literal("$tanh");
6428 # PECallFunction*tmp = make_call_function(tn, p[3]);
6429 # FILE_NAME(tmp,@1);
6430 # p[0] = tmp;
6431 # }
6432 ()
6433
6434
6435 def p_expr_primary_36(p):
6436 '''expr_primary : K_abs '(' expression ')' '''
6437 if(parse_debug):
6438 print('expr_primary_36', list(p))
6439
6440 # { PEUnary*tmp = new PEUnary('m', p[3]);
6441 # FILE_NAME(tmp,@1);
6442 # p[0] = tmp;
6443 # }
6444 ()
6445
6446
6447 def p_expr_primary_37(p):
6448 '''expr_primary : K_max '(' expression ',' expression ')' '''
6449 if(parse_debug):
6450 print('expr_primary_37', list(p))
6451
6452 # { PEBinary*tmp = new PEBinary('M', p[3], p[5]);
6453 # FILE_NAME(tmp,@1);
6454 # p[0] = tmp;
6455 # }
6456 ()
6457
6458
6459 def p_expr_primary_38(p):
6460 '''expr_primary : K_min '(' expression ',' expression ')' '''
6461 if(parse_debug):
6462 print('expr_primary_38', list(p))
6463
6464 # { PEBinary*tmp = new PEBinary('m', p[3], p[5]);
6465 # FILE_NAME(tmp,@1);
6466 # p[0] = tmp;
6467 # }
6468 ()
6469
6470
6471 def p_expr_primary_39(p):
6472 '''expr_primary : '(' expr_mintypmax ')' '''
6473 if(parse_debug):
6474 print('expr_primary_39', list(p))
6475 p[0] = p[2]
6476
6477
6478 ()
6479
6480
6481 def p_expr_primary_40(p):
6482 '''expr_primary : '{' expression_list_proper '}' '''
6483 if(parse_debug):
6484 print('expr_primary_40', list(p))
6485
6486 # { PEConcat*tmp = new PEConcat(*p[2]);
6487 # FILE_NAME(tmp, @1);
6488 # delete p[2];
6489 # p[0] = tmp;
6490 # }
6491 ()
6492
6493
6494 def p_expr_primary_41(p):
6495 '''expr_primary : '{' expression '{' expression_list_proper '}' '}' '''
6496 if(parse_debug):
6497 print('expr_primary_41', list(p))
6498
6499 # { PExpr*rep = p[2];
6500 # PEConcat*tmp = new PEConcat(*p[4], rep);
6501 # FILE_NAME(tmp, @1);
6502 # delete p[4];
6503 # p[0] = tmp;
6504 # }
6505 ()
6506
6507
6508 def p_expr_primary_42(p):
6509 '''expr_primary : '{' expression '{' expression_list_proper '}' error '}' '''
6510 if(parse_debug):
6511 print('expr_primary_42', list(p))
6512
6513 # { PExpr*rep = p[2];
6514 # PEConcat*tmp = new PEConcat(*p[4], rep);
6515 # FILE_NAME(tmp, @1);
6516 # delete p[4];
6517 # p[0] = tmp;
6518 # yyerror(@5, "error: Syntax error between internal '}' "
6519 # "and closing '}' of repeat concatenation.");
6520 # yyerrok;
6521 # }
6522 ()
6523
6524
6525 def p_expr_primary_43(p):
6526 '''expr_primary : '{' '}' '''
6527 if(parse_debug):
6528 print('expr_primary_43', list(p))
6529
6530 # { // This is the empty queue syntax.
6531 # if (gn_system_verilog()) {
6532 # list<PExpr*> empty_list;
6533 # PEConcat*tmp = new PEConcat(empty_list);
6534 # FILE_NAME(tmp, @1);
6535 # p[0] = tmp;
6536 # } else {
6537 # yyerror(@1, "error: Concatenations are not allowed to be empty.");
6538 # p[0] = None
6539 # }
6540 # }
6541 ()
6542
6543
6544 def p_expr_primary_44(p):
6545 '''expr_primary : expr_primary "'" '(' expression ')' '''
6546 if(parse_debug):
6547 print('expr_primary_44', list(p))
6548
6549 # { PExpr*base = p[4];
6550 # if (gn_system_verilog()) {
6551 # PECastSize*tmp = new PECastSize(p[1], base);
6552 # FILE_NAME(tmp, @1);
6553 # p[0] = tmp;
6554 # } else {
6555 # yyerror(@1, "error: Size cast requires SystemVerilog.");
6556 # p[0] = base;
6557 # }
6558 # }
6559 ()
6560
6561
6562 def p_expr_primary_45(p):
6563 '''expr_primary : simple_type_or_string "'" '(' expression ')' '''
6564 if(parse_debug):
6565 print('expr_primary_45', list(p))
6566
6567 # { PExpr*base = p[4];
6568 # if (gn_system_verilog()) {
6569 # PECastType*tmp = new PECastType(p[1], base);
6570 # FILE_NAME(tmp, @1);
6571 # p[0] = tmp;
6572 # } else {
6573 # yyerror(@1, "error: Type cast requires SystemVerilog.");
6574 # p[0] = base;
6575 # }
6576 # }
6577 ()
6578
6579
6580 def p_expr_primary_46(p):
6581 '''expr_primary : assignment_pattern '''
6582 if(parse_debug):
6583 print('expr_primary_46', list(p))
6584 p[0] = p[1]
6585
6586
6587 ()
6588
6589
6590 def p_expr_primary_47(p):
6591 '''expr_primary : streaming_concatenation '''
6592 if(parse_debug):
6593 print('expr_primary_47', list(p))
6594 p[0] = p[1]
6595
6596
6597 ()
6598
6599
6600 def p_expr_primary_48(p):
6601 '''expr_primary : K_null '''
6602 if(parse_debug):
6603 print('expr_primary_48', list(p))
6604
6605 # { PENull*tmp = new PENull;
6606 # FILE_NAME(tmp, @1);
6607 # p[0] = tmp;
6608 # }
6609 ()
6610
6611
6612 def p_function_item_list_opt_1(p):
6613 '''function_item_list_opt : function_item_list '''
6614 if(parse_debug):
6615 print('function_item_list_opt_1', list(p))
6616 p[0] = p[1]
6617
6618
6619 ()
6620
6621
6622 def p_function_item_list_opt_2(p):
6623 '''function_item_list_opt : '''
6624 if(parse_debug):
6625 print('function_item_list_opt_2', list(p))
6626
6627 # { p[0] = None }
6628 ()
6629
6630
6631 def p_function_item_list_1(p):
6632 '''function_item_list : function_item '''
6633 if(parse_debug):
6634 print('function_item_list_1', list(p))
6635 p[0] = p[1]
6636
6637
6638 ()
6639
6640
6641 def p_function_item_list_2(p):
6642 '''function_item_list : function_item_list function_item '''
6643 if(parse_debug):
6644 print('function_item_list_2', list(p))
6645
6646 # { /* */
6647 # if (p[1] && p[2]) {
6648 # vector<pform_tf_port_t>*tmp = p[1];
6649 # size_t s1 = tmp->size();
6650 # tmp->resize(s1 + p[2]->size());
6651 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
6652 # tmp->at(s1+idx) = p[2]->at(idx);
6653 # delete p[2];
6654 # p[0] = tmp;
6655 # } else if (p[1]) {
6656 # p[0] = p[1];
6657 # } else {
6658 # p[0] = p[2];
6659 # }
6660 # }
6661 ()
6662
6663
6664 def p_function_item_1(p):
6665 '''function_item : tf_port_declaration '''
6666 if(parse_debug):
6667 print('function_item_1', list(p))
6668 p[0] = p[1]
6669
6670
6671 ()
6672
6673
6674 def p_function_item_2(p):
6675 '''function_item : block_item_decl '''
6676 if(parse_debug):
6677 print('function_item_2', list(p))
6678
6679 # { p[0] = None }
6680 ()
6681
6682
6683 def p_gate_instance_1(p):
6684 '''gate_instance : IDENTIFIER '(' expression_list_with_nuls ')' '''
6685 if(parse_debug):
6686 print('gate_instance_1', list(p))
6687
6688 # { lgate*tmp = new lgate;
6689 # tmp->name = p[1];
6690 # tmp->parms = p[3];
6691 # tmp->file = @1.text;
6692 # tmp->lineno = @1.first_line;
6693 # delete[]p[1];
6694 # p[0] = tmp;
6695 # }
6696 ()
6697
6698
6699 def p_gate_instance_2(p):
6700 '''gate_instance : IDENTIFIER dimensions '(' expression_list_with_nuls ')' '''
6701 if(parse_debug):
6702 print('gate_instance_2', list(p))
6703
6704 # { lgate*tmp = new lgate;
6705 # list<pform_range_t>*rng = p[2];
6706 # tmp->name = p[1];
6707 # tmp->parms = p[4];
6708 # tmp->range = rng->front();
6709 # rng->pop_front();
6710 # assert(rng->empty());
6711 # tmp->file = @1.text;
6712 # tmp->lineno = @1.first_line;
6713 # delete[]p[1];
6714 # delete rng;
6715 # p[0] = tmp;
6716 # }
6717 ()
6718
6719
6720 def p_gate_instance_3(p):
6721 '''gate_instance : '(' expression_list_with_nuls ')' '''
6722 if(parse_debug):
6723 print('gate_instance_3', list(p))
6724
6725 # { lgate*tmp = new lgate;
6726 # tmp->name = "";
6727 # tmp->parms = p[2];
6728 # tmp->file = @1.text;
6729 # tmp->lineno = @1.first_line;
6730 # p[0] = tmp;
6731 # }
6732 ()
6733
6734
6735 def p_gate_instance_4(p):
6736 '''gate_instance : IDENTIFIER dimensions '''
6737 if(parse_debug):
6738 print('gate_instance_4', list(p))
6739
6740 # { lgate*tmp = new lgate;
6741 # list<pform_range_t>*rng = p[2];
6742 # tmp->name = p[1];
6743 # tmp->parms = 0;
6744 # tmp->parms_by_name = 0;
6745 # tmp->range = rng->front();
6746 # rng->pop_front();
6747 # assert(rng->empty());
6748 # tmp->file = @1.text;
6749 # tmp->lineno = @1.first_line;
6750 # delete[]p[1];
6751 # delete rng;
6752 # p[0] = tmp;
6753 # }
6754 ()
6755
6756
6757 def p_gate_instance_5(p):
6758 '''gate_instance : IDENTIFIER '(' port_name_list ')' '''
6759 if(parse_debug):
6760 print('gate_instance_5', list(p))
6761
6762 # { lgate*tmp = new lgate;
6763 # tmp->name = p[1];
6764 # tmp->parms = 0;
6765 # tmp->parms_by_name = p[3];
6766 # tmp->file = @1.text;
6767 # tmp->lineno = @1.first_line;
6768 # delete[]p[1];
6769 # p[0] = tmp;
6770 # }
6771 ()
6772
6773
6774 def p_gate_instance_6(p):
6775 '''gate_instance : IDENTIFIER dimensions '(' port_name_list ')' '''
6776 if(parse_debug):
6777 print('gate_instance_6', list(p))
6778
6779 # { lgate*tmp = new lgate;
6780 # list<pform_range_t>*rng = p[2];
6781 # tmp->name = p[1];
6782 # tmp->parms = 0;
6783 # tmp->parms_by_name = p[4];
6784 # tmp->range = rng->front();
6785 # rng->pop_front();
6786 # assert(rng->empty());
6787 # tmp->file = @1.text;
6788 # tmp->lineno = @1.first_line;
6789 # delete[]p[1];
6790 # delete rng;
6791 # p[0] = tmp;
6792 # }
6793 ()
6794
6795
6796 def p_gate_instance_7(p):
6797 '''gate_instance : IDENTIFIER '(' error ')' '''
6798 if(parse_debug):
6799 print('gate_instance_7', list(p))
6800
6801 # { lgate*tmp = new lgate;
6802 # tmp->name = p[1];
6803 # tmp->parms = 0;
6804 # tmp->parms_by_name = 0;
6805 # tmp->file = @1.text;
6806 # tmp->lineno = @1.first_line;
6807 # yyerror(@2, "error: Syntax error in instance port "
6808 # "expression(s).");
6809 # delete[]p[1];
6810 # p[0] = tmp;
6811 # }
6812 ()
6813
6814
6815 def p_gate_instance_8(p):
6816 '''gate_instance : IDENTIFIER dimensions '(' error ')' '''
6817 if(parse_debug):
6818 print('gate_instance_8', list(p))
6819
6820 # { lgate*tmp = new lgate;
6821 # tmp->name = p[1];
6822 # tmp->parms = 0;
6823 # tmp->parms_by_name = 0;
6824 # tmp->file = @1.text;
6825 # tmp->lineno = @1.first_line;
6826 # yyerror(@3, "error: Syntax error in instance port "
6827 # "expression(s).");
6828 # delete[]p[1];
6829 # p[0] = tmp;
6830 # }
6831 ()
6832
6833
6834 def p_gate_instance_list_1(p):
6835 '''gate_instance_list : gate_instance_list ',' gate_instance '''
6836 if(parse_debug):
6837 print('gate_instance_list_1', list(p))
6838
6839 # { svector<lgate>*tmp1 = p[1];
6840 # lgate*tmp2 = p[3];
6841 # svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
6842 # delete tmp1;
6843 # delete tmp2;
6844 # p[0] = out;
6845 # }
6846 ()
6847
6848
6849 def p_gate_instance_list_2(p):
6850 '''gate_instance_list : gate_instance '''
6851 if(parse_debug):
6852 print('gate_instance_list_2', list(p))
6853
6854 # { svector<lgate>*tmp = new svector<lgate>(1);
6855 # (*tmp)[0] = *p[1];
6856 # delete p[1];
6857 # p[0] = tmp;
6858 # }
6859 ()
6860
6861
6862 def p_gatetype_1(p):
6863 '''gatetype : K_and '''
6864 if(parse_debug):
6865 print('gatetype_1', list(p))
6866
6867 # { p[0] = PGBuiltin::AND; }
6868 ()
6869
6870
6871 def p_gatetype_2(p):
6872 '''gatetype : K_nand '''
6873 if(parse_debug):
6874 print('gatetype_2', list(p))
6875
6876 # { p[0] = PGBuiltin::NAND; }
6877 ()
6878
6879
6880 def p_gatetype_3(p):
6881 '''gatetype : K_or '''
6882 if(parse_debug):
6883 print('gatetype_3', list(p))
6884
6885 # { p[0] = PGBuiltin::OR; }
6886 ()
6887
6888
6889 def p_gatetype_4(p):
6890 '''gatetype : K_nor '''
6891 if(parse_debug):
6892 print('gatetype_4', list(p))
6893
6894 # { p[0] = PGBuiltin::NOR; }
6895 ()
6896
6897
6898 def p_gatetype_5(p):
6899 '''gatetype : K_xor '''
6900 if(parse_debug):
6901 print('gatetype_5', list(p))
6902
6903 # { p[0] = PGBuiltin::XOR; }
6904 ()
6905
6906
6907 def p_gatetype_6(p):
6908 '''gatetype : K_xnor '''
6909 if(parse_debug):
6910 print('gatetype_6', list(p))
6911
6912 # { p[0] = PGBuiltin::XNOR; }
6913 ()
6914
6915
6916 def p_gatetype_7(p):
6917 '''gatetype : K_buf '''
6918 if(parse_debug):
6919 print('gatetype_7', list(p))
6920
6921 # { p[0] = PGBuiltin::BUF; }
6922 ()
6923
6924
6925 def p_gatetype_8(p):
6926 '''gatetype : K_bufif0 '''
6927 if(parse_debug):
6928 print('gatetype_8', list(p))
6929
6930 # { p[0] = PGBuiltin::BUFIF0; }
6931 ()
6932
6933
6934 def p_gatetype_9(p):
6935 '''gatetype : K_bufif1 '''
6936 if(parse_debug):
6937 print('gatetype_9', list(p))
6938
6939 # { p[0] = PGBuiltin::BUFIF1; }
6940 ()
6941
6942
6943 def p_gatetype_10(p):
6944 '''gatetype : K_not '''
6945 if(parse_debug):
6946 print('gatetype_10', list(p))
6947
6948 # { p[0] = PGBuiltin::NOT; }
6949 ()
6950
6951
6952 def p_gatetype_11(p):
6953 '''gatetype : K_notif0 '''
6954 if(parse_debug):
6955 print('gatetype_11', list(p))
6956
6957 # { p[0] = PGBuiltin::NOTIF0; }
6958 ()
6959
6960
6961 def p_gatetype_12(p):
6962 '''gatetype : K_notif1 '''
6963 if(parse_debug):
6964 print('gatetype_12', list(p))
6965
6966 # { p[0] = PGBuiltin::NOTIF1; }
6967 ()
6968
6969
6970 def p_switchtype_1(p):
6971 '''switchtype : K_nmos '''
6972 if(parse_debug):
6973 print('switchtype_1', list(p))
6974
6975 # { p[0] = PGBuiltin::NMOS; }
6976 ()
6977
6978
6979 def p_switchtype_2(p):
6980 '''switchtype : K_rnmos '''
6981 if(parse_debug):
6982 print('switchtype_2', list(p))
6983
6984 # { p[0] = PGBuiltin::RNMOS; }
6985 ()
6986
6987
6988 def p_switchtype_3(p):
6989 '''switchtype : K_pmos '''
6990 if(parse_debug):
6991 print('switchtype_3', list(p))
6992
6993 # { p[0] = PGBuiltin::PMOS; }
6994 ()
6995
6996
6997 def p_switchtype_4(p):
6998 '''switchtype : K_rpmos '''
6999 if(parse_debug):
7000 print('switchtype_4', list(p))
7001
7002 # { p[0] = PGBuiltin::RPMOS; }
7003 ()
7004
7005
7006 def p_switchtype_5(p):
7007 '''switchtype : K_cmos '''
7008 if(parse_debug):
7009 print('switchtype_5', list(p))
7010
7011 # { p[0] = PGBuiltin::CMOS; }
7012 ()
7013
7014
7015 def p_switchtype_6(p):
7016 '''switchtype : K_rcmos '''
7017 if(parse_debug):
7018 print('switchtype_6', list(p))
7019
7020 # { p[0] = PGBuiltin::RCMOS; }
7021 ()
7022
7023
7024 def p_switchtype_7(p):
7025 '''switchtype : K_tran '''
7026 if(parse_debug):
7027 print('switchtype_7', list(p))
7028
7029 # { p[0] = PGBuiltin::TRAN; }
7030 ()
7031
7032
7033 def p_switchtype_8(p):
7034 '''switchtype : K_rtran '''
7035 if(parse_debug):
7036 print('switchtype_8', list(p))
7037
7038 # { p[0] = PGBuiltin::RTRAN; }
7039 ()
7040
7041
7042 def p_switchtype_9(p):
7043 '''switchtype : K_tranif0 '''
7044 if(parse_debug):
7045 print('switchtype_9', list(p))
7046
7047 # { p[0] = PGBuiltin::TRANIF0; }
7048 ()
7049
7050
7051 def p_switchtype_10(p):
7052 '''switchtype : K_tranif1 '''
7053 if(parse_debug):
7054 print('switchtype_10', list(p))
7055
7056 # { p[0] = PGBuiltin::TRANIF1; }
7057 ()
7058
7059
7060 def p_switchtype_11(p):
7061 '''switchtype : K_rtranif0 '''
7062 if(parse_debug):
7063 print('switchtype_11', list(p))
7064
7065 # { p[0] = PGBuiltin::RTRANIF0; }
7066 ()
7067
7068
7069 def p_switchtype_12(p):
7070 '''switchtype : K_rtranif1 '''
7071 if(parse_debug):
7072 print('switchtype_12', list(p))
7073
7074 # { p[0] = PGBuiltin::RTRANIF1; }
7075 ()
7076
7077
7078 def p_hierarchy_identifier_1(p):
7079 '''hierarchy_identifier : IDENTIFIER '''
7080 if(parse_debug):
7081 print('hierarchy_identifier_1 FIXME', list(p))
7082 lpvalue = Leaf(token.NAME, p[1])
7083 p[0] = lpvalue
7084
7085 # { p[0] = new pform_name_t;
7086 # p[0]->push_back(name_component_t(lex_strings.make(p[1])));
7087 # delete[]p[1];
7088 # }
7089 ()
7090
7091
7092 def p_hierarchy_identifier_2(p):
7093 '''hierarchy_identifier : hierarchy_identifier '.' IDENTIFIER '''
7094 if(parse_debug):
7095 print('hierarchy_identifier_2', list(p))
7096
7097 # { pform_name_t * tmp = p[1];
7098 # tmp->push_back(name_component_t(lex_strings.make(p[3])));
7099 # delete[]p[3];
7100 # p[0] = tmp;
7101 # }
7102 ()
7103
7104
7105 def p_hierarchy_identifier_3(p):
7106 '''hierarchy_identifier : hierarchy_identifier '[' expression ']' '''
7107 if(parse_debug):
7108 print('hierarchy_identifier_3', list(p))
7109
7110 # { pform_name_t * tmp = p[1];
7111 # name_component_t&tail = tmp->back();
7112 # index_component_t itmp;
7113 # itmp.sel = index_component_t::SEL_BIT;
7114 # itmp.msb = p[3];
7115 # tail.index.push_back(itmp);
7116 # p[0] = tmp;
7117 # }
7118 ()
7119
7120
7121 def p_hierarchy_identifier_4(p):
7122 '''hierarchy_identifier : hierarchy_identifier '[' '$' ']' '''
7123 if(parse_debug):
7124 print('hierarchy_identifier_4', list(p))
7125
7126 # { pform_name_t * tmp = p[1];
7127 # name_component_t&tail = tmp->back();
7128 # if (! gn_system_verilog()) {
7129 # yyerror(@3, "error: Last element expression ($) "
7130 # "requires SystemVerilog. Try enabling SystemVerilog.");
7131 # }
7132 # index_component_t itmp;
7133 # itmp.sel = index_component_t::SEL_BIT_LAST;
7134 # itmp.msb = 0;
7135 # itmp.lsb = 0;
7136 # tail.index.push_back(itmp);
7137 # p[0] = tmp;
7138 # }
7139 ()
7140
7141
7142 def p_hierarchy_identifier_5(p):
7143 '''hierarchy_identifier : hierarchy_identifier '[' expression ':' expression ']' '''
7144 if(parse_debug):
7145 print('hierarchy_identifier_5', list(p))
7146
7147 # { pform_name_t * tmp = p[1];
7148 # name_component_t&tail = tmp->back();
7149 # index_component_t itmp;
7150 # itmp.sel = index_component_t::SEL_PART;
7151 # itmp.msb = p[3];
7152 # itmp.lsb = p[5];
7153 # tail.index.push_back(itmp);
7154 # p[0] = tmp;
7155 # }
7156 ()
7157
7158
7159 def p_hierarchy_identifier_6(p):
7160 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_POS expression ']' '''
7161 if(parse_debug):
7162 print('hierarchy_identifier_6', list(p))
7163
7164 # { pform_name_t * tmp = p[1];
7165 # name_component_t&tail = tmp->back();
7166 # index_component_t itmp;
7167 # itmp.sel = index_component_t::SEL_IDX_UP;
7168 # itmp.msb = p[3];
7169 # itmp.lsb = p[5];
7170 # tail.index.push_back(itmp);
7171 # p[0] = tmp;
7172 # }
7173 ()
7174
7175
7176 def p_hierarchy_identifier_7(p):
7177 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_NEG expression ']' '''
7178 if(parse_debug):
7179 print('hierarchy_identifier_7', list(p))
7180
7181 # { pform_name_t * tmp = p[1];
7182 # name_component_t&tail = tmp->back();
7183 # index_component_t itmp;
7184 # itmp.sel = index_component_t::SEL_IDX_DO;
7185 # itmp.msb = p[3];
7186 # itmp.lsb = p[5];
7187 # tail.index.push_back(itmp);
7188 # p[0] = tmp;
7189 # }
7190 ()
7191
7192
7193 def p_list_of_identifiers_1(p):
7194 '''list_of_identifiers : IDENTIFIER '''
7195 if(parse_debug):
7196 print('list_of_identifiers_1', list(p))
7197
7198 # { p[0] = list_from_identifier(p[1]); }
7199 ()
7200
7201
7202 def p_list_of_identifiers_2(p):
7203 '''list_of_identifiers : list_of_identifiers ',' IDENTIFIER '''
7204 if(parse_debug):
7205 print('list_of_identifiers_2', list(p))
7206
7207 # { p[0] = list_from_identifier(p[1], p[3]); }
7208 ()
7209
7210
7211 def p_list_of_port_identifiers_1(p):
7212 '''list_of_port_identifiers : IDENTIFIER dimensions_opt '''
7213 if(parse_debug):
7214 print('list_of_port_identifiers_1', list(p))
7215
7216 # { p[0] = make_port_list(p[1], p[2], 0); }
7217 ()
7218
7219
7220 def p_list_of_port_identifiers_2(p):
7221 '''list_of_port_identifiers : list_of_port_identifiers ',' IDENTIFIER dimensions_opt '''
7222 if(parse_debug):
7223 print('list_of_port_identifiers_2', list(p))
7224
7225 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
7226 ()
7227
7228
7229 def p_list_of_variable_port_identifiers_1(p):
7230 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '''
7231 if(parse_debug):
7232 print('list_of_variable_port_identifiers_1', list(p))
7233
7234 # { p[0] = make_port_list(p[1], p[2], 0); }
7235 ()
7236
7237
7238 def p_list_of_variable_port_identifiers_2(p):
7239 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '=' expression '''
7240 if(parse_debug):
7241 print('list_of_variable_port_identifiers_2', list(p))
7242
7243 # { p[0] = make_port_list(p[1], p[2], p[4]); }
7244 ()
7245
7246
7247 def p_list_of_variable_port_identifiers_3(p):
7248 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '''
7249 if(parse_debug):
7250 print('list_of_variable_port_identifiers_3', list(p))
7251
7252 # { p[0] = make_port_list(p[1], p[3], p[4], 0); }
7253 ()
7254
7255
7256 def p_list_of_variable_port_identifiers_4(p):
7257 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '=' expression '''
7258 if(parse_debug):
7259 print('list_of_variable_port_identifiers_4', list(p))
7260
7261 # { p[0] = make_port_list(p[1], p[3], p[4], p[6]); }
7262 ()
7263
7264
7265 def p_list_of_ports_1(p):
7266 '''list_of_ports : port_opt '''
7267 if(parse_debug):
7268 print('list_of_ports_1', list(p))
7269
7270 # { vector<Module::port_t*>*tmp
7271 # = new vector<Module::port_t*>(1);
7272 # (*tmp)[0] = p[1];
7273 # p[0] = tmp;
7274 # }
7275 ()
7276
7277
7278 def p_list_of_ports_2(p):
7279 '''list_of_ports : list_of_ports ',' port_opt '''
7280 if(parse_debug):
7281 print('list_of_ports_2', list(p))
7282
7283 # { vector<Module::port_t*>*tmp = p[1];
7284 # tmp->push_back(p[3]);
7285 # p[0] = tmp;
7286 # }
7287 ()
7288
7289
7290 def p_list_of_port_declarations_1(p):
7291 '''list_of_port_declarations : port_declaration '''
7292 if(parse_debug > 1):
7293 print('list_of_port_declarations_1', list(p))
7294 p[0] = [p[1]]
7295
7296 # { vector<Module::port_t*>*tmp
7297 # = new vector<Module::port_t*>(1);
7298 # (*tmp)[0] = p[1];
7299 # p[0] = tmp;
7300 # }
7301 ()
7302
7303
7304 def p_list_of_port_declarations_2(p):
7305 '''list_of_port_declarations : list_of_port_declarations ',' port_declaration '''
7306 if(parse_debug):
7307 print('list_of_port_declarations_2 FIXME', list(p))
7308 # MOVE_TO absyn p[1].append(Leaf(token.NEWLINE, '\n')) # should be a comma
7309 # XXX p[3].prefix=' ' # add a space after the NL, must go in parameter
7310 p[1].append(p[3])
7311 p[0] = p[1]
7312
7313 # { vector<Module::port_t*>*tmp = p[1];
7314 # tmp->push_back(p[3]);
7315 # p[0] = tmp;
7316 # }
7317 ()
7318
7319
7320 def p_list_of_port_declarations_3(p):
7321 '''list_of_port_declarations : list_of_port_declarations ',' IDENTIFIER '''
7322 if(parse_debug):
7323 print('list_of_port_declarations_3', list(p))
7324
7325 # { Module::port_t*ptmp;
7326 # perm_string name = lex_strings.make(p[3]);
7327 # ptmp = pform_module_port_reference(name, @3.text,
7328 # @3.first_line);
7329 # vector<Module::port_t*>*tmp = p[1];
7330 # tmp->push_back(ptmp);
7331 #
7332 # /* Get the port declaration details, the port type
7333 # and what not, from context data stored by the
7334 # last port_declaration rule. */
7335 # pform_module_define_port(@3, name,
7336 # port_declaration_context.port_type,
7337 # port_declaration_context.port_net_type,
7338 # port_declaration_context.data_type, 0);
7339 # delete[]p[3];
7340 # p[0] = tmp;
7341 # }
7342 ()
7343
7344
7345 def p_list_of_port_declarations_4(p):
7346 '''list_of_port_declarations : list_of_port_declarations ',' '''
7347 if(parse_debug):
7348 print('list_of_port_declarations_4', list(p))
7349
7350 # {
7351 # yyerror(@2, "error: NULL port declarations are not "
7352 # "allowed.");
7353 # }
7354 ()
7355
7356
7357 def p_list_of_port_declarations_5(p):
7358 '''list_of_port_declarations : list_of_port_declarations ';' '''
7359 if(parse_debug):
7360 print('list_of_port_declarations_5', list(p))
7361
7362 # {
7363 # yyerror(@2, "error: ';' is an invalid port declaration "
7364 # "separator.");
7365 # }
7366 ()
7367
7368
7369 def p_port_declaration_1(p):
7370 '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7371 if(parse_debug):
7372 print('port_declaration_1 FIXME', list(p))
7373 comment, dt, name = p[2], p[4], p[5]
7374 p[0] = absyn.port_decl(comment, dt, name)
7375
7376 # { Module::port_t*ptmp;
7377 # perm_string name = lex_strings.make(p[5]);
7378 # data_type_t*use_type = p[4];
7379 # if (p[6]) use_type = new uarray_type_t(use_type, p[6]);
7380 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7381 # pform_module_define_port(@2, name, NetNet::PINPUT, p[3], use_type, p[1]);
7382 # port_declaration_context.port_type = NetNet::PINPUT;
7383 # port_declaration_context.port_net_type = p[3];
7384 # port_declaration_context.data_type = p[4];
7385 # delete[]p[5];
7386 # p[0] = ptmp;
7387 # }
7388 ()
7389
7390
7391 def p_port_declaration_2(p):
7392 '''port_declaration : attribute_list_opt K_input K_wreal IDENTIFIER '''
7393 if(parse_debug):
7394 print('port_declaration_2', list(p))
7395
7396 # { Module::port_t*ptmp;
7397 # perm_string name = lex_strings.make(p[4]);
7398 # ptmp = pform_module_port_reference(name, @2.text,
7399 # @2.first_line);
7400 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7401 # FILE_NAME(real_type, @3);
7402 # pform_module_define_port(@2, name, NetNet::PINPUT,
7403 # NetNet::WIRE, real_type, p[1]);
7404 # port_declaration_context.port_type = NetNet::PINPUT;
7405 # port_declaration_context.port_net_type = NetNet::WIRE;
7406 # port_declaration_context.data_type = real_type;
7407 # delete[]p[4];
7408 # p[0] = ptmp;
7409 # }
7410 ()
7411
7412
7413 def p_port_declaration_3(p):
7414 '''port_declaration : attribute_list_opt K_inout net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7415 if(parse_debug):
7416 print('port_declaration_3', list(p))
7417
7418 # { Module::port_t*ptmp;
7419 # perm_string name = lex_strings.make(p[5]);
7420 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7421 # pform_module_define_port(@2, name, NetNet::PINOUT, p[3], p[4], p[1]);
7422 # port_declaration_context.port_type = NetNet::PINOUT;
7423 # port_declaration_context.port_net_type = p[3];
7424 # port_declaration_context.data_type = p[4];
7425 # delete[]p[5];
7426 # if (p[6]) {
7427 # yyerror(@6, "sorry: Inout ports with unpacked dimensions not supported.");
7428 # delete p[6];
7429 # }
7430 # p[0] = ptmp;
7431 # }
7432 ()
7433
7434
7435 def p_port_declaration_4(p):
7436 '''port_declaration : attribute_list_opt K_inout K_wreal IDENTIFIER '''
7437 if(parse_debug):
7438 print('port_declaration_4', list(p))
7439
7440 # { Module::port_t*ptmp;
7441 # perm_string name = lex_strings.make(p[4]);
7442 # ptmp = pform_module_port_reference(name, @2.text,
7443 # @2.first_line);
7444 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7445 # FILE_NAME(real_type, @3);
7446 # pform_module_define_port(@2, name, NetNet::PINOUT,
7447 # NetNet::WIRE, real_type, p[1]);
7448 # port_declaration_context.port_type = NetNet::PINOUT;
7449 # port_declaration_context.port_net_type = NetNet::WIRE;
7450 # port_declaration_context.data_type = real_type;
7451 # delete[]p[4];
7452 # p[0] = ptmp;
7453 # }
7454 ()
7455
7456
7457 def p_port_declaration_5(p):
7458 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
7459 if(parse_debug):
7460 print('port_declaration_5 FIXME', list(p))
7461 comment, dt, name = p[2], p[4], p[5]
7462 p[0] = absyn.port_decl(comment, dt, name)
7463
7464 # { Module::port_t*ptmp;
7465 # perm_string name = lex_strings.make(p[5]);
7466 # data_type_t*use_dtype = p[4];
7467 # if (p[6]) use_dtype = new uarray_type_t(use_dtype, p[6]);
7468 # NetNet::Type use_type = p[3];
7469 # if (use_type == NetNet::IMPLICIT) {
7470 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
7471 # if (dtype->reg_flag)
7472 # use_type = NetNet::REG;
7473 # else if (dtype->implicit_flag)
7474 # use_type = NetNet::IMPLICIT;
7475 # else
7476 # use_type = NetNet::IMPLICIT_REG;
7477 #
7478 # // The SystemVerilog types that can show up as
7479 # // output ports are implicitly (on the inside)
7480 # // variables because "reg" is not valid syntax
7481 # // here.
7482 # } else if (dynamic_cast<atom2_type_t*> (p[4])) {
7483 # use_type = NetNet::IMPLICIT_REG;
7484 # } else if (dynamic_cast<struct_type_t*> (p[4])) {
7485 # use_type = NetNet::IMPLICIT_REG;
7486 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[4])) {
7487 # if(etype->base_type == IVL_VT_LOGIC)
7488 # use_type = NetNet::IMPLICIT_REG;
7489 # }
7490 # }
7491 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7492 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, use_dtype, p[1]);
7493 # port_declaration_context.port_type = NetNet::POUTPUT;
7494 # port_declaration_context.port_net_type = use_type;
7495 # port_declaration_context.data_type = p[4];
7496 # delete[]p[5];
7497 # p[0] = ptmp;
7498 # }
7499 ()
7500
7501
7502 def p_port_declaration_6(p):
7503 '''port_declaration : attribute_list_opt K_output K_wreal IDENTIFIER '''
7504 if(parse_debug):
7505 print('port_declaration_6', list(p))
7506
7507 # { Module::port_t*ptmp;
7508 # perm_string name = lex_strings.make(p[4]);
7509 # ptmp = pform_module_port_reference(name, @2.text,
7510 # @2.first_line);
7511 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
7512 # FILE_NAME(real_type, @3);
7513 # pform_module_define_port(@2, name, NetNet::POUTPUT,
7514 # NetNet::WIRE, real_type, p[1]);
7515 # port_declaration_context.port_type = NetNet::POUTPUT;
7516 # port_declaration_context.port_net_type = NetNet::WIRE;
7517 # port_declaration_context.data_type = real_type;
7518 # delete[]p[4];
7519 # p[0] = ptmp;
7520 # }
7521 ()
7522
7523
7524 def p_port_declaration_7(p):
7525 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER '=' expression '''
7526 if(parse_debug):
7527 print('port_declaration_7', list(p))
7528
7529 # { Module::port_t*ptmp;
7530 # perm_string name = lex_strings.make(p[5]);
7531 # NetNet::Type use_type = p[3];
7532 # if (use_type == NetNet::IMPLICIT) {
7533 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[4])) {
7534 # if (dtype->reg_flag)
7535 # use_type = NetNet::REG;
7536 # else
7537 # use_type = NetNet::IMPLICIT_REG;
7538 # } else {
7539 # use_type = NetNet::IMPLICIT_REG;
7540 # }
7541 # }
7542 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
7543 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, p[4], p[1]);
7544 # port_declaration_context.port_type = NetNet::PINOUT;
7545 # port_declaration_context.port_net_type = use_type;
7546 # port_declaration_context.data_type = p[4];
7547 #
7548 # pform_make_var_init(@5, name, p[7]);
7549 #
7550 # delete[]p[5];
7551 # p[0] = ptmp;
7552 # }
7553 ()
7554
7555
7556 def p_net_type_opt_1(p):
7557 '''net_type_opt : net_type '''
7558 if(parse_debug):
7559 print('net_type_opt_1', list(p))
7560 p[0] = p[1]
7561
7562
7563 ()
7564
7565
7566 def p_net_type_opt_2(p):
7567 '''net_type_opt : '''
7568 if(parse_debug > 2):
7569 print('net_type_opt_2', list(p))
7570 p[0] = NN_IMPLICIT
7571
7572
7573 ()
7574
7575
7576 def p_unsigned_signed_opt_1(p):
7577 '''unsigned_signed_opt : K_signed '''
7578 if(parse_debug):
7579 print('unsigned_signed_opt_1', list(p))
7580 p[0] = True
7581
7582
7583 ()
7584
7585
7586 def p_unsigned_signed_opt_2(p):
7587 '''unsigned_signed_opt : K_unsigned '''
7588 if(parse_debug):
7589 print('unsigned_signed_opt_2', list(p))
7590 p[0] = False
7591
7592
7593 ()
7594
7595
7596 def p_unsigned_signed_opt_3(p):
7597 '''unsigned_signed_opt : '''
7598 if(parse_debug):
7599 print('unsigned_signed_opt_3', list(p))
7600 p[0] = False
7601
7602
7603 ()
7604
7605
7606 def p_signed_unsigned_opt_1(p):
7607 '''signed_unsigned_opt : K_signed '''
7608 if(parse_debug):
7609 print('signed_unsigned_opt_1', list(p))
7610 p[0] = True
7611
7612
7613 ()
7614
7615
7616 def p_signed_unsigned_opt_2(p):
7617 '''signed_unsigned_opt : K_unsigned '''
7618 if(parse_debug):
7619 print('signed_unsigned_opt_2', list(p))
7620 p[0] = False
7621
7622
7623 ()
7624
7625
7626 def p_signed_unsigned_opt_3(p):
7627 '''signed_unsigned_opt : '''
7628 if(parse_debug):
7629 print('signed_unsigned_opt_3', list(p))
7630 p[0] = True
7631
7632
7633 ()
7634
7635
7636 def p_atom2_type_1(p):
7637 '''atom2_type : K_byte '''
7638 if(parse_debug):
7639 print('atom2_type_1', list(p))
7640
7641 # { p[0] = 8; }
7642 ()
7643
7644
7645 def p_atom2_type_2(p):
7646 '''atom2_type : K_shortint '''
7647 if(parse_debug):
7648 print('atom2_type_2', list(p))
7649
7650 # { p[0] = 16; }
7651 ()
7652
7653
7654 def p_atom2_type_3(p):
7655 '''atom2_type : K_int '''
7656 if(parse_debug):
7657 print('atom2_type_3', list(p))
7658
7659 # { p[0] = 32; }
7660 ()
7661
7662
7663 def p_atom2_type_4(p):
7664 '''atom2_type : K_longint '''
7665 if(parse_debug):
7666 print('atom2_type_4', list(p))
7667
7668 # { p[0] = 64; }
7669 ()
7670
7671
7672 def p_lpvalue_1(p):
7673 '''lpvalue : hierarchy_identifier '''
7674 if(parse_debug > 2):
7675 print('lpvalue_1', list(p))
7676 p[0] = p[1]
7677
7678 # { PEIdent*tmp = pform_new_ident(*p[1]);
7679 # FILE_NAME(tmp, @1);
7680 # p[0] = tmp;
7681 # delete p[1];
7682 # }
7683 ()
7684
7685
7686 def p_lpvalue_2(p):
7687 '''lpvalue : implicit_class_handle '.' hierarchy_identifier '''
7688 if(parse_debug):
7689 print('lpvalue_2', list(p))
7690
7691 # { pform_name_t*t_name = p[1];
7692 # while (!p[3]->empty()) {
7693 # t_name->push_back(p[3]->front());
7694 # p[3]->pop_front();
7695 # }
7696 # PEIdent*tmp = new PEIdent(*t_name);
7697 # FILE_NAME(tmp, @1);
7698 # p[0] = tmp;
7699 # delete p[1];
7700 # delete p[3];
7701 # }
7702 ()
7703
7704
7705 def p_lpvalue_3(p):
7706 '''lpvalue : '{' expression_list_proper '}' '''
7707 if(parse_debug):
7708 print('lpvalue_3', list(p))
7709
7710 # { PEConcat*tmp = new PEConcat(*p[2]);
7711 # FILE_NAME(tmp, @1);
7712 # delete p[2];
7713 # p[0] = tmp;
7714 # }
7715 ()
7716
7717
7718 def p_lpvalue_4(p):
7719 '''lpvalue : streaming_concatenation '''
7720 if(parse_debug):
7721 print('lpvalue_4', list(p))
7722
7723 # { yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
7724 # p[0] = None
7725 # }
7726 ()
7727
7728
7729 def p_cont_assign_1(p):
7730 '''cont_assign : lpvalue '=' expression '''
7731 if(parse_debug):
7732 print('cont_assign_1', list(p))
7733 absyn.cont_assign_1(p)
7734
7735 # { list<PExpr*>*tmp = new list<PExpr*>;
7736 # tmp->push_back(p[1]);
7737 # tmp->push_back(p[3]);
7738 # p[0] = tmp;
7739 # }
7740 ()
7741
7742
7743 def p_cont_assign_list_1(p):
7744 '''cont_assign_list : cont_assign_list ',' cont_assign '''
7745 if(parse_debug):
7746 print('cont_assign_list_1', list(p))
7747
7748 # { list<PExpr*>*tmp = p[1];
7749 # tmp->splice(tmp->end(), *p[3]);
7750 # delete p[3];
7751 # p[0] = tmp;
7752 # }
7753 ()
7754
7755
7756 def p_cont_assign_list_2(p):
7757 '''cont_assign_list : cont_assign '''
7758 if(parse_debug > 2):
7759 print('cont_assign_list_2', list(p))
7760 p[0] = p[1]
7761
7762
7763 ()
7764
7765
7766 def p_module_1(p):
7767 '''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 '''
7768 if(parse_debug > 2):
7769 print('module_1', list(p))
7770 clsdecl = absyn.module_1(p)
7771 p[0] = clsdecl
7772
7773
7774 ()
7775
7776
7777 def p__embed0_module(p):
7778 '''_embed0_module : '''
7779
7780 # { pform_startmodule(@2, p[4], p[2]==K_program, p[2]==K_interface, p[3], p[1]); }
7781 ()
7782
7783
7784 def p__embed1_module(p):
7785 '''_embed1_module : '''
7786
7787 # { pform_module_set_ports(p[8]); }
7788 ()
7789
7790
7791 def p__embed2_module(p):
7792 '''_embed2_module : '''
7793
7794 # { pform_set_scope_timescale(@2); }
7795 ()
7796
7797
7798 def p__embed3_module(p):
7799 '''_embed3_module : '''
7800
7801 # { Module::UCDriveType ucd;
7802 # // The lexor detected `unconnected_drive directives and
7803 # // marked what it found in the uc_drive variable. Use that
7804 # // to generate a UCD flag for the module.
7805 # switch (uc_drive) {
7806 # case UCD_NONE:
7807 # default:
7808 # ucd = Module::UCD_NONE;
7809 # break;
7810 # case UCD_PULL0:
7811 # ucd = Module::UCD_PULL0;
7812 # break;
7813 # case UCD_PULL1:
7814 # ucd = Module::UCD_PULL1;
7815 # break;
7816 # }
7817 # // Check that program/endprogram and module/endmodule
7818 # // keywords match.
7819 # if (p[2] != p[15]) {
7820 # switch (p[2]) {
7821 # case K_module:
7822 # yyerror(@15, "error: module not closed by endmodule.");
7823 # break;
7824 # case K_program:
7825 # yyerror(@15, "error: program not closed by endprogram.");
7826 # break;
7827 # case K_interface:
7828 # yyerror(@15, "error: interface not closed by endinterface.");
7829 # break;
7830 # default:
7831 # break;
7832 # }
7833 # }
7834 # pform_endmodule(p[4], in_celldefine, ucd);
7835 # }
7836 ()
7837
7838
7839 def p_module_start_1(p):
7840 '''module_start : K_module '''
7841 if(parse_debug > 1):
7842 print('module_start_1', list(p))
7843
7844 # { p[0] = K_module; }
7845 ()
7846
7847
7848 def p_module_start_2(p):
7849 '''module_start : K_macromodule '''
7850 if(parse_debug):
7851 print('module_start_2', list(p))
7852
7853 # { p[0] = K_module; }
7854 ()
7855
7856
7857 def p_module_start_3(p):
7858 '''module_start : K_program '''
7859 if(parse_debug):
7860 print('module_start_3', list(p))
7861
7862 # { p[0] = K_program; }
7863 ()
7864
7865
7866 def p_module_start_4(p):
7867 '''module_start : K_interface '''
7868 if(parse_debug):
7869 print('module_start_4', list(p))
7870
7871 # { p[0] = K_interface; }
7872 ()
7873
7874
7875 def p_module_end_1(p):
7876 '''module_end : K_endmodule '''
7877 if(parse_debug > 2):
7878 print('module_end_1', list(p))
7879
7880 # { p[0] = K_module; }
7881 ()
7882
7883
7884 def p_module_end_2(p):
7885 '''module_end : K_endprogram '''
7886 if(parse_debug):
7887 print('module_end_2', list(p))
7888
7889 # { p[0] = K_program; }
7890 ()
7891
7892
7893 def p_module_end_3(p):
7894 '''module_end : K_endinterface '''
7895 if(parse_debug):
7896 print('module_end_3', list(p))
7897
7898 # { p[0] = K_interface; }
7899 ()
7900
7901
7902 def p_endlabel_opt_1(p):
7903 '''endlabel_opt : ':' IDENTIFIER '''
7904 if(parse_debug):
7905 print('endlabel_opt_1', list(p))
7906 p[0] = p[2]
7907
7908
7909 ()
7910
7911
7912 def p_endlabel_opt_2(p):
7913 '''endlabel_opt : '''
7914 if(parse_debug > 2):
7915 print('endlabel_opt_2', list(p))
7916
7917 # { p[0] = None }
7918 ()
7919
7920
7921 def p_module_attribute_foreign_1(p):
7922 '''module_attribute_foreign : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP '''
7923 if(parse_debug):
7924 print('module_attribute_foreign_1', list(p))
7925
7926 # { p[0] = None }
7927 ()
7928
7929
7930 def p_module_attribute_foreign_2(p):
7931 '''module_attribute_foreign : '''
7932 if(parse_debug > 2):
7933 print('module_attribute_foreign_2', list(p))
7934
7935 # { p[0] = None }
7936 ()
7937
7938
7939 def p_module_port_list_opt_1(p):
7940 '''module_port_list_opt : '(' list_of_ports ')' '''
7941 if(parse_debug):
7942 print('module_port_list_opt_1', list(p))
7943 p[0] = p[2]
7944
7945
7946 ()
7947
7948
7949 def p_module_port_list_opt_2(p):
7950 '''module_port_list_opt : '(' list_of_port_declarations ')' '''
7951 if(parse_debug > 2):
7952 print('module_port_list_opt_2', list(p))
7953 p[0] = p[2]
7954
7955
7956 ()
7957
7958
7959 def p_module_port_list_opt_3(p):
7960 '''module_port_list_opt : '''
7961 if(parse_debug):
7962 print('module_port_list_opt_3', list(p))
7963
7964 # { p[0] = None }
7965 ()
7966
7967
7968 def p_module_port_list_opt_4(p):
7969 '''module_port_list_opt : '(' error ')' '''
7970 if(parse_debug):
7971 print('module_port_list_opt_4', list(p))
7972
7973 # { yyerror(@2, "Errors in port declarations.");
7974 # yyerrok;
7975 # p[0] = None
7976 # }
7977 ()
7978
7979
7980 def p_module_parameter_port_list_opt_1(p):
7981 '''module_parameter_port_list_opt : '''
7982 if(parse_debug > 2):
7983 print('module_parameter_port_list_opt_1', list(p))
7984
7985
7986 ()
7987
7988
7989 def p_module_parameter_port_list_opt_2(p):
7990 '''module_parameter_port_list_opt : '#' '(' module_parameter_port_list ')' '''
7991 if(parse_debug):
7992 print('module_parameter_port_list_opt_2', list(p))
7993 p[0] = p[3]
7994
7995
7996 ()
7997
7998
7999 def p_module_parameter_port_list_1(p):
8000 '''module_parameter_port_list : K_parameter param_type parameter_assign '''
8001 if(parse_debug):
8002 print('module_parameter_port_list_1', list(p))
8003 p[0] = [p[3]]
8004
8005
8006 ()
8007
8008
8009 def p_module_parameter_port_list_2(p):
8010 '''module_parameter_port_list : module_parameter_port_list ',' parameter_assign '''
8011 if(parse_debug):
8012 print('module_parameter_port_list_2', list(p))
8013 p[0] = p[1].append(p[3])
8014
8015
8016 ()
8017
8018
8019 def p_module_parameter_port_list_3(p):
8020 '''module_parameter_port_list : module_parameter_port_list ',' K_parameter param_type parameter_assign '''
8021 if(parse_debug):
8022 print('module_parameter_port_list_3', list(p))
8023 p[1].append(Leaf(token.COMMA, ','))
8024 p[1].append(Leaf(token.NEWLINE, '\n'))
8025 p[5].prefix = ' ' # add space after newline
8026 p[1].append(p[5])
8027 p[0] = p[1]
8028
8029
8030 ()
8031
8032
8033 def p_module_item_1(p):
8034 '''module_item : module '''
8035 if(parse_debug):
8036 print('module_item_1', list(p))
8037
8038
8039 ()
8040
8041
8042 def p_module_item_2(p):
8043 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' '''
8044 if(parse_debug):
8045 print('module_item_2', list(p))
8046
8047 # { data_type_t*data_type = p[3];
8048 # if (data_type == 0) {
8049 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8050 # FILE_NAME(data_type, @2);
8051 # }
8052 # pform_set_data_type(@2, data_type, p[5], p[2], p[1]);
8053 # if (p[4] != 0) {
8054 # yyerror(@2, "sorry: net delays not supported.");
8055 # delete p[4];
8056 # }
8057 # delete p[1];
8058 # }
8059 ()
8060
8061
8062 def p_module_item_3(p):
8063 '''module_item : attribute_list_opt K_wreal delay3 net_variable_list ';' '''
8064 if(parse_debug):
8065 print('module_item_3', list(p))
8066
8067 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
8068 # pform_set_data_type(@2, tmpt, p[4], NetNet::WIRE, p[1]);
8069 # if (p[3] != 0) {
8070 # yyerror(@3, "sorry: net delays not supported.");
8071 # delete p[3];
8072 # }
8073 # delete p[1];
8074 # }
8075 ()
8076
8077
8078 def p_module_item_4(p):
8079 '''module_item : attribute_list_opt K_wreal net_variable_list ';' '''
8080 if(parse_debug):
8081 print('module_item_4', list(p))
8082
8083 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
8084 # pform_set_data_type(@2, tmpt, p[3], NetNet::WIRE, p[1]);
8085 # delete p[1];
8086 # }
8087 ()
8088
8089
8090 def p_module_item_5(p):
8091 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_decl_assigns ';' '''
8092 if(parse_debug):
8093 print('module_item_5', list(p))
8094
8095 # { data_type_t*data_type = p[3];
8096 # if (data_type == 0) {
8097 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8098 # FILE_NAME(data_type, @2);
8099 # }
8100 # pform_makewire(@2, p[4], str_strength, p[5], p[2], data_type);
8101 # if (p[1]) {
8102 # yywarn(@2, "Attributes are not supported on net declaration "
8103 # "assignments and will be discarded.");
8104 # delete p[1];
8105 # }
8106 # }
8107 ()
8108
8109
8110 def p_module_item_6(p):
8111 '''module_item : attribute_list_opt net_type data_type_or_implicit drive_strength net_decl_assigns ';' '''
8112 if(parse_debug):
8113 print('module_item_6', list(p))
8114
8115 # { data_type_t*data_type = p[3];
8116 # if (data_type == 0) {
8117 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
8118 # FILE_NAME(data_type, @2);
8119 # }
8120 # pform_makewire(@2, 0, p[4], p[5], p[2], data_type);
8121 # if (p[1]) {
8122 # yywarn(@2, "Attributes are not supported on net declaration "
8123 # "assignments and will be discarded.");
8124 # delete p[1];
8125 # }
8126 # }
8127 ()
8128
8129
8130 def p_module_item_7(p):
8131 '''module_item : attribute_list_opt K_wreal net_decl_assigns ';' '''
8132 if(parse_debug):
8133 print('module_item_7', list(p))
8134
8135 # { real_type_t*data_type = new real_type_t(real_type_t::REAL);
8136 # pform_makewire(@2, 0, str_strength, p[3], NetNet::WIRE, data_type);
8137 # if (p[1]) {
8138 # yywarn(@2, "Attributes are not supported on net declaration "
8139 # "assignments and will be discarded.");
8140 # delete p[1];
8141 # }
8142 # }
8143 ()
8144
8145
8146 def p_module_item_8(p):
8147 '''module_item : K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' '''
8148 if(parse_debug):
8149 print('module_item_8', list(p))
8150
8151 # { yyerror(@1, "sorry: trireg nets not supported.");
8152 # delete p[3];
8153 # delete p[4];
8154 # }
8155 ()
8156
8157
8158 def p_module_item_9(p):
8159 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit list_of_port_identifiers ';' '''
8160 if(parse_debug):
8161 print('module_item_9', list(p))
8162
8163 # { pform_module_define_port(@2, p[5], p[2], p[3], p[4], p[1]); }
8164 ()
8165
8166
8167 def p_module_item_10(p):
8168 '''module_item : attribute_list_opt port_direction K_wreal list_of_port_identifiers ';' '''
8169 if(parse_debug):
8170 print('module_item_10', list(p))
8171
8172 # { real_type_t*real_type = new real_type_t(real_type_t::REAL);
8173 # pform_module_define_port(@2, p[4], p[2], NetNet::WIRE, real_type, p[1]);
8174 # }
8175 ()
8176
8177
8178 def p_module_item_11(p):
8179 '''module_item : attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' '''
8180 if(parse_debug):
8181 print('module_item_11', list(p))
8182
8183 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8184 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8185 # if (dtype->implicit_flag)
8186 # use_type = NetNet::NONE;
8187 # }
8188 # if (use_type == NetNet::NONE)
8189 # pform_set_port_type(@2, p[4], NetNet::PINOUT, p[3], p[1]);
8190 # else
8191 # pform_module_define_port(@2, p[4], NetNet::PINOUT, use_type, p[3], p[1]);
8192 # }
8193 ()
8194
8195
8196 def p_module_item_12(p):
8197 '''module_item : attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' '''
8198 if(parse_debug):
8199 print('module_item_12', list(p))
8200
8201 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8202 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8203 # if (dtype->implicit_flag)
8204 # use_type = NetNet::NONE;
8205 # }
8206 # if (use_type == NetNet::NONE)
8207 # pform_set_port_type(@2, p[4], NetNet::PINPUT, p[3], p[1]);
8208 # else
8209 # pform_module_define_port(@2, p[4], NetNet::PINPUT, use_type, p[3], p[1]);
8210 # }
8211 ()
8212
8213
8214 def p_module_item_13(p):
8215 '''module_item : attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' '''
8216 if(parse_debug):
8217 print('module_item_13', list(p))
8218
8219 # { NetNet::Type use_type = p[3] ? NetNet::IMPLICIT : NetNet::NONE;
8220 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (p[3])) {
8221 # if (dtype->implicit_flag)
8222 # use_type = NetNet::NONE;
8223 # else if (dtype->reg_flag)
8224 # use_type = NetNet::REG;
8225 # else
8226 # use_type = NetNet::IMPLICIT_REG;
8227 #
8228 # // The SystemVerilog types that can show up as
8229 # // output ports are implicitly (on the inside)
8230 # // variables because "reg" is not valid syntax
8231 # // here.
8232 # } else if (dynamic_cast<atom2_type_t*> (p[3])) {
8233 # use_type = NetNet::IMPLICIT_REG;
8234 # } else if (dynamic_cast<struct_type_t*> (p[3])) {
8235 # use_type = NetNet::IMPLICIT_REG;
8236 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> (p[3])) {
8237 # if(etype->base_type == IVL_VT_LOGIC)
8238 # use_type = NetNet::IMPLICIT_REG;
8239 # }
8240 # if (use_type == NetNet::NONE)
8241 # pform_set_port_type(@2, p[4], NetNet::POUTPUT, p[3], p[1]);
8242 # else
8243 # pform_module_define_port(@2, p[4], NetNet::POUTPUT, use_type, p[3], p[1]);
8244 # }
8245 ()
8246
8247
8248 def p_module_item_14(p):
8249 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit error ';' '''
8250 if(parse_debug):
8251 print('module_item_14', list(p))
8252
8253 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8254 # if (p[1]) delete p[1];
8255 # if (p[4]) delete p[4];
8256 # yyerrok;
8257 # }
8258 ()
8259
8260
8261 def p_module_item_15(p):
8262 '''module_item : attribute_list_opt K_inout data_type_or_implicit error ';' '''
8263 if(parse_debug):
8264 print('module_item_15', list(p))
8265
8266 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8267 # if (p[1]) delete p[1];
8268 # if (p[3]) delete p[3];
8269 # yyerrok;
8270 # }
8271 ()
8272
8273
8274 def p_module_item_16(p):
8275 '''module_item : attribute_list_opt K_input data_type_or_implicit error ';' '''
8276 if(parse_debug):
8277 print('module_item_16', list(p))
8278
8279 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8280 # if (p[1]) delete p[1];
8281 # if (p[3]) delete p[3];
8282 # yyerrok;
8283 # }
8284 ()
8285
8286
8287 def p_module_item_17(p):
8288 '''module_item : attribute_list_opt K_output data_type_or_implicit error ';' '''
8289 if(parse_debug):
8290 print('module_item_17', list(p))
8291
8292 # { yyerror(@2, "error: Invalid variable list in port declaration.");
8293 # if (p[1]) delete p[1];
8294 # if (p[3]) delete p[3];
8295 # yyerrok;
8296 # }
8297 ()
8298
8299
8300 def p_module_item_18(p):
8301 '''module_item : DISCIPLINE_IDENTIFIER list_of_identifiers ';' '''
8302 if(parse_debug):
8303 print('module_item_18', list(p))
8304
8305 # { pform_attach_discipline(@1, p[1], p[2]); }
8306 ()
8307
8308
8309 def p_module_item_19(p):
8310 '''module_item : attribute_list_opt _embed0_module_item block_item_decl '''
8311 if(parse_debug):
8312 print('module_item_19', list(p))
8313
8314 # { delete attributes_in_context;
8315 # attributes_in_context = 0;
8316 # }
8317 ()
8318
8319
8320 def p_module_item_20(p):
8321 '''module_item : K_defparam _embed1_module_item defparam_assign_list ';' '''
8322 if(parse_debug):
8323 print('module_item_20', list(p))
8324
8325
8326 ()
8327
8328
8329 def p_module_item_21(p):
8330 '''module_item : attribute_list_opt gatetype gate_instance_list ';' '''
8331 if(parse_debug):
8332 print('module_item_21', list(p))
8333
8334 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
8335 ()
8336
8337
8338 def p_module_item_22(p):
8339 '''module_item : attribute_list_opt gatetype delay3 gate_instance_list ';' '''
8340 if(parse_debug):
8341 print('module_item_22', list(p))
8342
8343 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
8344 ()
8345
8346
8347 def p_module_item_23(p):
8348 '''module_item : attribute_list_opt gatetype drive_strength gate_instance_list ';' '''
8349 if(parse_debug):
8350 print('module_item_23', list(p))
8351
8352 # { pform_makegates(@2, p[2], p[3], 0, p[4], p[1]); }
8353 ()
8354
8355
8356 def p_module_item_24(p):
8357 '''module_item : attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';' '''
8358 if(parse_debug):
8359 print('module_item_24', list(p))
8360
8361 # { pform_makegates(@2, p[2], p[3], p[4], p[5], p[1]); }
8362 ()
8363
8364
8365 def p_module_item_25(p):
8366 '''module_item : attribute_list_opt switchtype gate_instance_list ';' '''
8367 if(parse_debug):
8368 print('module_item_25', list(p))
8369
8370 # { pform_makegates(@2, p[2], str_strength, 0, p[3], p[1]); }
8371 ()
8372
8373
8374 def p_module_item_26(p):
8375 '''module_item : attribute_list_opt switchtype delay3 gate_instance_list ';' '''
8376 if(parse_debug):
8377 print('module_item_26', list(p))
8378
8379 # { pform_makegates(@2, p[2], str_strength, p[3], p[4], p[1]); }
8380 ()
8381
8382
8383 def p_module_item_27(p):
8384 '''module_item : K_pullup gate_instance_list ';' '''
8385 if(parse_debug):
8386 print('module_item_27', list(p))
8387
8388 # { pform_makegates(@1, PGBuiltin::PULLUP, pull_strength, 0, p[2], 0); }
8389 ()
8390
8391
8392 def p_module_item_28(p):
8393 '''module_item : K_pulldown gate_instance_list ';' '''
8394 if(parse_debug):
8395 print('module_item_28', list(p))
8396
8397 # { pform_makegates(@1, PGBuiltin::PULLDOWN, pull_strength, 0, p[2], 0); }
8398 ()
8399
8400
8401 def p_module_item_29(p):
8402 '''module_item : K_pullup '(' dr_strength1 ')' gate_instance_list ';' '''
8403 if(parse_debug):
8404 print('module_item_29', list(p))
8405
8406 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[5], 0); }
8407 ()
8408
8409
8410 def p_module_item_30(p):
8411 '''module_item : K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
8412 if(parse_debug):
8413 print('module_item_30', list(p))
8414
8415 # { pform_makegates(@1, PGBuiltin::PULLUP, p[3], 0, p[7], 0); }
8416 ()
8417
8418
8419 def p_module_item_31(p):
8420 '''module_item : K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
8421 if(parse_debug):
8422 print('module_item_31', list(p))
8423
8424 # { pform_makegates(@1, PGBuiltin::PULLUP, p[5], 0, p[7], 0); }
8425 ()
8426
8427
8428 def p_module_item_32(p):
8429 '''module_item : K_pulldown '(' dr_strength0 ')' gate_instance_list ';' '''
8430 if(parse_debug):
8431 print('module_item_32', list(p))
8432
8433 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[5], 0); }
8434 ()
8435
8436
8437 def p_module_item_33(p):
8438 '''module_item : K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
8439 if(parse_debug):
8440 print('module_item_33', list(p))
8441
8442 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[5], 0, p[7], 0); }
8443 ()
8444
8445
8446 def p_module_item_34(p):
8447 '''module_item : K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
8448 if(parse_debug):
8449 print('module_item_34', list(p))
8450
8451 # { pform_makegates(@1, PGBuiltin::PULLDOWN, p[3], 0, p[7], 0); }
8452 ()
8453
8454
8455 def p_module_item_35(p):
8456 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' '''
8457 if(parse_debug):
8458 print('module_item_35', list(p))
8459
8460 # { perm_string tmp1 = lex_strings.make(p[2]);
8461 # pform_make_modgates(@2, tmp1, p[3], p[4], p[1]);
8462 # delete[]p[2];
8463 # }
8464 ()
8465
8466
8467 def p_module_item_36(p):
8468 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt error ';' '''
8469 if(parse_debug):
8470 print('module_item_36', list(p))
8471
8472 # { yyerror(@2, "error: Invalid module instantiation");
8473 # delete[]p[2];
8474 # if (p[1]) delete p[1];
8475 # }
8476 ()
8477
8478
8479 def p_module_item_37(p):
8480 '''module_item : K_assign drive_strength_opt delay3_opt cont_assign_list ';' '''
8481 if(parse_debug > 2):
8482 print('module_item_37', list(p))
8483
8484 # { pform_make_pgassign_list(p[4], p[3], p[2], @1.text, @1.first_line); }
8485 ()
8486
8487
8488 def p_module_item_38(p):
8489 '''module_item : attribute_list_opt K_always statement_item '''
8490 if(parse_debug):
8491 print('module_item_38', list(p))
8492
8493 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, p[3], p[1]);
8494 # FILE_NAME(tmp, @2);
8495 # }
8496 ()
8497
8498
8499 def p_module_item_39(p):
8500 '''module_item : attribute_list_opt K_always_comb statement_item '''
8501 if(parse_debug):
8502 print('module_item_39', list(p))
8503
8504 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_COMB, p[3], p[1]);
8505 # FILE_NAME(tmp, @2);
8506 # }
8507 ()
8508
8509
8510 def p_module_item_40(p):
8511 '''module_item : attribute_list_opt K_always_ff statement_item '''
8512 if(parse_debug):
8513 print('module_item_40', list(p))
8514
8515 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, p[3], p[1]);
8516 # FILE_NAME(tmp, @2);
8517 # }
8518 ()
8519
8520
8521 def p_module_item_41(p):
8522 '''module_item : attribute_list_opt K_always_latch statement_item '''
8523 if(parse_debug):
8524 print('module_item_41', list(p))
8525
8526 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_LATCH, p[3], p[1]);
8527 # FILE_NAME(tmp, @2);
8528 # }
8529 ()
8530
8531
8532 def p_module_item_42(p):
8533 '''module_item : attribute_list_opt K_initial statement_item '''
8534 if(parse_debug):
8535 print('module_item_42', list(p))
8536
8537 # { PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, p[3], p[1]);
8538 # FILE_NAME(tmp, @2);
8539 # }
8540 ()
8541
8542
8543 def p_module_item_43(p):
8544 '''module_item : attribute_list_opt K_final statement_item '''
8545 if(parse_debug):
8546 print('module_item_43', list(p))
8547
8548 # { PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, p[3], p[1]);
8549 # FILE_NAME(tmp, @2);
8550 # }
8551 ()
8552
8553
8554 def p_module_item_44(p):
8555 '''module_item : attribute_list_opt K_analog analog_statement '''
8556 if(parse_debug):
8557 print('module_item_44', list(p))
8558
8559 # { pform_make_analog_behavior(@2, IVL_PR_ALWAYS, p[3]); }
8560 ()
8561
8562
8563 def p_module_item_45(p):
8564 '''module_item : attribute_list_opt assertion_item '''
8565 if(parse_debug):
8566 print('module_item_45', list(p))
8567
8568
8569 ()
8570
8571
8572 def p_module_item_46(p):
8573 '''module_item : timeunits_declaration '''
8574 if(parse_debug):
8575 print('module_item_46', list(p))
8576
8577
8578 ()
8579
8580
8581 def p_module_item_47(p):
8582 '''module_item : class_declaration '''
8583 if(parse_debug):
8584 print('module_item_47', list(p))
8585
8586
8587 ()
8588
8589
8590 def p_module_item_48(p):
8591 '''module_item : task_declaration '''
8592 if(parse_debug):
8593 print('module_item_48', list(p))
8594
8595
8596 ()
8597
8598
8599 def p_module_item_49(p):
8600 '''module_item : function_declaration '''
8601 if(parse_debug):
8602 print('module_item_49', list(p))
8603
8604
8605 ()
8606
8607
8608 def p_module_item_50(p):
8609 '''module_item : K_generate generate_item_list_opt K_endgenerate '''
8610 if(parse_debug):
8611 print('module_item_50', list(p))
8612
8613 # { // Test for bad nesting. I understand it, but it is illegal.
8614 # if (pform_parent_generate()) {
8615 # cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
8616 # cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
8617 # cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
8618 # error_count += 1;
8619 # }
8620 # }
8621 ()
8622
8623
8624 def p_module_item_51(p):
8625 '''module_item : K_genvar list_of_identifiers ';' '''
8626 if(parse_debug):
8627 print('module_item_51', list(p))
8628
8629 # { pform_genvars(@1, p[2]); }
8630 ()
8631
8632
8633 def p_module_item_52(p):
8634 '''module_item : K_for '(' IDENTIFIER '=' expression ';' expression ';' IDENTIFIER '=' expression ')' _embed2_module_item generate_block '''
8635 if(parse_debug):
8636 print('module_item_52', list(p))
8637
8638 # { pform_endgenerate(); }
8639 ()
8640
8641
8642 def p_module_item_53(p):
8643 '''module_item : generate_if generate_block_opt K_else _embed3_module_item generate_block '''
8644 if(parse_debug):
8645 print('module_item_53', list(p))
8646
8647 # { pform_endgenerate(); }
8648 ()
8649
8650
8651 def p_module_item_54(p):
8652 '''module_item : generate_if generate_block_opt %prec less_than_K_else '''
8653 if(parse_debug):
8654 print('module_item_54', list(p))
8655
8656 # { pform_endgenerate(); }
8657 ()
8658
8659
8660 def p_module_item_55(p):
8661 '''module_item : K_case '(' expression ')' _embed4_module_item generate_case_items K_endcase '''
8662 if(parse_debug):
8663 print('module_item_55', list(p))
8664
8665 # { pform_endgenerate(); }
8666 ()
8667
8668
8669 def p_module_item_56(p):
8670 '''module_item : modport_declaration '''
8671 if(parse_debug):
8672 print('module_item_56', list(p))
8673
8674
8675 ()
8676
8677
8678 def p_module_item_57(p):
8679 '''module_item : package_import_declaration '''
8680 if(parse_debug):
8681 print('module_item_57', list(p))
8682
8683
8684 ()
8685
8686
8687 def p_module_item_58(p):
8688 '''module_item : attribute_list_opt K_specparam _embed5_module_item specparam_decl ';' '''
8689 if(parse_debug):
8690 print('module_item_58', list(p))
8691
8692
8693 ()
8694
8695
8696 def p_module_item_59(p):
8697 '''module_item : K_specify _embed6_module_item specify_item_list_opt K_endspecify '''
8698 if(parse_debug):
8699 print('module_item_59', list(p))
8700
8701
8702 ()
8703
8704
8705 def p_module_item_60(p):
8706 '''module_item : K_specify error K_endspecify '''
8707 if(parse_debug):
8708 print('module_item_60', list(p))
8709
8710 # { yyerror(@1, "error: syntax error in specify block");
8711 # yyerrok;
8712 # }
8713 ()
8714
8715
8716 def p_module_item_61(p):
8717 '''module_item : error ';' '''
8718 if(parse_debug):
8719 print('module_item_61', list(p))
8720
8721 # { yyerror(@2, "error: invalid module item.");
8722 # yyerrok;
8723 # }
8724 ()
8725
8726
8727 def p_module_item_62(p):
8728 '''module_item : K_assign error '=' expression ';' '''
8729 if(parse_debug):
8730 print('module_item_62', list(p))
8731
8732 # { yyerror(@1, "error: syntax error in left side "
8733 # "of continuous assignment.");
8734 # yyerrok;
8735 # }
8736 ()
8737
8738
8739 def p_module_item_63(p):
8740 '''module_item : K_assign error ';' '''
8741 if(parse_debug):
8742 print('module_item_63', list(p))
8743
8744 # { yyerror(@1, "error: syntax error in "
8745 # "continuous assignment");
8746 # yyerrok;
8747 # }
8748 ()
8749
8750
8751 def p_module_item_64(p):
8752 '''module_item : K_function error K_endfunction endlabel_opt '''
8753 if(parse_debug):
8754 print('module_item_64', list(p))
8755
8756 # { yyerror(@1, "error: I give up on this "
8757 # "function definition.");
8758 # if (p[4]) {
8759 # if (!gn_system_verilog()) {
8760 # yyerror(@4, "error: Function end names require "
8761 # "SystemVerilog.");
8762 # }
8763 # delete[]p[4];
8764 # }
8765 # yyerrok;
8766 # }
8767 ()
8768
8769
8770 def p_module_item_65(p):
8771 '''module_item : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';' '''
8772 if(parse_debug):
8773 print('module_item_65', list(p))
8774
8775 # { perm_string tmp3 = lex_strings.make(p[3]);
8776 # perm_string tmp5 = lex_strings.make(p[5]);
8777 # pform_set_attrib(tmp3, tmp5, p[7]);
8778 # delete[] p[3];
8779 # delete[] p[5];
8780 # }
8781 ()
8782
8783
8784 def p_module_item_66(p):
8785 '''module_item : KK_attribute '(' error ')' ';' '''
8786 if(parse_debug):
8787 print('module_item_66', list(p))
8788
8789 # { yyerror(@1, "error: Malformed $attribute parameter list."); }
8790 ()
8791
8792
8793 def p__embed0_module_item(p):
8794 '''_embed0_module_item : '''
8795
8796 # { attributes_in_context = p[1]; }
8797 ()
8798
8799
8800 def p__embed1_module_item(p):
8801 '''_embed1_module_item : '''
8802
8803 # { if (pform_in_interface())
8804 # yyerror(@1, "error: Parameter overrides are not allowed "
8805 # "in interfaces.");
8806 # }
8807 ()
8808
8809
8810 def p__embed2_module_item(p):
8811 '''_embed2_module_item : '''
8812
8813 # { pform_start_generate_for(@1, p[3], p[5], p[7], p[9], p[11]); }
8814 ()
8815
8816
8817 def p__embed3_module_item(p):
8818 '''_embed3_module_item : '''
8819
8820 # { pform_start_generate_else(@1); }
8821 ()
8822
8823
8824 def p__embed4_module_item(p):
8825 '''_embed4_module_item : '''
8826
8827 # { pform_start_generate_case(@1, p[3]); }
8828 ()
8829
8830
8831 def p__embed5_module_item(p):
8832 '''_embed5_module_item : '''
8833
8834 # { if (pform_in_interface())
8835 # yyerror(@1, "error: specparam declarations are not allowed "
8836 # "in interfaces.");
8837 # }
8838 ()
8839
8840
8841 def p__embed6_module_item(p):
8842 '''_embed6_module_item : '''
8843
8844 # { if (pform_in_interface())
8845 # yyerror(@1, "error: specify blocks are not allowed "
8846 # "in interfaces.");
8847 # }
8848 ()
8849
8850
8851 def p_module_item_list_1(p):
8852 '''module_item_list : module_item_list module_item '''
8853 if(parse_debug):
8854 print('module_item_list_1', list(p))
8855
8856
8857 ()
8858
8859
8860 def p_module_item_list_2(p):
8861 '''module_item_list : module_item '''
8862 if(parse_debug > 2):
8863 print('module_item_list_2', list(p))
8864
8865
8866 ()
8867
8868
8869 def p_module_item_list_opt_1(p):
8870 '''module_item_list_opt : module_item_list '''
8871 if(parse_debug > 2):
8872 print('module_item_list_opt_1', list(p))
8873
8874
8875 ()
8876
8877
8878 def p_module_item_list_opt_2(p):
8879 '''module_item_list_opt : '''
8880 if(parse_debug):
8881 print('module_item_list_opt_2', list(p))
8882
8883
8884 ()
8885
8886
8887 def p_generate_if_1(p):
8888 '''generate_if : K_if '(' expression ')' '''
8889 if(parse_debug):
8890 print('generate_if_1', list(p))
8891
8892 # { pform_start_generate_if(@1, p[3]); }
8893 ()
8894
8895
8896 def p_generate_case_items_1(p):
8897 '''generate_case_items : generate_case_items generate_case_item '''
8898 if(parse_debug):
8899 print('generate_case_items_1', list(p))
8900
8901
8902 ()
8903
8904
8905 def p_generate_case_items_2(p):
8906 '''generate_case_items : generate_case_item '''
8907 if(parse_debug):
8908 print('generate_case_items_2', list(p))
8909
8910
8911 ()
8912
8913
8914 def p_generate_case_item_1(p):
8915 '''generate_case_item : expression_list_proper ':' _embed0_generate_case_item generate_block_opt '''
8916 if(parse_debug):
8917 print('generate_case_item_1', list(p))
8918
8919 # { pform_endgenerate(); }
8920 ()
8921
8922
8923 def p_generate_case_item_2(p):
8924 '''generate_case_item : K_default ':' _embed1_generate_case_item generate_block_opt '''
8925 if(parse_debug):
8926 print('generate_case_item_2', list(p))
8927
8928 # { pform_endgenerate(); }
8929 ()
8930
8931
8932 def p__embed0_generate_case_item(p):
8933 '''_embed0_generate_case_item : '''
8934
8935 # { pform_generate_case_item(@1, p[1]); }
8936 ()
8937
8938
8939 def p__embed1_generate_case_item(p):
8940 '''_embed1_generate_case_item : '''
8941
8942 # { pform_generate_case_item(@1, 0); }
8943 ()
8944
8945
8946 def p_generate_item_1(p):
8947 '''generate_item : module_item '''
8948 if(parse_debug):
8949 print('generate_item_1', list(p))
8950
8951
8952 ()
8953
8954
8955 def p_generate_item_2(p):
8956 '''generate_item : K_begin generate_item_list_opt K_end '''
8957 if(parse_debug):
8958 print('generate_item_2', list(p))
8959
8960 # { /* Detect and warn about anachronistic begin/end use */
8961 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
8962 # warn_count += 1;
8963 # cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
8964 # }
8965 # }
8966 ()
8967
8968
8969 def p_generate_item_3(p):
8970 '''generate_item : K_begin ':' IDENTIFIER _embed0_generate_item generate_item_list_opt K_end '''
8971 if(parse_debug):
8972 print('generate_item_3', list(p))
8973
8974 # { /* Detect and warn about anachronistic named begin/end use */
8975 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
8976 # warn_count += 1;
8977 # cerr << @1 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
8978 # }
8979 # pform_endgenerate();
8980 # }
8981 ()
8982
8983
8984 def p__embed0_generate_item(p):
8985 '''_embed0_generate_item : '''
8986
8987 # {
8988 # pform_start_generate_nblock(@1, p[3]);
8989 # }
8990 ()
8991
8992
8993 def p_generate_item_list_1(p):
8994 '''generate_item_list : generate_item_list generate_item '''
8995 if(parse_debug):
8996 print('generate_item_list_1', list(p))
8997
8998
8999 ()
9000
9001
9002 def p_generate_item_list_2(p):
9003 '''generate_item_list : generate_item '''
9004 if(parse_debug):
9005 print('generate_item_list_2', list(p))
9006
9007
9008 ()
9009
9010
9011 def p_generate_item_list_opt_1(p):
9012 '''generate_item_list_opt : generate_item_list '''
9013 if(parse_debug):
9014 print('generate_item_list_opt_1', list(p))
9015
9016
9017 ()
9018
9019
9020 def p_generate_item_list_opt_2(p):
9021 '''generate_item_list_opt : '''
9022 if(parse_debug):
9023 print('generate_item_list_opt_2', list(p))
9024
9025
9026 ()
9027
9028
9029 def p_generate_block_1(p):
9030 '''generate_block : module_item '''
9031 if(parse_debug):
9032 print('generate_block_1', list(p))
9033
9034
9035 ()
9036
9037
9038 def p_generate_block_2(p):
9039 '''generate_block : K_begin generate_item_list_opt K_end '''
9040 if(parse_debug):
9041 print('generate_block_2', list(p))
9042
9043
9044 ()
9045
9046
9047 def p_generate_block_3(p):
9048 '''generate_block : K_begin ':' IDENTIFIER generate_item_list_opt K_end endlabel_opt '''
9049 if(parse_debug):
9050 print('generate_block_3', list(p))
9051
9052 # { pform_generate_block_name(p[3]);
9053 # if (p[6]) {
9054 # if (strcmp(p[3],p[6]) != 0) {
9055 # yyerror(@6, "error: End label doesn't match "
9056 # "begin name");
9057 # }
9058 # if (! gn_system_verilog()) {
9059 # yyerror(@6, "error: Begin end labels require "
9060 # "SystemVerilog.");
9061 # }
9062 # delete[]p[6];
9063 # }
9064 # delete[]p[3];
9065 # }
9066 ()
9067
9068
9069 def p_generate_block_opt_1(p):
9070 '''generate_block_opt : generate_block '''
9071 if(parse_debug):
9072 print('generate_block_opt_1', list(p))
9073
9074
9075 ()
9076
9077
9078 def p_generate_block_opt_2(p):
9079 '''generate_block_opt : ';' '''
9080 if(parse_debug):
9081 print('generate_block_opt_2', list(p))
9082
9083
9084 ()
9085
9086
9087 def p_net_decl_assign_1(p):
9088 '''net_decl_assign : IDENTIFIER '=' expression '''
9089 if(parse_debug):
9090 print('net_decl_assign_1', list(p))
9091
9092 # { net_decl_assign_t*tmp = new net_decl_assign_t;
9093 # tmp->next = tmp;
9094 # tmp->name = lex_strings.make(p[1]);
9095 # tmp->expr = p[3];
9096 # delete[]p[1];
9097 # p[0] = tmp;
9098 # }
9099 ()
9100
9101
9102 def p_net_decl_assigns_1(p):
9103 '''net_decl_assigns : net_decl_assigns ',' net_decl_assign '''
9104 if(parse_debug):
9105 print('net_decl_assigns_1', list(p))
9106
9107 # { net_decl_assign_t*tmp = p[1];
9108 # p[3]->next = tmp->next;
9109 # tmp->next = p[3];
9110 # p[0] = tmp;
9111 # }
9112 ()
9113
9114
9115 def p_net_decl_assigns_2(p):
9116 '''net_decl_assigns : net_decl_assign '''
9117 if(parse_debug):
9118 print('net_decl_assigns_2', list(p))
9119
9120 # { p[0] = p[1];
9121 # }
9122 ()
9123
9124
9125 def p_bit_logic_1(p):
9126 '''bit_logic : K_logic '''
9127 if(parse_debug):
9128 print('bit_logic_1', list(p))
9129
9130 # { p[0] = IVL_VT_LOGIC; }
9131 ()
9132
9133
9134 def p_bit_logic_2(p):
9135 '''bit_logic : K_bool '''
9136 if(parse_debug):
9137 print('bit_logic_2', list(p))
9138
9139 # { p[0] = IVL_VT_BOOL; /* Icarus misc */}
9140 ()
9141
9142
9143 def p_bit_logic_3(p):
9144 '''bit_logic : K_bit '''
9145 if(parse_debug):
9146 print('bit_logic_3', list(p))
9147
9148 # { p[0] = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
9149 ()
9150
9151
9152 def p_bit_logic_opt_1(p):
9153 '''bit_logic_opt : bit_logic '''
9154 if(parse_debug):
9155 print('bit_logic_opt_1', list(p))
9156
9157
9158 ()
9159
9160
9161 def p_bit_logic_opt_2(p):
9162 '''bit_logic_opt : '''
9163 if(parse_debug):
9164 print('bit_logic_opt_2', list(p))
9165
9166 # { p[0] = IVL_VT_NO_TYPE; }
9167 ()
9168
9169
9170 def p_net_type_1(p):
9171 '''net_type : K_wire '''
9172 if(parse_debug):
9173 print('net_type_1', list(p))
9174
9175 # { p[0] = NetNet::WIRE; }
9176 ()
9177
9178
9179 def p_net_type_2(p):
9180 '''net_type : K_tri '''
9181 if(parse_debug):
9182 print('net_type_2', list(p))
9183
9184 # { p[0] = NetNet::TRI; }
9185 ()
9186
9187
9188 def p_net_type_3(p):
9189 '''net_type : K_tri1 '''
9190 if(parse_debug):
9191 print('net_type_3', list(p))
9192
9193 # { p[0] = NetNet::TRI1; }
9194 ()
9195
9196
9197 def p_net_type_4(p):
9198 '''net_type : K_supply0 '''
9199 if(parse_debug):
9200 print('net_type_4', list(p))
9201
9202 # { p[0] = NetNet::SUPPLY0; }
9203 ()
9204
9205
9206 def p_net_type_5(p):
9207 '''net_type : K_wand '''
9208 if(parse_debug):
9209 print('net_type_5', list(p))
9210
9211 # { p[0] = NetNet::WAND; }
9212 ()
9213
9214
9215 def p_net_type_6(p):
9216 '''net_type : K_triand '''
9217 if(parse_debug):
9218 print('net_type_6', list(p))
9219
9220 # { p[0] = NetNet::TRIAND; }
9221 ()
9222
9223
9224 def p_net_type_7(p):
9225 '''net_type : K_tri0 '''
9226 if(parse_debug):
9227 print('net_type_7', list(p))
9228
9229 # { p[0] = NetNet::TRI0; }
9230 ()
9231
9232
9233 def p_net_type_8(p):
9234 '''net_type : K_supply1 '''
9235 if(parse_debug):
9236 print('net_type_8', list(p))
9237
9238 # { p[0] = NetNet::SUPPLY1; }
9239 ()
9240
9241
9242 def p_net_type_9(p):
9243 '''net_type : K_wor '''
9244 if(parse_debug):
9245 print('net_type_9', list(p))
9246
9247 # { p[0] = NetNet::WOR; }
9248 ()
9249
9250
9251 def p_net_type_10(p):
9252 '''net_type : K_trior '''
9253 if(parse_debug):
9254 print('net_type_10', list(p))
9255
9256 # { p[0] = NetNet::TRIOR; }
9257 ()
9258
9259
9260 def p_net_type_11(p):
9261 '''net_type : K_wone '''
9262 if(parse_debug):
9263 print('net_type_11', list(p))
9264
9265 # { p[0] = NetNet::UNRESOLVED_WIRE;
9266 # cerr << @1.text << ":" << @1.first_line << ": warning: "
9267 # "'wone' is deprecated, please use 'uwire' "
9268 # "instead." << endl;
9269 # }
9270 ()
9271
9272
9273 def p_net_type_12(p):
9274 '''net_type : K_uwire '''
9275 if(parse_debug):
9276 print('net_type_12', list(p))
9277
9278 # { p[0] = NetNet::UNRESOLVED_WIRE; }
9279 ()
9280
9281
9282 def p_param_type_1(p):
9283 '''param_type : bit_logic_opt unsigned_signed_opt dimensions_opt '''
9284 if(parse_debug):
9285 print('param_type_1', list(p))
9286
9287 # { param_active_range = p[3];
9288 # param_active_signed = p[2];
9289 # if ((p[1] == IVL_VT_NO_TYPE) && (p[3] != 0))
9290 # param_active_type = IVL_VT_LOGIC;
9291 # else
9292 # param_active_type = p[1];
9293 # }
9294 ()
9295
9296
9297 def p_param_type_2(p):
9298 '''param_type : K_integer '''
9299 if(parse_debug):
9300 print('param_type_2', list(p))
9301
9302 # { param_active_range = make_range_from_width(integer_width);
9303 # param_active_signed = true;
9304 # param_active_type = IVL_VT_LOGIC;
9305 # }
9306 ()
9307
9308
9309 def p_param_type_3(p):
9310 '''param_type : K_time '''
9311 if(parse_debug):
9312 print('param_type_3', list(p))
9313
9314 # { param_active_range = make_range_from_width(64);
9315 # param_active_signed = false;
9316 # param_active_type = IVL_VT_LOGIC;
9317 # }
9318 ()
9319
9320
9321 def p_param_type_4(p):
9322 '''param_type : real_or_realtime '''
9323 if(parse_debug):
9324 print('param_type_4', list(p))
9325
9326 # { param_active_range = 0;
9327 # param_active_signed = true;
9328 # param_active_type = IVL_VT_REAL;
9329 # }
9330 ()
9331
9332
9333 def p_param_type_5(p):
9334 '''param_type : atom2_type '''
9335 if(parse_debug):
9336 print('param_type_5', list(p))
9337
9338 # { param_active_range = make_range_from_width(p[1]);
9339 # param_active_signed = true;
9340 # param_active_type = IVL_VT_BOOL;
9341 # }
9342 ()
9343
9344
9345 def p_param_type_6(p):
9346 '''param_type : TYPE_IDENTIFIER '''
9347 if(parse_debug):
9348 print('param_type_6', list(p))
9349
9350 # { pform_set_param_from_type(@1, p[1].type, p[1].text, param_active_range,
9351 # param_active_signed, param_active_type);
9352 # delete[]p[1].text;
9353 # }
9354 ()
9355
9356
9357 def p_parameter_assign_list_1(p):
9358 '''parameter_assign_list : parameter_assign '''
9359 if(parse_debug):
9360 print('parameter_assign_list_1', list(p))
9361
9362
9363 ()
9364
9365
9366 def p_parameter_assign_list_2(p):
9367 '''parameter_assign_list : parameter_assign_list ',' parameter_assign '''
9368 if(parse_debug):
9369 print('parameter_assign_list_2', list(p))
9370
9371
9372 ()
9373
9374
9375 def p_localparam_assign_list_1(p):
9376 '''localparam_assign_list : localparam_assign '''
9377 if(parse_debug):
9378 print('localparam_assign_list_1', list(p))
9379
9380
9381 ()
9382
9383
9384 def p_localparam_assign_list_2(p):
9385 '''localparam_assign_list : localparam_assign_list ',' localparam_assign '''
9386 if(parse_debug):
9387 print('localparam_assign_list_2', list(p))
9388
9389
9390 ()
9391
9392
9393 def p_parameter_assign_1(p):
9394 '''parameter_assign : IDENTIFIER '=' expression parameter_value_ranges_opt '''
9395 if(parse_debug):
9396 print('parameter_assign_1', list(p))
9397 tpname = Node(syms.tname, [Leaf(token.NAME, p[1])])
9398 expr = Node(syms.tfpdef, [tpname, Leaf(token.EQUAL, p[2]), p[3]])
9399 p[0] = expr
9400
9401 # { PExpr*tmp = p[3];
9402 # pform_set_parameter(@1, lex_strings.make(p[1]), param_active_type,
9403 # param_active_signed, param_active_range, tmp, p[4]);
9404 # delete[]p[1];
9405 # }
9406 ()
9407
9408
9409 def p_localparam_assign_1(p):
9410 '''localparam_assign : IDENTIFIER '=' expression '''
9411 if(parse_debug):
9412 print('localparam_assign_1', list(p))
9413
9414 # { PExpr*tmp = p[3];
9415 # pform_set_localparam(@1, lex_strings.make(p[1]), param_active_type,
9416 # param_active_signed, param_active_range, tmp);
9417 # delete[]p[1];
9418 # }
9419 ()
9420
9421
9422 def p_parameter_value_ranges_opt_1(p):
9423 '''parameter_value_ranges_opt : parameter_value_ranges '''
9424 if(parse_debug):
9425 print('parameter_value_ranges_opt_1', list(p))
9426 p[0] = p[1]
9427
9428
9429 ()
9430
9431
9432 def p_parameter_value_ranges_opt_2(p):
9433 '''parameter_value_ranges_opt : '''
9434 if(parse_debug):
9435 print('parameter_value_ranges_opt_2', list(p))
9436
9437 # { p[0] = None }
9438 ()
9439
9440
9441 def p_parameter_value_ranges_1(p):
9442 '''parameter_value_ranges : parameter_value_ranges parameter_value_range '''
9443 if(parse_debug):
9444 print('parameter_value_ranges_1', list(p))
9445
9446 # { p[0] = p[2]; p[0]->next = p[1]; }
9447 ()
9448
9449
9450 def p_parameter_value_ranges_2(p):
9451 '''parameter_value_ranges : parameter_value_range '''
9452 if(parse_debug):
9453 print('parameter_value_ranges_2', list(p))
9454
9455 # { p[0] = p[1]; p[0]->next = 0; }
9456 ()
9457
9458
9459 def p_parameter_value_range_1(p):
9460 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ']' '''
9461 if(parse_debug):
9462 print('parameter_value_range_1', list(p))
9463
9464 # { p[0] = pform_parameter_value_range(p[1], false, p[3], false, p[5]); }
9465 ()
9466
9467
9468 def p_parameter_value_range_2(p):
9469 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ')' '''
9470 if(parse_debug):
9471 print('parameter_value_range_2', list(p))
9472
9473 # { p[0] = pform_parameter_value_range(p[1], false, p[3], true, p[5]); }
9474 ()
9475
9476
9477 def p_parameter_value_range_3(p):
9478 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ']' '''
9479 if(parse_debug):
9480 print('parameter_value_range_3', list(p))
9481
9482 # { p[0] = pform_parameter_value_range(p[1], true, p[3], false, p[5]); }
9483 ()
9484
9485
9486 def p_parameter_value_range_4(p):
9487 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ')' '''
9488 if(parse_debug):
9489 print('parameter_value_range_4', list(p))
9490
9491 # { p[0] = pform_parameter_value_range(p[1], true, p[3], true, p[5]); }
9492 ()
9493
9494
9495 def p_parameter_value_range_5(p):
9496 '''parameter_value_range : K_exclude expression '''
9497 if(parse_debug):
9498 print('parameter_value_range_5', list(p))
9499
9500 # { p[0] = pform_parameter_value_range(true, false, p[2], false, p[2]); }
9501 ()
9502
9503
9504 def p_value_range_expression_1(p):
9505 '''value_range_expression : expression '''
9506 if(parse_debug):
9507 print('value_range_expression_1', list(p))
9508 p[0] = p[1]
9509
9510
9511 ()
9512
9513
9514 def p_value_range_expression_2(p):
9515 '''value_range_expression : K_inf '''
9516 if(parse_debug):
9517 print('value_range_expression_2', list(p))
9518
9519 # { p[0] = None }
9520 ()
9521
9522
9523 def p_value_range_expression_3(p):
9524 '''value_range_expression : '+' K_inf '''
9525 if(parse_debug):
9526 print('value_range_expression_3', list(p))
9527
9528 # { p[0] = None }
9529 ()
9530
9531
9532 def p_value_range_expression_4(p):
9533 '''value_range_expression : '-' K_inf '''
9534 if(parse_debug):
9535 print('value_range_expression_4', list(p))
9536
9537 # { p[0] = None }
9538 ()
9539
9540
9541 def p_from_exclude_1(p):
9542 '''from_exclude : K_from '''
9543 if(parse_debug):
9544 print('from_exclude_1', list(p))
9545 p[0] = False
9546
9547
9548 ()
9549
9550
9551 def p_from_exclude_2(p):
9552 '''from_exclude : K_exclude '''
9553 if(parse_debug):
9554 print('from_exclude_2', list(p))
9555 p[0] = True
9556
9557
9558 ()
9559
9560
9561 def p_parameter_value_opt_1(p):
9562 '''parameter_value_opt : '#' '(' expression_list_with_nuls ')' '''
9563 if(parse_debug):
9564 print('parameter_value_opt_1', list(p))
9565
9566 # { struct parmvalue_t*tmp = new struct parmvalue_t;
9567 # tmp->by_order = p[3];
9568 # tmp->by_name = 0;
9569 # p[0] = tmp;
9570 # }
9571 ()
9572
9573
9574 def p_parameter_value_opt_2(p):
9575 '''parameter_value_opt : '#' '(' parameter_value_byname_list ')' '''
9576 if(parse_debug):
9577 print('parameter_value_opt_2', list(p))
9578
9579 # { struct parmvalue_t*tmp = new struct parmvalue_t;
9580 # tmp->by_order = 0;
9581 # tmp->by_name = p[3];
9582 # p[0] = tmp;
9583 # }
9584 ()
9585
9586
9587 def p_parameter_value_opt_3(p):
9588 '''parameter_value_opt : '#' DEC_NUMBER '''
9589 if(parse_debug):
9590 print('parameter_value_opt_3', list(p))
9591
9592 # { assert(p[2]);
9593 # PENumber*tmp = new PENumber(p[2]);
9594 # FILE_NAME(tmp, @1);
9595 #
9596 # struct parmvalue_t*lst = new struct parmvalue_t;
9597 # lst->by_order = new list<PExpr*>;
9598 # lst->by_order->push_back(tmp);
9599 # lst->by_name = 0;
9600 # p[0] = lst;
9601 # based_size = 0;
9602 # }
9603 ()
9604
9605
9606 def p_parameter_value_opt_4(p):
9607 '''parameter_value_opt : '#' REALTIME '''
9608 if(parse_debug):
9609 print('parameter_value_opt_4', list(p))
9610
9611 # { assert(p[2]);
9612 # PEFNumber*tmp = new PEFNumber(p[2]);
9613 # FILE_NAME(tmp, @1);
9614 #
9615 # struct parmvalue_t*lst = new struct parmvalue_t;
9616 # lst->by_order = new list<PExpr*>;
9617 # lst->by_order->push_back(tmp);
9618 # lst->by_name = 0;
9619 # p[0] = lst;
9620 # }
9621 ()
9622
9623
9624 def p_parameter_value_opt_5(p):
9625 '''parameter_value_opt : '#' error '''
9626 if(parse_debug):
9627 print('parameter_value_opt_5', list(p))
9628
9629 # { yyerror(@1, "error: syntax error in parameter value "
9630 # "assignment list.");
9631 # p[0] = None
9632 # }
9633 ()
9634
9635
9636 def p_parameter_value_opt_6(p):
9637 '''parameter_value_opt : '''
9638 if(parse_debug):
9639 print('parameter_value_opt_6', list(p))
9640
9641 # { p[0] = None }
9642 ()
9643
9644
9645 def p_parameter_value_byname_1(p):
9646 '''parameter_value_byname : '.' IDENTIFIER '(' expression ')' '''
9647 if(parse_debug):
9648 print('parameter_value_byname_1', list(p))
9649
9650 # { named_pexpr_t*tmp = new named_pexpr_t;
9651 # tmp->name = lex_strings.make(p[2]);
9652 # tmp->parm = p[4];
9653 # delete[]p[2];
9654 # p[0] = tmp;
9655 # }
9656 ()
9657
9658
9659 def p_parameter_value_byname_2(p):
9660 '''parameter_value_byname : '.' IDENTIFIER '(' ')' '''
9661 if(parse_debug):
9662 print('parameter_value_byname_2', list(p))
9663
9664 # { named_pexpr_t*tmp = new named_pexpr_t;
9665 # tmp->name = lex_strings.make(p[2]);
9666 # tmp->parm = 0;
9667 # delete[]p[2];
9668 # p[0] = tmp;
9669 # }
9670 ()
9671
9672
9673 def p_parameter_value_byname_list_1(p):
9674 '''parameter_value_byname_list : parameter_value_byname '''
9675 if(parse_debug):
9676 print('parameter_value_byname_list_1', list(p))
9677
9678 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
9679 # tmp->push_back(*p[1]);
9680 # delete p[1];
9681 # p[0] = tmp;
9682 # }
9683 ()
9684
9685
9686 def p_parameter_value_byname_list_2(p):
9687 '''parameter_value_byname_list : parameter_value_byname_list ',' parameter_value_byname '''
9688 if(parse_debug):
9689 print('parameter_value_byname_list_2', list(p))
9690
9691 # { list<named_pexpr_t>*tmp = p[1];
9692 # tmp->push_back(*p[3]);
9693 # delete p[3];
9694 # p[0] = tmp;
9695 # }
9696 ()
9697
9698
9699 def p_port_1(p):
9700 '''port : port_reference '''
9701 if(parse_debug):
9702 print('port_1', list(p))
9703 p[0] = p[1]
9704
9705
9706 ()
9707
9708
9709 def p_port_2(p):
9710 '''port : '.' IDENTIFIER '(' port_reference ')' '''
9711 if(parse_debug):
9712 print('port_2', list(p))
9713
9714 # { Module::port_t*tmp = p[4];
9715 # tmp->name = lex_strings.make(p[2]);
9716 # delete[]p[2];
9717 # p[0] = tmp;
9718 # }
9719 ()
9720
9721
9722 def p_port_3(p):
9723 '''port : '{' port_reference_list '}' '''
9724 if(parse_debug):
9725 print('port_3', list(p))
9726
9727 # { Module::port_t*tmp = p[2];
9728 # tmp->name = perm_string();
9729 # p[0] = tmp;
9730 # }
9731 ()
9732
9733
9734 def p_port_4(p):
9735 '''port : '.' IDENTIFIER '(' '{' port_reference_list '}' ')' '''
9736 if(parse_debug):
9737 print('port_4', list(p))
9738
9739 # { Module::port_t*tmp = p[5];
9740 # tmp->name = lex_strings.make(p[2]);
9741 # delete[]p[2];
9742 # p[0] = tmp;
9743 # }
9744 ()
9745
9746
9747 def p_port_opt_1(p):
9748 '''port_opt : port '''
9749 if(parse_debug):
9750 print('port_opt_1', list(p))
9751 p[0] = p[1]
9752
9753
9754 ()
9755
9756
9757 def p_port_opt_2(p):
9758 '''port_opt : '''
9759 if(parse_debug):
9760 print('port_opt_2', list(p))
9761
9762 # { p[0] = None }
9763 ()
9764
9765
9766 def p_port_name_1(p):
9767 '''port_name : '.' IDENTIFIER '(' expression ')' '''
9768 if(parse_debug):
9769 print('port_name_1', list(p))
9770
9771 # { named_pexpr_t*tmp = new named_pexpr_t;
9772 # tmp->name = lex_strings.make(p[2]);
9773 # tmp->parm = p[4];
9774 # delete[]p[2];
9775 # p[0] = tmp;
9776 # }
9777 ()
9778
9779
9780 def p_port_name_2(p):
9781 '''port_name : '.' IDENTIFIER '(' error ')' '''
9782 if(parse_debug):
9783 print('port_name_2', list(p))
9784
9785 # { yyerror(@3, "error: invalid port connection expression.");
9786 # named_pexpr_t*tmp = new named_pexpr_t;
9787 # tmp->name = lex_strings.make(p[2]);
9788 # tmp->parm = 0;
9789 # delete[]p[2];
9790 # p[0] = tmp;
9791 # }
9792 ()
9793
9794
9795 def p_port_name_3(p):
9796 '''port_name : '.' IDENTIFIER '(' ')' '''
9797 if(parse_debug):
9798 print('port_name_3', list(p))
9799
9800 # { named_pexpr_t*tmp = new named_pexpr_t;
9801 # tmp->name = lex_strings.make(p[2]);
9802 # tmp->parm = 0;
9803 # delete[]p[2];
9804 # p[0] = tmp;
9805 # }
9806 ()
9807
9808
9809 def p_port_name_4(p):
9810 '''port_name : '.' IDENTIFIER '''
9811 if(parse_debug):
9812 print('port_name_4', list(p))
9813
9814 # { named_pexpr_t*tmp = new named_pexpr_t;
9815 # tmp->name = lex_strings.make(p[2]);
9816 # tmp->parm = new PEIdent(lex_strings.make(p[2]), true);
9817 # FILE_NAME(tmp->parm, @1);
9818 # delete[]p[2];
9819 # p[0] = tmp;
9820 # }
9821 ()
9822
9823
9824 def p_port_name_5(p):
9825 '''port_name : K_DOTSTAR '''
9826 if(parse_debug):
9827 print('port_name_5', list(p))
9828
9829 # { named_pexpr_t*tmp = new named_pexpr_t;
9830 # tmp->name = lex_strings.make("*");
9831 # tmp->parm = 0;
9832 # p[0] = tmp;
9833 # }
9834 ()
9835
9836
9837 def p_port_name_list_1(p):
9838 '''port_name_list : port_name_list ',' port_name '''
9839 if(parse_debug):
9840 print('port_name_list_1', list(p))
9841
9842 # { list<named_pexpr_t>*tmp = p[1];
9843 # tmp->push_back(*p[3]);
9844 # delete p[3];
9845 # p[0] = tmp;
9846 # }
9847 ()
9848
9849
9850 def p_port_name_list_2(p):
9851 '''port_name_list : port_name '''
9852 if(parse_debug):
9853 print('port_name_list_2', list(p))
9854
9855 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
9856 # tmp->push_back(*p[1]);
9857 # delete p[1];
9858 # p[0] = tmp;
9859 # }
9860 ()
9861
9862
9863 def p_port_reference_1(p):
9864 '''port_reference : IDENTIFIER '''
9865 if(parse_debug):
9866 print('port_reference_1', list(p))
9867
9868 # { Module::port_t*ptmp;
9869 # perm_string name = lex_strings.make(p[1]);
9870 # ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
9871 # delete[]p[1];
9872 # p[0] = ptmp;
9873 # }
9874 ()
9875
9876
9877 def p_port_reference_2(p):
9878 '''port_reference : IDENTIFIER '[' expression ':' expression ']' '''
9879 if(parse_debug):
9880 print('port_reference_2', list(p))
9881
9882 # { index_component_t itmp;
9883 # itmp.sel = index_component_t::SEL_PART;
9884 # itmp.msb = p[3];
9885 # itmp.lsb = p[5];
9886 #
9887 # name_component_t ntmp (lex_strings.make(p[1]));
9888 # ntmp.index.push_back(itmp);
9889 #
9890 # pform_name_t pname;
9891 # pname.push_back(ntmp);
9892 #
9893 # PEIdent*wtmp = new PEIdent(pname);
9894 # FILE_NAME(wtmp, @1);
9895 #
9896 # Module::port_t*ptmp = new Module::port_t;
9897 # ptmp->name = perm_string();
9898 # ptmp->expr.push_back(wtmp);
9899 #
9900 # delete[]p[1];
9901 # p[0] = ptmp;
9902 # }
9903 ()
9904
9905
9906 def p_port_reference_3(p):
9907 '''port_reference : IDENTIFIER '[' expression ']' '''
9908 if(parse_debug):
9909 print('port_reference_3', list(p))
9910
9911 # { index_component_t itmp;
9912 # itmp.sel = index_component_t::SEL_BIT;
9913 # itmp.msb = p[3];
9914 # itmp.lsb = 0;
9915 #
9916 # name_component_t ntmp (lex_strings.make(p[1]));
9917 # ntmp.index.push_back(itmp);
9918 #
9919 # pform_name_t pname;
9920 # pname.push_back(ntmp);
9921 #
9922 # PEIdent*tmp = new PEIdent(pname);
9923 # FILE_NAME(tmp, @1);
9924 #
9925 # Module::port_t*ptmp = new Module::port_t;
9926 # ptmp->name = perm_string();
9927 # ptmp->expr.push_back(tmp);
9928 # delete[]p[1];
9929 # p[0] = ptmp;
9930 # }
9931 ()
9932
9933
9934 def p_port_reference_4(p):
9935 '''port_reference : IDENTIFIER '[' error ']' '''
9936 if(parse_debug):
9937 print('port_reference_4', list(p))
9938
9939 # { yyerror(@1, "error: invalid port bit select");
9940 # Module::port_t*ptmp = new Module::port_t;
9941 # PEIdent*wtmp = new PEIdent(lex_strings.make(p[1]));
9942 # FILE_NAME(wtmp, @1);
9943 # ptmp->name = lex_strings.make(p[1]);
9944 # ptmp->expr.push_back(wtmp);
9945 # delete[]p[1];
9946 # p[0] = ptmp;
9947 # }
9948 ()
9949
9950
9951 def p_port_reference_list_1(p):
9952 '''port_reference_list : port_reference '''
9953 if(parse_debug):
9954 print('port_reference_list_1', list(p))
9955 p[0] = p[1]
9956
9957
9958 ()
9959
9960
9961 def p_port_reference_list_2(p):
9962 '''port_reference_list : port_reference_list ',' port_reference '''
9963 if(parse_debug):
9964 print('port_reference_list_2', list(p))
9965
9966 # { Module::port_t*tmp = p[1];
9967 # append(tmp->expr, p[3]->expr);
9968 # delete p[3];
9969 # p[0] = tmp;
9970 # }
9971 ()
9972
9973
9974 def p_dimensions_opt_1(p):
9975 '''dimensions_opt : '''
9976 if(parse_debug > 2):
9977 print('dimensions_opt_1', list(p))
9978
9979 # { p[0] = None }
9980 ()
9981
9982
9983 def p_dimensions_opt_2(p):
9984 '''dimensions_opt : dimensions '''
9985 if(parse_debug):
9986 print('dimensions_opt_2', list(p))
9987 p[0] = p[1]
9988
9989
9990 ()
9991
9992
9993 def p_dimensions_1(p):
9994 '''dimensions : variable_dimension '''
9995 if(parse_debug):
9996 print('dimensions_1', list(p))
9997 p[0] = p[1]
9998
9999
10000 ()
10001
10002
10003 def p_dimensions_2(p):
10004 '''dimensions : dimensions variable_dimension '''
10005 if(parse_debug):
10006 print('dimensions_2', list(p))
10007
10008 # { list<pform_range_t> *tmp = p[1];
10009 # if (p[2]) {
10010 # tmp->splice(tmp->end(), *p[2]);
10011 # delete p[2];
10012 # }
10013 # p[0] = tmp;
10014 # }
10015 ()
10016
10017
10018 def p_register_variable_1(p):
10019 '''register_variable : IDENTIFIER dimensions_opt '''
10020 if(parse_debug):
10021 print('register_variable_1', list(p))
10022
10023 # { perm_string name = lex_strings.make(p[1]);
10024 # pform_makewire(@1, name, NetNet::REG,
10025 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10026 # pform_set_reg_idx(name, p[2]);
10027 # p[0] = p[1];
10028 # }
10029 ()
10030
10031
10032 def p_register_variable_2(p):
10033 '''register_variable : IDENTIFIER dimensions_opt '=' expression '''
10034 if(parse_debug):
10035 print('register_variable_2', list(p))
10036
10037 # { if (pform_peek_scope()->var_init_needs_explicit_lifetime()
10038 # && (var_lifetime == LexicalScope::INHERITED)) {
10039 # cerr << @3 << ": warning: Static variable initialization requires "
10040 # "explicit lifetime in this context." << endl;
10041 # warn_count += 1;
10042 # }
10043 # perm_string name = lex_strings.make(p[1]);
10044 # pform_makewire(@1, name, NetNet::REG,
10045 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10046 # pform_set_reg_idx(name, p[2]);
10047 # pform_make_var_init(@1, name, p[4]);
10048 # p[0] = p[1];
10049 # }
10050 ()
10051
10052
10053 def p_register_variable_list_1(p):
10054 '''register_variable_list : register_variable '''
10055 if(parse_debug):
10056 print('register_variable_list_1', list(p))
10057
10058 # { list<perm_string>*tmp = new list<perm_string>;
10059 # tmp->push_back(lex_strings.make(p[1]));
10060 # p[0] = tmp;
10061 # delete[]p[1];
10062 # }
10063 ()
10064
10065
10066 def p_register_variable_list_2(p):
10067 '''register_variable_list : register_variable_list ',' register_variable '''
10068 if(parse_debug):
10069 print('register_variable_list_2', list(p))
10070
10071 # { list<perm_string>*tmp = p[1];
10072 # tmp->push_back(lex_strings.make(p[3]));
10073 # p[0] = tmp;
10074 # delete[]p[3];
10075 # }
10076 ()
10077
10078
10079 def p_net_variable_1(p):
10080 '''net_variable : IDENTIFIER dimensions_opt '''
10081 if(parse_debug):
10082 print('net_variable_1', list(p))
10083
10084 # { perm_string name = lex_strings.make(p[1]);
10085 # pform_makewire(@1, name, NetNet::IMPLICIT,
10086 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
10087 # pform_set_reg_idx(name, p[2]);
10088 # p[0] = p[1];
10089 # }
10090 ()
10091
10092
10093 def p_net_variable_list_1(p):
10094 '''net_variable_list : net_variable '''
10095 if(parse_debug):
10096 print('net_variable_list_1', list(p))
10097
10098 # { list<perm_string>*tmp = new list<perm_string>;
10099 # tmp->push_back(lex_strings.make(p[1]));
10100 # p[0] = tmp;
10101 # delete[]p[1];
10102 # }
10103 ()
10104
10105
10106 def p_net_variable_list_2(p):
10107 '''net_variable_list : net_variable_list ',' net_variable '''
10108 if(parse_debug):
10109 print('net_variable_list_2', list(p))
10110
10111 # { list<perm_string>*tmp = p[1];
10112 # tmp->push_back(lex_strings.make(p[3]));
10113 # p[0] = tmp;
10114 # delete[]p[3];
10115 # }
10116 ()
10117
10118
10119 def p_event_variable_1(p):
10120 '''event_variable : IDENTIFIER dimensions_opt '''
10121 if(parse_debug):
10122 print('event_variable_1', list(p))
10123
10124 # { if (p[2]) {
10125 # yyerror(@2, "sorry: event arrays are not supported.");
10126 # delete p[2];
10127 # }
10128 # p[0] = p[1];
10129 # }
10130 ()
10131
10132
10133 def p_event_variable_list_1(p):
10134 '''event_variable_list : event_variable '''
10135 if(parse_debug):
10136 print('event_variable_list_1', list(p))
10137
10138 # { p[0] = list_from_identifier(p[1]); }
10139 ()
10140
10141
10142 def p_event_variable_list_2(p):
10143 '''event_variable_list : event_variable_list ',' event_variable '''
10144 if(parse_debug):
10145 print('event_variable_list_2', list(p))
10146
10147 # { p[0] = list_from_identifier(p[1], p[3]); }
10148 ()
10149
10150
10151 def p_specify_item_1(p):
10152 '''specify_item : K_specparam specparam_decl ';' '''
10153 if(parse_debug):
10154 print('specify_item_1', list(p))
10155
10156
10157 ()
10158
10159
10160 def p_specify_item_2(p):
10161 '''specify_item : specify_simple_path_decl ';' '''
10162 if(parse_debug):
10163 print('specify_item_2', list(p))
10164
10165 # { pform_module_specify_path(p[1]);
10166 # }
10167 ()
10168
10169
10170 def p_specify_item_3(p):
10171 '''specify_item : specify_edge_path_decl ';' '''
10172 if(parse_debug):
10173 print('specify_item_3', list(p))
10174
10175 # { pform_module_specify_path(p[1]);
10176 # }
10177 ()
10178
10179
10180 def p_specify_item_4(p):
10181 '''specify_item : K_if '(' expression ')' specify_simple_path_decl ';' '''
10182 if(parse_debug):
10183 print('specify_item_4', list(p))
10184
10185 # { PSpecPath*tmp = p[5];
10186 # if (tmp) {
10187 # tmp->conditional = true;
10188 # tmp->condition = p[3];
10189 # }
10190 # pform_module_specify_path(tmp);
10191 # }
10192 ()
10193
10194
10195 def p_specify_item_5(p):
10196 '''specify_item : K_if '(' expression ')' specify_edge_path_decl ';' '''
10197 if(parse_debug):
10198 print('specify_item_5', list(p))
10199
10200 # { PSpecPath*tmp = p[5];
10201 # if (tmp) {
10202 # tmp->conditional = true;
10203 # tmp->condition = p[3];
10204 # }
10205 # pform_module_specify_path(tmp);
10206 # }
10207 ()
10208
10209
10210 def p_specify_item_6(p):
10211 '''specify_item : K_ifnone specify_simple_path_decl ';' '''
10212 if(parse_debug):
10213 print('specify_item_6', list(p))
10214
10215 # { PSpecPath*tmp = p[2];
10216 # if (tmp) {
10217 # tmp->conditional = true;
10218 # tmp->condition = 0;
10219 # }
10220 # pform_module_specify_path(tmp);
10221 # }
10222 ()
10223
10224
10225 def p_specify_item_7(p):
10226 '''specify_item : K_ifnone specify_edge_path_decl ';' '''
10227 if(parse_debug):
10228 print('specify_item_7', list(p))
10229
10230 # { yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
10231 # "not supported.");
10232 # yyerrok;
10233 # }
10234 ()
10235
10236
10237 def p_specify_item_8(p):
10238 '''specify_item : K_Sfullskew '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10239 if(parse_debug):
10240 print('specify_item_8', list(p))
10241
10242 # { delete p[7];
10243 # delete p[9];
10244 # }
10245 ()
10246
10247
10248 def p_specify_item_9(p):
10249 '''specify_item : K_Shold '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10250 if(parse_debug):
10251 print('specify_item_9', list(p))
10252
10253 # { delete p[7];
10254 # }
10255 ()
10256
10257
10258 def p_specify_item_10(p):
10259 '''specify_item : K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10260 if(parse_debug):
10261 print('specify_item_10', list(p))
10262
10263 # { delete p[7];
10264 # delete p[9];
10265 # }
10266 ()
10267
10268
10269 def p_specify_item_11(p):
10270 '''specify_item : K_Speriod '(' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10271 if(parse_debug):
10272 print('specify_item_11', list(p))
10273
10274 # { delete p[5];
10275 # }
10276 ()
10277
10278
10279 def p_specify_item_12(p):
10280 '''specify_item : K_Srecovery '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10281 if(parse_debug):
10282 print('specify_item_12', list(p))
10283
10284 # { delete p[7];
10285 # }
10286 ()
10287
10288
10289 def p_specify_item_13(p):
10290 '''specify_item : K_Srecrem '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10291 if(parse_debug):
10292 print('specify_item_13', list(p))
10293
10294 # { delete p[7];
10295 # delete p[9];
10296 # }
10297 ()
10298
10299
10300 def p_specify_item_14(p):
10301 '''specify_item : K_Sremoval '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10302 if(parse_debug):
10303 print('specify_item_14', list(p))
10304
10305 # { delete p[7];
10306 # }
10307 ()
10308
10309
10310 def p_specify_item_15(p):
10311 '''specify_item : K_Ssetup '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10312 if(parse_debug):
10313 print('specify_item_15', list(p))
10314
10315 # { delete p[7];
10316 # }
10317 ()
10318
10319
10320 def p_specify_item_16(p):
10321 '''specify_item : K_Ssetuphold '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
10322 if(parse_debug):
10323 print('specify_item_16', list(p))
10324
10325 # { delete p[7];
10326 # delete p[9];
10327 # }
10328 ()
10329
10330
10331 def p_specify_item_17(p):
10332 '''specify_item : K_Sskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10333 if(parse_debug):
10334 print('specify_item_17', list(p))
10335
10336 # { delete p[7];
10337 # }
10338 ()
10339
10340
10341 def p_specify_item_18(p):
10342 '''specify_item : K_Stimeskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
10343 if(parse_debug):
10344 print('specify_item_18', list(p))
10345
10346 # { delete p[7];
10347 # }
10348 ()
10349
10350
10351 def p_specify_item_19(p):
10352 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ',' expression spec_notifier_opt ')' ';' '''
10353 if(parse_debug):
10354 print('specify_item_19', list(p))
10355
10356 # { delete p[5];
10357 # delete p[7];
10358 # }
10359 ()
10360
10361
10362 def p_specify_item_20(p):
10363 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ')' ';' '''
10364 if(parse_debug):
10365 print('specify_item_20', list(p))
10366
10367 # { delete p[5];
10368 # }
10369 ()
10370
10371
10372 def p_specify_item_21(p):
10373 '''specify_item : K_pulsestyle_onevent specify_path_identifiers ';' '''
10374 if(parse_debug):
10375 print('specify_item_21', list(p))
10376
10377 # { delete p[2];
10378 # }
10379 ()
10380
10381
10382 def p_specify_item_22(p):
10383 '''specify_item : K_pulsestyle_ondetect specify_path_identifiers ';' '''
10384 if(parse_debug):
10385 print('specify_item_22', list(p))
10386
10387 # { delete p[2];
10388 # }
10389 ()
10390
10391
10392 def p_specify_item_23(p):
10393 '''specify_item : K_showcancelled specify_path_identifiers ';' '''
10394 if(parse_debug):
10395 print('specify_item_23', list(p))
10396
10397 # { delete p[2];
10398 # }
10399 ()
10400
10401
10402 def p_specify_item_24(p):
10403 '''specify_item : K_noshowcancelled specify_path_identifiers ';' '''
10404 if(parse_debug):
10405 print('specify_item_24', list(p))
10406
10407 # { delete p[2];
10408 # }
10409 ()
10410
10411
10412 def p_specify_item_list_1(p):
10413 '''specify_item_list : specify_item '''
10414 if(parse_debug):
10415 print('specify_item_list_1', list(p))
10416
10417
10418 ()
10419
10420
10421 def p_specify_item_list_2(p):
10422 '''specify_item_list : specify_item_list specify_item '''
10423 if(parse_debug):
10424 print('specify_item_list_2', list(p))
10425
10426
10427 ()
10428
10429
10430 def p_specify_item_list_opt_1(p):
10431 '''specify_item_list_opt : '''
10432 if(parse_debug):
10433 print('specify_item_list_opt_1', list(p))
10434
10435 # { }
10436 ()
10437
10438
10439 def p_specify_item_list_opt_2(p):
10440 '''specify_item_list_opt : specify_item_list '''
10441 if(parse_debug):
10442 print('specify_item_list_opt_2', list(p))
10443
10444 # { }
10445 ()
10446
10447
10448 def p_specify_edge_path_decl_1(p):
10449 '''specify_edge_path_decl : specify_edge_path '=' '(' delay_value_list ')' '''
10450 if(parse_debug):
10451 print('specify_edge_path_decl_1', list(p))
10452
10453 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
10454 ()
10455
10456
10457 def p_specify_edge_path_decl_2(p):
10458 '''specify_edge_path_decl : specify_edge_path '=' delay_value_simple '''
10459 if(parse_debug):
10460 print('specify_edge_path_decl_2', list(p))
10461
10462 # { list<PExpr*>*tmp = new list<PExpr*>;
10463 # tmp->push_back(p[3]);
10464 # p[0] = pform_assign_path_delay(p[1], tmp);
10465 # }
10466 ()
10467
10468
10469 def p_edge_operator_1(p):
10470 '''edge_operator : K_posedge '''
10471 if(parse_debug):
10472 print('edge_operator_1', list(p))
10473 p[0] = True
10474
10475
10476 ()
10477
10478
10479 def p_edge_operator_2(p):
10480 '''edge_operator : K_negedge '''
10481 if(parse_debug):
10482 print('edge_operator_2', list(p))
10483 p[0] = False
10484
10485
10486 ()
10487
10488
10489 def p_specify_edge_path_1(p):
10490 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10491 if(parse_debug):
10492 print('specify_edge_path_1', list(p))
10493
10494 # { int edge_flag = 0;
10495 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], false, p[6], p[8]); }
10496 ()
10497
10498
10499 def p_specify_edge_path_2(p):
10500 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10501 if(parse_debug):
10502 print('specify_edge_path_2', list(p))
10503
10504 # { int edge_flag = p[2]? 1 : -1;
10505 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], false, p[7], p[9]);}
10506 ()
10507
10508
10509 def p_specify_edge_path_3(p):
10510 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10511 if(parse_debug):
10512 print('specify_edge_path_3', list(p))
10513
10514 # { int edge_flag = 0;
10515 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[2], p[3], true, p[6], p[8]); }
10516 ()
10517
10518
10519 def p_specify_edge_path_4(p):
10520 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
10521 if(parse_debug):
10522 print('specify_edge_path_4', list(p))
10523
10524 # { int edge_flag = p[2]? 1 : -1;
10525 # p[0] = pform_make_specify_edge_path(@1, edge_flag, p[3], p[4], true, p[7], p[9]); }
10526 ()
10527
10528
10529 def p_polarity_operator_1(p):
10530 '''polarity_operator : K_PO_POS '''
10531 if(parse_debug):
10532 print('polarity_operator_1', list(p))
10533
10534
10535 ()
10536
10537
10538 def p_polarity_operator_2(p):
10539 '''polarity_operator : K_PO_NEG '''
10540 if(parse_debug):
10541 print('polarity_operator_2', list(p))
10542
10543
10544 ()
10545
10546
10547 def p_polarity_operator_3(p):
10548 '''polarity_operator : ':' '''
10549 if(parse_debug):
10550 print('polarity_operator_3', list(p))
10551
10552
10553 ()
10554
10555
10556 def p_specify_simple_path_decl_1(p):
10557 '''specify_simple_path_decl : specify_simple_path '=' '(' delay_value_list ')' '''
10558 if(parse_debug):
10559 print('specify_simple_path_decl_1', list(p))
10560
10561 # { p[0] = pform_assign_path_delay(p[1], p[4]); }
10562 ()
10563
10564
10565 def p_specify_simple_path_decl_2(p):
10566 '''specify_simple_path_decl : specify_simple_path '=' delay_value_simple '''
10567 if(parse_debug):
10568 print('specify_simple_path_decl_2', list(p))
10569
10570 # { list<PExpr*>*tmp = new list<PExpr*>;
10571 # tmp->push_back(p[3]);
10572 # p[0] = pform_assign_path_delay(p[1], tmp);
10573 # }
10574 ()
10575
10576
10577 def p_specify_simple_path_decl_3(p):
10578 '''specify_simple_path_decl : specify_simple_path '=' '(' error ')' '''
10579 if(parse_debug):
10580 print('specify_simple_path_decl_3', list(p))
10581
10582 # { yyerror(@3, "Syntax error in delay value list.");
10583 # yyerrok;
10584 # p[0] = None
10585 # }
10586 ()
10587
10588
10589 def p_specify_simple_path_1(p):
10590 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' '''
10591 if(parse_debug):
10592 print('specify_simple_path_1', list(p))
10593
10594 # { p[0] = pform_make_specify_path(@1, p[2], p[3], false, p[5]); }
10595 ()
10596
10597
10598 def p_specify_simple_path_2(p):
10599 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' '''
10600 if(parse_debug):
10601 print('specify_simple_path_2', list(p))
10602
10603 # { p[0] = pform_make_specify_path(@1, p[2], p[3], true, p[5]); }
10604 ()
10605
10606
10607 def p_specify_simple_path_3(p):
10608 '''specify_simple_path : '(' error ')' '''
10609 if(parse_debug):
10610 print('specify_simple_path_3', list(p))
10611
10612 # { yyerror(@1, "Invalid simple path");
10613 # yyerrok;
10614 # }
10615 ()
10616
10617
10618 def p_specify_path_identifiers_1(p):
10619 '''specify_path_identifiers : IDENTIFIER '''
10620 if(parse_debug):
10621 print('specify_path_identifiers_1', list(p))
10622
10623 # { list<perm_string>*tmp = new list<perm_string>;
10624 # tmp->push_back(lex_strings.make(p[1]));
10625 # p[0] = tmp;
10626 # delete[]p[1];
10627 # }
10628 ()
10629
10630
10631 def p_specify_path_identifiers_2(p):
10632 '''specify_path_identifiers : IDENTIFIER '[' expr_primary ']' '''
10633 if(parse_debug):
10634 print('specify_path_identifiers_2', list(p))
10635
10636 # { if (gn_specify_blocks_flag) {
10637 # yywarn(@4, "Bit selects are not currently supported "
10638 # "in path declarations. The declaration "
10639 # "will be applied to the whole vector.");
10640 # }
10641 # list<perm_string>*tmp = new list<perm_string>;
10642 # tmp->push_back(lex_strings.make(p[1]));
10643 # p[0] = tmp;
10644 # delete[]p[1];
10645 # }
10646 ()
10647
10648
10649 def p_specify_path_identifiers_3(p):
10650 '''specify_path_identifiers : IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
10651 if(parse_debug):
10652 print('specify_path_identifiers_3', list(p))
10653
10654 # { if (gn_specify_blocks_flag) {
10655 # yywarn(@4, "Part selects are not currently supported "
10656 # "in path declarations. The declaration "
10657 # "will be applied to the whole vector.");
10658 # }
10659 # list<perm_string>*tmp = new list<perm_string>;
10660 # tmp->push_back(lex_strings.make(p[1]));
10661 # p[0] = tmp;
10662 # delete[]p[1];
10663 # }
10664 ()
10665
10666
10667 def p_specify_path_identifiers_4(p):
10668 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '''
10669 if(parse_debug):
10670 print('specify_path_identifiers_4', list(p))
10671
10672 # { list<perm_string>*tmp = p[1];
10673 # tmp->push_back(lex_strings.make(p[3]));
10674 # p[0] = tmp;
10675 # delete[]p[3];
10676 # }
10677 ()
10678
10679
10680 def p_specify_path_identifiers_5(p):
10681 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' '''
10682 if(parse_debug):
10683 print('specify_path_identifiers_5', list(p))
10684
10685 # { if (gn_specify_blocks_flag) {
10686 # yywarn(@4, "Bit selects are not currently supported "
10687 # "in path declarations. The declaration "
10688 # "will be applied to the whole vector.");
10689 # }
10690 # list<perm_string>*tmp = p[1];
10691 # tmp->push_back(lex_strings.make(p[3]));
10692 # p[0] = tmp;
10693 # delete[]p[3];
10694 # }
10695 ()
10696
10697
10698 def p_specify_path_identifiers_6(p):
10699 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
10700 if(parse_debug):
10701 print('specify_path_identifiers_6', list(p))
10702
10703 # { if (gn_specify_blocks_flag) {
10704 # yywarn(@4, "Part selects are not currently supported "
10705 # "in path declarations. The declaration "
10706 # "will be applied to the whole vector.");
10707 # }
10708 # list<perm_string>*tmp = p[1];
10709 # tmp->push_back(lex_strings.make(p[3]));
10710 # p[0] = tmp;
10711 # delete[]p[3];
10712 # }
10713 ()
10714
10715
10716 def p_specparam_1(p):
10717 '''specparam : IDENTIFIER '=' expression '''
10718 if(parse_debug):
10719 print('specparam_1', list(p))
10720
10721 # { PExpr*tmp = p[3];
10722 # pform_set_specparam(@1, lex_strings.make(p[1]),
10723 # param_active_range, tmp);
10724 # delete[]p[1];
10725 # }
10726 ()
10727
10728
10729 def p_specparam_2(p):
10730 '''specparam : IDENTIFIER '=' expression ':' expression ':' expression '''
10731 if(parse_debug):
10732 print('specparam_2', list(p))
10733
10734 # { PExpr*tmp = 0;
10735 # switch (min_typ_max_flag) {
10736 # case MIN:
10737 # tmp = p[3];
10738 # delete p[5];
10739 # delete p[7];
10740 # break;
10741 # case TYP:
10742 # delete p[3];
10743 # tmp = p[5];
10744 # delete p[7];
10745 # break;
10746 # case MAX:
10747 # delete p[3];
10748 # delete p[5];
10749 # tmp = p[7];
10750 # break;
10751 # }
10752 # if (min_typ_max_warn > 0) {
10753 # cerr << tmp->get_fileline() << ": warning: choosing ";
10754 # switch (min_typ_max_flag) {
10755 # case MIN:
10756 # cerr << "min";
10757 # break;
10758 # case TYP:
10759 # cerr << "typ";
10760 # break;
10761 # case MAX:
10762 # cerr << "max";
10763 # break;
10764 # }
10765 # cerr << " expression." << endl;
10766 # min_typ_max_warn -= 1;
10767 # }
10768 # pform_set_specparam(@1, lex_strings.make(p[1]),
10769 # param_active_range, tmp);
10770 # delete[]p[1];
10771 # }
10772 ()
10773
10774
10775 def p_specparam_3(p):
10776 '''specparam : PATHPULSE_IDENTIFIER '=' expression '''
10777 if(parse_debug):
10778 print('specparam_3', list(p))
10779
10780 # { delete[]p[1];
10781 # delete p[3];
10782 # }
10783 ()
10784
10785
10786 def p_specparam_4(p):
10787 '''specparam : PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' '''
10788 if(parse_debug):
10789 print('specparam_4', list(p))
10790
10791 # { delete[]p[1];
10792 # delete p[4];
10793 # delete p[6];
10794 # }
10795 ()
10796
10797
10798 def p_specparam_list_1(p):
10799 '''specparam_list : specparam '''
10800 if(parse_debug):
10801 print('specparam_list_1', list(p))
10802
10803
10804 ()
10805
10806
10807 def p_specparam_list_2(p):
10808 '''specparam_list : specparam_list ',' specparam '''
10809 if(parse_debug):
10810 print('specparam_list_2', list(p))
10811
10812
10813 ()
10814
10815
10816 def p_specparam_decl_1(p):
10817 '''specparam_decl : specparam_list '''
10818 if(parse_debug):
10819 print('specparam_decl_1', list(p))
10820
10821
10822 ()
10823
10824
10825 def p_specparam_decl_2(p):
10826 '''specparam_decl : dimensions _embed0_specparam_decl specparam_list '''
10827 if(parse_debug):
10828 print('specparam_decl_2', list(p))
10829
10830 # { param_active_range = 0; }
10831 ()
10832
10833
10834 def p__embed0_specparam_decl(p):
10835 '''_embed0_specparam_decl : '''
10836
10837 # { param_active_range = p[1]; }
10838 ()
10839
10840
10841 def p_spec_polarity_1(p):
10842 '''spec_polarity : '+' '''
10843 if(parse_debug):
10844 print('spec_polarity_1', list(p))
10845
10846 # { p[0] = '+'; }
10847 ()
10848
10849
10850 def p_spec_polarity_2(p):
10851 '''spec_polarity : '-' '''
10852 if(parse_debug):
10853 print('spec_polarity_2', list(p))
10854
10855 # { p[0] = '-'; }
10856 ()
10857
10858
10859 def p_spec_polarity_3(p):
10860 '''spec_polarity : '''
10861 if(parse_debug):
10862 print('spec_polarity_3', list(p))
10863
10864 # { p[0] = None }
10865 ()
10866
10867
10868 def p_spec_reference_event_1(p):
10869 '''spec_reference_event : K_posedge expression '''
10870 if(parse_debug):
10871 print('spec_reference_event_1', list(p))
10872
10873 # { delete p[2]; }
10874 ()
10875
10876
10877 def p_spec_reference_event_2(p):
10878 '''spec_reference_event : K_negedge expression '''
10879 if(parse_debug):
10880 print('spec_reference_event_2', list(p))
10881
10882 # { delete p[2]; }
10883 ()
10884
10885
10886 def p_spec_reference_event_3(p):
10887 '''spec_reference_event : K_posedge expr_primary K_TAND expression '''
10888 if(parse_debug):
10889 print('spec_reference_event_3', list(p))
10890
10891 # { delete p[2];
10892 # delete p[4];
10893 # }
10894 ()
10895
10896
10897 def p_spec_reference_event_4(p):
10898 '''spec_reference_event : K_negedge expr_primary K_TAND expression '''
10899 if(parse_debug):
10900 print('spec_reference_event_4', list(p))
10901
10902 # { delete p[2];
10903 # delete p[4];
10904 # }
10905 ()
10906
10907
10908 def p_spec_reference_event_5(p):
10909 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary '''
10910 if(parse_debug):
10911 print('spec_reference_event_5', list(p))
10912
10913 # { delete p[5]; }
10914 ()
10915
10916
10917 def p_spec_reference_event_6(p):
10918 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression '''
10919 if(parse_debug):
10920 print('spec_reference_event_6', list(p))
10921
10922 # { delete p[5];
10923 # delete p[7];
10924 # }
10925 ()
10926
10927
10928 def p_spec_reference_event_7(p):
10929 '''spec_reference_event : expr_primary K_TAND expression '''
10930 if(parse_debug):
10931 print('spec_reference_event_7', list(p))
10932
10933 # { delete p[1];
10934 # delete p[3];
10935 # }
10936 ()
10937
10938
10939 def p_spec_reference_event_8(p):
10940 '''spec_reference_event : expr_primary '''
10941 if(parse_debug):
10942 print('spec_reference_event_8', list(p))
10943
10944 # { delete p[1]; }
10945 ()
10946
10947
10948 def p_edge_descriptor_list_1(p):
10949 '''edge_descriptor_list : edge_descriptor_list ',' K_edge_descriptor '''
10950 if(parse_debug):
10951 print('edge_descriptor_list_1', list(p))
10952
10953
10954 ()
10955
10956
10957 def p_edge_descriptor_list_2(p):
10958 '''edge_descriptor_list : K_edge_descriptor '''
10959 if(parse_debug):
10960 print('edge_descriptor_list_2', list(p))
10961
10962
10963 ()
10964
10965
10966 def p_spec_notifier_opt_1(p):
10967 '''spec_notifier_opt : '''
10968 if(parse_debug):
10969 print('spec_notifier_opt_1', list(p))
10970
10971 # { }
10972 ()
10973
10974
10975 def p_spec_notifier_opt_2(p):
10976 '''spec_notifier_opt : spec_notifier '''
10977 if(parse_debug):
10978 print('spec_notifier_opt_2', list(p))
10979
10980 # { }
10981 ()
10982
10983
10984 def p_spec_notifier_1(p):
10985 '''spec_notifier : ',' '''
10986 if(parse_debug):
10987 print('spec_notifier_1', list(p))
10988
10989 # { args_after_notifier = 0; }
10990 ()
10991
10992
10993 def p_spec_notifier_2(p):
10994 '''spec_notifier : ',' hierarchy_identifier '''
10995 if(parse_debug):
10996 print('spec_notifier_2', list(p))
10997
10998 # { args_after_notifier = 0; delete p[2]; }
10999 ()
11000
11001
11002 def p_spec_notifier_3(p):
11003 '''spec_notifier : spec_notifier ',' '''
11004 if(parse_debug):
11005 print('spec_notifier_3', list(p))
11006
11007 # { args_after_notifier += 1; }
11008 ()
11009
11010
11011 def p_spec_notifier_4(p):
11012 '''spec_notifier : spec_notifier ',' hierarchy_identifier '''
11013 if(parse_debug):
11014 print('spec_notifier_4', list(p))
11015
11016 # { args_after_notifier += 1;
11017 # if (args_after_notifier >= 3) {
11018 # cerr << @3 << ": warning: timing checks are not supported "
11019 # "and delayed signal \"" << *p[3]
11020 # << "\" will not be driven." << endl;
11021 # }
11022 # delete p[3]; }
11023 ()
11024
11025
11026 def p_spec_notifier_5(p):
11027 '''spec_notifier : IDENTIFIER '''
11028 if(parse_debug):
11029 print('spec_notifier_5', list(p))
11030
11031 # { args_after_notifier = 0; delete[]p[1]; }
11032 ()
11033
11034
11035 def p_statement_item_1(p):
11036 '''statement_item : K_assign lpvalue '=' expression ';' '''
11037 if(parse_debug):
11038 print('statement_item_1', list(p))
11039
11040 # { PCAssign*tmp = new PCAssign(p[2], p[4]);
11041 # FILE_NAME(tmp, @1);
11042 # p[0] = tmp;
11043 # }
11044 ()
11045
11046
11047 def p_statement_item_2(p):
11048 '''statement_item : K_deassign lpvalue ';' '''
11049 if(parse_debug):
11050 print('statement_item_2', list(p))
11051
11052 # { PDeassign*tmp = new PDeassign(p[2]);
11053 # FILE_NAME(tmp, @1);
11054 # p[0] = tmp;
11055 # }
11056 ()
11057
11058
11059 def p_statement_item_3(p):
11060 '''statement_item : K_force lpvalue '=' expression ';' '''
11061 if(parse_debug):
11062 print('statement_item_3', list(p))
11063
11064 # { PForce*tmp = new PForce(p[2], p[4]);
11065 # FILE_NAME(tmp, @1);
11066 # p[0] = tmp;
11067 # }
11068 ()
11069
11070
11071 def p_statement_item_4(p):
11072 '''statement_item : K_release lpvalue ';' '''
11073 if(parse_debug):
11074 print('statement_item_4', list(p))
11075
11076 # { PRelease*tmp = new PRelease(p[2]);
11077 # FILE_NAME(tmp, @1);
11078 # p[0] = tmp;
11079 # }
11080 ()
11081
11082
11083 def p_statement_item_5(p):
11084 '''statement_item : K_begin K_end '''
11085 if(parse_debug):
11086 print('statement_item_5', list(p))
11087
11088 # { PBlock*tmp = new PBlock(PBlock::BL_SEQ);
11089 # FILE_NAME(tmp, @1);
11090 # p[0] = tmp;
11091 # }
11092 ()
11093
11094
11095 def p_statement_item_6(p):
11096 '''statement_item : K_begin _embed0_statement_item block_item_decls_opt _embed1_statement_item statement_or_null_list K_end '''
11097 if(parse_debug):
11098 print('statement_item_6', list(p))
11099
11100 # { PBlock*tmp;
11101 # if (p[3]) {
11102 # pform_pop_scope();
11103 # assert(! current_block_stack.empty());
11104 # tmp = current_block_stack.top();
11105 # current_block_stack.pop();
11106 # } else {
11107 # tmp = new PBlock(PBlock::BL_SEQ);
11108 # FILE_NAME(tmp, @1);
11109 # }
11110 # if (p[5]) tmp->set_statement(*p[5]);
11111 # delete p[5];
11112 # p[0] = tmp;
11113 # }
11114 ()
11115
11116
11117 def p_statement_item_7(p):
11118 '''statement_item : K_begin ':' IDENTIFIER _embed2_statement_item block_item_decls_opt statement_or_null_list_opt K_end endlabel_opt '''
11119 if(parse_debug):
11120 print('statement_item_7', list(p))
11121
11122 # { pform_pop_scope();
11123 # assert(! current_block_stack.empty());
11124 # PBlock*tmp = current_block_stack.top();
11125 # current_block_stack.pop();
11126 # if (p[6]) tmp->set_statement(*p[6]);
11127 # delete p[6];
11128 # if (p[8]) {
11129 # if (strcmp(p[3],p[8]) != 0) {
11130 # yyerror(@8, "error: End label doesn't match begin name");
11131 # }
11132 # if (! gn_system_verilog()) {
11133 # yyerror(@8, "error: Begin end labels require "
11134 # "SystemVerilog.");
11135 # }
11136 # delete[]p[8];
11137 # }
11138 # delete[]p[3];
11139 # p[0] = tmp;
11140 # }
11141 ()
11142
11143
11144 def p_statement_item_8(p):
11145 '''statement_item : K_fork join_keyword '''
11146 if(parse_debug):
11147 print('statement_item_8', list(p))
11148
11149 # { PBlock*tmp = new PBlock(p[2]);
11150 # FILE_NAME(tmp, @1);
11151 # p[0] = tmp;
11152 # }
11153 ()
11154
11155
11156 def p_statement_item_9(p):
11157 '''statement_item : K_fork _embed3_statement_item block_item_decls_opt _embed4_statement_item statement_or_null_list join_keyword '''
11158 if(parse_debug):
11159 print('statement_item_9', list(p))
11160
11161 # { PBlock*tmp;
11162 # if (p[3]) {
11163 # pform_pop_scope();
11164 # assert(! current_block_stack.empty());
11165 # tmp = current_block_stack.top();
11166 # current_block_stack.pop();
11167 # tmp->set_join_type(p[6]);
11168 # } else {
11169 # tmp = new PBlock(p[6]);
11170 # FILE_NAME(tmp, @1);
11171 # }
11172 # if (p[5]) tmp->set_statement(*p[5]);
11173 # delete p[5];
11174 # p[0] = tmp;
11175 # }
11176 ()
11177
11178
11179 def p_statement_item_10(p):
11180 '''statement_item : K_fork ':' IDENTIFIER _embed5_statement_item block_item_decls_opt statement_or_null_list_opt join_keyword endlabel_opt '''
11181 if(parse_debug):
11182 print('statement_item_10', list(p))
11183
11184 # { pform_pop_scope();
11185 # assert(! current_block_stack.empty());
11186 # PBlock*tmp = current_block_stack.top();
11187 # current_block_stack.pop();
11188 # tmp->set_join_type(p[7]);
11189 # if (p[6]) tmp->set_statement(*p[6]);
11190 # delete p[6];
11191 # if (p[8]) {
11192 # if (strcmp(p[3],p[8]) != 0) {
11193 # yyerror(@8, "error: End label doesn't match fork name");
11194 # }
11195 # if (! gn_system_verilog()) {
11196 # yyerror(@8, "error: Fork end labels require "
11197 # "SystemVerilog.");
11198 # }
11199 # delete[]p[8];
11200 # }
11201 # delete[]p[3];
11202 # p[0] = tmp;
11203 # }
11204 ()
11205
11206
11207 def p_statement_item_11(p):
11208 '''statement_item : K_disable hierarchy_identifier ';' '''
11209 if(parse_debug):
11210 print('statement_item_11', list(p))
11211
11212 # { PDisable*tmp = new PDisable(*p[2]);
11213 # FILE_NAME(tmp, @1);
11214 # delete p[2];
11215 # p[0] = tmp;
11216 # }
11217 ()
11218
11219
11220 def p_statement_item_12(p):
11221 '''statement_item : K_disable K_fork ';' '''
11222 if(parse_debug):
11223 print('statement_item_12', list(p))
11224
11225 # { pform_name_t tmp_name;
11226 # PDisable*tmp = new PDisable(tmp_name);
11227 # FILE_NAME(tmp, @1);
11228 # p[0] = tmp;
11229 # }
11230 ()
11231
11232
11233 def p_statement_item_13(p):
11234 '''statement_item : K_TRIGGER hierarchy_identifier ';' '''
11235 if(parse_debug):
11236 print('statement_item_13', list(p))
11237
11238 # { PTrigger*tmp = new PTrigger(*p[2]);
11239 # FILE_NAME(tmp, @1);
11240 # delete p[2];
11241 # p[0] = tmp;
11242 # }
11243 ()
11244
11245
11246 def p_statement_item_14(p):
11247 '''statement_item : procedural_assertion_statement '''
11248 if(parse_debug):
11249 print('statement_item_14', list(p))
11250 p[0] = p[1]
11251
11252
11253 ()
11254
11255
11256 def p_statement_item_15(p):
11257 '''statement_item : loop_statement '''
11258 if(parse_debug):
11259 print('statement_item_15', list(p))
11260 p[0] = p[1]
11261
11262
11263 ()
11264
11265
11266 def p_statement_item_16(p):
11267 '''statement_item : jump_statement '''
11268 if(parse_debug):
11269 print('statement_item_16', list(p))
11270 p[0] = p[1]
11271
11272
11273 ()
11274
11275
11276 def p_statement_item_17(p):
11277 '''statement_item : K_case '(' expression ')' case_items K_endcase '''
11278 if(parse_debug):
11279 print('statement_item_17', list(p))
11280
11281 # { PCase*tmp = new PCase(NetCase::EQ, p[3], p[5]);
11282 # FILE_NAME(tmp, @1);
11283 # p[0] = tmp;
11284 # }
11285 ()
11286
11287
11288 def p_statement_item_18(p):
11289 '''statement_item : K_casex '(' expression ')' case_items K_endcase '''
11290 if(parse_debug):
11291 print('statement_item_18', list(p))
11292
11293 # { PCase*tmp = new PCase(NetCase::EQX, p[3], p[5]);
11294 # FILE_NAME(tmp, @1);
11295 # p[0] = tmp;
11296 # }
11297 ()
11298
11299
11300 def p_statement_item_19(p):
11301 '''statement_item : K_casez '(' expression ')' case_items K_endcase '''
11302 if(parse_debug):
11303 print('statement_item_19', list(p))
11304
11305 # { PCase*tmp = new PCase(NetCase::EQZ, p[3], p[5]);
11306 # FILE_NAME(tmp, @1);
11307 # p[0] = tmp;
11308 # }
11309 ()
11310
11311
11312 def p_statement_item_20(p):
11313 '''statement_item : K_case '(' expression ')' error K_endcase '''
11314 if(parse_debug):
11315 print('statement_item_20', list(p))
11316
11317 # { yyerrok; }
11318 ()
11319
11320
11321 def p_statement_item_21(p):
11322 '''statement_item : K_casex '(' expression ')' error K_endcase '''
11323 if(parse_debug):
11324 print('statement_item_21', list(p))
11325
11326 # { yyerrok; }
11327 ()
11328
11329
11330 def p_statement_item_22(p):
11331 '''statement_item : K_casez '(' expression ')' error K_endcase '''
11332 if(parse_debug):
11333 print('statement_item_22', list(p))
11334
11335 # { yyerrok; }
11336 ()
11337
11338
11339 def p_statement_item_23(p):
11340 '''statement_item : K_if '(' expression ')' statement_or_null %prec less_than_K_else '''
11341 if(parse_debug):
11342 print('statement_item_23', list(p))
11343
11344 # { PCondit*tmp = new PCondit(p[3], p[5], 0);
11345 # FILE_NAME(tmp, @1);
11346 # p[0] = tmp;
11347 # }
11348 ()
11349
11350
11351 def p_statement_item_24(p):
11352 '''statement_item : K_if '(' expression ')' statement_or_null K_else statement_or_null '''
11353 if(parse_debug):
11354 print('statement_item_24', list(p))
11355
11356 # { PCondit*tmp = new PCondit(p[3], p[5], p[7]);
11357 # FILE_NAME(tmp, @1);
11358 # p[0] = tmp;
11359 # }
11360 ()
11361
11362
11363 def p_statement_item_25(p):
11364 '''statement_item : K_if '(' error ')' statement_or_null %prec less_than_K_else '''
11365 if(parse_debug):
11366 print('statement_item_25', list(p))
11367
11368 # { yyerror(@1, "error: Malformed conditional expression.");
11369 # p[0] = p[5];
11370 # }
11371 ()
11372
11373
11374 def p_statement_item_26(p):
11375 '''statement_item : K_if '(' error ')' statement_or_null K_else statement_or_null '''
11376 if(parse_debug):
11377 print('statement_item_26', list(p))
11378
11379 # { yyerror(@1, "error: Malformed conditional expression.");
11380 # p[0] = p[5];
11381 # }
11382 ()
11383
11384
11385 def p_statement_item_27(p):
11386 '''statement_item : compressed_statement ';' '''
11387 if(parse_debug):
11388 print('statement_item_27', list(p))
11389 p[0] = p[1]
11390
11391
11392 ()
11393
11394
11395 def p_statement_item_28(p):
11396 '''statement_item : inc_or_dec_expression ';' '''
11397 if(parse_debug):
11398 print('statement_item_28', list(p))
11399
11400 # { p[0] = pform_compressed_assign_from_inc_dec(@1, p[1]); }
11401 ()
11402
11403
11404 def p_statement_item_29(p):
11405 '''statement_item : delay1 statement_or_null '''
11406 if(parse_debug):
11407 print('statement_item_29', list(p))
11408
11409 # { PExpr*del = p[1]->front();
11410 # assert(p[1]->size() == 1);
11411 # delete p[1];
11412 # PDelayStatement*tmp = new PDelayStatement(del, p[2]);
11413 # FILE_NAME(tmp, @1);
11414 # p[0] = tmp;
11415 # }
11416 ()
11417
11418
11419 def p_statement_item_30(p):
11420 '''statement_item : event_control statement_or_null '''
11421 if(parse_debug):
11422 print('statement_item_30', list(p))
11423
11424 # { PEventStatement*tmp = p[1];
11425 # if (tmp == 0) {
11426 # yyerror(@1, "error: Invalid event control.");
11427 # p[0] = None
11428 # } else {
11429 # tmp->set_statement(p[2]);
11430 # p[0] = tmp;
11431 # }
11432 # }
11433 ()
11434
11435
11436 def p_statement_item_31(p):
11437 '''statement_item : '@' '*' statement_or_null '''
11438 if(parse_debug):
11439 print('statement_item_31', list(p))
11440
11441 # { PEventStatement*tmp = new PEventStatement;
11442 # FILE_NAME(tmp, @1);
11443 # tmp->set_statement(p[3]);
11444 # p[0] = tmp;
11445 # }
11446 ()
11447
11448
11449 def p_statement_item_32(p):
11450 '''statement_item : '@' '(' '*' ')' statement_or_null '''
11451 if(parse_debug):
11452 print('statement_item_32', list(p))
11453
11454 # { PEventStatement*tmp = new PEventStatement;
11455 # FILE_NAME(tmp, @1);
11456 # tmp->set_statement(p[5]);
11457 # p[0] = tmp;
11458 # }
11459 ()
11460
11461
11462 def p_statement_item_33(p):
11463 '''statement_item : lpvalue '=' expression ';' '''
11464 if(parse_debug):
11465 print('statement_item33', list(p))
11466 if p[3]:
11467 expr = Node(syms.expr_stmt, [p[1], Leaf(token.EQUAL, p[2]), p[3]])
11468 if(parse_debug):
11469 print("expr TODO", repr(expr))
11470 else:
11471 expr = Node(syms.expr_stmt, [p[1], Leaf(token.EQUAL, p[2]), ])
11472 if(parse_debug):
11473 print("expr", repr(expr))
11474 if(parse_debug):
11475 print("expr (python):'%s'" % expr)
11476 p[0] = expr
11477
11478 # { PAssign*tmp = new PAssign(p[1],p[3]);
11479 # FILE_NAME(tmp, @1);
11480 # p[0] = tmp;
11481 # }
11482 ()
11483
11484
11485 def p_statement_item_34(p):
11486 '''statement_item : error '=' expression ';' '''
11487 if(parse_debug):
11488 print('statement_item_34', list(p))
11489
11490 # { yyerror(@2, "Syntax in assignment statement l-value.");
11491 # yyerrok;
11492 # p[0] = new PNoop;
11493 # }
11494 ()
11495
11496
11497 def p_statement_item_35(p):
11498 '''statement_item : lpvalue K_LE expression ';' '''
11499 if(parse_debug):
11500 print('statement_item_35', list(p))
11501
11502 # { PAssignNB*tmp = new PAssignNB(p[1],p[3]);
11503 # FILE_NAME(tmp, @1);
11504 # p[0] = tmp;
11505 # }
11506 ()
11507
11508
11509 def p_statement_item_36(p):
11510 '''statement_item : error K_LE expression ';' '''
11511 if(parse_debug):
11512 print('statement_item_36', list(p))
11513
11514 # { yyerror(@2, "Syntax in assignment statement l-value.");
11515 # yyerrok;
11516 # p[0] = new PNoop;
11517 # }
11518 ()
11519
11520
11521 def p_statement_item_37(p):
11522 '''statement_item : lpvalue '=' delay1 expression ';' '''
11523 if(parse_debug):
11524 print('statement_item_37', list(p))
11525
11526 # { PExpr*del = p[3]->front(); p[3]->pop_front();
11527 # assert(p[3]->empty());
11528 # PAssign*tmp = new PAssign(p[1],del,p[4]);
11529 # FILE_NAME(tmp, @1);
11530 # p[0] = tmp;
11531 # }
11532 ()
11533
11534
11535 def p_statement_item_38(p):
11536 '''statement_item : lpvalue K_LE delay1 expression ';' '''
11537 if(parse_debug):
11538 print('statement_item_38', list(p))
11539
11540 # { PExpr*del = p[3]->front(); p[3]->pop_front();
11541 # assert(p[3]->empty());
11542 # PAssignNB*tmp = new PAssignNB(p[1],del,p[4]);
11543 # FILE_NAME(tmp, @1);
11544 # p[0] = tmp;
11545 # }
11546 ()
11547
11548
11549 def p_statement_item_39(p):
11550 '''statement_item : lpvalue '=' event_control expression ';' '''
11551 if(parse_debug):
11552 print('statement_item_39', list(p))
11553
11554 # { PAssign*tmp = new PAssign(p[1],0,p[3],p[4]);
11555 # FILE_NAME(tmp, @1);
11556 # p[0] = tmp;
11557 # }
11558 ()
11559
11560
11561 def p_statement_item_40(p):
11562 '''statement_item : lpvalue '=' K_repeat '(' expression ')' event_control expression ';' '''
11563 if(parse_debug):
11564 print('statement_item_40', list(p))
11565
11566 # { PAssign*tmp = new PAssign(p[1],p[5],p[7],p[8]);
11567 # FILE_NAME(tmp,@1);
11568 # tmp->set_lineno(@1.first_line);
11569 # p[0] = tmp;
11570 # }
11571 ()
11572
11573
11574 def p_statement_item_41(p):
11575 '''statement_item : lpvalue K_LE event_control expression ';' '''
11576 if(parse_debug):
11577 print('statement_item_41', list(p))
11578
11579 # { PAssignNB*tmp = new PAssignNB(p[1],0,p[3],p[4]);
11580 # FILE_NAME(tmp, @1);
11581 # p[0] = tmp;
11582 # }
11583 ()
11584
11585
11586 def p_statement_item_42(p):
11587 '''statement_item : lpvalue K_LE K_repeat '(' expression ')' event_control expression ';' '''
11588 if(parse_debug):
11589 print('statement_item_42', list(p))
11590
11591 # { PAssignNB*tmp = new PAssignNB(p[1],p[5],p[7],p[8]);
11592 # FILE_NAME(tmp, @1);
11593 # p[0] = tmp;
11594 # }
11595 ()
11596
11597
11598 def p_statement_item_43(p):
11599 '''statement_item : lpvalue '=' dynamic_array_new ';' '''
11600 if(parse_debug):
11601 print('statement_item_43', list(p))
11602
11603 # { PAssign*tmp = new PAssign(p[1],p[3]);
11604 # FILE_NAME(tmp, @1);
11605 # p[0] = tmp;
11606 # }
11607 ()
11608
11609
11610 def p_statement_item_44(p):
11611 '''statement_item : lpvalue '=' class_new ';' '''
11612 if(parse_debug):
11613 print('statement_item_44', list(p))
11614
11615 # { PAssign*tmp = new PAssign(p[1],p[3]);
11616 # FILE_NAME(tmp, @1);
11617 # p[0] = tmp;
11618 # }
11619 ()
11620
11621
11622 def p_statement_item_45(p):
11623 '''statement_item : K_wait '(' expression ')' statement_or_null '''
11624 if(parse_debug):
11625 print('statement_item_45', list(p))
11626
11627 # { PEventStatement*tmp;
11628 # PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, p[3]);
11629 # tmp = new PEventStatement(etmp);
11630 # FILE_NAME(tmp,@1);
11631 # tmp->set_statement(p[5]);
11632 # p[0] = tmp;
11633 # }
11634 ()
11635
11636
11637 def p_statement_item_46(p):
11638 '''statement_item : K_wait K_fork ';' '''
11639 if(parse_debug):
11640 print('statement_item_46', list(p))
11641
11642 # { PEventStatement*tmp = new PEventStatement((PEEvent*)0);
11643 # FILE_NAME(tmp,@1);
11644 # p[0] = tmp;
11645 # }
11646 ()
11647
11648
11649 def p_statement_item_47(p):
11650 '''statement_item : SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';' '''
11651 if(parse_debug):
11652 print('statement_item_47', list(p))
11653
11654 # { PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), *p[3]);
11655 # FILE_NAME(tmp,@1);
11656 # delete[]p[1];
11657 # delete p[3];
11658 # p[0] = tmp;
11659 # }
11660 ()
11661
11662
11663 def p_statement_item_48(p):
11664 '''statement_item : SYSTEM_IDENTIFIER ';' '''
11665 if(parse_debug):
11666 print('statement_item_48', list(p))
11667
11668 # { list<PExpr*>pt;
11669 # PCallTask*tmp = new PCallTask(lex_strings.make(p[1]), pt);
11670 # FILE_NAME(tmp,@1);
11671 # delete[]p[1];
11672 # p[0] = tmp;
11673 # }
11674 ()
11675
11676
11677 def p_statement_item_49(p):
11678 '''statement_item : hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
11679 if(parse_debug):
11680 print('statement_item_49', list(p))
11681
11682 # { PCallTask*tmp = pform_make_call_task(@1, *p[1], *p[3]);
11683 # delete p[1];
11684 # delete p[3];
11685 # p[0] = tmp;
11686 # }
11687 ()
11688
11689
11690 def p_statement_item_50(p):
11691 '''statement_item : hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';' '''
11692 if(parse_debug):
11693 print('statement_item_50', list(p))
11694
11695 # { /* ....randomize with { <constraints> } */
11696 # if (p[1] && peek_tail_name(*p[1]) == "randomize") {
11697 # if (!gn_system_verilog())
11698 # yyerror(@2, "error: Randomize with constraint requires SystemVerilog.");
11699 # else
11700 # yyerror(@2, "sorry: Randomize with constraint not supported.");
11701 # } else {
11702 # yyerror(@2, "error: Constraint block can only be applied to randomize method.");
11703 # }
11704 # list<PExpr*>pt;
11705 # PCallTask*tmp = new PCallTask(*p[1], pt);
11706 # FILE_NAME(tmp, @1);
11707 # delete p[1];
11708 # p[0] = tmp;
11709 # }
11710 ()
11711
11712
11713 def p_statement_item_51(p):
11714 '''statement_item : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
11715 if(parse_debug):
11716 print('statement_item_51', list(p))
11717
11718 # { pform_name_t*t_name = p[1];
11719 # while (! p[3]->empty()) {
11720 # t_name->push_back(p[3]->front());
11721 # p[3]->pop_front();
11722 # }
11723 # PCallTask*tmp = new PCallTask(*t_name, *p[5]);
11724 # FILE_NAME(tmp, @1);
11725 # delete p[1];
11726 # delete p[3];
11727 # delete p[5];
11728 # p[0] = tmp;
11729 # }
11730 ()
11731
11732
11733 def p_statement_item_52(p):
11734 '''statement_item : hierarchy_identifier ';' '''
11735 if(parse_debug):
11736 print('statement_item_52', list(p))
11737
11738 # { list<PExpr*>pt;
11739 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
11740 # delete p[1];
11741 # p[0] = tmp;
11742 # }
11743 ()
11744
11745
11746 def p_statement_item_53(p):
11747 '''statement_item : implicit_class_handle '.' K_new '(' expression_list_with_nuls ')' ';' '''
11748 if(parse_debug):
11749 print('statement_item_53', list(p))
11750
11751 # { PChainConstructor*tmp = new PChainConstructor(*p[5]);
11752 # FILE_NAME(tmp, @3);
11753 # delete p[1];
11754 # p[0] = tmp;
11755 # }
11756 ()
11757
11758
11759 def p_statement_item_54(p):
11760 '''statement_item : hierarchy_identifier '(' error ')' ';' '''
11761 if(parse_debug):
11762 print('statement_item_54', list(p))
11763
11764 # { yyerror(@3, "error: Syntax error in task arguments.");
11765 # list<PExpr*>pt;
11766 # PCallTask*tmp = pform_make_call_task(@1, *p[1], pt);
11767 # delete p[1];
11768 # p[0] = tmp;
11769 # }
11770 ()
11771
11772
11773 def p_statement_item_55(p):
11774 '''statement_item : error ';' '''
11775 if(parse_debug):
11776 print('statement_item_55', list(p))
11777
11778 # { yyerror(@2, "error: malformed statement");
11779 # yyerrok;
11780 # p[0] = new PNoop;
11781 # }
11782 ()
11783
11784
11785 def p__embed0_statement_item(p):
11786 '''_embed0_statement_item : '''
11787
11788 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_SEQ);
11789 # FILE_NAME(tmp, @1);
11790 # current_block_stack.push(tmp);
11791 # }
11792 ()
11793
11794
11795 def p__embed1_statement_item(p):
11796 '''_embed1_statement_item : '''
11797
11798 # { if (p[3]) {
11799 # if (! gn_system_verilog()) {
11800 # yyerror("error: Variable declaration in unnamed block "
11801 # "requires SystemVerilog.");
11802 # }
11803 # } else {
11804 # /* If there are no declarations in the scope then just delete it. */
11805 # pform_pop_scope();
11806 # assert(! current_block_stack.empty());
11807 # PBlock*tmp = current_block_stack.top();
11808 # current_block_stack.pop();
11809 # delete tmp;
11810 # }
11811 # }
11812 ()
11813
11814
11815 def p__embed2_statement_item(p):
11816 '''_embed2_statement_item : '''
11817
11818 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_SEQ);
11819 # FILE_NAME(tmp, @1);
11820 # current_block_stack.push(tmp);
11821 # }
11822 ()
11823
11824
11825 def p__embed3_statement_item(p):
11826 '''_embed3_statement_item : '''
11827
11828 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
11829 # FILE_NAME(tmp, @1);
11830 # current_block_stack.push(tmp);
11831 # }
11832 ()
11833
11834
11835 def p__embed4_statement_item(p):
11836 '''_embed4_statement_item : '''
11837
11838 # { if (p[3]) {
11839 # if (! gn_system_verilog()) {
11840 # yyerror("error: Variable declaration in unnamed block "
11841 # "requires SystemVerilog.");
11842 # }
11843 # } else {
11844 # /* If there are no declarations in the scope then just delete it. */
11845 # pform_pop_scope();
11846 # assert(! current_block_stack.empty());
11847 # PBlock*tmp = current_block_stack.top();
11848 # current_block_stack.pop();
11849 # delete tmp;
11850 # }
11851 # }
11852 ()
11853
11854
11855 def p__embed5_statement_item(p):
11856 '''_embed5_statement_item : '''
11857
11858 # { PBlock*tmp = pform_push_block_scope(p[3], PBlock::BL_PAR);
11859 # FILE_NAME(tmp, @1);
11860 # current_block_stack.push(tmp);
11861 # }
11862 ()
11863
11864
11865 def p_compressed_statement_1(p):
11866 '''compressed_statement : lpvalue K_PLUS_EQ expression '''
11867 if(parse_debug):
11868 print('compressed_statement_1', list(p))
11869
11870 # { PAssign*tmp = new PAssign(p[1], '+', p[3]);
11871 # FILE_NAME(tmp, @1);
11872 # p[0] = tmp;
11873 # }
11874 ()
11875
11876
11877 def p_compressed_statement_2(p):
11878 '''compressed_statement : lpvalue K_MINUS_EQ expression '''
11879 if(parse_debug):
11880 print('compressed_statement_2', list(p))
11881
11882 # { PAssign*tmp = new PAssign(p[1], '-', p[3]);
11883 # FILE_NAME(tmp, @1);
11884 # p[0] = tmp;
11885 # }
11886 ()
11887
11888
11889 def p_compressed_statement_3(p):
11890 '''compressed_statement : lpvalue K_MUL_EQ expression '''
11891 if(parse_debug):
11892 print('compressed_statement_3', list(p))
11893
11894 # { PAssign*tmp = new PAssign(p[1], '*', p[3]);
11895 # FILE_NAME(tmp, @1);
11896 # p[0] = tmp;
11897 # }
11898 ()
11899
11900
11901 def p_compressed_statement_4(p):
11902 '''compressed_statement : lpvalue K_DIV_EQ expression '''
11903 if(parse_debug):
11904 print('compressed_statement_4', list(p))
11905
11906 # { PAssign*tmp = new PAssign(p[1], '/', p[3]);
11907 # FILE_NAME(tmp, @1);
11908 # p[0] = tmp;
11909 # }
11910 ()
11911
11912
11913 def p_compressed_statement_5(p):
11914 '''compressed_statement : lpvalue K_MOD_EQ expression '''
11915 if(parse_debug):
11916 print('compressed_statement_5', list(p))
11917
11918 # { PAssign*tmp = new PAssign(p[1], '%', p[3]);
11919 # FILE_NAME(tmp, @1);
11920 # p[0] = tmp;
11921 # }
11922 ()
11923
11924
11925 def p_compressed_statement_6(p):
11926 '''compressed_statement : lpvalue K_AND_EQ expression '''
11927 if(parse_debug):
11928 print('compressed_statement_6', list(p))
11929
11930 # { PAssign*tmp = new PAssign(p[1], '&', p[3]);
11931 # FILE_NAME(tmp, @1);
11932 # p[0] = tmp;
11933 # }
11934 ()
11935
11936
11937 def p_compressed_statement_7(p):
11938 '''compressed_statement : lpvalue K_OR_EQ expression '''
11939 if(parse_debug):
11940 print('compressed_statement_7', list(p))
11941
11942 # { PAssign*tmp = new PAssign(p[1], '|', p[3]);
11943 # FILE_NAME(tmp, @1);
11944 # p[0] = tmp;
11945 # }
11946 ()
11947
11948
11949 def p_compressed_statement_8(p):
11950 '''compressed_statement : lpvalue K_XOR_EQ expression '''
11951 if(parse_debug):
11952 print('compressed_statement_8', list(p))
11953
11954 # { PAssign*tmp = new PAssign(p[1], '^', p[3]);
11955 # FILE_NAME(tmp, @1);
11956 # p[0] = tmp;
11957 # }
11958 ()
11959
11960
11961 def p_compressed_statement_9(p):
11962 '''compressed_statement : lpvalue K_LS_EQ expression '''
11963 if(parse_debug):
11964 print('compressed_statement_9', list(p))
11965
11966 # { PAssign *tmp = new PAssign(p[1], 'l', p[3]);
11967 # FILE_NAME(tmp, @1);
11968 # p[0] = tmp;
11969 # }
11970 ()
11971
11972
11973 def p_compressed_statement_10(p):
11974 '''compressed_statement : lpvalue K_RS_EQ expression '''
11975 if(parse_debug):
11976 print('compressed_statement_10', list(p))
11977
11978 # { PAssign*tmp = new PAssign(p[1], 'r', p[3]);
11979 # FILE_NAME(tmp, @1);
11980 # p[0] = tmp;
11981 # }
11982 ()
11983
11984
11985 def p_compressed_statement_11(p):
11986 '''compressed_statement : lpvalue K_RSS_EQ expression '''
11987 if(parse_debug):
11988 print('compressed_statement_11', list(p))
11989
11990 # { PAssign *tmp = new PAssign(p[1], 'R', p[3]);
11991 # FILE_NAME(tmp, @1);
11992 # p[0] = tmp;
11993 # }
11994 ()
11995
11996
11997 def p_statement_or_null_list_opt_1(p):
11998 '''statement_or_null_list_opt : statement_or_null_list '''
11999 if(parse_debug):
12000 print('statement_or_null_list_opt_1', list(p))
12001 p[0] = p[1]
12002
12003
12004 ()
12005
12006
12007 def p_statement_or_null_list_opt_2(p):
12008 '''statement_or_null_list_opt : '''
12009 if(parse_debug):
12010 print('statement_or_null_list_opt_2', list(p))
12011
12012 # { p[0] = None }
12013 ()
12014
12015
12016 def p_statement_or_null_list_1(p):
12017 '''statement_or_null_list : statement_or_null_list statement_or_null '''
12018 if(parse_debug):
12019 print('statement_or_null_list_1', list(p))
12020
12021 # { vector<Statement*>*tmp = p[1];
12022 # if (p[2]) tmp->push_back(p[2]);
12023 # p[0] = tmp;
12024 # }
12025 ()
12026
12027
12028 def p_statement_or_null_list_2(p):
12029 '''statement_or_null_list : statement_or_null '''
12030 if(parse_debug):
12031 print('statement_or_null_list_2', list(p))
12032
12033 # { vector<Statement*>*tmp = new vector<Statement*>(0);
12034 # if (p[1]) tmp->push_back(p[1]);
12035 # p[0] = tmp;
12036 # }
12037 ()
12038
12039
12040 def p_analog_statement_1(p):
12041 '''analog_statement : branch_probe_expression K_CONTRIBUTE expression ';' '''
12042 if(parse_debug):
12043 print('analog_statement_1', list(p))
12044
12045 # { p[0] = pform_contribution_statement(@2, p[1], p[3]); }
12046 ()
12047
12048
12049 def p_task_item_1(p):
12050 '''task_item : block_item_decl '''
12051 if(parse_debug):
12052 print('task_item_1', list(p))
12053
12054 # { p[0] = new vector<pform_tf_port_t>(0); }
12055 ()
12056
12057
12058 def p_task_item_2(p):
12059 '''task_item : tf_port_declaration '''
12060 if(parse_debug):
12061 print('task_item_2', list(p))
12062 p[0] = p[1]
12063
12064
12065 ()
12066
12067
12068 def p_task_item_list_1(p):
12069 '''task_item_list : task_item_list task_item '''
12070 if(parse_debug):
12071 print('task_item_list_1', list(p))
12072
12073 # { vector<pform_tf_port_t>*tmp = p[1];
12074 # size_t s1 = tmp->size();
12075 # tmp->resize(s1 + p[2]->size());
12076 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
12077 # tmp->at(s1 + idx) = p[2]->at(idx);
12078 # delete p[2];
12079 # p[0] = tmp;
12080 # }
12081 ()
12082
12083
12084 def p_task_item_list_2(p):
12085 '''task_item_list : task_item '''
12086 if(parse_debug):
12087 print('task_item_list_2', list(p))
12088 p[0] = p[1]
12089
12090
12091 ()
12092
12093
12094 def p_task_item_list_opt_1(p):
12095 '''task_item_list_opt : task_item_list '''
12096 if(parse_debug):
12097 print('task_item_list_opt_1', list(p))
12098 p[0] = p[1]
12099
12100
12101 ()
12102
12103
12104 def p_task_item_list_opt_2(p):
12105 '''task_item_list_opt : '''
12106 if(parse_debug):
12107 print('task_item_list_opt_2', list(p))
12108
12109 # { p[0] = None }
12110 ()
12111
12112
12113 def p_tf_port_list_opt_1(p):
12114 '''tf_port_list_opt : tf_port_list '''
12115 if(parse_debug):
12116 print('tf_port_list_opt_1', list(p))
12117 p[0] = p[1]
12118
12119
12120 ()
12121
12122
12123 def p_tf_port_list_opt_2(p):
12124 '''tf_port_list_opt : '''
12125 if(parse_debug):
12126 print('tf_port_list_opt_2', list(p))
12127
12128 # { p[0] = None }
12129 ()
12130
12131
12132 def p_udp_body_1(p):
12133 '''udp_body : K_table udp_entry_list K_endtable '''
12134 if(parse_debug):
12135 print('udp_body_1', list(p))
12136
12137 # { lex_end_table();
12138 # p[0] = p[2];
12139 # }
12140 ()
12141
12142
12143 def p_udp_body_2(p):
12144 '''udp_body : K_table K_endtable '''
12145 if(parse_debug):
12146 print('udp_body_2', list(p))
12147
12148 # { lex_end_table();
12149 # yyerror(@1, "error: Empty UDP table.");
12150 # p[0] = None
12151 # }
12152 ()
12153
12154
12155 def p_udp_body_3(p):
12156 '''udp_body : K_table error K_endtable '''
12157 if(parse_debug):
12158 print('udp_body_3', list(p))
12159
12160 # { lex_end_table();
12161 # yyerror(@2, "Errors in UDP table");
12162 # yyerrok;
12163 # p[0] = None
12164 # }
12165 ()
12166
12167
12168 def p_udp_entry_list_1(p):
12169 '''udp_entry_list : udp_comb_entry_list '''
12170 if(parse_debug):
12171 print('udp_entry_list_1', list(p))
12172
12173
12174 ()
12175
12176
12177 def p_udp_entry_list_2(p):
12178 '''udp_entry_list : udp_sequ_entry_list '''
12179 if(parse_debug):
12180 print('udp_entry_list_2', list(p))
12181
12182
12183 ()
12184
12185
12186 def p_udp_comb_entry_1(p):
12187 '''udp_comb_entry : udp_input_list ':' udp_output_sym ';' '''
12188 if(parse_debug):
12189 print('udp_comb_entry_1', list(p))
12190
12191 # { char*tmp = new char[strlen(p[1])+3];
12192 # strcpy(tmp, p[1]);
12193 # char*tp = tmp+strlen(tmp);
12194 # *tp++ = ':';
12195 # *tp++ = p[3];
12196 # *tp++ = 0;
12197 # delete[]p[1];
12198 # p[0] = tmp;
12199 # }
12200 ()
12201
12202
12203 def p_udp_comb_entry_list_1(p):
12204 '''udp_comb_entry_list : udp_comb_entry '''
12205 if(parse_debug):
12206 print('udp_comb_entry_list_1', list(p))
12207
12208 # { list<string>*tmp = new list<string>;
12209 # tmp->push_back(p[1]);
12210 # delete[]p[1];
12211 # p[0] = tmp;
12212 # }
12213 ()
12214
12215
12216 def p_udp_comb_entry_list_2(p):
12217 '''udp_comb_entry_list : udp_comb_entry_list udp_comb_entry '''
12218 if(parse_debug):
12219 print('udp_comb_entry_list_2', list(p))
12220
12221 # { list<string>*tmp = p[1];
12222 # tmp->push_back(p[2]);
12223 # delete[]p[2];
12224 # p[0] = tmp;
12225 # }
12226 ()
12227
12228
12229 def p_udp_sequ_entry_list_1(p):
12230 '''udp_sequ_entry_list : udp_sequ_entry '''
12231 if(parse_debug):
12232 print('udp_sequ_entry_list_1', list(p))
12233
12234 # { list<string>*tmp = new list<string>;
12235 # tmp->push_back(p[1]);
12236 # delete[]p[1];
12237 # p[0] = tmp;
12238 # }
12239 ()
12240
12241
12242 def p_udp_sequ_entry_list_2(p):
12243 '''udp_sequ_entry_list : udp_sequ_entry_list udp_sequ_entry '''
12244 if(parse_debug):
12245 print('udp_sequ_entry_list_2', list(p))
12246
12247 # { list<string>*tmp = p[1];
12248 # tmp->push_back(p[2]);
12249 # delete[]p[2];
12250 # p[0] = tmp;
12251 # }
12252 ()
12253
12254
12255 def p_udp_sequ_entry_1(p):
12256 '''udp_sequ_entry : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' '''
12257 if(parse_debug):
12258 print('udp_sequ_entry_1', list(p))
12259
12260 # { char*tmp = new char[strlen(p[1])+5];
12261 # strcpy(tmp, p[1]);
12262 # char*tp = tmp+strlen(tmp);
12263 # *tp++ = ':';
12264 # *tp++ = p[3];
12265 # *tp++ = ':';
12266 # *tp++ = p[5];
12267 # *tp++ = 0;
12268 # p[0] = tmp;
12269 # }
12270 ()
12271
12272
12273 def p_udp_initial_1(p):
12274 '''udp_initial : K_initial IDENTIFIER '=' number ';' '''
12275 if(parse_debug):
12276 print('udp_initial_1', list(p))
12277
12278 # { PExpr*etmp = new PENumber(p[4]);
12279 # PEIdent*itmp = new PEIdent(lex_strings.make(p[2]));
12280 # PAssign*atmp = new PAssign(itmp, etmp);
12281 # FILE_NAME(atmp, @2);
12282 # delete[]p[2];
12283 # p[0] = atmp;
12284 # }
12285 ()
12286
12287
12288 def p_udp_init_opt_1(p):
12289 '''udp_init_opt : udp_initial '''
12290 if(parse_debug):
12291 print('udp_init_opt_1', list(p))
12292 p[0] = p[1]
12293
12294
12295 ()
12296
12297
12298 def p_udp_init_opt_2(p):
12299 '''udp_init_opt : '''
12300 if(parse_debug):
12301 print('udp_init_opt_2', list(p))
12302
12303 # { p[0] = None }
12304 ()
12305
12306
12307 def p_udp_input_list_1(p):
12308 '''udp_input_list : udp_input_sym '''
12309 if(parse_debug):
12310 print('udp_input_list_1', list(p))
12311
12312 # { char*tmp = new char[2];
12313 # tmp[0] = p[1];
12314 # tmp[1] = 0;
12315 # p[0] = tmp;
12316 # }
12317 ()
12318
12319
12320 def p_udp_input_list_2(p):
12321 '''udp_input_list : udp_input_list udp_input_sym '''
12322 if(parse_debug):
12323 print('udp_input_list_2', list(p))
12324
12325 # { char*tmp = new char[strlen(p[1])+2];
12326 # strcpy(tmp, p[1]);
12327 # char*tp = tmp+strlen(tmp);
12328 # *tp++ = p[2];
12329 # *tp++ = 0;
12330 # delete[]p[1];
12331 # p[0] = tmp;
12332 # }
12333 ()
12334
12335
12336 def p_udp_input_sym_1(p):
12337 '''udp_input_sym : '0' '''
12338 if(parse_debug):
12339 print('udp_input_sym_1', list(p))
12340
12341 # { p[0] = '0'; }
12342 ()
12343
12344
12345 def p_udp_input_sym_2(p):
12346 '''udp_input_sym : '1' '''
12347 if(parse_debug):
12348 print('udp_input_sym_2', list(p))
12349
12350 # { p[0] = '1'; }
12351 ()
12352
12353
12354 def p_udp_input_sym_3(p):
12355 '''udp_input_sym : 'x' '''
12356 if(parse_debug):
12357 print('udp_input_sym_3', list(p))
12358
12359 # { p[0] = 'x'; }
12360 ()
12361
12362
12363 def p_udp_input_sym_4(p):
12364 '''udp_input_sym : '?' '''
12365 if(parse_debug):
12366 print('udp_input_sym_4', list(p))
12367
12368 # { p[0] = '?'; }
12369 ()
12370
12371
12372 def p_udp_input_sym_5(p):
12373 '''udp_input_sym : 'b' '''
12374 if(parse_debug):
12375 print('udp_input_sym_5', list(p))
12376
12377 # { p[0] = 'b'; }
12378 ()
12379
12380
12381 def p_udp_input_sym_6(p):
12382 '''udp_input_sym : '*' '''
12383 if(parse_debug):
12384 print('udp_input_sym_6', list(p))
12385
12386 # { p[0] = '*'; }
12387 ()
12388
12389
12390 def p_udp_input_sym_7(p):
12391 '''udp_input_sym : '%' '''
12392 if(parse_debug):
12393 print('udp_input_sym_7', list(p))
12394
12395 # { p[0] = '%'; }
12396 ()
12397
12398
12399 def p_udp_input_sym_8(p):
12400 '''udp_input_sym : 'f' '''
12401 if(parse_debug):
12402 print('udp_input_sym_8', list(p))
12403
12404 # { p[0] = 'f'; }
12405 ()
12406
12407
12408 def p_udp_input_sym_9(p):
12409 '''udp_input_sym : 'F' '''
12410 if(parse_debug):
12411 print('udp_input_sym_9', list(p))
12412
12413 # { p[0] = 'F'; }
12414 ()
12415
12416
12417 def p_udp_input_sym_10(p):
12418 '''udp_input_sym : 'l' '''
12419 if(parse_debug):
12420 print('udp_input_sym_10', list(p))
12421
12422 # { p[0] = 'l'; }
12423 ()
12424
12425
12426 def p_udp_input_sym_11(p):
12427 '''udp_input_sym : 'h' '''
12428 if(parse_debug):
12429 print('udp_input_sym_11', list(p))
12430
12431 # { p[0] = 'h'; }
12432 ()
12433
12434
12435 def p_udp_input_sym_12(p):
12436 '''udp_input_sym : 'B' '''
12437 if(parse_debug):
12438 print('udp_input_sym_12', list(p))
12439
12440 # { p[0] = 'B'; }
12441 ()
12442
12443
12444 def p_udp_input_sym_13(p):
12445 '''udp_input_sym : 'r' '''
12446 if(parse_debug):
12447 print('udp_input_sym_13', list(p))
12448
12449 # { p[0] = 'r'; }
12450 ()
12451
12452
12453 def p_udp_input_sym_14(p):
12454 '''udp_input_sym : 'R' '''
12455 if(parse_debug):
12456 print('udp_input_sym_14', list(p))
12457
12458 # { p[0] = 'R'; }
12459 ()
12460
12461
12462 def p_udp_input_sym_15(p):
12463 '''udp_input_sym : 'M' '''
12464 if(parse_debug):
12465 print('udp_input_sym_15', list(p))
12466
12467 # { p[0] = 'M'; }
12468 ()
12469
12470
12471 def p_udp_input_sym_16(p):
12472 '''udp_input_sym : 'n' '''
12473 if(parse_debug):
12474 print('udp_input_sym_16', list(p))
12475
12476 # { p[0] = 'n'; }
12477 ()
12478
12479
12480 def p_udp_input_sym_17(p):
12481 '''udp_input_sym : 'N' '''
12482 if(parse_debug):
12483 print('udp_input_sym_17', list(p))
12484
12485 # { p[0] = 'N'; }
12486 ()
12487
12488
12489 def p_udp_input_sym_18(p):
12490 '''udp_input_sym : 'p' '''
12491 if(parse_debug):
12492 print('udp_input_sym_18', list(p))
12493
12494 # { p[0] = 'p'; }
12495 ()
12496
12497
12498 def p_udp_input_sym_19(p):
12499 '''udp_input_sym : 'P' '''
12500 if(parse_debug):
12501 print('udp_input_sym_19', list(p))
12502
12503 # { p[0] = 'P'; }
12504 ()
12505
12506
12507 def p_udp_input_sym_20(p):
12508 '''udp_input_sym : 'Q' '''
12509 if(parse_debug):
12510 print('udp_input_sym_20', list(p))
12511
12512 # { p[0] = 'Q'; }
12513 ()
12514
12515
12516 def p_udp_input_sym_21(p):
12517 '''udp_input_sym : 'q' '''
12518 if(parse_debug):
12519 print('udp_input_sym_21', list(p))
12520
12521 # { p[0] = 'q'; }
12522 ()
12523
12524
12525 def p_udp_input_sym_22(p):
12526 '''udp_input_sym : '_' '''
12527 if(parse_debug):
12528 print('udp_input_sym_22', list(p))
12529
12530 # { p[0] = '_'; }
12531 ()
12532
12533
12534 def p_udp_input_sym_23(p):
12535 '''udp_input_sym : '+' '''
12536 if(parse_debug):
12537 print('udp_input_sym_23', list(p))
12538
12539 # { p[0] = '+'; }
12540 ()
12541
12542
12543 def p_udp_input_sym_24(p):
12544 '''udp_input_sym : DEC_NUMBER '''
12545 if(parse_debug):
12546 print('udp_input_sym_24', list(p))
12547
12548 # { yyerror(@1, "internal error: Input digits parse as decimal number!"); p[0] = '0'; }
12549 ()
12550
12551
12552 def p_udp_output_sym_1(p):
12553 '''udp_output_sym : '0' '''
12554 if(parse_debug):
12555 print('udp_output_sym_1', list(p))
12556
12557 # { p[0] = '0'; }
12558 ()
12559
12560
12561 def p_udp_output_sym_2(p):
12562 '''udp_output_sym : '1' '''
12563 if(parse_debug):
12564 print('udp_output_sym_2', list(p))
12565
12566 # { p[0] = '1'; }
12567 ()
12568
12569
12570 def p_udp_output_sym_3(p):
12571 '''udp_output_sym : 'x' '''
12572 if(parse_debug):
12573 print('udp_output_sym_3', list(p))
12574
12575 # { p[0] = 'x'; }
12576 ()
12577
12578
12579 def p_udp_output_sym_4(p):
12580 '''udp_output_sym : '-' '''
12581 if(parse_debug):
12582 print('udp_output_sym_4', list(p))
12583
12584 # { p[0] = '-'; }
12585 ()
12586
12587
12588 def p_udp_output_sym_5(p):
12589 '''udp_output_sym : DEC_NUMBER '''
12590 if(parse_debug):
12591 print('udp_output_sym_5', list(p))
12592
12593 # { yyerror(@1, "internal error: Output digits parse as decimal number!"); p[0] = '0'; }
12594 ()
12595
12596
12597 def p_udp_port_decl_1(p):
12598 '''udp_port_decl : K_input list_of_identifiers ';' '''
12599 if(parse_debug):
12600 print('udp_port_decl_1', list(p))
12601
12602 # { p[0] = pform_make_udp_input_ports(p[2]); }
12603 ()
12604
12605
12606 def p_udp_port_decl_2(p):
12607 '''udp_port_decl : K_output IDENTIFIER ';' '''
12608 if(parse_debug):
12609 print('udp_port_decl_2', list(p))
12610
12611 # { perm_string pname = lex_strings.make(p[2]);
12612 # PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
12613 # vector<PWire*>*tmp = new vector<PWire*>(1);
12614 # (*tmp)[0] = pp;
12615 # p[0] = tmp;
12616 # delete[]p[2];
12617 # }
12618 ()
12619
12620
12621 def p_udp_port_decl_3(p):
12622 '''udp_port_decl : K_reg IDENTIFIER ';' '''
12623 if(parse_debug):
12624 print('udp_port_decl_3', list(p))
12625
12626 # { perm_string pname = lex_strings.make(p[2]);
12627 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
12628 # vector<PWire*>*tmp = new vector<PWire*>(1);
12629 # (*tmp)[0] = pp;
12630 # p[0] = tmp;
12631 # delete[]p[2];
12632 # }
12633 ()
12634
12635
12636 def p_udp_port_decl_4(p):
12637 '''udp_port_decl : K_reg K_output IDENTIFIER ';' '''
12638 if(parse_debug):
12639 print('udp_port_decl_4', list(p))
12640
12641 # { perm_string pname = lex_strings.make(p[3]);
12642 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
12643 # vector<PWire*>*tmp = new vector<PWire*>(1);
12644 # (*tmp)[0] = pp;
12645 # p[0] = tmp;
12646 # delete[]p[3];
12647 # }
12648 ()
12649
12650
12651 def p_udp_port_decls_1(p):
12652 '''udp_port_decls : udp_port_decl '''
12653 if(parse_debug):
12654 print('udp_port_decls_1', list(p))
12655 p[0] = p[1]
12656
12657
12658 ()
12659
12660
12661 def p_udp_port_decls_2(p):
12662 '''udp_port_decls : udp_port_decls udp_port_decl '''
12663 if(parse_debug):
12664 print('udp_port_decls_2', list(p))
12665
12666 # { vector<PWire*>*tmp = p[1];
12667 # size_t s1 = p[1]->size();
12668 # tmp->resize(s1+p[2]->size());
12669 # for (size_t idx = 0 ; idx < p[2]->size() ; idx += 1)
12670 # tmp->at(s1+idx) = p[2]->at(idx);
12671 # p[0] = tmp;
12672 # delete p[2];
12673 # }
12674 ()
12675
12676
12677 def p_udp_port_list_1(p):
12678 '''udp_port_list : IDENTIFIER '''
12679 if(parse_debug):
12680 print('udp_port_list_1', list(p))
12681
12682 # { list<perm_string>*tmp = new list<perm_string>;
12683 # tmp->push_back(lex_strings.make(p[1]));
12684 # delete[]p[1];
12685 # p[0] = tmp;
12686 # }
12687 ()
12688
12689
12690 def p_udp_port_list_2(p):
12691 '''udp_port_list : udp_port_list ',' IDENTIFIER '''
12692 if(parse_debug):
12693 print('udp_port_list_2', list(p))
12694
12695 # { list<perm_string>*tmp = p[1];
12696 # tmp->push_back(lex_strings.make(p[3]));
12697 # delete[]p[3];
12698 # p[0] = tmp;
12699 # }
12700 ()
12701
12702
12703 def p_udp_reg_opt_1(p):
12704 '''udp_reg_opt : K_reg '''
12705 if(parse_debug):
12706 print('udp_reg_opt_1', list(p))
12707 p[0] = True
12708
12709
12710 ()
12711
12712
12713 def p_udp_reg_opt_2(p):
12714 '''udp_reg_opt : '''
12715 if(parse_debug):
12716 print('udp_reg_opt_2', list(p))
12717 p[0] = False
12718
12719
12720 ()
12721
12722
12723 def p_udp_initial_expr_opt_1(p):
12724 '''udp_initial_expr_opt : '=' expression '''
12725 if(parse_debug):
12726 print('udp_initial_expr_opt_1', list(p))
12727 p[0] = p[2]
12728
12729
12730 ()
12731
12732
12733 def p_udp_initial_expr_opt_2(p):
12734 '''udp_initial_expr_opt : '''
12735 if(parse_debug):
12736 print('udp_initial_expr_opt_2', list(p))
12737
12738 # { p[0] = None }
12739 ()
12740
12741
12742 def p_udp_input_declaration_list_1(p):
12743 '''udp_input_declaration_list : K_input IDENTIFIER '''
12744 if(parse_debug):
12745 print('udp_input_declaration_list_1', list(p))
12746
12747 # { list<perm_string>*tmp = new list<perm_string>;
12748 # tmp->push_back(lex_strings.make(p[2]));
12749 # p[0] = tmp;
12750 # delete[]p[2];
12751 # }
12752 ()
12753
12754
12755 def p_udp_input_declaration_list_2(p):
12756 '''udp_input_declaration_list : udp_input_declaration_list ',' K_input IDENTIFIER '''
12757 if(parse_debug):
12758 print('udp_input_declaration_list_2', list(p))
12759
12760 # { list<perm_string>*tmp = p[1];
12761 # tmp->push_back(lex_strings.make(p[4]));
12762 # p[0] = tmp;
12763 # delete[]p[4];
12764 # }
12765 ()
12766
12767
12768 def p_udp_primitive_1(p):
12769 '''udp_primitive : K_primitive IDENTIFIER '(' udp_port_list ')' ';' udp_port_decls udp_init_opt udp_body K_endprimitive endlabel_opt '''
12770 if(parse_debug):
12771 print('udp_primitive_1', list(p))
12772
12773 # { perm_string tmp2 = lex_strings.make(p[2]);
12774 # pform_make_udp(tmp2, p[4], p[7], p[9], p[8],
12775 # @2.text, @2.first_line);
12776 # if (p[11]) {
12777 # if (strcmp(p[2],p[11]) != 0) {
12778 # yyerror(@11, "error: End label doesn't match "
12779 # "primitive name");
12780 # }
12781 # if (! gn_system_verilog()) {
12782 # yyerror(@11, "error: Primitive end labels "
12783 # "require SystemVerilog.");
12784 # }
12785 # delete[]p[11];
12786 # }
12787 # delete[]p[2];
12788 # }
12789 ()
12790
12791
12792 def p_udp_primitive_2(p):
12793 '''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 '''
12794 if(parse_debug):
12795 print('udp_primitive_2', list(p))
12796
12797 # { perm_string tmp2 = lex_strings.make(p[2]);
12798 # perm_string tmp6 = lex_strings.make(p[6]);
12799 # pform_make_udp(tmp2, p[5], tmp6, p[7], p[9], p[12],
12800 # @2.text, @2.first_line);
12801 # if (p[14]) {
12802 # if (strcmp(p[2],p[14]) != 0) {
12803 # yyerror(@14, "error: End label doesn't match "
12804 # "primitive name");
12805 # }
12806 # if (! gn_system_verilog()) {
12807 # yyerror(@14, "error: Primitive end labels "
12808 # "require SystemVerilog.");
12809 # }
12810 # delete[]p[14];
12811 # }
12812 # delete[]p[2];
12813 # delete[]p[6];
12814 # }
12815 ()
12816
12817
12818 def p_K_packed_opt_1(p):
12819 '''K_packed_opt : K_packed '''
12820 if(parse_debug):
12821 print('K_packed_opt', list(p))
12822 p[0] = True
12823
12824
12825 ()
12826
12827
12828 def p_K_packed_opt_2(p):
12829 '''K_packed_opt : '''
12830 if(parse_debug):
12831 print('K_packed_opt', list(p))
12832 p[0] = False
12833
12834
12835 ()
12836
12837
12838 def p_K_reg_opt_1(p):
12839 '''K_reg_opt : K_reg '''
12840 if(parse_debug):
12841 print('K_reg_opt', list(p))
12842 p[0] = True
12843
12844
12845 ()
12846
12847
12848 def p_K_reg_opt_2(p):
12849 '''K_reg_opt : '''
12850 if(parse_debug):
12851 print('K_reg_opt', list(p))
12852 p[0] = False
12853
12854
12855 ()
12856
12857
12858 def p_K_static_opt_1(p):
12859 '''K_static_opt : K_static '''
12860 if(parse_debug):
12861 print('K_static_opt', list(p))
12862 p[0] = True
12863
12864
12865 ()
12866
12867
12868 def p_K_static_opt_2(p):
12869 '''K_static_opt : '''
12870 if(parse_debug):
12871 print('K_static_opt', list(p))
12872 p[0] = False
12873
12874
12875 ()
12876
12877
12878 def p_K_virtual_opt_1(p):
12879 '''K_virtual_opt : K_virtual '''
12880 if(parse_debug):
12881 print(p)
12882 p[0] = True
12883
12884
12885 ()
12886
12887
12888 def p_K_virtual_opt_2(p):
12889 '''K_virtual_opt : '''
12890 if(parse_debug):
12891 print(p)
12892 p[0] = False
12893
12894
12895 ()
12896
12897
12898 def p_error(p):
12899 if(parse_debug):
12900 print("error", p)
12901 exit(0)
12902
12903
12904 yacc.yacc(debug=0)