Hello,
my goal is to write some SVA code in order to detect whether a given signal ‘sig’ changes between 2 events, ‘start_ev’ and ‘end_ev’, that in general will be asynchronous with sig clock.
The idea is that the signal and the events should be part of a SV interface, but the events may be controlled by a UVM testbench. For example, end_ev could be triggered by a timeout (from here the necessity of asynchronicity).
A similar question had been asked before in:
logic a[1:0];
event start_ev, end_ev;
property p_stable(logic sig, event start_ev, event end_ev);
(reject_on (sig)
@(start_ev) 1'b1 |-> @(end_ev) 1'b1);
endproperty
property p_stable_spec;
p_stable(a[1], posedge(a[0]), negedge(a[0]));
endproperty
but the solution requires to hardwire, in the property, the expected value of sig, while that may change in different phases of the test.
I then ran into a paper by Doulos’s Doug Smith (http://www.doulos.com/knowhow/sysverilog/DVCon10_sva_paper/DVCon2010_AsyncSVA_paper.pdf), dealing with asynchronous SVAs, where this property is shown.
property p_stable(logic sig, event start_ev, event end_ev);
bit loc_sig;
@(start_ev) (1'b1, loc_sig = sig) ##1 @(end_ev or sig) (loc_sig == sig);
endproperty
The problem (highlighted in the paper) is that this solution does not work, because the value of sig in
@(end_ev or sig) (loc_sig == sig);
is sampled in the Preponed region, and not in the Reactive one (it’s essentially the value of sig before it changes).
Possible workarounds (listed in the paper) require to hardwire the name of the checked signal somewhere in the code.
I am asking here if someone knows a solution that does not require to duplicate much code if one has many properties of the same kind involving different signals.
Thanks in advance,
Lanfranco