Lecture14

advertisement
290N: The Unknown Component
Problem
Lecture 14
Reachability Analysis
Outline

Image computation



Input splitting
Output splitting
Quantification scheduling
• IWLS-95
• ICCAD-01

Implementations




BDDs
SAT
Hybrid
Reachability analysis


Exact reachability analysis
Approximate reachability analysis
Image Computation

Given a mapping of minterms
from one Boolean space
(input space) into another
Boolean space (output space)

Input space
For a set of minterms (care set)
in the input space
• The image of this set is the set
of corresponding minterms in
the output space

Output space
For a set of minterms in the
output space
• The pre-image of this set is the
set of corresponding minterms in
the input space
Image
Care set
Example
Input space
abc
y
x
000
001
Output space
Care set
010
a
b
c
xy
011
00
Image
01
100
10
101
11
110
111
Image Computation


Implements formula: Image(Y) = x [R(X,Y) & C(X)]
Implicit methods by far outperform explicit ones


Operations & and  are basic Boolean manipulations


Successfully computing images with more than 2^100 minterms in
the input/output spaces
They are efficiently implemented in the BDD package
To avoid large intermediate results (during and after the product
computation), operation AND-EXIST can be used, which performs
product and quantification simultaneously (in one pass over the
BDDs)
Image Computation Techniques

When the relation is a monolithic one, these technique
do not work


The techniques discussed below work for the case of
partitioned representation


Unless the relation can be decomposed using disjoint-support
decomposition, etc.
This representation is natural when the system is represented
on the gate level
In this case, the transition relation is given in the form of
the set of partitions:
T(x,cs,ns) = i Ti(x,cs,nsi)
Input Splitting




Select an input variable
Cofactor partition w.r.t. this
variable
Compute the images for
the cofactors
Union the resulting images
x=a+b
a=0
x=b
y = bc
y = bc
a=1
x=1
y = bc
Input space
abc
000
001
Output space
Care set
010
xy
011
00
Image
01
100
10
101
11
110
111
Reducing Image Computation to
Range Computation


Operator “constrain” () is an image restrictor
It allows us to reduce image computation to range
computation:
Im(y) = Image( R(x,y), C(x) ) = Image( R(x,y)C(x) )
bdd constrain( bdd R, bdd C ) {
if ( C = 0 ) return 0;
if ( C = 1 or R = const ) return R;
(C0,C1) = Cofactors( C, x );
(R0,R1) = Cofactors( R, x );
if ( C0 = 0 ) return constrain( R1, C1 );
if ( C1 = 0 ) return constrain( R0, C0 );
R0 = constrain( R0, C0 );
R1 = constrain( R1, C1 );
return ITE( x, R1, R0 );
}
Example
R(X,Y) = {a+b, bc}
C(X) = a’(b’+c’)
Constrain:
R(X,Y)  C(X) = {a’(b’+c’), 0}
Image( R(X,Y)  C(X) ) = y’
Input space
abc
000
001
Output space
Care set
010
xy
011
00
Image
01
100
10
101
11
110
111
Output Splitting

Constrain each function Yi(x) w.r.t the care set C(x)
 Recursively compute the image as follows:


Select an output variable yi
Constrain each remaining function using the function yi=Yi(x)
• Use the direct polarity
• Use the complemented polarity



Find the images of the two resulting sets of functions, Im1(y) and Im2(y)
Combine the images using the ITE operator and the variable yi.
Im(y) = ITE(yi, Im1(y), Im2(y))
Trivial cases:

When function Yj(x) is constant 0 (1), the image is yj’ (yj)

When there is only one non-constant function left, the image is
constant 1 (it does not depend on the y variables)

When functions in the set Y can be split into two parts with disjoint
support, the image is the product of the two images

When only two functions are left and, for example, Yj1(x) = Yj2(x)’,
then, the image is yj1  yj2
Input vs. Output Splitting



These two methods are “symmetric”
Their efficiency depends on the cardinality of the
input/output spaces
Typically output splitting is more efficient because the
output space is typically smaller than the input space

As a result, the (potentially exponential) tree depth is bounded
by a smaller number
Variable 1
Variable 2
Variable 3
Quantification Scheduling

Existential quantification and product commute if a
variable to be quantified belongs to only one component
in the product
x [F(x,y) & G(x,y)]  [x F(x,y)] & [x G(x,y)]
x [F(y) & G(x,y)]

= F(y) & [x G(x,y)]
Scheduling is performed by ordering the partitions, so
that the variables are quantified as early as possible
Image(Y) = x,i [A(x) & T1(x,i,y) & T2(x,i,y) & … & Tk(x,i,y)] =
= xk,ik [ Tk(x,i,y) &
& xk-1,ik-1 [Tk(x,i,y) &
… & x1,i1 [T1(x,i,y) & x0,i0 A(x)] … ] ]
IWLS 95 Image Computation
Method

BDD variable ordering techniques
 Use of clustering
 Ordering of the clusters
BDD Variable Ordering

Given a set of partitions yj(i,x), find the permutation 
of partitions such that it minimizes the sum
Cost ( ) 
  sup p ( f )
1 j  n 1i  j

j
Order supports of yj(i,x) individually and then insert
the yj variables as follows:
sup p ( f 1 ), y 1 ,..., sup p ( fn ) 
 sup p ( f ), y
j
1i  n 1
n
Partition Clustering

Group partitions based on their support using
the overall limit on the BDD size of a partition

Partitions with close support should be grouped
together
• This facilitates quantification scheduling

Both many small partitions and few large partitions
are bad; the best result is somewhere in between
• Heuristically, it was found that the partition size of 1000-5000
BDD nodes works well in practice
Ordering Clusters

Start with two sets of clusters, P and Q


P is already ordered; Q is still to be ordered
Order the clusters by first including those clusters that
maximize the weight:
W = 2 * Vci/Wci + Wci/Xci + Yci/Zci + mci/Mci, where
Vci is the number of vars to be quantified by adding ci
Wci is the number of cs and i vars in the support ci
Xci is the number of cs and i vars that are not yet quantified
Yci is the number of ns vars that will be added by ci
Zci is the number of ns vars that are not yet in the product
mci is the max BDD level of a var to be quantified in ci
Mci is the max BDD level of a var to be quantified in Q
Non-Linear Quantification
Scheduling (ICCAD91)



Instead of creating the linear order, create a tree order
Use a sample care set to dynamically schedule
quantifications
Algorithm takes V (variables) and F (partitions)


Quantify away variables that appear in one partition only
Iterate as long as the set of variables V is not empty
• Select a variable with the lowest cost

Cost of is the sum of BDD sizes of functions, to which this var belongs
• Select two smallest partitions with this variable in their support
• Conjoin these partitions and update the costs


Dynamically build the tree as the quantification proceeds
Use this tree to compute images with other care sets
Example of Non-Linear Scheduling

Three-bit counter





&
Care set S = x1’
Partitions





y1 = x1’
y2 = x1  x2
y3 = x1x2  x3

&
F1(y1,x1) = y1 = x1’
F2(y2,x1,x2) = y2 = x1  x2
F3(y3,x1,x2,x3) = y3 = x1x2  x3
F4(x1) = x1’
Variables to quantify
x1,x2,x3
x1
x2
&
x3
F1
F2
F3
F4
Summary

These methods work for the partitioned transition relation


Different approaches to computing the image




Input splitting
Output splitting
Quantification scheduling
Hybrid methods






Natural when the FSM (automaton) is represented by a circuit
Use partition clustering in addition to quantification scheduling (Berkeley, IWLS
95)
Use non-linear quantification scheduling (CMU, ICCAD 01)
Partitioning (OR-decomposition) of the transition relation
“To split, or to conjoin” (mix the quantification scheduling and input/output
splitting) (Somenzi, DAC 2000)
“The compositional far side of image computation” (Somenzi, ICCAD 2003)
Tricks and speed-ups


Disjoint decomposition
Caching of intermediate results, etc
Using SAT for Image Computation


Represent transition relation as a CNF
Iterate through the satisfying assignments





It is good if the solver can iterate through cubes rather than
minterms of the solution space
Otherwise, it is only applicable to small output spaces (<10 vars)
When the problem becomes UNSAT, the collected
solutions represent the image
The care set is a set of additional constraints
Hybrid approaches use SAT and BDDs



To represent the care set (FMCAD-00)
To finish searching subspaces whose size is small (FMCAD-00)
To represent parts of the CNF (DAC-03)
Reachability Analysis



Many applications explore the reachable state space
Given an FSM (automaton) with the transition relation, find all the
states reachable from the initial state
Apply image computation repeatedly to compute the sets of reachable
states in the next iteration (“onion rings”) until convergence
ReachedStates = InitialState;
iterate the following computation:
ReachedStatesNew = Image( TransitionRelation, ReachedStates );
if (ReachedStatesNew = ReachedStates ) stop;
ReachedStates = ReachedStatesNew ;


Reachability analysis uses different methods of image computation
Relies on numerous improvements



Simplification using don’t-cares
Iterative squaring
Approximations, etc
Download