Hi There,
My question is when req goes high my counter need to start counting soon after getting corresponding grant for my request I need to stop my counter. I written my code using combintaion of fork join with stimulus generation and check block. simulator is going to loop can any one help me what is the issue in my code.
module top;
logic req, gnt;
bit clk = 1;
int unsigned counter = 0;
bit disable_fork_bit;
always #5 clk = ~clk;
initial
begin
fork
begin : stimulus_generation_block
@(posedge clk);
req = 1;
repeat(5)
begin
@(posedge clk);
end
gnt = 1;
end : stimulus_generation_block
begin : check
fork
@(posedge clk)
if(req == 1)
forever
fork
@(posedge clk)
counter ++;
if(gnt == 1);
begin
disable_fork_bit = 1;
end
join
join
end : check
join_any
wait(disable_fork_bit == 1);
disable fork;
$display("counter = %d", counter);
end
endmodule