Introduction to VHDL

Download Report

Transcript Introduction to VHDL

State university of New York at New Paltz
Electrical and Computer Engineering Department
Logic Synthesis Optimization
Lect12: Unate Covering Problem
By
Dr. Yaser Khalifa
Electrical and Computer Engineering Department
State University of New York at New Paltz
A
0000
1000
0101
1001
1010
0111
1110
1011
1111
B
C
X
X
D
E
F
G
X
X
H
I
J
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
Minterm 0000 is covered only by A then A is essential and is omitted from the prime implicant table
D
0101
1001
1010
0111
1110
1011
1111
B
C
D
E
F
G
X
X
H
I
J
X
X
X
X
X
X
X
X
X
X
X
X
X
X
Column B is dominated by column E and column C is dominated by column F,
and therefore we can eliminate B and C from the table.
D
0101
1001
1010
0111
1110
1011
1111
E
F
G
X
X
H
I
J
X
X
X
X
X
X
X
X
X
X
X
X
Minterm 0101 is covered only by D then D is essential and is omitted from the prime implicant table
E
1001
1010
1110
1011
1111
F
G
X
X
H
I
J
X
X
X
X
X
X
X
X
X
E
1001
1010
1110
1011
1111
F
G
X
X
H
I
J
X
X
X
X
X
X
X
X
X
Minterm 1001 is covered only by E then E is essential and is omitted from the prime implicant table
1010
1110
1111
F
G
X
X
H
X
I
J
X
X
X
Column G is dominated by column F,
and therefore we can eliminate G from the table.
X
F
1010
1110
1111
H
I
J
X
X
X
X
X
X
Minterm 1010 is covered only by F then F is essential and is omitted from the prime implicant table
1111
H
I
J
X
X
X
Therefore we have three possible solutions
A, D, E, F, H/I/J
Another set of solutions could emerge if we consider that columns H and J are dominated by I and
therefore a solution would be
A, D, E, F, I
Example
• F (A, B, C, D) = Sm( 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)
1)
2)
3)
4)
5)
6)
7)
Construct prime implicant table
Remove primary essential prime implicants
Row Dominance
Column Dominance
Remove secondary essential prime implicants
Row Dominance
Column Dominance
Petrick’s Method
In Petrick's method, a Boolean expression P is formed which
describes all possible solutions of the table.
The prime implicants in the table are numbered in order, from
1 to 6: p1 = A'C, p2 = B'C, p3 = A'B, p4 = BC', p5 = AB', p6 =
AC'.
For each prime implicant pi, a Boolean variable Pi is used
which is true whenever prime implicant piis included in the
solution.
Note the difference!: pi is an implicant, while Pi is a
corresponding Boolean proposition (i.e., true/false statement)
which has a true (1) or false (0) value. Pi=1 means ``I select
prime implicant pi for inclusion in the cover'', while Pi=0
means ``I do not select prime implicant pi for inclusion in the
cover.
Using these Pi variables, a larger Boolean expression P can be
formed, which captures the precise conditions for every row in the
table to be covered. Each clause in P is a disjunction (OR) of
several possible column selections to cover a particular row. The
conjunction (AND) of all of these clauses is the Boolean
expression P, which describes precisely the conditions to be
satisfied for all rows are covered.
For the above prime implicant table, the covering requirements
can be captured by the Boolean equation:
P = (P1 + P2)(P3 + P4)(P1 + P3)(P5 + P6)(P2 + P5)(P4 + P6)
•If Boolean variable P=1, each of the disjunctive clauses is
satisfied (1), and all rows are covered. In this case, the set of
Pi's which are 1 indicate a valid cover using the
corresponding selection of primes pi's (columns).
•If P=0, then at least one disjunctive clause is not satisfied
(0), meaning that at least one row is not covered.
•In this case, the set of Pi's which are 1 correspond to a set of
selected primes pi which do not form a valid cover.
•Note that the above equation is simply a rewriting of the
prime implicant table as a Boolean formula: the clauses
correspond to the rows.
In the right expression, the sum (P1 + P2) describes the covering
requirement for row 3: product p1or p2 must be included in the
solution, in order to cover row 3.
Similarly, the sum (P3 + P4) describes the covering requirement for
row 5: product p3or p4 must be included to cover row 5.
Each sum corresponds to a different row of the table.
These sums are ANDed together, since all such requirements must
be satisfied.
Since P is a Boolean expression, it can be multiplied out into sumof-products form:
P = P1 P4 P5 + P1 P3 P5 P6 + P2 P3 P4 P5 + P2 P3 P5 P6
+ P1 P2 P4 P6 + P1 P2 P3 P6 + P2 P3 P4 P6 + P2 P3 P6
Each product describes a solution for the table. Only two products
have 3 Boolean variables; the remainder have 4 variables. These
two products, P1 P4 P5 and P2 P3 P6, describe two minimal
solutions. The first product describes a solution which includes
prime implicants p1, p4 and p5; that is, A'C, BC' and AB'. The
second product describes a solution using prime implicants p2, p3
and p6; that is, B'C, A'B and AC'.
Both solutions have a minimal number of prime implicants, so
either can be used. With either choice, we must include the
secondary essential prime implicant, A'D', identified earlier.
Therefore, the two minimum-cost solutions are:
F = A'D' + A'C + BC' + AB'
F = A'D' + B'C + A'B + AC'
Tautology
• Tautology refers to redundancy, repetition, and circular
reasoning within an argument or statement.
• In logic, a tautology is a statement that is true regardless of
the truth-values of its parts.
• For example, the statement "All crows are either black, or
they are not black," is a tautology because it is true no
matter what color crows are.
• The opposite of a tautology is a contradiction, which is a
statement that is always false.
•The opposite of a tautology is a contradiction,
which is a statement that is always false.
•In linguistics, a tautology is often a fault of style. It
was defined by Fowler as "saying the same thing
twice". For example, "three-part trilogy" is
tautologous because a trilogy, by definition, has
three parts. "Significant milestone" and "significant
landmark" are also if less obviously tautologous,
because milestones and landmarks are again
significant by definition (could one imagine an
"insignificant landmark"?).
Two-Level Tautology
• During the prime implicant generation and prime
implicant table generation steps of two-level
Boolean minimization, repeated checks of the
containment of a cube by cover are performed.
• In order to check whether c T (cube c is
contained by cube T) we can check whether Tc, the
cofactor of T with respect to cube c, is tautology.
• A completely specified logic function is a
tautology if the OFF-set of all its component are
empty. In other words, the outputs of f are 1 for all
inputs.
Consider a Boolean function f with inputs a,
b, c, d.
C=0__1
T = { 000_, _1_1, 0_11 }
Ta’ = { 00_, 1_1, _11 }
We compute Tc = T a’d = { 00, 1_, _1 }
Tc is a tautology, and therefore c is contained
by T.
Tautology Checking
• Given a cover F of a Boolean function,
determine if F is a tautology.
Definitions
• The universal cube or 1 cube is a cube
whose input fields are all '-' (i.e., don'tcares).
• That is, the universal cube spans the entire
input domain
Definitions
• A logic function f is monotone increasing
(decreasing) in a variable xj if changes in xj
from 0 1 cause f to change from 0  1 or stay
constant (1  0 or stay constant)
• A function is unate in xj if it is either monotone
increasing in xj or monotone decreasing.
• A function is unate if it is unate in all its variables.
f = a . b’ + b’ . c
f is monotone increasing in a and c and monotone decreasing in b
Therefore f is unate.
f = a’ . b + a . b’
Is nonunate in a and b.
Therefore f is nonunate
• A cover is positive unate in a variable x if x’
does not appear in any cube in the cover.
That is, in each cube, x either is uncomplemented or
x does not appear.
• A cover is negative unate in a variable x if x
does not appear (uncomplemented) in any cube in
the cover.
That is, in each cube, x is either complemented or x
does not appear.
• If a cover is positive or negative unate in
variable x, the cover is said to be unate in
variable x. If a cover is unate in every
variable, it is called a unate cover.
• Given a cover for a function if a variable xj
is a _ or a 1 ( _ or a 0) in each cube, then f is
unate in xj.
• As an example consider f = a. b’ + b’. C
• F satisfies the above definition for all
variables.
Tautology
•
To detect a tautology:
1. Universal Cube. For a single-output
function, if the cover includes the universal
cube, then the function is a tautology.
2. Input Column of All 1's/All 0's. For a
single-output function, if an input column
contains all 0's (complemented literal) or all
1's (uncomplemented literal), then the
function is not a tautology.
3. Single-Input Dependence. For a singleoutput function, if the function depends on
only one input x (i.e., all other input columns
contain only '-'), and Rules 1 and 2 do not
apply (i.e., the x column contains both 1's and
0's), then the function is a tautology.
4. No Universal Cube. For a single-output
function, if the cover is unate, and the
cover does not include the universal cube,
then the function is not a tautology.
The Tautology Checking Algorithm
Tautology checking of a cover F is performed by a
recursive algorithm. The basic idea is as follows.
• Step #1. Apply the previous rules, to determine if
F (i) is a tautology, or (ii) is not a tautology. If the
result is (i) or (ii), the algorithm is done.
• Step #2. If the algorithm is not done, the cover is
recursively split, in two halves, and the same
algorithm is now repeated on each half.
More details on the recursion: Recursion is based on a
fundamental theorem, called Shannon Decomposition or
Boole's Expansion Theorem. Given a splitting variable x1,
the theorem states:
In other words, the theorem indicates how a function can be
examined, by cofactoring with respect to both x1 and x'1, and
combining the results.
For tautology, Shannon decomposition reduces to a very simple
form: A function f is a tautology if and only if fx1 and fx'1 are both
tautologies (see H/S p. 194). More formally:
.
Summary of Step#2: If Step #1 cannot determine if the cover is,
or is not a tautology, then recursion is performed. A splitting (or
branching) variable, x1, is selected. Check if (i) fx1 is a tautology,
and (ii) fx'1 is a tautology. If both are tautologies, f is a tautology,
and the algorithm is done. If at least one is not a tautology, then f
is not a tautology, and the algorithm is done.
Choice of Splitting Variable. The choice of splitting variable is
important. A key goal is to select a variable that is likely to create
unate subproblems.
The heuristic of Brayton et al. is therefore to select (i) a binate
variable, which (ii) has the most implicants dependent on it.
A binate variable xis one which appears in both complemented and
uncomplemented form. An implicant depends on the variable, if
the variable appears in the implicant (complemented or
uncomplemented).
In case of a tie, the heuristic choose a variable minimizing the
difference between number of occurrences with positive polarity
and the number of occurrences with negative polarity. The
rationale is to keep the recursion tree as balanced as possible.
Rules for Pruning/Simplifying the Recursion Step.
• A number of rules can be applied, to avoid unnecessary
recursion. The most common is a key rule, which uses
properties of recursive functions.
Unate Variable. For a single-output function, the
recursion can be simplified if the cover is unate in
some variable x. In this case, if the cover is positive
unate in x, then it is sufficient to check if fx' is a
tautology. Alternatively, if the cover is negative unate
in x, then it is sufficient to check if fx is a tautology.
(This is a pruning step: in each case, one of the two
recursive calls is not necessary)
Heuristic Logic Minimization
Heuristic Logic Minimization (cube-based)
② Unate recursive paradigm : ESPRESSO
(or in English; Divide-and-Conquer!)
i.e. Decomposition
 Make use of Shannon’s expansion to recursively operate on
subsets of logic cover until cover has unate property.
 Why looking for the unate property recursively?

Every prime of a unate function is essential.

Minimum form is given as the union of all EPIs.

Note that min form = EPIs + minimum PIs in general.

If F is a unate function, min form = EPIs : this is good to find min.
form.

In ESPRESSO, used for complementation and tautology checking.
(b) Shannon Expansion
f  x j fx j  x j fx j
where
fx j  f x 1
j
fx j  f x 1  f x 0
j
Complementation
f  x j ( f )x j  x j (f ) x j
 x j (f) x j  x j (f) x j
j
Unate Function
Definition :
If, in the minimum sum-of-product form of a switching function,
each variable appears either in its true form or its complemented
form, but not both, then the function is called a unate function.
Ex) f1(x1 x2 x3)= x1 + x2 x3’ : unate
f1(x1 x2 x3)= x1 + x1’ x2 x3’ : ≠ unate due to x1 & x1’
Th
A switching function is unate if and only if it can be expressed
as a sum of essential prime cubes, all intersecting at a common
subcube.
 The unate function is a special case that the minimum form can
be expressed as a sum of essential prime cubes.
AB
CD 00
00 0
01
1
A
01
11
10
0
0
0
1
1
1
AB
00
CD
00
1
01
1
A
01
11
10
0
0
0
1
1
1
D
11
0
0
1
C
10
0
0
0
D
0
0
B
Single common subcube
11
0
0
1
0
10
0
0
0
0
C
B
Min. form F=C’D +ABD+A’B’C’ is a
collection of EPI
Min. form F=C’D +ABD is a collection
of EPI
But two common subcubes
Thus, F is a unate function
Thus, F is not a unate function.
Also note that A and B appear in both
true and complement.
How to determine if a function is unate :
The definition on prev. page requires the min. form of the function.
But we are looking for it. Thus, we need another method.
 A function is unate if it is unate in all its variables.
 A function is unate in xj if it is monotone in xj.
 Thus, a function is unate if it is monotone in all its variables
 Monotone in xj?
 xj change causes all changing outputs to change in the
same direction.
 If xj of 0 1 causes all changing outputs to change
 from 0  1 : monotone increasing in xj
 from 1  0 : monotone decreasing in xj
Both OK for D: 0  1
A
B
C
D
0
0
0
0
0
0
0
1
0
0
1
0
0
0
1
1
0
1
0
0
0
1
0
1
0
1
1
0
0
1
1
1
1
0
0
0
1
0
0
1
1
0
1
0
1
0
1
1
F=C’D
+ABD
F1=C’D
+ABD+A’B’C’
1
1
1
1
1
1
1
Both OK for C: 0  1
A
B
D
C
0
0
0
0
0
0
0
1
0
0
1
0
0
0
1
1
0
1
0
0
0
1
0
1
0
1
1
0
0
1
1
1
1
0
0
0
1
0
0
1
1
0
1
0
1
0
1
1
F=C’D
+ABD
F1=C’D
+ABD+A’B’C’
1
1
1
1
1
1
1
F1 NOT OK for A: 0  1
F=C’D
+ABD
F1=C’D
+ABD+A’B’C’
A
B
C
D
0
0
0
0
1
0
0
0
0
0
0
1
1
1
1
0
0
1
1
1
0
0
1
0
1
0
1
0
0
0
1
1
1
0
1
1
0
1
0
0
1
1
0
0
0
1
0
1
1
1
1
1
0
1
1
1
1
Recursion Process
 Apply the Shannon expansion recursively until we hit a unate cover.
 If hit, return a minimum form for the subexpression which is a
collection of EPIs
f
x1
x1
fx1
x2
x2
fx1
x3
x3
...
At each node, a splitting variable is selected, e.g. x1, x2, ...
How to select a splitting variable.
Heuristic method for min # of
splittings
Choose most ‘binate’ variable, which is the one with most 0’s and
1’s in matrix representation
Matrix representation of an expression
input
variables
choose
this
product
x1
0
0
0
1
0
output
functions
x2 ... xn f1 f2 ... fm
1 ... 2
2
0
0
2
2
2
1
1
3 또는 4
not using the
corresponding
product
using
product
Simple heuristic minimization
algorithm
/* Given a cover F of f, return a smaller cover */
Simplify (F)
since PI of unate is EPI
{
if (F is unate)
And min form = EPI
return (F’  PI_of_F)
j  select_binate (F)
F’  merging ( xj•Simplify (Fxj), xj•Simplify (Fxj) )
if ( |F | < |F’| ) return (F)
else return (F’)
}
merging : AfA  AfA
systematically
* Did not work well (Read Brayton)