Академический Документы
Профессиональный Документы
Культура Документы
Content
Module 1: Introduction to Formal Verification
Module 2: OneSpin Shell and Data base
Module 3: Models
Module 4: Set up a design
Module 5: Checking Properties
Module 6: How to check and debug properties
Module 7: Operation Properties
Module 8: More Advanced Properties
confidential
July 2007/Page 2
confidential
July 2007/Page 4
Verify Implementation:
Propery Checking
Implementation 1
Implementation n
Verify Preservation:
Equivalence Checking
e.g. Synthesis
July 2007/Page 5
Verification is split
A
tpdLH
tpdHL
1.3 ns
1.1 ns
confidential
July 2007/Page 6
Verification Methods
Function *)
Implementation
Simulation
Simulation
Static Timing
Analysis
Simulation
Simulation
Formal
Equivalence Checking
Static Timing
Analysis
Preservation
Manufacturing
ATPG,...
*)
confidential
Timing
At-Speed Test,
High Temperature,
...
Simulation
Specification
Testbench
Pattern
Generator
Design
Pattern
Analyzer
Simulator
hold/fail
Simulation is incomplete.
Testbench required.
confidential
July 2007/Page 8
Property Checking
Design
Specification
Properties
HDL-Front-End
Property Checker
hold/fail
confidential
Diagnostics
Consistency Checking
Specification
Properties
Consistency
Checks
Design
HDL-Front-End
Consistency
checker
Proof Engine
Statistics
confidential
Diagnostics
Comparison
Simulation
011
010
001
000
Design
Examine a small
number of patterns
Runtime limitations
confidential
Property/Consistency Checking
111
110
101
100
011
010
001
000
Design
Same as automatic,
exhaustive simulation
each functionality
stimulated
Much faster than
exhaustive simulation
July 2007/Page 11
Operation Properties
request
rw
address
incominga
outgoing
write_data d
ready
pr nop
act nop wr nop
control
sdram_addr
a'
a''
sdram_wdat
d
idle
state idle
assume:
incoming_write(t, addr, data);
in_idle_state(t);
prove:
outgoing_write(t+1, addr, data);
ackn_incoming_write(t, t+1, t+7);
in_idle_state(t+7);
Main parts
Assume part: Situation analyzed by the property
Prove part: Expected behavior in this situation
Examples:
Transactions of a bus bridge
Instructions of a processor
confidential
360 MV
confidential
July 2007/Page 14
Summary
confidential
July 2007/Page 15
Summary
Property Checking
Completeness Checking
confidential
July 2007/Page 16
confidential
July 2007/Page 18
Tcl Shell
OneSpin shell is an extension of the Tcl shell
Tcl (tool command language) is standard in EDA
Tcl allows execution of
OneSpin-commands
Tcl-commands (e.g. set, lindex)
Tcl-scripts
confidential
July 2007/Page 19
confidential
July 2007/Page 20
reference
VHDL
Verilog
reference
OneSpin
commands
database
tcl
commands
tcl variables
persistence
database
OneSpin shell
confidential
July 2007/Page 21
confidential
July 2007/Page 22
Modes
The mode of the OneSpin Shell is a state
Mode can be either
setup (initial): read and configure designs and units
ec = equivalence checking
mv = module verification: checking properties,
assertions, completeness
cc = consistency checking
July 2007/Page 23
Help
Help for commands
setup> help <command-pattern>
Examples
setup> help *vhdl*
setup> help mode mv *propert*
Complete user documentation
(including Reference manual)
Help button/Help menu
Pdf-file in $ONESPINROOT/doc
confidential
July 2007/Page 24
Log Files
for commands
to create regression scripts
setup> start_command_log <log-file>
# all command lines are logged in <log-file>
setup> stop_command_log
confidential
July 2007/Page 25
Module 3: Models
confidential
July 2007/Page 27
Motivation
EDA tools usually compile the design into an
internal format which
enables the fastest algorithms for their purpose.
saves memory by keeping only data needed for their
specific functionality.
confidential
July 2007/Page 28
Abstraction (VHDL)
An abstraction of a model is a less detailed model
than the original one.
FSM for property checking is an abstraction of the
standard VHDL semantics IEEE 1076
restricted to zero delay descriptions.
Synthesis-like abstraction:
reduces real time to events (i.e. rising/falling edges).
ignores propagation delays (after)
samples outputs of settled combinational logic (i.e. no
spikes).
confidential
July 2007/Page 29
confidential
July 2007/Page 31
ns6
s6
ns5
s5
ns4
s4
i4
ns3
s3
i5
ns2
s2
i2
i3
i6
i7
i8
A2
next
state
logic
A1
next
state
logic
ns9
s1
o1
s9
inputs
A4
next
state
&
output
logic
A3
ns1
FSM
next
state
logic
o2
ns8
s8
ns7
s7
outputs
combinational
logic
o3
A5
output
logic
o4
states
q d
next-states
q d
confidential
July 2007/Page 32
two input
variables
"d1 and "d2"
d1,d2/q
input 1 for d1
0 for d2
output 0
for q
1,0/0
(s1,s2)
(0,0)
s1 is in state 0
s2 is in state 0
s1 is in state 0
s2 is in state 0
input 1 for d1
0 for d2
1,0/0=output function(0,0,1,0)
(0,1)=next-state
(0,0)
function(0,0,1,0)
confidential
July 2007/Page 33
Example
time point 0 1 2 3 4
state 0 0 1 1 0
in 0 1 1 0
synchronous DFF
1/0
1
out 0 0 1 1
0/0
0
1
0/1
1/1
1/1
state
in
out
July 2007/Page 34
C
B
confidential
July 2007/Page 35
confidential
July 2007/Page 36
C
B
only values
generated
by B are
considered
July 2007/Page 37
> onespin
setup> read_vhdl c.vhd d.vhd
setup> elaborate
setup> compile
setup> set_mode mv
mv> read_itl a.vhi
mv> check_property read_req
mv> report_results
Read ITL
(properties)
Check a
property
Show results
confidential
July 2007/Page 39
mod_5
mod_1
i1: mod_2
i2: mod_2
i1: mod_4
i1: mod_4
i2: mod_4
Design
i3: mod_3
i1: mod_4
i2: mod_4
i2: mod_2
i1: mod_4
i2: mod_4
i1: mod_5
Design model
mod_1
i1: mod_2
confidential
HDL model
i2: mod_4
i3: mod_3
i1: black box
setup
read_hdl
elaborate
compile
pin declaration
set_read_hdl_option
get_read_hdl_option
read_vhdl/read_verilog
set_elaborate_option
get_elaborate_option
elaborate
set_compile_option
get_compile_option
compile
mv
confidential
July 2007/Page 41
confidential
Phase
read_hdl
elaborate
compile
debug
monitor
map
compare
_option
July 2007/Page 42
setup
read_hdl
elaborate
compile
pin declaration
mv
confidential
July 2007/Page 43
> onespin
setup> set_read_hdl_option -vhdl_version 93
-pragma_ignore synthesis_
confidential
July 2007/Page 44
confidential
July 2007/Page 45
confidential
July 2007/Page 46
confidential
July 2007/Page 49
confidential
July 2007/Page 50
confidential
July 2007/Page 51
setup
read_hdl
elaborate
compile
pin declaration
mv
confidential
July 2007/Page 53
Elaborate Phase
> onespin
setup> set_elaborate_option
-vhdl_generic
-verilog_parameter
-black_box
-top
abc=2
le=0
*ram*
arb
Elaboration
setup> elaborate
top level is automatically detected if unique and not
specified
confidential
July 2007/Page 54
confidential
July 2007/Page 55
confidential
July 2007/Page 56
setup
read_hdl
elaborate
compile
pin declaration
mv
confidential
July 2007/Page 58
Compilation
> onespin
setup> set_compile_option
Compilation
setup> compile
Needed to enable pin declaration
confidential
July 2007/Page 59
setup
read_hdl
elaborate
compile
pin declaration
mv
confidential
July 2007/Page 60
Pin Declaration
setup> set_clocking -rising clk
Alternative settings:
-default
-falling <pin>
and others
confidential
July 2007/Page 61
confidential
July 2007/Page 62
confidential
entity ai is
port(
clk,reset: in bit;
i: in integer;
v: out bit_vector(3 downto 0)
);
end ai;
July 2007/Page 64
confidential
July 2007/Page 65
confidential
July 2007/Page 66
Example (VHDL)
read_vhdl arbiter.vhd
set_elaborate_option -vhdl_generic nr_masters=5
elaborate
set_mode mv
check_consistency -category model_building
confidential
July 2007/Page 67
counter-example
confidential
July 2007/Page 70
Model
Property
hold/fail
confidential
Waveform Viewer
Property Debugger
July 2007/Page 71
t_free
+0
+1
+2
0-11
state
idle
request
_ /= 0
_ /= idle
idle
free
_ /= 0
grant
If
confidential
Assumptions
hold.
Specification
d_i
res
dff
q_o
clk
confidential
July 2007/Page 73
Design
library IEEE;
use IEEE.std_logic_1164.all;
entity dff is
port(
clk : in std_logic;
d_i : in std_logic;
q_o : out std_logic;
);
end dff;
architecture rtl of dff is
begin
process
begin
wait until clkevent and clk = '1';
q_o <= d_i;
end process;
end rtl;
Confidential
I-2/6
Property
Assuming res is inactive (i.e. = 1) an arbitrary
value of input d_i will be available at the
output q_o one clock cycle later:
Assumption
Commitment
property dff is
assume:
at t: res = 1;
prove:
at t+1: q_o = prev(d_i);
end property;
confidential
July 2007/Page 74
Environment
Commitments
end property;
Design
confidential
July 2007/Page 75
inputs
nextstates
states
internal
nets outputs
inputs
nextstates
states
internal
nets outputs
Pattern Analyzer
time point t
hold/fail
July 2007/Page 76
Pattern Analyzer
Assumption 1
Assumption 2
Commitment 1
Commitment 2
Commitment 3
Assumption 3
&
&
confidential
1
0
hold/fail
July 2007/Page 77
confidential
July 2007/Page 78
confidential
3
e
cas
t+1
2
e
cas
t+1
1
e
cas
t+1
True
t+2
True
t+2
t+2
inputs
states
int. signals
outputs
inputs
states
int. signals
outputs
inputs
states
False int. signals
outputs
3
e
cas
t
t+1
t+2
2
e
cas
t
t+1
t+2
1
e
cas
t
t+1
t+2
July 2007/Page 79
3
e
cas
t
t+1
True
&
t+2
2
e
s
ca
fail
False
t
t+1
t+2
counter-example found
July 2007/Page 80
I
S@t I@t
nextstate
output
state
Q@t
input
nextstate
output
state
Q@t+1
=
1
'0'
property parity is
assume:
at t: S = '0';
prove:
at t+1:
Q = I xor prev(I);
end property;
time point t
input
1
0
hold/
fail
=
commitment
assumption
confidential
July 2007/Page 81
Counter-Examples (1)
Diagnostic produces a sequence over the
examination window, which is called "counterexample".
A counter-example demonstrates why a property
fails: assumptions hold; at least one commitment
fails.
There may be many counter-examples.
A heuristic selects one specific counter-example.
The input d
will be
available at
the output q
two clock
cycles later.
confidential
q
t
t+1
t+2
t+1
t+2
July 2007/Page 82
Counter-Examples (2)
counter-example: like simulation trace
starts in an arbitrary state
applies values to the inputs
goes through a state-sequence that contradicts the
property
confidential
July 2007/Page 83
assume part
= assumption
property name
property <Identifier> is
assume:
<TemporalExpr>;
prove part
prove:
= commitment
<TemporalExpr>;
end property;
July 2007/Page 84
Temporal Expressions
For a commitment or an assumption, a
temporal expression defines:
the combinational logic block.
the points of time at which inputs, states, outputs,
and internal nets are read by that combinational logic
block.
hold/fail
confidential
July 2007/Page 85
at t
property Example is
prove:
at t: <StateExpr>;
end property;
read variables
at time point t
July 2007/Page 86
at
General syntax: at t+<offset>: <StateExpr>;
at t-<offset>: <StateExpr>;
Examples:
at t:
a = b;
at t-2:
a = 1;
at t+(3-2)*2: a > b;
July 2007/Page 87
Examination Window
The right bound of the examination window is the
highest point of time being referred to in the
property.
The left bound of the examination window is either
t or the lowest negative point of time being
referred to in the property if there is any negative
one.
confidential
July 2007/Page 88
t-1
t+1
t+1
t+2
t+3
"history"
of one additional state transition
confidential
July 2007/Page 89
during
General syntax:
during [t[+-]<offset>,t[+-]<offset>] : <StateExpr>
Example:
during [t-1,t+2] : a = 1;
property Example is
prove:
at t+1: <StateExpr>;
at t+2: <StateExpr>;
at t+3: <StateExpr>;
end property;
July 2007/Page 90
confidential
July 2007/Page 92
Master 0
Master 1
grant_o
free_i
Arbiter
Master
ster 2 2
3
confidential
request_i
July 2007/Page 93
A Typical Trace
request_i(0)
request_i(1)
request_i(2)
grant_o(0)
grant_o(1)
grant_o(2)
free_i
state_s
confidential
busy
idle st
busy
idle st
July 2007/Page 94
state_s = IDLE
Reset state
Wait for requests
START
IDLE
state_s = START
Grant the highest priority master
BUSY
state_s = BUSY
Wait for the resource to become free
free_i/=0
confidential
July 2007/Page 95
setup> elaborate
setup> set_mode mv
default clock found
confidential
July 2007/Page 96
IDLE
request_i
--1
grant_o
confidential
t+1
001
property grant_master_0 is
assume:
at t: state_s = IDLE;
at t: request_i(0) = '1';
prove:
at t+1: grant_o = "001";
end property;
July 2007/Page 97
Property
not proven yet
confidential
July 2007/Page 98
confidential
July 2007/Page 99
Debugging
Failing commitment
is colored red
Reset is active
mv> debug_property
confidential
Debugging (cont.)
confidential
Excluding reset
constr_no_reset.vhi
constraint no_reset :=
reset = 0;
end constraint;
arbiter_master0.vhi
include constr_no_reset.vhi;
property grant_master_0 is
dependencies:
no_reset;
assume:
at t: state_s = IDLE;
at t: request_i(0) = '1';
prove:
at t+1: grant_o = "001";
end property;
confidential
confidential
confidential
confidential
Debugging (again)
confidential
Debugging (cont.)
prio_s is assigned in
the process priority
When in IDLE,
grant_o takes the
value of prio_s
confidential
assume:
at t: state_s = IDLE;
at t: request_i(0) = '1';
prove:
at t+1: grant_o = "001";
end property;
request_i = 001
request_i = 011
request_i = 101
request_i = 111
Simulation:
- every bit of request_i must be given a value
- not every one of the 4 request_i values hits the bug
assume:
at t: state_s = IDLE;
at t: request_i = 101;
prove:
at t+1: grant_o = "001";
end property;
confidential
Holds!
t+1
IDLE
One Pattern
--1
grant_o
001
Many Test Cases
reset
request_i
001
101
111
011
free_i
confidential
state_s
idle start
busy
idle start
busy
idle start
busy
grant_o
000 001
000
001
000
111
000
idle
confidential
property is
unproven
confidential
confidential
confidential
Summary
confidential
Used Syntax
Comments
/*
This is a block comment.
*/
property grant_master_0 is
assume:
-- This is a line comment
at t: state_s = IDLE;
at t: request_i(0) = '1';
prove:
at t+1: grant_o = 001;
end property;
confidential
a_i1/ctrl_i/state_s
state_s
confidential
Types of Signals
same as in VHDL
except:
confidential
std_[u]logic_vector unsigned
bit_vector
unsigned
array of bit
unsigned
integer, range
unsigned or signed
natural, positive
unsigned
Literals
Bit, std_logic and std_ulogic:
'0'
'1'
O"257"
X"AF"
internally: unsigned
Number:
175
Boolean literals:
false
true
colorRED
typemarking if
type is not unique
July 2007/Page 119
Structural Operations
Concatenation:
"1010" & "1111" = "10101111"
Indexing on arrays:
request_i(0)
memory_s(2,1)
confidential
Structural Operations
Shift arithmetically:
shift_left("10101111",3) = "01111000"
shift_right("10101111",3) = "00010101"
Rotating:
rotate_left("101",2) = "110"
rotate_right("10",1) = "01"
confidential
constraints
used to describe behavior of the environment
assumed to hold in each cycle starting after reset
implicitely assumed over the whole examination window
definition
constraint <name> :=
<boolean-expression>;
end constraint;
property that assumes a constraint
property Example is
dependencies:
<name-of-constraint>;
assume:
confidential
confidential
An Operation Property
A request from the highest priority master (master 0)
is granted on the next cycle, if the arbiter is ready
to serve a request;
the arbiter then waits until the resource is free and
returns to a state where it is ready to serve a
request.
Full description of the operation:
serving a request from the master 0
confidential
--1
state_s
idle
grant_o
t+1
t+4
idle
001
free_i
confidential
property grant_master_0 is
dependencies:
no_reset;
assume:
at t: state_s = IDLE;
at t: request_i(0) = '1';
prove:
at t+1: grant_o = "001";
at t+4: state_s = IDLE;
end property;
--1
state_s
idle
grant_o
t_grant
t_grant+3
idle
001
free_i
confidential
property grant_master_0 is
dependencies:
no_reset;
assume:
at t: state_s = IDLE;
at t: request_i(0) = '1';
prove:
at t+1: grant_o = "001";
at t+4: state_s = IDLE;
end property;
--1
state_s
idle
grant_o
t_grant
idle
001
free_i
confidential
property grant_master_0 is
dependencies:
no_reset;
t_free_i
assume:
at t: state_s = IDLE;
at t: request_i(0) = '1';
prove:
at t+1: grant_o = "001";
at t+4: state_s = IDLE;
end property;
t
request_i
--1
state_s
idle
grant_o
free_i
confidential
no_reset;
for timepoints:
t_grant = t+1,
t_free_i = t_grant+3;
assume:
at t: state_s = IDLE;
at t: request_i(0) = '1';
prove:
at t_grant: grant_o = "001";
at t_free_i: state_s = IDLE;
end property;
confidential
confidential
arbiter_master0.vhi
include constr_no_reset.vhi;
include constr_grant_free_after_3.vhi
property grant_master_0 is
dependencies:
no_reset,
grant_free_after_3;
for timepoints:
t_grant = t+1,
t_free_i = t_grant + 3;
assume:
at t: state_s = IDLE;
at t: request_i(0) = '1';
prove:
at t_grant: grant_o = "001";
at t_free_i+1: state_s = IDLE;
end property;
July 2007/Page 131
confidential
A Different Environment
The resource is freed within 3 cycles from grant
arbiter_master0.vhi
constr_grant_free.vhi
constraint grant_free :=
if grant_o /= 0 then
next(free_i) = 1' or
next(free_i,2) = 1' or
next(free_i,3) = '1'
end if;
end constraint;
confidential
include constr_no_reset.vhi;
include constr_grant_free.vhi
property grant_master_0 is
dependencies:
no_reset,
grant_free;
for timepoints:
t_grant = t+1,
t_free_i = t_grant + 1..3;
assume:
at t: state_s = IDLE;
at t: request_i(0) = '1';
prove:
at t_grant: grant_o = "001";
at t_free_i+1: state_s = IDLE;
end property;
July 2007/Page 133
no connection!
confidential
confidential
Contradictory Assumptions
arbiter_master0.vhi
include constr_no_reset.vhi;
include constr_grant_free.vhi
property grant_master_0 is
dependencies:
no_reset,
typo:
grant_free;
for timepoints:
t_free_i
t_grant = t+1,
Instead of
t_free_i = t_grant + 1..3;
t_free_i 1
assume:
at t: state_s = IDLE;
at t: request_i(0) = '1';
during [t_grant+1, t_free_i]: free_i = '0';
at t_free_i: free_i = '1';
at t_free_i:
prove:
free_i = 0 and free_i = 1
at t_grant: grant_o = "001";
at t_free_i+1: state_s = IDLE;
Contradiction!!!
end property;
confidential
confidential
Contradictory Assumptions:
why does the property holds
Commitment 1
Assumption 1
Assumption 2
Commitment 2
Commitment 3
Assumption 3
not relevant!
&
&
1
0
constant 1
hold
constant 0
confidential
state_s
idle
000
001
010
grant_o
011
100
101
110
111
confidential
start
busy
State Space:
state_s x grant_o
Reachable states:
Reset state
States reached from the
reset state
Etc.
Unreachable states:
All the other states
include constr_no_reset.vhi;
include constr_grant_free.vhi
property grant_master_0 is
dependencies:
no_reset,
No assumptions
grant_free;
on grant_o
for timepoints:
t_grant = t+1,
t_free_i = t_grant + 1..3;
assume:
at t: state_s = IDLE;
at t: request_i(0) = '1';
during [t_grant+1, t_free_i-1]: free_i = '0';
at t_free_i: free_i = '1';
prove:
at t_grant: grant_o = "001";
at t_free_i+1: state_s = IDLE;
end property;
confidential
grant_o
idle
start
busy
000
001
010
011
100
101
110
111
Cons:
False negatives: the property fails from an unreachable
state
Not a true failure
Soon learn how to deal with false negatives
confidential
Summary
An operation property describes a full operation
From accepting a request to being ready for the next
confidential
Used Syntax
Logical Operations
Bit-wise operations:
not
and
or
xor
nand
nor
xnor
or_reduce
nor_reduce
xor_reduce
xnor_reduce
e.g.
and_reduce("1111111")
confidential
= '1'
Conditional Expressions
Complete if expression
a ?
b = 3 :
b = 5
if a then
b = 3
else
b = 5
end if
b = if a then
3
else
5
end if
if a then
b = 3
else
true
end if
confidential
Conditional Expressions
Cascaded if statements:
if a1 then
b = 3
elsif a2 then
b = 5
else
b = 0
end if
if a1 then
b = 3
else if a2 then
b = 5
else
b = 0
end if
end if
case statement:
case c is
when 2
=> d = 6;
when 3
=> d = 9;
when others => d = 0
end case;
confidential
if
(c = 2) then d = 6
elsif (c = 3) then d = 9
else
d = 0
end if;
confidential
property Example is
prove:
at t+1: cnt = prev(cnt) + 1;
end property;
stands for:
previous value of cnt
i.e. at t
property Example is
prove:
at t: next(cnt) = cnt + 1;
end property;
stands for:
next value of cnt
i.e. at t+1
property Example is
prove:
at t: next(cnt, 2) = cnt + 2;
end property;
stands for:
next but one value
of cnt i.e. at t+2
July 2007/Page 149
within
<TimedStateExpr> ::= within <TimeRange>:<StateExpr>
<TimeRange> ::= [<TimeExpr>,<TimeExpr>]
I-5/24
either .. or
At least one, possibly several alternatives hold:
<TimedStateExpr> ::= either <TimedStateExpr>
{or <TimedStateExpr>}+
end either;
<StateExpr> should
hold at t+3,
or at t+4,
or at t+5
<StateExpr1> should
hold at t+3 or
<StateExpr2> at t+5
I-9/13
fell(expr)
Confidential
I-8/13
property Example is
for timepoints:
Denotes a
t_grant = t+1;
time point
prove:
at t_grant: ack_o = '1';
end property;
Uses the time variable
confidential
confidential
confidential
property Example is
for timepoints:
t1 = t+1..2,
t2 = t1+2..3;
prove:
<TimedStateExprList>
end property;
t1=t+2
t1=t+1
t2=t1+2
t2=t+3
t1=t+2
t2=t1+3
t2=t+4
t2=t1+2
t2=t+4
t2=t1+3
t2=t+5
(t1,t2)={(t+1,t+3),(t+1,t+4),(t+2,t+4),(t+2,t+5)}
confidential
for
property Example is
for:
<Identifier> = M..N;
prove:
<TimedStateExprList>
end property;
I-9/3
Application of for
State variables generated by for serve to
parameterize properties with a generic array index
and check the property for all possible values of that
array index independently.
property Example is
for:
Index = 3..4;
prove:
at t: DO_o(Index) = 0;
end property;
Confidential
property Example_3 is
prove:
at t: DO_o(3) = 0;
end property;
property Example_4 is
prove:
at t: DO_o(4) = 0;
end property;
CVE Property Checking
Infineon Technologies AG 2004, All rights reserved
I-9/4
More on for
property Example is
for:
<Identifier> = M..N,
<Identifier> = O..P,
<Identifier> = Q..R;
freeze:
<Identifier> = <Expr> @ <TimeExpr>;
prove:
<TimedStateExprList>
end property;
Confidential
I-9/5
More on for
property Example is
-- for: i = 0..5, j = i..5; -- forbidden!
for: i = 0..5, j = 0..5;
freeze:
dji = j - i@t;
assume: at t: j >= i; -- relation between i and j
prove:
at t: mem(i,j) =
if
i < j then dji
else
i
end if;
end property;
I-9/6
confidential
confidential
macro
grant_to_highest_prio (request:bit_vector):
bit_vector :=
if
request(0) = 1
then "001"
elsif request(1) = 1 then "010"
elsif request(2) = 1 then "100"
else
"000"
end if;
end macro;
property grant_master
grant_master_0
is is
dependencies:
no_reset, grant_free;
for timepoints:
t_grant = t+1,
t_free_i = t_grant + 1..3;
freeze:
req = request_i @ t;
assume:
at t: state_s = IDLE;
request_i(0)
= '1';
at t: request_i
/= 0;
-- some request
during [t_grant+1, t_free_i-1]:
t_free_i]: free_i
==
'0';'0';
free_i
at t_free_i: free_i = '1';
prove:
"001"; priority request>
at t_grant: grant_o = grant_to_highest_prio(req);
<highest
at t_free_i+1: state_s = IDLE;
end property;
confidential
confidential
Generating a Witness
arbiter_all_masters.vhi
include constr_no_reset.vhi;
include constr_grant_free.vhi
No counter-examples for
holding properties
Witness
property grant_master is
dependencies:
no_reset, grant_free;
a trace on which the
for timepoints:
t_grant = t+1,
property holds
t_free_i = t_grant + 1..3;
Force the property to fail
freeze:
req = request_i @ t;
assume:
at t: state_s = IDLE;
at t: request_i /= 0; -- some request
during [t_grant+1, t_free_i-1]: free_i = '0';
at t_free_i: free_i = '1';
prove:
false;
at t_grant: grant_o = grant_to_highest_prio(req);
at t_free_i+1: state_s = IDLE;
end property;
confidential
prove: false;
To generate an example
on which the property
holds a witness
confidential
Expanding Macros
confidential
Summary
How to write a property for all master
From a specific property (request from master 0) to a
generic property (requests from any master)
freeze, macros
confidential
Used Syntax
freeze
property Example is
freeze:
<Identifier> = <Expr> @ <TimeExpr>;
prove:
<TimedStateExprList>
end property;
sig
out
t
confidential
sig
out
actual parameter
property Example is
of a HDL type
assume:
at t+1: Request('1');
prove:
at t+2: grant_o = 001;
end property;
Note: signals are usable
within a macro without need
of parameter usage.
confidential
property Example is
dependencies:
no_reset, gnt_req;
assume:
at t+1: if (a < b) then
b-a
else
time points
a-b
end if;
prove:
at t+2: rdy_o = '1';
end property;
confidential
properties
dependencies
Expressions
temporals
I-10/5
Confidential
I-10/6
I-10/7
I-10/8
I-10/9
I-10/10
property Example is
assume:
macro call
Request;
prove:
at t+2: rdy_o = '1';
end property;
Confidential
I-10/11
Inclusion of Macros
Several macros sections in a file allowed.
include
VHI
macro
files
define
macros
before
usage
a VHI file
Confidential
include "Basics.vhi";
include "Params.vhi";
macro
m1: ...
end macro;
property p1 is
... m1 ...
end property;
macro
m2: ...
end macro;
property p2 is
... m2 ...
end property;
include ...;
macro
<Macro>
end macro;
...
Defining re-usable
macros
CVE Property Checking
Infineon Technologies AG 2004, All rights reserved
I-10/12
-A_s
Binary operations:
A_s + B_s
A_s - B_s
A_s * B_s
Comparison:
confidential
A_s = B_s
A_s /= B_s
Structural Operations
Resizing, removing or filling with '0'/sign at left end:
RESIZE("011",2) = "11"
RESIZE("11",3) = "011"
RESIZE(signed"101",2) = signed"11"
RESIZE(signed"010",2) = signed"00"
RESIZE(signed"10",3)
= signed"110"
I-6/12
t:
t:
t:
t:
t:
t:
"111" / = "000" - 1;
-- "1111"
"111" / = resize("000" - 1,3);
-- "111"
"111" / = unsigned("000" - 1);
-- "1111"
signed"111" = "000" - 1;
-- "1111"
"110" / = ("111" - 1)(2 downto 0);
/
-- "0110
"
"110" = unsigned(("111" - 1)(2 downto 0));
Confidential
I-6/13
Specifics of Operations
The results internal representation of any
operation will be large enough to avoid any
over- or underflow.
- Arguments internal representation may be
resized.
The result is to be understood arithmetically,
wherever possible.
- Resizing is done arithmetically: Sign is
preserved.
Mixed argument types are allowed, wherever
possible.
confidential
Exercise: Alu
ASL
ASR
LSR
ADD
SUB
MULS
MULU
IDLE
in1_i
in0_i
cmd_i
flags_o
4
flags_o.carry
flags_o.ovfl
flags_o.neg
flags_o.zero
out1_o out0_o
As preparation
analyze alu_pack.vhd, alu.vhd into library work .
note that entity alu describes a combinational circuit .
(set_clocking)
Confidential
I-6/19
I-6/20
Solutions
Confidential
I-6/21
=
=
=
=
shift_left(in0_i,1);
0;
in0_i(3);
(in0_i(3) xor out0_o(3));
CVE Property Checking
Infineon Technologies AG 2004, All rights reserved
I-6/22
trunk errors
an ATM cell
routing errors
packet size
# of bit errors
Confidential
I-5/29
11/01
10/10
*)
0-/00
state
correct_o
1
11/01
10/01
0-/00
multiple_i
*)
error_i multiple_i/ correct_o dismiss_o
dismiss_o
I-5/30
Solutions
Confidential
I-5/31
11/01
10/10
0-/00
11/ 01
10/ 01
0-/ 00
Confidential
I-5/32
I-5/33
11/01
10/01
0-/00
Confidential
I-5/34
11/01
10/01
0-/00
Confidential
I-5/35
11/01
10/01
0-/00
Confidential
I-5/36
11/01
10/01
0-/00
Confidential
I-5/37
OneSpin Solutions
Training Module Verification
Part III Assertions and Constraints
July 2007
OneSpin Solutions GmbH
Theresienhoehe 12
80339 Munich Germany
support@onespin-solutions.com
Content
confidential
confidential
state_s
idle
start
busy
IDLE
START
000
001
010
grant_o
011
100
101
110
grant_o <= 0
grant_o <= 0
BUSY
grant_o <= 0
111
reachable
unreachable
confidential
State Space:
state_s x grant_o
OneSpin Solutions/Page 390
include constr_no_reset.vhi;
include constr_grant_free.vhi
property grant_master_0 is
dependencies:
no_reset,
No assumptions
grant_free;
on grant_o
for timepoints:
t_grant = t+1,
t_free_i = t_grant + 1..3;
assume:
at t: state_s = IDLE;
at t: request_i(0) = '1';
during [t_grant+1, t_free_i]: free_i = '0';
at t_free_i: free_i = '1';
prove:
at t_grant: grant_o = "001";
at t_free_i+1: state_s = IDLE;
end property;
confidential
grant_o
idle
start
busy
000
001
010
011
100
101
110
111
Cons:
False negatives: the property fails from an unreachable
state
Not a true failure
IDLE
grant_o <= 0
grant_o <= 0
BUSY
grant_o <= 0
confidential
START
property idle is
assume:
at t: state_s = idle;
at t: request_i = 0;
prove:
at t+1: grant_o = 0;
end property;
Unreachable
start state
confidential
confidential
confidential
Assertions
arbiter_idle.vhi
assertion idle_grant :=
if (state_s = idle) then
grant_o = 0
end if;
end assertion;
property idle is
dependencies:
idle_grant;
assume:
at t: state_s = idle;
at t: request_i = 0;
prove:
at t+1: grant_o = 0;
end property;
confidential
Dependencies
idle depends on an
unproven assertion
confidential
Dependencies Management
mv> report_result
confidential
One unresolved
dependency
Syntax - Assertions
assumed to hold in each cycle starting after reset
implicitely assumed over the whole examination window
definition
assertion <name> :=
<boolean-expression>;
end assertion;
property that assumes an assertion
property Example is
dependencies:
<name-of-assertion>,
<name-of-constraint>,
;
assume:
confidential
confidential
Summary
Dealing with false negatives due to unreachable
start state
Describe the set of legal start states with an assertion
Set a dependency between the property and the
assertion
confidential
confidential
Proving Assertions
360 MV command to check assertions:
check_assertion
confidential
Mathematical Induction
A technique to prove statements about the natural
numbers
Example
n
2i = 2n+1 - 1
i=0
base case
induction step
prove for n = 0
20 = 1
2(0+1) - 1 = 2 - 1 = 1
n-1
2 = 2i + 2n =
i=0
i=0
= 2n 1 + 2n = 2n+1 - 1
confidential
State at t=0,
just after reset
t=0
States at t= 1,
states that
can be reached
from the reset
state
t=1
States at t= n,
states that
can be reached
from the states
at t = n-1
t=n
To prove that a condition is true for all the states in the sequence
(all the reachable states)
- prove at t=0 (base case)
- assume at t, prove at t+1 (induction step)
confidential
mv> get_reset_sequence
confidential
The state at t
is not reachable:
false negative
The property fails!
confidential
idle
start
busy
assertion idle_grant :=
if (state_s = idle) then
grant_o = 0
end if;
end assertion;
001
010
011
100
101
110
111
idle
start
busy
000
001
010
011
100
101
110
111
It is possible to leave
the set of states
described by the
assertion
confidential
A Stronger Assertion
state_s
grant_o
assertion idle_grant :=
if (state_s = idle) then grant_o = 0 end if
and
if (state_s = busy) then grant_o = 0 end if;
end assertion;
idle
start
busy
000
001
010
011
100
101
110
111
confidential
idle_grant states
all states
reachable states
check_assertion
automatic proof by induction
First version of
the assertion
confidential
debug_assertion
step
property
mv> debug_assertion
confidential
The state at t
is not reachable:
false negative
confidential
confidential
No Unresolved Dependencies
mv> report_result
confidential
No unresolved
dependency
confidential
Summary
Proof by induction
Check_assertion automates the induction
technique
How to debug assertions
How to strengthen assertions in order to prove
them
confidential
confidential
confidential
check_assertion no_grant_idle
confidential
confidential
confidential
Extended
base property
confidential
Expand during
In this example the assertion is wrong.
In a different situation this could have been
a bug in the design!
Expand the assertion
confidential
confidential
confidential
Add the
environment
constraint
confidential
confidential
confidential
Make the
assertion
stronger
The assertion
holds!
confidential
Short-Term Redundancy
t+1
t +2
a
b
Prove:
Irrelevant counter-example!
Dependencies needed!
Cure:
at t: a = b
a
b
confidential
Summary
How to check assertions from reset on longer
intervals
Assertions can depend on environment constraint
Short-term redundancies
Completeness helps in dealing with unreachable
states
confidential