SV: Add support for var decls in unnamed fork/join* blocks.
SystemVerilog allows variables to be declared in unnamed fork/join* blocks. This patch adds support for this functionality.
This commit is contained in:
parent
8e7e3c7493
commit
0cbd6d99af
41
parse.y
41
parse.y
|
|
@ -5702,14 +5702,41 @@ statement_item /* This is roughly statement_item in the LRM */
|
||||||
FILE_NAME(tmp, @1);
|
FILE_NAME(tmp, @1);
|
||||||
$$ = tmp;
|
$$ = tmp;
|
||||||
}
|
}
|
||||||
| K_fork statement_or_null_list join_keyword
|
/* In SystemVerilog an unnamed block can contain variable declarations. */
|
||||||
// HERE
|
| K_fork
|
||||||
// Create an anonymous scope and if no definitions are found then delete
|
{ PBlock*tmp = pform_push_block_scope(0, PBlock::BL_PAR);
|
||||||
// the scope and use a simple block.
|
|
||||||
{ PBlock*tmp = new PBlock($3);
|
|
||||||
FILE_NAME(tmp, @1);
|
FILE_NAME(tmp, @1);
|
||||||
tmp->set_statement(*$2);
|
current_block_stack.push(tmp);
|
||||||
delete $2;
|
}
|
||||||
|
block_item_decls_opt
|
||||||
|
{ if ($3) {
|
||||||
|
if (! gn_system_verilog()) {
|
||||||
|
yyerror("error: Variable declaration in unnamed block "
|
||||||
|
"requires SystemVerilog.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* If there are no declarations in the scope then just delete it. */
|
||||||
|
pform_pop_scope();
|
||||||
|
assert(! current_block_stack.empty());
|
||||||
|
PBlock*tmp = current_block_stack.top();
|
||||||
|
current_block_stack.pop();
|
||||||
|
delete tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
statement_or_null_list join_keyword
|
||||||
|
{ PBlock*tmp;
|
||||||
|
if ($3) {
|
||||||
|
pform_pop_scope();
|
||||||
|
assert(! current_block_stack.empty());
|
||||||
|
tmp = current_block_stack.top();
|
||||||
|
current_block_stack.pop();
|
||||||
|
tmp->set_join_type($6);
|
||||||
|
} else {
|
||||||
|
tmp = new PBlock($6);
|
||||||
|
FILE_NAME(tmp, @1);
|
||||||
|
}
|
||||||
|
if ($5) tmp->set_statement(*$5);
|
||||||
|
delete $5;
|
||||||
$$ = tmp;
|
$$ = tmp;
|
||||||
}
|
}
|
||||||
| K_fork ':' IDENTIFIER
|
| K_fork ':' IDENTIFIER
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue