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