Note that this is the async accept_on that when true yields a vacuous result.
The action block resets the “cancel” bit to 0 on a pass or fail.
You don’t need the |-> or the l_source, l_target.
You may need the “timeunit 1ns; timeprecision 100ps;” // set values as needed
Your assertion checks that th 2 signals are in sync.
module tb;
bit source, target, cancel;
realtime calibration_value=0.1;
function void set_cancel(realtime src, trgt);
if(src>trgt) cancel=1;
else cancel=0;
endfunction
//disable assertion when source > target?
property p1;
//int l_source;
//int l_target;
realtime source_t;
realtime target_t;
@(posedge source) accept_on(cancel)
(1, source_t=$realtime, $display("**** Start **** \nsource_t=%0t",source_t)) ##0
@(posedge target) (1, target_t=$realtime, $display("target_t=%0t",target_t)) ##0
(1, set_cancel(source_t, target_t)) ##0
//(1, l_source=int'(source_t)) |->
// (1, l_target=int'(target_t)) |->
(source_t -target_t) == calibration_value;
endproperty
assert property (p1) begin
set_cancel(1.0, 1.0); // reset cancel on pass
$display("----- End -----");
end
else
begin
set_cancel(1.0, 1.0); // reset on fail
$display("----- End -----");
end
endmodule
// Suppose that we create two properties. Also assume that the shift
// between source and target is such that there is no all 0 gap, i.e., there is overlap.
property p1;
realtime source_t;
realtime target_t;
@(posedge source) // source is first
(!target, source_t=$realtime, $display("**** Start **** \nsource_t=%0t",source_t)) ##0
@(posedge target) (1, target_t=$realtime, $display("target_t=%0t",target_t)) |->
(target_t - source_t) <= calibration_value; //Should be a bound, not exct value
endproperty
property p2;
realtime source_t;
realtime target_t;
@(posedge target)
(!source, target_t=$realtime, $display("**** Start **** \ntarget_t=%0t",target_t)) ##0
@(posedge source_t) (1, source_t=$realtime, $display("source_t=%0t",source_t)) |->
(source_t -target_t) <= calibration_value;
endproperty
assert_property(p1 and p2) ; // or as two separate assertions.
// Would that work? If there is no overlap to start with, we could perhaps try something
// with killing one property if the other one completes. not sure.