In reply to vk7715:
Actually I am puzzled. Wrote this modified model.
What is weird is that the task is called 2 times with j==0 and then j==1
but it executes with j==1 and j==2
I used breakpoints and step-into to verify the actions.
Why?
module m;
// event a;
bit [0:9] done;
task automatic A(input int i);
$display("Task A. Time = %0t, i = %0d", $time, i);
done[i] = 1;
endtask
task automatic B(i);
$display("Task B. Time = %0t, i = %0d", $time, i);
endtask
task automatic t();
for (int j = 0; j <= 1; j++) begin
#10;
fork
A(j);
join_none
end
endtask
initial begin
t();
$display("sent t()");
wait (done == 10'b00_0000_0011);
$display("done=%b", done);
// @(a);
B(2);
end
endmodule
SIm results
run -all
# Task A. Time = 10, i = 1
# sent t()
# Task A. Time = 20, i = 2
# exit