HI All,
I am trying to kill all threads of specific fork join by using disable with label .
But,disable with label is not working for while loop.
class abc;
int a;
task run_phase();
fork :main
begin : wait_10t
$display("t=%0t , WAIT START",$realtime());
#10ns;
$display("t=%0t , WAIT END",$realtime());
end
begin : count_20t
while(a < 20) begin
$display("t=%0t , a=%0d",$realtime(),a);
a++;
#1ns;
end
end
join_any
disable main;
$display("TEST ENDED");
endtask
endclass
module tst;
abc a;
initial begin
a = new();
a.run_phase();
end
endmodule
Output :
t=0 , WAIT START
t=0 , a=0
t=1 , a=1
t=2 , a=2
t=3 , a=3
t=4 , a=4
t=5 , a=5
t=6 , a=6
t=7 , a=7
t=8 , a=8
t=9 , a=9
t=10 , WAIT END
TEST ENDED
t=10 , a=10
t=11 , a=11
t=12 , a=12
t=13 , a=13
t=14 , a=14
t=15 , a=15
t=16 , a=16
t=17 , a=17
t=18 , a=18
t=19 , a=19
Here,Disable fork is working fine but Its killing other test process hence I have used disable with label instead of disable fork .
Could anyone tell me that Its a valid way to disable with label or not to kill all the threads ?
Could you give other alternative logic to kill while loop ?
Thanks,
Prashant