290 likes | 305 Views
Explore specialized applications of decision diagrams, including generic traversal procedures, variable redundancy checks, resubstitution techniques, and disjoint-support decomposition in electronic systems design.
E N D
Specialized Applications of Decision Diagrams Alan Mishchenko Electrical and Computer Engineering Portland State University October 22, 2001
Overview • Applications of Decision Diagrams (DDs) • Typical, not so typical, and specialized • Fast checks • Generic DD traversal procedure • Case study: Checking for redundant variables • Other specialized operators • Decomposability checks • Encoding • Two-level SOP minimization • Computing of Walsh and Haar spectra • Conclusions Electronic Systems Design Seminar, UC Berkeley
Applications of DD operators • Standard • Apply (Boolean AND,OR,XOR), If-Then-Else (ITE), quantifications, cofactoring • Non-standard • ISOP, compatible projection, disjoint cover • Specialized • Useful for one application only • Performance improvements are possible by tailoring DD operators to the application • Significant improvements are possible if processing can be reduced to checking conditions on the DD structure, without building new DD nodes ( example: Cudd_bddIteConstant() ) Electronic Systems Design Seminar, UC Berkeley
Generic DD Traversal Procedure dd Traversal( dd A, dd B ) { (1) terminal cases (2) cache lookup (3) cofactoring w.r.t. the top variable in A and B (4) recursively solving subproblems (5) deriving the solution from the partial solutions (6) cache insert (7) returning the result } Electronic Systems Design Seminar, UC Berkeley
Traversal Procedure: Boolean AND bdd AND( bdd A, bdd B ) { (1) if ( A == 0 ) return 0; if ( B == 0 ) return 0; if ( A == 1 ) return B; if ( B == 1 ) return A; if ( A == B ) return A; if ( A == B’ ) return 0; (2) cache lookup (3) (A0,A1)=Cofactors(A,x); (B0,B1)=Cofactors(F,x); (4) R0 = AND( A0, A1 ); R1 = AND( B0, B1 ); (5) R = ITE( x, R1, R0 ); (6) cache insert (7) return R; } Electronic Systems Design Seminar, UC Berkeley
Checking Variable Redundancy c c ab ab Theorem. Variablec is redundant if and only if and Electronic Systems Design Seminar, UC Berkeley
Ellimination of Redundant Variables c c c ab ab ab Electronic Systems Design Seminar, UC Berkeley
Redundancy Checking Procedure A procedure to perform the redundancy check for a set of variables without building new BDD nodes boolCheckRedundant(bdd F, bdd G, bdd Vars ); • Arguments • F is the on-set; G is the off-set; Vars is the variable set • Return value • TRUE, if variables in Vars are redundant in the incompletely specification function and can be removed from the support • FALSE, otherwise Electronic Systems Design Seminar, UC Berkeley
Redundancy Checking Procedure • Terminal cases • If one of the arguments is 0, Vars are redundant • If one of the arguments is 1, Vars are not redundant • Recursive step • If the topmost variable does not belong to Vars, call the procedure for both cofactors • If the topmost variable belongs to Vars, check that the redundancy conditions are true Electronic Systems Design Seminar, UC Berkeley
Redundancy Checking Pseudocode boolCheckRedundant(bdd F, bdd G, bdd Vars ) { if ( F == 0 || G == 0 ) return TRUE; if ( F == 1 || G == 1 ) return FALSE; x = TopVar( F, G, Vars ); (F0, F1) = Cofactors( F, x ); (G0, G1) = Cofactors( G, x ); if ( x Vars ) { /* the topmost variable belongs to Vars */ Res = CheckRedundant( F0, G1, Vars – x ); if ( Res == TRUE ) Res = CheckRedundant( F1, G0, Vars – x ); } else { /* the topmost variable does not belong to Vars */ Res = CheckRedundant( F0, G0, Vars ); if ( Res == TRUE ) Res = CheckRedundant( F1, G1, Vars ); } return Res; } Electronic Systems Design Seminar, UC Berkeley
Resubstitution • Algebraic resubstitution exists if the result of division of F by G is not an empty cover • Boolean resubstitution exists if adding the output of G to the support of F leads to the simplification of F F F G G Electronic Systems Design Seminar, UC Berkeley
Boolean Resubstitution • Force variable g = G(x) into the support of F • Minimize the support of FR(x,g) • Accept the transformation, if the resulting function is simpler than F Electronic Systems Design Seminar, UC Berkeley
Impact on Boolean Resubstitution A - algebraic resubstitution A+B - algebraic resubstitution followed by boolean resubstitution BF - brute force approach S - smart approach Electronic Systems Design Seminar, UC Berkeley
Disjoint-Support Decomposition (DSD) • DSD is the decomposition into logic blocks with disjoint support • Theorem. For a completely specified function, the structure of DSD of the finest granularity is canonical (unique up to the complementation of inputs and outputs of the blocks) F d e G H a b c f g Electronic Systems Design Seminar, UC Berkeley
Checking Existence of DSD • The algorithm [Bertacco, Damiani, ICCAD’97] computes the DSD structure from the shared BDD of a set of completely specified Boolean functions • The condition that should be verified many times in the process of DSD: Is it true that two Boolean functions, F and G, are equal when restricted to the domains DF and DG? • A specialized checking procedure has been designed to perform this check Electronic Systems Design Seminar, UC Berkeley
Speeding-up DSD BD – Bertacco/Damiani, ICCAD’97 150 MHz PC M – Matsunaga, SASHIMI’98 266 MHz PC New – our implementation 933 MHz PC Dash (-) means that the result is not available in the publications. Electronic Systems Design Seminar, UC Berkeley
Ashenhurst-Curtis Variable grouping Decomposition table Graph coloring Encoding Bi-Decomposition Variable grouping Checking conditions Deriving A and B using boolean formulas Non-Disjoint Decomposition These schemes work for binary and MV functions/relations Electronic Systems Design Seminar, UC Berkeley
DD Operators for MV Decomposition • Ashenhurst-Curtis • Checking column compatibility Problem: Given MV relation R(X,Y,V) and two columns C1(X) and C2(X), find out whether these columns are compatible bool CheckColumnCompatibility( bdd R, bdd C1, bdd C2 ); • Bi-Decomposition • Checking the existence of MAX/MIN-bi-decomposition Problem: Given MV relation R(X,V) and the partitioning of X into three sets Xa, Xb, and Xc, find out whether there exists bi-decomposition using MAX or MIN gate bool CheckMMDecomposability( bdd R, bdd Xa, bdd Xb ); Electronic Systems Design Seminar, UC Berkeley
Optimal Non-Strict Encoding • Definition. Encoding is strict, if a code is a minterm depending on the encoding variable. • Definition. Encoding is non-strict, if a code is a set of minterms depending on the encoding variable. (There should be no overlap between the sets.) • Problem: Given a set of N Boolean or MV functions, Fi(X), and an array of variables V, |V| |log2N|, find a non-strict encoding of the set of function, which guarantees that the resulting code-bit functions are simple in some sense. bdd FindEncoding(bdd * F, int N, bdd * Vars, int nVars); Electronic Systems Design Seminar, UC Berkeley
Encoding: Good and Bad Before encoding Encoding After encoding Electronic Systems Design Seminar, UC Berkeley
Two-Level SOP Minimization • The problem with long history • Explicit solutions • Quine (1952), Espresso (1984), Espresso-Signature (1993) • Implicit solutions • Swami et al (1992), Coudert/Madre (1993), Scherzo (1994) • Specialized DD operators in the implicit approach • Prime computation • Covering table reduction • Minimization of the number of literals in the SOP • SOP minimizer Rondo was designed after Scherzo http://www.ee.pdx.edu/~alanmi/research/min/minSop.htm Electronic Systems Design Seminar, UC Berkeley
Espresso vs. Rondo E – Espresso R – Rondo Electronic Systems Design Seminar, UC Berkeley
Walsh Spectrum • Applications: • Logic synthesis, technology mapping, NPN checking • Traditionally computed using the Walsh matrix [Clarke et al, 1993] • Walsh matrix can be defined recursively • Examples: Wn = W0 = W1 = W2 = Electronic Systems Design Seminar, UC Berkeley
Computing Walsh Spectrum • Brute-force approach • Deriving the matrix and multiplying it by the truth vector • Smart approach • Developing a specialized DD procedure Illustration of the brute force approach: F = a + b. • Truth vector is (0,1,1,1) • Encoded truth vector is (1,-1,-1,-1) • Spectrum is ( -2, 2, 2, 2 ) x = Electronic Systems Design Seminar, UC Berkeley
Computing Walsh Spectrum • Smart approach • Developing a specialized DD procedure based on a recursive definition of the Walsh matrix • Walsh “butterfly diagram” [Thornton et al, RM’01] • Illustration of the smart approach: F = a + b A A + B B A - B Electronic Systems Design Seminar, UC Berkeley
Walsh Spectrum Computation spectrumWalsh( bdd F, varset V ) { if ( F = 0 ) return +1; /* S-encoding */ if ( F = 1 ) return -1; x = TopVariable( V ); (F0, F1) = Cofactors( F, x ); W0 = Walsh( F0 , V- x); W1 = Walsh( F1 , V- x); R0 = W0 + W1; R1 = W0 - W1; return ITE( x, R1, R0 ); } Electronic Systems Design Seminar, UC Berkeley
Haar Spectrum Computation spectrumHaar(bdd F, varset V ) { if ( F = 0 ) return 0; /* R-encoding */ if ( F = 1 ) return 1; var x = TopVariable( V ); (F0, F1) = Cofactors( F, x ); H0 = Haar( F0 , V- x); H1 = Haar( F1 , V- x); C0 = NegPathCoef( H0 ); C1 = NegPathCoef( H1 ); R0 = Update(H0 , C0 +C1); R0 = Update(H0 , C0 - C1); return ITE( x, R1, R0 ); } Electronic Systems Design Seminar, UC Berkeley
Experimental Results Electronic Systems Design Seminar, UC Berkeley
Conclusions • Analyzed the generic DD traversal procedure • Discussed standard and specialized DD operators • Looked into several applications of specialized operators • Experimental results show that the performance may increase several orders of magnitude if the DD operators are skillfully tailored to the application • You are welcome to use the source code at http://www.ee.pdx.edu/~alanmi/research/extra.htm Electronic Systems Design Seminar, UC Berkeley