0% found this document useful (0 votes)
0 views

SCLD-M6-BinaryDecisionDiagrams (1)

Binary Decision Diagrams (BDD) are a data structure for representing Boolean functions using a directed acyclic graph with decision nodes and terminal nodes. The construction of BDDs utilizes Shannon expansion, and the efficiency of BDDs can vary significantly based on variable ordering, which is NP-hard to optimize. Reduced Ordered BDDs (ROBDD) provide a unique representation for a function, allowing for efficient operations such as checking for tautology, complementation, and equivalence checking.

Uploaded by

jindamsreenath
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

SCLD-M6-BinaryDecisionDiagrams (1)

Binary Decision Diagrams (BDD) are a data structure for representing Boolean functions using a directed acyclic graph with decision nodes and terminal nodes. The construction of BDDs utilizes Shannon expansion, and the efficiency of BDDs can vary significantly based on variable ordering, which is NP-hard to optimize. Reduced Ordered BDDs (ROBDD) provide a unique representation for a function, allowing for efficient operations such as checking for tautology, complementation, and equivalence checking.

Uploaded by

jindamsreenath
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

Switching Circuits and Logic Design (CS21202)

Module 6
Binary Decision Diagrams

Prof. Indranil Sengupta


Dr. Monosij Maitra

Department of Computer Science and Engineering


IIT Kharagpur
Binary Decision Diagrams (BDD)

Switching Circuits and Logic Design (CS20202) 2


Binary Decision Diagrams (BDD)

• A data structure used to represent a Boolean function.


• Represented as a rooted, directed, acyclic graph, which consists of
several decision nodes and two terminal nodes, called 0-terminal and
1-terminal.
• Each decision node is labeled by a Boolean variable and has two child nodes
called low child, and high child.
• The edge from a node to a low (high) child represents an assignment of the
variable to 0 (1).
• A BDD is said to be ordered if different variables appear in the same
order on all paths from the root. 3
Example a b c f
f 0 0 0 1
0 0 1 0
a 0 1 0 0
0 1 1 1
b b 1 0 0 0
1 0 1 0
1 1 0 1
c c c c 1 1 1 1

1 0 0 1 0 0 1 1

4
• Construction of a BDD is based on the Shannon expansion of a
function.

5
Shannon Expansion
• Given a Boolean function f (x1, x2, …, xi , …, xn)
• Positive cofactor
fi1 = f (x1, x2, …, 1, …, xn)
• Negative cofactor
fi0 = f (x1, x2, …, 0, …, xn)
• Shannon’s expansion theorem states that
f = xi fi0 + xi fi1
f = (xi + fi0 )(xi + fi1 )

6
How to construct BDD?

f = ac + bc + a’b’c’
= a’ (b’c’ + bc) + a (c + bc) f This is the first step.

= a’ (b’c’ + bc) + a (c) The process is continued


a for all input variables.

Low High
child child
b’c’ + bc c

7
f = ac + bc + abc
= a (bc + bc) + a (c + bc) Expand by a
= a (bc + bc) + a (c)

b(c) + b(c) b(c) + b(c) Expand by b

Expand by c
c(1) + c(0) c(0) + c(1) c(0) + c(1) c(0) + c(1)

Variable ordering: a, b, c

8
f

b b

c c c c

1 0 0 1 0 1 0 1

9
Another Example: f = a’bc + b’c’ + ac’

10
Another Example: f = a’bc + b’c’ + ac’
f = a’bc + b’c’ + ac’ Expand by c
= c .(a + b’) + c.(a’b)

11
Another Example: f = a’bc + b’c’ + ac’
f = a’bc + b’c’ + ac’ Expand by c
= c .(a + b’) + c.(a’b)

a.(b) + a.(1) a(b) + a(0) Expand by a

12
Another Example: f = a’bc + b’c’ + ac’
f = a’bc + b’c’ + ac’ Expand by c
= c .(a + b’) + c.(a’b)

a.(b) + a.(1) a(b) + a(0) Expand by a

b(1) + b(0) b(1) + b(1) b(0) + b(1) b(0) + b(0) Expand by b

13
Another Example: f = a’bc + b’c’ + ac’
f = a’bc + b’c’ + ac’ Expand by c
= c .(a + b’) + c.(a’b)

a.(b) + a.(1) a(b) + a(0) Expand by a

b(1) + b(0) b(1) + b(1) b(0) + b(1) b(0) + b(0) Expand by b

Variable ordering: c, a, b

14
Another Example: f = a’bc + b’c’ + ac’
f

a a

b b b b

1 0 1 1 0 1 0 0
15
Another Example: f = xy + yz + zx

16
Another Example: f = xy + yz + zx
f = xy + yz + zx Expand by x
= x .(yz) + x.(1.y + 1.z + y.z)

y.(0) + y.(z) y(z) + y(1) Expand by y

z(0) + z(0) z(0) + z(1) z(0) + z(1) z(1) + z(1) Expand by z

Variable ordering: x, y, z

17
Another Example: f = xy + yz + zx
f

y y

z z z z

0 0 0 1 0 1 1 1
18
Another Example: f = w1’ w3’ + w1w2 + w1w3

19
Another Example: f = w1’ w3’ + w1w2 + w1w3
f = w1’w3’ + w1w2 + w1w3 Expand by w1
= w1 .(0.w2 + 1.w3‘) + w1.(1. w2 + 1. w3)
= w1 .(w3‘) + w1.(w2 + w3)

w2‘.(w3‘) + w2.(w3‘) w2 (w3) + w2(1) Expand by w2

w3(1) + w3(0) w3(1) + w3(0) w3(0) + w3(1) w3(1) + w3(1) Expand by w3

Variable ordering: w1, w2, w3 20


Another Example: f = w1’ w3’ + w1w2 + w1w3
f

w1

w2 w2

w3 w3 w3 w3

1 0 1 0 0 1 1 1
21
Variable Ordering (OBDD)
• The size of a BDD is determined both by the function being represented and the
chosen ordering of the variables.
• For some functions, the size of a BDD may vary between a linear to an exponential range
depending upon the ordering of the variables.
• An example:
f(x1,…,x2n) = x1x2 + x3x4 + … + x2n-1x2n

Variable ordering: x1 < x3 < … < x2n-1 < x2 < x4 < … < x2n
BDD requires 2n+1 nodes to represent the function.

Variable ordering: x1 < x2 < x3 < x4 < … < x2n-1 < x2n
BDD requires 2n nodes to represent the function.

22
BDD for the function f(x1, ...,
x8) = x1x2 + x3x4 + x5x6 + x7x8
using bad variable ordering

23
Same function using good variable
ordering

24
• Important point to note:
• It is essential to find a good variable ordering when using the OBDD data
structure in practice.
• The problem of finding the best variable ordering is NP-hard.
• Several heuristics for variable ordering have been proposed.

25
Reduced Ordered BDD (ROBDD)

• An ordered binary decision diagram is said to be reduced ordered BDD (ROBDD) if


the following two graph reduction rules are applied:
• Merge any isomorphic subgraphs.
• Eliminate any node whose two children are isomorphic.

26
Example: f = w1’ w3’ + w1w2 + w1w3
f

w1

w2 w2

w3 w3 w3 w3

1 0 1 0 0 1 1 1
27
Example: f = w1’ w3’ + w1w2 + w1w3
f

w1

w2 w2

w3 Merge two w3 w3 w3
subgraphs

1 0 1 0 0 1 1 1
28
Example: f = w1’ w3’ + w1w2 + w1w3
f
Eliminate w1
node w2

w2 w2

w3 Merge two w3 w3 w3
subgraphs

1 0 1 0 0 1 1 1
29
Reduced Ordered BDD (ROBDD)

• An ordered binary decision diagram is said to be reduced ordered BDD (ROBDD) if


the following two graph reduction rules are applied:
• Merge any isomorphic subgraphs.
• Eliminate any node whose two children are isomorphic.

• The advantage of an ROBDD is that it is canonical (unique) for a given function.


• There is exactly one ROBDD for a given variable ordering.
• This property makes it useful in checking functional equivalence.

30
Some Properties of ROBDD

• The following properties hold in a ROBDD:


a) Uniqueness: No two distinct nodes u and v are labeled with the same
variable name and have the same low and high successor.
b) Non-redundant: No variable node u has identical low and high successor.

31
Reduction Rule: Merge Isomorphic Subtrees

x x x

y z y z y z

x x x

y z y z y z

32
Reduction Rule: Remove Redundant Nodes

y y

33
Construction of ROBDD: an example
Given function: f (x1, x2, x3) = x1.x2 + x1’.x3 + x1.x2’.x3

34
x1 x1
0 1 0 1

x2 x2 x2 x2
0 1 0 1 0 1 0 1
x3 x3 x3 x3 x3 x3 x3
x3 1 0 0
0 1 0 1 0 1 0 1 0 1
1 1
0 1 0 1 0 1 1 1 0
0 1

x1 1 x1
0 1
x2 x2 0
1 0 x2
0
0
x3 1 1 x3 1 1
0 0
0 1 0 1

35
Some Benefits of BDD

• Checking for tautology is trivial.


• BDD is a constant 1.
• Complementation:
• Given a BDD for a function f, the BDD for f can be obtained by simply
interchanging the terminal nodes.
• Equivalence check:
• Two functions f and g are equivalent if their BDDs (under the same variable
ordering) are the same.

36
Use of BDD in Synthesis
• BDD is canonical for a given variable ordering.
• It implicitly uses factored representation:

x
x’h + xh = h
h y h y

a b a b

h x h x h x
ah + bh = (a+b)h
y z y z y z
• Variable reordering can reduce the size of BDD.
• Implicit logic minimization.

• Some redundancy is also removed during the construction of BDD itself.

38
MUX realization of functions

f f

x x
0 1

f g
f g

39
MUX-based Functional Decomposition
f f

0 1
h

g
h
f g f

An example ===>

40
f f

a ab
0 1
b a
c d
c b
d
0 1
0 1

41
A Complete Mapping Example

x1
1
0
0 x2

x3 1 1
0

0 1

42
To Summarize

• BDDs have been used traditionally to represent and manipulate


Boolean functions.
• Used in synthesis systems.
• Used in formal verification tools.
• Efficient packages to manipulate BDDs are available.

43

You might also like