I feel that with respect to operation of fork join and fork join_any with wait fork, both will serve the same purpose. That is the operation is same.
Fork_join :
module main ;
initial
begin
#(10);
$display(" BEFORE fork time = %2d ",$time );
fork
begin
$display("current time in Thread-1 is %0t",$time);
# (20);
$display("Thread-1 time = %2d # 20 ",$time );
end
begin
$display("current time in Thread-2 is %0t",$time);
#(10);
$display("Thread-2 time = %2d # 10 ",$time );
end
begin
$display("current time in Thread-3 is %0t",$time);
$display("Thread-3 time = %2d # 5 ",$time );
end
join
$display("time = %2d Outside the main fork ",$time );
end
endmodule
wait fork program:
module main ;
initial
begin
#(10);
$display(" BEFORE fork time = %2d ",$time );
fork
begin
$display("current time in Thread-1 is %0t",$time);
# (20);
$display("Thread-1 time = %2d # 20 ",$time );
end
begin
$display("current time in Thread-2 is %0t",$time);
#(10);
$display("Thread-2 time = %2d # 10 ",$time );
end
begin
$display("current time in Thread-3 is %0t",$time);
$display("Thread-3 time = %2d # 5 ",$time );
end
join_any
$display("time = %2d Outside the main fork ",$time );
wait fork;
$display("time = %2d After the wait fork ",$time );
end
endmodule
Please correct me if i am wrong.
-Tarun