Hi,
consider the following code:
fork
begin
for(int i = 0; i < 10; i++)
begin
automatic int j = i;
fork
begin
forever
begin
@(evt_A[j]);
$display("AA");
end
forever
begin
@(evt_B[j]);
$display("BB");
end
end
join_none
end
end
join_none
Here the result I expected was:
AA
BB
(PS: I ensure that both evt_A and evt_B is triggered for some j).
But the above code did not give that outcome.
So when I rephrased the code to what I have shown below, I got the expected results. Could anyone pls explain why the first code couldn’t quite cut it right.
fork
begin
for(int i = 0; i < 10; i++)
begin
automatic int j = i;
fork
begin
forever
begin
@(evt_A[j]);
$display("AA");
end
end
join_none
end
end
begin
for(int i = 0; i < 10; i++)
begin
automatic int j = i;
fork
begin
forever
begin
@(evt_B[j]);
$display("BB");
end
end
join_none
end
end
join_none
Thanks in advance for the help!