Hi,
I have the following code with disable fork.
module parallel_threads;
initial begin
fork begin // Main fork
fork // child fork
fork // grandchild fork
#10$display("inside inside...", $time);
#20$display("inside inside...", $time);
join_none
#10 $display("Thread 1 line1...", $time);
$display("Thread 1 line2...", $time);
join_none
fork
$display("Thread 2 line1...", $time);
$display("Thread 2 line2..", $time);
join_none
fork
#1 $display("Thread 3 line1...", $time);
#1 $display("Thread 3 line2.", $time);
join_none
end
join
$display("came out of join", $time);
disable fork;
$display("disable", $time);
#100;
end
initial begin
#250;
$display($time,"\t sim ending\n");
$finish;
end
endmodule
Here, the disable fork is outside of the main fork. If my understanding is right, the disable fork will disable the main fork. But the main fork has 3 child forks and also 1 grandchild forks. why do I see that these are also disabled?
This is the output that I see:
came out of join 0
disable 0
250 sim ending