0% found this document useful (0 votes)
79 views48 pages

Chapter 3-P1-KMap

The document discusses Karnaugh maps and their use for simplifying Boolean functions. Karnaugh maps arrange minterms in a grid and allow adjacent minterms to be combined to find simpler expressions. Larger maps can represent functions with more variables. Standard rules are provided for grouping cells to minimize expressions.

Uploaded by

Subhajit Mandal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views48 pages

Chapter 3-P1-KMap

The document discusses Karnaugh maps and their use for simplifying Boolean functions. Karnaugh maps arrange minterms in a grid and allow adjacent minterms to be combined to find simpler expressions. Larger maps can represent functions with more variables. Standard rules are provided for grouping cells to minimize expressions.

Uploaded by

Subhajit Mandal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

Chapter 3 : Gate-Level Minimization

• The K-Map Method


• Don’t care conditions
• NAND and NOR implementations
• Exclusive-OR function
• The Quine McCluskey Method
• Petric’s Method

Some of the figures and tables in this set of slides are obtained from material
supplied by Pearson Prentice Hall and is copyrighted. Use of this material is
permitted for academic purposes only.
Karnaugh Maps (K-map)
• A K-map is a collection of squares
• Each square represents a minterm
• The collection of squares is a graphical representation of a Boolean function
• Adjacent squares differ in the value of one variable
• Alternative algebraic expressions for the same function are derived by recognizing
patterns of squares
• The K-map can be viewed as
• A reorganized version of the truth table
• A topologically-warped Venn diagram as used to visualize sets in algebra of sets
• Provides a means for:
• Finding optimum or near optimum
• SOP and POS standard forms, and
• two-level AND/OR and OR/AND circuit implementations
for functions with small numbers of variables
Two Variable Maps
• A 2-variable Karnaugh Map: y=0 y=1
• Note that minterm m0 and
minterm m1 are “adjacent” m0 = m1 =
x=0
and differ in the value of the xy xy
variable y
x = 1 m2 = m3 =
• Similarly, minterm m0 and xy xy
minterm m2 differ in the x variable.
• Also, m1 and m3 differ in the x variable as well.
• Finally, m2 and m3 differ in the value of the variable y
K-Map and Truth Tables
• The K-Map is just a different form of the truth table.
• Example – Two variable function: We choose a,b,c and d from the set {0,1} to
implement a particular function, F(x,y).

Function Table K-Map


Input Function
Values Value y=0 y=1
(x,y) F(x,y)
00 a
x=0 a b
01 b x=1 c d
10 c
11 d
K-Map Function Representation
• Example: F(x,y) = x F=x y=0 y=1
x=0 0 0
x=1 1 1

• For function F(x,y), the two adjacent cells containing 1’s can be combined
using the Minimization Theorem:

F( x , y ) = x y + x y = x
K-Map Function Representation
• Example: G(x,y) = x + y G = x+y y = 0 y = 1
x=0 0 1

x=1 1 1

• For G(x,y), two pairs of adjacent cells containing 1’s can be combined using
the Minimization Theorem:

G( x , y ) = (x y + x y )+ (xy + x y )= x + y
Duplicate xy
Three Variable Maps
• A three-variable K-map:
yz=00 yz=01 yz=11 yz=10
x=0 m0 m1 m3 m2
x=1 m4 m5 m7 m6

• Where each minterm corresponds to the product terms:


yz=00 yz=01 yz=11 yz=10
x=0 x y z xyz xyz xyz
x=1 xyz xyz xyz xyz

• Note that if the binary value for an index differs in one bit position, the minterms
are adjacent on the K-Map
Alternative Map Labeling
• Map use largely involves:
• Entering values into the map, and
• Reading off product terms from the map.
• Alternate labelings are useful:

y y yz y
0 3 2 x 00 01 11 10
x 1

x 4 5 7 6 0 0 1 3 2

z z z x 1 4 5 7 6

z
Example Functions
• By convention, we represent the minterms of F by a "1" in the map and leave the
minterms of F blank
• Example:
y
F(x, y, z) = m(2,3,4,5)
0 1 3 2
1 1
x 41 5
1 7 6

• Example:
z
G(a, b, c) = m(3,4,6,7) y
0 1 3 2
1
x 41 5 7
1 6
1
z
Combining Squares
• By combining squares, we reduce number of literals in a product term,
reducing the literal cost, thereby reducing the other two cost criteria
• On a 3-variable K-Map:
• One square represents a minterm with three variables
• Two adjacent squares represent a product term with two variables
• Four “adjacent” terms represent a product term with one variable
• Eight “adjacent” terms is the function of all ones (no variables) = 1.
Three Variable Maps
 K-Maps can be used to simplify Boolean functions by systematic methods.
Terms are selected to cover the “1s”in the map.
 Example: Simplify F(x, y, z) = m(1,2,3,5,7)

z xy
y
1 1 1
x 1 1

z
F(x, y, z) = z+xy
Rules for Grouping squares in a K-map
• No zeros allowed in any group.
• No diagonal grouping.
• Only powers of 2 number of squares in any group.
• Groups should be as large as possible.
• All the 1s in the map must belong in some group.
• Groups can overlap.
• Groups can wrap around.
• Fewest number of groups to cover all the 1s.
Three-Variable K-Maps
f =  (0,4) = B C f =  (4,5) = A B f =  (0,1,4,5) = B f =  (0,1,2,3) = A

BC BC BC BC
A 00 01 11 10 A 00 01 11 10 A 00 01 11 10 A 00 01 11 10
0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 1 1 1
1 1 0 0 0 1 1 1 0 0 1 1 1 0 0 1 0 0 0 0

f =  (0,4) = A C f =  (4,6) = A C f =  (0,2) = A C f =  (0,2,4,6) = C

BC BC BC BC
A 00 01 11 10 A 00 01 11 10 A 00 01 11 10 A 00 01 11 10
0 0 1 1 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 1
1 0 0 0 0 1 1 0 0 1 1 0 0 0 0 1 1 0 0 1
Four Variable Maps
 Map and location of minterms:
Y
0 1 3 2

4 5 7 6

12 13 15 14 X

W 11 10
8 9

Z
Four Variable Terms

 Four variable maps can have rectangles


corresponding to:
• A single 1 = 4 variables, (i.e. Minterm)
• Two 1s = 3 variables,
• Four 1s = 2 variables
• Eight 1s = 1 variable,
• Sixteen 1s = zero variables (i.e.
Constant "1")
Four-Variable K-Maps

CD CD CD CD
AB 00 01 11 10 AB 00 01 11 10 AB 00 01 11 10 AB 00 01 11 10
00 1 0 0 0 00 0 0 0 0 00 0 0 0 0 00 0 0 0 0
01 0 0 0 0 01 0 1 0 0 01 0 0 0 0 01 1 0 0 1
11 0 0 0 0 11 0 1 0 0 11 0 1 1 0 11 0 0 0 0
10 1 0 0 0 10 0 0 0 0 10 0 0 0 0 10 0 0 0 0

f =  (0,8) = B  C  D f =  (5,13) = B  C  D f =  (13,15) = A  B  D f =  (4,6) = A  B  D

CD CD CD CD
AB 00 01 11 10 AB 00 01 11 10 AB 00 01 11 10 AB 00 01 11 10
00 0 0 1 1 00 0 0 0 0 00 0 0 1 1 00 1 0 0 1

01 0 0 1 1 01 1 0 0 1 01 0 0 0 0 01 0 0 0 0
11 0 0 0 0 11 1 0 0 1 11 0 0 0 0 11 0 0 0 0
10 0 0 0 0 10 0 0 0 0 10 0 0 1 1 10 1 0 0 1

f =  (2,3,6,7) = A  C f =  (4,6,12,14) = B  D f =  (2,3,10,11) = B  C f =  (0,2,8,10) = B  D


Four-Variable K-Maps

CD CD CD CD
00 01 11 10 00 01 11 10 00 01 11 10 00 01 11 10
AB AB AB AB
00 0 0 0 0 00 0 0 1 0 00 1 0 1 0 00 0 1 0 1
01 1 1 1 1 01 0 0 1 0 01 0 1 0 1 01 1 0 1 0
11 0 0 0 0 11 0 0 1 0 11 1 0 1 0 11 0 1 0 1
10 0 0 0 0 10 0 0 1 0 10 0 1 0 1 10 1 0 1 0

f =  (0, 3,5, 6, 9,10,12,15) f =  (1, 2, 4, 7,8,11,13,14)


f =  (4,5, 6, 7) = A  B f =  (3,7,11,15) = C  D
f = A  B C D f = A  B C D

CD CD CD CD
AB 00 01 11 10 AB 00 01 11 10 AB 00 01 11 10 AB 00 01 11 10
00 0 1 1 0 00 1 0 0 1 00 0 0 0 0 00 1 1 1 1
01 0 1 1 0 01 1 0 0 1 01 1 1 1 1 01 0 0 0 0
11 0 1 1 0 11 1 0 0 1 11 1 1 1 1 11 0 0 0 0
10 0 1 1 0 10 1 0 0 1 10 0 0 0 0 10 1 1 1 1

f =  (1, 3,5, 7, 9,11,13,15) f =  (0,2,4,6,8,10,12,14) f =  (4,5,6,7,12,13,14,15) f =  (0,1,2,3,8,9,10,11)


f=D f=D f =B f =B
Don't Cares in K-Maps
• Sometimes a function table or 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 1: 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” to represent “don’t cares.”
Don't Cares in K-Maps
• Example 2: A circuit that represents a very common situation that occurs in computer design
has two distinct sets of input variables:
• A, B, and C which take on all possible combinations, and
• Y which takes on values 0 or 1.
and a single output Z. The circuit that receives the output Z observes it only for (A,B,C) = (1,1,1)
and otherwise ignores it. Thus, Z is specified only for the combinations (A,B,C,Y) = 1110 and
1111. For these two combinations, Z = Y. For all of the 14 remaining input combinations, Z is a
don’t care.
• Ultimately, each “x” entry may take on either a 0 or 1 value in resulting solutions
• For example, an “x” may take on value “0” in an SOP solution and value “1” in a POS solution,
or vice-versa.
• Any minterm with value “x” need not be covered by a prime implicant.
Example: BCD “5 or More”
• The map below gives a function F1(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:
F1 (w,x,y,z) = w + x z + x y G=7
y This is much lower in cost than F2 where the
00 01 03 02 “don't cares” were treated as "0s."
04 15 17 16 F2(w, x, y, z) = w x z + w x y + w x y
x
X12 X13 X15 X14 G = 12
w For this particular function, cost G for the POS
1 8 1 9 X11 X10
solution for F1(w,x,y,z) is not changed by using
z the don't cares.
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 a power of 2.
 A prime implicant is called an Essential Prime Implicant if it is the only prime
implicant that covers (includes) 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.
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
• Minimize the overlap among prime implicants as much as possible. 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.
Selected Essential
C C

1 1 1 1

1 1 1 1 1 1 1 1
B B
1 1
A A
1 1 1 1

D D
Minterms covered by essential prime implicants
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
POS Simplification
• Group the 0s in the K-map to obtain the SOP for the complemented
function.
• Complement the SOP obtain to get the POS form of the required function.
• Include Don’t Cares while grouping the 0s.

Example : Y(A,B,C) = π(1,3,6,7)

SOP Expression : Y’ = A’C + AB


POS expression: Y = (A + C') .(A' + B')
POS Simplification

Example: Y(C,D,A,B) = π(3,5,7,8,10,11,12,13)

SOP expression : Y’ = AC’D’ + BC’D + A’CD + AB’C

POS expression: Y = (A’+C+D) . (B’+C+D’) .


(A+C’+D’) . (A’+B+C’)

PITFALL– Always remember POS ≠ (SOP)’


The correct form is (POS of F)=(SOP of F’)’
K-Maps of Five Variables or More
• For five variable problems, we use two adjacent K-maps. It becomes harder
to visualize adjacent minterms for selecting PIs. You can extend the problem
to six variables by using four K-Maps.
V=0 V=1
Y Y

X X

W W

Z Z
NAND and NOR Gates
NAND Gate as a Universal gate
NOR Gate as a Universal Gate
NOR Gate using NAND Gates
NAND Gate using NOR Gates
NAND and NOR Gates using DeMorgan’s Laws
Implementation of SOP (AND–OR) using NAND

Every gate just becomes a NAND. Two bubbles on the


same line cancel each other out.
Implementation of SOP (AND–OR) using NAND
Implementation of POS (OR-AND) using NOR
Implementation of POS (OR-AND) using NOR
Exclusive-OR and Exclusive-NOR Operations

x y z x y z

0 0 0 0 0 1
Truth Table
0 1 1 0 1 0

1 0 1 1 0 0

1 1 0 1 1 1
XOR Operation XNOR Operation
XOR using NAND and NOR
XNOR using NAND and NOR
XOR Operation
-- Rules

XꚚY=YꚚX
X Ꚛ Y’ = X’ Ꚛ Y = (X Ꚛ Y)’
(X Ꚛ Y) Ꚛ Z = X Ꚛ (Y Ꚛ Z)
Odd Function – Multivalued XOR
Parity Generator and Checker

The circuit that generates the parity


bit in the transmitter is called the
parity generator.

An even parity generator implements


the odd function since it generates 1
Whenever the number of 1’s in the
message is odd.
Parity Generator and Checker

The output of the parity checker C will be equal to 1 if an error occurs


– that is if the 4-bit message received has an odd number of 1’s.
4 – bit Even Parity Generation and Checking
Parity Generator – Even and Odd Parity
4-bit Comparator Circuit using XOR gates

If A=B, output = 1
Otherwise output = 0.

You might also like