Hi,
I am trying to write a SV checker to check for req ack protocol.
after seeing a req, i should see ack within 4 cycles.
To do this, i am using forever loops inside fork…join_any.
module req_ack;
bit req,ack,clk;
//logic clk;
int count;
always @ (posedge req) begin
fork
begin : label_1
$display("thread0");
forever @ (posedge clk)
begin
$display("saw clk");
count = count + 1;
$display("clk count is %0d", count);
if (count == 4) begin
$display("timeout for ack");
//disable label_2;
end
end
end
begin : label_2
forever @ (posedge ack)
begin
$display("received ack");
//disable label_1 ;
end
end
join_any
disable fork;
end
initial begin
#10;
req = 1;
#60;
ack = 1;
end
initial begin
# 100;
$finish;
end
initial clk = 0;
always #5 clk = ~clk;
endmodule
I see that this does not give expected results.
After hitting timeout, the disable fork does not kill the forever loops.
I tried using disable label which works fine but it is not a recommended approach.