Merge pull request #603 from larsclausen/unnamed-fork-variable-decl

Allow unnamed parallel block with only variable declarations
This commit is contained in:
Stephen Williams 2022-02-06 09:49:11 -08:00 committed by GitHub
commit bc0fc4ab89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 6 deletions

View File

@ -0,0 +1,29 @@
// Check variable declarations in unnamed forks
// All of these should pass in SystemVerilog and all should fail in Verilog
module test;
initial fork
integer x;
join
initial fork
integer x;
integer y;
join
initial fork
integer x, y;
join
initial fork
integer x;
integer y;
x = y;
join
initial begin
$display("PASSED");
end
endmodule

View File

@ -83,6 +83,7 @@ resetall normal,-Wtimescale ivltests gold=resetall-fsv.gold
scope2b normal ivltests
sys_func_task_error RE ivltests gold=sys_func_task_error-fsv.gold
unnamed_block_var_decl normal ivltests
unnamed_fork_var_decl normal ivltests
# We do not run synthesis when forcing SystemVerilog so these pass
br995 normal ivltests

View File

@ -1677,6 +1677,7 @@ undef_lval_select4c CE ivltests
undef_lval_select5 normal ivltests
undefined_shift normal ivltests
unnamed_block_var_decl CE ivltests
unnamed_fork_var_decl CE ivltests
urand_r normal ivltests gold=urand_r.gold
urand_r2 normal ivltests gold=urand_r.gold
urand_r3 normal ivltests gold=urand_r.gold

View File

@ -6652,11 +6652,6 @@ statement_item /* This is roughly statement_item in the LRM */
need to do is remember that this is a parallel block so that the
code generator can do the right thing. */
| K_fork join_keyword
{ PBlock*tmp = new PBlock($2);
FILE_NAME(tmp, @1);
$$ = tmp;
}
/* In SystemVerilog an unnamed block can contain variable declarations. */
| K_fork
{ PBlock*tmp = pform_push_block_scope(@1, 0, PBlock::BL_PAR);
@ -6677,7 +6672,7 @@ statement_item /* This is roughly statement_item in the LRM */
delete tmp;
}
}
statement_or_null_list join_keyword
statement_or_null_list_opt join_keyword
{ PBlock*tmp;
if ($3) {
pform_pop_scope();