gate level minimization - jufiles.comjufiles.com/wp-content/uploads/2016/12/lecture-7-1.pdf · gate...
TRANSCRIPT
Digital Logic Lecture 7
Gate Level Minimization
By
Ghada Al-Mashaqbeh
The Hashemite University
Computer Engineering Department
The Hashemite University 2
Outline
Introduction.
K-map principles.
Simplification using K-maps.
Don’t-care conditions.
The Hashemite University 3
Introduction
Gate level minimization (or simply simplification) is the process of finding the optimal implementation of a Boolean function that describes a logic circuit.
It is referred to reducing the terms or the literals or both in a Boolean function.
In the last chapter we have explored simplification using Boolean algebra laws.
In this chapter we will explore simplification using a graphical method known as Karnaugh map or K-map.
The K-map method is easy and straightforward not like the usage of Boolean algebra laws which is: difficult, requires smartness, and there are no specific rules for simplification, in addition to no guarantee is available that your work is right.
The Hashemite University 4
K-map
A K-map for a function of n variables consists of 2n cells (or squares), Each cell represents one minterm (or maxterm) in the truth
table of the function, in every row and column, two adjacent cells should differ in
the value of only one of the logic variables (in one bit only), recall the Gray Code.
From the map you can derive many equivalent expressions of the function, and your task is to select the simplest one.
The simplest expression is not always unique. Sometimes you can find more than one expression which can be denoted as the simplest one.
The function expression obtained from a K-map is always in the standard from (i.e. either SOP or POS).
K-map can be used for functions with up to 5 variables (or inputs) only.
The Hashemite University 5
Two-Variable K-map
4 minterms (or maxterms) in the map. The values of the first input A appear next to the
rows of the map. The values of the second input appear above the
columns of the map. On each side of the map there is one input. So,
only two values 0 and 1. Based on the values of the inputs you can
determine the minterm (or the maxterm) that represents the cell.
In this map it does not matter if you exchange the locations of the two inputs. But be careful when you expresses the minterms (or the maxterms) of each cell.
m0 m1
m2 m3
0
1
0 1 A
B
m0 m2
m1 m3
0
1
0 1 B
A
The Hashemite University 6
Three-Variable K-map
8 minterms (or maxterms) in the map. The values of the first input A appear next
to the rows of the map. The values of the second and the third
inputs appear above the columns of the map.
The values of the combined inputs are arranged as in the Gray code (only one bit changes when you move from one value to the next).
Based on the values of the inputs you can determine the minterm (or the maxterm) that represents a cell.
Again, it does not matter if you exchange the locations of the inputs. But be careful when you expresses the minterms (or the maxterms) of each cell.
m0 m1 m3 m2
m4 m5 m7 m6
00 01 11 10
0 1
A BC
m0 m4
m1 m5
m3 m7
m2 m6
0 1
00 01 11 10
BC
A
The Hashemite University 7
Four-Variable K-map I
16 minterms (or maxterms) in the map. The values of the first two inputs appear next to the rows of the
map. The values of the third and the fourth inputs appear above the
columns of the map. The values of the combined inputs are arranged as in the Gray
code (only one bit changes when you move from one value to the next).
Based on the values of the inputs you can determine the minterm (or the maxterm) that represents a cell.
Again, it does not matter if you exchange the locations of the inputs. But be careful when you expresses the minterms (or the maxterms) of each cell.
The Hashemite University 8
Four-Variable K-map II
0 1 3 2
4 5 7 6
12 13 15 14
8 9 11 10
00 01 11 10
00
01
11
10
AB CD
0 4 12 8
1 5 13 9
3 7 15 11
2 6 14 10
00 01 11 10
00
01
11
10
AB
CD
The Hashemite University 9
Function Mapping I
By function mapping we mean how to find the corresponding 1’s in the K-map that represents the function.
Why we need function mapping? Since to simplify a function using K-map we must group the
cells that contain 1’s to simplify the function as a SOP (we will see that to simplify a function as a POS we will group the cells that contains 0’s).
How to map a function to K-map? Using the truth table of the function.
From the function Boolean expression representation.
The Hashemite University 10
Function Mapping II
Example of function mapping using truth table:
F = (x+y)’
Truth table:
x y F
0 0 1
0 1 0
1 0 0
1 1 0
1 0
1
0 1 y
x
1 0
1
0 1 x
y
The Hashemite University 11
Function Mapping III
Five possible cases for mapping using the function Boolean expression:
Sum of minterms canonical form:
Put a 1 in the map in cell that represents a minterm contained within the function.
Product of maxterms canonical form:
Put a 1 in the map in cell that represents a maxterm not contained within the function (or put a 0 in the cell that represents a maxterm contained in the function).
The Hashemite University 12
Function Mapping IV
SOP standard form: Take each term within the function and determine which
rows and columns it contains within the map. Then put 1 in the cells that lies on the intersection of these rows and columns in the map.
POS standard form: Take each term within the function and determine which
rows and columns it contains within the map. Then put 0 in the cells that lies on the intersection of these rows and columns in the map. The rest of the cells that do not have 0’s will be 1’s.
Non-standard form: Convert it using Boolean algebra rules to SOP or POS
standard representation and follow one of the aforementioned procedures.
The Hashemite University 13
Adjacent Minterms or Maxterms I
Why to require that only one bit changes in the values of combined inputs? This is done to have any two adjacent cells (next to each other
vertically or horizontally but not diagonally) differ exactly in one literal.
This literal appears complemented in one minterm and noncomplemented in the other.
This literal will disappear when you combine these minterms (or maxterms) as will be shown.
Remember when you combine two minterms with an OR gate (sum of minterms) you can delete this literal from both minterms.
Example: In a 3-variable K-map m0 and m1 are adjacent. m0 + m1 = xyz + xyz’ = xy(z + z’) = xy.1 = xy (z disappeared)
The Hashemite University 14
Adjacent Minterms or Maxterms II
Lets have a look at adjacent maxterms: Remember that maxterms are combined using AND gate (product of
maxterms).
Example: In a 3-variable K-map M0 and M1 are adjacent. M0.M1 = (x+y+z)(x+y+z’) = xx+xy+xz’+xy+yy+yz’+xz+yz+zz’ = x+xy+xz’+y+yz’+xz+yz =x(1+z’) + y(1+z’)+xy+xz+yz =x+y+xy+xz+yz = x(1+z) + y(1+z)+xy = x+y+xy = x+y (z disappeared)
The Hashemite University 15
Adjacent Minterms or Maxterms III
Definition of adjacent minterms (maxterms): Minterm (maxterms) which are identical, except for one
variable, are considered to be adjacent to one another.
In a K-map, the corresponding cells in the top and the bottom rows are adjacent to each other.
Similarly the corresponding cells in the leftmost column and the rightmost column are adjacent to each other.
E.g.: In a 3-variable K-map, these cells are said to be adjacent cells: cell 0 is adjacent to cells 1, 4, 5, 2. And so on for all cells.
So, simply define the adjacent cells and then express the inputs values of these cells as either minterms (adjacent minterms) or as maxterms (adjacent maxterms).
The Hashemite University 16
Simplification Using K-maps
Using K-maps you can simplify a Boolean function as a:
SOP.
POS.
This means that the representation of the simplified version of the function will be either a SOP or POS depends on the application or the problem that you want to solve.
The Hashemite University 17
Simplification Using K-map (SOP Form) I
First: draw the suitable map based on the number of inputs found in the function.
Second: map the function to the K-map (define the locations of the 1’s of the function).
Third: define the adjacent cells as follows: Only combine cells that have 1 in them from the function output. You can combine 2, 4, 8, ..., etc. (i.e. a number that is power of 2),
adjacent cells in one group. Each group will be one term in the simplified version of the function. As possible each cell must participate in one group only unless it is
necessary. Do not recombine cells that are already found in other groups since this
will produce redundant terms (so your answer will not be the most simplified one).
Try to maximize the number of cells in each group as possible. For example: after grouping you have only one cell remained if there are adjacent cells to it that already grouped regroup this cell with them to find the maximum possible group.
The Hashemite University 18
Simplification Using K-map (SOP Form) II
Hints for adjacent cells grouping: Maximize the number of cells in each group as possible. Start with adjacent cells that have only one possible maximum group
to combine them. Finally, inspect the remaining ungrouped adjacent cells and try to
maximize their groups as possible. After grouping have a look at your map and see if there are redundant
and unnecessary groups that can be eliminated. Also, see if you can merge groups with each other to get larger group.
Make sure that all 1’s in the map are covered after grouping all adjacent cells.
Finally, combine the cells in each group by one product term (AND gate) in which: the variables that change in value (01 or 10) are deleted,
and only the variables that are constant (not changing) are stay. For these variables if its value is 1 they appear uncomplemented in the final product term and if they are 0 they appear complemented.
The Hashemite University 19
Simplification Using K-map (SOP Form) III
Results of groups combinations:
In a two-variable K-map: The combination of 1-cell group term with 2 literals.
The combination of 2-cell group term with 1 literals.
The combination of 4-cell group term with 0 literals (this means that F = 1 for all inputs combinations).
In a three-variable K-map: The combination of 1-cell group term with 3 literals.
The combination of 2-cell group term with 2 literals.
The combination of 4-cell group term with 1 literals.
The combination of 8-cell group term with 0 literals (this means that F = 1 for all inputs combinations).
The Hashemite University 20
Simplification Using K-map (SOP Form) IV
In a Four-variable K-map: The combination of 1-cell group term with 4 literals.
The combination of 2-cell group term with 3 literals.
The combination of 4-cell group term with 2 literals.
The combination of 8-cell group term with 1 literals.
The combination of 16-cell group term with 0 literals (this means that F = 1 for all inputs combinations).
In general, for a k-variable K-map and for m-cells group in that map the number of literals of the term that represents this group = k – n. where m = 2^n
The Hashemite University 21
Example I
Given F(A, B, C) = ∑(1, 4, 6), simplify F as a SOP using K-map.
Sol:
F = A’B’C + AC’
A
BC
1
0
10110100
1
1 1
The Hashemite University 22
Example II
Given F(x, y, z, w) = ∏(2,
6, 7, 9, 13, 15), simplify F as a SOP using K-map.
Sol:
F = x’z’ + xw’ + y’zw
xy
zw
10110100
1
1
1
00
01
11
10
1
1
1
1
1
1
1
The Hashemite University 23
Example III
Given
F(x, y, z, w) = z’ + xyz + xy’z’ + y’w simplify F as a SOP using K-map.
Sol:
F = z’ + xy + y’w
xy
zw
10110100
11
1
00
01
11
10
1
11
1
1
1
1
1
1
The Hashemite University 24
Example IV
Given
F(A, B, C) = C’(A + B)(A’ + C’) simplify F as a SOP using K-map.
Sol:
F = AB’
A
BC
1
0
10110100
1 1
The Hashemite University 25
Example V
Given
F(x, y, z, w) = z’ + xyz + x(y’ + z’) simplify F as a SOP using K-map.
Sol:
First convert F to a standard form SOP:
F = z’ + xyz + xy’ + xz’
Simplified F is:
F = z’ + x
xy
zw
10110100
11
1
00
01
11
10
1
11
1
1
1
1
1 1
The Hashemite University 26
Product of Sum Simplification
First: draw the suitable map based on the number of inputs found in the function.
Second: map the function to the K-map (define the locations of the 0’s of the function).
Third: define the adjacent cells and groups as in SOP simplification with the only difference that you group the cells that contains 0’s not 1’s.
Finally, combine the cells in each group by one sum term (OR gate) in which: the variables that change in value (01 or 10) are deleted,
and only the variables that are constant (not changing) are stay. For these variables if its value is 1 they appear complemented in the final sum term and if they are 0 they appear uncomplemented.
The Hashemite University 27
Example
Given
F(x, y, z, w) = z’ + xy’z’ + xyz simplify F as a POS using K-map.
Sol:
F = (z’ + x)(y + z’)
xy
zw
10110100
00
01
11
10
00
0 0
00
The Hashemite University 28
Complement of a Function From the K-map
You can obtain a simplified version of the complement of a function from its K-map as follows: Draw the K-map F’ which is the same as
the K-map for F except that it has 1’s in the cells that have 0 in the K-map of F.
Now deal with the new K-map as we have learned before and simplify F’ as either POS or SOP.
The Hashemite University 29
Don’t-Care Conditions I
In some applications we are not interested in the output of a function for specific input combinations. So, either it is zero or 1 it is not important to know its actual value.
For example: for a 2-input AND gate if the one is 0 the value of the other input has no effect. So, whether it is 1 or 0 the output of the AND gate will be 0 for all possible cases.
Such functions are called incompletely specified functions.
The unspecified minterms in such functions are called don’t care conditions.
The Hashemite University 30
Don’t-Care Conditions II
Don’t care conditions can greatly help in simplifying the functions more.
Mark these unspecified minterms as X in the map.
While grouping of adjacent cells you can assume these X as either 0 (POS simplification) or 1 (SOP simplification) to obtain larger groups.
Leave unused X’s without grouping since they will result in additional terms in the result.
The Hashemite University 31
Example I
Given F(x, y, z, w) = ∑(1, 8, 9, 12) + d ∑(0, 4, 15, 14), simplify F as a SOP using K-map.
Sol:
F = z’w’ + y’z’
xy
zw
10110100
00
01
11
10
X
X X
X 1
11
1
The Hashemite University 32
Example II
Given F(x, y, z, w) = ∑(1, 8, 9, 12) + d ∑(0, 4, 15, 14), simplify F as a POS using K-map.
Sol:
F = z’(y’ + w’)
xy
zw
10110100
00
01
11
10
00
0 0
00
0
0X
X X
X
The Hashemite University 33
Additional Notes
This lecture covers the following material from the textbook:
Chapter 3: Sections 3.1 – 3.6, and parts of section 3.9