Hello,
I have written the following assertion for the above mentioned statement,
module assertions(clk,req,done,start);
input bit clk;
input bit req;
input bit done;
input bit start;
default clocking cb @(posedge clk); endclocking
**
property should_be_max_two_requests_in_ten_cycles(cb,sig0,sig1,sig2);
@(cb) (sig0 ##1 sig1[=2] ##1 sig2) within 1’b1[*10];
endproperty: should_be_max_two_requests_in_ten_cycles
ASSERTION_2_label: assert property (should_be_max_two_requests_in_ten_cycles(cb,start,req,done))
$display(“time=%2t: {A2}Two requests in ten cycles”, $time);
else $error(“time=%2t: {A2}One or more than two requests in ten cycles”, $time);**
endmodule
Testbench:
module testbench();
bit clk, req, done,start;
assertions A (.*);
initial forever clk= #5 ~clk;
bit [1:0] req_count;
initial begin
$vcdpluson();
req = 0;
done = 0;
start = 0;
#2 start = 1;;
for (int i=0;i<10;i++) begin
#10;
req = $urandom_range(0,1);
if (req == 1’b1) req_count++;
if (req_count > 2’b10) done = 1;
end
#100; $finish;
end
endmodule
When tested against various testcases, the assertion fails to through error when there are more than two requests in 10 cycles. I am unsure about the non-consecutive repetition that I used.
Can anyone help me in fixing this.
Thank You.
Regards,
Ramakrishna Melgiri