data structures

advertisement
DATA STRUCTURES
FOR LOGIC OPTIMIZATION
Outline
c GDM
• Review of Boolean algebra.
c Giovanni De Micheli
• Representations of logic functions.
Stanford University
• Matrix representations of covers.
• Operations on logic covers.
Background
c GDM
Example
c GDM
• Function f (x1, x2, . . . , xi, . . . , xn).
• Function:f = ab + bc + ac
• Cofactor of f with respect to variable xi:
• Cofactors:
– fxi ≡ f (x1, x2, . . . , 1, . . . , xn).
– fa = b + c
• Cofactor of f with respect to variable x0i:
– fa0 = bc
– fx0 ≡ f (x1, x2, . . . , 0, . . . , xn).
i
• Expansion:
• Boole’s expansion theorem:
– f = afa + a0fa0 = a(b + c) + a0bc
– f (x1, x2, . . . , xi, . . . , xn) = xi ·fxi +x0i ·fx0
i
Background
Background
c GDM
c GDM
• Function f (x1, x2, . . . , xi, . . . , xn).
• Function f (x1, x2, . . . , xi, . . . , xn).
• Boolean difference of f w.r.t. variable xi:
• Positive unate in xi when:
– ∂f /∂xi ≡ fxi ⊕ fx0 .
– fxi ≥ fx0
i
i
• Consensus of f w. r. to variable xi:
• Negative unate in xi when:
– Cxi ≡ fxi · fx0 .
– fxi ≤ fx0
i
i
• A function is positive/negative unate when
positive/negative unate in all its variables.
• Smoothing of f w. r. to variable xi:
– Sxi ≡ fxi + fx0 .
i
Generalized expansion
c GDM
Example
f = ab + bc + ac
c GDM
• Given:
– A Boolean function f .
c
– Orthonormal set of functions:
φi, i = 1, 2, . . . , k.
b
a
(a)
(b)
• Then:
– f =
(c)
(d)
• The Boolean difference ∂f /∂a = fa ⊕ fa0 = b0c + bc0 .
• The consensus Ca = fa · fa0 = bc.
• The smoothing Sa = fa + fa0 = b + c.
Pk
i φi · fφi
– Where fφi is a generalized cofactor.
• The generalized cofactor is not unique,
but satisfies:
– f · φi ⊆ fφi ⊆ f + φ0i
Generalized expansion theorem
Example
c GDM
c GDM
• Given:
• Function f = ab + bc + ac.
– Two functions f and g.
• Basis: φ1 = ab and φ2 = a0 + b0.
– Orthonormal set of functions:
φi, i = 1, 2, . . . , k.
• Bounds:
– Boolean operator .
– ab ⊆ fφ1 ⊆ 1
– a0bc + ab0c ⊆ fφ2 ⊆ ab + bc + ac.
• Cofactors: fφ1 = 1 and fφ2 = a0bc + ab0c.
f = φ1fφ1 + φ2fφ2
= ab1 + (a0 + b0)(a0 bc + ab0c)
= ab + bc + ac
Matrix representations of logic covers
• Then:
– f g =
Pk
i φi · (fφi gφi )
• Corollary:
– f g = xi · (fxi gxi ) + x0i · (fx0 gx0 )
i
i
The positional cube notation
c GDM
• Used in logic minimizers.
c GDM
• Encoding scheme:
∅
0
1
∗
• Different formats.
• Usually one row per implicant.
• Symbols: 0,1,*. (and other)
00
10
01
11
• Operations:
– Intersection – AND
– Union – OR
Example
f = a0d0 + a0b + ab0 + ac0d
Cofactor computation
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 + b01 a2 + b02
...
an + b0n
• Cofactor of a set C = {γi} w.r. to β:
– Set of cofactors of γi w.r. to β.
Multiple-valued-input functions
Example
f = a0 b0 + ab
c GDM
c GDM
10
01
10
01
• Cofactor w.r. to 01 11:
– First row – void.
– Second row – 11 01 .
• Cofactor fa = b
• Input variables can have many values.
• Representations:
– Literals: set of valid values.
– Sum of products of literals.
• 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
• Recursive paradigm:
– f1 = a0b0 + ab
– Expand about a mv-variable.
– f2 = ab
– Apply operation to cofactors.
– f3 = ab0 + a0 b
– Merge results.
• Mvi representation:
10
10
01
01
• Unate heuristics:
10
01
10
01
– Operations on unate functions are simpler.
100
001
001
110
– Select variables so that
cofactors become unate functions.
Tautology
Recursive tautology
c GDM
• Check if a function is always TRUE.
c GDM
• TAUTOLOGY: the cover has a row of all 1s.
(Tautology cube).
• 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.
• 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 field.
• When a cover is the union of two subcovers,
that depend on disoint subsets of variables,
then check tautology in both subcovers.
Example
Example
bc
c GDM
ac
ab
a’
f = ab + ac + ab0c0 + a0
c
b
a
ab’c’
c GDM
01
01
01
10
01
11
10
11
11
01
10
11
11 01 11
11 11 01
11 10 10
• Select variable b.
• Cofactor w.r.to b0 is:
• Select variable a.
11 11 01
11 11 10
• Cofactor w.r.to a0 is 11 11 11 – Tautology.
• Cofactor w.r.to a is:
• No column of 0 – Tautology.
• Cofactor w.r.to b is: 11 11 11.
11 01 11
11 11 01
11 10 10
• Function is a TAUTOLOGY.
Example
bc
Containment
ac
ab
c GDM
a’
f = ab + ac + a0
c
b
a
c GDM
• Theorem:
– A cover F contains an implicant α
iff Fα is a tautology.
• Consequence:
– Containment can be verified by the
tautology algorithm.
• 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
c GDM
Termination rules
c GDM
• Recursive paradigm:
• The cover F is void.
Hence its complement is the universal cube.
– f 0 = x · fx0 + x0 · fx0 0
• The cover F has a row of 1s.
Hence F is a tautology and its complement is void.
• Steps:
• The cover F consists of one implicant.
Hence the complement is computed by
De Morgan’s law.
– Select variable.
– Compute cofactors.
• All the implicants of F depend on a single variable,
and there is not a column of 0s.
– Complement cofactors.
The function is a tautology, and its complement
is void.
• Recur until cofactors can be complemented
in a straightforward way.
Unate functions
Example
c GDM
ac
ab
a’
• Theorem:
c
f = ab + ac + a0
b
a
ab’c’
c GDM
– If f be positive unate: f 0 = fx0 + x0 · fx0 0 .
– If f be negative unate: f 0 = x · fx0 + fx0 0 .
• Consequence:
• Select binate variable a0 .
• Compute cofactors:
– Complement computation is simpler.
– Fa0 is a tautology, hence Fa0 0 is void.
– One branch to follow in the recursion.
– Fa yields:
11 01 11
11 11 01
• Heuristic:
– Select variables to make the cofactors
unate.
Example (2)
c GDM
Example (3)
c GDM
• Select unate variable b.
RECURSIVE SEARCH
• Compute cofactors:
0 is void.
– Fab is a tautology, hence Fab
a’
a
– Fab0 = 11 11 01 and its complement is
11 11 10.
F = TAUT
a’
COMP = φ
• Re-construct complement:
– 11 11 10 intersected with C(b0) = 11 10 11
yields 11 10 10.
– 11 10 10 intersected with C(a) = 01 11 11
yields 01 10 10.
• Complement: F 0 = 01 10 10.
Summary
c GDM
• Matrix oriented representation:
– Used in two-level logic minimizer.
– May be wasteful of space (sparsity).
– Good heuristics tied to this representation.
• Efficient Boolean manipulation exploits
recursion.
b
F = TAUT
ab
COMP = φ
b’
F
ab’ = c
COMP =
c’
Download