2015 DVClub Austin - SVA Tutorial - and - SVA Planning PDF
2015 DVClub Austin - SVA Tutorial - and - SVA Planning PDF
2015 DVClub Austin - SVA Tutorial - and - SVA Planning PDF
Austin TX
September 9, 2015
An immediate assertion is the same as an ifelse statement, but with assertion controls
Concurrent assertions have an extensive set of operators to describe complex design conditions
9-8
Assertions in a UVM testbench should use the UVM message functions, such as
uvm_report_warning and uvm_report_error, so that the messages are tracked by UVM
9-9
This glitch within a clock cycle will This glitch within a clock cycle
affect my design functionality I will never be stored in my
need to detect it. registers I can ignore it.
clk
req 1 2 3 4
ack
apReqAck F SF F
The fix for this gotcha is something called an implication operator (see next page)
9-14
Conditioning Sequences Using
Implication Operators
A sequence can be conditioned with an implication operator
If the condition is true, the sequence is evaluated
If the condition is false, the sequence is not evaluated (a dont care)
The |=> (non-overlapped implication) is the same as |-> ##1 (overlapped plus 1 cycle)
9-15
Implication Terminology
property p_handshake;
@(posedge clk) implication operator
request |=> acknowledge ##1 data_enable ##2 done;
endproperty: p_handshake
consequent (or effect) only
evaluated if antecedent succeeds
9-16
Using Concurrent Assertions
with Zero-delay RTL Models
In RTL models, most signals change on a clock edge
RTL models are typically modeled with zero delay
Register outputs change immediately on the clock edge
0 10 20 30 40 50
clk property p_req_ack;
@(posedge clk)
req req |-> ##2 ack ##1 !ack;
endproperty: p_req_ack
ack
ap_req_ack: assert property (p_req_ack);
Spec 2: A req (request) should be followed two cycles later by a rising edge of ack
(acknowledge). The ack is only allowed to be high for one clock cycle.
9-18
Special functions test for a value change between adjacent clock cycles:
$rose(expression, cycle_definition);
Returns true if the LSB of the expression changed to 1 These functions evaluate
sampled values they
$fell(expression, cycle_definition); compare the value that was
Returns true if the LSB of the expression changed to 0 sampled at the beginning
$changed(expression, cycle_definition); of the previous clock cycle
Returns true if the value of the expression changed with the value that was
$stable(expression, cycle_definition); sampled at the beginning
Returns true if the value of the expression did not change of the current clock cycle
The cycle_definition is optional and seldom needed (see notes below); It specifies what
clock to use for sampling the expression (e.g.: $rose(ack, @posedge master_clk) )
Design Spec: A req (request) should be followed two cycles later by a rising edge
of ack (acknowledge). The ack is only allowed to be high for one clock cycle.
The paper
Who Put Assertions In My RTL Code? And Why
has examples of these types of assertions
Several registers
decoder
controller
A program counter status_reg
ram
4k x 16
addr [11:0] data [15:0]
rdN
wrN
rstN
The controller is a 1-hot finite state machine that sets the control
lines for the various DSP blocks
rstN is asynchronous the controller resets to the RESET state
Functionality to Verify Assertion Type Assigned To
The instruction input never has X or Z bits immediate design team
At a positive edge of clk, state is always 1-hot concurrent verification team
If in DECODE state, then the prior state was RESET or STORE concurrent verification team
If in LOAD state, then the prior state was DECODE concurrent verification team
If in STORE state, then the prior state was LOAD concurrent verification team
9-36
Assertion Test Plan
Considerations
Some things to think about when developing an Assertions Test
Plan include
It takes time to write the assertions test plan
It is not a trivial task, but it is critical to successfully using SVA!
The assertion test plan helps identify similar assertions
Can write an assertion once, and use it in several places
Assertions should not just duplicate the RTL code
Engineers need to learn to think differently
Which assertions should be disabled for reset or lower-power mode?
False assertion failures can occur if they are not disabled
The test plan needs to be flexible
Some times the responsibility for which team should write the
assertion needs to change
9-37
More Assertion Test Plan
Considerations
Assertions may require different design partitioning
Example: The DSP ALU block is difficult to check with concurrent
assertions because it is pure combinational logic (no clock)
Better design partitioning would put the ALU and its input and output
registers into one design block
Enumerated type definitions should be defined globally
Example: If the DSP state machine uses a local enumerated variable
for the state names, then assertions written external to the state
machine cannot access those enumerated names
Enumerated types should have explicit values defined for each label
After synthesis, labels disappear and only logic values exist
Assertions become invalid if the label does not have an explicit value
Do It!
9-38
Summary