You are on page 1of 27

Digital Electronics

EEE211
Lecture 7

Dr Atiqur Rahman
Dept. of Electrical and Computer Engineering
North South University
Four-Variable K-Map

yz Y Y
wx 00 01 11 10

00 m0 = w x y z m1 = w x y z m3 = w x y z m2 = w x y z X
W
01 m4 = w x y z m5 = w x y z m7 = w x y z m6 = w x y z
X
11 m12 = w x y z m13 = w x y z m15 = w x y z m14 = w x y z
W
10 m8 = w x y z m9 = w x y z m11 = w x y z m10 = w x y z X
Z Z Z
4-Variable K-map Terms

 4-variable K-maps can have rectangles corresponding to:


• Single square = 4-variable minterm
• 2 combined squares = 3-variable term
• 4 combined squares = 2-variable term
• 8 combined squares = 1 variable term
• 16 (all) combined squares = constant ‘1’
Combining Eight Squares

• Examples of 8-square Rectangles:


Y
Z

0 1 3 2

W
4 5 7 6

X
12 13 15 14

W
8 9 11 10

Z
Combining Four Squares

• Examples of 4-square Rectangles:


XZ Y
XZ
WY
0 1 3 2

4 5 7 6

X
12 13 15 14

W
8 9 11 10

Z
Combining Two Squares
• Examples of 2-square Rectangles:
WXZ Y
XYZ WYZ
0 1 3 2

4 5 7 6

X
12 13 15 14

W
8 9 11 10
WXZ

Z
Simplifying 4-Variable Functions

• F(W, X, Y, Z) = ∑ (0, 2, 4, 5, 6, 7, 8, 12)


YZ Y WZ

1 0 1 3 1 2

WX 1 4 1 5 1 7 1 6
X
1 12 13 15 14
W
8 9 11 10
1

Z
F=WX+YZ+WZ
Product-of-Sum (POS) Simplification
• F (W, X, Y, Z) = ∑ (1, 2, 3, 9, 10, 11, 13, 14, 15)
• F = WZ +WY +X Z +XY (G = 8+4 = 12)

• F (W, X, Y, Z) = ∑ (0, 4, 5, 6, 7, 8, 12) = Y Z + W X


• F = Y Z + W X = (Y + Z) (W + X) (G = 4+2 = 6)

F
Y Y
0 1 3 2 0 1 3 2
1 1 1 1
4 5 7 6 6
14 1 5
1
7
1
12 13 15 14
X 12 13 15 14
X
1 1 1 1
W 8 9 11 10
W 8 9 11 10
1 1 1 1
Z Z
Product-of-Sum Simplification

• Step 1: Draw the K-map for F, replacing the 0’s of F


with 1’s in F and vice versa
• Step 2: Obtain a minimal Sum-of-Product (SOP)
expression for F
• Step 3: Use DeMorgan’s Theorem to obtain F = F
The result is a minimal Product-of-Sum (POS)
expression for F
• Step 4: Compare the cost of the minimal SOP and POS
expressions to find which one is better
Five-Variable K-Maps

• For five variable problems, we use two adjacent 4-variable


K-maps that can be visualized to be on top of each other
• Each square in the A=0 map is adjacent to the
corresponding square in the A=1 map (e.g. m4 and m20)
A=0 A=1
D D
0 1 3 2 16 17 19 18

4 5 7 6 20 21 23 22

12 13 15 14
C 28 29 31 30 C

B 8 9 11 10 B 24 25 27 26

E E
Example of a Five-Variable K-map

• F(A, B, C, D, E) = ∑(0, 1, 8, 9, 16, 17, 22, 23, 24, 25)


• F= CD +AB CD

A=0 A=1
D D
16 17 19 18
10 11 3 2
1 1
4 5 7 6 20 21 23 22
1 1
12 13 15 14
C 28 29 31 30 C

B 8 9 11 10 B 24 25 27 26
1 1 1 1

E E
Don't Cares in K-Maps
• Sometimes a function table or K-map contains entries for
which it is known:
– The input values for the minterm will never occur, or
– The output value for the minterm is not used
• In these cases, the output value need not be defined
• Instead, the output value is defined as a “don't care”
• By placing “don't cares” ( an “x” entry) in the function table
or map, the cost of the logic circuit may be lowered.
• Example: A logic function having the binary codes for the
BCD digits as its inputs. Only the codes for 0 through 9 are
used. The six codes, 1010 through 1111 never occur, so the
output values for these codes are “x = don’t cares.”
Example: BCD “5 or More”
• The map below gives a function F(w,x,y,z) which is
defined as "5 or more" over BCD inputs. With the don't
cares used for the 6 non-BCD combinations:
• If the don’t cares were treated as 0’s we get:
F1 = w x z + w x y + w x y (G = 12)
y
• If the don’t cares were 1’s we get:
00 01 03 02
F2 = w + x z + x y (G = 7 better)
04 15 17 16
The selection of don’t cares depends on which x
combination gives the simplest expression X12 X13 X15 X14
w
1 8 1 9 X11 X10

z
Product-of-Sums Example

• Find the optimum POS expression for :


F(A, B, C, D) = ∑ (3,9,11,12,13,14,15) + ∑d (1,4,6)
Where ∑d indicates the don’t care minterms
• Solution: Find F =∑ (0, 2, 5, 7, 8, 10) + ∑d (1,4,6)
• F=BD+AB F C
1 0 X1 12
• Optimum POS expression: 3

X4 1 5 1 7 X6
F = (B + D) (A + B) B
12 13 15 14
Gate input cost (G = 6) A
18 1 10
9 11

D
Systematic Simplification
 A Prime Implicant is a product term obtained by combining the
maximum possible number of adjacent squares in the map into a
rectangle, with the number of squares equal to a power of 2

 A prime implicant is called an Essential Prime Implicant if it is


the only prime implicant that covers one or more minterms

 Prime Implicants and Essential Prime Implicants can be


determined by inspection of a K-Map

 A set of prime implicants covers all minterms if, for each


minterm of the function, at least one prime implicant in the set
of prime implicants includes the minterm
Example of Prime Implicants
• Find ALL Prime Implicants
Prime Implicant Practice
• Find all prime implicants for
F(A, B, C, D) = ∑ (0,2,3,8,9,10,11,12,13,14,15)
BD
C

3 prime implicants: 1 0 1 1 3 1 2 BC
A, B C, B D
All 3 prime implicants are essential
4 5 7 6

B
1 12 1 13 1 15 1 14
A
A 8 9 11 10
1 1 1 1

D
Optimization Algorithm

• Find all prime implicants


• Include all essential prime implicants in the solution
• Select a minimum cost set of non-essential prime
implicants to cover all minterms not yet covered
• Prime implicant selection rule:
– Minimize the overlap among prime implicants
– In particular, in the final solution, make sure that each
prime implicant selected includes at least one minterm not
included in any other prime implicant selected
Selection Rule Example
• Simplify F(A, B, C, D) given on the K-map
Selection Rule Example with Don't Cares
• Simplify F(A, B, C, D) given on the K-map.
Selected Essential
C C

1 x 1 x

1 x x 1 1 x x 1
B B
x x
A A
1 1 x 1 1 x

D D
Minterms covered by essential prime implicants
Multiple-Level Optimization

• Multiple-level circuits - circuits that are more than


two levels (inverters are not counted)

• Multiple-level circuits can have reduced gate input


cost compared to two-level (SOP and POS) circuits

• Multiple-level optimization is performed by


applying transformations to circuits represented by
equations while evaluating cost
Transformations
• Factoring: finding a factored form from SOP or
POS expression
• Decomposition: expressing a function as a set of
new functions
• Substitution of H into F: Expressing F as a function
of H and some of its original variables
• Elimination: Inverse of substitution, called also
flattening
• Extraction: decomposition applied to multiple
functions simultaneously
Factoring Example

• Algebraic Factoring
F=ACD+ABC+ABC+ACD (G = 16)
• Factoring:
F = A (C D + B C) + A (B C + C D) (G = 16)
• Factoring again:
F = A C (B + D) + A C (B + D) (G = 12)
• Factoring again:
F = (A C + A C) (B + D) (G = 10)
This factoring example has reduced G from 16 to 10
Resulting circuit has three levels plus input inverters
Decomposition Example
• Given the following function:
F = (A (B + C) + D) (B + C) (G = 10)
• Define 2 new functions X and Y as follows:
X = (B + C) and Y = (A X + D)
• Then function F can be decomposed as follows:
F = X Y, where
X = (B + C) and
Y = (A X + D) (G = 8)
Substitution Example

• Given the following function:


H = A(C + D)(E + F) + B C D E F (G = 14)
• Define X and Y as new functions :
X = C D and Y = E + F
• The complement of X and Y are:
X = (C + D) and Y = E F
• Substitute C D with X and (C + D) with X
Substitute (E + F) with Y and E F with Y
H=AXY+BXY
where, X = C D and Y = E + F (G = 12)
Elimination Example
• Given a set of functions:
X = B+C, Y = A+B, and Z = A X + C Y (G = 10)
• Eliminate X and Y from Z:
Z = A (B + C) + C (A + B) (G = 10)
• Flatten Z (Convert to SOP expression):
Z=AB+AC+AC+BC (G = 12)
• Two-Level Optimization (using K-map):
Z=AB+C (G = 4)
This example shows that elimination begins with any set of
functions. It can increase gate input cost (G) temporarily, but
can result in a final solution with optimum cost (G)
Extraction Example

• Given the following two functions:


E =ABD+ABD
H=BCD+BCD (G = 16)
• Find a common factor for E and H
• Define the common factor as a function:
F=BD+BD
• Perform extraction by expressing E and H as a
function of F:
F = B D + B D, E = A F, H = C F (G = 10)
• Reduced cost because of the sharing of F

You might also like