Requirement : I want the threads to spawn in a forever block , and the number of threads is parametererised.
Problem facing : The below code is only executing for the i=0 ; Can you please help me whats the bug in the code , and how it should be changed to meet my requirement
module fork_join_none;
initial begin
$display("-----------------------------------------------------------------");
for (int i = 0;i < 5;i++) begin
automatic int j = i;
$display("----------------------------------i=%0d----------------",i);
fork: label_1
// automatic int j=i;
begin
test1(j);
end
join_none
end
end
task test1(int j);
forever begin
#5;
$display("!!PORT %d!!! delay task started %t ",j,$time);
#5;
$display("!!PORT %d!!! after delay %t ",j,$time);
end
endtask
initial begin
#1000;
$finish();
end
endmodule