In reply to warlocklw:
Try the accept_on
https://www.edaplayground.com/x/mSRK
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
Ben Cohen
http://www.systemverilog.us/
** SVA Handbook 4th Edition, 2016 ISBN 978-1518681448
...
1) SVA Package: Dynamic and range delays and repeats
https://rb.gy/a89jlh
2) Free books:
* Component Design by Example
https://rb.gy/9tcbhl
* Real Chip Design and Verification Using Verilog and VHDL($3)
https://rb.gy/cwy7nb
* A Pragmatic Approach to VMM Adoption
http://SystemVerilog.us/vf/VMM/VMM_pdf_release070506.ziphttp://SystemVerilog.us/vf/VMM/VMM_code_release_071806.tar
3) Papers:
Understanding the SVA Engine,
https://verificationacademy.com/verification-horizons/july-2020-volume-16-issue-2
Reflections on Users’ Experiences with SVA, part 1
https://verificationacademy.com/verification-horizons/march-2022-volume-18-issue-1/reflections-on-users-experiences-with-systemverilog-assertions-sva
Reflections on Users’ Experiences with SVA, part 2
https://verificationacademy.com/verification-horizons/july-2022-volume-18-issue-2/reflections-on-users-experiences-with-sva-part-2
SUPPORT LOGIC AND THE ALWAYS PROPERTY
http://systemverilog.us/vf/support_logic_always.pdf
SVA Alternative for Complex Assertions
https://verificationacademy.com/news/verification-horizons-march-2018-issue
SVA in a UVM Class-based Environment
https://verificationacademy.com/verification-horizons/february-2013-volume-9-issue-1/SVA-in-a-UVM-Class-based-Environment
SVA for statistical analysis of a weighted work-conserving prioritized round-robin arbiter.
https://verificationacademy.com/forums/coverage/sva-statistical-analysis-weighted-work-conserving-prioritized-round-robin-arbiter.
Udemy courses by Srinivasan Venkataramanan (
http://cvcblr.com/home.html)
https://www.udemy.com/course/sva-basic/https://www.udemy.com/course/sv-pre-uvm/