You are on page 1of 17

Decision Diagrams

Maciej Ciesielski Electrical & Computer Engineering University of Massachusetts, Amherst, USA ciesiel@ecs.umass.edu

2001 Ciesielski

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)
2001 Ciesielski BDD Tutorial 2

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 Ciesielski BDD Tutorial 3

Decomposition Types
Shannon expansion

f = x fx + x fx
Positive Davio (moment decomposition): replace x=1-x

f = x fx + (1-x) fx = fx + x fx
where

fx = fx - fx

Negative Davio

f = fx + (1-x) fx
2001 Ciesielski BDD Tutorial 4

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
2001 Ciesielski BDD Tutorial 5

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
g= bc

f
a h= c + bc b c 0 1

hb = (c+bc)|b=0 = c
hb = (c+bc)|b=1 = c
2001 Ciesielski BDD Tutorial

BDD Reduction Rules -1


1. Eliminate redundant nodes (with both edges pointing to same node)
f
a g g b b

f = a g(b) + a g(b) = g(b) (fa + fa = 1)

2001 Ciesielski

BDD Tutorial

BDD Reduction Rules -2


2. Merge duplicate nodes (isomorphic subgraphs) Nodes must be unique
f1 a g b c a h g b f2 a h c f

f1 = a g(b) + a h(c) = f2
2001 Ciesielski BDD Tutorial

f = f 1 = f2
8

BDD Construction
Reduced Ordered BDD
a b c 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 f 0 0 0 1 0 1 0 1

f = ac + bc
b c c

f
a

1 edge 0 edge

b
c c

Truth table
2001 Ciesielski BDD Tutorial

Decision tree
9

BDD Construction contd


f
a b c c c b c b c

f
a b c

f = (a+b)c
a b c

1. Merge terminal nodes


2001 Ciesielski

2. Merge duplicate nodes


BDD Tutorial

3. Remove redundant nodes


10

Logic Manipulation using BDDs


Useful operators
F F

Complement F = F (switch the terminal nodes)


0 1

1 0

F(x,y)

F(y)
Restrict

Restrict: F|x=b = F(x=b) where b = const

x=b

2001 Ciesielski

BDD Tutorial

11

APPLY Operator
Apply: F

G, any Boolean operation


F

0 1 0 1

(AND, OR, XOR, ) G F

=
0 1

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 Ciesielski BDD Tutorial 12

BDD: APPLY Operation


Basic operator for efficient BDD manipulation (structural) Based on recursive Shannon expansion
F OP G = x (Fx OP Gx) + x(Fx OP Gx)
where OP = OR, AND, XOR, etc

Works directly on BDD


2001 Ciesielski BDD Tutorial 13

BDD: APPLY Operation - AND


a AND c
a 2
AND

ac a 2.3

=
c 3
1.3 c 0 1 0.3 1.0 1.1

=
0

a c

2001 Ciesielski

BDD Tutorial

14

BDD: APPLY Operation - OR


ac
a 4
OR

f = ac+bc bc
b 6 c 7

a 4+6
0+6 6+5 b b

=
0+0

0+7 0+5 7+5 c 0 1

=
0

2001 Ciesielski

BDD Tutorial

15

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)

a F = abc + abc +abc


b c

a
b

G = ac +bc

1
BDD Tutorial

0
2001 Ciesielski

1
16

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)

a b ab

c
abc

0
2001 Ciesielski BDD Tutorial

1
17

You might also like