DATA STRUCTURES FOR LOGIC OPTIMIZATION

advertisement
DATA STRUCTURES
FOR LOGIC OPTIMIZATION
Outline
c Giovanni De Micheli
Stanford University
Background
f (x1; x2; : : : ; 1; : : : ; xn).
Cofactor of f with respect to variable xi:
0
i
Operations on logic covers.
Boole's expansion theorem:
Function:f = ab + bc + ac
Cofactors:
Expansion:
{ f = afa + a fa = a(b + c) + a bc
0
xi fx + xi fx
i
0
c GDM
0
f (x1; x2; : : : ; 0; : : : ; xn).
{ f (x1; x2; : : : ; xi; : : : ; xn) =
Matrix representations of covers.
{ fa = b + c
{ fa = bc
0
{ fx
Representations of logic functions.
Example
Cofactor of f with respect to variable xi:
i
Review of Boolean algebra.
c GDM
Function f (x1; x2; : : : ; xi; : : : ; xn).
{ fx
c GDM
0
i
0
0
Background
Background
c GDM
c GDM
Function f (x1; x2; : : : ; xi; : : : ; xn).
Function f (x1; x2; : : : ; xi; : : : ; xn).
Positive unate in xi when:
Boolean dierence of f w.r.t. variable xi:
{ fx
i
{ @f=@xi
fx
0
i
fx
0
C
xi
0
i
fx fx .
0
i
i
Smoothing of f w. r. to variable xi:
{
c GDM
S
xi
fx + fx .
0
i
i
c GDM
Given:
{ A Boolean function f .
{ Orthonormal set of functions:
i; i = 1; 2; : : : ; k.
b
a
(a)
(b)
Then:
{ f = Pki i f
{ Where f is a generalized cofactor.
(c)
fx .
Generalized expansion
f = ab + bc + ac
i
Example
i
Consensus of f w. r. to variable xi:
{
fx
A function is positive/negative unate when
positive/negative unate in all its variables.
c
i
Negative unate in xi when:
{ fx
i
(d)
The Boolean dierence @f=@a = fa fa = b c + bc .
The consensus
The smoothing
C
a
= fa fa = bc.
a
S
0
= fa + fa = b + c.
0
i
0
0
0
The generalized cofactor is not unique,
but satises:
{f
i f
i
f + i
0
Example
c GDM
c GDM
Function f = ab + bc + ac.
0
i; i = 1; 2; : : : ; k.
Bounds:
0
{ Boolean operator .
0
ab + bc + ac.
Cofactors: f1 = 1 and f2 = a bc + ab c.
f = 1f1 + 2f2
= ab1 + (a + b )(a bc + ab c)
= ab + bc + ac
0
0
0
0
0
0
g = Pki i (f
i
g = xi (fx
i
g )
i
gx ) + xi (fx
i
0
0
i
gx )
The positional cube notation
0
i
c GDM
Encoding scheme:
00
0 10
1 01
11
Dierent formats.
;
Usually one row per implicant.
Symbols: 0,1,*. (and other)
Corollary:
{f
c GDM
Used in logic minimizers.
Then:
{f
Matrix representations of logic covers
Given:
{ Two functions f and g.
{ Orthonormal set of functions:
Basis: 1 = ab and 2 = a + b .
0
{ ab f1 1
{ a bc + ab c f2
Generalized expansion theorem
Operations:
{ Intersection { AND
{ Union { OR
Example
Cofactor computation
f = a d + a b + ab + ac d
0
0
0
0
0
c GDM
c GDM
10
10
01
01
11
01
10
11
11
11
11
10
10
11
11
01
Cofactor of w.r. to .
{ Void when does not intersect .
{ a1 + b1 a2 + b2 : : : an + bn
0
0
0
Cofactor of a set C = i w.r. to :
f
g
{ Set of cofactors of i w.r. to .
Multiple-valued-input functions
Example
f = a b + ab
c GDM
0 0
10 10
01 01
Cofactor fa = b
Input variables can have many values.
Representations:
{ Literals: set of valid values.
{ Sum of products of literals.
Cofactor w.r. to 01 11:
{ First row { void.
{ Second row { 11 01 .
c GDM
Extension of positional cube notation.
Key fact:
{ Multiple-output binary-valued functions
represented as mvi single-output functions.
Example
Operations on logic covers
c GDM
2-input, 3-output function:
c GDM
{ f1 = a b + ab
{ f2 = ab
{ f3 = ab + a b
{ Expand about a mv-variable.
{ Apply operation to cofactors.
{ Merge results.
0 0
0
0
Mvi representation:
10
10
01
01
10
01
10
01
cofactors become unate functions.
Recursive tautology
c GDM
Check if a function is always TRUE.
Recursive paradigm:
{ Expand about a mv-variable.
{ If all cofactors are TRUE
then function is a tautology.
Unate heuristics:
{ If cofactors are unate functions
additional criteria to determine tautology.
{ Faster decision.
Unate heuristics:
{ Operations on unate functions are simpler.
{ Select variables so that
100
001
001
110
Tautology
Recursive paradigm:
c GDM
TAUTOLOGY: the cover has a row of all 1s.
(Tautology cube).
NO TAUT.: the cover has a column of 0s.
(A variable that never takes a value).
TAUTOLOGY:
the cover depends on one variable,
and there is no column of 0s in that eld.
When a cover is the union of two subcovers,
that depend on disoint subsets of variables,
then check tautology in both subcovers.
Example
Example
c GDM
ac
ab
a’
f = ab + ac + ab c + a
0 0
01
01
01
10
c
01
11
10
11
b
11 01 11
11 11 01
11 10 10
a
0
ab’c’
c GDM
11
01
10
11
Select variable a.
Cofactor w.r.to a is 11 11 11 { Tautology.
0
Cofactor w.r.to a is:
11 01 11
11 11 01
11 10 10
Containment
Select variable b.
Cofactor w.r.to b is:
11 11 01
11 11 10
0
No column of 0 { Tautology.
Cofactor w.r.to b is: 11 11 11.
Function is a TAUTOLOGY.
Example
c GDM
ab
a’
f = ab + ac + a
0
Theorem:
{ A cover F contains an implicant i F is a tautology.
Consequence:
bc
ac
{ Containment can be veried by the
tautology algorithm.
c
b
a
c GDM
Check covering of bc { C (bc) = 11 01 01.
Take the cofactor:
01 11 11
01 11 11
10 11 11
Tautology { bc is contained by f .
Complementation
Termination rules
c GDM
Recursive paradigm:
{ f =x
0
fx + x fx
0
0
0
The cover F is void.
Hence its complement is the universal cube.
The cover F has a row of 1s.
Hence F is a tautology and its complement is void.
0
Steps:
{ Select variable.
{ Compute cofactors.
{ Complement cofactors.
Recur until cofactors can be complemented
in a straightforward way.
The cover F consists of one implicant.
Hence the complement is computed by
De Morgan's law.
All the implicants of F depend on a single variable,
and there is not a column of 0s.
The function is a tautology, and its complement is
void.
The cover has a column of 0s, say in position j .
Let be a cube of all 1s, except in position j .
Then F = F and F = F.
Hence recursively compute the complement
of F and of and return their union.
\
0
0
ac
ab
a’
c
Theorem:
{ If f be positive unate: f = fx + x fx .
{ If f be negative unate: f = x fx + fx .
0
0
0
0
0
0
ab’c’
c GDM
Select binate variable a .
0
0
Consequence:
{ Complement computation is simpler.
{ One branch to follow in the recursion.
b
a
0
0
0
c GDM
f = ab + ac + a
0
[
Example
Unate functions
c GDM
Heuristic:
{ Select variables to make the cofactors unate.
Compute cofactors:
{ Fa is a tautology, hence Fa is void.
{ Fa yields:
0
0
11 01 11
11 11 01
0
Example (2)
c GDM
Example (3)
c GDM
Select unate variable b.
Compute cofactors:
RECURSIVE SEARCH
{ Fab is a tautology, hence Fab is void.
{ Fab = 11 11 01 and its complement is
0
a’
a
0
11 11 10.
F = TAUT
a’
COMP = φ
Re-construct complement:
{ 11 11 10 intersected with C (b ) = 11 10 11
yields 11 10 10.
0
{ 11 10 10 intersected with C (a) = 01 11 11
yields 01 10 10.
Complement: F = 01 10 10.
0
Summary
c GDM
Matrix oriented representation:
{ Used in two-level logic minimizer.
{ May be wasteful of space (sparsity).
{ Good heuristics tied to this representation.
Ecient Boolean manipulation exploits
recursion.
b
F = TAUT
ab
COMP = φ
b’
F
=c
ab’
COMP =
c’
Download