• Non ci sono risultati.

Applications of SAT in EDA

N/A
N/A
Protected

Academic year: 2021

Condividi "Applications of SAT in EDA"

Copied!
4
0
0

Testo completo

(1)

1 Boolean Satisfiability in

Verification

Gianpiero Cabodi Stefano Quer

Politecnico di Torino Torino, Italy

{gianpiero.cabodi,stefano.quer}@polito.it http://staff.polito.it/{gianpiero.cabodi,stefano.quer}/

Applications of SAT in EDA

™ Test Pattern Generation:

‹Stuck-at, Delay faults, etc.

‹Redundancy Removal

™ Circuit Delay Computation

™ Combinational Equivalence Checking

™ Bounded/Unbounded Model Checking

™ Superscalar processor verification

™ FPGA routing

™ Noise analysis

ATPG

x4

x1

x2 x3

x5

x6 x7

x8

x9

ATPG

x4

x1

x2 x3

x5

x6 x7

x8

x9 s-a-1

ATPG

x4 x1

x2

x3

x5

x6 x7

x8

x9

= 0

x4 x1

x2 x3

x5

x6 x7

x8

x9

ATPG

x4 x1

x2

x3

x5

x6 x7

x8

x9

= 0

(2)

2

x4

x1

x2 x3

x5

x6 x7

x8

x9

ATPG

x4 x1 x2 x3

x5

x6 x7

x8

x9

= 0

CG

= 1

CF

x4

x1

x3

x5

x6 x7

x8

x9

x4

x1

x2 x3

x5

x6 x7

x8

x9

ATPG

x4 x1 x2 x3

x5

x6 x7

x8

x9

= 0

CG

= 1

CF

x4

x1

x3

x5

x6 x7

x8

x9

z = 1 ?

Delay Computation Using SAT

unstable stable

τ t y

χy,t

χy,t= 1⇔ node y stabilizes no ealier than t Characteristic Function [McGeer,ICCAD'91]

Can circuit delay be ≥ ∆?

Use characteristic functions χy,tto represent circuit delay computation as an instance of SAT !

Combinational Equivalence Checking

If z = 1 is unsatisfiable, the two circuits are equivalent ! CB

CA

z = 1 ?

Bounded Model Checking (BMC)

™ Bounded Model Checking (Biere, et al., TACAS 1999)

‹Property checking method based on finite unfolding of transition relation interleaved with checks of the property

—Sound – in its pure form no false positives are possible

—Incomplete – cannot guarantee correctness of property

‹Basic method

—CNF-based

– Use CNF-based SAT solver to represent unfolding and proof UNSAT for correctness of property

—Circuit-based

– Use ATPG-like reasoning to show untestability

—Hybrid

– Use circuit rewriting and SAT checking interleaved

• e.g. based on AND/INV graphs

™ Given

‹A finite transition system M

‹A property P (representing “good” states)

™ Note: We restrict our attention to safety properties

™ Does M allow a counterexample to ¬P of k transitions or fewer?

(3)

3

™ Property P holds in states k following initial state I0 S0

TR (S0,S1) TR (S1,S2) ∧ … ∧TR (Sk-1,Sk)

¬P (Sk)

BMC Unfolding

( )0

I s

¬P

¬P ¬P ¬P

1( , )0 1

T s s% T s s%2( ,1 2) T s%i(i1, )si

™ This problem can be translated into a SAT problem

™ Create an instance of SAT

‹CNF format

‹A counterexample is a path from a state satisfying S0to state satisfying P, where every transition satisfies TR

™ Bounded Model Check for length k Algorithm BMC(max_length){

forall i = 1 and i < max_length do { if (SAT(BMCi)) return FAIL

}

return SUCCESS;

}

Example

Transition system described by a set of constraints

ab p c

g

Each circuit element is a constraint note: a = at and a' = at+1 g = a ∧ b

p = g ∨ c c' = p

Model:

C = {

g = a ∧ b, p = g ∨ c, c' = p }

™ Unfold the model k times Uk= TR0∧ TR1∧ ... ∧ TRk-1

ab

c p

g a

b p c

g a

b p c

... g

S0 Pk

™Use SAT solver to check satisfiability of

S0UkPk

™A satisfying assignment is a counterexample of k steps

Applications

™ Debugging

‹Can find counterexamples using a SAT solver

™ Proving properties

‹Only possible if a bound on the length of the shortest counterexample is known

‹I.e., we need a diameter bound. The diameter is the maximum length of the shortest path between any two states

‹Worst case is exponential. Obtaining better bounds is sometimes possible, but generally intractable

Unbounded Model Checking (UMC)

™ We consider a variety of methods to exploit SAT and BMC for unbounded model checking

‹K-step induction

‹Abstraction

—Counterexample-based

—Non-counterexample-based

‹Exact image computations

—SAT solver tests for fixed point

—SAT solver computes image

‹Over-approximate image computations

(4)

4 Improvements

(Sheeran, FMCAD 2000)

™ Assert correctness of properties proven for previous frames

tpk(s0,sk)=

0≤i<kp(si)∧ t(si,si+1)

– Helps pruning the search, especially for optimization in this talk

tpsimplek (s0,sk)=

0≤i<kp(si)∧ t(si,si+1)∧

0≤i< j≤ksi≠ sj

Simple paths constraints

– Do not allow that a state is visited twice

– Does not really help in practice

invk= tpk(s0,sk)∧ ¬p(sk)

K-step inductiveness:

– In addition to BMCkcheck also

– Makes proof complete

Note low correlation between the two methods.

SAT based method may be a good alternative when BDD’s fail.

0,01 0,1 1 10 100 1000 10000

0,0 1

0,1 1 10 100 100 0

100 00 Run time of BDD-based method (s)

Run time of SAT-based method (s)

SAT versus BDDs (McMillan, CAV 2002)

Note low variance in times for BDD based technique.

Benchmarks may be biased in favor of BDD’s.

BDD’s are better overall.

But note relative immaturity of SAT

based method

Context

™ SAT is the quintessential NP-complete problem

™ Theoretically well-studied

™ Practical algorithms for large problem instances started emerging in the last five years

™ Has many applications in EDA and other fields

™ Can potentially have similar impact on EDA as BDDs

™ EDA professionals should have good working knowledge of SAT formulations and algorithms

Research Directions

™ Algorithms

‹Explore relation between different techniques

—backtrack search; conflict analysis; recursive learning;

branch-merge rule; randomization & restarts; clause inference; local search (?); BDDs (?)

‹Address specific solvers (circuits, incremental, etc.)

‹Develop visualization aids for helping to better understand problem hardness

™ Applications

‹Industry has applied SAT solvers to different applications

—SAT research requires challenging and representative publicly available benchmark instances !

Conclusion

™ SAT solvers are very effective at ignoring irrelevant facts

™ SAT solvers can produce refutations

™ We can exploit in a number of ways

‹BMC

‹Abstraction for UMC

‹Abstract image computations using interpolation

This makes it possible to model check localizable properties large systems

™ Approaches that compute exact images sacrifice this quality of SAT solvers

‹still useful as alternative to BDD's

™ For non-localizable properties, SAT-based BMC and UMC do not perform well

™ The capacity of SAT-based UMC is smaller than the one of BMC

‹Need to settle for bounded results

‹Debugging solution instead of complete verification

‹Use UMC only in late verification phases

Riferimenti

Documenti correlati

Boolean circuits (Bounded) Planning (Bounded) Model Checking Cryptography.

Learning: in future branches, when all-but-one literals in η are assigned, the remaining literal is assigned to false

limited sensitivity: one good setting, does not require expert users much higher capacity (more variables) than BDD based techniques Various techniques: Bounded Model

all but one literals in η are as “old” as possible Learning: in future branches, when all-but-one literals in η are assigned, the remaining literal is assigned to false

(a) List the sequence of unit-propagations following after the last decision, each literal tagged (in square brackets) by its antecedent clause?. (b) Derive the conflict clause

Let LRA be the logic of linear arithmetic over the rationals and EUF be the logic of equality and uninterpreted functions9. (4) Thus, with either technique, we can conclude that φ

Various techniques: Bounded Model Checking (BMC), K-induction, Interpolant-based, IC3/PDR,..... SAT-based Bounded Model Checking

satisfiability of the Boolean formulas is checked by a SAT solver can manage complex formulae on several 100K variables returns satisfying assignment (i.e., a counter-example)