SAT Based Efficient Directed Test Generation Techniques

Similar documents
Lecture 2: Symbolic Model Checking With SAT

Zchaff: A fast SAT solver. Zchaff: A fast SAT solver

Functional Test Generation Using Design and Property Decomposition Techniques

MajorSat: A SAT Solver to Majority Logic

Combinational Equivalence Checking

SAT Solver. CS 680 Formal Methods Jeremy Johnson

Acceleration of SAT-based Iterative Property Checking

Integrating a SAT Solver with Isabelle/HOL

QuteSat. A Robust Circuit-Based SAT Solver for Complex Circuit Structure. Chung-Yang (Ric) Huang National Taiwan University

Abstraction Refinement for Bounded Model Checking

Normal Forms for Boolean Expressions

Efficient SAT-based Boolean Matching for FPGA Technology Mapping

Efficient Directed Test Generation for Validation of Multicore Architectures

ESE535: Electronic Design Automation CNF. Today CNF. 3-SAT Universal. Problem (A+B+/C)*(/B+D)*(C+/A+/E)

HySAT. what you can use it for how it works example from application domain final remarks. Christian Herde /12

Finite Model Generation for Isabelle/HOL Using a SAT Solver

SAT Solvers. Ranjit Jhala, UC San Diego. April 9, 2013

Trading-off incrementality and dynamic restart of multiple solvers in IC3

Applying Multi-Core Model Checking to Hardware-Software Partitioning in Embedded Systems

CS-E3200 Discrete Models and Search

SAT-based Model Checking for C programs

Chapter 2 PRELIMINARIES

12. Use of Test Generation Algorithms and Emulation

Satisfiability (SAT) Applications. Extensions/Related Problems. An Aside: Example Proof by Machine. Annual Competitions 12/3/2008

Boolean Representations and Combinatorial Equivalence

EECS 219C: Formal Methods Boolean Satisfiability Solving. Sanjit A. Seshia EECS, UC Berkeley

Decision Procedures. An Algorithmic Point of View. Decision Procedures for Propositional Logic. D. Kroening O. Strichman.

Boolean Functions (Formulas) and Propositional Logic

Formally Certified Satisfiability Solving

HECTOR: Formal System-Level to RTL Equivalence Checking

Xuandong Li. BACH: Path-oriented Reachability Checker of Linear Hybrid Automata

Research Collection. Formal background and algorithms. Other Conference Item. ETH Library. Author(s): Biere, Armin. Publication Date: 2001

Bounded Model Checking with QBF

Space-Efficient Bounded Model Checking

Conflict Driven Learning and Non-chronological Backtracking

CSE507. Practical Applications of SAT. Computer-Aided Reasoning for Software. Emina Torlak

Solving 3-SAT. Radboud University Nijmegen. Bachelor Thesis. Supervisors: Henk Barendregt Alexandra Silva. Author: Peter Maandag s

To be or not programmable Dimitri Papadimitriou, Bernard Sales Alcatel-Lucent April 2013 COPYRIGHT 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.

EE382V: System-on-a-Chip (SoC) Design

System Correctness. EEC 421/521: Software Engineering. System Correctness. The Problem at Hand. A system is correct when it meets its requirements

SAT and Termination. Nao Hirokawa. Japan Advanced Institute of Science and Technology. SAT and Termination 1/41

Circuit versus CNF Reasoning for Equivalence Checking

Computer-Aided Program Design

Finite State Verification. CSCE Lecture 21-03/28/2017

On Computing Minimum Size Prime Implicants

Finite State Verification. CSCE Lecture 14-02/25/2016

Satisfiability Solvers

Constraint Satisfaction Problems

On Formal Verification of Pipelined Processors with Arrays of Reconfigurable Functional Units. Miroslav N. Velev and Ping Gao

SAT Solver Heuristics

Deductive Methods, Bounded Model Checking

Bounded Model Checking with Parametric Data Structures

System Debugging and Verification : A New Challenge. Center for Embedded Computer Systems University of California, Irvine

Seminar decision procedures: Certification of SAT and unsat proofs

Automatic Abstraction without Counterexamples

A Structure-Based Variable Ordering Heuristic for SAT. By Jinbo Huang and Adnan Darwiche Presented by Jack Pinette

A Scalable Algorithm for Minimal Unsatisfiable Core Extraction

9.1 Cook-Levin Theorem

EECS 219C: Computer-Aided Verification Boolean Satisfiability Solving. Sanjit A. Seshia EECS, UC Berkeley

An Introduction to SAT Solvers

Combinational Equivalence Checking Using Incremental SAT Solving, Output Ordering, and Resets

CS 267: Automated Verification. Lecture 13: Bounded Model Checking. Instructor: Tevfik Bultan

Parallelizing SAT Solver With specific application on solving Sudoku Puzzles

DM841 DISCRETE OPTIMIZATION. Part 2 Heuristics. Satisfiability. Marco Chiarandini

Validating SAT Solvers Using an Independent Resolution-Based Checker: Practical Implementations and Other Applications

BITCOIN MINING IN A SAT FRAMEWORK

1 Inference for Boolean theories

Rethinking Automated Theorem Provers?

Efficient test case generation for validation of UML activity diagrams

COVERAGE-DRIVEN TEST GENERATION FOR FUNCTIONAL VALIDATION OF PIPELINED PROCESSORS

NP-Completeness. Algorithms

NiVER: Non Increasing Variable Elimination Resolution for Preprocessing SAT instances

SAT, SMT and QBF Solving in a Multi-Core Environment

Predicate Abstraction and Refinement Techniques for Verifying Verilog

Provably Optimal Test Cube Generation using Quantified Boolean Formula Solving

CDCL SAT Solvers. Joao Marques-Silva. Theory and Practice of SAT Solving Dagstuhl Workshop. April INESC-ID, IST, ULisbon, Portugal

Hybrid Constraint Solvers

SMT-Style Program Analysis with Value-based Refinements

Example: Map coloring

Symbolic and Concolic Execution of Programs

Combinatorial Algorithms. Unate Covering Binate Covering Graph Coloring Maximum Clique

Minimum Satisfying Assignments for SMT. Işıl Dillig, Tom Dillig Ken McMillan Alex Aiken College of William & Mary Microsoft Research Stanford U.

Satisfiability Modulo Theories. DPLL solves Satisfiability fine on some problems but not others

Symbolic Methods. The finite-state case. Martin Fränzle. Carl von Ossietzky Universität FK II, Dpt. Informatik Abt.

SAT/SMT Solvers and Applications

PBS: A Pseudo-Boolean Solver and Optimizer

Type checking. Jianguo Lu. November 27, slides adapted from Sean Treichler and Alex Aiken s. Jianguo Lu November 27, / 39

Course Summary! What have we learned and what are we expected to know?

Set 5: Constraint Satisfaction Problems Chapter 6 R&N

ABC basics (compilation from different articles)

SAT Solvers: A Condensed History. Sharad Malik Princeton University COS 598d 3/1/2010

Parallel and Distributed Computing

arxiv: v2 [cs.pl] 3 Apr 2018

4.1 Review - the DPLL procedure

Introduction to Formal Methods

Guiding Real-World SAT Solving with Dynamic Hypergraph Separator Decomposition

Integration of Supercubing and Learning in a SAT Solver

On Resolution Proofs for Combinational Equivalence Checking

Computability Theory

Improving Coq Propositional Reasoning Using a Lazy CNF Conversion

Transcription:

SAT Based Efficient Directed Test Generation Techniques Presented by Mingsong Chen Software Engineering Institute East China Normal University May 5, 2011

Outline Introduction Model Checking Based Test Generation SAT-based Bounded Model Checking DPLL algorithm Conflict clause Efficient Test Generation Approaches Conflict clause forwarding based approaches Decision ordering based techniques Property decomposition based methods Conclusion 2

Outline Introduction Model Checking Based Test Generation SAT-based Bounded Model Checking DPLL algorithm Conflict clause Efficient Test Generation Approaches Conflict clause forwarding based approaches Decision ordering based techniques Property decomposition based methods Conclusion 3

Functional Validation of SOC Designs Engineer Years 2000 200 20 2007 2001 1995 1000B 10B 100M Simulation Vectors 1M 10M 100M Logic Gates Source: G. Spirakis, keynote address at DATE 2004 Source: Synopsys Functional validation is a major bottleneck during SoC development! (up to 70% of time and resources are used)

Functional Validation Methods Simulation (Validation) The process of gaining confidence by examining the behavior of the implementation using input/output test vectors Incompleteness verification: not possible for all input vectors Applicable to large designs Formal (Verification) Mathematical proof that a system (implementation) behaves according to a given set of requirements (specification) Complete verification Applied to small and critical components due to the state space explosion problem 5

Approaches for Specification Validation Verification / Validation Formal Verification Simulation-based Validation Theorem Proving Model Checking SAT Solving Random Test Constrained Random Test Directed Test Bounded Model Checking SAT-based Bounded Model Checking Validation using a combination of simulation based techniques and formal methods. 6

Test Generation using Model Checking Model Checking (MC) Specification is translated to formal models, e.g., SMV Desired behaviors in temporal logic properties, e.g. LTL Property falsification leads to counterexamples (tests) Test Generation Generate a counterexample: sequence of variable assignments ATM Model Password Input is always true Problem: Test generation is very costly or not applicable in many complex scenarios. An Example Model Checker Approach: Generate a Exploit test to fail passward learning input to reduce validation complexity User name Password User intput - Reduction of test generation time Bob ABC ABD - Enables test generation in complex scenarios 7

Outline Introduction Model Checking Based Test Generation SAT-based Bounded Model Checking DPLL algorithm Conflict clause Efficient Test Generation Approaches Conflict clause forwarding based approaches Decision ordering based techniques Property decomposition based methods Conclusion 8

SAT-based Bounded Model Checking The safety property P is valid up to cycle k iff Ω(k) is not satisfiable. p p p p p... s 0 s 1 s 2 s k-1 s k If Ω(k) is satisfiable, then we can get an assignment which can be translated to a test.

SAT Decision Procedure Given a ϕ in CNF: (x+y+z)( x+y)( y+z)( x+ y+ z) x ϕ ϕ x Decide() (y),( y,z),( y, z) (y,z),( y,z) x=1@ level1 y y z z (z),( z) () () (y),( y) z=1@level2 z z X y y () () () () X X X X Deduce() Resolve_Conflict() y=0 or 1@level2

DPLL Algorithm while (1){ run_periodic_function(); if( decide_next_branch() ){ while (deduce() Implication == CONFLICT) { } blevel = analyze_conflicts(); Conflict Backtrack if( blevel<0 ) return UNSAT; } } else return SAT; BCP = Implication Number + Conflict Backtrack Boolean Constraint Propagation (BCP) consumes up to 80% of the time and resources during SAT solving

Implication Graph, Conflict Clause ω 1 = (x 2 x 6 x 4 ) ω 2 = ( x 8 x 3 x 7 ) ω 3 = ( x 1 x 4 x 5 ) ω 4 = ( x 3 x 4 ) ω 5 = ( x 2 x 3 x 8 ) ω 6 : ( x 1 x 5 x 6 x 7 ) x5@4 x1@3 x4@4 x6@1 x2@4 x3@4 cut1 x8@4 x8@4 conflict x7@2 Conflict clause can be treated as the knowledge learned during the SAT solving. It is a restriction of the variable assignment.

Same Property but Different Bounds p 1 k p 1 3 p 1 2 p 1 1 Δp 1 k p 1 3 Forward Δp 1 3 Forward p 1 1 p 1 2 Δp 1 2 The minimal bound is k: Save: ΔP 1 2 + Δp 13 + +Δp 1 k-1 + + Δp 1 k O. Strichman. Pruning Techniques for the SAT-Based Bounded Model Checking Problems. CHARME, 2001

Outline Introduction Model Checking Based Test Generation SAT-based Bound Model Checking DPLL algorithm Conflict clause Efficient Test Generation Approaches Conflict clause forwarding based approaches Decision ordering based techniques Property decomposition based methods Conclusion 14

Same Design, Different Properties P1 P2 rg2 rg3 rg1 rgk rg4 rb2 P3 rb1 rb4 rb3 rbn Benefit: Original: Red + Blue + Green Now: Red + (Blue Δblue) + (Green Δgreen) Save: Δblue + Δgreen Forward Forward Δgreen Δblue

Property Clustering Clustering properties is to exploit the structural and behavior similarity and maximize the validation reuse Property clustering methods: Based on structural similarity Based on textual similarity Based on Influence (Cone of Influence) Based on CNF intersections

Identification of Common Conflict Clauses X1@3 x5@4 x4@4 x7@2 x6@1 x2@4 x3@4 cut1 x8@4 x8@4 conflict Conflict Clause ( X1 X5 X6 X7 ) Conflict Side Clauses Clauses Group ID 4 3 2 1 ( X2 X3 X8 ) 0 1 1 1 (X3 X7 X8 ) 1 0 1 0 (X2 X3 X6 ) 1 1 1 1 ( X3 X4) 1 0 1 0 ( X1 X4 X5 ) 1 1 1 0 Let be the bit AND operation. (0111 1010 1111 1010 1110) = 0010. So the conflict clause ( X1 X5 X6 X7 ) can be reused for property 2.

Test Generation For A Property Cluster 1. Cluster the properties based on similarity 2. for each cluster i, of properties 1 Select base property p i 1, and generate CNF i 1 2 for each CNF i j of p i j (j 1) in cluster i a) Perform name substitution on CNF i j b) Compute intersection INT i j between CNF i 1 and CNF i j c) Mark the clauses of CNF i 1 using INT i j endfor 3 Solve CNF i 1 to get the conflict clauses CC i 1 and test i 1 4 for each CNF i j (j 1) a) CNF i j = CNF i j + Filter (CC i j, j) b) Solve CNF i j to get test i j endfor endfor

Case Study 1 : MIPS Processor PC Fetch Memory Register File Decode The Architecture IALU MUL1 MUL2 FADD1 FADD2 FADD3 DIV MIPS Processor - 20 nodes - 24 edges - 91 instructions MUL7 FADD4 Decode WriteBack Unit Storage Pipeline edge Data-transfer edge

MIPS Processor Results The processor has five pipeline stages: fetch, decode, execute, memory and writeback. There are totally 171 properties generated. Methods Structure Textual Influence Intersection Num. of Clusters 16 32 27 17 zchaff (sec.) (Existing Approach) 3275.07 3266.73 3241.00 3323.34 Our Method (sec.) 957.42 879.19 754.58 751.36 Speedup 3.42 3.72 4.33 4.42 zchaff is a state-of-the-art SAT Solver.

Case Study 2 : OSES VerifyOrd er Settle_tra de Trade_S Update_SHolderDB _S Update_StockDB _S Update_OrderDB_ S Update_orderDB_ NM Trade_N M Trade_ PE Update _stockdb_pe Update_StockerHolderDB_ PE Update_OrderDB_ PE UpdateM ap AddOrderForm List GetNewOrd er Trade _F CheckLimitPr ice Update_orderDB _F End Order Order Error Get Order Result Limit Buy Market Buy Marker Sale Limit Sale t0 t11 t1 t2 t12 t9 t8 t6 t5 t7 t3 t15 t16 t13 t14 t17 t18 t10 t22 t27 t28 t29 t23 t29 t26 t2 5 t2 4 t20 t21 t19 t4

OSES Results This case study is a on-line stock exchange system. The activity diagram consists of 27 activities, 29 transitions and 18 key paths. There are totally 51 properties. Methods Structure Textual Influence Intersection Num. of Clusters 18 9 12 13 zchaff (sec.) (Existing Approach) 2119.16 2159.92 2311.47 2134.26 Our Method (sec.) 939.25 926.98 966.19 794.48 Speedup 2.26 2.33 2.44 2.69

Outline Introduction Model Checking Based Test Generation SAT-based Bounded Model Checking DPLL algorithm Conflict clause Efficient Test Generation Approaches Conflict clause forwarding based approaches Decision ordering based techniques Property decomposition based methods Conclusion 23

Decision Ordering Problem Given a ϕ in CNF: (x+y+z)( x+y)( y+z)( x+ y+ z) ϕ ϕ x x (y),( y,z),( y, z) (y,z),( y,z) y y z z (z),( z) () () (y),( y) z z X y y A wise decision ordering can quickly locate the true assignment. Bit value ordering Variable Orderinig () () () () X X X X Best decision: x, z 24

Two Similar SAT Problems SAT 1 SAT 2 a a b b b b c c c c c c c c F F F S F F F F F F F F F F F S Ordering: a, a, b, b, c, c Ordering: a, a, b, b, c, c Without Learning, 7 conflicts in SAT2.

Learning: Bit Value Ordering SAT 1 SAT 2 a Bit value: a=1,b=0,c=0 a b b b b c c c c c c c c F F F S F F F F F F F F F F F S Ordering: a, a, b, b, c, c Ordering: a, a, b, b, c, c With bit value learning, 4 conflicts in SAT2.

Learning: Bit Value + Variable Ordering SAT 1 SAT 2 Bit value: a=1,b=0,c=0 a Variable order: b>c>a b b b c c c c c c F F F S F F F F Ordering: a, a, b, b, c, c a a a a F F F F F F F S Ordering: b, b, c, c, a, a With bit value+ variable order learning, 1 conflict in SAT2.

Our method An Example with 3 properties VarStat a b c d [0] V 0 0 0 0 [1] V 0 0 0 0 P1: a=0, b=0, c=1, d=1 VarStat a b c d [0] V 1 1 0 0 [1] V 0 0 1 1 P2: a=0, b=0, c=1, d=0 P3: a=0, b=0, c=1, d=? score(a), score(a ) score(b), score(b ) score(c), score(c ) Predict ordering for P3 VarStat a b c d [0] V 2 2 0 1 [1] V 0 0 2 1 Approach: Using the statistics of the counterexamples when checking the properties in a cluster - Count of values bit value ordering - Variance of counts of two literals variable ordering

Case Study 1 : MIPS Processor For each function unit (ALU, DIV, FADD and MUL) in the pipelined processor. We generate 4 properties. Property (test) zchaff (sec) Clustering Speedup (over zchaff) Decision Ordering Speedup (over Clustering) ALU 23.20 23.20 1 23.20 1 P1 20.73 2.74 7.57 0.18 15.22 P2 21.33 3.01 7.09 0.15 20.07 P3 18.03 2.70 6.68 0.29 9.31 DIV 18.78 18.78 1 18.78 1 P4 23.55 2.72 8.66 0.13 20.92 P5 18.31 3.60 5.09 0.14 25.71 P6 18.11 3.72 4.87 0.18 20.67 FADD 22.90 22.90 1 22.90 1 P7 16.95 4.46 3.80 0.23 19.39 P8 18.89 2.71 6.97 0.16 16.94 P9 19.80 4.70 4.21 0.39 12.05 MUL 64.21 64.21 1 64.21 1 P10 59.15 3.36 17.60 0.24 14.00 P11 59.65 3.85 15.49 0.45 8.56 P12 73.98 6.28 11.78 0.18 34.89

Case Study 1 : MIPS Processor Test generation time is significantly improved - Drastic reduction of conflict clauses - Drastic reduction in number of implications

Case Study 2 : OSES This case study is a on-line stock exchange system. The activity diagram consists of 27 activities, 29 transitions and 18 key paths. Cluster Size zchaff Clustering Speedup (over zchaff) Decision Ordering Speedup (over Clustering) C1 3 1.18 2.18 0.54 0.70 3.11 C2 4 14.53 9.53 1.52 0.78 12.22 C3 8 375.91 170.06 2.21 36.19 4.70 C4 4 12.98 8.33 1.56 1.24 6.72 C5 4 7.13 16.88 0.42 1.02 16.55 C6 8 720.13 474.68 1.52 28.60 16.60 C7 4 10.80 24.55 0.44 1.95 12.59 C8 8 656.95 321.14 2.05 77.65 4.14 C9 8 248.17 82.42 3.01 37.93 2.17 Average - 227.53 123.21 1.85 20.67 5.97

Outline Introduction Model Checking Based Test Generation SAT-based Bounded Model Checking Implication graph SAT decision procedure DPLL algorithm Efficient Test Generation Approaches Conflict clause forwarding based approaches Decision ordering based techniques Property decomposition based methods Conclusion 32

Property Decomposition Techniques Property Property p1 p2 pn p1 p2 pn t1 t2 tn Learnings Drawback: Composition Hard to automate BMC Test Koo et al. Functional Test Generation using Property Decomposition Techniques. ACM TECS, 2009 Test 33

Spatial Decomposition V1 V2 Cone1 p1 COI(p1) < COI(p2) < COI(p3) <COI(P) V3 V4 V5 Cone2 p2 P Time(p1) < Time(p2) < Time(p3) <Time(P) Cone3 p3 Vn Learning from P1 can reduce the Time(P)? 34

Temporal Decomposition T2 T1 T3 e1 e3 e4 e5 e2 e6 Cause effect relation: e1 e2 e3 e4 e5 e6 Happen before relation: e1<e3<e4 <e5<e2<e6 35

Temporal Decomposition e3 e4 e5 1 2 e1 1 e2 3 e7 e8 e9 2 1 5 e6 5 event Cause-effect Happen-before!F(e1)!F(e3)!F(e7)!F(e9) 36

Case Study 1: MIPS Processor We generated 6 complex properties based on interaction faults on various function unit (ALU, DIV, FADD and MUL), which cannot handled by temporal decomposition. Property (test) zchaff (sec) Num. of Clusters Num. of Sub-props Spatial (sec) Speedup P1 127.52 3 2 49.41 2.58 P2 49.24 3 2 15.73 3.13 P3 9.18 2 1 4.99 1.84 P4 13.78 2 1 7.28 1.89 P5 31.63 3 2 12.74 2.48 P6 120.72 3 2 54.21 2.23 Speedup: 1.84-3.13 times

Case Study 2 : OSES This case study is a on-line stock exchange system. The activity diagram consists of 27 activities, 29 transitions and 18 key paths. Property zchaff (sec) Bound Num. of Subproperties Temporal (sec) Speedup P1 25.99 8 3 0.78 33.32 P2 48.99 10 4 2.69 18.21 P3 39.67 11 5 3.45 11.50 P4 247.26 11 5 22.46 11.01 P5 160.73 11 5 15.68 10.25 P6 97.54 11 4 1.56 62.53 P7 31.39 10 4 12.31 2.55 P8 161.74 11 4 12.62 12.82 P9 142.91 10 4 17.57 8.13 P10 33.77 10 4 1.76 19.19 Speedup: 3-62 times

Outline Introduction Model Checking Based Test Generation SAT-based Bounded Model Checking DPLL algorithm Conflict clause Efficient Test Generation Approaches Conflict clause forwarding based approaches Decision ordering based techniques Property decomposition based methods Conclusion 39

Conclusion Validation is a major bottleneck in HW/SW designs This presentation discusses how to reduce the overall validation effort for directed test generation from models. 1. Conflict clause forwarding and property clustering methods 2. Efficient decision ordering approaches 3. Property decomposition techniques Successfully applied on both HW/SW designs Several orders of magnitude reduction in overall validation effort 40

Thank you!