4
\$\begingroup\$

Suppose we have two signals: A and B. And we need to check that the rising edge of signal B is between 7.62ns and 7.77ns after the rising edge of signal A. In VHDL this can be done with two "wait-for-until" expressions.

  1. Is it possible to write this with the SystemVerilog Assertion?
  2. Is it possible to write this with the SystemVerilog Assertion without any additional clocks?
\$\endgroup\$

1 Answer 1

4
\$\begingroup\$

SystemVerilog does not have direct translation of the compound VHDL wait statements. The simple forms can be translated

  • wait for delay#delay
  • wait on A@A
  • wait until expressionwait (expression)

If you needed to combine some of these forms together, they can be put into a fork/join_any block

VHDL:

wait until sig = 15 for 10 ns;

SV:

fork
   wait(sig == 15);
   #10ns;
join_any

SystemVerilog Assertions are not the best construct to catch timing errors, but they can be used

property p;
  realtime timestamp;
  @(posedge a) ('1, timestamp = $realtime) |=> 
       @(posedge b) $realtime - timestamp inside {[7.62ns:7.77ns]};
endproperty
\$\endgroup\$
3
  • \$\begingroup\$ Am I right that the SV fork construction wait for the condition (sig==15) and THEN wait for 10ns and the VHDL wait-until-for construction wait 10ns waiting the condition (sig==15)? \$\endgroup\$
    – Arseniy
    Aug 19, 2022 at 16:12
  • 1
    \$\begingroup\$ @Arseniy: That's what it would do without a fork. \$\endgroup\$
    – Ben Voigt
    Aug 19, 2022 at 17:03
  • 1
    \$\begingroup\$ fork/join_any block creates a process for each statement inside the block and waits for any one of the processes to complete before continuing after the block. In this case it is simply an OR of the conditions before continuing. Note that it does not terminate the remaining processes. There are other construct that can do that. \$\endgroup\$
    – dave_59
    Aug 19, 2022 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.