start adding in module parameters
[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 p[0] = p[1]
3241 ()
3242 def p_expression_2(p):
3243 '''expression : inc_or_dec_expression '''
3244 print('expression_2', list(p))
3245 p[0] = p[1]
3246 ()
3247 def p_expression_3(p):
3248 '''expression : inside_expression '''
3249 print('expression_3', list(p))
3250 p[0] = p[1]
3251 ()
3252 def p_expression_4(p):
3253 '''expression : '+' attribute_list_opt expr_primary %prec UNARY_PREC '''
3254 print('expression_4', list(p))
3255 # { $$ = $3; }
3256 ()
3257 def p_expression_5(p):
3258 '''expression : '-' attribute_list_opt expr_primary %prec UNARY_PREC '''
3259 print('expression_5', list(p))
3260 # { PEUnary*tmp = new PEUnary('-', $3);
3261 # FILE_NAME(tmp, @3);
3262 # $$ = tmp;
3263 # }
3264 ()
3265 def p_expression_6(p):
3266 '''expression : '~' attribute_list_opt expr_primary %prec UNARY_PREC '''
3267 print('expression_6', list(p))
3268 # { PEUnary*tmp = new PEUnary('~', $3);
3269 # FILE_NAME(tmp, @3);
3270 # $$ = tmp;
3271 # }
3272 ()
3273 def p_expression_7(p):
3274 '''expression : '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3275 print('expression_7', list(p))
3276 # { PEUnary*tmp = new PEUnary('&', $3);
3277 # FILE_NAME(tmp, @3);
3278 # $$ = tmp;
3279 # }
3280 ()
3281 def p_expression_8(p):
3282 '''expression : '!' attribute_list_opt expr_primary %prec UNARY_PREC '''
3283 print('expression_8', list(p))
3284 # { PEUnary*tmp = new PEUnary('!', $3);
3285 # FILE_NAME(tmp, @3);
3286 # $$ = tmp;
3287 # }
3288 ()
3289 def p_expression_9(p):
3290 '''expression : '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3291 print('expression_9', list(p))
3292 # { PEUnary*tmp = new PEUnary('|', $3);
3293 # FILE_NAME(tmp, @3);
3294 # $$ = tmp;
3295 # }
3296 ()
3297 def p_expression_10(p):
3298 '''expression : '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3299 print('expression_10', list(p))
3300 # { PEUnary*tmp = new PEUnary('^', $3);
3301 # FILE_NAME(tmp, @3);
3302 # $$ = tmp;
3303 # }
3304 ()
3305 def p_expression_11(p):
3306 '''expression : '~' '&' attribute_list_opt expr_primary %prec UNARY_PREC '''
3307 print('expression_11', list(p))
3308 # { yyerror(@1, "error: '~' '&' is not a valid expression. "
3309 # "Please use operator '~&' instead.");
3310 # $$ = 0;
3311 # }
3312 ()
3313 def p_expression_12(p):
3314 '''expression : '~' '|' attribute_list_opt expr_primary %prec UNARY_PREC '''
3315 print('expression_12', list(p))
3316 # { yyerror(@1, "error: '~' '|' is not a valid expression. "
3317 # "Please use operator '~|' instead.");
3318 # $$ = 0;
3319 # }
3320 ()
3321 def p_expression_13(p):
3322 '''expression : '~' '^' attribute_list_opt expr_primary %prec UNARY_PREC '''
3323 print('expression_13', list(p))
3324 # { yyerror(@1, "error: '~' '^' is not a valid expression. "
3325 # "Please use operator '~^' instead.");
3326 # $$ = 0;
3327 # }
3328 ()
3329 def p_expression_14(p):
3330 '''expression : K_NAND attribute_list_opt expr_primary %prec UNARY_PREC '''
3331 print('expression_14', list(p))
3332 # { PEUnary*tmp = new PEUnary('A', $3);
3333 # FILE_NAME(tmp, @3);
3334 # $$ = tmp;
3335 # }
3336 ()
3337 def p_expression_15(p):
3338 '''expression : K_NOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3339 print('expression_15', list(p))
3340 # { PEUnary*tmp = new PEUnary('N', $3);
3341 # FILE_NAME(tmp, @3);
3342 # $$ = tmp;
3343 # }
3344 ()
3345 def p_expression_16(p):
3346 '''expression : K_NXOR attribute_list_opt expr_primary %prec UNARY_PREC '''
3347 print('expression_16', list(p))
3348 # { PEUnary*tmp = new PEUnary('X', $3);
3349 # FILE_NAME(tmp, @3);
3350 # $$ = tmp;
3351 # }
3352 ()
3353 def p_expression_17(p):
3354 '''expression : '!' error %prec UNARY_PREC '''
3355 print('expression_17', list(p))
3356 # { yyerror(@1, "error: Operand of unary ! "
3357 # "is not a primary expression.");
3358 # $$ = 0;
3359 # }
3360 ()
3361 def p_expression_18(p):
3362 '''expression : '^' error %prec UNARY_PREC '''
3363 print('expression_18', list(p))
3364 # { yyerror(@1, "error: Operand of reduction ^ "
3365 # "is not a primary expression.");
3366 # $$ = 0;
3367 # }
3368 ()
3369 def p_expression_19(p):
3370 '''expression : expression '^' attribute_list_opt expression '''
3371 print('expression_19', list(p))
3372 # { PEBinary*tmp = new PEBinary('^', $1, $4);
3373 # FILE_NAME(tmp, @2);
3374 # $$ = tmp;
3375 # }
3376 ()
3377 def p_expression_20(p):
3378 '''expression : expression K_POW attribute_list_opt expression '''
3379 print('expression_20', list(p))
3380 # { PEBinary*tmp = new PEBPower('p', $1, $4);
3381 # FILE_NAME(tmp, @2);
3382 # $$ = tmp;
3383 # }
3384 ()
3385 def p_expression_21(p):
3386 '''expression : expression '*' attribute_list_opt expression '''
3387 print('expression_21', list(p))
3388 # { PEBinary*tmp = new PEBinary('*', $1, $4);
3389 # FILE_NAME(tmp, @2);
3390 # $$ = tmp;
3391 # }
3392 ()
3393 def p_expression_22(p):
3394 '''expression : expression '/' attribute_list_opt expression '''
3395 print('expression_22', list(p))
3396 # { PEBinary*tmp = new PEBinary('/', $1, $4);
3397 # FILE_NAME(tmp, @2);
3398 # $$ = tmp;
3399 # }
3400 ()
3401 def p_expression_23(p):
3402 '''expression : expression '%' attribute_list_opt expression '''
3403 print('expression_23', list(p))
3404 # { PEBinary*tmp = new PEBinary('%', $1, $4);
3405 # FILE_NAME(tmp, @2);
3406 # $$ = tmp;
3407 # }
3408 ()
3409 def p_expression_24(p):
3410 '''expression : expression '+' attribute_list_opt expression '''
3411 print('expression_24', list(p))
3412 # { PEBinary*tmp = new PEBinary('+', $1, $4);
3413 # FILE_NAME(tmp, @2);
3414 # $$ = tmp;
3415 # }
3416 ()
3417 def p_expression_25(p):
3418 '''expression : expression '-' attribute_list_opt expression '''
3419 print('expression_25', list(p))
3420 # { PEBinary*tmp = new PEBinary('-', $1, $4);
3421 # FILE_NAME(tmp, @2);
3422 # $$ = tmp;
3423 # }
3424 ()
3425 def p_expression_26(p):
3426 '''expression : expression '&' attribute_list_opt expression '''
3427 print('expression_26', list(p))
3428 # { PEBinary*tmp = new PEBinary('&', $1, $4);
3429 # FILE_NAME(tmp, @2);
3430 # $$ = tmp;
3431 # }
3432 ()
3433 def p_expression_27(p):
3434 '''expression : expression '|' attribute_list_opt expression '''
3435 print('expression_27', list(p))
3436 # { PEBinary*tmp = new PEBinary('|', $1, $4);
3437 # FILE_NAME(tmp, @2);
3438 # $$ = tmp;
3439 # }
3440 ()
3441 def p_expression_28(p):
3442 '''expression : expression K_NAND attribute_list_opt expression '''
3443 print('expression_28', list(p))
3444 # { PEBinary*tmp = new PEBinary('A', $1, $4);
3445 # FILE_NAME(tmp, @2);
3446 # $$ = tmp;
3447 # }
3448 ()
3449 def p_expression_29(p):
3450 '''expression : expression K_NOR attribute_list_opt expression '''
3451 print('expression_29', list(p))
3452 # { PEBinary*tmp = new PEBinary('O', $1, $4);
3453 # FILE_NAME(tmp, @2);
3454 # $$ = tmp;
3455 # }
3456 ()
3457 def p_expression_30(p):
3458 '''expression : expression K_NXOR attribute_list_opt expression '''
3459 print('expression_30', list(p))
3460 # { PEBinary*tmp = new PEBinary('X', $1, $4);
3461 # FILE_NAME(tmp, @2);
3462 # $$ = tmp;
3463 # }
3464 ()
3465 def p_expression_31(p):
3466 '''expression : expression '<' attribute_list_opt expression '''
3467 print('expression_31', list(p))
3468 # { PEBinary*tmp = new PEBComp('<', $1, $4);
3469 # FILE_NAME(tmp, @2);
3470 # $$ = tmp;
3471 # }
3472 ()
3473 def p_expression_32(p):
3474 '''expression : expression '>' attribute_list_opt expression '''
3475 print('expression_32', list(p))
3476 # { PEBinary*tmp = new PEBComp('>', $1, $4);
3477 # FILE_NAME(tmp, @2);
3478 # $$ = tmp;
3479 # }
3480 ()
3481 def p_expression_33(p):
3482 '''expression : expression K_LS attribute_list_opt expression '''
3483 print('expression_33', list(p))
3484 # { PEBinary*tmp = new PEBShift('l', $1, $4);
3485 # FILE_NAME(tmp, @2);
3486 # $$ = tmp;
3487 # }
3488 ()
3489 def p_expression_34(p):
3490 '''expression : expression K_RS attribute_list_opt expression '''
3491 print('expression_34', list(p))
3492 # { PEBinary*tmp = new PEBShift('r', $1, $4);
3493 # FILE_NAME(tmp, @2);
3494 # $$ = tmp;
3495 # }
3496 ()
3497 def p_expression_35(p):
3498 '''expression : expression K_RSS attribute_list_opt expression '''
3499 print('expression_35', list(p))
3500 # { PEBinary*tmp = new PEBShift('R', $1, $4);
3501 # FILE_NAME(tmp, @2);
3502 # $$ = tmp;
3503 # }
3504 ()
3505 def p_expression_36(p):
3506 '''expression : expression K_EQ attribute_list_opt expression '''
3507 print('expression_36', list(p))
3508 # { PEBinary*tmp = new PEBComp('e', $1, $4);
3509 # FILE_NAME(tmp, @2);
3510 # $$ = tmp;
3511 # }
3512 ()
3513 def p_expression_37(p):
3514 '''expression : expression K_CEQ attribute_list_opt expression '''
3515 print('expression_37', list(p))
3516 # { PEBinary*tmp = new PEBComp('E', $1, $4);
3517 # FILE_NAME(tmp, @2);
3518 # $$ = tmp;
3519 # }
3520 ()
3521 def p_expression_38(p):
3522 '''expression : expression K_WEQ attribute_list_opt expression '''
3523 print('expression_38', list(p))
3524 # { PEBinary*tmp = new PEBComp('w', $1, $4);
3525 # FILE_NAME(tmp, @2);
3526 # $$ = tmp;
3527 # }
3528 ()
3529 def p_expression_39(p):
3530 '''expression : expression K_LE attribute_list_opt expression '''
3531 print('expression_39', list(p))
3532 # { PEBinary*tmp = new PEBComp('L', $1, $4);
3533 # FILE_NAME(tmp, @2);
3534 # $$ = tmp;
3535 # }
3536 ()
3537 def p_expression_40(p):
3538 '''expression : expression K_GE attribute_list_opt expression '''
3539 print('expression_40', list(p))
3540 # { PEBinary*tmp = new PEBComp('G', $1, $4);
3541 # FILE_NAME(tmp, @2);
3542 # $$ = tmp;
3543 # }
3544 ()
3545 def p_expression_41(p):
3546 '''expression : expression K_NE attribute_list_opt expression '''
3547 print('expression_41', list(p))
3548 # { PEBinary*tmp = new PEBComp('n', $1, $4);
3549 # FILE_NAME(tmp, @2);
3550 # $$ = tmp;
3551 # }
3552 ()
3553 def p_expression_42(p):
3554 '''expression : expression K_CNE attribute_list_opt expression '''
3555 print('expression_42', list(p))
3556 # { PEBinary*tmp = new PEBComp('N', $1, $4);
3557 # FILE_NAME(tmp, @2);
3558 # $$ = tmp;
3559 # }
3560 ()
3561 def p_expression_43(p):
3562 '''expression : expression K_WNE attribute_list_opt expression '''
3563 print('expression_43', list(p))
3564 # { PEBinary*tmp = new PEBComp('W', $1, $4);
3565 # FILE_NAME(tmp, @2);
3566 # $$ = tmp;
3567 # }
3568 ()
3569 def p_expression_44(p):
3570 '''expression : expression K_LOR attribute_list_opt expression '''
3571 print('expression_44', list(p))
3572 # { PEBinary*tmp = new PEBLogic('o', $1, $4);
3573 # FILE_NAME(tmp, @2);
3574 # $$ = tmp;
3575 # }
3576 ()
3577 def p_expression_45(p):
3578 '''expression : expression K_LAND attribute_list_opt expression '''
3579 print('expression_45', list(p))
3580 # { PEBinary*tmp = new PEBLogic('a', $1, $4);
3581 # FILE_NAME(tmp, @2);
3582 # $$ = tmp;
3583 # }
3584 ()
3585 def p_expression_46(p):
3586 '''expression : expression '?' attribute_list_opt expression ':' expression '''
3587 print('expression_46', list(p))
3588 # { PETernary*tmp = new PETernary($1, $4, $6);
3589 # FILE_NAME(tmp, @2);
3590 # $$ = tmp;
3591 # }
3592 ()
3593 def p_expr_mintypmax_1(p):
3594 '''expr_mintypmax : expression '''
3595 print('expr_mintypmax_1', list(p))
3596 p[0] = p[1]
3597 ()
3598 def p_expr_mintypmax_2(p):
3599 '''expr_mintypmax : expression ':' expression ':' expression '''
3600 print('expr_mintypmax_2', list(p))
3601 # { switch (min_typ_max_flag) {
3602 # case MIN:
3603 # $$ = $1;
3604 # delete $3;
3605 # delete $5;
3606 # break;
3607 # case TYP:
3608 # delete $1;
3609 # $$ = $3;
3610 # delete $5;
3611 # break;
3612 # case MAX:
3613 # delete $1;
3614 # delete $3;
3615 # $$ = $5;
3616 # break;
3617 # }
3618 # if (min_typ_max_warn > 0) {
3619 # cerr << $$->get_fileline() << ": warning: choosing ";
3620 # switch (min_typ_max_flag) {
3621 # case MIN:
3622 # cerr << "min";
3623 # break;
3624 # case TYP:
3625 # cerr << "typ";
3626 # break;
3627 # case MAX:
3628 # cerr << "max";
3629 # break;
3630 # }
3631 # cerr << " expression." << endl;
3632 # min_typ_max_warn -= 1;
3633 # }
3634 # }
3635 ()
3636 def p_expression_list_with_nuls_1(p):
3637 '''expression_list_with_nuls : expression_list_with_nuls ',' expression '''
3638 print('expression_list_with_nuls_1', list(p))
3639 # { list<PExpr*>*tmp = $1;
3640 # tmp->push_back($3);
3641 # $$ = tmp;
3642 # }
3643 ()
3644 def p_expression_list_with_nuls_2(p):
3645 '''expression_list_with_nuls : expression '''
3646 print('expression_list_with_nuls_2', list(p))
3647 # { list<PExpr*>*tmp = new list<PExpr*>;
3648 # tmp->push_back($1);
3649 # $$ = tmp;
3650 # }
3651 ()
3652 def p_expression_list_with_nuls_3(p):
3653 '''expression_list_with_nuls : '''
3654 print('expression_list_with_nuls_3', list(p))
3655 # { list<PExpr*>*tmp = new list<PExpr*>;
3656 # tmp->push_back(0);
3657 # $$ = tmp;
3658 # }
3659 ()
3660 def p_expression_list_with_nuls_4(p):
3661 '''expression_list_with_nuls : expression_list_with_nuls ',' '''
3662 print('expression_list_with_nuls_4', list(p))
3663 # { list<PExpr*>*tmp = $1;
3664 # tmp->push_back(0);
3665 # $$ = tmp;
3666 # }
3667 ()
3668 def p_expression_list_proper_1(p):
3669 '''expression_list_proper : expression_list_proper ',' expression '''
3670 print('expression_list_proper_1', list(p))
3671 # { list<PExpr*>*tmp = $1;
3672 # tmp->push_back($3);
3673 # $$ = tmp;
3674 # }
3675 ()
3676 def p_expression_list_proper_2(p):
3677 '''expression_list_proper : expression '''
3678 print('expression_list_proper_2', list(p))
3679 # { list<PExpr*>*tmp = new list<PExpr*>;
3680 # tmp->push_back($1);
3681 # $$ = tmp;
3682 # }
3683 ()
3684 def p_expr_primary_or_typename_1(p):
3685 '''expr_primary_or_typename : expr_primary '''
3686 print('expr_primary_or_typename_1', list(p))
3687 p[0] = p[1]
3688 ()
3689 def p_expr_primary_or_typename_2(p):
3690 '''expr_primary_or_typename : TYPE_IDENTIFIER '''
3691 print('expr_primary_or_typename_2', list(p))
3692 p[0] = p[1]
3693 # { PETypename*tmp = new PETypename($1.type);
3694 # FILE_NAME(tmp,@1);
3695 # $$ = tmp;
3696 # delete[]$1.text;
3697 # }
3698 ()
3699 def p_expr_primary_1(p):
3700 '''expr_primary : number '''
3701 print('expr_primary_1', list(p))
3702 p[0] = p[1]
3703 # { assert($1);
3704 # PENumber*tmp = new PENumber($1);
3705 # FILE_NAME(tmp, @1);
3706 # $$ = tmp;
3707 # }
3708 ()
3709 def p_expr_primary_2(p):
3710 '''expr_primary : REALTIME '''
3711 print('expr_primary_2', list(p))
3712 # { PEFNumber*tmp = new PEFNumber($1);
3713 # FILE_NAME(tmp, @1);
3714 # $$ = tmp;
3715 # }
3716 ()
3717 def p_expr_primary_3(p):
3718 '''expr_primary : STRING '''
3719 print('expr_primary_3', list(p))
3720 # { PEString*tmp = new PEString($1);
3721 # FILE_NAME(tmp, @1);
3722 # $$ = tmp;
3723 # }
3724 ()
3725 def p_expr_primary_4(p):
3726 '''expr_primary : TIME_LITERAL '''
3727 print('expr_primary_4', list(p))
3728 # { int unit;
3729 #
3730 # based_size = 0;
3731 # $$ = 0;
3732 # if ($1 == 0 || !get_time_unit($1, unit))
3733 # yyerror(@1, "internal error: delay.");
3734 # else {
3735 # double p = pow(10.0, (double)(unit - pform_get_timeunit()));
3736 # double time = atof($1) * p;
3737 #
3738 # verireal *v = new verireal(time);
3739 # $$ = new PEFNumber(v);
3740 # FILE_NAME($$, @1);
3741 # }
3742 # }
3743 ()
3744 def p_expr_primary_5(p):
3745 '''expr_primary : SYSTEM_IDENTIFIER '''
3746 print('expr_primary_5', list(p))
3747 # { perm_string tn = lex_strings.make($1);
3748 # PECallFunction*tmp = new PECallFunction(tn);
3749 # FILE_NAME(tmp, @1);
3750 # $$ = tmp;
3751 # delete[]$1;
3752 # }
3753 ()
3754 def p_expr_primary_6(p):
3755 '''expr_primary : hierarchy_identifier '''
3756 print('expr_primary_6', list(p))
3757 p[0] = p[1]
3758 # { PEIdent*tmp = pform_new_ident(*$1);
3759 # FILE_NAME(tmp, @1);
3760 # $$ = tmp;
3761 # delete $1;
3762 # }
3763 ()
3764 def p_expr_primary_7(p):
3765 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier '''
3766 print('expr_primary_7', list(p))
3767 # { $$ = pform_package_ident(@2, $1, $3);
3768 # delete $3;
3769 # }
3770 ()
3771 def p_expr_primary_8(p):
3772 '''expr_primary : hierarchy_identifier '(' expression_list_with_nuls ')' '''
3773 print('expr_primary_8', list(p))
3774 # { list<PExpr*>*expr_list = $3;
3775 # strip_tail_items(expr_list);
3776 # PECallFunction*tmp = pform_make_call_function(@1, *$1, *expr_list);
3777 # delete $1;
3778 # $$ = tmp;
3779 # }
3780 ()
3781 def p_expr_primary_9(p):
3782 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' '''
3783 print('expr_primary_9', list(p))
3784 # { pform_name_t*t_name = $1;
3785 # while (! $3->empty()) {
3786 # t_name->push_back($3->front());
3787 # $3->pop_front();
3788 # }
3789 # list<PExpr*>*expr_list = $5;
3790 # strip_tail_items(expr_list);
3791 # PECallFunction*tmp = pform_make_call_function(@1, *t_name, *expr_list);
3792 # delete $1;
3793 # delete $3;
3794 # $$ = tmp;
3795 # }
3796 ()
3797 def p_expr_primary_10(p):
3798 '''expr_primary : SYSTEM_IDENTIFIER '(' expression_list_proper ')' '''
3799 print('expr_primary_10', list(p))
3800 # { perm_string tn = lex_strings.make($1);
3801 # PECallFunction*tmp = new PECallFunction(tn, *$3);
3802 # FILE_NAME(tmp, @1);
3803 # delete[]$1;
3804 # $$ = tmp;
3805 # }
3806 ()
3807 def p_expr_primary_11(p):
3808 '''expr_primary : PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')' '''
3809 print('expr_primary_11', list(p))
3810 # { perm_string use_name = lex_strings.make($3);
3811 # PECallFunction*tmp = new PECallFunction($1, use_name, *$5);
3812 # FILE_NAME(tmp, @3);
3813 # delete[]$3;
3814 # $$ = tmp;
3815 # }
3816 ()
3817 def p_expr_primary_12(p):
3818 '''expr_primary : SYSTEM_IDENTIFIER '(' ')' '''
3819 print('expr_primary_12', list(p))
3820 # { perm_string tn = lex_strings.make($1);
3821 # const vector<PExpr*>empty;
3822 # PECallFunction*tmp = new PECallFunction(tn, empty);
3823 # FILE_NAME(tmp, @1);
3824 # delete[]$1;
3825 # $$ = tmp;
3826 # if (!gn_system_verilog()) {
3827 # yyerror(@1, "error: Empty function argument list requires SystemVerilog.");
3828 # }
3829 # }
3830 ()
3831 def p_expr_primary_13(p):
3832 '''expr_primary : implicit_class_handle '''
3833 print('expr_primary_13', list(p))
3834 # { PEIdent*tmp = new PEIdent(*$1);
3835 # FILE_NAME(tmp,@1);
3836 # delete $1;
3837 # $$ = tmp;
3838 # }
3839 ()
3840 def p_expr_primary_14(p):
3841 '''expr_primary : implicit_class_handle '.' hierarchy_identifier '''
3842 print('expr_primary_14', list(p))
3843 # { pform_name_t*t_name = $1;
3844 # while (! $3->empty()) {
3845 # t_name->push_back($3->front());
3846 # $3->pop_front();
3847 # }
3848 # PEIdent*tmp = new PEIdent(*t_name);
3849 # FILE_NAME(tmp,@1);
3850 # delete $1;
3851 # delete $3;
3852 # $$ = tmp;
3853 # }
3854 ()
3855 def p_expr_primary_15(p):
3856 '''expr_primary : K_acos '(' expression ')' '''
3857 print('expr_primary_15', list(p))
3858 # { perm_string tn = perm_string::literal("$acos");
3859 # PECallFunction*tmp = make_call_function(tn, $3);
3860 # FILE_NAME(tmp,@1);
3861 # $$ = tmp;
3862 # }
3863 ()
3864 def p_expr_primary_16(p):
3865 '''expr_primary : K_acosh '(' expression ')' '''
3866 print('expr_primary_16', list(p))
3867 # { perm_string tn = perm_string::literal("$acosh");
3868 # PECallFunction*tmp = make_call_function(tn, $3);
3869 # FILE_NAME(tmp,@1);
3870 # $$ = tmp;
3871 # }
3872 ()
3873 def p_expr_primary_17(p):
3874 '''expr_primary : K_asin '(' expression ')' '''
3875 print('expr_primary_17', list(p))
3876 # { perm_string tn = perm_string::literal("$asin");
3877 # PECallFunction*tmp = make_call_function(tn, $3);
3878 # FILE_NAME(tmp,@1);
3879 # $$ = tmp;
3880 # }
3881 ()
3882 def p_expr_primary_18(p):
3883 '''expr_primary : K_asinh '(' expression ')' '''
3884 print('expr_primary_18', list(p))
3885 # { perm_string tn = perm_string::literal("$asinh");
3886 # PECallFunction*tmp = make_call_function(tn, $3);
3887 # FILE_NAME(tmp,@1);
3888 # $$ = tmp;
3889 # }
3890 ()
3891 def p_expr_primary_19(p):
3892 '''expr_primary : K_atan '(' expression ')' '''
3893 print('expr_primary_19', list(p))
3894 # { perm_string tn = perm_string::literal("$atan");
3895 # PECallFunction*tmp = make_call_function(tn, $3);
3896 # FILE_NAME(tmp,@1);
3897 # $$ = tmp;
3898 # }
3899 ()
3900 def p_expr_primary_20(p):
3901 '''expr_primary : K_atanh '(' expression ')' '''
3902 print('expr_primary_20', list(p))
3903 # { perm_string tn = perm_string::literal("$atanh");
3904 # PECallFunction*tmp = make_call_function(tn, $3);
3905 # FILE_NAME(tmp,@1);
3906 # $$ = tmp;
3907 # }
3908 ()
3909 def p_expr_primary_21(p):
3910 '''expr_primary : K_atan2 '(' expression ',' expression ')' '''
3911 print('expr_primary_21', list(p))
3912 # { perm_string tn = perm_string::literal("$atan2");
3913 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3914 # FILE_NAME(tmp,@1);
3915 # $$ = tmp;
3916 # }
3917 ()
3918 def p_expr_primary_22(p):
3919 '''expr_primary : K_ceil '(' expression ')' '''
3920 print('expr_primary_22', list(p))
3921 # { perm_string tn = perm_string::literal("$ceil");
3922 # PECallFunction*tmp = make_call_function(tn, $3);
3923 # FILE_NAME(tmp,@1);
3924 # $$ = tmp;
3925 # }
3926 ()
3927 def p_expr_primary_23(p):
3928 '''expr_primary : K_cos '(' expression ')' '''
3929 print('expr_primary_23', list(p))
3930 # { perm_string tn = perm_string::literal("$cos");
3931 # PECallFunction*tmp = make_call_function(tn, $3);
3932 # FILE_NAME(tmp,@1);
3933 # $$ = tmp;
3934 # }
3935 ()
3936 def p_expr_primary_24(p):
3937 '''expr_primary : K_cosh '(' expression ')' '''
3938 print('expr_primary_24', list(p))
3939 # { perm_string tn = perm_string::literal("$cosh");
3940 # PECallFunction*tmp = make_call_function(tn, $3);
3941 # FILE_NAME(tmp,@1);
3942 # $$ = tmp;
3943 # }
3944 ()
3945 def p_expr_primary_25(p):
3946 '''expr_primary : K_exp '(' expression ')' '''
3947 print('expr_primary_25', list(p))
3948 # { perm_string tn = perm_string::literal("$exp");
3949 # PECallFunction*tmp = make_call_function(tn, $3);
3950 # FILE_NAME(tmp,@1);
3951 # $$ = tmp;
3952 # }
3953 ()
3954 def p_expr_primary_26(p):
3955 '''expr_primary : K_floor '(' expression ')' '''
3956 print('expr_primary_26', list(p))
3957 # { perm_string tn = perm_string::literal("$floor");
3958 # PECallFunction*tmp = make_call_function(tn, $3);
3959 # FILE_NAME(tmp,@1);
3960 # $$ = tmp;
3961 # }
3962 ()
3963 def p_expr_primary_27(p):
3964 '''expr_primary : K_hypot '(' expression ',' expression ')' '''
3965 print('expr_primary_27', list(p))
3966 # { perm_string tn = perm_string::literal("$hypot");
3967 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3968 # FILE_NAME(tmp,@1);
3969 # $$ = tmp;
3970 # }
3971 ()
3972 def p_expr_primary_28(p):
3973 '''expr_primary : K_ln '(' expression ')' '''
3974 print('expr_primary_28', list(p))
3975 # { perm_string tn = perm_string::literal("$ln");
3976 # PECallFunction*tmp = make_call_function(tn, $3);
3977 # FILE_NAME(tmp,@1);
3978 # $$ = tmp;
3979 # }
3980 ()
3981 def p_expr_primary_29(p):
3982 '''expr_primary : K_log '(' expression ')' '''
3983 print('expr_primary_29', list(p))
3984 # { perm_string tn = perm_string::literal("$log10");
3985 # PECallFunction*tmp = make_call_function(tn, $3);
3986 # FILE_NAME(tmp,@1);
3987 # $$ = tmp;
3988 # }
3989 ()
3990 def p_expr_primary_30(p):
3991 '''expr_primary : K_pow '(' expression ',' expression ')' '''
3992 print('expr_primary_30', list(p))
3993 # { perm_string tn = perm_string::literal("$pow");
3994 # PECallFunction*tmp = make_call_function(tn, $3, $5);
3995 # FILE_NAME(tmp,@1);
3996 # $$ = tmp;
3997 # }
3998 ()
3999 def p_expr_primary_31(p):
4000 '''expr_primary : K_sin '(' expression ')' '''
4001 print('expr_primary_31', list(p))
4002 # { perm_string tn = perm_string::literal("$sin");
4003 # PECallFunction*tmp = make_call_function(tn, $3);
4004 # FILE_NAME(tmp,@1);
4005 # $$ = tmp;
4006 # }
4007 ()
4008 def p_expr_primary_32(p):
4009 '''expr_primary : K_sinh '(' expression ')' '''
4010 print('expr_primary_32', list(p))
4011 # { perm_string tn = perm_string::literal("$sinh");
4012 # PECallFunction*tmp = make_call_function(tn, $3);
4013 # FILE_NAME(tmp,@1);
4014 # $$ = tmp;
4015 # }
4016 ()
4017 def p_expr_primary_33(p):
4018 '''expr_primary : K_sqrt '(' expression ')' '''
4019 print('expr_primary_33', list(p))
4020 # { perm_string tn = perm_string::literal("$sqrt");
4021 # PECallFunction*tmp = make_call_function(tn, $3);
4022 # FILE_NAME(tmp,@1);
4023 # $$ = tmp;
4024 # }
4025 ()
4026 def p_expr_primary_34(p):
4027 '''expr_primary : K_tan '(' expression ')' '''
4028 print('expr_primary_34', list(p))
4029 # { perm_string tn = perm_string::literal("$tan");
4030 # PECallFunction*tmp = make_call_function(tn, $3);
4031 # FILE_NAME(tmp,@1);
4032 # $$ = tmp;
4033 # }
4034 ()
4035 def p_expr_primary_35(p):
4036 '''expr_primary : K_tanh '(' expression ')' '''
4037 print('expr_primary_35', list(p))
4038 # { perm_string tn = perm_string::literal("$tanh");
4039 # PECallFunction*tmp = make_call_function(tn, $3);
4040 # FILE_NAME(tmp,@1);
4041 # $$ = tmp;
4042 # }
4043 ()
4044 def p_expr_primary_36(p):
4045 '''expr_primary : K_abs '(' expression ')' '''
4046 print('expr_primary_36', list(p))
4047 # { PEUnary*tmp = new PEUnary('m', $3);
4048 # FILE_NAME(tmp,@1);
4049 # $$ = tmp;
4050 # }
4051 ()
4052 def p_expr_primary_37(p):
4053 '''expr_primary : K_max '(' expression ',' expression ')' '''
4054 print('expr_primary_37', list(p))
4055 # { PEBinary*tmp = new PEBinary('M', $3, $5);
4056 # FILE_NAME(tmp,@1);
4057 # $$ = tmp;
4058 # }
4059 ()
4060 def p_expr_primary_38(p):
4061 '''expr_primary : K_min '(' expression ',' expression ')' '''
4062 print('expr_primary_38', list(p))
4063 # { PEBinary*tmp = new PEBinary('m', $3, $5);
4064 # FILE_NAME(tmp,@1);
4065 # $$ = tmp;
4066 # }
4067 ()
4068 def p_expr_primary_39(p):
4069 '''expr_primary : '(' expr_mintypmax ')' '''
4070 print('expr_primary_39', list(p))
4071 p[0] = p[2]
4072 ()
4073 def p_expr_primary_40(p):
4074 '''expr_primary : '{' expression_list_proper '}' '''
4075 print('expr_primary_40', list(p))
4076 # { PEConcat*tmp = new PEConcat(*$2);
4077 # FILE_NAME(tmp, @1);
4078 # delete $2;
4079 # $$ = tmp;
4080 # }
4081 ()
4082 def p_expr_primary_41(p):
4083 '''expr_primary : '{' expression '{' expression_list_proper '}' '}' '''
4084 print('expr_primary_41', list(p))
4085 # { PExpr*rep = $2;
4086 # PEConcat*tmp = new PEConcat(*$4, rep);
4087 # FILE_NAME(tmp, @1);
4088 # delete $4;
4089 # $$ = tmp;
4090 # }
4091 ()
4092 def p_expr_primary_42(p):
4093 '''expr_primary : '{' expression '{' expression_list_proper '}' error '}' '''
4094 print('expr_primary_42', list(p))
4095 # { PExpr*rep = $2;
4096 # PEConcat*tmp = new PEConcat(*$4, rep);
4097 # FILE_NAME(tmp, @1);
4098 # delete $4;
4099 # $$ = tmp;
4100 # yyerror(@5, "error: Syntax error between internal '}' "
4101 # "and closing '}' of repeat concatenation.");
4102 # yyerrok;
4103 # }
4104 ()
4105 def p_expr_primary_43(p):
4106 '''expr_primary : '{' '}' '''
4107 print('expr_primary_43', list(p))
4108 # { // This is the empty queue syntax.
4109 # if (gn_system_verilog()) {
4110 # list<PExpr*> empty_list;
4111 # PEConcat*tmp = new PEConcat(empty_list);
4112 # FILE_NAME(tmp, @1);
4113 # $$ = tmp;
4114 # } else {
4115 # yyerror(@1, "error: Concatenations are not allowed to be empty.");
4116 # $$ = 0;
4117 # }
4118 # }
4119 ()
4120 def p_expr_primary_44(p):
4121 '''expr_primary : expr_primary "'" '(' expression ')' '''
4122 print('expr_primary_44', list(p))
4123 # { PExpr*base = $4;
4124 # if (gn_system_verilog()) {
4125 # PECastSize*tmp = new PECastSize($1, base);
4126 # FILE_NAME(tmp, @1);
4127 # $$ = tmp;
4128 # } else {
4129 # yyerror(@1, "error: Size cast requires SystemVerilog.");
4130 # $$ = base;
4131 # }
4132 # }
4133 ()
4134 def p_expr_primary_45(p):
4135 '''expr_primary : simple_type_or_string "'" '(' expression ')' '''
4136 print('expr_primary_45', list(p))
4137 # { PExpr*base = $4;
4138 # if (gn_system_verilog()) {
4139 # PECastType*tmp = new PECastType($1, base);
4140 # FILE_NAME(tmp, @1);
4141 # $$ = tmp;
4142 # } else {
4143 # yyerror(@1, "error: Type cast requires SystemVerilog.");
4144 # $$ = base;
4145 # }
4146 # }
4147 ()
4148 def p_expr_primary_46(p):
4149 '''expr_primary : assignment_pattern '''
4150 print('expr_primary_46', list(p))
4151 p[0] = p[1]
4152 ()
4153 def p_expr_primary_47(p):
4154 '''expr_primary : streaming_concatenation '''
4155 print('expr_primary_47', list(p))
4156 p[0] = p[1]
4157 ()
4158 def p_expr_primary_48(p):
4159 '''expr_primary : K_null '''
4160 print('expr_primary_48', list(p))
4161 # { PENull*tmp = new PENull;
4162 # FILE_NAME(tmp, @1);
4163 # $$ = tmp;
4164 # }
4165 ()
4166 def p_function_item_list_opt_1(p):
4167 '''function_item_list_opt : function_item_list '''
4168 print('function_item_list_opt_1', list(p))
4169 p[0] = p[1]
4170 ()
4171 def p_function_item_list_opt_2(p):
4172 '''function_item_list_opt : '''
4173 print('function_item_list_opt_2', list(p))
4174 # { $$ = 0; }
4175 ()
4176 def p_function_item_list_1(p):
4177 '''function_item_list : function_item '''
4178 print('function_item_list_1', list(p))
4179 p[0] = p[1]
4180 ()
4181 def p_function_item_list_2(p):
4182 '''function_item_list : function_item_list function_item '''
4183 print('function_item_list_2', list(p))
4184 # { /* */
4185 # if ($1 && $2) {
4186 # vector<pform_tf_port_t>*tmp = $1;
4187 # size_t s1 = tmp->size();
4188 # tmp->resize(s1 + $2->size());
4189 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
4190 # tmp->at(s1+idx) = $2->at(idx);
4191 # delete $2;
4192 # $$ = tmp;
4193 # } else if ($1) {
4194 # $$ = $1;
4195 # } else {
4196 # $$ = $2;
4197 # }
4198 # }
4199 ()
4200 def p_function_item_1(p):
4201 '''function_item : tf_port_declaration '''
4202 print('function_item_1', list(p))
4203 p[0] = p[1]
4204 ()
4205 def p_function_item_2(p):
4206 '''function_item : block_item_decl '''
4207 print('function_item_2', list(p))
4208 # { $$ = 0; }
4209 ()
4210 def p_gate_instance_1(p):
4211 '''gate_instance : IDENTIFIER '(' expression_list_with_nuls ')' '''
4212 print('gate_instance_1', list(p))
4213 # { lgate*tmp = new lgate;
4214 # tmp->name = $1;
4215 # tmp->parms = $3;
4216 # tmp->file = @1.text;
4217 # tmp->lineno = @1.first_line;
4218 # delete[]$1;
4219 # $$ = tmp;
4220 # }
4221 ()
4222 def p_gate_instance_2(p):
4223 '''gate_instance : IDENTIFIER dimensions '(' expression_list_with_nuls ')' '''
4224 print('gate_instance_2', list(p))
4225 # { lgate*tmp = new lgate;
4226 # list<pform_range_t>*rng = $2;
4227 # tmp->name = $1;
4228 # tmp->parms = $4;
4229 # tmp->range = rng->front();
4230 # rng->pop_front();
4231 # assert(rng->empty());
4232 # tmp->file = @1.text;
4233 # tmp->lineno = @1.first_line;
4234 # delete[]$1;
4235 # delete rng;
4236 # $$ = tmp;
4237 # }
4238 ()
4239 def p_gate_instance_3(p):
4240 '''gate_instance : '(' expression_list_with_nuls ')' '''
4241 print('gate_instance_3', list(p))
4242 # { lgate*tmp = new lgate;
4243 # tmp->name = "";
4244 # tmp->parms = $2;
4245 # tmp->file = @1.text;
4246 # tmp->lineno = @1.first_line;
4247 # $$ = tmp;
4248 # }
4249 ()
4250 def p_gate_instance_4(p):
4251 '''gate_instance : IDENTIFIER dimensions '''
4252 print('gate_instance_4', list(p))
4253 # { lgate*tmp = new lgate;
4254 # list<pform_range_t>*rng = $2;
4255 # tmp->name = $1;
4256 # tmp->parms = 0;
4257 # tmp->parms_by_name = 0;
4258 # tmp->range = rng->front();
4259 # rng->pop_front();
4260 # assert(rng->empty());
4261 # tmp->file = @1.text;
4262 # tmp->lineno = @1.first_line;
4263 # delete[]$1;
4264 # delete rng;
4265 # $$ = tmp;
4266 # }
4267 ()
4268 def p_gate_instance_5(p):
4269 '''gate_instance : IDENTIFIER '(' port_name_list ')' '''
4270 print('gate_instance_5', list(p))
4271 # { lgate*tmp = new lgate;
4272 # tmp->name = $1;
4273 # tmp->parms = 0;
4274 # tmp->parms_by_name = $3;
4275 # tmp->file = @1.text;
4276 # tmp->lineno = @1.first_line;
4277 # delete[]$1;
4278 # $$ = tmp;
4279 # }
4280 ()
4281 def p_gate_instance_6(p):
4282 '''gate_instance : IDENTIFIER dimensions '(' port_name_list ')' '''
4283 print('gate_instance_6', list(p))
4284 # { lgate*tmp = new lgate;
4285 # list<pform_range_t>*rng = $2;
4286 # tmp->name = $1;
4287 # tmp->parms = 0;
4288 # tmp->parms_by_name = $4;
4289 # tmp->range = rng->front();
4290 # rng->pop_front();
4291 # assert(rng->empty());
4292 # tmp->file = @1.text;
4293 # tmp->lineno = @1.first_line;
4294 # delete[]$1;
4295 # delete rng;
4296 # $$ = tmp;
4297 # }
4298 ()
4299 def p_gate_instance_7(p):
4300 '''gate_instance : IDENTIFIER '(' error ')' '''
4301 print('gate_instance_7', list(p))
4302 # { lgate*tmp = new lgate;
4303 # tmp->name = $1;
4304 # tmp->parms = 0;
4305 # tmp->parms_by_name = 0;
4306 # tmp->file = @1.text;
4307 # tmp->lineno = @1.first_line;
4308 # yyerror(@2, "error: Syntax error in instance port "
4309 # "expression(s).");
4310 # delete[]$1;
4311 # $$ = tmp;
4312 # }
4313 ()
4314 def p_gate_instance_8(p):
4315 '''gate_instance : IDENTIFIER dimensions '(' error ')' '''
4316 print('gate_instance_8', list(p))
4317 # { lgate*tmp = new lgate;
4318 # tmp->name = $1;
4319 # tmp->parms = 0;
4320 # tmp->parms_by_name = 0;
4321 # tmp->file = @1.text;
4322 # tmp->lineno = @1.first_line;
4323 # yyerror(@3, "error: Syntax error in instance port "
4324 # "expression(s).");
4325 # delete[]$1;
4326 # $$ = tmp;
4327 # }
4328 ()
4329 def p_gate_instance_list_1(p):
4330 '''gate_instance_list : gate_instance_list ',' gate_instance '''
4331 print('gate_instance_list_1', list(p))
4332 # { svector<lgate>*tmp1 = $1;
4333 # lgate*tmp2 = $3;
4334 # svector<lgate>*out = new svector<lgate> (*tmp1, *tmp2);
4335 # delete tmp1;
4336 # delete tmp2;
4337 # $$ = out;
4338 # }
4339 ()
4340 def p_gate_instance_list_2(p):
4341 '''gate_instance_list : gate_instance '''
4342 print('gate_instance_list_2', list(p))
4343 # { svector<lgate>*tmp = new svector<lgate>(1);
4344 # (*tmp)[0] = *$1;
4345 # delete $1;
4346 # $$ = tmp;
4347 # }
4348 ()
4349 def p_gatetype_1(p):
4350 '''gatetype : K_and '''
4351 print('gatetype_1', list(p))
4352 # { $$ = PGBuiltin::AND; }
4353 ()
4354 def p_gatetype_2(p):
4355 '''gatetype : K_nand '''
4356 print('gatetype_2', list(p))
4357 # { $$ = PGBuiltin::NAND; }
4358 ()
4359 def p_gatetype_3(p):
4360 '''gatetype : K_or '''
4361 print('gatetype_3', list(p))
4362 # { $$ = PGBuiltin::OR; }
4363 ()
4364 def p_gatetype_4(p):
4365 '''gatetype : K_nor '''
4366 print('gatetype_4', list(p))
4367 # { $$ = PGBuiltin::NOR; }
4368 ()
4369 def p_gatetype_5(p):
4370 '''gatetype : K_xor '''
4371 print('gatetype_5', list(p))
4372 # { $$ = PGBuiltin::XOR; }
4373 ()
4374 def p_gatetype_6(p):
4375 '''gatetype : K_xnor '''
4376 print('gatetype_6', list(p))
4377 # { $$ = PGBuiltin::XNOR; }
4378 ()
4379 def p_gatetype_7(p):
4380 '''gatetype : K_buf '''
4381 print('gatetype_7', list(p))
4382 # { $$ = PGBuiltin::BUF; }
4383 ()
4384 def p_gatetype_8(p):
4385 '''gatetype : K_bufif0 '''
4386 print('gatetype_8', list(p))
4387 # { $$ = PGBuiltin::BUFIF0; }
4388 ()
4389 def p_gatetype_9(p):
4390 '''gatetype : K_bufif1 '''
4391 print('gatetype_9', list(p))
4392 # { $$ = PGBuiltin::BUFIF1; }
4393 ()
4394 def p_gatetype_10(p):
4395 '''gatetype : K_not '''
4396 print('gatetype_10', list(p))
4397 # { $$ = PGBuiltin::NOT; }
4398 ()
4399 def p_gatetype_11(p):
4400 '''gatetype : K_notif0 '''
4401 print('gatetype_11', list(p))
4402 # { $$ = PGBuiltin::NOTIF0; }
4403 ()
4404 def p_gatetype_12(p):
4405 '''gatetype : K_notif1 '''
4406 print('gatetype_12', list(p))
4407 # { $$ = PGBuiltin::NOTIF1; }
4408 ()
4409 def p_switchtype_1(p):
4410 '''switchtype : K_nmos '''
4411 print('switchtype_1', list(p))
4412 # { $$ = PGBuiltin::NMOS; }
4413 ()
4414 def p_switchtype_2(p):
4415 '''switchtype : K_rnmos '''
4416 print('switchtype_2', list(p))
4417 # { $$ = PGBuiltin::RNMOS; }
4418 ()
4419 def p_switchtype_3(p):
4420 '''switchtype : K_pmos '''
4421 print('switchtype_3', list(p))
4422 # { $$ = PGBuiltin::PMOS; }
4423 ()
4424 def p_switchtype_4(p):
4425 '''switchtype : K_rpmos '''
4426 print('switchtype_4', list(p))
4427 # { $$ = PGBuiltin::RPMOS; }
4428 ()
4429 def p_switchtype_5(p):
4430 '''switchtype : K_cmos '''
4431 print('switchtype_5', list(p))
4432 # { $$ = PGBuiltin::CMOS; }
4433 ()
4434 def p_switchtype_6(p):
4435 '''switchtype : K_rcmos '''
4436 print('switchtype_6', list(p))
4437 # { $$ = PGBuiltin::RCMOS; }
4438 ()
4439 def p_switchtype_7(p):
4440 '''switchtype : K_tran '''
4441 print('switchtype_7', list(p))
4442 # { $$ = PGBuiltin::TRAN; }
4443 ()
4444 def p_switchtype_8(p):
4445 '''switchtype : K_rtran '''
4446 print('switchtype_8', list(p))
4447 # { $$ = PGBuiltin::RTRAN; }
4448 ()
4449 def p_switchtype_9(p):
4450 '''switchtype : K_tranif0 '''
4451 print('switchtype_9', list(p))
4452 # { $$ = PGBuiltin::TRANIF0; }
4453 ()
4454 def p_switchtype_10(p):
4455 '''switchtype : K_tranif1 '''
4456 print('switchtype_10', list(p))
4457 # { $$ = PGBuiltin::TRANIF1; }
4458 ()
4459 def p_switchtype_11(p):
4460 '''switchtype : K_rtranif0 '''
4461 print('switchtype_11', list(p))
4462 # { $$ = PGBuiltin::RTRANIF0; }
4463 ()
4464 def p_switchtype_12(p):
4465 '''switchtype : K_rtranif1 '''
4466 print('switchtype_12', list(p))
4467 # { $$ = PGBuiltin::RTRANIF1; }
4468 ()
4469 def p_hierarchy_identifier_1(p):
4470 '''hierarchy_identifier : IDENTIFIER '''
4471 print('hierarchy_identifier_1', list(p))
4472 lpvalue = Leaf(token.NAME, p[1])
4473 p[0] = lpvalue
4474 # { $$ = new pform_name_t;
4475 # $$->push_back(name_component_t(lex_strings.make($1)));
4476 # delete[]$1;
4477 # }
4478 ()
4479 def p_hierarchy_identifier_2(p):
4480 '''hierarchy_identifier : hierarchy_identifier '.' IDENTIFIER '''
4481 print('hierarchy_identifier_2', list(p))
4482 # { pform_name_t * tmp = $1;
4483 # tmp->push_back(name_component_t(lex_strings.make($3)));
4484 # delete[]$3;
4485 # $$ = tmp;
4486 # }
4487 ()
4488 def p_hierarchy_identifier_3(p):
4489 '''hierarchy_identifier : hierarchy_identifier '[' expression ']' '''
4490 print('hierarchy_identifier_3', list(p))
4491 # { pform_name_t * tmp = $1;
4492 # name_component_t&tail = tmp->back();
4493 # index_component_t itmp;
4494 # itmp.sel = index_component_t::SEL_BIT;
4495 # itmp.msb = $3;
4496 # tail.index.push_back(itmp);
4497 # $$ = tmp;
4498 # }
4499 ()
4500 def p_hierarchy_identifier_4(p):
4501 '''hierarchy_identifier : hierarchy_identifier '[' '$' ']' '''
4502 print('hierarchy_identifier_4', list(p))
4503 # { pform_name_t * tmp = $1;
4504 # name_component_t&tail = tmp->back();
4505 # if (! gn_system_verilog()) {
4506 # yyerror(@3, "error: Last element expression ($) "
4507 # "requires SystemVerilog. Try enabling SystemVerilog.");
4508 # }
4509 # index_component_t itmp;
4510 # itmp.sel = index_component_t::SEL_BIT_LAST;
4511 # itmp.msb = 0;
4512 # itmp.lsb = 0;
4513 # tail.index.push_back(itmp);
4514 # $$ = tmp;
4515 # }
4516 ()
4517 def p_hierarchy_identifier_5(p):
4518 '''hierarchy_identifier : hierarchy_identifier '[' expression ':' expression ']' '''
4519 print('hierarchy_identifier_5', list(p))
4520 # { pform_name_t * tmp = $1;
4521 # name_component_t&tail = tmp->back();
4522 # index_component_t itmp;
4523 # itmp.sel = index_component_t::SEL_PART;
4524 # itmp.msb = $3;
4525 # itmp.lsb = $5;
4526 # tail.index.push_back(itmp);
4527 # $$ = tmp;
4528 # }
4529 ()
4530 def p_hierarchy_identifier_6(p):
4531 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_POS expression ']' '''
4532 print('hierarchy_identifier_6', list(p))
4533 # { pform_name_t * tmp = $1;
4534 # name_component_t&tail = tmp->back();
4535 # index_component_t itmp;
4536 # itmp.sel = index_component_t::SEL_IDX_UP;
4537 # itmp.msb = $3;
4538 # itmp.lsb = $5;
4539 # tail.index.push_back(itmp);
4540 # $$ = tmp;
4541 # }
4542 ()
4543 def p_hierarchy_identifier_7(p):
4544 '''hierarchy_identifier : hierarchy_identifier '[' expression K_PO_NEG expression ']' '''
4545 print('hierarchy_identifier_7', list(p))
4546 # { pform_name_t * tmp = $1;
4547 # name_component_t&tail = tmp->back();
4548 # index_component_t itmp;
4549 # itmp.sel = index_component_t::SEL_IDX_DO;
4550 # itmp.msb = $3;
4551 # itmp.lsb = $5;
4552 # tail.index.push_back(itmp);
4553 # $$ = tmp;
4554 # }
4555 ()
4556 def p_list_of_identifiers_1(p):
4557 '''list_of_identifiers : IDENTIFIER '''
4558 print('list_of_identifiers_1', list(p))
4559 # { $$ = list_from_identifier($1); }
4560 ()
4561 def p_list_of_identifiers_2(p):
4562 '''list_of_identifiers : list_of_identifiers ',' IDENTIFIER '''
4563 print('list_of_identifiers_2', list(p))
4564 # { $$ = list_from_identifier($1, $3); }
4565 ()
4566 def p_list_of_port_identifiers_1(p):
4567 '''list_of_port_identifiers : IDENTIFIER dimensions_opt '''
4568 print('list_of_port_identifiers_1', list(p))
4569 # { $$ = make_port_list($1, $2, 0); }
4570 ()
4571 def p_list_of_port_identifiers_2(p):
4572 '''list_of_port_identifiers : list_of_port_identifiers ',' IDENTIFIER dimensions_opt '''
4573 print('list_of_port_identifiers_2', list(p))
4574 # { $$ = make_port_list($1, $3, $4, 0); }
4575 ()
4576 def p_list_of_variable_port_identifiers_1(p):
4577 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '''
4578 print('list_of_variable_port_identifiers_1', list(p))
4579 # { $$ = make_port_list($1, $2, 0); }
4580 ()
4581 def p_list_of_variable_port_identifiers_2(p):
4582 '''list_of_variable_port_identifiers : IDENTIFIER dimensions_opt '=' expression '''
4583 print('list_of_variable_port_identifiers_2', list(p))
4584 # { $$ = make_port_list($1, $2, $4); }
4585 ()
4586 def p_list_of_variable_port_identifiers_3(p):
4587 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '''
4588 print('list_of_variable_port_identifiers_3', list(p))
4589 # { $$ = make_port_list($1, $3, $4, 0); }
4590 ()
4591 def p_list_of_variable_port_identifiers_4(p):
4592 '''list_of_variable_port_identifiers : list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt '=' expression '''
4593 print('list_of_variable_port_identifiers_4', list(p))
4594 # { $$ = make_port_list($1, $3, $4, $6); }
4595 ()
4596 def p_list_of_ports_1(p):
4597 '''list_of_ports : port_opt '''
4598 print('list_of_ports_1', list(p))
4599 # { vector<Module::port_t*>*tmp
4600 # = new vector<Module::port_t*>(1);
4601 # (*tmp)[0] = $1;
4602 # $$ = tmp;
4603 # }
4604 ()
4605 def p_list_of_ports_2(p):
4606 '''list_of_ports : list_of_ports ',' port_opt '''
4607 print('list_of_ports_2', list(p))
4608 # { vector<Module::port_t*>*tmp = $1;
4609 # tmp->push_back($3);
4610 # $$ = tmp;
4611 # }
4612 ()
4613 def p_list_of_port_declarations_1(p):
4614 '''list_of_port_declarations : port_declaration '''
4615 print('list_of_port_declarations_1', list(p))
4616 # { vector<Module::port_t*>*tmp
4617 # = new vector<Module::port_t*>(1);
4618 # (*tmp)[0] = $1;
4619 # $$ = tmp;
4620 # }
4621 ()
4622 def p_list_of_port_declarations_2(p):
4623 '''list_of_port_declarations : list_of_port_declarations ',' port_declaration '''
4624 print('list_of_port_declarations_2', list(p))
4625 # { vector<Module::port_t*>*tmp = $1;
4626 # tmp->push_back($3);
4627 # $$ = tmp;
4628 # }
4629 ()
4630 def p_list_of_port_declarations_3(p):
4631 '''list_of_port_declarations : list_of_port_declarations ',' IDENTIFIER '''
4632 print('list_of_port_declarations_3', list(p))
4633 # { Module::port_t*ptmp;
4634 # perm_string name = lex_strings.make($3);
4635 # ptmp = pform_module_port_reference(name, @3.text,
4636 # @3.first_line);
4637 # vector<Module::port_t*>*tmp = $1;
4638 # tmp->push_back(ptmp);
4639 #
4640 # /* Get the port declaration details, the port type
4641 # and what not, from context data stored by the
4642 # last port_declaration rule. */
4643 # pform_module_define_port(@3, name,
4644 # port_declaration_context.port_type,
4645 # port_declaration_context.port_net_type,
4646 # port_declaration_context.data_type, 0);
4647 # delete[]$3;
4648 # $$ = tmp;
4649 # }
4650 ()
4651 def p_list_of_port_declarations_4(p):
4652 '''list_of_port_declarations : list_of_port_declarations ',' '''
4653 print('list_of_port_declarations_4', list(p))
4654 # {
4655 # yyerror(@2, "error: NULL port declarations are not "
4656 # "allowed.");
4657 # }
4658 ()
4659 def p_list_of_port_declarations_5(p):
4660 '''list_of_port_declarations : list_of_port_declarations ';' '''
4661 print('list_of_port_declarations_5', list(p))
4662 # {
4663 # yyerror(@2, "error: ';' is an invalid port declaration "
4664 # "separator.");
4665 # }
4666 ()
4667 def p_port_declaration_1(p):
4668 '''port_declaration : attribute_list_opt K_input net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4669 print('port_declaration_1', list(p))
4670 # { Module::port_t*ptmp;
4671 # perm_string name = lex_strings.make($5);
4672 # data_type_t*use_type = $4;
4673 # if ($6) use_type = new uarray_type_t(use_type, $6);
4674 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4675 # pform_module_define_port(@2, name, NetNet::PINPUT, $3, use_type, $1);
4676 # port_declaration_context.port_type = NetNet::PINPUT;
4677 # port_declaration_context.port_net_type = $3;
4678 # port_declaration_context.data_type = $4;
4679 # delete[]$5;
4680 # $$ = ptmp;
4681 # }
4682 ()
4683 def p_port_declaration_2(p):
4684 '''port_declaration : attribute_list_opt K_input K_wreal IDENTIFIER '''
4685 print('port_declaration_2', list(p))
4686 # { Module::port_t*ptmp;
4687 # perm_string name = lex_strings.make($4);
4688 # ptmp = pform_module_port_reference(name, @2.text,
4689 # @2.first_line);
4690 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4691 # FILE_NAME(real_type, @3);
4692 # pform_module_define_port(@2, name, NetNet::PINPUT,
4693 # NetNet::WIRE, real_type, $1);
4694 # port_declaration_context.port_type = NetNet::PINPUT;
4695 # port_declaration_context.port_net_type = NetNet::WIRE;
4696 # port_declaration_context.data_type = real_type;
4697 # delete[]$4;
4698 # $$ = ptmp;
4699 # }
4700 ()
4701 def p_port_declaration_3(p):
4702 '''port_declaration : attribute_list_opt K_inout net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4703 print('port_declaration_3', list(p))
4704 # { Module::port_t*ptmp;
4705 # perm_string name = lex_strings.make($5);
4706 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4707 # pform_module_define_port(@2, name, NetNet::PINOUT, $3, $4, $1);
4708 # port_declaration_context.port_type = NetNet::PINOUT;
4709 # port_declaration_context.port_net_type = $3;
4710 # port_declaration_context.data_type = $4;
4711 # delete[]$5;
4712 # if ($6) {
4713 # yyerror(@6, "sorry: Inout ports with unpacked dimensions not supported.");
4714 # delete $6;
4715 # }
4716 # $$ = ptmp;
4717 # }
4718 ()
4719 def p_port_declaration_4(p):
4720 '''port_declaration : attribute_list_opt K_inout K_wreal IDENTIFIER '''
4721 print('port_declaration_4', list(p))
4722 # { Module::port_t*ptmp;
4723 # perm_string name = lex_strings.make($4);
4724 # ptmp = pform_module_port_reference(name, @2.text,
4725 # @2.first_line);
4726 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4727 # FILE_NAME(real_type, @3);
4728 # pform_module_define_port(@2, name, NetNet::PINOUT,
4729 # NetNet::WIRE, real_type, $1);
4730 # port_declaration_context.port_type = NetNet::PINOUT;
4731 # port_declaration_context.port_net_type = NetNet::WIRE;
4732 # port_declaration_context.data_type = real_type;
4733 # delete[]$4;
4734 # $$ = ptmp;
4735 # }
4736 ()
4737 def p_port_declaration_5(p):
4738 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER dimensions_opt '''
4739 print('port_declaration_5', list(p))
4740 # { Module::port_t*ptmp;
4741 # perm_string name = lex_strings.make($5);
4742 # data_type_t*use_dtype = $4;
4743 # if ($6) use_dtype = new uarray_type_t(use_dtype, $6);
4744 # NetNet::Type use_type = $3;
4745 # if (use_type == NetNet::IMPLICIT) {
4746 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($4)) {
4747 # if (dtype->reg_flag)
4748 # use_type = NetNet::REG;
4749 # else if (dtype->implicit_flag)
4750 # use_type = NetNet::IMPLICIT;
4751 # else
4752 # use_type = NetNet::IMPLICIT_REG;
4753 #
4754 # // The SystemVerilog types that can show up as
4755 # // output ports are implicitly (on the inside)
4756 # // variables because "reg" is not valid syntax
4757 # // here.
4758 # } else if (dynamic_cast<atom2_type_t*> ($4)) {
4759 # use_type = NetNet::IMPLICIT_REG;
4760 # } else if (dynamic_cast<struct_type_t*> ($4)) {
4761 # use_type = NetNet::IMPLICIT_REG;
4762 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> ($4)) {
4763 # if(etype->base_type == IVL_VT_LOGIC)
4764 # use_type = NetNet::IMPLICIT_REG;
4765 # }
4766 # }
4767 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4768 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, use_dtype, $1);
4769 # port_declaration_context.port_type = NetNet::POUTPUT;
4770 # port_declaration_context.port_net_type = use_type;
4771 # port_declaration_context.data_type = $4;
4772 # delete[]$5;
4773 # $$ = ptmp;
4774 # }
4775 ()
4776 def p_port_declaration_6(p):
4777 '''port_declaration : attribute_list_opt K_output K_wreal IDENTIFIER '''
4778 print('port_declaration_6', list(p))
4779 # { Module::port_t*ptmp;
4780 # perm_string name = lex_strings.make($4);
4781 # ptmp = pform_module_port_reference(name, @2.text,
4782 # @2.first_line);
4783 # real_type_t*real_type = new real_type_t(real_type_t::REAL);
4784 # FILE_NAME(real_type, @3);
4785 # pform_module_define_port(@2, name, NetNet::POUTPUT,
4786 # NetNet::WIRE, real_type, $1);
4787 # port_declaration_context.port_type = NetNet::POUTPUT;
4788 # port_declaration_context.port_net_type = NetNet::WIRE;
4789 # port_declaration_context.data_type = real_type;
4790 # delete[]$4;
4791 # $$ = ptmp;
4792 # }
4793 ()
4794 def p_port_declaration_7(p):
4795 '''port_declaration : attribute_list_opt K_output net_type_opt data_type_or_implicit IDENTIFIER '=' expression '''
4796 print('port_declaration_7', list(p))
4797 # { Module::port_t*ptmp;
4798 # perm_string name = lex_strings.make($5);
4799 # NetNet::Type use_type = $3;
4800 # if (use_type == NetNet::IMPLICIT) {
4801 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($4)) {
4802 # if (dtype->reg_flag)
4803 # use_type = NetNet::REG;
4804 # else
4805 # use_type = NetNet::IMPLICIT_REG;
4806 # } else {
4807 # use_type = NetNet::IMPLICIT_REG;
4808 # }
4809 # }
4810 # ptmp = pform_module_port_reference(name, @2.text, @2.first_line);
4811 # pform_module_define_port(@2, name, NetNet::POUTPUT, use_type, $4, $1);
4812 # port_declaration_context.port_type = NetNet::PINOUT;
4813 # port_declaration_context.port_net_type = use_type;
4814 # port_declaration_context.data_type = $4;
4815 #
4816 # pform_make_var_init(@5, name, $7);
4817 #
4818 # delete[]$5;
4819 # $$ = ptmp;
4820 # }
4821 ()
4822 def p_net_type_opt_1(p):
4823 '''net_type_opt : net_type '''
4824 print('net_type_opt_1', list(p))
4825 p[0] = p[1]
4826 ()
4827 def p_net_type_opt_2(p):
4828 '''net_type_opt : '''
4829 print('net_type_opt_2', list(p))
4830 # { $$ = NetNet::IMPLICIT; }
4831 ()
4832 def p_unsigned_signed_opt_1(p):
4833 '''unsigned_signed_opt : K_signed '''
4834 print('unsigned_signed_opt_1', list(p))
4835 # { $$ = true; }
4836 ()
4837 def p_unsigned_signed_opt_2(p):
4838 '''unsigned_signed_opt : K_unsigned '''
4839 print('unsigned_signed_opt_2', list(p))
4840 # { $$ = false; }
4841 ()
4842 def p_unsigned_signed_opt_3(p):
4843 '''unsigned_signed_opt : '''
4844 print('unsigned_signed_opt_3', list(p))
4845 # { $$ = false; }
4846 ()
4847 def p_signed_unsigned_opt_1(p):
4848 '''signed_unsigned_opt : K_signed '''
4849 print('signed_unsigned_opt_1', list(p))
4850 # { $$ = true; }
4851 ()
4852 def p_signed_unsigned_opt_2(p):
4853 '''signed_unsigned_opt : K_unsigned '''
4854 print('signed_unsigned_opt_2', list(p))
4855 # { $$ = false; }
4856 ()
4857 def p_signed_unsigned_opt_3(p):
4858 '''signed_unsigned_opt : '''
4859 print('signed_unsigned_opt_3', list(p))
4860 # { $$ = true; }
4861 ()
4862 def p_atom2_type_1(p):
4863 '''atom2_type : K_byte '''
4864 print('atom2_type_1', list(p))
4865 # { $$ = 8; }
4866 ()
4867 def p_atom2_type_2(p):
4868 '''atom2_type : K_shortint '''
4869 print('atom2_type_2', list(p))
4870 # { $$ = 16; }
4871 ()
4872 def p_atom2_type_3(p):
4873 '''atom2_type : K_int '''
4874 print('atom2_type_3', list(p))
4875 # { $$ = 32; }
4876 ()
4877 def p_atom2_type_4(p):
4878 '''atom2_type : K_longint '''
4879 print('atom2_type_4', list(p))
4880 # { $$ = 64; }
4881 ()
4882 def p_lpvalue_1(p):
4883 '''lpvalue : hierarchy_identifier '''
4884 print('lpvalue_1', list(p))
4885 p[0] = p[1]
4886 # { PEIdent*tmp = pform_new_ident(*$1);
4887 # FILE_NAME(tmp, @1);
4888 # $$ = tmp;
4889 # delete $1;
4890 # }
4891 ()
4892 def p_lpvalue_2(p):
4893 '''lpvalue : implicit_class_handle '.' hierarchy_identifier '''
4894 print('lpvalue_2', list(p))
4895 # { pform_name_t*t_name = $1;
4896 # while (!$3->empty()) {
4897 # t_name->push_back($3->front());
4898 # $3->pop_front();
4899 # }
4900 # PEIdent*tmp = new PEIdent(*t_name);
4901 # FILE_NAME(tmp, @1);
4902 # $$ = tmp;
4903 # delete $1;
4904 # delete $3;
4905 # }
4906 ()
4907 def p_lpvalue_3(p):
4908 '''lpvalue : '{' expression_list_proper '}' '''
4909 print('lpvalue_3', list(p))
4910 # { PEConcat*tmp = new PEConcat(*$2);
4911 # FILE_NAME(tmp, @1);
4912 # delete $2;
4913 # $$ = tmp;
4914 # }
4915 ()
4916 def p_lpvalue_4(p):
4917 '''lpvalue : streaming_concatenation '''
4918 print('lpvalue_4', list(p))
4919 # { yyerror(@1, "sorry: streaming concatenation not supported in l-values.");
4920 # $$ = 0;
4921 # }
4922 ()
4923 def p_cont_assign_1(p):
4924 '''cont_assign : lpvalue '=' expression '''
4925 print('cont_assign_1', list(p))
4926 # { list<PExpr*>*tmp = new list<PExpr*>;
4927 # tmp->push_back($1);
4928 # tmp->push_back($3);
4929 # $$ = tmp;
4930 # }
4931 ()
4932 def p_cont_assign_list_1(p):
4933 '''cont_assign_list : cont_assign_list ',' cont_assign '''
4934 print('cont_assign_list_1', list(p))
4935 # { list<PExpr*>*tmp = $1;
4936 # tmp->splice(tmp->end(), *$3);
4937 # delete $3;
4938 # $$ = tmp;
4939 # }
4940 ()
4941 def p_cont_assign_list_2(p):
4942 '''cont_assign_list : cont_assign '''
4943 print('cont_assign_list_2', list(p))
4944 p[0] = p[1]
4945 ()
4946 def p_module_1(p):
4947 '''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 '''
4948 print('module_1', list(p))
4949 clsname = [Leaf(token.NAME, 'class'),
4950 Leaf(token.NAME, p[4], prefix=' '),
4951 Leaf(token.COLON, ':')]
4952 stmt = Node(syms.pass_stmt, [Leaf(token.NAME, "pass"),])
4953 stmts = Node(syms.small_stmt, [stmt, Leaf(token.NEWLINE, '\n')])
4954 stmts = Node(syms.stmt, [stmts])
4955 suite = Node(syms.suite, [Leaf(token.NEWLINE, '\n'),
4956 Leaf(token.INDENT, ' '),
4957 stmts,
4958 Leaf(token.DEDENT, '')
4959 ])
4960 clsdecl = Node(syms.classdef, clsname + [suite],
4961 prefix='', fixers_applied=[])
4962 clsdecl = Node(syms.compound_stmt, [clsdecl])
4963 print ("clsdecl", repr(clsdecl))
4964 print ("clsstr:")
4965 print (str(clsdecl))
4966 p[0] = clsdecl
4967 # { // Last step: check any closing name. This is done late so
4968 # // that the parser can look ahead to detect the present
4969 # // endlabel_opt but still have the pform_endmodule() called
4970 # // early enough that the lexor can know we are outside the
4971 # // module.
4972 # if ($17) {
4973 # if (strcmp($4,$17) != 0) {
4974 # switch ($2) {
4975 # case K_module:
4976 # yyerror(@17, "error: End label doesn't match "
4977 # "module name.");
4978 # break;
4979 # case K_program:
4980 # yyerror(@17, "error: End label doesn't match "
4981 # "program name.");
4982 # break;
4983 # case K_interface:
4984 # yyerror(@17, "error: End label doesn't match "
4985 # "interface name.");
4986 # break;
4987 # default:
4988 # break;
4989 # }
4990 # }
4991 # if (($2 == K_module) && (! gn_system_verilog())) {
4992 # yyerror(@8, "error: Module end labels require "
4993 # "SystemVerilog.");
4994 # }
4995 # delete[]$17;
4996 # }
4997 # delete[]$4;
4998 # }
4999 ()
5000 def p__embed0_module(p):
5001 '''_embed0_module : '''
5002 # { pform_startmodule(@2, $4, $2==K_program, $2==K_interface, $3, $1); }
5003 ()
5004 def p__embed1_module(p):
5005 '''_embed1_module : '''
5006 # { pform_module_set_ports($8); }
5007 ()
5008 def p__embed2_module(p):
5009 '''_embed2_module : '''
5010 # { pform_set_scope_timescale(@2); }
5011 ()
5012 def p__embed3_module(p):
5013 '''_embed3_module : '''
5014 # { Module::UCDriveType ucd;
5015 # // The lexor detected `unconnected_drive directives and
5016 # // marked what it found in the uc_drive variable. Use that
5017 # // to generate a UCD flag for the module.
5018 # switch (uc_drive) {
5019 # case UCD_NONE:
5020 # default:
5021 # ucd = Module::UCD_NONE;
5022 # break;
5023 # case UCD_PULL0:
5024 # ucd = Module::UCD_PULL0;
5025 # break;
5026 # case UCD_PULL1:
5027 # ucd = Module::UCD_PULL1;
5028 # break;
5029 # }
5030 # // Check that program/endprogram and module/endmodule
5031 # // keywords match.
5032 # if ($2 != $15) {
5033 # switch ($2) {
5034 # case K_module:
5035 # yyerror(@15, "error: module not closed by endmodule.");
5036 # break;
5037 # case K_program:
5038 # yyerror(@15, "error: program not closed by endprogram.");
5039 # break;
5040 # case K_interface:
5041 # yyerror(@15, "error: interface not closed by endinterface.");
5042 # break;
5043 # default:
5044 # break;
5045 # }
5046 # }
5047 # pform_endmodule($4, in_celldefine, ucd);
5048 # }
5049 ()
5050 def p_module_start_1(p):
5051 '''module_start : K_module '''
5052 print('module_start_1', list(p))
5053 # { $$ = K_module; }
5054 ()
5055 def p_module_start_2(p):
5056 '''module_start : K_macromodule '''
5057 print('module_start_2', list(p))
5058 # { $$ = K_module; }
5059 ()
5060 def p_module_start_3(p):
5061 '''module_start : K_program '''
5062 print('module_start_3', list(p))
5063 # { $$ = K_program; }
5064 ()
5065 def p_module_start_4(p):
5066 '''module_start : K_interface '''
5067 print('module_start_4', list(p))
5068 # { $$ = K_interface; }
5069 ()
5070 def p_module_end_1(p):
5071 '''module_end : K_endmodule '''
5072 print('module_end_1', list(p))
5073 # { $$ = K_module; }
5074 ()
5075 def p_module_end_2(p):
5076 '''module_end : K_endprogram '''
5077 print('module_end_2', list(p))
5078 # { $$ = K_program; }
5079 ()
5080 def p_module_end_3(p):
5081 '''module_end : K_endinterface '''
5082 print('module_end_3', list(p))
5083 # { $$ = K_interface; }
5084 ()
5085 def p_endlabel_opt_1(p):
5086 '''endlabel_opt : ':' IDENTIFIER '''
5087 print('endlabel_opt_1', list(p))
5088 p[0] = p[2]
5089 ()
5090 def p_endlabel_opt_2(p):
5091 '''endlabel_opt : '''
5092 print('endlabel_opt_2', list(p))
5093 # { $$ = 0; }
5094 ()
5095 def p_module_attribute_foreign_1(p):
5096 '''module_attribute_foreign : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP '''
5097 print('module_attribute_foreign_1', list(p))
5098 # { $$ = 0; }
5099 ()
5100 def p_module_attribute_foreign_2(p):
5101 '''module_attribute_foreign : '''
5102 print('module_attribute_foreign_2', list(p))
5103 # { $$ = 0; }
5104 ()
5105 def p_module_port_list_opt_1(p):
5106 '''module_port_list_opt : '(' list_of_ports ')' '''
5107 print('module_port_list_opt_1', list(p))
5108 p[0] = p[2]
5109 ()
5110 def p_module_port_list_opt_2(p):
5111 '''module_port_list_opt : '(' list_of_port_declarations ')' '''
5112 print('module_port_list_opt_2', list(p))
5113 p[0] = p[2]
5114 ()
5115 def p_module_port_list_opt_3(p):
5116 '''module_port_list_opt : '''
5117 print('module_port_list_opt_3', list(p))
5118 # { $$ = 0; }
5119 ()
5120 def p_module_port_list_opt_4(p):
5121 '''module_port_list_opt : '(' error ')' '''
5122 print('module_port_list_opt_4', list(p))
5123 # { yyerror(@2, "Errors in port declarations.");
5124 # yyerrok;
5125 # $$ = 0;
5126 # }
5127 ()
5128 def p_module_parameter_port_list_opt_1(p):
5129 '''module_parameter_port_list_opt : '''
5130 print('module_parameter_port_list_opt_1', list(p))
5131 ()
5132 def p_module_parameter_port_list_opt_2(p):
5133 '''module_parameter_port_list_opt : '#' '(' module_parameter_port_list ')' '''
5134 print('module_parameter_port_list_opt_2', list(p))
5135 p[0] = p[2]
5136 ()
5137 def p_module_parameter_port_list_1(p):
5138 '''module_parameter_port_list : K_parameter param_type parameter_assign '''
5139 print('module_parameter_port_list_1', list(p))
5140 p[0] = [p[3]]
5141 ()
5142 def p_module_parameter_port_list_2(p):
5143 '''module_parameter_port_list : module_parameter_port_list ',' parameter_assign '''
5144 print('module_parameter_port_list_2', list(p))
5145 p[0] = p[1].append(p[3])
5146 ()
5147 def p_module_parameter_port_list_3(p):
5148 '''module_parameter_port_list : module_parameter_port_list ',' K_parameter param_type parameter_assign '''
5149 print('module_parameter_port_list_3', list(p))
5150 p[1].append(p[5])
5151 p[0] = p[1]
5152 ()
5153 def p_module_item_1(p):
5154 '''module_item : module '''
5155 print('module_item_1', list(p))
5156 ()
5157 def p_module_item_2(p):
5158 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_variable_list ';' '''
5159 print('module_item_2', list(p))
5160 # { data_type_t*data_type = $3;
5161 # if (data_type == 0) {
5162 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5163 # FILE_NAME(data_type, @2);
5164 # }
5165 # pform_set_data_type(@2, data_type, $5, $2, $1);
5166 # if ($4 != 0) {
5167 # yyerror(@2, "sorry: net delays not supported.");
5168 # delete $4;
5169 # }
5170 # delete $1;
5171 # }
5172 ()
5173 def p_module_item_3(p):
5174 '''module_item : attribute_list_opt K_wreal delay3 net_variable_list ';' '''
5175 print('module_item_3', list(p))
5176 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5177 # pform_set_data_type(@2, tmpt, $4, NetNet::WIRE, $1);
5178 # if ($3 != 0) {
5179 # yyerror(@3, "sorry: net delays not supported.");
5180 # delete $3;
5181 # }
5182 # delete $1;
5183 # }
5184 ()
5185 def p_module_item_4(p):
5186 '''module_item : attribute_list_opt K_wreal net_variable_list ';' '''
5187 print('module_item_4', list(p))
5188 # { real_type_t*tmpt = new real_type_t(real_type_t::REAL);
5189 # pform_set_data_type(@2, tmpt, $3, NetNet::WIRE, $1);
5190 # delete $1;
5191 # }
5192 ()
5193 def p_module_item_5(p):
5194 '''module_item : attribute_list_opt net_type data_type_or_implicit delay3_opt net_decl_assigns ';' '''
5195 print('module_item_5', list(p))
5196 # { data_type_t*data_type = $3;
5197 # if (data_type == 0) {
5198 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5199 # FILE_NAME(data_type, @2);
5200 # }
5201 # pform_makewire(@2, $4, str_strength, $5, $2, data_type);
5202 # if ($1) {
5203 # yywarn(@2, "Attributes are not supported on net declaration "
5204 # "assignments and will be discarded.");
5205 # delete $1;
5206 # }
5207 # }
5208 ()
5209 def p_module_item_6(p):
5210 '''module_item : attribute_list_opt net_type data_type_or_implicit drive_strength net_decl_assigns ';' '''
5211 print('module_item_6', list(p))
5212 # { data_type_t*data_type = $3;
5213 # if (data_type == 0) {
5214 # data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
5215 # FILE_NAME(data_type, @2);
5216 # }
5217 # pform_makewire(@2, 0, $4, $5, $2, data_type);
5218 # if ($1) {
5219 # yywarn(@2, "Attributes are not supported on net declaration "
5220 # "assignments and will be discarded.");
5221 # delete $1;
5222 # }
5223 # }
5224 ()
5225 def p_module_item_7(p):
5226 '''module_item : attribute_list_opt K_wreal net_decl_assigns ';' '''
5227 print('module_item_7', list(p))
5228 # { real_type_t*data_type = new real_type_t(real_type_t::REAL);
5229 # pform_makewire(@2, 0, str_strength, $3, NetNet::WIRE, data_type);
5230 # if ($1) {
5231 # yywarn(@2, "Attributes are not supported on net declaration "
5232 # "assignments and will be discarded.");
5233 # delete $1;
5234 # }
5235 # }
5236 ()
5237 def p_module_item_8(p):
5238 '''module_item : K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' '''
5239 print('module_item_8', list(p))
5240 # { yyerror(@1, "sorry: trireg nets not supported.");
5241 # delete $3;
5242 # delete $4;
5243 # }
5244 ()
5245 def p_module_item_9(p):
5246 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit list_of_port_identifiers ';' '''
5247 print('module_item_9', list(p))
5248 # { pform_module_define_port(@2, $5, $2, $3, $4, $1); }
5249 ()
5250 def p_module_item_10(p):
5251 '''module_item : attribute_list_opt port_direction K_wreal list_of_port_identifiers ';' '''
5252 print('module_item_10', list(p))
5253 # { real_type_t*real_type = new real_type_t(real_type_t::REAL);
5254 # pform_module_define_port(@2, $4, $2, NetNet::WIRE, real_type, $1);
5255 # }
5256 ()
5257 def p_module_item_11(p):
5258 '''module_item : attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' '''
5259 print('module_item_11', list(p))
5260 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5261 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5262 # if (dtype->implicit_flag)
5263 # use_type = NetNet::NONE;
5264 # }
5265 # if (use_type == NetNet::NONE)
5266 # pform_set_port_type(@2, $4, NetNet::PINOUT, $3, $1);
5267 # else
5268 # pform_module_define_port(@2, $4, NetNet::PINOUT, use_type, $3, $1);
5269 # }
5270 ()
5271 def p_module_item_12(p):
5272 '''module_item : attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' '''
5273 print('module_item_12', list(p))
5274 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5275 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5276 # if (dtype->implicit_flag)
5277 # use_type = NetNet::NONE;
5278 # }
5279 # if (use_type == NetNet::NONE)
5280 # pform_set_port_type(@2, $4, NetNet::PINPUT, $3, $1);
5281 # else
5282 # pform_module_define_port(@2, $4, NetNet::PINPUT, use_type, $3, $1);
5283 # }
5284 ()
5285 def p_module_item_13(p):
5286 '''module_item : attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' '''
5287 print('module_item_13', list(p))
5288 # { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
5289 # if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
5290 # if (dtype->implicit_flag)
5291 # use_type = NetNet::NONE;
5292 # else if (dtype->reg_flag)
5293 # use_type = NetNet::REG;
5294 # else
5295 # use_type = NetNet::IMPLICIT_REG;
5296 #
5297 # // The SystemVerilog types that can show up as
5298 # // output ports are implicitly (on the inside)
5299 # // variables because "reg" is not valid syntax
5300 # // here.
5301 # } else if (dynamic_cast<atom2_type_t*> ($3)) {
5302 # use_type = NetNet::IMPLICIT_REG;
5303 # } else if (dynamic_cast<struct_type_t*> ($3)) {
5304 # use_type = NetNet::IMPLICIT_REG;
5305 # } else if (enum_type_t*etype = dynamic_cast<enum_type_t*> ($3)) {
5306 # if(etype->base_type == IVL_VT_LOGIC)
5307 # use_type = NetNet::IMPLICIT_REG;
5308 # }
5309 # if (use_type == NetNet::NONE)
5310 # pform_set_port_type(@2, $4, NetNet::POUTPUT, $3, $1);
5311 # else
5312 # pform_module_define_port(@2, $4, NetNet::POUTPUT, use_type, $3, $1);
5313 # }
5314 ()
5315 def p_module_item_14(p):
5316 '''module_item : attribute_list_opt port_direction net_type data_type_or_implicit error ';' '''
5317 print('module_item_14', list(p))
5318 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5319 # if ($1) delete $1;
5320 # if ($4) delete $4;
5321 # yyerrok;
5322 # }
5323 ()
5324 def p_module_item_15(p):
5325 '''module_item : attribute_list_opt K_inout data_type_or_implicit error ';' '''
5326 print('module_item_15', list(p))
5327 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5328 # if ($1) delete $1;
5329 # if ($3) delete $3;
5330 # yyerrok;
5331 # }
5332 ()
5333 def p_module_item_16(p):
5334 '''module_item : attribute_list_opt K_input data_type_or_implicit error ';' '''
5335 print('module_item_16', list(p))
5336 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5337 # if ($1) delete $1;
5338 # if ($3) delete $3;
5339 # yyerrok;
5340 # }
5341 ()
5342 def p_module_item_17(p):
5343 '''module_item : attribute_list_opt K_output data_type_or_implicit error ';' '''
5344 print('module_item_17', list(p))
5345 # { yyerror(@2, "error: Invalid variable list in port declaration.");
5346 # if ($1) delete $1;
5347 # if ($3) delete $3;
5348 # yyerrok;
5349 # }
5350 ()
5351 def p_module_item_18(p):
5352 '''module_item : DISCIPLINE_IDENTIFIER list_of_identifiers ';' '''
5353 print('module_item_18', list(p))
5354 # { pform_attach_discipline(@1, $1, $2); }
5355 ()
5356 def p_module_item_19(p):
5357 '''module_item : attribute_list_opt _embed0_module_item block_item_decl '''
5358 print('module_item_19', list(p))
5359 # { delete attributes_in_context;
5360 # attributes_in_context = 0;
5361 # }
5362 ()
5363 def p_module_item_20(p):
5364 '''module_item : K_defparam _embed1_module_item defparam_assign_list ';' '''
5365 print('module_item_20', list(p))
5366 ()
5367 def p_module_item_21(p):
5368 '''module_item : attribute_list_opt gatetype gate_instance_list ';' '''
5369 print('module_item_21', list(p))
5370 # { pform_makegates(@2, $2, str_strength, 0, $3, $1); }
5371 ()
5372 def p_module_item_22(p):
5373 '''module_item : attribute_list_opt gatetype delay3 gate_instance_list ';' '''
5374 print('module_item_22', list(p))
5375 # { pform_makegates(@2, $2, str_strength, $3, $4, $1); }
5376 ()
5377 def p_module_item_23(p):
5378 '''module_item : attribute_list_opt gatetype drive_strength gate_instance_list ';' '''
5379 print('module_item_23', list(p))
5380 # { pform_makegates(@2, $2, $3, 0, $4, $1); }
5381 ()
5382 def p_module_item_24(p):
5383 '''module_item : attribute_list_opt gatetype drive_strength delay3 gate_instance_list ';' '''
5384 print('module_item_24', list(p))
5385 # { pform_makegates(@2, $2, $3, $4, $5, $1); }
5386 ()
5387 def p_module_item_25(p):
5388 '''module_item : attribute_list_opt switchtype gate_instance_list ';' '''
5389 print('module_item_25', list(p))
5390 # { pform_makegates(@2, $2, str_strength, 0, $3, $1); }
5391 ()
5392 def p_module_item_26(p):
5393 '''module_item : attribute_list_opt switchtype delay3 gate_instance_list ';' '''
5394 print('module_item_26', list(p))
5395 # { pform_makegates(@2, $2, str_strength, $3, $4, $1); }
5396 ()
5397 def p_module_item_27(p):
5398 '''module_item : K_pullup gate_instance_list ';' '''
5399 print('module_item_27', list(p))
5400 # { pform_makegates(@1, PGBuiltin::PULLUP, pull_strength, 0, $2, 0); }
5401 ()
5402 def p_module_item_28(p):
5403 '''module_item : K_pulldown gate_instance_list ';' '''
5404 print('module_item_28', list(p))
5405 # { pform_makegates(@1, PGBuiltin::PULLDOWN, pull_strength, 0, $2, 0); }
5406 ()
5407 def p_module_item_29(p):
5408 '''module_item : K_pullup '(' dr_strength1 ')' gate_instance_list ';' '''
5409 print('module_item_29', list(p))
5410 # { pform_makegates(@1, PGBuiltin::PULLUP, $3, 0, $5, 0); }
5411 ()
5412 def p_module_item_30(p):
5413 '''module_item : K_pullup '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5414 print('module_item_30', list(p))
5415 # { pform_makegates(@1, PGBuiltin::PULLUP, $3, 0, $7, 0); }
5416 ()
5417 def p_module_item_31(p):
5418 '''module_item : K_pullup '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5419 print('module_item_31', list(p))
5420 # { pform_makegates(@1, PGBuiltin::PULLUP, $5, 0, $7, 0); }
5421 ()
5422 def p_module_item_32(p):
5423 '''module_item : K_pulldown '(' dr_strength0 ')' gate_instance_list ';' '''
5424 print('module_item_32', list(p))
5425 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $3, 0, $5, 0); }
5426 ()
5427 def p_module_item_33(p):
5428 '''module_item : K_pulldown '(' dr_strength1 ',' dr_strength0 ')' gate_instance_list ';' '''
5429 print('module_item_33', list(p))
5430 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $5, 0, $7, 0); }
5431 ()
5432 def p_module_item_34(p):
5433 '''module_item : K_pulldown '(' dr_strength0 ',' dr_strength1 ')' gate_instance_list ';' '''
5434 print('module_item_34', list(p))
5435 # { pform_makegates(@1, PGBuiltin::PULLDOWN, $3, 0, $7, 0); }
5436 ()
5437 def p_module_item_35(p):
5438 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' '''
5439 print('module_item_35', list(p))
5440 # { perm_string tmp1 = lex_strings.make($2);
5441 # pform_make_modgates(@2, tmp1, $3, $4, $1);
5442 # delete[]$2;
5443 # }
5444 ()
5445 def p_module_item_36(p):
5446 '''module_item : attribute_list_opt IDENTIFIER parameter_value_opt error ';' '''
5447 print('module_item_36', list(p))
5448 # { yyerror(@2, "error: Invalid module instantiation");
5449 # delete[]$2;
5450 # if ($1) delete $1;
5451 # }
5452 ()
5453 def p_module_item_37(p):
5454 '''module_item : K_assign drive_strength_opt delay3_opt cont_assign_list ';' '''
5455 print('module_item_37', list(p))
5456 # { pform_make_pgassign_list($4, $3, $2, @1.text, @1.first_line); }
5457 ()
5458 def p_module_item_38(p):
5459 '''module_item : attribute_list_opt K_always statement_item '''
5460 print('module_item_38', list(p))
5461 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS, $3, $1);
5462 # FILE_NAME(tmp, @2);
5463 # }
5464 ()
5465 def p_module_item_39(p):
5466 '''module_item : attribute_list_opt K_always_comb statement_item '''
5467 print('module_item_39', list(p))
5468 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_COMB, $3, $1);
5469 # FILE_NAME(tmp, @2);
5470 # }
5471 ()
5472 def p_module_item_40(p):
5473 '''module_item : attribute_list_opt K_always_ff statement_item '''
5474 print('module_item_40', list(p))
5475 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_FF, $3, $1);
5476 # FILE_NAME(tmp, @2);
5477 # }
5478 ()
5479 def p_module_item_41(p):
5480 '''module_item : attribute_list_opt K_always_latch statement_item '''
5481 print('module_item_41', list(p))
5482 # { PProcess*tmp = pform_make_behavior(IVL_PR_ALWAYS_LATCH, $3, $1);
5483 # FILE_NAME(tmp, @2);
5484 # }
5485 ()
5486 def p_module_item_42(p):
5487 '''module_item : attribute_list_opt K_initial statement_item '''
5488 print('module_item_42', list(p))
5489 # { PProcess*tmp = pform_make_behavior(IVL_PR_INITIAL, $3, $1);
5490 # FILE_NAME(tmp, @2);
5491 # }
5492 ()
5493 def p_module_item_43(p):
5494 '''module_item : attribute_list_opt K_final statement_item '''
5495 print('module_item_43', list(p))
5496 # { PProcess*tmp = pform_make_behavior(IVL_PR_FINAL, $3, $1);
5497 # FILE_NAME(tmp, @2);
5498 # }
5499 ()
5500 def p_module_item_44(p):
5501 '''module_item : attribute_list_opt K_analog analog_statement '''
5502 print('module_item_44', list(p))
5503 # { pform_make_analog_behavior(@2, IVL_PR_ALWAYS, $3); }
5504 ()
5505 def p_module_item_45(p):
5506 '''module_item : attribute_list_opt assertion_item '''
5507 print('module_item_45', list(p))
5508 ()
5509 def p_module_item_46(p):
5510 '''module_item : timeunits_declaration '''
5511 print('module_item_46', list(p))
5512 ()
5513 def p_module_item_47(p):
5514 '''module_item : class_declaration '''
5515 print('module_item_47', list(p))
5516 ()
5517 def p_module_item_48(p):
5518 '''module_item : task_declaration '''
5519 print('module_item_48', list(p))
5520 ()
5521 def p_module_item_49(p):
5522 '''module_item : function_declaration '''
5523 print('module_item_49', list(p))
5524 ()
5525 def p_module_item_50(p):
5526 '''module_item : K_generate generate_item_list_opt K_endgenerate '''
5527 print('module_item_50', list(p))
5528 # { // Test for bad nesting. I understand it, but it is illegal.
5529 # if (pform_parent_generate()) {
5530 # cerr << @1 << ": error: Generate/endgenerate regions cannot nest." << endl;
5531 # cerr << @1 << ": : Try removing optional generate/endgenerate keywords," << endl;
5532 # cerr << @1 << ": : or move them to surround the parent generate scheme." << endl;
5533 # error_count += 1;
5534 # }
5535 # }
5536 ()
5537 def p_module_item_51(p):
5538 '''module_item : K_genvar list_of_identifiers ';' '''
5539 print('module_item_51', list(p))
5540 # { pform_genvars(@1, $2); }
5541 ()
5542 def p_module_item_52(p):
5543 '''module_item : K_for '(' IDENTIFIER '=' expression ';' expression ';' IDENTIFIER '=' expression ')' _embed2_module_item generate_block '''
5544 print('module_item_52', list(p))
5545 # { pform_endgenerate(); }
5546 ()
5547 def p_module_item_53(p):
5548 '''module_item : generate_if generate_block_opt K_else _embed3_module_item generate_block '''
5549 print('module_item_53', list(p))
5550 # { pform_endgenerate(); }
5551 ()
5552 def p_module_item_54(p):
5553 '''module_item : generate_if generate_block_opt %prec less_than_K_else '''
5554 print('module_item_54', list(p))
5555 # { pform_endgenerate(); }
5556 ()
5557 def p_module_item_55(p):
5558 '''module_item : K_case '(' expression ')' _embed4_module_item generate_case_items K_endcase '''
5559 print('module_item_55', list(p))
5560 # { pform_endgenerate(); }
5561 ()
5562 def p_module_item_56(p):
5563 '''module_item : modport_declaration '''
5564 print('module_item_56', list(p))
5565 ()
5566 def p_module_item_57(p):
5567 '''module_item : package_import_declaration '''
5568 print('module_item_57', list(p))
5569 ()
5570 def p_module_item_58(p):
5571 '''module_item : attribute_list_opt K_specparam _embed5_module_item specparam_decl ';' '''
5572 print('module_item_58', list(p))
5573 ()
5574 def p_module_item_59(p):
5575 '''module_item : K_specify _embed6_module_item specify_item_list_opt K_endspecify '''
5576 print('module_item_59', list(p))
5577 ()
5578 def p_module_item_60(p):
5579 '''module_item : K_specify error K_endspecify '''
5580 print('module_item_60', list(p))
5581 # { yyerror(@1, "error: syntax error in specify block");
5582 # yyerrok;
5583 # }
5584 ()
5585 def p_module_item_61(p):
5586 '''module_item : error ';' '''
5587 print('module_item_61', list(p))
5588 # { yyerror(@2, "error: invalid module item.");
5589 # yyerrok;
5590 # }
5591 ()
5592 def p_module_item_62(p):
5593 '''module_item : K_assign error '=' expression ';' '''
5594 print('module_item_62', list(p))
5595 # { yyerror(@1, "error: syntax error in left side "
5596 # "of continuous assignment.");
5597 # yyerrok;
5598 # }
5599 ()
5600 def p_module_item_63(p):
5601 '''module_item : K_assign error ';' '''
5602 print('module_item_63', list(p))
5603 # { yyerror(@1, "error: syntax error in "
5604 # "continuous assignment");
5605 # yyerrok;
5606 # }
5607 ()
5608 def p_module_item_64(p):
5609 '''module_item : K_function error K_endfunction endlabel_opt '''
5610 print('module_item_64', list(p))
5611 # { yyerror(@1, "error: I give up on this "
5612 # "function definition.");
5613 # if ($4) {
5614 # if (!gn_system_verilog()) {
5615 # yyerror(@4, "error: Function end names require "
5616 # "SystemVerilog.");
5617 # }
5618 # delete[]$4;
5619 # }
5620 # yyerrok;
5621 # }
5622 ()
5623 def p_module_item_65(p):
5624 '''module_item : KK_attribute '(' IDENTIFIER ',' STRING ',' STRING ')' ';' '''
5625 print('module_item_65', list(p))
5626 # { perm_string tmp3 = lex_strings.make($3);
5627 # perm_string tmp5 = lex_strings.make($5);
5628 # pform_set_attrib(tmp3, tmp5, $7);
5629 # delete[] $3;
5630 # delete[] $5;
5631 # }
5632 ()
5633 def p_module_item_66(p):
5634 '''module_item : KK_attribute '(' error ')' ';' '''
5635 print('module_item_66', list(p))
5636 # { yyerror(@1, "error: Malformed $attribute parameter list."); }
5637 ()
5638 def p__embed0_module_item(p):
5639 '''_embed0_module_item : '''
5640 # { attributes_in_context = $1; }
5641 ()
5642 def p__embed1_module_item(p):
5643 '''_embed1_module_item : '''
5644 # { if (pform_in_interface())
5645 # yyerror(@1, "error: Parameter overrides are not allowed "
5646 # "in interfaces.");
5647 # }
5648 ()
5649 def p__embed2_module_item(p):
5650 '''_embed2_module_item : '''
5651 # { pform_start_generate_for(@1, $3, $5, $7, $9, $11); }
5652 ()
5653 def p__embed3_module_item(p):
5654 '''_embed3_module_item : '''
5655 # { pform_start_generate_else(@1); }
5656 ()
5657 def p__embed4_module_item(p):
5658 '''_embed4_module_item : '''
5659 # { pform_start_generate_case(@1, $3); }
5660 ()
5661 def p__embed5_module_item(p):
5662 '''_embed5_module_item : '''
5663 # { if (pform_in_interface())
5664 # yyerror(@1, "error: specparam declarations are not allowed "
5665 # "in interfaces.");
5666 # }
5667 ()
5668 def p__embed6_module_item(p):
5669 '''_embed6_module_item : '''
5670 # { if (pform_in_interface())
5671 # yyerror(@1, "error: specify blocks are not allowed "
5672 # "in interfaces.");
5673 # }
5674 ()
5675 def p_module_item_list_1(p):
5676 '''module_item_list : module_item_list module_item '''
5677 print('module_item_list_1', list(p))
5678 ()
5679 def p_module_item_list_2(p):
5680 '''module_item_list : module_item '''
5681 print('module_item_list_2', list(p))
5682 ()
5683 def p_module_item_list_opt_1(p):
5684 '''module_item_list_opt : module_item_list '''
5685 print('module_item_list_opt_1', list(p))
5686 ()
5687 def p_module_item_list_opt_2(p):
5688 '''module_item_list_opt : '''
5689 print('module_item_list_opt_2', list(p))
5690 ()
5691 def p_generate_if_1(p):
5692 '''generate_if : K_if '(' expression ')' '''
5693 print('generate_if_1', list(p))
5694 # { pform_start_generate_if(@1, $3); }
5695 ()
5696 def p_generate_case_items_1(p):
5697 '''generate_case_items : generate_case_items generate_case_item '''
5698 print('generate_case_items_1', list(p))
5699 ()
5700 def p_generate_case_items_2(p):
5701 '''generate_case_items : generate_case_item '''
5702 print('generate_case_items_2', list(p))
5703 ()
5704 def p_generate_case_item_1(p):
5705 '''generate_case_item : expression_list_proper ':' _embed0_generate_case_item generate_block_opt '''
5706 print('generate_case_item_1', list(p))
5707 # { pform_endgenerate(); }
5708 ()
5709 def p_generate_case_item_2(p):
5710 '''generate_case_item : K_default ':' _embed1_generate_case_item generate_block_opt '''
5711 print('generate_case_item_2', list(p))
5712 # { pform_endgenerate(); }
5713 ()
5714 def p__embed0_generate_case_item(p):
5715 '''_embed0_generate_case_item : '''
5716 # { pform_generate_case_item(@1, $1); }
5717 ()
5718 def p__embed1_generate_case_item(p):
5719 '''_embed1_generate_case_item : '''
5720 # { pform_generate_case_item(@1, 0); }
5721 ()
5722 def p_generate_item_1(p):
5723 '''generate_item : module_item '''
5724 print('generate_item_1', list(p))
5725 ()
5726 def p_generate_item_2(p):
5727 '''generate_item : K_begin generate_item_list_opt K_end '''
5728 print('generate_item_2', list(p))
5729 # { /* Detect and warn about anachronistic begin/end use */
5730 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5731 # warn_count += 1;
5732 # cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl;
5733 # }
5734 # }
5735 ()
5736 def p_generate_item_3(p):
5737 '''generate_item : K_begin ':' IDENTIFIER _embed0_generate_item generate_item_list_opt K_end '''
5738 print('generate_item_3', list(p))
5739 # { /* Detect and warn about anachronistic named begin/end use */
5740 # if (generation_flag > GN_VER2001 && warn_anachronisms) {
5741 # warn_count += 1;
5742 # cerr << @1 << ": warning: Anachronistic use of named begin/end to surround generate schemes." << endl;
5743 # }
5744 # pform_endgenerate();
5745 # }
5746 ()
5747 def p__embed0_generate_item(p):
5748 '''_embed0_generate_item : '''
5749 # {
5750 # pform_start_generate_nblock(@1, $3);
5751 # }
5752 ()
5753 def p_generate_item_list_1(p):
5754 '''generate_item_list : generate_item_list generate_item '''
5755 print('generate_item_list_1', list(p))
5756 ()
5757 def p_generate_item_list_2(p):
5758 '''generate_item_list : generate_item '''
5759 print('generate_item_list_2', list(p))
5760 ()
5761 def p_generate_item_list_opt_1(p):
5762 '''generate_item_list_opt : generate_item_list '''
5763 print('generate_item_list_opt_1', list(p))
5764 ()
5765 def p_generate_item_list_opt_2(p):
5766 '''generate_item_list_opt : '''
5767 print('generate_item_list_opt_2', list(p))
5768 ()
5769 def p_generate_block_1(p):
5770 '''generate_block : module_item '''
5771 print('generate_block_1', list(p))
5772 ()
5773 def p_generate_block_2(p):
5774 '''generate_block : K_begin generate_item_list_opt K_end '''
5775 print('generate_block_2', list(p))
5776 ()
5777 def p_generate_block_3(p):
5778 '''generate_block : K_begin ':' IDENTIFIER generate_item_list_opt K_end endlabel_opt '''
5779 print('generate_block_3', list(p))
5780 # { pform_generate_block_name($3);
5781 # if ($6) {
5782 # if (strcmp($3,$6) != 0) {
5783 # yyerror(@6, "error: End label doesn't match "
5784 # "begin name");
5785 # }
5786 # if (! gn_system_verilog()) {
5787 # yyerror(@6, "error: Begin end labels require "
5788 # "SystemVerilog.");
5789 # }
5790 # delete[]$6;
5791 # }
5792 # delete[]$3;
5793 # }
5794 ()
5795 def p_generate_block_opt_1(p):
5796 '''generate_block_opt : generate_block '''
5797 print('generate_block_opt_1', list(p))
5798 ()
5799 def p_generate_block_opt_2(p):
5800 '''generate_block_opt : ';' '''
5801 print('generate_block_opt_2', list(p))
5802 ()
5803 def p_net_decl_assign_1(p):
5804 '''net_decl_assign : IDENTIFIER '=' expression '''
5805 print('net_decl_assign_1', list(p))
5806 # { net_decl_assign_t*tmp = new net_decl_assign_t;
5807 # tmp->next = tmp;
5808 # tmp->name = lex_strings.make($1);
5809 # tmp->expr = $3;
5810 # delete[]$1;
5811 # $$ = tmp;
5812 # }
5813 ()
5814 def p_net_decl_assigns_1(p):
5815 '''net_decl_assigns : net_decl_assigns ',' net_decl_assign '''
5816 print('net_decl_assigns_1', list(p))
5817 # { net_decl_assign_t*tmp = $1;
5818 # $3->next = tmp->next;
5819 # tmp->next = $3;
5820 # $$ = tmp;
5821 # }
5822 ()
5823 def p_net_decl_assigns_2(p):
5824 '''net_decl_assigns : net_decl_assign '''
5825 print('net_decl_assigns_2', list(p))
5826 # { $$ = $1;
5827 # }
5828 ()
5829 def p_bit_logic_1(p):
5830 '''bit_logic : K_logic '''
5831 print('bit_logic_1', list(p))
5832 # { $$ = IVL_VT_LOGIC; }
5833 ()
5834 def p_bit_logic_2(p):
5835 '''bit_logic : K_bool '''
5836 print('bit_logic_2', list(p))
5837 # { $$ = IVL_VT_BOOL; /* Icarus misc */}
5838 ()
5839 def p_bit_logic_3(p):
5840 '''bit_logic : K_bit '''
5841 print('bit_logic_3', list(p))
5842 # { $$ = IVL_VT_BOOL; /* IEEE1800 / IEEE1364-2009 */}
5843 ()
5844 def p_bit_logic_opt_1(p):
5845 '''bit_logic_opt : bit_logic '''
5846 print('bit_logic_opt_1', list(p))
5847 ()
5848 def p_bit_logic_opt_2(p):
5849 '''bit_logic_opt : '''
5850 print('bit_logic_opt_2', list(p))
5851 # { $$ = IVL_VT_NO_TYPE; }
5852 ()
5853 def p_net_type_1(p):
5854 '''net_type : K_wire '''
5855 print('net_type_1', list(p))
5856 # { $$ = NetNet::WIRE; }
5857 ()
5858 def p_net_type_2(p):
5859 '''net_type : K_tri '''
5860 print('net_type_2', list(p))
5861 # { $$ = NetNet::TRI; }
5862 ()
5863 def p_net_type_3(p):
5864 '''net_type : K_tri1 '''
5865 print('net_type_3', list(p))
5866 # { $$ = NetNet::TRI1; }
5867 ()
5868 def p_net_type_4(p):
5869 '''net_type : K_supply0 '''
5870 print('net_type_4', list(p))
5871 # { $$ = NetNet::SUPPLY0; }
5872 ()
5873 def p_net_type_5(p):
5874 '''net_type : K_wand '''
5875 print('net_type_5', list(p))
5876 # { $$ = NetNet::WAND; }
5877 ()
5878 def p_net_type_6(p):
5879 '''net_type : K_triand '''
5880 print('net_type_6', list(p))
5881 # { $$ = NetNet::TRIAND; }
5882 ()
5883 def p_net_type_7(p):
5884 '''net_type : K_tri0 '''
5885 print('net_type_7', list(p))
5886 # { $$ = NetNet::TRI0; }
5887 ()
5888 def p_net_type_8(p):
5889 '''net_type : K_supply1 '''
5890 print('net_type_8', list(p))
5891 # { $$ = NetNet::SUPPLY1; }
5892 ()
5893 def p_net_type_9(p):
5894 '''net_type : K_wor '''
5895 print('net_type_9', list(p))
5896 # { $$ = NetNet::WOR; }
5897 ()
5898 def p_net_type_10(p):
5899 '''net_type : K_trior '''
5900 print('net_type_10', list(p))
5901 # { $$ = NetNet::TRIOR; }
5902 ()
5903 def p_net_type_11(p):
5904 '''net_type : K_wone '''
5905 print('net_type_11', list(p))
5906 # { $$ = NetNet::UNRESOLVED_WIRE;
5907 # cerr << @1.text << ":" << @1.first_line << ": warning: "
5908 # "'wone' is deprecated, please use 'uwire' "
5909 # "instead." << endl;
5910 # }
5911 ()
5912 def p_net_type_12(p):
5913 '''net_type : K_uwire '''
5914 print('net_type_12', list(p))
5915 # { $$ = NetNet::UNRESOLVED_WIRE; }
5916 ()
5917 def p_param_type_1(p):
5918 '''param_type : bit_logic_opt unsigned_signed_opt dimensions_opt '''
5919 print('param_type_1', list(p))
5920 # { param_active_range = $3;
5921 # param_active_signed = $2;
5922 # if (($1 == IVL_VT_NO_TYPE) && ($3 != 0))
5923 # param_active_type = IVL_VT_LOGIC;
5924 # else
5925 # param_active_type = $1;
5926 # }
5927 ()
5928 def p_param_type_2(p):
5929 '''param_type : K_integer '''
5930 print('param_type_2', list(p))
5931 # { param_active_range = make_range_from_width(integer_width);
5932 # param_active_signed = true;
5933 # param_active_type = IVL_VT_LOGIC;
5934 # }
5935 ()
5936 def p_param_type_3(p):
5937 '''param_type : K_time '''
5938 print('param_type_3', list(p))
5939 # { param_active_range = make_range_from_width(64);
5940 # param_active_signed = false;
5941 # param_active_type = IVL_VT_LOGIC;
5942 # }
5943 ()
5944 def p_param_type_4(p):
5945 '''param_type : real_or_realtime '''
5946 print('param_type_4', list(p))
5947 # { param_active_range = 0;
5948 # param_active_signed = true;
5949 # param_active_type = IVL_VT_REAL;
5950 # }
5951 ()
5952 def p_param_type_5(p):
5953 '''param_type : atom2_type '''
5954 print('param_type_5', list(p))
5955 # { param_active_range = make_range_from_width($1);
5956 # param_active_signed = true;
5957 # param_active_type = IVL_VT_BOOL;
5958 # }
5959 ()
5960 def p_param_type_6(p):
5961 '''param_type : TYPE_IDENTIFIER '''
5962 print('param_type_6', list(p))
5963 # { pform_set_param_from_type(@1, $1.type, $1.text, param_active_range,
5964 # param_active_signed, param_active_type);
5965 # delete[]$1.text;
5966 # }
5967 ()
5968 def p_parameter_assign_list_1(p):
5969 '''parameter_assign_list : parameter_assign '''
5970 print('parameter_assign_list_1', list(p))
5971 ()
5972 def p_parameter_assign_list_2(p):
5973 '''parameter_assign_list : parameter_assign_list ',' parameter_assign '''
5974 print('parameter_assign_list_2', list(p))
5975 ()
5976 def p_localparam_assign_list_1(p):
5977 '''localparam_assign_list : localparam_assign '''
5978 print('localparam_assign_list_1', list(p))
5979 ()
5980 def p_localparam_assign_list_2(p):
5981 '''localparam_assign_list : localparam_assign_list ',' localparam_assign '''
5982 print('localparam_assign_list_2', list(p))
5983 ()
5984 def p_parameter_assign_1(p):
5985 '''parameter_assign : IDENTIFIER '=' expression parameter_value_ranges_opt '''
5986 print('parameter_assign_1', list(p))
5987 tpname = Node(syms.tname, [Leaf(token.NAME, p[1])])
5988 expr = Node(syms.tfpdef, [tpname, Leaf(token.EQUAL, p[2]), p[3] ])
5989 p[0] = expr
5990 # { PExpr*tmp = $3;
5991 # pform_set_parameter(@1, lex_strings.make($1), param_active_type,
5992 # param_active_signed, param_active_range, tmp, $4);
5993 # delete[]$1;
5994 # }
5995 ()
5996 def p_localparam_assign_1(p):
5997 '''localparam_assign : IDENTIFIER '=' expression '''
5998 print('localparam_assign_1', list(p))
5999 # { PExpr*tmp = $3;
6000 # pform_set_localparam(@1, lex_strings.make($1), param_active_type,
6001 # param_active_signed, param_active_range, tmp);
6002 # delete[]$1;
6003 # }
6004 ()
6005 def p_parameter_value_ranges_opt_1(p):
6006 '''parameter_value_ranges_opt : parameter_value_ranges '''
6007 print('parameter_value_ranges_opt_1', list(p))
6008 p[0] = p[1]
6009 ()
6010 def p_parameter_value_ranges_opt_2(p):
6011 '''parameter_value_ranges_opt : '''
6012 print('parameter_value_ranges_opt_2', list(p))
6013 # { $$ = 0; }
6014 ()
6015 def p_parameter_value_ranges_1(p):
6016 '''parameter_value_ranges : parameter_value_ranges parameter_value_range '''
6017 print('parameter_value_ranges_1', list(p))
6018 # { $$ = $2; $$->next = $1; }
6019 ()
6020 def p_parameter_value_ranges_2(p):
6021 '''parameter_value_ranges : parameter_value_range '''
6022 print('parameter_value_ranges_2', list(p))
6023 # { $$ = $1; $$->next = 0; }
6024 ()
6025 def p_parameter_value_range_1(p):
6026 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ']' '''
6027 print('parameter_value_range_1', list(p))
6028 # { $$ = pform_parameter_value_range($1, false, $3, false, $5); }
6029 ()
6030 def p_parameter_value_range_2(p):
6031 '''parameter_value_range : from_exclude '[' value_range_expression ':' value_range_expression ')' '''
6032 print('parameter_value_range_2', list(p))
6033 # { $$ = pform_parameter_value_range($1, false, $3, true, $5); }
6034 ()
6035 def p_parameter_value_range_3(p):
6036 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ']' '''
6037 print('parameter_value_range_3', list(p))
6038 # { $$ = pform_parameter_value_range($1, true, $3, false, $5); }
6039 ()
6040 def p_parameter_value_range_4(p):
6041 '''parameter_value_range : from_exclude '(' value_range_expression ':' value_range_expression ')' '''
6042 print('parameter_value_range_4', list(p))
6043 # { $$ = pform_parameter_value_range($1, true, $3, true, $5); }
6044 ()
6045 def p_parameter_value_range_5(p):
6046 '''parameter_value_range : K_exclude expression '''
6047 print('parameter_value_range_5', list(p))
6048 # { $$ = pform_parameter_value_range(true, false, $2, false, $2); }
6049 ()
6050 def p_value_range_expression_1(p):
6051 '''value_range_expression : expression '''
6052 print('value_range_expression_1', list(p))
6053 p[0] = p[1]
6054 ()
6055 def p_value_range_expression_2(p):
6056 '''value_range_expression : K_inf '''
6057 print('value_range_expression_2', list(p))
6058 # { $$ = 0; }
6059 ()
6060 def p_value_range_expression_3(p):
6061 '''value_range_expression : '+' K_inf '''
6062 print('value_range_expression_3', list(p))
6063 # { $$ = 0; }
6064 ()
6065 def p_value_range_expression_4(p):
6066 '''value_range_expression : '-' K_inf '''
6067 print('value_range_expression_4', list(p))
6068 # { $$ = 0; }
6069 ()
6070 def p_from_exclude_1(p):
6071 '''from_exclude : K_from '''
6072 print('from_exclude_1', list(p))
6073 # { $$ = false; }
6074 ()
6075 def p_from_exclude_2(p):
6076 '''from_exclude : K_exclude '''
6077 print('from_exclude_2', list(p))
6078 # { $$ = true; }
6079 ()
6080 def p_parameter_value_opt_1(p):
6081 '''parameter_value_opt : '#' '(' expression_list_with_nuls ')' '''
6082 print('parameter_value_opt_1', list(p))
6083 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6084 # tmp->by_order = $3;
6085 # tmp->by_name = 0;
6086 # $$ = tmp;
6087 # }
6088 ()
6089 def p_parameter_value_opt_2(p):
6090 '''parameter_value_opt : '#' '(' parameter_value_byname_list ')' '''
6091 print('parameter_value_opt_2', list(p))
6092 # { struct parmvalue_t*tmp = new struct parmvalue_t;
6093 # tmp->by_order = 0;
6094 # tmp->by_name = $3;
6095 # $$ = tmp;
6096 # }
6097 ()
6098 def p_parameter_value_opt_3(p):
6099 '''parameter_value_opt : '#' DEC_NUMBER '''
6100 print('parameter_value_opt_3', list(p))
6101 # { assert($2);
6102 # PENumber*tmp = new PENumber($2);
6103 # FILE_NAME(tmp, @1);
6104 #
6105 # struct parmvalue_t*lst = new struct parmvalue_t;
6106 # lst->by_order = new list<PExpr*>;
6107 # lst->by_order->push_back(tmp);
6108 # lst->by_name = 0;
6109 # $$ = lst;
6110 # based_size = 0;
6111 # }
6112 ()
6113 def p_parameter_value_opt_4(p):
6114 '''parameter_value_opt : '#' REALTIME '''
6115 print('parameter_value_opt_4', list(p))
6116 # { assert($2);
6117 # PEFNumber*tmp = new PEFNumber($2);
6118 # FILE_NAME(tmp, @1);
6119 #
6120 # struct parmvalue_t*lst = new struct parmvalue_t;
6121 # lst->by_order = new list<PExpr*>;
6122 # lst->by_order->push_back(tmp);
6123 # lst->by_name = 0;
6124 # $$ = lst;
6125 # }
6126 ()
6127 def p_parameter_value_opt_5(p):
6128 '''parameter_value_opt : '#' error '''
6129 print('parameter_value_opt_5', list(p))
6130 # { yyerror(@1, "error: syntax error in parameter value "
6131 # "assignment list.");
6132 # $$ = 0;
6133 # }
6134 ()
6135 def p_parameter_value_opt_6(p):
6136 '''parameter_value_opt : '''
6137 print('parameter_value_opt_6', list(p))
6138 # { $$ = 0; }
6139 ()
6140 def p_parameter_value_byname_1(p):
6141 '''parameter_value_byname : '.' IDENTIFIER '(' expression ')' '''
6142 print('parameter_value_byname_1', list(p))
6143 # { named_pexpr_t*tmp = new named_pexpr_t;
6144 # tmp->name = lex_strings.make($2);
6145 # tmp->parm = $4;
6146 # delete[]$2;
6147 # $$ = tmp;
6148 # }
6149 ()
6150 def p_parameter_value_byname_2(p):
6151 '''parameter_value_byname : '.' IDENTIFIER '(' ')' '''
6152 print('parameter_value_byname_2', list(p))
6153 # { named_pexpr_t*tmp = new named_pexpr_t;
6154 # tmp->name = lex_strings.make($2);
6155 # tmp->parm = 0;
6156 # delete[]$2;
6157 # $$ = tmp;
6158 # }
6159 ()
6160 def p_parameter_value_byname_list_1(p):
6161 '''parameter_value_byname_list : parameter_value_byname '''
6162 print('parameter_value_byname_list_1', list(p))
6163 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6164 # tmp->push_back(*$1);
6165 # delete $1;
6166 # $$ = tmp;
6167 # }
6168 ()
6169 def p_parameter_value_byname_list_2(p):
6170 '''parameter_value_byname_list : parameter_value_byname_list ',' parameter_value_byname '''
6171 print('parameter_value_byname_list_2', list(p))
6172 # { list<named_pexpr_t>*tmp = $1;
6173 # tmp->push_back(*$3);
6174 # delete $3;
6175 # $$ = tmp;
6176 # }
6177 ()
6178 def p_port_1(p):
6179 '''port : port_reference '''
6180 print('port_1', list(p))
6181 p[0] = p[1]
6182 ()
6183 def p_port_2(p):
6184 '''port : '.' IDENTIFIER '(' port_reference ')' '''
6185 print('port_2', list(p))
6186 # { Module::port_t*tmp = $4;
6187 # tmp->name = lex_strings.make($2);
6188 # delete[]$2;
6189 # $$ = tmp;
6190 # }
6191 ()
6192 def p_port_3(p):
6193 '''port : '{' port_reference_list '}' '''
6194 print('port_3', list(p))
6195 # { Module::port_t*tmp = $2;
6196 # tmp->name = perm_string();
6197 # $$ = tmp;
6198 # }
6199 ()
6200 def p_port_4(p):
6201 '''port : '.' IDENTIFIER '(' '{' port_reference_list '}' ')' '''
6202 print('port_4', list(p))
6203 # { Module::port_t*tmp = $5;
6204 # tmp->name = lex_strings.make($2);
6205 # delete[]$2;
6206 # $$ = tmp;
6207 # }
6208 ()
6209 def p_port_opt_1(p):
6210 '''port_opt : port '''
6211 print('port_opt_1', list(p))
6212 p[0] = p[1]
6213 ()
6214 def p_port_opt_2(p):
6215 '''port_opt : '''
6216 print('port_opt_2', list(p))
6217 # { $$ = 0; }
6218 ()
6219 def p_port_name_1(p):
6220 '''port_name : '.' IDENTIFIER '(' expression ')' '''
6221 print('port_name_1', list(p))
6222 # { named_pexpr_t*tmp = new named_pexpr_t;
6223 # tmp->name = lex_strings.make($2);
6224 # tmp->parm = $4;
6225 # delete[]$2;
6226 # $$ = tmp;
6227 # }
6228 ()
6229 def p_port_name_2(p):
6230 '''port_name : '.' IDENTIFIER '(' error ')' '''
6231 print('port_name_2', list(p))
6232 # { yyerror(@3, "error: invalid port connection expression.");
6233 # named_pexpr_t*tmp = new named_pexpr_t;
6234 # tmp->name = lex_strings.make($2);
6235 # tmp->parm = 0;
6236 # delete[]$2;
6237 # $$ = tmp;
6238 # }
6239 ()
6240 def p_port_name_3(p):
6241 '''port_name : '.' IDENTIFIER '(' ')' '''
6242 print('port_name_3', list(p))
6243 # { named_pexpr_t*tmp = new named_pexpr_t;
6244 # tmp->name = lex_strings.make($2);
6245 # tmp->parm = 0;
6246 # delete[]$2;
6247 # $$ = tmp;
6248 # }
6249 ()
6250 def p_port_name_4(p):
6251 '''port_name : '.' IDENTIFIER '''
6252 print('port_name_4', list(p))
6253 # { named_pexpr_t*tmp = new named_pexpr_t;
6254 # tmp->name = lex_strings.make($2);
6255 # tmp->parm = new PEIdent(lex_strings.make($2), true);
6256 # FILE_NAME(tmp->parm, @1);
6257 # delete[]$2;
6258 # $$ = tmp;
6259 # }
6260 ()
6261 def p_port_name_5(p):
6262 '''port_name : K_DOTSTAR '''
6263 print('port_name_5', list(p))
6264 # { named_pexpr_t*tmp = new named_pexpr_t;
6265 # tmp->name = lex_strings.make("*");
6266 # tmp->parm = 0;
6267 # $$ = tmp;
6268 # }
6269 ()
6270 def p_port_name_list_1(p):
6271 '''port_name_list : port_name_list ',' port_name '''
6272 print('port_name_list_1', list(p))
6273 # { list<named_pexpr_t>*tmp = $1;
6274 # tmp->push_back(*$3);
6275 # delete $3;
6276 # $$ = tmp;
6277 # }
6278 ()
6279 def p_port_name_list_2(p):
6280 '''port_name_list : port_name '''
6281 print('port_name_list_2', list(p))
6282 # { list<named_pexpr_t>*tmp = new list<named_pexpr_t>;
6283 # tmp->push_back(*$1);
6284 # delete $1;
6285 # $$ = tmp;
6286 # }
6287 ()
6288 def p_port_reference_1(p):
6289 '''port_reference : IDENTIFIER '''
6290 print('port_reference_1', list(p))
6291 # { Module::port_t*ptmp;
6292 # perm_string name = lex_strings.make($1);
6293 # ptmp = pform_module_port_reference(name, @1.text, @1.first_line);
6294 # delete[]$1;
6295 # $$ = ptmp;
6296 # }
6297 ()
6298 def p_port_reference_2(p):
6299 '''port_reference : IDENTIFIER '[' expression ':' expression ']' '''
6300 print('port_reference_2', list(p))
6301 # { index_component_t itmp;
6302 # itmp.sel = index_component_t::SEL_PART;
6303 # itmp.msb = $3;
6304 # itmp.lsb = $5;
6305 #
6306 # name_component_t ntmp (lex_strings.make($1));
6307 # ntmp.index.push_back(itmp);
6308 #
6309 # pform_name_t pname;
6310 # pname.push_back(ntmp);
6311 #
6312 # PEIdent*wtmp = new PEIdent(pname);
6313 # FILE_NAME(wtmp, @1);
6314 #
6315 # Module::port_t*ptmp = new Module::port_t;
6316 # ptmp->name = perm_string();
6317 # ptmp->expr.push_back(wtmp);
6318 #
6319 # delete[]$1;
6320 # $$ = ptmp;
6321 # }
6322 ()
6323 def p_port_reference_3(p):
6324 '''port_reference : IDENTIFIER '[' expression ']' '''
6325 print('port_reference_3', list(p))
6326 # { index_component_t itmp;
6327 # itmp.sel = index_component_t::SEL_BIT;
6328 # itmp.msb = $3;
6329 # itmp.lsb = 0;
6330 #
6331 # name_component_t ntmp (lex_strings.make($1));
6332 # ntmp.index.push_back(itmp);
6333 #
6334 # pform_name_t pname;
6335 # pname.push_back(ntmp);
6336 #
6337 # PEIdent*tmp = new PEIdent(pname);
6338 # FILE_NAME(tmp, @1);
6339 #
6340 # Module::port_t*ptmp = new Module::port_t;
6341 # ptmp->name = perm_string();
6342 # ptmp->expr.push_back(tmp);
6343 # delete[]$1;
6344 # $$ = ptmp;
6345 # }
6346 ()
6347 def p_port_reference_4(p):
6348 '''port_reference : IDENTIFIER '[' error ']' '''
6349 print('port_reference_4', list(p))
6350 # { yyerror(@1, "error: invalid port bit select");
6351 # Module::port_t*ptmp = new Module::port_t;
6352 # PEIdent*wtmp = new PEIdent(lex_strings.make($1));
6353 # FILE_NAME(wtmp, @1);
6354 # ptmp->name = lex_strings.make($1);
6355 # ptmp->expr.push_back(wtmp);
6356 # delete[]$1;
6357 # $$ = ptmp;
6358 # }
6359 ()
6360 def p_port_reference_list_1(p):
6361 '''port_reference_list : port_reference '''
6362 print('port_reference_list_1', list(p))
6363 p[0] = p[1]
6364 ()
6365 def p_port_reference_list_2(p):
6366 '''port_reference_list : port_reference_list ',' port_reference '''
6367 print('port_reference_list_2', list(p))
6368 # { Module::port_t*tmp = $1;
6369 # append(tmp->expr, $3->expr);
6370 # delete $3;
6371 # $$ = tmp;
6372 # }
6373 ()
6374 def p_dimensions_opt_1(p):
6375 '''dimensions_opt : '''
6376 print('dimensions_opt_1', list(p))
6377 # { $$ = 0; }
6378 ()
6379 def p_dimensions_opt_2(p):
6380 '''dimensions_opt : dimensions '''
6381 print('dimensions_opt_2', list(p))
6382 p[0] = p[1]
6383 ()
6384 def p_dimensions_1(p):
6385 '''dimensions : variable_dimension '''
6386 print('dimensions_1', list(p))
6387 p[0] = p[1]
6388 ()
6389 def p_dimensions_2(p):
6390 '''dimensions : dimensions variable_dimension '''
6391 print('dimensions_2', list(p))
6392 # { list<pform_range_t> *tmp = $1;
6393 # if ($2) {
6394 # tmp->splice(tmp->end(), *$2);
6395 # delete $2;
6396 # }
6397 # $$ = tmp;
6398 # }
6399 ()
6400 def p_register_variable_1(p):
6401 '''register_variable : IDENTIFIER dimensions_opt '''
6402 print('register_variable_1', list(p))
6403 # { perm_string name = lex_strings.make($1);
6404 # pform_makewire(@1, name, NetNet::REG,
6405 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6406 # pform_set_reg_idx(name, $2);
6407 # $$ = $1;
6408 # }
6409 ()
6410 def p_register_variable_2(p):
6411 '''register_variable : IDENTIFIER dimensions_opt '=' expression '''
6412 print('register_variable_2', list(p))
6413 # { if (pform_peek_scope()->var_init_needs_explicit_lifetime()
6414 # && (var_lifetime == LexicalScope::INHERITED)) {
6415 # cerr << @3 << ": warning: Static variable initialization requires "
6416 # "explicit lifetime in this context." << endl;
6417 # warn_count += 1;
6418 # }
6419 # perm_string name = lex_strings.make($1);
6420 # pform_makewire(@1, name, NetNet::REG,
6421 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6422 # pform_set_reg_idx(name, $2);
6423 # pform_make_var_init(@1, name, $4);
6424 # $$ = $1;
6425 # }
6426 ()
6427 def p_register_variable_list_1(p):
6428 '''register_variable_list : register_variable '''
6429 print('register_variable_list_1', list(p))
6430 # { list<perm_string>*tmp = new list<perm_string>;
6431 # tmp->push_back(lex_strings.make($1));
6432 # $$ = tmp;
6433 # delete[]$1;
6434 # }
6435 ()
6436 def p_register_variable_list_2(p):
6437 '''register_variable_list : register_variable_list ',' register_variable '''
6438 print('register_variable_list_2', list(p))
6439 # { list<perm_string>*tmp = $1;
6440 # tmp->push_back(lex_strings.make($3));
6441 # $$ = tmp;
6442 # delete[]$3;
6443 # }
6444 ()
6445 def p_net_variable_1(p):
6446 '''net_variable : IDENTIFIER dimensions_opt '''
6447 print('net_variable_1', list(p))
6448 # { perm_string name = lex_strings.make($1);
6449 # pform_makewire(@1, name, NetNet::IMPLICIT,
6450 # NetNet::NOT_A_PORT, IVL_VT_NO_TYPE, 0);
6451 # pform_set_reg_idx(name, $2);
6452 # $$ = $1;
6453 # }
6454 ()
6455 def p_net_variable_list_1(p):
6456 '''net_variable_list : net_variable '''
6457 print('net_variable_list_1', list(p))
6458 # { list<perm_string>*tmp = new list<perm_string>;
6459 # tmp->push_back(lex_strings.make($1));
6460 # $$ = tmp;
6461 # delete[]$1;
6462 # }
6463 ()
6464 def p_net_variable_list_2(p):
6465 '''net_variable_list : net_variable_list ',' net_variable '''
6466 print('net_variable_list_2', list(p))
6467 # { list<perm_string>*tmp = $1;
6468 # tmp->push_back(lex_strings.make($3));
6469 # $$ = tmp;
6470 # delete[]$3;
6471 # }
6472 ()
6473 def p_event_variable_1(p):
6474 '''event_variable : IDENTIFIER dimensions_opt '''
6475 print('event_variable_1', list(p))
6476 # { if ($2) {
6477 # yyerror(@2, "sorry: event arrays are not supported.");
6478 # delete $2;
6479 # }
6480 # $$ = $1;
6481 # }
6482 ()
6483 def p_event_variable_list_1(p):
6484 '''event_variable_list : event_variable '''
6485 print('event_variable_list_1', list(p))
6486 # { $$ = list_from_identifier($1); }
6487 ()
6488 def p_event_variable_list_2(p):
6489 '''event_variable_list : event_variable_list ',' event_variable '''
6490 print('event_variable_list_2', list(p))
6491 # { $$ = list_from_identifier($1, $3); }
6492 ()
6493 def p_specify_item_1(p):
6494 '''specify_item : K_specparam specparam_decl ';' '''
6495 print('specify_item_1', list(p))
6496 ()
6497 def p_specify_item_2(p):
6498 '''specify_item : specify_simple_path_decl ';' '''
6499 print('specify_item_2', list(p))
6500 # { pform_module_specify_path($1);
6501 # }
6502 ()
6503 def p_specify_item_3(p):
6504 '''specify_item : specify_edge_path_decl ';' '''
6505 print('specify_item_3', list(p))
6506 # { pform_module_specify_path($1);
6507 # }
6508 ()
6509 def p_specify_item_4(p):
6510 '''specify_item : K_if '(' expression ')' specify_simple_path_decl ';' '''
6511 print('specify_item_4', list(p))
6512 # { PSpecPath*tmp = $5;
6513 # if (tmp) {
6514 # tmp->conditional = true;
6515 # tmp->condition = $3;
6516 # }
6517 # pform_module_specify_path(tmp);
6518 # }
6519 ()
6520 def p_specify_item_5(p):
6521 '''specify_item : K_if '(' expression ')' specify_edge_path_decl ';' '''
6522 print('specify_item_5', list(p))
6523 # { PSpecPath*tmp = $5;
6524 # if (tmp) {
6525 # tmp->conditional = true;
6526 # tmp->condition = $3;
6527 # }
6528 # pform_module_specify_path(tmp);
6529 # }
6530 ()
6531 def p_specify_item_6(p):
6532 '''specify_item : K_ifnone specify_simple_path_decl ';' '''
6533 print('specify_item_6', list(p))
6534 # { PSpecPath*tmp = $2;
6535 # if (tmp) {
6536 # tmp->conditional = true;
6537 # tmp->condition = 0;
6538 # }
6539 # pform_module_specify_path(tmp);
6540 # }
6541 ()
6542 def p_specify_item_7(p):
6543 '''specify_item : K_ifnone specify_edge_path_decl ';' '''
6544 print('specify_item_7', list(p))
6545 # { yyerror(@1, "Sorry: ifnone with an edge-sensitive path is "
6546 # "not supported.");
6547 # yyerrok;
6548 # }
6549 ()
6550 def p_specify_item_8(p):
6551 '''specify_item : K_Sfullskew '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6552 print('specify_item_8', list(p))
6553 # { delete $7;
6554 # delete $9;
6555 # }
6556 ()
6557 def p_specify_item_9(p):
6558 '''specify_item : K_Shold '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6559 print('specify_item_9', list(p))
6560 # { delete $7;
6561 # }
6562 ()
6563 def p_specify_item_10(p):
6564 '''specify_item : K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6565 print('specify_item_10', list(p))
6566 # { delete $7;
6567 # delete $9;
6568 # }
6569 ()
6570 def p_specify_item_11(p):
6571 '''specify_item : K_Speriod '(' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6572 print('specify_item_11', list(p))
6573 # { delete $5;
6574 # }
6575 ()
6576 def p_specify_item_12(p):
6577 '''specify_item : K_Srecovery '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6578 print('specify_item_12', list(p))
6579 # { delete $7;
6580 # }
6581 ()
6582 def p_specify_item_13(p):
6583 '''specify_item : K_Srecrem '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6584 print('specify_item_13', list(p))
6585 # { delete $7;
6586 # delete $9;
6587 # }
6588 ()
6589 def p_specify_item_14(p):
6590 '''specify_item : K_Sremoval '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6591 print('specify_item_14', list(p))
6592 # { delete $7;
6593 # }
6594 ()
6595 def p_specify_item_15(p):
6596 '''specify_item : K_Ssetup '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6597 print('specify_item_15', list(p))
6598 # { delete $7;
6599 # }
6600 ()
6601 def p_specify_item_16(p):
6602 '''specify_item : K_Ssetuphold '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' '''
6603 print('specify_item_16', list(p))
6604 # { delete $7;
6605 # delete $9;
6606 # }
6607 ()
6608 def p_specify_item_17(p):
6609 '''specify_item : K_Sskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6610 print('specify_item_17', list(p))
6611 # { delete $7;
6612 # }
6613 ()
6614 def p_specify_item_18(p):
6615 '''specify_item : K_Stimeskew '(' spec_reference_event ',' spec_reference_event ',' delay_value spec_notifier_opt ')' ';' '''
6616 print('specify_item_18', list(p))
6617 # { delete $7;
6618 # }
6619 ()
6620 def p_specify_item_19(p):
6621 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ',' expression spec_notifier_opt ')' ';' '''
6622 print('specify_item_19', list(p))
6623 # { delete $5;
6624 # delete $7;
6625 # }
6626 ()
6627 def p_specify_item_20(p):
6628 '''specify_item : K_Swidth '(' spec_reference_event ',' delay_value ')' ';' '''
6629 print('specify_item_20', list(p))
6630 # { delete $5;
6631 # }
6632 ()
6633 def p_specify_item_21(p):
6634 '''specify_item : K_pulsestyle_onevent specify_path_identifiers ';' '''
6635 print('specify_item_21', list(p))
6636 # { delete $2;
6637 # }
6638 ()
6639 def p_specify_item_22(p):
6640 '''specify_item : K_pulsestyle_ondetect specify_path_identifiers ';' '''
6641 print('specify_item_22', list(p))
6642 # { delete $2;
6643 # }
6644 ()
6645 def p_specify_item_23(p):
6646 '''specify_item : K_showcancelled specify_path_identifiers ';' '''
6647 print('specify_item_23', list(p))
6648 # { delete $2;
6649 # }
6650 ()
6651 def p_specify_item_24(p):
6652 '''specify_item : K_noshowcancelled specify_path_identifiers ';' '''
6653 print('specify_item_24', list(p))
6654 # { delete $2;
6655 # }
6656 ()
6657 def p_specify_item_list_1(p):
6658 '''specify_item_list : specify_item '''
6659 print('specify_item_list_1', list(p))
6660 ()
6661 def p_specify_item_list_2(p):
6662 '''specify_item_list : specify_item_list specify_item '''
6663 print('specify_item_list_2', list(p))
6664 ()
6665 def p_specify_item_list_opt_1(p):
6666 '''specify_item_list_opt : '''
6667 print('specify_item_list_opt_1', list(p))
6668 # { }
6669 ()
6670 def p_specify_item_list_opt_2(p):
6671 '''specify_item_list_opt : specify_item_list '''
6672 print('specify_item_list_opt_2', list(p))
6673 # { }
6674 ()
6675 def p_specify_edge_path_decl_1(p):
6676 '''specify_edge_path_decl : specify_edge_path '=' '(' delay_value_list ')' '''
6677 print('specify_edge_path_decl_1', list(p))
6678 # { $$ = pform_assign_path_delay($1, $4); }
6679 ()
6680 def p_specify_edge_path_decl_2(p):
6681 '''specify_edge_path_decl : specify_edge_path '=' delay_value_simple '''
6682 print('specify_edge_path_decl_2', list(p))
6683 # { list<PExpr*>*tmp = new list<PExpr*>;
6684 # tmp->push_back($3);
6685 # $$ = pform_assign_path_delay($1, tmp);
6686 # }
6687 ()
6688 def p_edge_operator_1(p):
6689 '''edge_operator : K_posedge '''
6690 print('edge_operator_1', list(p))
6691 # { $$ = true; }
6692 ()
6693 def p_edge_operator_2(p):
6694 '''edge_operator : K_negedge '''
6695 print('edge_operator_2', list(p))
6696 # { $$ = false; }
6697 ()
6698 def p_specify_edge_path_1(p):
6699 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6700 print('specify_edge_path_1', list(p))
6701 # { int edge_flag = 0;
6702 # $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, false, $6, $8); }
6703 ()
6704 def p_specify_edge_path_2(p):
6705 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6706 print('specify_edge_path_2', list(p))
6707 # { int edge_flag = $2? 1 : -1;
6708 # $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, false, $7, $9);}
6709 ()
6710 def p_specify_edge_path_3(p):
6711 '''specify_edge_path : '(' specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6712 print('specify_edge_path_3', list(p))
6713 # { int edge_flag = 0;
6714 # $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, true, $6, $8); }
6715 ()
6716 def p_specify_edge_path_4(p):
6717 '''specify_edge_path : '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' '''
6718 print('specify_edge_path_4', list(p))
6719 # { int edge_flag = $2? 1 : -1;
6720 # $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, true, $7, $9); }
6721 ()
6722 def p_polarity_operator_1(p):
6723 '''polarity_operator : K_PO_POS '''
6724 print('polarity_operator_1', list(p))
6725 ()
6726 def p_polarity_operator_2(p):
6727 '''polarity_operator : K_PO_NEG '''
6728 print('polarity_operator_2', list(p))
6729 ()
6730 def p_polarity_operator_3(p):
6731 '''polarity_operator : ':' '''
6732 print('polarity_operator_3', list(p))
6733 ()
6734 def p_specify_simple_path_decl_1(p):
6735 '''specify_simple_path_decl : specify_simple_path '=' '(' delay_value_list ')' '''
6736 print('specify_simple_path_decl_1', list(p))
6737 # { $$ = pform_assign_path_delay($1, $4); }
6738 ()
6739 def p_specify_simple_path_decl_2(p):
6740 '''specify_simple_path_decl : specify_simple_path '=' delay_value_simple '''
6741 print('specify_simple_path_decl_2', list(p))
6742 # { list<PExpr*>*tmp = new list<PExpr*>;
6743 # tmp->push_back($3);
6744 # $$ = pform_assign_path_delay($1, tmp);
6745 # }
6746 ()
6747 def p_specify_simple_path_decl_3(p):
6748 '''specify_simple_path_decl : specify_simple_path '=' '(' error ')' '''
6749 print('specify_simple_path_decl_3', list(p))
6750 # { yyerror(@3, "Syntax error in delay value list.");
6751 # yyerrok;
6752 # $$ = 0;
6753 # }
6754 ()
6755 def p_specify_simple_path_1(p):
6756 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' '''
6757 print('specify_simple_path_1', list(p))
6758 # { $$ = pform_make_specify_path(@1, $2, $3, false, $5); }
6759 ()
6760 def p_specify_simple_path_2(p):
6761 '''specify_simple_path : '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' '''
6762 print('specify_simple_path_2', list(p))
6763 # { $$ = pform_make_specify_path(@1, $2, $3, true, $5); }
6764 ()
6765 def p_specify_simple_path_3(p):
6766 '''specify_simple_path : '(' error ')' '''
6767 print('specify_simple_path_3', list(p))
6768 # { yyerror(@1, "Invalid simple path");
6769 # yyerrok;
6770 # }
6771 ()
6772 def p_specify_path_identifiers_1(p):
6773 '''specify_path_identifiers : IDENTIFIER '''
6774 print('specify_path_identifiers_1', list(p))
6775 # { list<perm_string>*tmp = new list<perm_string>;
6776 # tmp->push_back(lex_strings.make($1));
6777 # $$ = tmp;
6778 # delete[]$1;
6779 # }
6780 ()
6781 def p_specify_path_identifiers_2(p):
6782 '''specify_path_identifiers : IDENTIFIER '[' expr_primary ']' '''
6783 print('specify_path_identifiers_2', list(p))
6784 # { if (gn_specify_blocks_flag) {
6785 # yywarn(@4, "Bit selects are not currently supported "
6786 # "in path declarations. The declaration "
6787 # "will be applied to the whole vector.");
6788 # }
6789 # list<perm_string>*tmp = new list<perm_string>;
6790 # tmp->push_back(lex_strings.make($1));
6791 # $$ = tmp;
6792 # delete[]$1;
6793 # }
6794 ()
6795 def p_specify_path_identifiers_3(p):
6796 '''specify_path_identifiers : IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6797 print('specify_path_identifiers_3', list(p))
6798 # { if (gn_specify_blocks_flag) {
6799 # yywarn(@4, "Part selects are not currently supported "
6800 # "in path declarations. The declaration "
6801 # "will be applied to the whole vector.");
6802 # }
6803 # list<perm_string>*tmp = new list<perm_string>;
6804 # tmp->push_back(lex_strings.make($1));
6805 # $$ = tmp;
6806 # delete[]$1;
6807 # }
6808 ()
6809 def p_specify_path_identifiers_4(p):
6810 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '''
6811 print('specify_path_identifiers_4', list(p))
6812 # { list<perm_string>*tmp = $1;
6813 # tmp->push_back(lex_strings.make($3));
6814 # $$ = tmp;
6815 # delete[]$3;
6816 # }
6817 ()
6818 def p_specify_path_identifiers_5(p):
6819 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' '''
6820 print('specify_path_identifiers_5', list(p))
6821 # { if (gn_specify_blocks_flag) {
6822 # yywarn(@4, "Bit selects are not currently supported "
6823 # "in path declarations. The declaration "
6824 # "will be applied to the whole vector.");
6825 # }
6826 # list<perm_string>*tmp = $1;
6827 # tmp->push_back(lex_strings.make($3));
6828 # $$ = tmp;
6829 # delete[]$3;
6830 # }
6831 ()
6832 def p_specify_path_identifiers_6(p):
6833 '''specify_path_identifiers : specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' '''
6834 print('specify_path_identifiers_6', list(p))
6835 # { if (gn_specify_blocks_flag) {
6836 # yywarn(@4, "Part selects are not currently supported "
6837 # "in path declarations. The declaration "
6838 # "will be applied to the whole vector.");
6839 # }
6840 # list<perm_string>*tmp = $1;
6841 # tmp->push_back(lex_strings.make($3));
6842 # $$ = tmp;
6843 # delete[]$3;
6844 # }
6845 ()
6846 def p_specparam_1(p):
6847 '''specparam : IDENTIFIER '=' expression '''
6848 print('specparam_1', list(p))
6849 # { PExpr*tmp = $3;
6850 # pform_set_specparam(@1, lex_strings.make($1),
6851 # param_active_range, tmp);
6852 # delete[]$1;
6853 # }
6854 ()
6855 def p_specparam_2(p):
6856 '''specparam : IDENTIFIER '=' expression ':' expression ':' expression '''
6857 print('specparam_2', list(p))
6858 # { PExpr*tmp = 0;
6859 # switch (min_typ_max_flag) {
6860 # case MIN:
6861 # tmp = $3;
6862 # delete $5;
6863 # delete $7;
6864 # break;
6865 # case TYP:
6866 # delete $3;
6867 # tmp = $5;
6868 # delete $7;
6869 # break;
6870 # case MAX:
6871 # delete $3;
6872 # delete $5;
6873 # tmp = $7;
6874 # break;
6875 # }
6876 # if (min_typ_max_warn > 0) {
6877 # cerr << tmp->get_fileline() << ": warning: choosing ";
6878 # switch (min_typ_max_flag) {
6879 # case MIN:
6880 # cerr << "min";
6881 # break;
6882 # case TYP:
6883 # cerr << "typ";
6884 # break;
6885 # case MAX:
6886 # cerr << "max";
6887 # break;
6888 # }
6889 # cerr << " expression." << endl;
6890 # min_typ_max_warn -= 1;
6891 # }
6892 # pform_set_specparam(@1, lex_strings.make($1),
6893 # param_active_range, tmp);
6894 # delete[]$1;
6895 # }
6896 ()
6897 def p_specparam_3(p):
6898 '''specparam : PATHPULSE_IDENTIFIER '=' expression '''
6899 print('specparam_3', list(p))
6900 # { delete[]$1;
6901 # delete $3;
6902 # }
6903 ()
6904 def p_specparam_4(p):
6905 '''specparam : PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' '''
6906 print('specparam_4', list(p))
6907 # { delete[]$1;
6908 # delete $4;
6909 # delete $6;
6910 # }
6911 ()
6912 def p_specparam_list_1(p):
6913 '''specparam_list : specparam '''
6914 print('specparam_list_1', list(p))
6915 ()
6916 def p_specparam_list_2(p):
6917 '''specparam_list : specparam_list ',' specparam '''
6918 print('specparam_list_2', list(p))
6919 ()
6920 def p_specparam_decl_1(p):
6921 '''specparam_decl : specparam_list '''
6922 print('specparam_decl_1', list(p))
6923 ()
6924 def p_specparam_decl_2(p):
6925 '''specparam_decl : dimensions _embed0_specparam_decl specparam_list '''
6926 print('specparam_decl_2', list(p))
6927 # { param_active_range = 0; }
6928 ()
6929 def p__embed0_specparam_decl(p):
6930 '''_embed0_specparam_decl : '''
6931 # { param_active_range = $1; }
6932 ()
6933 def p_spec_polarity_1(p):
6934 '''spec_polarity : '+' '''
6935 print('spec_polarity_1', list(p))
6936 # { $$ = '+'; }
6937 ()
6938 def p_spec_polarity_2(p):
6939 '''spec_polarity : '-' '''
6940 print('spec_polarity_2', list(p))
6941 # { $$ = '-'; }
6942 ()
6943 def p_spec_polarity_3(p):
6944 '''spec_polarity : '''
6945 print('spec_polarity_3', list(p))
6946 # { $$ = 0; }
6947 ()
6948 def p_spec_reference_event_1(p):
6949 '''spec_reference_event : K_posedge expression '''
6950 print('spec_reference_event_1', list(p))
6951 # { delete $2; }
6952 ()
6953 def p_spec_reference_event_2(p):
6954 '''spec_reference_event : K_negedge expression '''
6955 print('spec_reference_event_2', list(p))
6956 # { delete $2; }
6957 ()
6958 def p_spec_reference_event_3(p):
6959 '''spec_reference_event : K_posedge expr_primary K_TAND expression '''
6960 print('spec_reference_event_3', list(p))
6961 # { delete $2;
6962 # delete $4;
6963 # }
6964 ()
6965 def p_spec_reference_event_4(p):
6966 '''spec_reference_event : K_negedge expr_primary K_TAND expression '''
6967 print('spec_reference_event_4', list(p))
6968 # { delete $2;
6969 # delete $4;
6970 # }
6971 ()
6972 def p_spec_reference_event_5(p):
6973 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary '''
6974 print('spec_reference_event_5', list(p))
6975 # { delete $5; }
6976 ()
6977 def p_spec_reference_event_6(p):
6978 '''spec_reference_event : K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression '''
6979 print('spec_reference_event_6', list(p))
6980 # { delete $5;
6981 # delete $7;
6982 # }
6983 ()
6984 def p_spec_reference_event_7(p):
6985 '''spec_reference_event : expr_primary K_TAND expression '''
6986 print('spec_reference_event_7', list(p))
6987 # { delete $1;
6988 # delete $3;
6989 # }
6990 ()
6991 def p_spec_reference_event_8(p):
6992 '''spec_reference_event : expr_primary '''
6993 print('spec_reference_event_8', list(p))
6994 # { delete $1; }
6995 ()
6996 def p_edge_descriptor_list_1(p):
6997 '''edge_descriptor_list : edge_descriptor_list ',' K_edge_descriptor '''
6998 print('edge_descriptor_list_1', list(p))
6999 ()
7000 def p_edge_descriptor_list_2(p):
7001 '''edge_descriptor_list : K_edge_descriptor '''
7002 print('edge_descriptor_list_2', list(p))
7003 ()
7004 def p_spec_notifier_opt_1(p):
7005 '''spec_notifier_opt : '''
7006 print('spec_notifier_opt_1', list(p))
7007 # { }
7008 ()
7009 def p_spec_notifier_opt_2(p):
7010 '''spec_notifier_opt : spec_notifier '''
7011 print('spec_notifier_opt_2', list(p))
7012 # { }
7013 ()
7014 def p_spec_notifier_1(p):
7015 '''spec_notifier : ',' '''
7016 print('spec_notifier_1', list(p))
7017 # { args_after_notifier = 0; }
7018 ()
7019 def p_spec_notifier_2(p):
7020 '''spec_notifier : ',' hierarchy_identifier '''
7021 print('spec_notifier_2', list(p))
7022 # { args_after_notifier = 0; delete $2; }
7023 ()
7024 def p_spec_notifier_3(p):
7025 '''spec_notifier : spec_notifier ',' '''
7026 print('spec_notifier_3', list(p))
7027 # { args_after_notifier += 1; }
7028 ()
7029 def p_spec_notifier_4(p):
7030 '''spec_notifier : spec_notifier ',' hierarchy_identifier '''
7031 print('spec_notifier_4', list(p))
7032 # { args_after_notifier += 1;
7033 # if (args_after_notifier >= 3) {
7034 # cerr << @3 << ": warning: timing checks are not supported "
7035 # "and delayed signal \"" << *$3
7036 # << "\" will not be driven." << endl;
7037 # }
7038 # delete $3; }
7039 ()
7040 def p_spec_notifier_5(p):
7041 '''spec_notifier : IDENTIFIER '''
7042 print('spec_notifier_5', list(p))
7043 # { args_after_notifier = 0; delete[]$1; }
7044 ()
7045 def p_statement_item_1(p):
7046 '''statement_item : K_assign lpvalue '=' expression ';' '''
7047 print('statement_item_1', list(p))
7048 # { PCAssign*tmp = new PCAssign($2, $4);
7049 # FILE_NAME(tmp, @1);
7050 # $$ = tmp;
7051 # }
7052 ()
7053 def p_statement_item_2(p):
7054 '''statement_item : K_deassign lpvalue ';' '''
7055 print('statement_item_2', list(p))
7056 # { PDeassign*tmp = new PDeassign($2);
7057 # FILE_NAME(tmp, @1);
7058 # $$ = tmp;
7059 # }
7060 ()
7061 def p_statement_item_3(p):
7062 '''statement_item : K_force lpvalue '=' expression ';' '''
7063 print('statement_item_3', list(p))
7064 # { PForce*tmp = new PForce($2, $4);
7065 # FILE_NAME(tmp, @1);
7066 # $$ = tmp;
7067 # }
7068 ()
7069 def p_statement_item_4(p):
7070 '''statement_item : K_release lpvalue ';' '''
7071 print('statement_item_4', list(p))
7072 # { PRelease*tmp = new PRelease($2);
7073 # FILE_NAME(tmp, @1);
7074 # $$ = tmp;
7075 # }
7076 ()
7077 def p_statement_item_5(p):
7078 '''statement_item : K_begin K_end '''
7079 print('statement_item_5', list(p))
7080 # { PBlock*tmp = new PBlock(PBlock::BL_SEQ);
7081 # FILE_NAME(tmp, @1);
7082 # $$ = tmp;
7083 # }
7084 ()
7085 def p_statement_item_6(p):
7086 '''statement_item : K_begin _embed0_statement_item block_item_decls_opt _embed1_statement_item statement_or_null_list K_end '''
7087 print('statement_item_6', list(p))
7088 # { PBlock*tmp;
7089 # if ($3) {
7090 # pform_pop_scope();
7091 # assert(! current_block_stack.empty());
7092 # tmp = current_block_stack.top();
7093 # current_block_stack.pop();
7094 # } else {
7095 # tmp = new PBlock(PBlock::BL_SEQ);
7096 # FILE_NAME(tmp, @1);
7097 # }
7098 # if ($5) tmp->set_statement(*$5);
7099 # delete $5;
7100 # $$ = tmp;
7101 # }
7102 ()
7103 def p_statement_item_7(p):
7104 '''statement_item : K_begin ':' IDENTIFIER _embed2_statement_item block_item_decls_opt statement_or_null_list_opt K_end endlabel_opt '''
7105 print('statement_item_7', list(p))
7106 # { pform_pop_scope();
7107 # assert(! current_block_stack.empty());
7108 # PBlock*tmp = current_block_stack.top();
7109 # current_block_stack.pop();
7110 # if ($6) tmp->set_statement(*$6);
7111 # delete $6;
7112 # if ($8) {
7113 # if (strcmp($3,$8) != 0) {
7114 # yyerror(@8, "error: End label doesn't match begin name");
7115 # }
7116 # if (! gn_system_verilog()) {
7117 # yyerror(@8, "error: Begin end labels require "
7118 # "SystemVerilog.");
7119 # }
7120 # delete[]$8;
7121 # }
7122 # delete[]$3;
7123 # $$ = tmp;
7124 # }
7125 ()
7126 def p_statement_item_8(p):
7127 '''statement_item : K_fork join_keyword '''
7128 print('statement_item_8', list(p))
7129 # { PBlock*tmp = new PBlock($2);
7130 # FILE_NAME(tmp, @1);
7131 # $$ = tmp;
7132 # }
7133 ()
7134 def p_statement_item_9(p):
7135 '''statement_item : K_fork _embed3_statement_item block_item_decls_opt _embed4_statement_item statement_or_null_list join_keyword '''
7136 print('statement_item_9', list(p))
7137 # { PBlock*tmp;
7138 # if ($3) {
7139 # pform_pop_scope();
7140 # assert(! current_block_stack.empty());
7141 # tmp = current_block_stack.top();
7142 # current_block_stack.pop();
7143 # tmp->set_join_type($6);
7144 # } else {
7145 # tmp = new PBlock($6);
7146 # FILE_NAME(tmp, @1);
7147 # }
7148 # if ($5) tmp->set_statement(*$5);
7149 # delete $5;
7150 # $$ = tmp;
7151 # }
7152 ()
7153 def p_statement_item_10(p):
7154 '''statement_item : K_fork ':' IDENTIFIER _embed5_statement_item block_item_decls_opt statement_or_null_list_opt join_keyword endlabel_opt '''
7155 print('statement_item_10', list(p))
7156 # { pform_pop_scope();
7157 # assert(! current_block_stack.empty());
7158 # PBlock*tmp = current_block_stack.top();
7159 # current_block_stack.pop();
7160 # tmp->set_join_type($7);
7161 # if ($6) tmp->set_statement(*$6);
7162 # delete $6;
7163 # if ($8) {
7164 # if (strcmp($3,$8) != 0) {
7165 # yyerror(@8, "error: End label doesn't match fork name");
7166 # }
7167 # if (! gn_system_verilog()) {
7168 # yyerror(@8, "error: Fork end labels require "
7169 # "SystemVerilog.");
7170 # }
7171 # delete[]$8;
7172 # }
7173 # delete[]$3;
7174 # $$ = tmp;
7175 # }
7176 ()
7177 def p_statement_item_11(p):
7178 '''statement_item : K_disable hierarchy_identifier ';' '''
7179 print('statement_item_11', list(p))
7180 # { PDisable*tmp = new PDisable(*$2);
7181 # FILE_NAME(tmp, @1);
7182 # delete $2;
7183 # $$ = tmp;
7184 # }
7185 ()
7186 def p_statement_item_12(p):
7187 '''statement_item : K_disable K_fork ';' '''
7188 print('statement_item_12', list(p))
7189 # { pform_name_t tmp_name;
7190 # PDisable*tmp = new PDisable(tmp_name);
7191 # FILE_NAME(tmp, @1);
7192 # $$ = tmp;
7193 # }
7194 ()
7195 def p_statement_item_13(p):
7196 '''statement_item : K_TRIGGER hierarchy_identifier ';' '''
7197 print('statement_item_13', list(p))
7198 # { PTrigger*tmp = new PTrigger(*$2);
7199 # FILE_NAME(tmp, @1);
7200 # delete $2;
7201 # $$ = tmp;
7202 # }
7203 ()
7204 def p_statement_item_14(p):
7205 '''statement_item : procedural_assertion_statement '''
7206 print('statement_item_14', list(p))
7207 p[0] = p[1]
7208 ()
7209 def p_statement_item_15(p):
7210 '''statement_item : loop_statement '''
7211 print('statement_item_15', list(p))
7212 p[0] = p[1]
7213 ()
7214 def p_statement_item_16(p):
7215 '''statement_item : jump_statement '''
7216 print('statement_item_16', list(p))
7217 p[0] = p[1]
7218 ()
7219 def p_statement_item_17(p):
7220 '''statement_item : K_case '(' expression ')' case_items K_endcase '''
7221 print('statement_item_17', list(p))
7222 # { PCase*tmp = new PCase(NetCase::EQ, $3, $5);
7223 # FILE_NAME(tmp, @1);
7224 # $$ = tmp;
7225 # }
7226 ()
7227 def p_statement_item_18(p):
7228 '''statement_item : K_casex '(' expression ')' case_items K_endcase '''
7229 print('statement_item_18', list(p))
7230 # { PCase*tmp = new PCase(NetCase::EQX, $3, $5);
7231 # FILE_NAME(tmp, @1);
7232 # $$ = tmp;
7233 # }
7234 ()
7235 def p_statement_item_19(p):
7236 '''statement_item : K_casez '(' expression ')' case_items K_endcase '''
7237 print('statement_item_19', list(p))
7238 # { PCase*tmp = new PCase(NetCase::EQZ, $3, $5);
7239 # FILE_NAME(tmp, @1);
7240 # $$ = tmp;
7241 # }
7242 ()
7243 def p_statement_item_20(p):
7244 '''statement_item : K_case '(' expression ')' error K_endcase '''
7245 print('statement_item_20', list(p))
7246 # { yyerrok; }
7247 ()
7248 def p_statement_item_21(p):
7249 '''statement_item : K_casex '(' expression ')' error K_endcase '''
7250 print('statement_item_21', list(p))
7251 # { yyerrok; }
7252 ()
7253 def p_statement_item_22(p):
7254 '''statement_item : K_casez '(' expression ')' error K_endcase '''
7255 print('statement_item_22', list(p))
7256 # { yyerrok; }
7257 ()
7258 def p_statement_item_23(p):
7259 '''statement_item : K_if '(' expression ')' statement_or_null %prec less_than_K_else '''
7260 print('statement_item_23', list(p))
7261 # { PCondit*tmp = new PCondit($3, $5, 0);
7262 # FILE_NAME(tmp, @1);
7263 # $$ = tmp;
7264 # }
7265 ()
7266 def p_statement_item_24(p):
7267 '''statement_item : K_if '(' expression ')' statement_or_null K_else statement_or_null '''
7268 print('statement_item_24', list(p))
7269 # { PCondit*tmp = new PCondit($3, $5, $7);
7270 # FILE_NAME(tmp, @1);
7271 # $$ = tmp;
7272 # }
7273 ()
7274 def p_statement_item_25(p):
7275 '''statement_item : K_if '(' error ')' statement_or_null %prec less_than_K_else '''
7276 print('statement_item_25', list(p))
7277 # { yyerror(@1, "error: Malformed conditional expression.");
7278 # $$ = $5;
7279 # }
7280 ()
7281 def p_statement_item_26(p):
7282 '''statement_item : K_if '(' error ')' statement_or_null K_else statement_or_null '''
7283 print('statement_item_26', list(p))
7284 # { yyerror(@1, "error: Malformed conditional expression.");
7285 # $$ = $5;
7286 # }
7287 ()
7288 def p_statement_item_27(p):
7289 '''statement_item : compressed_statement ';' '''
7290 print('statement_item_27', list(p))
7291 p[0] = p[1]
7292 ()
7293 def p_statement_item_28(p):
7294 '''statement_item : inc_or_dec_expression ';' '''
7295 print('statement_item_28', list(p))
7296 # { $$ = pform_compressed_assign_from_inc_dec(@1, $1); }
7297 ()
7298 def p_statement_item_29(p):
7299 '''statement_item : delay1 statement_or_null '''
7300 print('statement_item_29', list(p))
7301 # { PExpr*del = $1->front();
7302 # assert($1->size() == 1);
7303 # delete $1;
7304 # PDelayStatement*tmp = new PDelayStatement(del, $2);
7305 # FILE_NAME(tmp, @1);
7306 # $$ = tmp;
7307 # }
7308 ()
7309 def p_statement_item_30(p):
7310 '''statement_item : event_control statement_or_null '''
7311 print('statement_item_30', list(p))
7312 # { PEventStatement*tmp = $1;
7313 # if (tmp == 0) {
7314 # yyerror(@1, "error: Invalid event control.");
7315 # $$ = 0;
7316 # } else {
7317 # tmp->set_statement($2);
7318 # $$ = tmp;
7319 # }
7320 # }
7321 ()
7322 def p_statement_item_31(p):
7323 '''statement_item : '@' '*' statement_or_null '''
7324 print('statement_item_31', list(p))
7325 # { PEventStatement*tmp = new PEventStatement;
7326 # FILE_NAME(tmp, @1);
7327 # tmp->set_statement($3);
7328 # $$ = tmp;
7329 # }
7330 ()
7331 def p_statement_item_32(p):
7332 '''statement_item : '@' '(' '*' ')' statement_or_null '''
7333 print('statement_item_32', list(p))
7334 # { PEventStatement*tmp = new PEventStatement;
7335 # FILE_NAME(tmp, @1);
7336 # tmp->set_statement($5);
7337 # $$ = tmp;
7338 # }
7339 ()
7340 def p_statement_item_33(p):
7341 '''statement_item : lpvalue '=' expression ';' '''
7342 print('statement_item33', list(p))
7343 if p[3]:
7344 expr = Node(syms.expr_stmt, [p[1], Leaf(token.EQUAL, p[2]), p[3] ])
7345 print ("expr TODO", repr(expr))
7346 else:
7347 expr = Node(syms.expr_stmt, [p[1], Leaf(token.EQUAL, p[2]), ])
7348 print ("expr", repr(expr))
7349 print ("expr (python):'%s'" % expr)
7350 p[0] = expr
7351 # { PAssign*tmp = new PAssign($1,$3);
7352 # FILE_NAME(tmp, @1);
7353 # $$ = tmp;
7354 # }
7355 ()
7356 def p_statement_item_34(p):
7357 '''statement_item : error '=' expression ';' '''
7358 print('statement_item_34', list(p))
7359 # { yyerror(@2, "Syntax in assignment statement l-value.");
7360 # yyerrok;
7361 # $$ = new PNoop;
7362 # }
7363 ()
7364 def p_statement_item_35(p):
7365 '''statement_item : lpvalue K_LE expression ';' '''
7366 print('statement_item_35', list(p))
7367 # { PAssignNB*tmp = new PAssignNB($1,$3);
7368 # FILE_NAME(tmp, @1);
7369 # $$ = tmp;
7370 # }
7371 ()
7372 def p_statement_item_36(p):
7373 '''statement_item : error K_LE expression ';' '''
7374 print('statement_item_36', list(p))
7375 # { yyerror(@2, "Syntax in assignment statement l-value.");
7376 # yyerrok;
7377 # $$ = new PNoop;
7378 # }
7379 ()
7380 def p_statement_item_37(p):
7381 '''statement_item : lpvalue '=' delay1 expression ';' '''
7382 print('statement_item_37', list(p))
7383 # { PExpr*del = $3->front(); $3->pop_front();
7384 # assert($3->empty());
7385 # PAssign*tmp = new PAssign($1,del,$4);
7386 # FILE_NAME(tmp, @1);
7387 # $$ = tmp;
7388 # }
7389 ()
7390 def p_statement_item_38(p):
7391 '''statement_item : lpvalue K_LE delay1 expression ';' '''
7392 print('statement_item_38', list(p))
7393 # { PExpr*del = $3->front(); $3->pop_front();
7394 # assert($3->empty());
7395 # PAssignNB*tmp = new PAssignNB($1,del,$4);
7396 # FILE_NAME(tmp, @1);
7397 # $$ = tmp;
7398 # }
7399 ()
7400 def p_statement_item_39(p):
7401 '''statement_item : lpvalue '=' event_control expression ';' '''
7402 print('statement_item_39', list(p))
7403 # { PAssign*tmp = new PAssign($1,0,$3,$4);
7404 # FILE_NAME(tmp, @1);
7405 # $$ = tmp;
7406 # }
7407 ()
7408 def p_statement_item_40(p):
7409 '''statement_item : lpvalue '=' K_repeat '(' expression ')' event_control expression ';' '''
7410 print('statement_item_40', list(p))
7411 # { PAssign*tmp = new PAssign($1,$5,$7,$8);
7412 # FILE_NAME(tmp,@1);
7413 # tmp->set_lineno(@1.first_line);
7414 # $$ = tmp;
7415 # }
7416 ()
7417 def p_statement_item_41(p):
7418 '''statement_item : lpvalue K_LE event_control expression ';' '''
7419 print('statement_item_41', list(p))
7420 # { PAssignNB*tmp = new PAssignNB($1,0,$3,$4);
7421 # FILE_NAME(tmp, @1);
7422 # $$ = tmp;
7423 # }
7424 ()
7425 def p_statement_item_42(p):
7426 '''statement_item : lpvalue K_LE K_repeat '(' expression ')' event_control expression ';' '''
7427 print('statement_item_42', list(p))
7428 # { PAssignNB*tmp = new PAssignNB($1,$5,$7,$8);
7429 # FILE_NAME(tmp, @1);
7430 # $$ = tmp;
7431 # }
7432 ()
7433 def p_statement_item_43(p):
7434 '''statement_item : lpvalue '=' dynamic_array_new ';' '''
7435 print('statement_item_43', list(p))
7436 # { PAssign*tmp = new PAssign($1,$3);
7437 # FILE_NAME(tmp, @1);
7438 # $$ = tmp;
7439 # }
7440 ()
7441 def p_statement_item_44(p):
7442 '''statement_item : lpvalue '=' class_new ';' '''
7443 print('statement_item_44', list(p))
7444 # { PAssign*tmp = new PAssign($1,$3);
7445 # FILE_NAME(tmp, @1);
7446 # $$ = tmp;
7447 # }
7448 ()
7449 def p_statement_item_45(p):
7450 '''statement_item : K_wait '(' expression ')' statement_or_null '''
7451 print('statement_item_45', list(p))
7452 # { PEventStatement*tmp;
7453 # PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, $3);
7454 # tmp = new PEventStatement(etmp);
7455 # FILE_NAME(tmp,@1);
7456 # tmp->set_statement($5);
7457 # $$ = tmp;
7458 # }
7459 ()
7460 def p_statement_item_46(p):
7461 '''statement_item : K_wait K_fork ';' '''
7462 print('statement_item_46', list(p))
7463 # { PEventStatement*tmp = new PEventStatement((PEEvent*)0);
7464 # FILE_NAME(tmp,@1);
7465 # $$ = tmp;
7466 # }
7467 ()
7468 def p_statement_item_47(p):
7469 '''statement_item : SYSTEM_IDENTIFIER '(' expression_list_with_nuls ')' ';' '''
7470 print('statement_item_47', list(p))
7471 # { PCallTask*tmp = new PCallTask(lex_strings.make($1), *$3);
7472 # FILE_NAME(tmp,@1);
7473 # delete[]$1;
7474 # delete $3;
7475 # $$ = tmp;
7476 # }
7477 ()
7478 def p_statement_item_48(p):
7479 '''statement_item : SYSTEM_IDENTIFIER ';' '''
7480 print('statement_item_48', list(p))
7481 # { list<PExpr*>pt;
7482 # PCallTask*tmp = new PCallTask(lex_strings.make($1), pt);
7483 # FILE_NAME(tmp,@1);
7484 # delete[]$1;
7485 # $$ = tmp;
7486 # }
7487 ()
7488 def p_statement_item_49(p):
7489 '''statement_item : hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7490 print('statement_item_49', list(p))
7491 # { PCallTask*tmp = pform_make_call_task(@1, *$1, *$3);
7492 # delete $1;
7493 # delete $3;
7494 # $$ = tmp;
7495 # }
7496 ()
7497 def p_statement_item_50(p):
7498 '''statement_item : hierarchy_identifier K_with '{' constraint_block_item_list_opt '}' ';' '''
7499 print('statement_item_50', list(p))
7500 # { /* ....randomize with { <constraints> } */
7501 # if ($1 && peek_tail_name(*$1) == "randomize") {
7502 # if (!gn_system_verilog())
7503 # yyerror(@2, "error: Randomize with constraint requires SystemVerilog.");
7504 # else
7505 # yyerror(@2, "sorry: Randomize with constraint not supported.");
7506 # } else {
7507 # yyerror(@2, "error: Constraint block can only be applied to randomize method.");
7508 # }
7509 # list<PExpr*>pt;
7510 # PCallTask*tmp = new PCallTask(*$1, pt);
7511 # FILE_NAME(tmp, @1);
7512 # delete $1;
7513 # $$ = tmp;
7514 # }
7515 ()
7516 def p_statement_item_51(p):
7517 '''statement_item : implicit_class_handle '.' hierarchy_identifier '(' expression_list_with_nuls ')' ';' '''
7518 print('statement_item_51', list(p))
7519 # { pform_name_t*t_name = $1;
7520 # while (! $3->empty()) {
7521 # t_name->push_back($3->front());
7522 # $3->pop_front();
7523 # }
7524 # PCallTask*tmp = new PCallTask(*t_name, *$5);
7525 # FILE_NAME(tmp, @1);
7526 # delete $1;
7527 # delete $3;
7528 # delete $5;
7529 # $$ = tmp;
7530 # }
7531 ()
7532 def p_statement_item_52(p):
7533 '''statement_item : hierarchy_identifier ';' '''
7534 print('statement_item_52', list(p))
7535 # { list<PExpr*>pt;
7536 # PCallTask*tmp = pform_make_call_task(@1, *$1, pt);
7537 # delete $1;
7538 # $$ = tmp;
7539 # }
7540 ()
7541 def p_statement_item_53(p):
7542 '''statement_item : implicit_class_handle '.' K_new '(' expression_list_with_nuls ')' ';' '''
7543 print('statement_item_53', list(p))
7544 # { PChainConstructor*tmp = new PChainConstructor(*$5);
7545 # FILE_NAME(tmp, @3);
7546 # delete $1;
7547 # $$ = tmp;
7548 # }
7549 ()
7550 def p_statement_item_54(p):
7551 '''statement_item : hierarchy_identifier '(' error ')' ';' '''
7552 print('statement_item_54', list(p))
7553 # { yyerror(@3, "error: Syntax error in task arguments.");
7554 # list<PExpr*>pt;
7555 # PCallTask*tmp = pform_make_call_task(@1, *$1, pt);
7556 # delete $1;
7557 # $$ = tmp;
7558 # }
7559 ()
7560 def p_statement_item_55(p):
7561 '''statement_item : error ';' '''
7562 print('statement_item_55', list(p))
7563 # { yyerror(@2, "error: malformed statement");
7564 # yyerrok;
7565 # $$ = new PNoop;
7566 # }
7567 ()
7568 def p__embed0_statement_item(p):
7569 '''_embed0_statement_item : '''
7570 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_SEQ);
7571 # FILE_NAME(tmp, @1);
7572 # current_block_stack.push(tmp);
7573 # }
7574 ()
7575 def p__embed1_statement_item(p):
7576 '''_embed1_statement_item : '''
7577 # { if ($3) {
7578 # if (! gn_system_verilog()) {
7579 # yyerror("error: Variable declaration in unnamed block "
7580 # "requires SystemVerilog.");
7581 # }
7582 # } else {
7583 # /* If there are no declarations in the scope then just delete it. */
7584 # pform_pop_scope();
7585 # assert(! current_block_stack.empty());
7586 # PBlock*tmp = current_block_stack.top();
7587 # current_block_stack.pop();
7588 # delete tmp;
7589 # }
7590 # }
7591 ()
7592 def p__embed2_statement_item(p):
7593 '''_embed2_statement_item : '''
7594 # { PBlock*tmp = pform_push_block_scope($3, PBlock::BL_SEQ);
7595 # FILE_NAME(tmp, @1);
7596 # current_block_stack.push(tmp);
7597 # }
7598 ()
7599 def p__embed3_statement_item(p):
7600 '''_embed3_statement_item : '''
7601 # { PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
7602 # FILE_NAME(tmp, @1);
7603 # current_block_stack.push(tmp);
7604 # }
7605 ()
7606 def p__embed4_statement_item(p):
7607 '''_embed4_statement_item : '''
7608 # { if ($3) {
7609 # if (! gn_system_verilog()) {
7610 # yyerror("error: Variable declaration in unnamed block "
7611 # "requires SystemVerilog.");
7612 # }
7613 # } else {
7614 # /* If there are no declarations in the scope then just delete it. */
7615 # pform_pop_scope();
7616 # assert(! current_block_stack.empty());
7617 # PBlock*tmp = current_block_stack.top();
7618 # current_block_stack.pop();
7619 # delete tmp;
7620 # }
7621 # }
7622 ()
7623 def p__embed5_statement_item(p):
7624 '''_embed5_statement_item : '''
7625 # { PBlock*tmp = pform_push_block_scope($3, PBlock::BL_PAR);
7626 # FILE_NAME(tmp, @1);
7627 # current_block_stack.push(tmp);
7628 # }
7629 ()
7630 def p_compressed_statement_1(p):
7631 '''compressed_statement : lpvalue K_PLUS_EQ expression '''
7632 print('compressed_statement_1', list(p))
7633 # { PAssign*tmp = new PAssign($1, '+', $3);
7634 # FILE_NAME(tmp, @1);
7635 # $$ = tmp;
7636 # }
7637 ()
7638 def p_compressed_statement_2(p):
7639 '''compressed_statement : lpvalue K_MINUS_EQ expression '''
7640 print('compressed_statement_2', list(p))
7641 # { PAssign*tmp = new PAssign($1, '-', $3);
7642 # FILE_NAME(tmp, @1);
7643 # $$ = tmp;
7644 # }
7645 ()
7646 def p_compressed_statement_3(p):
7647 '''compressed_statement : lpvalue K_MUL_EQ expression '''
7648 print('compressed_statement_3', list(p))
7649 # { PAssign*tmp = new PAssign($1, '*', $3);
7650 # FILE_NAME(tmp, @1);
7651 # $$ = tmp;
7652 # }
7653 ()
7654 def p_compressed_statement_4(p):
7655 '''compressed_statement : lpvalue K_DIV_EQ expression '''
7656 print('compressed_statement_4', list(p))
7657 # { PAssign*tmp = new PAssign($1, '/', $3);
7658 # FILE_NAME(tmp, @1);
7659 # $$ = tmp;
7660 # }
7661 ()
7662 def p_compressed_statement_5(p):
7663 '''compressed_statement : lpvalue K_MOD_EQ expression '''
7664 print('compressed_statement_5', list(p))
7665 # { PAssign*tmp = new PAssign($1, '%', $3);
7666 # FILE_NAME(tmp, @1);
7667 # $$ = tmp;
7668 # }
7669 ()
7670 def p_compressed_statement_6(p):
7671 '''compressed_statement : lpvalue K_AND_EQ expression '''
7672 print('compressed_statement_6', list(p))
7673 # { PAssign*tmp = new PAssign($1, '&', $3);
7674 # FILE_NAME(tmp, @1);
7675 # $$ = tmp;
7676 # }
7677 ()
7678 def p_compressed_statement_7(p):
7679 '''compressed_statement : lpvalue K_OR_EQ expression '''
7680 print('compressed_statement_7', list(p))
7681 # { PAssign*tmp = new PAssign($1, '|', $3);
7682 # FILE_NAME(tmp, @1);
7683 # $$ = tmp;
7684 # }
7685 ()
7686 def p_compressed_statement_8(p):
7687 '''compressed_statement : lpvalue K_XOR_EQ expression '''
7688 print('compressed_statement_8', list(p))
7689 # { PAssign*tmp = new PAssign($1, '^', $3);
7690 # FILE_NAME(tmp, @1);
7691 # $$ = tmp;
7692 # }
7693 ()
7694 def p_compressed_statement_9(p):
7695 '''compressed_statement : lpvalue K_LS_EQ expression '''
7696 print('compressed_statement_9', list(p))
7697 # { PAssign *tmp = new PAssign($1, 'l', $3);
7698 # FILE_NAME(tmp, @1);
7699 # $$ = tmp;
7700 # }
7701 ()
7702 def p_compressed_statement_10(p):
7703 '''compressed_statement : lpvalue K_RS_EQ expression '''
7704 print('compressed_statement_10', list(p))
7705 # { PAssign*tmp = new PAssign($1, 'r', $3);
7706 # FILE_NAME(tmp, @1);
7707 # $$ = tmp;
7708 # }
7709 ()
7710 def p_compressed_statement_11(p):
7711 '''compressed_statement : lpvalue K_RSS_EQ expression '''
7712 print('compressed_statement_11', list(p))
7713 # { PAssign *tmp = new PAssign($1, 'R', $3);
7714 # FILE_NAME(tmp, @1);
7715 # $$ = tmp;
7716 # }
7717 ()
7718 def p_statement_or_null_list_opt_1(p):
7719 '''statement_or_null_list_opt : statement_or_null_list '''
7720 print('statement_or_null_list_opt_1', list(p))
7721 p[0] = p[1]
7722 ()
7723 def p_statement_or_null_list_opt_2(p):
7724 '''statement_or_null_list_opt : '''
7725 print('statement_or_null_list_opt_2', list(p))
7726 # { $$ = 0; }
7727 ()
7728 def p_statement_or_null_list_1(p):
7729 '''statement_or_null_list : statement_or_null_list statement_or_null '''
7730 print('statement_or_null_list_1', list(p))
7731 # { vector<Statement*>*tmp = $1;
7732 # if ($2) tmp->push_back($2);
7733 # $$ = tmp;
7734 # }
7735 ()
7736 def p_statement_or_null_list_2(p):
7737 '''statement_or_null_list : statement_or_null '''
7738 print('statement_or_null_list_2', list(p))
7739 # { vector<Statement*>*tmp = new vector<Statement*>(0);
7740 # if ($1) tmp->push_back($1);
7741 # $$ = tmp;
7742 # }
7743 ()
7744 def p_analog_statement_1(p):
7745 '''analog_statement : branch_probe_expression K_CONTRIBUTE expression ';' '''
7746 print('analog_statement_1', list(p))
7747 # { $$ = pform_contribution_statement(@2, $1, $3); }
7748 ()
7749 def p_task_item_1(p):
7750 '''task_item : block_item_decl '''
7751 print('task_item_1', list(p))
7752 # { $$ = new vector<pform_tf_port_t>(0); }
7753 ()
7754 def p_task_item_2(p):
7755 '''task_item : tf_port_declaration '''
7756 print('task_item_2', list(p))
7757 p[0] = p[1]
7758 ()
7759 def p_task_item_list_1(p):
7760 '''task_item_list : task_item_list task_item '''
7761 print('task_item_list_1', list(p))
7762 # { vector<pform_tf_port_t>*tmp = $1;
7763 # size_t s1 = tmp->size();
7764 # tmp->resize(s1 + $2->size());
7765 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
7766 # tmp->at(s1 + idx) = $2->at(idx);
7767 # delete $2;
7768 # $$ = tmp;
7769 # }
7770 ()
7771 def p_task_item_list_2(p):
7772 '''task_item_list : task_item '''
7773 print('task_item_list_2', list(p))
7774 p[0] = p[1]
7775 ()
7776 def p_task_item_list_opt_1(p):
7777 '''task_item_list_opt : task_item_list '''
7778 print('task_item_list_opt_1', list(p))
7779 p[0] = p[1]
7780 ()
7781 def p_task_item_list_opt_2(p):
7782 '''task_item_list_opt : '''
7783 print('task_item_list_opt_2', list(p))
7784 # { $$ = 0; }
7785 ()
7786 def p_tf_port_list_opt_1(p):
7787 '''tf_port_list_opt : tf_port_list '''
7788 print('tf_port_list_opt_1', list(p))
7789 p[0] = p[1]
7790 ()
7791 def p_tf_port_list_opt_2(p):
7792 '''tf_port_list_opt : '''
7793 print('tf_port_list_opt_2', list(p))
7794 # { $$ = 0; }
7795 ()
7796 def p_udp_body_1(p):
7797 '''udp_body : K_table udp_entry_list K_endtable '''
7798 print('udp_body_1', list(p))
7799 # { lex_end_table();
7800 # $$ = $2;
7801 # }
7802 ()
7803 def p_udp_body_2(p):
7804 '''udp_body : K_table K_endtable '''
7805 print('udp_body_2', list(p))
7806 # { lex_end_table();
7807 # yyerror(@1, "error: Empty UDP table.");
7808 # $$ = 0;
7809 # }
7810 ()
7811 def p_udp_body_3(p):
7812 '''udp_body : K_table error K_endtable '''
7813 print('udp_body_3', list(p))
7814 # { lex_end_table();
7815 # yyerror(@2, "Errors in UDP table");
7816 # yyerrok;
7817 # $$ = 0;
7818 # }
7819 ()
7820 def p_udp_entry_list_1(p):
7821 '''udp_entry_list : udp_comb_entry_list '''
7822 print('udp_entry_list_1', list(p))
7823 ()
7824 def p_udp_entry_list_2(p):
7825 '''udp_entry_list : udp_sequ_entry_list '''
7826 print('udp_entry_list_2', list(p))
7827 ()
7828 def p_udp_comb_entry_1(p):
7829 '''udp_comb_entry : udp_input_list ':' udp_output_sym ';' '''
7830 print('udp_comb_entry_1', list(p))
7831 # { char*tmp = new char[strlen($1)+3];
7832 # strcpy(tmp, $1);
7833 # char*tp = tmp+strlen(tmp);
7834 # *tp++ = ':';
7835 # *tp++ = $3;
7836 # *tp++ = 0;
7837 # delete[]$1;
7838 # $$ = tmp;
7839 # }
7840 ()
7841 def p_udp_comb_entry_list_1(p):
7842 '''udp_comb_entry_list : udp_comb_entry '''
7843 print('udp_comb_entry_list_1', list(p))
7844 # { list<string>*tmp = new list<string>;
7845 # tmp->push_back($1);
7846 # delete[]$1;
7847 # $$ = tmp;
7848 # }
7849 ()
7850 def p_udp_comb_entry_list_2(p):
7851 '''udp_comb_entry_list : udp_comb_entry_list udp_comb_entry '''
7852 print('udp_comb_entry_list_2', list(p))
7853 # { list<string>*tmp = $1;
7854 # tmp->push_back($2);
7855 # delete[]$2;
7856 # $$ = tmp;
7857 # }
7858 ()
7859 def p_udp_sequ_entry_list_1(p):
7860 '''udp_sequ_entry_list : udp_sequ_entry '''
7861 print('udp_sequ_entry_list_1', list(p))
7862 # { list<string>*tmp = new list<string>;
7863 # tmp->push_back($1);
7864 # delete[]$1;
7865 # $$ = tmp;
7866 # }
7867 ()
7868 def p_udp_sequ_entry_list_2(p):
7869 '''udp_sequ_entry_list : udp_sequ_entry_list udp_sequ_entry '''
7870 print('udp_sequ_entry_list_2', list(p))
7871 # { list<string>*tmp = $1;
7872 # tmp->push_back($2);
7873 # delete[]$2;
7874 # $$ = tmp;
7875 # }
7876 ()
7877 def p_udp_sequ_entry_1(p):
7878 '''udp_sequ_entry : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' '''
7879 print('udp_sequ_entry_1', list(p))
7880 # { char*tmp = new char[strlen($1)+5];
7881 # strcpy(tmp, $1);
7882 # char*tp = tmp+strlen(tmp);
7883 # *tp++ = ':';
7884 # *tp++ = $3;
7885 # *tp++ = ':';
7886 # *tp++ = $5;
7887 # *tp++ = 0;
7888 # $$ = tmp;
7889 # }
7890 ()
7891 def p_udp_initial_1(p):
7892 '''udp_initial : K_initial IDENTIFIER '=' number ';' '''
7893 print('udp_initial_1', list(p))
7894 # { PExpr*etmp = new PENumber($4);
7895 # PEIdent*itmp = new PEIdent(lex_strings.make($2));
7896 # PAssign*atmp = new PAssign(itmp, etmp);
7897 # FILE_NAME(atmp, @2);
7898 # delete[]$2;
7899 # $$ = atmp;
7900 # }
7901 ()
7902 def p_udp_init_opt_1(p):
7903 '''udp_init_opt : udp_initial '''
7904 print('udp_init_opt_1', list(p))
7905 p[0] = p[1]
7906 ()
7907 def p_udp_init_opt_2(p):
7908 '''udp_init_opt : '''
7909 print('udp_init_opt_2', list(p))
7910 # { $$ = 0; }
7911 ()
7912 def p_udp_input_list_1(p):
7913 '''udp_input_list : udp_input_sym '''
7914 print('udp_input_list_1', list(p))
7915 # { char*tmp = new char[2];
7916 # tmp[0] = $1;
7917 # tmp[1] = 0;
7918 # $$ = tmp;
7919 # }
7920 ()
7921 def p_udp_input_list_2(p):
7922 '''udp_input_list : udp_input_list udp_input_sym '''
7923 print('udp_input_list_2', list(p))
7924 # { char*tmp = new char[strlen($1)+2];
7925 # strcpy(tmp, $1);
7926 # char*tp = tmp+strlen(tmp);
7927 # *tp++ = $2;
7928 # *tp++ = 0;
7929 # delete[]$1;
7930 # $$ = tmp;
7931 # }
7932 ()
7933 def p_udp_input_sym_1(p):
7934 '''udp_input_sym : '0' '''
7935 print('udp_input_sym_1', list(p))
7936 # { $$ = '0'; }
7937 ()
7938 def p_udp_input_sym_2(p):
7939 '''udp_input_sym : '1' '''
7940 print('udp_input_sym_2', list(p))
7941 # { $$ = '1'; }
7942 ()
7943 def p_udp_input_sym_3(p):
7944 '''udp_input_sym : 'x' '''
7945 print('udp_input_sym_3', list(p))
7946 # { $$ = 'x'; }
7947 ()
7948 def p_udp_input_sym_4(p):
7949 '''udp_input_sym : '?' '''
7950 print('udp_input_sym_4', list(p))
7951 # { $$ = '?'; }
7952 ()
7953 def p_udp_input_sym_5(p):
7954 '''udp_input_sym : 'b' '''
7955 print('udp_input_sym_5', list(p))
7956 # { $$ = 'b'; }
7957 ()
7958 def p_udp_input_sym_6(p):
7959 '''udp_input_sym : '*' '''
7960 print('udp_input_sym_6', list(p))
7961 # { $$ = '*'; }
7962 ()
7963 def p_udp_input_sym_7(p):
7964 '''udp_input_sym : '%' '''
7965 print('udp_input_sym_7', list(p))
7966 # { $$ = '%'; }
7967 ()
7968 def p_udp_input_sym_8(p):
7969 '''udp_input_sym : 'f' '''
7970 print('udp_input_sym_8', list(p))
7971 # { $$ = 'f'; }
7972 ()
7973 def p_udp_input_sym_9(p):
7974 '''udp_input_sym : 'F' '''
7975 print('udp_input_sym_9', list(p))
7976 # { $$ = 'F'; }
7977 ()
7978 def p_udp_input_sym_10(p):
7979 '''udp_input_sym : 'l' '''
7980 print('udp_input_sym_10', list(p))
7981 # { $$ = 'l'; }
7982 ()
7983 def p_udp_input_sym_11(p):
7984 '''udp_input_sym : 'h' '''
7985 print('udp_input_sym_11', list(p))
7986 # { $$ = 'h'; }
7987 ()
7988 def p_udp_input_sym_12(p):
7989 '''udp_input_sym : 'B' '''
7990 print('udp_input_sym_12', list(p))
7991 # { $$ = 'B'; }
7992 ()
7993 def p_udp_input_sym_13(p):
7994 '''udp_input_sym : 'r' '''
7995 print('udp_input_sym_13', list(p))
7996 # { $$ = 'r'; }
7997 ()
7998 def p_udp_input_sym_14(p):
7999 '''udp_input_sym : 'R' '''
8000 print('udp_input_sym_14', list(p))
8001 # { $$ = 'R'; }
8002 ()
8003 def p_udp_input_sym_15(p):
8004 '''udp_input_sym : 'M' '''
8005 print('udp_input_sym_15', list(p))
8006 # { $$ = 'M'; }
8007 ()
8008 def p_udp_input_sym_16(p):
8009 '''udp_input_sym : 'n' '''
8010 print('udp_input_sym_16', list(p))
8011 # { $$ = 'n'; }
8012 ()
8013 def p_udp_input_sym_17(p):
8014 '''udp_input_sym : 'N' '''
8015 print('udp_input_sym_17', list(p))
8016 # { $$ = 'N'; }
8017 ()
8018 def p_udp_input_sym_18(p):
8019 '''udp_input_sym : 'p' '''
8020 print('udp_input_sym_18', list(p))
8021 # { $$ = 'p'; }
8022 ()
8023 def p_udp_input_sym_19(p):
8024 '''udp_input_sym : 'P' '''
8025 print('udp_input_sym_19', list(p))
8026 # { $$ = 'P'; }
8027 ()
8028 def p_udp_input_sym_20(p):
8029 '''udp_input_sym : 'Q' '''
8030 print('udp_input_sym_20', list(p))
8031 # { $$ = 'Q'; }
8032 ()
8033 def p_udp_input_sym_21(p):
8034 '''udp_input_sym : 'q' '''
8035 print('udp_input_sym_21', list(p))
8036 # { $$ = 'q'; }
8037 ()
8038 def p_udp_input_sym_22(p):
8039 '''udp_input_sym : '_' '''
8040 print('udp_input_sym_22', list(p))
8041 # { $$ = '_'; }
8042 ()
8043 def p_udp_input_sym_23(p):
8044 '''udp_input_sym : '+' '''
8045 print('udp_input_sym_23', list(p))
8046 # { $$ = '+'; }
8047 ()
8048 def p_udp_input_sym_24(p):
8049 '''udp_input_sym : DEC_NUMBER '''
8050 print('udp_input_sym_24', list(p))
8051 # { yyerror(@1, "internal error: Input digits parse as decimal number!"); $$ = '0'; }
8052 ()
8053 def p_udp_output_sym_1(p):
8054 '''udp_output_sym : '0' '''
8055 print('udp_output_sym_1', list(p))
8056 # { $$ = '0'; }
8057 ()
8058 def p_udp_output_sym_2(p):
8059 '''udp_output_sym : '1' '''
8060 print('udp_output_sym_2', list(p))
8061 # { $$ = '1'; }
8062 ()
8063 def p_udp_output_sym_3(p):
8064 '''udp_output_sym : 'x' '''
8065 print('udp_output_sym_3', list(p))
8066 # { $$ = 'x'; }
8067 ()
8068 def p_udp_output_sym_4(p):
8069 '''udp_output_sym : '-' '''
8070 print('udp_output_sym_4', list(p))
8071 # { $$ = '-'; }
8072 ()
8073 def p_udp_output_sym_5(p):
8074 '''udp_output_sym : DEC_NUMBER '''
8075 print('udp_output_sym_5', list(p))
8076 # { yyerror(@1, "internal error: Output digits parse as decimal number!"); $$ = '0'; }
8077 ()
8078 def p_udp_port_decl_1(p):
8079 '''udp_port_decl : K_input list_of_identifiers ';' '''
8080 print('udp_port_decl_1', list(p))
8081 # { $$ = pform_make_udp_input_ports($2); }
8082 ()
8083 def p_udp_port_decl_2(p):
8084 '''udp_port_decl : K_output IDENTIFIER ';' '''
8085 print('udp_port_decl_2', list(p))
8086 # { perm_string pname = lex_strings.make($2);
8087 # PWire*pp = new PWire(pname, NetNet::IMPLICIT, NetNet::POUTPUT, IVL_VT_LOGIC);
8088 # vector<PWire*>*tmp = new vector<PWire*>(1);
8089 # (*tmp)[0] = pp;
8090 # $$ = tmp;
8091 # delete[]$2;
8092 # }
8093 ()
8094 def p_udp_port_decl_3(p):
8095 '''udp_port_decl : K_reg IDENTIFIER ';' '''
8096 print('udp_port_decl_3', list(p))
8097 # { perm_string pname = lex_strings.make($2);
8098 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::PIMPLICIT, IVL_VT_LOGIC);
8099 # vector<PWire*>*tmp = new vector<PWire*>(1);
8100 # (*tmp)[0] = pp;
8101 # $$ = tmp;
8102 # delete[]$2;
8103 # }
8104 ()
8105 def p_udp_port_decl_4(p):
8106 '''udp_port_decl : K_reg K_output IDENTIFIER ';' '''
8107 print('udp_port_decl_4', list(p))
8108 # { perm_string pname = lex_strings.make($3);
8109 # PWire*pp = new PWire(pname, NetNet::REG, NetNet::POUTPUT, IVL_VT_LOGIC);
8110 # vector<PWire*>*tmp = new vector<PWire*>(1);
8111 # (*tmp)[0] = pp;
8112 # $$ = tmp;
8113 # delete[]$3;
8114 # }
8115 ()
8116 def p_udp_port_decls_1(p):
8117 '''udp_port_decls : udp_port_decl '''
8118 print('udp_port_decls_1', list(p))
8119 p[0] = p[1]
8120 ()
8121 def p_udp_port_decls_2(p):
8122 '''udp_port_decls : udp_port_decls udp_port_decl '''
8123 print('udp_port_decls_2', list(p))
8124 # { vector<PWire*>*tmp = $1;
8125 # size_t s1 = $1->size();
8126 # tmp->resize(s1+$2->size());
8127 # for (size_t idx = 0 ; idx < $2->size() ; idx += 1)
8128 # tmp->at(s1+idx) = $2->at(idx);
8129 # $$ = tmp;
8130 # delete $2;
8131 # }
8132 ()
8133 def p_udp_port_list_1(p):
8134 '''udp_port_list : IDENTIFIER '''
8135 print('udp_port_list_1', list(p))
8136 # { list<perm_string>*tmp = new list<perm_string>;
8137 # tmp->push_back(lex_strings.make($1));
8138 # delete[]$1;
8139 # $$ = tmp;
8140 # }
8141 ()
8142 def p_udp_port_list_2(p):
8143 '''udp_port_list : udp_port_list ',' IDENTIFIER '''
8144 print('udp_port_list_2', list(p))
8145 # { list<perm_string>*tmp = $1;
8146 # tmp->push_back(lex_strings.make($3));
8147 # delete[]$3;
8148 # $$ = tmp;
8149 # }
8150 ()
8151 def p_udp_reg_opt_1(p):
8152 '''udp_reg_opt : K_reg '''
8153 print('udp_reg_opt_1', list(p))
8154 # { $$ = true; }
8155 ()
8156 def p_udp_reg_opt_2(p):
8157 '''udp_reg_opt : '''
8158 print('udp_reg_opt_2', list(p))
8159 # { $$ = false; }
8160 ()
8161 def p_udp_initial_expr_opt_1(p):
8162 '''udp_initial_expr_opt : '=' expression '''
8163 print('udp_initial_expr_opt_1', list(p))
8164 p[0] = p[2]
8165 ()
8166 def p_udp_initial_expr_opt_2(p):
8167 '''udp_initial_expr_opt : '''
8168 print('udp_initial_expr_opt_2', list(p))
8169 # { $$ = 0; }
8170 ()
8171 def p_udp_input_declaration_list_1(p):
8172 '''udp_input_declaration_list : K_input IDENTIFIER '''
8173 print('udp_input_declaration_list_1', list(p))
8174 # { list<perm_string>*tmp = new list<perm_string>;
8175 # tmp->push_back(lex_strings.make($2));
8176 # $$ = tmp;
8177 # delete[]$2;
8178 # }
8179 ()
8180 def p_udp_input_declaration_list_2(p):
8181 '''udp_input_declaration_list : udp_input_declaration_list ',' K_input IDENTIFIER '''
8182 print('udp_input_declaration_list_2', list(p))
8183 # { list<perm_string>*tmp = $1;
8184 # tmp->push_back(lex_strings.make($4));
8185 # $$ = tmp;
8186 # delete[]$4;
8187 # }
8188 ()
8189 def p_udp_primitive_1(p):
8190 '''udp_primitive : K_primitive IDENTIFIER '(' udp_port_list ')' ';' udp_port_decls udp_init_opt udp_body K_endprimitive endlabel_opt '''
8191 print('udp_primitive_1', list(p))
8192 # { perm_string tmp2 = lex_strings.make($2);
8193 # pform_make_udp(tmp2, $4, $7, $9, $8,
8194 # @2.text, @2.first_line);
8195 # if ($11) {
8196 # if (strcmp($2,$11) != 0) {
8197 # yyerror(@11, "error: End label doesn't match "
8198 # "primitive name");
8199 # }
8200 # if (! gn_system_verilog()) {
8201 # yyerror(@11, "error: Primitive end labels "
8202 # "require SystemVerilog.");
8203 # }
8204 # delete[]$11;
8205 # }
8206 # delete[]$2;
8207 # }
8208 ()
8209 def p_udp_primitive_2(p):
8210 '''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 '''
8211 print('udp_primitive_2', list(p))
8212 # { perm_string tmp2 = lex_strings.make($2);
8213 # perm_string tmp6 = lex_strings.make($6);
8214 # pform_make_udp(tmp2, $5, tmp6, $7, $9, $12,
8215 # @2.text, @2.first_line);
8216 # if ($14) {
8217 # if (strcmp($2,$14) != 0) {
8218 # yyerror(@14, "error: End label doesn't match "
8219 # "primitive name");
8220 # }
8221 # if (! gn_system_verilog()) {
8222 # yyerror(@14, "error: Primitive end labels "
8223 # "require SystemVerilog.");
8224 # }
8225 # delete[]$14;
8226 # }
8227 # delete[]$2;
8228 # delete[]$6;
8229 # }
8230 ()
8231 def p_K_packed_opt_1(p):
8232 '''K_packed_opt : K_packed '''
8233 print('K_packed_opt', list(p))
8234 # { $$ = true; }
8235 ()
8236 def p_K_packed_opt_2(p):
8237 '''K_packed_opt : '''
8238 print('K_packed_opt', list(p))
8239 # { $$ = false; }
8240 ()
8241 def p_K_reg_opt_1(p):
8242 '''K_reg_opt : K_reg '''
8243 print('K_reg_opt', list(p))
8244 # { $$ = true; }
8245 ()
8246 def p_K_reg_opt_2(p):
8247 '''K_reg_opt : '''
8248 print('K_reg_opt', list(p))
8249 # { $$ = false; }
8250 ()
8251 def p_K_static_opt_1(p):
8252 '''K_static_opt : K_static '''
8253 print('K_static_opt', list(p))
8254 # { $$ = true; }
8255 ()
8256 def p_K_static_opt_2(p):
8257 '''K_static_opt : '''
8258 print('K_static_opt', list(p))
8259 # { $$ = false; }
8260 ()
8261
8262 def p_K_virtual_opt_1(p):
8263 '''K_virtual_opt : K_virtual '''
8264 print(p)
8265 # { $$ = true; }
8266 ()
8267 def p_K_virtual_opt_2(p):
8268 '''K_virtual_opt : '''
8269 print(p)
8270 # { $$ = false; }
8271 ()
8272
8273 def p_error(p):
8274 print ("error", p)
8275 exit(0)
8276
8277 yacc.yacc(debug=0)
8278