You are on page 1of 53

CHAPTER 2 Logic Simplification

Karnaugh Maps

NurulHazlina/BEE2243/Glitches

Introduction
Merit of a network include

Propagation delay Reliability Cost

In this course, unless otherwise specified, the cost of a network is defined to be the total number of gates plus the total number of gate inputs. Solutions -> Simplification of design (Boolean Equation)
NurulHazlina/BEE2243/Logic

Simplification Methods

A graphic method that can handle Boolean expressions up to 6 variables Karnaugh maps A tabular method that has no limit on the number of variable and can be implemented on a computer Quine-McCluskey method

NurulHazlina/BEE2243/Logic

Karnaugh Maps

The Karnaugh map of a function consists

a number of cells (squares) - equal to number of its minterms.

Possibilities of simplification is signified by the presence of 1s occupying adjacent cells. Conceptually, it may be useful to think of a Karnaugh map as a different form of the truth table. Each row of the truth table is embedded in a cell in the map in such a way that the possibility of simplification becomes obvious.

NurulHazlina/BEE2243/Logic

Karnaugh Map Method


hard to draw cubes of more than 4 dimensions K-map is an alternative method of representing the truth table that helps visualize adjacencies in up to 6 dimensions Beyond that, computer-based methods are needed
A B 0 0 0 1 1 2 3 01 1 AB C 00 0 0 1 1 2 3 B 6 7 4 5 01 11 A 10 C 10 11 3 2 5 7 6 13 15 14 9 11 10 D 1 AB CD 00 00 0 01 4 11 12 A 00 8

2-variable K-map

3-variable K-map

ECE C03 Lecture 2

4-variable K-map B Numbering Scheme: 00, 01, 11, 10 Gray Code only a single bit changes from code word to next code word
5

Karnaugh Map Examples


A B 0 1 0 0 0 1 1 1 A

A asserted, unchanged B varies B complemented, unchanged A varies

B 0 1

0 1 0

1 1 0

F=A
A B Cin 0 1 00 0 0 01 0 1 11 1 1 A 10 0 1

G = B'

AB C 0 1

A 00 0 0 01 0 0 B 11 1 1 10 1 1

Cout = A B + B Cin + A Cin


ECE C03 Lecture 2

F(A,B,C) = A
6

More Karnaugh Map Examples


AB C 0 1 00 1 0 01 0 0 B 11 0 1 A 10 1 1

F(A,B,C) = Sm(0,4,5,7) F = B' C' + A C In the K-map, adjacency wraps from left to right and from top to bottom

AB C 0 1

A 00 0 1 01 1 1 B 11 1 0 10 0 0

F' simply replace 1's with 0's and vice versa


F'(A,B,C) = Sm(1,2,3,6) F' = B C' + A' C Compare with the method of using De Morgan's Theorem and Boolean Algebra to reduce the complement!
ECE C03 Lecture 2 7

Karnaugh Map Examples (4 variables)


AB CD 00 01 11 C 10 1 1 B
1011 0111 0011 0010 1010 1110 0110 1001 C D 0000 0001 A B 0100 0101 1100 1000 ECE C03 Lecture 2 1101 1111

A 00 1 0 1 01 0 1 1 11 0 0 1 1 10 1 0 D 1 1

F(A,B,C,D) = Sm(0,2,3,5,6,7,8,10,11,14,15)
F = C + A' B D + B' D'

Find the smallest number of the largest possible subcubes that cover the ON-set

K-map Corner Adjacency Illustrated in the 4-Cube

Karnaugh Maps: Circling zeros


AB CD 00 01 11 C 10 1 1 B 1 1 A 00 1 0 1 01 0 1 1 11 0 0 1 10 1 0 D 1

F = (B + C + D) (A + C + D) (B + C + D)

Replace F by F, 0s become 1s and vice versa F=BCD+ACD+BCD

F=BCD+ACD+BCD
F = (B + C + D) (A + C + D) (B + C + D)
ECE C03 Lecture 2 9

Karnaugh Map Dont Cares


Don't Cares can be treated as 1's or 0's if it is advantageous to do so
AB CD 00 01 11 C 10 0 X B 0 0 A 00 0 1 1 01 0 1 1 11 X X 0 10 0 1 D 0

F(A,B,C,D) = Sm(1,3,5,7,9) + Sd(6,12,13) F = A'D + B' C' D w/o don't cares F = C' D + A' D w/ don't cares

By treating this DC as a "1", a 2-cube can be formed rather than one 0-cube
AB CD 00 01 A 00 0 1 1 0 01 0 1 1 X B 11 X X 0 0 10 0 1 D 11 0 0 C 10

In PoS form: F = D (A' + C') Same answer as above, but fewer literals

ECE C03 Lecture 2

10

Algorithm: Minimum SOP from K-Map


Step 1: Step 2: Choose an element of ON-set not already covered by an implicant Find "maximal" groupings of 1's and X's adjacent to that element. Remember to consider top/bottom row, left/right column, and corner adjacencies. This forms prime implicants (always a power of 2 number of elements).

Repeat Steps 1 and 2 to find all prime implicants Step 3: Revisit the 1's elements in the K-map. If covered by single prime implicant, it is essential, and participates in final cover. The 1's it covers do not need to be revisited If there remain 1's not covered by essential prime implicants, then select the smallest number of prime implicants that cover the remaining 1's

Step 4:

ECE C03 Lecture 2

11

Example: (A,B,C,D) = m(4,5,6,8,9,10,13) + d(0,7,15)


AB CD 00 01 11 C 10 0 1 B 0 1 A 00 X 0 0 01 1 1 X 11 0 1 X 10 1 1 D 0 C 10 0 1 B 0 1 11 0 X X 0
C 10 0 1 B 0 1

AB CD 00 01

A 00 X 0 01 1 1 11 0 1 10 1 1 D

AB CD 00 01 11

A 00 X 0 0 01 1 1 X 11 0 1 X 10 1 1 D 0

Initial K-map

Primes around A' B C' D'

Primes around A B C' D

ECE C03 Lecture 2

12

Example Continued
AB CD 00 01 11 C 10 0 1 B 0 1 A 00 X 0 0 01 1 1 X 11 0 1 X 10 1 1 D 0 C 10 0 1 B 0 1 11 0 X X 0 C 10 0 1 B 0 1 AB CD 00 01 A 00 X 0 01 1 1 11 0 1 10 1 1 D 11 0 X X 0 AB CD 00 01 A 00 X 0 01 1 1 11 0 1 10 1 1 D

Primes around A B C' D

Primes around A B' C' D'

Essential Primes with Min Cover

ECE C03 Lecture 2

13

Karnaugh Maps
Map of a function of 2 variables

NurulHazlina/BEE2243/Logic

Karnaugh Maps
Map of a function of 3 variables

NurulHazlina/BEE2243/Logic

Karnaugh Maps
Map of a function of 4 variables

NurulHazlina/BEE2243/Logic

Karnaugh Maps
Map of function of five variables f(v, w, x, y, z)

NurulHazlina/BEE2243/Logic

Karnaugh Maps
Maps with cells designated by decimal numbers

NurulHazlina/BEE2243/Logic

Karnaugh Maps
Typical subcubes for elimination

NurulHazlina/BEE2243/Logic

Karnaugh Maps
The map for f(w,x,y,z) = m(1,2,3,5,6,7,8,13)

NurulHazlina/BEE2243/Logic

Karnaugh Maps
The map of f = xy + wxz + wxyz

NurulHazlina/BEE2243/Logic

Karnaugh Maps
Map for the functions f(w,x,y,z) = m(1,3,4,5,6,7,11,14,15)

NurulHazlina/BEE2243/Logic

Karnaugh Maps
f(w,x,y,z) = m(0,3,7,8,12) + dc(5,10,13,14).

NurulHazlina/BEE2243/Logic

Variable-entered Karnaugh Maps


x y z f
f f0.z + f1.z f2.z + f3.z f4.z + f5.z f6.z + f7.z fi fj fi.v + fj.v 0+0=0 0+v=v v+0=v v+v=1
MapEntry

y
0
0

0
0 0 0

0
0 1 1

0
1 0 1

f0
f1 f2 f3

f0.z + f1.z f4.z + f5.z

f2.z + f3.z f6.z + f7.z

1
1 1

0
0 1

0
1 0

f4
f5 f6
00 01

yz
11 10

0 0 0 1 1 0

0 1

f0
f4

f1
f5

f3
f7

f2
f6

v
v 1

f7

1 1
NurulHazlina/BEE2243/Logic

Variable-entered Karnaugh Maps


Variable-entered map.

NurulHazlina/BEE2243/Logic

Variable-entered Karnaugh Maps

Variable-entered maps grouping techniques z

NurulHazlina/BEE2243/Logic

Variable-entered Karnaugh Maps

Optimal groupings on a variable-entered map

NurulHazlina/BEE2243/Logic

VEM : Minimization Procedure

STEP1: Form an optimal collections of subcubes involving the literal z using the cells containing 1s as dont-care cells and the cells containing the literal z as 0-cell.
STEP2: Form an optimal collection of subcubes involving the 1-cell not completely covered in STEP1 by replacing the literals z and z with 0 and 1-cell that is completely covered with dontcares.
NurulHazlina/BEE2243/Logic

Example1
yz 00 01 11 10

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 1 1 1 0 0 1 0 0

M 1 z z 0

x 0 1

1 0

1 1

0 0

1 0

yz + xz

1 z

z 0

NurulHazlina/BEE2243/Logic

VEM with z as map entered variable

Example2
w 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 x 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 y 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 z 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 f 0 1 1 1 0 0 1 1 0 0 1 0 0 0 1 1
Map

00 0 w 1

xy 01 11

10

z 0
00

1 z

1 1

0 0
10

z 1
w

xy 01 11

0 1

z 0
00

0
1

1 z

1 1

0 0
10

xy 01 11

0
z

w 1

z 0
00

1 z

1 1

0 0
10

xy 01 11

0
1

0 w 1

0 0

-0

1 1

0 0

Example3

w 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

x 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1

y 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1

z 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

f 0 1 0 0 1 1 0 1 0 1 1 0 0 0 1 1

Map z 0 1 z z

z
0

NurulHazlina/BEE2243/Logic

Cont : Example3
00 0 w 1

xy 01

xy 11 10 00 0 w 1 01 11 10

z
Z

0
z
xy 01

z
1

1
0

z z

0 z
xy 01

z 1

1 0

00 0 w 1

11

10

00 0 w 1

11

10

0 0

0 0

0 --

1 0

NurulHazlina/BEE2243/Logic

Cont : Example4
00
0 w 1 xy 01

11

10

00
0 w 1

xy 01

11

10

z z

z 1
xy 01

z z

z z

z z

z 1
xy

z 0

z z

00

11

10

00 0 w 1

01

11

10

0
w 1

z
z

z
1

z
z

z z

z z

z 1

z 0

z z

NurulHazlina/BEE2243/Logic

Variable-entered Karnaugh Maps


Minimization through a map with single-variable entries

NurulHazlina/BEE2243/Logic

Minimal POS : Example1


x 0 y 0 z 0 f 1

0
0 0 1 1 1 1

0
1 1 0 0 1 1

1
0 1 0 1 0 1

1
1 0 0 1
x 1 0

1 z

z 0

0 (c) VEM with z as map entered variable NurulHazlina/BEE2243/Logic 0

Minimal POS : Example2


w 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 x 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 y 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 z 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 f 0 1 1 1 0 0 1 1 0 0 1 0 0 0 1 1 Map z 1 0 1 0 z 0 1

Cont : Example2
xy 00 0 w 1 01 11 10 xy

00
0 w 1

01

11

10

z 0

1 z
xy

1 1

0 0

1 0

1 z
xy 01

1 1

0 0

00

01

11

10

00

11

10

0
w 1

z 0

1 1

1 1

0 0
w

0
1

1 --

1 1

1 1

0 0

NurulHazlina/BEE2243/Logic

Minimal POS : Example3


w 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 x y z f 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 0 1 0 1 0 1NurulHazlina/BEE2243/Logic 1 0 1 1 1 1 1
Map

z 0 1

z
z

z
0 1

Cont : Example3
xy xy

00
0 w 1

01

11

10

00
0 w 1

01

11

10

z z

0 z

z 1

1 0

1 1

0 z

1 1

1 0

xy 00 0 w 1 01 11 10 00 0 w 1 01

xy 11 10

z z

0 1

z 1

1 0

1 1

-1

1 1

1 0

NurulHazlina/BEE2243/Logic

Minimal SOP
z z z z 1 z

Minimal POS
z
0
0
0

y
1

x
1

1 z

z 0

1
z

0
z

-0

0
0
NurulHazlina/BEE2243/Logic

Incompletely Specified Functions

Single-variable map entries for incompletely specified (i.e having dont-cares) Boolean functions

NurulHazlina/BEE2243/Logic

Incompletely Specified Functions

Step 1: Form an optimal collections of subcubes involving the single literal; z or z,using the cells containing 1s, Xs and double entries with 1 constant as dontcare cells. Double entries with 0 constant part can be used as dontcares for subcubes that agree with the literal part of the double entry.
NurulHazlina/BEE2243/Logic

Incompletely Specified Functions

STEP2:

Replace the single literal entries; z and z, by 0. Retain the single 0 and Xs entries Replace each single 1 entry by a dont care if it was covered in step 1. Otherwise, retain the single entry. Replace the double entries having having a 0 constant by 0. Replace each double entries with 1 constant by a X if the cell was used in step 1 to form at least one subcube agreeing with the literal parts; otherwise replace the double entry having a constant 1 by a 1.
NurulHazlina/BEE2243/Logic

Examples
1.

Obtaining a minimal sum for the incompletely specified Boolean funciton f(w,x,y,z) = m(3,5,6,7,8,9,10) + dc(4,11,12,14,15) using a variable-entered map. (a) Truth table. (b) Variable-entered map. (c) Step 1 map and subcubes. (d) Step 2 map and subcubes. Obtaining a minimal sum for the incompletely specified Boolean function f(w,x,y,z) = m(0,4,5,6,13,14,15) + dc(2,7,8,9) using a variable-entered map. (a) Truth table. (b) Step 1 map and subcubes. (c) Step 2 map and subcubes. Obtaining a minimal product for the incompletely specified Boolean function f(w,x,y,z) = m(0,4,5,6,13,14,15) + dc(2,7,8,9) using a variable-entered map. (a) Step 1 map and subcubes. (b) Step 2 map and subcubes.

2.

3.

NurulHazlina/BEE2243/Logic

x 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1

y 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1

z 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

f 0

Map entry

Answers
Question 1 Obtaining a minimal sum for the incompletely specified Boolean funciton f(w,x,y,z) = m(3,5,6,7,8,9,10) + dc(4,11,12,14,15) using a variableentered map. (a) Truth table. (b) Variable-entered map. (c) Step 1 map and subcubes. (d) Step 2 map and subcubes.

0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

0 0 0 z 1 z,1 1 1 1 1 1 1 1 1 z,1 z,0 0 -

Answers
xy w 0 1 00 0 1 01 z z,1 xy 11 1 10 z,1 z,0 w 0 1 xy

00 0
1

01 0
1

11 1
-

10 1
0

w 0
1

00 0 1

01 z z,1

11 1 -

10 z,1 z,0 Used as 1-cell

NurulHazlina/BEE2243/Logic

x 0 0 0 0 1 1 1 1 0

y 0 0 1 1 0 0 1 1 0

z 0 1 0 1 0 1 0 1 0

f 1

Map entry

Answers
Question 2 Obtaining a minimal sum for the incompletely specified Boolean function f(w,x,y,z) = m(0,4,5,6,13,14,15) + dc(2,7,8,9) using a variable-entered map. (a) Truth table. (b) Step 1 map and subcubes. (c) Step 2 map and subcubes.

0 0 0 0 0 0 0 0 1

z 0 z,0 0 1 1 1 1 z,1 -

1
1 1 1 1 1 1

0
0 0 1 1 1 1

0
1 1 0 0 1 1

1
0 1 0 1 0 1

0 0 0 0 z 1 1 1 1

Answers

xy

xy 10 1 z

w 0
1

00 z -

01 z,0 0

11 z,1 1

w 0
1

00 0 -

01 0 0

11 1

10 0

NurulHazlina/BEE2243/Logic

Obtaining a minimal product for the incompletely specified Boolean function f(w,x,y,z) = m(0,4,5,6,13,14,15) + dc(2,7,8,9) using a variable-entered map. (a) Step 1 map and subcubes. (b) Step 2 map and subcubes.

NurulHazlina/BEE2243/Logic

2-variable map entries


x
00 w 0 0 1 01 z x 00 w 0 0 1 y 01 z z+z x 01 z y+y
NurulHazlina/BEE2243/Logic

y
x

00 w 0 0 1 y

00 w 0 0 1 0

01 0 1

2-variable map entries

xy

xy 11 z 0 10 0 0

w 0
1

00 y 0

01 1 y

w 0
1

00 y 0

01
z+z y+y

11 z 0

10 0 0

NurulHazlina/BEE2243/Logic

Maps having sum terms as entries. (a) Variableentered map. (b) Grouping the y literal. (c) Grouping the z literal. (d) Grouping the not completely covered 1-cell.

NurulHazlina/BEE2243/Logic

Maps having product terms as entries. (a) Variable-entered map. (b) Grouping the yz term. (c) Grouping the y literal.(d) Grouping the not completely covered 1-cell.

NurulHazlina/BEE2243/Logic

You might also like