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