In my assertion, an offset should determine how much earlier to send a signal prior to a signal with value incrementing in every clock cycle. Below is my assertion.
The signal b value doesn’t match with the incrementing values in the waveform. I tried using $past as well but it doesn’t work. Any lead would be helpful.
Requiremens In my assertion, an offset should determine how much earlier to send a signal prior to a signal with value incrementing in every clock cycle.
That requirement is ambiguous. Do you mean to say: Following the rise of signal “a”, the 32-bit signal “b” should be incremented after an offset of a number of system clocks. The value of that offset is stored in an 8-bit register. During that offset time, signal “a” shall remain in the logical high state.
With the above requirements, I would write:
I understand that you hastily wrote your requirements for the assertion for this forum. However, requirements really need to be better defined. For your benefit and this audience, I recommend that you take a look at my book (below) that goes ito great details about defining requirements and verification plans. FREE BOOK: Component Design by Example
… A Step-by-Step Process Using VHDL with UART as Vehicle
Hi,
Thank you very much for your reply. I am sorry if my requirements were not clear. b is a signal which contains values incrementing from 0 to 10 and keeps repeating for the entire time. When the value of signal b changes, at that point signal a which is 1 bit should rise before an offset. rise of signal a should happen before every start time of values changing in signal b by an offset.
I tried your assertion but the value of b doesn’t change when offset becomes 0. Is there anyway I can find the change of b and check for signal a. I tried the below code too but it said illegal operand for constant expression
Good solution with one big EXCEPTION! $changed(b) |-> ($past(a,offset)==1);
Requires “offset” to be static and NOT dynamic. Thus
int offset=7;
let static_offset=6;
$changed(b) |-> ($past(a,offset)==1); // ERROR !!!!
$changed(b) |-> ($past(a,static_offset)==1); // OK
As a general comment, the above styles of assertions is generally of poor style because it is not forward looking. It is saying if something happens, then something else before that must have happened. I pefer the forward looking approach that says, if something happens, then now or later on something else must happen. My solution does that:
($rose(a), v_offset= offset, v_b=b) |-> // something happens
first_match((a,v_offset=v_offset - 1'b1)[*0:$] ##1 v_offset==0) ##0
// after an offset time set dynamically when that something did happen
$changed(b) && b==v_b+1'b1); // 2 other things happen