170 likes | 633 Views
Decision Diagrams. Maciej Ciesielski Electrical & Computer Engineering University of Massachusetts, Amherst, USA ciesiel@ecs.umass.edu. Common Representations. Boolean functions ( f : B B ) Truth table, Karnaugh map SoP, PoS, ESoP Reed-Muller expansions (PPRM, FPRM, GRM, etc.)
E N D
Decision Diagrams Maciej Ciesielski Electrical & Computer Engineering University of Massachusetts, Amherst, USA ciesiel@ecs.umass.edu BDD Tutorial
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) BDD Tutorial
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 ) BDD Tutorial
Decomposition Types • Shannon expansion f = x fx + x’ fx’ • Positive Davio (moment decomposition): replacex’=1-x f = x fx + (1-x) fx’ = fx’ + x fx where fx = fx - fx’ • Negative Davio f = fx + (1-x) fx’ BDD Tutorial
Binary Decision Diagrams (BDD) • Based on recursive Shannon expansion f = x fx + x’ fx’ • 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 BDD Tutorial
f a h= c + bc g= bc b b c 0 1 Sannon Expansion BDD f = ac + bc • fa’ = f(a=0) = bc • fa = f(a=1) = c + bc • gb’ = (bc)|b=0 = 0 • gb = (bc)|b=1 = c • hb’ = (c+bc)|b=0 = c • hb = (c+bc)|b=1 = c BDD Tutorial
f a g g b b BDD Reduction Rules -1 • Eliminate redundant nodes • (with both edges pointing to same node) f = a’ g(b) + a g(b) = g(b) (fa + fa’ = 1) BDD Tutorial
f f1 f2 a a a h g h g b c b c BDD Reduction Rules -2 • 2. Merge duplicate nodes (isomorphic subgraphs) • Nodes must be unique f1 = a’ g(b) + a h(c) = f2 f = f1 = f2 BDD Tutorial
f 1 edge a b c f 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 0 edge a b b c c c c 0 0 0 0 0 1 1 1 BDD Construction • Reduced Ordered BDD f = ac + bc Truth table Decision tree BDD Tutorial
f f a a a b b b b b c c c c c c c 0 0 0 1 1 1 BDD Construction – cont’d f = (a+b)c • 2. Merge duplicate nodes 3. Remove redundant nodes 1. Merge terminal nodes BDD Tutorial
F F’ ¬ F(y) F(x,y) Restrict x=b 0 0 1 0 0 1 1 1 Logic Manipulation using BDDs • Useful operators • Complement ¬ F = F’ • (switch the terminal nodes) • Restrict: F|x=b = F(x=b) where b = const BDD Tutorial
F G G F = 0 0 1 1 0 1 APPLY Operator • Apply: F G, any Boolean operation (AND, OR, XOR, ) • Useful in constructing BDD for arbitrary Boolean logic • Any logic operation can be expressed using Restrict, Apply • Efficient algorithms, work directly on BDD graphs BDD Tutorial
BDD:APPLY Operation • Basic operator for efficient BDD manipulation (structural) • Based on recursive Shannon expansion F OP G = x (FxOP Gx) + x’(Fx’OP Gx’) whereOP = OR, AND, XOR, etc • Works directly on BDD BDD Tutorial
2 a a 3 2.3 1.3 c c 1.0 0.3 0 0 0 1.1 1 1 1 BDD:APPLY Operation - AND a AND c ac a = = c AND BDD Tutorial
ac bc 4 a 6 b a a b 5 7 b 7+5 0+6 6+5 4+6 0+7 0+5 c c c c 0+0 0 0 0 0 1 1 1 1 BDD:APPLY Operation - OR f = ac+bc OR = = BDD Tutorial
a a b b c c 0 0 1 1 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) F = a’bc + abc +ab’c G = ac +bc BDD Tutorial
a ab b c 1 0 ab’c Application to SAT H • 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 infunction variables, gives a satisfying solution (test vector) BDD Tutorial