Sunteți pe pagina 1din 23

SEMINAR ON

Binary Decision Diagrams


BY

CHANDAN T J

Binary Decision Diagrams

Binary Decision Diagrams (BDDs) are symbolic/graph representation of Boolean functions. With BDDs, functions can be constructed, manipulated, and compared. Since Boolean functions can also represent mathematical domains as sets and relations and many problems in digital systems can be expressed as a sequence boolean functions, a wide variety of problems can be solved using BDDs.

Terminologies

Nodes with children are parent nodes. A directed edge refers to the link from the parent to the child. The root node of a tree is the node with no parents. There is at most one root node in a rooted tree. A leaf node (terminal node) has no children. Siblings are nodes that share the same parent node. A node p is an ancestor of a node q if it exists on the path from q to the root. The node q is then termed a descendant of p.

Binary tree

binary tree is a tree data structure in which each node has at most two child nodes, usually distinguished as "left(0/1)" and "right(1/0)". Binary trees are used to implement binary search trees.

Representing Boolean Functions

Truth Table

It needs 2^N bit of memory to represent a Boolean function having N-bit input variables.

Binary Trees
Binary Decision Diagrams

Representing Boolean Functions: Examples


Truth Table
X 0 0 0 0 1 1 1 1 Y 0 0 1 1 0 0 1 1 Z 0 1 0 1 0 1 0 1 F 0 0 1 0 1 1 0 0

Binary Decision Tree


X Y Z Z Z Y Z

Boolean Circuit
F X Y Z

Boolean Expression F = XYZ |X Y

Arriving at BDDs

Conjunctive Normal Form (CNF) or POS


F = (A+B) (B+C) . . .

Disjunctive Normal Form (DNF) or SOP


F = AB + BC + . . .

An If-then-else Normal Form (INF) is a Boolean expression built entirely from the if-then-else operator and the constants 0 and 1 such that all tests are performed only on variables.
Y = x

y0, y1 = (x ^ y0) v ( x ^ y1)

This is known as the Shannon expansion of Y with respect to x.

Example
Consider the Boolean expression t = (x1 y1) ^ (x2 y2).
An INF of t by selecting in the order of variables x1, y1, x2, y2 and by performing Shannon expansions, we get the expressions t = x1 t1; t0 t0 = y1 0; t00 t1 = y1 t11; 0 t00 = x2 t001; t000 t11 = x2 t111; t110 t000 = y2 0; 1 t001 = y2 1; 0 t110 = y2 0; 1 t111 = y2 1; 0

Binary Tree x1

0 0 y1 1 x2

1 0 x2 y1 1

x2 0 1 1 0 y2 y2 y2 y2 0 1 0 1 0 1 0 1 1 0 0 1 0 0 0 0

x2 1 0 1 0 y2 y2 y2 y2 0 1 0 1 0 1 0 1 0 0 0 0 1 0 0 1

(x1 y1) (x2 y2)

The ordering and reduction conditions of ROBDDs


Steps to be followed in Reduction Techniques Variables must be ordered.

Sharing of Equivalent Functions (Nodes and edges must be unique).


Only non-redundant tests should be present. Delete a node whose both edges point to the same function.

If all identical nodes are shared and all redundant tests are eliminated, the OBDD is said to be reduced (an ROBDD).

Reduced Ordered BDD


Binary Decision Diagram F
X
0-edge
F(X=0)

Fixed Variables Order


X
For every node: X < Y, X < Z

1-edge

F(X=1)

Sharing Equivalent Functions


F=G X Y X Z Y
F G

Redundant node
X
Y
F F

X Z

Redundant node
A node whose both edges point to the same function. Redundant node is simply replaced by a reference to its subnode.

x2 0 1

0 1 1 1

y2

Binary Tree x1

0 0 y1 1 x2

1 0 x2 y1 1

x2 0 1 1 0 y2 y2 y2 y2 0 1 0 1 0 1 0 1 1 0 0 1 0 0 0 0

x2 1 0 1 0 y2 y2 y2 y2 0 1 0 1 0 1 0 1 0 0 0 0 1 0 0 1

(x1 y1) (x2 y2)

Decision Tree
0 0 x2 0 1 y2 y2 0 1 0 1 1 0 0 1 y1 1 x1 1 0 x2 y1 1

x2 1 0 1 0 y2 y2 y2 y2 0 1 0 1 0 1 0 1 0 0 0 0 0 1 0 0 1 (x1 y1) (x2 y2)

Decision Tree
0 0 x2 0 1 y2 y2 0 1 0 1 1 0 0 1 y1 1 x1 1 0 y1 1 x2 1 0 y2 y2 0 1 0 1 1 0 0 1

0 (x1 y1) (x2 y2)

BDD

If we substitute all equal sub-expressions we end up with what is known as a binary decision diagram (a BDD). It is no longer a tree of Boolean expressions but a directed acyclic graph (DAG).

t = x1 t1; t0 t0 = y1 0; t00 t1 = y1 t00; 0 t00 = x2 t001; t000 t000 = y2 0; 1 t001 = y2 1; 0

Decision Tree
0 0 x2 0 1 y2 y2 0 1 0 1 1 0 0 1 y1 1 x1 1 0 y1 1 x2 1 0 y2 y2 0 1 0 1 1 0 0 1

0 (x1 y1) (x2 y2)

BDD 0 0 x2 0 1 y2 y2 0 1 0 1 1 0 0 1 y1 1 x1 1 1 0 y1

0 (x1 y1) (x2 y2)

Reduced Ordered BDD 0 0 x2 0 1 y2 y2 0 11 1 y1 1 x1 1 0 1 y1

0 0 (x1 y1) (x2 y2)

Examples
Truth Table
X 0 0 0 0 1 1 1 1 Y 0 0 1 1 0 0 1 1 Z 0 1 0 1 0 1 0 1 F 0 0 1 0 1 1 0 0

Binary Decision Tree


X Y Z Z Z Y Z

Boolean Circuit
F X Y Z

Boolean Expression F = (XYZ) |(X Y)

Examples
0 0 0 0 z 1 0 y 1 z x 1 0 z 0 1 y 1 1 1 z 1 0 0 0

0 1

1 0

Boolean Expression F = (XYZ) |(X Y)

Eliminating Redundant nodes

0 0 0 y 1 z

1 0 1 y 1 0

0 1

1 0

Boolean Expression F = (XYZ) |(X Y)

Examples

S-ar putea să vă placă și