multilevel logic synthesis -- algebraic methods
DESCRIPTION
Multilevel Logic Synthesis -- Algebraic Methods. Why Algebraic Methods?. What is our goal? minimization, maximally factored form. Algebraic methods provide fast algorithms. Algebraic methods treat logic function like a polynomial Fast algorithms for polynomial manipulation exist. - PowerPoint PPT PresentationTRANSCRIPT
Multilevel Logic SynthesisMultilevel Logic Synthesis-- Algebraic Methods-- Algebraic Methods
ENEE 644 2
Why Algebraic Methods?Why Algebraic Methods?
What is our goal?What is our goal?
minimization, maximally factored form.minimization, maximally factored form. Algebraic methods provide Algebraic methods provide fastfast algorithms. algorithms.
Algebraic methods treat logic function like a Algebraic methods treat logic function like a polynomialpolynomial
Fast algorithms for polynomial manipulation exist. Fast algorithms for polynomial manipulation exist.
Algebraic methods may lose the optimality, but Algebraic methods may lose the optimality, but the the resultresults are quite s are quite goodgood in general. in general.
Algebraic methods can be used to iterate and Algebraic methods can be used to iterate and interleave with interleave with Boolean operationsBoolean operations..
ENEE 644 3
What is Division?What is Division? 7 = 2 x 3 + 17 = 2 x 3 + 1 Divisor: what to divide with?Divisor: what to divide with? Quotient and remainder: how to divide?Quotient and remainder: how to divide? F = G F = G · H + R· H + R
Why Division? Why Division? Division is central in many operations: Division is central in many operations: factoring and decomposition factoring and decomposition resubstitution resubstitution extractionextraction
Division: Division: OutlineOutline
ENEE 644 4
ProductProduct
The The productproduct of two algebraic expressions F = X of two algebraic expressions F = X11+X+X22++…+X…+Xmm and G = Y and G = Y11+Y+Y22+…+Y+…+Ynn is the SOP expression is the SOP expression obtained by simplifying the result of (Xobtained by simplifying the result of (X11+X+X22+…+X+…+Xmm))(Y(Y11+Y+Y22+…+Y+…+Ynn) using xx’=0 and xx=x.) using xx’=0 and xx=x. Example: (a+b)(a+c) = a + ab + ac + bcExample: (a+b)(a+c) = a + ab + ac + bc
The product FG is The product FG is algebraicalgebraic if F and G are if F and G are orthogonal, otherwise, it is called a orthogonal, otherwise, it is called a Boolean productBoolean product.. Example: (a+b)(c+d) = ac + ad + bc + bdExample: (a+b)(c+d) = ac + ad + bc + bd (algebraic)(algebraic)
(a+b)(a+c) = aa+ab+ac+bc(a+b)(a+c) = aa+ab+ac+bc (Boolean)(Boolean)
ENEE 644 5
Algebraic and Boolean ExpressionsAlgebraic and Boolean Expressions
ff is an is an algebraic expressionalgebraic expression if if f f is a set of cubes is a set of cubes (SOP), such that no single cube contains another (SOP), such that no single cube contains another (minimal with respect to single cube (minimal with respect to single cube containment). Otherwise, containment). Otherwise, ff is called a is called a Boolean Boolean expressionexpression.. Example: a+bc is algebraic, a+ab is Boolean.Example: a+bc is algebraic, a+ab is Boolean.
The The supportsupport of an expression of an expression f, supp(f),f, supp(f), is the set is the set of variables that of variables that ff explicitly depends on. Two explicitly depends on. Two expressions f and g are said to be expressions f and g are said to be orthogonal orthogonal if if supp(f)supp(f)supp(g)=supp(g)=, denoted by , denoted by ffg.g. Example: a+b Example: a+b c+d c+d
Recall:Recall:
ENEE 644 6
DivisionDivision
DivisionDivision is an operation that takes two SOP is an operation that takes two SOP expressions F and P, and generates SOP expressions F and P, and generates SOP expressions Q and R, s.t. F = PQ +R.expressions Q and R, s.t. F = PQ +R. The division is The division is algebraicalgebraic is PQ is an algebraic product; is PQ is an algebraic product;
otherwise it is a otherwise it is a Boolean divisionBoolean division.. Q is called the Q is called the quotientquotient, R is called the , R is called the remainderremainder.. If R=0, P is a If R=0, P is a factorfactor, otherwise it is called a , otherwise it is called a divisordivisor..
Example:Example: F = ad + ae + bcd + jF = ad + ae + bcd + j For P = a, Q = d+e, R = bcd+jFor P = a, Q = d+e, R = bcd+j For P = a+bc, Q=d, R=ae+jFor P = a+bc, Q=d, R=ae+j Both a and a+bc are divisors, not factors.Both a and a+bc are divisors, not factors.
ENEE 644 7
Weak DivisionWeak Division
For division F = PQ+R, it is For division F = PQ+R, it is weakweak if if PQ is an algebraic product;PQ is an algebraic product; R has as few cubes as possible;R has as few cubes as possible; PQ+R and F are the same expression (same cubes).PQ+R and F are the same expression (same cubes).
{Q,R} is unique given F and P{Q,R} is unique given F and P, denote Q=F/P., denote Q=F/P. Example:Example:
For F=For F=adad+abc++abc+bcdbcd, P=a+bc: Q=d, R=abc, P=a+bc: Q=d, R=abc For F=For F=ac+adac+ad++bc+bdbc+bd+e, P=a+b: Q=c+d,R=e+e, P=a+b: Q=c+d,R=e For F=ad+aef+ab+b’cd+b’cef, P=a+b’cFor F=ad+aef+ab+b’cd+b’cef, P=a+b’c
• If P=a: Q=d+ef+bIf P=a: Q=d+ef+b• If P=b’c, Q=d+efIf P=b’c, Q=d+ef
Q=d+ef,R=abQ=d+ef,R=ab
ENEE 644 8
Kernel and Co-Kernel: Kernel and Co-Kernel: MotivationMotivation
We know how to divide a given expression F by We know how to divide a given expression F by another expression G. (division)another expression G. (division)
How to find G?How to find G? Too many Boolean divisors: a+bc’Too many Boolean divisors: a+bc’ Restrict to algebraic divisors, e.g. cubesRestrict to algebraic divisors, e.g. cubes
Problem: Problem:
Given a set of functions, find common weak Given a set of functions, find common weak (algebraic) divisors.(algebraic) divisors.
ENEE 644 9
Kernels: Kernels: DefinitionsDefinitions
An expression is An expression is cube-freecube-free if no cube divides the if no cube divides the expression evenly (i.e. no remainder, or there is no expression evenly (i.e. no remainder, or there is no literal that is common to all the cubes).literal that is common to all the cubes). Example: ab+c is cube-freeExample: ab+c is cube-free
ab+ac is not (a is a common factor)ab+ac is not (a is a common factor)
abc is not (must have two or more abc is not (must have two or more cubes)cubes)
The The primary divisorsprimary divisors of an expression F are the set of an expression F are the set of expressions of expressions D(F) = {F/c | c is a cube}.D(F) = {F/c | c is a cube}. Example: F = (a+b+c)(d+e)f + bfg + hExample: F = (a+b+c)(d+e)f + bfg + h
df+ef (=F/a) is a primary divisordf+ef (=F/a) is a primary divisor
d+e+g (=F/bf) is a primary divisord+e+g (=F/bf) is a primary divisor
ENEE 644 10
Kernels: Kernels: Definitions (cont’d)Definitions (cont’d)
The The kernelskernels of an expression F are of an expression F are
K(F) = {G | G K(F) = {G | G D(F) and G is cube-free}. D(F) and G is cube-free}. Example:Example: F = (a+b+c)(d+e)f + bfg + h F = (a+b+c)(d+e)f + bfg + h
df+ef (=F/a) df+ef (=F/a) D(F), but not a kernel. D(F), but not a kernel.
d+e+g (=F/bf) d+e+g (=F/bf) D(F) and is cube-free. D(F) and is cube-free.
A cube c used to obtain the kernel K=F/c is A cube c used to obtain the kernel K=F/c is called a called a co-kernelco-kernel of K. of K. C(F) = {c | F/c C(F) = {c | F/c K(F)}. K(F)}.
A kernel is of A kernel is of level 0level 0 if it has no kernels except if it has no kernels except itself. A kernel of itself. A kernel of level nlevel n has at least one kernel has at least one kernel of level n-1, but no kernel (except itself) of level n of level n-1, but no kernel (except itself) of level n or greater. or greater.
ENEE 644 11
Kernels: Kernels: ExampleExample
F = adf + aef + bdf + bef + cdf + cef + bfg + hF = adf + aef + bdf + bef + cdf + cef + bfg + h
= (a+b+c)(d+e)f + bfg + h= (a+b+c)(d+e)f + bfg + hcubecube Prim. Div.Prim. Div. KernelKernel Co-kernelCo-kernel levellevel
aa df+efdf+ef NONO NONO ----
bb df+ef+fgdf+ef+fg NONO NONO ----
bfbf d+e+gd+e+g YESYES YESYES 00
cfcf d+ed+e YESYES YESYES 00
dfdf a+b+ca+b+c YESYES YESYES 00
fgfg bb NONO NONO ----
ff (a+b+c)(d+e)+bg(a+b+c)(d+e)+bg YESYES YESYES 11
11 FF YESYES YESYES 22
ENEE 644 12
Kernel Computation: Kernel Computation: Cube IntersectionCube Intersection
Given F = XGiven F = X11+X+X22+…+X+…+Xnn, compute K(F) and C(F), compute K(F) and C(F) C*(F) = {c | c= XC*(F) = {c | c= XiiXXjj for some i and j} for some i and j}
(This contains all the level-0 co-kernels.)(This contains all the level-0 co-kernels.) weak_div(F,c) = F/c is a kernel with c as the weak_div(F,c) = F/c is a kernel with c as the
corresponding co-kernel.corresponding co-kernel.Example: F = abcd + abce + efgExample: F = abcd + abce + efg
C*(F) = {abc, e}C*(F) = {abc, e} F/abc = d+e,F/abc = d+e, F/e = abc+fgF/e = abc+fg
Problem: gives only level-0 co-kernels, to get for Problem: gives only level-0 co-kernels, to get for example level-1 co-kernels, example level-1 co-kernels,
ENEE 644 13
Kernel Computation: Kernel Computation: ExampleExample
Find all the level-0 co-kernels forFind all the level-0 co-kernels for
abc+abd’+bcd’+ade+cde+a’ceabc+abd’+bcd’+ade+cde+a’ce
--ceceeecc--cca’cea’ce
--dedecc--cccdecde
----aaaaadeade
--bd’bd’bcbcbcd’bcd’
--abababd’abd’
--abcabc
a’cea’cecdecdeadeadebcd’bcd’abd’abd’abcabc
00a’+da’+dcece
11ad+cd+a’cad+cd+a’cee
00a+ca+cdede
00a+ca+cbd’bd’
11ab+bd’+deab+bd’+de+a’e+a’e
cc
11bc+bd’+debc+bd’+deaa
00a+d’a+d’bcbc
00c+d’c+d’abab
levlevelel
primary primary divisordivisor
cubecube
How about level-1 kernels?How about level-1 kernels?
Repeat Above RecursivelyRepeat Above Recursively
ENEE 644 14
Fundamental TheoremFundamental Theorem
Theorem: If two expressions F and G have the property Theorem: If two expressions F and G have the property that that kkFFK(F), kK(F), kGGK(G) K(G) | k | kGG k kF F ||1 (k1 (kG G and kand kFF have at have at
most one term in common), most one term in common),
then F and G have no common nontrivial algebraic then F and G have no common nontrivial algebraic divisors (i.e. with at least two terms) else it does.divisors (i.e. with at least two terms) else it does.
Importance: If we “kernel” all functions and there are no Importance: If we “kernel” all functions and there are no nontrivial intersections, then the only common algebraic nontrivial intersections, then the only common algebraic divisors left are single cube divisors. This is used for divisors left are single cube divisors. This is used for quickly finding common subfunctions. quickly finding common subfunctions.
ENEE 644 15
Factoring and Factoring AlgorithmFactoring and Factoring Algorithm
Factoring is the process of deriving a factored Factoring is the process of deriving a factored form for a given logic function in SOP form. form for a given logic function in SOP form.
A factoring algorithm is algebraic if it guarantees A factoring algorithm is algebraic if it guarantees an an algebraic factored formalgebraic factored form from an from an algebraic algebraic SOP expressionSOP expression; otherwise it is Boolean.; otherwise it is Boolean.
F = ab+ac+bc F = a(b+c)+bcfactoringfactoring
SOP formSOP form factored formfactored form
goal: minimize goal: minimize the number of the number of
literalsliterals
ENEE 644 16
Generic Factoring AlgorithmGeneric Factoring Algorithm
Factor(F) Factor(F)
{ if (F has no factor) { if (F has no factor)
return F;return F;
D = D = DivisorDivisor(F);(F);
(Q,R) = (Q,R) = DivideDivide(F,D);(F,D);
return return
Factor(Q)Factor(D) Factor(Q)Factor(D)
+ Factor(R);+ Factor(R);
}}
Example:Example:
F = abc+abd+ae+af+gF = abc+abd+ae+af+g
D = c+dD = c+d
F = DQ+RF = DQ+R
Q = abQ = ab
R = ae+af+gR = ae+af+g
= a(e+f) + g= a(e+f) + g
((Factor(R)Factor(R)))
O = ab(O = ab(c+dc+d) + ) + a(e+f)+ga(e+f)+g
ENEE 644 17
Maximal FactorizationsMaximal Factorizations
A factored form is A factored form is maximally factoredmaximally factored if if For every sum of products, there are no two For every sum of products, there are no two
syntactically equivalent factors in the products;syntactically equivalent factors in the products; For every product of sums, there are no two For every product of sums, there are no two
syntactically equivalent factors in the sums. syntactically equivalent factors in the sums.
Example:Example: ab+ac is not maximally factored,ab+ac is not maximally factored,
a(b+c) is.a(b+c) is. (a+b)(a+c) is not maximally factored,(a+b)(a+c) is not maximally factored,
a+bc is.a+bc is.
bb
++
··ccaaaa
··
Recall:Recall:
ENEE 644 18
Problem with Algorithm FactorProblem with Algorithm Factor
O = O = aabb(c+d) + (c+d) + aa(e+f)+g(e+f)+g is not optimal since it is is not optimal since it is not maximally factored. not maximally factored. a(b(c+d)+e+f)+ga(b(c+d)+e+f)+g
The problem occurs whenThe problem occurs when Quotient Q is a single cube, andQuotient Q is a single cube, and Some of the literals of Q appear in the remainder RSome of the literals of Q appear in the remainder R
Solution to the problem:Solution to the problem: If the quotient Q is not a single cube, done; elseIf the quotient Q is not a single cube, done; else Pick a literal l in Q that occurs most frequently in the cubes of F;Pick a literal l in Q that occurs most frequently in the cubes of F; Divide F by l to obtain a new divisor DDivide F by l to obtain a new divisor D11;;
F = l DF = l D11 + R + R11, where literal l does not appear in R, where literal l does not appear in R11..
Lemma: partial factored form Lemma: partial factored form l Dl D11 + R + R11 is maximally factored if Q is a is maximally factored if Q is a single cubesingle cube
ENEE 644 19
Another ExampleAnother Example
FF ==ace+adeace+ade++bce+bdebce+bde+cf+df+cf+df
DD =a+b=a+b
QQ =ce+de=ce+de
RR =cf+df=cf+df
PP =QD+R=QD+R
=(ce+de)(a+b)+(cf+df)=(ce+de)(a+b)+(cf+df)
OO =e(c+d)(a+b)+(c+d)f=e(c+d)(a+b)+(c+d)f
Problem: Problem:
O=e(c+d)(a+b)+(c+d)fO=e(c+d)(a+b)+(c+d)f
is not maximally factored is not maximally factored because it can be further because it can be further factored to (c+d)(e(a+b)+f).factored to (c+d)(e(a+b)+f).
The problem occurs when The problem occurs when Q and R have a common Q and R have a common factor. (c+d in this case).factor. (c+d in this case).
ENEE 644 20
Solution to the ProblemSolution to the Problem
Make Q cube-free to obtain QMake Q cube-free to obtain Q11;;
Divide F by QDivide F by Q11 to obtain a new divisor D to obtain a new divisor D11;;
If DIf D11 is cube-free, we get a partial factored form is cube-free, we get a partial factored form
F=QF=Q11DD11+R+R11 and recursively factor Q and recursively factor Q11,D,D11, and R, and R11;;
If DIf D11 is not cube-free, let D is not cube-free, let D11=cD=cD22 and D and D33=Q=Q11DD22, we , we
have the partial factoring F=cDhave the partial factoring F=cD33+R+R11 and can and can
recursivelyrecursively factor Dfactor D33 and R and R11..
Lemma: if Q is not a single cube, F is maximally Lemma: if Q is not a single cube, F is maximally factored at this level.factored at this level.
ENEE 644 21
Application: Application: DecompositionDecomposition
Given an expression F and one of its divisors D, Given an expression F and one of its divisors D, the the decompositiondecomposition associates a new variable, G, associates a new variable, G, with the divisor and reduce F to QG+R, where with the divisor and reduce F to QG+R, where Q=F/G and R is the remainder in the division. Q=F/G and R is the remainder in the division.
Decomposition vs. factorizationDecomposition vs. factorization Divisor is added as a new variable.Divisor is added as a new variable. The new variable may fan out elsewhere in both The new variable may fan out elsewhere in both
regular or complement forms.regular or complement forms.
Why decomposition: Why decomposition: reduce the size of the expression reduce the size of the expression (e.g. to typical library cells).(e.g. to typical library cells).
ENEE 644 22
Example: Example: DecompositionDecomposition
F=ace+bce+de+gF = Ge+g
G=ac+bc+ddecompositiondecomposition
SOP formSOP form factored formfactored form
goal: minimize goal: minimize the size of the the size of the
expressionexpression
F = ab+ac+bc F = a(b+c)+bcfactoringfactoring
SOP formSOP form factored formfactored form
goal: minimize goal: minimize the number of the number of
literalsliterals
ENEE 644 23
Application: Application: Algebraic ResubstitutionAlgebraic Resubstitution
Goal: Goal: reduce number of literalsreduce number of literals
Idea: Idea: (Reuse)(Reuse) For multi-output For multi-output function, one output (or its complement) function, one output (or its complement) may be a useful divisor in another output.may be a useful divisor in another output.
Procedure: Procedure: substitution of Fsubstitution of Fjj into F into Fii
Divide FDivide Fii by F by Fjj: : FFii = QF = QFjj + R + R
Divide R by F’Divide R by F’jj: : R = QR = QCCF’F’jj+R+RCC
Result: Result: FFii = QF = QFjj + Q + QCCF’F’jj+R+RCC
ffiiffjj
ffjj
In practiceIn practice: this is tried for each output pair, therefore requires : this is tried for each output pair, therefore requires O(nO(n22) divisions when there are n outputs.) divisions when there are n outputs.
Filters:Filters: criteria that reduce the number of divisions. For example, criteria that reduce the number of divisions. For example, don’t try Fdon’t try Fii/F/Fjj if 1) F if 1) Fjj contains a literal not in F contains a literal not in F ii, or 2) F, or 2) Fjj has more has more
terms than Fterms than Fii, or 3) there is a literal occurs more often in F, or 3) there is a literal occurs more often in F jj than in F than in Fii..
ENEE 644 24
Example: Example: Algebraic ResubstitutionAlgebraic Resubstitution
F/G:F/G: F/ab’ = d+fgF/ab’ = d+fg F/c = d+fgF/c = d+fg
F = (d+fg)G + (a’c’e+bc’e+aef) = QG + RF = (d+fg)G + (a’c’e+bc’e+aef) = QG + R R/G’:R/G’:
G’ = (ab’+c)’ = (a’+b)c’ = a’c’ + bc’G’ = (ab’+c)’ = (a’+b)c’ = a’c’ + bc’ R/a’c’ = eR/a’c’ = e R/bc’ = eR/bc’ = e
R = eG’ + aefR = eG’ + aef
F = (d+fg)G + eG’ + aefF = (d+fg)G + eG’ + aef
9 literals9 literals
21 literals21 literals
saving of saving of 12 literals12 literals
(#23 on Page 448) Resubstitution of (#23 on Page 448) Resubstitution of G=ab’+cG=ab’+c into into F=ab’d+cd+ab’fg+cfg+a’c’e+bc’e+aefF=ab’d+cd+ab’fg+cfg+a’c’e+bc’e+aef
ENEE 644 25
Idea: replace a literal (and its complement) in an Idea: replace a literal (and its complement) in an expression by its algebraic SOP form.expression by its algebraic SOP form.
Goal: prepare for a different factorization or Goal: prepare for a different factorization or decomposition.decomposition.
Elimination value:Elimination value: FFii = Q = QiiG + QG + QiCiCG’ + RG’ + Rii
Let nLet nii be the number of times that G or G’ appears in be the number of times that G or G’ appears in
the factored form Fthe factored form Fii, L, LGG be the number of literals in the be the number of literals in the
factored form for G, then approximately, (nfactored form for G, then approximately, (n iiLLGG-n-nii))--
literals will be added after the elimination. This value is literals will be added after the elimination. This value is defined as the defined as the elimination value of Gelimination value of G..
In practice, don’t eliminate node with large In practice, don’t eliminate node with large e_valuee_value..
Application: Application: Node EliminationNode Elimination
ENEE 644 26
Example: Example: Node EliminationNode Elimination
F = e(af+c’G) + (d+fg)(c+G’)F = e(af+c’G) + (d+fg)(c+G’) G = a’+bG = a’+b
e_valuee_valueGG = = (n(niiLLGG-n-nii)) = 2x2-2 = 2= 2x2-2 = 2
elimination elimination of G (and G’)of G (and G’)
ENEE 644 27
Application: Application: ExtractionExtraction
Idea: Idea: identifies common sub-expressions and identifies common sub-expressions and
manipulates the Boolean network.manipulates the Boolean network. We can combine decomposition, substitution, We can combine decomposition, substitution,
and node elimination to provide an effective and node elimination to provide an effective extraction algorithm:extraction algorithm:Quick_ExtractionQuick_Extraction For each node in the network, apply decomposition;For each node in the network, apply decomposition; For all profitable pairs, apply algebraic substitution;For all profitable pairs, apply algebraic substitution; Eliminate all single literal functions;Eliminate all single literal functions; Eliminate all functions with small e_value;Eliminate all functions with small e_value;
ENEE 644 28
Example: Example: ExtractionExtraction
Decomposition:Decomposition:
OO11 = aY= aY11 + g + g
YY11 = bX= bX11 + e + + e +
ff
XX11 = c + d= c + d
OO22 = X= X22ZZ22
ZZ22 = eY= eY22 + f + f
YY22 = a + b= a + b
XX22 = c + d = c + d
(18 literals)(18 literals)
FF11 = abc+abd+ae+af+g= abc+abd+ae+af+gFF22= ace+ade+bce+bde+cf+df= ace+ade+bce+bde+cf+df
(11+16 = 27 literals)(11+16 = 27 literals)
Resubstitution:Resubstitution:
(X(X11 = X = X22))
OO11 = aY= aY11 + g + g
YY11 = bX= bX11 + e + e
+ f+ f
XX11 = c + d= c + d
OO22 = X= X11ZZ22
ZZ22 = eY= eY22 + f + f
YY22 = a + b= a + b
(16 literals)(16 literals)
Node Elimination:Node Elimination:
(e_value(e_valueY2Y2=-1)=-1)
OO11 = aY= aY11 + g + g
YY11 = bX= bX11 + e + e
+ f+ f
XX11 = c + d= c + d
OO22 = X= X11ZZ22
ZZ22 = e(a+b) + = e(a+b) +
ff
(15 literals)(15 literals)