Hardware Verification 2IMF20

Similar documents
Unit 4. Combinational Circuits

CS 573 Automata Theory and Formal Languages

Propositional models. Historical models of computation. Application: binary addition. Boolean functions. Implementation using switches.

NON-DETERMINISTIC FSA

1. Logic verification

Logic Synthesis and Verification

Chapter 4 State-Space Planning

Engr354: Digital Logic Circuits

Project 6: Minigoals Towards Simplifying and Rewriting Expressions

1 PYTHAGORAS THEOREM 1. Given a right angled triangle, the square of the hypotenuse is equal to the sum of the squares of the other two sides.

Lecture 11 Binary Decision Diagrams (BDDs)

Technische Universität München Winter term 2009/10 I7 Prof. J. Esparza / J. Křetínský / M. Luttenberger 11. Februar Solution

Review of Gaussian Quadrature method

Metodologie di progetto HW Technology Mapping. Last update: 19/03/09

Algorithms & Data Structures Homework 8 HS 18 Exercise Class (Room & TA): Submitted by: Peer Feedback by: Points:

Lecture Notes No. 10

expression simply by forming an OR of the ANDs of all input variables for which the output is

Exercise 3 Logic Control

Linear Algebra Introduction

Parse trees, ambiguity, and Chomsky normal form

Solutions - Homework 1 (Due date: September 9:30 am) Presentation and clarity are very important!

Chapter 8 Roots and Radicals

Nondeterministic Automata vs Deterministic Automata

AP Calculus BC Chapter 8: Integration Techniques, L Hopital s Rule and Improper Integrals

22: Union Find. CS 473u - Algorithms - Spring April 14, We want to maintain a collection of sets, under the operations of:

Fast Boolean Algebra

Convert the NFA into DFA

Discrete Structures, Test 2 Monday, March 28, 2016 SOLUTIONS, VERSION α

Boolean algebra.

Lecture 3. In this lecture, we will discuss algorithms for solving systems of linear equations.

CS12N: The Coming Revolution in Computer Architecture Laboratory 2 Preparation

How do we solve these things, especially when they get complicated? How do we know when a system has a solution, and when is it unique?

Logic Synthesis and Verification

Boolean Algebra. Boolean Algebra

2. Binary Decision Diagrams Fachgebiet Rechnersysteme1

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-2700: Digital Logic Design Fall Notes - Unit 1

EECS 141 Due 04/19/02, 5pm, in 558 Cory

Fault Modeling. EE5375 ADD II Prof. MacDonald

Resources. Introduction: Binding. Resource Types. Resource Sharing. The type of a resource denotes its ability to perform different operations

I1 = I2 I1 = I2 + I3 I1 + I2 = I3 + I4 I 3

CS 491G Combinatorial Optimization Lecture Notes

6.5 Improper integrals

CHENG Chun Chor Litwin The Hong Kong Institute of Education

Algorithm Design and Analysis

Global alignment. Genome Rearrangements Finding preserved genes. Lecture 18

CS 2204 DIGITAL LOGIC & STATE MACHINE DESIGN SPRING 2014

where the box contains a finite number of gates from the given collection. Examples of gates that are commonly used are the following: a b

The Word Problem in Quandles

Part 4. Integration (with Proofs)

(a) A partition P of [a, b] is a finite subset of [a, b] containing a and b. If Q is another partition and P Q, then Q is a refinement of P.

8 THREE PHASE A.C. CIRCUITS

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-378: Computer Hardware Design Winter Notes - Unit 1

Computational Biology Lecture 18: Genome rearrangements, finding maximal matches Saad Mneimneh

Discrete Structures Lecture 11

Nondeterministic Finite Automata

Connected-components. Summary of lecture 9. Algorithms and Data Structures Disjoint sets. Example: connected components in graphs

PAIR OF LINEAR EQUATIONS IN TWO VARIABLES

Introduction to Olympiad Inequalities

Interpreting Integrals and the Fundamental Theorem

Algorithm Design and Analysis

p-adic Egyptian Fractions

Section 1.3 Triangles

Combinational Circuits Verification. 2. Verification by Equivalence Checking. Combinational Equivalence Checking (con t)

Comparing the Pre-image and Image of a Dilation

Lecture 9: LTL and Büchi Automata

First Midterm Examination

Lecture 6: Coding theory

Lecture 6. CMOS Static & Dynamic Logic Gates. Static CMOS Circuit. PMOS Transistors in Series/Parallel Connection

A Functorial Query Language

EE 108A Lecture 2 (c) W. J. Dally and P. Levis 2

CS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4

BİL 354 Veritabanı Sistemleri. Relational Algebra (İlişkisel Cebir)

Overview of Today s Lecture:

ENGR 3861 Digital Logic Boolean Algebra. Fall 2007

Instructions. An 8.5 x 11 Cheat Sheet may also be used as an aid for this test. MUST be original handwriting.

set is not closed under matrix [ multiplication, ] and does not form a group.

Alpha Algorithm: Limitations

Chapter 3. Vector Spaces. 3.1 Images and Image Arithmetic

Lecture 3. Introduction digital logic. Notes. Notes. Notes. Representations. February Bern University of Applied Sciences.

CS 275 Automata and Formal Language Theory

Combinational Logic. Precedence. Quick Quiz 25/9/12. Schematics à Boolean Expression. 3 Representations of Logic Functions. Dr. Hayden So.

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS

Logical Algebra 1. By Vern Crisler Copyright 2000; 2013

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

Mid-Term Examination - Spring 2014 Mathematical Programming with Applications to Economics Total Score: 45; Time: 3 hours

Things to Memorize: A Partial List. January 27, 2017

Designing finite automata II

ANALYSIS AND MODELLING OF RAINFALL EVENTS

Lecture 2 : Propositions DRAFT

Closure Properties of Regular Languages

The Regulated and Riemann Integrals

A Differential Approach to Inference in Bayesian Networks

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

6.004 Computation Structures Spring 2009

Minimal DFA. minimal DFA for L starting from any other

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.

m2 m3 m1 (a) (b) (c) n2 n3

How do we solve these things, especially when they get complicated? How do we know when a system has a solution, and when is it unique?

Lecture 3: Equivalence Relations

Transcription:

Hrdwre Verifition 2IMF20 Julien Shmltz Leture 02: Boolen Funtions, ST, CEC

Course ontent - Forml tools Temporl Logis (LTL, CTL) Domin Properties System Verilog ssertions demi & Industrils Proessors Networks Che oherene Sum-of-Produts (SoP) Conjuntive Norml Form (CNF) Binry Deision Digrms (BDDs) nd-inverter Grphs (IGs) Forml Tools RTL Code Forml Model OK! NOK! Witness nd ounter-exmples 2

Gol: Reson out hrdwre» Given two iruits: do they ompute the sme funtion?» Equivlene heking» Comintoril nd Sequentil (next leture)» Notion of Miter (XOR etween outputs)» Given property nd iruit: prove tht the iruit stisfies the property» Forml Property Verifition (FPV) (some letures from now)» In ll se, mthemtil representtion of the iruit is needed. 3

Importnt onepts» The need to represent Boolen funtions effiiently» Different representtions hve different pros nd ons» Get to know the min representtions used in prtie» SoP» DNF nd CNF» DG» IG» BDD» Hve feeling out how good/d they re» Know how they re used in Comintoril Equivlene Cheking» Bsi priniple of ST solvers» Note: representing Boolen funtions is tive reserh» Cyli Boolen Ciruits y Riedel nd Bruk, Disrete pplied Mthemtis (2012) 4

Progrm for tody» Boolen funtions» Boolen Stisfiility» Comintoril Equivlene Cheking 5

Hrdwre to Forml Representtion» The first step efore pplying ny forml nlysis tehnique is to otin forml representtion of the design.» from 4 vlued logi to Boolens» Symoli Boolen expressions of the wires.» Different representtions of these expressions» Direted yli Grphs (DG)» Sum-of-Produts (SoP)» Conjuntive Norml Form (CNF)» Disjuntive Norml Form» Binry Deision Digrms (BDD s)» nd-inverter Grphs (IG s) 6

Boolen funtions Mthes most digitl hrdwre, other hrdwre n e trnslted into Boolen funtions. For exmple, Verilog HDL hs 0, 1, nd lso: X (unknown / error) Z (not driven, open wire) To trnslte, simply use two its, or Boolen vlues: (Flse,Flse): 0 (Flse,True): X (True,Flse): Z (True,True): 1 (ny other hoie will lso do) 7

Why Boolen funtions For this leture, we ssume two vlued logi without X or Z s Boolen vlue, we write: 0 for Flse, nd 1 for True We tlk out & for nd, for or,! for not, et. We n ssume we re tlking out the logil funtions: 1 & 1 = 1, x & 0 = 0, 0 & x = 0 0 0 = 0, x 1 = 1, 1 x = 1!0 = 1,!1 = 0 8

Expressing Boolen funtions: Dt struture should e: Effiient to onstrut Esy to reson out 9

How ompt n we store funtion? Truth tle: for Boolen funtion on N inputs 2 N possile input ssignments So, 2 N rows in the truth tle s most Boolen funtions re not ny Boolen funtion : we n hve smller representtions, most of the time. For instne, only represent rows for whih n output is 1 10

Direted yli grph (DG) direted yli grph is wy to represent Boolen funtion, it is often used s synonym for iruit. More ompt thn the funtion written out! d e ND d&e OR (d&e) ND d&e& OR ND (d&e&) ((d&e) )&((d&e&) ) 11

Direted yli grph (DG) DG is list of gtes. gte t position i hs: Boolen funtion ssigned to it Eh Boolen funtion gets list of pointers to other gtes, from whih it gets its input vlues Eh of those numers need to point kwrds Vriles re represented s gtes without inputs d e ND OR ND OR ND 12

Direted yli grph (DG) 0: vrile 1: vrile 2: vrile 3: vrile d 4: vrile e 5: nd [3,4] 6: or [5,2] 7: nd [5,1] 8: or [7,0] 9: nd [6,8] d e ND 5 6 OR ND 7 OR 8 9 ND 13

Direted yli grph (DG) DG is esy to onstrut (follows hrdwre diretly) Lrge mount of different gtes: mkes it hrd to write nd mintin progrms tht reson with DGs lterntive: nd-inverter Grph (IG) Uses just two gtes: ND nd NOT 14

nd-inverter Grph (IG) Every gte n e onverted into fixed mount of IG gtes ND OR XOR 15

IG Every gte n e onverted into fixed mount of IG gtes OR OR XOR OR d ND XOR 16

IG Every gte n e onverted into fixed mount of IG gtes OR XOR OR d ND XOR 17

IG Cnnot put two inverters etween two gtes XOR OR d ND XOR 18

IG Sometimes, ND gtes re the sme OR d ND 19

IG We my shre ND gtes tht hve the sme input OR d ND 20

IG Two inverters in row re removed (not not is identity) d 21

IG Coneptully, inverters elong with the next gte d 22

IG IG storge is relly ompt: ll nodes get even numers First node, 0, stnds for Flse To negte node, use its numer +1 23

IG 2 4 6 8 d 26 output 10 3 5!&! 12 2 4 14 6 8 16 11 13 18 17 15 20 10 18 22 21 15 24 20 14 26 23 25 d 14 12 10 16 18 20 22 24 26 24

dvntges of IG Liner size ompred to DG Useful s intermedite struture for synthesis: NND gte hs 4 trnsistors in CMOS NOT hs 2 IG Struture gives good re nd lok-speed estimtes Exmple tool tht uses IGs: BC, System for Sequentil Synthesis nd Verifition Berkeley Logi Synthesis nd Verifition Group 25

Dt strutures, so fr: DG IG (Is roughly the sme, ut with few onditions) Next: onjuntive norml form 12 10 16 18 20 22 d 14 24 26 26

Conjuntive norml form (CNF) Simple grmmr: CNF = (Disjuntion) & CNF CNF = (Disjuntion) CNF = True Disjuntion = Term Disjuntion Disjuntion = Term Disjuntion = Flse Term = Vrile Term =! Vrile Exmple: (x y) & (!z x!y) & (z -x) Rules: ll vriles within n disjuntion must e unique. Inluding x nd!x: they do not our in the sme disjuntion 27

Creting CNF Nive wy: Proedure for ND nd NOT, trnslte from IG ND is trivil: ND of [( )&(d e f)&(i j)] [(g h)&(i j)] eomes: [( )&(d e f)&(g h)&(i j)] or even [( )&(d e f)&(i j)&(g h)&(i j)] NOT is prolemti: goes from CNF to DNF k to CNF [( )&(d e f)&(i j)] eomes: [ (- -d -i)&(- -d -j)&(- -e -i)&(- -e -j)&(- -f -i)&(- -f -j) &(- -d -i)&(- -d -j)&(- -e -i)&(- -e -j)&(- -f -i)&(- -f -j) &(- -d -i)&(- -d -j)&(- -e -i)&(- -e -j)&(- -f -i)&(- -f -j)] This is not going to sle! 28

nother wy to rete CNF - ND» Consider C = ND(,B)» Gol: rete CNF formul f suh tht f(,,) == (C = &B)» if is flse, then C is flse»! implies!c, logilly equivlent to the luse!c» similrly for B: B!C» If nd B re true, then C is true» & B implies C, logilly we get!! B C» Finlly, the enoding for n ND-gte is:» (!C) & (B!C) & (!!B C)» Liner expnsion: 3 luses for eh ND-gte 29

nother exmple: XOR» Consider C = XOR(,B)» Gol: rete CNF formul f suh tht f(,,) == (C = XOR B)» if nd B re flse, then C is flse»! nd!b implies!c, logilly equivlent to B!C» If is true nd B is flse, then C is true» &!B implies C, logilly we get! B C» Symmetri se:!b C» If nd B re true, then C is flse» &B implies!c, logilly we get!! B!C» Finlly, the enoding for n XOR-gte is:» ( B!C) & (! B C) & (!B C) & (!! B!C) 30

CNF Like IG, CNF is liner in the size of the originl DG, ut only if we dd helper vriles. CNF is used s the internl struture of most ST solvers, inluding MiniST CNF is the input formt in the ST ompetition, nd in mny of its vritions Some optimistions re esier on IGs, so tools uilt on ST solvers sometimes trnslte Boolen primitives to IG to CNF, for exmple: Booletor. Other tools trnslte Boolen primitives to CNF diretly, suh s Yies 31

CNF: typil optimistions Never hve disjuntions with one vrile: ( v10) & (- -v10) & (- -v10) & (- - v12) & ( -v12) & ( -v12) & (- -d v14) & ( -v14) & (d -v14) & (v10 v12 v16) & (-v10 -v16) & (-v12 -v16) & (-v10) -v10 is neessrily True, so v10 is Flse (-) & (-) & (- - v12) & ( -v12) & ( -v12) & (- -d v14) & ( -v14) & (d -v14) & (v12 v16) & (-v12 -v16) New single vrile disjuntions: nd re Flse (-v12) & (-v12) & (- -d v14) & ( -v14) & (d -v14) & (v12 v16) & (-v12 -v16) New single vrile disjuntions: v12 is Flse (- -d v14) & ( -v14) & (d -v14) & (v16) New single vrile disjuntions: v16 is True 32

CNF: typil optimistions (2) Remove stritly lrger disjuntions: ( ) implies ( ), so ( ) is redundnt. Reple ( ) & ( ) y ( ). If vrile only ours positively/negtively, remove it: (- -d v14) & ( -v14) eomes: ( -v14) y ssigning d to Flse, whih then eomes: True y ssigning to True (or v14 to Flse) If vrile ours twie, positively in one luse, nd negtively in nother luse, we n merge these luses: (- -d v14) & ( ) eomes ( -d v14) (if does not our elsewhere!) Rell the rule: Never hve -x nd x in one disjuntion (it is lwys True) 33

CNF: summry Cn e onstruted in liner size if we llow for dditionl vriles Esy to reson with Common file formt for mny purposes 34

Dt strutures, so fr: DG IG CNF 10 20 Next: inry deision digrm 12 16 18 22 d 14 24 26 35

Binry Deision Digrm (BDD) Cnonil form exists: two strutures re equivlent if they re equl. Drwk: usully very lrge strutures 36

Binry Deision Digrm (BDD) DG with the following nodes Constnt 0 Constnt 1 If-then-else with vrile s ondition Rules for Ordered-BDD: Vriles re ordered, gtes must our in tht order: if >>>d>e>f, then the if then.. else.. gte n ontin gtes with nd, ut not with d, e nd f. Rules for Redued-BDD: ll gtes must e different (no two gtes with the sme vriles nd inputs, e.g. if x then y else z ) gte nnot hve the sme then nd else luse Theorem: if BDD is Redued ND Ordered, it is nonil. 37

Binry Deision Digrm (BDD) IG node 10: 10 20 0 0 1 12 16 18 22 IG node 12: d 14 24 26 0 1 0 38

Binry Deision Digrm (BDD) IG node 11: 10 20 1 1 0 12 16 18 22 IG node 13: d 14 24 26 1 0 1 IG node 16: 0 1 1 0 39

Binry Deision Digrm (BDD) IG node 14: 10 20 1 d 0 0 12 16 18 22 IG node 15: d 14 24 26 d 1 0 1 IG node 17: 1 0 0 1 0 1 40

Binry Deision Digrm (BDD) IG node 18: 10 20 12 16 18 22 d 14 24 26 IG node 15: IG node 17: d 1 0 1 0 1 41

Binry Deision Digrm (BDD) IG node 18: 10 20 12 16 18 22 0 d 1 d 14 24 26 IG node 15: IG node 17: d 1 0 1 0 1 42

Binry Deision Digrm (BDD) Cnonil form: ROBDD ND of two BDDs introdues lowup Used in model hekers Usully ST-sed (CNF/IG) model heking is fster Not lwys We will ome k with more detils out BDD s lter when we will tlk out Symoli Model Cheking 43

Dt strutures, so fr: DG IG CNF BDD Up next: Sum of produts 10 20 12 16 18 22 d 14 24 26 44

Sum of produts lot like CNF, ut opertions re hosen suh tht SOP is nonil. Most ommon hoie of opertions: ND (produt) + XOR (sum) ND is innermost, XOR is outermost opertion 10 20 12 16 18 22 d 14 24 26 45

Sum of produts not : True XOR ND of {} ND of {} (True XOR ) & (True XOR ) = True & True XOR True & XOR & True XOR & = True XOR XOR XOR & d 14 12 10 16 18 20 22 24 26 46

Sum of produts (SOP) Unlike CNF, do not introdue helper vriles Negtion of x is simply x XOR 1 SOP is nonil, if ND- nd XOR- luses re onsidered s sets: Sort vriles within ND luse, no duplites Sort vrile-sets within XOR luse, no duplites ND of two SOPs introdues lowup 10 20 12 16 18 22 d 14 24 26 47

Sum of produts (SOP) 10: True XOR XOR XOR & 12: & 11: XOR XOR & 13: True XOR & 16: True& XOR True& XOR True&& XOR && XOR && XOR &&& = XOR XOR & XOR & XOR & XOR & = XOR 17: True XOR XOR 14: &d 15: True XOR &d 18: True XOR XOR XOR &d XOR &d& XOR &d& 12 10 16 18 20 22 d 14 24 26 48

Dtstrutures, so fr: DG IG CNF BDD SOP Up next: IG (gin!) 10 20 12 16 18 22 d 14 24 26 49

IGs vs. SoP x1 x2 x3 x4 x5 y x1 x2 x3 x4 y x5 50

IGs vs. BDDs» IGs lwys size proportionl to input» BDDs lwys exponentil size for some ses (e.g. multiplier iruits) 51

ST solving» One we hve Boolen funtions, we n do ST solving.» This is n NP-Hrd prolem, ut effiient in prtie» t the sis of lmost ll modern FV methods.» t the next leture, we will go through the si lgorithm for ST solving. 52

CEC with SoP» SoP is norml form» CEC otined y normlising expressions to SoP» Then hek for syntti equlity 53

CEC with BDDs» ROBDDs is norml form.» Compute the two ROBDDs.» Chek for syntti equlity. 54

CEC with ST nd CNF» Tke two iruits» Crete CNF representtion of eh one of them» XOR ll outputs pirwise» ssert one XOR output is 1» Look t ode skeleton for ssignment 1 55

CEC with IGs» Step 1: rndom simultion» Step 2: uild IG» Step 3: ST sweeping (slides tken from Sen Wever, see ourse wepge) 56

Equivlene Cheking x y 57

nother exmple (1) y 58

nother exmple (2) y 1 nnd-gte to strt 59

nother exmple (3) y 1 or gte 60

nother exmple (3) y 1 nnd gte 61

nother exmple y finlly 1 or gte with negted inputs 62

IGs» Pros simple to uild nd mnipulte unifying mong synthesis, verifition, tehnology mpping ompt representtion» Cons struturlly not effiient (see FRIG) non nonil 63

Equivlene Cheking 0 4 6 7 5 O 1 O 2 8 3 64

Rndom Simultion (1) 0 4 6 7 Equivlene lsses 1,4,7,8 5 O 1 O 2 8 0,2,3,5,6 3 Rndom Vetor: ssign T to ll inputs. = = = T 65

Rndom Simultion (2) 0 4 6 7 Equivlene lsses 1,4 5 7,8 O 1 O 2 8 2,3,5,6 3 Rndom Vetor: ssign F to ll inputs. = = = F 66

Rndom Simultion (3) 0 4 6 7 Equivlene lsses 1,4 5 7,8 O 1 O 2 8 2,6 3,5 3 Rndom Vetor: = = F nd = T 67

Rndom Simultion (4) 0 4 6 7 Equivlene lsses 5 7,8 O 1 O 2 8 2,6 3,5 3 Rndom Vetor: = = T nd = F 68

IG (1) 0 4 6 7 5 O 1 O 2 8 3 69

IG (2) 0 4 6 7 5 1 2 8 3 70

IG (3) 0 4 6 7 5 1 2 8 3 71

IG (4) 0 4 6 7 5 1 2 8 3 72

IG (4) 0 4 6 7 5 1 2 8 3 73

IG (5) 0 4 6 7 5 1 2 8 3 74

ST Sweeping (1) 0 4 6 7 5 Equivlene lsses 1 2 7,8 2,6 8 3,5 3 ST solver: 3 = 5 ( ^ ) ^ = (( ^ ) ^ ) ^ 75

ST Sweeping (2) 0 4 6 7 Equivlene lsses 5 1 2 7,8 2,6 8 3,5 3 ST solver: 3 = 5 Merge nodes 3 nd 5 76

ST Sweeping (3) 0 4 6 7 5 Equivlene lsses 1 2 7,8 2,6 8 3,5 3 ST solver: 2 = 6 77

ST Sweeping (4) 0 4 6 7 Equivlene lsses 5 1 2 7,8 2,6 8 3,5 3 ST solver: 2 = 6 Merge nodes 2 nd 6 78

ST Sweeping (5) 0 4 6 7 Equivlene lsses 5 1 2 7,8 2,6 8 3,5 3 7 struturlly hshes to 8 So, iruits re equivlent 79

FRIGS» Insted of ST sweeping» On-the-fly uild Funtionlly Redued IG» Struturl hshing, one or two-levels» Simultion with test-vetors» Cll ST for possily equivlent nodes» Keep funtionl equivlent nodes, ut re-use just one of them 80

Simple exerises to prtie» See reder (Chpter 2) on the wesite 81