I have a simple spec “A grant must at some time have been preceded by a request”
If grant arrives and request never arrives before grant, the assertion fails. Need to look in the past for request, but would not know when request would have arrived.
$past only looks in the ‘past’ a fixed number of clocks. How do you make it look in the past forever?
rose(req) ##[1:] 1’b1; // after the 1st req you get an endpoint at every cycle thereafter, till infinity.
The 1st attempt with the rose gnt would be OK. However,
$rose(gnt) |-> s_req.triggered;
with any 2nd, 3rd, …nth grant the assertion would would be immediately passed.
This is because the sequence (rose(req) ##[1:] 1’b1) is causing and endpoint at every cycle after the 1st rose of req
In reply to ben@SystemVerilog.us:
$rose(gnt) |-> s_req.triggered;
For the triggered solution to work, use this sequence declaration
sequence s_req;
@(posedge clk). // updated.
first_match($rose(req) ##[1:$] gnt; // ##1 1'b1); // endpoint 1 cycle after gnt
endsequence
// the endpoint of the sequence must end when
// the $rose(gnt) occurs
// Note: This solution has many threads for each successful attempt