3a AssertionsOverview PDF
3a AssertionsOverview PDF
User Experience
Matt Maidment, Intel
User Experience
Faisal Haque, Verification Central
Lunch: 12:15 1:00pm
157
What is an Assertion?
A concise description of [un]desired behavior
0 req ack
Example intended behavior
After the request signal is asserted, the acknowledge signal must come 1 to 3 cycles later
159
Syntactic compatibility
Easy to code directly in-line with RTL
Usability:
Easy to understand and use by:
Design Engineer Verification Engineer
Formalism:
Formal semantics to ensure correct analysis Consistent semantics between simulation and formal design validation approaches
161 DAC2003 Accellera SystemVerilog Workshop
req ack
Example intended behavior
HDL Assertion
162
The Basics
4 Easy Lessons
Immediate assertions
assert ( expression ) action_block; action_block ::= [statement] [else statement]
Action block
Executes immediately Can contain system tasks to control severity, for example: $error, $warning,
164 DAC2003 Accellera SystemVerilog Workshop
Concurrent assertions
assert property ( property_instance_or_spec ) action_block; action_block ::= [statement] [else statement]
Appears outside/inside procedural context Follows cycle semantics using sampled values Action block
Executes in reactive region Can contain system tasks to control severity, for example: $error, $warning,
165 DAC2003 Accellera SystemVerilog Workshop
Assertion Sampling
Values sampled at end of previous Time Step
Time Step sample here
clock
input
166
disable iff, not, implication repetition,(cycle)delay, and, or, intersect, first_match, within, throughout <expr>, <function>, <temporal_edge_function>, ended, matched
167
Congratulations !!!
a b c
a b b b c a b b b b c
a ##1 b[*3:4] ##1 c Expression Non-Consecutive Counting Repetition
a b
a
a ##1 b ##2 c
b b c
a b b b c
a ##1 b[*3] ##1 c
b b c
170
171
Sequence Operations
Sequence Concatenation s1 s2 s1 ##1 s2 s1 and s2 Sequence Overlap s1 s2 s1 ##0 s2 First Match s1 first_match(s1) Sequence intersect s1 s2 s1 intersect s2 Sequence or s1 s2 s1 or s2 Sequence and s1 s2
172
a
s1 a throughout s1
a
!a ##1 $rose(a);
a
a[*2] ##1 $fell(a)
173
Property Definition
Property Declaration: property
Declares property by name Formal parameters to enable property reuse Top Level Operators not desired/undesired disable iff reset |->, |=> precondition
Assertion Directives
assert checks that the property is never violated cover tracks all occurrences of property
property prop1(a,b,c,d); disable iff (reset) (a) |-> [not](b ##[2:3]c ##1 d); endproperty assert1: assert prop1 (g1, h2, hxl, in3);
174 DAC2003 Accellera SystemVerilog Workshop
Property implication
sequence_expr |-> [not] sequence_expr sequence_expr |=> [not] sequence_expr
175
176
Assigned anywhere in the sequence Value of assigned variable remains stable until reassigned in a sequence
Local Dynamic Variable Example
valid in out EA BF EB
property e; int x; (valid,(x=in))|=> ##5(out==(x+1)); endproperty
177 DAC2003 Accellera SystemVerilog Workshop
C0
Bind statement
bind module_or_instance_name instantiation;
No semantic changes to assertion Minimal change to design code Assertions included in the instantiation Allows binding a module, program and interface instance Mechanism to attach verification IP to module or module instance
179
Bind statement
bind module_or_instance_name instantiation; Top
cpu1 module cpu(a,b); reg c; ... endmodule cpu2 module cpu(a,b); reg c; ... endmodule
module/instance name
bind
endprogram
Equivalent to: assert property (top.cpu1.a ##1 top.cpu1.b |=> top.cpu1.c[*3]); assert property (top.cpu2.a ##1 top.cpu2.b |=> top.cpu2.c[*3]); or cpu_props cpu_rules1(a,b,c); // in module cpu
180 DAC2003 Accellera SystemVerilog Workshop
010
010
FF1 b
FF2 c
sample here
drive here
Preponed
clk
clock trigger
sample here
Active
assign #0 gclk = clk; always @(posedge gclk) b = a; // FF1 always @(posedge clk) c = b; // FF2 clocking @(posedge clk) sequence sa; !a ##1 a ##1 !a; endsequence sequence sc; !c ##1 c ##1 !c; endsequence property p sa => [2] sc; endproperty
Inactive
NBA
evaluate here
Observe
Reactive
react here
Postponed
181
Support design/assertion IP creation and reuse Enhanced scheduling allows building reactive testbenches Enhanced coverage of functional spec
182 DAC2003 Accellera SystemVerilog Workshop