Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
ALGEBRAIC METHODS
c GDM
Algebraic model.
Giovanni De Micheli
Stanford University
Kernel theory.
{ Kernel and cube extraction.
Decomposition.
Algebraic model
c GDM
Boolean algebra:
Algebraic division
c GDM
{ Complement.
fquotient
=f
dividend =fdivisor
sets.
fdividend
Algebraic methods:
fdivisor
Don't care
=f
divisor
fquotient
when:
fquotient
+f
remainder
6= 0
divisor
and f
quotient
Example
c GDM
An algorithm for division
c GDM
Algebraic division:
{ Let f
and f
= ac + ad + bc + bd + e
=a+b
dividend
divisor
{ Then f
quotient
=c+d
fremainder
=e
{ Because (a + b) (c + d) + e = f
and fa; bg \ fc; dg = ;.
dividend
Non-algebraic division:
j = 1; 2; : : : ; lg set of cubes
(monomials) of the dividend.
A
A
;
j
=f
= 1; 2; : : : ; ng set of cubes
(monomials) of the divisor.
B
B
;
i
Quotient
{ Let f = a + bc and f = a + b.
i
=f
{ Then (a + b) (a + c) = f
but fa; bg \ fa; cg 6= ;.
fdividend
(A; B ) f
A
j
A
j
= A Q B;
return(Q; R);
R
B
i
B
i
divisor
=f
A
for (i = 1 to n) f
D = fC
such that C C g;
if ( D == ; ) return(;; A);
D = D with var. in sup(C ) dropped ;
if i = 1
Q = D ;
else
Q = Q\D ;
ALGEBRAI C DI V I SI ON
Example
= ac + ad + bc + bd + e;
f
= a + b;
c GDM
= 1:
i
gand = f g.
B
a; b
=2= :
i
Result:
{
fquotient
remainder
= e.
Substitution
Theorem
{
{
fj
fj
fi =fj
c GDM
is empty when:
fj
c GDM
dividend
{ Substitute f
where j = f
divisor
by j f
quotient
+f
remainder
Substitution algorithm
c GDM
( Gn(V; E ) )f
(i = 1; 2; : : : ; jV j) f
for (j = 1; 2; : : : ; jV j; j 6= i) f
A = set of cubes of fi ;
B = set of cubes of fj ;
if (A; B pass the lter test ) f
(Q; R) = ALGEBRAI C DI V I SI ON (A; B )
if (Q 6= ;) f
fquotient = sum of cubes of Q;
fremainder = sum of cubes of R;
if ( substitution is favorable)
fi = j fquotient + fremainder ;
Extraction
c GDM
SU BST I T U T E
for
Denitions
Cube-free
c GDM
expression:
Kernel
of an expression:
Kernel set
( ) of an expression:
K f
{ Set of kernels.
fx
Example
= ace + bce + de + g
Divide
fx
by a. Get
ce
Divide
fx
by b. Get
ce
Divide
fx
by c. Get
ae
Divide
fx
by
Divide
fx
Divide
K fx
fx
fy
fz
Consequence:
{ If kernel intersection is void, then the
search for common sub-expression
can be dropped.
=
=
=
K fx
K fy
Kernel!
c GDM
+ bce + de + g
+ bd + cde + ge
ace
ad
abc
Kernel!
fx
Example
fb
ce
Theorem
(Brayton and McMullen)
c GDM
fa
c GDM
is empty.
Select intersection (a + b)
fw
= a+b
fx
= wce + de + g
fy
= wd + cde + ge
fz
= abc
( )f
R K ERN ELS f
Naive method:
= ;;
foreach variable x 2 sup(f ) f
if(jC U BES (f; x)j 2) f
f
= largest cube containing x,
s.t. C U BES (f; C ) = C U BES (f; x);
K = K [ R K ERN ELS (f =f );
K
Smart way:
{ Use recursion:
Kernels of kernels are kernels.
{ Exploit commutativity of multiplication.
( )f
return the cubes of f whose support C ;
C U BES f; C
( )f
= ;;
for i = j to n f
if(jC U BES (f; x )j 2) f
f
= largest cube containing x,
s.t. C U BES (f; C ) = C U BES (f; x );
if (x 2n C 8k < i)
K = K [ K ERN ELS (f =f ; i + 1);
K ERN ELS f; j
K
{ Example:
Divide by a and then by b.
= K [ f;
return(K );
c GDM
Improvement:
{ Keep a pointer to literals used so far.
Analysis
= K [ f;
return(K );
K
Literals
Example
= ace + bce + de + g
c GDM
or b. No action required.
Adds
ace
cube
ace
bce
de
g
Example
= ace + bce + de + g
var
R C
1
2
3
4
1
1
0
0
0
2
0
1
0
0
3
1
1
0
0
4
0
0
1
0
5
1
1
1
0
{ Co-kernel ce.
{ Kernel a + b.
Rectangle (
R; C
):
Prime rectangle:
{ Rectangle not inside any other rectangle.
Co-rectangle (
R; C
) of a rectangle (R; C ):
A co-kernel corresponds to a
c GDM
Single-cube extraction
6
0
0
0
1
Boolean matrix:
fx
c GDM
x = t (a+b) +de +g
x = ace + bce + de + g
t = ce
s = cde + b
s = td + b
Single-cube extraction
Example
c GDM
Expressions:
{ fx = ace + bce + de + g
{ fs = cde + b
Auxiliary function:
{ faux = ace + bce + de + g + cde + b
Matrix:
cube ID
ace
x
bce
x
de
x
g
x
cde
s
b
s
common cube.
( G (V ; E ) )f
while (some favorable common cube exist) f
C = select common cube to extract;
Generate new label l;
Add to network v and f = f ;
Replace all functions f , where f is a divisor,
by l f
+f
;
l
RnC
1
2
3
4
5
6
1
1
0
0
0
0
0
2
0
1
0
0
0
1
3
1
1
0
0
1
0
Extract cube
4
0
0
1
0
1
0
5
1
1
1
0
1
0
6
0
0
0
1
0
0
ce
Multiple-cube extraction
c GDM
x = ace+bce+de+g
x = wce+de+g
quotient
var
c GDM
remainder
y = ad+bd+cde+ge
z = abc
w = a+ b
y = wd+cde+ge
z = abc
Example
Multiple-cube extraction
c GDM
fp
Relabeling:
fq
{ Kernels by cubes.
Example (2)
=x
a xb
+x
a xb
+x
ae xbe xd
( ) = f(a + b)g.
K fp
= ae + be + d.
( ) = f(a + b); (ae + be + d)g.
K fq
xa
( ) = ff
K fp
faux
= ace + bce.
Relabeling:
( ) = ff
K fq
xa xb
g; f
xae ; xbe ; xd
gg.
( Gn(V; E ) , n; k)f
(some favorable common kernel intersection exist)
Compute kernel set of level k;
for (i = 1 to n) f
Compute kernel intersections;
f = select kernel intersection to extract;
Generate new label l;
Add vl to the network with expression fl = f ;
Replace all functions f where fl is a divisor
by l fquotient + fremainder ;
while
xa ; xb
gg
xa xb
a
xa ; xb
c GDM
K ERN EL EX T RAC T
Co-kernel:
c GDM
Decomposition
Decomposition
c GDM
c GDM
Dierent ways:
{ Method of Ashenhurst and Curtis.
x = te + g
s = a+b
x = ace + bce + de + g
t = ac+bc+d
x = te + g
t = sc+d
{ NAND/NOR decomposition.
Kernel-based decomposition:
{ Divide expression recursively.
fx
Example
= ace + bce + de + g
Select kernel
Decompose:
ac
fx
+ bc + d.
= te + g;
Decomposition algorithm
c GDM
c GDM
( G (V ; E ) , k)f
repeat f
v
= selected vertex with expression
whose size is above k;
if (v = ;) return;
decompose expression f ;
DEC OM P OSE
ft
= ac + bc + d;
ft
{ Select kernel a + b:
{ Decompose:
ft
= sc + d;
fs
= a + b;
Summary
Algebraic transformations
c GDM