Presentation is loading. Please wait.

Presentation is loading. Please wait.

SAT-based Methods for Scalable Synthesis and Verification

Similar presentations


Presentation on theme: "SAT-based Methods for Scalable Synthesis and Verification"— Presentation transcript:

1 SAT-based Methods for Scalable Synthesis and Verification
Alan Mishchenko Robert Brayton Department of EECS, UC Berkeley

2 Overview Logic synthesis, BDDs, and satisfiability (SAT)
Canonical SAT-based computations SAT-based computations in logic synthesis ISOP computation, Boolean resubstitution, ECO, etc Agile SAT solving Conclusions 2

3 Terminology When a Boolean function is given in some form, logic synthesis derives a circuit for this function, while minimizing a cost function (area/delay/etc) Binary decision diagrams (BDDs) is a canonical graph-based representation of Boolean functions Boolean satisfiability (SAT) is a problem of checking whether a Boolean function, represented in a non-canonical way, is equal to constant 0

4 A Recent Trend Both BDDs and SAT are seen as computation engines used to solve practical problems in particular, problems arising in logic synthesis implemented and solved in EDA tools In recent years, traditional solutions based on Sums-of-Products (SOPs) and Binary Decision Diagrams (BDDs) are being gradually replaced by SAT-based ones both quality and runtime is often improved This presentation presents some of the latest SAT-based solutions

5 Boolean Satisfiability (SAT)
Boolean variable can take value 0 or 1 (for example, a) Literal is Boolean variable with its value (for example, a) Clause is a disjunction of literals: a + b CNF is a conjunction of clauses: (a + b) & (a + c) Given CNF representing a Boolean function, Boolean satisfiability checks whether the function is constant 0 Example of a satisfiabile problem: (a + b) & (a + c) one solution is a = 1, b = 1, c = 1 Example of an unsatisfiable problem: (a + b) & (a + b) & (a + b) & (a + b) no solution exists

6 SAT in Practical Applications
Netlist Answer: “SAT” or “UNSAT” CNF SAT solver CNF generator CNF Design constraints If SAT, a counter-example If UNSAT, a core User cost functions Both counter-examples and cores are useful in SAT-based applications. In practice, cores are often represented as subsets of assumptions that make the problem UNSAT.

7 Incremental SAT Initial CNF Round 1: SAT solver Initial assumptions Additional CNF Round 2: SAT solver New assumptions Additional CNF Round 3: SAT solver New assumptions Assumptions are CNF clauses used only in the current round – they are handled differently from the rest of CNF clauses.

8 BDDs vs SAT Complementary data structures: BDDs vs SAT BDDs SAT
trading space for time BDDs canonical, easy to use but difficult to construct (can mem out) SAT non-canonical, easy to construct but difficult to use (can time out) However, SAT is “better” in most cases Can we improve SAT by adopting some feature of BDDs? yes, we can have canonicity!

9 What Is Canonicity? Canonical representation Canonical computation
Representing Boolean functions in a unique way for a given Boolean function with a given variable order, only one representation is possible Canonical computation Computing Boolean functions in a unique way for a given Boolean function with a given variable order, only one result of computation is possible In the BDD world, we did not distinguish the two In the SAT world, we cannot have both However, we can have canonical computation!

10 Modification to SAT Needed for Canonical Computations
Without changing the SAT solver, we can add a new computation layer between the SAT solver and the application code Traditional: Input: CNF, assumptions Output: (1) satisfying assignment or (2) UNSAT core, that is, a subset of literals that make the instance unsatisfiable Proposed: Input: CNF, assumptions, variable order (1) canonical satisfying assignment or (2) canonical UNSAT core, that is, subset of literals that make the instance unsatisfiable

11 How Canonicity is Achieved?
Canonicity in SAT (as in BDDs) is achieved by using a variable order Now among all valid satisfying assignments (among all UNSAT cores), the lexicographically smallest one can be returned This assignment (core) is canonical because there is only one such assignment (core)

12 Choosing The Smallest Since we have a variable order, we can sort all assignments (cores) using this order, and take the first one in the list All satisfying assignments:  the smallest one Fortunately, there is no need to compute all assignments in order to find the minimum one

13 LEXSAT Input: cnf F Output: the smallest satisfying assignment as literals in array A array LEXSAT( cnf F ) { Initialize array A to have all negative literals in the given order; for ( i = 0; i <|A|; i++ ) { if ( F is UNSAT under assumptions A[0] through A[i] ) invert the polarity of literal A[i] to be positive; } return A;

14 LEXUNSAT Input: cnf F Output: the smallest satisfying assignment as literals in array A array LEXUNSAT( cnf F ) { Initialize array A to have all positive literals in the given order; for ( i = 0; i <|A|; i++ ) { if ( F is UNSAT under assumptions in A without A[i] ) invert the polarity of literal A[i] to be negative; } return A; A. Mishchenko, R. Brayton, A. Petkovska, M. Soeken, L. Amaru, and A. Domic, "Canonical computation without canonical representation", Proc. DAC'18.

15 Applications of LEX{SAT,UNSAT}
Canonical SAT-based ISOP (similar to BDD-based ISOP) useful in collapsing/refactoring, timing-driven optimization, etc Computing minimal supports in node minimization, resubstitution, Boolean decomposition, ECO Diversifying SAT assignments useful in both logic synthesis and formal verification Approximate computing, SMT solving, etc

16 ISOP Computation ISOP is a Sum-of-Products (SOP) that is prime and irredundant F = ab + cd is an ISOP G= ab + a is not an ISOP BDD-based ISOP computation is often used to transform functions into circuits by algebraic factoring to improve an existing circuit by locally collapsing it and re-factoring the resulting functions S. Minato, “Fast generation of Irredundant Sum-Of-Products forms from Binary Decision Diagrams”, Proc. SASIMI’92.

17 SAT-based ISOP Computation
UNSAT proof (finished computation) SAT assignment SAT solver S1 (ON-set) SAT solver S2 (OFF-set) (one minterm) F(x) F(x) one prime cube blocking clause CNF CNF (LEXUNSAT) ON-set OFF-set ISOP generator X A. Petkovska, A. Mishchenko, D. Novo, M. Owaida, and P. Ienne, "Progressive generation of canonical sums of products using a SAT solver", "Advanced Logic Synthesis" (ed. A. Reis), Springer, 2017.

18 Canonicity of the ISOP Resulting ISOP is canonical because the same fixed variable order is used to compute one satisfiable minterm to expand minterm into a prime to remove redundant primes if present Canonicity (as in the case of BDDs) guarantees that the result is the same for any original circuit (if function is given as a circuit) for any CNF generation algorithm for any SAT solver for any operating system, etc

19 Boolean Resubstitution
Given function F(x) and divisors g1(x), g2(x), etc, re-express F in terms of g1, g2, etc F(X) F(X) H(g) g1 g2 g3 g1 g2 g3 X X C.-C. Lee, J.-H. R. Jiang, C.-Y. Huang, and A. Mishchenko. "Scalable exploration of functional dependency by interpolation and incremental SAT solving", Proc. ICCAD '07.

20 SAT-based Support Computation in Boolean Decomposition
candidate support CNF SAT solver CNF OFF-set 1 1 SAT (invalid support) UNSAT (valid support) = F(X1) F(X2) g1 g2 g3 g1 g2 g3 Support generator ON-set X1 X2 Alternatively, support after resubstitution can be found using LEXUNSAT

21 Engineering Change Orders (ECO)
Given networks F(x) and S(x), find target n(x) and divisors g1(x), g2(x), etc, such that n(x) can be reexpressed in terms of g1, g2, etc, so that the updated outputs of F(x) are equivalent to those of S(x) X g1 g3 g2 F(X) n(X) X S(X) F(X) becomes S(X) n(g) g1 g2 g3 X

22 ECO in Terms of Primary Inputs
F(n, x)  S(x) Outputs Implementation F(n, x) Specification S(x) n Node Inputs x Boolean space Resubstitution / ECO of n in terms of x exists iff I(x) x n F(n, x) == S(x) is true, that is x n F(n, x)  S(x) is false, that is F(0, x)  S(x) F(1, x)  S(x) x F(0, x)  S(x) & F(1, x)  S(x) is UNSAT

23 ECO in Terms of Intermediate Divisors
F(n, x)  S(x) Outputs Implementation F(n, x) Specification S(x) n Node Divisors d Inputs x 1 M2 = 1 Consider M(n, x) = [F(n, x)  S(x)] & [d == D(x)] M1 = 1 M1(x1) = M2(x2) Consider M1(x1) = M(0, x1) and M1(x2) = M(1, x2) Resubstitution / ECO of n in terms of d exists iff d1 d2 x1x2 [M1(x1) & M2(x2) & [d1 == d2]] is UNSAT x1 x2 A. Q. Dao, N.-Z. Lee, L.-C. Chen, M. P.-H. Lin, J.-H. R. Jiang, A. Mishchenko, and R. Brayton, "Efficient computation of ECO patch functions", Proc. DAC'18.

24 Handling Multiple Targets
Often ECO cannot be solved by considering only one target, leading on a multi-target problem In this case, quantify all targets n, except one, in x n F(n, x)  S(x) The problem is thus reduced to 1-target Once this target is solved, we substitute the solution into the miter, and solve the next target, until all targets are solved Theorem: This method always finds a solution of the multi-target ECO problem, if it exists

25 Using Don’t-Cares This formulation of resubstitution/ECO exploits internal don’t-cares of the node in the network (can also use external don’t-cares) Moreover, the don’t-cares do not have to be computed explicitly before they are used Instead, the circuit-based constraint is added to the SAT solver, resulting in a solution that is correct under the don’t-cares A. Mishchenko and R. Brayton, "SAT-based complete don't-care computation for network optimization", Proc. DATE '05, pp

26 Agile SAT Solving Use simulation and circuit structure analysis whenever possible to avoid unnecessary SAT calls Simplify SAT-based formulations avoid QBF if regular SAT can be used experiment with different encodings try to reduce the number of variables and clauses reduce complexity of the constraints, even if it takes more variables counter-intuitively, sometimes larger CNFs lead to shorter runtimes Create formulations resulting in fast incremental runs in most practical applications in the area of logic synthesis, a well-tuned formulation leads to SAT runtimes not exceeding 1 sec per call (in fact, it is a fraction of a second on average) If constraints are complex, use lazy constraint addition Whenever possible, give initial solution to the SAT solver

27 Conclusion Reviewed logic synthesis and Boolean satisfiability
Discussed a number of problems in logic synthesis that can be solved using SAT ISOP computation, Boolean resubstitution, ECO Shared practical advice on developing efficient SAT based solutions

28 Abstract This presentation focuses on developing scalable SAT-based methods for circuit restructuring and addresses two related topics. The first one is how to make SAT-based computations canonical and why canonicity is important in practical applications. The second one is an award-winning SAT-based engine to perform engineering change orders (ECOs). The key component of the ECO engine is a method to compute minimal-support rectification functions in a canonical way, which guarantees their minimality. Both of these findings appeared as technical papers in DAC 2018.


Download ppt "SAT-based Methods for Scalable Synthesis and Verification"

Similar presentations


Ads by Google