LC03

advertisement
3. Minimizing Logic Functions
3. MINIMIZING LOGIC FUNCTIONS
The minimizing of logic functions' is of great importance because simple logic equations are
realized by simple, cheap and reliable logic circuits. This chapter includes the postulates and
theorems of Boolean algebra, and the methods of minimizing logic functions algebraically and
using Karnaugh map.
3.1. The Postulates and Theorems of Boolean Algebra
The Boolean algebra or algebra of logic is based on the next postulates or axioms:
A1a. X + 0 = X
A1b. X 1 = X
A2a. X + Y = Y + X
A2b. X Y =Y X
A3a. X + Y Z = (X+Y) (X+Z)
A3b. X (Y+Z) = X Y+X Z
A4a. X + X = 1
A4b. X X = 0
The axioms and theorems of Boolean algebra are presented as dual pairs a and b: each
member of dual pair can be obtained from the member of the other pair by exchanging the 0s
and 1s and the binary operators + and  .
Some of the axioms are obvious, others – not. The latter one can be verified by the truth
tables. The method of mathematical induction says: what is right for the 1, 2, 3, ... , and i cases,
will be right for i + 1 case. All possible combinations of logic variables are written in the truth
table, therefore verification according the truth table is verification of all possible cases. It is
called a method of perfect induction.
Example 3.1
Prove by perfect induction:
a) X1 X2  X1 X2;
b) X1+X2  X1+X2.
Theorems of Boolean algebra can be proved algebraically using the axioms, using a
combination of axioms with theorems that have already been proved, and using the truth tables
and the principle of perfect induction. Once a theorem is proven, its dual form is also proven.
A few of the more useful theorems of Boolean algebra are listed below:
T1. X = X
T2a.
T3a.
T4a.
T5a.
T6a.
X+X = X
X+1 = 1
X+ X Y = X
X+(Y+Z) = (X+Y)+Z
X+Y = XY
T2b.
T3b.
T4b.
T5b.
T6b.
X X = X
X 0 = 0
X (X+Y) = X
X (YZ) = ( XY)Z
X Y = X+Y
21
3. Minimizing Logic Functions
T7a. X Y+ X Y = X
T8a. X Y+ XZ+YZ = X Y+ X Z
T9a. X+ X Y = X+Y
TI0a. X1+X2+X3+... = X1X2X3...
T7b. (X+Y) (X+Y) = X
T8b. (X+Y)(X+Z)(Y+Z) = (X+Y)(X+Z)
T9b. X (X+Y) = X Y
T10b. X1X2X3... = X1+X2+X3+...
Now we will name some theorems. T1 is a double negation theorem. T3 is identity element
theorem. T4 is absorption theorem. T6 is De Morgan's theorem – it is very useful changing the
NOR gates in the circuits by NAND gates and other way round. T7 – adjacency theorem – and
T9 – simplification theorem – are very useful minimizing logic expressions algebraically. T10
is De Morgan's theorem for many variables.
Example 3.2
Prove the theorem T2a, applying the axioms A1b, A4, A3a, A4b and A1a.
Example 3.3
Prove the theorem T4a, applying the axioms and theorem T3a.
3.2. Minimizing Boolean Functions Algebraically
Minimizing logic expressions algebraically it is necessary to know the hierarchy or order of
precedence of the binary operators: complement or inversion, AND, OR. The parentheses
circumvent operator hierarchy as in an ordinary algebra.
3.2.1. Minimizing Using Axioms and Theorems
We can use axioms with theorems to manipulate Boolean functions into a simpler form.
Example 3.4
Minimize the logic circuit.
Solution
We will minimize the expression in the output of the circuit:
(A+B) (B+C)  AB + AC + BB +BC 
 BB + B C +BA + AC.
A
1
AB

( AB) (BC)
B
1
BC
C
Applying the theorems T2b and T4a, we get the following:
BB+BC+BA+AC  B+AC.
This expression can be realized by two gates only.
It is obvious that simpler form of logic expression means simpler logic circuit, and it is
not necessary to draw the logic circuits every time.
As with ordinary algebra, it is often hard to know exactly when you have obtained a
minimum form of a function when you reduce an expression algebraically.
Consider the following function:
F(X,Y,Z) = XYZ + YZ + YZ .
Can we reduce this function? The answer is yes since YZ + YZ reduces to Y by T7a.
XYZ + Y reduces to XZ + Y by T9a. Does this represent a minimum form of the function?
22
3. Minimizing Logic Functions
The answer is yes. This is a very simple function and since it only has one form for each literal
(each input variable is either complemented or uncomplemented), the function is in a minimum
form. When input variables appear in both complemented and uncomplemented forms, a
function may or may not be reducible.
Now using theorems we will prove one very useful principle: the complement of i
maxterm equals to i minterm:
Mi = mi.
Let us take a quantity of logic variables' n = 3 and a number of the truth table row i = 3. It
means that it is necessary to prove that
X+Y+Z = XYZ.
We can prove it applying De Morgan's theorem twice to the left side of expression.
We have got very useful conclusion: writing the sum of products according the rows of
truth table in which the function has value 0, we write the complement of function F.
3.2.2. Minimizing by First Expanding the Function
The function may appear to be in a minimum form since none of the theorems appear to
directly provide a simpler expression. A general technique that is recommended in this case
(when there are three or more input variables and the theorems do not appear provide a simpler
expression), is to expand the function such that every product term contains one of the input
variables in either it's complemented or uncomplemented form.
We will minimize the function
F(X,Y,Z) = XZ + XYZ + XZ+ XYZ.
To expand a product term in a function containing the missing variable Y, the missing
variable is supplied using A1b and A4a:
XZ = X1Z = X (Y+Y)Z = XYZ + XYZ.
Product XZ is expanded similarly. Our function now looks like this:
F(X,Y,Z) = XYZ + XYZ + XYZ + XYZ + XYZ + XYZ =
= m1 + m2 + m3 + m4 + m5 + m6 .
Applying T7a for the pairs of minterms 1 and 5, 2 and 3, 4 and 6 we got a minimized
function:
F(X,Y,Z)= XY + XZ + YZ.
3.3. Minimizing Functions Using Karnaugh Maps
In 1953 Maurice Karnaugh published paper entitled "The Map Method for Synthesis of
Combinational Logic Circuits". Today these maps are generally referred to as Karnaugh maps
in his honor, and they are the main instrument in the reduction of Boolean functions. Karnaugh
maps are considered easier to use than Boolean theorems for minimizing functions because
23
3. Minimizing Logic Functions
they provide a graphical viewpoint. The Boolean function entered into the map can be
simplified to a minimum form without too much difficulty.
3.3.1. Drawing, Filling, and Using Karnaugh Map
Karnaugh map is another form of a truth table. Every row of the truth table, that is, the
minterm, corresponds with the particular square in Karnaugh map. The squares in Karnaugh
map are laid out so that the values of only one logic variable differ in the adjacent squares. The
values of all other variables, inscribed in minterms corresponding to adjacent squares,
coincide. Such requirement means that the values of the variables along the sides of Karnaugh
map must be written in a Gray code.
Let us illustrate above-stated with the truth table and Karnaugh map of the function
F(X,Y,Z)= m(1,2,5).
X
0
0
0
0
1
1
1
1
Y
0
0
1
1
0
0
1
1
Z
0
1
0
1
0
1
0
1
F
0
1
1
0
0
1
0
0
X YZ
00
000
0 XYZ
F
01
001
11
011
10
010
XYZ
XYZ XYZ
m0
m1
m3
m2
100
101
111
1 XYZ
XYZ
XYZ
m5
m7
110
XYZ
m6
m4
All possible combinations of input variables are written
along the sides of Karnaugh map in the sequence of Gray
00
01
11
10
code: X along the vertical side of the map, and YZ along the
horizontal side. The values of all logic variables, and
0
1
0
1
0
corresponding minterms in the expanded and short form are
F
inscribed in all squares of the map above. Usually we write
0
1
0
0
1
in the squares only the values of function, as in the map
below. The values of variables written along the sides of
map give the number of the minterm corresponding to the
particular square of map. As a rule we write in the squares only 1s, 0s are usually missed.
Now we will name the sequence of actions minimizing the function written into the map.
1. All isolated 1s (with no neighbors in the adjacent squares) are circled and the circles
are indicated as p1, p2, ... .
2. All pairs of 1s in the adjacent squares are circled and the circles are indicated
continuing numeration of the circles from point one.
X YZ
24
3. Minimizing Logic Functions
3. All groups of four 1s in the adjacent squares are circled and the circles are indicated
continuing numeration of the circles.
4. All groups of eight 1s in the adjacent squares are circled and the circles are indicated
continuing the numeration.
5. When all 1s inscribed into the map are circled, we write the logic function in the form
of SOP. Each product in the sum corresponds to the certain circle. Each product consists from
only these variables, which repeats oneself in an every square of the circle in the same
complemented or uncomplemented form. When a function of n variables is minimized,
products corresponding to the circle of isolated 1s' consist from n variables; products
corresponding to the circles of pairs of 1s' consist from n –1 variables; to the circles of fours of
1s' – from n –2 variables; to the circles of eights' of 1s' – from n –3 variables.
We will illustrate these rules minimizing the functions of 2, 3, 4 and 5 logic variables.
Example 3.5
Minimize the logic function F(X,Y)  m(1,2,3).
Solution
F(X,Y) = m(1,2,3) = XY+XY+XY .
We write into the map 1s corresponding the minterms with binary
numbers 01, 10 and 11 and circle the pairs of 1s in the adjacent squares p1 and
p2. Then we write the function in the minimized SOP form:
F(X,Y) = p1+p2 = Y+X.
Example 3.6
Minimize the logic function F(X,Y,Z)  m(0,2,3,5,6,7).
Solution
We write into the map 1s corresponding the minterms with
binary numbers 000, 010, 011, 101, 110 and 111. We circle the pairs
of 1s in the adjacent squares p1 (the square to the left side of map is
adjacent to the square to the right side of map like in a map of the
globe) and p2. Then we circle the four of 1s' p3, and write the
function in the minimized SOP form:
F(X,Y,Z) = p1+p2+p3 = XZ + XZ +Y.
X Y
0
1
F
p1
1
0
1
1
1
p2
X YZ
00
0
01
1
11
10
1
1
1
1
p1
F
1
1
p3
p2
If we exchange the function F values (1s with 0s and 0s with 1s) we get a complement of
the function F. It means that performing all actions in Karnaugh map with 0s like with 1s we
have complemented function F as a result. Sometimes, when
r1
X YZ
there is few 0s in truth table or in Karnaugh map, actions
00
01
11
10
with 0s instead of 1s may sense. Let us perform this with
function of example 3.6.
1
0
1
1
0
There are two isolated 0s in Karnaugh map of this F
function indicated as circles r1 and r2 (usually the circles
1
0
1
1
1
with 0s are indicated as r circles). The complement of the
function
r2
F(X,Y,Z) = r1+r2 = XYZ+XYZ.
25
3. Minimizing Logic Functions
Now it is necessary to decide which of two expressions of the function is less complicated.
It is useful to know the rule: complexity of the circuit is defined by total number of
inputs and outputs of gates used in the circuit. This number for uncomplemented expression of
function equals 14, for the complemented expression – 17+2 for inverter, that changes F to F.
Example 3.7
Minimize the logic function F(A,B,C,D)  m(3,4,6,7,9,11,12,14,15).
Solution
According to Karnaugh map
F(A,B,C,D) = p1+p2+p3 = ABD+CD+BD .
AB CD
00
01
11
00
F
10
p3
1
01
1
1
1
11
1
1
1
10
1
1
p2
p1
Example 3.7
Minimize the logic function F(A,B,C,D,E) entered into the map.
Solution
A0, BC DE
00
01
00
11
1
01
1
1
11
1
1
1
10
10
p4
1
p1
p2
26
A=1 BC DE
00
01
11
10
1
00
1
1
01
1
1
11
1
1
10
1
1
p3
1
3. Minimizing Logic Functions
Logic functions of 5 variables are reflected in two maps. In this case a new type of adjacency occurs
when one map is laid on another. Two pairs of 1s' laid one on another makes four (p2), and two fours makes
eight (p4).
F(A,B,C,D,E) = p1+p2+p3+p4 = ABCE+CDE+ACE+DE.
3.3.2. Reducing of Partially Reduced Functions
Sometimes a function is not expressed in either the standard form or a minimum form:
F(X,Y,Z)  X (Z + Y Z) + X (Z + Y Z)  X Z +X Y Z + X Z + X Y Z.
The function can now be expanded to the standard SOP form, but this procedure is not
obligatory. The pair of 1s in two adjacent squares with X = 1 and Z = 0 in both of them (circle
p1) reflects the product XZ. The pair of 1s in circle p5 reflects the product XZ. 1s in the squares
101 and 010 represent the products X Y Z and X Y Z.
p5
X YZ
00
0
1
p1
1
p4
01
11
10
1
1
1
1
p3
p6
1
p2
Notice that 1s in this map can form two variants of three pairs: p1, p2 and p3 or p4, p5 and p6.
It means that minimized function has two equivalent but different forms:
F(X,Y,Z) = p1+p2+p3 = XZ+YZ+XY
or
F(X,Y,Z) = p4+p5+p6 = XY+XZ+YZ .
3.3.3. Minimizing Functions with Don't Care Outputs
All the outputs of the functions we have covered thus far have been assigned a fixed value of 0
or 1 for all the combinations of input variables. Functions of this type are called completely or
fully specified functions. There are times, when certain input variable values may never occur.
The 8421 code, for example, has 4 bits to represent 10 coded values out of possible 16
combinations. Six of the combinations should not occur, but if they do and you don't care, the
outputs those occur from these combinations are classified as don't care outputs.
A don't care output is usually represented by symbols x in a truth table or Karnaugh map
or symbol d (dont care output), when a logic variable X is used. These symbols may be circled
with 1s in Karnaugh map enlarging the circles and providing a smaller number of letters in
simplified function, but it is not necessary to circle all x-es or d-es.
27
3. Minimizing Logic Functions
Example 3.8
Minimize the function entered to Karnaugh map.
Solution
X YZ
00
0
1
1
1
F
01
11
10
d
d
d
p2
d
p1
The circle p1 with 1s only gives a minimized function
F(X,Y,Z) = p1 = YZ ,
the circle p2 with 1s and d-es gives a minimized function
F(X,Y,Z) = p2 = Z.
CONTROL QUESTIONS AND PROBLEMS
3.1. The Postulates and Theorems of Boolean Algebra
3.1.1. Complete the equations:
A+0=
A 0 =
A+1=
A 1 =
A+A=
A A =
A+A=
A A =
3.1.2. Prove by perfect induction the theorem T9a: X + XY = X + Y.
3.2. Minimizing Boolean Functions Algebraically
3.2.1. Applying axioms and theorems minimize the logic functions:
a) ( A + B + A  B )  ( A + B + A  B ) ;
b) ( A + C) (A + D) (B+C) (B +D) .
3.2.2. Expand to the standard SOP form with three variables in every product:
a) F(X,Y,Z) = Y + X Z ;
b) F(A,B,C) = B + C .
28
3. Minimizing Logic Functions
3.3. Minimizing Functions Using Karnaugh Maps
3.3.1. Minimize the logic functions:
a) F(X,Y) =  m (2,3);
b) F(X,Y) =  m (0,1);
c) F(X,Y) =  M (1,3).
3.3.2. Minimize the logic functions of three variables:
a) F(X,Y,Z) =  m (0,2,3,6,7);
b) F(X,Y,Z) =  m (0,1,4,5,6,7).
3.3.3. Write compact and expanded SOP and POS forms of every function below:
a) F(A,B,C) =  M (2,3);
b) F(A,B,C) =  m (4,6) .
3.3.4. Minimize partially reduced functions:
a) F(X,Y,Z) = X  Y  Z + X  Y  Z + X Y ;
b) F(X,Y,Z) = X + X Z + X  Y + X  Y  Z .
3.3.5. Minimize the logic functions of four and five variables:
a) F(W,X,Y,Z) =  m (2,3,6,7,8,9,12,13);
b) F(V,W,X,Y,Z) =  m (3,5,8,9,10,11,13,17,19,24,25,26.27) .
3.3.6. Minimize the logic functions with don’t care outputs:
a) F(A,B,C) = (M (2,3)  x (4,6) );
b) F(A,B,C) =  (m (4,6) + x (0,1,2)) .
29
Download