2001 CiesielskiBDD Tutorial1 Decision Diagrams Maciej Ciesielski Electrical & Computer Engineering University of Massachusetts, Amherst, USA
2001 CiesielskiBDD Tutorial2 Common Representations Boolean functions ( f : B B ) –Truth table, Karnaugh map –SoP, PoS, ESoP –Reed-Muller expansions (PPRM, FPRM, GRM, etc.) –Decision diagrams (BDD, ZDD, KFDD, *BMD, etc.) Arithmetic functions ( f : B Int ) –Binary Moment Diagrams (*BMD, K*BMD, *PHDD) –Algebraic Decision Diagrams (ADD) Arithmetic functions (f : Int Int ) –Taylor Expansion Diagrams (TED)
2001 CiesielskiBDD Tutorial3 Canonical Representations Each minimal, canonical representation is characterized by –Decomposition type Shannon, Davio, moment decomposition, Taylor, etc. –Reduction rules Redundant nodes, isomorphic sub-graphs, etc –Composition method (“Apply” rule) They can represent –Boolean functions (f : B B) –Arithmetic functions (f : B Int ) –Algebraic expressions (f : Int Int )
2001 CiesielskiBDD Tutorial4 Decomposition Types Shannon expansion f = x f x + x’ f x’ Positive Davio (moment decomposition): replace x’=1-x f = x f x + (1-x) f x’ = f x’ + x f x where f x = f x - f x’ Negative Davio f = f x + (1-x) f x’
2001 CiesielskiBDD Tutorial5 Binary Decision Diagrams ( BDD ) Based on recursive Shannon expansion f = x f x + x’ f x’ Compact data structure for Boolean logic –can represents sets of objects (states) encoded as Boolean functions Canonical representation –reduced ordered BDDs (ROBDD) are canonical –essential for verification
2001 CiesielskiBDD Tutorial6 Sannon Expansion BDD f a’ = f(a=0) = bc b 0 f = ac + bc a f f a = f(a=1) = c + bc g b’ = (bc) |b=0 = 0 g= bc h= c + bc g b = (bc) |b=1 = c h b’ = (c+bc) |b=0 = c h b = (c+bc) |b=1 = c b c 1
2001 CiesielskiBDD Tutorial7 BDD Reduction Rules -1 1.Eliminate redundant nodes (with both edges pointing to same node) f = a’ g(b) + a g(b) = g(b) (f a + f a’ = 1) b g a b f g
2001 CiesielskiBDD Tutorial8 BDD Reduction Rules Merge duplicate nodes (isomorphic subgraphs) Nodes must be unique f 1 = a’ g(b) + a h(c) = f 2 f = f 1 = f 2 aa bc h g f1f1 f2f2 a bc g h f
2001 CiesielskiBDD Tutorial9 BDD Construction Reduced Ordered BDD 1 edge 0 edge a b c f Truth table f = ac + bc Decision tree a b c b ccc f
2001 CiesielskiBDD Tutorial10 BDD Construction – cont’d 10 a b c b ccc ff 10 a b c b c 10 a b c f = (a+b)c 2. Merge duplicate nodes 1. Merge terminal nodes 3. Remove redundant nodes
2001 CiesielskiBDD Tutorial11 Logic Manipulation using BDDs Useful operators ¬ FF’ 0 1 F(x,y) x=b 0 1 F(y) Restrict – Restrict: F| x=b = F(x=b) where b = const – Complement ¬ F = F’ (switch the terminal nodes)
2001 CiesielskiBDD Tutorial12 APPLY Operator Apply: F G, any Boolean operation (AND, OR, XOR, ) = F G F G Useful in constructing BDD for arbitrary Boolean logic Any logic operation can be expressed using Restrict, Apply Efficient algorithms, work directly on BDD graphs
2001 CiesielskiBDD Tutorial13 BDD: APPLY Operation Basic operator for efficient BDD manipulation (structural) Based on recursive Shannon expansion F OP G = x (F x OP G x ) + x’(F x’ OP G x’ ) where OP = OR, AND, XOR, etc Works directly on BDD
2001 CiesielskiBDD Tutorial14 BDD: APPLY Operation - AND 10 a c ac a AND c 10 a 2 c a c AND = =
2001 CiesielskiBDD Tutorial15 BDD: APPLY Operation - OR OR ac 10 a c 4 5 bc 10 b c 6 7 = = 10 a b c f = ac+bc c a b
2001 CiesielskiBDD Tutorial16 Application to Verification Equivalence Checking of combinational circuits Canonicity property of BDDs: –if F and G are equivalent, their BDDs are identical (for the same ordering of variables ) 10 a b c F = a’bc + abc +ab’c G = ac +bc 10 a b c
2001 CiesielskiBDD Tutorial17 Application to SAT Functional test generation –SAT, Boolean satisfiability analysis –to test for H = 1 (0), find a path in the BDD to terminal 1 (0) –the path, expressed in function variables, gives a satisfying solution (test vector) ab ab’c H 0 1 a b c