Binary Tree Representation
The recursive Shannon expansion corresponds to a
binary tree
f xf x x f x
x( yf xy y f x y ) x( yf xy y f x y )
Example:
x
0
y
0
fx y
1
1
0
f xy
fx y
y
1
f xy
Each path from the root to a leaf corresponds to a
minterm.
BDDs
1
The root represents the original function f.
The two nodes immediately below the root represent
the co-factors of f.
As you go deeper, each node represents a co-factor of
the function represented by its parent.
The leaves are the terminal cases representing 0 and 1
which have no co-factors.
BDDs
2
Example
f ab ac
a
0
b
0
c
0
0
1
1
0
1 0
0
1
0
a
0
1
c
b
1
c
Splitting
variable
0
1
0
1
1
0
1
0
b
1
1
1
BDDs
3
Implicit Enumeration Branch and Bound
Checking for tautology and many other theoretically
intractable problems (co-NP complete) can be
effectively solved using implicit enumeration:
use recursive Shannon expansion to explore Bn.
In (hopefully) large subspaces of Bn, prune the binary
recursion tree by
exploiting properties of the node function fc(v)
exploiting heuristic bounding techniques
Even though in the worst case the recursion tree may
n
have 2 nodes, in practice (in many cases), we
typically encounter a linear number of nodes.
BDDs
4
Implicit Enumeration Branch and Bound
Thus we say that the 2n minterms of f have been
implicitly enumerated
BDD’s (Binary Decision Diagrams) are alternate
representations in which implicit enumeration is
performed statically, and nodes with identical path
cofactors are identified
BDDs
5
ROBDDs
represents a logic function by a directed acyclic graph
(DAG). (many logic functions can be represented
compactly - usually better than SOP’s)
canonical form (important) (only canonical if an
ordering of the variables is given)
many logic operations can be performed efficiently on
BDD’s (usually linear in size of result - tautology and
complement are constant time)
size of ROBDD critically dependent on variable
ordering
BDDs
6
ROBDDs
one root node per function, two terminals 0, 1
each node, two children, and a variable
Shannon co-factoring tree, except reduced and
ordered (ROBDD)
Reduced:
any node with two identical children is removed
two nodes with isomorphic BDD’s are merged
Ordered:
Co-factoring variables (splitting variables) always follow
the same order from a root to a terminal
xi < xi < xi < … < xin
1
2
3
BDDs
7
OBDD
Ordered BDD (OBDD) Input variables are ordered - each path
from root to sink visits nodes with labels (variables) in
ascending order.
a
c
c
ordered
order = a,c,b
b
0
b
c
b
c
1
not
ordered
a
0
BDDs
1
8
ROBDD
Reduced Ordered BDD - reduction rules:
if the two children of a node are the same,
the node is eliminated: f = cf + c’f
if two nodes have isomorphic graphs, they
are replaced by one of them
These two rules added to ordering mean
each node represents a distinct logic
function.
BDDs
9
F = b’+a’c’ = ab’+a’cb’+a’c’ (all paths to the 1 node)
fa = cb’+c’
0
c
0
0
a f
1
1
b
0
fa= b’
1
1
By tracing paths to the 1 node, we get a cover
of pairwise disjoint cubes.
The power of the BDD representation is that it
does not explicitly enumerate all paths; rather
it represents paths by a graph whose size is
measures by its nodes and not paths.
A DAG can represent an exponential number
of paths with a linear number of nodes.
BDDs
10
Examples
a
a
1
b
b
c
c
d
0
d
0
1
0
BDDs
1
11
EXOR
a
a b c d = a’b’c’d +
b
a’b’cd’ +
b
a’bc’d’ +
ab’c’d’ +
c
a’bcd +
c
ab’cd +
abc’d +
d
abcd’
d
Terms in SOP = ???
0
1
Nodes in BDD = ???
BDDs
12
The Ordering Effect
root
node
c+bd
c
c+d
c
a
b
b
c+bd c
b
c
b
d
b
0
1
1
0
d
d+b
d
0
a
f = ab+a’c+bc’d
1
Two different orderings, same function.
BDDs
13
Example
f = ad + be + cf
There are n! orderings – in this example 6! = 720
Try orderings:
a,b,c,d,e,f
a,d,b,e,c,f
BDDs
14
Theorem
Theorem 1 (Bryant – 1986 posted on course page)
ROBDD’s are canonical
Thus two functions are the same iff their
ROBDD’s are equivalent graphs
(isomorphic). Of course must use same
order for variables.
BDDs
15
Implementation
Each node is a triple (v,g0,g1) representing
a function
g = v g0 + v g 1
In most implementations, g0 and g1 are
pointers to other nodes.
BDDs
16
ITE Operator
Table
Subset
Expression
Equivalent Form
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
0
AND(f, g)
f > g
f
f < g
g
XOR(f, g)
OR(f, g)
NOR(f, g)
XNOR(f, g)
NOT(g)
f g
NOT(f)
f g
NAND(f, g)
1
0
fg
fg
f
fg
g
f g
f + g
f + g
f g
g
f + g
f
f + g
fg
1
0
ite(f, g, 0)
ite(f,g, 0)
f
ite(f, 0, g)
g
ite(f,g, g)
ite(f, 1, g)
ite(f, 0,g)
ite(f, g,g)
ite(g, 0, 1)
ite(f, 1, g)
ite(f, 0, 1)
ite(f, g, 1)
ite(f, g, 1)
1
BDDs
17
Efficient Implementation
Strong canonical form: A “unique-id” is associated
(through a hash table) uniquely with each element in
a set.
With BDD’s the set is the set of all logic functions. A BDD node is a
function. Thus each function has a unique-id in memory.
What is a good hash function?
f
0
v
1
fv
fv
BDDs
18
Unique Table - Hash Table
hash value
of key
collision
chain
Before a node (v, g, h ) is added to BDD data base, it is
looked up in the “unique-table”. If it is there, then
existing pointer to node is used to represent the logic
function. Otherwise, a new node is added to the uniquetable and the new pointer returned.
Thus a strong canonical form is maintained. The node for f
= (v, g, h ) exists iff(v, g, h ) is in the unique-table.
There is only one pointer for (v, g, h ) and that is the
address to the unique-table entry.
Unique-table allows single multi-rooted DAG to represent
all users’ functions:
BDDs
19
Recursive Formulation of ITE
v = top-most variable among the three
BDD’s f, g, h
ite( f , g , h) fg f h
v( fg f h)v v( fg f h)v
v( f v g v f v hv ) v( f v g v f v hv )
ite(v, ite( f v , g v , hv ), ite( f v , g v , hv ))
(v, ite( f v , g v , hv ), ite( f v , g v , hv ))
( v, f , g )
BDDs
20
Recursive Formulation of ITE
ite(f, g, h)
if(terminal case) {
return result;
} else if(computed-table has entry (f, g, h )) {
return result;
} else {
let v be the top variable of (f, g, h );
f <- ite(fv , gv , hv );
g <- ite(fv , gv , hv );
if( f equals g ) return g;
R <- find_or_add_unique_table(v, f, g );
insert_computed_table( {f, g, h }, R);
return R; } }
BDDs
21
Terminal cases:
(0, f, g) = g
(1, f, g) = f
ite (f, g, g) = g
Unique table: Used to ensure one physical
representation for any given function.
Computed table: Used to cache results to
avoid recomputation.
BDDs
22
Example
1
1
F
a
0
b
1
1
B
0
0
C
1
1
1
c
G
a
0
0
0
1
0
1
H
b
0
d
1
1
D
0
0
C
1
I
a
0
b
1
0
J
0
D
F,G,H,I,J,B,C,D
are pointers
I = ite (F, G, H)
= (a, ite (Fa , Ga , Ha ), ite (Fa , Ga , Ha ))
= (a, ite (1, C , H ), ite(B, 0, H ))
= (a, C, (b , ite (Bb , 0b , Hb ), ite (Bb , 0b , Hb ))
= (a, C, (b , ite (1, 0, 1), ite (0, 0, D)))
= (a, C, (b , 0, D))
= (a, C, J)
BDDs
23
Computed Table
Keep a record of (F, G, H ) triplets already computed by the ite
operator in a hash-based cache ( “cache” table). This means
that the collision chain is not used (if collision, old entry thrown
away ).
The above structure is wasteful since the BDD nodes and collision
chain can be merged.
BDDs
24
Better Implementation
BDDs
25
Edge Complementation
G’
G
two different
DAGs
0
0
1
1
Can combine by making complement edges
G
0
G’
only one DAG
using complement
pointer
1
BDDs
26
Extension - Complement Edges
To maintain the strong canonical form, we need to resolve 4 equivalences:
V
V
V
V
V
V
V
V
Solution: Always choose the one on the left,
i.e. the “1” edge must not have a
complement.
BDDs
27
EXOR (revisited)
a
a
b
b
b
c
c
d
d
d
0
1
1
c
BDDs
28
© Copyright 2026 Paperzz