In reply to Moein75:
Dave,
Why is the following code NOT producing an error?
1800 9.3.2 Parallel blocks states
Variables declared in the block_item_declaration of a fork-join block shall be initialized to their initialization value expression whenever execution enters their scope and before any processes are spawned. Within a fork-join_any or fork-join_none block, it shall be illegal to refer to formal arguments passed by reference other than in the initialization value expressions of variables declared in a block_item_declaration of the fork.
module test;
initial begin
for(int i = 0; i < 16; i++)
begin
fork
//automatic int index =i ;
send(i); // am within a fork-join-any
// "i" is referring to formal argument "j" of function send
// "j" is a formal where actual is passed by reference
// All simulators give the same results
// Am I misunderstanding 1800?
join_any
end
wait fork;
end
function automatic void send( ref int j);
$display("driving %0d %t" , j, $realtime);
endfunction
endmodule
// Sim
# driving 0 0
# driving 1 0
# driving 2 0
...
# driving 15 0
# exit
Ben