Hi ,
Please help me the following code,
module fork_join_any_process();
int me[3];
task automatic print_value;
input [7:0] value;
input [7:0] delay;
begin
$display("Waiting Passed value %d",value);
#(delay) $display("@%g Passed Value %d Delay %d",
$time, value, delay);
end
endtask
initial begin
me[0] = 1;
me[1] = 2;
me[2] = 3;
repeat(5) begin
fork
foreach(me[i])
fork automatic int id = me[i]; print_value (10+id,id); join_none
foreach(me[i])
fork automatic int id = me[i]; print_value (20+id,id); join_none
// wait fork;
join_any
disable fork;
$display(" Disable Fork ");
// for (int i = 0 ; i < 3 ;i++) begin
// fork
// print_value (10+i,7);
// print_value (20+i,7);
// print_value (30+i,7);
// join_any
// if ( i < 2 ) begin
// print_value (50+i,7);
// print_value (60+i,7);
// end
// end
end
$display("@%g Came out of fork-join", $time);
#20 $finish;
end
endmodule
Expecting the output as:
Waiting Passed value 11
Waiting Passed value 12
Waiting Passed value 13
Waiting Passed value 21
Waiting Passed value 22
Waiting Passed value 23
@1 Passed Value 11 Delay 1
Disable fork
Waiting Passed value 11
Waiting Passed value 12
Waiting Passed value 13
Waiting Passed value 21
Waiting Passed value 22
Waiting Passed value 23
@1 Passed Value 11 Delay 1
But unable to get that, Please help me with this.
Thanks a lot !! ![]()