Automatic variables in fork

In reply to dave_59:

Hi Dave, with regard to fork join_none, I have gone through some threads asked in the forum but I still don’t understand why in this code j = 0 is not getting printed. Would you please help me understand this?


module top;
	initial begin
		for (int j=0; j<3; j++) begin
			#1;
			fork
				$display($time, "  j = %0d",j);
			join_none
		end
	end
endmodule

Result:


                   1  j = 1
                   2  j = 2
                   3  j = 3