Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handing reset in SystemVerilog assertions

How are the following two properties different?

property p1;
    @(posedge clk) disable iff (Reset) b ##1 c;
endproperty

property p2;
    @(posedge clk) (~Reset & b) ##1 c;
endproperty

assert property (p1);
assert property (p2);
like image 272
Ari Avatar asked Feb 20 '14 19:02

Ari


People also ask

What are the differences between immediate and concurrent assertions?

Immediate assertions can be placed in procedural code, but not in structural scopes, so the same combinational checker cannot be used in both contexts. Concurrent assertions in always blocks cannot report on intermediate values of variables when assigned more than once in sequential code in an always block.

What is $Past in SystemVerilog?

$past(signal_name, number of clock cycles) provides the value of the signal from the previous clock cycle. Below Property checks that, in the given positive clock edge, if the “b” is high, then 2 cycles before that, a was high.

What are the two types of immediate assertions?

In SystemVerilog there are two kinds of assertion: immediate (assert) and concurrent (assert property). Coverage statements (cover property) are concurrent and have the same syntax as concurrent assertions, as do assume property statements, which are primarily used by formal tools.

What is the default severity given when assertion fails?

By default, the severity of an assertion failure is “error”.


2 Answers

Very different.

In p1, Reset is asynchronous not sampled. At any time during the evaluation of p1, Reset becomes true, the property is disabled. While Reset is false, there is an attempt at every posedge clock to check that b is be true followed one clock cycle later, c is true for the attempt to pass, otherwise it fails. If at any time Reset becomes true, all active attempts are killed off.

In p2, Reset is synchronously sampled. There is an attempt at every posedge clock to check that ~Reset &b is be true followed one clock cycle later, c is true for the attempt to pass, otherwise it fails. The attempt will fail if Reset becomes true.

like image 196
dave_59 Avatar answered Sep 28 '22 08:09

dave_59


  • p1 has an asynchronous reset. At any port Reset is high any active p1 threads are aborted.
  • p2 only check Reset at the first clock. The assertion fails if Reset==1 or b==0.

Here are are two examples of ways to visual it.

clk   ‾‾‾\__/‾‾‾\__/‾‾‾
Reset _________/‾‾‾‾‾‾‾
b     ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
c     ‾‾‾‾‾‾‾‾‾\_______ c is asynchronously reset by Reset in this example
p1          .___        Assertion aborts on posedge Reset
p2          .______↓    Assertion fails
clk   ‾‾‾\__/‾‾‾\__/‾‾‾
Reset ____/‾‾‾‾‾‾‾‾‾‾‾‾
b     ‾‾‾‾‾‾‾\_________
c     ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
p1                      Assertion never starts
p2          ↓      ↓    Assertion fails
like image 36
Greg Avatar answered Sep 28 '22 08:09

Greg