1 / 22

Formal verification : SAT

SAT applied in equivalence checking. Formal verification : SAT. Equivalence Checking. Two principal approaches : Transform implementation and spec ( reference implementation) to a canonical form

Download Presentation

Formal verification : SAT

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SAT applied in equivalence checking Formal verification: SAT Digitaalsüsteemide verifitseerimise kursus

  2. Equivalence Checking • Two principal approaches: • Transform implementation and spec (reference implementation) to a canonical form • Search for an input assignment that would distinguish the responses of the implementation and reference implementation. • SATapplied for the latter Digitaalsüsteemide verifitseerimise kursus

  3. Satisfiability aka SAT • SAT: Boolean function is satisfiable if there exists a variable assignment for which the function is TRUE Digitaalsüsteemide verifitseerimise kursus

  4. Equivalence checking with SAT • Equivalence Checking can be reduced to SAT: d = f g • Iff dis satisfiable then fand gare NOT equivalent. Digitaalsüsteemide verifitseerimise kursus

  5. Specification (reference implementation) + + 1 Implementation Miter circuit SAT? Digitaalsüsteemide verifitseerimise kursus

  6. Satisfiability aka SAT • SATis transformed to CNF (i.e. product of sums). • Sums are called terms. • If terms have max 2 literals then 2-SAT  2-SAT solved in a polynomial time • 3-SAT is an NP complete task Digitaalsüsteemide verifitseerimise kursus

  7. Satisfiability aka SAT • Is this CNF satisfiable? • Yes: a = 1, b = 0, c = 0! • Worst case: 2ncombinations to try Digitaalsüsteemide verifitseerimise kursus

  8. Some terminology • If x in the formula alwaysin one phase (i.e. always inverted or always noninverted then x is unate. • If x in the formula in both phases then x is binate. • Term having just one literal called unit term. Digitaalsüsteemide verifitseerimise kursus

  9. Resolvent-algorithm • Resolvent: f = (x+A)(¬x+B) = (x +A)(¬x+B)(A+B) • Consensus: f = xC + ¬xD = xC + ¬xD + CD • Since SAT is in CNF we use resolvent. Digitaalsüsteemide verifitseerimise kursus

  10. Resolvent-algorithm • Choose another variable x. • If xis unate, apply unate rule. • If xis unit term, apply unit term rule. • If xis unate, solve resolvent of x. • Repeat the steps until all resolvents solved. • If the result is 1, then function satisfiable; otherwise not satisfiable (unit term). Digitaalsüsteemide verifitseerimise kursus

  11. a binate terms resolvent solved Resolvent-algorithm example Digitaalsüsteemide verifitseerimise kursus

  12. Resolvent-algorithm: summary • Resolvent-algorithm mathematically elegant but... • ... Designed for small SAT problems • In the worst case 2n resolvents to solve • In order to solve complex SAT instances, search based algorithms needed Digitaalsüsteemide verifitseerimise kursus

  13. Search-based SAT Digitaalsüsteemide verifitseerimise kursus

  14. Implication Graph • Directed acyclic graph: • Nodes labeled by variable names, followed by the rank of the decision • Variables preceded by minus were assigned 0, not preceded by minus were assigned 1 • Directed arcs show from which assignments what new assignments imply • Decision nodes (grey) and implication nodes (white) Digitaalsüsteemide verifitseerimise kursus

  15. Implication Graph • decisions: k = 1, j = 1, a = 0, b = 1. • reach a conflict: x = 1 ja x = 0! • learning: add a new term (¬e + h + ¬d) Digitaalsüsteemide verifitseerimise kursus

  16. Implication Graph Example Since e is a unit term then e = 1; first decision: a = 1 It implies that c = 0; the function is simplified: If we choose b=1, then conflict! Two possibilities to handle this: 1) Invert the last decision (backtrack) 2) Add a new term (learning): Digitaalsüsteemide verifitseerimise kursus

  17. Equivalence checking with SAT • Equivalence Checking can be reduced to SAT: d = f g • Iff dis satisfiable then fand gare NOT equivalent. Digitaalsüsteemide verifitseerimise kursus

  18. Specification (reference implementation) + + 1 Implementation Miter circuit SAT? Digitaalsüsteemide verifitseerimise kursus

  19. SATfor schematics: characteristic formula • Build CNFs corresponding to logic gates using logic implication: • ab = ¬a + b Digitaalsüsteemide verifitseerimise kursus

  20. a c & b SATfor schematics: characteristic formula • Implications for describing the AND gate: ¬a¬c & ¬b ¬c & ¬c  ¬a  ¬b • Characteristic formula for AND in CNF: (a+ ¬c) (b+ ¬c) (c+ ¬a+ ¬b) Digitaalsüsteemide verifitseerimise kursus

  21. a c 1 b SATfor schematics: characteristic formula • Implications for describing the OR-gate: ac & b c & c  a  b • Characteristic formula for OR in CNF: (¬a + c) (¬b + c) (¬c + a + b) Digitaalsüsteemide verifitseerimise kursus

  22. a d & b f 1 e c SATfor schematics: characteristic formula Characteristic formula for a schematic: (a+¬d)(b+¬d)(d+¬a+¬b)(¬c+¬e)(c+e)(¬d+f)(¬e+f)(¬f+d+e) Digitaalsüsteemide verifitseerimise kursus

More Related