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