Microelectronics Journal, 23 (1992) 5 2 3 - 5 3 1
Near-Optimal PLA Input Variable Pairing Using Autocorrelation Techniques R. T o m c z u k
[ii!~i ii} ii
a n d D. M . M i l l e r
VLSI Design and Test Group, Departmentof Computer Science, Universityof Victoria, Victoria, BC, Canada V8W 31)6
One logic optimization that can be used t o reduce the area required by a PLA is to use multi-bit rather than single-bit input decoders. In such a PLA the input variables are partitioned into
disjoint subsets, each of which is used as the input to a decoder. The outputs of the decoders instead of the input signals and their complements are used in the core of the PLA. This paper addresses the problem of assigning pairs of input variables to two-bit decoders. Variable pair selection is based on the total autocorrelation of a system of Boolean functions.
1. Introduction he goals of PLA optimization are to minimize
area requirements and to minimize propagation T delays. Because o f its regularity, the area of, and delay through, a PLA is proportional to the number of terms in a two-level canonical expression for the system of Boolean functions to be implemented. Efficient Boolean minimization methods [1] have been developed to determine a canonical form that is minimal or near-minimal and targeted to PLA implementation. However, there are other logic optimizations that can be used to reduce the area required by a PLA.
0026-2692/92/$5.00
One may use two-bit decoders to group the input variables into pairs where each pair is viewed as a single four-valued variable [2-5]. The optimization o f the PLA is then done via multiple-valued minimization. This technique almost always reduces, and never increases, the number o f products in the PLA. Figure 1 depicts a two-bit decoder which generates the four maxterms o f two variables. Any twovariable function may be represented as a product o f maxterms
f(x,, x2) = (c,, + x, + x2) (c, + x, + ~) (c2 + ~, + x~) (c3 + ~, + ~2) where ci(i = 0, 1, 2, 3) is a constant 0 or 1. To realize a function represented by (co, cl, c2, c3), the maxterms for which ci = 0 are A N D e d together.
Table 1 shows the truth table for a system o f Boolean functions and Fig. 2 depicts its standard two-level
© 1992, Elsevier Science Publishers Ltd.
523
m . e i
<
Ft. Tomczuk and D. M. Miller/PLA Input Variable Pairing
--'
-I
X
x~ + ~2 xl + x2
I
'
I'
i
•~ ' 1 "q- . ? 2
i
I
Fig. 1, Two-bit decoder. Example function
x4
x~
x2
x,
f,
f~
f2
0 0 0 0 0 0 o o
0 0 0 0 1 1 1 1
0 0 1 1 0 0 1 1
0 1 0 1 0 1 o 1
1 0 0 1 0 1 o o
0 0 0 0 1 1 o 1
1 0 0 1 1 0 o 1
1 1 1 1 1 1 1 1
o o 0 0 1 1 1 1
o o 1 1 o (} 1 1
o 1 0 1 o 1 o 1
o o 1 0 o 1 1 1
1 o 1 1 o o o 1
1 o 0 1 o 1 1 0
Xl
I I
I I I
I I
I I
I
I
I I
I I
I
'
'II!
x4
i
x3
]
I
llllll, 111111'
:
i
illIIl:
: I I I T T l : :,:o ,TTT11~: ...... ~ 4-]-~ ~ ~-" f2 (b) Fig. 3. Decoded PLA realizations of example function: (a) arbitrary; (b) optimal. affected by the choice o f variables to be assigned to each decoder.
I
I
I
'"~
/o fl A
-li-[-L~i-,
I
fo fl A
This paper proposes an algorithm that determines a near-optimal input variable pairing for a system o f Boolean functions from information contained in the system's total autocorrelation function. The algorithm is shown to produce excellent results.
.J
Fig. 2. Standard two-level PLA realization. PLA implementation. Figures 3(a) and 3(b) show decoded PLA realizations for the same system with an arbitrary pair assignment and an optimal pair assignment, respectively. As can be seen in Fig. 3, the area required by a decoded PLA is significantly
524
I
(a)
I
L-
I
,]''
I i )
I I
T,.,~
. . . . . .
J; 1
TABLE 1
J'l
Ii
, ',.=IIII--
3' 2
2. The Autocorrelation Function The autocorrelation function B,(u) [6, 7] for a Boolean function f,(X), X = Ix,,, x, _, . . . . . x , / o f n variables is given by 2"--
I
.f(v)f,(v • u)
B,(u) = E r, =
i)
(1)
;;2
Microelectronics Journal, VoL 23, No. 7
where u = XT= 1 ui2i- 1 and v = Xp= 1 vi2i- t. The number of ones in u is called the weight of u and is denoted by II u II.
Each Bi may be computed from the spectrum as follows [6]:
B, = ~-; T n R/2
(4)
Bi(u) is a measure of correlation between the functionS(X ) andS(X ) "shifted" a certain amount. Let Zi be the Boolean column vector definingf/(X). In GF(2), the result of the shift of S(X) is a permutation of Z~, accomplished by switching element v in Z~ with element v • u. From another viewpoint, if Z~ is restructured into a matrix with columns defined by variables x;, where ui = 1, then from (1) the value of B,(u) is a measure of similarity between pairs of columns j and j • u, j = 0 , 1 . . . . ,211"ll-- 1. For an m-output function, which may be viewed alternatively as a system of m functions f,.(X), i = 0, 1. . . . . m - 1, the autocorrelation function definition is extended to be the total autocorrelation function [6], defined as m--1
m--I
2"--1
(2) i=0
i=0
v=0
Let B be a column vector of 2" elements b,, u = 0 , 1 , 2 . . . . . 2"-1, where b , = B ( u ) . Each element b, is called a total autocorrelation coefficient, and has order II u [I- To compute B using eqn. (2) requires O(m22") operations. To reduce the computational complexity, B may be computed from the spectra of the system of Boolean functions. The spectrum Ri of a given function f, (X) defined by its truth table Z~ is given by
Ri = T" Zi
(3)
where T" is a Hadamard transform matrix [6, 8] in which the rows are the Rademacher/Walsh functions [6, 8]. T" has the following recursive structure: T ° = [1],
T"=
"- 1 T" -1] T,_ 1 _T,_lj
IT
Using eqns. (3) and (4), the computation of B requires O(mn2") operations when a fast transform procedure [8] is used. Although the autocorrelation function has been described by Karpovsky [6] as a synthesis tool, it has not been applied very extensively. In this paper we describe an application of the autocorrelation function to near-optimal input variable pairing for decoded PLAs.
3. The PLA Pairing Problem The PLA pairing problem may be stated as follows: given a system of Boolean functions determine an optimal assignment of the input variables to the twobit decoders for a decoded PLA. An optimal pairing of the input variables is an assignment that minimizes the area of the core of the f'mal PLA. There are n !/2 m- m!, m = n/2, possible pair assignments for n variables. For small values of n, an optimal assignment can be found by exhaustive search. However, as n grows, the computational requirements make this approach unfeasible. Therefore algorithms that employ heuristics are needed to arrive at near-optimal solutions relatively quickly. Some algorithms have been developed [3-5], and have been shown to be quite effective at reducing the area required by a PLA. The following section describes our heuristic algorithm which is based on the total autocorrelation function of a system of Boolean functions.
4. Autocorrelation Applied to the Pairing Problem One measure that has been shown by experiment to provide a satisfactory estimate of the complexity of a
525
!i ~ i ~ ~
R. Tomczuk and D. M. Miller/PLA Input Variable Pairing
Boolean functionf/(X) is a count of the number of adjacent pairs of assignments for which f/takes the same value for both assignments in the pair [6]. Hurst, Miller and Muzio [7] have shown that the first-order autocorrelation coefficients of a system of functions may be used to compute this estimate since each first-order coefficient is a count of the 1adjacencies with respect to the corresponding input variable, and the number of 0-adjacencies is easily derived from that and the number of ones in the function. Karpovsky [6] has shown that a linearization procedure may be used to transform a system of Boolean functions into a simpler system by moving the largest-magnitude coefficients into the first-order positions, thereby maximizing the number of adjacencies for the system. This process yields a realization for the system of functions consisting of a linear prefdter and a residual system simpler than the original. A decoded PLA has a similar structure in that the decoders perform a translation of the input variables for a transformed simpler-core PLA. The heuristics used in the autocorrelation pairing procedure are based on this observation. Each second-order autocorrelation coefficient, b., 2, for a given function provides a measure of the similarity between the values the function takes when the pair of variables x/and Xi, u~ = u i = 1, are assigned values that are Hamming distance 2 apart. The Boolean expression needed to specify function values that are at distance 2 from each other requires two product terms (to specify the Exclusive-Or operation). In a standard PLA realization, two product terms are necessary.
II. II =
In a decoded PLA realization, only one product term is needed. Furthermore, any subset of the four possible assignments to variables x~ and x i can be specified in only one product term in a decoded PLA. In choosing a pairing, the variables that should be paired are those that would take most advantage of this fact. Thus it seems reasonable to pair variables
526
for which the corresponding second-order autocorrelation coefficients have largest magnitude. This is the basis of our algorithm. 4.1 The Autocorrelation Pairing Algorithm The autocorrelation pairing algorithm is as follows: Step 1. Compute the total autocorrelation coefficients of the system of Boolean functions. Step 2. Find the largest magnitude second-order coefficient b,. Step 3. Pair the variables xi and Xi, u~ = Ui= 1. Step 4. Remove all second-order b,, such that vs = I or vi:
1.
Step 5. Repeat Steps 2 through 4 until no secondorder coefficients remain.
Take as an example, the function given in Table 1. Table 2 gives the autocorrelation coefficients Bi(u) of each output function f, as well as the total autocorrelation coefficients B(u) with the secondorder coefficients highlighted in bold type. From the table, the largest magnitude second-order total autocorrelation coefficient is b 3 = 16, which TABLE 2 function
Autocorrelation coefficients for example
v, u
f.
f,
f2
B.~
B,
B2
B
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
1 0 0 1 0 1 0 0 0 0 1 0 0 1 1 1
0 0 0 0 1 1
1 0 0 1 1 0 0 1 1 0 0 1 0 1 1 0
7 2 2 4 2 4 2 2 2 2 4 2 2 4 4 4
7 4 4 4 2 2 0 2 2 0 2 2 4 4 4 6
8 0 0 8 4 4 4 4 4 4 4 4 4 4 4 4
22 6 6 16 8 10 6 8 8 6 10 8 10 12 12 14
0 1 1 0 1 1 0 0 0 1
Microelectronics Journal, VoL 23, No. 7
TABLE 3 PLa
adr3 adr4 add6 mlp2 mlp3 mlp4 sqr4 sqr6 sqr8 root6 root7 root8 root9 dist3 dist4 f16 f18 sn74181
Arithmetic function pairing remits
#
#
in
out
6 8 12 4 6 8 4 6 8 6 7 8 9 6 8 6 8 14
4 5 7 4 6 8 8 12 16 4 4 5 5 4 5 6 8 8
F__..,dumstive
sop
31 75 355 7 31 124 13 48 180 23 34 57 85 36 120 40 129 575
Worst
Avg.
Best
25 67 346 7 29 115 13 46 169 21 33 73 82 31 105 36 120 569*
20.5 50.7 253.3 6.3 26.1 104-6 11.7 42.0 160.8 19.8 29.5 48.8 73-9 28-1 94.3 33.5 110-5 524-6"
10 17 37 6 21 89 11 40 151 17 25 38 60 19 71 31 102 300*
AC
Saseo
pair
[3]
10 17 37 6 24 89 11 41 156 17 26 42 62 19 73 33 109 289
10 17 w o 22 89 -41 156 17 ~ 38 ~ 19 74 34 109 --
Chen & Muroooa [5]
--
----27 42 64 73 ---
*From 1500 randomly selected pairings.
corresponds to variables x2 and xl since u2 = 1 and ul = 1. Thus x2 and Xl are chosen as a pair to be assigned to a decoder. This eliminates all secondorder coefficients b~, v E {5, 6, 9, 10}, since for each, vl = 1 or v2 = 1. Then the largest (and only) remaining second-order coefficient is b12 = 10 which corresponds to variables x4 and x3. Therefore these two input variables are also paired. The pairing chosen for this particular example is (x2, xl) (x4, x3), and is the optimum one.
4.2 Benchmark Circuit Results The autocorrehtion pairing algorithm has been implemented in the C programming language and interfaced with ESPRESSO [1]. Near-optimal p "amngs for several benchmark functions are presented in Tables 3 and 4. The results are compared with optimal pairings obtained by exhaustive search. The only criterion used for evaluation o f the algorithm is the number o f product terms needed in the core o f
the decoded PLA. N o consideration is made o f area cost o f the decoders. Tables 3 and 4 provide the results for a set o f arithmetic functions and a set o f control functions, respectively. The information provided is the number o f product terms required for a minimal standard PLA realization, the greatest, average and least number o f product terms required for decoded PLAs over all possible pairings as obtained by exhaustive search, and the number o f product terms needed for a decoded PLA using the pairing obtained by the autocorrelation procedure. In addition, Table 3 provides results obtained by Sasao [3] and Chen and Muroga [5] for some o f the functions. Table 4 contains results from Chen and Muroga
[5].
For the arithmetic function sn74181 an exhaustive search was not feasible due to the large number o f
527
m
<
R. Tomczuk and D. M. Miller/PLA Input Variable Pairing
"o
09 09 09 109
n"
TABLE 4
PLA
2ot"5" postal 5xpl 9sym bw conl t'2 fSlm mi~xl rd53* rd73* rd84* ~o2 alu2 a~3 c~p dc2 dk17 ri~ sqn xor5* z4
Control function pairing results
# in
5 8 7 9 5 7 4 8 8 5 7 8 10 10 10 9 8 10 8 7 5 7
# out
1 1 10 1 28 2 4 8 7 3 3 4 4 8 8 5 7 11 31 3 1 4
SOP
10 18 64 85 22 9 8 76 12 31 127 255 58 68 65 118 39 18 28 38 16 59
Exhaustive Worst
Avg.
Best
5 18 61 28 22 9 6 66 12 13 38 54 48 68 65 112 39 18 29 36 4 49
5-0 12.8 54-5 26.4 22.0 8.3 6-0 58.5 11.7 12.2 37-8 54.0 42-7 60.2 57.8 92.9 35.9 18.0 27.9 32.8 4.0 38.7
5 8 46 26 22 7 6 48 10 12 37 54 36 41 36 40 31 18 27 25 4 16
AC pair
Chen & Muroga [5]
5 9 49 27 22 8 6 50 11 12 37 54 38 41 37 43 32 18 28 33 4 16
--46 28 ---50 -37
--18 27 16
*Symmetric function.
possible pairings. Therefore 1500 random pairings were chosen out o f the possible 135 135 to obtain an estimate o f the number o f product terms required for a decoded PLA realization. The histogram in Fig. 4 shows that for the 1500 selections, the vast majority o f the results were closely clustered about the mean, which is itself considerably larger than the value found by our algorithm. The result for the best pairing o f the 1500 was also significantly larger than the result for the pairing found by our algorithm. These experimental results indicate that the autocorrelation pairing procedure works quite well. For all but two functionsfl8 and sqn, the pairing selected is within five product terms o f the optimum. For arithmetic function .//8, the result obtained by the
528
autocorrelation procedure is no worse than that obtained by Sasao [3]. Control function sqn is the only function for which a pairing was chosen that is significantly worse than that o f other researchers.
5. Relation to Previous Work Some heuristic algorithms that obtain " g o o d " solutions relatively quickly have been developed [35]. Each o f the algorithms begins by obtaining for the system o f functions a near minimal two-level canonical form from which an assignment graph is constructed. This is a complete weighted graph o f n nodes. Each node represents an input variable xi and the weight o f each edge (i,j) represents an estimate o f
'~
~ 7--
;:D
Microelectronics Journal, VoL 23, No. 7
IED ! ¸¸(3) ¢D
......m
80.0
60.0
Q_
40.0
E
20.0
o.o 250.0
300.0
350.0
400.0 Number
of
450.0 Product
500.0
550.0
600.0
Terms
Fig. 4. sn74181 random pairing results.
the complexity of the minimized function if variables xl and Xi are paired. This estimate is the number of unique product terms that remain in the nearminimal canonical expression after the variables xi and Xi and their inverses are removed. Sasao [3, 4] addresses the problem of assigning variables to two-bit decoders in a decoded PLA. This is accomplished by assigning to a decoder the variables xi and x i for each edge (i,j) in a minimumweight maximum-cardinality matching of the assignment graph. The algorithm achieves an average 2030% area reduction over standard PLAs. Chen and Muroga [5] extend pairing to a more general grouping problem that may use multi-bit decoders to reduce further the area required by a PLA. First, they order the input variables by finding a minimum-weight Hamiltonian path in the assignment graph. Then a minimum-cost partitioning of the variables is found using dynamic programming, and
one decoder is assigned to each partition. The cost function used by this algorithm takes into consideration the area overhead of the decoders. A major drawback to the above approaches is that an initial minimal or near-minimal two-level canonical expression for the system of functions is required to build the assignment graph. Also, the processing of the assignment graph is computationally expensive. The algorithm presented in this paper for nearoptimal input variable assignment for two-bit decoded PLAs does not need a near-minimal canonical expression from which to begin. It also does not perform any optimization of a structure such as the assignment graph. Variable selection is done directly from the second-order autocorrelation coefficients. Since fewer steps are involved and the computation for an initial near-minimal canonical form is avoided, the algorithm is more efficient than those of Sasao [3, 4] and Chen and Muroga [5].
529
R. Tomczuk and 19. M. Miller/PLA Input Variable Pairing
TABLE 5
PLA
root8 root9 sqn
Functions affected by modification
# in
# out
8
5
9 7
5 3
SOP
57 85 38
Exhaustive Worst
Avg.
Best
Old
New
73 82 36
48.8 73.9 32.8
38 60 25
41 62 33
38 60 29
6. Remarks A drawback of our current implementation is that the list of cubes defining a system of functions is expanded into a full truth table to compute the autocorrelation functions. A future enhancement is to compute the autocorrelation functions directly from the cube list. The results of the autocorrelation procedure compares favourably with those of Sasao, and Chen and Muroga. In only two cases did it produce poorer results than those of Sasao. Chen and Muroga's results were better in only two cases as well. In the above algorithm, variables are paired if the corresponding second-order autocorrelation coefficient has large magnitude. However, if a firstorder coefficient for either of the variables is significantly larger than the second-order coefficient, then the variables should not be paired since a much larger first-order value indicates that the function may be expressed more simply using only that one variable. A coefficient can be considered significantly larger than another one if the difference between it and the other is greater than or equal to a given threshold value. By studying the examples cited above, we have determined that 2"/2 ~+ 1, where n is the number of inputs and m is the number of outputs for the system of Boolean functions, is a suitable threshold. An analysis of the general applicability of this threshold is ongoing.
530
A C pair
Sasao [3]
Chen & Muroga [5]
38 ---
42 64 27
The algorithm has been modified to choose a secondorder coefficient only if it is significantly larger than the relevant first-order coefficients. Table 5 gives the results for those functions that were affected by this change. As can be seen, the results for these functions are all improved. This is an area we plan to pursue more fully. We plan to examine the use of higher order autocorrelation coefficients in the more general grouping problem addressed by Chen and Muroga [5]. Also, the costs of the decoders will be incorporated into the procedure since the area required by multi-bit decoders may override the savings achieved in the PLA core.
Acknowledgments This paper was first presented at the 1991 Canadian Conference on VLSI (CCVLSI'91), held in Kingston, Ontario, on 25-27 August 1991.
References [1] R.K. Brayton, G. D. Hachtel, C. T. McMullen and A. L. Sangiovanni-Vincentelli, Logic Minimization Algorithms .for VLSI Synthesis, Kluwer, Norwell, MA, 1984. [2] T. Sasao, Multiple-valued decomposition of generalized boolean functions and the complexity of programmable logic arrays, IEEE Trans. Computers, C-30 (Sep. 1981) 635643. [3] T. Sasao, Input variable assignment and output optimization of pla's, IEEE Trans. Computers, C-33 (Oct. 1984) 879894. [4] T. Sasao, Multiple-valued logic and optimization of programmable logic arrays, IEEE Computer, 21 (Apr. 1988) 71-80.
Microelectronics Journal, VoL 23, No. 7
[5]
K.-C. Chen and S. Muroga, Input assignment algorithm for decoded-pla's with multi-input decoders, Proc. 1988 Int. Conf. on Computer Aided Design, 1988, pp. 474477. [61 M. Karpovsky, Finite OnhogonalSeries in the Design of Digital Devices, Wiley, New York, 1976.
[7] S.L. Hurst, D. M. Miller andJ. C. Muzio, Spectra] method of boolean function complexity, Electron. Lett., 18 0une 1982) 572-573. [8] S. L. Hurst, D. M. Miller and J. c. Muzio, Spectral Techniques in Digital Logic, Academic Press, London/ Orlando, 1985.
531