Sei sulla pagina 1di 10

Outline

ALGEBRAIC METHODS

c GDM

 Algebraic model.

Giovanni De Micheli

 Division and substitution.

Stanford University

 Kernel theory.
{ Kernel and cube extraction.

 Decomposition.

Algebraic model

c GDM

 Boolean algebra:

Algebraic division

c GDM

{ Complement.

 Given two algebraic expressions:

{ Symmetric distribution laws.

fquotient

=f

dividend =fdivisor

sets.

fdividend

 Algebraic methods:

fdivisor

Don't care

{ Boolean functions !polynomials.


{ Expressions (sum of product forms).

=f

divisor

fquotient

when:

fquotient

+f

remainder

6= 0

{ and the support of f


is disjoint.

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

Q and remainder R are sum of


cubes (monomials).

{ Let f = a + bc and f = a + b.
i

 =f

{ Then (a + b)  (a + c) = f
but fa; bg \ fa; cg 6= ;.

fdividend

An algorithm for division


c GDM

(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

ac; ad; bc; bd; e

 = 1:
i

gand = f g.
B

a; b

= a, D = fac; adg and D1 = fc; dg.

{ Then Q = fc; dg.

 =2= :
i

= b, D = fbc; bdg and D2 = fc; dg.

{ Then Q = fc; dg \ fc; dg = fc; dg.

 Result:
{

= fc; dg and R = feg.


= c + d and f

fquotient

remainder

= e.

Substitution
Theorem

 Given and , then


fi

{
{

fj

fj

fi =fj

c GDM

 Consider expression pairs.

is empty when:

 Apply division (in any order).

contains a variable not in f .


i

 If quotient is not void:

contains a cube whose support is not


contained in that of any cube of f .
fj

{ Evaluate area/delay gain

fj

c GDM

contains more terms than f .


i

dividend

{ The count of any variable in f than in f .


j

{ Substitute f
where j = f

divisor

by j f

quotient

+f

remainder

 Use lters to reduce divisions.

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

 Search for common sub-expressions:


{ Single-cube extraction: monomial.
{ Multiple-cube (kernel) extraction.

 Search for appropriate divisors.

De nitions

Cube-free

c GDM

expression:

{ Cannot be factored by a cube.

Kernel

of an expression:

{ Cube-free quotient of the expression


divided by a cube, called co-kernel.

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

by d. Get e. Not cube free.

Divide fx by e. Get ac + bc + d. Cube free.

Divide

Expression fx is a kernel of itself because cube free.

K fx

fx

. Get a + b. Cube free.

fy
fz

 Consequence:
{ If kernel intersection is void, then the
search for common sub-expression
can be dropped.

=
=
=

K fx

K fy

The kernel set of

Kernel!

c GDM

+ bce + de + g
+ bd + cde + ge

ace
ad

abc

( ) = f(a + b); (ac + bc + d); (ace + bce + de + g)g.

Kernel!

by g. Get 1. Not cube free.

fx

multiple-cube divisor f if and only if:


b

+ be. Not cube free.

Example

fb

. Not cube free.

( ) = f(a + b); (ac + bc + d); (ace + bce + de + g)g.

 Two expressions and have a common


{ there exist kernels k 2 K (f )
and k 2 K (f ) s.t. f is the sum
of 2 (or more) cubes in k \ k .

. Not cube free.

ce

Theorem
(Brayton and McMullen)
c GDM
fa

c GDM

( ) = f(a + b + ce); (cd + g); (ad + bd + cde + ge)g.


fz

is empty.

Select intersection (a + b)
fw
= a+b
fx
= wce + de + g
fy
= wd + cde + ge
fz
= abc

Recursive kernel computation


simple algorithm
c GDM

Kernel set computation


c GDM

( )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

{ Divide function by elements in power


set of its support set.

{ Weed out non cube-free quotients.

 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

Recursive kernel computation


c GDM

( )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.

 Divide by and then by .


b

= K [ f;
return(K );

c GDM

 Some computation may be redundant:

{ Obtain duplicate kernels.

 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.

Literal c. Select cube ce:


{ Recursive call with arguments: (ace + bce)=ce =
a + b; pointer j = 3 + 1.
{ Call considers variables fd; e; gg. No kernel.
{ Adds a + b to the kernel set at the last step.
Literal d. No action required.
Literal e. Select cube e:
{ Recursive call with arguments: ac + bc + d and
pointer j = 5 + 1.
{ Call considers variable fgg. No kernel.
{ Adds ac + bc + d to the kernel set at the last
step.

Literal g. No action required.

Adds

ace

= f(ace + bce + de + g); (ac + bc + d); (a + b)g.

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.

 Co-rectangle: (f1 2g f1 2 4 6g).


;

{ Kernel a + b.

{ Rows: cubes. Columns: variables.

 Rectangle (

R; C

):

{ Subset of rows and columns


with all entries equal to 1.

 Prime rectangle:
{ Rectangle not inside any other rectangle.

 Co-rectangle (

R; C

) of a rectangle (R; C ):

are the columns not in C .

 A co-kernel corresponds to a

prime rectangle with at least two rows.

c GDM

Single-cube extraction

6
0
0
0
1

 Rectangle (prime): (f1 2g f3 5g)


;

 Boolean matrix:

+ bce + de + g to the kernel set.

fx

Matrix representation of kernels


c GDM

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


 Form auxiliary function:


{ Sum of all local functions.

 Form matrix representation:


{ A rectangle with two rows represents a

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.

{ Best choice is a prime rectangle.

 Use function ID for cubes:


{ Cube intersection from di erent
functions.

( 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

Prime rectangle: (f1; 2; 5g; f3; 5g)

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

Cube extraction algorithm


c GDM
C U BE EX T RAC T

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

 We need a kernel/cube matrix.

fp

 Relabeling:

{ Cubes by new variables.

fq

{ Kernels by cubes.

{ Sum of all kernels.

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

= a; xb = b; xae = ae; xbe = be; xd = d;

 ( ) = ff
K fp

 Extend cube intersection algorithm.

faux

= ace + bce.

 Relabeling:

 Form auxiliary function:

 ( ) = 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

corresponds to kernel intersection


+ b.

{ Extract a + b from f and f .


p

xa ; xb

gg

Kernel extraction algorithm


c GDM

xa xb
a

xa ; xb

c GDM

K ERN EL EX T RAC T

 Co-kernel:

c GDM

Decomposition

Decomposition

c GDM

c GDM

 Di erent 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;

 Recur on the quotient :

ft

{ Select kernel a + b:
{ Decompose:

ft

= sc + d;

fs

= a + b;

Summary
Algebraic transformations
c GDM

 View Boolean functions as algebraic


expression.

 Fast manipulation algorithms.


 Some optimality lost,

because Boolean properties are neglected.

 Useful to reduce large networks.

Potrebbero piacerti anche