LINEAR TRANSFORMATION OF BINARY DECISION DIAGRAMS TROUGH SPECTRAL DOMAIN Mlena Stankovc, Suzana Stokovc 2 Faculty of Electronc Engneerng, Unversty of Ns, A Medvedeva 4, 8 Ns, SERBIA, mstankovc@elfaknacyu, 2 Faculty of Electronc Engneerng, Unversty of Ns, A Medvedeva 4, 8 Ns, SERBIA, suza@elfaknacyu ABSTRACT We propose a new algorthm for lnear transformaton of BDD, by usng of Walsh Hadamard coeffcents of the represented functon Ths approach s based on the property that each spectral coeffcent represents the measure of correlaton between the functon and the correspondng EXOR sum of varables The proposed algorthm s applcable to large examples, and n many cases leads to substantally more compact dagrams when compared wth smple Ordered BDD INTRODUCTION Bnary decson dagrams (BDDs) are an effcent way for representaton of dscrete functons, whch has many applcatons n CAD systems for VLSI desgn, sgnal processng, and related areas BDDs are especally effcent n representatons and calculatons wth functons of a large number of varables, and thanks to that, they consderably extend applcablty of those method whose calculaton complexty s a lmtng factor n applcatons In partcular, BDDs permt effcent calculaton of spectral transforms of large functons [5,9,,2], evaluaton of large functons, verfcaton and testng [3,6,] Effcency of methods based on BDDs consderably depends on the sze of BDDs, defned as the number of non-termnal nodes Thus, reducton of the sze of BDDs, s a very mportant task greatly dscussed n many publcatons, see for example, [2,5] The mnmzaton of BDDs wth respect to many dfferent parameters (number of nodes, number of paths or memory sze) usually s performed by reorderng varables n the represented functon However, ths s an NP-complete problem, and ts exact soluton s a very space and tme demandng task Therefore, many heurstc algorthms are proposed for the reducton of the sze of BDDs, see for example a dscusson of that problem n [2] However, ths s stll an open and challengng task Several extensons of the basc BDD structure have been proposed n the last few years Instead of usng a Shannon decomposton only, dfferent decomposton types have been studed n [,3] In Free BDDs, the orderng restrcton s relaxed n the way that varables may occur n dfferent orders along each path from the root to the termnal nodes, whle they stll must not occur more than once along each path [,3] Word-level Decson Dagrams allow us to represent nteger-valued functons effcently However, the basc concept s much more complcated than n the bt-level doman and, also, many synthess operatons requre exponental tme n the worst case A very promsng extenson to BDDs are Lnearly Transformed BDDs (LTBDDs) dscussed n [4,5,7] where t s possble to have the EXOR sum of varables n the nodes In ths case, the BDD data structure tself remans unchanged and only an encodng of the nputs s carred out For some functons even an exponental reducton n the sze can be obtaned [4] usng lnear transformaton of varables Effcent heurstcs for BDD mnmzaton under lnear transformatons have been proposed n [5,7] In ths paper, we present a determnstc method for transformaton of BDD nto LTBDD by explotng propertes of the Walsh-Hadamard Transform (WHT) spectra of swtchng functons Ths consderaton s based on the property that the value of each Walsh coeffcent s a measure of the correlaton between a gven functon and the correspondng varable or an EXOR sum of varables, [6] PRELIMINARIES Bnary Decson Dagrams Each Boolean functon f : B n B, B = {,}, f ( x,, Kxn ) can be represented by a Bnary Decson Dagram (BDD) [], whch s a drected acyclc graph where the Shannon decomposton f = x f ( x = ) f ( x = ), ( {,2, n}) s performed at each node wth respect to the varable x assgned to the node Thus, each non-termnal node n a BDD s labelled by the correspondng varable Two constant nodes show functon values and The outgong edges of nodes are also labelled by and representng two possble values a swtchng varable can take
Example Fgure shows BDD for the functon f ( x, x3, x4) = xx4 + xx4 + x3 + x3 x x 2 x 2 x 3 x 3 x 3 x 3 x 4 x 4 Fgure BDD for f n Example A BDD s called ordered f each varable s encountered at most once on each path from the root to a termnal node and f the varables are encountered n the same order on all such pats A BDD s called reduced f t does not contan nodes wth somorphc sub-graphs or wth both edges pontng to the same node For functon represented by reduced BDDs effcent manpulaton are possble [2, 3] n m For a mult-output Boolean functon f : B B t s possble to use a shared BDD, as a common BDD for a set of functons ϕ = { f, ( =,2, Km)}, where f s the -th output In ths case, the order of the varables s fxed for all functons 2 Lnearly Transformed Bnary Decson Dagrams Defnton [4] A Lnear Transformaton of a set of nput varables X = x, x, x } s a bectve mappng n f { 2 n n n τ : B B that maps each varable x to a lnear combnaton of a set of varables x' = x V x V e, Ths can also be seen as a re-encodng of the varables whch can be represented by a nonsngular n n matrx over the Galos feld ( B,, ) Instead of representng a functon f drectly by a BDD, a lnearly transformed functon f s represented such that f ( x,, xn ) = f '( τ ( x,, xn )) The correspondng decson dagram s called Lnearly Transformed BDD (LTBDD) In other words, nstead of labelng nodes wth one sngle varable, nodes are labeled wth a lnear combnaton of a subset of varables, Fgure 2 Note that the read-once property does not hold n LTBDDs, e, one (untransformed) varable may appear more than once on a path from the root to a termnal node LTBDDs are a canoncal representaton for a fxed varable orderng and the lnear transformaton specfed Example 2 For the functon f n Example, the transformaton τ ( x, x3) = ( x 4, 3, x3, x4 ) s an automorphsm and converts f nto f x, x, x, x ) = ( x ) + ( x ) ( 2 3 4 4 2 x3 The LTBDD for f after the transformaton s shown n Fgure 2 x 2 + x x 3 + f x 4 Fgure 2 LTBDD of the functon n Example 2 In [5,6] t s shown that an exponental reducton of the BDD by usng lnear transformatons s possble, e, there s a set of functons f whch can be represented by LTBDDs of the lnear sze, but all OBDDs for these functons have the exponental sze 3 Complexty of DDs There are many dfferent defntons of DD complexty Here wll be done tree, usualz used n Defnton 2 In a decson dagram (DD), the number of nodes n the DD, denoted by NN_,, ncludes only nontermnal nodes Defnton 3 In a decson dagram (DD), the number of -paths, denoted by NOP, s defned as the total number of paths from the root node to the constant node showng the logc value, [5] Defnton 4 In a decson dagram (DD), the average path length, denoted by APL, s defned as the number of non-termnal nodes along all the paths n the decson dagram dvded by the number of paths [6] In ths paper, the proposed algorthm for constructon of LTBDDs wll be evaluated wth respect to all those tree measures Example 3 For the BDD n Fgure the number of non termnal nodes (NN) s 9, the number of ones path (NOP) s 8, and the average path length (APL) s 366
Example 4 For the LTBDD n Fgure 2 the number of non termnal nodes (NN) s 2, the number of -paths (NOP) s 2 and the average path length (APL) s,66 Thus, the complexty of ths decson dagrams s smaller then the complexty of the BDD n Fgure 4 Walsh-Hadamard transform Let F(n) = [F ], =, 2 n n -, be the 2 element vector representng the truth-vector of an n-nput Boolean functon f ( x, K xn ) n {,-} encodng, e, such that F s when the correspondng value of f s logc, and F s - when ths value s logc The Walsh spectrum of f s the n 2 element vector determned as: R( n) = W( n) F( n), () n n where W(n) s the 2 2 Walsh-Hadamard matrx: W( n ) W( n ) W( n ) =, () = ( ) ( ) W (2) W n W n The Walsh transform defned by () produces the Walsh coeffcents n the Hadamard orderng [6], n ths paper denoted as WH coeffcents For n = 4, ths vector s: R, R4, R3, R34, R2, R24, R23, R234 R (4) = R, R4, R3, R34, R24, R24, R23, R234 In our consderaton some subset of WH coeffcents wll be used and here we wll ntroduce a notaton for ths The subset of coeffcents n the spectrum R (n) wth the symbol n the ndces of the coeffcents wll be denoted as R ( { } n) and the subset of coeffcents wthout n the ndces wll be denoted as R ~ } ( n) For { example, for n = 4 and = 3, the subsets R ) and R ~ (4) are: { 3} R and {3}(4 [ R, R, R, R, R, R, R ] { 3} 4) = 3 34 23 234 3 34 23, ( R [ R, R, R, R, R, R, R ] 234 R ( 4) = { 3} 4 2 24 4 2, R24 Smlarly, the subset of WH coeffcents wth and n the ndces wll be denoted by R{, }( n) whle R ~ ( n) wll be a subset of coeffcents wthout and {, } wth n the ndces For example, [ R, R, R ] R ( R and { 2,3} 4) = 23 234 23, [ R, R, R ] R ( R 4) = { 2,3} 3 34 3, 34 234 Each WH coeffcent may be consdered as a measure of the correlaton (lkeness) between a gven functon f and the correspondng Walsh functon, whch further corresponds to the relatonshps between f and lnear swtchng functons [8,3] For example, the coeffcent R (zero-order coeffcent) s the measure of the correlaton between a functon f and constants and The frst order coeffcents ( R, R2, K, Rn ) are measures of correlatons between the functon f and nput varables: x, K, x n, whle the value of hgh order coeffcents depends on the correlaton between a functon f and EXOR sums of nput varables: x, x, x K,etc 2 2 3 2 PROCEDURE FOR LINEAR TRANSFORMATION When the spectra of a number of functons of any gven n are compared, t wll be evdent that dentcal sets of magntudes occur n many spectra, albet wth poston and sgn changes It s well known that some operatons over f, denoted as spectral nvarant operatons, change the order, but not the values of coeffcents n Walsh- Hadamard spectrum [8, 3] Those nvarant operatons are effcently used n several tasks n swtchng theory and applcatons, as for example n classfcaton and crcut realzaton of swtchng functons [7] Lnear transformaton s one of the nvarant transforms and s defned as follows: Theorem, [7] For the functon f ( x, xn) replacement of any varable x wth: x K xk, K k, and, k, n, n the WH spectrum of the f doman requres the nterchange of the subset of WH coeffcents R {, wth the subset R {, Kk } In ths paper, ths nvarant operaton wll be used for lnear transformaton of the BDDs For ths transformaton followng smple heurstc wll be used: If consdered functon has larger correlaton wth some EXOR sum of varables x K x compared to correlaton wth the varable x k then, at the th level of the BDD representng functon, the correspondng lnear transformaton wll be performed As measure of ths correlaton the absolute values of the WH coeffcents wll be consdered If the coeffcent R has the largest absolute value n subset of WH coeffcents, then n the nodes the R { } ( n) at the -th level of the BDD the varable x wll be used When the coeffcent R has not the maxmum absolute value n the subset R ), then a lnear transformaton { } ( n wll be performed, and the nodes at the -th level of the BDD wll be labelled by the EXOR sum of varables, wth ndces dentcal to the ndces of the coeffcent wth the maxmum absolute value n the subset R ) x n { } ( n
Ths transformaton n spectrum doman wll be performed as a permutaton of subsets of coeffcents If x s replaced wth the lnear combnaton: x K k, then R{, subset of coeffcents wll be replaced wth the subset R and vce versa {, Kk } Ths consderaton wll be performed at all levels, and n each step prevously transformed spectrum wll be used Ths procedure wll be formulated as follows: 4 Procedure for transformaton of BDD nto LTBDD Input: BDD of the functon f ( x, K, xn) Output: LTBDD of the functon f ( x, K, xn) Step Generate the BDD of the gven functon f Step 2 Calculate the spectrum R ( n ) as WH spectrum of the functon f (The superscrpt n the notaton above s used to denote the frst teraton n transformaton of the spectrum) Step 3 for := to n do begn In the subset of coeffcents R {} of the spectrum R (n) fnd the coeffcent R, k wth the maxmum absolute value If R, K, k > R at the -th level of the BDD perform lnear transform x = x K k Calculate R I + ( n ) by replacng the subset of coeffcents R {, wth the subset R {, end End of procedure Note that the LTBDD gven wth ths transformaton s the BDD of the functon wth the WH spectrum R n+ ( n) Ths procedure wll be llustrated step by step for the functon f n Example Example 3 The Walsh-Hadamard spectrum for f n Ex- R (4) = 8,,,,,,8,,,8,,,,,,8 ample s [ ] Step The coeffcent wth the maxmum value n the subset R {} s the coeffcent R 4 whch means that the sum of varables x 4 wll be selected for the node at the level Ths corresponds to the lnear transformaton x = x 4 In the doman of WH spectrum, ths lnear transformaton s performed as the permutaton between the coeffcents from the subset R {4} and the correspondng coeffcents from the subset R {4} After ths permutaton, the startng WH spectrum R (4) wll be transformed nto the spectrum: [ 8,,,,,,8,,8,,,,,,8, ] R 2 (4) = Step 2 Now the coeffcent wth the maxmum absolute value n the subset R 2 {2} wll be selected Ths s the coeffcent R 23 At ths level, the lnear transformaton 2 = 3 wll be performed In the spectral doman, the permutaton of subsets R 2 {23} and R 2 {23} s requred After ths transformaton, the WH spectrum R 2 (4) s converted nto the spectrum: [ 8,,,,8,,,,8,,,,,8,, ] R 3 (4) = 3 Step 3 The coeffcent R 3 has the maxmum absolute value n the subset of coeffcents R 3 {3} and at ths level t s not necessary to perform a lnear transformaton and spectrum R 4 (4) s equal to R 3 (4) : 4 R (4) = R 3 (4) 4 Step 4 Fnally, the coeffcent R 4 has the maxmum absolute value n the subset of coeffcents R 4 {4} and at ths level t s not necessary to perform a lnear transformaton and spectrum R 5 (4) s equal to R 4 (4) : 5 R (4) = R 4 (4) As a result of ths procedure the transformaton τ ( x, x3) = ( x 4, 3, x3, x4) s obtaned and the LTBDD represented at the Fgure 2 s generated EXPERIMENTAL RESULTS In ths secton, as llustratng of the effcency of the procedure proposed above, we show examples of experments over some standard benchmark functons, Table, and for a set of functon representng adders wth dfferent nput varables, Table 2 In the set of expermental data we compared the complexty of OBDDs and LTBDDs generated by usng the proposed procedure Tree parameters of the complexty are compared: NN, NOP and APL Tables show the reducton of these parameters n the LTBDDs, determned by the procedure proposed n ths paper, compared wth the ntal OBDD Frst tree columns n tables show functons and the number of nputs and outputs of those functons Notce that, for the set of the benchmark functons, the reducton of nodes does not necessarly mples the reduced number of -paths n a decson dagram Therefore, there are examples where n LTBDDs the NOP s ncreased (the negatve values n the table) although the number of nodes s reduced The value n Table means that the lnear transform dd not mprove the parameters consdered Notce that the same features can be observed also n the procedures dscussed n [5, 6] Over a set of benchmark functons proposed algorthm reduces the sze of the BDD n most cases, wth an
average mprovement of 3,2% n the number of nodes, 3,% n the average pats and of 9,73% n the ones pats For the set of functons representng adders reducton of NOP ranges from 33% (for add2) to 56% (for Add8) It s nterestng to notce that on the average the reducton s 47% and that ths reducton rato mproves wth ncreasng the number of nput varables, Fgure 3 Table Expermental results for pla benchmarks Fun In Out Reduc of NN Reduc of APL Reduc of NOP 5xp 7 73 97 399 9sym 9 22 362 5 Add2 4 3 374 269 3333 Add4 8 5 4398 356 4542 Alu4 4 8 Apex4 9 9 B2 5 9 Clp 9 5 277 72 235 Con 7 2 Cordc 23 2 5244 3877 9975 Ex 293 268 32 Inc 7 9 228 87-624 Msex 8 7 73 99 598 Mse 25 8 Msex3 4 4 Mul2 4 4 Rd53 5 3 474 347 479 Rd73 7 3 377 2857 328 Rd84 8 4 2333 288 248 Sao2 4 667 28-38 Sqrt8 8 4 729 434 24 Squar5 5 8 677 648 95 T48 6 Table3 4 4 Vg2 25 8 Xor5 5 5 8 9375 Average 32 3 973 CONCLUSION The optmzaton of decson dagrams has applcatons n both crcut verfcaton and synthess Whenever the cost of creatng and optmzng the decson dagram s a mnor fracton of the total elaboraton cost; or whenever the optmalty of the dagram may have a drect mpact on the qualty of the soluton, the extra expense of tme requred by a more sophstcated algorthm may well be ustfed The lnear transformaton of varables s an approach to the optmzaton of varous parameters of decson dagrams, as, for nstance, the number of nodes, - paths, and the average path length In ths paper, we presented a procedure for lnear transformaton of varables n BDDs by usng of Walsh spectrum of the functon represented We show by experments that ths algorthm reduces the sze of the BDD n most cases over a set of benchmark functons used n ths area Table 2 Expermental results for adders Fun In Out Reduc of NN Reduc of APL Reduc of NOP Add2 4 3 37,4 26,9 33,33 Add3 6 4 4,82 28,39 4,28 Add4 8 5 43,98 3,56 45,42 Add5 6 46,5 32,43 49,26 Add6 2 7 48,5 34, 52,2 Add7 4 8 5,3 35,3 54,53 Add8 6 9 5,43 36,4 56,4 Average 45,49 3,9 47,35 6 5 4 3 2 4 6 8 2 4 6 Reduc of NN Reduc of APL Reduc of NOP Fgure 3 Expermental results for adders REFERENCES [] Bryant, R E Graph-based algorthm for Boolean functon manpulaton IEEE Trans on Computers, vol C-35, no 8, 986, pp 677-69 [2] Drechsler, R, Drechsler, N, Gunther, W, Fast exact mnmzaton of BDDs, n Desgn Automaton Conference, 5-9 June 998 pp2-25 [3] Drechler, R, Formal Verfcaton of Crcuts, Kluwer Academc Publsher, 2 [4] W Gunther and R Drechsler, On the Computatonal Power of Lnearly Transformed BDDs, Informaton Processng Letters, vol 75,no 3, pp 9-25, 2Fey, G, Drechsler, R, Dreshler Mnmzng the number of paths n BDDs: Theory and algortham, Computer-Aded Desgn of Integrated Crcuts and Systems, IEEE Transactons on, Volume 25, Issue, Jan 26, pp 4 [5] C Menel, F Somenz, and T Theobald, Lnear Sftng of Decson Dagrams and Its Applcaton n Synthess, IEEE Trans Computer Automated Desgn, vol 9, no 5, pp 52-533, 2 [6] Futa, M, Chh-Yuan Yang J, Clarke, EM,Zudong Zhao; P McGeer, Fast spectrum computaton for logc functons usng bnary decson dagrams Crcuts and
Systems, ISCAS '94, 3 May-2 June 994 Vol, pp 275-278 [7] S L Hurst, DM Mller, JC Muzo, Spectral Technques n Dgtal Logc, Academc Press 985 [8] N Ishura, H Sawada, and S Yama, Mnmzaton of bnary decson dagrams based on exchange of varables, Proc Int ConfComputer-Aded Desgn, Nov 99, pp 472 475 [9] S-W Jeong, T-S Km, and F Somenz, An effcent method for optmal BDD orderng computaton,, Proc Int Conf VLSI and CAD, 993 [] Sasao, T, Futa M, Representaton of Dscrete Functons, Kluwer Academc Publshers, 996 [] F Somenz, CUDD: CU Decson Dagram Package Relase 22, Unv Colorado, Boulder, 997 [2] Stankovc, M, Stokovc, S, Reducton of Decson Dagrams by Usng of Dsunctve Spectral Translaton n the Walsh-Hadamard Doman, Facta Unverstats, Ser Math Inform 2(25), 37-48 [3] Stankovc, R S; Stankovc, M; Jankovc, D, Spectral Transforms n Swtchng Theory, Defntons and Calculatons, Nauka, Belgrade, 999 [4] MA Thorton, J P Wllams, R Drechsler, N Drechsler, SBDD Varable Reorderng Based on Probablstc and Evolutonary Algorthms, IEEE, 999, pp 38-387 [5] S Nagayama, A Mshchenko, T Sasao, and J T Butler, Mnmzaton of average path length n BDDs by varable reorderng, n Proc Int Workshop Logc and Synthess, Laguna Beach, CA, May 23, pp 27-23