Can $random be NBA assigned in a for loop to an unpacked array of variables?
int tmp  ;
always @ (posedge clk) begin
foreach (tmp[i]) begin
tmp[i] <= $urandom();
Using Cadence tools (with a bit more code involved), I get all 8 of tmp ints assigned the same value.
Can someone confirm whether this code is legal?
I have spoken to Cadence and been told this:
This use model of having $urandom call inside a non-blocking assignment is wrong.
The scheduling semantics of System Verilog dictates that the RHS is calculated and sampled once in the "inactive region" and then in the "NBA region" it's assigned the ALL of the elements of the foreach at the same time!