Binary Decision Diagrams (BDDS) : Ece 474A/57A Computer-Aided Logic Design
Binary Decision Diagrams (BDDS) : Ece 474A/57A Computer-Aided Logic Design
Lecture 11
Binary Decision Diagrams (BDDs)
ECE 474a/575a
Susan Lysecky
1 of 31
Equation 1: F(a,b) = ab + ab
a
Equation 2: F(a,b) = a
b
F
Circuit 1
a
Truth table
The function F
F
Circuit 2
ECE 474a/575a
Susan Lysecky
2 of 31
Why BDDs
An Efficient Representation
BDDs
Graph representation similar to a binary tree (i.e. decision trees from previous
lectures)
Able to efficiently represent large functions
Some representations are canonical (unique)
ECE 474a/575a
Susan Lysecky
3 of 31
0
x1
x2
x3
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
1
0
1
1
1
1
0
0
X3 (1)
0 1
x3
MUX
0 1
x2
0 1
MUX
MUX
0 1
x1
MUX
0 1
X3 (0)
x2 (0)
MUX
X3 (0)
MUX
x2 (1)
MUX
X1 (0)
0 1
X3 (1)
MUX
MUX
0
1
MUX
x2 (1)
MUX
X1 (1)
MUX
MUX
0 1
MUX
MUX
X1 (0)
MUX
S(1, 1, 1) = 0
MUX
x2 (0)
MUX
0 1
X1 (0)
MUX
S(0, 0, 0) = 1
1
0
MUX
S(0, 1, 0) = 1
S(0, 0, 1) = 0
ECE 474a/575a
Susan Lysecky
4 of 31
x1
x2
x3
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
1
0
1
1
1
1
0
0
0 1
x3
1
x2
x1
MUX
x1
MUX
0 1
0 1
0 1
MUX
MUX
MUX
x2
x2
x2
MUX
0 1
0 1
x3
0 1
x1
MUX
x3
MUX
0 1
1
ECE 474a/575a
Susan Lysecky
Corresponding BDD
5 of 31
x1
x2
x2
x3
x2
S(0, 0, 0)
S(1, 1, 1)
S(0, 1, 0)
x1
x1
x1
x2
x3
x2
x2
x3
x2
0
ECE 474a/575a
Susan Lysecky
x2
x3
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
1
0
1
1
1
1
0
0
S(0, 0, 1)
x1
x2
x3
x1
x2
x2
x3
0
6 of 31
We will adopt T vs. E labels consistent with most of the book (Hatchel) examples
x1
x1
x2
x2
x2
x3
x2
x2
x3
x2
T
x3 E
T
ECE 474a/575a
Susan Lysecky
7 of 31
b
E
b
E
d
T
a
T
b
E
c
T
8 of 31
c
T
c
T
Ordering : a c b
b
T
Not ordered
ECE 474a/575a
Susan Lysecky
9 of 31
Variable ordering important, may result in a more complex (or simple) BDD
All three BDDs below represent the same function
Third ordering (b c a d) optimal because there is exactly one node for
each variable
f
b
E
d
E
E
E
d
T
b
E
1
1
Order : a b c d
Order : a d b c
Order : b c a d
ECE 474a/575a
Susan Lysecky
10 of 31
f
a
T
f
E
E
E
Order : a b c d e f
Order : a c e b d f
ECE 474a/575a
Susan Lysecky
11 of 31
0
1
1
0
NAND
0
1
0
1
0
0
0
1
0
0
1
1
0
1
0
1
0
1
1
1
0
0
1
1
0
1
0
1
0
1
1
0
0
0
1
1
0
1
0
1
1
1
1
0
XOR
a
E
OR
a
0
0
1
1
a
T
b E
1
a
E
b T
E
ECE 474a/575a
Susan Lysecky
a
E
b
T
12 of 31
b
T
Function node
Function node
Internal
nodes
E
E
d
T
Internal node
Terminal nodes
Terminal node
Represents a value (1 or 0)
Indegree 1
Outdegree = 0
ECE 474a/575a
Susan Lysecky
13 of 31
Incoming edge
Incoming edge
E edge
T edge
T edge
E edge
a
d
T
ECE 474a/575a
Susan Lysecky
14 of 31
b
T
Function of this
E edge is a
E
E
d
T
Function of this
T edge is a
1
ECE 474a/575a
Susan Lysecky
15 of 31
b
T
c
T
Isomorphic subgraphs
Isomorphic
Two graphs are isomorphic if there is a one-to-one correspondence between their vertices and there is an edge between
two vertices of one graph if and only if there is an edge between the two corresponding vertices in the other graph
English same subgraph - all vertices the same, all edges between vertices the same
ECE 474a/575a
Susan Lysecky
16 of 31
F = aFa + aFa
We can keep applying expansion theorem,
eventually we reach the unique canonical form ,
which uses only minterms
F = ab + abc + abc
F = a(bc) + a(b+bc)
Fa = (b+bc)
Fa = (bc)
Fa also called the cofactor of F w.r.t.
(with respect to) a
F = ab + abc + abc
F = ab + abc + abc
F = bFb + bFb
F = cFc + cFc
F expanded w.r.t to b
F expanded w.r.t to c
ECE 474a/575a
Susan Lysecky
17 of 31
partial expansion
with respect to a
fa = bc + bc
fa
fa = bc + bc
ECE 474a/575a
Susan Lysecky
fa
18 of 31
f
a
T
fa
fa
partial expansion
with respect to b
fa = bc + bc
(fa)b = fab = c
(fa)b = fab = c
fab
fa = bc + bc
fab
fab
fab
(fa)b = fab = c
(fa)b = fab = c
ECE 474a/575a
Susan Lysecky
19 of 31
f
a
T
b
T
b
T
fab
fab
fab
fab = c
fab
fabc = 1
fabc = 0
fab = c
fabc = 1
fabc = 0
fab = c
fabc = 0
expansion with
respect to c, final
BDD
c
T
fabc = 1
fab = c
fabc = 0
fabc = 1
ECE 474a/575a
Susan Lysecky
20 of 31
a
0
0
0
0
1
1
1
1
b
0
0
1
1
0
0
1
1
c
0
1
0
1
0
1
0
1
f
1
0
1
0
0
1
0
1
f
a
T
b
T
b
T
c
T
c
E
Does it work?
ECE 474a/575a
Susan Lysecky
21 of 31
partial expansion
with respect to b
f = abc + bd + cd
b
T
fb = ac + cd
fb
fb = d + cd
fb
ECE 474a/575a
Susan Lysecky
22 of 31
f
b
T
fb
f
b
fb = ac + cd
c
T
fbc = a
c
E
fbc
fbc = d
partial expansion
with respect to c
fb
fbc
fbc
fbc
equivalent
cofactors, we can
create a single
node (reduced)
fb = d + cd
T
fbc = d
c
T
fbc = d
ECE 474a/575a
Susan Lysecky
fbc
23 of 31
c
T
partial expansion
with respect to d
fbc
fbc
1
ECE 474a/575a
Susan Lysecky
24 of 31
c
T
fbc
fbc = a
expansion with
respect to a, final
BDD
fbca = 1
fbca = 0
c
T
a
T
ECE 474a/575a
Susan Lysecky
25 of 31
b
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
c
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
d
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
f
0
1
0
1
0
1
0
0
0
1
0
1
0
1
1
1
c
T
a
T
Does it work?
ECE 474a/575a
Susan Lysecky
26 of 31
F = bca + bcd + bd
= cFc + cFc
= c(a) + c(d)
= ca + cd
a
T
= aFa + aFa
= a(1) + a(0)
=a+0
=a
= bFb + bFb
= b(ca + cd) + b(d)
= bca + bcd + bd
=d
1
ECE 474a/575a
Susan Lysecky
27 of 31
F = abc + ab + a
f
= bFb + bFb
= b(c) + b(1)
= bc + b
c
T
= aFa + aFa
= a(bc + b) + a(1)
= abc + ab + a
= c
ECE 474a/575a
Susan Lysecky
28 of 31
Reducing BDDs
When building BDDs, result not always reduced (Example 1 - slide 19)
a
T
b
T
b
T
c
T
a
T
c
T
a
T
c
T
c
E
c
T
Fb = Fb
(redundant node)
isomorphic subgraphs
ECE 474a/575a
Susan Lysecky
29 of 31
Reducing BDDs
Example 2
Iterative apply
Identify isomorphic subgraphs
Remove redundant nodes
a
T
b
T
a
T
a
T
b
T
c
T
c
E
isomorphic subgraphs
c
E
c
E
c
E
Fb = Fb
(redundant node)
ECE 474a/575a
Susan Lysecky
30 of 31
10
ECE 474a/575a
Susan Lysecky
31 of 31
ITE Operator
Two argument operators expressed in terms of ITE
Table
Name
Expression
Equivalent Form
0000
0001
AND(F, G)
FG
ITE(F, G, 0)
0010
F>G
FG
ITE(F, G, 0)
0011
0100
F<G
FG
ITE(F, 0, G)
0101
0110
XOR(F, G)
FG
ITE(F, G, G)
0111
OR(F, G)
F+G
ITE(F, 1, G)
1000
NOR(F, G)
(F + G)
ITE(F, 0, G)
1001
XNOR(F, G)
(F G)
ITE(F, G, G)
1010
NOT(G)
ITE(G, 0, 1)
1011
FG
F + G
ITE(F, 1, G)
1100
NOT(F)
ITE(F, 0, 1)
1101
FG
F + G
ITE(F, G, 1)
1110
NAND(F, G)
(FG)
ITE(F, G, 1)
1111
1
ECE 474a/575a
Susan Lysecky
32 of 31
ITE Algorithm
ECE 474a/575a
Susan Lysecky
33 of 31
11
INSERT_COMPUTED_TABLE((F, G, H), R)
return (R)
}
ECE 474a/575a
Susan Lysecky
34 of 31
12