BDD Minimization by Truth Table Permutations
Document Sample


BDD Minimization by Truth Table Permutations
Masahiro Fujita Yuji Kukimoto Robert K. Brayton
Fujitsu Laboratories of America University of California
San Jose, CA 95134 Berkeley, CA 94720
Abstract
a
Bern, Meinel and Slobodov´ [1] have recently proposed a novel tech-
nique called cube transformations to minimize the size of binary decision
diagrams. Given a Boolean function, they try to find a domain transforma-
tion such that the function after the transformation has a smaller BDD. It has
been shown that well-chosen transformations allow us to represent compactly
the hidden-weight-bit functions, which are known to have exponential-sized
BDDs regardless of variable orderings. Although their results are promising,
no heuristics for picking good transformations are provided in [1] , i.e. they
carefully chose a particular transformation for each function by investigating
the characteristic of the function. In this paper, we present a set of heuris-
tic algorithms which construct effective transformations starting from given
BDDs. The algorithms are incremental in the sense that they construct a
transformation as the combination of local transformations, each of which
is guaranteed to generate smaller BDDs. Preliminary experimental results
showed that this technique gives us a minimization ability which cannot be
captured by dynamic reordering.
1 Introduction
Binary decision diagrams (BDD) are the most memory-efficient data structure for
Boolean functions known so far, which are now used in almost every aspect of
logic synthesis and verification. The fact that the size of BDDs is highly sensitive
to variable ordering has spurred a large body of research on heuristic variable
ordering [2, 4, 3]. In 1993, Rudell [6] gave a powerful reordering algorithm
called sifting and showed that there is an efficient way to change variable ordering
dynamically while BDDs are constructed, which significantly enlarged the appli-
a
cability of BDDs. Recently Bern, Meinel and Slobodov´ [1] have proposed a novel
The second author is supported by NSF/DARPA under Contract #MIP-8719546
1
technique called cube transformations to minimize the size of binary decision di-
agrams. Given a Boolean function, they try to find a domain transformation such
that the function after the transformation has a smaller BDD. The transformation
can be seen as a row-wise permutation of the truth table of a given function. More
precisely, given a completely specified function f : B n ! B , a cube transfor-
mation is a one-to-one mapping ' : B n ! B n , where for x 2 B n , the output
value of the transformed function of f is f ('(x)). In this paper, we use a dif-
ferent terminology truth table permutations or TTP for short since we think this
is more informative. We are interested in finding a transformation ' such that
bdd size(f ('(x))) < bdd size(f (x)). Notice that the technique can be seen as
an extension of variable reordering since any variable reordering can be cast into
a simple truth table permutation. It has been shown in [1] that well-chosen trans-
formations allow us to represent compactly the hidden-weight-bit functions, which
are known to have exponential-sized BDDs regardless of variable orderings. Al-
though their results are promising, no heuristics for picking good transformations
are provided in [1] , i.e. they carefully chose a particular transformation for each
function by investigating the characteristic of the function. In this paper, we present
a set of heuristic algorithms which construct effective transformations starting from
given BDDs. The algorithms are incremental in the sense that a transformation is
constructed as the combination of local transformations, each of which is guaran-
teed to generate smaller BDDs. Preliminary experimental results showed that this
technique gives us a minimization ability which cannot be captured by dynamic
reordering.
This paper is organized as follows. Section 2 gives a simple example of truth
table permutations. Section 3 gives the basic definition of truth table permutations.
Section 4 discuss how to construct a promising transformation given a BDD. In
Section 5 we show that truth table permutations can be seen as a heuristic tech-
nique for solving the re-encoding problem for multi-valued functions. Preliminary
experimental results are given in Section 6. Section 7 concludes the paper.
2 Example
We will show a simple example of truth table permutations to clarify how BDDs
can be simplified. Consider the two-input EXOR function f = a b. The BDD
for this function has five nodes as shown in Figure 1. Notice that the size is
not sensitive to variable ordering since the function is symmetric. Consider a
truth table permutation where (a; b) = (0; 0); (0; 1); (1; 0); (1; 1) are mapped to
(0; 0); (1; 1); (1; 0); (0; 1) respectively, i.e. the output values of (a; b) = (0; 1) and
2
Truth Table
ab o Permutation ab o
00 0 00 0
01 1 01 0
10 1 10 1
11 0 11 1
a
0 1
a
b b
0 1 0 1
Figure 1: Example — Truth Table Permutation
(1; 1) are swapped. Once we applied this transformation to the EXOR function, the
resulting function is a, whose BDD has only three nodes, i.e. we could reduce the
BDD size by two. Note that this type of reductions is not possible by any variable
reordering. If we maintain the precise information on the permutation performed,
then the original functionality can be always extracted from the transformed func-
tion. In other words, any transformation induced by truth table permutation is
invertible. Note that the inverse transformation is also a truth table permutation.
3 Truth Table Permutations
Definition 1 [1] A truth table permutation ' is a one-to-one mapping ' : Bn !
Bn , where B = f0; 1g and n is the number of input variables.
Let f : B n ! B n and x 2 B n . Let f' = f ' be the new function
obtained after applying the TTP ' to f , where denotes the functional composition.
Intuitively, ' gives a permutation on the input domain B n . Given a minterm x, the
permutation gives another minterm of B n , where the function f is evaluated. Our
goal is to find a permutation such that the functionality after the transformation is
simplified. Note that this is equivalent with reorganizing the onset of a function in
the input domain. As long as we keep the permutation and the resulting function, the
3
a
0 1
b c
c b
t
Figure 2: Complete Type
original functionality can be always extracted. Therefore, truth table permutations
do not cause any loss of information.
a
Bern, Meinel and Slobodov´ proposed in [1] the basic notion of truth table
permutations and showed that the hidden-weight bit functions can be represented
compactly with a certain truth table permutation. Specifically, they investigated
a strict subset of truth table permutations, namely those represented by complete
types. Figure 2 shows an example of complete types for functions defined over
three variables a; b and c. Given a complete type represented as a DAG, one can
extract a TTP by traversing the graph from its root to its leaf. For the details of
complete types, the reader should refer to [1]. Due to the structural constraint on
complete types, it is known that we cannot explore the entire flexibility of TTPs by
complete types.
Truth table permutations give us a way to reduce the size of BDDs as seen in
Figure 1, but we still remain to answer if they are useful in actual applications. The
answer is yes and the following properties of TTPs make them attractive.
1. Let ' be a truth table permutation.
f = g iff f' = g'
2. Let ? be a binary operator on Boolean functions.
f ? g ) ' = f' ? g'
(
The first property tells us that Boolean comparison of two functions can be
done by comparing the corresponding functions after a truth table permutation.
4
f
=?
g
f
=?
TTP
g
Figure 3: Boolean Comparison
The second property allows us to perform any binary operation on the original
functions using transformed functions. These two properties are essential in setting
up an effective Boolean comparison technique using TTPs. The idea is to attach
an additional circuit representing a truth table permutation to the input of the two
functions as shown in Figure 3. By smartly choosing a truth table permutation, one
can make the transformed functionality of the two outputs simpler, thereby making
Boolean comparison itself easier. Notice that TTPs can be applied dynamically just
like dynamic reordering. The approach would be that when we get a huge BDD
while constructing an output function, a TTP is dynamically performed to reduce
the size of the function. The entire TTP is maintained incrementally in runtime. As
is done typically in Boolean comparison, we can also build a single-output circuit
whose primary output is the EXOR of the two outputs and test whether the output
is negative tautology. This is possible due to the second property.
One of the most important properties of TTPs is the existence of a powerful
permutation for any Boolean function.
Theorem 1 Given any Boolean function and any variable ordering, there exists a
TTP which gives a linear-sized BDD.
The result of such a transformation on a given function is quite easy to construct.
We first count the number of minterms of the function, jf j, and then construct the
function whose onset is a contiguous region from 00 : : : 0 to binary (jf j ? 1).
Intuitively, the transformation moves every minterm of the function as close as
5
possible to 00 : : : 0. It is easy to see that the BDD constructed this way is of
linear-size. Although the construction of the resulting function is easy, computing
such a TTP itself is difficult in practice1 . Therefore, the realistic goal is to come
up with a good TTP heuristically, which is described in Section 4.
In the following subsections, we discuss the relationship between TTPs and
other closely related techniques.
3.1 TTPs vs. Variable Reordering
Swapping two variables in BDD ordering can be seen as a TTP transformation,
i.e. variable reordering is a strict subset of TTPs. For example, the swap of two
variables x and y in the existing ordering can be done with the following TTP.
x y x y
::: 0 ::: 0 ::: ) ::: 0 ::: 0 :::
::: 0 ::: 1 ::: ) ::: 1 ::: 0 :::
::: 1 ::: 0 ::: ) ::: 0 ::: 1 :::
::: 1 ::: 1 ::: ) ::: 1 ::: 1 :::
3.2 TTPs vs. Spectral Transformations
Spectral transformation is a well-known transformation applicable to Boolean
n
functions. The input to this transformation is a vector x 2 f0; 1g2 corresponding
to the output values of an n-variable Boolean function for all the input patterns,
and a 2n 2n integer matrix M . The result of the transformation is another
vector y = M x. The structure of the matrix M characterizes the type of the
transformation.
The similarity between TTPs and spectral transformations is the fact that TTP
can also be represented as a matrix of the same size, which we call a permutation
matrix. The constraint to be satisfied is:
The matrix is a 0-1 Boolean matrix.
For any row of the matrix, there exists a single column containing 1.
For any column of the matrix, there exists a single row containing 1.
In spectral transformations, generally M (x ? y) 6= M x ? M y, where ? is a binary
operation. Thus, computing M (x ? y) from M x and M y usually takes exponential
1
This can be formulated with Boolean unification under some additional constraints, but so far
we do not know how to solve it efficiently.
6
x x x
1 1
0 0 1 0
y z y z
Figure 4: One-level Swapping
time. On the other hand, TTPs satisfies the equality as we saw in the second property
of TTPs.
4 Algorithms for Constructing Permutations
In the previous section, we have shown that for any function, there exists a TTP that
allows us to represent the transformed function with a linear-sized BDD. Computing
such a TTP, however, is in general difficult. Moreover, the representation of
the permutation in BDDs could be large, thereby canceling out the reduction
obtained from the transformation. Thus, we want to extract a reasonably good
TTP heuristically. Specifically, we are interested in constructing a promising TTP
automatically given a BDD. In this section, a couple of such algorithms will be
presented, where a TTP is dynamically constructed in order to reduce the size
of the current BDD. The algorithms are based on local hill-climbing, i.e. each
transformation tries to convert the current BDD to a smaller BDD level-by-level.
A final TTP is generated as the combination of such transformations.
4.1 One-level Swapping
The first local transformation looks at each level of a given BDD one by one to
find out a pair of nodes (index; then; else) = (x; y; z ); (x; z; y ), i.e. two nodes
which are labeled with the same variable and have the same two children connected
differently. The two x nodes of the left BDD in Figure 4 are an example of such
a pair of nodes. We want to merge the two nodes into a single node as shown on
the right in Figure 4. Note that the reduction shown in Figure 4 is exactly the same
7
original BDD (f)
w
0 1
BDD after TTP (new f)
x x x
BDD for TTP (p)
y z y z w
0 1 0 1
Figure 5: Example of One-level Swapping
as Minato’s input complement edges [5]. The TTP to be performed is: given a
minterm (seq; 0; : : :) where seq corresponds to a 0-1 assignment to the variables
above x in the current BDD ordering,
If seq leads to the shaded node, then (seq; 0; : : :) ) (seq; 1; : : :) and
(seq; 1; : : :) ) (seq; 0; : : :), else no transformation is performed.
More formally, let p be the function which evaluates to one if and only if an
evaluation up to variable x leads to the shaded node in the left BDD. Let f be
the initial function being minimized. The result of the TTP is: f' = f jx=x p
or f' = pf + p(xfx + xfx ). Note that p captures the exact information on the
¯ ¯
permutation.
Figure 5 shows how the reduction is done in a simple example. The two nodes
labeled with x here are the pair of nodes chosen by this TTP. The two children of
the right node are swapped so that the resulting node is exactly the same as the
left node. This reduction causes a further reduction on level w, where the only
node is removed since both its 0-edge and 1-edge point to the same node. This
transformation saves us 2 nodes, while one additional node is needed to represent
p. In this particular example, p = w.
4.2 Two-level Swapping
This technique is an extension of one-level swapping. Instead of looking at each
level one by one, now we examine two levels of a given BDD simultaneously to find
out a set of potential nodes for size reduction. Figure 6 shows an example of TTPs
falling into this category. Here we are looking at level x and level y simultaneously
to see if there is a node labeled with x whose grandchildren can be rearranged so
that the total number of nodes in the BDD decreases. In this example, the 01 child
8
TTP
x 00 00 x
0 1 01 10 0 1
10 01
11 11
y y y
G1 G2 G3 G1 G2 G3
Figure 6: Two-level Swapping
and the 10 child are swapped. This saves us one node at level y . Note that this
transformation is a generalization of adjacent-variable swapping in BDD ordering
in the sense that swapping is done selectively to a subset of nodes in a level not to
all the nodes in the level as in variable swapping. The corresponding TTP is:
xy xy
If seq leads to the shaded x-node, then (seq 01 : : : ) ) (seq 10 : : :)
(seq 10 : : : ) ) (seq 01 : : :)
else no transformation.
More formally, let f be an initial function to be minimized and p be the function
which evaluates to one if and only if an evaluation leads to the shaded x node.
Then
f' = p + p(x y)]f + p(xyfxy + xyfxy¯ ):
¯ ¯ ¯
Figure 7 shows a similar transformation as before, but this is not even a local
variable swapping since the swapping is done between the 01-child and 11-child.
So far we have not considered the case where the nodes on the second level,
i.e. the nodes labeled by y in Figure 6, are pointed by some other nodes. This
case complicates our situation since even if a y node can be removed locally from
a subgraph, it may still be pointed by another node, in which case the function still
needs this node. A reduction strategy based on this observation is illustrated in
Figure 8. Here we try to find a set of nodes which have the same four grandchildren
G1; G2; G3 and G4. In Figure 8 the two nodes labeled with x satisfy this condition.
We pick one of them as a canonical form and transform everything else to this
canonical form by a TTP. This allows us to reuse existing nodes effectively.
9
TTP
x 00 00 x
0 1 01 11 0 1
10 10
11 01
y y y
G1 G2 G3 G1 G2 G3
Figure 7: Two-level Swapping
5 Application: Re-encoding Multi-Valued Variables
In this section, we show that the technique can be adapted to solve the re-encoding
problem of multi-valued variables heuristically. The re-encoding problem is to find
a better encoding of multi-valued variables given a multi-valued input function and
an initial encoding. The cost criterion is to minimize the complexity of the encoded
function in some representation. In the following, we measure the complexity of
the functions by the size of BDDs.
Let f be a multi-valued-input binary-output function, f : P1 P2 : : :Pm
Bn ! B, where Pi (i = 1; : : :; m) is the multi-valued domain of i-th multi-valued
variable. Assume that i-th multi-valued variable is encoded with dlog jPi je Boolean
variables (xi;1; : : :; xi;dlog jPi je). Let enc(f; E1; : : :; Em]) be the encoded Boolean
function of f under the encoding E1; : : :; Em]), where Ei is the encoding of i-
th multi-valued variable. Let y1 ; : : :; yn be the Boolean variables for the last n
arguments of the function. Then, re-encoding of i-th multi-valued variable in this
function enc(f; E1; : : :; Em]) corresponds to a specific class of TTPs in which
only the Boolean variables for i-th variable, (xi;1 ; : : :; xi;dlog jPi je), are allowed to
be permuted. More precisely, the TTPs ' should satisfy the following condition,
where '(x1;1; : : :; xm;dlog jPm je; y1 ; : : :; yn ) = (x1;1; : : :; xm;dlog jPm je ; y1; : : :; yn ).
˜ ˜ ˜ ˜
1. (xi;1; : : :; xi;dlog jPije ) ! (xi;1; : : :; xi;dlog jPi je)
˜ ˜ is an arbitrary TTP from
B dlog jPi je ! B dlog jPi je .
2. xj;k = xj;k if j 6= i
˜
10
x x
0 1
y y y y
G1 G2 G3 G4
TTP
00 01
01 10
10 11 x
11 00 0 1
y y
G1 G2 G3 G4
Figure 8: Two-level Swapping
3. yj
˜ = yj
It is easy to restrict our TTP construction algorithms to find TTPs satisfying these
constraints by allowing local changes only in the levels (xi;1; : : :; xi;dlog jPi je ).
6 Experimental Results
We have conducted a preliminary experiment on the minimization of BDDs using
TTPs. A multi-level network dalu was read in and each of its primary output was
minimized using TTPs. We ran two sets of experiments. In the first experiment, we
started off with Malik’s heuristic ordering and directly applied TTP transformations.
The second experiment was exactly the same as the first one except that the initial
Malik’s ordering is improved by dynamic reordering. TTPs are then applied to the
results. We observed that dynamic reordering is so powerful that once we are done
with reordering, there is not much room left for improving the quality. This can be
explained by the fact that the current TTPs extracted by the algorithms are based on
local hill climbing. A more global view like the one in sifting is necessary to take
11
name of PO BDD size(experiment1) BDD size(experiment2)
O15 102 ! 77 83 ! 82
O14 155 ! 94 138 ! 138
O13 164 ! 108 141 ! 141
O12 183 ! 123 135 ! 135
O11 214 ! 139 131 ! 131
O10 294 ! 205 135 ! 135
O9 450 ! 327 137 ! 137
O8 452 ! 331 144 ! 144
O7 452 ! 296 139 ! 139
O6 430 ! 292 137 ! 137
O5 428 ! 292 135 ! 135
O4 426 ! 299 138 ! 138
O3 424 ! 308 126 ! 126
O2 422 ! 305 119 ! 119
O1 420 ! 306 117 ! 117
O0 394 ! 286 114 ! 114
Table 1: Experimental Results
advantage of the full power of TTPs. Interesting facts to be noticed, however, are
that sometimes the first experiment gives better results than the second experiment.
This is the evidence that TTPs explore a truly different space than reordering. We
are currently collecting comprehensive data, which will be included in the final
version.
7 Conclusion
In this paper we have proposed a novel approach for minimizing the size of BDDs
using the notion of truth table permutations originally given by Bern et al. The main
contribution of this paper is a set of heuristic algorithms for constructing effective
permutations given a function in BDD. We have shown that variable reordering
is just one instance of TTPs, so theoretically more powerful minimization can
be expected with TTPs. We have also shown that TTPs can be the basis for
the re-encoding problem of multi-valued functions. Experimental results showed
that TTPs enable us to perform a completely different type of minimization than
12
variable reordering although the minimization ability is currently somewhat limited
due to the local hill-climbing strategy employed in our implementation. We are
currently working on incorporating more global strategies into the algorithms to
see how much minimization ability TTPs have. We believe this extension enhances
the minimization ability significantly. Comprehensive experimental results will be
available in the camera-ready submission.
Recently, Sasao pointed out that TTPs can be thought of as a function de-
composition technique, where a given function is decomposed into a function
corresponding to a TTP and the transformed function. The goal here is to come
up with a decomposition in which both of these functions are simple. We are
investigating the relationship between his work on EXOR synthesis and TTPs.
References
a
[1] J. Bern, C. Meinel, and A. Slobodov´ . Efficient OBDD-based Boolean ma-
nipulation in CAD beyond current limits. Submitted to IEEE Transactions on
Computer-Aided Design, November 1994.
[2] M. Fujita, H. Fujisawa, and N. Kawato. Evaluation and improvements of
Boolean comparison method based on binary decision diagrams. In Proceed-
ings of IEEE International Conference on Computer-Aided Design, pages 2–5,
November 1988.
[3] M. Fujita, Y. Matsunaga, and T. Kakuda. On variable ordering of binary deci-
sion diagrams for the application of multi-level logic synthesis. In Proceedings
of European Design Automation Conference, pages –, February 1991.
[4] S. Malik, A. R. Wang, R. K. Brayton, and A. Sangiovanni-Vincentelli. Logic
verification using binary decision diagrams in a logic synthesis environments.
In Proceedings of IEEE International Conference on Computer-Aided Design,
pages 6–9, November 1988.
[5] S. Minato, N. Ishiura, and S. Yajima. Shared binary decision diagrams with
attributed edges for efficient Boolean function manipulation. In Proceedings
of 27th ACM/IEEE Design Automation Conference, pages 52–57, June 1990.
[6] R. Rudell. Dynamic variable ordering for ordered binary decision diagrams.
In Proceedings of IEEE/ACM International Conference on Computer-Aided
Design, pages 42–47, November 1993.
13
Related docs
Get documents about "