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