160 likes | 380 Views
Boolean Satisfiability in Electronic Design Automation (EDA ). By Kunal P. Ganeshpure. Talk structure. Introduction to Boolean Satisfiability Applications of SAT in EDA CNF equations for logic gates and combinational circuits Backtrack search algorithm. Recursive learning. Conclusion.
E N D
Boolean Satisfiabilityin Electronic Design Automation (EDA ) By Kunal P. Ganeshpure
Talk structure • Introduction to Boolean Satisfiability • Applications of SAT in EDA • CNF equations for logic gates and combinational circuits • Backtrack search algorithm. • Recursive learning. • Conclusion
What is Boolean Satisfiability? • Given a boolean expression written using only AND, OR, NOT of variables, determine the true or false variable assignment that will make the entire expression true. • For example • Let • F = (a + b) · (a + ¬b) · (¬a + c) · (¬c + b) For a = 1 b = 1 c = 1 the formula is satisfied i.e. F = 1 • But if • F = (a + b) ·(a + ¬b) · (¬a + c) · (¬c + ¬a) In this case F is not satisfied for any variable assignments • SAT is an NP Complete problem NOTATION: ¬ : NOT operation · : AND operation + : OR operation
Importance of SAT in EDA • Many applications • Test pattern generation • Circuit Delay Computation • Logic optimization • Functional test vector generation • Combinational equivalence checking • Delay testing • Crosstalk noise analysis
Conjunctive normal form (CNF) • In the SAT problem, the formula is represented in the CNF form. • A formula consists of conjunction of clauses • A clause is a disjunction of literals • A literal is either a variable or its negation Literal =(A + B) · (¬B + C) · (A + C) Variable Clause
CNF equations for logic gates • A formula P = Q is logically equivalent to (P => Q) · (Q => P) • The above relation can be expressed as (¬P + Q) · (¬Q + P) • For a gate with a function z = f (a, b, c…) (z => f(a,b,c..)) · (f(a,b,c..) => z) Therefore (¬z + f(a,b,c..)) · (¬f(a,b,c..) + z) • Expand the above equation in POS form to obtain the CNF for the gate
CNF equations for gates (example) a z b z = a · b (z => (a · b)) ·((a · b) => z) (¬z + (a · b)) · (¬(a · b) + z) (¬z + a) · (¬z + b) · (z + ¬a + ¬b) Therefore the CNF formula is = (a + ¬z) · ( b + ¬z) · (¬a + ¬b + z)
a a z z b b a z a z b CNF formula of different gates = (¬a + z) · (¬b + z) · (a + b + ¬z) = (a + ¬z) · ( b + ¬z) · (¬a + ¬b + z) • = (a + b + ¬z) · (a + ¬b + z) • (¬a + ¬b + ¬z) · (¬a + b + z) = (a + z) · (¬a + ¬z)
CNF equations for a logic circuit DAG for the circuit Original circuit • Breath first propagation • through the DAG. • Take the conjunction of all • equations for all the nodes. O = ((f + ¬d) · (f + ¬e) · (f + d + ¬e)) · ((¬d + c) · (¬d + b) · (d + ¬c + ¬b)) · ((¬e + a) · (¬e + c) · (e + ¬a + ¬c)) · ((c + a) · (c + b) · (¬c + ¬a + ¬b))
Conflict Solution of SAT problem:Backtrack search algorithm • Backtrack search algorithm for SAT = (a + b) · (¬b + c + d) · (¬b + e) · (¬d + ¬e +f) = (a + b) · (¬b + c + d) · (¬b + e) · (¬d + ¬e +f) = (a+ b) · (¬b+ c + d) · (¬b+ e) · (¬d+ ¬e +f) = (a+ b) · (¬b + c + d) · (¬b + e) · (¬d + ¬e +f) = (a+ b) · (¬b + c + d) · (¬b + e) · (¬d + ¬e +f) = (a+ b) · (¬b + c + d) · (¬b + e) · (¬d + ¬e +f) Assume (decisions) c = 0 and f = 0 Assign a = 0 and imply the assignments Decide() Decide() Decide() yes no Any variable left? All variables tried both ways ? All variables tried both ways ? is unsatisfied is satisfied no Imply() yes Imply() Conflict ? Conflict ? yes no Backtrack() Backtrack()
Decision c = 0 Conflict Decision f = 0 Decision Imply Decision b = 1 b = 0 Imply d = 1 Backtrack Backtrack search algorithm • Backtrack search SAT algorithm = (a+ b) · (¬b+ c + d) · (¬b+ e) · (¬d+ ¬e +f) = (a + b) · (¬b + c + d) · (¬b + e) · (¬d + ¬e +f) = (a+ b) · (¬b+ c + d) · (¬b+ e) · (¬d+ ¬e +f) = (a + b) · (¬b + c + d) · (¬b + e) · (¬d + ¬e +f) = (a+ b) · (¬b + c + d) · (¬b + e) · (¬d + ¬e +f) = (a+ b) · (¬b + c + d) · (¬b + e) · (¬d + ¬e +f) = (a+ b) · (¬b + c + d) · (¬b + e) · (¬d + ¬e +f) = (a+ b) · (¬b + c + d) · (¬b + e) · (¬d + ¬e +f) Assume (decisions) c = 0 and f = 0 Assign a = 0 and imply the assignments a = 0 a = 1 Conflict
Recursive Learning • Search space reduction technique. • Study the different ways of satisfying the selected clause. • Determine the assignments that are necessary for the satisfiability instance to get satisfied. • Form a clause that describes the variable assignment.
Recursive Learning example Ψ = (u + x + ¬w) · (x + ¬y) · (w + y + ¬z) Ψ = (u+ x + ¬w) · (x + ¬y) · (w + y +¬z) Selected clause Assignments: {z = 1, u = 0} To satisfy the selected clause either w = 1 or y = 1. Case 1: w = 1 x = 1 for the equation to be satisfied Ψ = (u+ x +¬w) · (x + ¬y) · (w+ y +¬z) Ψ = (u+x+¬w) · (x+¬y) · (w+ y +¬z) Case 2: y = 1 x = 1 for the CNF to be satisfied Ψ = (u +x+ ¬w) · (x+¬y) · (w + y+¬z) Ψ = (u + x + ¬w) · (x +¬y) · (w + y+ ¬z) Thus (z = 1) AND (u = 0) => (x = 1) Therefore the clause (¬z + u + ¬x) represents the learned constraint Ψ = (u + x + ¬w) · (x + ¬y) · (w + y + ¬z) · (¬z + u + ¬x)
Conclusion • Satisfiability is an NP-complete problem • Solution of SAT involves the searching the space of all the possible variable assignment. • Search space reduction techniques like recursive learning are used to reduce the search space.
References • J.P. Marques-Silva, K. Sakallah, Boolean Satisfiability in Electronic Design Automation, DAC 2000. Review of SAT problem • T. Larrabee, “Test Pattern Generation Using Boolean Satisfiability,” IEEE Transactions on Computer-Aided Design, vol. 11, no. 1, pp. 4-15, January 1992.