[18] | 1 | /* |
---|
| 2 | |
---|
| 3 | Copyright (c) 1992, 1993 |
---|
| 4 | Regents of the University of California |
---|
| 5 | All rights reserved. |
---|
| 6 | |
---|
| 7 | Use and copying of this software and preparation of derivative works |
---|
| 8 | based upon this software are permitted. However, any distribution of |
---|
| 9 | this software or derivative works must include the above copyright |
---|
| 10 | notice. |
---|
| 11 | |
---|
| 12 | This software is made available AS IS, and neither the Electronics |
---|
| 13 | Research Laboratory or the Universify of California make any |
---|
| 14 | warranty about the software, its performance or its conformity to |
---|
| 15 | any specification. |
---|
| 16 | |
---|
| 17 | Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU |
---|
| 18 | 10/92 |
---|
| 19 | 10/93 |
---|
| 20 | |
---|
| 21 | $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/verilog.y,v 1.7 2009/03/16 20:57:20 fabio Exp $ |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | */ |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | %{ |
---|
| 28 | |
---|
| 29 | #include <stdio.h> |
---|
| 30 | #include "util.h" |
---|
| 31 | #include "list.h" |
---|
| 32 | #include "st.h" |
---|
| 33 | #include "array.h" |
---|
| 34 | #include "set.h" |
---|
| 35 | #include "stack.h" |
---|
| 36 | #include "vl_defs.h" |
---|
| 37 | #include "vl_types.h" |
---|
| 38 | #include "vlr_int.h" |
---|
| 39 | #include "vl_create.h" |
---|
| 40 | #include "vl_write.h" |
---|
| 41 | #include "vl_create.h" |
---|
| 42 | #include "verilog.h" |
---|
| 43 | |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | |
---|
| 48 | #define NOND_SET "NDset" |
---|
| 49 | |
---|
| 50 | extern vl_descPtr mod_list; |
---|
| 51 | extern char yyid[]; |
---|
| 52 | extern char brep[]; |
---|
| 53 | extern int bexp0, bexp1; |
---|
| 54 | extern char last_macro[]; |
---|
| 55 | extern st_table *macros; |
---|
| 56 | extern int compatibleChecking; |
---|
| 57 | extern char yytypetoken[]; |
---|
| 58 | extern int instantiateAll; |
---|
| 59 | |
---|
| 60 | int YYTrace=0; |
---|
| 61 | |
---|
| 62 | char *vl_filename = "<stdin>"; |
---|
| 63 | struct vl_desc *vl_description = NIL(struct vl_desc); |
---|
| 64 | struct vl_module *vl_currentModule=NIL(vl_module); |
---|
| 65 | struct vl_primitive *vl_currentPrimitive=NIL(vl_primitive); |
---|
| 66 | struct vl_function *vl_currentFunction=NIL(vl_function); |
---|
| 67 | lsList vl_module_stack; |
---|
| 68 | lsList vl_cur_type_stack; |
---|
| 69 | st_table *aux_st=NIL(st_table); |
---|
| 70 | char modName[MAXSTRLEN]; |
---|
| 71 | char *cp; |
---|
| 72 | short eventType; |
---|
| 73 | int enum_val=0; |
---|
| 74 | int reserve_type_name=1; |
---|
| 75 | int task_mode=0; |
---|
| 76 | int timed_statement = 0; |
---|
| 77 | static int c_assign=0; |
---|
| 78 | |
---|
| 79 | EXTERN int yylex ARGS(()); |
---|
| 80 | |
---|
| 81 | %} |
---|
| 82 | |
---|
| 83 | |
---|
| 84 | %union { |
---|
| 85 | int ival; |
---|
| 86 | char *charp; |
---|
| 87 | typestructPtr type; |
---|
| 88 | lsList lstp; |
---|
| 89 | vl_bassign_stmtPtr basgn; |
---|
| 90 | vl_begin_end_stmtPtr seqstmt; |
---|
| 91 | vl_case_itemPtr caseitem; |
---|
| 92 | vl_cont_assignPtr casgn; |
---|
| 93 | vl_declPtr bascdcl; |
---|
| 94 | vl_delayPtr dlay; |
---|
| 95 | vl_descPtr desc; |
---|
| 96 | vl_event_exprPtr evnt; |
---|
| 97 | vl_exprPtr expr; |
---|
| 98 | vl_fork_join_stmtPtr parstmt; |
---|
| 99 | vl_functionPtr func; |
---|
| 100 | vl_gate_instPtr gtinst; |
---|
| 101 | vl_gate_inst_listPtr gtlist; |
---|
| 102 | vl_id_rangePtr idrng; |
---|
| 103 | vl_lvalPtr lval; |
---|
| 104 | vl_mod_prim_inst_listPtr modlist; |
---|
| 105 | vl_modulePtr modu; |
---|
| 106 | vl_netdeclPtr netdcl; |
---|
| 107 | vl_paramdeclPtr paradcl; |
---|
| 108 | vl_portPtr port; |
---|
| 109 | vl_port_connectPtr connect; |
---|
| 110 | vl_prim_entryPtr ntry; |
---|
| 111 | vl_primitivePtr prim; |
---|
| 112 | vl_procstmtPtr prcstmt; |
---|
| 113 | vl_rangePtr rang; |
---|
| 114 | vl_range_or_typePtr rngtyp; |
---|
| 115 | vl_rangedeclPtr rangdcl; |
---|
| 116 | vl_taskPtr task; |
---|
| 117 | vl_task_enable_stmtPtr taskenablestmt; |
---|
| 118 | vl_typePtr typedcl; |
---|
| 119 | vl_type_specifierPtr typespc; |
---|
| 120 | vl_enumeratorPtr enumtr; |
---|
| 121 | vl_enum_typePtr enumtp; |
---|
| 122 | multi_concatPtr mconcat; |
---|
| 123 | } |
---|
| 124 | |
---|
| 125 | |
---|
| 126 | %start source_text |
---|
| 127 | |
---|
| 128 | |
---|
| 129 | %token YYIDE |
---|
| 130 | %token YYINUMBER |
---|
| 131 | %token YYRNUMBER |
---|
| 132 | %token YYSTRING |
---|
| 133 | %token YYALLPATH |
---|
| 134 | %token YYALWAYS |
---|
| 135 | %token YYAND |
---|
| 136 | %token YYASSIGN |
---|
| 137 | %token YYBEGIN |
---|
| 138 | %token YYBUF |
---|
| 139 | %token YYBUFIF0 |
---|
| 140 | %token YYBUFIF1 |
---|
| 141 | %token YYCASE |
---|
| 142 | %token YYCASEX |
---|
| 143 | %token YYCASEZ |
---|
| 144 | %token YYCMOS |
---|
| 145 | %token YYCONDITIONAL |
---|
| 146 | %token YYDEASSIGN |
---|
| 147 | %token YYDEFAULT |
---|
| 148 | %token YYDEFPARAM |
---|
| 149 | %token YYDISABLE |
---|
| 150 | %token YYELSE |
---|
| 151 | %token YYEDGE |
---|
| 152 | %token YYEND |
---|
| 153 | %token YYENDCASE |
---|
| 154 | %token YYENDMODULE |
---|
| 155 | %token YYENDFUNCTION |
---|
| 156 | %token YYENDPRIMITIVE |
---|
| 157 | %token YYENDSPECIFY |
---|
| 158 | %token YYENDTABLE |
---|
| 159 | %token YYENDTASK |
---|
| 160 | %token YYENUM |
---|
| 161 | %token YYEVENT |
---|
| 162 | %token YYFOR |
---|
| 163 | %token YYFOREVER |
---|
| 164 | %token YYFORK |
---|
| 165 | %token YYFUNCTION |
---|
| 166 | %token YYGEQ |
---|
| 167 | %token YYHIGHZ0 |
---|
| 168 | %token YYHIGHZ1 |
---|
| 169 | %token YYIF |
---|
| 170 | %token YYINITIAL |
---|
| 171 | %token YYINOUT |
---|
| 172 | %token YYINPUT |
---|
| 173 | %token YYINTEGER |
---|
| 174 | %token YYJOIN |
---|
| 175 | %token YYLARGE |
---|
| 176 | %token YYLEADTO |
---|
| 177 | %token YYLEQ |
---|
| 178 | %token YYLOGAND |
---|
| 179 | %token YYCASEEQUALITY |
---|
| 180 | %token YYCASEINEQUALITY |
---|
| 181 | %token YYLOGNAND |
---|
| 182 | %token YYLOGNOR |
---|
| 183 | %token YYLOGOR |
---|
| 184 | %token YYLOGXNOR |
---|
| 185 | %token YYLOGEQUALITY |
---|
| 186 | %token YYLOGINEQUALITY |
---|
| 187 | %token YYLSHIFT |
---|
| 188 | %token YYMACROMODULE |
---|
| 189 | %token YYMEDIUM |
---|
| 190 | %token YYMODULE |
---|
| 191 | %token YYMREG |
---|
| 192 | %token YYNAND |
---|
| 193 | %token YYNBASSIGN |
---|
| 194 | %token YYNEGEDGE |
---|
| 195 | %token YYNMOS |
---|
| 196 | %token YYNOR |
---|
| 197 | %token YYNOT |
---|
| 198 | %token YYNOTIF0 |
---|
| 199 | %token YYNOTIF1 |
---|
| 200 | %token YYOR |
---|
| 201 | %token YYOUTPUT |
---|
| 202 | %token YYPARAMETER |
---|
| 203 | %token YYPMOS |
---|
| 204 | %token YYPOSEDGE |
---|
| 205 | %token YYPRIMITIVE |
---|
| 206 | %token YYPULL0 |
---|
| 207 | %token YYPULL1 |
---|
| 208 | %token YYPULLUP |
---|
| 209 | %token YYPULLDOWN |
---|
| 210 | %token YYRCMOS |
---|
| 211 | %token YYREAL |
---|
| 212 | %token YYREG |
---|
| 213 | %token YYREPEAT |
---|
| 214 | %token YYRIGHTARROW |
---|
| 215 | %token YYRNMOS |
---|
| 216 | %token YYRPMOS |
---|
| 217 | %token YYRSHIFT |
---|
| 218 | %token YYRTRAN |
---|
| 219 | %token YYRTRANIF0 |
---|
| 220 | %token YYRTRANIF1 |
---|
| 221 | %token YYSCALARED |
---|
| 222 | %token YYSMALL |
---|
| 223 | %token YYSPECIFY |
---|
| 224 | %token YYSPECPARAM |
---|
| 225 | %token YYSTRONG0 |
---|
| 226 | %token YYSTRONG1 |
---|
| 227 | %token YYSUPPLY0 |
---|
| 228 | %token YYSUPPLY1 |
---|
| 229 | %token YYSWIRE |
---|
| 230 | %token YYTABLE |
---|
| 231 | %token YYTASK |
---|
| 232 | %token YYTESLATIMER |
---|
| 233 | %token YYTIME |
---|
| 234 | %token YYTRAN |
---|
| 235 | %token YYTRANIF0 |
---|
| 236 | %token YYTRANIF1 |
---|
| 237 | %token YYTRI |
---|
| 238 | %token YYTRI0 |
---|
| 239 | %token YYTRI1 |
---|
| 240 | %token YYTRIAND |
---|
| 241 | %token YYTRIOR |
---|
| 242 | %token YYTRIREG |
---|
| 243 | %token YYuTYPE |
---|
| 244 | %token YYTYPEDEF |
---|
| 245 | %token YYVECTORED |
---|
| 246 | %token YYWAIT |
---|
| 247 | %token YYWAND |
---|
| 248 | %token YYWEAK0 |
---|
| 249 | %token YYWEAK1 |
---|
| 250 | %token YYWHILE |
---|
| 251 | %token YYWIRE |
---|
| 252 | %token YYWOR |
---|
| 253 | %token YYXNOR |
---|
| 254 | %token YYXOR |
---|
| 255 | %token YYsysSETUP |
---|
| 256 | %token YYsysID |
---|
| 257 | %token YYsysND |
---|
| 258 | |
---|
| 259 | %right YYCONDITIONAL |
---|
| 260 | %right '?' ':' |
---|
| 261 | %left YYOR |
---|
| 262 | %left YYLOGOR |
---|
| 263 | %left YYLOGAND |
---|
| 264 | %left '|' |
---|
| 265 | %left '^' YYLOGXNOR |
---|
| 266 | %left '&' |
---|
| 267 | %left YYLOGEQUALITY YYLOGINEQUALITY YYCASEEQUALITY YYCASEINEQUALITY |
---|
| 268 | %left '<' YYLEQ '>' YYGEQ YYNBASSIGN |
---|
| 269 | %left YYLSHIFT YYRSHIFT |
---|
| 270 | %left '+' '-' |
---|
| 271 | %left '*' '/' '%' |
---|
| 272 | %right '~' '!' YYUNARYOPERATOR |
---|
| 273 | |
---|
| 274 | %type <desc> source_text |
---|
| 275 | %type <desc> description |
---|
| 276 | %type <modu> module |
---|
| 277 | %type <prim> primitive |
---|
| 278 | %type <lstp> port_list_opt port_list |
---|
| 279 | %type <port> port |
---|
| 280 | %type <lstp> port_expression_opt port_expression |
---|
| 281 | %type <lstp> port_ref_list |
---|
| 282 | %type <idrng> port_reference |
---|
| 283 | %type <rang> port_reference_arg |
---|
| 284 | %type <type> module_item |
---|
| 285 | %type <lstp> module_item_clr |
---|
| 286 | %type <paradcl> parameter_declaration |
---|
| 287 | %type <rangdcl> input_declaration output_declaration inout_declaration |
---|
| 288 | %type <rangdcl> reg_declaration |
---|
| 289 | %type <netdcl> net_declaration |
---|
| 290 | %type <bascdcl> time_declaration event_declaration |
---|
| 291 | %type <bascdcl> integer_declaration real_declaration |
---|
| 292 | %type <gtlist> gate_instantiation |
---|
| 293 | %type <type> module_or_primitive_instantiation |
---|
| 294 | %type <paradcl> parameter_override |
---|
| 295 | %type <casgn> continuous_assign |
---|
| 296 | %type <prcstmt> initial_statement always_statement |
---|
| 297 | %type <task> task |
---|
| 298 | %type <func> function |
---|
| 299 | %type <lstp> variable_list primitive_declaration_eclr |
---|
| 300 | %type <lstp> table_definition |
---|
| 301 | %type <lstp> table_entries combinational_entry_eclr sequential_entry_eclr |
---|
| 302 | %type <ntry> combinational_entry sequential_entry |
---|
| 303 | %type <lstp> input_list level_symbol_or_edge_eclr |
---|
| 304 | %type <ival> output_symbol state next_state |
---|
| 305 | %type <ival> level_symbol edge level_symbol_or_edge edge_symbol |
---|
| 306 | %type <type> primitive_declaration |
---|
| 307 | %type <lstp> tf_declaration_clr tf_declaration_eclr |
---|
| 308 | %type <lstp> statement_opt |
---|
| 309 | %type <rngtyp> range_or_type_opt range_or_type |
---|
| 310 | %type <rang> range |
---|
| 311 | %type <type> tf_declaration |
---|
| 312 | %type <lstp> assignment_list |
---|
| 313 | %type <rang> range_opt |
---|
| 314 | %type <expr> expression |
---|
| 315 | %type <ival> drive_strength_opt drive_strength |
---|
| 316 | %type <ival> charge_strength_opt charge_strength |
---|
| 317 | %type <ival> nettype |
---|
| 318 | %type <rang> expandrange_opt expandrange |
---|
| 319 | %type <dlay> delay_opt delay |
---|
| 320 | %type <lstp> register_variable_list |
---|
| 321 | %type <lstp> name_of_event_list |
---|
| 322 | %type <idrng> identifier |
---|
| 323 | %type <idrng> register_variable |
---|
| 324 | %type <charp> name_of_register |
---|
| 325 | %type <idrng> name_of_event |
---|
| 326 | %type <ival> strength0 strength1 |
---|
| 327 | %type <basgn> assignment |
---|
| 328 | %type <lstp> drive_delay_clr gate_instance_list |
---|
| 329 | %type <ival> gatetype drive_delay |
---|
| 330 | %type <gtinst> gate_instance |
---|
| 331 | %type <lstp> terminal_list |
---|
| 332 | %type <idrng> name_of_gate_instance name_of_module_or_primitive |
---|
| 333 | %type <expr> terminal |
---|
| 334 | %type <lstp> module_or_primitive_option_clr |
---|
| 335 | %type <ival> module_or_primitive_option |
---|
| 336 | %type <lstp> module_or_primitive_instance_list |
---|
| 337 | %type <dlay> delay_or_parameter_value_assignment |
---|
| 338 | %type <type> module_or_primitive_instance |
---|
| 339 | %type <lstp> module_connection_list module_port_connection_list |
---|
| 340 | %type <lstp> named_port_connection_list |
---|
| 341 | %type <connect> module_port_connection named_port_connection |
---|
| 342 | %type <type> statement |
---|
| 343 | %type <lstp> statement_clr case_item_eclr |
---|
| 344 | %type <caseitem> case_item |
---|
| 345 | %type <dlay> delay_control |
---|
| 346 | %type <evnt> event_control |
---|
| 347 | %type <lval> lvalue |
---|
| 348 | %type <lstp> expression_list |
---|
| 349 | %type <seqstmt> seq_block |
---|
| 350 | %type <parstmt> par_block |
---|
| 351 | %type <idrng> name_of_block |
---|
| 352 | %type <lstp> block_declaration_clr |
---|
| 353 | %type <type> block_declaration |
---|
| 354 | %type <taskenablestmt> task_enable |
---|
| 355 | %type <lstp> concatenation |
---|
| 356 | %type <lstp> mintypmax_expression_list |
---|
| 357 | %type <expr> mintypmax_expression |
---|
| 358 | %type <expr> primary |
---|
| 359 | %type <expr> function_call |
---|
| 360 | %type <evnt> event_expression ored_event_expression |
---|
| 361 | %type <typedcl> type_declaration type_decorator_opt |
---|
| 362 | %type <charp> type_name enum_name |
---|
| 363 | %type <typespc> type_specifier |
---|
| 364 | %type <lstp> enum_lst_opt enumerator_list |
---|
| 365 | %type <enumtp> enum_specifier |
---|
| 366 | %type <enumtr> enumerator |
---|
| 367 | %type <lstp> nondeterminism_list |
---|
| 368 | %type <mconcat> multiple_concatenation |
---|
| 369 | |
---|
| 370 | /* The rules for if-then-else statements produce one harmless |
---|
| 371 | * shift-reduce conflict. */ |
---|
| 372 | %expect 1 |
---|
| 373 | |
---|
| 374 | %% |
---|
| 375 | |
---|
| 376 | |
---|
| 377 | |
---|
| 378 | source_text |
---|
| 379 | : |
---|
| 380 | { |
---|
| 381 | YYTRACE("source_text:"); |
---|
| 382 | if (vl_description == NIL(struct vl_desc)) { |
---|
| 383 | $$ = vl_description = mod_list = vl_create_desc("stdin"); |
---|
| 384 | } |
---|
| 385 | } |
---|
| 386 | | source_text description |
---|
| 387 | { |
---|
| 388 | YYTRACE("source_text: source_text description"); |
---|
| 389 | } |
---|
| 390 | ; |
---|
| 391 | |
---|
| 392 | description |
---|
| 393 | : module |
---|
| 394 | { |
---|
| 395 | YYTRACE("description: module"); |
---|
| 396 | } |
---|
| 397 | | primitive |
---|
| 398 | { |
---|
| 399 | YYTRACE("description: primitive"); |
---|
| 400 | } |
---|
| 401 | | type_declaration |
---|
| 402 | { |
---|
| 403 | YYTRACE("module_item: type_declaration"); |
---|
| 404 | } |
---|
| 405 | ; |
---|
| 406 | |
---|
| 407 | type_declaration |
---|
| 408 | : YYTYPEDEF type_specifier type_name ';' |
---|
| 409 | { |
---|
| 410 | YYTRACE("type_declaration: YYTYPEDEF typesepcifier type_name ';'"); |
---|
| 411 | vl_create_typedecl($3, $2); |
---|
| 412 | if (compatibleChecking) |
---|
| 413 | yyerror("type mechanism is not allowed"); |
---|
| 414 | } |
---|
| 415 | ; |
---|
| 416 | |
---|
| 417 | module |
---|
| 418 | : YYMODULE YYIDE |
---|
| 419 | { |
---|
| 420 | vl_id_rangePtr idptr; |
---|
| 421 | |
---|
| 422 | |
---|
| 423 | if (!empty_file_stack() && !instantiateAll && mod_list) |
---|
| 424 | st_insert(mod_list->mod_holes,vlStrdup(yyid),0); |
---|
| 425 | |
---|
| 426 | idptr = vl_create_id_range(vlStrdup(yyid), NIL(vl_range)); |
---|
| 427 | vl_currentModule = vl_create_module(idptr, LS_NIL, LS_NIL); |
---|
| 428 | (void)push_stack(vl_module_stack, (void*)vl_currentModule); |
---|
| 429 | set_eliminate(idptr->name, mod_list->mp_undefined); |
---|
| 430 | } |
---|
| 431 | port_list_opt ';' |
---|
| 432 | { |
---|
| 433 | vl_currentModule->ports = $4; |
---|
| 434 | } |
---|
| 435 | module_item_clr |
---|
| 436 | YYENDMODULE |
---|
| 437 | { |
---|
| 438 | YYTRACE("module: YYMODULE YYIDE port_list_opt ';' module_item_clr YYENDMODULE"); |
---|
| 439 | vl_currentModule->mod_items = $7; |
---|
| 440 | $$ = vl_currentModule; |
---|
| 441 | (void**)pop_stack(vl_module_stack, (void**)&vl_currentModule); |
---|
| 442 | vl_currentModule = (vl_module*)(void*)top_stack(vl_module_stack); |
---|
| 443 | assert(vl_currentModule == NIL(vl_module)); |
---|
| 444 | } |
---|
| 445 | | YYMACROMODULE YYIDE port_list_opt ';' |
---|
| 446 | module_item_clr |
---|
| 447 | YYENDMODULE |
---|
| 448 | { |
---|
| 449 | YYTRACE("module: YYMACROMODULE YYIDE port_list_opt ';' module_item_clr YYENDMODULE"); |
---|
| 450 | TODO("module: YYMACROMODULE YYIDE port_list_opt ';' module_item_clr YYENDMODULE"); |
---|
| 451 | } |
---|
| 452 | ; |
---|
| 453 | |
---|
| 454 | port_list_opt |
---|
| 455 | : |
---|
| 456 | { |
---|
| 457 | YYTRACE("port_list_opt:"); |
---|
| 458 | $$ = LS_NIL; |
---|
| 459 | } |
---|
| 460 | | '(' port_list ')' |
---|
| 461 | { |
---|
| 462 | YYTRACE("port_list_opt: '(' port_list ')'"); |
---|
| 463 | $$ = $2; |
---|
| 464 | } |
---|
| 465 | ; |
---|
| 466 | |
---|
| 467 | port_list |
---|
| 468 | : port |
---|
| 469 | { |
---|
| 470 | lsHandle handle; |
---|
| 471 | |
---|
| 472 | YYTRACE("port_list: port"); |
---|
| 473 | $$ = lsCreate(); |
---|
| 474 | lsNewEnd($$, (lsGeneric)$1, &handle); |
---|
| 475 | } |
---|
| 476 | | port_list ',' port |
---|
| 477 | { |
---|
| 478 | lsHandle handle; |
---|
| 479 | |
---|
| 480 | YYTRACE("port_list: port_list ',' port"); |
---|
| 481 | lsNewEnd($1, (lsGeneric)$3, &handle); |
---|
| 482 | $$ = $1; |
---|
| 483 | } |
---|
| 484 | ; |
---|
| 485 | |
---|
| 486 | port |
---|
| 487 | : port_expression_opt |
---|
| 488 | { |
---|
| 489 | YYTRACE("port: port_expression_opt"); |
---|
| 490 | $$ = vl_create_port(ModulePort, NIL(vl_id_range), $1); |
---|
| 491 | } |
---|
| 492 | | '.' YYIDE |
---|
| 493 | { |
---|
| 494 | $<idrng>$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range)); |
---|
| 495 | } |
---|
| 496 | '(' port_expression_opt ')' |
---|
| 497 | { |
---|
| 498 | YYTRACE("port: ',' YYIDE '(' port_expression_opt ')'"); |
---|
| 499 | $$ = vl_create_port(NamedPort, $<idrng>3, $5); |
---|
| 500 | } |
---|
| 501 | ; |
---|
| 502 | |
---|
| 503 | port_expression_opt |
---|
| 504 | : |
---|
| 505 | { |
---|
| 506 | YYTRACE("port_expression_opt:"); |
---|
| 507 | $$ = LS_NIL; |
---|
| 508 | } |
---|
| 509 | | port_expression |
---|
| 510 | { |
---|
| 511 | YYTRACE("port_expression_opt: port_expression"); |
---|
| 512 | } |
---|
| 513 | ; |
---|
| 514 | |
---|
| 515 | port_expression |
---|
| 516 | : port_reference |
---|
| 517 | { |
---|
| 518 | lsHandle handle; |
---|
| 519 | |
---|
| 520 | YYTRACE("port_expression: port_reference"); |
---|
| 521 | $$ = lsCreate(); |
---|
| 522 | lsNewEnd($$, (lsGeneric)$1, &handle); |
---|
| 523 | } |
---|
| 524 | | '{' port_ref_list '}' |
---|
| 525 | { |
---|
| 526 | YYTRACE("port_expression: '{' port_ref_list '}'"); |
---|
| 527 | $$ = $2; |
---|
| 528 | } |
---|
| 529 | ; |
---|
| 530 | |
---|
| 531 | port_ref_list |
---|
| 532 | : port_reference |
---|
| 533 | { |
---|
| 534 | lsHandle handle; |
---|
| 535 | |
---|
| 536 | YYTRACE("port_ref_list: port_reference"); |
---|
| 537 | $$ = lsCreate(); |
---|
| 538 | lsNewEnd($$, (lsGeneric)$1, &handle); |
---|
| 539 | } |
---|
| 540 | | port_ref_list ',' port_reference |
---|
| 541 | { |
---|
| 542 | lsHandle handle; |
---|
| 543 | |
---|
| 544 | YYTRACE("port_ref_list: port_ref_list ',' port_reference"); |
---|
| 545 | lsNewEnd($1, (lsGeneric)$3, &handle); |
---|
| 546 | $$ = $1; |
---|
| 547 | } |
---|
| 548 | ; |
---|
| 549 | |
---|
| 550 | port_reference |
---|
| 551 | : YYIDE |
---|
| 552 | { |
---|
| 553 | $<idrng>$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range)); |
---|
| 554 | } |
---|
| 555 | port_reference_arg |
---|
| 556 | { |
---|
| 557 | YYTRACE("port_reference: YYIDE port_reference_arg"); |
---|
| 558 | $$ = vl_create_id_range($<idrng>2->name, $3); |
---|
| 559 | } |
---|
| 560 | ; |
---|
| 561 | |
---|
| 562 | port_reference_arg |
---|
| 563 | : |
---|
| 564 | { |
---|
| 565 | YYTRACE("port_reference_arg:"); |
---|
| 566 | $$ = vl_create_range(NIL(vl_expr), NIL(vl_expr)); |
---|
| 567 | } |
---|
| 568 | | '[' expression ']' |
---|
| 569 | { |
---|
| 570 | YYTRACE("port_reference_arg: '[' expression ']'"); |
---|
| 571 | $$ = vl_create_range($2, NIL(vl_expr)); |
---|
| 572 | } |
---|
| 573 | | '[' expression ':' expression ']' |
---|
| 574 | { |
---|
| 575 | YYTRACE("port_reference_arg: '[' expression ':' expression ']'"); |
---|
| 576 | $$ = vl_create_range($2, $4); |
---|
| 577 | } |
---|
| 578 | ; |
---|
| 579 | |
---|
| 580 | module_item_clr |
---|
| 581 | : |
---|
| 582 | { |
---|
| 583 | YYTRACE("module_item_clr:"); |
---|
| 584 | $$ = lsCreate(); |
---|
| 585 | } |
---|
| 586 | | module_item_clr module_item |
---|
| 587 | { |
---|
| 588 | lsHandle handle; |
---|
| 589 | int decomposed_assign = 0; |
---|
| 590 | lsHandle assignHandle; |
---|
| 591 | lsGen assignGen; |
---|
| 592 | vl_cont_assign *cont_assign, *new_cont_assign; |
---|
| 593 | lsList new_assigns; |
---|
| 594 | vl_bassign_stmt *assign; |
---|
| 595 | |
---|
| 596 | YYTRACE("module_item_clr: module_item_clr module_item"); |
---|
| 597 | if (((vl_decl*)$2)->type == ContAssign) |
---|
| 598 | if (lsLength(((vl_cont_assign*)$2)->assigns) > 1) { |
---|
| 599 | decomposed_assign = 1; |
---|
| 600 | cont_assign = (vl_cont_assign*)$2; |
---|
| 601 | for (assignGen=lsStart(((vl_cont_assign*)$2)->assigns); |
---|
| 602 | lsNext(assignGen,(lsGeneric*)&assign,&assignHandle) |
---|
| 603 | != LS_NOMORE; ) { |
---|
| 604 | new_assigns = lsCreate(); |
---|
| 605 | lsNewEnd(new_assigns, (lsGeneric)assign, 0); |
---|
| 606 | new_cont_assign = |
---|
| 607 | vl_create_cont_assign_stmt(cont_assign->strength, |
---|
| 608 | cont_assign->delay, |
---|
| 609 | new_assigns); |
---|
| 610 | lsNewEnd($1, (lsGeneric)new_cont_assign, 0); |
---|
| 611 | } |
---|
| 612 | lsFinish(assignGen); |
---|
| 613 | lsDestroy(cont_assign->assigns, 0); |
---|
| 614 | vl_chk_free((char*)$2); |
---|
| 615 | } |
---|
| 616 | if (!decomposed_assign) |
---|
| 617 | lsNewEnd($1, (lsGeneric)$2, &handle); |
---|
| 618 | $$ = $1; |
---|
| 619 | } |
---|
| 620 | ; |
---|
| 621 | |
---|
| 622 | module_item |
---|
| 623 | : parameter_declaration |
---|
| 624 | { |
---|
| 625 | YYTRACE("module_item: parameter_declaration"); |
---|
| 626 | $$ = (typestructPtr)$1; |
---|
| 627 | } |
---|
| 628 | | input_declaration |
---|
| 629 | { |
---|
| 630 | YYTRACE("module_item: input_declaration"); |
---|
| 631 | $$ = (typestructPtr)$1; |
---|
| 632 | } |
---|
| 633 | | output_declaration |
---|
| 634 | { |
---|
| 635 | YYTRACE("module_item: output_declaration"); |
---|
| 636 | $$ = (typestructPtr)$1; |
---|
| 637 | } |
---|
| 638 | | inout_declaration |
---|
| 639 | { |
---|
| 640 | YYTRACE("module_item: inout_declaration"); |
---|
| 641 | $$ = (typestructPtr)$1; |
---|
| 642 | } |
---|
| 643 | | net_declaration |
---|
| 644 | { |
---|
| 645 | YYTRACE("module_item: net_declaration"); |
---|
| 646 | $$ = (typestructPtr)$1; |
---|
| 647 | } |
---|
| 648 | | reg_declaration |
---|
| 649 | { |
---|
| 650 | YYTRACE("module_item: reg_declaration"); |
---|
| 651 | $$ = (typestructPtr)$1; |
---|
| 652 | } |
---|
| 653 | | time_declaration |
---|
| 654 | { |
---|
| 655 | YYTRACE("module_item: time_declaration"); |
---|
| 656 | $$ = (typestructPtr)$1; |
---|
| 657 | } |
---|
| 658 | | integer_declaration |
---|
| 659 | { |
---|
| 660 | YYTRACE("module_item: integer_declaration"); |
---|
| 661 | $$ = (typestructPtr)$1; |
---|
| 662 | } |
---|
| 663 | | real_declaration |
---|
| 664 | { |
---|
| 665 | YYTRACE("module_item: real_declaration"); |
---|
| 666 | $$ = (typestructPtr)$1; |
---|
| 667 | } |
---|
| 668 | | event_declaration |
---|
| 669 | { |
---|
| 670 | YYTRACE("module_item: event_declaration"); |
---|
| 671 | $$ = (typestructPtr)$1; |
---|
| 672 | } |
---|
| 673 | | gate_instantiation |
---|
| 674 | { |
---|
| 675 | YYTRACE("module_item: gate_instantiation"); |
---|
| 676 | $$ = (typestructPtr)$1; |
---|
| 677 | } |
---|
| 678 | | module_or_primitive_instantiation |
---|
| 679 | { |
---|
| 680 | YYTRACE("module_item: module_or_primitive_instantiation"); |
---|
| 681 | $$ = (typestructPtr)$1; |
---|
| 682 | } |
---|
| 683 | | parameter_override |
---|
| 684 | { |
---|
| 685 | YYTRACE("module_item: parameter_override"); |
---|
| 686 | $$ = (typestructPtr)$1; |
---|
| 687 | } |
---|
| 688 | | continuous_assign |
---|
| 689 | { |
---|
| 690 | YYTRACE("module_item: continous_assign"); |
---|
| 691 | $$ = (typestructPtr)$1; |
---|
| 692 | } |
---|
| 693 | | specify_block |
---|
| 694 | { |
---|
| 695 | YYTRACE("module_item: specify_block"); |
---|
| 696 | $$ = $<type>1; |
---|
| 697 | } |
---|
| 698 | | initial_statement |
---|
| 699 | { |
---|
| 700 | YYTRACE("module_item: initial_statement"); |
---|
| 701 | $$ = (typestructPtr)$1; |
---|
| 702 | } |
---|
| 703 | | always_statement |
---|
| 704 | { |
---|
| 705 | YYTRACE("module_item: always_statement"); |
---|
| 706 | $$ = (typestructPtr)$1; |
---|
| 707 | } |
---|
| 708 | | task |
---|
| 709 | { |
---|
| 710 | YYTRACE("module_item: task"); |
---|
| 711 | $$ = (typestructPtr)$1; |
---|
| 712 | } |
---|
| 713 | | function |
---|
| 714 | { |
---|
| 715 | YYTRACE("module_item: function"); |
---|
| 716 | $$ = (typestructPtr)$1; |
---|
| 717 | } |
---|
| 718 | ; |
---|
| 719 | |
---|
| 720 | primitive |
---|
| 721 | : YYPRIMITIVE YYIDE |
---|
| 722 | { |
---|
| 723 | vl_id_rangePtr idptr; |
---|
| 724 | |
---|
| 725 | idptr = vl_create_id_range(vlStrdup(yyid), NIL(vl_range)); |
---|
| 726 | vl_currentPrimitive = vl_create_primitive(idptr, |
---|
| 727 | LS_NIL, |
---|
| 728 | LS_NIL, |
---|
| 729 | LS_NIL); |
---|
| 730 | set_eliminate(idptr->name, mod_list->mp_undefined); |
---|
| 731 | } |
---|
| 732 | '(' port_list ')' ';' |
---|
| 733 | primitive_declaration_eclr |
---|
| 734 | table_definition |
---|
| 735 | YYENDPRIMITIVE |
---|
| 736 | { |
---|
| 737 | YYTRACE("primitive: YYPRMITIVE YYIDE '(' variable_list ')' ';' primitive_declaration_eclr table_definition YYENDPRIMITIVE"); |
---|
| 738 | vl_currentPrimitive->ports = $5; |
---|
| 739 | vl_currentPrimitive->decls = $8; |
---|
| 740 | vl_currentPrimitive->entries = $9; |
---|
| 741 | $$ = vl_currentPrimitive; |
---|
| 742 | vl_currentPrimitive = NIL(vl_primitive); |
---|
| 743 | } |
---|
| 744 | ; |
---|
| 745 | |
---|
| 746 | primitive_declaration_eclr |
---|
| 747 | : primitive_declaration |
---|
| 748 | { |
---|
| 749 | lsHandle handle; |
---|
| 750 | |
---|
| 751 | YYTRACE("primitive_declaration_eclr: primitive_declaration"); |
---|
| 752 | $$ = lsCreate(); |
---|
| 753 | lsNewEnd($$, (lsGeneric)$1, &handle); |
---|
| 754 | } |
---|
| 755 | | primitive_declaration_eclr primitive_declaration |
---|
| 756 | { |
---|
| 757 | lsHandle handle; |
---|
| 758 | |
---|
| 759 | YYTRACE("primitive_declaration_eclr: primitive_declaration_eclr primitive_declaration"); |
---|
| 760 | lsNewEnd($1, (lsGeneric)$2, &handle); |
---|
| 761 | $$ = $1; |
---|
| 762 | } |
---|
| 763 | ; |
---|
| 764 | |
---|
| 765 | primitive_declaration |
---|
| 766 | : output_declaration |
---|
| 767 | { |
---|
| 768 | YYTRACE("primitive_declaration: output_declaration"); |
---|
| 769 | $$ = (typestructPtr)$1; |
---|
| 770 | } |
---|
| 771 | | reg_declaration |
---|
| 772 | { |
---|
| 773 | YYTRACE("primitive_decalration: reg_declaration"); |
---|
| 774 | $$ = (typestructPtr)$1; |
---|
| 775 | } |
---|
| 776 | | input_declaration |
---|
| 777 | { |
---|
| 778 | YYTRACE("primitive_decalration: input_declaration"); |
---|
| 779 | $$ = (typestructPtr)$1; |
---|
| 780 | } |
---|
| 781 | ; |
---|
| 782 | |
---|
| 783 | table_definition |
---|
| 784 | : YYTABLE table_entries YYENDTABLE |
---|
| 785 | { |
---|
| 786 | YYTRACE("table_definition: YYTABLE table_entries YYENDTABLE"); |
---|
| 787 | $$ = $2; |
---|
| 788 | } |
---|
| 789 | ; |
---|
| 790 | |
---|
| 791 | table_entries |
---|
| 792 | : combinational_entry_eclr |
---|
| 793 | { |
---|
| 794 | YYTRACE("table_definition: combinational_entry_eclr"); |
---|
| 795 | vl_currentPrimitive->type = CombPrimDecl; |
---|
| 796 | } |
---|
| 797 | | sequential_entry_eclr |
---|
| 798 | { |
---|
| 799 | YYTRACE("table_definition: sequential_entry_eclr"); |
---|
| 800 | vl_currentPrimitive->type = SeqPrimDecl; |
---|
| 801 | } |
---|
| 802 | ; |
---|
| 803 | |
---|
| 804 | combinational_entry_eclr |
---|
| 805 | : combinational_entry |
---|
| 806 | { |
---|
| 807 | YYTRACE("combinational_entry_eclr: combinational_entry"); |
---|
| 808 | $$ = lsCreate(); |
---|
| 809 | lsNewEnd($$, (lsGeneric)$1, LS_NH); |
---|
| 810 | } |
---|
| 811 | | combinational_entry_eclr combinational_entry |
---|
| 812 | { |
---|
| 813 | YYTRACE("combinational_entry_eclr: combinational_entry_eclr combinational_entry"); |
---|
| 814 | lsNewEnd($1, (lsGeneric)$2, LS_NH); |
---|
| 815 | $$ = $1; |
---|
| 816 | } |
---|
| 817 | ; |
---|
| 818 | |
---|
| 819 | combinational_entry |
---|
| 820 | : input_list ':' output_symbol ';' |
---|
| 821 | { |
---|
| 822 | YYTRACE("combinational_entry: input_list ':' output_symbol ';'"); |
---|
| 823 | $$ = vl_create_prim_entry($1, PrimNone, $3); |
---|
| 824 | } |
---|
| 825 | ; |
---|
| 826 | |
---|
| 827 | sequential_entry_eclr |
---|
| 828 | : sequential_entry |
---|
| 829 | { |
---|
| 830 | YYTRACE("sequential_entry_eclr: sequential_entry"); |
---|
| 831 | $$ = lsCreate(); |
---|
| 832 | lsNewEnd($$, (lsGeneric)$1, LS_NH); |
---|
| 833 | } |
---|
| 834 | | sequential_entry_eclr sequential_entry |
---|
| 835 | { |
---|
| 836 | YYTRACE("sequential_entry_eclr: sequential_entry_eclr sequential_entry"); |
---|
| 837 | lsNewEnd($1, (lsGeneric)$2, LS_NH); |
---|
| 838 | $$ = $1; |
---|
| 839 | } |
---|
| 840 | ; |
---|
| 841 | |
---|
| 842 | sequential_entry |
---|
| 843 | : input_list ':' state ':' next_state ';' |
---|
| 844 | { |
---|
| 845 | YYTRACE("sequential_entry: input_list ':' state ':' next_state ';'"); |
---|
| 846 | $$ = vl_create_prim_entry($1, $3, $5); |
---|
| 847 | } |
---|
| 848 | ; |
---|
| 849 | |
---|
| 850 | input_list |
---|
| 851 | : level_symbol_or_edge_eclr |
---|
| 852 | { |
---|
| 853 | YYTRACE("input_list: level_symbol_or_edge_eclr"); |
---|
| 854 | } |
---|
| 855 | ; |
---|
| 856 | |
---|
| 857 | level_symbol_or_edge_eclr |
---|
| 858 | : level_symbol_or_edge |
---|
| 859 | { |
---|
| 860 | YYTRACE("level_symbol_or_edge_eclr: level_symbol_or_edge"); |
---|
| 861 | $$ = lsCreate(); |
---|
| 862 | lsNewEnd($$, (lsGeneric)$1, LS_NH); |
---|
| 863 | } |
---|
| 864 | | level_symbol_or_edge_eclr level_symbol_or_edge |
---|
| 865 | { |
---|
| 866 | YYTRACE("level_symbol_or_edge_eclr: level_symbol_or_edge_eclr level_symbol_or_edge"); |
---|
| 867 | lsNewEnd($1, (lsGeneric)$2, LS_NH); |
---|
| 868 | $$ = $1; |
---|
| 869 | } |
---|
| 870 | ; |
---|
| 871 | |
---|
| 872 | level_symbol_or_edge |
---|
| 873 | : level_symbol |
---|
| 874 | { |
---|
| 875 | YYTRACE("level_symbol_or_edge: level_symbol"); |
---|
| 876 | } |
---|
| 877 | | edge |
---|
| 878 | { |
---|
| 879 | YYTRACE("level_symbol_or_edge: edge"); |
---|
| 880 | } |
---|
| 881 | ; |
---|
| 882 | |
---|
| 883 | edge |
---|
| 884 | : '(' level_symbol level_symbol ')' |
---|
| 885 | { |
---|
| 886 | YYTRACE("edge: '(' level_symbol level_symbol ')'"); |
---|
| 887 | switch ($2) { |
---|
| 888 | case Prim0: $$ = ($3==PrimX) ? Prim0X : PrimR; break; |
---|
| 889 | case Prim1: $$ = ($3==PrimX) ? Prim1X : PrimF; break; |
---|
| 890 | case PrimX: |
---|
| 891 | $$ = ($3==Prim1) ? PrimX1 : ($3==Prim0) ? PrimX0 : PrimXB; |
---|
| 892 | break; |
---|
| 893 | case PrimB: $$ = ($3==PrimX) ? PrimBX : PrimBB; break; |
---|
| 894 | case PrimQ: |
---|
| 895 | $$ = ($3==Prim1) ? PrimQ1 : ($3==Prim0) ? PrimQ0 : PrimQB; |
---|
| 896 | break; |
---|
| 897 | default: { |
---|
| 898 | char mesg[MAXSTRLEN]; |
---|
| 899 | |
---|
| 900 | sprintf(mesg, "Unknown edge symbol (%d,%d)", $2, $3); |
---|
| 901 | compile_error(mesg); |
---|
| 902 | } |
---|
| 903 | } |
---|
| 904 | } |
---|
| 905 | | edge_symbol |
---|
| 906 | { |
---|
| 907 | YYTRACE("edge: edge_symbol"); |
---|
| 908 | } |
---|
| 909 | ; |
---|
| 910 | |
---|
| 911 | state |
---|
| 912 | : level_symbol |
---|
| 913 | { |
---|
| 914 | YYTRACE("state: level_symbol"); |
---|
| 915 | } |
---|
| 916 | ; |
---|
| 917 | |
---|
| 918 | next_state |
---|
| 919 | : output_symbol |
---|
| 920 | { |
---|
| 921 | YYTRACE("next_state: output_symbol"); |
---|
| 922 | } |
---|
| 923 | | '-' |
---|
| 924 | { |
---|
| 925 | YYTRACE("next_state: '_'"); |
---|
| 926 | $$ = PrimM; |
---|
| 927 | } |
---|
| 928 | ; |
---|
| 929 | |
---|
| 930 | output_symbol |
---|
| 931 | : '0' |
---|
| 932 | { |
---|
| 933 | YYTRACE("output_symbol: '0'"); |
---|
| 934 | $$ = Prim0; |
---|
| 935 | } |
---|
| 936 | | '1' |
---|
| 937 | { |
---|
| 938 | YYTRACE("output_symbol: '1'"); |
---|
| 939 | $$ = Prim1; |
---|
| 940 | } |
---|
| 941 | | 'x' |
---|
| 942 | { |
---|
| 943 | YYTRACE("output_symbol: 'x'"); |
---|
| 944 | $$ = PrimX; |
---|
| 945 | } |
---|
| 946 | | 'X' |
---|
| 947 | { |
---|
| 948 | YYTRACE("output_symbol: 'X'"); |
---|
| 949 | $$ = PrimX; |
---|
| 950 | } |
---|
| 951 | ; |
---|
| 952 | |
---|
| 953 | level_symbol |
---|
| 954 | : '0' |
---|
| 955 | { |
---|
| 956 | YYTRACE("level_symbol: '0'"); |
---|
| 957 | $$ = Prim0; |
---|
| 958 | } |
---|
| 959 | | '1' |
---|
| 960 | { |
---|
| 961 | YYTRACE("level_symbol: '1'"); |
---|
| 962 | $$ = Prim1; |
---|
| 963 | } |
---|
| 964 | | 'x' |
---|
| 965 | { |
---|
| 966 | YYTRACE("level_symbol: 'x'"); |
---|
| 967 | $$ = PrimX; |
---|
| 968 | } |
---|
| 969 | | 'X' |
---|
| 970 | { |
---|
| 971 | YYTRACE("level_symbol: 'X'"); |
---|
| 972 | $$ = PrimX; |
---|
| 973 | } |
---|
| 974 | | '?' |
---|
| 975 | { |
---|
| 976 | YYTRACE("level_symbol: '?'"); |
---|
| 977 | $$ = PrimQ; |
---|
| 978 | } |
---|
| 979 | | 'b' |
---|
| 980 | { |
---|
| 981 | YYTRACE("level_symbol: 'b'"); |
---|
| 982 | $$ = PrimB; |
---|
| 983 | } |
---|
| 984 | | 'B' |
---|
| 985 | { |
---|
| 986 | YYTRACE("level_symbol: 'B'"); |
---|
| 987 | $$ = PrimB; |
---|
| 988 | } |
---|
| 989 | ; |
---|
| 990 | |
---|
| 991 | edge_symbol |
---|
| 992 | : 'r' |
---|
| 993 | { |
---|
| 994 | YYTRACE("edge_symbol: 'r'"); |
---|
| 995 | $$ = PrimR; |
---|
| 996 | } |
---|
| 997 | | 'R' |
---|
| 998 | { |
---|
| 999 | YYTRACE("edge_symbol: 'R'"); |
---|
| 1000 | $$ = PrimR; |
---|
| 1001 | } |
---|
| 1002 | | 'f' |
---|
| 1003 | { |
---|
| 1004 | YYTRACE("edge_symbol: 'f'"); |
---|
| 1005 | $$ = PrimF; |
---|
| 1006 | } |
---|
| 1007 | | 'F' |
---|
| 1008 | { |
---|
| 1009 | YYTRACE("edge_symbol: 'F'"); |
---|
| 1010 | $$ = PrimF; |
---|
| 1011 | } |
---|
| 1012 | | 'p' |
---|
| 1013 | { |
---|
| 1014 | YYTRACE("edge_symbol: 'p'"); |
---|
| 1015 | $$ = PrimP; |
---|
| 1016 | } |
---|
| 1017 | | 'P' |
---|
| 1018 | { |
---|
| 1019 | YYTRACE("edge_symbol: 'P'"); |
---|
| 1020 | $$ = PrimP; |
---|
| 1021 | } |
---|
| 1022 | | 'n' |
---|
| 1023 | { |
---|
| 1024 | YYTRACE("edge_symbol: 'n'"); |
---|
| 1025 | $$ = PrimN; |
---|
| 1026 | } |
---|
| 1027 | | 'N' |
---|
| 1028 | { |
---|
| 1029 | YYTRACE("edge_symbol: 'N'"); |
---|
| 1030 | $$ = PrimN; |
---|
| 1031 | } |
---|
| 1032 | | '*' |
---|
| 1033 | { |
---|
| 1034 | YYTRACE("edge_symbol: '*'"); |
---|
| 1035 | $$ = PrimS; |
---|
| 1036 | } |
---|
| 1037 | ; |
---|
| 1038 | |
---|
| 1039 | task |
---|
| 1040 | : YYTASK YYIDE |
---|
| 1041 | { |
---|
| 1042 | $<idrng>$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range)); |
---|
| 1043 | task_mode = 1; |
---|
| 1044 | } |
---|
| 1045 | ';' tf_declaration_clr statement_opt |
---|
| 1046 | YYENDTASK |
---|
| 1047 | { |
---|
| 1048 | YYTRACE("YYTASK YYIDE ';' tf_declaration_clr statement_opt YYENDTASK"); |
---|
| 1049 | $$ = vl_create_task($<idrng>3, $5, $6); |
---|
| 1050 | task_mode = 0; |
---|
| 1051 | } |
---|
| 1052 | ; |
---|
| 1053 | |
---|
| 1054 | function |
---|
| 1055 | : YYFUNCTION range_or_type_opt YYIDE |
---|
| 1056 | { |
---|
| 1057 | int bad_type=0; |
---|
| 1058 | |
---|
| 1059 | $<idrng>$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range)); |
---|
| 1060 | |
---|
| 1061 | if (!$2) { |
---|
| 1062 | |
---|
| 1063 | vl_expr *zero; |
---|
| 1064 | zero = vl_create_expr(IntExpr, 0, (double)0.0, |
---|
| 1065 | NIL(void), NIL(void), NIL(void)); |
---|
| 1066 | $2 = vl_create_range_or_type(Range_Dcl, |
---|
| 1067 | vl_create_range(zero,zero)); |
---|
| 1068 | } else if (!$2->range) { |
---|
| 1069 | bad_type = 1; |
---|
| 1070 | } |
---|
| 1071 | |
---|
| 1072 | if (bad_type) { |
---|
| 1073 | char buf[MAXSTRLEN]; |
---|
| 1074 | sprintf(buf, "bit width of function '%s' is not known",yyid); |
---|
| 1075 | compile_error(buf); |
---|
| 1076 | } |
---|
| 1077 | |
---|
| 1078 | vl_currentFunction = vl_create_function(0, $2->range, $<idrng>$, |
---|
| 1079 | lsCreate(), lsCreate()); |
---|
| 1080 | vl_currentModule = (vl_module*)vl_currentFunction; |
---|
| 1081 | push_stack(vl_module_stack, vl_currentModule); |
---|
| 1082 | } |
---|
| 1083 | ';' tf_declaration_eclr statement_opt |
---|
| 1084 | YYENDFUNCTION |
---|
| 1085 | { |
---|
| 1086 | vl_id_range *func_out; |
---|
| 1087 | short func_type=0; |
---|
| 1088 | lsList out_ids; |
---|
| 1089 | |
---|
| 1090 | YYTRACE("YYFUNCTION range_or_type_opt YYIDE ';' tf_declaration_eclr statement_opt YYENDFUNCTION"); |
---|
| 1091 | if ($2 == NIL(vl_range_or_type)) { |
---|
| 1092 | func_type = IntFuncDecl; |
---|
| 1093 | } else { |
---|
| 1094 | switch ($2->type) { |
---|
| 1095 | case Range_Dcl: func_type = RangeFuncDecl; break; |
---|
| 1096 | case Integer_Dcl: func_type = IntFuncDecl; break; |
---|
| 1097 | case Real_Dcl: func_type = RealFuncDecl; break; |
---|
| 1098 | default: internal_error("unknown function type"); |
---|
| 1099 | } |
---|
| 1100 | } |
---|
| 1101 | |
---|
| 1102 | func_out = vl_create_id_range($<idrng>4->name, NIL(vl_range)); |
---|
| 1103 | func_out->flags |= OutPort; |
---|
| 1104 | out_ids = lsCreate(); |
---|
| 1105 | lsNewEnd(out_ids, (lsGeneric)func_out, 0); |
---|
| 1106 | if ($2->type == Range_Dcl) |
---|
| 1107 | lsNewEnd($6, (lsGeneric)vl_create_rangedecl(NIL(vl_type), |
---|
| 1108 | RegDecl, |
---|
| 1109 | $2->range, |
---|
| 1110 | out_ids, 0), |
---|
| 1111 | 0); |
---|
| 1112 | else |
---|
| 1113 | lsNewEnd($6, (lsGeneric)vl_create_rangedecl(NIL(vl_type), |
---|
| 1114 | RegDecl, |
---|
| 1115 | NIL(vl_range), |
---|
| 1116 | out_ids, 0), |
---|
| 1117 | 0); |
---|
| 1118 | |
---|
| 1119 | ((vl_function*)vl_currentModule)->type = func_type; |
---|
| 1120 | ((vl_function*)vl_currentModule)->decls = $6; |
---|
| 1121 | ((vl_function*)vl_currentModule)->stmts = $7; |
---|
| 1122 | $$ = (vl_function*)vl_currentModule; |
---|
| 1123 | (void*)pop_stack(vl_module_stack, (void**)&vl_currentModule); |
---|
| 1124 | vl_currentModule = (vl_module*)(void*)top_stack(vl_module_stack); |
---|
| 1125 | lsNewBegin($$->ports, (lsGeneric)func_out, 0); |
---|
| 1126 | vl_currentFunction = NIL(vl_function); |
---|
| 1127 | assert(vl_currentModule != NIL(vl_module)); |
---|
| 1128 | } |
---|
| 1129 | ; |
---|
| 1130 | |
---|
| 1131 | range_or_type_opt |
---|
| 1132 | : |
---|
| 1133 | { |
---|
| 1134 | YYTRACE("range_or_type_opt:"); |
---|
| 1135 | $$ = NIL(vl_range_or_type); |
---|
| 1136 | } |
---|
| 1137 | | range_or_type |
---|
| 1138 | { |
---|
| 1139 | YYTRACE("range_or_type_opt: range_or_type"); |
---|
| 1140 | $$ = $1; |
---|
| 1141 | } |
---|
| 1142 | ; |
---|
| 1143 | |
---|
| 1144 | range_or_type |
---|
| 1145 | : range |
---|
| 1146 | { |
---|
| 1147 | YYTRACE("range_or_type: range"); |
---|
| 1148 | $$ = vl_create_range_or_type(Range_Dcl, $1); |
---|
| 1149 | } |
---|
| 1150 | | YYINTEGER |
---|
| 1151 | { |
---|
| 1152 | YYTRACE("range_or_type: YYINTEGER"); |
---|
| 1153 | $$ = vl_create_range_or_type(Integer_Dcl, NIL(vl_range)); |
---|
| 1154 | } |
---|
| 1155 | | YYREAL |
---|
| 1156 | { |
---|
| 1157 | YYTRACE("range_or_type: YYREAL"); |
---|
| 1158 | $$ = vl_create_range_or_type(Real_Dcl, NIL(vl_range)); |
---|
| 1159 | } |
---|
| 1160 | ; |
---|
| 1161 | |
---|
| 1162 | tf_declaration_clr |
---|
| 1163 | : |
---|
| 1164 | { |
---|
| 1165 | YYTRACE("tf_declaration_clr:"); |
---|
| 1166 | $$ = lsCreate(); |
---|
| 1167 | } |
---|
| 1168 | | tf_declaration_clr tf_declaration |
---|
| 1169 | { |
---|
| 1170 | lsHandle handle; |
---|
| 1171 | |
---|
| 1172 | YYTRACE("tf_declaration_clr: tf_declaration_clr tf_declaration"); |
---|
| 1173 | lsNewEnd($1, (lsGeneric)$2, &handle); |
---|
| 1174 | $$ = $1; |
---|
| 1175 | } |
---|
| 1176 | ; |
---|
| 1177 | |
---|
| 1178 | tf_declaration_eclr |
---|
| 1179 | : tf_declaration |
---|
| 1180 | { |
---|
| 1181 | lsHandle handle; |
---|
| 1182 | |
---|
| 1183 | YYTRACE("tf_declaration_eclr: tf_declaration"); |
---|
| 1184 | $$ = lsCreate(); |
---|
| 1185 | lsNewEnd($$, (lsGeneric)$1, &handle); |
---|
| 1186 | } |
---|
| 1187 | | tf_declaration_eclr tf_declaration |
---|
| 1188 | { |
---|
| 1189 | lsHandle handle; |
---|
| 1190 | |
---|
| 1191 | YYTRACE("tf_declaration_eclr: tf_decalration_eclr tf_declaration"); |
---|
| 1192 | lsNewEnd($1, (lsGeneric)$2, &handle); |
---|
| 1193 | $$ = $1; |
---|
| 1194 | } |
---|
| 1195 | ; |
---|
| 1196 | |
---|
| 1197 | tf_declaration |
---|
| 1198 | : parameter_declaration |
---|
| 1199 | { |
---|
| 1200 | YYTRACE("tf_declaration: parameter_decalration"); |
---|
| 1201 | $$ = (typestructPtr)$1; |
---|
| 1202 | } |
---|
| 1203 | | input_declaration |
---|
| 1204 | { |
---|
| 1205 | YYTRACE("tf_declaration: input_declaration"); |
---|
| 1206 | $$ = (typestructPtr)$1; |
---|
| 1207 | } |
---|
| 1208 | | output_declaration |
---|
| 1209 | { |
---|
| 1210 | YYTRACE("tf_declaration: output_declaration"); |
---|
| 1211 | $$ = (typestructPtr)$1; |
---|
| 1212 | } |
---|
| 1213 | | inout_declaration |
---|
| 1214 | { |
---|
| 1215 | YYTRACE("tf_declaration: inout_declaration"); |
---|
| 1216 | $$ = (typestructPtr)$1; |
---|
| 1217 | } |
---|
| 1218 | | reg_declaration |
---|
| 1219 | { |
---|
| 1220 | YYTRACE("tf_declaration: reg_declaration"); |
---|
| 1221 | $$ = (typestructPtr)$1; |
---|
| 1222 | } |
---|
| 1223 | | time_declaration |
---|
| 1224 | { |
---|
| 1225 | YYTRACE("tf_declaration: time_declaration"); |
---|
| 1226 | $$ = (typestructPtr)$1; |
---|
| 1227 | } |
---|
| 1228 | | integer_declaration |
---|
| 1229 | { |
---|
| 1230 | YYTRACE("tf_declaration: integer_declaration"); |
---|
| 1231 | $$ = (typestructPtr)$1; |
---|
| 1232 | } |
---|
| 1233 | | real_declaration |
---|
| 1234 | { |
---|
| 1235 | YYTRACE("tf_declaration: real_declaration"); |
---|
| 1236 | $$ = (typestructPtr)$1; |
---|
| 1237 | } |
---|
| 1238 | | event_declaration |
---|
| 1239 | { |
---|
| 1240 | YYTRACE("tf_declaration: event_declaration"); |
---|
| 1241 | $$ = (typestructPtr)$1; |
---|
| 1242 | } |
---|
| 1243 | ; |
---|
| 1244 | |
---|
| 1245 | type_name |
---|
| 1246 | : YYIDE |
---|
| 1247 | { |
---|
| 1248 | YYTRACE("type_name: YYIDE"); |
---|
| 1249 | $$ = vlStrdup(yyid); |
---|
| 1250 | } |
---|
| 1251 | ; |
---|
| 1252 | |
---|
| 1253 | type_specifier |
---|
| 1254 | : enum_specifier |
---|
| 1255 | { |
---|
| 1256 | YYTRACE("type_specifier: enum_specifier ';'"); |
---|
| 1257 | $$ = vl_create_type_specifier(EnumType, $1); |
---|
| 1258 | } |
---|
| 1259 | ; |
---|
| 1260 | |
---|
| 1261 | enum_specifier |
---|
| 1262 | : YYENUM {enum_val=0;} enum_name enum_lst_opt |
---|
| 1263 | { |
---|
| 1264 | YYTRACE("enum_specifier: YYENUM enum_name enum_lst_opt"); |
---|
| 1265 | $$ = vl_create_enum_type($3, $4); |
---|
| 1266 | } |
---|
| 1267 | | YYENUM {enum_val=0;} '{' enumerator_list '}' |
---|
| 1268 | { |
---|
| 1269 | YYTRACE("enum_specifier: YYENUM '{' enumerator_list '}'"); |
---|
| 1270 | $$ = vl_create_enum_type(NIL(char), $4); |
---|
| 1271 | } |
---|
| 1272 | ; |
---|
| 1273 | |
---|
| 1274 | enum_name |
---|
| 1275 | : YYIDE |
---|
| 1276 | { |
---|
| 1277 | YYTRACE("enum_name: YYIDE"); |
---|
| 1278 | $$ = vlStrdup(yyid); |
---|
| 1279 | } |
---|
| 1280 | ; |
---|
| 1281 | |
---|
| 1282 | enum_lst_opt |
---|
| 1283 | : '{' enumerator_list '}' |
---|
| 1284 | { |
---|
| 1285 | YYTRACE("enum_lst_opt: '{' enumerator_list '}'"); |
---|
| 1286 | $$ = $2; |
---|
| 1287 | } |
---|
| 1288 | | |
---|
| 1289 | { |
---|
| 1290 | YYTRACE("enum_lst_opt: "); |
---|
| 1291 | $$ = (lsList)0; |
---|
| 1292 | } |
---|
| 1293 | ; |
---|
| 1294 | |
---|
| 1295 | enumerator_list |
---|
| 1296 | : enumerator |
---|
| 1297 | { |
---|
| 1298 | YYTRACE("enumerator_list: enumerator"); |
---|
| 1299 | $$ = lsCreate(); |
---|
| 1300 | lsNewEnd($$, (lsGeneric)$1, 0); |
---|
| 1301 | } |
---|
| 1302 | | enumerator_list ',' enumerator |
---|
| 1303 | { |
---|
| 1304 | YYTRACE("enumerator_list: enumerator_list ',' enumerator"); |
---|
| 1305 | lsNewEnd($$, (lsGeneric)$3, 0); |
---|
| 1306 | } |
---|
| 1307 | ; |
---|
| 1308 | |
---|
| 1309 | enumerator |
---|
| 1310 | : YYIDE |
---|
| 1311 | { |
---|
| 1312 | YYTRACE("enumerator: YYIDE"); |
---|
| 1313 | $$ = vl_create_enumerator(vlStrdup(yyid), enum_val++); |
---|
| 1314 | } |
---|
| 1315 | | YYIDE {cp=vlStrdup(yyid);} '=' expression |
---|
| 1316 | { |
---|
| 1317 | YYTRACE("enumerator: YYIDE '=' expression"); |
---|
| 1318 | enum_val = vl_eval_expr($4); |
---|
| 1319 | $$ = vl_create_enumerator(cp, enum_val++); |
---|
| 1320 | } |
---|
| 1321 | ; |
---|
| 1322 | |
---|
| 1323 | |
---|
| 1324 | |
---|
| 1325 | type_decorator_opt |
---|
| 1326 | : YYuTYPE |
---|
| 1327 | { |
---|
| 1328 | vl_type *var_type; |
---|
| 1329 | int mustBe1; |
---|
| 1330 | |
---|
| 1331 | YYTRACE("type_decorator_opt: YYuTYPE"); |
---|
| 1332 | mustBe1 = st_lookup(mod_list->type_st, yyid, (char**)&var_type); |
---|
| 1333 | assert(mustBe1); |
---|
| 1334 | $$ = var_type; |
---|
| 1335 | } |
---|
| 1336 | | |
---|
| 1337 | { |
---|
| 1338 | YYTRACE("type_decorator_opt: "); |
---|
| 1339 | $$ = NIL(vl_type); |
---|
| 1340 | } |
---|
| 1341 | ; |
---|
| 1342 | |
---|
| 1343 | parameter_declaration |
---|
| 1344 | : YYPARAMETER assignment_list ';' |
---|
| 1345 | { |
---|
| 1346 | YYTRACE("parameter_declaration: YYPARAMETER assignment_list ';'"); |
---|
| 1347 | $$ = vl_create_paramdecl(ParamDecl, $2); |
---|
| 1348 | } |
---|
| 1349 | ; |
---|
| 1350 | |
---|
| 1351 | input_declaration |
---|
| 1352 | : YYINPUT range_opt variable_list ';' |
---|
| 1353 | { |
---|
| 1354 | YYTRACE("input_declaration: YYINPUT range_opt variable_list ';'"); |
---|
| 1355 | $$ = vl_create_rangedecl(NIL(vl_type), InputDecl, $2, $3, 0); |
---|
| 1356 | } |
---|
| 1357 | ; |
---|
| 1358 | |
---|
| 1359 | output_declaration |
---|
| 1360 | : YYOUTPUT range_opt variable_list ';' |
---|
| 1361 | { |
---|
| 1362 | YYTRACE("output_declaration: YYOUTPUT range_opt variable_list ';'"); |
---|
| 1363 | $$ = vl_create_rangedecl(NIL(vl_type), OutputDecl, $2, $3, 0); |
---|
| 1364 | } |
---|
| 1365 | ; |
---|
| 1366 | |
---|
| 1367 | inout_declaration |
---|
| 1368 | : YYINOUT range_opt variable_list ';' |
---|
| 1369 | { |
---|
| 1370 | YYTRACE("inout_declaration: YYINOUT range_opt variable_list ';'"); |
---|
| 1371 | $$ = vl_create_rangedecl(NIL(vl_type), InoutDecl, $2, $3, 0); |
---|
| 1372 | } |
---|
| 1373 | ; |
---|
| 1374 | |
---|
| 1375 | net_declaration |
---|
| 1376 | : type_decorator_opt nettype drive_strength_opt expandrange_opt delay_opt |
---|
| 1377 | assignment_list ';' |
---|
| 1378 | { |
---|
| 1379 | YYTRACE("net_declaration: type_decorator_opt nettype drive_strength_opt expandrange_opt delay_opt assignment_list ';'"); |
---|
| 1380 | $$ = vl_create_netdecl_assigned($1, $2, $3, $4, $5, $6); |
---|
| 1381 | } |
---|
| 1382 | | type_decorator_opt nettype drive_strength_opt expandrange_opt delay_opt |
---|
| 1383 | variable_list ';' |
---|
| 1384 | { |
---|
| 1385 | YYTRACE("net_declaration: type_decorator_opt nettype drive_strength_opt expandrange_opt delay_opt variable_list ';'"); |
---|
| 1386 | $$ = vl_create_netdecl($1, $2, $3, $4, $5, $6); |
---|
| 1387 | } |
---|
| 1388 | | type_decorator_opt YYTRIREG charge_strength_opt expandrange_opt delay_opt |
---|
| 1389 | variable_list ';' |
---|
| 1390 | { |
---|
| 1391 | YYTRACE("net_declaration: type_decorator_opt YYTRIREG charge_strength_opt expandrange_opt delay_opt variable_list ';'"); |
---|
| 1392 | $$ = vl_create_netdecl($1, TriregDecl, $3, $4, $5, $6); |
---|
| 1393 | } |
---|
| 1394 | ; |
---|
| 1395 | |
---|
| 1396 | |
---|
| 1397 | nettype |
---|
| 1398 | : YYSWIRE |
---|
| 1399 | { |
---|
| 1400 | YYTRACE("nettype: YYSWIRE"); |
---|
| 1401 | $$ = SWireDecl; |
---|
| 1402 | } |
---|
| 1403 | | YYWIRE |
---|
| 1404 | { |
---|
| 1405 | YYTRACE("nettype: YYWIRE"); |
---|
| 1406 | $$ = WireDecl; |
---|
| 1407 | } |
---|
| 1408 | | YYTRI |
---|
| 1409 | { |
---|
| 1410 | YYTRACE("nettype: YYTRI"); |
---|
| 1411 | $$ = TriDecl; |
---|
| 1412 | } |
---|
| 1413 | | YYTRI1 |
---|
| 1414 | { |
---|
| 1415 | YYTRACE("nettype: YYTRI1"); |
---|
| 1416 | $$ = Tri1Decl; |
---|
| 1417 | } |
---|
| 1418 | | YYSUPPLY0 |
---|
| 1419 | { |
---|
| 1420 | YYTRACE("nettype: YYSUPPLY0"); |
---|
| 1421 | $$ = Supply0Decl; |
---|
| 1422 | } |
---|
| 1423 | | YYWAND |
---|
| 1424 | { |
---|
| 1425 | YYTRACE("nettype: YYWAND"); |
---|
| 1426 | $$ = WandDecl; |
---|
| 1427 | } |
---|
| 1428 | | YYTRIAND |
---|
| 1429 | { |
---|
| 1430 | YYTRACE("nettype: YYTRIAND"); |
---|
| 1431 | $$ = TriandDecl; |
---|
| 1432 | } |
---|
| 1433 | | YYTRI0 |
---|
| 1434 | { |
---|
| 1435 | YYTRACE("nettype: YYTRI0"); |
---|
| 1436 | $$ = Tri0Decl; |
---|
| 1437 | } |
---|
| 1438 | | YYSUPPLY1 |
---|
| 1439 | { |
---|
| 1440 | YYTRACE("nettype: YYSUPPLY1"); |
---|
| 1441 | $$ = Supply1Decl; |
---|
| 1442 | } |
---|
| 1443 | | YYWOR |
---|
| 1444 | { |
---|
| 1445 | YYTRACE("nettype: YYWOR"); |
---|
| 1446 | $$ = WorDecl; |
---|
| 1447 | } |
---|
| 1448 | | YYTRIOR |
---|
| 1449 | { |
---|
| 1450 | YYTRACE("nettype: YYTRIOR"); |
---|
| 1451 | $$ = TriorDecl; |
---|
| 1452 | } |
---|
| 1453 | ; |
---|
| 1454 | |
---|
| 1455 | |
---|
| 1456 | expandrange_opt |
---|
| 1457 | : |
---|
| 1458 | { |
---|
| 1459 | YYTRACE("expandrange_opt:"); |
---|
| 1460 | $$ = NIL(vl_range); |
---|
| 1461 | } |
---|
| 1462 | | expandrange |
---|
| 1463 | { |
---|
| 1464 | YYTRACE("expandrange_opt: expandrange"); |
---|
| 1465 | $$ = $1; |
---|
| 1466 | } |
---|
| 1467 | ; |
---|
| 1468 | |
---|
| 1469 | expandrange |
---|
| 1470 | : range |
---|
| 1471 | { |
---|
| 1472 | YYTRACE("expandrange: range"); |
---|
| 1473 | } |
---|
| 1474 | | YYSCALARED range |
---|
| 1475 | { |
---|
| 1476 | YYTRACE("expandrange: YYSCALARED range"); |
---|
| 1477 | $$ = $2; |
---|
| 1478 | } |
---|
| 1479 | | YYVECTORED range |
---|
| 1480 | { |
---|
| 1481 | YYTRACE("expandrange: YYVECTORED range"); |
---|
| 1482 | $$ = $2; |
---|
| 1483 | } |
---|
| 1484 | ; |
---|
| 1485 | |
---|
| 1486 | reg_declaration |
---|
| 1487 | : type_decorator_opt YYREG range_opt register_variable_list ';' |
---|
| 1488 | { |
---|
| 1489 | YYTRACE("reg_declaration: type_decorator_opt YYREG range_opt register_variable_list ';'"); |
---|
| 1490 | $$ = vl_create_rangedecl($1, RegDecl, $3, $4, 0); |
---|
| 1491 | } |
---|
| 1492 | | type_decorator_opt YYMREG range_opt register_variable_list ';' |
---|
| 1493 | { |
---|
| 1494 | YYTRACE("reg_declaration: type_decorator_opt YYMREG range_opt register_variable_list ';'"); |
---|
| 1495 | $$ = vl_create_rangedecl($1, RegDecl, $3, $4, MVar); |
---|
| 1496 | } |
---|
| 1497 | ; |
---|
| 1498 | |
---|
| 1499 | time_declaration |
---|
| 1500 | : YYTIME register_variable_list ';' |
---|
| 1501 | { |
---|
| 1502 | YYTRACE("time_declaration: YYTIME register_variable_list ';'"); |
---|
| 1503 | $$ = vl_create_basicdecl(TimeDecl, $2); |
---|
| 1504 | } |
---|
| 1505 | ; |
---|
| 1506 | |
---|
| 1507 | integer_declaration |
---|
| 1508 | : YYINTEGER register_variable_list ';' |
---|
| 1509 | { |
---|
| 1510 | YYTRACE("integer_declaration: YYINTEGER register_variable_list ';'"); |
---|
| 1511 | $$ = vl_create_basicdecl(IntDecl, $2); |
---|
| 1512 | } |
---|
| 1513 | ; |
---|
| 1514 | |
---|
| 1515 | real_declaration |
---|
| 1516 | : YYREAL variable_list ';' |
---|
| 1517 | { |
---|
| 1518 | YYTRACE("real_declaration: YYREAL variable_list ';'"); |
---|
| 1519 | $$ = vl_create_basicdecl(RealDecl, $2); |
---|
| 1520 | } |
---|
| 1521 | ; |
---|
| 1522 | |
---|
| 1523 | event_declaration |
---|
| 1524 | : YYEVENT name_of_event_list ';' |
---|
| 1525 | { |
---|
| 1526 | YYTRACE("event_declaration: YYEVENT name_of_event_list ';'"); |
---|
| 1527 | $$ = vl_create_basicdecl(EventDecl, $2); |
---|
| 1528 | } |
---|
| 1529 | ; |
---|
| 1530 | |
---|
| 1531 | continuous_assign |
---|
| 1532 | : YYASSIGN {reserve_type_name=0; c_assign=1;} |
---|
| 1533 | drive_strength_opt delay_opt assignment_list ';' |
---|
| 1534 | { |
---|
| 1535 | YYTRACE("continuous_assign: YYASSIGN drive_strength_opt delay_opt assignment_list ';'"); |
---|
| 1536 | $$ = vl_create_cont_assign_stmt($3, $4, $5); |
---|
| 1537 | reserve_type_name=1; |
---|
| 1538 | c_assign=0; |
---|
| 1539 | } |
---|
| 1540 | ; |
---|
| 1541 | |
---|
| 1542 | parameter_override |
---|
| 1543 | : YYDEFPARAM assignment_list ';' |
---|
| 1544 | { |
---|
| 1545 | YYTRACE("parameter_override: YYDEFPARAM assign_list ';'"); |
---|
| 1546 | $$ = vl_create_paramdecl(DefparamDecl, $2); |
---|
| 1547 | } |
---|
| 1548 | ; |
---|
| 1549 | |
---|
| 1550 | variable_list |
---|
| 1551 | : identifier |
---|
| 1552 | { |
---|
| 1553 | lsHandle handle; |
---|
| 1554 | |
---|
| 1555 | YYTRACE("variable_list: identifier"); |
---|
| 1556 | $$ = lsCreate(); |
---|
| 1557 | lsNewEnd($$, (lsGeneric)$1, &handle); |
---|
| 1558 | } |
---|
| 1559 | | variable_list ',' identifier |
---|
| 1560 | { |
---|
| 1561 | lsHandle handle; |
---|
| 1562 | |
---|
| 1563 | YYTRACE("variable_list: variable_list ',' identifier"); |
---|
| 1564 | lsNewEnd($1, (lsGeneric)$3, &handle); |
---|
| 1565 | $$ = $1; |
---|
| 1566 | } |
---|
| 1567 | ; |
---|
| 1568 | |
---|
| 1569 | register_variable_list |
---|
| 1570 | : register_variable |
---|
| 1571 | { |
---|
| 1572 | lsHandle handle; |
---|
| 1573 | |
---|
| 1574 | YYTRACE("register_variable_list: register_variable"); |
---|
| 1575 | $$ = lsCreate(); |
---|
| 1576 | lsNewEnd($$, (lsGeneric)$1, &handle); |
---|
| 1577 | } |
---|
| 1578 | | register_variable_list ',' register_variable |
---|
| 1579 | { |
---|
| 1580 | lsHandle handle; |
---|
| 1581 | |
---|
| 1582 | YYTRACE("register_variable_list: register_variable_list ',' register_variable"); |
---|
| 1583 | lsNewEnd($1, (lsGeneric)$3, &handle); |
---|
| 1584 | $$ = $1; |
---|
| 1585 | } |
---|
| 1586 | ; |
---|
| 1587 | |
---|
| 1588 | register_variable |
---|
| 1589 | : name_of_register |
---|
| 1590 | { |
---|
| 1591 | YYTRACE("register_variable: name_of_register"); |
---|
| 1592 | $$ = vl_create_id_range($1, NIL(vl_range)); |
---|
| 1593 | } |
---|
| 1594 | | name_of_register '[' expression ':' expression ']' |
---|
| 1595 | { |
---|
| 1596 | int lo, hi; |
---|
| 1597 | |
---|
| 1598 | YYTRACE("register_variable: name_of_register '[' expression ':' expression ']'"); |
---|
| 1599 | lo = vl_eval_expr($3); |
---|
| 1600 | hi = vl_eval_expr($5); |
---|
| 1601 | if (lo > hi) |
---|
| 1602 | $$ = vl_create_id_range($1, vl_create_range($5, $3)); |
---|
| 1603 | else |
---|
| 1604 | $$ = vl_create_id_range($1, vl_create_range($3, $5)); |
---|
| 1605 | } |
---|
| 1606 | ; |
---|
| 1607 | |
---|
| 1608 | name_of_register |
---|
| 1609 | : YYIDE |
---|
| 1610 | { |
---|
| 1611 | YYTRACE("name_of_register: YYIDE"); |
---|
| 1612 | $$ = vlStrdup(yyid); |
---|
| 1613 | } |
---|
| 1614 | ; |
---|
| 1615 | |
---|
| 1616 | name_of_event_list |
---|
| 1617 | : name_of_event |
---|
| 1618 | { |
---|
| 1619 | lsHandle handle; |
---|
| 1620 | |
---|
| 1621 | YYTRACE("name_of_event_list: name_of_event"); |
---|
| 1622 | $$ = lsCreate(); |
---|
| 1623 | lsNewEnd($$, (lsGeneric)$1, &handle); |
---|
| 1624 | } |
---|
| 1625 | | name_of_event_list ',' name_of_event |
---|
| 1626 | { |
---|
| 1627 | lsHandle handle; |
---|
| 1628 | |
---|
| 1629 | YYTRACE("name_of_event_list: name_of_event_list ',' name_of_event"); |
---|
| 1630 | lsNewEnd($1, (lsGeneric)$3, &handle); |
---|
| 1631 | $$ = $1; |
---|
| 1632 | } |
---|
| 1633 | ; |
---|
| 1634 | |
---|
| 1635 | name_of_event |
---|
| 1636 | : YYIDE |
---|
| 1637 | { |
---|
| 1638 | YYTRACE("name_of_event: YYIDE"); |
---|
| 1639 | $$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range)); |
---|
| 1640 | } |
---|
| 1641 | ; |
---|
| 1642 | |
---|
| 1643 | charge_strength_opt |
---|
| 1644 | : |
---|
| 1645 | { |
---|
| 1646 | YYTRACE("charge_strength_opt:"); |
---|
| 1647 | $$ = 0; |
---|
| 1648 | } |
---|
| 1649 | | charge_strength |
---|
| 1650 | { |
---|
| 1651 | YYTRACE("charge_strength_opt: charge_strength"); |
---|
| 1652 | } |
---|
| 1653 | ; |
---|
| 1654 | |
---|
| 1655 | charge_strength |
---|
| 1656 | : '(' YYSMALL ')' |
---|
| 1657 | { |
---|
| 1658 | YYTRACE("charge_strength: '(' YYSMALL ')'"); |
---|
| 1659 | $$ = Small; |
---|
| 1660 | } |
---|
| 1661 | | '(' YYMEDIUM ')' |
---|
| 1662 | { |
---|
| 1663 | YYTRACE("charge_strength: '(' YYMEDIUM ')'"); |
---|
| 1664 | $$ = Medium; |
---|
| 1665 | } |
---|
| 1666 | | '(' YYLARGE ')' |
---|
| 1667 | { |
---|
| 1668 | YYTRACE("charge_strength: '(' YYLARGE ')'"); |
---|
| 1669 | $$ = Large; |
---|
| 1670 | } |
---|
| 1671 | ; |
---|
| 1672 | |
---|
| 1673 | drive_strength_opt |
---|
| 1674 | : |
---|
| 1675 | { |
---|
| 1676 | YYTRACE("drive_strength_opt:"); |
---|
| 1677 | $$ = 0; |
---|
| 1678 | } |
---|
| 1679 | | drive_strength |
---|
| 1680 | { |
---|
| 1681 | YYTRACE("drive_strength_opt: drive_strength"); |
---|
| 1682 | $$ = $1; |
---|
| 1683 | } |
---|
| 1684 | ; |
---|
| 1685 | |
---|
| 1686 | drive_strength |
---|
| 1687 | : '(' strength0 ',' strength1 ')' |
---|
| 1688 | { |
---|
| 1689 | YYTRACE("drive_strength: '(' strength0 ',' strength1 ')'"); |
---|
| 1690 | $$ = drive_strength($2, $4); |
---|
| 1691 | } |
---|
| 1692 | | '(' strength1 ',' strength0 ')' |
---|
| 1693 | { |
---|
| 1694 | YYTRACE("drive_strength: '(' strength1 ',' strength0 ')'"); |
---|
| 1695 | $$ = drive_strength($4, $2); |
---|
| 1696 | } |
---|
| 1697 | ; |
---|
| 1698 | |
---|
| 1699 | strength0 |
---|
| 1700 | : YYSUPPLY0 |
---|
| 1701 | { |
---|
| 1702 | YYTRACE("strength0: YYSUPPLY0"); |
---|
| 1703 | $$ = YYSUPPLY0; |
---|
| 1704 | } |
---|
| 1705 | | YYSTRONG0 |
---|
| 1706 | { |
---|
| 1707 | YYTRACE("strength0: YYSTRONG0"); |
---|
| 1708 | $$ = YYSTRONG0; |
---|
| 1709 | } |
---|
| 1710 | | YYPULL0 |
---|
| 1711 | { |
---|
| 1712 | YYTRACE("strength0: YYPULL0"); |
---|
| 1713 | $$ = YYPULL0; |
---|
| 1714 | } |
---|
| 1715 | | YYWEAK0 |
---|
| 1716 | { |
---|
| 1717 | YYTRACE("strength0: YYWEAK0"); |
---|
| 1718 | $$ = YYWEAK0; |
---|
| 1719 | } |
---|
| 1720 | | YYHIGHZ0 |
---|
| 1721 | { |
---|
| 1722 | YYTRACE("strength0: YYHIGHZ0"); |
---|
| 1723 | $$ = YYHIGHZ0; |
---|
| 1724 | } |
---|
| 1725 | ; |
---|
| 1726 | |
---|
| 1727 | strength1 |
---|
| 1728 | : YYSUPPLY1 |
---|
| 1729 | { |
---|
| 1730 | YYTRACE("strength1: YYSUPPLY1"); |
---|
| 1731 | $$ = YYSUPPLY1; |
---|
| 1732 | } |
---|
| 1733 | | YYSTRONG1 |
---|
| 1734 | { |
---|
| 1735 | YYTRACE("strength1: YYSTRONG1"); |
---|
| 1736 | $$ = YYSTRONG1; |
---|
| 1737 | } |
---|
| 1738 | | YYPULL1 |
---|
| 1739 | { |
---|
| 1740 | YYTRACE("strength1: YYPULL1"); |
---|
| 1741 | $$ = YYPULL1; |
---|
| 1742 | } |
---|
| 1743 | | YYWEAK1 |
---|
| 1744 | { |
---|
| 1745 | YYTRACE("strength1: YYWEAK1"); |
---|
| 1746 | $$ = YYWEAK1; |
---|
| 1747 | } |
---|
| 1748 | | YYHIGHZ1 |
---|
| 1749 | { |
---|
| 1750 | YYTRACE("strength1: YYHIGHZ1"); |
---|
| 1751 | $$ = YYHIGHZ1; |
---|
| 1752 | } |
---|
| 1753 | ; |
---|
| 1754 | |
---|
| 1755 | range_opt |
---|
| 1756 | : |
---|
| 1757 | { |
---|
| 1758 | YYTRACE("range_opt:"); |
---|
| 1759 | $$ = NIL(vl_range); |
---|
| 1760 | } |
---|
| 1761 | | range |
---|
| 1762 | { |
---|
| 1763 | YYTRACE("range_opt: range"); |
---|
| 1764 | $$ = $1; |
---|
| 1765 | } |
---|
| 1766 | ; |
---|
| 1767 | |
---|
| 1768 | range |
---|
| 1769 | : '[' expression ':' expression ']' |
---|
| 1770 | { |
---|
| 1771 | YYTRACE("range: '[' expression ':' expression ']'"); |
---|
| 1772 | $$ = vl_create_range($2, $4); |
---|
| 1773 | } |
---|
| 1774 | ; |
---|
| 1775 | |
---|
| 1776 | assignment_list |
---|
| 1777 | : assignment |
---|
| 1778 | { |
---|
| 1779 | lsHandle handle; |
---|
| 1780 | |
---|
| 1781 | YYTRACE("assignment_list: assignment"); |
---|
| 1782 | $$ = lsCreate(); |
---|
| 1783 | lsNewEnd($$, (lsGeneric)$1, &handle); |
---|
| 1784 | } |
---|
| 1785 | | assignment_list ',' assignment |
---|
| 1786 | { |
---|
| 1787 | lsHandle handle; |
---|
| 1788 | |
---|
| 1789 | YYTRACE("assignment_list: assignment_list ',' assignment"); |
---|
| 1790 | lsNewEnd($1, (lsGeneric)$3, &handle); |
---|
| 1791 | $$ = $1; |
---|
| 1792 | } |
---|
| 1793 | ; |
---|
| 1794 | |
---|
| 1795 | |
---|
| 1796 | |
---|
| 1797 | gate_instantiation |
---|
| 1798 | : gatetype drive_delay_clr gate_instance_list ';' |
---|
| 1799 | { |
---|
| 1800 | int strength=0; |
---|
| 1801 | vl_delay *delay=NIL(vl_delay); |
---|
| 1802 | |
---|
| 1803 | YYTRACE("gate_instantiation: gatetype drive_delay_clr gate_instance_list ';'"); |
---|
| 1804 | |
---|
| 1805 | extract_delay_strength($2, &delay, &strength); |
---|
| 1806 | lsDestroy($2, NULL); |
---|
| 1807 | |
---|
| 1808 | |
---|
| 1809 | $$ = vl_create_gate_inst_list($1, strength, delay, $3); |
---|
| 1810 | |
---|
| 1811 | insert_instances($3, $$); |
---|
| 1812 | } |
---|
| 1813 | ; |
---|
| 1814 | |
---|
| 1815 | drive_delay_clr |
---|
| 1816 | : |
---|
| 1817 | { |
---|
| 1818 | YYTRACE("drive_delay_clr:"); |
---|
| 1819 | $$ = lsCreate(); |
---|
| 1820 | } |
---|
| 1821 | | drive_delay_clr drive_delay |
---|
| 1822 | { |
---|
| 1823 | lsHandle handle; |
---|
| 1824 | |
---|
| 1825 | YYTRACE("drive_delay_clr: drive_delay_clr drive_delay"); |
---|
| 1826 | lsNewEnd($1, (lsGeneric)$2, &handle); |
---|
| 1827 | $$ = $1; |
---|
| 1828 | } |
---|
| 1829 | ; |
---|
| 1830 | |
---|
| 1831 | drive_delay |
---|
| 1832 | : drive_strength |
---|
| 1833 | { |
---|
| 1834 | YYTRACE("drive_delay: drive_strength"); |
---|
| 1835 | $$ = $1 << 2; |
---|
| 1836 | } |
---|
| 1837 | | delay |
---|
| 1838 | { |
---|
| 1839 | YYTRACE("drive_delay: delay"); |
---|
| 1840 | |
---|
| 1841 | |
---|
| 1842 | |
---|
| 1843 | $$ = (int)($1) | LEAST_SB; |
---|
| 1844 | } |
---|
| 1845 | ; |
---|
| 1846 | |
---|
| 1847 | gatetype |
---|
| 1848 | : YYAND |
---|
| 1849 | { |
---|
| 1850 | YYTRACE("gatetype: YYAND"); |
---|
| 1851 | $$ = AndGate; |
---|
| 1852 | } |
---|
| 1853 | | YYNAND |
---|
| 1854 | { |
---|
| 1855 | YYTRACE("gatetype: YYNAND"); |
---|
| 1856 | $$ = NandGate; |
---|
| 1857 | } |
---|
| 1858 | | YYOR |
---|
| 1859 | { |
---|
| 1860 | YYTRACE("gatetype: YYOR"); |
---|
| 1861 | $$ = OrGate; |
---|
| 1862 | } |
---|
| 1863 | | YYNOR |
---|
| 1864 | { |
---|
| 1865 | YYTRACE("gatetype: YYNOR"); |
---|
| 1866 | $$ = NorGate; |
---|
| 1867 | } |
---|
| 1868 | | YYXOR |
---|
| 1869 | { |
---|
| 1870 | YYTRACE("gatetype: YYXOR"); |
---|
| 1871 | $$ = XorGate; |
---|
| 1872 | } |
---|
| 1873 | | YYXNOR |
---|
| 1874 | { |
---|
| 1875 | YYTRACE("gatetype: YYXNOR"); |
---|
| 1876 | $$ = XnorGate; |
---|
| 1877 | } |
---|
| 1878 | | YYBUF |
---|
| 1879 | { |
---|
| 1880 | YYTRACE("gatetype: YYBUF"); |
---|
| 1881 | $$ = BufGate; |
---|
| 1882 | } |
---|
| 1883 | | YYBUFIF0 |
---|
| 1884 | { |
---|
| 1885 | YYTRACE("gatetype: YYBIFIF0"); |
---|
| 1886 | $$ = Bufif0Gate; |
---|
| 1887 | } |
---|
| 1888 | | YYBUFIF1 |
---|
| 1889 | { |
---|
| 1890 | YYTRACE("gatetype: YYBIFIF1"); |
---|
| 1891 | $$ = Bufif1Gate; |
---|
| 1892 | } |
---|
| 1893 | | YYNOT |
---|
| 1894 | { |
---|
| 1895 | YYTRACE("gatetype: YYNOT"); |
---|
| 1896 | $$ = NotGate; |
---|
| 1897 | } |
---|
| 1898 | | YYNOTIF0 |
---|
| 1899 | { |
---|
| 1900 | YYTRACE("gatetype: YYNOTIF0"); |
---|
| 1901 | $$ = Notif0Gate; |
---|
| 1902 | } |
---|
| 1903 | | YYNOTIF1 |
---|
| 1904 | { |
---|
| 1905 | YYTRACE("gatetype: YYNOTIF1"); |
---|
| 1906 | $$ = Notif1Gate; |
---|
| 1907 | } |
---|
| 1908 | | YYPULLDOWN |
---|
| 1909 | { |
---|
| 1910 | YYTRACE("gatetype: YYPULLDOWN"); |
---|
| 1911 | $$ = PulldownGate; |
---|
| 1912 | } |
---|
| 1913 | | YYPULLUP |
---|
| 1914 | { |
---|
| 1915 | YYTRACE("gatetype: YYPULLUP"); |
---|
| 1916 | $$ = PullupGate; |
---|
| 1917 | } |
---|
| 1918 | | YYNMOS |
---|
| 1919 | { |
---|
| 1920 | YYTRACE("gatetype: YYNMOS"); |
---|
| 1921 | $$ = NmosGate; |
---|
| 1922 | } |
---|
| 1923 | | YYPMOS |
---|
| 1924 | { |
---|
| 1925 | YYTRACE("gatetype: YYPMOS"); |
---|
| 1926 | $$ = PmosGate; |
---|
| 1927 | } |
---|
| 1928 | | YYRNMOS |
---|
| 1929 | { |
---|
| 1930 | YYTRACE("gatetype: YYRNMOS"); |
---|
| 1931 | $$ = RnmosGate; |
---|
| 1932 | } |
---|
| 1933 | | YYRPMOS |
---|
| 1934 | { |
---|
| 1935 | YYTRACE("gatetype: YYRPMOS"); |
---|
| 1936 | $$ = RpmosGate; |
---|
| 1937 | } |
---|
| 1938 | | YYCMOS |
---|
| 1939 | { |
---|
| 1940 | YYTRACE("gatetype: YYCMOS"); |
---|
| 1941 | $$ = CmosGate; |
---|
| 1942 | } |
---|
| 1943 | | YYRCMOS |
---|
| 1944 | { |
---|
| 1945 | YYTRACE("gatetype: YYRCMOS"); |
---|
| 1946 | $$ = RcmosGate; |
---|
| 1947 | } |
---|
| 1948 | | YYTRAN |
---|
| 1949 | { |
---|
| 1950 | YYTRACE("gatetype: YYTRAN"); |
---|
| 1951 | $$ = TranGate; |
---|
| 1952 | } |
---|
| 1953 | | YYRTRAN |
---|
| 1954 | { |
---|
| 1955 | YYTRACE("gatetype: YYRTRAN"); |
---|
| 1956 | $$ = RtranGate; |
---|
| 1957 | } |
---|
| 1958 | | YYTRANIF0 |
---|
| 1959 | { |
---|
| 1960 | YYTRACE("gatetype: YYTRANIF0"); |
---|
| 1961 | $$ = Tranif0Gate; |
---|
| 1962 | } |
---|
| 1963 | | YYRTRANIF0 |
---|
| 1964 | { |
---|
| 1965 | YYTRACE("gatetype: YYRTRANIF0"); |
---|
| 1966 | $$ = Rtranif0Gate; |
---|
| 1967 | } |
---|
| 1968 | | YYTRANIF1 |
---|
| 1969 | { |
---|
| 1970 | YYTRACE("gatetype: YYTRANIF1"); |
---|
| 1971 | $$ = Tranif1Gate; |
---|
| 1972 | } |
---|
| 1973 | | YYRTRANIF1 |
---|
| 1974 | { |
---|
| 1975 | YYTRACE("gatetype: YYRTRANIF1"); |
---|
| 1976 | $$ = Rtranif1Gate; |
---|
| 1977 | } |
---|
| 1978 | |
---|
| 1979 | |
---|
| 1980 | | YYTESLATIMER |
---|
| 1981 | { |
---|
| 1982 | YYTRACE("gatetype: YYTESLATIMER"); |
---|
| 1983 | $$ = TeslaTimerGate; |
---|
| 1984 | } |
---|
| 1985 | ; |
---|
| 1986 | |
---|
| 1987 | gate_instance_list |
---|
| 1988 | : gate_instance |
---|
| 1989 | { |
---|
| 1990 | lsHandle handle; |
---|
| 1991 | |
---|
| 1992 | YYTRACE("gate_instance_list: gate_instance"); |
---|
| 1993 | $$ = lsCreate(); |
---|
| 1994 | lsNewEnd($$, (lsGeneric)$1, &handle); |
---|
| 1995 | } |
---|
| 1996 | | gate_instance_list ',' gate_instance |
---|
| 1997 | { |
---|
| 1998 | lsHandle handle; |
---|
| 1999 | |
---|
| 2000 | YYTRACE("gate_instance_list: gate_instance_list ',' gate_instance"); |
---|
| 2001 | lsNewEnd($1, (lsGeneric)$3, &handle); |
---|
| 2002 | $$ = $1; |
---|
| 2003 | } |
---|
| 2004 | ; |
---|
| 2005 | |
---|
| 2006 | gate_instance |
---|
| 2007 | : '(' terminal_list ')' |
---|
| 2008 | { |
---|
| 2009 | YYTRACE("gate_instance: '(' terminal_list ')'"); |
---|
| 2010 | $$ = vl_create_gate_inst(NIL(vl_id_range), $2); |
---|
| 2011 | } |
---|
| 2012 | | name_of_gate_instance '(' terminal_list ')' |
---|
| 2013 | { |
---|
| 2014 | YYTRACE("gate_instance: name_of_gate_instance '(' terminal_list ')'"); |
---|
| 2015 | $$ = vl_create_gate_inst($1, $3); |
---|
| 2016 | } |
---|
| 2017 | ; |
---|
| 2018 | |
---|
| 2019 | name_of_gate_instance |
---|
| 2020 | : YYIDE |
---|
| 2021 | { |
---|
| 2022 | YYTRACE("name_of_gate_instance: YYIDE"); |
---|
| 2023 | $$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range)); |
---|
| 2024 | } |
---|
| 2025 | ; |
---|
| 2026 | |
---|
| 2027 | terminal_list |
---|
| 2028 | : terminal |
---|
| 2029 | { |
---|
| 2030 | lsHandle handle; |
---|
| 2031 | |
---|
| 2032 | YYTRACE("terminal_list: terminal"); |
---|
| 2033 | $$ = lsCreate(); |
---|
| 2034 | lsNewEnd($$, (lsGeneric)$1, &handle); |
---|
| 2035 | } |
---|
| 2036 | | terminal_list ',' terminal |
---|
| 2037 | { |
---|
| 2038 | lsHandle handle; |
---|
| 2039 | |
---|
| 2040 | YYTRACE("terminal_list: terminal_list ',' terminal"); |
---|
| 2041 | lsNewEnd($1, (lsGeneric)$3, &handle); |
---|
| 2042 | $$ = $1; |
---|
| 2043 | } |
---|
| 2044 | ; |
---|
| 2045 | |
---|
| 2046 | terminal |
---|
| 2047 | : expression |
---|
| 2048 | { |
---|
| 2049 | YYTRACE("terminal: expression"); |
---|
| 2050 | } |
---|
| 2051 | ; |
---|
| 2052 | |
---|
| 2053 | |
---|
| 2054 | |
---|
| 2055 | module_or_primitive_instantiation |
---|
| 2056 | : name_of_module_or_primitive module_or_primitive_option_clr |
---|
| 2057 | module_or_primitive_instance_list ';' |
---|
| 2058 | { |
---|
| 2059 | int strength=0; |
---|
| 2060 | vl_delay *delay=NIL(vl_delay); |
---|
| 2061 | |
---|
| 2062 | YYTRACE("module_or_primitive_instantiation: name_of_module_or_primitive module_or_primitive_option_clr module_or_primitive_instance_list ';'"); |
---|
| 2063 | |
---|
| 2064 | extract_delay_strength($2, &delay, &strength); |
---|
| 2065 | lsDestroy($2, NULL); |
---|
| 2066 | |
---|
| 2067 | |
---|
| 2068 | $$ = vl_add_find_mod_prim_instances($1, delay, strength, $3); |
---|
| 2069 | |
---|
| 2070 | insert_instances($3, $$); |
---|
| 2071 | } |
---|
| 2072 | ; |
---|
| 2073 | |
---|
| 2074 | name_of_module_or_primitive |
---|
| 2075 | : YYIDE |
---|
| 2076 | { |
---|
| 2077 | YYTRACE("name_of_module_or_primitive: YYIDE"); |
---|
| 2078 | $$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range)); |
---|
| 2079 | } |
---|
| 2080 | ; |
---|
| 2081 | |
---|
| 2082 | module_or_primitive_option_clr |
---|
| 2083 | : |
---|
| 2084 | { |
---|
| 2085 | YYTRACE("module_or_primitive_option_clr:"); |
---|
| 2086 | $$ = lsCreate(); |
---|
| 2087 | } |
---|
| 2088 | | module_or_primitive_option_clr module_or_primitive_option |
---|
| 2089 | { |
---|
| 2090 | lsHandle handle; |
---|
| 2091 | |
---|
| 2092 | YYTRACE("module_or_primitive_option_clr: module_or_primitive_option_clr module_or_primitive_option"); |
---|
| 2093 | lsNewEnd($1, (lsGeneric)$2, &handle); |
---|
| 2094 | $$ = $1; |
---|
| 2095 | } |
---|
| 2096 | ; |
---|
| 2097 | |
---|
| 2098 | module_or_primitive_option |
---|
| 2099 | : drive_strength |
---|
| 2100 | { |
---|
| 2101 | YYTRACE("module_or_primitive_option:"); |
---|
| 2102 | $$ = $1 << 2; |
---|
| 2103 | } |
---|
| 2104 | | delay_or_parameter_value_assignment |
---|
| 2105 | { |
---|
| 2106 | YYTRACE("module_or_primitive_option: delay"); |
---|
| 2107 | |
---|
| 2108 | $$ = (int)($1) | LEAST_SB; |
---|
| 2109 | } |
---|
| 2110 | ; |
---|
| 2111 | |
---|
| 2112 | delay_or_parameter_value_assignment |
---|
| 2113 | : '#' YYINUMBER |
---|
| 2114 | { |
---|
| 2115 | vl_expr *expr; |
---|
| 2116 | |
---|
| 2117 | YYTRACE("delay_or_parameter_value_assignment: '#' YYINUMBER"); |
---|
| 2118 | expr = vl_create_expr(IntExpr, atoi(yytext), (double)0.0, |
---|
| 2119 | NIL(void), NIL(void), NIL(void)); |
---|
| 2120 | $$ = vl_create_delay(expr, NIL(vl_expr), NIL(vl_expr)); |
---|
| 2121 | } |
---|
| 2122 | | '#' YYRNUMBER |
---|
| 2123 | { |
---|
| 2124 | vl_expr *expr; |
---|
| 2125 | |
---|
| 2126 | YYTRACE("delay_or_parameter_value_assignment: '#' YYRNUMBER"); |
---|
| 2127 | expr = vl_create_expr(IntExpr, 0, atof(yytext), |
---|
| 2128 | NIL(void), NIL(void), NIL(void)); |
---|
| 2129 | $$ = vl_create_delay(expr, NIL(vl_expr), NIL(vl_expr)); |
---|
| 2130 | } |
---|
| 2131 | | '#' identifier |
---|
| 2132 | { |
---|
| 2133 | vl_expr *expr; |
---|
| 2134 | |
---|
| 2135 | YYTRACE("delay_or_parameter_value_assignment: '#' identifier"); |
---|
| 2136 | expr = vl_create_expr(IDExpr, 0, (double)0.0, |
---|
| 2137 | $2, NIL(void), NIL(void)); |
---|
| 2138 | $$ = vl_create_delay(expr, NIL(vl_expr), NIL(vl_expr)); |
---|
| 2139 | } |
---|
| 2140 | | '#' '(' mintypmax_expression_list ')' |
---|
| 2141 | { |
---|
| 2142 | YYTRACE("delay_or_parameter_value_assignment: '#' '(' mintypmax_expression_list ')'"); |
---|
| 2143 | $$ = vl_create_delay(NIL(vl_expr), NIL(vl_expr), (vl_expr*)$3); |
---|
| 2144 | } |
---|
| 2145 | ; |
---|
| 2146 | |
---|
| 2147 | module_or_primitive_instance_list |
---|
| 2148 | : module_or_primitive_instance |
---|
| 2149 | { |
---|
| 2150 | lsHandle handle; |
---|
| 2151 | |
---|
| 2152 | YYTRACE("module_or_primitive_instance_list: module_or_primitive_instance"); |
---|
| 2153 | $$ = lsCreate(); |
---|
| 2154 | lsNewEnd($$, (lsGeneric)$1, &handle); |
---|
| 2155 | } |
---|
| 2156 | | module_or_primitive_instance_list ',' module_or_primitive_instance |
---|
| 2157 | { |
---|
| 2158 | lsHandle handle; |
---|
| 2159 | |
---|
| 2160 | YYTRACE("module_or_primitive_instance_list: module_or_primitive_instance_list ',' module_or_primitive_instance"); |
---|
| 2161 | lsNewEnd($1, (lsGeneric)$3, &handle); |
---|
| 2162 | $$ = $1; |
---|
| 2163 | } |
---|
| 2164 | ; |
---|
| 2165 | |
---|
| 2166 | |
---|
| 2167 | module_or_primitive_instance |
---|
| 2168 | : '(' module_connection_list ')' |
---|
| 2169 | { |
---|
| 2170 | YYTRACE("module_or_primitive_instance: '(' module_connection_list ')'"); |
---|
| 2171 | $$ = (typestructPtr)vl_create_mod_prim_inst(NIL(vl_id_range), $2); |
---|
| 2172 | } |
---|
| 2173 | | identifier '(' module_connection_list ')' |
---|
| 2174 | { |
---|
| 2175 | YYTRACE("module_or_primitive_instance: '(' module_connection_list ')'"); |
---|
| 2176 | $$ = (typestructPtr)vl_create_mod_prim_inst($1, $3); |
---|
| 2177 | } |
---|
| 2178 | ; |
---|
| 2179 | |
---|
| 2180 | module_connection_list |
---|
| 2181 | : module_port_connection_list |
---|
| 2182 | { |
---|
| 2183 | YYTRACE("module_connection_list: module_port_connection_list"); |
---|
| 2184 | } |
---|
| 2185 | | named_port_connection_list |
---|
| 2186 | { |
---|
| 2187 | YYTRACE("module_connection_list: named_port_connection_list"); |
---|
| 2188 | } |
---|
| 2189 | ; |
---|
| 2190 | |
---|
| 2191 | module_port_connection_list |
---|
| 2192 | : module_port_connection |
---|
| 2193 | { |
---|
| 2194 | lsHandle handle; |
---|
| 2195 | |
---|
| 2196 | YYTRACE("module_port_connection_list: module_port_connection"); |
---|
| 2197 | $$ = lsCreate(); |
---|
| 2198 | lsNewEnd($$, (lsGeneric)$1, &handle); |
---|
| 2199 | } |
---|
| 2200 | | module_port_connection_list ',' module_port_connection |
---|
| 2201 | { |
---|
| 2202 | lsHandle handle; |
---|
| 2203 | |
---|
| 2204 | YYTRACE("module_port_connection_list: module_port_connection_list ',' module_port_connection"); |
---|
| 2205 | lsNewEnd($1, (lsGeneric)$3, &handle); |
---|
| 2206 | $$ = $1; |
---|
| 2207 | } |
---|
| 2208 | ; |
---|
| 2209 | |
---|
| 2210 | named_port_connection_list |
---|
| 2211 | : named_port_connection |
---|
| 2212 | { |
---|
| 2213 | lsHandle handle; |
---|
| 2214 | |
---|
| 2215 | YYTRACE("named_port_connection_list: named_port_connection"); |
---|
| 2216 | $$ = lsCreate(); |
---|
| 2217 | lsNewEnd($$, (lsGeneric)$<ival>1, &handle); |
---|
| 2218 | } |
---|
| 2219 | | named_port_connection_list ',' named_port_connection |
---|
| 2220 | { |
---|
| 2221 | lsHandle handle; |
---|
| 2222 | |
---|
| 2223 | YYTRACE("named_port_connection_list: named_port_connection_list ',' name_port_connection"); |
---|
| 2224 | lsNewEnd($1, (lsGeneric)$<ival>3, &handle); |
---|
| 2225 | $$ = $1; |
---|
| 2226 | } |
---|
| 2227 | ; |
---|
| 2228 | |
---|
| 2229 | module_port_connection |
---|
| 2230 | : |
---|
| 2231 | { |
---|
| 2232 | YYTRACE("module_port_connection:"); |
---|
| 2233 | $$ = vl_create_port_connect(ModuleConnect, |
---|
| 2234 | NIL(vl_id_range), NIL(vl_expr)); |
---|
| 2235 | } |
---|
| 2236 | | expression |
---|
| 2237 | { |
---|
| 2238 | YYTRACE("module_port_connection: expression"); |
---|
| 2239 | $$ = vl_create_port_connect(ModuleConnect, NIL(vl_id_range), $1); |
---|
| 2240 | } |
---|
| 2241 | ; |
---|
| 2242 | |
---|
| 2243 | named_port_connection |
---|
| 2244 | : '.' identifier '(' expression ')' |
---|
| 2245 | { |
---|
| 2246 | YYTRACE("named_port_connection: '.' identifier '(' expression ')'"); |
---|
| 2247 | $$ = vl_create_port_connect(NamedConnect, $2, $4); |
---|
| 2248 | } |
---|
| 2249 | ; |
---|
| 2250 | |
---|
| 2251 | |
---|
| 2252 | |
---|
| 2253 | initial_statement |
---|
| 2254 | : YYINITIAL {reserve_type_name=0; timed_statement=0;} statement |
---|
| 2255 | { |
---|
| 2256 | YYTRACE("initial_statement: YYINITIAL statement"); |
---|
| 2257 | $$ = vl_create_procstmt(InitialStmt, $3); |
---|
| 2258 | reserve_type_name=1; |
---|
| 2259 | if (timed_statement) $$->flags |= TimedInitStmt; |
---|
| 2260 | } |
---|
| 2261 | ; |
---|
| 2262 | |
---|
| 2263 | always_statement |
---|
| 2264 | : YYALWAYS {reserve_type_name=0;} statement |
---|
| 2265 | { |
---|
| 2266 | YYTRACE("always_statement: YYALWAYS statement"); |
---|
| 2267 | $$ = vl_create_procstmt(AlwaysStmt, $3); |
---|
| 2268 | reserve_type_name=1; |
---|
| 2269 | } |
---|
| 2270 | ; |
---|
| 2271 | |
---|
| 2272 | statement_opt |
---|
| 2273 | : |
---|
| 2274 | { |
---|
| 2275 | YYTRACE("statement_opt:"); |
---|
| 2276 | $$ = lsCreate(); |
---|
| 2277 | } |
---|
| 2278 | | statement |
---|
| 2279 | { |
---|
| 2280 | lsHandle handle; |
---|
| 2281 | |
---|
| 2282 | YYTRACE("statement_opt: statement"); |
---|
| 2283 | $$ = lsCreate(); |
---|
| 2284 | lsNewEnd($$, (lsGeneric)$1, &handle); |
---|
| 2285 | } |
---|
| 2286 | ; |
---|
| 2287 | |
---|
| 2288 | statement_clr |
---|
| 2289 | : |
---|
| 2290 | { |
---|
| 2291 | YYTRACE("statement_clr:"); |
---|
| 2292 | $$ = lsCreate(); |
---|
| 2293 | } |
---|
| 2294 | | statement_clr statement |
---|
| 2295 | { |
---|
| 2296 | lsHandle handle; |
---|
| 2297 | |
---|
| 2298 | YYTRACE("statement_clr: statement_clr statement"); |
---|
| 2299 | lsNewEnd($1, (lsGeneric)$2, &handle); |
---|
| 2300 | $$ = $1; |
---|
| 2301 | } |
---|
| 2302 | ; |
---|
| 2303 | |
---|
| 2304 | |
---|
| 2305 | statement |
---|
| 2306 | : ';' |
---|
| 2307 | { |
---|
| 2308 | YYTRACE("statement: ';'"); |
---|
| 2309 | $$ = NIL(typestruct); |
---|
| 2310 | } |
---|
| 2311 | | assignment ';' |
---|
| 2312 | { |
---|
| 2313 | YYTRACE("statement: assignment ';'"); |
---|
| 2314 | } |
---|
| 2315 | | YYIF '(' expression ')' statement |
---|
| 2316 | { |
---|
| 2317 | YYTRACE("statement: YYIF '(' expression ')' statement"); |
---|
| 2318 | $$ = (typestructPtr)vl_create_if_else_stmt($3, $5, NIL(typestruct)); |
---|
| 2319 | } |
---|
| 2320 | | YYIF '(' expression ')' statement YYELSE statement |
---|
| 2321 | { |
---|
| 2322 | YYTRACE("statement: YYIF '(' expression ')' statement YYELSE statement"); |
---|
| 2323 | $$ = (typestructPtr)vl_create_if_else_stmt($3, $5, $7); |
---|
| 2324 | } |
---|
| 2325 | | YYCASE '(' expression ')' case_item_eclr YYENDCASE |
---|
| 2326 | { |
---|
| 2327 | YYTRACE("statement: YYCASE '(' expression ')' case_item_eclr YYENDCASE"); |
---|
| 2328 | $$ = (typestructPtr)vl_create_case_stmt(CaseStmt, $3, $5); |
---|
| 2329 | } |
---|
| 2330 | | YYCASEZ '(' expression ')' case_item_eclr YYENDCASE |
---|
| 2331 | { |
---|
| 2332 | YYTRACE("statement: YYCASEZ '(' expression ')' case_item_eclr YYENDCASE"); |
---|
| 2333 | $$ = (typestructPtr)vl_create_case_stmt(CasezStmt, $3, $5); |
---|
| 2334 | } |
---|
| 2335 | | YYCASEX '(' expression ')' case_item_eclr YYENDCASE |
---|
| 2336 | { |
---|
| 2337 | YYTRACE("statement: YYCASEX '(' expression ')' case_item_eclr YYENDCASE"); |
---|
| 2338 | $$ = (typestructPtr)vl_create_case_stmt(CasexStmt, $3, $5); |
---|
| 2339 | } |
---|
| 2340 | | YYFOREVER statement |
---|
| 2341 | { |
---|
| 2342 | YYTRACE("statement: YYFOREVER statement"); |
---|
| 2343 | $$ = (typestructPtr)vl_create_forever_stmt($2); |
---|
| 2344 | } |
---|
| 2345 | | YYREPEAT '(' expression ')' statement |
---|
| 2346 | { |
---|
| 2347 | YYTRACE("statement: YYREPEAT '(' expression ')' statement"); |
---|
| 2348 | $$ = (typestructPtr)vl_create_repeat_stmt($3, $5); |
---|
| 2349 | } |
---|
| 2350 | | YYWHILE '(' expression ')' statement |
---|
| 2351 | { |
---|
| 2352 | YYTRACE("statement: YYWHILE '(' expression ')' statement"); |
---|
| 2353 | $$ = (typestructPtr)vl_create_while_stmt($3, $5); |
---|
| 2354 | } |
---|
| 2355 | | YYFOR '(' assignment ';' expression ';' assignment ')' statement |
---|
| 2356 | { |
---|
| 2357 | YYTRACE("statement: YYFOR '(' assignment ';' expression ';' assignment ')' statement"); |
---|
| 2358 | $$ = (typestructPtr)vl_create_for_stmt($3, $5, $7, $9); |
---|
| 2359 | } |
---|
| 2360 | | delay_control statement |
---|
| 2361 | { |
---|
| 2362 | YYTRACE("statement: delay_control statement"); |
---|
| 2363 | $$ = (typestructPtr)vl_create_delay_control_stmt($1, $2); |
---|
| 2364 | } |
---|
| 2365 | | event_control statement |
---|
| 2366 | { |
---|
| 2367 | YYTRACE("statement: event_control statement"); |
---|
| 2368 | $$ = (typestructPtr)vl_create_event_control_stmt($1, $2); |
---|
| 2369 | } |
---|
| 2370 | | lvalue type_action '=' delay_control expression ';' |
---|
| 2371 | { |
---|
| 2372 | YYTRACE("statement: lvalue '=' delay_control expression ';'"); |
---|
| 2373 | $$ = (typestructPtr)vl_create_bassign_stmt(DelayBassignStmt, $1, $4, $5); |
---|
| 2374 | } |
---|
| 2375 | | lvalue type_action '=' event_control expression ';' |
---|
| 2376 | { |
---|
| 2377 | YYTRACE("statement: lvalue '=' event_control expression ';'"); |
---|
| 2378 | $$ = (typestructPtr)vl_create_bassign_stmt(EventBassignStmt, $1, $4, $5); |
---|
| 2379 | } |
---|
| 2380 | | lvalue type_action YYNBASSIGN delay_control expression ';' |
---|
| 2381 | { |
---|
| 2382 | YYTRACE("statement: lvalue YYNBASSIGN delay_control expression ';'"); |
---|
| 2383 | $$ = (typestructPtr)vl_create_bassign_stmt(DelayNbassignStmt, $1, $4, $5); |
---|
| 2384 | } |
---|
| 2385 | | lvalue type_action YYNBASSIGN event_control expression ';' |
---|
| 2386 | { |
---|
| 2387 | YYTRACE("statement: lvalue YYNBASSIGN event_control expression ';'"); |
---|
| 2388 | $$ = (typestructPtr)vl_create_bassign_stmt(EventNbassignStmt, $1, $4, $5); |
---|
| 2389 | } |
---|
| 2390 | | YYWAIT '(' expression ')' statement |
---|
| 2391 | { |
---|
| 2392 | YYTRACE("statement: YYWAIT '(' expression ')' statement"); |
---|
| 2393 | $$ = (typestructPtr)vl_create_wait_stmt($3, $5); |
---|
| 2394 | } |
---|
| 2395 | | YYRIGHTARROW name_of_event ';' |
---|
| 2396 | { |
---|
| 2397 | YYTRACE("statement: YYRIGHTARROW name_of_event ';'"); |
---|
| 2398 | $$ = (typestructPtr)vl_create_send_event_stmt($2); |
---|
| 2399 | } |
---|
| 2400 | | seq_block |
---|
| 2401 | { |
---|
| 2402 | YYTRACE("statement: seq_block"); |
---|
| 2403 | } |
---|
| 2404 | | par_block |
---|
| 2405 | { |
---|
| 2406 | YYTRACE("statement: par_block"); |
---|
| 2407 | } |
---|
| 2408 | | task_enable |
---|
| 2409 | { |
---|
| 2410 | YYTRACE("statement: task_enable"); |
---|
| 2411 | } |
---|
| 2412 | | system_task_enable |
---|
| 2413 | { |
---|
| 2414 | YYTRACE("statement: system_task_enable"); |
---|
| 2415 | TODO("statement: system_task_enable"); |
---|
| 2416 | $$ = NIL(typestruct); |
---|
| 2417 | } |
---|
| 2418 | | YYDISABLE YYIDE |
---|
| 2419 | { |
---|
| 2420 | $<idrng>$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range)); |
---|
| 2421 | } |
---|
| 2422 | ';' |
---|
| 2423 | { |
---|
| 2424 | YYTRACE("statement: YYDISABLE YYIDE ';'"); |
---|
| 2425 | $$ = (typestructPtr)vl_create_disable_stmt($<idrng>3); |
---|
| 2426 | } |
---|
| 2427 | | YYASSIGN assignment ';' |
---|
| 2428 | { |
---|
| 2429 | YYTRACE("statement: YYASSIGN assignment ';'"); |
---|
| 2430 | $2->type = AssignStmt; |
---|
| 2431 | $$ = (typestructPtr)$2; |
---|
| 2432 | } |
---|
| 2433 | | YYDEASSIGN lvalue ';' |
---|
| 2434 | { |
---|
| 2435 | YYTRACE("statement: YYDEASSIGN lvalue ';'"); |
---|
| 2436 | $$ = (typestructPtr)vl_create_deassign_stmt($2); |
---|
| 2437 | } |
---|
| 2438 | ; |
---|
| 2439 | |
---|
| 2440 | assignment |
---|
| 2441 | : lvalue type_action '=' expression |
---|
| 2442 | { |
---|
| 2443 | YYTRACE("assignment: lvalue '=' expression"); |
---|
| 2444 | associate_symbolic_value($1, $4); |
---|
| 2445 | $$ = vl_create_bassign_stmt(BassignStmt, $1, NIL(void), $4); |
---|
| 2446 | if (c_assign && $1->type != ConcatExpr) { |
---|
| 2447 | vl_id_range *id_sym; |
---|
| 2448 | if (!st_lookup(vl_currentModule->sig_st, $1->name->name, (char**)&id_sym)) |
---|
| 2449 | compile_error("continuous assignment to undeclared var"); |
---|
| 2450 | id_sym->flags |= WireVar; |
---|
| 2451 | } |
---|
| 2452 | pop_stack(vl_cur_type_stack, (void **) &aux_st); |
---|
| 2453 | } |
---|
| 2454 | | lvalue type_action YYNBASSIGN expression |
---|
| 2455 | { |
---|
| 2456 | YYTRACE("assignment: lvalue YYNBASSIGN expression"); |
---|
| 2457 | associate_symbolic_value($1, $4); |
---|
| 2458 | $$ = vl_create_bassign_stmt(NbassignStmt, $1, NIL(void), $4); |
---|
| 2459 | if (c_assign && $1->type != ConcatExpr) { |
---|
| 2460 | vl_id_range *id_sym; |
---|
| 2461 | if (!st_lookup(vl_currentModule->sig_st, $1->name->name, (char**)&id_sym)) |
---|
| 2462 | compile_error("non-blocking assignment to undeclared var"); |
---|
| 2463 | id_sym->flags |= WireVar; |
---|
| 2464 | } |
---|
| 2465 | pop_stack(vl_cur_type_stack, (void **) &aux_st); |
---|
| 2466 | } |
---|
| 2467 | ; |
---|
| 2468 | |
---|
| 2469 | type_action |
---|
| 2470 | : |
---|
| 2471 | { |
---|
| 2472 | vl_id_range *id_sym; |
---|
| 2473 | |
---|
| 2474 | if ($<lval>0->type != ConcatExpr) { |
---|
| 2475 | push_stack(vl_cur_type_stack, aux_st); |
---|
| 2476 | |
---|
| 2477 | if (st_lookup(vl_currentModule->sig_st, |
---|
| 2478 | $<lval>0->name->name, &id_sym)) |
---|
| 2479 | if (id_sym->id_type) |
---|
| 2480 | aux_st = |
---|
| 2481 | id_sym->id_type->specifier->u.enum_type->domain_st; |
---|
| 2482 | else |
---|
| 2483 | aux_st = NIL(st_table); |
---|
| 2484 | else |
---|
| 2485 | aux_st = NIL(st_table); |
---|
| 2486 | } |
---|
| 2487 | } |
---|
| 2488 | ; |
---|
| 2489 | |
---|
| 2490 | type_action_expr |
---|
| 2491 | : |
---|
| 2492 | { /* Partial patch: b = (v1 == a) ? v1 : v2, where v1 and v2 |
---|
| 2493 | * are enumerated values still compiled incorrectly. */ |
---|
| 2494 | vl_id_range *id_sym; |
---|
| 2495 | |
---|
| 2496 | if ($<expr>-1->type != ConcatExpr) { |
---|
| 2497 | push_stack(vl_cur_type_stack, aux_st); |
---|
| 2498 | if ($<expr>-1->type == IDExpr) { |
---|
| 2499 | if (st_lookup(vl_currentModule->sig_st, |
---|
| 2500 | $<expr>-1->u.name->name, &id_sym)) |
---|
| 2501 | if (id_sym->id_type) |
---|
| 2502 | aux_st = |
---|
| 2503 | id_sym->id_type->specifier->u.enum_type->domain_st; |
---|
| 2504 | else |
---|
| 2505 | aux_st = NIL(st_table); |
---|
| 2506 | else |
---|
| 2507 | aux_st = NIL(st_table); |
---|
| 2508 | } |
---|
| 2509 | else |
---|
| 2510 | aux_st = NIL(st_table); |
---|
| 2511 | } |
---|
| 2512 | } |
---|
| 2513 | ; |
---|
| 2514 | |
---|
| 2515 | case_item_eclr |
---|
| 2516 | : case_item |
---|
| 2517 | { |
---|
| 2518 | lsHandle handle; |
---|
| 2519 | |
---|
| 2520 | YYTRACE("case_item_eclr: case_item"); |
---|
| 2521 | $$ = lsCreate(); |
---|
| 2522 | lsNewEnd($$, (lsGeneric)$1, &handle); |
---|
| 2523 | } |
---|
| 2524 | | case_item_eclr case_item |
---|
| 2525 | { |
---|
| 2526 | lsHandle handle; |
---|
| 2527 | |
---|
| 2528 | YYTRACE("case_item_eclr: case_item_eclr case_item"); |
---|
| 2529 | lsNewEnd($1, (lsGeneric)$2, &handle); |
---|
| 2530 | $$ = $1; |
---|
| 2531 | } |
---|
| 2532 | ; |
---|
| 2533 | |
---|
| 2534 | case_item |
---|
| 2535 | : expression_list ':' statement |
---|
| 2536 | { |
---|
| 2537 | YYTRACE("case_item: expression_list ':' statement"); |
---|
| 2538 | $$ = vl_create_case_item(CaseItem, $1, $3); |
---|
| 2539 | } |
---|
| 2540 | | YYDEFAULT ':' statement |
---|
| 2541 | { |
---|
| 2542 | YYTRACE("case_item: YYDEFAULT ':' statement"); |
---|
| 2543 | $$ = vl_create_case_item(DefaultItem, (lsList)0, $3); |
---|
| 2544 | } |
---|
| 2545 | | YYDEFAULT statement |
---|
| 2546 | { |
---|
| 2547 | YYTRACE("case_item: YYDEFAULT statement"); |
---|
| 2548 | $$ = vl_create_case_item(DefaultItem, (lsList)0, $2); |
---|
| 2549 | } |
---|
| 2550 | ; |
---|
| 2551 | |
---|
| 2552 | seq_block |
---|
| 2553 | : YYBEGIN statement_clr YYEND |
---|
| 2554 | { |
---|
| 2555 | YYTRACE("seq_block: YYBEGIN statement_clr YYEND"); |
---|
| 2556 | $$ = vl_create_begin_end_stmt(NIL(vl_id_range), LS_NH, $2); |
---|
| 2557 | } |
---|
| 2558 | | YYBEGIN ':' name_of_block block_declaration_clr statement_clr YYEND |
---|
| 2559 | { |
---|
| 2560 | YYTRACE("seq_block: YYBEGIN ':' name_of_block block_declaration_clr statement_clr YYEND"); |
---|
| 2561 | $$ = vl_create_begin_end_stmt($3, $4, $5); |
---|
| 2562 | } |
---|
| 2563 | ; |
---|
| 2564 | |
---|
| 2565 | par_block |
---|
| 2566 | : YYFORK statement_clr YYJOIN |
---|
| 2567 | { |
---|
| 2568 | YYTRACE("par_block: YYFORK statement_clr YYJOIN"); |
---|
| 2569 | $$ = vl_create_fork_join_stmt(NIL(vl_id_range), LS_NH, $2); |
---|
| 2570 | TODO("fork/join : dynamic process control"); |
---|
| 2571 | } |
---|
| 2572 | | YYFORK ':' name_of_block block_declaration_clr statement_clr YYJOIN |
---|
| 2573 | { |
---|
| 2574 | YYTRACE("par_block: YYFORK ':' name_of_block block_declaration_clr statement_clr YYJOIN"); |
---|
| 2575 | $$ = vl_create_fork_join_stmt($3, $4, $5); |
---|
| 2576 | TODO("fork/join : dynamic process control"); |
---|
| 2577 | } |
---|
| 2578 | ; |
---|
| 2579 | |
---|
| 2580 | name_of_block |
---|
| 2581 | : YYIDE |
---|
| 2582 | { |
---|
| 2583 | YYTRACE("name_of_block: YYIDE"); |
---|
| 2584 | $$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range)); |
---|
| 2585 | } |
---|
| 2586 | ; |
---|
| 2587 | |
---|
| 2588 | block_declaration_clr |
---|
| 2589 | : |
---|
| 2590 | { |
---|
| 2591 | YYTRACE("block_declaration_clr:"); |
---|
| 2592 | $$ = lsCreate(); |
---|
| 2593 | } |
---|
| 2594 | | block_declaration_clr block_declaration |
---|
| 2595 | { |
---|
| 2596 | lsHandle handle; |
---|
| 2597 | |
---|
| 2598 | YYTRACE("block_declaration_clr: block_declaration_clr block_declaration"); |
---|
| 2599 | lsNewEnd($1, (lsGeneric)$2, &handle); |
---|
| 2600 | $$ = $1; |
---|
| 2601 | } |
---|
| 2602 | ; |
---|
| 2603 | |
---|
| 2604 | block_declaration |
---|
| 2605 | : parameter_declaration |
---|
| 2606 | { |
---|
| 2607 | YYTRACE("block_declaration: parameter_declaration"); |
---|
| 2608 | $$ = (typestructPtr)$1; |
---|
| 2609 | } |
---|
| 2610 | | reg_declaration |
---|
| 2611 | { |
---|
| 2612 | YYTRACE("block_declaration: reg_declaration"); |
---|
| 2613 | $$ = (typestructPtr)$1; |
---|
| 2614 | } |
---|
| 2615 | | integer_declaration |
---|
| 2616 | { |
---|
| 2617 | YYTRACE("block_declaration: integer_declaration"); |
---|
| 2618 | $$ = (typestructPtr)$1; |
---|
| 2619 | } |
---|
| 2620 | | real_declaration |
---|
| 2621 | { |
---|
| 2622 | YYTRACE("block_declaration: real_declaration"); |
---|
| 2623 | $$ = (typestructPtr)$1; |
---|
| 2624 | } |
---|
| 2625 | | time_declaration |
---|
| 2626 | { |
---|
| 2627 | YYTRACE("block_delcaration: time_declaration"); |
---|
| 2628 | $$ = (typestructPtr)$1; |
---|
| 2629 | } |
---|
| 2630 | | event_declaration |
---|
| 2631 | { |
---|
| 2632 | YYTRACE("block_declaration: event_declaration"); |
---|
| 2633 | $$ = (typestructPtr)$1; |
---|
| 2634 | } |
---|
| 2635 | ; |
---|
| 2636 | |
---|
| 2637 | |
---|
| 2638 | task_enable |
---|
| 2639 | : YYIDE |
---|
| 2640 | { |
---|
| 2641 | $<idrng>$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range)); |
---|
| 2642 | } |
---|
| 2643 | ';' |
---|
| 2644 | { |
---|
| 2645 | YYTRACE("task_enable: YYIDE ';'"); |
---|
| 2646 | $$ = vl_create_task_enable_stmt(TaskEnableStmt, $<idrng>2, (lsList)0); |
---|
| 2647 | } |
---|
| 2648 | | YYIDE |
---|
| 2649 | { |
---|
| 2650 | $<idrng>$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range)); |
---|
| 2651 | } |
---|
| 2652 | '(' expression_list ')' ';' |
---|
| 2653 | { |
---|
| 2654 | YYTRACE("task_enable: YYIDE '(' expression_list ')' ';'"); |
---|
| 2655 | $$ = vl_create_task_enable_stmt(TaskEnableStmt, $<idrng>2, $4); |
---|
| 2656 | } |
---|
| 2657 | ; |
---|
| 2658 | |
---|
| 2659 | system_task_enable |
---|
| 2660 | : name_of_system_task ';' |
---|
| 2661 | { |
---|
| 2662 | YYTRACE("system_task_enable: name_of_system_task ';'"); |
---|
| 2663 | } |
---|
| 2664 | | name_of_system_task '(' expression_list ')' ';' |
---|
| 2665 | { |
---|
| 2666 | YYTRACE("system_task_enable: name_of_system_task '(' expression_list ')'"); |
---|
| 2667 | } |
---|
| 2668 | ; |
---|
| 2669 | |
---|
| 2670 | name_of_system_task |
---|
| 2671 | : system_identifier |
---|
| 2672 | { |
---|
| 2673 | YYTRACE("name_of_system_task: system_identifier"); |
---|
| 2674 | } |
---|
| 2675 | ; |
---|
| 2676 | |
---|
| 2677 | |
---|
| 2678 | |
---|
| 2679 | specify_block |
---|
| 2680 | : YYSPECIFY specify_item_clr YYENDSPECIFY |
---|
| 2681 | { |
---|
| 2682 | YYTRACE("specify_block: YYSPECIFY specify_item_clr YYENDSPECIFY"); |
---|
| 2683 | TODO("specify_block: YYSPECIFY specify_item_clr YYENDSPECIFY"); |
---|
| 2684 | } |
---|
| 2685 | ; |
---|
| 2686 | |
---|
| 2687 | specify_item_clr |
---|
| 2688 | : |
---|
| 2689 | | specify_item_clr specify_item |
---|
| 2690 | ; |
---|
| 2691 | |
---|
| 2692 | specify_item |
---|
| 2693 | : specparam_declaration |
---|
| 2694 | | path_declaration |
---|
| 2695 | | level_sensitive_path_declaration |
---|
| 2696 | | edge_sensitive_path_declaration |
---|
| 2697 | | system_timing_check |
---|
| 2698 | ; |
---|
| 2699 | |
---|
| 2700 | specparam_declaration |
---|
| 2701 | : YYSPECPARAM assignment_list ';' |
---|
| 2702 | ; |
---|
| 2703 | |
---|
| 2704 | path_declaration |
---|
| 2705 | : path_description '=' path_delay_value ';' |
---|
| 2706 | ; |
---|
| 2707 | |
---|
| 2708 | |
---|
| 2709 | |
---|
| 2710 | path_description |
---|
| 2711 | : '(' specify_terminal_descriptor YYLEADTO specify_terminal_descriptor ')' |
---|
| 2712 | | '(' path_list YYALLPATH path_list_or_edge_sensitive_path_list ')' |
---|
| 2713 | ; |
---|
| 2714 | |
---|
| 2715 | path_list |
---|
| 2716 | : specify_terminal_descriptor |
---|
| 2717 | | path_list ',' specify_terminal_descriptor |
---|
| 2718 | ; |
---|
| 2719 | |
---|
| 2720 | specify_terminal_descriptor |
---|
| 2721 | : YYIDE |
---|
| 2722 | | YYIDE '[' expression ']' |
---|
| 2723 | | YYIDE '[' expression ';' expression ']' |
---|
| 2724 | ; |
---|
| 2725 | |
---|
| 2726 | path_list_or_edge_sensitive_path_list |
---|
| 2727 | : path_list |
---|
| 2728 | | '(' path_list ',' specify_terminal_descriptor |
---|
| 2729 | polarity_operator YYCONDITIONAL |
---|
| 2730 | expression ')' |
---|
| 2731 | ; |
---|
| 2732 | |
---|
| 2733 | path_delay_value |
---|
| 2734 | : path_delay_expression |
---|
| 2735 | | '(' path_delay_expression ',' path_delay_expression ')' |
---|
| 2736 | | '(' path_delay_expression ',' path_delay_expression ',' |
---|
| 2737 | path_delay_expression ')' |
---|
| 2738 | | '(' path_delay_expression ',' path_delay_expression ',' |
---|
| 2739 | path_delay_expression ',' path_delay_expression ',' |
---|
| 2740 | path_delay_expression ',' path_delay_expression ')' |
---|
| 2741 | ; |
---|
| 2742 | |
---|
| 2743 | path_delay_expression |
---|
| 2744 | : expression |
---|
| 2745 | { |
---|
| 2746 | } |
---|
| 2747 | ; |
---|
| 2748 | |
---|
| 2749 | system_timing_check |
---|
| 2750 | : YYsysSETUP '(' ')' ';' |
---|
| 2751 | ; |
---|
| 2752 | |
---|
| 2753 | level_sensitive_path_declaration |
---|
| 2754 | : YYIF '(' expression ')' |
---|
| 2755 | '(' specify_terminal_descriptor polarity_operator_opt YYLEADTO |
---|
| 2756 | spec_terminal_desptr_or_edge_sensitive_spec_terminal_desptr |
---|
| 2757 | | YYIF '(' expression ')' |
---|
| 2758 | '(' path_list ',' specify_terminal_descriptor |
---|
| 2759 | polarity_operator_opt YYALLPATH path_list ')' |
---|
| 2760 | path_list '=' path_delay_value ';' |
---|
| 2761 | ; |
---|
| 2762 | |
---|
| 2763 | spec_terminal_desptr_or_edge_sensitive_spec_terminal_desptr |
---|
| 2764 | : specify_terminal_descriptor ')' path_list '=' path_delay_value ';' |
---|
| 2765 | | '(' specify_terminal_descriptor polarity_operator YYCONDITIONAL |
---|
| 2766 | expression ')' ')' '=' path_delay_value ';' |
---|
| 2767 | ; |
---|
| 2768 | |
---|
| 2769 | polarity_operator_opt |
---|
| 2770 | : |
---|
| 2771 | | polarity_operator |
---|
| 2772 | ; |
---|
| 2773 | |
---|
| 2774 | polarity_operator |
---|
| 2775 | : '+' |
---|
| 2776 | | '-' |
---|
| 2777 | ; |
---|
| 2778 | |
---|
| 2779 | edge_sensitive_path_declaration |
---|
| 2780 | : '(' specify_terminal_descriptor YYLEADTO |
---|
| 2781 | '(' specify_terminal_descriptor polarity_operator YYCONDITIONAL |
---|
| 2782 | expression ')' ')' '=' path_delay_value ';' |
---|
| 2783 | | '(' edge_identifier specify_terminal_descriptor YYLEADTO |
---|
| 2784 | '(' specify_terminal_descriptor polarity_operator YYCONDITIONAL |
---|
| 2785 | expression ')' ')' '=' path_delay_value ';' |
---|
| 2786 | | '(' edge_identifier specify_terminal_descriptor YYALLPATH |
---|
| 2787 | '(' path_list ',' specify_terminal_descriptor |
---|
| 2788 | polarity_operator YYCONDITIONAL |
---|
| 2789 | expression ')' ')' '=' path_delay_value ';' |
---|
| 2790 | | YYIF '(' expression ')' |
---|
| 2791 | '(' specify_terminal_descriptor YYALLPATH |
---|
| 2792 | '(' path_list ',' specify_terminal_descriptor |
---|
| 2793 | polarity_operator YYCONDITIONAL |
---|
| 2794 | expression ')' ')' '=' path_delay_value ';' |
---|
| 2795 | | YYIF '(' expression ')' |
---|
| 2796 | '(' edge_identifier specify_terminal_descriptor YYLEADTO |
---|
| 2797 | '(' specify_terminal_descriptor polarity_operator YYCONDITIONAL |
---|
| 2798 | expression ')' ')' '=' path_delay_value ';' |
---|
| 2799 | | YYIF '(' expression ')' |
---|
| 2800 | '(' edge_identifier specify_terminal_descriptor YYALLPATH |
---|
| 2801 | '(' path_list ',' specify_terminal_descriptor |
---|
| 2802 | polarity_operator YYCONDITIONAL |
---|
| 2803 | expression ')' ')' '=' path_delay_value ';' |
---|
| 2804 | ; |
---|
| 2805 | |
---|
| 2806 | edge_identifier |
---|
| 2807 | : YYPOSEDGE |
---|
| 2808 | | YYNEGEDGE |
---|
| 2809 | ; |
---|
| 2810 | |
---|
| 2811 | |
---|
| 2812 | |
---|
| 2813 | lvalue |
---|
| 2814 | : identifier |
---|
| 2815 | { |
---|
| 2816 | YYTRACE("lvalue: YYIDE"); |
---|
| 2817 | $$ = vl_create_lval(IDExpr, $1, |
---|
| 2818 | NIL(vl_range), (lsList)0); |
---|
| 2819 | } |
---|
| 2820 | | identifier '[' expression ']' |
---|
| 2821 | { |
---|
| 2822 | YYTRACE("lvalue: YYIDE '[' expression ']'"); |
---|
| 2823 | $$ = vl_create_lval(BitSelExpr, $1, |
---|
| 2824 | vl_create_range($3, NIL(vl_expr)), |
---|
| 2825 | (lsList)0); |
---|
| 2826 | } |
---|
| 2827 | | identifier '[' expression ':' expression ']' |
---|
| 2828 | { |
---|
| 2829 | YYTRACE("lvalue: YYIDE'[' expression ':' expression ']'"); |
---|
| 2830 | $$ = vl_create_lval(PartSelExpr, $1, |
---|
| 2831 | vl_create_range($3, $5), (lsList)0); |
---|
| 2832 | } |
---|
| 2833 | | concatenation |
---|
| 2834 | { |
---|
| 2835 | YYTRACE("lvalue: concatenation"); |
---|
| 2836 | $$ = vl_create_lval(ConcatExpr, NIL(vl_id_range), NIL(vl_range), $1); |
---|
| 2837 | } |
---|
| 2838 | ; |
---|
| 2839 | |
---|
| 2840 | mintypmax_expression_list |
---|
| 2841 | : mintypmax_expression |
---|
| 2842 | { |
---|
| 2843 | lsHandle handle; |
---|
| 2844 | |
---|
| 2845 | YYTRACE("mintypmax_expression_list: mintypmax_expression"); |
---|
| 2846 | $$ = lsCreate(); |
---|
| 2847 | lsNewEnd($$, (lsGeneric)$1, &handle); |
---|
| 2848 | } |
---|
| 2849 | | mintypmax_expression_list ',' mintypmax_expression |
---|
| 2850 | { |
---|
| 2851 | lsHandle handle; |
---|
| 2852 | |
---|
| 2853 | YYTRACE("mintypmax_expression_list: mintypmax_expression_list ',' mintypmax_expression"); |
---|
| 2854 | lsNewEnd($1, (lsGeneric)$3, &handle); |
---|
| 2855 | $$ = $1; |
---|
| 2856 | } |
---|
| 2857 | ; |
---|
| 2858 | |
---|
| 2859 | mintypmax_expression |
---|
| 2860 | : expression |
---|
| 2861 | { |
---|
| 2862 | YYTRACE("mintypmax_expression: expression"); |
---|
| 2863 | $$ = vl_create_expr(MinTypMaxExpr, 0, (double)0.0, |
---|
| 2864 | $1, NIL(vl_expr), NIL(vl_expr)); |
---|
| 2865 | } |
---|
| 2866 | | expression ':' expression |
---|
| 2867 | { |
---|
| 2868 | YYTRACE("mintypmax_expression: expression ':' expression"); |
---|
| 2869 | $$ = vl_create_expr(MinTypMaxExpr, 0, (double)0.0, |
---|
| 2870 | $1, $3, NIL(vl_expr)); |
---|
| 2871 | } |
---|
| 2872 | | expression ':' expression ':' expression |
---|
| 2873 | { |
---|
| 2874 | YYTRACE("mintypmax_expression: expression ':' expression ':' expression"); |
---|
| 2875 | $$ = vl_create_expr(MinTypMaxExpr, 0, (double)0.0, |
---|
| 2876 | $1, $3, $5); |
---|
| 2877 | } |
---|
| 2878 | ; |
---|
| 2879 | |
---|
| 2880 | expression_list |
---|
| 2881 | : expression |
---|
| 2882 | { |
---|
| 2883 | lsHandle handle; |
---|
| 2884 | |
---|
| 2885 | YYTRACE("expression_list: expression"); |
---|
| 2886 | $$ = lsCreate(); |
---|
| 2887 | lsNewEnd($$, (lsGeneric)$1, &handle); |
---|
| 2888 | } |
---|
| 2889 | | expression_list ',' expression |
---|
| 2890 | { |
---|
| 2891 | lsHandle handle; |
---|
| 2892 | |
---|
| 2893 | YYTRACE("expression_list: expression_list ',' expression"); |
---|
| 2894 | $$ = lsCreate(); |
---|
| 2895 | lsNewEnd($1, (lsGeneric)$3, &handle); |
---|
| 2896 | $$ = $1; |
---|
| 2897 | } |
---|
| 2898 | ; |
---|
| 2899 | |
---|
| 2900 | expression |
---|
| 2901 | : primary |
---|
| 2902 | { |
---|
| 2903 | YYTRACE("expression: primary"); |
---|
| 2904 | } |
---|
| 2905 | | '+' primary %prec YYUNARYOPERATOR |
---|
| 2906 | { |
---|
| 2907 | YYTRACE("expression: '+' primary %prec YYUNARYOPERATOR"); |
---|
| 2908 | $$ = vl_create_expr(UplusExpr, 0, (double)0.0, |
---|
| 2909 | $2, NIL(vl_expr), NIL(vl_expr)); |
---|
| 2910 | } |
---|
| 2911 | | '-' primary %prec YYUNARYOPERATOR |
---|
| 2912 | { |
---|
| 2913 | YYTRACE("expression: '-' primary %prec YYUNARYOPERATOR"); |
---|
| 2914 | $$ = vl_create_expr(UminusExpr, 0, (double)0.0, |
---|
| 2915 | $2, NIL(vl_expr), NIL(vl_expr)); |
---|
| 2916 | |
---|
| 2917 | } |
---|
| 2918 | | '!' primary %prec YYUNARYOPERATOR |
---|
| 2919 | { |
---|
| 2920 | YYTRACE("expression: '!' primary %prec YYUNARYOPERATOR"); |
---|
| 2921 | $$ = vl_create_expr(UnotExpr, 0, (double)0.0, |
---|
| 2922 | $2, NIL(vl_expr), NIL(vl_expr)); |
---|
| 2923 | |
---|
| 2924 | } |
---|
| 2925 | | '~' primary %prec YYUNARYOPERATOR |
---|
| 2926 | { |
---|
| 2927 | YYTRACE("expression: '~' primary %prec YYUNARYOPERATOR"); |
---|
| 2928 | $$ = vl_create_expr(UcomplExpr, 0, (double)0.0, |
---|
| 2929 | $2, NIL(vl_expr), NIL(vl_expr)); |
---|
| 2930 | } |
---|
| 2931 | | '&' primary %prec YYUNARYOPERATOR |
---|
| 2932 | { |
---|
| 2933 | YYTRACE("expression: '&' primary %prec YYUNARYOPERATOR"); |
---|
| 2934 | $$ = vl_create_expr(UandExpr, 0, (double)0.0, |
---|
| 2935 | $2, NIL(vl_expr), NIL(vl_expr)); |
---|
| 2936 | } |
---|
| 2937 | | '|' primary %prec YYUNARYOPERATOR |
---|
| 2938 | { |
---|
| 2939 | YYTRACE("expression: '|' primary %prec YYUNARYOPERATOR"); |
---|
| 2940 | $$ = vl_create_expr(UorExpr, 0, (double)0.0, |
---|
| 2941 | $2, NIL(vl_expr), NIL(vl_expr)); |
---|
| 2942 | } |
---|
| 2943 | | '^' primary %prec YYUNARYOPERATOR |
---|
| 2944 | { |
---|
| 2945 | YYTRACE("expression: '^' primary %prec YYUNARYOPERATOR"); |
---|
| 2946 | $$ = vl_create_expr(UxorExpr, 0, (double)0.0, |
---|
| 2947 | $2, NIL(vl_expr), NIL(vl_expr)); |
---|
| 2948 | } |
---|
| 2949 | | YYLOGNAND primary %prec YYUNARYOPERATOR |
---|
| 2950 | { |
---|
| 2951 | YYTRACE("expression: YYLOGNAND primary %prec YYUNARYOPERATOR"); |
---|
| 2952 | $$ = vl_create_expr(UnandExpr, 0, (double)0.0, |
---|
| 2953 | $2, NIL(vl_expr), NIL(vl_expr)); |
---|
| 2954 | } |
---|
| 2955 | | YYLOGNOR primary %prec YYUNARYOPERATOR |
---|
| 2956 | { |
---|
| 2957 | YYTRACE("expression: YYLOGNOR primary %prec YYUNARYOPERATOR"); |
---|
| 2958 | $$ = vl_create_expr(UnorExpr, 0, (double)0.0, |
---|
| 2959 | $2, NIL(vl_expr), NIL(vl_expr)); |
---|
| 2960 | } |
---|
| 2961 | | YYLOGXNOR primary %prec YYUNARYOPERATOR |
---|
| 2962 | { |
---|
| 2963 | YYTRACE("expression: YYLOGXNOR primary %prec YYUNARYOPERATOR"); |
---|
| 2964 | $$ = vl_create_expr(UxnorExpr, 0, (double)0.0, |
---|
| 2965 | $2, NIL(vl_expr), NIL(vl_expr)); |
---|
| 2966 | } |
---|
| 2967 | | expression '+' expression |
---|
| 2968 | { |
---|
| 2969 | YYTRACE("expression: expression '+' expression"); |
---|
| 2970 | $$ = vl_create_expr(BplusExpr, 0, (double)0.0, |
---|
| 2971 | $1, $3, NIL(vl_expr)); |
---|
| 2972 | } |
---|
| 2973 | | expression '-' expression |
---|
| 2974 | { |
---|
| 2975 | YYTRACE("expression: expressio '-' expression"); |
---|
| 2976 | $$ = vl_create_expr(BminusExpr, 0, (double)0.0, |
---|
| 2977 | $1, $3, NIL(vl_expr)); |
---|
| 2978 | } |
---|
| 2979 | | expression '*' expression |
---|
| 2980 | { |
---|
| 2981 | YYTRACE("expression: expression '*' expression"); |
---|
| 2982 | $$ = vl_create_expr(BtimesExpr, 0, (double)0.0, |
---|
| 2983 | $1, $3, NIL(vl_expr)); |
---|
| 2984 | } |
---|
| 2985 | | expression '/' expression |
---|
| 2986 | { |
---|
| 2987 | YYTRACE("expression: expression '/' expression"); |
---|
| 2988 | $$ = vl_create_expr(BdivExpr, 0, (double)0.0, |
---|
| 2989 | $1, $3, NIL(vl_expr)); |
---|
| 2990 | } |
---|
| 2991 | | expression '%' expression |
---|
| 2992 | { |
---|
| 2993 | YYTRACE("expression: expression '%' expression"); |
---|
| 2994 | $$ = vl_create_expr(BremExpr, 0, (double)0.0, |
---|
| 2995 | $1, $3, NIL(vl_expr)); |
---|
| 2996 | } |
---|
| 2997 | | expression YYLOGEQUALITY type_action_expr expression |
---|
| 2998 | { |
---|
| 2999 | YYTRACE("expression: expression YYLOGEQUALITY expression"); |
---|
| 3000 | $$ = vl_create_expr(Beq2Expr, 0, (double)0.0, |
---|
| 3001 | $1, $4, NIL(vl_expr)); |
---|
| 3002 | pop_stack(vl_cur_type_stack, (void **) &aux_st); |
---|
| 3003 | } |
---|
| 3004 | | expression YYLOGINEQUALITY type_action_expr expression |
---|
| 3005 | { |
---|
| 3006 | YYTRACE("expression: expression YYLOGINEQUALITY expression"); |
---|
| 3007 | $$ = vl_create_expr(Bneq2Expr, 0, (double)0.0, |
---|
| 3008 | $1, $4, NIL(vl_expr)); |
---|
| 3009 | pop_stack(vl_cur_type_stack, (void **) &aux_st); |
---|
| 3010 | } |
---|
| 3011 | | expression YYCASEEQUALITY type_action_expr expression |
---|
| 3012 | { |
---|
| 3013 | YYTRACE("expression: expression YYCASEEQUALITY expression"); |
---|
| 3014 | $$ = vl_create_expr(Beq3Expr, 0, (double)0.0, |
---|
| 3015 | $1, $4, NIL(vl_expr)); |
---|
| 3016 | pop_stack(vl_cur_type_stack, (void **) &aux_st); |
---|
| 3017 | } |
---|
| 3018 | | expression YYCASEINEQUALITY type_action_expr expression |
---|
| 3019 | { |
---|
| 3020 | YYTRACE("expression: expression YYCASEINEQUALITY expression"); |
---|
| 3021 | $$ = vl_create_expr(Bneq3Expr, 0, (double)0.0, |
---|
| 3022 | $1, $4, NIL(vl_expr)); |
---|
| 3023 | pop_stack(vl_cur_type_stack, (void **) &aux_st); |
---|
| 3024 | } |
---|
| 3025 | | expression YYLOGAND expression |
---|
| 3026 | { |
---|
| 3027 | YYTRACE("expression: expression YYLOGAND expression"); |
---|
| 3028 | $$ = vl_create_expr(BlandExpr, 0, (double)0.0, |
---|
| 3029 | $1, $3, NIL(vl_expr)); |
---|
| 3030 | } |
---|
| 3031 | | expression YYLOGOR expression |
---|
| 3032 | { |
---|
| 3033 | YYTRACE("expression: expression YYLOGOR expression"); |
---|
| 3034 | $$ = vl_create_expr(BlorExpr, 0, (double)0.0, |
---|
| 3035 | $1, $3, NIL(vl_expr)); |
---|
| 3036 | } |
---|
| 3037 | | expression '<' expression |
---|
| 3038 | { |
---|
| 3039 | YYTRACE("expression: expression '<' expression"); |
---|
| 3040 | $$ = vl_create_expr(BltExpr, 0, (double)0.0, |
---|
| 3041 | $1, $3, NIL(vl_expr)); |
---|
| 3042 | } |
---|
| 3043 | | expression '>' expression |
---|
| 3044 | { |
---|
| 3045 | YYTRACE("expression: expression '>' expression"); |
---|
| 3046 | $$ = vl_create_expr(BgtExpr, 0, (double)0.0, |
---|
| 3047 | $1, $3, NIL(vl_expr)); |
---|
| 3048 | } |
---|
| 3049 | | expression '&' expression |
---|
| 3050 | { |
---|
| 3051 | YYTRACE("expression: expression '&' expression"); |
---|
| 3052 | $$ = vl_create_expr(BandExpr, 0, (double)0.0, |
---|
| 3053 | $1, $3, NIL(vl_expr)); |
---|
| 3054 | } |
---|
| 3055 | | expression '|' expression |
---|
| 3056 | { |
---|
| 3057 | YYTRACE("expression: expression '|' expression"); |
---|
| 3058 | $$ = vl_create_expr(BorExpr, 0, (double)0.0, |
---|
| 3059 | $1, $3, NIL(vl_expr)); |
---|
| 3060 | } |
---|
| 3061 | | expression '^' expression |
---|
| 3062 | { |
---|
| 3063 | YYTRACE("expression: expression '^' expression"); |
---|
| 3064 | $$ = vl_create_expr(BxorExpr, 0, (double)0.0, |
---|
| 3065 | $1, $3, NIL(vl_expr)); |
---|
| 3066 | } |
---|
| 3067 | | expression YYLEQ expression |
---|
| 3068 | { |
---|
| 3069 | YYTRACE("expression: expression YYLEQ expression"); |
---|
| 3070 | $$ = vl_create_expr(BleExpr, 0, (double)0.0, |
---|
| 3071 | $1, $3, NIL(vl_expr)); |
---|
| 3072 | } |
---|
| 3073 | | expression YYNBASSIGN expression |
---|
| 3074 | { |
---|
| 3075 | YYTRACE("expression: expression YYLEQ expression"); |
---|
| 3076 | $$ = vl_create_expr(BleExpr, 0, (double)0.0, |
---|
| 3077 | $1, $3, NIL(vl_expr)); |
---|
| 3078 | } |
---|
| 3079 | | expression YYGEQ expression |
---|
| 3080 | { |
---|
| 3081 | YYTRACE("expression: expression YYGEQ expression"); |
---|
| 3082 | $$ = vl_create_expr(BgeExpr, 0, (double)0.0, |
---|
| 3083 | $1, $3, NIL(vl_expr)); |
---|
| 3084 | } |
---|
| 3085 | | expression YYLSHIFT expression |
---|
| 3086 | { |
---|
| 3087 | YYTRACE("expression: expression YYLSHIFT expression"); |
---|
| 3088 | $$ = vl_create_expr(BlshiftExpr, 0, (double)0.0, |
---|
| 3089 | $1, $3, NIL(vl_expr)); |
---|
| 3090 | } |
---|
| 3091 | | expression YYRSHIFT expression |
---|
| 3092 | { |
---|
| 3093 | YYTRACE("expression: expression YYRSHIFT expression"); |
---|
| 3094 | $$ = vl_create_expr(BrshiftExpr, 0, (double)0.0, |
---|
| 3095 | $1, $3, NIL(vl_expr)); |
---|
| 3096 | } |
---|
| 3097 | | expression YYLOGXNOR expression |
---|
| 3098 | { |
---|
| 3099 | YYTRACE("expression: expression YYLOGXNOR expression"); |
---|
| 3100 | $$ = vl_create_expr(BxnorExpr, 0, (double)0.0, |
---|
| 3101 | $1, $3, NIL(vl_expr)); |
---|
| 3102 | } |
---|
| 3103 | | expression '?' expression ':' expression |
---|
| 3104 | { |
---|
| 3105 | YYTRACE("expression: expression '?' expression ':' expression"); |
---|
| 3106 | $$ = vl_create_expr(TcondExpr, 0, (double)0.0, |
---|
| 3107 | $1, $3, $5); |
---|
| 3108 | } |
---|
| 3109 | | YYSTRING |
---|
| 3110 | { |
---|
| 3111 | YYTRACE("expression: YYSTRING"); |
---|
| 3112 | $$ = vl_create_expr(StringExpr, 0, (double)0.0, |
---|
| 3113 | vlStrdup(yytext), NIL(vl_expr), NIL(vl_expr)); |
---|
| 3114 | TODO("<string> is not supported in generated FSMs"); |
---|
| 3115 | } |
---|
| 3116 | ; |
---|
| 3117 | |
---|
| 3118 | primary |
---|
| 3119 | : YYINUMBER |
---|
| 3120 | { |
---|
| 3121 | YYTRACE("primary: YYINUMBER"); |
---|
| 3122 | if (strchr(yytext, '\'')) { |
---|
| 3123 | $$ = vl_create_expr(BitExpr, 0, (double)0.0, |
---|
| 3124 | (void*)bexp1, (void*)bexp0, (void*)vlStrdup(brep)); |
---|
| 3125 | } else { |
---|
| 3126 | $$ = vl_create_expr(IntExpr, atoi(yytext), (double)0.0, |
---|
| 3127 | NIL(vl_expr), NIL(vl_expr), NIL(vl_expr)); |
---|
| 3128 | } |
---|
| 3129 | } |
---|
| 3130 | | YYRNUMBER |
---|
| 3131 | { |
---|
| 3132 | YYTRACE("primary: YYRNUMBER"); |
---|
| 3133 | $$ = vl_create_expr(RealExpr, 0, atof(yytext), |
---|
| 3134 | NIL(vl_expr), NIL(vl_expr), NIL(vl_expr)); |
---|
| 3135 | } |
---|
| 3136 | | identifier |
---|
| 3137 | { |
---|
| 3138 | YYTRACE("primary: identifier"); |
---|
| 3139 | $$ = vl_create_expr(IDExpr, 0, (double)0.0, |
---|
| 3140 | $1, NIL(vl_expr), NIL(vl_expr)); |
---|
| 3141 | } |
---|
| 3142 | | identifier '[' expression ']' |
---|
| 3143 | { |
---|
| 3144 | YYTRACE("primary: identifier '[' expression ']'"); |
---|
| 3145 | $$ = vl_create_expr(BitSelExpr, 0, (double)0.0, |
---|
| 3146 | vl_create_id_range($1->name, |
---|
| 3147 | vl_create_range($3, NIL(vl_expr))), |
---|
| 3148 | NIL(vl_expr), NIL(vl_expr)); |
---|
| 3149 | } |
---|
| 3150 | | identifier '[' expression ':' expression ']' |
---|
| 3151 | { |
---|
| 3152 | YYTRACE("primary: identifier '[' expression ':' expression ']'"); |
---|
| 3153 | $$ = vl_create_expr(BitSelExpr, 0, (double)0.0, |
---|
| 3154 | vl_create_id_range($1->name, |
---|
| 3155 | vl_create_range($3, $5)), |
---|
| 3156 | NIL(vl_expr), NIL(vl_expr)); |
---|
| 3157 | } |
---|
| 3158 | | concatenation |
---|
| 3159 | { |
---|
| 3160 | YYTRACE("primary: concatenation"); |
---|
| 3161 | $$ = vl_create_expr(ConcatExpr, 0, (double)0.0, |
---|
| 3162 | $1, NIL(vl_expr), NIL(vl_expr)); |
---|
| 3163 | } |
---|
| 3164 | | multiple_concatenation |
---|
| 3165 | { |
---|
| 3166 | YYTRACE("primary: multiple_concatenatin"); |
---|
| 3167 | $$ = vl_create_expr(ConcatExpr, 0, (double)0.0, |
---|
| 3168 | $1->concat, $1->rep, NIL(vl_expr)); |
---|
| 3169 | vl_chk_free((char*)$1); |
---|
| 3170 | } |
---|
| 3171 | | function_call |
---|
| 3172 | { |
---|
| 3173 | YYTRACE("primary: function_call"); |
---|
| 3174 | } |
---|
| 3175 | | '(' mintypmax_expression ')' |
---|
| 3176 | { |
---|
| 3177 | YYTRACE("primary: '(' mintypmax_expression ')'"); |
---|
| 3178 | $$ = $2; |
---|
| 3179 | } |
---|
| 3180 | |
---|
| 3181 | | YYsysID '(' nondeterminism_list ')' |
---|
| 3182 | { |
---|
| 3183 | YYTRACE("primary: YYsysID '(' nondeterminism_list ')'"); |
---|
| 3184 | TODO("System task (\"$sys-task(...)\")"); |
---|
| 3185 | } |
---|
| 3186 | | YYsysND '(' nondeterminism_list ')' |
---|
| 3187 | { |
---|
| 3188 | $$ = vl_create_expr(NondExpr, 0, (double)0.0, |
---|
| 3189 | $3, NIL(vl_expr), NIL(vl_expr)); |
---|
| 3190 | if ($$ == NIL(vl_expr)) |
---|
| 3191 | yyerror("unsynchronized nondeterministic wire"); |
---|
| 3192 | } |
---|
| 3193 | ; |
---|
| 3194 | |
---|
| 3195 | nondeterminism_list |
---|
| 3196 | : event_control |
---|
| 3197 | { |
---|
| 3198 | YYTRACE("nondeterminism_list : event_control"); |
---|
| 3199 | $$ = lsCreate(); |
---|
| 3200 | lsNewEnd($$, (lsGeneric)$1, 0); |
---|
| 3201 | } |
---|
| 3202 | | expression |
---|
| 3203 | { |
---|
| 3204 | YYTRACE("nondeterminism_list : expression"); |
---|
| 3205 | $$ = lsCreate(); |
---|
| 3206 | lsNewEnd($$, (lsGeneric)$1, 0); |
---|
| 3207 | } |
---|
| 3208 | | nondeterminism_list ',' event_control |
---|
| 3209 | { |
---|
| 3210 | YYTRACE("nondeterminism_list : nondeterminism_list ',' event_control"); |
---|
| 3211 | lsNewEnd($$, (lsGeneric)$3, 0); |
---|
| 3212 | } |
---|
| 3213 | | nondeterminism_list ',' expression |
---|
| 3214 | { |
---|
| 3215 | YYTRACE("nondeterminism_list : nondeterminism_list ',' expression"); |
---|
| 3216 | lsNewEnd($$, (lsGeneric)$3, 0); |
---|
| 3217 | } |
---|
| 3218 | ; |
---|
| 3219 | |
---|
| 3220 | |
---|
| 3221 | |
---|
| 3222 | concatenation |
---|
| 3223 | : '{' expression_list '}' |
---|
| 3224 | { |
---|
| 3225 | YYTRACE("concatenation: '{' expression_list '}'"); |
---|
| 3226 | $$ = $2; |
---|
| 3227 | } |
---|
| 3228 | ; |
---|
| 3229 | |
---|
| 3230 | multiple_concatenation |
---|
| 3231 | : '{' expression '{' expression_list '}' '}' |
---|
| 3232 | { |
---|
| 3233 | YYTRACE("multiple_concatenation: '{' expression '{' expression_list '}' '}'"); |
---|
| 3234 | $$ = vl_create_mconcat($2,$4); |
---|
| 3235 | } |
---|
| 3236 | ; |
---|
| 3237 | |
---|
| 3238 | function_call |
---|
| 3239 | : identifier '(' expression_list ')' |
---|
| 3240 | { |
---|
| 3241 | YYTRACE("function_call: identifier '(' expression_list ')'"); |
---|
| 3242 | $$ = vl_create_expr(FuncExpr, 0, (double)0.0, |
---|
| 3243 | $1, $3, NIL(void)); |
---|
| 3244 | } |
---|
| 3245 | |
---|
| 3246 | ; |
---|
| 3247 | |
---|
| 3248 | system_identifier |
---|
| 3249 | : YYsysID |
---|
| 3250 | ; |
---|
| 3251 | |
---|
| 3252 | |
---|
| 3253 | |
---|
| 3254 | identifier |
---|
| 3255 | : YYIDE |
---|
| 3256 | { |
---|
| 3257 | YYTRACE("identifier: YYIDE"); |
---|
| 3258 | $$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range)); |
---|
| 3259 | } |
---|
| 3260 | | identifier '.' YYIDE |
---|
| 3261 | { |
---|
| 3262 | YYTRACE("identifier: identifier '.' YYIDE"); |
---|
| 3263 | TODO("identifier: identifier '.' YYIDE --> cross hierarchy access"); |
---|
| 3264 | } |
---|
| 3265 | ; |
---|
| 3266 | |
---|
| 3267 | delay_opt |
---|
| 3268 | : |
---|
| 3269 | { |
---|
| 3270 | YYTRACE("delay_opt:"); |
---|
| 3271 | $$ = NIL(vl_delay); |
---|
| 3272 | } |
---|
| 3273 | | delay |
---|
| 3274 | { |
---|
| 3275 | YYTRACE("delay_opt: delay"); |
---|
| 3276 | } |
---|
| 3277 | ; |
---|
| 3278 | |
---|
| 3279 | delay |
---|
| 3280 | : '#' YYINUMBER |
---|
| 3281 | { |
---|
| 3282 | vl_expr *expr; |
---|
| 3283 | |
---|
| 3284 | YYTRACE("delay: '#' YYINUMBER"); |
---|
| 3285 | expr = vl_create_expr(IntExpr, atoi(yytext), (double)0.0, |
---|
| 3286 | NIL(void), NIL(void), NIL(void)); |
---|
| 3287 | $$ = vl_create_delay(expr, NIL(vl_expr), NIL(vl_expr)); |
---|
| 3288 | } |
---|
| 3289 | | '#' YYRNUMBER |
---|
| 3290 | { |
---|
| 3291 | vl_expr *expr; |
---|
| 3292 | |
---|
| 3293 | YYTRACE("delay: '#' YYRNUMBER"); |
---|
| 3294 | expr = vl_create_expr(IntExpr, 0, atof(yytext), |
---|
| 3295 | NIL(void), NIL(void), NIL(void)); |
---|
| 3296 | $$ = vl_create_delay(expr, NIL(vl_expr), NIL(vl_expr)); |
---|
| 3297 | } |
---|
| 3298 | | '#' identifier |
---|
| 3299 | { |
---|
| 3300 | vl_expr *expr; |
---|
| 3301 | |
---|
| 3302 | YYTRACE("delay: '#' identifier"); |
---|
| 3303 | expr = vl_create_expr(IDExpr, 0, (double)0.0, |
---|
| 3304 | $2, NIL(void), NIL(void)); |
---|
| 3305 | $$ = vl_create_delay(expr, NIL(vl_expr), NIL(vl_expr)); |
---|
| 3306 | } |
---|
| 3307 | | '#' '(' mintypmax_expression ')' |
---|
| 3308 | { |
---|
| 3309 | YYTRACE("delay: '#' '(' mintypmax_expression ')'"); |
---|
| 3310 | $$ = vl_create_delay($3, NIL(vl_expr), NIL(vl_expr)); |
---|
| 3311 | } |
---|
| 3312 | | '#' '(' mintypmax_expression ',' mintypmax_expression ')' |
---|
| 3313 | { |
---|
| 3314 | YYTRACE("delay: '#' '(' mintypmax_expression ',' mintypmax_expression ')'"); |
---|
| 3315 | $$ = vl_create_delay($3, $5, NIL(vl_expr)); |
---|
| 3316 | } |
---|
| 3317 | | '#' '(' mintypmax_expression ',' mintypmax_expression ',' |
---|
| 3318 | mintypmax_expression ')' |
---|
| 3319 | { |
---|
| 3320 | YYTRACE("delay: '#' '(' mintypmax_expression ',' mintypmax_expression ',' mintypmax_expression ')'"); |
---|
| 3321 | $$ = vl_create_delay($3, $5, $7); |
---|
| 3322 | } |
---|
| 3323 | ; |
---|
| 3324 | |
---|
| 3325 | delay_control |
---|
| 3326 | : '#' YYINUMBER |
---|
| 3327 | { |
---|
| 3328 | vl_expr *expr; |
---|
| 3329 | |
---|
| 3330 | YYTRACE("delay_control: '#' YYINUMBER"); |
---|
| 3331 | expr = vl_create_expr(IntExpr, atoi(yytext), (double)0.0, |
---|
| 3332 | NIL(void), NIL(void), NIL(void)); |
---|
| 3333 | $$ = vl_create_delay(expr, NIL(vl_expr), NIL(vl_expr)); |
---|
| 3334 | timed_statement = 1; |
---|
| 3335 | } |
---|
| 3336 | | '#' YYRNUMBER |
---|
| 3337 | { |
---|
| 3338 | vl_expr *expr; |
---|
| 3339 | |
---|
| 3340 | YYTRACE("delay_control: '#' YYRNUMBER"); |
---|
| 3341 | expr = vl_create_expr(RealExpr, 0, atof(yytext), |
---|
| 3342 | NIL(void), NIL(void), NIL(void)); |
---|
| 3343 | $$ = vl_create_delay(expr, NIL(vl_expr), NIL(vl_expr)); |
---|
| 3344 | timed_statement = 1; |
---|
| 3345 | } |
---|
| 3346 | | '#' identifier |
---|
| 3347 | { |
---|
| 3348 | vl_expr *expr; |
---|
| 3349 | |
---|
| 3350 | YYTRACE("delay_control: '#' identifier"); |
---|
| 3351 | expr = vl_create_expr(IDExpr, 0, (double)0.0, |
---|
| 3352 | $2, NIL(void), NIL(void)); |
---|
| 3353 | $$ = vl_create_delay(expr, NIL(vl_expr), NIL(vl_expr)); |
---|
| 3354 | timed_statement = 1; |
---|
| 3355 | } |
---|
| 3356 | | '#' '(' mintypmax_expression_list ')' |
---|
| 3357 | { |
---|
| 3358 | YYTRACE("delay_control: '#' '(' mintypmax_expression ')'"); |
---|
| 3359 | $$ = vl_create_delay((vl_expr*)$3, NIL(vl_expr), (vl_expr*)$3); |
---|
| 3360 | timed_statement = 1; |
---|
| 3361 | } |
---|
| 3362 | ; |
---|
| 3363 | |
---|
| 3364 | event_control |
---|
| 3365 | : '@' identifier |
---|
| 3366 | { |
---|
| 3367 | vl_exprPtr expr; |
---|
| 3368 | |
---|
| 3369 | YYTRACE("event_control: '@' identifier"); |
---|
| 3370 | expr = vl_create_expr(IDExpr, 0, (double)0.0, |
---|
| 3371 | $2, NIL(vl_expr), NIL(vl_expr)); |
---|
| 3372 | $$ = vl_create_event_expr(EventExpr, expr); |
---|
| 3373 | timed_statement = 1; |
---|
| 3374 | } |
---|
| 3375 | | '@' '(' event_expression ')' |
---|
| 3376 | { |
---|
| 3377 | YYTRACE("event_control: '@' '(' event_expression ')'"); |
---|
| 3378 | $$ = $3; |
---|
| 3379 | timed_statement = 1; |
---|
| 3380 | } |
---|
| 3381 | | '@' '(' ored_event_expression ')' |
---|
| 3382 | { |
---|
| 3383 | YYTRACE("event_control: '@' '(' ored_event_expression ')'"); |
---|
| 3384 | $$ = $3; |
---|
| 3385 | timed_statement = 1; |
---|
| 3386 | } |
---|
| 3387 | ; |
---|
| 3388 | |
---|
| 3389 | |
---|
| 3390 | event_expression |
---|
| 3391 | : expression |
---|
| 3392 | { |
---|
| 3393 | YYTRACE("event_expression: expression"); |
---|
| 3394 | $$ = vl_create_event_expr(EventExpr, $1); |
---|
| 3395 | } |
---|
| 3396 | | YYPOSEDGE expression |
---|
| 3397 | { |
---|
| 3398 | YYTRACE("event_expression: YYPOSEDGE expression"); |
---|
| 3399 | $$ = vl_create_event_expr(PosedgeEventExpr, $2); |
---|
| 3400 | } |
---|
| 3401 | | YYNEGEDGE expression |
---|
| 3402 | { |
---|
| 3403 | YYTRACE("event_expression: YYNEGEDGE expression"); |
---|
| 3404 | $$ = vl_create_event_expr(NegedgeEventExpr, $2); |
---|
| 3405 | } |
---|
| 3406 | | YYEDGE expression |
---|
| 3407 | { |
---|
| 3408 | YYTRACE("event_expression: YYEDGE expression"); |
---|
| 3409 | $$ = vl_create_event_expr(EdgeEventExpr, $2); |
---|
| 3410 | } |
---|
| 3411 | ; |
---|
| 3412 | |
---|
| 3413 | ored_event_expression |
---|
| 3414 | : event_expression YYOR event_expression |
---|
| 3415 | { |
---|
| 3416 | lsList event_list; |
---|
| 3417 | YYTRACE("ored_event_expression: event_expression YYOR event_expression"); |
---|
| 3418 | event_list = lsCreate(); |
---|
| 3419 | lsNewEnd(event_list, (lsGeneric)$1, LS_NH); |
---|
| 3420 | lsNewEnd(event_list, (lsGeneric)$3, LS_NH); |
---|
| 3421 | $$ = vl_create_event_expr(OrEventExpr, NIL(vl_expr)); |
---|
| 3422 | $$->list = event_list; |
---|
| 3423 | } |
---|
| 3424 | | ored_event_expression YYOR event_expression |
---|
| 3425 | { |
---|
| 3426 | YYTRACE("ored_event_expression: ored_event_expression YYOR event_expression"); |
---|
| 3427 | lsNewEnd($1->list, (lsGeneric)$3, LS_NH); |
---|
| 3428 | $$ = $1; |
---|
| 3429 | } |
---|
| 3430 | ; |
---|
| 3431 | |
---|
| 3432 | %% |
---|
| 3433 | |
---|
| 3434 | void yyerror(str) |
---|
| 3435 | char *str; |
---|
| 3436 | { |
---|
| 3437 | fprintf(stderr, "%s : (line:%d;file:%s) token :'%s', ", |
---|
| 3438 | str, yylineno, vl_filename, |
---|
| 3439 | #ifndef _snake |
---|
| 3440 | (yytypetoken[0])?yytypetoken:yytext |
---|
| 3441 | #else |
---|
| 3442 | (yytypetoken[0])?yytypetoken:(char*)yytext |
---|
| 3443 | #endif |
---|
| 3444 | ); |
---|
| 3445 | fprintf(stderr, "yacc token : '%s'\n", yytext); |
---|
| 3446 | if (vl_currentModule) |
---|
| 3447 | fprintf(stderr, "unexpected token '%s' seen in module '%s'\n", |
---|
| 3448 | #ifndef _snake |
---|
| 3449 | (yytypetoken[0])?yytypetoken:yytext, |
---|
| 3450 | #else |
---|
| 3451 | (yytypetoken[0])?yytypetoken:(char*)yytext, |
---|
| 3452 | #endif |
---|
| 3453 | vl_currentModule->name->name); |
---|
| 3454 | exit (1); |
---|
| 3455 | } |
---|