0
\$\begingroup\$

I would like to write the following in SVA (SystemVerilog Assertion) format.

signal a should never be 2 until it attains the value 1

How can we do that?

\$\endgroup\$
  • 4
    \$\begingroup\$ Sorry, I cant help it, this triggers immediately: "Four shalt thou not count, neither count thou two, excepting that thou then proceed to three." \$\endgroup\$ – Oldfart Sep 22 at 7:42
  • 1
    \$\begingroup\$ ... Five is right out! \$\endgroup\$ – Dave Tweed Sep 22 at 13:16
  • 1
    \$\begingroup\$ For the clueless: montypython.net/scripts/HG-handgrenade.php \$\endgroup\$ – dave_59 Sep 25 at 10:37
2
\$\begingroup\$

Such a condition requires a state machine, and cannot be done with simple assertions alone. You need to build the state machine, and then make an assertion that certain transitions cannot occur within that state machine.

\$\endgroup\$
  • \$\begingroup\$ Do you mean state machine in the Verilog design or state machine in the SVA property (is that possible)? \$\endgroup\$ – vineeshvs Sep 23 at 6:13
  • \$\begingroup\$ I just showed a very simple assertion. \$\endgroup\$ – dave_59 Sep 25 at 9:30
2
\$\begingroup\$
property p;
  @(posedge clk) (A != 2) until (A == 1);
endproperty

assert property (p);
\$\endgroup\$
  • \$\begingroup\$ Another related question: I want to generate the counter-example for this property. When I try assert property (not(p)) for that purpose, it says syntax error. Is there an issue with using not with until? \$\endgroup\$ – vineeshvs Sep 25 at 14:04
  • \$\begingroup\$ Another doubt: How can I write the following in SVA? not(a until b) without using until or s_until. \$\endgroup\$ – vineeshvs Sep 25 at 15:14
  • 1
    \$\begingroup\$ You cannot use parenthesis () with property expressions. \$\endgroup\$ – dave_59 Sep 25 at 16:56
  • \$\begingroup\$ Okay. What would be the recommended way if we want to negate such a property? The objective here is to get the counterexample corresponding to the property (hence the negation). \$\endgroup\$ – vineeshvs Sep 26 at 6:43
  • 1
    \$\begingroup\$ Assert property ( not p) \$\endgroup\$ – dave_59 Sep 26 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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