I want to write an assertion for the following requirement:
From state: FAULT_ID
To state : WAIT_STATE
Condition : The transition should happen only after 100ms delay
I heard that this kind of check can also be achieved using first_match constructs.
Is my approach correct?
Would first_match be a better option here?
Any recommended clean way to model this delay-based state transition?
There’s no need for first_match() here as you have only one variable involving simple boolean sequences.
Scaling $time* 1000000 is a mistake. 100ms gets scaled to the local timescale.
Timing checks should be performed using realtime and relational operators instead of equality. Achieving exact equality becomes extremely challenging due to the fact that getting the clock period precisely and accounting for rounding errors make it very difficult.
Is it a good idea to use $(real)time inside a property? Would it perhaps be better to count clock edges to check the condition in this case? What if the time of the state change differs due to clock variation?
It really depends on the source of the requirements. However, if you want to formally verify this assertion rather than through simulation, clock cycles would be a more appropriate.