Hi,
is it necessary to use the process to disable the fork?
I have the following example.
module test;
initial begin
fork : fork_1
begin : begin_1_fork_1
#10ns;
$display("%s(%0d) @%0t : Fork_1 Process_1 Completed", `__FILE__, `__LINE__,$time);
end : begin_1_fork_1
begin : begin_2_fork_1
#25ns;
$display("%s(%0d) @%0t : Fork_1 Process_2 Completed", `__FILE__, `__LINE__,$time);
end : begin_2_fork_1
join_any : fork_1
$display("%s(%0d) @%0t : Disabling Fork_1", `__FILE__, `__LINE__,$time);
disable fork_1;
$display("%s(%0d) @%0t : Disabled Fork_1", `__FILE__, `__LINE__,$time);
end
initial begin
fork : fork_2
begin : begin_1_fork_2
#150ns;
$display("%s(%0d) @%0t : Fork_2 Process_1 Completed", `__FILE__, `__LINE__,$time);
end : begin_1_fork_2
begin : begin_2_fork_2
#125ns;
$display("%s(%0d) @%0t : Fork_2 Process_2 Completed", `__FILE__, `__LINE__,$time);
end : begin_2_fork_2
join_any : fork_2
$display("%s(%0d) @%0t : Disabling Fork_2", `__FILE__, `__LINE__,$time);
disable fork_2;
$display("%s(%0d) @%0t : Disabled Fork_2", `__FILE__, `__LINE__,$time);
end
endmodule : test
I have observed that for some of the simulators this code is working for some the code is not working. Can you please help?
Results
testbench.sv(10) @10 : Fork_1 Process_1 Completed
testbench.sv(18) @10 : Disabling Fork_1
testbench.sv(20) @10 : Disabled Fork_1
testbench.sv(14) @25 : Fork_1 Process_2 Completed
testbench.sv(31) @125 : Fork_2 Process_2 Completed
testbench.sv(35) @125 : Disabling Fork_2
testbench.sv(37) @125 : Disabled Fork_2
testbench.sv(27) @150 : Fork_2 Process_1 Completed