EEE241 Digital Logic Design (DLD)
Lecture 9 – Gate-level minimization
Dr. Muhammad Rizwan Azam
COMSATS University Islamabad (CUI) Islamabad, Pakistan.
Lecture Outline
• Gate-level minimization (Optimization)
• Using Boolean Algebra
• Using Karnaugh Map (K-map)
• K-Map
• Two-Variable Map
• Three-Variable Map
Gate-level Optimization
• Goal:
• To obtain simplest implementation for given function
• What is a simplest expression?
• Minimum number of terms and with the smallest possible number
of literals in each term
• Expression produces a circuit diagram with a minimum number of
gates and the minimum number of inputs to each gate
• Simplest expression may not be unique! (To be explained later)
• Optimization is a more formal approach to simplification that
is performed:
• Manually
• Using a specific procedure/algorithm
Gate-level Optimization
• Manual Methods:
• Based on Boolean algebra
• Graphical method based on K-map
• Demerits of Boolean algebra-based methods:
• Awkard (lacks specific rules)
• Different treatment as per problem in hand
Review of Boolean Function
• Boolean function
• Sum of minterms
• Sum of products (or product of sum) in the simplest form
• A minimum number of terms
• A minimum number of literals
• The simplified expression may not be unique
The Map Method
• Logic minimization - The Karnaugh map
• A simple straight forward procedure
• A pictorial form of a truth table
• A diagram made up of squares
• Each square represents one minterm
• What about squares?:
• No. of squares = No. of combinations
• 2 variables → 4 squares
• 3 variables → 8 squares
• 4 variables → 16 squares
The Map Method
• Steps:
• From expression, draw the required no. of boxes
• (If not already) Express function in sum of minterms
• Input the function → K-map (insert ‘1’ as appropriate)
• Group adjacent squares containing ‘1’ (2,4,8,…)
• Write same/common variables (or their compliments)
• Simply add them
K-Map Rules
• No zeros allowed.
• No diagonals.
• Only power of 2 number of cells in each group.
• Groups should be as large as possible.
• Each cell containing a ’one’ must be in at least one group.
• Overlapping allowed.
• Wrap around allowed.
• Fewest number of groups possible.
Two-Variable Map
• A two-variable map
• Four minterms
• x' = row 0; x = row 1
• y' = column 0; y = column
1
• A truth table in square
diagram
Figure 3.1 Two-variable Map
• Fig. 3.2(a): xy = m3
• Fig. 3.2(b): x'y+xy' +xy =
m1+m2+m3 = x+y
• Note: Adjacent squares
horizontally and vertically,
NOT diagonally
Figure 3.2 Representation of functions in the map
A Three-variable Map
• A three-variable map
• Eight minterms
• The Gray code sequence
• Any two adjacent squares in the map differ by only on variable
• Primed in one square and unprimed in the other
Figure 3.3 Three-variable Map
A Three-variable Map
x y z Minterm F
0 0 0 0 m0 x y z 0
1 0 0 1 m1 x y z 0
2 0 1 0 m2 x y z 1
3 0 1 1 m3 x y z 1
4 1 0 0 m4 x y z 1
5 1 0 1 m5 x y z 1
6 1 1 0 m6 x y z 0
7 1 1 1 m7 x y z 0
A Three-variable Map
• From the postulates of Boolean algebra, it follows that the
sum of two minterms in adjacent squares can be simplified to
a single product term consisting of only two literals.
• e.g., m5 and m7 can be simplified
• m5+ m7 = xy'z + xyz = xz (y'+y) = xz
• m0 and m2 (m4 and m6) are adjacent
• m0+ m2 = x'y'z' + x'yz' = x'z' (y'+y) = x'z'
• m4+ m6 = xy'z' + xyz' = xz' (y'+y) = xz'
Three-Variable K - Map
yz
F x yz x 00 01 11 10
0 1
1
One square represents one minterm, giving a term with three
literals
yz
x 00 01 11 10
F xz 0 1 1
1
Two adjacent squares represent a term with two literals
Three-Variable K - Map
yz
F z x 00 01 11 10
0 1 1
1 1 1
Four adjacent squares represent a term with one
literal
yz
x 00 01 11 10
F 1 0 1 1 1 1
1 1 1 1 1
Eight adjacent squares encompass the entire map
and always produces F = 1
Three-Variable K - Map
• Groups may wrap around the table.
• The leftmost cell in a row may be grouped with the rightmost
cell and the top cell in a column may be grouped with the
bottom cell.
yz Top Cell
x 00 01 11 10
0 1 0 0 1
Left Most Cell Right Most Cell
1 1 0 0 1
Bottom Cell
Example 3.1
• Simplify the Boolean function
Y
yz
x 00 01 11 10
0 0 0 1 1 X’ Y
1 1 1 0 0 X Y’
Y’
F xy xy
Example 3.2
• Example 3.2: simplify F(x, y, z) = S(3, 4, 6, 7)
• F(x, y, z) = S(3, 4, 6, 7) = yz+ xz'
Figure 3.5 Map for Example 3-2; F(x, y, z) = Σ(3, 4, 6, 7) = yz + xz'
Four adjacent Squares
• Consider four adjacent squares
• 2, 4, and 8 squares
• m1+m3+m5+m7 = x'y'z+x'yz+xy'z+xyz =x'z(y'+y) + xz(y'+y)
=x'z + xz = z
• m0+m2+m4+m6 = x'y'z'+x'yz'+xy'z'+xyz' = x'z'(y'+y) +xz'(y'+y)
= x'z' + xz‘ = z'
Example 3.3
• Simplify F(x, y, z) = S(0, 2, 4, 5, 6)
• F(x, y, z) = S(0, 2, 4, 5, 6) = z'+ xy'
Figure 3.6 Map for Example 3-3, F(x, y, z) = Σ(0, 2, 4, 5, 6) = z' +xy'
Example 3.4
• Let F = A'C + A'B + AB'C + BC
a) Express it in sum of minterms.
b) Find the minimal sum of products expression.
Ans: The function in sum of minterms and simplified SoPs form:
F(A, B, C) = S(1, 2, 3, 5, 7)
F(A, B, C) = C + A’B
Figure 3.7 Map for Example 3.4, A'C + A'B + AB'C + BC = C + A'B
Four-Variable Map
• 16 minterms
• Combinations of 2, 4, 8, and 16 adjacent squares
• One square represents one minterm, giving a term with four
literals.
• Two adjacent squares represent a term with three literals.
• Four adjacent squares represent a term with two literals.
• Eight adjacent squares represent a term with one literal.
• Sixteen adjacent squares produce a function that is always
equal to 1.
Four-Variable Map
w x y z Minterm
0 0 0 0 0 m0 wxyz
1 0 0 0 1 m1 wxyz
2 0 0 1 0 m2 wx yz
3 0 0 1 1 m3 wx yz
4 0 1 0 0 m4 wxyz
5 0 1 0 1 m5 wxyz
6 0 1 1 0 m6 wxyz
7 0 1 1 1 m7 wxyz
8 1 0 0 0 m8 wx y z
9 1 0 0 1 m9 wx y z
10 1 0 1 0 m10 wx y z
11 1 0 1 1 m11 wx y z
12 1 1 0 0 m12 wx y z
13 1 1 0 1 m13 wx y z
14 1 1 1 0 m14 wx y z
15 1 1 1 1 m15 wx y z
Example 3.5
• Simplify F(w, x, y, z) = S(0, 1, 2, 4, 5, 6, 8, 9, 12, 13, 14)
F = y'+w'z'+xz'
Figure 3.9 Map for Example 3-5; F(w, x, y, z) = Σ(0, 1, 2, 4, 5, 6, 8, 9, 12, 13, 14) = y' + w' z' +xz'
Example 3.6
• Simplify F = ABC + BCD + ABCD + ABC
𝐹(A,B,C,D)=∑(0,1,2,6,8,9,10)
Figure 3.9 Map for Example 3-6; ABC + BCD + ABCD + ABC= BD + BC
+ACD