class looped_process;
function new();
endfunction
task a_process(int val);
$display("val: %d",val);
endtask
task init_multi_process();
for(int i = 0; i < 20; i++)begin
fork
automatic int j = i;
begin
a_process(j);
end
join_none
end
endtask
endclass
module some;
looped_process inst1;
initial begin
inst1 = new();
inst1.init_multi_process();
end
endmodule
for this code I get the following output:
val: 19
val: 18
val: 17
val: 16
val: 15
val: 14
val: 13
val: 12
val: 11
val: 10
val: 9
val: 8
val: 7
val: 6
val: 5
val: 4
val: 3
val: 2
val: 1
val: 0
But I want it to print 0 to 19. Not 19 to 0. How can I do that?