SAT-based Methods for Scalable Synthesis and Verification

Slides:



Advertisements
Similar presentations
The Synthesis of Cyclic Circuits with SAT and Interpolation By John Backes and Marc Riedel ECE University of Minnesota.
Advertisements

NP-Hard Nattee Niparnan.
Proofs from SAT Solvers Yeting Ge ACSys NYU Nov
Reduction of Interpolants for Logic Synthesis John Backes Marc Riedel University of Minnesota Dept.
ECE 667 Synthesis and Verification of Digital Systems
Faster Logic Manipulation for Large Designs Alan Mishchenko Robert Brayton University of California, Berkeley.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Electrical and Computer Engineering Archana Rengaraj ABC Logic Synthesis basics ECE 667 Synthesis and Verification of Digital Systems Spring 2011.
Digitaalsüsteemide verifitseerimise kursus1 Formal verification: SAT SAT applied in equivalence checking.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
On the Relation between SAT and BDDs for Equivalence Checking Sherief Reda Rolf Drechsler Alex Orailoglu Computer Science & Engineering Dept. University.
Boolean Satisfiability Present and Future
Boolean Functions 1 ECE 667 ECE 667 Synthesis and Verification of Digital Circuits Boolean Functions Basics Maciej Ciesielski Univ.
2009/6/30 CAV Quantifier Elimination via Functional Composition Jie-Hong Roland Jiang Dept. of Electrical Eng. / Grad. Inst. of Electronics Eng.
A Semi-Canonical Form for Sequential Circuits Alan Mishchenko Niklas Een Robert Brayton UC Berkeley Michael Case Pankaj Chauhan Nikhil Sharma Calypto Design.
Resolution Proofs as a Data Structure for Logic Synthesis John Backes Marc Riedel Electrical.
Introduction to Formal Verification
Chih-Fan Lai1, J.-H. Roland Jiang1, and Kuo-Hua Wang2
Synthesis for Verification
SAT-based Methods: Logic Synthesis and Technology Mapping
Alan Mishchenko UC Berkeley
Delay Optimization using SOP Balancing
Faster Logic Manipulation for Large Designs
Enhancing PDR/IC3 with Localization Abstraction
SAT-Based Logic Optimization and Resynthesis
New Directions in the Development of ABC
Alan Mishchenko Robert Brayton UC Berkeley
Simple Circuit-Based SAT Solver
Robert Brayton Alan Mishchenko Department of EECS UC Berkeley
Versatile SAT-based Remapping for Standard Cells
SAT-based Methods: Logic Synthesis and Technology Mapping
Integrating an AIG Package, Simulator, and SAT Solver
A Boolean Paradigm in Multi-Valued Logic Synthesis
Synthesis for Verification
SAT-Based Logic Synthesis (yes, Logic Synthesis Is Everywhere
Faster Logic Manipulation for Large Designs
Introduction to Formal Verification
Fast Computation of Symmetries in Boolean Functions Alan Mishchenko
SAT-Based Area Recovery in Technology Mapping
Polynomial Construction for Arithmetic Circuits
Alan Mishchenko University of California, Berkeley
Canonical Computation without Canonical Data Structure
ECE 667 Synthesis and Verification of Digital Circuits
SAT-Based Optimization with Don’t-Cares Revisited
Canonical Computation Without Canonical Data Structure
Robert Brayton UC Berkeley
Scalable and Scalably-Verifiable Sequential Synthesis
Resolution Proofs for Combinational Equivalence
SAT-Based Logic Synthesis (yes, Logic Synthesis Is Everywhere!)
Integrating an AIG Package, Simulator, and SAT Solver
Introduction to Logic Synthesis
Canonical Computation without Canonical Data Structure
SAT-Based Logic Synthesis
SAT-based Methods: Logic Synthesis and Technology Mapping
Alan Mishchenko UC Berkeley
Recording Synthesis History for Sequential Verification
SAT-based Methods: Logic Synthesis and Technology Mapping
Delay Optimization using SOP Balancing
Alan Mishchenko UC Berkeley
Logic Synthesis: Past and Future
Canonical Computation without Canonical Data Structure
A Practical Approach to Arithmetic Circuit Verification
Innovative Sequential Synthesis and Verification
SAT-Based Logic Synthesis (yes, Logic Synthesis Is Everywhere!)
SAT-based Methods: Logic Synthesis and Technology Mapping
SAT-Based Logic Synthesis (yes, Logic Synthesis Is Everywhere!)
SAT-Based Logic Synthesis
Lecture 3: Incompletely Specified Functions and K Maps
Alan Mishchenko Department of EECS UC Berkeley
Integrating AIG Package, Simulator, and SAT Solver
Presentation transcript:

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

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

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

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

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

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.

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.

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!

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!

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

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)

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: 0000101101  the smallest one 0001111001 … 0111100111 Fortunately, there is no need to compute all assignments in order to find the minimum one

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;

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.

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

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.

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.

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

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.

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

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

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

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.

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

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. 418-423.

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

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

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.