Beruflich Dokumente
Kultur Dokumente
Other nodes are called non-terminal nodes denoted by circles with variables inside. They are also
called simply nodes, differentiating themselves from the 0- and 1-terminals. From a node with xi
inside, two lines go down. The solid line is called 1-edge, representing xi = 1; and the dotted line is
called 0-edge, representing xi = 0.
In an OBDD, the value of the function f can be evaluated by following a path of edges from the root
node to one of the terminal nodes. If the nodes in every path from the root node to a terminal node are
assigned with variables, x1, x2, x3, , and xn, in this order, then f can be expressed as follows, according
to the Shannon expansion (described in Chapter 24). By branching with respect to x1 from the root node,
f(x1, x2, , xn) can be expanded as follows, where f(0, x2, , xn) and f(1, x2, , xn) are functions that
the nodes at the low ends of 0-edge and 1-edge from the root represent, respectively:
f ( x 1, x 2, , x n ) = x 1 f ( 0, x 2, , x n ) x 1 f ( 1, x 2, , x n )
Then, by branching with respect to x2 from each of these two nodes that f(0, x2, , xn) and f(1, x2, ,
xn) represent, each f(0, x2, , xn) and f(1, x2, , xn) can be expanded as follows:
f ( 0, x 2, x n ) = x 2 f ( 0, 0, x 3, , x n ) x 2 f ( 0, 1, x 3, , x n )
f ( 1, x 2, , x n ) = x 2 f ( 1, 0, x 3, , x n ) x 2 f ( 1, 1, x 3, , x n )
And so on. As we go down from the root node toward the 0- or 1-terminal, more variables of f are set to
0 or 1. Each term excluding xi or x i in each of these expansions [i.e., f(0, x2, , xn) and f(1, x2, , xn) in
the first expansion, f(0, 0, , xn) and f(0, 1, , xn) in the second expansion, ect.], are called cofactors.
Each node at the low ends of 0-edge and 1-edge from a node in an OBDD represents cofactors of the
Shannon expansion of the logic function at the node, from which these 0-edge and 1-edge come down.
Procedure 26.1: Reduction of a BDD
1. For the given BDD, apply the following steps in any order.
a. If two nodes, va and vb , that represent the same variable xi, branch to the same nodes in a lower
level for each of xi = 0 and xi = 1, then combine them into one node that still represents variable xi.
In Fig. 26.2(a), two nodes, va and vb , that represent variable xi, go to the same node vu for xi = 0 and
the same node vv for xi = 1. Then, according to Step a, two nodes, va and vb, are merged into one node
vab, as shown in Fig. 26.2(b). The node vab represents variable xi.
b. If a node that represents a variable xi branches to the same node in a lower level for both xi =
0 and xi = 1, then that node is deleted, and the 0- and 1-edges that come down to the former
are extended to the latter.
In Fig. 26.3(a), node va that represents variable xi branches to the same node vb for both xi = 0 and xi
= 1. Then, according to Step b, node va is deleted, as shown in Fig. 26.3(b), where the node va is a
dont-care for xi, and the edges that come down to va are extended to vu.
c. Terminals nodes with the same value, 0 or 1, are merged into the terminal node with the same
original value.
All the 0-terminals in Fig. 26.1(b) are combined into one 0-terminal in each of Figs. 26.1(c), (d), and
(e). All the 1-terminals are similarly combined.
2. When we cannot apply any step after repeatedly applying these steps (a), (b), and (c), the reduced
ordered BDD (i.e., ROBDD) or simply called the reduced BDD (i.e., RBDD), is obtained for the
given function.
The following process is faster than the repeated application of Step 1(a) of Procedure 26.1. Suppose
a BDD contains two nodes, va and vb, both of which represent xi, such that a sub-BDD, B1, that stretches
downward from va is completely identical to another sub-BDD, B2, that stretches downward from vb. In
this case, each sub-BDD is said to be isomorphic to the other. Then the two sub-BDDs can be merged.
For example, the two sub-BDDs, B1 and B2, shown in the two dotted rectangles in Fig. 26.4(a), both
representing x4, can be merged into one, B3, as shown in Fig. 26.4(b).
Theorem 26.1: Any completely or incompletely specified function has a unique reduced ordered
BDD and any other ordered BDD for the function in the same order of variables (i.e., not reduced)
has more nodes.
A set of BDDs representing many functions can be combined into a graph that consists of BDDs
sharing sub-graphs among them, as shown in Fig. 26.6. This idea saves time and space for duplicating
isomorphic BDDs. By sharing all the isomorphic sub-graphs completely, no two nodes that express the
same function coexist in the graph. We call it shared BDDs (SBDDs),25 or multi-rooted BDDs. In a
shared BDD, no two root nodes express the same function.
Shared BDDs are now widely used and those algorithms are more concise than ordinary BDDs. In the
remainder of this chapter, we deal with shared BDD only.
f1 = x1 x2 ,
f2 = x1 x2 ,
f3 = x2 ,
f4 = x1 x2
In the following, we show a formal algorithm for constructing BDDs for an arbitrary logic expression.
This algorithm is generally far more efficient than that based on a truth table.
g h = xi g h x g h
xi = 0 x = 0
i
x = 1 x = 1
i i i
with respect to variable xi, which is the variable of the node that is in the highest level among all the
nodes in g and h. This expansion creates the 0- and 1-edges which go to the next two nodes from the
node for the variable xi, by operations g xi = 0 h xi = 0 and g xi = 1 h xi = 1 . The two subgraphs
whose roots are these two nodes represent the cofactors derived by the Shannon expansion,
g h xi = 0 and g xi = 1 h xi = 1 . Repeating this expansion for all the variables, as we go down
xi = 0
0ntually trivial operations, such as g 1 = g, g g = 0, and
h 0 = h, finishing the construction of a BDD for g h.
1. Starting with the root nodes for g and h and going down toward to the 0- or 1-terminal, apply
repeatedly steps a and b in the following, considering steps c and d.
a. When the node under consideration, say Na, in one of the two BDDs for g and h is in a higher
level than the other node, Nb:
If Na and Nb are for variables xa and xb, respectively, and
Complement Edges
Complement edge is a technique to reduce computation time and memory requirement of BDDs by
using edges that indicates to complement the function of the subgraph pointed to by the edge, as shown
in Fig. 26.9(a). This idea was first shown by Akers3 and later discussed by Madre and Billon.18 The use
of complement edges brings the following outstanding merits.
The BDD size is reduced by up to a half
Negation can be performed in constant time
Logic operations are sped by applying the rules, such as f f = 0, f f = 1, and f f = 1
Use of complement edges may break the uniqueness of BDDs. Therefore, we have to adopt the two
rules, as illustrated in Fig. 26.9(b):
Before creating a new node, we check the reduction rules of Procedure 26.1. If the 0- and 1-edges go
to the same next node (Step 1(b) of Procedure 26.1) or if an equivalent node already exists (Step 1(a)),
then we do not create a new node but simply copy that node as the next node. To find an equivalent
node, we check a table which displays all the existing nodes. The hash table technique is very effective
to accelerate this checking. (It can be done in a constant time for any large-scale BDDs, unless the table
overflows in main memories.)
When generating BDDs for logic expressions, such as Procedure 26.2, many intermediate BDDs are
temporarily generated. It is important for memory efficiency to delete such unnecessary BDDs. In order
to determine the necessity of the nodes, a reference counter is attached to each node, which shows the
number of incoming edges to the node.
In a typical implementation, the BDD manipulator consumes 20 to 30 bytes of memory for each node.
Today, there are personal computers and workstations with more than 100 Mbytes of memory, and those
facilitate us to generate BDDs containing as many as millions of nodes. However, the BDDs still grow
beyond the memory capacity in some practical applications.
FIGURE 26.11 BDDs for 2-level logic network with AND/OR gates.
2. Influential variables:
The variables that greatly influence the nature of a function should be at higher position. For
example, the 8-to-1 selector shown in Fig. 26.12(a) can be represented by a linear size of BDD
when the three control inputs are ordered high, but when the order is reversed, it becomes of
exponentially increasing size as the number of variables (i.e., the total number of data inputs and
control inputs) increases, as shown in Fig. 26.12(b).
Based on empirical rules like this, Fujita et al.9 and Malik et al.20 presented methods; in these
methods, an output of the given logic networks is reached, traversing in a depth-first manner, then
an input variable that can be reached by going back toward the inputs of the network is placed at
highest position in variable ordering. Minato25 devised another heuristic method in which each output
function of the given logic networks is weighted and then input variables are ordered by the weight
of each input variable determined by how each input can be reached from an output of the network.
Butler et al.8 proposed another heuristic based on a measure which uses not only the connection
configuration of the network, but also the output functions of the network. These methods probably
find a good order before generating BDDs. They find good orders in many cases, but there is no
method that is always effective to a given network.
Another approach reduces the size of BDDs by reordering input variables. A greedy local exchange
(swapping adjacent variables) method was developed by Fujita et al.10 Minato22 presented another reor-
dering method which measures the width of BDDs as a cost function. In many cases, these methods find
a fairly good order using no additional information. A drawback of the approach of these methods is
that they cannot start if an initial BDD is too large.
One remarkable work is dynamic variable ordering, presented by Rudell.27 In this technique, the BDD
package itself determines and maintains the variable order. Every time the BDDs grow to a certain size,
the reordering process is invoked automatically. This method is very effective in terms of the reduction
of BDD size, although it sometimes takes a long computation time.
Table 26.1 shows experimental results on the effect of variable ordering. The logic network sel8 is
an 8-bit data selector, and enc8 is an 8-bit encoder. add8 and mult6 are an 8-bit adder and a 6-bit
multiplier. The rest is chosen from the benchmark networks in MCNC90.1 Table 26.1 compares four
different orders: the original order, a random order, and two heuristic orders. The results show that the
heuristic ordering methods are very effective except for a few cases which are insensitive to the order.
sel8 12 2 29 16 88 23 19
enc8 9 4 31 28 29 28 27
add8 17 9 65 83 885 41 41
mult6 12 12 187 2183 2927 2471 2281
vg2 25 8 97 117 842 97 86
c432 36 7 203 3986 (>500k) 27302 1361
c499 41 32 275 115654 (>500k) 52369 40288
c880 60 26 464 (>500k) (>500k) 23364 9114
Unfortunately, there are some hard examples where variable ordering is powerless. For example,
Bryant6 proved that an n-bit multiplier function requires an exponentially increasing number of BDD
nodes for any variable order, as n increases. However, for many other practical functions, the variable
ordering methods are useful for generating compact BDDs in a reasonably short time.
26.5 Remarks
Several groups developed BDD packages, and some of them are open to the public. For example, the
CUDD package12 is well-known to BDD researchers in the U.S. Many other BDD packages may be found
on the Internet. BDD packages, in general, are based on the quick search of hash tables and linked-list
data structures. They greatly benefit from the property of the random access machine model,2 where
any data in main memory can be accessed in constant time.
Presently, considerable research is in progress. Detection of total or partial symmetry of a logic function
with respect to variables has been a very time-consuming problem, but now it can be done in a short
time by BDDs.26,29 Also, decomposition of a logic function, which used to be very difficult, can be quickly
solved with BDD.5,21 A number of new types of BDDs have been proposed in recent years. For example,
the Zero-Suppressed BDD (ZBDD)23 is useful for solving covering problems, which are used in deriving
a minimal sum and other combinatorial problems. The Binary Moment Diagram (BMD)7 is another
type of BDD that is used for representing logic functions for arithmetic operations. For those who are
interested in more detailed techniques related to BDDs, several good surveys11,24,28 are available.
References
1. ACM/SIGDA Benchmark Newsletter, DAC 93 Edition, June 1993.
2. Aho, A. V., J. E. Hopcroft, and J. D. Ullman, The Design and Analysis of Computer Algorithms,
Addison-Wesley, Reading, MA, 1974.
3. Akers, S. B., Functional testing with binary decision diagrams, Proc. 8th Ann. IEEE Conf. Fault-
Tolerant Comput., pp. 75-82, 1978.
4. Akers, S. B., Binary decision diagrams, IEEE Trans. on Computers, vol. C-27, no. 6, pp. 509-516,
June 1978.
5. Bertacco, V. and M. Damiani, The disjunctive decomposition of logic functions, ICCAD 97, pp.
78-82, Nov. 1997.
6. Bryant, R. E., Graph-based algorithms for Boolean function manipulation, IEEE Trans. on Com-
puters, vol. C-35, no. 8, pp. 677-691, Aug. 1986.