21
Reachability Analysis Reachability Analysis 290N: The Unknown Component 290N: The Unknown Component Problem Problem Lecture 14 Lecture 14

Reachability Analysis

  • Upload
    shino

  • View
    52

  • Download
    0

Embed Size (px)

DESCRIPTION

Reachability Analysis. 290N: The Unknown Component Problem Lecture 14. Outline. Image computation Input splitting Output splitting Quantification scheduling IWLS-95 ICCAD-01 Implementations BDDs SAT Hybrid Reachability analysis Exact reachability analysis - PowerPoint PPT Presentation

Citation preview

Page 1: Reachability Analysis

Reachability AnalysisReachability Analysis

290N: The Unknown Component 290N: The Unknown Component ProblemProblem

Lecture 14Lecture 14

Page 2: Reachability Analysis

OutlineOutline Image computationImage computation

Input splittingInput splitting Output splittingOutput splitting Quantification schedulingQuantification scheduling

• IWLS-95IWLS-95• ICCAD-01ICCAD-01

ImplementationsImplementations BDDsBDDs SATSAT HybridHybrid

Reachability analysisReachability analysis Exact reachability analysis Exact reachability analysis Approximate reachability analysisApproximate reachability analysis

Page 3: Reachability Analysis

Image ComputationImage Computation Given a mapping of minterms Given a mapping of minterms

from one Boolean space from one Boolean space ((input spaceinput space) into another ) into another Boolean space (Boolean space (output spaceoutput space))

For a set of minterms (For a set of minterms (care setcare set) ) in the input spacein the input space

• The The imageimage of this set is the set of this set is the set of corresponding minterms in the of corresponding minterms in the output spaceoutput space

For a set of minterms in the For a set of minterms in the output spaceoutput space

• The The pre-imagepre-image of this set is the of this set is the set of corresponding minterms in set of corresponding minterms in the input spacethe input space

Input space

Output space

Image

Care set

Page 4: Reachability Analysis

ExampleExample

a b c

yx Output space

Image

Care set000

001

010

011

100

101

110

111

00

01

10

11

abc

xy

Input space

Page 5: Reachability Analysis

Image ComputationImage Computation

Implements formula:Implements formula: Image(Y) = Image(Y) = x [R(X,Y) & C(X)]x [R(X,Y) & C(X)] Implicit methods by far outperform explicit onesImplicit methods by far outperform explicit ones

Successfully computing images with more than Successfully computing images with more than 2^1002^100 minterms in minterms in the input/output spacesthe input/output spaces

Operations Operations && and and are basic Boolean manipulationsare basic Boolean manipulations They are efficiently implemented in the BDD packageThey are efficiently implemented in the BDD package

To avoid large intermediate results (during and after the product To avoid large intermediate results (during and after the product computation), operation computation), operation AND-EXISTAND-EXIST can be used, which can be used, which performs product and quantification simultaneously (in one pass performs product and quantification simultaneously (in one pass over the BDDs)over the BDDs)

Page 6: Reachability Analysis

Image Computation TechniquesImage Computation Techniques

When the relation is a monolithic one, these technique When the relation is a monolithic one, these technique do not workdo not work

Unless the relation can be decomposed using disjoint-support Unless the relation can be decomposed using disjoint-support decomposition, etc.decomposition, etc.

The techniques discussed below work for the case of The techniques discussed below work for the case of partitioned representationpartitioned representation

This representation is natural when the system is represented This representation is natural when the system is represented on the gate levelon the gate level

In this case, the transition relation is given in the form of In this case, the transition relation is given in the form of the set of partitions: the set of partitions:

T(x,cs,ns) = T(x,cs,ns) = i Ti(x,cs,nsi)i Ti(x,cs,nsi)

Page 7: Reachability Analysis

Input SplittingInput Splitting

Select an input variableSelect an input variable Cofactor partition w.r.t. this Cofactor partition w.r.t. this

variablevariable Compute the images for Compute the images for

the cofactorsthe cofactors Union the resulting imagesUnion the resulting images

Output space

Image

Care set000

001

010

011

100

101

110

111

00

01

10

11

abc

xy

Input space

x = a + b y = bc

x = b y = bc x = 1 y = bc

a=0 a=1

Page 8: Reachability Analysis

Reducing Image Computation to Reducing Image Computation to Range ComputationRange Computation

Operator “constrain” (Operator “constrain” () is an image restrictor) is an image restrictor It allows us to reduce image computation to range It allows us to reduce image computation to range

computation:computation:

Im(y) = Image( R(x,y), C(x) ) = Image( R(x,y)Im(y) = Image( R(x,y), C(x) ) = Image( R(x,y)C(x) )C(x) )

bdd bdd constrainconstrain( bdd R, bdd C ) {( bdd R, bdd C ) {if ( C = 0 ) return 0;if ( C = 0 ) return 0;if ( C = 1 or R = const ) return R;if ( C = 1 or R = const ) return R;(C0,C1) = Cofactors( C, x );(C0,C1) = Cofactors( C, x );(R0,R1) = Cofactors( R, x );(R0,R1) = Cofactors( R, x );if ( C0 = 0 ) return if ( C0 = 0 ) return constrainconstrain( R1, C1 );( R1, C1 );if ( C1 = 0 ) return if ( C1 = 0 ) return constrainconstrain( R0, C0 ); ( R0, C0 ); R0 = R0 = constrainconstrain( R0, C0 );( R0, C0 );R1 = R1 = constrainconstrain( R1, C1 );( R1, C1 );return ITE( x, R1, R0 );return ITE( x, R1, R0 );

}}

Page 9: Reachability Analysis

ExampleExample

R(X,Y) = {a+b, bc}R(X,Y) = {a+b, bc}

C(X) = a’(b’+c’)C(X) = a’(b’+c’)

Constrain:Constrain:

R(X,Y) R(X,Y) C(X) C(X) = {a’(b’+c’), 0} = {a’(b’+c’), 0}

Image( R(X,Y) Image( R(X,Y) C(X) ) C(X) ) = y= y’’

Output space

Image

Care set000

001

010

011

100

101

110

111

00

01

10

11

abc

xy

Input space

Page 10: Reachability Analysis

Output SplittingOutput Splitting Constrain each function Constrain each function Yi(x)Yi(x) w.r.t the care set w.r.t the care set C(x)C(x) Recursively compute the image as follows:Recursively compute the image as follows:

Select an output variable Select an output variable yiyi Constrain each remaining function using the function Constrain each remaining function using the function yi=Yi(x)yi=Yi(x)

• Use the direct polarityUse the direct polarity• Use the complemented polarityUse the complemented polarity

Find the images of the two resulting sets of functions, Find the images of the two resulting sets of functions, Im1(y)Im1(y) and and Im2(y) Im2(y) Combine the images using the Combine the images using the ITEITE operator and the variable operator and the variable yiyi.. Im(y) = ITE(yi, Im1(y), Im2(y))Im(y) = ITE(yi, Im1(y), Im2(y))

Trivial cases:Trivial cases: When function When function Yj(x)Yj(x) is constant is constant 0 (1)0 (1), the image is , the image is yj’ (yj)yj’ (yj) When there is only one non-constant function left, the image is When there is only one non-constant function left, the image is

constant constant 11 (it does not depend on the (it does not depend on the yy variables) variables) When functions in the set When functions in the set YY can be split into two parts with disjoint can be split into two parts with disjoint

support, the image is the product of the two imagessupport, the image is the product of the two images When only two functions are left and, for example, When only two functions are left and, for example, Yj1(x) = Yj2(x)’Yj1(x) = Yj2(x)’, ,

then, the image is then, the image is yj1 yj1 yj2 yj2

Page 11: Reachability Analysis

Input vs. Output SplittingInput vs. Output Splitting

These two methods are “symmetric”These two methods are “symmetric” Their efficiency depends on the cardinality of the Their efficiency depends on the cardinality of the

input/output spacesinput/output spaces Typically output splitting is more efficient because the Typically output splitting is more efficient because the

output space is typically smaller than the input spaceoutput space is typically smaller than the input space As a result, the (potentially exponential) tree depth is bounded As a result, the (potentially exponential) tree depth is bounded

by a smaller numberby a smaller number

Variable 1

Variable 2

Variable 3

Page 12: Reachability Analysis

Quantification SchedulingQuantification Scheduling

Existential quantification and product commute if a Existential quantification and product commute if a variable to be quantified belongs to only one component variable to be quantified belongs to only one component in the productin the product

x [F(x,y) & G(x,y)] x [F(x,y) & G(x,y)] [ [x F(x,y)] & [x F(x,y)] & [x G(x,y)] x G(x,y)]

x [F(y) & G(x,y)] = F(y) & [x [F(y) & G(x,y)] = F(y) & [x G(x,y)]x G(x,y)]

Scheduling is performed by ordering the partitions, so Scheduling is performed by ordering the partitions, so that the variables are quantified as early as possiblethat the variables are quantified as early as possibleImage(Y) = Image(Y) = x,i [A(x) & T1(x,i,y) & T2(x,i,y) & … & Tk(x,i,y)] =x,i [A(x) & T1(x,i,y) & T2(x,i,y) & … & Tk(x,i,y)] =

= = xxkk,i,ikk [ Tk(x,i,y) & [ Tk(x,i,y) &

& & xxk-1k-1,i,ik-1k-1 [Tk(x,i,y) & [Tk(x,i,y) &

… … & & xx11,i,i11 [T1(x,i,y) & [T1(x,i,y) & xx00,i,i00 A(x)] … ] ] A(x)] … ] ]

Page 13: Reachability Analysis

IWLS 95 Image Computation IWLS 95 Image Computation MethodMethod

BDD variable ordering techniquesBDD variable ordering techniques Use of clusteringUse of clustering Ordering of the clustersOrdering of the clusters

Page 14: Reachability Analysis

BDD Variable OrderingBDD Variable Ordering

Given a set of partitions Given a set of partitions yj(i,x),yj(i,x), find the permutation find the permutation of partitions such that it minimizes the sumof partitions such that it minimizes the sum

Order supports of Order supports of yj(i,x) yj(i,x) individually and then insert individually and then insert the the yj yj variables as follows:variables as follows:

nj ji

jfCost1 1

)(psup)(

nni

jn yffyf ,)(psup)(psup,...,),(psup11

11

Page 15: Reachability Analysis

Partition ClusteringPartition Clustering

Group partitions based on their support using Group partitions based on their support using the overall limit on the BDD size of a partitionthe overall limit on the BDD size of a partition Partitions with close support should be grouped Partitions with close support should be grouped

togethertogether• This facilitates quantification schedulingThis facilitates quantification scheduling

Both many small partitions and few large partitions Both many small partitions and few large partitions are bad; the best result is somewhere in betweenare bad; the best result is somewhere in between

• Heuristically, it was found that the partition size of 1000-5000 Heuristically, it was found that the partition size of 1000-5000 BDD nodes works well in practiceBDD nodes works well in practice

Page 16: Reachability Analysis

Ordering ClustersOrdering Clusters

Start with two sets of clusters, Start with two sets of clusters, PP and and QQ PP is already ordered; is already ordered; Q Q is still to be ordered is still to be ordered

Order the clusters by first including those clusters that Order the clusters by first including those clusters that maximize the weight:maximize the weight:

W = 2 * Vci/Wci + Wci/Xci + Yci/Zci + mci/MciW = 2 * Vci/Wci + Wci/Xci + Yci/Zci + mci/Mci, where, whereVciVci is the number of vars to be quantified by adding is the number of vars to be quantified by adding ciciWciWci is the number of is the number of cscs and and i i vars in the support vars in the support ciciXciXci is the number of is the number of cscs and and i i vars that are not yet quantifiedvars that are not yet quantifiedYciYci is the number of is the number of nsns vars that will be added by vars that will be added by ciciZciZci is the number of is the number of nsns vars that are not yet in the product vars that are not yet in the productmci mci is the max BDD level of a var to be quantified inis the max BDD level of a var to be quantified in ci ciMci Mci is the max BDD level of a var to be quantified in is the max BDD level of a var to be quantified in QQ

Page 17: Reachability Analysis

Non-Linear Quantification Non-Linear Quantification Scheduling (ICCAD91)Scheduling (ICCAD91)

Instead of creating the linear order, create a tree orderInstead of creating the linear order, create a tree order Use a sample care set to dynamically schedule Use a sample care set to dynamically schedule

quantificationsquantifications Algorithm takes Algorithm takes VV (variables) and (variables) and FF (partitions) (partitions)

Quantify away variables that appear in one partition onlyQuantify away variables that appear in one partition only Iterate as long as the set of variablesIterate as long as the set of variables V V is not emptyis not empty

• Select a variable with the lowest cost Select a variable with the lowest cost Cost of is the sum of BDD sizes of functions, to which this var belongsCost of is the sum of BDD sizes of functions, to which this var belongs

• Select two smallest partitions with this variable in their support Select two smallest partitions with this variable in their support

• Conjoin these partitions and update the costsConjoin these partitions and update the costs Dynamically build the tree as the quantification proceedsDynamically build the tree as the quantification proceeds

Use this tree to compute images with other care setsUse this tree to compute images with other care sets

Page 18: Reachability Analysis

Example of Non-Linear SchedulingExample of Non-Linear Scheduling

Three-bit counterThree-bit counter y1 = x1’y1 = x1’ y2 = x1 y2 = x1 x2 x2 y3 = x1x2 y3 = x1x2 x3 x3

Care set Care set S = x1’S = x1’ PartitionsPartitions

F1(y1,x1) = F1(y1,x1) = y1 = x1’y1 = x1’ F2(y2,x1,x2) = F2(y2,x1,x2) = y2 = x1 y2 = x1 x2 x2 F3(y3,x1,x2,x3) = F3(y3,x1,x2,x3) = y3 = x1x2 y3 = x1x2 x3 x3 F4(x1) = F4(x1) = x1’x1’

Variables to quantifyVariables to quantify x1,x2,x3x1,x2,x3

F1 F2 F3 F4

x3

x2

x1&

&

&

Page 19: Reachability Analysis

SummarySummary These methods work for the partitioned transition relationThese methods work for the partitioned transition relation

Natural when the FSM (automaton) is represented by a circuitNatural when the FSM (automaton) is represented by a circuit Different approaches to computing the imageDifferent approaches to computing the image

Input splittingInput splitting Output splittingOutput splitting Quantification schedulingQuantification scheduling

Hybrid methodsHybrid methods Use partition clustering in addition to quantification scheduling (Berkeley, IWLS Use partition clustering in addition to quantification scheduling (Berkeley, IWLS

95)95) Use non-linear quantification scheduling (CMU, ICCAD 01)Use non-linear quantification scheduling (CMU, ICCAD 01) Partitioning (OR-decomposition) of the transition relationPartitioning (OR-decomposition) of the transition relation ““To split, or to conjoin” (mix the quantification scheduling and input/output To split, or to conjoin” (mix the quantification scheduling and input/output

splitting) (Somenzi, DAC 2000)splitting) (Somenzi, DAC 2000) ““The compositional far side of image computation” (Somenzi, ICCAD 2003)The compositional far side of image computation” (Somenzi, ICCAD 2003)

Tricks and speed-upsTricks and speed-ups Disjoint decompositionDisjoint decomposition Caching of intermediate results, etcCaching of intermediate results, etc

Page 20: Reachability Analysis

Using SAT for Image ComputationUsing SAT for Image Computation

Represent transition relation as a CNFRepresent transition relation as a CNF Iterate through the satisfying assignmentsIterate through the satisfying assignments

It is good if the solver can iterate through cubes rather than It is good if the solver can iterate through cubes rather than minterms of the solution spaceminterms of the solution space

Otherwise, it is only applicable to small output spaces (<10 vars)Otherwise, it is only applicable to small output spaces (<10 vars) When the problem becomes UNSAT, the collected When the problem becomes UNSAT, the collected

solutions represent the imagesolutions represent the image The care set is a set of additional constraintsThe care set is a set of additional constraints Hybrid approaches use SAT and BDDsHybrid approaches use SAT and BDDs

To represent the care set (FMCAD-00)To represent the care set (FMCAD-00) To finish searching subspaces whose size is small (FMCAD-00)To finish searching subspaces whose size is small (FMCAD-00) To represent parts of the CNF (DAC-03)To represent parts of the CNF (DAC-03)

Page 21: Reachability Analysis

Reachability AnalysisReachability Analysis Many applications explore the reachable state spaceMany applications explore the reachable state space Given an FSM (automaton) with the transition relation, find all the Given an FSM (automaton) with the transition relation, find all the

states reachable from the initial statestates reachable from the initial state Apply image computation repeatedly to compute the sets of reachable Apply image computation repeatedly to compute the sets of reachable

states in the next iteration (“onion rings”) until convergencestates in the next iteration (“onion rings”) until convergenceReachedStates = InitialState;ReachedStates = InitialState;iterate the following computation:iterate the following computation:

ReachedStatesNew = Image( TransitionRelation, ReachedStates );ReachedStatesNew = Image( TransitionRelation, ReachedStates );if (ReachedStatesNew = ReachedStates ) stop;if (ReachedStatesNew = ReachedStates ) stop;ReachedStates = ReachedStatesNew ;ReachedStates = ReachedStatesNew ;

Reachability analysis uses different methods of image computationReachability analysis uses different methods of image computation Relies on numerous improvementsRelies on numerous improvements

Simplification using don’t-caresSimplification using don’t-cares Iterative squaringIterative squaring Approximations, etcApproximations, etc