add extra pass-through rules
[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 from lib2to3.pytree import Node, Leaf
23 from lib2to3.pgen2 import token
24 from lib2to3.pygram import python_symbols as syms
25
26 from ply import yacc, lex
27
28 #from parse_tokens import tokens
29 import lexor
30 tokens = lexor.tokens # list(set(lexor.tokens).union(set(tokens)))
31 literals = lexor.literals
32
33 precedence = [\
34 ('right', 'K_PLUS_EQ', 'K_MINUS_EQ', 'K_MUL_EQ', 'K_DIV_EQ',
35 'K_MOD_EQ', 'K_AND_EQ', 'K_OR_EQ'),
36 ('right', 'K_XOR_EQ', 'K_LS_EQ', 'K_RS_EQ', 'K_RSS_EQ'),
37 ('right', '?', ':', 'K_inside'),
38 ('left', 'K_LOR'),
39 ('left', 'K_LAND'),
40 ('left', '|'),
41 ('left', '^', 'K_NXOR', 'K_NOR'),
42 ('left', '&', 'K_NAND'),
43 ('left', 'K_EQ', 'K_NE', 'K_CEQ', 'K_CNE', 'K_WEQ', 'K_WNE'),
44 ('left', 'K_GE', 'K_LE', '<', '>'),
45 ('left', 'K_LS', 'K_RS', 'K_RSS'),
46 ('left', '+', '-'),
47 ('left', '*', '/', '%'),
48 ('left', 'K_POW'),
49 ('left', 'UNARY_PREC'),
50 ('nonassoc', 'less_than_K_else'),
51 ('nonassoc', 'K_else'),
52 ('nonassoc', '('),
53 ('nonassoc', 'K_exclude'),
54 ('nonassoc', 'no_timeunits_declaration'),
55 ('nonassoc', 'one_timeunits_declaration'),
56 ('nonassoc', 'K_timeunit', 'K_timeprecision')
57 ]
58 ()
59 # -------------- RULES ----------------
60 ()
61 def p_source_text_1(p):
62 '''source_text : timeunits_declaration_opt _embed0_source_text description_list '''
63 print('source_text', list(p))
64 ()
65 def p_source_text_2(p):
66 '''source_text : '''
67 print('source_text', list(p))
68 ()
69 def p__embed0_source_text(p):
70 '''_embed0_source_text : '''
71 # { pform_set_scope_timescale(yyloc); }
72 ()
73 def p_assertion_item_1(p):
74 '''assertion_item : concurrent_assertion_item '''
75 print('assertion_item_1', list(p))
76 ()
77 def p_assignment_pattern_1(p):
78 '''assignment_pattern : K_LP expression_list_proper '}' '''
79 print('assignment_pattern_1', list(p))
80 # { PEAssignPattern*tmp = new PEAssignPattern(*$2);
81 # FILE_NAME(tmp, @1);
82 # delete $2;
83 # $$ = tmp;
84 # }
85 ()
86 def p_assignment_pattern_2(p):
87 '''assignment_pattern : K_LP '}' '''
88 print('assignment_pattern_2', list(p))
89 # { PEAssignPattern*tmp = new PEAssignPattern;
90 # FILE_NAME(tmp, @1);
91 # $$ = tmp;
92 # }
93 ()
94 def p_block_identifier_opt_1(p):
95 '''block_identifier_opt : IDENTIFIER ':' '''
96 print('block_identifier_opt_1', list(p))
97 ()
98 def p_block_identifier_opt_2(p):
99 '''block_identifier_opt : '''
100 print('block_identifier_opt_2', list(p))
101 ()
102 def p_class_declaration_1(p):
103 '''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 '''
104 print('class_declaration_1', list(p))
105 # { // Wrap up the class.
106 # if ($11 && $4 && $4->name != $11) {
107 # yyerror(@11, "error: Class end label doesn't match class name.");
108 # delete[]$11;
109 # }
110 # }
111 ()
112 def p__embed0_class_declaration(p):
113 '''_embed0_class_declaration : '''
114 # { pform_start_class_declaration(@2, $4, $5.type, $5.exprs, $3); }
115 ()
116 def p__embed1_class_declaration(p):
117 '''_embed1_class_declaration : '''
118 # { // Process a class.
119 # pform_end_class_declaration(@9);
120 # }
121 ()
122 def p_class_constraint_1(p):
123 '''class_constraint : constraint_prototype '''
124 print('class_constraint_1', list(p))
125 ()
126 def p_class_constraint_2(p):
127 '''class_constraint : constraint_declaration '''
128 print('class_constraint_2', list(p))
129 ()
130 def p_class_identifier_1(p):
131 '''class_identifier : IDENTIFIER '''
132 print('class_identifier_1', list(p))
133 # { // Create a synthetic typedef for the class name so that the
134 # // lexor detects the name as a type.
135 # perm_string name = lex_strings.make($1);
136 # class_type_t*tmp = new class_type_t(name);
137 # FILE_NAME(tmp, @1);
138 # pform_set_typedef(name, tmp, NULL);
139 # delete[]$1;
140 # $$ = tmp;
141 # }
142 ()
143 def p_class_identifier_2(p):
144 '''class_identifier : TYPE_IDENTIFIER '''
145 print('class_identifier_2', list(p))
146 # { class_type_t*tmp = dynamic_cast<class_type_t*>($1.type);
147 # if (tmp == 0) {
148 # yyerror(@1, "Type name \"%s\"is not a predeclared class name.", $1.text);
149 # }
150 # delete[]$1.text;
151 # $$ = tmp;
152 # }
153 ()
154 def p_class_declaration_endlabel_opt_1(p):
155 '''class_declaration_endlabel_opt : ':' TYPE_IDENTIFIER '''
156 print('class_declaration_endlabel_opt_1', list(p))
157 # { class_type_t*tmp = dynamic_cast<class_type_t*> ($2.type);
158 # if (tmp == 0) {
159 # yyerror(@2, "error: class declaration endlabel \"%s\" is not a class name\n", $2.text);
160 # $$ = 0;
161 # } else {
162 # $$ = strdupnew(tmp->name.str());
163 # }
164 # delete[]$2.text;
165 # }
166 ()
167 def p_class_declaration_endlabel_opt_2(p):
168 '''class_declaration_endlabel_opt : ':' IDENTIFIER '''
169 print('class_declaration_endlabel_opt_2', list(p))
170 p[0] = p[2]
171 ()
172 def p_class_declaration_endlabel_opt_3(p):
173 '''class_declaration_endlabel_opt : '''
174 print('class_declaration_endlabel_opt_3', list(p))
175 # { $$ = 0; }
176 ()
177 def p_class_declaration_extends_opt_1(p):
178 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '''
179 print('class_declaration_extends_opt_1', list(p))
180 # { $$.type = $2.type;
181 # $$.exprs= 0;
182 # delete[]$2.text;
183 # }
184 ()
185 def p_class_declaration_extends_opt_2(p):
186 '''class_declaration_extends_opt : K_extends TYPE_IDENTIFIER '(' expression_list_with_nuls ')' '''
187 print('class_declaration_extends_opt_2', list(p))
188 # { $$.type = $2.type;
189 # $$.exprs = $4;
190 # delete[]$2.text;
191 # }
192 ()
193 def p_class_declaration_extends_opt_3(p):
194 '''class_declaration_extends_opt : '''
195 print('class_declaration_extends_opt_3', list(p))
196 # { $$.type = 0; $$.exprs = 0; }
197 ()
198 def p_class_items_opt_1(p):
199 '''class_items_opt : class_items '''
200 print('class_items_opt_1', list(p))
201 ()
202 def p_class_items_opt_2(p):
203 '''class_items_opt : '''
204 print('class_items_opt_2', list(p))
205 ()
206 def p_class_items_1(p):
207 '''class_items : class_items class_item '''
208 print('class_items_1', list(p))
209 ()
210 def p_class_items_2(p):
211 '''class_items : class_item '''
212 print('class_items_2', list(p))
213 ()
214 def p_class_item_1(p):
215 '''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 '''
216 print('class_item_1', list(p))
217 # { current_function->set_ports($6);
218 # pform_set_constructor_return(current_function);
219 # pform_set_this_class(@3, current_function);
220 # current_function_set_statement(@3, $10);
221 # pform_pop_scope();
222 # current_function = 0;
223 # }
224 ()
225 def p_class_item_2(p):
226 '''class_item : property_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
227 print('class_item_2', list(p))
228 # { pform_class_property(@2, $1, $2, $3); }
229 ()
230 def p_class_item_3(p):
231 '''class_item : K_const class_item_qualifier_opt data_type list_of_variable_decl_assignments ';' '''
232 print('class_item_3', list(p))
233 # { pform_class_property(@1, $2 | property_qualifier_t::make_const(), $3, $4); }
234 ()
235 def p_class_item_4(p):
236 '''class_item : method_qualifier_opt task_declaration '''
237 print('class_item_4', list(p))
238 # { /* The task_declaration rule puts this into the class */ }
239 ()
240 def p_class_item_5(p):
241 '''class_item : method_qualifier_opt function_declaration '''
242 print('class_item_5', list(p))
243 # { /* The function_declaration rule puts this into the class */ }
244 ()
245 def p_class_item_6(p):
246 '''class_item : K_extern method_qualifier_opt K_function K_new ';' '''
247 print('class_item_6', list(p))
248 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
249 ()
250 def p_class_item_7(p):
251 '''class_item : K_extern method_qualifier_opt K_function K_new '(' tf_port_list_opt ')' ';' '''
252 print('class_item_7', list(p))
253 # { yyerror(@1, "sorry: External constructors are not yet supported."); }
254 ()
255 def p_class_item_8(p):
256 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER ';' '''
257 print('class_item_8', list(p))
258 # { yyerror(@1, "sorry: External methods are not yet supported.");
259 # delete[] $5;
260 # }
261 ()
262 def p_class_item_9(p):
263 '''class_item : K_extern method_qualifier_opt K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' ';' '''
264 print('class_item_9', list(p))
265 # { yyerror(@1, "sorry: External methods are not yet supported.");
266 # delete[] $5;
267 # }
268 ()
269 def p_class_item_10(p):
270 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER ';' '''
271 print('class_item_10', list(p))
272 # { yyerror(@1, "sorry: External methods are not yet supported.");
273 # delete[] $4;
274 # }
275 ()
276 def p_class_item_11(p):
277 '''class_item : K_extern method_qualifier_opt K_task IDENTIFIER '(' tf_port_list_opt ')' ';' '''
278 print('class_item_11', list(p))
279 # { yyerror(@1, "sorry: External methods are not yet supported.");
280 # delete[] $4;
281 # }
282 ()
283 def p_class_item_12(p):
284 '''class_item : class_constraint '''
285 print('class_item_12', list(p))
286 ()
287 def p_class_item_13(p):
288 '''class_item : property_qualifier_opt data_type error ';' '''
289 print('class_item_13', list(p))
290 # { yyerror(@3, "error: Errors in variable names after data type.");
291 # yyerrok;
292 # }
293 ()
294 def p_class_item_14(p):
295 '''class_item : property_qualifier_opt IDENTIFIER error ';' '''
296 print('class_item_14', list(p))
297 # { yyerror(@3, "error: %s doesn't name a type.", $2);
298 # yyerrok;
299 # }
300 ()
301 def p_class_item_15(p):
302 '''class_item : method_qualifier_opt K_function K_new error K_endfunction endnew_opt '''
303 print('class_item_15', list(p))
304 # { yyerror(@1, "error: I give up on this class constructor declaration.");
305 # yyerrok;
306 # }
307 ()
308 def p_class_item_16(p):
309 '''class_item : error ';' '''
310 print('class_item_16', list(p))
311 # { yyerror(@2, "error: invalid class item.");
312 # yyerrok;
313 # }
314 ()
315 def p__embed0_class_item(p):
316 '''_embed0_class_item : '''
317 # { assert(current_function==0);
318 # current_function = pform_push_constructor_scope(@3);
319 # }
320 ()
321 def p_class_item_qualifier_1(p):
322 '''class_item_qualifier : K_static '''
323 print('class_item_qualifier_1', list(p))
324 # { $$ = property_qualifier_t::make_static(); }
325 ()
326 def p_class_item_qualifier_2(p):
327 '''class_item_qualifier : K_protected '''
328 print('class_item_qualifier_2', list(p))
329 # { $$ = property_qualifier_t::make_protected(); }
330 ()
331 def p_class_item_qualifier_3(p):
332 '''class_item_qualifier : K_local '''
333 print('class_item_qualifier_3', list(p))
334 # { $$ = property_qualifier_t::make_local(); }
335 ()
336 def p_class_item_qualifier_list_1(p):
337 '''class_item_qualifier_list : class_item_qualifier_list class_item_qualifier '''
338 print('class_item_qualifier_list_1', list(p))
339 # { $$ = $1 | $2; }
340 ()
341 def p_class_item_qualifier_list_2(p):
342 '''class_item_qualifier_list : class_item_qualifier '''
343 print('class_item_qualifier_list_2', list(p))
344 p[0] = p[1]
345 ()
346 def p_class_item_qualifier_opt_1(p):
347 '''class_item_qualifier_opt : class_item_qualifier_list '''
348 print('class_item_qualifier_opt_1', list(p))
349 p[0] = p[1]
350 ()
351 def p_class_item_qualifier_opt_2(p):
352 '''class_item_qualifier_opt : '''
353 print('class_item_qualifier_opt_2', list(p))
354 # { $$ = property_qualifier_t::make_none(); }
355 ()
356 def p_class_new_1(p):
357 '''class_new : K_new '(' expression_list_with_nuls ')' '''
358 print('class_new_1', list(p))
359 # { list<PExpr*>*expr_list = $3;
360 # strip_tail_items(expr_list);
361 # PENewClass*tmp = new PENewClass(*expr_list);
362 # FILE_NAME(tmp, @1);
363 # delete $3;
364 # $$ = tmp;
365 # }
366 ()
367 def p_class_new_2(p):
368 '''class_new : K_new hierarchy_identifier '''
369 print('class_new_2', list(p))
370 # { PEIdent*tmpi = new PEIdent(*$2);
371 # FILE_NAME(tmpi, @2);
372 # PENewCopy*tmp = new PENewCopy(tmpi);
373 # FILE_NAME(tmp, @1);
374 # delete $2;
375 # $$ = tmp;
376 # }
377 ()
378 def p_class_new_3(p):
379 '''class_new : K_new '''
380 print('class_new_3', list(p))
381 # { PENewClass*tmp = new PENewClass;
382 # FILE_NAME(tmp, @1);
383 # $$ = tmp;
384 # }
385 ()
386 def p_concurrent_assertion_item_1(p):
387 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' property_spec ')' statement_or_null '''
388 print('concurrent_assertion_item_1', list(p))
389 # { /* */
390 # if (gn_assertions_flag) {
391 # yyerror(@2, "sorry: concurrent_assertion_item not supported."
392 # " Try -gno-assertion to turn this message off.");
393 # }
394 # }
395 ()
396 def p_concurrent_assertion_item_2(p):
397 '''concurrent_assertion_item : block_identifier_opt K_assert K_property '(' error ')' statement_or_null '''
398 print('concurrent_assertion_item_2', list(p))
399 # { yyerrok;
400 # yyerror(@2, "error: Error in property_spec of concurrent assertion item.");
401 # }
402 ()
403 def p_constraint_block_item_1(p):
404 '''constraint_block_item : constraint_expression '''
405 print('constraint_block_item_1', list(p))
406 ()
407 def p_constraint_block_item_list_1(p):
408 '''constraint_block_item_list : constraint_block_item_list constraint_block_item '''
409 print('constraint_block_item_list_1', list(p))
410 ()
411 def p_constraint_block_item_list_2(p):
412 '''constraint_block_item_list : constraint_block_item '''
413 print('constraint_block_item_list_2', list(p))
414 ()
415 def p_constraint_block_item_list_opt_1(p):
416 '''constraint_block_item_list_opt : '''
417 print('constraint_block_item_list_opt_1', list(p))
418 ()
419 def p_constraint_block_item_list_opt_2(p):
420 '''constraint_block_item_list_opt : constraint_block_item_list '''
421 print('constraint_block_item_list_opt_2', list(p))
422 ()
423 def p_constraint_declaration_1(p):
424 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' constraint_block_item_list_opt '}' '''
425 print('constraint_declaration_1', list(p))
426 # { yyerror(@2, "sorry: Constraint declarations not supported."); }
427 ()
428 def p_constraint_declaration_2(p):
429 '''constraint_declaration : K_static_opt K_constraint IDENTIFIER '{' error '}' '''
430 print('constraint_declaration_2', list(p))
431 # { yyerror(@4, "error: Errors in the constraint block item list."); }
432 ()
433 def p_constraint_expression_1(p):
434 '''constraint_expression : expression ';' '''
435 print('constraint_expression_1', list(p))
436 ()
437 def p_constraint_expression_2(p):
438 '''constraint_expression : expression K_dist '{' '}' ';' '''
439 print('constraint_expression_2', list(p))
440 ()
441 def p_constraint_expression_3(p):
442 '''constraint_expression : expression K_TRIGGER constraint_set '''
443 print('constraint_expression_3', list(p))
444 ()
445 def p_constraint_expression_4(p):
446 '''constraint_expression : K_if '(' expression ')' constraint_set %prec less_than_K_else '''
447 print('constraint_expression_4', list(p))
448 ()
449 def p_constraint_expression_5(p):
450 '''constraint_expression : K_if '(' expression ')' constraint_set K_else constraint_set '''
451 print('constraint_expression_5', list(p))
452 ()
453 def p_constraint_expression_6(p):
454 '''constraint_expression : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' constraint_set '''
455 print('constraint_expression_6', list(p))
456 ()
457 def p_constraint_expression_list_1(p):
458 '''constraint_expression_list : constraint_expression_list constraint_expression '''
459 print('constraint_expression_list_1', list(p))
460 ()
461 def p_constraint_expression_list_2(p):
462 '''constraint_expression_list : constraint_expression '''
463 print('constraint_expression_list_2', list(p))
464 ()
465 def p_constraint_prototype_1(p):
466 '''constraint_prototype : K_static_opt K_constraint IDENTIFIER ';' '''
467 print('constraint_prototype_1', list(p))
468 # { yyerror(@2, "sorry: Constraint prototypes not supported."); }
469 ()
470 def p_constraint_set_1(p):
471 '''constraint_set : constraint_expression '''
472 print('constraint_set_1', list(p))
473 ()
474 def p_constraint_set_2(p):
475 '''constraint_set : '{' constraint_expression_list '}' '''
476 print('constraint_set_2', list(p))
477 ()
478 def p_data_declaration_1(p):
479 '''data_declaration : attribute_list_opt data_type_or_implicit list_of_variable_decl_assignments ';' '''
480 print('data_declaration_1', list(p))
481 # { data_type_t*data_type = $2;
482 # if (data_type == 0) {
483 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
484 # FILE_NAME(data_type, @2);
485 # }
486 # pform_makewire(@2, 0, str_strength, $3, NetNet::IMPLICIT_REG, data_type);
487 # }
488 ()
489 def p_data_type_1(p):
490 '''data_type : integer_vector_type unsigned_signed_opt dimensions_opt '''
491 print('data_type_1', list(p))
492 # { ivl_variable_type_t use_vtype = $1;
493 # bool reg_flag = false;
494 # if (use_vtype == IVL_VT_NO_TYPE) {
495 # use_vtype = IVL_VT_LOGIC;
496 # reg_flag = true;
497 # }
498 # vector_type_t*tmp = new vector_type_t(use_vtype, $2, $3);
499 # tmp->reg_flag = reg_flag;
500 # FILE_NAME(tmp, @1);
501 # $$ = tmp;
502 # }
503 ()
504 def p_data_type_2(p):
505 '''data_type : non_integer_type '''
506 print('data_type_2', list(p))
507 # { real_type_t*tmp = new real_type_t($1);
508 # FILE_NAME(tmp, @1);
509 # $$ = tmp;
510 # }
511 ()
512 def p_data_type_3(p):
513 '''data_type : struct_data_type '''
514 print('data_type_3', list(p))
515 # { if (!$1->packed_flag) {
516 # yyerror(@1, "sorry: Unpacked structs not supported.");
517 # }
518 # $$ = $1;
519 # }
520 ()
521 def p_data_type_4(p):
522 '''data_type : enum_data_type '''
523 print('data_type_4', list(p))
524 p[0] = p[1]
525 ()
526 def p_data_type_5(p):
527 '''data_type : atom2_type signed_unsigned_opt '''
528 print('data_type_5', list(p))
529 # { atom2_type_t*tmp = new atom2_type_t($1, $2);
530 # FILE_NAME(tmp, @1);
531 # $$ = tmp;
532 # }
533 ()
534 def p_data_type_6(p):
535 '''data_type : K_integer signed_unsigned_opt '''
536 print('data_type_6', list(p))
537 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
538 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, $2, pd);
539 # tmp->reg_flag = true;
540 # tmp->integer_flag = true;
541 # $$ = tmp;
542 # }
543 ()
544 def p_data_type_7(p):
545 '''data_type : K_time '''
546 print('data_type_7', list(p))
547 # { list<pform_range_t>*pd = make_range_from_width(64);
548 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
549 # tmp->reg_flag = !gn_system_verilog();
550 # $$ = tmp;
551 # }
552 ()
553 def p_data_type_8(p):
554 '''data_type : TYPE_IDENTIFIER dimensions_opt '''
555 print('data_type_8', list(p))
556 # { if ($2) {
557 # parray_type_t*tmp = new parray_type_t($1.type, $2);
558 # FILE_NAME(tmp, @1);
559 # $$ = tmp;
560 # } else $$ = $1.type;
561 # delete[]$1.text;
562 # }
563 ()
564 def p_data_type_9(p):
565 '''data_type : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_data_type TYPE_IDENTIFIER '''
566 print('data_type_9', list(p))
567 # { lex_in_package_scope(0);
568 # $$ = $4.type;
569 # delete[]$4.text;
570 # }
571 ()
572 def p_data_type_10(p):
573 '''data_type : K_string '''
574 print('data_type_10', list(p))
575 # { string_type_t*tmp = new string_type_t;
576 # FILE_NAME(tmp, @1);
577 # $$ = tmp;
578 # }
579 ()
580 def p__embed0_data_type(p):
581 '''_embed0_data_type : '''
582 # { lex_in_package_scope($1); }
583 ()
584 def p_data_type_or_implicit_1(p):
585 '''data_type_or_implicit : data_type '''
586 print('data_type_or_implicit_1', list(p))
587 p[0] = p[1]
588 ()
589 def p_data_type_or_implicit_2(p):
590 '''data_type_or_implicit : signing dimensions_opt '''
591 print('data_type_or_implicit_2', list(p))
592 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, $1, $2);
593 # tmp->implicit_flag = true;
594 # FILE_NAME(tmp, @1);
595 # $$ = tmp;
596 # }
597 ()
598 def p_data_type_or_implicit_3(p):
599 '''data_type_or_implicit : dimensions '''
600 print('data_type_or_implicit_3', list(p))
601 # { vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, $1);
602 # tmp->implicit_flag = true;
603 # FILE_NAME(tmp, @1);
604 # $$ = tmp;
605 # }
606 ()
607 def p_data_type_or_implicit_4(p):
608 '''data_type_or_implicit : '''
609 print('data_type_or_implicit_4', list(p))
610 # { $$ = 0; }
611 ()
612 def p_data_type_or_implicit_or_void_1(p):
613 '''data_type_or_implicit_or_void : data_type_or_implicit '''
614 print('data_type_or_implicit_or_void_1', list(p))
615 p[0] = p[1]
616 ()
617 def p_data_type_or_implicit_or_void_2(p):
618 '''data_type_or_implicit_or_void : K_void '''
619 print('data_type_or_implicit_or_void_2', list(p))
620 # { void_type_t*tmp = new void_type_t;
621 # FILE_NAME(tmp, @1);
622 # $$ = tmp;
623 # }
624 ()
625 def p_description_1(p):
626 '''description : module '''
627 print('description_1', list(p))
628 ()
629 def p_description_2(p):
630 '''description : udp_primitive '''
631 print('description_2', list(p))
632 ()
633 def p_description_3(p):
634 '''description : config_declaration '''
635 print('description_3', list(p))
636 ()
637 def p_description_4(p):
638 '''description : nature_declaration '''
639 print('description_4', list(p))
640 ()
641 def p_description_5(p):
642 '''description : package_declaration '''
643 print('description_5', list(p))
644 ()
645 def p_description_6(p):
646 '''description : discipline_declaration '''
647 print('description_6', list(p))
648 ()
649 def p_description_7(p):
650 '''description : package_item '''
651 print('description_7', list(p))
652 ()
653 def p_description_8(p):
654 '''description : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' '''
655 print('description_8', list(p))
656 # { perm_string tmp3 = lex_strings.make($3);
657 # pform_set_type_attrib(tmp3, $5, $7);
658 # delete[] $3;
659 # delete[] $5;
660 # }
661 ()
662 def p_description_list_1(p):
663 '''description_list : description '''
664 print('description_list_1', list(p))
665 ()
666 def p_description_list_2(p):
667 '''description_list : description_list description '''
668 print('description_list_2', list(p))
669 ()
670 def p_endnew_opt_1(p):
671 '''endnew_opt : ':' K_new '''
672 print('endnew_opt_1', list(p))
673 ()
674 def p_endnew_opt_2(p):
675 '''endnew_opt : '''
676 print('endnew_opt_2', list(p))
677 ()
678 def p_dynamic_array_new_1(p):
679 '''dynamic_array_new : K_new '[' expression ']' '''
680 print('dynamic_array_new_1', list(p))
681 # { $$ = new PENewArray($3, 0);
682 # FILE_NAME($$, @1);
683 # }
684 ()
685 def p_dynamic_array_new_2(p):
686 '''dynamic_array_new : K_new '[' expression ']' '(' expression ')' '''
687 print('dynamic_array_new_2', list(p))
688 # { $$ = new PENewArray($3, $6);
689 # FILE_NAME($$, @1);
690 # }
691 ()
692 def p_for_step_1(p):
693 '''for_step : lpvalue '=' expression '''
694 print('for_step_1', list(p))
695 # { PAssign*tmp = new PAssign($1,$3);
696 # FILE_NAME(tmp, @1);
697 # $$ = tmp;
698 # }
699 ()
700 def p_for_step_2(p):
701 '''for_step : inc_or_dec_expression '''
702 print('for_step_2', list(p))
703 # { $$ = pform_compressed_assign_from_inc_dec(@1, $1); }
704 ()
705 def p_for_step_3(p):
706 '''for_step : compressed_statement '''
707 print('for_step_3', list(p))
708 p[0] = p[1]
709 ()
710 def p_function_declaration_1(p):
711 '''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 '''
712 print('function_declaration_1', list(p))
713 # { // Last step: check any closing name.
714 # if ($11) {
715 # if (strcmp($4,$11) != 0) {
716 # yyerror(@11, "error: End label doesn't match "
717 # "function name");
718 # }
719 # if (! gn_system_verilog()) {
720 # yyerror(@11, "error: Function end labels require "
721 # "SystemVerilog.");
722 # }
723 # delete[]$11;
724 # }
725 # delete[]$4;
726 # }
727 ()
728 def p_function_declaration_2(p):
729 '''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 '''
730 print('function_declaration_2', list(p))
731 # { // Last step: check any closing name.
732 # if ($14) {
733 # if (strcmp($4,$14) != 0) {
734 # yyerror(@14, "error: End label doesn't match "
735 # "function name");
736 # }
737 # if (! gn_system_verilog()) {
738 # yyerror(@14, "error: Function end labels require "
739 # "SystemVerilog.");
740 # }
741 # delete[]$14;
742 # }
743 # delete[]$4;
744 # }
745 ()
746 def p_function_declaration_3(p):
747 '''function_declaration : K_function lifetime_opt data_type_or_implicit_or_void IDENTIFIER error K_endfunction _embed4_function_declaration endlabel_opt '''
748 print('function_declaration_3', list(p))
749 # { // Last step: check any closing name.
750 # if ($8) {
751 # if (strcmp($4,$8) != 0) {
752 # yyerror(@8, "error: End label doesn't match function name");
753 # }
754 # if (! gn_system_verilog()) {
755 # yyerror(@8, "error: Function end labels require "
756 # "SystemVerilog.");
757 # }
758 # delete[]$8;
759 # }
760 # delete[]$4;
761 # }
762 ()
763 def p__embed0_function_declaration(p):
764 '''_embed0_function_declaration : '''
765 # { assert(current_function == 0);
766 # current_function = pform_push_function_scope(@1, $4, $2);
767 # }
768 ()
769 def p__embed1_function_declaration(p):
770 '''_embed1_function_declaration : '''
771 # { current_function->set_ports($7);
772 # current_function->set_return($3);
773 # current_function_set_statement($8? @8 : @4, $8);
774 # pform_set_this_class(@4, current_function);
775 # pform_pop_scope();
776 # current_function = 0;
777 # }
778 ()
779 def p__embed2_function_declaration(p):
780 '''_embed2_function_declaration : '''
781 # { assert(current_function == 0);
782 # current_function = pform_push_function_scope(@1, $4, $2);
783 # }
784 ()
785 def p__embed3_function_declaration(p):
786 '''_embed3_function_declaration : '''
787 # { current_function->set_ports($7);
788 # current_function->set_return($3);
789 # current_function_set_statement($11? @11 : @4, $11);
790 # pform_set_this_class(@4, current_function);
791 # pform_pop_scope();
792 # current_function = 0;
793 # if ($7==0 && !gn_system_verilog()) {
794 # yyerror(@4, "error: Empty parenthesis syntax requires SystemVerilog.");
795 # }
796 # }
797 ()
798 def p__embed4_function_declaration(p):
799 '''_embed4_function_declaration : '''
800 # { /* */
801 # if (current_function) {
802 # pform_pop_scope();
803 # current_function = 0;
804 # }
805 # assert(current_function == 0);
806 # yyerror(@1, "error: Syntax error defining function.");
807 # yyerrok;
808 # }
809 ()
810 def p_import_export_1(p):
811 '''import_export : K_import '''
812 print('import_export_1', list(p))
813 # { $$ = true; }
814 ()
815 def p_import_export_2(p):
816 '''import_export : K_export '''
817 print('import_export_2', list(p))
818 # { $$ = false; }
819 ()
820 def p_implicit_class_handle_1(p):
821 '''implicit_class_handle : K_this '''
822 print('implicit_class_handle_1', list(p))
823 # { $$ = pform_create_this(); }
824 ()
825 def p_implicit_class_handle_2(p):
826 '''implicit_class_handle : K_super '''
827 print('implicit_class_handle_2', list(p))
828 # { $$ = pform_create_super(); }
829 ()
830 def p_inc_or_dec_expression_1(p):
831 '''inc_or_dec_expression : K_INCR lpvalue %prec UNARY_PREC '''
832 print('inc_or_dec_expression_1', list(p))
833 # { PEUnary*tmp = new PEUnary('I', $2);
834 # FILE_NAME(tmp, @2);
835 # $$ = tmp;
836 # }
837 ()
838 def p_inc_or_dec_expression_2(p):
839 '''inc_or_dec_expression : lpvalue K_INCR %prec UNARY_PREC '''
840 print('inc_or_dec_expression_2', list(p))
841 # { PEUnary*tmp = new PEUnary('i', $1);
842 # FILE_NAME(tmp, @1);
843 # $$ = tmp;
844 # }
845 ()
846 def p_inc_or_dec_expression_3(p):
847 '''inc_or_dec_expression : K_DECR lpvalue %prec UNARY_PREC '''
848 print('inc_or_dec_expression_3', list(p))
849 # { PEUnary*tmp = new PEUnary('D', $2);
850 # FILE_NAME(tmp, @2);
851 # $$ = tmp;
852 # }
853 ()
854 def p_inc_or_dec_expression_4(p):
855 '''inc_or_dec_expression : lpvalue K_DECR %prec UNARY_PREC '''
856 print('inc_or_dec_expression_4', list(p))
857 # { PEUnary*tmp = new PEUnary('d', $1);
858 # FILE_NAME(tmp, @1);
859 # $$ = tmp;
860 # }
861 ()
862 def p_inside_expression_1(p):
863 '''inside_expression : expression K_inside '{' open_range_list '}' '''
864 print('inside_expression_1', list(p))
865 # { yyerror(@2, "sorry: \"inside\" expressions not supported yet.");
866 # $$ = 0;
867 # }
868 ()
869 def p_integer_vector_type_1(p):
870 '''integer_vector_type : K_reg '''
871 print('integer_vector_type_1', list(p))
872 # { $$ = IVL_VT_NO_TYPE; }
873 ()
874 def p_integer_vector_type_2(p):
875 '''integer_vector_type : K_bit '''
876 print('integer_vector_type_2', list(p))
877 # { $$ = IVL_VT_BOOL; }
878 ()
879 def p_integer_vector_type_3(p):
880 '''integer_vector_type : K_logic '''
881 print('integer_vector_type_3', list(p))
882 # { $$ = IVL_VT_LOGIC; }
883 ()
884 def p_integer_vector_type_4(p):
885 '''integer_vector_type : K_bool '''
886 print('integer_vector_type_4', list(p))
887 # { $$ = IVL_VT_BOOL; }
888 ()
889 def p_join_keyword_1(p):
890 '''join_keyword : K_join '''
891 print('join_keyword_1', list(p))
892 # { $$ = PBlock::BL_PAR; }
893 ()
894 def p_join_keyword_2(p):
895 '''join_keyword : K_join_none '''
896 print('join_keyword_2', list(p))
897 # { $$ = PBlock::BL_JOIN_NONE; }
898 ()
899 def p_join_keyword_3(p):
900 '''join_keyword : K_join_any '''
901 print('join_keyword_3', list(p))
902 # { $$ = PBlock::BL_JOIN_ANY; }
903 ()
904 def p_jump_statement_1(p):
905 '''jump_statement : K_break ';' '''
906 print('jump_statement_1', list(p))
907 # { yyerror(@1, "sorry: break statements not supported.");
908 # $$ = 0;
909 # }
910 ()
911 def p_jump_statement_2(p):
912 '''jump_statement : K_return ';' '''
913 print('jump_statement_2', list(p))
914 # { PReturn*tmp = new PReturn(0);
915 # FILE_NAME(tmp, @1);
916 # $$ = tmp;
917 # }
918 ()
919 def p_jump_statement_3(p):
920 '''jump_statement : K_return expression ';' '''
921 print('jump_statement_3', list(p))
922 # { PReturn*tmp = new PReturn($2);
923 # FILE_NAME(tmp, @1);
924 # $$ = tmp;
925 # }
926 ()
927 def p_lifetime_1(p):
928 '''lifetime : K_automatic '''
929 print('lifetime_1', list(p))
930 # { $$ = LexicalScope::AUTOMATIC; }
931 ()
932 def p_lifetime_2(p):
933 '''lifetime : K_static '''
934 print('lifetime_2', list(p))
935 # { $$ = LexicalScope::STATIC; }
936 ()
937 def p_lifetime_opt_1(p):
938 '''lifetime_opt : lifetime '''
939 print('lifetime_opt_1', list(p))
940 p[0] = p[1]
941 ()
942 def p_lifetime_opt_2(p):
943 '''lifetime_opt : '''
944 print('lifetime_opt_2', list(p))
945 # { $$ = LexicalScope::INHERITED; }
946 ()
947 def p_loop_statement_1(p):
948 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' for_step ')' statement_or_null '''
949 print('loop_statement_1', list(p))
950 # { PForStatement*tmp = new PForStatement($3, $5, $7, $9, $11);
951 # FILE_NAME(tmp, @1);
952 # $$ = tmp;
953 # }
954 ()
955 def p_loop_statement_2(p):
956 '''loop_statement : K_for '(' data_type IDENTIFIER '=' expression ';' expression ';' for_step ')' _embed0_loop_statement statement_or_null '''
957 print('loop_statement_2', list(p))
958 # { pform_name_t tmp_hident;
959 # tmp_hident.push_back(name_component_t(lex_strings.make($4)));
960 #
961 # PEIdent*tmp_ident = pform_new_ident(tmp_hident);
962 # FILE_NAME(tmp_ident, @4);
963 #
964 # PForStatement*tmp_for = new PForStatement(tmp_ident, $6, $8, $10, $13);
965 # FILE_NAME(tmp_for, @1);
966 #
967 # pform_pop_scope();
968 # vector<Statement*>tmp_for_list (1);
969 # tmp_for_list[0] = tmp_for;
970 # PBlock*tmp_blk = current_block_stack.top();
971 # current_block_stack.pop();
972 # tmp_blk->set_statement(tmp_for_list);
973 # $$ = tmp_blk;
974 # delete[]$4;
975 # }
976 ()
977 def p_loop_statement_3(p):
978 '''loop_statement : K_forever statement_or_null '''
979 print('loop_statement_3', list(p))
980 # { PForever*tmp = new PForever($2);
981 # FILE_NAME(tmp, @1);
982 # $$ = tmp;
983 # }
984 ()
985 def p_loop_statement_4(p):
986 '''loop_statement : K_repeat '(' expression ')' statement_or_null '''
987 print('loop_statement_4', list(p))
988 # { PRepeat*tmp = new PRepeat($3, $5);
989 # FILE_NAME(tmp, @1);
990 # $$ = tmp;
991 # }
992 ()
993 def p_loop_statement_5(p):
994 '''loop_statement : K_while '(' expression ')' statement_or_null '''
995 print('loop_statement_5', list(p))
996 # { PWhile*tmp = new PWhile($3, $5);
997 # FILE_NAME(tmp, @1);
998 # $$ = tmp;
999 # }
1000 ()
1001 def p_loop_statement_6(p):
1002 '''loop_statement : K_do statement_or_null K_while '(' expression ')' ';' '''
1003 print('loop_statement_6', list(p))
1004 # { PDoWhile*tmp = new PDoWhile($5, $2);
1005 # FILE_NAME(tmp, @1);
1006 # $$ = tmp;
1007 # }
1008 ()
1009 def p_loop_statement_7(p):
1010 '''loop_statement : K_foreach '(' IDENTIFIER '[' loop_variables ']' ')' _embed1_loop_statement statement_or_null '''
1011 print('loop_statement_7', list(p))
1012 # { PForeach*tmp_for = pform_make_foreach(@1, $3, $5, $9);
1013 #
1014 # pform_pop_scope();
1015 # vector<Statement*>tmp_for_list(1);
1016 # tmp_for_list[0] = tmp_for;
1017 # PBlock*tmp_blk = current_block_stack.top();
1018 # current_block_stack.pop();
1019 # tmp_blk->set_statement(tmp_for_list);
1020 # $$ = tmp_blk;
1021 # }
1022 ()
1023 def p_loop_statement_8(p):
1024 '''loop_statement : K_for '(' lpvalue '=' expression ';' expression ';' error ')' statement_or_null '''
1025 print('loop_statement_8', list(p))
1026 # { $$ = 0;
1027 # yyerror(@1, "error: Error in for loop step assignment.");
1028 # }
1029 ()
1030 def p_loop_statement_9(p):
1031 '''loop_statement : K_for '(' lpvalue '=' expression ';' error ';' for_step ')' statement_or_null '''
1032 print('loop_statement_9', list(p))
1033 # { $$ = 0;
1034 # yyerror(@1, "error: Error in for loop condition expression.");
1035 # }
1036 ()
1037 def p_loop_statement_10(p):
1038 '''loop_statement : K_for '(' error ')' statement_or_null '''
1039 print('loop_statement_10', list(p))
1040 # { $$ = 0;
1041 # yyerror(@1, "error: Incomprehensible for loop.");
1042 # }
1043 ()
1044 def p_loop_statement_11(p):
1045 '''loop_statement : K_while '(' error ')' statement_or_null '''
1046 print('loop_statement_11', list(p))
1047 # { $$ = 0;
1048 # yyerror(@1, "error: Error in while loop condition.");
1049 # }
1050 ()
1051 def p_loop_statement_12(p):
1052 '''loop_statement : K_do statement_or_null K_while '(' error ')' ';' '''
1053 print('loop_statement_12', list(p))
1054 # { $$ = 0;
1055 # yyerror(@1, "error: Error in do/while loop condition.");
1056 # }
1057 ()
1058 def p_loop_statement_13(p):
1059 '''loop_statement : K_foreach '(' IDENTIFIER '[' error ']' ')' statement_or_null '''
1060 print('loop_statement_13', list(p))
1061 # { $$ = 0;
1062 # yyerror(@4, "error: Errors in foreach loop variables list.");
1063 # }
1064 ()
1065 def p__embed0_loop_statement(p):
1066 '''_embed0_loop_statement : '''
1067 # { static unsigned for_counter = 0;
1068 # char for_block_name [64];
1069 # snprintf(for_block_name, sizeof for_block_name, "$ivl_for_loop%u", for_counter);
1070 # for_counter += 1;
1071 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1072 # FILE_NAME(tmp, @1);
1073 # current_block_stack.push(tmp);
1074 #
1075 # list<decl_assignment_t*>assign_list;
1076 # decl_assignment_t*tmp_assign = new decl_assignment_t;
1077 # tmp_assign->name = lex_strings.make($4);
1078 # assign_list.push_back(tmp_assign);
1079 # pform_makewire(@4, 0, str_strength, &assign_list, NetNet::REG, $3);
1080 # }
1081 ()
1082 def p__embed1_loop_statement(p):
1083 '''_embed1_loop_statement : '''
1084 # { static unsigned foreach_counter = 0;
1085 # char for_block_name[64];
1086 # snprintf(for_block_name, sizeof for_block_name, "$ivl_foreach%u", foreach_counter);
1087 # foreach_counter += 1;
1088 #
1089 # PBlock*tmp = pform_push_block_scope(for_block_name, PBlock::BL_SEQ);
1090 # FILE_NAME(tmp, @1);
1091 # current_block_stack.push(tmp);
1092 #
1093 # pform_make_foreach_declarations(@1, $5);
1094 # }
1095 ()
1096 def p_list_of_variable_decl_assignments_1(p):
1097 '''list_of_variable_decl_assignments : variable_decl_assignment '''
1098 print('list_of_variable_decl_assignments_1', list(p))
1099 # { list<decl_assignment_t*>*tmp = new list<decl_assignment_t*>;
1100 # tmp->push_back($1);
1101 # $$ = tmp;
1102 # }
1103 ()
1104 def p_list_of_variable_decl_assignments_2(p):
1105 '''list_of_variable_decl_assignments : list_of_variable_decl_assignments ',' variable_decl_assignment '''
1106 print('list_of_variable_decl_assignments_2', list(p))
1107 # { list<decl_assignment_t*>*tmp = $1;
1108 # tmp->push_back($3);
1109 # $$ = tmp;
1110 # }
1111 ()
1112 def p_variable_decl_assignment_1(p):
1113 '''variable_decl_assignment : IDENTIFIER dimensions_opt '''
1114 print('variable_decl_assignment_1', list(p))
1115 # { decl_assignment_t*tmp = new decl_assignment_t;
1116 # tmp->name = lex_strings.make($1);
1117 # if ($2) {
1118 # tmp->index = *$2;
1119 # delete $2;
1120 # }
1121 # delete[]$1;
1122 # $$ = tmp;
1123 # }
1124 ()
1125 def p_variable_decl_assignment_2(p):
1126 '''variable_decl_assignment : IDENTIFIER '=' expression '''
1127 print('variable_decl_assignment_2', list(p))
1128 # { decl_assignment_t*tmp = new decl_assignment_t;
1129 # tmp->name = lex_strings.make($1);
1130 # tmp->expr .reset($3);
1131 # delete[]$1;
1132 # $$ = tmp;
1133 # }
1134 ()
1135 def p_variable_decl_assignment_3(p):
1136 '''variable_decl_assignment : IDENTIFIER '=' K_new '(' ')' '''
1137 print('variable_decl_assignment_3', list(p))
1138 # { decl_assignment_t*tmp = new decl_assignment_t;
1139 # tmp->name = lex_strings.make($1);
1140 # PENewClass*expr = new PENewClass;
1141 # FILE_NAME(expr, @3);
1142 # tmp->expr .reset(expr);
1143 # delete[]$1;
1144 # $$ = tmp;
1145 # }
1146 ()
1147 def p_loop_variables_1(p):
1148 '''loop_variables : loop_variables ',' IDENTIFIER '''
1149 print('loop_variables_1', list(p))
1150 # { list<perm_string>*tmp = $1;
1151 # tmp->push_back(lex_strings.make($3));
1152 # delete[]$3;
1153 # $$ = tmp;
1154 # }
1155 ()
1156 def p_loop_variables_2(p):
1157 '''loop_variables : IDENTIFIER '''
1158 print('loop_variables_2', list(p))
1159 # { list<perm_string>*tmp = new list<perm_string>;
1160 # tmp->push_back(lex_strings.make($1));
1161 # delete[]$1;
1162 # $$ = tmp;
1163 # }
1164 ()
1165 def p_method_qualifier_1(p):
1166 '''method_qualifier : K_virtual '''
1167 print('method_qualifier_1', list(p))
1168 ()
1169 def p_method_qualifier_2(p):
1170 '''method_qualifier : class_item_qualifier '''
1171 print('method_qualifier_2', list(p))
1172 ()
1173 def p_method_qualifier_opt_1(p):
1174 '''method_qualifier_opt : method_qualifier '''
1175 print('method_qualifier_opt_1', list(p))
1176 ()
1177 def p_method_qualifier_opt_2(p):
1178 '''method_qualifier_opt : '''
1179 print('method_qualifier_opt_2', list(p))
1180 ()
1181 def p_modport_declaration_1(p):
1182 '''modport_declaration : K_modport _embed0_modport_declaration modport_item_list ';' '''
1183 print('modport_declaration_1', list(p))
1184 ()
1185 def p__embed0_modport_declaration(p):
1186 '''_embed0_modport_declaration : '''
1187 # { if (!pform_in_interface())
1188 # yyerror(@1, "error: modport declarations are only allowed "
1189 # "in interfaces.");
1190 # }
1191 ()
1192 def p_modport_item_list_1(p):
1193 '''modport_item_list : modport_item '''
1194 print('modport_item_list_1', list(p))
1195 ()
1196 def p_modport_item_list_2(p):
1197 '''modport_item_list : modport_item_list ',' modport_item '''
1198 print('modport_item_list_2', list(p))
1199 ()
1200 def p_modport_item_1(p):
1201 '''modport_item : IDENTIFIER _embed0_modport_item '(' modport_ports_list ')' '''
1202 print('modport_item_1', list(p))
1203 # { pform_end_modport_item(@1); }
1204 ()
1205 def p__embed0_modport_item(p):
1206 '''_embed0_modport_item : '''
1207 # { pform_start_modport_item(@1, $1); }
1208 ()
1209 def p_modport_ports_list_1(p):
1210 '''modport_ports_list : modport_ports_declaration '''
1211 print('modport_ports_list_1', list(p))
1212 ()
1213 def p_modport_ports_list_2(p):
1214 '''modport_ports_list : modport_ports_list ',' modport_ports_declaration '''
1215 print('modport_ports_list_2', list(p))
1216 ()
1217 def p_modport_ports_list_3(p):
1218 '''modport_ports_list : modport_ports_list ',' modport_simple_port '''
1219 print('modport_ports_list_3', list(p))
1220 # { if (last_modport_port.type == MP_SIMPLE) {
1221 # pform_add_modport_port(@3, last_modport_port.direction,
1222 # $3->name, $3->parm);
1223 # } else {
1224 # yyerror(@3, "error: modport expression not allowed here.");
1225 # }
1226 # delete $3;
1227 # }
1228 ()
1229 def p_modport_ports_list_4(p):
1230 '''modport_ports_list : modport_ports_list ',' modport_tf_port '''
1231 print('modport_ports_list_4', list(p))
1232 # { if (last_modport_port.type != MP_TF)
1233 # yyerror(@3, "error: task/function declaration not allowed here.");
1234 # }
1235 ()
1236 def p_modport_ports_list_5(p):
1237 '''modport_ports_list : modport_ports_list ',' IDENTIFIER '''
1238 print('modport_ports_list_5', list(p))
1239 # { if (last_modport_port.type == MP_SIMPLE) {
1240 # pform_add_modport_port(@3, last_modport_port.direction,
1241 # lex_strings.make($3), 0);
1242 # } else if (last_modport_port.type != MP_TF) {
1243 # yyerror(@3, "error: list of identifiers not allowed here.");
1244 # }
1245 # delete[] $3;
1246 # }
1247 ()
1248 def p_modport_ports_list_6(p):
1249 '''modport_ports_list : modport_ports_list ',' '''
1250 print('modport_ports_list_6', list(p))
1251 # { yyerror(@2, "error: NULL port declarations are not allowed"); }
1252 ()
1253 def p_modport_ports_declaration_1(p):
1254 '''modport_ports_declaration : attribute_list_opt port_direction IDENTIFIER '''
1255 print('modport_ports_declaration_1', list(p))
1256 # { last_modport_port.type = MP_SIMPLE;
1257 # last_modport_port.direction = $2;
1258 # pform_add_modport_port(@3, $2, lex_strings.make($3), 0);
1259 # delete[] $3;
1260 # delete $1;
1261 # }
1262 ()
1263 def p_modport_ports_declaration_2(p):
1264 '''modport_ports_declaration : attribute_list_opt port_direction modport_simple_port '''
1265 print('modport_ports_declaration_2', list(p))
1266 # { last_modport_port.type = MP_SIMPLE;
1267 # last_modport_port.direction = $2;
1268 # pform_add_modport_port(@3, $2, $3->name, $3->parm);
1269 # delete $3;
1270 # delete $1;
1271 # }
1272 ()
1273 def p_modport_ports_declaration_3(p):
1274 '''modport_ports_declaration : attribute_list_opt import_export IDENTIFIER '''
1275 print('modport_ports_declaration_3', list(p))
1276 # { last_modport_port.type = MP_TF;
1277 # last_modport_port.is_import = $2;
1278 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
1279 # delete[] $3;
1280 # delete $1;
1281 # }
1282 ()
1283 def p_modport_ports_declaration_4(p):
1284 '''modport_ports_declaration : attribute_list_opt import_export modport_tf_port '''
1285 print('modport_ports_declaration_4', list(p))
1286 # { last_modport_port.type = MP_TF;
1287 # last_modport_port.is_import = $2;
1288 # yyerror(@3, "sorry: modport task/function ports are not yet supported.");
1289 # delete $1;
1290 # }
1291 ()
1292 def p_modport_ports_declaration_5(p):
1293 '''modport_ports_declaration : attribute_list_opt K_clocking IDENTIFIER '''
1294 print('modport_ports_declaration_5', list(p))
1295 # { last_modport_port.type = MP_CLOCKING;
1296 # last_modport_port.direction = NetNet::NOT_A_PORT;
1297 # yyerror(@3, "sorry: modport clocking declaration is not yet supported.");
1298 # delete[] $3;
1299 # delete $1;
1300 # }
1301 ()
1302 def p_modport_simple_port_1(p):
1303 '''modport_simple_port : '.' IDENTIFIER '(' expression ')' '''
1304 print('modport_simple_port_1', list(p))
1305 # { named_pexpr_t*tmp = new named_pexpr_t;
1306 # tmp->name = lex_strings.make($2);
1307 # tmp->parm = $4;
1308 # delete[]$2;
1309 # $$ = tmp;
1310 # }
1311 ()
1312 def p_modport_tf_port_1(p):
1313 '''modport_tf_port : K_task IDENTIFIER '''
1314 print('modport_tf_port_1', list(p))
1315 ()
1316 def p_modport_tf_port_2(p):
1317 '''modport_tf_port : K_task IDENTIFIER '(' tf_port_list_opt ')' '''
1318 print('modport_tf_port_2', list(p))
1319 ()
1320 def p_modport_tf_port_3(p):
1321 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '''
1322 print('modport_tf_port_3', list(p))
1323 ()
1324 def p_modport_tf_port_4(p):
1325 '''modport_tf_port : K_function data_type_or_implicit_or_void IDENTIFIER '(' tf_port_list_opt ')' '''
1326 print('modport_tf_port_4', list(p))
1327 ()
1328 def p_non_integer_type_1(p):
1329 '''non_integer_type : K_real '''
1330 print('non_integer_type_1', list(p))
1331 # { $$ = real_type_t::REAL; }
1332 ()
1333 def p_non_integer_type_2(p):
1334 '''non_integer_type : K_realtime '''
1335 print('non_integer_type_2', list(p))
1336 # { $$ = real_type_t::REAL; }
1337 ()
1338 def p_non_integer_type_3(p):
1339 '''non_integer_type : K_shortreal '''
1340 print('non_integer_type_3', list(p))
1341 # { $$ = real_type_t::SHORTREAL; }
1342 ()
1343 def p_number_1(p):
1344 '''number : BASED_NUMBER '''
1345 print('number_1', list(p))
1346 # { $$ = $1; based_size = 0;}
1347 ()
1348 def p_number_2(p):
1349 '''number : DEC_NUMBER '''
1350 print('number_2', list(p))
1351 num = Leaf(token.NUMBER, "%s" % (p[1]))
1352 p[0] = num
1353 # { $$ = $1; based_size = 0;}
1354 ()
1355 def p_number_3(p):
1356 '''number : DEC_NUMBER BASED_NUMBER '''
1357 print('number_3', list(p))
1358 num = Leaf(token.NUMBER, "%s:%s" % (p[1], p[2]))
1359 p[0] = num
1360 # { $$ = pform_verinum_with_size($1,$2, @2.text, @2.first_line);
1361 # based_size = 0; }
1362 ()
1363 def p_number_4(p):
1364 '''number : UNBASED_NUMBER '''
1365 print('number_4', list(p))
1366 # { $$ = $1; based_size = 0;}
1367 ()
1368 def p_number_5(p):
1369 '''number : DEC_NUMBER UNBASED_NUMBER '''
1370 print('number_5', list(p))
1371 # { yyerror(@1, "error: Unbased SystemVerilog literal cannot have "
1372 # "a size.");
1373 # $$ = $1; based_size = 0;}
1374 ()
1375 def p_open_range_list_1(p):
1376 '''open_range_list : open_range_list ',' value_range '''
1377 print('open_range_list_1', list(p))
1378 ()
1379 def p_open_range_list_2(p):
1380 '''open_range_list : value_range '''
1381 print('open_range_list_2', list(p))
1382 ()
1383 def p_package_declaration_1(p):
1384 '''package_declaration : K_package lifetime_opt IDENTIFIER ';' _embed0_package_declaration timeunits_declaration_opt _embed1_package_declaration package_item_list_opt K_endpackage endlabel_opt '''
1385 print('package_declaration_1', list(p))
1386 # { pform_end_package_declaration(@1);
1387 # // If an end label is present make sure it match the package name.
1388 # if ($10) {
1389 # if (strcmp($3,$10) != 0) {
1390 # yyerror(@10, "error: End label doesn't match package name");
1391 # }
1392 # delete[]$10;
1393 # }
1394 # delete[]$3;
1395 # }
1396 ()
1397 def p__embed0_package_declaration(p):
1398 '''_embed0_package_declaration : '''
1399 # { pform_start_package_declaration(@1, $3, $2); }
1400 ()
1401 def p__embed1_package_declaration(p):
1402 '''_embed1_package_declaration : '''
1403 # { pform_set_scope_timescale(@1); }
1404 ()
1405 def p_module_package_import_list_opt_1(p):
1406 '''module_package_import_list_opt : '''
1407 print('module_package_import_list_opt_1', list(p))
1408 ()
1409 def p_module_package_import_list_opt_2(p):
1410 '''module_package_import_list_opt : package_import_list '''
1411 print('module_package_import_list_opt_2', list(p))
1412 ()
1413 def p_package_import_list_1(p):
1414 '''package_import_list : package_import_declaration '''
1415 print('package_import_list_1', list(p))
1416 ()
1417 def p_package_import_list_2(p):
1418 '''package_import_list : package_import_list package_import_declaration '''
1419 print('package_import_list_2', list(p))
1420 ()
1421 def p_package_import_declaration_1(p):
1422 '''package_import_declaration : K_import package_import_item_list ';' '''
1423 print('package_import_declaration_1', list(p))
1424 # { }
1425 ()
1426 def p_package_import_item_1(p):
1427 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '''
1428 print('package_import_item_1', list(p))
1429 # { pform_package_import(@2, $1, $3);
1430 # delete[]$3;
1431 # }
1432 ()
1433 def p_package_import_item_2(p):
1434 '''package_import_item : PACKAGE_IDENTIFIER K_SCOPE_RES '*' '''
1435 print('package_import_item_2', list(p))
1436 # { pform_package_import(@2, $1, 0);
1437 # }
1438 ()
1439 def p_package_import_item_list_1(p):
1440 '''package_import_item_list : package_import_item_list ',' package_import_item '''
1441 print('package_import_item_list_1', list(p))
1442 ()
1443 def p_package_import_item_list_2(p):
1444 '''package_import_item_list : package_import_item '''
1445 print('package_import_item_list_2', list(p))
1446 ()
1447 def p_package_item_1(p):
1448 '''package_item : timeunits_declaration '''
1449 print('package_item_1', list(p))
1450 ()
1451 def p_package_item_2(p):
1452 '''package_item : K_parameter param_type parameter_assign_list ';' '''
1453 print('package_item_2', list(p))
1454 ()
1455 def p_package_item_3(p):
1456 '''package_item : K_localparam param_type localparam_assign_list ';' '''
1457 print('package_item_3', list(p))
1458 ()
1459 def p_package_item_4(p):
1460 '''package_item : type_declaration '''
1461 print('package_item_4', list(p))
1462 ()
1463 def p_package_item_5(p):
1464 '''package_item : function_declaration '''
1465 print('package_item_5', list(p))
1466 ()
1467 def p_package_item_6(p):
1468 '''package_item : task_declaration '''
1469 print('package_item_6', list(p))
1470 ()
1471 def p_package_item_7(p):
1472 '''package_item : data_declaration '''
1473 print('package_item_7', list(p))
1474 ()
1475 def p_package_item_8(p):
1476 '''package_item : class_declaration '''
1477 print('package_item_8', list(p))
1478 ()
1479 def p_package_item_list_1(p):
1480 '''package_item_list : package_item_list package_item '''
1481 print('package_item_list_1', list(p))
1482 ()
1483 def p_package_item_list_2(p):
1484 '''package_item_list : package_item '''
1485 print('package_item_list_2', list(p))
1486 ()
1487 def p_package_item_list_opt_1(p):
1488 '''package_item_list_opt : package_item_list '''
1489 print('package_item_list_opt_1', list(p))
1490 ()
1491 def p_package_item_list_opt_2(p):
1492 '''package_item_list_opt : '''
1493 print('package_item_list_opt_2', list(p))
1494 ()
1495 def p_port_direction_1(p):
1496 '''port_direction : K_input '''
1497 print('port_direction_1', list(p))
1498 # { $$ = NetNet::PINPUT; }
1499 ()
1500 def p_port_direction_2(p):
1501 '''port_direction : K_output '''
1502 print('port_direction_2', list(p))
1503 # { $$ = NetNet::POUTPUT; }
1504 ()
1505 def p_port_direction_3(p):
1506 '''port_direction : K_inout '''
1507 print('port_direction_3', list(p))
1508 # { $$ = NetNet::PINOUT; }
1509 ()
1510 def p_port_direction_4(p):
1511 '''port_direction : K_ref '''
1512 print('port_direction_4', list(p))
1513 # { $$ = NetNet::PREF;
1514 # if (!gn_system_verilog()) {
1515 # yyerror(@1, "error: Reference ports (ref) require SystemVerilog.");
1516 # $$ = NetNet::PINPUT;
1517 # }
1518 # }
1519 ()
1520 def p_port_direction_opt_1(p):
1521 '''port_direction_opt : port_direction '''
1522 print('port_direction_opt_1', list(p))
1523 p[0] = p[1]
1524 ()
1525 def p_port_direction_opt_2(p):
1526 '''port_direction_opt : '''
1527 print('port_direction_opt_2', list(p))
1528 # { $$ = NetNet::PIMPLICIT; }
1529 ()
1530 def p_property_expr_1(p):
1531 '''property_expr : expression '''
1532 print('property_expr_1', list(p))
1533 ()
1534 def p_procedural_assertion_statement_1(p):
1535 '''procedural_assertion_statement : K_assert '(' expression ')' statement %prec less_than_K_else '''
1536 print('procedural_assertion_statement_1', list(p))
1537 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1538 # $$ = 0;
1539 # }
1540 ()
1541 def p_procedural_assertion_statement_2(p):
1542 '''procedural_assertion_statement : K_assert '(' expression ')' K_else statement '''
1543 print('procedural_assertion_statement_2', list(p))
1544 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1545 # $$ = 0;
1546 # }
1547 ()
1548 def p_procedural_assertion_statement_3(p):
1549 '''procedural_assertion_statement : K_assert '(' expression ')' statement K_else statement '''
1550 print('procedural_assertion_statement_3', list(p))
1551 # { yyerror(@1, "sorry: Simple immediate assertion statements not implemented.");
1552 # $$ = 0;
1553 # }
1554 ()
1555 def p_property_qualifier_1(p):
1556 '''property_qualifier : class_item_qualifier '''
1557 print('property_qualifier_1', list(p))
1558 ()
1559 def p_property_qualifier_2(p):
1560 '''property_qualifier : random_qualifier '''
1561 print('property_qualifier_2', list(p))
1562 ()
1563 def p_property_qualifier_opt_1(p):
1564 '''property_qualifier_opt : property_qualifier_list '''
1565 print('property_qualifier_opt_1', list(p))
1566 p[0] = p[1]
1567 ()
1568 def p_property_qualifier_opt_2(p):
1569 '''property_qualifier_opt : '''
1570 print('property_qualifier_opt_2', list(p))
1571 # { $$ = property_qualifier_t::make_none(); }
1572 ()
1573 def p_property_qualifier_list_1(p):
1574 '''property_qualifier_list : property_qualifier_list property_qualifier '''
1575 print('property_qualifier_list_1', list(p))
1576 # { $$ = $1 | $2; }
1577 ()
1578 def p_property_qualifier_list_2(p):
1579 '''property_qualifier_list : property_qualifier '''
1580 print('property_qualifier_list_2', list(p))
1581 p[0] = p[1]
1582 ()
1583 def p_property_spec_1(p):
1584 '''property_spec : clocking_event_opt property_spec_disable_iff_opt property_expr '''
1585 print('property_spec_1', list(p))
1586 ()
1587 def p_property_spec_disable_iff_opt_1(p):
1588 '''property_spec_disable_iff_opt : K_disable K_iff '(' expression ')' '''
1589 print('property_spec_disable_iff_opt_1', list(p))
1590 ()
1591 def p_property_spec_disable_iff_opt_2(p):
1592 '''property_spec_disable_iff_opt : '''
1593 print('property_spec_disable_iff_opt_2', list(p))
1594 ()
1595 def p_random_qualifier_1(p):
1596 '''random_qualifier : K_rand '''
1597 print('random_qualifier_1', list(p))
1598 # { $$ = property_qualifier_t::make_rand(); }
1599 ()
1600 def p_random_qualifier_2(p):
1601 '''random_qualifier : K_randc '''
1602 print('random_qualifier_2', list(p))
1603 # { $$ = property_qualifier_t::make_randc(); }
1604 ()
1605 def p_real_or_realtime_1(p):
1606 '''real_or_realtime : K_real '''
1607 print('real_or_realtime_1', list(p))
1608 ()
1609 def p_real_or_realtime_2(p):
1610 '''real_or_realtime : K_realtime '''
1611 print('real_or_realtime_2', list(p))
1612 ()
1613 def p_signing_1(p):
1614 '''signing : K_signed '''
1615 print('signing_1', list(p))
1616 # { $$ = true; }
1617 ()
1618 def p_signing_2(p):
1619 '''signing : K_unsigned '''
1620 print('signing_2', list(p))
1621 # { $$ = false; }
1622 ()
1623 def p_simple_type_or_string_1(p):
1624 '''simple_type_or_string : integer_vector_type '''
1625 print('simple_type_or_string_1', list(p))
1626 # { ivl_variable_type_t use_vtype = $1;
1627 # bool reg_flag = false;
1628 # if (use_vtype == IVL_VT_NO_TYPE) {
1629 # use_vtype = IVL_VT_LOGIC;
1630 # reg_flag = true;
1631 # }
1632 # vector_type_t*tmp = new vector_type_t(use_vtype, false, 0);
1633 # tmp->reg_flag = reg_flag;
1634 # FILE_NAME(tmp, @1);
1635 # $$ = tmp;
1636 # }
1637 ()
1638 def p_simple_type_or_string_2(p):
1639 '''simple_type_or_string : non_integer_type '''
1640 print('simple_type_or_string_2', list(p))
1641 # { real_type_t*tmp = new real_type_t($1);
1642 # FILE_NAME(tmp, @1);
1643 # $$ = tmp;
1644 # }
1645 ()
1646 def p_simple_type_or_string_3(p):
1647 '''simple_type_or_string : atom2_type '''
1648 print('simple_type_or_string_3', list(p))
1649 # { atom2_type_t*tmp = new atom2_type_t($1, true);
1650 # FILE_NAME(tmp, @1);
1651 # $$ = tmp;
1652 # }
1653 ()
1654 def p_simple_type_or_string_4(p):
1655 '''simple_type_or_string : K_integer '''
1656 print('simple_type_or_string_4', list(p))
1657 # { list<pform_range_t>*pd = make_range_from_width(integer_width);
1658 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd);
1659 # tmp->reg_flag = true;
1660 # tmp->integer_flag = true;
1661 # $$ = tmp;
1662 # }
1663 ()
1664 def p_simple_type_or_string_5(p):
1665 '''simple_type_or_string : K_time '''
1666 print('simple_type_or_string_5', list(p))
1667 # { list<pform_range_t>*pd = make_range_from_width(64);
1668 # vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
1669 # tmp->reg_flag = !gn_system_verilog();
1670 # $$ = tmp;
1671 # }
1672 ()
1673 def p_simple_type_or_string_6(p):
1674 '''simple_type_or_string : TYPE_IDENTIFIER '''
1675 print('simple_type_or_string_6', list(p))
1676 # { $$ = $1.type;
1677 # delete[]$1.text;
1678 # }
1679 ()
1680 def p_simple_type_or_string_7(p):
1681 '''simple_type_or_string : PACKAGE_IDENTIFIER K_SCOPE_RES _embed0_simple_type_or_string TYPE_IDENTIFIER '''
1682 print('simple_type_or_string_7', list(p))
1683 # { lex_in_package_scope(0);
1684 # $$ = $4.type;
1685 # delete[]$4.text;
1686 # }
1687 ()
1688 def p_simple_type_or_string_8(p):
1689 '''simple_type_or_string : K_string '''
1690 print('simple_type_or_string_8', list(p))
1691 # { string_type_t*tmp = new string_type_t;
1692 # FILE_NAME(tmp, @1);
1693 # $$ = tmp;
1694 # }
1695 ()
1696 def p__embed0_simple_type_or_string(p):
1697 '''_embed0_simple_type_or_string : '''
1698 # { lex_in_package_scope($1); }
1699 ()
1700 def p_statement_1(p):
1701 '''statement : attribute_list_opt statement_item '''
1702 print('statement_1', list(p))
1703 # { pform_bind_attributes($2->attributes, $1);
1704 # $$ = $2;
1705 # }
1706 ()
1707 def p_statement_or_null_1(p):
1708 '''statement_or_null : statement '''
1709 print('statement_or_null_1', list(p))
1710 p[0] = p[1]
1711 ()
1712 def p_statement_or_null_2(p):
1713 '''statement_or_null : attribute_list_opt ';' '''
1714 print('statement_or_null_2', list(p))
1715 # { $$ = 0; }
1716 ()
1717 def p_stream_expression_1(p):
1718 '''stream_expression : expression '''
1719 print('stream_expression_1', list(p))
1720 ()
1721 def p_stream_expression_list_1(p):
1722 '''stream_expression_list : stream_expression_list ',' stream_expression '''
1723 print('stream_expression_list_1', list(p))
1724 ()
1725 def p_stream_expression_list_2(p):
1726 '''stream_expression_list : stream_expression '''
1727 print('stream_expression_list_2', list(p))
1728 ()
1729 def p_stream_operator_1(p):
1730 '''stream_operator : K_LS '''
1731 print('stream_operator_1', list(p))
1732 ()
1733 def p_stream_operator_2(p):
1734 '''stream_operator : K_RS '''
1735 print('stream_operator_2', list(p))
1736 ()
1737 def p_streaming_concatenation_1(p):
1738 '''streaming_concatenation : '{' stream_operator '{' stream_expression_list '}' '}' '''
1739 print('streaming_concatenation_1', list(p))
1740 # { /* streaming concatenation is a SystemVerilog thing. */
1741 # if (gn_system_verilog()) {
1742 # yyerror(@2, "sorry: Streaming concatenation not supported.");
1743 # $$ = 0;
1744 # } else {
1745 # yyerror(@2, "error: Streaming concatenation requires SystemVerilog");
1746 # $$ = 0;
1747 # }
1748 # }
1749 ()
1750 def p_task_declaration_1(p):
1751 '''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 '''
1752 print('task_declaration_1', list(p))
1753 # { // Last step: check any closing name. This is done late so
1754 # // that the parser can look ahead to detect the present
1755 # // endlabel_opt but still have the pform_endmodule() called
1756 # // early enough that the lexor can know we are outside the
1757 # // module.
1758 # if ($10) {
1759 # if (strcmp($3,$10) != 0) {
1760 # yyerror(@10, "error: End label doesn't match task name");
1761 # }
1762 # if (! gn_system_verilog()) {
1763 # yyerror(@10, "error: Task end labels require "
1764 # "SystemVerilog.");
1765 # }
1766 # delete[]$10;
1767 # }
1768 # delete[]$3;
1769 # }
1770 ()
1771 def p_task_declaration_2(p):
1772 '''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 '''
1773 print('task_declaration_2', list(p))
1774 # { // Last step: check any closing name. This is done late so
1775 # // that the parser can look ahead to detect the present
1776 # // endlabel_opt but still have the pform_endmodule() called
1777 # // early enough that the lexor can know we are outside the
1778 # // module.
1779 # if ($13) {
1780 # if (strcmp($3,$13) != 0) {
1781 # yyerror(@13, "error: End label doesn't match task name");
1782 # }
1783 # if (! gn_system_verilog()) {
1784 # yyerror(@13, "error: Task end labels require "
1785 # "SystemVerilog.");
1786 # }
1787 # delete[]$13;
1788 # }
1789 # delete[]$3;
1790 # }
1791 ()
1792 def p_task_declaration_3(p):
1793 '''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 '''
1794 print('task_declaration_3', list(p))
1795 # { // Last step: check any closing name. This is done late so
1796 # // that the parser can look ahead to detect the present
1797 # // endlabel_opt but still have the pform_endmodule() called
1798 # // early enough that the lexor can know we are outside the
1799 # // module.
1800 # if ($12) {
1801 # if (strcmp($3,$12) != 0) {
1802 # yyerror(@12, "error: End label doesn't match task name");
1803 # }
1804 # if (! gn_system_verilog()) {
1805 # yyerror(@12, "error: Task end labels require "
1806 # "SystemVerilog.");
1807 # }
1808 # delete[]$12;
1809 # }
1810 # delete[]$3;
1811 # }
1812 ()
1813 def p_task_declaration_4(p):
1814 '''task_declaration : K_task lifetime_opt IDENTIFIER error K_endtask _embed6_task_declaration endlabel_opt '''
1815 print('task_declaration_4', list(p))
1816 # { // Last step: check any closing name. This is done late so
1817 # // that the parser can look ahead to detect the present
1818 # // endlabel_opt but still have the pform_endmodule() called
1819 # // early enough that the lexor can know we are outside the
1820 # // module.
1821 # if ($7) {
1822 # if (strcmp($3,$7) != 0) {
1823 # yyerror(@7, "error: End label doesn't match task name");
1824 # }
1825 # if (! gn_system_verilog()) {
1826 # yyerror(@7, "error: Task end labels require "
1827 # "SystemVerilog.");
1828 # }
1829 # delete[]$7;
1830 # }
1831 # delete[]$3;
1832 # }
1833 ()
1834 def p__embed0_task_declaration(p):
1835 '''_embed0_task_declaration : '''
1836 # { assert(current_task == 0);
1837 # current_task = pform_push_task_scope(@1, $3, $2);
1838 # }
1839 ()
1840 def p__embed1_task_declaration(p):
1841 '''_embed1_task_declaration : '''
1842 # { current_task->set_ports($6);
1843 # current_task_set_statement(@3, $7);
1844 # pform_set_this_class(@3, current_task);
1845 # pform_pop_scope();
1846 # current_task = 0;
1847 # if ($7 && $7->size() > 1 && !gn_system_verilog()) {
1848 # yyerror(@7, "error: Task body with multiple statements requires SystemVerilog.");
1849 # }
1850 # delete $7;
1851 # }
1852 ()
1853 def p__embed2_task_declaration(p):
1854 '''_embed2_task_declaration : '''
1855 # { assert(current_task == 0);
1856 # current_task = pform_push_task_scope(@1, $3, $2);
1857 # }
1858 ()
1859 def p__embed3_task_declaration(p):
1860 '''_embed3_task_declaration : '''
1861 # { current_task->set_ports($6);
1862 # current_task_set_statement(@3, $10);
1863 # pform_set_this_class(@3, current_task);
1864 # pform_pop_scope();
1865 # current_task = 0;
1866 # if ($10) delete $10;
1867 # }
1868 ()
1869 def p__embed4_task_declaration(p):
1870 '''_embed4_task_declaration : '''
1871 # { assert(current_task == 0);
1872 # current_task = pform_push_task_scope(@1, $3, $2);
1873 # }
1874 ()
1875 def p__embed5_task_declaration(p):
1876 '''_embed5_task_declaration : '''
1877 # { current_task->set_ports(0);
1878 # current_task_set_statement(@3, $9);
1879 # pform_set_this_class(@3, current_task);
1880 # if (! current_task->method_of()) {
1881 # cerr << @3 << ": warning: task definition for \"" << $3
1882 # << "\" has an empty port declaration list!" << endl;
1883 # }
1884 # pform_pop_scope();
1885 # current_task = 0;
1886 # if ($9->size() > 1 && !gn_system_verilog()) {
1887 # yyerror(@9, "error: Task body with multiple statements requires SystemVerilog.");
1888 # }
1889 # delete $9;
1890 # }
1891 ()
1892 def p__embed6_task_declaration(p):
1893 '''_embed6_task_declaration : '''
1894 # {
1895 # if (current_task) {
1896 # pform_pop_scope();
1897 # current_task = 0;
1898 # }
1899 # }
1900 ()
1901 def p_tf_port_declaration_1(p):
1902 '''tf_port_declaration : port_direction K_reg_opt unsigned_signed_opt dimensions_opt list_of_identifiers ';' '''
1903 print('tf_port_declaration_1', list(p))
1904 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1,
1905 # $2 ? IVL_VT_LOGIC :
1906 # IVL_VT_NO_TYPE,
1907 # $3, $4, $5);
1908 # $$ = tmp;
1909 # }
1910 ()
1911 def p_tf_port_declaration_2(p):
1912 '''tf_port_declaration : port_direction K_integer list_of_identifiers ';' '''
1913 print('tf_port_declaration_2', list(p))
1914 # { list<pform_range_t>*range_stub = make_range_from_width(integer_width);
1915 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_LOGIC, true,
1916 # range_stub, $3, true);
1917 # $$ = tmp;
1918 # }
1919 ()
1920 def p_tf_port_declaration_3(p):
1921 '''tf_port_declaration : port_direction K_time list_of_identifiers ';' '''
1922 print('tf_port_declaration_3', list(p))
1923 # { list<pform_range_t>*range_stub = make_range_from_width(64);
1924 # vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_LOGIC, false,
1925 # range_stub, $3);
1926 # $$ = tmp;
1927 # }
1928 ()
1929 def p_tf_port_declaration_4(p):
1930 '''tf_port_declaration : port_direction real_or_realtime list_of_identifiers ';' '''
1931 print('tf_port_declaration_4', list(p))
1932 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_REAL, true,
1933 # 0, $3);
1934 # $$ = tmp;
1935 # }
1936 ()
1937 def p_tf_port_declaration_5(p):
1938 '''tf_port_declaration : port_direction K_string list_of_identifiers ';' '''
1939 print('tf_port_declaration_5', list(p))
1940 # { vector<pform_tf_port_t>*tmp = pform_make_task_ports(@1, $1, IVL_VT_STRING, true,
1941 # 0, $3);
1942 # $$ = tmp;
1943 # }
1944 ()
1945 def p_tf_port_item_1(p):
1946 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER dimensions_opt tf_port_item_expr_opt '''
1947 print('tf_port_item_1', list(p))
1948 # { vector<pform_tf_port_t>*tmp;
1949 # NetNet::PortType use_port_type = $1;
1950 # if ((use_port_type == NetNet::PIMPLICIT) && (gn_system_verilog() || ($2 == 0)))
1951 # use_port_type = port_declaration_context.port_type;
1952 # perm_string name = lex_strings.make($3);
1953 # list<perm_string>* ilist = list_from_identifier($3);
1954 #
1955 # if (use_port_type == NetNet::PIMPLICIT) {
1956 # yyerror(@1, "error: missing task/function port direction.");
1957 # use_port_type = NetNet::PINPUT; // for error recovery
1958 # }
1959 # if (($2 == 0) && ($1==NetNet::PIMPLICIT)) {
1960 # // Detect special case this is an undecorated
1961 # // identifier and we need to get the declaration from
1962 # // left context.
1963 # if ($4 != 0) {
1964 # yyerror(@4, "internal error: How can there be an unpacked range here?\n");
1965 # }
1966 # tmp = pform_make_task_ports(@3, use_port_type,
1967 # port_declaration_context.data_type,
1968 # ilist);
1969 #
1970 # } else {
1971 # // Otherwise, the decorations for this identifier
1972 # // indicate the type. Save the type for any right
1973 # // context that may come later.
1974 # port_declaration_context.port_type = use_port_type;
1975 # if ($2 == 0) {
1976 # $2 = new vector_type_t(IVL_VT_LOGIC, false, 0);
1977 # FILE_NAME($2, @3);
1978 # }
1979 # port_declaration_context.data_type = $2;
1980 # tmp = pform_make_task_ports(@3, use_port_type, $2, ilist);
1981 # }
1982 # if ($4 != 0) {
1983 # pform_set_reg_idx(name, $4);
1984 # }
1985 #
1986 # $$ = tmp;
1987 # if ($5) {
1988 # assert(tmp->size()==1);
1989 # tmp->front().defe = $5;
1990 # }
1991 # }
1992 ()
1993 def p_tf_port_item_2(p):
1994 '''tf_port_item : port_direction_opt data_type_or_implicit IDENTIFIER error '''
1995 print('tf_port_item_2', list(p))
1996 # { yyerror(@3, "error: Error in task/function port item after port name %s.", $3);
1997 # yyerrok;
1998 # $$ = 0;
1999 # }
2000 ()
2001 def p_tf_port_item_expr_opt_1(p):
2002 '''tf_port_item_expr_opt : '=' expression '''
2003 print('tf_port_item_expr_opt_1', list(p))
2004 # { if (! gn_system_verilog()) {
2005 # yyerror(@1, "error: Task/function default arguments require "
2006 # "SystemVerilog.");
2007 # }
2008 # $$ = $2;
2009 # }
2010 ()
2011 def p_tf_port_item_expr_opt_2(p):
2012 '''tf_port_item_expr_opt : '''
2013 print('tf_port_item_expr_opt_2', list(p))
2014 # { $$ = 0; }
2015 ()
2016 def p_tf_port_list_1(p):
2017 '''tf_port_list : _embed0_tf_port_list tf_port_item_list '''
2018 print('tf_port_list_1', list(p))
2019 p[0] = p[2]
2020 ()
2021 def p__embed0_tf_port_list(p):
2022 '''_embed0_tf_port_list : '''
2023 # { port_declaration_context.port_type = gn_system_verilog() ? NetNet::PINPUT : NetNet::PIMPLICIT;
2024 # port_declaration_context.data_type = 0;
2025 # }
2026 ()
2027 def p_tf_port_item_list_1(p):
2028 '''tf_port_item_list : tf_port_item_list ',' tf_port_item '''
2029 print('tf_port_item_list_1', list(p))
2030 # { vector<pform_tf_port_t>*tmp;
2031 # if ($1 && $3) {
2032 # size_t s1 = $1->size();
2033 # tmp = $1;
2034 # tmp->resize(tmp->size()+$3->size());
2035 # for (size_t idx = 0 ; idx < $3->size() ; idx += 1)
2036 # tmp->at(s1+idx) = $3->at(idx);
2037 # delete $3;
2038 # } else if ($1) {
2039 # tmp = $1;
2040 # } else {
2041 # tmp = $3;
2042 # }
2043 # $$ = tmp;
2044 # }
2045 ()
2046 def p_tf_port_item_list_2(p):
2047 '''tf_port_item_list : tf_port_item '''
2048 print('tf_port_item_list_2', list(p))
2049 p[0] = p[1]
2050 ()
2051 def p_tf_port_item_list_3(p):
2052 '''tf_port_item_list : error ',' tf_port_item '''
2053 print('tf_port_item_list_3', list(p))
2054 # { yyerror(@2, "error: Syntax error in task/function port declaration.");
2055 # $$ = $3;
2056 # }
2057 ()
2058 def p_tf_port_item_list_4(p):
2059 '''tf_port_item_list : tf_port_item_list ',' '''
2060 print('tf_port_item_list_4', list(p))
2061 # { yyerror(@2, "error: NULL port declarations are not allowed.");
2062 # $$ = $1;
2063 # }
2064 ()
2065 def p_tf_port_item_list_5(p):
2066 '''tf_port_item_list : tf_port_item_list ';' '''
2067 print('tf_port_item_list_5', list(p))
2068 # { yyerror(@2, "error: ';' is an invalid port declaration separator.");
2069 # $$ = $1;
2070 # }
2071 ()
2072 def p_timeunits_declaration_1(p):
2073 '''timeunits_declaration : K_timeunit TIME_LITERAL ';' '''
2074 print('timeunits_declaration_1', list(p))
2075 # { pform_set_timeunit($2, allow_timeunit_decl); }
2076 ()
2077 def p_timeunits_declaration_2(p):
2078 '''timeunits_declaration : K_timeunit TIME_LITERAL '/' TIME_LITERAL ';' '''
2079 print('timeunits_declaration_2', list(p))
2080 # { bool initial_decl = allow_timeunit_decl && allow_timeprec_decl;
2081 # pform_set_timeunit($2, initial_decl);
2082 # pform_set_timeprec($4, initial_decl);
2083 # }
2084 ()
2085 def p_timeunits_declaration_3(p):
2086 '''timeunits_declaration : K_timeprecision TIME_LITERAL ';' '''
2087 print('timeunits_declaration_3', list(p))
2088 # { pform_set_timeprec($2, allow_timeprec_decl); }
2089 ()
2090 def p_timeunits_declaration_opt_1(p):
2091 '''timeunits_declaration_opt : %prec no_timeunits_declaration '''
2092 print('timeunits_declaration_opt_1', list(p))
2093 ()
2094 def p_timeunits_declaration_opt_2(p):
2095 '''timeunits_declaration_opt : timeunits_declaration %prec one_timeunits_declaration '''
2096 print('timeunits_declaration_opt_2', list(p))
2097 ()
2098 def p_timeunits_declaration_opt_3(p):
2099 '''timeunits_declaration_opt : timeunits_declaration timeunits_declaration '''
2100 print('timeunits_declaration_opt_3', list(p))
2101 ()
2102 def p_value_range_1(p):
2103 '''value_range : expression '''
2104 print('value_range_1', list(p))
2105 # { }
2106 ()
2107 def p_value_range_2(p):
2108 '''value_range : '[' expression ':' expression ']' '''
2109 print('value_range_2', list(p))
2110 # { }
2111 ()
2112 def p_variable_dimension_1(p):
2113 '''variable_dimension : '[' expression ':' expression ']' '''
2114 print('variable_dimension_1', list(p))
2115 # { list<pform_range_t> *tmp = new list<pform_range_t>;
2116 # pform_range_t index ($2,$4);
2117 # tmp->push_back(index);
2118 # $$ = tmp;
2119 # }
2120 ()
2121 def p_variable_dimension_2(p):
2122 '''variable_dimension : '[' expression ']' '''
2123 print('variable_dimension_2', list(p))
2124 # { // SystemVerilog canonical range
2125 # if (!gn_system_verilog()) {
2126 # warn_count += 1;
2127 # cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. "
2128 # << "Use at least -g2005-sv to remove this warning." << endl;
2129 # }
2130 # list<pform_range_t> *tmp = new list<pform_range_t>;
2131 # pform_range_t index;
2132 # index.first = new PENumber(new verinum((uint64_t)0, integer_width));
2133 # index.second = new PEBinary('-', $2, new PENumber(new verinum((uint64_t)1, integer_width)));
2134 # tmp->push_back(index);
2135 # $$ = tmp;
2136 # }
2137 ()
2138 def p_variable_dimension_3(p):
2139 '''variable_dimension : '[' ']' '''
2140 print('variable_dimension_3', list(p))
2141 # { list<pform_range_t> *tmp = new list<pform_range_t>;
2142 # pform_range_t index (0,0);
2143 # tmp->push_back(index);
2144 # $$ = tmp;
2145 # }
2146 ()
2147 def p_variable_dimension_4(p):
2148 '''variable_dimension : '[' '$' ']' '''
2149 print('variable_dimension_4', list(p))
2150 # { // SystemVerilog queue
2151 # list<pform_range_t> *tmp = new list<pform_range_t>;
2152 # pform_range_t index (new PENull,0);
2153 # if (!gn_system_verilog()) {
2154 # yyerror("error: Queue declarations require SystemVerilog.");
2155 # }
2156 # tmp->push_back(index);
2157 # $$ = tmp;
2158 # }
2159 ()
2160 def p_variable_lifetime_1(p):
2161 '''variable_lifetime : lifetime '''
2162 print('variable_lifetime_1', list(p))
2163 # { if (!gn_system_verilog()) {
2164 # yyerror(@1, "error: overriding the default variable lifetime "
2165 # "requires SystemVerilog.");
2166 # } else if ($1 != pform_peek_scope()->default_lifetime) {
2167 # yyerror(@1, "sorry: overriding the default variable lifetime "
2168 # "is not yet supported.");
2169 # }
2170 # var_lifetime = $1;
2171 # }
2172 ()
2173 def p_attribute_list_opt_1(p):
2174 '''attribute_list_opt : attribute_instance_list '''
2175 print('attribute_list_opt_1', list(p))
2176 p[0] = p[1]
2177 ()
2178 def p_attribute_list_opt_2(p):
2179 '''attribute_list_opt : '''
2180 print('attribute_list_opt_2', list(p))
2181 # { $$ = 0; }
2182 ()
2183 def p_attribute_instance_list_1(p):
2184 '''attribute_instance_list : K_PSTAR K_STARP '''
2185 print('attribute_instance_list_1', list(p))
2186 # { $$ = 0; }
2187 ()
2188 def p_attribute_instance_list_2(p):
2189 '''attribute_instance_list : K_PSTAR attribute_list K_STARP '''
2190 print('attribute_instance_list_2', list(p))
2191 p[0] = p[2]
2192 ()
2193 def p_attribute_instance_list_3(p):
2194 '''attribute_instance_list : attribute_instance_list K_PSTAR K_STARP '''
2195 print('attribute_instance_list_3', list(p))
2196 p[0] = p[1]
2197 ()
2198 def p_attribute_instance_list_4(p):
2199 '''attribute_instance_list : attribute_instance_list K_PSTAR attribute_list K_STARP '''
2200 print('attribute_instance_list_4', list(p))
2201 # { list<named_pexpr_t>*tmp = $1;
2202 # if (tmp) {
2203 # tmp->splice(tmp->end(), *$3);
2204 # delete $3;
2205 # $$ = tmp;
2206 # } else $$ = $3;
2207 # }
2208 ()
2209 def p_attribute_list_1(p):
2210 '''attribute_list : attribute_list ',' attribute '''
2211 print('attribute_list_1', list(p))
2212 # { list<named_pexpr_t>*tmp = $1;
2213 # tmp->push_back(*$3);
2214 # delete $3;
2215 # $$ = tmp;
2216 # }
2217 ()
2218 def p_attribute_list_2(p):
2219 '''attribute_list : attribute '''
2220 print('attribute_list_2', list(p))
2221 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
2222 # tmp->push_back(*$1);
2223 # delete $1;
2224 # $$ = tmp;
2225 # }
2226 ()
2227 def p_attribute_1(p):
2228 '''attribute : IDENTIFIER '''
2229 print('attribute_1', list(p))
2230 # { named_pexpr_t*tmp = new named_pexpr_t;
2231 # tmp->name = lex_strings.make($1);
2232 # tmp->parm = 0;
2233 # delete[]$1;
2234 # $$ = tmp;
2235 # }
2236 ()
2237 def p_attribute_2(p):
2238 '''attribute : IDENTIFIER '=' expression '''
2239 print('attribute_2', list(p))
2240 # { PExpr*tmp = $3;
2241 # named_pexpr_t*tmp2 = new named_pexpr_t;
2242 # tmp2->name = lex_strings.make($1);
2243 # tmp2->parm = tmp;
2244 # delete[]$1;
2245 # $$ = tmp2;
2246 # }
2247 ()
2248 def p_block_item_decl_1(p):
2249 '''block_item_decl : data_type register_variable_list ';' '''
2250 print('block_item_decl_1', list(p))
2251 # { if ($1) pform_set_data_type(@1, $1, $2, NetNet::REG, attributes_in_context);
2252 # }
2253 ()
2254 def p_block_item_decl_2(p):
2255 '''block_item_decl : variable_lifetime data_type register_variable_list ';' '''
2256 print('block_item_decl_2', list(p))
2257 # { if ($2) pform_set_data_type(@2, $2, $3, NetNet::REG, attributes_in_context);
2258 # var_lifetime = LexicalScope::INHERITED;
2259 # }
2260 ()
2261 def p_block_item_decl_3(p):
2262 '''block_item_decl : K_reg data_type register_variable_list ';' '''
2263 print('block_item_decl_3', list(p))
2264 # { if ($2) pform_set_data_type(@2, $2, $3, NetNet::REG, attributes_in_context);
2265 # }
2266 ()
2267 def p_block_item_decl_4(p):
2268 '''block_item_decl : variable_lifetime K_reg data_type register_variable_list ';' '''
2269 print('block_item_decl_4', list(p))
2270 # { if ($3) pform_set_data_type(@3, $3, $4, NetNet::REG, attributes_in_context);
2271 # var_lifetime = LexicalScope::INHERITED;
2272 # }
2273 ()
2274 def p_block_item_decl_5(p):
2275 '''block_item_decl : K_event event_variable_list ';' '''
2276 print('block_item_decl_5', list(p))
2277 # { if ($2) pform_make_events($2, @1.text, @1.first_line);
2278 # }
2279 ()
2280 def p_block_item_decl_6(p):
2281 '''block_item_decl : K_parameter param_type parameter_assign_list ';' '''
2282 print('block_item_decl_6', list(p))
2283 ()
2284 def p_block_item_decl_7(p):
2285 '''block_item_decl : K_localparam param_type localparam_assign_list ';' '''
2286 print('block_item_decl_7', list(p))
2287 ()
2288 def p_block_item_decl_8(p):
2289 '''block_item_decl : type_declaration '''
2290 print('block_item_decl_8', list(p))
2291 ()
2292 def p_block_item_decl_9(p):
2293 '''block_item_decl : K_integer error ';' '''
2294 print('block_item_decl_9', list(p))
2295 # { yyerror(@1, "error: syntax error in integer variable list.");
2296 # yyerrok;
2297 # }
2298 ()
2299 def p_block_item_decl_10(p):
2300 '''block_item_decl : K_time error ';' '''
2301 print('block_item_decl_10', list(p))
2302 # { yyerror(@1, "error: syntax error in time variable list.");
2303 # yyerrok;
2304 # }
2305 ()
2306 def p_block_item_decl_11(p):
2307 '''block_item_decl : K_parameter error ';' '''
2308 print('block_item_decl_11', list(p))
2309 # { yyerror(@1, "error: syntax error in parameter list.");
2310 # yyerrok;
2311 # }
2312 ()
2313 def p_block_item_decl_12(p):
2314 '''block_item_decl : K_localparam error ';' '''
2315 print('block_item_decl_12', list(p))
2316 # { yyerror(@1, "error: syntax error localparam list.");
2317 # yyerrok;
2318 # }
2319 ()
2320 def p_block_item_decls_1(p):
2321 '''block_item_decls : block_item_decl '''
2322 print('block_item_decls_1', list(p))
2323 ()
2324 def p_block_item_decls_2(p):
2325 '''block_item_decls : block_item_decls block_item_decl '''
2326 print('block_item_decls_2', list(p))
2327 ()
2328 def p_block_item_decls_opt_1(p):
2329 '''block_item_decls_opt : block_item_decls '''
2330 print('block_item_decls_opt_1', list(p))
2331 # { $$ = true; }
2332 ()
2333 def p_block_item_decls_opt_2(p):
2334 '''block_item_decls_opt : '''
2335 print('block_item_decls_opt_2', list(p))
2336 # { $$ = false; }
2337 ()
2338 def p_type_declaration_1(p):
2339 '''type_declaration : K_typedef data_type IDENTIFIER dimensions_opt ';' '''
2340 print('type_declaration_1', list(p))
2341 # { perm_string name = lex_strings.make($3);
2342 # pform_set_typedef(name, $2, $4);
2343 # delete[]$3;
2344 # }
2345 ()
2346 def p_type_declaration_2(p):
2347 '''type_declaration : K_typedef data_type TYPE_IDENTIFIER ';' '''
2348 print('type_declaration_2', list(p))
2349 # { perm_string name = lex_strings.make($3.text);
2350 # if (pform_test_type_identifier_local(name)) {
2351 # yyerror(@3, "error: Typedef identifier \"%s\" is already a type name.", $3.text);
2352 #
2353 # } else {
2354 # pform_set_typedef(name, $2, NULL);
2355 # }
2356 # delete[]$3.text;
2357 # }
2358 ()
2359 def p_type_declaration_3(p):
2360 '''type_declaration : K_typedef K_class IDENTIFIER ';' '''
2361 print('type_declaration_3', list(p))
2362 # { // Create a synthetic typedef for the class name so that the
2363 # // lexor detects the name as a type.
2364 # perm_string name = lex_strings.make($3);
2365 # class_type_t*tmp = new class_type_t(name);
2366 # FILE_NAME(tmp, @3);
2367 # pform_set_typedef(name, tmp, NULL);
2368 # delete[]$3;
2369 # }
2370 ()
2371 def p_type_declaration_4(p):
2372 '''type_declaration : K_typedef K_enum IDENTIFIER ';' '''
2373 print('type_declaration_4', list(p))
2374 # { yyerror(@1, "sorry: Enum forward declarations not supported yet."); }
2375 ()
2376 def p_type_declaration_5(p):
2377 '''type_declaration : K_typedef K_struct IDENTIFIER ';' '''
2378 print('type_declaration_5', list(p))
2379 # { yyerror(@1, "sorry: Struct forward declarations not supported yet."); }
2380 ()
2381 def p_type_declaration_6(p):
2382 '''type_declaration : K_typedef K_union IDENTIFIER ';' '''
2383 print('type_declaration_6', list(p))
2384 # { yyerror(@1, "sorry: Union forward declarations not supported yet."); }
2385 ()
2386 def p_type_declaration_7(p):
2387 '''type_declaration : K_typedef IDENTIFIER ';' '''
2388 print('type_declaration_7', list(p))
2389 # { // Create a synthetic typedef for the class name so that the
2390 # // lexor detects the name as a type.
2391 # perm_string name = lex_strings.make($2);
2392 # class_type_t*tmp = new class_type_t(name);
2393 # FILE_NAME(tmp, @2);
2394 # pform_set_typedef(name, tmp, NULL);
2395 # delete[]$2;
2396 # }
2397 ()
2398 def p_type_declaration_8(p):
2399 '''type_declaration : K_typedef error ';' '''
2400 print('type_declaration_8', list(p))
2401 # { yyerror(@2, "error: Syntax error in typedef clause.");
2402 # yyerrok;
2403 # }
2404 ()
2405 def p_enum_data_type_1(p):
2406 '''enum_data_type : K_enum '{' enum_name_list '}' '''
2407 print('enum_data_type_1', list(p))
2408 # { enum_type_t*enum_type = new enum_type_t;
2409 # FILE_NAME(enum_type, @1);
2410 # enum_type->names .reset($3);
2411 # enum_type->base_type = IVL_VT_BOOL;
2412 # enum_type->signed_flag = true;
2413 # enum_type->integer_flag = false;
2414 # enum_type->range.reset(make_range_from_width(32));
2415 # $$ = enum_type;
2416 # }
2417 ()
2418 def p_enum_data_type_2(p):
2419 '''enum_data_type : K_enum atom2_type signed_unsigned_opt '{' enum_name_list '}' '''
2420 print('enum_data_type_2', list(p))
2421 # { enum_type_t*enum_type = new enum_type_t;
2422 # FILE_NAME(enum_type, @1);
2423 # enum_type->names .reset($5);
2424 # enum_type->base_type = IVL_VT_BOOL;
2425 # enum_type->signed_flag = $3;
2426 # enum_type->integer_flag = false;
2427 # enum_type->range.reset(make_range_from_width($2));
2428 # $$ = enum_type;
2429 # }
2430 ()
2431 def p_enum_data_type_3(p):
2432 '''enum_data_type : K_enum K_integer signed_unsigned_opt '{' enum_name_list '}' '''
2433 print('enum_data_type_3', list(p))
2434 # { enum_type_t*enum_type = new enum_type_t;
2435 # FILE_NAME(enum_type, @1);
2436 # enum_type->names .reset($5);
2437 # enum_type->base_type = IVL_VT_LOGIC;
2438 # enum_type->signed_flag = $3;
2439 # enum_type->integer_flag = true;
2440 # enum_type->range.reset(make_range_from_width(integer_width));
2441 # $$ = enum_type;
2442 # }
2443 ()
2444 def p_enum_data_type_4(p):
2445 '''enum_data_type : K_enum K_logic unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2446 print('enum_data_type_4', list(p))
2447 # { enum_type_t*enum_type = new enum_type_t;
2448 # FILE_NAME(enum_type, @1);
2449 # enum_type->names .reset($6);
2450 # enum_type->base_type = IVL_VT_LOGIC;
2451 # enum_type->signed_flag = $3;
2452 # enum_type->integer_flag = false;
2453 # enum_type->range.reset($4 ? $4 : make_range_from_width(1));
2454 # $$ = enum_type;
2455 # }
2456 ()
2457 def p_enum_data_type_5(p):
2458 '''enum_data_type : K_enum K_reg unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2459 print('enum_data_type_5', list(p))
2460 # { enum_type_t*enum_type = new enum_type_t;
2461 # FILE_NAME(enum_type, @1);
2462 # enum_type->names .reset($6);
2463 # enum_type->base_type = IVL_VT_LOGIC;
2464 # enum_type->signed_flag = $3;
2465 # enum_type->integer_flag = false;
2466 # enum_type->range.reset($4 ? $4 : make_range_from_width(1));
2467 # $$ = enum_type;
2468 # }
2469 ()
2470 def p_enum_data_type_6(p):
2471 '''enum_data_type : K_enum K_bit unsigned_signed_opt dimensions_opt '{' enum_name_list '}' '''
2472 print('enum_data_type_6', list(p))
2473 # { enum_type_t*enum_type = new enum_type_t;
2474 # FILE_NAME(enum_type, @1);
2475 # enum_type->names .reset($6);
2476 # enum_type->base_type = IVL_VT_BOOL;
2477 # enum_type->signed_flag = $3;
2478 # enum_type->integer_flag = false;
2479 # enum_type->range.reset($4 ? $4 : make_range_from_width(1));
2480 # $$ = enum_type;
2481 # }
2482 ()
2483 def p_enum_name_list_1(p):
2484 '''enum_name_list : enum_name '''
2485 print('enum_name_list_1', list(p))
2486 # { $$ = $1;
2487 # }
2488 ()
2489 def p_enum_name_list_2(p):
2490 '''enum_name_list : enum_name_list ',' enum_name '''
2491 print('enum_name_list_2', list(p))
2492 # { list<named_pexpr_t>*lst = $1;
2493 # lst->splice(lst->end(), *$3);
2494 # delete $3;
2495 # $$ = lst;
2496 # }
2497 ()
2498 def p_pos_neg_number_1(p):
2499 '''pos_neg_number : number '''
2500 print('pos_neg_number_1', list(p))
2501 # { $$ = $1;
2502 # }
2503 ()
2504 def p_pos_neg_number_2(p):
2505 '''pos_neg_number : '-' number '''
2506 print('pos_neg_number_2', list(p))
2507 # { verinum tmp = -(*($2));
2508 # *($2) = tmp;
2509 # $$ = $2;
2510 # }
2511 ()
2512 def p_enum_name_1(p):
2513 '''enum_name : IDENTIFIER '''
2514 print('enum_name_1', list(p))
2515 # { perm_string name = lex_strings.make($1);
2516 # delete[]$1;
2517 # $$ = make_named_number(name);
2518 # }
2519 ()
2520 def p_enum_name_2(p):
2521 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '''
2522 print('enum_name_2', list(p))
2523 # { perm_string name = lex_strings.make($1);
2524 # long count = check_enum_seq_value(@1, $3, false);
2525 # delete[]$1;
2526 # $$ = make_named_numbers(name, 0, count-1);
2527 # delete $3;
2528 # }
2529 ()
2530 def p_enum_name_3(p):
2531 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '''
2532 print('enum_name_3', list(p))
2533 # { perm_string name = lex_strings.make($1);
2534 # $$ = make_named_numbers(name, check_enum_seq_value(@1, $3, true),
2535 # check_enum_seq_value(@1, $5, true));
2536 # delete[]$1;
2537 # delete $3;
2538 # delete $5;
2539 # }
2540 ()
2541 def p_enum_name_4(p):
2542 '''enum_name : IDENTIFIER '=' expression '''
2543 print('enum_name_4', list(p))
2544 # { perm_string name = lex_strings.make($1);
2545 # delete[]$1;
2546 # $$ = make_named_number(name, $3);
2547 # }
2548 ()
2549 def p_enum_name_5(p):
2550 '''enum_name : IDENTIFIER '[' pos_neg_number ']' '=' expression '''
2551 print('enum_name_5', list(p))
2552 # { perm_string name = lex_strings.make($1);
2553 # long count = check_enum_seq_value(@1, $3, false);
2554 # $$ = make_named_numbers(name, 0, count-1, $6);
2555 # delete[]$1;
2556 # delete $3;
2557 # }
2558 ()
2559 def p_enum_name_6(p):
2560 '''enum_name : IDENTIFIER '[' pos_neg_number ':' pos_neg_number ']' '=' expression '''
2561 print('enum_name_6', list(p))
2562 # { perm_string name = lex_strings.make($1);
2563 # $$ = make_named_numbers(name, check_enum_seq_value(@1, $3, true),
2564 # check_enum_seq_value(@1, $5, true), $8);
2565 # delete[]$1;
2566 # delete $3;
2567 # delete $5;
2568 # }
2569 ()
2570 def p_struct_data_type_1(p):
2571 '''struct_data_type : K_struct K_packed_opt '{' struct_union_member_list '}' '''
2572 print('struct_data_type_1', list(p))
2573 # { struct_type_t*tmp = new struct_type_t;
2574 # FILE_NAME(tmp, @1);
2575 # tmp->packed_flag = $2;
2576 # tmp->union_flag = false;
2577 # tmp->members .reset($4);
2578 # $$ = tmp;
2579 # }
2580 ()
2581 def p_struct_data_type_2(p):
2582 '''struct_data_type : K_union K_packed_opt '{' struct_union_member_list '}' '''
2583 print('struct_data_type_2', list(p))
2584 # { struct_type_t*tmp = new struct_type_t;
2585 # FILE_NAME(tmp, @1);
2586 # tmp->packed_flag = $2;
2587 # tmp->union_flag = true;
2588 # tmp->members .reset($4);
2589 # $$ = tmp;
2590 # }
2591 ()
2592 def p_struct_data_type_3(p):
2593 '''struct_data_type : K_struct K_packed_opt '{' error '}' '''
2594 print('struct_data_type_3', list(p))
2595 # { yyerror(@3, "error: Errors in struct member list.");
2596 # yyerrok;
2597 # struct_type_t*tmp = new struct_type_t;
2598 # FILE_NAME(tmp, @1);
2599 # tmp->packed_flag = $2;
2600 # tmp->union_flag = false;
2601 # $$ = tmp;
2602 # }
2603 ()
2604 def p_struct_data_type_4(p):
2605 '''struct_data_type : K_union K_packed_opt '{' error '}' '''
2606 print('struct_data_type_4', list(p))
2607 # { yyerror(@3, "error: Errors in union member list.");
2608 # yyerrok;
2609 # struct_type_t*tmp = new struct_type_t;
2610 # FILE_NAME(tmp, @1);
2611 # tmp->packed_flag = $2;
2612 # tmp->union_flag = true;
2613 # $$ = tmp;
2614 # }
2615 ()
2616 def p_struct_union_member_list_1(p):
2617 '''struct_union_member_list : struct_union_member_list struct_union_member '''
2618 print('struct_union_member_list_1', list(p))
2619 # { list<struct_member_t*>*tmp = $1;
2620 # tmp->push_back($2);
2621 # $$ = tmp;
2622 # }
2623 ()
2624 def p_struct_union_member_list_2(p):
2625 '''struct_union_member_list : struct_union_member '''
2626 print('struct_union_member_list_2', list(p))
2627 # { list<struct_member_t*>*tmp = new list<struct_member_t*>;
2628 # tmp->push_back($1);
2629 # $$ = tmp;
2630 # }
2631 ()
2632 def p_struct_union_member_1(p):
2633 '''struct_union_member : attribute_list_opt data_type list_of_variable_decl_assignments ';' '''
2634 print('struct_union_member_1', list(p))
2635 # { struct_member_t*tmp = new struct_member_t;
2636 # FILE_NAME(tmp, @2);
2637 # tmp->type .reset($2);
2638 # tmp->names .reset($3);
2639 # $$ = tmp;
2640 # }
2641 ()
2642 def p_struct_union_member_2(p):
2643 '''struct_union_member : error ';' '''
2644 print('struct_union_member_2', list(p))
2645 # { yyerror(@2, "Error in struct/union member.");
2646 # yyerrok;
2647 # $$ = 0;
2648 # }
2649 ()
2650 def p_case_item_1(p):
2651 '''case_item : expression_list_proper ':' statement_or_null '''
2652 print('case_item_1', list(p))
2653 # { PCase::Item*tmp = new PCase::Item;
2654 # tmp->expr = *$1;
2655 # tmp->stat = $3;
2656 # delete $1;
2657 # $$ = tmp;
2658 # }
2659 ()
2660 def p_case_item_2(p):
2661 '''case_item : K_default ':' statement_or_null '''
2662 print('case_item_2', list(p))
2663 # { PCase::Item*tmp = new PCase::Item;
2664 # tmp->stat = $3;
2665 # $$ = tmp;
2666 # }
2667 ()
2668 def p_case_item_3(p):
2669 '''case_item : K_default statement_or_null '''
2670 print('case_item_3', list(p))
2671 # { PCase::Item*tmp = new PCase::Item;
2672 # tmp->stat = $2;
2673 # $$ = tmp;
2674 # }
2675 ()
2676 def p_case_item_4(p):
2677 '''case_item : error ':' statement_or_null '''
2678 print('case_item_4', list(p))
2679 # { yyerror(@2, "error: Incomprehensible case expression.");
2680 # yyerrok;
2681 # }
2682 ()
2683 def p_case_items_1(p):
2684 '''case_items : case_items case_item '''
2685 print('case_items_1', list(p))
2686 # { svector<PCase::Item*>*tmp;
2687 # tmp = new svector<PCase::Item*>(*$1, $2);
2688 # delete $1;
2689 # $$ = tmp;
2690 # }
2691 ()
2692 def p_case_items_2(p):
2693 '''case_items : case_item '''
2694 print('case_items_2', list(p))
2695 # { svector<PCase::Item*>*tmp = new svector<PCase::Item*>(1);
2696 # (*tmp)[0] = $1;
2697 # $$ = tmp;
2698 # }
2699 ()
2700 def p_charge_strength_1(p):
2701 '''charge_strength : '(' K_small ')' '''
2702 print('charge_strength_1', list(p))
2703 ()
2704 def p_charge_strength_2(p):
2705 '''charge_strength : '(' K_medium ')' '''
2706 print('charge_strength_2', list(p))
2707 ()
2708 def p_charge_strength_3(p):
2709 '''charge_strength : '(' K_large ')' '''
2710 print('charge_strength_3', list(p))
2711 ()
2712 def p_charge_strength_opt_1(p):
2713 '''charge_strength_opt : charge_strength '''
2714 print('charge_strength_opt_1', list(p))
2715 ()
2716 def p_charge_strength_opt_2(p):
2717 '''charge_strength_opt : '''
2718 print('charge_strength_opt_2', list(p))
2719 ()
2720 def p_defparam_assign_1(p):
2721 '''defparam_assign : hierarchy_identifier '=' expression '''
2722 print('defparam_assign_1', list(p))
2723 # { pform_set_defparam(*$1, $3);
2724 # delete $1;
2725 # }
2726 ()
2727 def p_defparam_assign_list_1(p):
2728 '''defparam_assign_list : defparam_assign '''
2729 print('defparam_assign_list_1', list(p))
2730 ()
2731 def p_defparam_assign_list_2(p):
2732 '''defparam_assign_list : dimensions defparam_assign '''
2733 print('defparam_assign_list_2', list(p))
2734 # { yyerror(@1, "error: defparam may not include a range.");
2735 # delete $1;
2736 # }
2737 ()
2738 def p_defparam_assign_list_3(p):
2739 '''defparam_assign_list : defparam_assign_list ',' defparam_assign '''
2740 print('defparam_assign_list_3', list(p))
2741 ()
2742 def p_delay1_1(p):
2743 '''delay1 : '#' delay_value_simple '''
2744 print('delay1_1', list(p))
2745 # { list<PExpr*>*tmp = new list<PExpr*>;
2746 # tmp->push_back($2);
2747 # $$ = tmp;
2748 # }
2749 ()
2750 def p_delay1_2(p):
2751 '''delay1 : '#' '(' delay_value ')' '''
2752 print('delay1_2', list(p))
2753 # { list<PExpr*>*tmp = new list<PExpr*>;
2754 # tmp->push_back($3);
2755 # $$ = tmp;
2756 # }
2757 ()
2758 def p_delay3_1(p):
2759 '''delay3 : '#' delay_value_simple '''
2760 print('delay3_1', list(p))
2761 # { list<PExpr*>*tmp = new list<PExpr*>;
2762 # tmp->push_back($2);
2763 # $$ = tmp;
2764 # }
2765 ()
2766 def p_delay3_2(p):
2767 '''delay3 : '#' '(' delay_value ')' '''
2768 print('delay3_2', list(p))
2769 # { list<PExpr*>*tmp = new list<PExpr*>;
2770 # tmp->push_back($3);
2771 # $$ = tmp;
2772 # }
2773 ()
2774 def p_delay3_3(p):
2775 '''delay3 : '#' '(' delay_value ',' delay_value ')' '''
2776 print('delay3_3', list(p))
2777 # { list<PExpr*>*tmp = new list<PExpr*>;
2778 # tmp->push_back($3);
2779 # tmp->push_back($5);
2780 # $$ = tmp;
2781 # }
2782 ()
2783 def p_delay3_4(p):
2784 '''delay3 : '#' '(' delay_value ',' delay_value ',' delay_value ')' '''
2785 print('delay3_4', list(p))
2786 # { list<PExpr*>*tmp = new list<PExpr*>;
2787 # tmp->push_back($3);
2788 # tmp->push_back($5);
2789 # tmp->push_back($7);
2790 # $$ = tmp;
2791 # }
2792 ()
2793 def p_delay3_opt_1(p):
2794 '''delay3_opt : delay3 '''
2795 print('delay3_opt_1', list(p))
2796 p[0] = p[1]
2797 ()
2798 def p_delay3_opt_2(p):
2799 '''delay3_opt : '''
2800 print('delay3_opt_2', list(p))
2801 # { $$ = 0; }
2802 ()
2803 def p_delay_value_list_1(p):
2804 '''delay_value_list : delay_value '''
2805 print('delay_value_list_1', list(p))
2806 # { list<PExpr*>*tmp = new list<PExpr*>;
2807 # tmp->push_back($1);
2808 # $$ = tmp;
2809 # }
2810 ()
2811 def p_delay_value_list_2(p):
2812 '''delay_value_list : delay_value_list ',' delay_value '''
2813 print('delay_value_list_2', list(p))
2814 # { list<PExpr*>*tmp = $1;
2815 # tmp->push_back($3);
2816 # $$ = tmp;
2817 # }
2818 ()
2819 def p_delay_value_1(p):
2820 '''delay_value : expression '''
2821 print('delay_value_1', list(p))
2822 # { PExpr*tmp = $1;
2823 # $$ = tmp;
2824 # }
2825 ()
2826 def p_delay_value_2(p):
2827 '''delay_value : expression ':' expression ':' expression '''
2828 print('delay_value_2', list(p))
2829 # { $$ = pform_select_mtm_expr($1, $3, $5); }
2830 ()
2831 def p_delay_value_simple_1(p):
2832 '''delay_value_simple : DEC_NUMBER '''
2833 print('delay_value_simple_1', list(p))
2834 # { verinum*tmp = $1;
2835 # if (tmp == 0) {
2836 # yyerror(@1, "internal error: delay.");
2837 # $$ = 0;
2838 # } else {
2839 # $$ = new PENumber(tmp);
2840 # FILE_NAME($$, @1);
2841 # }
2842 # based_size = 0;
2843 # }
2844 ()
2845 def p_delay_value_simple_2(p):
2846 '''delay_value_simple : REALTIME '''
2847 print('delay_value_simple_2', list(p))
2848 # { verireal*tmp = $1;
2849 # if (tmp == 0) {
2850 # yyerror(@1, "internal error: delay.");
2851 # $$ = 0;
2852 # } else {
2853 # $$ = new PEFNumber(tmp);
2854 # FILE_NAME($$, @1);
2855 # }
2856 # }
2857 ()
2858 def p_delay_value_simple_3(p):
2859 '''delay_value_simple : IDENTIFIER '''
2860 print('delay_value_simple_3', list(p))
2861 # { PEIdent*tmp = new PEIdent(lex_strings.make($1));
2862 # FILE_NAME(tmp, @1);
2863 # $$ = tmp;
2864 # delete[]$1;
2865 # }
2866 ()
2867 def p_delay_value_simple_4(p):
2868 '''delay_value_simple : TIME_LITERAL '''
2869 print('delay_value_simple_4', list(p))
2870 # { int unit;
2871 #
2872 # based_size = 0;
2873 # $$ = 0;
2874 # if ($1 == 0 || !get_time_unit($1, unit))
2875 # yyerror(@1, "internal error: delay.");
2876 # else {
2877 # double p = pow(10.0,
2878 # (double)(unit - pform_get_timeunit()));
2879 # double time = atof($1) * p;
2880 #
2881 # verireal *v = new verireal(time);
2882 # $$ = new PEFNumber(v);
2883 # FILE_NAME($$, @1);
2884 # }
2885 # }
2886 ()
2887 def p_optional_semicolon_1(p):
2888 '''optional_semicolon : ';' '''
2889 print('optional_semicolon_1', list(p))
2890 ()
2891 def p_optional_semicolon_2(p):
2892 '''optional_semicolon : '''
2893 print('optional_semicolon_2', list(p))
2894 ()
2895 def p_discipline_declaration_1(p):
2896 '''discipline_declaration : K_discipline IDENTIFIER optional_semicolon _embed0_discipline_declaration discipline_items K_enddiscipline '''
2897 print('discipline_declaration_1', list(p))
2898 # { pform_end_discipline(@1); delete[] $2; }
2899 ()
2900 def p__embed0_discipline_declaration(p):
2901 '''_embed0_discipline_declaration : '''
2902 # { pform_start_discipline($2); }
2903 ()
2904 def p_discipline_items_1(p):
2905 '''discipline_items : discipline_items discipline_item '''
2906 print('discipline_items_1', list(p))
2907 ()
2908 def p_discipline_items_2(p):
2909 '''discipline_items : discipline_item '''
2910 print('discipline_items_2', list(p))
2911 ()
2912 def p_discipline_item_1(p):
2913 '''discipline_item : K_domain K_discrete ';' '''
2914 print('discipline_item_1', list(p))
2915 # { pform_discipline_domain(@1, IVL_DIS_DISCRETE); }
2916 ()
2917 def p_discipline_item_2(p):
2918 '''discipline_item : K_domain K_continuous ';' '''
2919 print('discipline_item_2', list(p))
2920 # { pform_discipline_domain(@1, IVL_DIS_CONTINUOUS); }
2921 ()
2922 def p_discipline_item_3(p):
2923 '''discipline_item : K_potential IDENTIFIER ';' '''
2924 print('discipline_item_3', list(p))
2925 # { pform_discipline_potential(@1, $2); delete[] $2; }
2926 ()
2927 def p_discipline_item_4(p):
2928 '''discipline_item : K_flow IDENTIFIER ';' '''
2929 print('discipline_item_4', list(p))
2930 # { pform_discipline_flow(@1, $2); delete[] $2; }
2931 ()
2932 def p_nature_declaration_1(p):
2933 '''nature_declaration : K_nature IDENTIFIER optional_semicolon _embed0_nature_declaration nature_items K_endnature '''
2934 print('nature_declaration_1', list(p))
2935 # { pform_end_nature(@1); delete[] $2; }
2936 ()
2937 def p__embed0_nature_declaration(p):
2938 '''_embed0_nature_declaration : '''
2939 # { pform_start_nature($2); }
2940 ()
2941 def p_nature_items_1(p):
2942 '''nature_items : nature_items nature_item '''
2943 print('nature_items_1', list(p))
2944 ()
2945 def p_nature_items_2(p):
2946 '''nature_items : nature_item '''
2947 print('nature_items_2', list(p))
2948 ()
2949 def p_nature_item_1(p):
2950 '''nature_item : K_units '=' STRING ';' '''
2951 print('nature_item_1', list(p))
2952 # { delete[] $3; }
2953 ()
2954 def p_nature_item_2(p):
2955 '''nature_item : K_abstol '=' expression ';' '''
2956 print('nature_item_2', list(p))
2957 ()
2958 def p_nature_item_3(p):
2959 '''nature_item : K_access '=' IDENTIFIER ';' '''
2960 print('nature_item_3', list(p))
2961 # { pform_nature_access(@1, $3); delete[] $3; }
2962 ()
2963 def p_nature_item_4(p):
2964 '''nature_item : K_idt_nature '=' IDENTIFIER ';' '''
2965 print('nature_item_4', list(p))
2966 # { delete[] $3; }
2967 ()
2968 def p_nature_item_5(p):
2969 '''nature_item : K_ddt_nature '=' IDENTIFIER ';' '''
2970 print('nature_item_5', list(p))
2971 # { delete[] $3; }
2972 ()
2973 def p_config_declaration_1(p):
2974 '''config_declaration : K_config IDENTIFIER ';' K_design lib_cell_identifiers ';' list_of_config_rule_statements K_endconfig '''
2975 print('config_declaration_1', list(p))
2976 # { cerr << @1 << ": sorry: config declarations are not supported and "
2977 # "will be skipped." << endl;
2978 # delete[] $2;
2979 # }
2980 ()
2981 def p_lib_cell_identifiers_1(p):
2982 '''lib_cell_identifiers : '''
2983 print('lib_cell_identifiers_1', list(p))
2984 ()
2985 def p_lib_cell_identifiers_2(p):
2986 '''lib_cell_identifiers : lib_cell_identifiers lib_cell_id '''
2987 print('lib_cell_identifiers_2', list(p))
2988 ()
2989 def p_list_of_config_rule_statements_1(p):
2990 '''list_of_config_rule_statements : '''
2991 print('list_of_config_rule_statements_1', list(p))
2992 ()
2993 def p_list_of_config_rule_statements_2(p):
2994 '''list_of_config_rule_statements : list_of_config_rule_statements config_rule_statement '''
2995 print('list_of_config_rule_statements_2', list(p))
2996 ()
2997 def p_config_rule_statement_1(p):
2998 '''config_rule_statement : K_default K_liblist list_of_libraries ';' '''
2999 print('config_rule_statement_1', list(p))
3000 ()
3001 def p_config_rule_statement_2(p):
3002 '''config_rule_statement : K_instance hierarchy_identifier K_liblist list_of_libraries ';' '''
3003 print('config_rule_statement_2', list(p))
3004 # { delete $2; }
3005 ()
3006 def p_config_rule_statement_3(p):
3007 '''config_rule_statement : K_instance hierarchy_identifier K_use lib_cell_id opt_config ';' '''
3008 print('config_rule_statement_3', list(p))
3009 # { delete $2; }
3010 ()
3011 def p_config_rule_statement_4(p):
3012 '''config_rule_statement : K_cell lib_cell_id K_liblist list_of_libraries ';' '''
3013 print('config_rule_statement_4', list(p))
3014 ()
3015 def p_config_rule_statement_5(p):
3016 '''config_rule_statement : K_cell lib_cell_id K_use lib_cell_id opt_config ';' '''
3017 print('config_rule_statement_5', list(p))
3018 ()
3019 def p_opt_config_1(p):
3020 '''opt_config : '''
3021 print('opt_config_1', list(p))
3022 ()
3023 def p_opt_config_2(p):
3024 '''opt_config : ':' K_config '''
3025 print('opt_config_2', list(p))
3026 ()
3027 def p_lib_cell_id_1(p):
3028 '''lib_cell_id : IDENTIFIER '''
3029 print('lib_cell_id_1', list(p))
3030 # { delete[] $1; }
3031 ()
3032 def p_lib_cell_id_2(p):
3033 '''lib_cell_id : IDENTIFIER '.' IDENTIFIER '''
3034 print('lib_cell_id_2', list(p))
3035 # { delete[] $1; delete[] $3; }
3036 ()
3037 def p_list_of_libraries_1(p):
3038 '''list_of_libraries : '''
3039 print('list_of_libraries_1', list(p))
3040 ()
3041 def p_list_of_libraries_2(p):
3042 '''list_of_libraries : list_of_libraries IDENTIFIER '''
3043 print('list_of_libraries_2', list(p))
3044 # { delete[] $2; }
3045 ()
3046 def p_drive_strength_1(p):
3047 '''drive_strength : '(' dr_strength0 ',' dr_strength1 ')' '''
3048 print('drive_strength_1', list(p))
3049 # { $$.str0 = $2.str0;
3050 # $$.str1 = $4.str1;
3051 # }
3052 ()
3053 def p_drive_strength_2(p):
3054 '''drive_strength : '(' dr_strength1 ',' dr_strength0 ')' '''
3055 print('drive_strength_2', list(p))
3056 # { $$.str0 = $4.str0;
3057 # $$.str1 = $2.str1;
3058 # }
3059 ()
3060 def p_drive_strength_3(p):
3061 '''drive_strength : '(' dr_strength0 ',' K_highz1 ')' '''
3062 print('drive_strength_3', list(p))
3063 # { $$.str0 = $2.str0;
3064 # $$.str1 = IVL_DR_HiZ;
3065 # }
3066 ()
3067 def p_drive_strength_4(p):
3068 '''drive_strength : '(' dr_strength1 ',' K_highz0 ')' '''
3069 print('drive_strength_4', list(p))
3070 # { $$.str0 = IVL_DR_HiZ;
3071 # $$.str1 = $2.str1;
3072 # }
3073 ()
3074 def p_drive_strength_5(p):
3075 '''drive_strength : '(' K_highz1 ',' dr_strength0 ')' '''
3076 print('drive_strength_5', list(p))
3077 # { $$.str0 = $4.str0;
3078 # $$.str1 = IVL_DR_HiZ;
3079 # }
3080 ()
3081 def p_drive_strength_6(p):
3082 '''drive_strength : '(' K_highz0 ',' dr_strength1 ')' '''
3083 print('drive_strength_6', list(p))
3084 # { $$.str0 = IVL_DR_HiZ;
3085 # $$.str1 = $4.str1;
3086 # }
3087 ()
3088 def p_drive_strength_opt_1(p):
3089 '''drive_strength_opt : drive_strength '''
3090 print('drive_strength_opt_1', list(p))
3091 p[0] = p[1]
3092 ()
3093 def p_drive_strength_opt_2(p):
3094 '''drive_strength_opt : '''
3095 print('drive_strength_opt_2', list(p))
3096 # { $$.str0 = IVL_DR_STRONG; $$.str1 = IVL_DR_STRONG; }
3097 ()
3098 def p_dr_strength0_1(p):
3099 '''dr_strength0 : K_supply0 '''
3100 print('dr_strength0_1', list(p))
3101 # { $$.str0 = IVL_DR_SUPPLY; }
3102 ()
3103 def p_dr_strength0_2(p):
3104 '''dr_strength0 : K_strong0 '''
3105 print('dr_strength0_2', list(p))
3106 # { $$.str0 = IVL_DR_STRONG; }
3107 ()
3108 def p_dr_strength0_3(p):
3109 '''dr_strength0 : K_pull0 '''
3110 print('dr_strength0_3', list(p))
3111 # { $$.str0 = IVL_DR_PULL; }
3112 ()
3113 def p_dr_strength0_4(p):
3114 '''dr_strength0 : K_weak0 '''
3115 print('dr_strength0_4', list(p))
3116 # { $$.str0 = IVL_DR_WEAK; }
3117 ()
3118 def p_dr_strength1_1(p):
3119 '''dr_strength1 : K_supply1 '''
3120 print('dr_strength1_1', list(p))
3121 # { $$.str1 = IVL_DR_SUPPLY; }
3122 ()
3123 def p_dr_strength1_2(p):
3124 '''dr_strength1 : K_strong1 '''
3125 print('dr_strength1_2', list(p))
3126 # { $$.str1 = IVL_DR_STRONG; }
3127 ()
3128 def p_dr_strength1_3(p):
3129 '''dr_strength1 : K_pull1 '''
3130 print('dr_strength1_3', list(p))
3131 # { $$.str1 = IVL_DR_PULL; }
3132 ()
3133 def p_dr_strength1_4(p):
3134 '''dr_strength1 : K_weak1 '''
3135 print('dr_strength1_4', list(p))
3136 # { $$.str1 = IVL_DR_WEAK; }
3137 ()
3138 def p_clocking_event_opt_1(p):
3139 '''clocking_event_opt : event_control '''
3140 print('clocking_event_opt_1', list(p))
3141 ()
3142 def p_clocking_event_opt_2(p):
3143 '''clocking_event_opt : '''
3144 print('clocking_event_opt_2', list(p))
3145 ()
3146 def p_event_control_1(p):
3147 '''event_control : '@' hierarchy_identifier '''
3148 print('event_control_1', list(p))
3149 # { PEIdent*tmpi = new PEIdent(*$2);
3150 # PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi);
3151 # PEventStatement*tmps = new PEventStatement(tmpe);
3152 # FILE_NAME(tmps, @1);
3153 # $$ = tmps;
3154 # delete $2;
3155 # }
3156 ()
3157 def p_event_control_2(p):
3158 '''event_control : '@' '(' event_expression_list ')' '''
3159 print('event_control_2', list(p))
3160 # { PEventStatement*tmp = new PEventStatement(*$3);
3161 # FILE_NAME(tmp, @1);
3162 # delete $3;
3163 # $$ = tmp;
3164 # }
3165 ()
3166 def p_event_control_3(p):
3167 '''event_control : '@' '(' error ')' '''
3168 print('event_control_3', list(p))
3169 # { yyerror(@1, "error: Malformed event control expression.");
3170 # $$ = 0;
3171 # }
3172 ()
3173 def p_event_expression_list_1(p):
3174 '''event_expression_list : event_expression '''
3175 print('event_expression_list_1', list(p))
3176 p[0] = p[1]
3177 ()
3178 def p_event_expression_list_2(p):
3179 '''event_expression_list : event_expression_list K_or event_expression '''
3180 print('event_expression_list_2', list(p))
3181 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*$1, *$3);
3182 # delete $1;
3183 # delete $3;
3184 # $$ = tmp;
3185 # }
3186 ()
3187 def p_event_expression_list_3(p):
3188 '''event_expression_list : event_expression_list ',' event_expression '''
3189 print('event_expression_list_3', list(p))
3190 # { svector<PEEvent*>*tmp = new svector<PEEvent*>(*$1, *$3);
3191 # delete $1;
3192 # delete $3;
3193 # $$ = tmp;
3194 # }
3195 ()
3196 def p_event_expression_1(p):
3197 '''event_expression : K_posedge expression '''
3198 print('event_expression_1', list(p))
3199 # { PEEvent*tmp = new PEEvent(PEEvent::POSEDGE, $2);
3200 # FILE_NAME(tmp, @1);
3201 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3202 # (*tl)[0] = tmp;
3203 # $$ = tl;
3204 # }
3205 ()
3206 def p_event_expression_2(p):
3207 '''event_expression : K_negedge expression '''
3208 print('event_expression_2', list(p))
3209 # { PEEvent*tmp = new PEEvent(PEEvent::NEGEDGE, $2);
3210 # FILE_NAME(tmp, @1);
3211 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3212 # (*tl)[0] = tmp;
3213 # $$ = tl;
3214 # }
3215 ()
3216 def p_event_expression_3(p):
3217 '''event_expression : expression '''
3218 print('event_expression_3', list(p))
3219 # { PEEvent*tmp = new PEEvent(PEEvent::ANYEDGE, $1);
3220 # FILE_NAME(tmp, @1);
3221 # svector<PEEvent*>*tl = new svector<PEEvent*>(1);
3222 # (*tl)[0] = tmp;
3223 # $$ = tl;
3224 # }
3225 ()
3226 def p_branch_probe_expression_1(p):
3227 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ',' IDENTIFIER ')' '''
3228 print('branch_probe_expression_1', list(p))
3229 # { $$ = pform_make_branch_probe_expression(@1, $1, $3, $5); }
3230 ()
3231 def p_branch_probe_expression_2(p):
3232 '''branch_probe_expression : IDENTIFIER '(' IDENTIFIER ')' '''
3233 print('branch_probe_expression_2', list(p))
3234 # { $$ = pform_make_branch_probe_expression(@1, $1, $3); }
3235 ()
3236 def p_expression_1(p):
3237 '''expression : expr_primary_or_typename '''
3238 print('expression_1', list(p))
3239 p[0] = p[1]
3240 ()
3241 def p_expression_2(p):
3242 '''expression : inc_or_dec_expression '''
3243 print('expression_2', list(p))
3244 p[0] = p[1]
3245 ()
3246 def p_expression_3(p):
3247 '''expression : inside_expression '''
3248 print('expression_3', list(p))
3249 p[0] = p[1]
3250 ()
3251 def p_expression_4(p):
3252 '''expression : '+' attribute_list_opt expr_primary %prec UNARY_PREC '''
3253 print('expression_4', list(p))
3254 p[0] = p[3]
3255 ()
3256 def p_expression_5(p):
3257 '''expression : '-' attribute_list_opt expr_primary %prec UNARY_PREC '''
3258 print('expression_5', list(p))
3259 # { PEUnary*tmp = new PEUnary('-', $3);
3260 # FILE_NAME(tmp, @3);
3261 # $$ = tmp;
3262 # }
3263 ()
3264 def p_expression_6(p):
3265 '''expression : '~' attribute_list_opt expr_primary %prec UNARY_PREC '''
3266 print('expression_6', list(p))
3267 # { PEUnary*tmp = new PEUnary('~', $3);
3268 # FILE_NAME(tmp, @3);
3269 # $$ = tmp;
3270 # }
3271 ()
3272 def p_expression_7(p):
3273 '''expression : '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3274 print('expression_7', list(p))
3275 # { PEUnary*tmp = new PEUnary('&', $3);
3276 # FILE_NAME(tmp, @3);
3277 # $$ = tmp;
3278 # }
3279 ()
3280 def p_expression_8(p):
3281 '''expression : '!' attribute_list_opt expr_primary %prec UNARY_PREC '''
3282 print('expression_8', list(p))
3283 # { PEUnary*tmp = new PEUnary('!', $3);
3284 # FILE_NAME(tmp, @3);
3285 # $$ = tmp;
3286 # }
3287 ()
3288 def p_expression_9(p):
3289 '''expression : '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3290 print('expression_9', list(p))
3291 # { PEUnary*tmp = new PEUnary('|', $3);
3292 # FILE_NAME(tmp, @3);
3293 # $$ = tmp;
3294 # }
3295 ()
3296 def p_expression_10(p):
3297 '''expression : '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3298 print('expression_10', list(p))
3299 # { PEUnary*tmp = new PEUnary('^', $3);
3300 # FILE_NAME(tmp, @3);
3301 # $$ = tmp;
3302 # }
3303 ()
3304 def p_expression_11(p):
3305 '''expression : '~' '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3306 print('expression_11', list(p))
3307 # { yyerror(@1, "error: '~' '&' is not a valid expression. "
3308 # "Please use operator '~&' instead.");
3309 # $$ = 0;
3310 # }
3311 ()
3312 def p_expression_12(p):
3313 '''expression : '~' '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3314 print('expression_12', list(p))
3315 # { yyerror(@1, "error: '~' '|' is not a valid expression. "
3316 # "Please use operator '~|' instead.");
3317 # $$ = 0;
3318 # }
3319 ()
3320 def p_expression_13(p):
3321 '''expression : '~' '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3322 print('expression_13', list(p))
3323 # { yyerror(@1, "error: '~' '^' is not a valid expression. "
3324 # "Please use operator '~^' instead.");
3325 # $$ = 0;
3326 # }
3327 ()
3328 def p_expression_14(p):
3329 '''expression : K_NAND attribute_list_opt expr_primary %prec UNARY_PREC '''
3330 print('expression_14', list(p))
3331 # { PEUnary*tmp = new PEUnary('A', $3);
3332 # FILE_NAME(tmp, @3);
3333 # $$ = tmp;
3334 # }
3335 ()
3336 def p_expression_15(p):
3337 '''expression : K_NOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3338 print('expression_15', list(p))
3339 # { PEUnary*tmp = new PEUnary('N', $3);
3340 # FILE_NAME(tmp, @3);
3341 # $$ = tmp;
3342 # }
3343 ()
3344 def p_expression_16(p):
3345 '''expression : K_NXOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3346 print('expression_16', list(p))
3347 # { PEUnary*tmp = new PEUnary('X', $3);
3348 # FILE_NAME(tmp, @3);
3349 # $$ = tmp;
3350 # }
3351 ()
3352 def p_expression_17(p):
3353 '''expression : '!' error %prec UNARY_PREC '''
3354 print('expression_17', list(p))
3355 # { yyerror(@1, "error: Operand of unary ! "
3356 # "is not a primary expression.");
3357 # $$ = 0;
3358 # }
3359 ()
3360 def p_expression_18(p):
3361 '''expression : '^' error %prec UNARY_PREC '''
3362 print('expression_18', list(p))
3363 # { yyerror(@1, "error: Operand of reduction ^ "
3364 # "is not a primary expression.");
3365 # $$ = 0;
3366 # }
3367 ()
3368 def p_expression_19(p):
3369 '''expression : expression '^' attribute_list_opt expression '''
3370 print('expression_19', list(p))
3371 # { PEBinary*tmp = new PEBinary('^', $1, $4);
3372 # FILE_NAME(tmp, @2);
3373 # $$ = tmp;
3374 # }
3375 ()
3376 def p_expression_20(p):
3377 '''expression : expression K_POW attribute_list_opt expression '''
3378 print('expression_20', list(p))
3379 # { PEBinary*tmp = new PEBPower('p', $1, $4);
3380 # FILE_NAME(tmp, @2);
3381 # $$ = tmp;
3382 # }
3383 ()
3384 def p_expression_21(p):
3385 '''expression : expression '*' attribute_list_opt expression '''
3386 print('expression_21', list(p))
3387 # { PEBinary*tmp = new PEBinary('*', $1, $4);
3388 # FILE_NAME(tmp, @2);
3389 # $$ = tmp;
3390 # }
3391 ()
3392 def p_expression_22(p):
3393 '''expression : expression '/' attribute_list_opt expression '''
3394 print('expression_22', list(p))
3395 # { PEBinary*tmp = new PEBinary('/', $1, $4);
3396 # FILE_NAME(tmp, @2);
3397 # $$ = tmp;
3398 # }
3399 ()
3400 def p_expression_23(p):
3401 '''expression : expression '%' attribute_list_opt expression '''
3402 print('expression_23', list(p))
3403 # { PEBinary*tmp = new PEBinary('%', $1, $4);
3404 # FILE_NAME(tmp, @2);
3405 # $$ = tmp;
3406 # }
3407 ()
3408 def p_expression_24(p):
3409 '''expression : expression '+' attribute_list_opt expression '''
3410 print('expression_24', list(p))
3411 # { PEBinary*tmp = new PEBinary('+', $1, $4);
3412 # FILE_NAME(tmp, @2);
3413 # $$ = tmp;
3414 # }
3415 ()
3416 def p_expression_25(p):
3417 '''expression : expression '-' attribute_list_opt expression '''
3418 print('expression_25', list(p))
3419 # { PEBinary*tmp = new PEBinary('-', $1, $4);
3420 # FILE_NAME(tmp, @2);
3421 # $$ = tmp;
3422 # }
3423 ()
3424 def p_expression_26(p):
3425 '''expression : expression '&' attribute_list_opt expression '''
3426 print('expression_26', list(p))
3427 # { PEBinary*tmp = new PEBinary('&', $1, $4);
3428 # FILE_NAME(tmp, @2);
3429 # $$ = tmp;
3430 # }
3431 ()
3432 def p_expression_27(p):
3433 '''expression : expression '|' attribute_list_opt expression '''
3434 print('expression_27', list(p))
3435 # { PEBinary*tmp = new PEBinary('|', $1, $4);
3436 # FILE_NAME(tmp, @2);
3437 # $$ = tmp;
3438 # }
3439 ()
3440 def p_expression_28(p):
3441 '''expression : expression K_NAND attribute_list_opt expression '''
3442 print('expression_28', list(p))
3443 # { PEBinary*tmp = new PEBinary('A', $1, $4);
3444 # FILE_NAME(tmp, @2);
3445 # $$ = tmp;
3446 # }
3447 ()
3448 def p_expression_29(p):
3449 '''expression : expression K_NOR attribute_list_opt expression '''
3450 print('expression_29', list(p))
3451 # { PEBinary*tmp = new PEBinary('O', $1, $4);
3452 # FILE_NAME(tmp, @2);
3453 # $$ = tmp;
3454 # }
3455 ()
3456 def p_expression_30(p):
3457 '''expression : expression K_NXOR attribute_list_opt expression '''
3458 print('expression_30', list(p))
3459 # { PEBinary*tmp = new PEBinary('X', $1, $4);
3460 # FILE_NAME(tmp, @2);
3461 # $$ = tmp;
3462 # }
3463 ()
3464 def p_expression_31(p):
3465 '''expression : expression '<' attribute_list_opt expression '''
3466 print('expression_31', list(p))
3467 # { PEBinary*tmp = new PEBComp('<', $1, $4);
3468 # FILE_NAME(tmp, @2);
3469 # $$ = tmp;
3470 # }
3471 ()
3472 def p_expression_32(p):
3473 '''expression : expression '>' attribute_list_opt expression '''
3474 print('expression_32', list(p))
3475 # { PEBinary*tmp = new PEBComp('>', $1, $4);
3476 # FILE_NAME(tmp, @2);
3477 # $$ = tmp;
3478 # }
3479 ()
3480 def p_expression_33(p):
3481 '''expression : expression K_LS attribute_list_opt expression '''
3482 print('expression_33', list(p))
3483 # { PEBinary*tmp = new PEBShift('l', $1, $4);
3484 # FILE_NAME(tmp, @2);
3485 # $$ = tmp;
3486 # }
3487 ()
3488 def p_expression_34(p):
3489 '''expression : expression K_RS attribute_list_opt expression '''
3490 print('expression_34', list(p))
3491 # { PEBinary*tmp = new PEBShift('r', $1, $4);
3492 # FILE_NAME(tmp, @2);
3493 # $$ = tmp;
3494 # }
3495 ()
3496 def p_expression_35(p):
3497 '''expression : expression K_RSS attribute_list_opt expression '''
3498 print('expression_35', list(p))
3499 # { PEBinary*tmp = new PEBShift('R', $1, $4);
3500 # FILE_NAME(tmp, @2);
3501 # $$ = tmp;
3502 # }
3503 ()
3504 def p_expression_36(p):
3505 '''expression : expression K_EQ attribute_list_opt expression '''
3506 print('expression_36', list(p))
3507 # { PEBinary*tmp = new PEBComp('e', $1, $4);
3508 # FILE_NAME(tmp, @2);
3509 # $$ = tmp;
3510 # }
3511 ()
3512 def p_expression_37(p):
3513 '''expression : expression K_CEQ attribute_list_opt expression '''
3514 print('expression_37', list(p))
3515 # { PEBinary*tmp = new PEBComp('E', $1, $4);
3516 # FILE_NAME(tmp, @2);
3517 # $$ = tmp;
3518 # }
3519 ()
3520 def p_expression_38(p):
3521 '''expression : expression K_WEQ attribute_list_opt expression '''
3522 print('expression_38', list(p))
3523 # { PEBinary*tmp = new PEBComp('w', $1, $4);
3524 # FILE_NAME(tmp, @2);
3525 # $$ = tmp;
3526 # }
3527 ()
3528 def p_expression_39(p):
3529 '''expression : expression K_LE attribute_list_opt expression '''
3530 print('expression_39', list(p))
3531 # { PEBinary*tmp = new PEBComp('L', $1, $4);
3532 # FILE_NAME(tmp, @2);
3533 # $$ = tmp;
3534 # }
3535 ()
3536 def p_expression_40(p):
3537 '''expression : expression K_GE attribute_list_opt expression '''
3538 print('expression_40', list(p))
3539 # { PEBinary*tmp = new PEBComp('G', $1, $4);
3540 # FILE_NAME(tmp, @2);
3541 # $$ = tmp;
3542 # }
3543 ()
3544 def p_expression_41(p):
3545 '''expression : expression K_NE attribute_list_opt expression '''
3546 print('expression_41', list(p))
3547 # { PEBinary*tmp = new PEBComp('n', $1, $4);
3548 # FILE_NAME(tmp, @2);
3549 # $$ = tmp;
3550 # }
3551 ()
3552 def p_expression_42(p):
3553 '''expression : expression K_CNE attribute_list_opt expression '''
3554 print('expression_42', list(p))
3555 # { PEBinary*tmp = new PEBComp('N', $1, $4);
3556 # FILE_NAME(tmp, @2);
3557 # $$ = tmp;
3558 # }
3559 ()
3560 def p_expression_43(p):
3561 '''expression : expression K_WNE attribute_list_opt expression '''
3562 print('expression_43', list(p))
3563 # { PEBinary*tmp = new PEBComp('W', $1, $4);
3564 # FILE_NAME(tmp, @2);
3565 # $$ = tmp;
3566 # }
3567 ()
3568 def p_expression_44(p):
3569 '''expression : expression K_LOR attribute_list_opt expression '''
3570 print('expression_44', list(p))
3571 # { PEBinary*tmp = new PEBLogic('o', $1, $4);
3572 # FILE_NAME(tmp, @2);
3573 # $$ = tmp;
3574 # }
3575 ()
3576 def p_expression_45(p):
3577 '''expression : expression K_LAND attribute_list_opt expression '''
3578 print('expression_45', list(p))
3579 # { PEBinary*tmp = new PEBLogic('a', $1, $4);
3580 # FILE_NAME(tmp, @2);
3581 # $$ = tmp;
3582 # }
3583 ()
3584 def p_expression_46(p):
3585 '''expression : expression '?' attribute_list_opt expression ':' expression '''
3586 print('expression_46', list(p))
3587 # { PETernary*tmp = new PETernary($1, $4, $6);
3588 # FILE_NAME(tmp, @2);
3589 # $$ = tmp;
3590 # }
3591 ()
3592 def p_expr_mintypmax_1(p):
3593 '''expr_mintypmax : expression '''
3594 print('expr_mintypmax_1', list(p))
3595 p[0] = p[1]
3596 ()
3597 def p_expr_mintypmax_2(p):
3598 '''expr_mintypmax : expression ':' expression ':' expression '''
3599 print('expr_mintypmax_2', list(p))
3600 # { switch (min_typ_max_flag) {
3601 # case MIN:
3602 # $$ = $1;
3603 # delete $3;
3604 # delete $5;
3605 # break;
3606 # case TYP:
3607 # delete $1;
3608 # $$ = $3;
3609 # delete $5;
3610 # break;
3611 # case MAX:
3612 # delete $1;
3613 # delete $3;
3614 # $$ = $5;
3615 # break;
3616 # }
3617 # if (min_typ_max_warn > 0) {
3618 # cerr << $$->get_fileline() << ": warning: choosing ";
3619 # switch (min_typ_max_flag) {
3620 # case MIN:
3621 # cerr << "min";
3622 # break;
3623 # case TYP:
3624 # cerr << "typ";
3625 # break;
3626 # case MAX:
3627 # cerr << "max";
3628 # break;
3629 # }
3630 # cerr << " expression." << endl;
3631 # min_typ_max_warn -= 1;
3632 # }
3633 # }
3634 ()
3635 def p_expression_list_with_nuls_1(p):
3636 '''expression_list_with_nuls : expression_list_with_nuls ',' expression '''
3637 print('expression_list_with_nuls_1', list(p))
3638 # { list<PExpr*>*tmp = $1;
3639 # tmp->push_back($3);
3640 # $$ = tmp;
3641 # }
3642 ()
3643 def p_expression_list_with_nuls_2(p):
3644 '''expression_list_with_nuls : expression '''
3645 print('expression_list_with_nuls_2', list(p))
3646 # { list<PExpr*>*tmp = new list<PExpr*>;
3647 # tmp->push_back($1);
3648 # $$ = tmp;
3649 # }
3650 ()
3651 def p_expression_list_with_nuls_3(p):
3652 '''expression_list_with_nuls : '''
3653 print('expression_list_with_nuls_3', list(p))
3654 # { list<PExpr*>*tmp = new list<PExpr*>;
3655 # tmp->push_back(0);
3656 # $$ = tmp;
3657 # }
3658 ()
3659 def p_expression_list_with_nuls_4(p):
3660 '''expression_list_with_nuls : expression_list_with_nuls ',' '''
3661 print('expression_list_with_nuls_4', list(p))
3662 # { list<PExpr*>*tmp = $1;
3663 # tmp->push_back(0);
3664 # $$ = tmp;
3665 # }
3666 ()
3667 def p_expression_list_proper_1(p):
3668 '''expression_list_proper : expression_list_proper ',' expression '''
3669 print('expression_list_proper_1', list(p))
3670 # { list<PExpr*>*tmp = $1;
3671 # tmp->push_back($3);
3672 # $$ = tmp;
3673 # }
3674 ()
3675 def p_expression_list_proper_2(p):
3676 '''expression_list_proper : expression '''
3677 print('expression_list_proper_2', list(p))
3678 # { list<PExpr*>*tmp = new list<PExpr*>;
3679 # tmp->push_back($1);
3680 # $$ = tmp;
3681 # }
3682 ()
3683 def p_expr_primary_or_typename_1(p):
3684 '''expr_primary_or_typename : expr_primary '''
3685 print('expr_primary_or_typename_1', list(p))
3686 p[0] = p[1]
3687 ()
3688 def p_expr_primary_or_typename_2(p):
3689 '''expr_primary_or_typename : TYPE_IDENTIFIER '''
3690 print('expr_primary_or_typename_2', list(p))
3691 p[0] = p[1]
3692 # { PETypename*tmp = new PETypename($1.type);
3693 # FILE_NAME(tmp,@1);
3694 # $$ = tmp;
3695 # delete[]$1.text;
3696 # }
3697 ()
3698 def p_expr_primary_1(p):
3699 '''expr_primary : number '''
3700 print('expr_primary_1', list(p))
3701 p[0] = p[1]
3702 # { assert($1);
3703 # PENumber*tmp = new PENumber($1);
3704 # FILE_NAME(tmp, @1);
3705 # $$ = tmp;
3706 # }
3707 ()
3708 def p_expr_primary_2(p):
3709 '''expr_primary : REALTIME '''
3710 print('expr_primary_2', list(p))
3711 # { PEFNumber*tmp = new PEFNumber($1);
3712 # FILE_NAME(tmp, @1);
3713 # $$ = tmp;
3714 # }
3715 ()
3716 def p_expr_primary_3(p):
3717 '''expr_primary : STRING '''
3718 print('expr_primary_3', list(p))
3719 # { PEString*tmp = new PEString($1);
3720 # FILE_NAME(tmp, @1);
3721 # $$ = tmp;
3722 # }
3723 ()
3724 def p_expr_primary_4(p):
3725 '''expr_primary : TIME_LITERAL '''
3726 print('expr_primary_4', list(p))
3727 # { int unit;
3728 #
3729 # based_size = 0;
3730 # $$ = 0;
3731 # if ($1 == 0 || !get_time_unit($1, unit))
3732 # yyerror(@1, "internal error: delay.");
3733 # else {
3734 # double p = pow(10.0, (double)(unit - pform_get_timeunit()));
3735 # double time = atof($1) * p;
3736 #
3737 # verireal *v = new verireal(time);
3738 # $$ = new PEFNumber(v);
3739 # FILE_NAME($$, @1);
3740 # }
3741 # }
3742 ()
3743 def p_expr_primary_5(p):
3744 '''expr_primary : SYSTEM_IDENTIFIER '''
3745 print('expr_primary_5', list(p))
3746 # { perm_string tn = lex_strings.make($1);
3747 # PECallFunction*tmp = new PECallFunction(tn);
3748 # FILE_NAME(tmp, @1);
3749 # $$ = tmp;
3750 # delete[]$1;
3751 # }
3752 ()
3753 def p_expr_primary_6(p):
3754 '''expr_primary : hierarchy_identifier '''
3755 print('expr_primary_6', list(p))
3756 p[0] = p[1]
3757 # { PEIdent*tmp = pform_new_ident(*$1);
3758 # FILE_NAME(tmp, @1);
3759 # $$ = tmp;
3760 # delete $1;
3761 # }
3762 ()
3763 def p_expr_primary_7(p):
3764 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier '''
3765 print('expr_primary_7', list(p))
3766 # { $$ = pform_package_ident(@2, $1, $3);
3767 # delete $3;
3768 # }
3769 ()
3770 def p_expr_primary_8(p):
3771 '''expr_primary : hierarchy_identifier '(' expression_list_with_nuls ')' '''
3772 print('expr_primary_8', list(p))
3773 # { list<PExpr*>*expr_list = $3;
3774 # strip_tail_items(expr_list);
3775 # PECallFunction*tmp = pform_make_call_function(@1, *$1, *expr_list);
3776 # delete $1;
3777 # $$ = tmp;
3778 # }
3779 ()
3780 def p_expr_primary_9(p):
3781 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' '''
3782 print('expr_primary_9', list(p))
3783 # { pform_name_t*t_name = $1;
3784 # while (! $3->empty()) {
3785 # t_name->push_back($3->front());
3786 # $3->pop_front();
3787 # }
3788 # list<PExpr*>*expr_list = $5;
3789 # strip_tail_items(expr_list);
3790 # PECallFunction*tmp = pform_make_call_function(@1, *t_name, *expr_list);
3791 # delete $1;
3792 # delete $3;
3793 # $$ = tmp;
3794 # }
3795 ()
3796 def p_expr_primary_10(p):
3797 '''expr_primary : SYSTEM_IDENTIFIER '(' expression_list_proper ')' '''
3798 print('expr_primary_10', list(p))
3799 # { perm_string tn = lex_strings.make($1);
3800 # PECallFunction*tmp = new PECallFunction(tn, *$3);
3801 # FILE_NAME(tmp, @1);
3802 # delete[]$1;
3803 # $$ = tmp;
3804 # }
3805 ()
3806 def p_expr_primary_11(p):
3807 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')' '''
3808 print('expr_primary_11', list(p))
3809 # { perm_string use_name = lex_strings.make($3);
3810 # PECallFunction*tmp = new PECallFunction($1, use_name, *$5);
3811 # FILE_NAME(tmp, @3);
3812 # delete[]$3;
3813 # $$ = tmp;
3814 # }
3815 ()
3816 def p_expr_primary_12(p):
3817 '''expr_primary : SYSTEM_IDENTIFIER '(' ')' '''
3818 print('expr_primary_12', list(p))
3819 # { perm_string tn = lex_strings.make($1);
3820 # const vector<PExpr*>empty;
3821 # PECallFunction*tmp = new PECallFunction(tn, empty);
3822 # FILE_NAME(tmp, @1);
3823 # delete[]$1;
3824 # $$ = tmp;
3825 # if (!gn_system_verilog()) {
3826 # yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
3827 # }
3828 # }
3829 ()
3830 def p_expr_primary_13(p):
3831 '''expr_primary : implicit_class_handle '''
3832 print('expr_primary_13', list(p))
3833 # { PEIdent*tmp = new PEIdent(*$1);
3834 # FILE_NAME(tmp,@1);
3835 # delete $1;
3836 # $$ = tmp;
3837 # }
3838 ()
3839 def p_expr_primary_14(p):
3840 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '''
3841 print('expr_primary_14', list(p))
3842 # { pform_name_t*t_name = $1;
3843 # while (! $3->empty()) {
3844 # t_name->push_back($3->front());
3845 # $3->pop_front();
3846 # }
3847 # PEIdent*tmp = new PEIdent(*t_name);
3848 # FILE_NAME(tmp,@1);
3849 # delete $1;
3850 # delete $3;
3851 # $$ = tmp;
3852 # }
3853 ()
3854 def p_expr_primary_15(p):
3855 '''expr_primary : K_acos '(' expression ')' '''
3856 print('expr_primary_15', list(p))
3857 # { perm_string tn = perm_string::literal("$acos");
3858 # PECallFunction*tmp = make_call_function(tn, $3);
3859 # FILE_NAME(tmp,@1);
3860 # $$ = tmp;
3861 # }
3862 ()
3863 def p_expr_primary_16(p):
3864 '''expr_primary : K_acosh '(' expression ')' '''
3865 print('expr_primary_16', list(p))
3866 # { perm_string tn = perm_string::literal("$acosh");
3867 # PECallFunction*tmp = make_call_function(tn, $3);
3868 # FILE_NAME(tmp,@1);
3869 # $$ = tmp;
3870 # }
3871 ()
3872 def p_expr_primary_17(p):
3873 '''expr_primary : K_asin '(' expression ')' '''
3874 print('expr_primary_17', list(p))
3875 # { perm_string tn = perm_string::literal("$asin");
3876 # PECallFunction*tmp = make_call_function(tn, $3);
3877 # FILE_NAME(tmp,@1);
3878 # $$ = tmp;
3879 # }
3880 ()
3881 def p_expr_primary_18(p):
3882 '''expr_primary : K_asinh '(' expression ')' '''
3883 print('expr_primary_18', list(p))
3884 # { perm_string tn = perm_string::literal("$asinh");
3885 # PECallFunction*tmp = make_call_function(tn, $3);
3886 # FILE_NAME(tmp,@1);
3887 # $$ = tmp;
3888 # }
3889 ()
3890 def p_expr_primary_19(p):
3891 '''expr_primary : K_atan '(' expression ')' '''
3892 print('expr_primary_19', list(p))
3893 # { perm_string tn = perm_string::literal("$atan");
3894 # PECallFunction*tmp = make_call_function(tn, $3);
3895 # FILE_NAME(tmp,@1);
3896 # $$ = tmp;
3897 # }
3898 ()
3899 def p_expr_primary_20(p):
3900 '''expr_primary : K_atanh '(' expression ')' '''
3901 print('expr_primary_20', list(p))
3902 # { perm_string tn = perm_string::literal("$atanh");
3903 # PECallFunction*tmp = make_call_function(tn, $3);
3904 # FILE_NAME(tmp,@1);
3905 # $$ = tmp;
3906 # }
3907 ()
3908 def p_expr_primary_21(p):
3909 '''expr_primary : K_atan2 '(' expression ',' expression ')' '''
3910 print('expr_primary_21', list(p))
3911 # { perm_string tn = perm_string::literal("$atan2");
3912 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3913 # FILE_NAME(tmp,@1);
3914 # $$ = tmp;
3915 # }
3916 ()
3917 def p_expr_primary_22(p):
3918 '''expr_primary : K_ceil '(' expression ')' '''
3919 print('expr_primary_22', list(p))
3920 # { perm_string tn = perm_string::literal("$ceil");
3921 # PECallFunction*tmp = make_call_function(tn, $3);
3922 # FILE_NAME(tmp,@1);
3923 # $$ = tmp;
3924 # }
3925 ()
3926 def p_expr_primary_23(p):
3927 '''expr_primary : K_cos '(' expression ')' '''
3928 print('expr_primary_23', list(p))
3929 # { perm_string tn = perm_string::literal("$cos");
3930 # PECallFunction*tmp = make_call_function(tn, $3);
3931 # FILE_NAME(tmp,@1);
3932 # $$ = tmp;
3933 # }
3934 ()
3935 def p_expr_primary_24(p):
3936 '''expr_primary : K_cosh '(' expression ')' '''
3937 print('expr_primary_24', list(p))
3938 # { perm_string tn = perm_string::literal("$cosh");
3939 # PECallFunction*tmp = make_call_function(tn, $3);
3940 # FILE_NAME(tmp,@1);
3941 # $$ = tmp;
3942 # }
3943 ()
3944 def p_expr_primary_25(p):
3945 '''expr_primary : K_exp '(' expression ')' '''
3946 print('expr_primary_25', list(p))
3947 # { perm_string tn = perm_string::literal("$exp");
3948 # PECallFunction*tmp = make_call_function(tn, $3);
3949 # FILE_NAME(tmp,@1);
3950 # $$ = tmp;
3951 # }
3952 ()
3953 def p_expr_primary_26(p):
3954 '''expr_primary : K_floor '(' expression ')' '''
3955 print('expr_primary_26', list(p))
3956 # { perm_string tn = perm_string::literal("$floor");
3957 # PECallFunction*tmp = make_call_function(tn, $3);
3958 # FILE_NAME(tmp,@1);
3959 # $$ = tmp;
3960 # }
3961 ()
3962 def p_expr_primary_27(p):
3963 '''expr_primary : K_hypot '(' expression ',' expression ')' '''
3964 print('expr_primary_27', list(p))
3965 # { perm_string tn = perm_string::literal("$hypot");
3966 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3967 # FILE_NAME(tmp,@1);
3968 # $$ = tmp;
3969 # }
3970 ()
3971 def p_expr_primary_28(p):
3972 '''expr_primary : K_ln '(' expression ')' '''
3973 print('expr_primary_28', list(p))
3974 # { perm_string tn = perm_string::literal("$ln");
3975 # PECallFunction*tmp = make_call_function(tn, $3);
3976 # FILE_NAME(tmp,@1);
3977 # $$ = tmp;
3978 # }
3979 ()
3980 def p_expr_primary_29(p):
3981 '''expr_primary : K_log '(' expression ')' '''
3982 print('expr_primary_29', list(p))
3983 # { perm_string tn = perm_string::literal("$log10");
3984 # PECallFunction*tmp = make_call_function(tn, $3);
3985 # FILE_NAME(tmp,@1);
3986 # $$ = tmp;
3987 # }
3988 ()
3989 def p_expr_primary_30(p):
3990 '''expr_primary : K_pow '(' expression ',' expression ')' '''
3991 print('expr_primary_30', list(p))
3992 # { perm_string tn = perm_string::literal("$pow");
3993 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3994 # FILE_NAME(tmp,@1);
3995 # $$ = tmp;
3996 # }
3997 ()
3998 def p_expr_primary_31(p):
3999 '''expr_primary : K_sin '(' expression ')' '''
4000 print('expr_primary_31', list(p))
4001 # { perm_string tn = perm_string::literal("$sin");
4002 # PECallFunction*tmp = make_call_function(tn, $3);
4003 # FILE_NAME(tmp,@1);
4004 # $$ = tmp;
4005 # }
4006 ()
4007 def p_expr_primary_32(p):
4008 '''expr_primary : K_sinh '(' expression ')' '''
4009 print('expr_primary_32', list(p))
4010 # { perm_string tn = perm_string::literal("$sinh");
4011 # PECallFunction*tmp = make_call_function(tn, $3);
4012 # FILE_NAME(tmp,@1);
4013 # $$ = tmp;
4014 # }
4015 ()
4016 def p_expr_primary_33(p):
4017 '''expr_primary : K_sqrt '(' expression ')' '''
4018 print('expr_primary_33', list(p))
4019 # { perm_string tn = perm_string::literal("$sqrt");
4020 # PECallFunction*tmp = make_call_function(tn, $3);
4021 # FILE_NAME(tmp,@1);
4022 # $$ = tmp;
4023 # }
4024 ()
4025 def p_expr_primary_34(p):
4026 '''expr_primary : K_tan '(' expression ')' '''
4027 print('expr_primary_34', list(p))
4028 # { perm_string tn = perm_string::literal("$tan");
4029 # PECallFunction*tmp = make_call_function(tn, $3);
4030 # FILE_NAME(tmp,@1);
4031 # $$ = tmp;
4032 # }
4033 ()
4034 def p_expr_primary_35(p):
4035 '''expr_primary : K_tanh '(' expression ')' '''
4036 print('expr_primary_35', list(p))
4037 # { perm_string tn = perm_string::literal("$tanh");
4038 # PECallFunction*tmp = make_call_function(tn, $3);
4039 # FILE_NAME(tmp,@1);
4040 # $$ = tmp;
4041 # }
4042 ()
4043 def p_expr_primary_36(p):
4044 '''expr_primary : K_abs '(' expression ')' '''
4045 print('expr_primary_36', list(p))
4046 # { PEUnary*tmp = new PEUnary('m', $3);
4047 # FILE_NAME(tmp,@1);
4048 # $$ = tmp;
4049 # }
4050 ()
4051 def p_expr_primary_37(p):
4052 '''expr_primary : K_max '(' expression ',' expression ')' '''
4053 print('expr_primary_37', list(p))
4054 # { PEBinary*tmp = new PEBinary('M', $3, $5);
4055 # FILE_NAME(tmp,@1);
4056 # $$ = tmp;
4057 # }
4058 ()
4059 def p_expr_primary_38(p):
4060 '''expr_primary : K_min '(' expression ',' expression ')' '''
4061 print('expr_primary_38', list(p))
4062 # { PEBinary*tmp = new PEBinary('m', $3, $5);
4063 # FILE_NAME(tmp,@1);
4064 # $$ = tmp;
4065 # }
4066 ()
4067 def p_expr_primary_39(p):
4068 '''expr_primary : '(' expr_mintypmax ')' '''
4069 print('expr_primary_39', list(p))
4070 p[0] = p[2]
4071 ()
4072 def p_expr_primary_40(p):
4073 '''expr_primary : '{' expression_list_proper '}' '''
4074 print('expr_primary_40', list(p))
4075 # { PEConcat*tmp = new PEConcat(*$2);
4076 # FILE_NAME(tmp, @1);
4077 # delete $2;
4078 # $$ = tmp;
4079 # }
4080 ()
4081 def p_expr_primary_41(p):
4082 '''expr_primary : '{' expression '{' expression_list_proper '}' '}' '''
4083 print('expr_primary_41', list(p))
4084 # { PExpr*rep = $2;
4085 # PEConcat*tmp = new PEConcat(*$4, rep);
4086 # FILE_NAME(tmp, @1);
4087 # delete $4;
4088 # $$ = tmp;
4089 # }
4090 ()
4091 def p_expr_primary_42(p):
4092 '''expr_primary : '{' expression '{' expression_list_proper '}' error '}' '''
4093 print('expr_primary_42', list(p))
4094 # { PExpr*rep = $2;
4095 # PEConcat*tmp = new PEConcat(*$4, rep);
4096 # FILE_NAME(tmp, @1);
4097 # delete $4;
4098 # $$ = tmp;
4099 # yyerror(@5, "error: Syntax error between internal '}' "
4100 # "and closing '}' of repeat concatenation.");
4101 # yyerrok;
4102 # }
4103 ()
4104 def p_expr_primary_43(p):
4105 '''expr_primary : '{' '}' '''
4106 print('expr_primary_43', list(p))
4107 # { // This is the empty queue syntax.
4108 # if (gn_system_verilog()) {
4109 # list<PExpr*> empty_list;
4110 # PEConcat*tmp = new PEConcat(empty_list);
4111 # FILE_NAME(tmp, @1);
4112 # $$ = tmp;
4113 # } else {
4114 # yyerror(@1, "error: Concatenations are not allowed to be empty.");
4115 # $$ = 0;
4116 # }
4117 # }
4118 ()
4119 def p_expr_primary_44(p):
4120 '''expr_primary : expr_primary "'" '(' expression ')' '''
4121 print('expr_primary_44', list(p))
4122 # { PExpr*base = $4;
4123 # if (gn_system_verilog()) {
4124 # PECastSize*tmp = new PECastSize($1, base);
4125 # FILE_NAME(tmp, @1);
4126 # $$ = tmp;
4127 # } else {
4128 # yyerror(@1, "error: Size cast requires SystemVerilog.");
4129 # $$ = base;
4130 # }
4131 # }
4132 ()
4133 def p_expr_primary_45(p):
4134 '''expr_primary : simple_type_or_string "'" '(' expression ')' '''
4135 print('expr_primary_45', list(p))
4136 # { PExpr*base = $4;
4137 # if (gn_system_verilog()) {
4138 # PECastType*tmp = new PECastType($1, base);
4139 # FILE_NAME(tmp, @1);
4140 # $$ = tmp;
4141 # } else {
4142 # yyerror(@1, "error: Type cast requires SystemVerilog.");
4143 # $$ = base;
4144 # }
4145 # }
4146 ()
4147 def p_expr_primary_46(p):
4148 '''expr_primary : assignment_pattern '''
4149 print('expr_primary_46', list(p))
4150 p[0] = p[1]
4151 ()
4152 def p_expr_primary_47(p):
4153 '''expr_primary : streaming_concatenation '''
4154 print('expr_primary_47', list(p))
4155 p[0] = p[1]
4156 ()
4157 def p_expr_primary_48(p):
4158 '''expr_primary : K_null '''
4159 print('expr_primary_48', list(p))
4160 # { PENull*tmp = new PENull;
4161 # FILE_NAME(tmp, @1);
4162 # $$ = tmp;
4163 # }
4164 ()
4165 def p_function_item_list_opt_1(p):
4166 '''function_item_list_opt : function_item_list '''
4167 print('function_item_list_opt_1', list(p))
4168 p[0] = p[1]
4169 ()
4170 def p_function_item_list_opt_2(p):
4171 '''function_item_list_opt : '''
4172 print('function_item_list_opt_2', list(p))
4173 # { $$ = 0; }
4174 ()
4175 def p_function_item_list_1(p):
4176 '''function_item_list : function_item '''
4177 print('function_item_list_1', list(p))
4178 p[0] = p[1]
4179 ()
4180 def p_function_item_list_2(p):
4181 '''function_item_list : function_item_list function_item '''
4182 print('function_item_list_2', list(p))
4183 # { /* */
4184 # if ($1 && $2) {
4185 # vector<pform_tf_port_t>*tmp = $1;
4186 # size_t s1 = tmp->size();
4187 # tmp->resize(s1 + $2->size());
4188 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
4189 # tmp->at(s1+idx) = $2->at(idx);
4190 # delete $2;
4191 # $$ = tmp;
4192 # } else if ($1) {
4193 # $$ = $1;
4194 # } else {
4195 # $$ = $2;
4196 # }
4197 # }
4198 ()
4199 def p_function_item_1(p):
4200 '''function_item : tf_port_declaration '''
4201 print('function_item_1', list(p))
4202 p[0] = p[1]
4203 ()
4204 def p_function_item_2(p):
4205 '''function_item : block_item_decl '''
4206 print('function_item_2', list(p))
4207 # { $$ = 0; }
4208 ()
4209 def p_gate_instance_1(p):
4210 '''gate_instance : IDENTIFIER '(' expression_list_with_nuls ')' '''
4211 print('gate_instance_1', list(p))
4212 # { lgate*tmp = new lgate;
4213 # tmp->name = $1;
4214 # tmp->parms = $3;
4215 # tmp->file = @1.text;
4216 # tmp->lineno = @1.first_line;
4217 # delete[]$1;
4218 # $$ = tmp;
4219 # }
4220 ()
4221 def p_gate_instance_2(p):
4222 '''gate_instance : IDENTIFIER dimensions '(' expression_list_with_nuls ')' '''
4223 print('gate_instance_2', list(p))
4224 # { lgate*tmp = new lgate;
4225 # list<pform_range_t>*rng = $2;
4226 # tmp->name = $1;
4227 # tmp->parms = $4;
4228 # tmp->range = rng->front();
4229 # rng->pop_front();
4230 # assert(rng->empty());
4231 # tmp->file = @1.text;
4232 # tmp->lineno = @1.first_line;
4233 # delete[]$1;
4234 # delete rng;
4235 # $$ = tmp;
4236 # }
4237 ()
4238 def p_gate_instance_3(p):
4239 '''gate_instance : '(' expression_list_with_nuls ')' '''
4240 print('gate_instance_3', list(p))
4241 # { lgate*tmp = new lgate;
4242 # tmp->name = "";
4243 # tmp->parms = $2;
4244 # tmp->file = @1.text;
4245 # tmp->lineno = @1.first_line;
4246 # $$ = tmp;
4247 # }
4248 ()
4249 def p_gate_instance_4(p):
4250 '''gate_instance : IDENTIFIER dimensions '''
4251 print('gate_instance_4', list(p))
4252 # { lgate*tmp = new lgate;
4253 # list<pform_range_t>*rng = $2;
4254 # tmp->name = $1;
4255 # tmp->parms = 0;
4256 # tmp->parms_by_name = 0;
4257 # tmp->range = rng->front();
4258 # rng->pop_front();
4259 # assert(rng->empty());
4260 # tmp->file = @1.text;
4261 # tmp->lineno = @1.first_line;
4262 # delete[]$1;
4263 # delete rng;
4264 # $$ = tmp;
4265 # }
4266 ()
4267 def p_gate_instance_5(p):
4268 '''gate_instance : IDENTIFIER '(' port_name_list ')' '''
4269 print('gate_instance_5', list(p))
4270 # { lgate*tmp = new lgate;
4271 # tmp->name = $1;
4272 # tmp->parms = 0;
4273 # tmp->parms_by_name = $3;
4274 # tmp->file = @1.text;
4275 # tmp->lineno = @1.first_line;
4276 # delete[]$1;
4277 # $$ = tmp;
4278 # }
4279 ()
4280 def p_gate_instance_6(p):
4281 '''gate_instance : IDENTIFIER dimensions '(' port_name_list ')' '''
4282 print('gate_instance_6', list(p))
4283 # { lgate*tmp = new lgate;
4284 # list<pform_range_t>*rng = $2;
4285 # tmp->name = $1;
4286 # tmp->parms = 0;
4287 # tmp->parms_by_name = $4;
4288 # tmp->range = rng->front();
4289 # rng->pop_front();
4290 # assert(rng->empty());
4291 # tmp->file = @1.text;
4292 # tmp->lineno = @1.first_line;
4293 # delete[]$1;
4294 # delete rng;
4295 # $$ = tmp;
4296 # }
4297 ()
4298 def p_gate_instance_7(p):
4299 '''gate_instance : IDENTIFIER '(' error ')' '''
4300 print('gate_instance_7', list(p))
4301 # { lgate*tmp = new lgate;
4302 # tmp->name = $1;
4303 # tmp->parms = 0;
4304 # tmp->parms_by_name = 0;
4305 # tmp->file = @1.text;
4306 # tmp->lineno = @1.first_line;
4307 # yyerror(@2, "error: Syntax error in instance port "
4308 # "expression(s).");
4309 # delete[]$1;
4310 # $$ = tmp;
4311 # }
4312 ()
4313 def p_gate_instance_8(p):
4314 '''gate_instance : IDENTIFIER dimensions '(' error ')' '''
4315 print('gate_instance_8', list(p))
4316 # { lgate*tmp = new lgate;
4317 # tmp->name = $1;
4318 # tmp->parms = 0;
4319 # tmp->parms_by_name = 0;
4320 # tmp->file = @1.text;
4321 # tmp->lineno = @1.first_line;
4322 # yyerror(@3, "error: Syntax error in instance port "
4323 # "expression(s).");
4324 # delete[]$1;
4325 # $$ = tmp;
4326 # }
4327 ()
4328 def p_gate_instance_list_1(p):
4329 '''gate_instance_list : gate_instance_list ',' gate_instance '''
4330 print('gate_instance_list_1', list(p))
4331 # { svector<lgate>*tmp1 = $1;
4332 # lgate*tmp2 = $3;
4333 # svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
4334 # delete tmp1;
4335 # delete tmp2;
4336 # $$ = out;
4337 # }
4338 ()
4339 def p_gate_instance_list_2(p):
4340 '''gate_instance_list : gate_instance '''
4341 print('gate_instance_list_2', list(p))
4342 # { svector<lgate>*tmp = new svector<lgate>(1);
4343 # (*tmp)[0] = *$1;
4344 # delete $1;
4345 # $$ = tmp;
4346 # }
4347 ()
4348 def p_gatetype_1(p):
4349 '''gatetype : K_and '''
4350 print('gatetype_1', list(p))
4351 # { $$ = PGBuiltin::AND; }
4352 ()
4353 def p_gatetype_2(p):
4354 '''gatetype : K_nand '''
4355 print('gatetype_2', list(p))
4356 # { $$ = PGBuiltin::NAND; }
4357 ()
4358 def p_gatetype_3(p):
4359 '''gatetype : K_or '''
4360 print('gatetype_3', list(p))
4361 # { $$ = PGBuiltin::OR; }
4362 ()
4363 def p_gatetype_4(p):
4364 '''gatetype : K_nor '''
4365 print('gatetype_4', list(p))
4366 # { $$ = PGBuiltin::NOR; }
4367 ()
4368 def p_gatetype_5(p):
4369 '''gatetype : K_xor '''
4370 print('gatetype_5', list(p))
4371 # { $$ = PGBuiltin::XOR; }
4372 ()
4373 def p_gatetype_6(p):
4374 '''gatetype : K_xnor '''
4375 print('gatetype_6', list(p))
4376 # { $$ = PGBuiltin::XNOR; }
4377 ()
4378 def p_gatetype_7(p):
4379 '''gatetype : K_buf '''
4380 print('gatetype_7', list(p))
4381 # { $$ = PGBuiltin::BUF; }
4382 ()
4383 def p_gatetype_8(p):
4384 '''gatetype : K_bufif0 '''
4385 print('gatetype_8', list(p))
4386 # { $$ = PGBuiltin::BUFIF0; }
4387 ()
4388 def p_gatetype_9(p):
4389 '''gatetype : K_bufif1 '''
4390 print('gatetype_9', list(p))
4391 # { $$ = PGBuiltin::BUFIF1; }
4392 ()
4393 def p_gatetype_10(p):
4394 '''gatetype : K_not '''
4395 print('gatetype_10', list(p))
4396 # { $$ = PGBuiltin::NOT; }
4397 ()
4398 def p_gatetype_11(p):
4399 '''gatetype : K_notif0 '''
4400 print('gatetype_11', list(p))
4401 # { $$ = PGBuiltin::NOTIF0; }
4402 ()
4403 def p_gatetype_12(p):
4404 '''gatetype : K_notif1 '''
4405 print('gatetype_12', list(p))
4406 # { $$ = PGBuiltin::NOTIF1; }
4407 ()
4408 def p_switchtype_1(p):
4409 '''switchtype : K_nmos '''
4410 print('switchtype_1', list(p))
4411 # { $$ = PGBuiltin::NMOS; }
4412 ()
4413 def p_switchtype_2(p):
4414 '''switchtype : K_rnmos '''
4415 print('switchtype_2', list(p))
4416 # { $$ = PGBuiltin::RNMOS; }
4417 ()
4418 def p_switchtype_3(p):
4419 '''switchtype : K_pmos '''
4420 print('switchtype_3', list(p))
4421 # { $$ = PGBuiltin::PMOS; }
4422 ()
4423 def p_switchtype_4(p):
4424 '''switchtype : K_rpmos '''
4425 print('switchtype_4', list(p))
4426 # { $$ = PGBuiltin::RPMOS; }
4427 ()
4428 def p_switchtype_5(p):
4429 '''switchtype : K_cmos '''
4430 print('switchtype_5', list(p))
4431 # { $$ = PGBuiltin::CMOS; }
4432 ()
4433 def p_switchtype_6(p):
4434 '''switchtype : K_rcmos '''
4435 print('switchtype_6', list(p))
4436 # { $$ = PGBuiltin::RCMOS; }
4437 ()
4438 def p_switchtype_7(p):
4439 '''switchtype : K_tran '''
4440 print('switchtype_7', list(p))
4441 # { $$ = PGBuiltin::TRAN; }
4442 ()
4443 def p_switchtype_8(p):
4444 '''switchtype : K_rtran '''
4445 print('switchtype_8', list(p))
4446 # { $$ = PGBuiltin::RTRAN; }
4447 ()
4448 def p_switchtype_9(p):
4449 '''switchtype : K_tranif0 '''
4450 print('switchtype_9', list(p))
4451 # { $$ = PGBuiltin::TRANIF0; }
4452 ()
4453 def p_switchtype_10(p):
4454 '''switchtype : K_tranif1 '''
4455 print('switchtype_10', list(p))
4456 # { $$ = PGBuiltin::TRANIF1; }
4457 ()
4458 def p_switchtype_11(p):
4459 '''switchtype : K_rtranif0 '''
4460 print('switchtype_11', list(p))
4461 # { $$ = PGBuiltin::RTRANIF0; }
4462 ()
4463 def p_switchtype_12(p):
4464 '''switchtype : K_rtranif1 '''
4465 print('switchtype_12', list(p))
4466 # { $$ = PGBuiltin::RTRANIF1; }
4467 ()
4468 def p_hierarchy_identifier_1(p):
4469 '''hierarchy_identifier : IDENTIFIER '''
4470 print('hierarchy_identifier_1', list(p))
4471 lpvalue = Leaf(token.NAME, p[1])
4472 p[0] = lpvalue
4473 # { $$ = new pform_name_t;
4474 # $$->push_back(name_component_t(lex_strings.make($1)));
4475 # delete[]$1;
4476 # }
4477 ()
4478 def p_hierarchy_identifier_2(p):
4479 '''hierarchy_identifier : hierarchy_identifier '.' IDENTIFIER '''
4480 print('hierarchy_identifier_2', list(p))
4481 # { pform_name_t * tmp = $1;
4482 # tmp->push_back(name_component_t(lex_strings.make($3)));
4483 # delete[]$3;
4484 # $$ = tmp;
4485 # }
4486 ()
4487 def p_hierarchy_identifier_3(p):
4488 '''hierarchy_identifier : hierarchy_identifier '[' expression ']' '''
4489 print('hierarchy_identifier_3', list(p))
4490 # { pform_name_t * tmp = $1;
4491 # name_component_t&tail = tmp->back();
4492 # index_component_t itmp;
4493 # itmp.sel = index_component_t::SEL_BIT;
4494 # itmp.msb = $3;
4495 # tail.index.push_back(itmp);
4496 # $$ = tmp;
4497 # }
4498 ()
4499 def p_hierarchy_identifier_4(p):
4500 '''hierarchy_identifier : hierarchy_identifier '[' '$' ']' '''
4501 print('hierarchy_identifier_4', list(p))
4502 # { pform_name_t * tmp = $1;
4503 # name_component_t&tail = tmp->back();
4504 # if (! gn_system_verilog()) {
4505 # yyerror(@3, "error: Last element expression ($) "
4506 # "requires SystemVerilog. Try enabling SystemVerilog.");
4507 # }
4508 # index_component_t itmp;
4509 # itmp.sel = index_component_t::SEL_BIT_LAST;
4510 # itmp.msb = 0;
4511 # itmp.lsb = 0;
4512 # tail.index.push_back(itmp);
4513 # $$ = tmp;
4514 # }
4515 ()
4516 def p_hierarchy_identifier_5(p):
4517 '''hierarchy_identifier : hierarchy_identifier '[' expression ':' expression ']' '''
4518 print('hierarchy_identifier_5', list(p))
4519 # { pform_name_t * tmp = $1;
4520 # name_component_t&tail = tmp->back();
4521 # index_component_t itmp;
4522 # itmp.sel = index_component_t::SEL_PART;
4523 # itmp.msb = $3;
4524 # itmp.lsb = $5;
4525 # tail.index.push_back(itmp);
4526 # $$ = tmp;
4527 # }
4528 ()
4529 def p_hierarchy_identifier_6(p):
4530 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_POS expression ']' '''
4531 print('hierarchy_identifier_6', list(p))
4532 # { pform_name_t * tmp = $1;
4533 # name_component_t&tail = tmp->back();
4534 # index_component_t itmp;
4535 # itmp.sel = index_component_t::SEL_IDX_UP;
4536 # itmp.msb = $3;
4537 # itmp.lsb = $5;
4538 # tail.index.push_back(itmp);
4539 # $$ = tmp;
4540 # }
4541 ()
4542 def p_hierarchy_identifier_7(p):
4543 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_NEG expression ']' '''
4544 print('hierarchy_identifier_7', list(p))
4545 # { pform_name_t * tmp = $1;
4546 # name_component_t&tail = tmp->back();
4547 # index_component_t itmp;
4548 # itmp.sel = index_component_t::SEL_IDX_DO;
4549 # itmp.msb = $3;
4550 # itmp.lsb = $5;
4551 # tail.index.push_back(itmp);
4552 # $$ = tmp;
4553 # }
4554 ()
4555 def p_list_of_identifiers_1(p):
4556 '''list_of_identifiers : IDENTIFIER '''
4557 print('list_of_identifiers_1', list(p))
4558 # { $$ = list_from_identifier($1); }
4559 ()
4560 def p_list_of_identifiers_2(p):
4561 '''list_of_identifiers : list_of_identifiers ',' IDENTIFIER '''
4562 print('list_of_identifiers_2', list(p))
4563 # { $$ = list_from_identifier($1, $3); }
4564 ()
4565 def p_list_of_port_identifiers_1(p):
4566 '''list_of_port_identifiers : IDENTIFIER dimensions_opt '''
4567 print('list_of_port_identifiers_1', list(p))
4568 # { $$ = make_port_list($1, $2, 0); }
4569 ()
4570 def p_list_of_port_identifiers_2(p):
4571 '''list_of_port_identifiers : list_of_port_identifiers ',' IDENTIFIER dimensions_opt '''
4572 print('list_of_port_identifiers_2', list(p))
4573 # { $$ = make_port_list($1, $3, $4, 0); }
4574 ()
4575 def p_list_of_variable_port_identifiers_1(p):
4576 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '''
4577 print('list_of_variable_port_identifiers_1', list(p))
4578 # { $$ = make_port_list($1, $2, 0); }
4579 ()
4580 def p_list_of_variable_port_identifiers_2(p):
4581 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '=' expression '''
4582 print('list_of_variable_port_identifiers_2', list(p))
4583 # { $$ = make_port_list($1, $2, $4); }
4584 ()
4585 def p_list_of_variable_port_identifiers_3(p):
4586 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '''
4587 print('list_of_variable_port_identifiers_3', list(p))
4588 # { $$ = make_port_list($1, $3, $4, 0); }
4589 ()
4590 def p_list_of_variable_port_identifiers_4(p):
4591 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '=' expression '''
4592 print('list_of_variable_port_identifiers_4', list(p))
4593 # { $$ = make_port_list($1, $3, $4, $6); }
4594 ()
4595 def p_list_of_ports_1(p):
4596 '''list_of_ports : port_opt '''
4597 print('list_of_ports_1', list(p))
4598 # { vector<Module::port_t*>*tmp
4599 # = new vector<Module::port_t*>(1);
4600 # (*tmp)[0] = $1;
4601 # $$ = tmp;
4602 # }
4603 ()
4604 def p_list_of_ports_2(p):
4605 '''list_of_ports : list_of_ports ',' port_opt '''
4606 print('list_of_ports_2', list(p))
4607 # { vector<Module::port_t*>*tmp = $1;
4608 # tmp->push_back($3);
4609 # $$ = tmp;
4610 # }
4611 ()
4612 def p_list_of_port_declarations_1(p):
4613 '''list_of_port_declarations : port_declaration '''
4614 print('list_of_port_declarations_1', list(p))
4615 # { vector<Module::port_t*>*tmp
4616 # = new vector<Module::port_t*>(1);
4617 # (*tmp)[0] = $1;
4618 # $$ = tmp;
4619 # }
4620 ()
4621 def p_list_of_port_declarations_2(p):
4622 '''list_of_port_declarations : list_of_port_declarations ',' port_declaration '''
4623 print('list_of_port_declarations_2', list(p))
4624 # { vector<Module::port_t*>*tmp = $1;
4625 # tmp->push_back($3);
4626 # $$ = tmp;
4627 # }
4628 ()
4629 def p_list_of_port_declarations_3(p):
4630 '''list_of_port_declarations : list_of_port_declarations ',' IDENTIFIER '''
4631 print('list_of_port_declarations_3', list(p))
4632 # { Module::port_t*ptmp;
4633 # perm_string name = lex_strings.make($3);
4634 # ptmp = pform_module_port_reference(name, @3.text,
4635 # @3.first_line);
4636 # vector<Module::port_t*>*tmp = $1;
4637 # tmp->push_back(ptmp);
4638 #
4639 # /* Get the port declaration details, the port type
4640 # and what not, from context data stored by the
4641 # last port_declaration rule. */
4642 # pform_module_define_port(@3, name,
4643 # port_declaration_context.port_type,
4644 # port_declaration_context.port_net_type,
4645 # port_declaration_context.data_type, 0);
4646 # delete[]$3;
4647 # $$ = tmp;
4648 # }
4649 ()
4650 def p_list_of_port_declarations_4(p):
4651 '''list_of_port_declarations : list_of_port_declarations ',' '''
4652 print('list_of_port_declarations_4', list(p))
4653 # {
4654 # yyerror(@2, "error: NULL port declarations are not "
4655 # "allowed.");
4656 # }
4657 ()
4658 def p_list_of_port_declarations_5(p):
4659 '''list_of_port_declarations : list_of_port_declarations ';' '''
4660 print('list_of_port_declarations_5', list(p))
4661 # {
4662 # yyerror(@2, "error: ';' is an invalid port declaration "
4663 # "separator.");
4664 # }
4665 ()
4666 def p_port_declaration_1(p):
4667 '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4668 print('port_declaration_1', list(p))
4669 # { Module::port_t*ptmp;
4670 # perm_string name = lex_strings.make($5);
4671 # data_type_t*use_type = $4;
4672 # if ($6) use_type = new uarray_type_t(use_type, $6);
4673 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4674 # pform_module_define_port(@2, name, NetNet::PINPUT, $3, use_type, $1);
4675 # port_declaration_context.port_type = NetNet::PINPUT;
4676 # port_declaration_context.port_net_type = $3;
4677 # port_declaration_context.data_type = $4;
4678 # delete[]$5;
4679 # $$ = ptmp;
4680 # }
4681 ()
4682 def p_port_declaration_2(p):
4683 '''port_declaration : attribute_list_opt K_input K_wreal IDENTIFIER '''
4684 print('port_declaration_2', list(p))
4685 # { Module::port_t*ptmp;
4686 # perm_string name = lex_strings.make($4);
4687 # ptmp = pform_module_port_reference(name, @2.text,
4688 # @2.first_line);
4689 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4690 # FILE_NAME(real_type, @3);
4691 # pform_module_define_port(@2, name, NetNet::PINPUT,
4692 # NetNet::WIRE, real_type, $1);
4693 # port_declaration_context.port_type = NetNet::PINPUT;
4694 # port_declaration_context.port_net_type = NetNet::WIRE;
4695 # port_declaration_context.data_type = real_type;
4696 # delete[]$4;
4697 # $$ = ptmp;
4698 # }
4699 ()
4700 def p_port_declaration_3(p):
4701 '''port_declaration : attribute_list_opt K_inout net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4702 print('port_declaration_3', list(p))
4703 # { Module::port_t*ptmp;
4704 # perm_string name = lex_strings.make($5);
4705 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4706 # pform_module_define_port(@2, name, NetNet::PINOUT, $3, $4, $1);
4707 # port_declaration_context.port_type = NetNet::PINOUT;
4708 # port_declaration_context.port_net_type = $3;
4709 # port_declaration_context.data_type = $4;
4710 # delete[]$5;
4711 # if ($6) {
4712 # yyerror(@6, "sorry: Inout ports with unpacked dimensions not supported.");
4713 # delete $6;
4714 # }
4715 # $$ = ptmp;
4716 # }
4717 ()
4718 def p_port_declaration_4(p):
4719 '''port_declaration : attribute_list_opt K_inout K_wreal IDENTIFIER '''
4720 print('port_declaration_4', list(p))
4721 # { Module::port_t*ptmp;
4722 # perm_string name = lex_strings.make($4);
4723 # ptmp = pform_module_port_reference(name, @2.text,
4724 # @2.first_line);
4725 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4726 # FILE_NAME(real_type, @3);
4727 # pform_module_define_port(@2, name, NetNet::PINOUT,
4728 # NetNet::WIRE, real_type, $1);
4729 # port_declaration_context.port_type = NetNet::PINOUT;
4730 # port_declaration_context.port_net_type = NetNet::WIRE;
4731 # port_declaration_context.data_type = real_type;
4732 # delete[]$4;
4733 # $$ = ptmp;
4734 # }
4735 ()
4736 def p_port_declaration_5(p):
4737 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4738 print('port_declaration_5', list(p))
4739 # { Module::port_t*ptmp;
4740 # perm_string name = lex_strings.make($5);
4741 # data_type_t*use_dtype = $4;
4742 # if ($6) use_dtype = new uarray_type_t(use_dtype, $6);
4743 # NetNet::Type use_type = $3;
4744 # if (use_type == NetNet::IMPLICIT) {
4745 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($4)) {
4746 # if (dtype->reg_flag)
4747 # use_type = NetNet::REG;
4748 # else if (dtype->implicit_flag)
4749 # use_type = NetNet::IMPLICIT;
4750 # else
4751 # use_type = NetNet::IMPLICIT_REG;
4752 #
4753 # // The SystemVerilog types that can show up as
4754 # // output ports are implicitly (on the inside)
4755 # // variables because "reg" is not valid syntax
4756 # // here.
4757 # } else if (dynamic_cast<atom2_type_t*> ($4)) {
4758 # use_type = NetNet::IMPLICIT_REG;
4759 # } else if (dynamic_cast<struct_type_t*> ($4)) {
4760 # use_type = NetNet::IMPLICIT_REG;
4761 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> ($4)) {
4762 # if(etype->base_type == IVL_VT_LOGIC)
4763 # use_type = NetNet::IMPLICIT_REG;
4764 # }
4765 # }
4766 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4767 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, use_dtype, $1);
4768 # port_declaration_context.port_type = NetNet::POUTPUT;
4769 # port_declaration_context.port_net_type = use_type;
4770 # port_declaration_context.data_type = $4;
4771 # delete[]$5;
4772 # $$ = ptmp;
4773 # }
4774 ()
4775 def p_port_declaration_6(p):
4776 '''port_declaration : attribute_list_opt K_output K_wreal IDENTIFIER '''
4777 print('port_declaration_6', list(p))
4778 # { Module::port_t*ptmp;
4779 # perm_string name = lex_strings.make($4);
4780 # ptmp = pform_module_port_reference(name, @2.text,
4781 # @2.first_line);
4782 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4783 # FILE_NAME(real_type, @3);
4784 # pform_module_define_port(@2, name, NetNet::POUTPUT,
4785 # NetNet::WIRE, real_type, $1);
4786 # port_declaration_context.port_type = NetNet::POUTPUT;
4787 # port_declaration_context.port_net_type = NetNet::WIRE;
4788 # port_declaration_context.data_type = real_type;
4789 # delete[]$4;
4790 # $$ = ptmp;
4791 # }
4792 ()
4793 def p_port_declaration_7(p):
4794 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER '=' expression '''
4795 print('port_declaration_7', list(p))
4796 # { Module::port_t*ptmp;
4797 # perm_string name = lex_strings.make($5);
4798 # NetNet::Type use_type = $3;
4799 # if (use_type == NetNet::IMPLICIT) {
4800 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($4)) {
4801 # if (dtype->reg_flag)
4802 # use_type = NetNet::REG;
4803 # else
4804 # use_type = NetNet::IMPLICIT_REG;
4805 # } else {
4806 # use_type = NetNet::IMPLICIT_REG;
4807 # }
4808 # }
4809 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4810 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, $4, $1);
4811 # port_declaration_context.port_type = NetNet::PINOUT;
4812 # port_declaration_context.port_net_type = use_type;
4813 # port_declaration_context.data_type = $4;
4814 #
4815 # pform_make_var_init(@5, name, $7);
4816 #
4817 # delete[]$5;
4818 # $$ = ptmp;
4819 # }
4820 ()
4821 def p_net_type_opt_1(p):
4822 '''net_type_opt : net_type '''
4823 print('net_type_opt_1', list(p))
4824 p[0] = p[1]
4825 ()
4826 def p_net_type_opt_2(p):
4827 '''net_type_opt : '''
4828 print('net_type_opt_2', list(p))
4829 # { $$ = NetNet::IMPLICIT; }
4830 ()
4831 def p_unsigned_signed_opt_1(p):
4832 '''unsigned_signed_opt : K_signed '''
4833 print('unsigned_signed_opt_1', list(p))
4834 # { $$ = true; }
4835 ()
4836 def p_unsigned_signed_opt_2(p):
4837 '''unsigned_signed_opt : K_unsigned '''
4838 print('unsigned_signed_opt_2', list(p))
4839 # { $$ = false; }
4840 ()
4841 def p_unsigned_signed_opt_3(p):
4842 '''unsigned_signed_opt : '''
4843 print('unsigned_signed_opt_3', list(p))
4844 # { $$ = false; }
4845 ()
4846 def p_signed_unsigned_opt_1(p):
4847 '''signed_unsigned_opt : K_signed '''
4848 print('signed_unsigned_opt_1', list(p))
4849 # { $$ = true; }
4850 ()
4851 def p_signed_unsigned_opt_2(p):
4852 '''signed_unsigned_opt : K_unsigned '''
4853 print('signed_unsigned_opt_2', list(p))
4854 # { $$ = false; }
4855 ()
4856 def p_signed_unsigned_opt_3(p):
4857 '''signed_unsigned_opt : '''
4858 print('signed_unsigned_opt_3', list(p))
4859 # { $$ = true; }
4860 ()
4861 def p_atom2_type_1(p):
4862 '''atom2_type : K_byte '''
4863 print('atom2_type_1', list(p))
4864 # { $$ = 8; }
4865 ()
4866 def p_atom2_type_2(p):
4867 '''atom2_type : K_shortint '''
4868 print('atom2_type_2', list(p))
4869 # { $$ = 16; }
4870 ()
4871 def p_atom2_type_3(p):
4872 '''atom2_type : K_int '''
4873 print('atom2_type_3', list(p))
4874 # { $$ = 32; }
4875 ()
4876 def p_atom2_type_4(p):
4877 '''atom2_type : K_longint '''
4878 print('atom2_type_4', list(p))
4879 # { $$ = 64; }
4880 ()
4881 def p_lpvalue_1(p):
4882 '''lpvalue : hierarchy_identifier '''
4883 print('lpvalue_1', list(p))
4884 p[0] = p[1]
4885 # { PEIdent*tmp = pform_new_ident(*$1);
4886 # FILE_NAME(tmp, @1);
4887 # $$ = tmp;
4888 # delete $1;
4889 # }
4890 ()
4891 def p_lpvalue_2(p):
4892 '''lpvalue : implicit_class_handle '.' hierarchy_identifier '''
4893 print('lpvalue_2', list(p))
4894 # { pform_name_t*t_name = $1;
4895 # while (!$3->empty()) {
4896 # t_name->push_back($3->front());
4897 # $3->pop_front();
4898 # }
4899 # PEIdent*tmp = new PEIdent(*t_name);
4900 # FILE_NAME(tmp, @1);
4901 # $$ = tmp;
4902 # delete $1;
4903 # delete $3;
4904 # }
4905 ()
4906 def p_lpvalue_3(p):
4907 '''lpvalue : '{' expression_list_proper '}' '''
4908 print('lpvalue_3', list(p))
4909 # { PEConcat*tmp = new PEConcat(*$2);
4910 # FILE_NAME(tmp, @1);
4911 # delete $2;
4912 # $$ = tmp;
4913 # }
4914 ()
4915 def p_lpvalue_4(p):
4916 '''lpvalue : streaming_concatenation '''
4917 print('lpvalue_4', list(p))
4918 # { yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
4919 # $$ = 0;
4920 # }
4921 ()
4922 def p_cont_assign_1(p):
4923 '''cont_assign : lpvalue '=' expression '''
4924 print('cont_assign_1', list(p))
4925 # { list<PExpr*>*tmp = new list<PExpr*>;
4926 # tmp->push_back($1);
4927 # tmp->push_back($3);
4928 # $$ = tmp;
4929 # }
4930 ()
4931 def p_cont_assign_list_1(p):
4932 '''cont_assign_list : cont_assign_list ',' cont_assign '''
4933 print('cont_assign_list_1', list(p))
4934 # { list<PExpr*>*tmp = $1;
4935 # tmp->splice(tmp->end(), *$3);
4936 # delete $3;
4937 # $$ = tmp;
4938 # }
4939 ()
4940 def p_cont_assign_list_2(p):
4941 '''cont_assign_list : cont_assign '''
4942 print('cont_assign_list_2', list(p))
4943 p[0] = p[1]
4944 ()
4945 def p_module_1(p):
4946 '''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 '''
4947 print('module_1', list(p))
4948 clsname = [Leaf(token.NAME, 'class'),
4949 Leaf(token.NAME, p[4], prefix=' '),
4950 Leaf(token.COLON, ':')]
4951 stmt = Node(syms.pass_stmt, [Leaf(token.NAME, "pass"),])
4952 stmts = Node(syms.small_stmt, [stmt, Leaf(token.NEWLINE, '\n')])
4953 stmts = Node(syms.stmt, [stmts])
4954 suite = Node(syms.suite, [Leaf(token.NEWLINE, '\n'),
4955 Leaf(token.INDENT, ' '),
4956 stmts,
4957 Leaf(token.DEDENT, '')
4958 ])
4959 clsdecl = Node(syms.classdef, clsname + [suite],
4960 prefix='', fixers_applied=[])
4961 clsdecl = Node(syms.compound_stmt, [clsdecl])
4962 print ("clsdecl", repr(clsdecl))
4963 print ("clsstr:")
4964 print (str(clsdecl))
4965 p[0] = clsdecl
4966 # { // Last step: check any closing name. This is done late so
4967 # // that the parser can look ahead to detect the present
4968 # // endlabel_opt but still have the pform_endmodule() called
4969 # // early enough that the lexor can know we are outside the
4970 # // module.
4971 # if ($17) {
4972 # if (strcmp($4,$17) != 0) {
4973 # switch ($2) {
4974 # case K_module:
4975 # yyerror(@17, "error: End label doesn't match "
4976 # "module name.");
4977 # break;
4978 # case K_program:
4979 # yyerror(@17, "error: End label doesn't match "
4980 # "program name.");
4981 # break;
4982 # case K_interface:
4983 # yyerror(@17, "error: End label doesn't match "
4984 # "interface name.");
4985 # break;
4986 # default:
4987 # break;
4988 # }
4989 # }
4990 # if (($2 == K_module) && (! gn_system_verilog())) {
4991 # yyerror(@8, "error: Module end labels require "
4992 # "SystemVerilog.");
4993 # }
4994 # delete[]$17;
4995 # }
4996 # delete[]$4;
4997 # }
4998 ()
4999 def p__embed0_module(p):
5000 '''_embed0_module : '''
5001 # { pform_startmodule(@2, $4, $2==K_program, $2==K_interface, $3, $1); }
5002 ()
5003 def p__embed1_module(p):
5004 '''_embed1_module : '''
5005 # { pform_module_set_ports($8); }
5006 ()
5007 def p__embed2_module(p):
5008 '''_embed2_module : '''
5009 # { pform_set_scope_timescale(@2); }
5010 ()
5011 def p__embed3_module(p):
5012 '''_embed3_module : '''
5013 # { Module::UCDriveType ucd;
5014 # // The lexor detected `unconnected_drive directives and
5015 # // marked what it found in the uc_drive variable. Use that
5016 # // to generate a UCD flag for the module.
5017 # switch (uc_drive) {
5018 # case UCD_NONE:
5019 # default:
5020 # ucd = Module::UCD_NONE;
5021 # break;
5022 # case UCD_PULL0:
5023 # ucd = Module::UCD_PULL0;
5024 # break;
5025 # case UCD_PULL1:
5026 # ucd = Module::UCD_PULL1;
5027 # break;
5028 # }
5029 # // Check that program/endprogram and module/endmodule
5030 # // keywords match.
5031 # if ($2 != $15) {
5032 # switch ($2) {
5033 # case K_module:
5034 # yyerror(@15, "error: module not closed by endmodule.");
5035 # break;
5036 # case K_program:
5037 # yyerror(@15, "error: program not closed by endprogram.");
5038 # break;
5039 # case K_interface:
5040 # yyerror(@15, "error: interface not closed by endinterface.");
5041 # break;
5042 # default:
5043 # break;
5044 # }
5045 # }
5046 # pform_endmodule($4, in_celldefine, ucd);
5047 # }
5048 ()
5049 def p_module_start_1(p):
5050 '''module_start : K_module '''
5051 print('module_start_1', list(p))
5052 # { $$ = K_module; }
5053 ()
5054 def p_module_start_2(p):
5055 '''module_start : K_macromodule '''
5056 print('module_start_2', list(p))
5057 # { $$ = K_module; }
5058 ()
5059 def p_module_start_3(p):
5060 '''module_start : K_program '''
5061 print('module_start_3', list(p))
5062 # { $$ = K_program; }
5063 ()
5064 def p_module_start_4(p):
5065 '''module_start : K_interface '''
5066 print('module_start_4', list(p))
5067 # { $$ = K_interface; }
5068 ()
5069 def p_module_end_1(p):
5070 '''module_end : K_endmodule '''
5071 print('module_end_1', list(p))
5072 # { $$ = K_module; }
5073 ()
5074 def p_module_end_2(p):
5075 '''module_end : K_endprogram '''
5076 print('module_end_2', list(p))
5077 # { $$ = K_program; }
5078 ()
5079 def p_module_end_3(p):
5080 '''module_end : K_endinterface '''
5081 print('module_end_3', list(p))
5082 # { $$ = K_interface; }
5083 ()
5084 def p_endlabel_opt_1(p):
5085 '''endlabel_opt : ':' IDENTIFIER '''
5086 print('endlabel_opt_1', list(p))
5087 p[0] = p[2]
5088 ()
5089 def p_endlabel_opt_2(p):
5090 '''endlabel_opt : '''
5091 print('endlabel_opt_2', list(p))
5092 # { $$ = 0; }
5093 ()
5094 def p_module_attribute_foreign_1(p):
5095 '''module_attribute_foreign : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP '''
5096 print('module_attribute_foreign_1', list(p))
5097 # { $$ = 0; }
5098 ()
5099 def p_module_attribute_foreign_2(p):
5100 '''module_attribute_foreign : '''
5101 print('module_attribute_foreign_2', list(p))
5102 # { $$ = 0; }
5103 ()
5104 def p_module_port_list_opt_1(p):
5105 '''module_port_list_opt : '(' list_of_ports ')' '''
5106 print('module_port_list_opt_1', list(p))
5107 p[0] = p[2]
5108 ()
5109 def p_module_port_list_opt_2(p):
5110 '''module_port_list_opt : '(' list_of_port_declarations ')' '''
5111 print('module_port_list_opt_2', list(p))
5112 p[0] = p[2]
5113 ()
5114 def p_module_port_list_opt_3(p):
5115 '''module_port_list_opt : '''
5116 print('module_port_list_opt_3', list(p))
5117 # { $$ = 0; }
5118 ()
5119 def p_module_port_list_opt_4(p):
5120 '''module_port_list_opt : '(' error ')' '''
5121 print('module_port_list_opt_4', list(p))
5122 # { yyerror(@2, "Errors in port declarations.");
5123 # yyerrok;
5124 # $$ = 0;
5125 # }
5126 ()
5127 def p_module_parameter_port_list_opt_1(p):
5128 '''module_parameter_port_list_opt : '''
5129 print('module_parameter_port_list_opt_1', list(p))
5130 ()
5131 def p_module_parameter_port_list_opt_2(p):
5132 '''module_parameter_port_list_opt : '#' '(' module_parameter_port_list ')' '''
5133 print('module_parameter_port_list_opt_2', list(p))
5134 p[0] = p[2]
5135 ()
5136 def p_module_parameter_port_list_1(p):
5137 '''module_parameter_port_list : K_parameter param_type parameter_assign '''
5138 print('module_parameter_port_list_1', list(p))
5139 p[0] = [p[3]]
5140 ()
5141 def p_module_parameter_port_list_2(p):
5142 '''module_parameter_port_list : module_parameter_port_list ',' parameter_assign '''
5143 print('module_parameter_port_list_2', list(p))
5144 p[0] = p[1].append(p[3])
5145 ()
5146 def p_module_parameter_port_list_3(p):
5147 '''module_parameter_port_list : module_parameter_port_list ',' K_parameter param_type parameter_assign '''
5148 print('module_parameter_port_list_3', list(p))
5149 p[1].append(p[5])
5150 p[0] = p[1]
5151 ()
5152 def p_module_item_1(p):
5153 '''module_item : module '''
5154 print('module_item_1', list(p))
5155 ()
5156 def p_module_item_2(p):
5157 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' '''
5158 print('module_item_2', list(p))
5159 # { data_type_t*data_type = $3;
5160 # if (data_type == 0) {
5161 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5162 # FILE_NAME(data_type, @2);
5163 # }
5164 # pform_set_data_type(@2, data_type, $5, $2, $1);
5165 # if ($4 != 0) {
5166 # yyerror(@2, "sorry: net delays not supported.");
5167 # delete $4;
5168 # }
5169 # delete $1;
5170 # }
5171 ()
5172 def p_module_item_3(p):
5173 '''module_item : attribute_list_opt K_wreal delay3 net_variable_list ';' '''
5174 print('module_item_3', list(p))
5175 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5176 # pform_set_data_type(@2, tmpt, $4, NetNet::WIRE, $1);
5177 # if ($3 != 0) {
5178 # yyerror(@3, "sorry: net delays not supported.");
5179 # delete $3;
5180 # }
5181 # delete $1;
5182 # }
5183 ()
5184 def p_module_item_4(p):
5185 '''module_item : attribute_list_opt K_wreal net_variable_list ';' '''
5186 print('module_item_4', list(p))
5187 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5188 # pform_set_data_type(@2, tmpt, $3, NetNet::WIRE, $1);
5189 # delete $1;
5190 # }
5191 ()
5192 def p_module_item_5(p):
5193 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_decl_assigns ';' '''
5194 print('module_item_5', list(p))
5195 # { data_type_t*data_type = $3;
5196 # if (data_type == 0) {
5197 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5198 # FILE_NAME(data_type, @2);
5199 # }
5200 # pform_makewire(@2, $4, str_strength, $5, $2, data_type);
5201 # if ($1) {
5202 # yywarn(@2, "Attributes are not supported on net declaration "
5203 # "assignments and will be discarded.");
5204 # delete $1;
5205 # }
5206 # }
5207 ()
5208 def p_module_item_6(p):
5209 '''module_item : attribute_list_opt net_type data_type_or_implicit drive_strength net_decl_assigns ';' '''
5210 print('module_item_6', list(p))
5211 # { data_type_t*data_type = $3;
5212 # if (data_type == 0) {
5213 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5214 # FILE_NAME(data_type, @2);
5215 # }
5216 # pform_makewire(@2, 0, $4, $5, $2, data_type);
5217 # if ($1) {
5218 # yywarn(@2, "Attributes are not supported on net declaration "
5219 # "assignments and will be discarded.");
5220 # delete $1;
5221 # }
5222 # }
5223 ()
5224 def p_module_item_7(p):
5225 '''module_item : attribute_list_opt K_wreal net_decl_assigns ';' '''
5226 print('module_item_7', list(p))
5227 # { real_type_t*data_type = new real_type_t(real_type_t::REAL);
5228 # pform_makewire(@2, 0, str_strength, $3, NetNet::WIRE, data_type);
5229 # if ($1) {
5230 # yywarn(@2, "Attributes are not supported on net declaration "
5231 # "assignments and will be discarded.");
5232 # delete $1;
5233 # }
5234 # }
5235 ()
5236 def p_module_item_8(p):
5237 '''module_item : K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' '''
5238 print('module_item_8', list(p))
5239 # { yyerror(@1, "sorry: trireg nets not supported.");
5240 # delete $3;
5241 # delete $4;
5242 # }
5243 ()
5244 def p_module_item_9(p):
5245 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit list_of_port_identifiers ';' '''
5246 print('module_item_9', list(p))
5247 # { pform_module_define_port(@2, $5, $2, $3, $4, $1); }
5248 ()
5249 def p_module_item_10(p):
5250 '''module_item : attribute_list_opt port_direction K_wreal list_of_port_identifiers ';' '''
5251 print('module_item_10', list(p))
5252 # { real_type_t*real_type = new real_type_t(real_type_t::REAL);
5253 # pform_module_define_port(@2, $4, $2, NetNet::WIRE, real_type, $1);
5254 # }
5255 ()
5256 def p_module_item_11(p):
5257 '''module_item : attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' '''
5258 print('module_item_11', list(p))
5259 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5260 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5261 # if (dtype->implicit_flag)
5262 # use_type = NetNet::NONE;
5263 # }
5264 # if (use_type == NetNet::NONE)
5265 # pform_set_port_type(@2, $4, NetNet::PINOUT, $3, $1);
5266 # else
5267 # pform_module_define_port(@2, $4, NetNet::PINOUT, use_type, $3, $1);
5268 # }
5269 ()
5270 def p_module_item_12(p):
5271 '''module_item : attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' '''
5272 print('module_item_12', list(p))
5273 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5274 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5275 # if (dtype->implicit_flag)
5276 # use_type = NetNet::NONE;
5277 # }
5278 # if (use_type == NetNet::NONE)
5279 # pform_set_port_type(@2, $4, NetNet::PINPUT, $3, $1);
5280 # else
5281 # pform_module_define_port(@2, $4, NetNet::PINPUT, use_type, $3, $1);
5282 # }
5283 ()
5284 def p_module_item_13(p):
5285 '''module_item : attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' '''
5286 print('module_item_13', list(p))
5287 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5288 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5289 # if (dtype->implicit_flag)
5290 # use_type = NetNet::NONE;
5291 # else if (dtype->reg_flag)
5292 # use_type = NetNet::REG;
5293 # else
5294 # use_type = NetNet::IMPLICIT_REG;
5295 #
5296 # // The SystemVerilog types that can show up as
5297 # // output ports are implicitly (on the inside)
5298 # // variables because "reg" is not valid syntax
5299 # // here.
5300 # } else if (dynamic_cast<atom2_type_t*> ($3)) {
5301 # use_type = NetNet::IMPLICIT_REG;
5302 # } else if (dynamic_cast<struct_type_t*> ($3)) {
5303 # use_type = NetNet::IMPLICIT_REG;
5304 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> ($3)) {
5305 # if(etype->base_type == IVL_VT_LOGIC)
5306 # use_type = NetNet::IMPLICIT_REG;
5307 # }
5308 # if (use_type == NetNet::NONE)
5309 # pform_set_port_type(@2, $4, NetNet::POUTPUT, $3, $1);
5310 # else
5311 # pform_module_define_port(@2, $4, NetNet::POUTPUT, use_type, $3, $1);
5312 # }
5313 ()
5314 def p_module_item_14(p):
5315 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit error ';' '''
5316 print('module_item_14', list(p))
5317 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5318 # if ($1) delete $1;
5319 # if ($4) delete $4;
5320 # yyerrok;
5321 # }
5322 ()
5323 def p_module_item_15(p):
5324 '''module_item : attribute_list_opt K_inout data_type_or_implicit error ';' '''
5325 print('module_item_15', list(p))
5326 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5327 # if ($1) delete $1;
5328 # if ($3) delete $3;
5329 # yyerrok;
5330 # }
5331 ()
5332 def p_module_item_16(p):
5333 '''module_item : attribute_list_opt K_input data_type_or_implicit error ';' '''
5334 print('module_item_16', list(p))
5335 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5336 # if ($1) delete $1;
5337 # if ($3) delete $3;
5338 # yyerrok;
5339 # }
5340 ()
5341 def p_module_item_17(p):
5342 '''module_item : attribute_list_opt K_output data_type_or_implicit error ';' '''
5343 print('module_item_17', list(p))
5344 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5345 # if ($1) delete $1;
5346 # if ($3) delete $3;
5347 # yyerrok;
5348 # }
5349 ()
5350 def p_module_item_18(p):
5351 '''module_item : DISCIPLINE_IDENTIFIER list_of_identifiers ';' '''
5352 print('module_item_18', list(p))
5353 # { pform_attach_discipline(@1, $1, $2); }
5354 ()
5355 def p_module_item_19(p):
5356 '''module_item : attribute_list_opt _embed0_module_item block_item_decl '''
5357 print('module_item_19', list(p))
5358 # { delete attributes_in_context;
5359 # attributes_in_context = 0;
5360 # }
5361 ()
5362 def p_module_item_20(p):
5363 '''module_item : K_defparam _embed1_module_item defparam_assign_list ';' '''
5364 print('module_item_20', list(p))
5365 ()
5366 def p_module_item_21(p):
5367 '''module_item : attribute_list_opt gatetype gate_instance_list ';' '''
5368 print('module_item_21', list(p))
5369 # { pform_makegates(@2, $2, str_strength, 0, $3, $1); }
5370 ()
5371 def p_module_item_22(p):
5372 '''module_item : attribute_list_opt gatetype delay3 gate_instance_list ';' '''
5373 print('module_item_22', list(p))
5374 # { pform_makegates(@2, $2, str_strength, $3, $4, $1); }
5375 ()
5376 def p_module_item_23(p):
5377 '''module_item : attribute_list_opt gatetype drive_strength gate_instance_list ';' '''
5378 print('module_item_23', list(p))
5379 # { pform_makegates(@2, $2, $3, 0, $4, $1); }
5380 ()
5381 def p_module_item_24(p):
5382 '''module_item : attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';' '''
5383 print('module_item_24', list(p))
5384 # { pform_makegates(@2, $2, $3, $4, $5, $1); }
5385 ()
5386 def p_module_item_25(p):
5387 '''module_item : attribute_list_opt switchtype gate_instance_list ';' '''
5388 print('module_item_25', list(p))
5389 # { pform_makegates(@2, $2, str_strength, 0, $3, $1); }
5390 ()
5391 def p_module_item_26(p):
5392 '''module_item : attribute_list_opt switchtype delay3 gate_instance_list ';' '''
5393 print('module_item_26', list(p))
5394 # { pform_makegates(@2, $2, str_strength, $3, $4, $1); }
5395 ()
5396 def p_module_item_27(p):
5397 '''module_item : K_pullup gate_instance_list ';' '''
5398 print('module_item_27', list(p))
5399 # { pform_makegates(@1, PGBuiltin::PULLUP, pull_strength, 0, $2, 0); }
5400 ()
5401 def p_module_item_28(p):
5402 '''module_item : K_pulldown gate_instance_list ';' '''
5403 print('module_item_28', list(p))
5404 # { pform_makegates(@1, PGBuiltin::PULLDOWN, pull_strength, 0, $2, 0); }
5405 ()
5406 def p_module_item_29(p):
5407 '''module_item : K_pullup '(' dr_strength1 ')' gate_instance_list ';' '''
5408 print('module_item_29', list(p))
5409 # { pform_makegates(@1, PGBuiltin::PULLUP, $3, 0, $5, 0); }
5410 ()
5411 def p_module_item_30(p):
5412 '''module_item : K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5413 print('module_item_30', list(p))
5414 # { pform_makegates(@1, PGBuiltin::PULLUP, $3, 0, $7, 0); }
5415 ()
5416 def p_module_item_31(p):
5417 '''module_item : K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5418 print('module_item_31', list(p))
5419 # { pform_makegates(@1, PGBuiltin::PULLUP, $5, 0, $7, 0); }
5420 ()
5421 def p_module_item_32(p):
5422 '''module_item : K_pulldown '(' dr_strength0 ')' gate_instance_list ';' '''
5423 print('module_item_32', list(p))
5424 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $3, 0, $5, 0); }
5425 ()
5426 def p_module_item_33(p):
5427 '''module_item : K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5428 print('module_item_33', list(p))
5429 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $5, 0, $7, 0); }
5430 ()
5431 def p_module_item_34(p):
5432 '''module_item : K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5433 print('module_item_34', list(p))
5434 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $3, 0, $7, 0); }
5435 ()
5436 def p_module_item_35(p):
5437 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' '''
5438 print('module_item_35', list(p))
5439 # { perm_string tmp1 = lex_strings.make($2);
5440 # pform_make_modgates(@2, tmp1, $3, $4, $1);
5441 # delete[]$2;
5442 # }
5443 ()
5444 def p_module_item_36(p):
5445 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt error ';' '''
5446 print('module_item_36', list(p))
5447 # { yyerror(@2, "error: Invalid module instantiation");
5448 # delete[]$2;
5449 # if ($1) delete $1;
5450 # }
5451 ()
5452 def p_module_item_37(p):
5453 '''module_item : K_assign drive_strength_opt delay3_opt cont_assign_list ';' '''
5454 print('module_item_37', list(p))
5455 # { pform_make_pgassign_list($4, $3, $2, @1.text, @1.first_line); }
5456 ()
5457 def p_module_item_38(p):
5458 '''module_item : attribute_list_opt K_always statement_item '''
5459 print('module_item_38', list(p))
5460 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, $3, $1);
5461 # FILE_NAME(tmp, @2);
5462 # }
5463 ()
5464 def p_module_item_39(p):
5465 '''module_item : attribute_list_opt K_always_comb statement_item '''
5466 print('module_item_39', list(p))
5467 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_COMB, $3, $1);
5468 # FILE_NAME(tmp, @2);
5469 # }
5470 ()
5471 def p_module_item_40(p):
5472 '''module_item : attribute_list_opt K_always_ff statement_item '''
5473 print('module_item_40', list(p))
5474 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, $3, $1);
5475 # FILE_NAME(tmp, @2);
5476 # }
5477 ()
5478 def p_module_item_41(p):
5479 '''module_item : attribute_list_opt K_always_latch statement_item '''
5480 print('module_item_41', list(p))
5481 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_LATCH, $3, $1);
5482 # FILE_NAME(tmp, @2);
5483 # }
5484 ()
5485 def p_module_item_42(p):
5486 '''module_item : attribute_list_opt K_initial statement_item '''
5487 print('module_item_42', list(p))
5488 # { PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, $3, $1);
5489 # FILE_NAME(tmp, @2);
5490 # }
5491 ()
5492 def p_module_item_43(p):
5493 '''module_item : attribute_list_opt K_final statement_item '''
5494 print('module_item_43', list(p))
5495 # { PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, $3, $1);
5496 # FILE_NAME(tmp, @2);
5497 # }
5498 ()
5499 def p_module_item_44(p):
5500 '''module_item : attribute_list_opt K_analog analog_statement '''
5501 print('module_item_44', list(p))
5502 # { pform_make_analog_behavior(@2, IVL_PR_ALWAYS, $3); }
5503 ()
5504 def p_module_item_45(p):
5505 '''module_item : attribute_list_opt assertion_item '''
5506 print('module_item_45', list(p))
5507 ()
5508 def p_module_item_46(p):
5509 '''module_item : timeunits_declaration '''
5510 print('module_item_46', list(p))
5511 ()
5512 def p_module_item_47(p):
5513 '''module_item : class_declaration '''
5514 print('module_item_47', list(p))
5515 ()
5516 def p_module_item_48(p):
5517 '''module_item : task_declaration '''
5518 print('module_item_48', list(p))
5519 ()
5520 def p_module_item_49(p):
5521 '''module_item : function_declaration '''
5522 print('module_item_49', list(p))
5523 ()
5524 def p_module_item_50(p):
5525 '''module_item : K_generate generate_item_list_opt K_endgenerate '''
5526 print('module_item_50', list(p))
5527 # { // Test for bad nesting. I understand it, but it is illegal.
5528 # if (pform_parent_generate()) {
5529 # cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
5530 # cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
5531 # cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
5532 # error_count += 1;
5533 # }
5534 # }
5535 ()
5536 def p_module_item_51(p):
5537 '''module_item : K_genvar list_of_identifiers ';' '''
5538 print('module_item_51', list(p))
5539 # { pform_genvars(@1, $2); }
5540 ()
5541 def p_module_item_52(p):
5542 '''module_item : K_for '(' IDENTIFIER '=' expression ';' expression ';' IDENTIFIER '=' expression ')' _embed2_module_item generate_block '''
5543 print('module_item_52', list(p))
5544 # { pform_endgenerate(); }
5545 ()
5546 def p_module_item_53(p):
5547 '''module_item : generate_if generate_block_opt K_else _embed3_module_item generate_block '''
5548 print('module_item_53', list(p))
5549 # { pform_endgenerate(); }
5550 ()
5551 def p_module_item_54(p):
5552 '''module_item : generate_if generate_block_opt %prec less_than_K_else '''
5553 print('module_item_54', list(p))
5554 # { pform_endgenerate(); }
5555 ()
5556 def p_module_item_55(p):
5557 '''module_item : K_case '(' expression ')' _embed4_module_item generate_case_items K_endcase '''
5558 print('module_item_55', list(p))
5559 # { pform_endgenerate(); }
5560 ()
5561 def p_module_item_56(p):
5562 '''module_item : modport_declaration '''
5563 print('module_item_56', list(p))
5564 ()
5565 def p_module_item_57(p):
5566 '''module_item : package_import_declaration '''
5567 print('module_item_57', list(p))
5568 ()
5569 def p_module_item_58(p):
5570 '''module_item : attribute_list_opt K_specparam _embed5_module_item specparam_decl ';' '''
5571 print('module_item_58', list(p))
5572 ()
5573 def p_module_item_59(p):
5574 '''module_item : K_specify _embed6_module_item specify_item_list_opt K_endspecify '''
5575 print('module_item_59', list(p))
5576 ()
5577 def p_module_item_60(p):
5578 '''module_item : K_specify error K_endspecify '''
5579 print('module_item_60', list(p))
5580 # { yyerror(@1, "error: syntax error in specify block");
5581 # yyerrok;
5582 # }
5583 ()
5584 def p_module_item_61(p):
5585 '''module_item : error ';' '''
5586 print('module_item_61', list(p))
5587 # { yyerror(@2, "error: invalid module item.");
5588 # yyerrok;
5589 # }
5590 ()
5591 def p_module_item_62(p):
5592 '''module_item : K_assign error '=' expression ';' '''
5593 print('module_item_62', list(p))
5594 # { yyerror(@1, "error: syntax error in left side "
5595 # "of continuous assignment.");
5596 # yyerrok;
5597 # }
5598 ()
5599 def p_module_item_63(p):
5600 '''module_item : K_assign error ';' '''
5601 print('module_item_63', list(p))
5602 # { yyerror(@1, "error: syntax error in "
5603 # "continuous assignment");
5604 # yyerrok;
5605 # }
5606 ()
5607 def p_module_item_64(p):
5608 '''module_item : K_function error K_endfunction endlabel_opt '''
5609 print('module_item_64', list(p))
5610 # { yyerror(@1, "error: I give up on this "
5611 # "function definition.");
5612 # if ($4) {
5613 # if (!gn_system_verilog()) {
5614 # yyerror(@4, "error: Function end names require "
5615 # "SystemVerilog.");
5616 # }
5617 # delete[]$4;
5618 # }
5619 # yyerrok;
5620 # }
5621 ()
5622 def p_module_item_65(p):
5623 '''module_item : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';' '''
5624 print('module_item_65', list(p))
5625 # { perm_string tmp3 = lex_strings.make($3);
5626 # perm_string tmp5 = lex_strings.make($5);
5627 # pform_set_attrib(tmp3, tmp5, $7);
5628 # delete[] $3;
5629 # delete[] $5;
5630 # }
5631 ()
5632 def p_module_item_66(p):
5633 '''module_item : KK_attribute '(' error ')' ';' '''
5634 print('module_item_66', list(p))
5635 # { yyerror(@1, "error: Malformed $attribute parameter list."); }
5636 ()
5637 def p__embed0_module_item(p):
5638 '''_embed0_module_item : '''
5639 # { attributes_in_context = $1; }
5640 ()
5641 def p__embed1_module_item(p):
5642 '''_embed1_module_item : '''
5643 # { if (pform_in_interface())
5644 # yyerror(@1, "error: Parameter overrides are not allowed "
5645 # "in interfaces.");
5646 # }
5647 ()
5648 def p__embed2_module_item(p):
5649 '''_embed2_module_item : '''
5650 # { pform_start_generate_for(@1, $3, $5, $7, $9, $11); }
5651 ()
5652 def p__embed3_module_item(p):
5653 '''_embed3_module_item : '''
5654 # { pform_start_generate_else(@1); }
5655 ()
5656 def p__embed4_module_item(p):
5657 '''_embed4_module_item : '''
5658 # { pform_start_generate_case(@1, $3); }
5659 ()
5660 def p__embed5_module_item(p):
5661 '''_embed5_module_item : '''
5662 # { if (pform_in_interface())
5663 # yyerror(@1, "error: specparam declarations are not allowed "
5664 # "in interfaces.");
5665 # }
5666 ()
5667 def p__embed6_module_item(p):
5668 '''_embed6_module_item : '''
5669 # { if (pform_in_interface())
5670 # yyerror(@1, "error: specify blocks are not allowed "
5671 # "in interfaces.");
5672 # }
5673 ()
5674 def p_module_item_list_1(p):
5675 '''module_item_list : module_item_list module_item '''
5676 print('module_item_list_1', list(p))
5677 ()
5678 def p_module_item_list_2(p):
5679 '''module_item_list : module_item '''
5680 print('module_item_list_2', list(p))
5681 ()
5682 def p_module_item_list_opt_1(p):
5683 '''module_item_list_opt : module_item_list '''
5684 print('module_item_list_opt_1', list(p))
5685 ()
5686 def p_module_item_list_opt_2(p):
5687 '''module_item_list_opt : '''
5688 print('module_item_list_opt_2', list(p))
5689 ()
5690 def p_generate_if_1(p):
5691 '''generate_if : K_if '(' expression ')' '''
5692 print('generate_if_1', list(p))
5693 # { pform_start_generate_if(@1, $3); }
5694 ()
5695 def p_generate_case_items_1(p):
5696 '''generate_case_items : generate_case_items generate_case_item '''
5697 print('generate_case_items_1', list(p))
5698 ()
5699 def p_generate_case_items_2(p):
5700 '''generate_case_items : generate_case_item '''
5701 print('generate_case_items_2', list(p))
5702 ()
5703 def p_generate_case_item_1(p):
5704 '''generate_case_item : expression_list_proper ':' _embed0_generate_case_item generate_block_opt '''
5705 print('generate_case_item_1', list(p))
5706 # { pform_endgenerate(); }
5707 ()
5708 def p_generate_case_item_2(p):
5709 '''generate_case_item : K_default ':' _embed1_generate_case_item generate_block_opt '''
5710 print('generate_case_item_2', list(p))
5711 # { pform_endgenerate(); }
5712 ()
5713 def p__embed0_generate_case_item(p):
5714 '''_embed0_generate_case_item : '''
5715 # { pform_generate_case_item(@1, $1); }
5716 ()
5717 def p__embed1_generate_case_item(p):
5718 '''_embed1_generate_case_item : '''
5719 # { pform_generate_case_item(@1, 0); }
5720 ()
5721 def p_generate_item_1(p):
5722 '''generate_item : module_item '''
5723 print('generate_item_1', list(p))
5724 ()
5725 def p_generate_item_2(p):
5726 '''generate_item : K_begin generate_item_list_opt K_end '''
5727 print('generate_item_2', list(p))
5728 # { /* Detect and warn about anachronistic begin/end use */
5729 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5730 # warn_count += 1;
5731 # cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
5732 # }
5733 # }
5734 ()
5735 def p_generate_item_3(p):
5736 '''generate_item : K_begin ':' IDENTIFIER _embed0_generate_item generate_item_list_opt K_end '''
5737 print('generate_item_3', list(p))
5738 # { /* Detect and warn about anachronistic named begin/end use */
5739 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5740 # warn_count += 1;
5741 # cerr << @1 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
5742 # }
5743 # pform_endgenerate();
5744 # }
5745 ()
5746 def p__embed0_generate_item(p):
5747 '''_embed0_generate_item : '''
5748 # {
5749 # pform_start_generate_nblock(@1, $3);
5750 # }
5751 ()
5752 def p_generate_item_list_1(p):
5753 '''generate_item_list : generate_item_list generate_item '''
5754 print('generate_item_list_1', list(p))
5755 ()
5756 def p_generate_item_list_2(p):
5757 '''generate_item_list : generate_item '''
5758 print('generate_item_list_2', list(p))
5759 ()
5760 def p_generate_item_list_opt_1(p):
5761 '''generate_item_list_opt : generate_item_list '''
5762 print('generate_item_list_opt_1', list(p))
5763 ()
5764 def p_generate_item_list_opt_2(p):
5765 '''generate_item_list_opt : '''
5766 print('generate_item_list_opt_2', list(p))
5767 ()
5768 def p_generate_block_1(p):
5769 '''generate_block : module_item '''
5770 print('generate_block_1', list(p))
5771 ()
5772 def p_generate_block_2(p):
5773 '''generate_block : K_begin generate_item_list_opt K_end '''
5774 print('generate_block_2', list(p))
5775 ()
5776 def p_generate_block_3(p):
5777 '''generate_block : K_begin ':' IDENTIFIER generate_item_list_opt K_end endlabel_opt '''
5778 print('generate_block_3', list(p))
5779 # { pform_generate_block_name($3);
5780 # if ($6) {
5781 # if (strcmp($3,$6) != 0) {
5782 # yyerror(@6, "error: End label doesn't match "
5783 # "begin name");
5784 # }
5785 # if (! gn_system_verilog()) {
5786 # yyerror(@6, "error: Begin end labels require "
5787 # "SystemVerilog.");
5788 # }
5789 # delete[]$6;
5790 # }
5791 # delete[]$3;
5792 # }
5793 ()
5794 def p_generate_block_opt_1(p):
5795 '''generate_block_opt : generate_block '''
5796 print('generate_block_opt_1', list(p))
5797 ()
5798 def p_generate_block_opt_2(p):
5799 '''generate_block_opt : ';' '''
5800 print('generate_block_opt_2', list(p))
5801 ()
5802 def p_net_decl_assign_1(p):
5803 '''net_decl_assign : IDENTIFIER '=' expression '''
5804 print('net_decl_assign_1', list(p))
5805 # { net_decl_assign_t*tmp = new net_decl_assign_t;
5806 # tmp->next = tmp;
5807 # tmp->name = lex_strings.make($1);
5808 # tmp->expr = $3;
5809 # delete[]$1;
5810 # $$ = tmp;
5811 # }
5812 ()
5813 def p_net_decl_assigns_1(p):
5814 '''net_decl_assigns : net_decl_assigns ',' net_decl_assign '''
5815 print('net_decl_assigns_1', list(p))
5816 # { net_decl_assign_t*tmp = $1;
5817 # $3->next = tmp->next;
5818 # tmp->next = $3;
5819 # $$ = tmp;
5820 # }
5821 ()
5822 def p_net_decl_assigns_2(p):
5823 '''net_decl_assigns : net_decl_assign '''
5824 print('net_decl_assigns_2', list(p))
5825 # { $$ = $1;
5826 # }
5827 ()
5828 def p_bit_logic_1(p):
5829 '''bit_logic : K_logic '''
5830 print('bit_logic_1', list(p))
5831 # { $$ = IVL_VT_LOGIC; }
5832 ()
5833 def p_bit_logic_2(p):
5834 '''bit_logic : K_bool '''
5835 print('bit_logic_2', list(p))
5836 # { $$ = IVL_VT_BOOL; /* Icarus misc */}
5837 ()
5838 def p_bit_logic_3(p):
5839 '''bit_logic : K_bit '''
5840 print('bit_logic_3', list(p))
5841 # { $$ = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
5842 ()
5843 def p_bit_logic_opt_1(p):
5844 '''bit_logic_opt : bit_logic '''
5845 print('bit_logic_opt_1', list(p))
5846 ()
5847 def p_bit_logic_opt_2(p):
5848 '''bit_logic_opt : '''
5849 print('bit_logic_opt_2', list(p))
5850 # { $$ = IVL_VT_NO_TYPE; }
5851 ()
5852 def p_net_type_1(p):
5853 '''net_type : K_wire '''
5854 print('net_type_1', list(p))
5855 # { $$ = NetNet::WIRE; }
5856 ()
5857 def p_net_type_2(p):
5858 '''net_type : K_tri '''
5859 print('net_type_2', list(p))
5860 # { $$ = NetNet::TRI; }
5861 ()
5862 def p_net_type_3(p):
5863 '''net_type : K_tri1 '''
5864 print('net_type_3', list(p))
5865 # { $$ = NetNet::TRI1; }
5866 ()
5867 def p_net_type_4(p):
5868 '''net_type : K_supply0 '''
5869 print('net_type_4', list(p))
5870 # { $$ = NetNet::SUPPLY0; }
5871 ()
5872 def p_net_type_5(p):
5873 '''net_type : K_wand '''
5874 print('net_type_5', list(p))
5875 # { $$ = NetNet::WAND; }
5876 ()
5877 def p_net_type_6(p):
5878 '''net_type : K_triand '''
5879 print('net_type_6', list(p))
5880 # { $$ = NetNet::TRIAND; }
5881 ()
5882 def p_net_type_7(p):
5883 '''net_type : K_tri0 '''
5884 print('net_type_7', list(p))
5885 # { $$ = NetNet::TRI0; }
5886 ()
5887 def p_net_type_8(p):
5888 '''net_type : K_supply1 '''
5889 print('net_type_8', list(p))
5890 # { $$ = NetNet::SUPPLY1; }
5891 ()
5892 def p_net_type_9(p):
5893 '''net_type : K_wor '''
5894 print('net_type_9', list(p))
5895 # { $$ = NetNet::WOR; }
5896 ()
5897 def p_net_type_10(p):
5898 '''net_type : K_trior '''
5899 print('net_type_10', list(p))
5900 # { $$ = NetNet::TRIOR; }
5901 ()
5902 def p_net_type_11(p):
5903 '''net_type : K_wone '''
5904 print('net_type_11', list(p))
5905 # { $$ = NetNet::UNRESOLVED_WIRE;
5906 # cerr << @1.text << ":" << @1.first_line << ": warning: "
5907 # "'wone' is deprecated, please use 'uwire' "
5908 # "instead." << endl;
5909 # }
5910 ()
5911 def p_net_type_12(p):
5912 '''net_type : K_uwire '''
5913 print('net_type_12', list(p))
5914 # { $$ = NetNet::UNRESOLVED_WIRE; }
5915 ()
5916 def p_param_type_1(p):
5917 '''param_type : bit_logic_opt unsigned_signed_opt dimensions_opt '''
5918 print('param_type_1', list(p))
5919 # { param_active_range = $3;
5920 # param_active_signed = $2;
5921 # if (($1 == IVL_VT_NO_TYPE) && ($3 != 0))
5922 # param_active_type = IVL_VT_LOGIC;
5923 # else
5924 # param_active_type = $1;
5925 # }
5926 ()
5927 def p_param_type_2(p):
5928 '''param_type : K_integer '''
5929 print('param_type_2', list(p))
5930 # { param_active_range = make_range_from_width(integer_width);
5931 # param_active_signed = true;
5932 # param_active_type = IVL_VT_LOGIC;
5933 # }
5934 ()
5935 def p_param_type_3(p):
5936 '''param_type : K_time '''
5937 print('param_type_3', list(p))
5938 # { param_active_range = make_range_from_width(64);
5939 # param_active_signed = false;
5940 # param_active_type = IVL_VT_LOGIC;
5941 # }
5942 ()
5943 def p_param_type_4(p):
5944 '''param_type : real_or_realtime '''
5945 print('param_type_4', list(p))
5946 # { param_active_range = 0;
5947 # param_active_signed = true;
5948 # param_active_type = IVL_VT_REAL;
5949 # }
5950 ()
5951 def p_param_type_5(p):
5952 '''param_type : atom2_type '''
5953 print('param_type_5', list(p))
5954 # { param_active_range = make_range_from_width($1);
5955 # param_active_signed = true;
5956 # param_active_type = IVL_VT_BOOL;
5957 # }
5958 ()
5959 def p_param_type_6(p):
5960 '''param_type : TYPE_IDENTIFIER '''
5961 print('param_type_6', list(p))
5962 # { pform_set_param_from_type(@1, $1.type, $1.text, param_active_range,
5963 # param_active_signed, param_active_type);
5964 # delete[]$1.text;
5965 # }
5966 ()
5967 def p_parameter_assign_list_1(p):
5968 '''parameter_assign_list : parameter_assign '''
5969 print('parameter_assign_list_1', list(p))
5970 ()
5971 def p_parameter_assign_list_2(p):
5972 '''parameter_assign_list : parameter_assign_list ',' parameter_assign '''
5973 print('parameter_assign_list_2', list(p))
5974 ()
5975 def p_localparam_assign_list_1(p):
5976 '''localparam_assign_list : localparam_assign '''
5977 print('localparam_assign_list_1', list(p))
5978 ()
5979 def p_localparam_assign_list_2(p):
5980 '''localparam_assign_list : localparam_assign_list ',' localparam_assign '''
5981 print('localparam_assign_list_2', list(p))
5982 ()
5983 def p_parameter_assign_1(p):
5984 '''parameter_assign : IDENTIFIER '=' expression parameter_value_ranges_opt '''
5985 print('parameter_assign_1', list(p))
5986 tpname = Node(syms.tname, [Leaf(token.NAME, p[1])])
5987 expr = Node(syms.tfpdef, [tpname, Leaf(token.EQUAL, p[2]), p[3] ])
5988 p[0] = expr
5989 # { PExpr*tmp = $3;
5990 # pform_set_parameter(@1, lex_strings.make($1), param_active_type,
5991 # param_active_signed, param_active_range, tmp, $4);
5992 # delete[]$1;
5993 # }
5994 ()
5995 def p_localparam_assign_1(p):
5996 '''localparam_assign : IDENTIFIER '=' expression '''
5997 print('localparam_assign_1', list(p))
5998 # { PExpr*tmp = $3;
5999 # pform_set_localparam(@1, lex_strings.make($1), param_active_type,
6000 # param_active_signed, param_active_range, tmp);
6001 # delete[]$1;
6002 # }
6003 ()
6004 def p_parameter_value_ranges_opt_1(p):
6005 '''parameter_value_ranges_opt : parameter_value_ranges '''
6006 print('parameter_value_ranges_opt_1', list(p))
6007 p[0] = p[1]
6008 ()
6009 def p_parameter_value_ranges_opt_2(p):
6010 '''parameter_value_ranges_opt : '''
6011 print('parameter_value_ranges_opt_2', list(p))
6012 # { $$ = 0; }
6013 ()
6014 def p_parameter_value_ranges_1(p):
6015 '''parameter_value_ranges : parameter_value_ranges parameter_value_range '''
6016 print('parameter_value_ranges_1', list(p))
6017 # { $$ = $2; $$->next = $1; }
6018 ()
6019 def p_parameter_value_ranges_2(p):
6020 '''parameter_value_ranges : parameter_value_range '''
6021 print('parameter_value_ranges_2', list(p))
6022 # { $$ = $1; $$->next = 0; }
6023 ()
6024 def p_parameter_value_range_1(p):
6025 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ']' '''
6026 print('parameter_value_range_1', list(p))
6027 # { $$ = pform_parameter_value_range($1, false, $3, false, $5); }
6028 ()
6029 def p_parameter_value_range_2(p):
6030 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ')' '''
6031 print('parameter_value_range_2', list(p))
6032 # { $$ = pform_parameter_value_range($1, false, $3, true, $5); }
6033 ()
6034 def p_parameter_value_range_3(p):
6035 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ']' '''
6036 print('parameter_value_range_3', list(p))
6037 # { $$ = pform_parameter_value_range($1, true, $3, false, $5); }
6038 ()
6039 def p_parameter_value_range_4(p):
6040 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ')' '''
6041 print('parameter_value_range_4', list(p))
6042 # { $$ = pform_parameter_value_range($1, true, $3, true, $5); }
6043 ()
6044 def p_parameter_value_range_5(p):
6045 '''parameter_value_range : K_exclude expression '''
6046 print('parameter_value_range_5', list(p))
6047 # { $$ = pform_parameter_value_range(true, false, $2, false, $2); }
6048 ()
6049 def p_value_range_expression_1(p):
6050 '''value_range_expression : expression '''
6051 print('value_range_expression_1', list(p))
6052 p[0] = p[1]
6053 ()
6054 def p_value_range_expression_2(p):
6055 '''value_range_expression : K_inf '''
6056 print('value_range_expression_2', list(p))
6057 # { $$ = 0; }
6058 ()
6059 def p_value_range_expression_3(p):
6060 '''value_range_expression : '+' K_inf '''
6061 print('value_range_expression_3', list(p))
6062 # { $$ = 0; }
6063 ()
6064 def p_value_range_expression_4(p):
6065 '''value_range_expression : '-' K_inf '''
6066 print('value_range_expression_4', list(p))
6067 # { $$ = 0; }
6068 ()
6069 def p_from_exclude_1(p):
6070 '''from_exclude : K_from '''
6071 print('from_exclude_1', list(p))
6072 # { $$ = false; }
6073 ()
6074 def p_from_exclude_2(p):
6075 '''from_exclude : K_exclude '''
6076 print('from_exclude_2', list(p))
6077 # { $$ = true; }
6078 ()
6079 def p_parameter_value_opt_1(p):
6080 '''parameter_value_opt : '#' '(' expression_list_with_nuls ')' '''
6081 print('parameter_value_opt_1', list(p))
6082 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6083 # tmp->by_order = $3;
6084 # tmp->by_name = 0;
6085 # $$ = tmp;
6086 # }
6087 ()
6088 def p_parameter_value_opt_2(p):
6089 '''parameter_value_opt : '#' '(' parameter_value_byname_list ')' '''
6090 print('parameter_value_opt_2', list(p))
6091 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6092 # tmp->by_order = 0;
6093 # tmp->by_name = $3;
6094 # $$ = tmp;
6095 # }
6096 ()
6097 def p_parameter_value_opt_3(p):
6098 '''parameter_value_opt : '#' DEC_NUMBER '''
6099 print('parameter_value_opt_3', list(p))
6100 # { assert($2);
6101 # PENumber*tmp = new PENumber($2);
6102 # FILE_NAME(tmp, @1);
6103 #
6104 # struct parmvalue_t*lst = new struct parmvalue_t;
6105 # lst->by_order = new list<PExpr*>;
6106 # lst->by_order->push_back(tmp);
6107 # lst->by_name = 0;
6108 # $$ = lst;
6109 # based_size = 0;
6110 # }
6111 ()
6112 def p_parameter_value_opt_4(p):
6113 '''parameter_value_opt : '#' REALTIME '''
6114 print('parameter_value_opt_4', list(p))
6115 # { assert($2);
6116 # PEFNumber*tmp = new PEFNumber($2);
6117 # FILE_NAME(tmp, @1);
6118 #
6119 # struct parmvalue_t*lst = new struct parmvalue_t;
6120 # lst->by_order = new list<PExpr*>;
6121 # lst->by_order->push_back(tmp);
6122 # lst->by_name = 0;
6123 # $$ = lst;
6124 # }
6125 ()
6126 def p_parameter_value_opt_5(p):
6127 '''parameter_value_opt : '#' error '''
6128 print('parameter_value_opt_5', list(p))
6129 # { yyerror(@1, "error: syntax error in parameter value "
6130 # "assignment list.");
6131 # $$ = 0;
6132 # }
6133 ()
6134 def p_parameter_value_opt_6(p):
6135 '''parameter_value_opt : '''
6136 print('parameter_value_opt_6', list(p))
6137 # { $$ = 0; }
6138 ()
6139 def p_parameter_value_byname_1(p):
6140 '''parameter_value_byname : '.' IDENTIFIER '(' expression ')' '''
6141 print('parameter_value_byname_1', list(p))
6142 # { named_pexpr_t*tmp = new named_pexpr_t;
6143 # tmp->name = lex_strings.make($2);
6144 # tmp->parm = $4;
6145 # delete[]$2;
6146 # $$ = tmp;
6147 # }
6148 ()
6149 def p_parameter_value_byname_2(p):
6150 '''parameter_value_byname : '.' IDENTIFIER '(' ')' '''
6151 print('parameter_value_byname_2', list(p))
6152 # { named_pexpr_t*tmp = new named_pexpr_t;
6153 # tmp->name = lex_strings.make($2);
6154 # tmp->parm = 0;
6155 # delete[]$2;
6156 # $$ = tmp;
6157 # }
6158 ()
6159 def p_parameter_value_byname_list_1(p):
6160 '''parameter_value_byname_list : parameter_value_byname '''
6161 print('parameter_value_byname_list_1', list(p))
6162 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6163 # tmp->push_back(*$1);
6164 # delete $1;
6165 # $$ = tmp;
6166 # }
6167 ()
6168 def p_parameter_value_byname_list_2(p):
6169 '''parameter_value_byname_list : parameter_value_byname_list ',' parameter_value_byname '''
6170 print('parameter_value_byname_list_2', list(p))
6171 # { list<named_pexpr_t>*tmp = $1;
6172 # tmp->push_back(*$3);
6173 # delete $3;
6174 # $$ = tmp;
6175 # }
6176 ()
6177 def p_port_1(p):
6178 '''port : port_reference '''
6179 print('port_1', list(p))
6180 p[0] = p[1]
6181 ()
6182 def p_port_2(p):
6183 '''port : '.' IDENTIFIER '(' port_reference ')' '''
6184 print('port_2', list(p))
6185 # { Module::port_t*tmp = $4;
6186 # tmp->name = lex_strings.make($2);
6187 # delete[]$2;
6188 # $$ = tmp;
6189 # }
6190 ()
6191 def p_port_3(p):
6192 '''port : '{' port_reference_list '}' '''
6193 print('port_3', list(p))
6194 # { Module::port_t*tmp = $2;
6195 # tmp->name = perm_string();
6196 # $$ = tmp;
6197 # }
6198 ()
6199 def p_port_4(p):
6200 '''port : '.' IDENTIFIER '(' '{' port_reference_list '}' ')' '''
6201 print('port_4', list(p))
6202 # { Module::port_t*tmp = $5;
6203 # tmp->name = lex_strings.make($2);
6204 # delete[]$2;
6205 # $$ = tmp;
6206 # }
6207 ()
6208 def p_port_opt_1(p):
6209 '''port_opt : port '''
6210 print('port_opt_1', list(p))
6211 p[0] = p[1]
6212 ()
6213 def p_port_opt_2(p):
6214 '''port_opt : '''
6215 print('port_opt_2', list(p))
6216 # { $$ = 0; }
6217 ()
6218 def p_port_name_1(p):
6219 '''port_name : '.' IDENTIFIER '(' expression ')' '''
6220 print('port_name_1', list(p))
6221 # { named_pexpr_t*tmp = new named_pexpr_t;
6222 # tmp->name = lex_strings.make($2);
6223 # tmp->parm = $4;
6224 # delete[]$2;
6225 # $$ = tmp;
6226 # }
6227 ()
6228 def p_port_name_2(p):
6229 '''port_name : '.' IDENTIFIER '(' error ')' '''
6230 print('port_name_2', list(p))
6231 # { yyerror(@3, "error: invalid port connection expression.");
6232 # named_pexpr_t*tmp = new named_pexpr_t;
6233 # tmp->name = lex_strings.make($2);
6234 # tmp->parm = 0;
6235 # delete[]$2;
6236 # $$ = tmp;
6237 # }
6238 ()
6239 def p_port_name_3(p):
6240 '''port_name : '.' IDENTIFIER '(' ')' '''
6241 print('port_name_3', list(p))
6242 # { named_pexpr_t*tmp = new named_pexpr_t;
6243 # tmp->name = lex_strings.make($2);
6244 # tmp->parm = 0;
6245 # delete[]$2;
6246 # $$ = tmp;
6247 # }
6248 ()
6249 def p_port_name_4(p):
6250 '''port_name : '.' IDENTIFIER '''
6251 print('port_name_4', list(p))
6252 # { named_pexpr_t*tmp = new named_pexpr_t;
6253 # tmp->name = lex_strings.make($2);
6254 # tmp->parm = new PEIdent(lex_strings.make($2), true);
6255 # FILE_NAME(tmp->parm, @1);
6256 # delete[]$2;
6257 # $$ = tmp;
6258 # }
6259 ()
6260 def p_port_name_5(p):
6261 '''port_name : K_DOTSTAR '''
6262 print('port_name_5', list(p))
6263 # { named_pexpr_t*tmp = new named_pexpr_t;
6264 # tmp->name = lex_strings.make("*");
6265 # tmp->parm = 0;
6266 # $$ = tmp;
6267 # }
6268 ()
6269 def p_port_name_list_1(p):
6270 '''port_name_list : port_name_list ',' port_name '''
6271 print('port_name_list_1', list(p))
6272 # { list<named_pexpr_t>*tmp = $1;
6273 # tmp->push_back(*$3);
6274 # delete $3;
6275 # $$ = tmp;
6276 # }
6277 ()
6278 def p_port_name_list_2(p):
6279 '''port_name_list : port_name '''
6280 print('port_name_list_2', list(p))
6281 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6282 # tmp->push_back(*$1);
6283 # delete $1;
6284 # $$ = tmp;
6285 # }
6286 ()
6287 def p_port_reference_1(p):
6288 '''port_reference : IDENTIFIER '''
6289 print('port_reference_1', list(p))
6290 # { Module::port_t*ptmp;
6291 # perm_string name = lex_strings.make($1);
6292 # ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
6293 # delete[]$1;
6294 # $$ = ptmp;
6295 # }
6296 ()
6297 def p_port_reference_2(p):
6298 '''port_reference : IDENTIFIER '[' expression ':' expression ']' '''
6299 print('port_reference_2', list(p))
6300 # { index_component_t itmp;
6301 # itmp.sel = index_component_t::SEL_PART;
6302 # itmp.msb = $3;
6303 # itmp.lsb = $5;
6304 #
6305 # name_component_t ntmp (lex_strings.make($1));
6306 # ntmp.index.push_back(itmp);
6307 #
6308 # pform_name_t pname;
6309 # pname.push_back(ntmp);
6310 #
6311 # PEIdent*wtmp = new PEIdent(pname);
6312 # FILE_NAME(wtmp, @1);
6313 #
6314 # Module::port_t*ptmp = new Module::port_t;
6315 # ptmp->name = perm_string();
6316 # ptmp->expr.push_back(wtmp);
6317 #
6318 # delete[]$1;
6319 # $$ = ptmp;
6320 # }
6321 ()
6322 def p_port_reference_3(p):
6323 '''port_reference : IDENTIFIER '[' expression ']' '''
6324 print('port_reference_3', list(p))
6325 # { index_component_t itmp;
6326 # itmp.sel = index_component_t::SEL_BIT;
6327 # itmp.msb = $3;
6328 # itmp.lsb = 0;
6329 #
6330 # name_component_t ntmp (lex_strings.make($1));
6331 # ntmp.index.push_back(itmp);
6332 #
6333 # pform_name_t pname;
6334 # pname.push_back(ntmp);
6335 #
6336 # PEIdent*tmp = new PEIdent(pname);
6337 # FILE_NAME(tmp, @1);
6338 #
6339 # Module::port_t*ptmp = new Module::port_t;
6340 # ptmp->name = perm_string();
6341 # ptmp->expr.push_back(tmp);
6342 # delete[]$1;
6343 # $$ = ptmp;
6344 # }
6345 ()
6346 def p_port_reference_4(p):
6347 '''port_reference : IDENTIFIER '[' error ']' '''
6348 print('port_reference_4', list(p))
6349 # { yyerror(@1, "error: invalid port bit select");
6350 # Module::port_t*ptmp = new Module::port_t;
6351 # PEIdent*wtmp = new PEIdent(lex_strings.make($1));
6352 # FILE_NAME(wtmp, @1);
6353 # ptmp->name = lex_strings.make($1);
6354 # ptmp->expr.push_back(wtmp);
6355 # delete[]$1;
6356 # $$ = ptmp;
6357 # }
6358 ()
6359 def p_port_reference_list_1(p):
6360 '''port_reference_list : port_reference '''
6361 print('port_reference_list_1', list(p))
6362 p[0] = p[1]
6363 ()
6364 def p_port_reference_list_2(p):
6365 '''port_reference_list : port_reference_list ',' port_reference '''
6366 print('port_reference_list_2', list(p))
6367 # { Module::port_t*tmp = $1;
6368 # append(tmp->expr, $3->expr);
6369 # delete $3;
6370 # $$ = tmp;
6371 # }
6372 ()
6373 def p_dimensions_opt_1(p):
6374 '''dimensions_opt : '''
6375 print('dimensions_opt_1', list(p))
6376 # { $$ = 0; }
6377 ()
6378 def p_dimensions_opt_2(p):
6379 '''dimensions_opt : dimensions '''
6380 print('dimensions_opt_2', list(p))
6381 p[0] = p[1]
6382 ()
6383 def p_dimensions_1(p):
6384 '''dimensions : variable_dimension '''
6385 print('dimensions_1', list(p))
6386 p[0] = p[1]
6387 ()
6388 def p_dimensions_2(p):
6389 '''dimensions : dimensions variable_dimension '''
6390 print('dimensions_2', list(p))
6391 # { list<pform_range_t> *tmp = $1;
6392 # if ($2) {
6393 # tmp->splice(tmp->end(), *$2);
6394 # delete $2;
6395 # }
6396 # $$ = tmp;
6397 # }
6398 ()
6399 def p_register_variable_1(p):
6400 '''register_variable : IDENTIFIER dimensions_opt '''
6401 print('register_variable_1', list(p))
6402 # { perm_string name = lex_strings.make($1);
6403 # pform_makewire(@1, name, NetNet::REG,
6404 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6405 # pform_set_reg_idx(name, $2);
6406 # $$ = $1;
6407 # }
6408 ()
6409 def p_register_variable_2(p):
6410 '''register_variable : IDENTIFIER dimensions_opt '=' expression '''
6411 print('register_variable_2', list(p))
6412 # { if (pform_peek_scope()->var_init_needs_explicit_lifetime()
6413 # && (var_lifetime == LexicalScope::INHERITED)) {
6414 # cerr << @3 << ": warning: Static variable initialization requires "
6415 # "explicit lifetime in this context." << endl;
6416 # warn_count += 1;
6417 # }
6418 # perm_string name = lex_strings.make($1);
6419 # pform_makewire(@1, name, NetNet::REG,
6420 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6421 # pform_set_reg_idx(name, $2);
6422 # pform_make_var_init(@1, name, $4);
6423 # $$ = $1;
6424 # }
6425 ()
6426 def p_register_variable_list_1(p):
6427 '''register_variable_list : register_variable '''
6428 print('register_variable_list_1', list(p))
6429 # { list<perm_string>*tmp = new list<perm_string>;
6430 # tmp->push_back(lex_strings.make($1));
6431 # $$ = tmp;
6432 # delete[]$1;
6433 # }
6434 ()
6435 def p_register_variable_list_2(p):
6436 '''register_variable_list : register_variable_list ',' register_variable '''
6437 print('register_variable_list_2', list(p))
6438 # { list<perm_string>*tmp = $1;
6439 # tmp->push_back(lex_strings.make($3));
6440 # $$ = tmp;
6441 # delete[]$3;
6442 # }
6443 ()
6444 def p_net_variable_1(p):
6445 '''net_variable : IDENTIFIER dimensions_opt '''
6446 print('net_variable_1', list(p))
6447 # { perm_string name = lex_strings.make($1);
6448 # pform_makewire(@1, name, NetNet::IMPLICIT,
6449 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6450 # pform_set_reg_idx(name, $2);
6451 # $$ = $1;
6452 # }
6453 ()
6454 def p_net_variable_list_1(p):
6455 '''net_variable_list : net_variable '''
6456 print('net_variable_list_1', list(p))
6457 # { list<perm_string>*tmp = new list<perm_string>;
6458 # tmp->push_back(lex_strings.make($1));
6459 # $$ = tmp;
6460 # delete[]$1;
6461 # }
6462 ()
6463 def p_net_variable_list_2(p):
6464 '''net_variable_list : net_variable_list ',' net_variable '''
6465 print('net_variable_list_2', list(p))
6466 # { list<perm_string>*tmp = $1;
6467 # tmp->push_back(lex_strings.make($3));
6468 # $$ = tmp;
6469 # delete[]$3;
6470 # }
6471 ()
6472 def p_event_variable_1(p):
6473 '''event_variable : IDENTIFIER dimensions_opt '''
6474 print('event_variable_1', list(p))
6475 # { if ($2) {
6476 # yyerror(@2, "sorry: event arrays are not supported.");
6477 # delete $2;
6478 # }
6479 # $$ = $1;
6480 # }
6481 ()
6482 def p_event_variable_list_1(p):
6483 '''event_variable_list : event_variable '''
6484 print('event_variable_list_1', list(p))
6485 # { $$ = list_from_identifier($1); }
6486 ()
6487 def p_event_variable_list_2(p):
6488 '''event_variable_list : event_variable_list ',' event_variable '''
6489 print('event_variable_list_2', list(p))
6490 # { $$ = list_from_identifier($1, $3); }
6491 ()
6492 def p_specify_item_1(p):
6493 '''specify_item : K_specparam specparam_decl ';' '''
6494 print('specify_item_1', list(p))
6495 ()
6496 def p_specify_item_2(p):
6497 '''specify_item : specify_simple_path_decl ';' '''
6498 print('specify_item_2', list(p))
6499 # { pform_module_specify_path($1);
6500 # }
6501 ()
6502 def p_specify_item_3(p):
6503 '''specify_item : specify_edge_path_decl ';' '''
6504 print('specify_item_3', list(p))
6505 # { pform_module_specify_path($1);
6506 # }
6507 ()
6508 def p_specify_item_4(p):
6509 '''specify_item : K_if '(' expression ')' specify_simple_path_decl ';' '''
6510 print('specify_item_4', list(p))
6511 # { PSpecPath*tmp = $5;
6512 # if (tmp) {
6513 # tmp->conditional = true;
6514 # tmp->condition = $3;
6515 # }
6516 # pform_module_specify_path(tmp);
6517 # }
6518 ()
6519 def p_specify_item_5(p):
6520 '''specify_item : K_if '(' expression ')' specify_edge_path_decl ';' '''
6521 print('specify_item_5', list(p))
6522 # { PSpecPath*tmp = $5;
6523 # if (tmp) {
6524 # tmp->conditional = true;
6525 # tmp->condition = $3;
6526 # }
6527 # pform_module_specify_path(tmp);
6528 # }
6529 ()
6530 def p_specify_item_6(p):
6531 '''specify_item : K_ifnone specify_simple_path_decl ';' '''
6532 print('specify_item_6', list(p))
6533 # { PSpecPath*tmp = $2;
6534 # if (tmp) {
6535 # tmp->conditional = true;
6536 # tmp->condition = 0;
6537 # }
6538 # pform_module_specify_path(tmp);
6539 # }
6540 ()
6541 def p_specify_item_7(p):
6542 '''specify_item : K_ifnone specify_edge_path_decl ';' '''
6543 print('specify_item_7', list(p))
6544 # { yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
6545 # "not supported.");
6546 # yyerrok;
6547 # }
6548 ()
6549 def p_specify_item_8(p):
6550 '''specify_item : K_Sfullskew '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6551 print('specify_item_8', list(p))
6552 # { delete $7;
6553 # delete $9;
6554 # }
6555 ()
6556 def p_specify_item_9(p):
6557 '''specify_item : K_Shold '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6558 print('specify_item_9', list(p))
6559 # { delete $7;
6560 # }
6561 ()
6562 def p_specify_item_10(p):
6563 '''specify_item : K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6564 print('specify_item_10', list(p))
6565 # { delete $7;
6566 # delete $9;
6567 # }
6568 ()
6569 def p_specify_item_11(p):
6570 '''specify_item : K_Speriod '(' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6571 print('specify_item_11', list(p))
6572 # { delete $5;
6573 # }
6574 ()
6575 def p_specify_item_12(p):
6576 '''specify_item : K_Srecovery '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6577 print('specify_item_12', list(p))
6578 # { delete $7;
6579 # }
6580 ()
6581 def p_specify_item_13(p):
6582 '''specify_item : K_Srecrem '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6583 print('specify_item_13', list(p))
6584 # { delete $7;
6585 # delete $9;
6586 # }
6587 ()
6588 def p_specify_item_14(p):
6589 '''specify_item : K_Sremoval '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6590 print('specify_item_14', list(p))
6591 # { delete $7;
6592 # }
6593 ()
6594 def p_specify_item_15(p):
6595 '''specify_item : K_Ssetup '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6596 print('specify_item_15', list(p))
6597 # { delete $7;
6598 # }
6599 ()
6600 def p_specify_item_16(p):
6601 '''specify_item : K_Ssetuphold '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6602 print('specify_item_16', list(p))
6603 # { delete $7;
6604 # delete $9;
6605 # }
6606 ()
6607 def p_specify_item_17(p):
6608 '''specify_item : K_Sskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6609 print('specify_item_17', list(p))
6610 # { delete $7;
6611 # }
6612 ()
6613 def p_specify_item_18(p):
6614 '''specify_item : K_Stimeskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6615 print('specify_item_18', list(p))
6616 # { delete $7;
6617 # }
6618 ()
6619 def p_specify_item_19(p):
6620 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ',' expression spec_notifier_opt ')' ';' '''
6621 print('specify_item_19', list(p))
6622 # { delete $5;
6623 # delete $7;
6624 # }
6625 ()
6626 def p_specify_item_20(p):
6627 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ')' ';' '''
6628 print('specify_item_20', list(p))
6629 # { delete $5;
6630 # }
6631 ()
6632 def p_specify_item_21(p):
6633 '''specify_item : K_pulsestyle_onevent specify_path_identifiers ';' '''
6634 print('specify_item_21', list(p))
6635 # { delete $2;
6636 # }
6637 ()
6638 def p_specify_item_22(p):
6639 '''specify_item : K_pulsestyle_ondetect specify_path_identifiers ';' '''
6640 print('specify_item_22', list(p))
6641 # { delete $2;
6642 # }
6643 ()
6644 def p_specify_item_23(p):
6645 '''specify_item : K_showcancelled specify_path_identifiers ';' '''
6646 print('specify_item_23', list(p))
6647 # { delete $2;
6648 # }
6649 ()
6650 def p_specify_item_24(p):
6651 '''specify_item : K_noshowcancelled specify_path_identifiers ';' '''
6652 print('specify_item_24', list(p))
6653 # { delete $2;
6654 # }
6655 ()
6656 def p_specify_item_list_1(p):
6657 '''specify_item_list : specify_item '''
6658 print('specify_item_list_1', list(p))
6659 ()
6660 def p_specify_item_list_2(p):
6661 '''specify_item_list : specify_item_list specify_item '''
6662 print('specify_item_list_2', list(p))
6663 ()
6664 def p_specify_item_list_opt_1(p):
6665 '''specify_item_list_opt : '''
6666 print('specify_item_list_opt_1', list(p))
6667 # { }
6668 ()
6669 def p_specify_item_list_opt_2(p):
6670 '''specify_item_list_opt : specify_item_list '''
6671 print('specify_item_list_opt_2', list(p))
6672 # { }
6673 ()
6674 def p_specify_edge_path_decl_1(p):
6675 '''specify_edge_path_decl : specify_edge_path '=' '(' delay_value_list ')' '''
6676 print('specify_edge_path_decl_1', list(p))
6677 # { $$ = pform_assign_path_delay($1, $4); }
6678 ()
6679 def p_specify_edge_path_decl_2(p):
6680 '''specify_edge_path_decl : specify_edge_path '=' delay_value_simple '''
6681 print('specify_edge_path_decl_2', list(p))
6682 # { list<PExpr*>*tmp = new list<PExpr*>;
6683 # tmp->push_back($3);
6684 # $$ = pform_assign_path_delay($1, tmp);
6685 # }
6686 ()
6687 def p_edge_operator_1(p):
6688 '''edge_operator : K_posedge '''
6689 print('edge_operator_1', list(p))
6690 # { $$ = true; }
6691 ()
6692 def p_edge_operator_2(p):
6693 '''edge_operator : K_negedge '''
6694 print('edge_operator_2', list(p))
6695 # { $$ = false; }
6696 ()
6697 def p_specify_edge_path_1(p):
6698 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6699 print('specify_edge_path_1', list(p))
6700 # { int edge_flag = 0;
6701 # $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, false, $6, $8); }
6702 ()
6703 def p_specify_edge_path_2(p):
6704 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6705 print('specify_edge_path_2', list(p))
6706 # { int edge_flag = $2? 1 : -1;
6707 # $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, false, $7, $9);}
6708 ()
6709 def p_specify_edge_path_3(p):
6710 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6711 print('specify_edge_path_3', list(p))
6712 # { int edge_flag = 0;
6713 # $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, true, $6, $8); }
6714 ()
6715 def p_specify_edge_path_4(p):
6716 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6717 print('specify_edge_path_4', list(p))
6718 # { int edge_flag = $2? 1 : -1;
6719 # $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, true, $7, $9); }
6720 ()
6721 def p_polarity_operator_1(p):
6722 '''polarity_operator : K_PO_POS '''
6723 print('polarity_operator_1', list(p))
6724 ()
6725 def p_polarity_operator_2(p):
6726 '''polarity_operator : K_PO_NEG '''
6727 print('polarity_operator_2', list(p))
6728 ()
6729 def p_polarity_operator_3(p):
6730 '''polarity_operator : ':' '''
6731 print('polarity_operator_3', list(p))
6732 ()
6733 def p_specify_simple_path_decl_1(p):
6734 '''specify_simple_path_decl : specify_simple_path '=' '(' delay_value_list ')' '''
6735 print('specify_simple_path_decl_1', list(p))
6736 # { $$ = pform_assign_path_delay($1, $4); }
6737 ()
6738 def p_specify_simple_path_decl_2(p):
6739 '''specify_simple_path_decl : specify_simple_path '=' delay_value_simple '''
6740 print('specify_simple_path_decl_2', list(p))
6741 # { list<PExpr*>*tmp = new list<PExpr*>;
6742 # tmp->push_back($3);
6743 # $$ = pform_assign_path_delay($1, tmp);
6744 # }
6745 ()
6746 def p_specify_simple_path_decl_3(p):
6747 '''specify_simple_path_decl : specify_simple_path '=' '(' error ')' '''
6748 print('specify_simple_path_decl_3', list(p))
6749 # { yyerror(@3, "Syntax error in delay value list.");
6750 # yyerrok;
6751 # $$ = 0;
6752 # }
6753 ()
6754 def p_specify_simple_path_1(p):
6755 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' '''
6756 print('specify_simple_path_1', list(p))
6757 # { $$ = pform_make_specify_path(@1, $2, $3, false, $5); }
6758 ()
6759 def p_specify_simple_path_2(p):
6760 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' '''
6761 print('specify_simple_path_2', list(p))
6762 # { $$ = pform_make_specify_path(@1, $2, $3, true, $5); }
6763 ()
6764 def p_specify_simple_path_3(p):
6765 '''specify_simple_path : '(' error ')' '''
6766 print('specify_simple_path_3', list(p))
6767 # { yyerror(@1, "Invalid simple path");
6768 # yyerrok;
6769 # }
6770 ()
6771 def p_specify_path_identifiers_1(p):
6772 '''specify_path_identifiers : IDENTIFIER '''
6773 print('specify_path_identifiers_1', list(p))
6774 # { list<perm_string>*tmp = new list<perm_string>;
6775 # tmp->push_back(lex_strings.make($1));
6776 # $$ = tmp;
6777 # delete[]$1;
6778 # }
6779 ()
6780 def p_specify_path_identifiers_2(p):
6781 '''specify_path_identifiers : IDENTIFIER '[' expr_primary ']' '''
6782 print('specify_path_identifiers_2', list(p))
6783 # { if (gn_specify_blocks_flag) {
6784 # yywarn(@4, "Bit selects are not currently supported "
6785 # "in path declarations. The declaration "
6786 # "will be applied to the whole vector.");
6787 # }
6788 # list<perm_string>*tmp = new list<perm_string>;
6789 # tmp->push_back(lex_strings.make($1));
6790 # $$ = tmp;
6791 # delete[]$1;
6792 # }
6793 ()
6794 def p_specify_path_identifiers_3(p):
6795 '''specify_path_identifiers : IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6796 print('specify_path_identifiers_3', list(p))
6797 # { if (gn_specify_blocks_flag) {
6798 # yywarn(@4, "Part selects are not currently supported "
6799 # "in path declarations. The declaration "
6800 # "will be applied to the whole vector.");
6801 # }
6802 # list<perm_string>*tmp = new list<perm_string>;
6803 # tmp->push_back(lex_strings.make($1));
6804 # $$ = tmp;
6805 # delete[]$1;
6806 # }
6807 ()
6808 def p_specify_path_identifiers_4(p):
6809 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '''
6810 print('specify_path_identifiers_4', list(p))
6811 # { list<perm_string>*tmp = $1;
6812 # tmp->push_back(lex_strings.make($3));
6813 # $$ = tmp;
6814 # delete[]$3;
6815 # }
6816 ()
6817 def p_specify_path_identifiers_5(p):
6818 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' '''
6819 print('specify_path_identifiers_5', list(p))
6820 # { if (gn_specify_blocks_flag) {
6821 # yywarn(@4, "Bit selects are not currently supported "
6822 # "in path declarations. The declaration "
6823 # "will be applied to the whole vector.");
6824 # }
6825 # list<perm_string>*tmp = $1;
6826 # tmp->push_back(lex_strings.make($3));
6827 # $$ = tmp;
6828 # delete[]$3;
6829 # }
6830 ()
6831 def p_specify_path_identifiers_6(p):
6832 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6833 print('specify_path_identifiers_6', list(p))
6834 # { if (gn_specify_blocks_flag) {
6835 # yywarn(@4, "Part selects are not currently supported "
6836 # "in path declarations. The declaration "
6837 # "will be applied to the whole vector.");
6838 # }
6839 # list<perm_string>*tmp = $1;
6840 # tmp->push_back(lex_strings.make($3));
6841 # $$ = tmp;
6842 # delete[]$3;
6843 # }
6844 ()
6845 def p_specparam_1(p):
6846 '''specparam : IDENTIFIER '=' expression '''
6847 print('specparam_1', list(p))
6848 # { PExpr*tmp = $3;
6849 # pform_set_specparam(@1, lex_strings.make($1),
6850 # param_active_range, tmp);
6851 # delete[]$1;
6852 # }
6853 ()
6854 def p_specparam_2(p):
6855 '''specparam : IDENTIFIER '=' expression ':' expression ':' expression '''
6856 print('specparam_2', list(p))
6857 # { PExpr*tmp = 0;
6858 # switch (min_typ_max_flag) {
6859 # case MIN:
6860 # tmp = $3;
6861 # delete $5;
6862 # delete $7;
6863 # break;
6864 # case TYP:
6865 # delete $3;
6866 # tmp = $5;
6867 # delete $7;
6868 # break;
6869 # case MAX:
6870 # delete $3;
6871 # delete $5;
6872 # tmp = $7;
6873 # break;
6874 # }
6875 # if (min_typ_max_warn > 0) {
6876 # cerr << tmp->get_fileline() << ": warning: choosing ";
6877 # switch (min_typ_max_flag) {
6878 # case MIN:
6879 # cerr << "min";
6880 # break;
6881 # case TYP:
6882 # cerr << "typ";
6883 # break;
6884 # case MAX:
6885 # cerr << "max";
6886 # break;
6887 # }
6888 # cerr << " expression." << endl;
6889 # min_typ_max_warn -= 1;
6890 # }
6891 # pform_set_specparam(@1, lex_strings.make($1),
6892 # param_active_range, tmp);
6893 # delete[]$1;
6894 # }
6895 ()
6896 def p_specparam_3(p):
6897 '''specparam : PATHPULSE_IDENTIFIER '=' expression '''
6898 print('specparam_3', list(p))
6899 # { delete[]$1;
6900 # delete $3;
6901 # }
6902 ()
6903 def p_specparam_4(p):
6904 '''specparam : PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' '''
6905 print('specparam_4', list(p))
6906 # { delete[]$1;
6907 # delete $4;
6908 # delete $6;
6909 # }
6910 ()
6911 def p_specparam_list_1(p):
6912 '''specparam_list : specparam '''
6913 print('specparam_list_1', list(p))
6914 ()
6915 def p_specparam_list_2(p):
6916 '''specparam_list : specparam_list ',' specparam '''
6917 print('specparam_list_2', list(p))
6918 ()
6919 def p_specparam_decl_1(p):
6920 '''specparam_decl : specparam_list '''
6921 print('specparam_decl_1', list(p))
6922 ()
6923 def p_specparam_decl_2(p):
6924 '''specparam_decl : dimensions _embed0_specparam_decl specparam_list '''
6925 print('specparam_decl_2', list(p))
6926 # { param_active_range = 0; }
6927 ()
6928 def p__embed0_specparam_decl(p):
6929 '''_embed0_specparam_decl : '''
6930 # { param_active_range = $1; }
6931 ()
6932 def p_spec_polarity_1(p):
6933 '''spec_polarity : '+' '''
6934 print('spec_polarity_1', list(p))
6935 # { $$ = '+'; }
6936 ()
6937 def p_spec_polarity_2(p):
6938 '''spec_polarity : '-' '''
6939 print('spec_polarity_2', list(p))
6940 # { $$ = '-'; }
6941 ()
6942 def p_spec_polarity_3(p):
6943 '''spec_polarity : '''
6944 print('spec_polarity_3', list(p))
6945 # { $$ = 0; }
6946 ()
6947 def p_spec_reference_event_1(p):
6948 '''spec_reference_event : K_posedge expression '''
6949 print('spec_reference_event_1', list(p))
6950 # { delete $2; }
6951 ()
6952 def p_spec_reference_event_2(p):
6953 '''spec_reference_event : K_negedge expression '''
6954 print('spec_reference_event_2', list(p))
6955 # { delete $2; }
6956 ()
6957 def p_spec_reference_event_3(p):
6958 '''spec_reference_event : K_posedge expr_primary K_TAND expression '''
6959 print('spec_reference_event_3', list(p))
6960 # { delete $2;
6961 # delete $4;
6962 # }
6963 ()
6964 def p_spec_reference_event_4(p):
6965 '''spec_reference_event : K_negedge expr_primary K_TAND expression '''
6966 print('spec_reference_event_4', list(p))
6967 # { delete $2;
6968 # delete $4;
6969 # }
6970 ()
6971 def p_spec_reference_event_5(p):
6972 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary '''
6973 print('spec_reference_event_5', list(p))
6974 # { delete $5; }
6975 ()
6976 def p_spec_reference_event_6(p):
6977 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression '''
6978 print('spec_reference_event_6', list(p))
6979 # { delete $5;
6980 # delete $7;
6981 # }
6982 ()
6983 def p_spec_reference_event_7(p):
6984 '''spec_reference_event : expr_primary K_TAND expression '''
6985 print('spec_reference_event_7', list(p))
6986 # { delete $1;
6987 # delete $3;
6988 # }
6989 ()
6990 def p_spec_reference_event_8(p):
6991 '''spec_reference_event : expr_primary '''
6992 print('spec_reference_event_8', list(p))
6993 # { delete $1; }
6994 ()
6995 def p_edge_descriptor_list_1(p):
6996 '''edge_descriptor_list : edge_descriptor_list ',' K_edge_descriptor '''
6997 print('edge_descriptor_list_1', list(p))
6998 ()
6999 def p_edge_descriptor_list_2(p):
7000 '''edge_descriptor_list : K_edge_descriptor '''
7001 print('edge_descriptor_list_2', list(p))
7002 ()
7003 def p_spec_notifier_opt_1(p):
7004 '''spec_notifier_opt : '''
7005 print('spec_notifier_opt_1', list(p))
7006 # { }
7007 ()
7008 def p_spec_notifier_opt_2(p):
7009 '''spec_notifier_opt : spec_notifier '''
7010 print('spec_notifier_opt_2', list(p))
7011 # { }
7012 ()
7013 def p_spec_notifier_1(p):
7014 '''spec_notifier : ',' '''
7015 print('spec_notifier_1', list(p))
7016 # { args_after_notifier = 0; }
7017 ()
7018 def p_spec_notifier_2(p):
7019 '''spec_notifier : ',' hierarchy_identifier '''
7020 print('spec_notifier_2', list(p))
7021 # { args_after_notifier = 0; delete $2; }
7022 ()
7023 def p_spec_notifier_3(p):
7024 '''spec_notifier : spec_notifier ',' '''
7025 print('spec_notifier_3', list(p))
7026 # { args_after_notifier += 1; }
7027 ()
7028 def p_spec_notifier_4(p):
7029 '''spec_notifier : spec_notifier ',' hierarchy_identifier '''
7030 print('spec_notifier_4', list(p))
7031 # { args_after_notifier += 1;
7032 # if (args_after_notifier >= 3) {
7033 # cerr << @3 << ": warning: timing checks are not supported "
7034 # "and delayed signal \"" << *$3
7035 # << "\" will not be driven." << endl;
7036 # }
7037 # delete $3; }
7038 ()
7039 def p_spec_notifier_5(p):
7040 '''spec_notifier : IDENTIFIER '''
7041 print('spec_notifier_5', list(p))
7042 # { args_after_notifier = 0; delete[]$1; }
7043 ()
7044 def p_statement_item_1(p):
7045 '''statement_item : K_assign lpvalue '=' expression ';' '''
7046 print('statement_item_1', list(p))
7047 # { PCAssign*tmp = new PCAssign($2, $4);
7048 # FILE_NAME(tmp, @1);
7049 # $$ = tmp;
7050 # }
7051 ()
7052 def p_statement_item_2(p):
7053 '''statement_item : K_deassign lpvalue ';' '''
7054 print('statement_item_2', list(p))
7055 # { PDeassign*tmp = new PDeassign($2);
7056 # FILE_NAME(tmp, @1);
7057 # $$ = tmp;
7058 # }
7059 ()
7060 def p_statement_item_3(p):
7061 '''statement_item : K_force lpvalue '=' expression ';' '''
7062 print('statement_item_3', list(p))
7063 # { PForce*tmp = new PForce($2, $4);
7064 # FILE_NAME(tmp, @1);
7065 # $$ = tmp;
7066 # }
7067 ()
7068 def p_statement_item_4(p):
7069 '''statement_item : K_release lpvalue ';' '''
7070 print('statement_item_4', list(p))
7071 # { PRelease*tmp = new PRelease($2);
7072 # FILE_NAME(tmp, @1);
7073 # $$ = tmp;
7074 # }
7075 ()
7076 def p_statement_item_5(p):
7077 '''statement_item : K_begin K_end '''
7078 print('statement_item_5', list(p))
7079 # { PBlock*tmp = new PBlock(PBlock::BL_SEQ);
7080 # FILE_NAME(tmp, @1);
7081 # $$ = tmp;
7082 # }
7083 ()
7084 def p_statement_item_6(p):
7085 '''statement_item : K_begin _embed0_statement_item block_item_decls_opt _embed1_statement_item statement_or_null_list K_end '''
7086 print('statement_item_6', list(p))
7087 # { PBlock*tmp;
7088 # if ($3) {
7089 # pform_pop_scope();
7090 # assert(! current_block_stack.empty());
7091 # tmp = current_block_stack.top();
7092 # current_block_stack.pop();
7093 # } else {
7094 # tmp = new PBlock(PBlock::BL_SEQ);
7095 # FILE_NAME(tmp, @1);
7096 # }
7097 # if ($5) tmp->set_statement(*$5);
7098 # delete $5;
7099 # $$ = tmp;
7100 # }
7101 ()
7102 def p_statement_item_7(p):
7103 '''statement_item : K_begin ':' IDENTIFIER _embed2_statement_item block_item_decls_opt statement_or_null_list_opt K_end endlabel_opt '''
7104 print('statement_item_7', list(p))
7105 # { pform_pop_scope();
7106 # assert(! current_block_stack.empty());
7107 # PBlock*tmp = current_block_stack.top();
7108 # current_block_stack.pop();
7109 # if ($6) tmp->set_statement(*$6);
7110 # delete $6;
7111 # if ($8) {
7112 # if (strcmp($3,$8) != 0) {
7113 # yyerror(@8, "error: End label doesn't match begin name");
7114 # }
7115 # if (! gn_system_verilog()) {
7116 # yyerror(@8, "error: Begin end labels require "
7117 # "SystemVerilog.");
7118 # }
7119 # delete[]$8;
7120 # }
7121 # delete[]$3;
7122 # $$ = tmp;
7123 # }
7124 ()
7125 def p_statement_item_8(p):
7126 '''statement_item : K_fork join_keyword '''
7127 print('statement_item_8', list(p))
7128 # { PBlock*tmp = new PBlock($2);
7129 # FILE_NAME(tmp, @1);
7130 # $$ = tmp;
7131 # }
7132 ()
7133 def p_statement_item_9(p):
7134 '''statement_item : K_fork _embed3_statement_item block_item_decls_opt _embed4_statement_item statement_or_null_list join_keyword '''
7135 print('statement_item_9', list(p))
7136 # { PBlock*tmp;
7137 # if ($3) {
7138 # pform_pop_scope();
7139 # assert(! current_block_stack.empty());
7140 # tmp = current_block_stack.top();
7141 # current_block_stack.pop();
7142 # tmp->set_join_type($6);
7143 # } else {
7144 # tmp = new PBlock($6);
7145 # FILE_NAME(tmp, @1);
7146 # }
7147 # if ($5) tmp->set_statement(*$5);
7148 # delete $5;
7149 # $$ = tmp;
7150 # }
7151 ()
7152 def p_statement_item_10(p):
7153 '''statement_item : K_fork ':' IDENTIFIER _embed5_statement_item block_item_decls_opt statement_or_null_list_opt join_keyword endlabel_opt '''
7154 print('statement_item_10', list(p))
7155 # { pform_pop_scope();
7156 # assert(! current_block_stack.empty());
7157 # PBlock*tmp = current_block_stack.top();
7158 # current_block_stack.pop();
7159 # tmp->set_join_type($7);
7160 # if ($6) tmp->set_statement(*$6);
7161 # delete $6;
7162 # if ($8) {
7163 # if (strcmp($3,$8) != 0) {
7164 # yyerror(@8, "error: End label doesn't match fork name");
7165 # }
7166 # if (! gn_system_verilog()) {
7167 # yyerror(@8, "error: Fork end labels require "
7168 # "SystemVerilog.");
7169 # }
7170 # delete[]$8;
7171 # }
7172 # delete[]$3;
7173 # $$ = tmp;
7174 # }
7175 ()
7176 def p_statement_item_11(p):
7177 '''statement_item : K_disable hierarchy_identifier ';' '''
7178 print('statement_item_11', list(p))
7179 # { PDisable*tmp = new PDisable(*$2);
7180 # FILE_NAME(tmp, @1);
7181 # delete $2;
7182 # $$ = tmp;
7183 # }
7184 ()
7185 def p_statement_item_12(p):
7186 '''statement_item : K_disable K_fork ';' '''
7187 print('statement_item_12', list(p))
7188 # { pform_name_t tmp_name;
7189 # PDisable*tmp = new PDisable(tmp_name);
7190 # FILE_NAME(tmp, @1);
7191 # $$ = tmp;
7192 # }
7193 ()
7194 def p_statement_item_13(p):
7195 '''statement_item : K_TRIGGER hierarchy_identifier ';' '''
7196 print('statement_item_13', list(p))
7197 # { PTrigger*tmp = new PTrigger(*$2);
7198 # FILE_NAME(tmp, @1);
7199 # delete $2;
7200 # $$ = tmp;
7201 # }
7202 ()
7203 def p_statement_item_14(p):
7204 '''statement_item : procedural_assertion_statement '''
7205 print('statement_item_14', list(p))
7206 p[0] = p[1]
7207 ()
7208 def p_statement_item_15(p):
7209 '''statement_item : loop_statement '''
7210 print('statement_item_15', list(p))
7211 p[0] = p[1]
7212 ()
7213 def p_statement_item_16(p):
7214 '''statement_item : jump_statement '''
7215 print('statement_item_16', list(p))
7216 p[0] = p[1]
7217 ()
7218 def p_statement_item_17(p):
7219 '''statement_item : K_case '(' expression ')' case_items K_endcase '''
7220 print('statement_item_17', list(p))
7221 # { PCase*tmp = new PCase(NetCase::EQ, $3, $5);
7222 # FILE_NAME(tmp, @1);
7223 # $$ = tmp;
7224 # }
7225 ()
7226 def p_statement_item_18(p):
7227 '''statement_item : K_casex '(' expression ')' case_items K_endcase '''
7228 print('statement_item_18', list(p))
7229 # { PCase*tmp = new PCase(NetCase::EQX, $3, $5);
7230 # FILE_NAME(tmp, @1);
7231 # $$ = tmp;
7232 # }
7233 ()
7234 def p_statement_item_19(p):
7235 '''statement_item : K_casez '(' expression ')' case_items K_endcase '''
7236 print('statement_item_19', list(p))
7237 # { PCase*tmp = new PCase(NetCase::EQZ, $3, $5);
7238 # FILE_NAME(tmp, @1);
7239 # $$ = tmp;
7240 # }
7241 ()
7242 def p_statement_item_20(p):
7243 '''statement_item : K_case '(' expression ')' error K_endcase '''
7244 print('statement_item_20', list(p))
7245 # { yyerrok; }
7246 ()
7247 def p_statement_item_21(p):
7248 '''statement_item : K_casex '(' expression ')' error K_endcase '''
7249 print('statement_item_21', list(p))
7250 # { yyerrok; }
7251 ()
7252 def p_statement_item_22(p):
7253 '''statement_item : K_casez '(' expression ')' error K_endcase '''
7254 print('statement_item_22', list(p))
7255 # { yyerrok; }
7256 ()
7257 def p_statement_item_23(p):
7258 '''statement_item : K_if '(' expression ')' statement_or_null %prec less_than_K_else '''
7259 print('statement_item_23', list(p))
7260 # { PCondit*tmp = new PCondit($3, $5, 0);
7261 # FILE_NAME(tmp, @1);
7262 # $$ = tmp;
7263 # }
7264 ()
7265 def p_statement_item_24(p):
7266 '''statement_item : K_if '(' expression ')' statement_or_null K_else statement_or_null '''
7267 print('statement_item_24', list(p))
7268 # { PCondit*tmp = new PCondit($3, $5, $7);
7269 # FILE_NAME(tmp, @1);
7270 # $$ = tmp;
7271 # }
7272 ()
7273 def p_statement_item_25(p):
7274 '''statement_item : K_if '(' error ')' statement_or_null %prec less_than_K_else '''
7275 print('statement_item_25', list(p))
7276 # { yyerror(@1, "error: Malformed conditional expression.");
7277 # $$ = $5;
7278 # }
7279 ()
7280 def p_statement_item_26(p):
7281 '''statement_item : K_if '(' error ')' statement_or_null K_else statement_or_null '''
7282 print('statement_item_26', list(p))
7283 # { yyerror(@1, "error: Malformed conditional expression.");
7284 # $$ = $5;
7285 # }
7286 ()
7287 def p_statement_item_27(p):
7288 '''statement_item : compressed_statement ';' '''
7289 print('statement_item_27', list(p))
7290 p[0] = p[1]
7291 ()
7292 def p_statement_item_28(p):
7293 '''statement_item : inc_or_dec_expression ';' '''
7294 print('statement_item_28', list(p))
7295 # { $$ = pform_compressed_assign_from_inc_dec(@1, $1); }
7296 ()
7297 def p_statement_item_29(p):
7298 '''statement_item : delay1 statement_or_null '''
7299 print('statement_item_29', list(p))
7300 # { PExpr*del = $1->front();
7301 # assert($1->size() == 1);
7302 # delete $1;
7303 # PDelayStatement*tmp = new PDelayStatement(del, $2);
7304 # FILE_NAME(tmp, @1);
7305 # $$ = tmp;
7306 # }
7307 ()
7308 def p_statement_item_30(p):
7309 '''statement_item : event_control statement_or_null '''
7310 print('statement_item_30', list(p))
7311 # { PEventStatement*tmp = $1;
7312 # if (tmp == 0) {
7313 # yyerror(@1, "error: Invalid event control.");
7314 # $$ = 0;
7315 # } else {
7316 # tmp->set_statement($2);
7317 # $$ = tmp;
7318 # }
7319 # }
7320 ()
7321 def p_statement_item_31(p):
7322 '''statement_item : '@' '*' statement_or_null '''
7323 print('statement_item_31', list(p))
7324 # { PEventStatement*tmp = new PEventStatement;
7325 # FILE_NAME(tmp, @1);
7326 # tmp->set_statement($3);
7327 # $$ = tmp;
7328 # }
7329 ()
7330 def p_statement_item_32(p):
7331 '''statement_item : '@' '(' '*' ')' statement_or_null '''
7332 print('statement_item_32', list(p))
7333 # { PEventStatement*tmp = new PEventStatement;
7334 # FILE_NAME(tmp, @1);
7335 # tmp->set_statement($5);
7336 # $$ = tmp;
7337 # }
7338 ()
7339 def p_statement_item_33(p):
7340 '''statement_item : lpvalue '=' expression ';' '''
7341 print('statement_item33', list(p))
7342 if p[3]:
7343 expr = Node(syms.expr_stmt, [p[1], Leaf(token.EQUAL, p[2]), p[3] ])
7344 print ("expr TODO", repr(expr))
7345 else:
7346 expr = Node(syms.expr_stmt, [p[1], Leaf(token.EQUAL, p[2]), ])
7347 print ("expr", repr(expr))
7348 print ("expr (python):'%s'" % expr)
7349 p[0] = expr
7350 # { PAssign*tmp = new PAssign($1,$3);
7351 # FILE_NAME(tmp, @1);
7352 # $$ = tmp;
7353 # }
7354 ()
7355 def p_statement_item_34(p):
7356 '''statement_item : error '=' expression ';' '''
7357 print('statement_item_34', list(p))
7358 # { yyerror(@2, "Syntax in assignment statement l-value.");
7359 # yyerrok;
7360 # $$ = new PNoop;
7361 # }
7362 ()
7363 def p_statement_item_35(p):
7364 '''statement_item : lpvalue K_LE expression ';' '''
7365 print('statement_item_35', list(p))
7366 # { PAssignNB*tmp = new PAssignNB($1,$3);
7367 # FILE_NAME(tmp, @1);
7368 # $$ = tmp;
7369 # }
7370 ()
7371 def p_statement_item_36(p):
7372 '''statement_item : error K_LE expression ';' '''
7373 print('statement_item_36', list(p))
7374 # { yyerror(@2, "Syntax in assignment statement l-value.");
7375 # yyerrok;
7376 # $$ = new PNoop;
7377 # }
7378 ()
7379 def p_statement_item_37(p):
7380 '''statement_item : lpvalue '=' delay1 expression ';' '''
7381 print('statement_item_37', list(p))
7382 # { PExpr*del = $3->front(); $3->pop_front();
7383 # assert($3->empty());
7384 # PAssign*tmp = new PAssign($1,del,$4);
7385 # FILE_NAME(tmp, @1);
7386 # $$ = tmp;
7387 # }
7388 ()
7389 def p_statement_item_38(p):
7390 '''statement_item : lpvalue K_LE delay1 expression ';' '''
7391 print('statement_item_38', list(p))
7392 # { PExpr*del = $3->front(); $3->pop_front();
7393 # assert($3->empty());
7394 # PAssignNB*tmp = new PAssignNB($1,del,$4);
7395 # FILE_NAME(tmp, @1);
7396 # $$ = tmp;
7397 # }
7398 ()
7399 def p_statement_item_39(p):
7400 '''statement_item : lpvalue '=' event_control expression ';' '''
7401 print('statement_item_39', list(p))
7402 # { PAssign*tmp = new PAssign($1,0,$3,$4);
7403 # FILE_NAME(tmp, @1);
7404 # $$ = tmp;
7405 # }
7406 ()
7407 def p_statement_item_40(p):
7408 '''statement_item : lpvalue '=' K_repeat '(' expression ')' event_control expression ';' '''
7409 print('statement_item_40', list(p))
7410 # { PAssign*tmp = new PAssign($1,$5,$7,$8);
7411 # FILE_NAME(tmp,@1);
7412 # tmp->set_lineno(@1.first_line);
7413 # $$ = tmp;
7414 # }
7415 ()
7416 def p_statement_item_41(p):
7417 '''statement_item : lpvalue K_LE event_control expression ';' '''
7418 print('statement_item_41', list(p))
7419 # { PAssignNB*tmp = new PAssignNB($1,0,$3,$4);
7420 # FILE_NAME(tmp, @1);
7421 # $$ = tmp;
7422 # }
7423 ()
7424 def p_statement_item_42(p):
7425 '''statement_item : lpvalue K_LE K_repeat '(' expression ')' event_control expression ';' '''
7426 print('statement_item_42', list(p))
7427 # { PAssignNB*tmp = new PAssignNB($1,$5,$7,$8);
7428 # FILE_NAME(tmp, @1);
7429 # $$ = tmp;
7430 # }
7431 ()
7432 def p_statement_item_43(p):
7433 '''statement_item : lpvalue '=' dynamic_array_new ';' '''
7434 print('statement_item_43', list(p))
7435 # { PAssign*tmp = new PAssign($1,$3);
7436 # FILE_NAME(tmp, @1);
7437 # $$ = tmp;
7438 # }
7439 ()
7440 def p_statement_item_44(p):
7441 '''statement_item : lpvalue '=' class_new ';' '''
7442 print('statement_item_44', list(p))
7443 # { PAssign*tmp = new PAssign($1,$3);
7444 # FILE_NAME(tmp, @1);
7445 # $$ = tmp;
7446 # }
7447 ()
7448 def p_statement_item_45(p):
7449 '''statement_item : K_wait '(' expression ')' statement_or_null '''
7450 print('statement_item_45', list(p))
7451 # { PEventStatement*tmp;
7452 # PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, $3);
7453 # tmp = new PEventStatement(etmp);
7454 # FILE_NAME(tmp,@1);
7455 # tmp->set_statement($5);
7456 # $$ = tmp;
7457 # }
7458 ()
7459 def p_statement_item_46(p):
7460 '''statement_item : K_wait K_fork ';' '''
7461 print('statement_item_46', list(p))
7462 # { PEventStatement*tmp = new PEventStatement((PEEvent*)0);
7463 # FILE_NAME(tmp,@1);
7464 # $$ = tmp;
7465 # }
7466 ()
7467 def p_statement_item_47(p):
7468 '''statement_item : SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';' '''
7469 print('statement_item_47', list(p))
7470 # { PCallTask*tmp = new PCallTask(lex_strings.make($1), *$3);
7471 # FILE_NAME(tmp,@1);
7472 # delete[]$1;
7473 # delete $3;
7474 # $$ = tmp;
7475 # }
7476 ()
7477 def p_statement_item_48(p):
7478 '''statement_item : SYSTEM_IDENTIFIER ';' '''
7479 print('statement_item_48', list(p))
7480 # { list<PExpr*>pt;
7481 # PCallTask*tmp = new PCallTask(lex_strings.make($1), pt);
7482 # FILE_NAME(tmp,@1);
7483 # delete[]$1;
7484 # $$ = tmp;
7485 # }
7486 ()
7487 def p_statement_item_49(p):
7488 '''statement_item : hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7489 print('statement_item_49', list(p))
7490 # { PCallTask*tmp = pform_make_call_task(@1, *$1, *$3);
7491 # delete $1;
7492 # delete $3;
7493 # $$ = tmp;
7494 # }
7495 ()
7496 def p_statement_item_50(p):
7497 '''statement_item : hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';' '''
7498 print('statement_item_50', list(p))
7499 # { /* ....randomize with { <constraints> } */
7500 # if ($1 && peek_tail_name(*$1) == "randomize") {
7501 # if (!gn_system_verilog())
7502 # yyerror(@2, "error: Randomize with constraint requires SystemVerilog.");
7503 # else
7504 # yyerror(@2, "sorry: Randomize with constraint not supported.");
7505 # } else {
7506 # yyerror(@2, "error: Constraint block can only be applied to randomize method.");
7507 # }
7508 # list<PExpr*>pt;
7509 # PCallTask*tmp = new PCallTask(*$1, pt);
7510 # FILE_NAME(tmp, @1);
7511 # delete $1;
7512 # $$ = tmp;
7513 # }
7514 ()
7515 def p_statement_item_51(p):
7516 '''statement_item : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7517 print('statement_item_51', list(p))
7518 # { pform_name_t*t_name = $1;
7519 # while (! $3->empty()) {
7520 # t_name->push_back($3->front());
7521 # $3->pop_front();
7522 # }
7523 # PCallTask*tmp = new PCallTask(*t_name, *$5);
7524 # FILE_NAME(tmp, @1);
7525 # delete $1;
7526 # delete $3;
7527 # delete $5;
7528 # $$ = tmp;
7529 # }
7530 ()
7531 def p_statement_item_52(p):
7532 '''statement_item : hierarchy_identifier ';' '''
7533 print('statement_item_52', list(p))
7534 # { list<PExpr*>pt;
7535 # PCallTask*tmp = pform_make_call_task(@1, *$1, pt);
7536 # delete $1;
7537 # $$ = tmp;
7538 # }
7539 ()
7540 def p_statement_item_53(p):
7541 '''statement_item : implicit_class_handle '.' K_new '(' expression_list_with_nuls ')' ';' '''
7542 print('statement_item_53', list(p))
7543 # { PChainConstructor*tmp = new PChainConstructor(*$5);
7544 # FILE_NAME(tmp, @3);
7545 # delete $1;
7546 # $$ = tmp;
7547 # }
7548 ()
7549 def p_statement_item_54(p):
7550 '''statement_item : hierarchy_identifier '(' error ')' ';' '''
7551 print('statement_item_54', list(p))
7552 # { yyerror(@3, "error: Syntax error in task arguments.");
7553 # list<PExpr*>pt;
7554 # PCallTask*tmp = pform_make_call_task(@1, *$1, pt);
7555 # delete $1;
7556 # $$ = tmp;
7557 # }
7558 ()
7559 def p_statement_item_55(p):
7560 '''statement_item : error ';' '''
7561 print('statement_item_55', list(p))
7562 # { yyerror(@2, "error: malformed statement");
7563 # yyerrok;
7564 # $$ = new PNoop;
7565 # }
7566 ()
7567 def p__embed0_statement_item(p):
7568 '''_embed0_statement_item : '''
7569 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_SEQ);
7570 # FILE_NAME(tmp, @1);
7571 # current_block_stack.push(tmp);
7572 # }
7573 ()
7574 def p__embed1_statement_item(p):
7575 '''_embed1_statement_item : '''
7576 # { if ($3) {
7577 # if (! gn_system_verilog()) {
7578 # yyerror("error: Variable declaration in unnamed block "
7579 # "requires SystemVerilog.");
7580 # }
7581 # } else {
7582 # /* If there are no declarations in the scope then just delete it. */
7583 # pform_pop_scope();
7584 # assert(! current_block_stack.empty());
7585 # PBlock*tmp = current_block_stack.top();
7586 # current_block_stack.pop();
7587 # delete tmp;
7588 # }
7589 # }
7590 ()
7591 def p__embed2_statement_item(p):
7592 '''_embed2_statement_item : '''
7593 # { PBlock*tmp = pform_push_block_scope($3, PBlock::BL_SEQ);
7594 # FILE_NAME(tmp, @1);
7595 # current_block_stack.push(tmp);
7596 # }
7597 ()
7598 def p__embed3_statement_item(p):
7599 '''_embed3_statement_item : '''
7600 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
7601 # FILE_NAME(tmp, @1);
7602 # current_block_stack.push(tmp);
7603 # }
7604 ()
7605 def p__embed4_statement_item(p):
7606 '''_embed4_statement_item : '''
7607 # { if ($3) {
7608 # if (! gn_system_verilog()) {
7609 # yyerror("error: Variable declaration in unnamed block "
7610 # "requires SystemVerilog.");
7611 # }
7612 # } else {
7613 # /* If there are no declarations in the scope then just delete it. */
7614 # pform_pop_scope();
7615 # assert(! current_block_stack.empty());
7616 # PBlock*tmp = current_block_stack.top();
7617 # current_block_stack.pop();
7618 # delete tmp;
7619 # }
7620 # }
7621 ()
7622 def p__embed5_statement_item(p):
7623 '''_embed5_statement_item : '''
7624 # { PBlock*tmp = pform_push_block_scope($3, PBlock::BL_PAR);
7625 # FILE_NAME(tmp, @1);
7626 # current_block_stack.push(tmp);
7627 # }
7628 ()
7629 def p_compressed_statement_1(p):
7630 '''compressed_statement : lpvalue K_PLUS_EQ expression '''
7631 print('compressed_statement_1', list(p))
7632 # { PAssign*tmp = new PAssign($1, '+', $3);
7633 # FILE_NAME(tmp, @1);
7634 # $$ = tmp;
7635 # }
7636 ()
7637 def p_compressed_statement_2(p):
7638 '''compressed_statement : lpvalue K_MINUS_EQ expression '''
7639 print('compressed_statement_2', list(p))
7640 # { PAssign*tmp = new PAssign($1, '-', $3);
7641 # FILE_NAME(tmp, @1);
7642 # $$ = tmp;
7643 # }
7644 ()
7645 def p_compressed_statement_3(p):
7646 '''compressed_statement : lpvalue K_MUL_EQ expression '''
7647 print('compressed_statement_3', list(p))
7648 # { PAssign*tmp = new PAssign($1, '*', $3);
7649 # FILE_NAME(tmp, @1);
7650 # $$ = tmp;
7651 # }
7652 ()
7653 def p_compressed_statement_4(p):
7654 '''compressed_statement : lpvalue K_DIV_EQ expression '''
7655 print('compressed_statement_4', list(p))
7656 # { PAssign*tmp = new PAssign($1, '/', $3);
7657 # FILE_NAME(tmp, @1);
7658 # $$ = tmp;
7659 # }
7660 ()
7661 def p_compressed_statement_5(p):
7662 '''compressed_statement : lpvalue K_MOD_EQ expression '''
7663 print('compressed_statement_5', list(p))
7664 # { PAssign*tmp = new PAssign($1, '%', $3);
7665 # FILE_NAME(tmp, @1);
7666 # $$ = tmp;
7667 # }
7668 ()
7669 def p_compressed_statement_6(p):
7670 '''compressed_statement : lpvalue K_AND_EQ expression '''
7671 print('compressed_statement_6', list(p))
7672 # { PAssign*tmp = new PAssign($1, '&', $3);
7673 # FILE_NAME(tmp, @1);
7674 # $$ = tmp;
7675 # }
7676 ()
7677 def p_compressed_statement_7(p):
7678 '''compressed_statement : lpvalue K_OR_EQ expression '''
7679 print('compressed_statement_7', list(p))
7680 # { PAssign*tmp = new PAssign($1, '|', $3);
7681 # FILE_NAME(tmp, @1);
7682 # $$ = tmp;
7683 # }
7684 ()
7685 def p_compressed_statement_8(p):
7686 '''compressed_statement : lpvalue K_XOR_EQ expression '''
7687 print('compressed_statement_8', list(p))
7688 # { PAssign*tmp = new PAssign($1, '^', $3);
7689 # FILE_NAME(tmp, @1);
7690 # $$ = tmp;
7691 # }
7692 ()
7693 def p_compressed_statement_9(p):
7694 '''compressed_statement : lpvalue K_LS_EQ expression '''
7695 print('compressed_statement_9', list(p))
7696 # { PAssign *tmp = new PAssign($1, 'l', $3);
7697 # FILE_NAME(tmp, @1);
7698 # $$ = tmp;
7699 # }
7700 ()
7701 def p_compressed_statement_10(p):
7702 '''compressed_statement : lpvalue K_RS_EQ expression '''
7703 print('compressed_statement_10', list(p))
7704 # { PAssign*tmp = new PAssign($1, 'r', $3);
7705 # FILE_NAME(tmp, @1);
7706 # $$ = tmp;
7707 # }
7708 ()
7709 def p_compressed_statement_11(p):
7710 '''compressed_statement : lpvalue K_RSS_EQ expression '''
7711 print('compressed_statement_11', list(p))
7712 # { PAssign *tmp = new PAssign($1, 'R', $3);
7713 # FILE_NAME(tmp, @1);
7714 # $$ = tmp;
7715 # }
7716 ()
7717 def p_statement_or_null_list_opt_1(p):
7718 '''statement_or_null_list_opt : statement_or_null_list '''
7719 print('statement_or_null_list_opt_1', list(p))
7720 p[0] = p[1]
7721 ()
7722 def p_statement_or_null_list_opt_2(p):
7723 '''statement_or_null_list_opt : '''
7724 print('statement_or_null_list_opt_2', list(p))
7725 # { $$ = 0; }
7726 ()
7727 def p_statement_or_null_list_1(p):
7728 '''statement_or_null_list : statement_or_null_list statement_or_null '''
7729 print('statement_or_null_list_1', list(p))
7730 # { vector<Statement*>*tmp = $1;
7731 # if ($2) tmp->push_back($2);
7732 # $$ = tmp;
7733 # }
7734 ()
7735 def p_statement_or_null_list_2(p):
7736 '''statement_or_null_list : statement_or_null '''
7737 print('statement_or_null_list_2', list(p))
7738 # { vector<Statement*>*tmp = new vector<Statement*>(0);
7739 # if ($1) tmp->push_back($1);
7740 # $$ = tmp;
7741 # }
7742 ()
7743 def p_analog_statement_1(p):
7744 '''analog_statement : branch_probe_expression K_CONTRIBUTE expression ';' '''
7745 print('analog_statement_1', list(p))
7746 # { $$ = pform_contribution_statement(@2, $1, $3); }
7747 ()
7748 def p_task_item_1(p):
7749 '''task_item : block_item_decl '''
7750 print('task_item_1', list(p))
7751 # { $$ = new vector<pform_tf_port_t>(0); }
7752 ()
7753 def p_task_item_2(p):
7754 '''task_item : tf_port_declaration '''
7755 print('task_item_2', list(p))
7756 p[0] = p[1]
7757 ()
7758 def p_task_item_list_1(p):
7759 '''task_item_list : task_item_list task_item '''
7760 print('task_item_list_1', list(p))
7761 # { vector<pform_tf_port_t>*tmp = $1;
7762 # size_t s1 = tmp->size();
7763 # tmp->resize(s1 + $2->size());
7764 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
7765 # tmp->at(s1 + idx) = $2->at(idx);
7766 # delete $2;
7767 # $$ = tmp;
7768 # }
7769 ()
7770 def p_task_item_list_2(p):
7771 '''task_item_list : task_item '''
7772 print('task_item_list_2', list(p))
7773 p[0] = p[1]
7774 ()
7775 def p_task_item_list_opt_1(p):
7776 '''task_item_list_opt : task_item_list '''
7777 print('task_item_list_opt_1', list(p))
7778 p[0] = p[1]
7779 ()
7780 def p_task_item_list_opt_2(p):
7781 '''task_item_list_opt : '''
7782 print('task_item_list_opt_2', list(p))
7783 # { $$ = 0; }
7784 ()
7785 def p_tf_port_list_opt_1(p):
7786 '''tf_port_list_opt : tf_port_list '''
7787 print('tf_port_list_opt_1', list(p))
7788 p[0] = p[1]
7789 ()
7790 def p_tf_port_list_opt_2(p):
7791 '''tf_port_list_opt : '''
7792 print('tf_port_list_opt_2', list(p))
7793 # { $$ = 0; }
7794 ()
7795 def p_udp_body_1(p):
7796 '''udp_body : K_table udp_entry_list K_endtable '''
7797 print('udp_body_1', list(p))
7798 # { lex_end_table();
7799 # $$ = $2;
7800 # }
7801 ()
7802 def p_udp_body_2(p):
7803 '''udp_body : K_table K_endtable '''
7804 print('udp_body_2', list(p))
7805 # { lex_end_table();
7806 # yyerror(@1, "error: Empty UDP table.");
7807 # $$ = 0;
7808 # }
7809 ()
7810 def p_udp_body_3(p):
7811 '''udp_body : K_table error K_endtable '''
7812 print('udp_body_3', list(p))
7813 # { lex_end_table();
7814 # yyerror(@2, "Errors in UDP table");
7815 # yyerrok;
7816 # $$ = 0;
7817 # }
7818 ()
7819 def p_udp_entry_list_1(p):
7820 '''udp_entry_list : udp_comb_entry_list '''
7821 print('udp_entry_list_1', list(p))
7822 ()
7823 def p_udp_entry_list_2(p):
7824 '''udp_entry_list : udp_sequ_entry_list '''
7825 print('udp_entry_list_2', list(p))
7826 ()
7827 def p_udp_comb_entry_1(p):
7828 '''udp_comb_entry : udp_input_list ':' udp_output_sym ';' '''
7829 print('udp_comb_entry_1', list(p))
7830 # { char*tmp = new char[strlen($1)+3];
7831 # strcpy(tmp, $1);
7832 # char*tp = tmp+strlen(tmp);
7833 # *tp++ = ':';
7834 # *tp++ = $3;
7835 # *tp++ = 0;
7836 # delete[]$1;
7837 # $$ = tmp;
7838 # }
7839 ()
7840 def p_udp_comb_entry_list_1(p):
7841 '''udp_comb_entry_list : udp_comb_entry '''
7842 print('udp_comb_entry_list_1', list(p))
7843 # { list<string>*tmp = new list<string>;
7844 # tmp->push_back($1);
7845 # delete[]$1;
7846 # $$ = tmp;
7847 # }
7848 ()
7849 def p_udp_comb_entry_list_2(p):
7850 '''udp_comb_entry_list : udp_comb_entry_list udp_comb_entry '''
7851 print('udp_comb_entry_list_2', list(p))
7852 # { list<string>*tmp = $1;
7853 # tmp->push_back($2);
7854 # delete[]$2;
7855 # $$ = tmp;
7856 # }
7857 ()
7858 def p_udp_sequ_entry_list_1(p):
7859 '''udp_sequ_entry_list : udp_sequ_entry '''
7860 print('udp_sequ_entry_list_1', list(p))
7861 # { list<string>*tmp = new list<string>;
7862 # tmp->push_back($1);
7863 # delete[]$1;
7864 # $$ = tmp;
7865 # }
7866 ()
7867 def p_udp_sequ_entry_list_2(p):
7868 '''udp_sequ_entry_list : udp_sequ_entry_list udp_sequ_entry '''
7869 print('udp_sequ_entry_list_2', list(p))
7870 # { list<string>*tmp = $1;
7871 # tmp->push_back($2);
7872 # delete[]$2;
7873 # $$ = tmp;
7874 # }
7875 ()
7876 def p_udp_sequ_entry_1(p):
7877 '''udp_sequ_entry : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' '''
7878 print('udp_sequ_entry_1', list(p))
7879 # { char*tmp = new char[strlen($1)+5];
7880 # strcpy(tmp, $1);
7881 # char*tp = tmp+strlen(tmp);
7882 # *tp++ = ':';
7883 # *tp++ = $3;
7884 # *tp++ = ':';
7885 # *tp++ = $5;
7886 # *tp++ = 0;
7887 # $$ = tmp;
7888 # }
7889 ()
7890 def p_udp_initial_1(p):
7891 '''udp_initial : K_initial IDENTIFIER '=' number ';' '''
7892 print('udp_initial_1', list(p))
7893 # { PExpr*etmp = new PENumber($4);
7894 # PEIdent*itmp = new PEIdent(lex_strings.make($2));
7895 # PAssign*atmp = new PAssign(itmp, etmp);
7896 # FILE_NAME(atmp, @2);
7897 # delete[]$2;
7898 # $$ = atmp;
7899 # }
7900 ()
7901 def p_udp_init_opt_1(p):
7902 '''udp_init_opt : udp_initial '''
7903 print('udp_init_opt_1', list(p))
7904 p[0] = p[1]
7905 ()
7906 def p_udp_init_opt_2(p):
7907 '''udp_init_opt : '''
7908 print('udp_init_opt_2', list(p))
7909 # { $$ = 0; }
7910 ()
7911 def p_udp_input_list_1(p):
7912 '''udp_input_list : udp_input_sym '''
7913 print('udp_input_list_1', list(p))
7914 # { char*tmp = new char[2];
7915 # tmp[0] = $1;
7916 # tmp[1] = 0;
7917 # $$ = tmp;
7918 # }
7919 ()
7920 def p_udp_input_list_2(p):
7921 '''udp_input_list : udp_input_list udp_input_sym '''
7922 print('udp_input_list_2', list(p))
7923 # { char*tmp = new char[strlen($1)+2];
7924 # strcpy(tmp, $1);
7925 # char*tp = tmp+strlen(tmp);
7926 # *tp++ = $2;
7927 # *tp++ = 0;
7928 # delete[]$1;
7929 # $$ = tmp;
7930 # }
7931 ()
7932 def p_udp_input_sym_1(p):
7933 '''udp_input_sym : '0' '''
7934 print('udp_input_sym_1', list(p))
7935 # { $$ = '0'; }
7936 ()
7937 def p_udp_input_sym_2(p):
7938 '''udp_input_sym : '1' '''
7939 print('udp_input_sym_2', list(p))
7940 # { $$ = '1'; }
7941 ()
7942 def p_udp_input_sym_3(p):
7943 '''udp_input_sym : 'x' '''
7944 print('udp_input_sym_3', list(p))
7945 # { $$ = 'x'; }
7946 ()
7947 def p_udp_input_sym_4(p):
7948 '''udp_input_sym : '?' '''
7949 print('udp_input_sym_4', list(p))
7950 # { $$ = '?'; }
7951 ()
7952 def p_udp_input_sym_5(p):
7953 '''udp_input_sym : 'b' '''
7954 print('udp_input_sym_5', list(p))
7955 # { $$ = 'b'; }
7956 ()
7957 def p_udp_input_sym_6(p):
7958 '''udp_input_sym : '*' '''
7959 print('udp_input_sym_6', list(p))
7960 # { $$ = '*'; }
7961 ()
7962 def p_udp_input_sym_7(p):
7963 '''udp_input_sym : '%' '''
7964 print('udp_input_sym_7', list(p))
7965 # { $$ = '%'; }
7966 ()
7967 def p_udp_input_sym_8(p):
7968 '''udp_input_sym : 'f' '''
7969 print('udp_input_sym_8', list(p))
7970 # { $$ = 'f'; }
7971 ()
7972 def p_udp_input_sym_9(p):
7973 '''udp_input_sym : 'F' '''
7974 print('udp_input_sym_9', list(p))
7975 # { $$ = 'F'; }
7976 ()
7977 def p_udp_input_sym_10(p):
7978 '''udp_input_sym : 'l' '''
7979 print('udp_input_sym_10', list(p))
7980 # { $$ = 'l'; }
7981 ()
7982 def p_udp_input_sym_11(p):
7983 '''udp_input_sym : 'h' '''
7984 print('udp_input_sym_11', list(p))
7985 # { $$ = 'h'; }
7986 ()
7987 def p_udp_input_sym_12(p):
7988 '''udp_input_sym : 'B' '''
7989 print('udp_input_sym_12', list(p))
7990 # { $$ = 'B'; }
7991 ()
7992 def p_udp_input_sym_13(p):
7993 '''udp_input_sym : 'r' '''
7994 print('udp_input_sym_13', list(p))
7995 # { $$ = 'r'; }
7996 ()
7997 def p_udp_input_sym_14(p):
7998 '''udp_input_sym : 'R' '''
7999 print('udp_input_sym_14', list(p))
8000 # { $$ = 'R'; }
8001 ()
8002 def p_udp_input_sym_15(p):
8003 '''udp_input_sym : 'M' '''
8004 print('udp_input_sym_15', list(p))
8005 # { $$ = 'M'; }
8006 ()
8007 def p_udp_input_sym_16(p):
8008 '''udp_input_sym : 'n' '''
8009 print('udp_input_sym_16', list(p))
8010 # { $$ = 'n'; }
8011 ()
8012 def p_udp_input_sym_17(p):
8013 '''udp_input_sym : 'N' '''
8014 print('udp_input_sym_17', list(p))
8015 # { $$ = 'N'; }
8016 ()
8017 def p_udp_input_sym_18(p):
8018 '''udp_input_sym : 'p' '''
8019 print('udp_input_sym_18', list(p))
8020 # { $$ = 'p'; }
8021 ()
8022 def p_udp_input_sym_19(p):
8023 '''udp_input_sym : 'P' '''
8024 print('udp_input_sym_19', list(p))
8025 # { $$ = 'P'; }
8026 ()
8027 def p_udp_input_sym_20(p):
8028 '''udp_input_sym : 'Q' '''
8029 print('udp_input_sym_20', list(p))
8030 # { $$ = 'Q'; }
8031 ()
8032 def p_udp_input_sym_21(p):
8033 '''udp_input_sym : 'q' '''
8034 print('udp_input_sym_21', list(p))
8035 # { $$ = 'q'; }
8036 ()
8037 def p_udp_input_sym_22(p):
8038 '''udp_input_sym : '_' '''
8039 print('udp_input_sym_22', list(p))
8040 # { $$ = '_'; }
8041 ()
8042 def p_udp_input_sym_23(p):
8043 '''udp_input_sym : '+' '''
8044 print('udp_input_sym_23', list(p))
8045 # { $$ = '+'; }
8046 ()
8047 def p_udp_input_sym_24(p):
8048 '''udp_input_sym : DEC_NUMBER '''
8049 print('udp_input_sym_24', list(p))
8050 # { yyerror(@1, "internal error: Input digits parse as decimal number!"); $$ = '0'; }
8051 ()
8052 def p_udp_output_sym_1(p):
8053 '''udp_output_sym : '0' '''
8054 print('udp_output_sym_1', list(p))
8055 # { $$ = '0'; }
8056 ()
8057 def p_udp_output_sym_2(p):
8058 '''udp_output_sym : '1' '''
8059 print('udp_output_sym_2', list(p))
8060 # { $$ = '1'; }
8061 ()
8062 def p_udp_output_sym_3(p):
8063 '''udp_output_sym : 'x' '''
8064 print('udp_output_sym_3', list(p))
8065 # { $$ = 'x'; }
8066 ()
8067 def p_udp_output_sym_4(p):
8068 '''udp_output_sym : '-' '''
8069 print('udp_output_sym_4', list(p))
8070 # { $$ = '-'; }
8071 ()
8072 def p_udp_output_sym_5(p):
8073 '''udp_output_sym : DEC_NUMBER '''
8074 print('udp_output_sym_5', list(p))
8075 # { yyerror(@1, "internal error: Output digits parse as decimal number!"); $$ = '0'; }
8076 ()
8077 def p_udp_port_decl_1(p):
8078 '''udp_port_decl : K_input list_of_identifiers ';' '''
8079 print('udp_port_decl_1', list(p))
8080 # { $$ = pform_make_udp_input_ports($2); }
8081 ()
8082 def p_udp_port_decl_2(p):
8083 '''udp_port_decl : K_output IDENTIFIER ';' '''
8084 print('udp_port_decl_2', list(p))
8085 # { perm_string pname = lex_strings.make($2);
8086 # PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
8087 # vector<PWire*>*tmp = new vector<PWire*>(1);
8088 # (*tmp)[0] = pp;
8089 # $$ = tmp;
8090 # delete[]$2;
8091 # }
8092 ()
8093 def p_udp_port_decl_3(p):
8094 '''udp_port_decl : K_reg IDENTIFIER ';' '''
8095 print('udp_port_decl_3', list(p))
8096 # { perm_string pname = lex_strings.make($2);
8097 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
8098 # vector<PWire*>*tmp = new vector<PWire*>(1);
8099 # (*tmp)[0] = pp;
8100 # $$ = tmp;
8101 # delete[]$2;
8102 # }
8103 ()
8104 def p_udp_port_decl_4(p):
8105 '''udp_port_decl : K_reg K_output IDENTIFIER ';' '''
8106 print('udp_port_decl_4', list(p))
8107 # { perm_string pname = lex_strings.make($3);
8108 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
8109 # vector<PWire*>*tmp = new vector<PWire*>(1);
8110 # (*tmp)[0] = pp;
8111 # $$ = tmp;
8112 # delete[]$3;
8113 # }
8114 ()
8115 def p_udp_port_decls_1(p):
8116 '''udp_port_decls : udp_port_decl '''
8117 print('udp_port_decls_1', list(p))
8118 p[0] = p[1]
8119 ()
8120 def p_udp_port_decls_2(p):
8121 '''udp_port_decls : udp_port_decls udp_port_decl '''
8122 print('udp_port_decls_2', list(p))
8123 # { vector<PWire*>*tmp = $1;
8124 # size_t s1 = $1->size();
8125 # tmp->resize(s1+$2->size());
8126 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
8127 # tmp->at(s1+idx) = $2->at(idx);
8128 # $$ = tmp;
8129 # delete $2;
8130 # }
8131 ()
8132 def p_udp_port_list_1(p):
8133 '''udp_port_list : IDENTIFIER '''
8134 print('udp_port_list_1', list(p))
8135 # { list<perm_string>*tmp = new list<perm_string>;
8136 # tmp->push_back(lex_strings.make($1));
8137 # delete[]$1;
8138 # $$ = tmp;
8139 # }
8140 ()
8141 def p_udp_port_list_2(p):
8142 '''udp_port_list : udp_port_list ',' IDENTIFIER '''
8143 print('udp_port_list_2', list(p))
8144 # { list<perm_string>*tmp = $1;
8145 # tmp->push_back(lex_strings.make($3));
8146 # delete[]$3;
8147 # $$ = tmp;
8148 # }
8149 ()
8150 def p_udp_reg_opt_1(p):
8151 '''udp_reg_opt : K_reg '''
8152 print('udp_reg_opt_1', list(p))
8153 # { $$ = true; }
8154 ()
8155 def p_udp_reg_opt_2(p):
8156 '''udp_reg_opt : '''
8157 print('udp_reg_opt_2', list(p))
8158 # { $$ = false; }
8159 ()
8160 def p_udp_initial_expr_opt_1(p):
8161 '''udp_initial_expr_opt : '=' expression '''
8162 print('udp_initial_expr_opt_1', list(p))
8163 p[0] = p[2]
8164 ()
8165 def p_udp_initial_expr_opt_2(p):
8166 '''udp_initial_expr_opt : '''
8167 print('udp_initial_expr_opt_2', list(p))
8168 # { $$ = 0; }
8169 ()
8170 def p_udp_input_declaration_list_1(p):
8171 '''udp_input_declaration_list : K_input IDENTIFIER '''
8172 print('udp_input_declaration_list_1', list(p))
8173 # { list<perm_string>*tmp = new list<perm_string>;
8174 # tmp->push_back(lex_strings.make($2));
8175 # $$ = tmp;
8176 # delete[]$2;
8177 # }
8178 ()
8179 def p_udp_input_declaration_list_2(p):
8180 '''udp_input_declaration_list : udp_input_declaration_list ',' K_input IDENTIFIER '''
8181 print('udp_input_declaration_list_2', list(p))
8182 # { list<perm_string>*tmp = $1;
8183 # tmp->push_back(lex_strings.make($4));
8184 # $$ = tmp;
8185 # delete[]$4;
8186 # }
8187 ()
8188 def p_udp_primitive_1(p):
8189 '''udp_primitive : K_primitive IDENTIFIER '(' udp_port_list ')' ';' udp_port_decls udp_init_opt udp_body K_endprimitive endlabel_opt '''
8190 print('udp_primitive_1', list(p))
8191 # { perm_string tmp2 = lex_strings.make($2);
8192 # pform_make_udp(tmp2, $4, $7, $9, $8,
8193 # @2.text, @2.first_line);
8194 # if ($11) {
8195 # if (strcmp($2,$11) != 0) {
8196 # yyerror(@11, "error: End label doesn't match "
8197 # "primitive name");
8198 # }
8199 # if (! gn_system_verilog()) {
8200 # yyerror(@11, "error: Primitive end labels "
8201 # "require SystemVerilog.");
8202 # }
8203 # delete[]$11;
8204 # }
8205 # delete[]$2;
8206 # }
8207 ()
8208 def p_udp_primitive_2(p):
8209 '''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 '''
8210 print('udp_primitive_2', list(p))
8211 # { perm_string tmp2 = lex_strings.make($2);
8212 # perm_string tmp6 = lex_strings.make($6);
8213 # pform_make_udp(tmp2, $5, tmp6, $7, $9, $12,
8214 # @2.text, @2.first_line);
8215 # if ($14) {
8216 # if (strcmp($2,$14) != 0) {
8217 # yyerror(@14, "error: End label doesn't match "
8218 # "primitive name");
8219 # }
8220 # if (! gn_system_verilog()) {
8221 # yyerror(@14, "error: Primitive end labels "
8222 # "require SystemVerilog.");
8223 # }
8224 # delete[]$14;
8225 # }
8226 # delete[]$2;
8227 # delete[]$6;
8228 # }
8229 ()
8230 def p_K_packed_opt_1(p):
8231 '''K_packed_opt : K_packed '''
8232 print('K_packed_opt', list(p))
8233 # { $$ = true; }
8234 ()
8235 def p_K_packed_opt_2(p):
8236 '''K_packed_opt : '''
8237 print('K_packed_opt', list(p))
8238 # { $$ = false; }
8239 ()
8240 def p_K_reg_opt_1(p):
8241 '''K_reg_opt : K_reg '''
8242 print('K_reg_opt', list(p))
8243 # { $$ = true; }
8244 ()
8245 def p_K_reg_opt_2(p):
8246 '''K_reg_opt : '''
8247 print('K_reg_opt', list(p))
8248 # { $$ = false; }
8249 ()
8250 def p_K_static_opt_1(p):
8251 '''K_static_opt : K_static '''
8252 print('K_static_opt', list(p))
8253 # { $$ = true; }
8254 ()
8255 def p_K_static_opt_2(p):
8256 '''K_static_opt : '''
8257 print('K_static_opt', list(p))
8258 # { $$ = false; }
8259 ()
8260
8261 def p_K_virtual_opt_1(p):
8262 '''K_virtual_opt : K_virtual '''
8263 print(p)
8264 # { $$ = true; }
8265 ()
8266 def p_K_virtual_opt_2(p):
8267 '''K_virtual_opt : '''
8268 print(p)
8269 # { $$ = false; }
8270 ()
8271
8272 def p_error(p):
8273 print ("error", p)
8274 exit(0)
8275
8276 yacc.yacc(debug=0)
8277