In reply to chandnidodiya:
Where are you applying the assertion?
If it's in the interface then you can use my package at
https://verificationacademy.com/forums/systemverilog/sva-package-dynamic-and-range-delays-and-repeats
From the package you need to apply
sequence dynamic_delay(count);
int v;
(count<=0) or ((1, v=count) ##0 (v>0, v=v-1) [*0:$] ##1 v<=0);
endsequence // dynamic_delay
// in your interface
interface name;
import sva_delay_repeat_range_pkg::*;
int delay=2; // can be reassigned as needed later on
property p;
int v;
(1, v=input1) ##0 dynamic_delay(delay) ##0 output1==v;
endproperty
ap_dyn_delay: assert property(@(posedge clk) p);
From your code, it seems that you want to do the assertion from the class.
SVA does not support uses in classes, but you have 2 options:
- Copy the class variables into the virtual interface that has the SVA as shown above.
I addressed that in my paper SVA-in-a-UVM-Class-based-Environment
- Create a task that at every clock edge initiates a forked task that computes this assertion. Read my paper Understanding the SVA Engine (link to the paper is in my signature).
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
3) Papers:
- Understanding the SVA Engine,
https://verificationacademy.com/verification-horizons/july-2020-volume-16-issue-2
- Reflections on Users’ Experiences with SVA
https://verificationacademy.com/verification-horizons/march-2022-volume-18-issue-1/reflections-on-users-experiences-with-systemverilog-assertions-sva
- 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
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/